1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-15 13:51:40 +00:00

ObjectTypeDB was renamed to ClassDB. Types are meant to be more generic to Variant.

All usages of "type" to refer to classes were renamed to "class"
ClassDB has been exposed to GDScript.
OBJ_TYPE() macro is now GDCLASS()
This commit is contained in:
Juan Linietsky
2017-01-02 23:03:46 -03:00
parent ce26eb74bc
commit 118eed485e
751 changed files with 8046 additions and 7810 deletions

View File

@@ -151,10 +151,10 @@ void CreateDialog::add_type(const String& p_type,HashMap<String,TreeItem*>& p_ty
if (p_types.has(p_type))
return;
if (!ObjectTypeDB::is_type(p_type,base_type) || p_type==base_type)
if (!ClassDB::is_parent_class(p_type,base_type) || p_type==base_type)
return;
String inherits=ObjectTypeDB::type_inherits_from(p_type);
String inherits=ClassDB::get_parent_class(p_type);
TreeItem *parent=p_root;
@@ -172,7 +172,7 @@ void CreateDialog::add_type(const String& p_type,HashMap<String,TreeItem*>& p_ty
TreeItem *item = search_options->create_item(parent);
item->set_text(0,p_type);
if (!ObjectTypeDB::can_instance(p_type)) {
if (!ClassDB::can_instance(p_type)) {
item->set_custom_color(0, Color(0.5,0.5,0.5) );
item->set_selectable(0,false);
} else {
@@ -191,7 +191,7 @@ void CreateDialog::add_type(const String& p_type,HashMap<String,TreeItem*>& p_ty
// don't collapse the root node
collapse &= (item != p_root);
// don't collapse abstract nodes on the first tree level
collapse &= ((parent != p_root) || (ObjectTypeDB::can_instance(p_type)));
collapse &= ((parent != p_root) || (ClassDB::can_instance(p_type)));
item->set_collapsed(collapse);
}
@@ -222,7 +222,7 @@ void CreateDialog::_update_search() {
*/
List<StringName> type_list;
ObjectTypeDB::get_type_list(&type_list);
ClassDB::get_class_list(&type_list);
HashMap<String,TreeItem*> types;
@@ -245,7 +245,7 @@ void CreateDialog::_update_search() {
if (base_type=="Node" && type.begins_with("Editor"))
continue; // do not show editor nodes
if (!ObjectTypeDB::can_instance(type))
if (!ClassDB::can_instance(type))
continue; // cant create what can't be instanced
if (search_box->get_text()=="") {
@@ -254,14 +254,14 @@ void CreateDialog::_update_search() {
bool found=false;
String type=I->get();
while(type!="" && ObjectTypeDB::is_type(type,base_type) && type!=base_type) {
while(type!="" && ClassDB::is_parent_class(type,base_type) && type!=base_type) {
if (search_box->get_text().is_subsequence_ofi(type)) {
found=true;
break;
}
type=ObjectTypeDB::type_inherits_from(type);
type=ClassDB::get_parent_class(type);
}
@@ -269,7 +269,7 @@ void CreateDialog::_update_search() {
add_type(I->get(),types,root,&to_select);
}
if (EditorNode::get_editor_data().get_custom_types().has(type) && ObjectTypeDB::is_type(type, base_type)) {
if (EditorNode::get_editor_data().get_custom_types().has(type) && ClassDB::is_parent_class(type, base_type)) {
//there are custom types based on this... cool.
//print_line("there are custom types");
@@ -412,9 +412,9 @@ Object *CreateDialog::instance_selected() {
Ref<Script> script = EditorNode::get_editor_data().get_custom_types()[custom][i].script;
String name = selected->get_text(0);
Object *ob = ObjectTypeDB::instance(custom);
Object *ob = ClassDB::instance(custom);
ERR_FAIL_COND_V(!ob,NULL);
if (ob->is_type("Node")) {
if (ob->is_class("Node")) {
ob->call("set_name",name);
}
ob->set_script(script.get_ref_ptr());
@@ -427,7 +427,7 @@ Object *CreateDialog::instance_selected() {
}
} else {
return ObjectTypeDB::instance(selected->get_text(0));
return ClassDB::instance(selected->get_text(0));
}
}
@@ -621,20 +621,20 @@ void CreateDialog::drop_data_fw(const Point2& p_point,const Variant& p_data,Cont
void CreateDialog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_text_changed"),&CreateDialog::_text_changed);
ObjectTypeDB::bind_method(_MD("_confirmed"),&CreateDialog::_confirmed);
ObjectTypeDB::bind_method(_MD("_sbox_input"),&CreateDialog::_sbox_input);
ObjectTypeDB::bind_method(_MD("_item_selected"),&CreateDialog::_item_selected);
ObjectTypeDB::bind_method(_MD("_favorite_toggled"),&CreateDialog::_favorite_toggled);
ObjectTypeDB::bind_method(_MD("_history_selected"),&CreateDialog::_history_selected);
ObjectTypeDB::bind_method(_MD("_favorite_selected"),&CreateDialog::_favorite_selected);
ObjectTypeDB::bind_method(_MD("_history_activated"),&CreateDialog::_history_activated);
ObjectTypeDB::bind_method(_MD("_favorite_activated"),&CreateDialog::_favorite_activated);
ClassDB::bind_method(_MD("_text_changed"),&CreateDialog::_text_changed);
ClassDB::bind_method(_MD("_confirmed"),&CreateDialog::_confirmed);
ClassDB::bind_method(_MD("_sbox_input"),&CreateDialog::_sbox_input);
ClassDB::bind_method(_MD("_item_selected"),&CreateDialog::_item_selected);
ClassDB::bind_method(_MD("_favorite_toggled"),&CreateDialog::_favorite_toggled);
ClassDB::bind_method(_MD("_history_selected"),&CreateDialog::_history_selected);
ClassDB::bind_method(_MD("_favorite_selected"),&CreateDialog::_favorite_selected);
ClassDB::bind_method(_MD("_history_activated"),&CreateDialog::_history_activated);
ClassDB::bind_method(_MD("_favorite_activated"),&CreateDialog::_favorite_activated);
ObjectTypeDB::bind_method("get_drag_data_fw",&CreateDialog::get_drag_data_fw);
ObjectTypeDB::bind_method("can_drop_data_fw",&CreateDialog::can_drop_data_fw);
ObjectTypeDB::bind_method("drop_data_fw",&CreateDialog::drop_data_fw);
ClassDB::bind_method("get_drag_data_fw",&CreateDialog::get_drag_data_fw);
ClassDB::bind_method("can_drop_data_fw",&CreateDialog::can_drop_data_fw);
ClassDB::bind_method("drop_data_fw",&CreateDialog::drop_data_fw);
ADD_SIGNAL(MethodInfo("create"));
@@ -740,10 +740,10 @@ void CreateDialog::add_type(const String& p_type,HashMap<String,TreeItem*>& p_ty
if (p_types.has(p_type))
return;
if (!ObjectTypeDB::is_type(p_type,base) || p_type==base)
if (!ClassDB::is_type(p_type,base) || p_type==base)
return;
String inherits=ObjectTypeDB::type_inherits_from(p_type);
String inherits=ClassDB::type_inherits_from(p_type);
TreeItem *parent=p_root;
@@ -761,7 +761,7 @@ void CreateDialog::add_type(const String& p_type,HashMap<String,TreeItem*>& p_ty
TreeItem *item = tree->create_item(parent);
item->set_text(0,p_type);
if (!ObjectTypeDB::can_instance(p_type)) {
if (!ClassDB::can_instance(p_type)) {
item->set_custom_color(0, Color(0.5,0.5,0.5) );
item->set_selectable(0,false);
}
@@ -782,7 +782,7 @@ void CreateDialog::update_tree() {
tree->clear();
List<String> type_list;
ObjectTypeDB::get_type_list(&type_list);
ClassDB::get_type_list(&type_list);
HashMap<String,TreeItem*> types;
@@ -798,7 +798,7 @@ void CreateDialog::update_tree() {
String type=I->get();
if (!ObjectTypeDB::can_instance(type))
if (!ClassDB::can_instance(type))
continue; // cant create what can't be instanced
if (filter->get_text()=="")
add_type(type,types,root);
@@ -806,14 +806,14 @@ void CreateDialog::update_tree() {
bool found=false;
String type=I->get();
while(type!="" && ObjectTypeDB::is_type(type,base) && type!=base) {
while(type!="" && ClassDB::is_type(type,base) && type!=base) {
if (type.findn(filter->get_text())!=-1) {
found=true;
break;
}
type=ObjectTypeDB::type_inherits_from(type);
type=ClassDB::type_inherits_from(type);
}
@@ -875,7 +875,7 @@ Object *CreateDialog::instance_selected() {
if (ct[i].name==name) {
Object* obj = ObjectTypeDB::instance(base);
Object* obj = ClassDB::instance(base);
ERR_FAIL_COND_V(!obj,NULL);
obj->set_script(ct[i].script.get_ref_ptr());
if (ct[i].icon.is_valid())
@@ -891,16 +891,16 @@ Object *CreateDialog::instance_selected() {
}
return ObjectTypeDB::instance(tree->get_selected()->get_text(0));
return ClassDB::instance(tree->get_selected()->get_text(0));
}
void CreateDialog::_bind_methods() {
ObjectTypeDB::bind_method("_create",&CreateDialog::_create);
ObjectTypeDB::bind_method("_cancel",&CreateDialog::_cancel);
ObjectTypeDB::bind_method("_text_changed", &CreateDialog::_text_changed);
ClassDB::bind_method("_create",&CreateDialog::_create);
ClassDB::bind_method("_cancel",&CreateDialog::_cancel);
ClassDB::bind_method("_text_changed", &CreateDialog::_text_changed);
ADD_SIGNAL( MethodInfo("create"));
}