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

Merge pull request #16995 from mrcdk/custom_resources_inspector

The inspector will show the custom resources added via plugin
This commit is contained in:
Juan Linietsky
2018-04-08 11:49:34 -03:00
committed by GitHub
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));
}