1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-20 14:45:44 +00:00

Now the inspector will show the custom resources added via plugin

This commit is contained in:
MrCdK
2018-02-25 01:41:26 +01:00
parent 3647ebc834
commit 97e77688bb
4 changed files with 70 additions and 23 deletions

View File

@@ -433,26 +433,7 @@ Object *CreateDialog::instance_selected() {
custom = md;
if (custom != String()) {
if (EditorNode::get_editor_data().get_custom_types().has(custom)) {
for (int i = 0; i < EditorNode::get_editor_data().get_custom_types()[custom].size(); i++) {
if (EditorNode::get_editor_data().get_custom_types()[custom][i].name == selected->get_text(0)) {
Ref<Texture> icon = EditorNode::get_editor_data().get_custom_types()[custom][i].icon;
Ref<Script> script = EditorNode::get_editor_data().get_custom_types()[custom][i].script;
String name = selected->get_text(0);
Object *ob = ClassDB::instance(custom);
ERR_FAIL_COND_V(!ob, NULL);
if (ob->is_class("Node")) {
ob->call("set_name", name);
}
ob->set_script(script.get_ref_ptr());
if (icon.is_valid())
ob->set_meta("_editor_icon", icon);
return ob;
}
}
}
return EditorNode::get_editor_data().instance_custom_type(selected->get_text(0), custom);
} else {
return ClassDB::instance(selected->get_text(0));
}