summaryrefslogtreecommitdiff
path: root/editor/editor_properties.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_properties.cpp')
-rw-r--r--editor/editor_properties.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 5abcae80e0..9902d8d3e7 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -1530,6 +1530,8 @@ void EditorPropertyNodePath::_node_selected(const NodePath &p_path) {
void EditorPropertyNodePath::_node_assign() {
if (!scene_tree) {
scene_tree = memnew(SceneTreeDialog);
+ scene_tree->get_scene_tree()->set_show_enabled_subscene(true);
+ scene_tree->get_scene_tree()->set_valid_types(valid_types);
add_child(scene_tree);
scene_tree->connect("selected", this, "_node_selected");
}
@@ -1584,9 +1586,10 @@ void EditorPropertyNodePath::update_property() {
assign->set_icon(icon);
}
-void EditorPropertyNodePath::setup(const NodePath &p_base_hint) {
+void EditorPropertyNodePath::setup(const NodePath &p_base_hint, Vector<StringName> p_valid_types) {
base_hint = p_base_hint;
+ valid_types = p_valid_types;
}
void EditorPropertyNodePath::_notification(int p_what) {
@@ -1779,6 +1782,7 @@ void EditorPropertyResource::_menu_option(int p_which) {
if (!scene_tree) {
scene_tree = memnew(SceneTreeDialog);
+ scene_tree->get_scene_tree()->set_show_enabled_subscene(true);
add_child(scene_tree);
scene_tree->connect("selected", this, "_viewport_selected");
scene_tree->set_title(TTR("Pick a Viewport"));
@@ -2665,7 +2669,12 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
EditorPropertyNodePath *editor = memnew(EditorPropertyNodePath);
if (p_hint == PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE && p_hint_text != String()) {
- editor->setup(p_hint_text);
+ editor->setup(p_hint_text, Vector<StringName>());
+ }
+ if (p_hint == PROPERTY_HINT_NODE_PATH_VALID_TYPES && p_hint_text != String()) {
+ Vector<String> types = p_hint_text.split(",", false);
+ Vector<StringName> sn = Variant(types); //convert via variant
+ editor->setup(NodePath(), sn);
}
add_property_editor(p_path, editor);
@@ -2684,34 +2693,42 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
} break;
case Variant::ARRAY: {
EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::ARRAY);
add_property_editor(p_path, editor);
} break;
case Variant::POOL_BYTE_ARRAY: {
EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_BYTE_ARRAY);
add_property_editor(p_path, editor);
} break; // 20
case Variant::POOL_INT_ARRAY: {
EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_INT_ARRAY);
add_property_editor(p_path, editor);
} break;
case Variant::POOL_REAL_ARRAY: {
EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_REAL_ARRAY);
add_property_editor(p_path, editor);
} break;
case Variant::POOL_STRING_ARRAY: {
EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_STRING_ARRAY);
add_property_editor(p_path, editor);
} break;
case Variant::POOL_VECTOR2_ARRAY: {
EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_VECTOR2_ARRAY);
add_property_editor(p_path, editor);
} break;
case Variant::POOL_VECTOR3_ARRAY: {
EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_VECTOR3_ARRAY);
add_property_editor(p_path, editor);
} break; // 25
case Variant::POOL_COLOR_ARRAY: {
EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_COLOR_ARRAY);
add_property_editor(p_path, editor);
} break;
default: {}