diff options
Diffstat (limited to 'editor/editor_properties.cpp')
-rw-r--r-- | editor/editor_properties.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 6684fe1abb..3d6ff233e3 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -1828,11 +1828,14 @@ void EditorPropertyNodePath::_node_selected(const NodePath &p_path) { NodePath path = p_path; Node *base_node = Object::cast_to<Node>(get_edited_object()); if (!base_node) { - //try a base node within history - if (EditorNode::get_singleton()->get_editor_history()->get_path_size() > 0) { - Object *base = ObjectDB::get_instance(EditorNode::get_singleton()->get_editor_history()->get_path_object(0)); - if (base) { - base_node = Object::cast_to<Node>(base); + + if (guess_path_from_editor_history) { + //try a base node within history + if (EditorNode::get_singleton()->get_editor_history()->get_path_size() > 0) { + Object *base = ObjectDB::get_instance(EditorNode::get_singleton()->get_editor_history()->get_path_object(0)); + if (base) { + base_node = Object::cast_to<Node>(base); + } } } } @@ -1912,10 +1915,11 @@ void EditorPropertyNodePath::update_property() { assign->set_icon(EditorNode::get_singleton()->get_object_icon(target_node, "Node")); } -void EditorPropertyNodePath::setup(const NodePath &p_base_hint, Vector<StringName> p_valid_types) { +void EditorPropertyNodePath::setup(const NodePath &p_base_hint, Vector<StringName> p_valid_types, bool p_guess_path_from_editor_history) { base_hint = p_base_hint; valid_types = p_valid_types; + guess_path_from_editor_history = guess_path_from_editor_history; } void EditorPropertyNodePath::_notification(int p_what) { @@ -1948,6 +1952,7 @@ EditorPropertyNodePath::EditorPropertyNodePath() { clear->set_flat(true); clear->connect("pressed", this, "_node_clear"); hbc->add_child(clear); + guess_path_from_editor_history = false; scene_tree = NULL; //do not allocate unnecessarily } @@ -3124,12 +3129,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, Vector<StringName>()); + editor->setup(p_hint_text, Vector<StringName>(), !(p_usage & PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT)); } 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); + editor->setup(NodePath(), sn, !(p_usage & PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT)); } add_property_editor(p_path, editor); |