wtf
This commit is contained in:
@ -1826,10 +1826,12 @@ EditorPropertyColor::EditorPropertyColor() {
|
|||||||
void EditorPropertyNodePath::_node_selected(const NodePath &p_path) {
|
void EditorPropertyNodePath::_node_selected(const NodePath &p_path) {
|
||||||
|
|
||||||
NodePath path = p_path;
|
NodePath path = p_path;
|
||||||
Node *base_node = Object::cast_to<Node>(get_edited_object());
|
Node *base_node = NULL;
|
||||||
if (!base_node) {
|
|
||||||
|
|
||||||
if (guess_path_from_editor_history) {
|
if (!use_path_from_scene_root) {
|
||||||
|
base_node = Object::cast_to<Node>(get_edited_object());
|
||||||
|
|
||||||
|
if (!base_node) {
|
||||||
//try a base node within history
|
//try a base node within history
|
||||||
if (EditorNode::get_singleton()->get_editor_history()->get_path_size() > 0) {
|
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));
|
Object *base = ObjectDB::get_instance(EditorNode::get_singleton()->get_editor_history()->get_path_object(0));
|
||||||
@ -1915,11 +1917,11 @@ void EditorPropertyNodePath::update_property() {
|
|||||||
assign->set_icon(EditorNode::get_singleton()->get_object_icon(target_node, "Node"));
|
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, bool p_guess_path_from_editor_history) {
|
void EditorPropertyNodePath::setup(const NodePath &p_base_hint, Vector<StringName> p_valid_types, bool p_use_path_from_scene_root) {
|
||||||
|
|
||||||
base_hint = p_base_hint;
|
base_hint = p_base_hint;
|
||||||
valid_types = p_valid_types;
|
valid_types = p_valid_types;
|
||||||
guess_path_from_editor_history = guess_path_from_editor_history;
|
use_path_from_scene_root = p_use_path_from_scene_root;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyNodePath::_notification(int p_what) {
|
void EditorPropertyNodePath::_notification(int p_what) {
|
||||||
@ -1952,7 +1954,7 @@ EditorPropertyNodePath::EditorPropertyNodePath() {
|
|||||||
clear->set_flat(true);
|
clear->set_flat(true);
|
||||||
clear->connect("pressed", this, "_node_clear");
|
clear->connect("pressed", this, "_node_clear");
|
||||||
hbc->add_child(clear);
|
hbc->add_child(clear);
|
||||||
guess_path_from_editor_history = false;
|
use_path_from_scene_root = false;
|
||||||
|
|
||||||
scene_tree = NULL; //do not allocate unnecessarily
|
scene_tree = NULL; //do not allocate unnecessarily
|
||||||
}
|
}
|
||||||
@ -3129,12 +3131,12 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
|
|||||||
|
|
||||||
EditorPropertyNodePath *editor = memnew(EditorPropertyNodePath);
|
EditorPropertyNodePath *editor = memnew(EditorPropertyNodePath);
|
||||||
if (p_hint == PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE && p_hint_text != String()) {
|
if (p_hint == PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE && p_hint_text != String()) {
|
||||||
editor->setup(p_hint_text, Vector<StringName>(), !(p_usage & PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT));
|
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()) {
|
if (p_hint == PROPERTY_HINT_NODE_PATH_VALID_TYPES && p_hint_text != String()) {
|
||||||
Vector<String> types = p_hint_text.split(",", false);
|
Vector<String> types = p_hint_text.split(",", false);
|
||||||
Vector<StringName> sn = Variant(types); //convert via variant
|
Vector<StringName> sn = Variant(types); //convert via variant
|
||||||
editor->setup(NodePath(), sn, !(p_usage & PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT));
|
editor->setup(NodePath(), sn, (p_usage & PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT));
|
||||||
}
|
}
|
||||||
add_property_editor(p_path, editor);
|
add_property_editor(p_path, editor);
|
||||||
|
|
||||||
|
|||||||
@ -499,7 +499,7 @@ class EditorPropertyNodePath : public EditorProperty {
|
|||||||
Button *clear;
|
Button *clear;
|
||||||
SceneTreeDialog *scene_tree;
|
SceneTreeDialog *scene_tree;
|
||||||
NodePath base_hint;
|
NodePath base_hint;
|
||||||
bool guess_path_from_editor_history;
|
bool use_path_from_scene_root;
|
||||||
|
|
||||||
Vector<StringName> valid_types;
|
Vector<StringName> valid_types;
|
||||||
void _node_selected(const NodePath &p_path);
|
void _node_selected(const NodePath &p_path);
|
||||||
@ -512,7 +512,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void update_property();
|
virtual void update_property();
|
||||||
void setup(const NodePath &p_base_hint, Vector<StringName> p_valid_types, bool p_guess_path_from_editor_history = true);
|
void setup(const NodePath &p_base_hint, Vector<StringName> p_valid_types, bool p_use_path_from_scene_root = true);
|
||||||
EditorPropertyNodePath();
|
EditorPropertyNodePath();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user