aboutsummaryrefslogtreecommitdiff
path: root/editor/property_editor.cpp
diff options
context:
space:
mode:
authorRémi Verschelde2017-04-07 08:54:39 +0200
committerGitHub2017-04-07 08:54:39 +0200
commit2ee9e033ecdb39d25a958141179c5caea9690a76 (patch)
treeca4419c9691dc6a60274c6889b39428a099dbb26 /editor/property_editor.cpp
parentf7c3ecb38c807da3bac50676b3914ce530910352 (diff)
parentd90809151fb25d98ef9b1f5f95fc7575084e3218 (diff)
downloadgodot-2ee9e033ecdb39d25a958141179c5caea9690a76.tar.gz
godot-2ee9e033ecdb39d25a958141179c5caea9690a76.tar.zst
godot-2ee9e033ecdb39d25a958141179c5caea9690a76.zip
Merge pull request #8202 from williamd1k0/add-script-button
Add Attach and Clear Script buttons (2.1)
Diffstat (limited to 'editor/property_editor.cpp')
-rw-r--r--editor/property_editor.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 1b99ecdd7..1d0449e44 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -194,6 +194,12 @@ void CustomPropertyEditor::_menu_option(int p_which) {
}
}
} break;
+ case OBJ_MENU_NEW_SCRIPT: {
+
+ if (owner->cast_to<Node>())
+ EditorNode::get_singleton()->get_scene_tree_dock()->open_script_dialog(owner->cast_to<Node>());
+
+ } break;
default: {
ERR_FAIL_COND(inheritors_array.empty());
@@ -212,6 +218,7 @@ void CustomPropertyEditor::_menu_option(int p_which) {
}
} break;
+
default: {}
}
}
@@ -647,7 +654,10 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
menu->clear();
menu->set_size(Size2(1, 1));
- if (hint_text != "") {
+ if (p_name=="script/script" && hint_text=="Script" && owner->cast_to<Node>()) {
+ menu->add_icon_item(get_icon("Script","EditorIcons"),TTR("New Script"),OBJ_MENU_NEW_SCRIPT);
+ menu->add_separator();
+ } else if (hint_text!="") {
int idx = 0;
for (int i = 0; i < hint_text.get_slice_count(","); i++) {