diff options
Diffstat (limited to 'modules/visual_script')
-rw-r--r-- | modules/visual_script/editor/visual_script_editor.cpp | 15 | ||||
-rw-r--r-- | modules/visual_script/editor/visual_script_editor.h | 6 | ||||
-rw-r--r-- | modules/visual_script/visual_script_func_nodes.cpp | 194 | ||||
-rw-r--r-- | modules/visual_script/visual_script_func_nodes.h | 8 | ||||
-rw-r--r-- | modules/visual_script/visual_script_nodes.cpp | 74 | ||||
-rw-r--r-- | modules/visual_script/visual_script_nodes.h | 20 | ||||
-rw-r--r-- | modules/visual_script/visual_script_yield_nodes.cpp | 24 | ||||
-rw-r--r-- | modules/visual_script/visual_script_yield_nodes.h | 4 |
8 files changed, 171 insertions, 174 deletions
diff --git a/modules/visual_script/editor/visual_script_editor.cpp b/modules/visual_script/editor/visual_script_editor.cpp index 7f8e9d8254..fec48d1807 100644 --- a/modules/visual_script/editor/visual_script_editor.cpp +++ b/modules/visual_script/editor/visual_script_editor.cpp @@ -43,6 +43,7 @@ #include "editor/editor_resource_preview.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" +#include "editor/editor_undo_redo_manager.h" #include "scene/gui/check_button.h" #include "scene/gui/graph_edit.h" #include "scene/gui/separator.h" @@ -74,7 +75,7 @@ class VisualScriptEditorSignalEdit : public Object { StringName sig; public: - UndoRedo *undo_redo; + Ref<EditorUndoRedoManager> undo_redo; Ref<VisualScript> script; protected: @@ -197,8 +198,6 @@ public: sig = p_sig; notify_property_list_changed(); } - - VisualScriptEditorSignalEdit() { undo_redo = nullptr; } }; class VisualScriptEditorVariableEdit : public Object { @@ -207,7 +206,7 @@ class VisualScriptEditorVariableEdit : public Object { StringName var; public: - UndoRedo *undo_redo; + Ref<EditorUndoRedoManager> undo_redo; Ref<VisualScript> script; protected: @@ -355,8 +354,6 @@ public: var = p_var; notify_property_list_changed(); } - - VisualScriptEditorVariableEdit() { undo_redo = nullptr; } }; static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) { @@ -2853,8 +2850,8 @@ void VisualScriptEditor::reload(bool p_soft) { _update_graph(); } -Array VisualScriptEditor::get_breakpoints() { - Array breakpoints; +PackedInt32Array VisualScriptEditor::get_breakpoints() { + PackedInt32Array breakpoints; List<StringName> functions; script->get_function_list(&functions); for (int i = 0; i < functions.size(); i++) { @@ -2936,7 +2933,7 @@ Control *VisualScriptEditor::get_edit_menu() { } void VisualScriptEditor::_change_base_type() { - select_base_type->popup_create(true, true); + select_base_type->popup_create(true, true, script->get_instance_base_type()); } void VisualScriptEditor::_toggle_tool_script() { diff --git a/modules/visual_script/editor/visual_script_editor.h b/modules/visual_script/editor/visual_script_editor.h index 6b337e52f6..0378da9700 100644 --- a/modules/visual_script/editor/visual_script_editor.h +++ b/modules/visual_script/editor/visual_script_editor.h @@ -38,6 +38,7 @@ class GraphEdit; +class EditorUndoRedoManager; class VisualScriptEditorSignalEdit; class VisualScriptEditorVariableEdit; @@ -135,8 +136,7 @@ class VisualScriptEditor : public ScriptEditorBase { EditorProperty *default_property_editor = nullptr; Ref<VisualScriptEditedProperty> edited_default_property_holder; - UndoRedo *undo_redo = nullptr; - + Ref<EditorUndoRedoManager> undo_redo; Tree *members = nullptr; AcceptDialog *function_name_edit = nullptr; LineEdit *function_name_box = nullptr; @@ -341,7 +341,7 @@ public: virtual void ensure_focus() override; virtual void tag_saved_version() override; virtual void reload(bool p_soft) override; - virtual Array get_breakpoints() override; + virtual PackedInt32Array get_breakpoints() override; virtual void set_breakpoint(int p_line, bool p_enable) override{}; virtual void clear_breakpoints() override{}; virtual void add_callback(const String &p_function, PackedStringArray p_args) override; diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index b16358ae38..e79d3bae8a 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -512,32 +512,32 @@ Dictionary VisualScriptFunctionCall::_get_argument_cache() const { return method_cache; } -void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const { - if (property.name == "base_type") { +void VisualScriptFunctionCall::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "base_type") { if (call_mode != CALL_MODE_INSTANCE) { - property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL; + p_property.usage = PROPERTY_USAGE_NO_EDITOR; } } - if (property.name == "base_script") { + if (p_property.name == "base_script") { if (call_mode != CALL_MODE_INSTANCE) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } } - if (property.name == "basic_type") { + if (p_property.name == "basic_type") { if (call_mode != CALL_MODE_BASIC_TYPE) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } } - if (property.name == "singleton") { + if (p_property.name == "singleton") { if (call_mode != CALL_MODE_SINGLETON) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } else { List<Engine::Singleton> names; Engine::get_singleton()->get_singletons(&names); - property.hint = PROPERTY_HINT_ENUM; + p_property.hint = PROPERTY_HINT_ENUM; String sl; for (const Engine::Singleton &E : names) { if (!sl.is_empty()) { @@ -545,41 +545,41 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const } sl += E.name; } - property.hint_string = sl; + p_property.hint_string = sl; } } - if (property.name == "node_path") { + if (p_property.name == "node_path") { if (call_mode != CALL_MODE_NODE_PATH) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } else { Node *bnode = _get_base_node(); if (bnode) { - property.hint_string = bnode->get_path(); //convert to long string + p_property.hint_string = bnode->get_path(); //convert to long string } } } - if (property.name == "function") { + if (p_property.name == "function") { if (call_mode == CALL_MODE_BASIC_TYPE) { - property.hint = PROPERTY_HINT_METHOD_OF_VARIANT_TYPE; - property.hint_string = Variant::get_type_name(basic_type); + p_property.hint = PROPERTY_HINT_METHOD_OF_VARIANT_TYPE; + p_property.hint_string = Variant::get_type_name(basic_type); } else if (call_mode == CALL_MODE_SELF && get_visual_script().is_valid()) { - property.hint = PROPERTY_HINT_METHOD_OF_SCRIPT; - property.hint_string = itos(get_visual_script()->get_instance_id()); + p_property.hint = PROPERTY_HINT_METHOD_OF_SCRIPT; + p_property.hint_string = itos(get_visual_script()->get_instance_id()); } else if (call_mode == CALL_MODE_SINGLETON) { Object *obj = Engine::get_singleton()->get_singleton_object(singleton); if (obj) { - property.hint = PROPERTY_HINT_METHOD_OF_INSTANCE; - property.hint_string = itos(obj->get_instance_id()); + p_property.hint = PROPERTY_HINT_METHOD_OF_INSTANCE; + p_property.hint_string = itos(obj->get_instance_id()); } else { - property.hint = PROPERTY_HINT_METHOD_OF_BASE_TYPE; - property.hint_string = base_type; //should be cached + p_property.hint = PROPERTY_HINT_METHOD_OF_BASE_TYPE; + p_property.hint_string = base_type; //should be cached } } else if (call_mode == CALL_MODE_INSTANCE) { - property.hint = PROPERTY_HINT_METHOD_OF_BASE_TYPE; - property.hint_string = base_type; + p_property.hint = PROPERTY_HINT_METHOD_OF_BASE_TYPE; + p_property.hint_string = base_type; if (!base_script.is_empty()) { if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) { @@ -589,8 +589,8 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const if (ResourceCache::has(base_script)) { Ref<Script> script = ResourceCache::get_ref(base_script); if (script.is_valid()) { - property.hint = PROPERTY_HINT_METHOD_OF_SCRIPT; - property.hint_string = itos(script->get_instance_id()); + p_property.hint = PROPERTY_HINT_METHOD_OF_SCRIPT; + p_property.hint_string = itos(script->get_instance_id()); } } } @@ -598,17 +598,17 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const } else if (call_mode == CALL_MODE_NODE_PATH) { Node *node = _get_base_node(); if (node) { - property.hint = PROPERTY_HINT_METHOD_OF_INSTANCE; - property.hint_string = itos(node->get_instance_id()); + p_property.hint = PROPERTY_HINT_METHOD_OF_INSTANCE; + p_property.hint_string = itos(node->get_instance_id()); } else { - property.hint = PROPERTY_HINT_METHOD_OF_BASE_TYPE; - property.hint_string = get_base_type(); + p_property.hint = PROPERTY_HINT_METHOD_OF_BASE_TYPE; + p_property.hint_string = get_base_type(); } } } - if (property.name == "use_default_args") { - property.hint = PROPERTY_HINT_RANGE; + if (p_property.name == "use_default_args") { + p_property.hint = PROPERTY_HINT_RANGE; int mc = 0; @@ -622,15 +622,15 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const } if (mc == 0) { - property.usage = PROPERTY_USAGE_NONE; //do not show + p_property.usage = PROPERTY_USAGE_NONE; //do not show } else { - property.hint_string = "0," + itos(mc) + ",1"; + p_property.hint_string = "0," + itos(mc) + ",1"; } } - if (property.name == "rpc_call_mode") { + if (p_property.name == "rpc_call_mode") { if (call_mode == CALL_MODE_BASIC_TYPE) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } } } @@ -1290,47 +1290,47 @@ VisualScriptPropertySet::AssignOp VisualScriptPropertySet::get_assign_op() const return assign_op; } -void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const { - if (property.name == "base_type") { +void VisualScriptPropertySet::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "base_type") { if (call_mode != CALL_MODE_INSTANCE) { - property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL; + p_property.usage = PROPERTY_USAGE_NO_EDITOR; } } - if (property.name == "base_script") { + if (p_property.name == "base_script") { if (call_mode != CALL_MODE_INSTANCE) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } } - if (property.name == "basic_type") { + if (p_property.name == "basic_type") { if (call_mode != CALL_MODE_BASIC_TYPE) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } } - if (property.name == "node_path") { + if (p_property.name == "node_path") { if (call_mode != CALL_MODE_NODE_PATH) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } else { Node *bnode = _get_base_node(); if (bnode) { - property.hint_string = bnode->get_path(); //convert to long string + p_property.hint_string = bnode->get_path(); //convert to long string } } } - if (property.name == "property") { + if (p_property.name == "property") { if (call_mode == CALL_MODE_BASIC_TYPE) { - property.hint = PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE; - property.hint_string = Variant::get_type_name(basic_type); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE; + p_property.hint_string = Variant::get_type_name(basic_type); } else if (call_mode == CALL_MODE_SELF && get_visual_script().is_valid()) { - property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; - property.hint_string = itos(get_visual_script()->get_instance_id()); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; + p_property.hint_string = itos(get_visual_script()->get_instance_id()); } else if (call_mode == CALL_MODE_INSTANCE) { - property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; - property.hint_string = base_type; + p_property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; + p_property.hint_string = base_type; if (!base_script.is_empty()) { if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) { @@ -1340,8 +1340,8 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const { if (ResourceCache::has(base_script)) { Ref<Script> script = ResourceCache::get_ref(base_script); if (script.is_valid()) { - property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; - property.hint_string = itos(script->get_instance_id()); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; + p_property.hint_string = itos(script->get_instance_id()); } } } @@ -1349,16 +1349,16 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const { } else if (call_mode == CALL_MODE_NODE_PATH) { Node *node = _get_base_node(); if (node) { - property.hint = PROPERTY_HINT_PROPERTY_OF_INSTANCE; - property.hint_string = itos(node->get_instance_id()); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_INSTANCE; + p_property.hint_string = itos(node->get_instance_id()); } else { - property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; - property.hint_string = get_base_type(); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; + p_property.hint_string = get_base_type(); } } } - if (property.name == "index") { + if (p_property.name == "index") { Callable::CallError ce; Variant v; Variant::construct(type_cache.type, v, nullptr, 0, ce); @@ -1369,11 +1369,11 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const { options += "," + E.name; } - property.hint = PROPERTY_HINT_ENUM; - property.hint_string = options; - property.type = Variant::STRING; + p_property.hint = PROPERTY_HINT_ENUM; + p_property.hint_string = options; + p_property.type = Variant::STRING; if (options.is_empty()) { - property.usage = PROPERTY_USAGE_NONE; //hide if type has no usable index + p_property.usage = PROPERTY_USAGE_NONE; //hide if type has no usable index } } } @@ -1996,47 +1996,47 @@ StringName VisualScriptPropertyGet::get_index() const { return index; } -void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const { - if (property.name == "base_type") { +void VisualScriptPropertyGet::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "base_type") { if (call_mode != CALL_MODE_INSTANCE) { - property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL; + p_property.usage = PROPERTY_USAGE_NO_EDITOR; } } - if (property.name == "base_script") { + if (p_property.name == "base_script") { if (call_mode != CALL_MODE_INSTANCE) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } } - if (property.name == "basic_type") { + if (p_property.name == "basic_type") { if (call_mode != CALL_MODE_BASIC_TYPE) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } } - if (property.name == "node_path") { + if (p_property.name == "node_path") { if (call_mode != CALL_MODE_NODE_PATH) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } else { Node *bnode = _get_base_node(); if (bnode) { - property.hint_string = bnode->get_path(); //convert to long string + p_property.hint_string = bnode->get_path(); //convert to long string } } } - if (property.name == "property") { + if (p_property.name == "property") { if (call_mode == CALL_MODE_BASIC_TYPE) { - property.hint = PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE; - property.hint_string = Variant::get_type_name(basic_type); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE; + p_property.hint_string = Variant::get_type_name(basic_type); } else if (call_mode == CALL_MODE_SELF && get_visual_script().is_valid()) { - property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; - property.hint_string = itos(get_visual_script()->get_instance_id()); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; + p_property.hint_string = itos(get_visual_script()->get_instance_id()); } else if (call_mode == CALL_MODE_INSTANCE) { - property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; - property.hint_string = base_type; + p_property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; + p_property.hint_string = base_type; if (!base_script.is_empty()) { if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) { @@ -2046,24 +2046,24 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const { if (ResourceCache::has(base_script)) { Ref<Script> script = ResourceCache::get_ref(base_script); if (script.is_valid()) { - property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; - property.hint_string = itos(script->get_instance_id()); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; + p_property.hint_string = itos(script->get_instance_id()); } } } } else if (call_mode == CALL_MODE_NODE_PATH) { Node *node = _get_base_node(); if (node) { - property.hint = PROPERTY_HINT_PROPERTY_OF_INSTANCE; - property.hint_string = itos(node->get_instance_id()); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_INSTANCE; + p_property.hint_string = itos(node->get_instance_id()); } else { - property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; - property.hint_string = get_base_type(); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; + p_property.hint_string = get_base_type(); } } } - if (property.name == "index") { + if (p_property.name == "index") { Callable::CallError ce; Variant v; Variant::construct(type_cache, v, nullptr, 0, ce); @@ -2074,11 +2074,11 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const { options += "," + E.name; } - property.hint = PROPERTY_HINT_ENUM; - property.hint_string = options; - property.type = Variant::STRING; + p_property.hint = PROPERTY_HINT_ENUM; + p_property.hint_string = options; + p_property.type = Variant::STRING; if (options.is_empty()) { - property.usage = PROPERTY_USAGE_NONE; //hide if type has no usable index + p_property.usage = PROPERTY_USAGE_NONE; //hide if type has no usable index } } } @@ -2322,9 +2322,9 @@ StringName VisualScriptEmitSignal::get_signal() const { return name; } -void VisualScriptEmitSignal::_validate_property(PropertyInfo &property) const { - if (property.name == "signal") { - property.hint = PROPERTY_HINT_ENUM; +void VisualScriptEmitSignal::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "signal") { + p_property.hint = PROPERTY_HINT_ENUM; List<StringName> sigs; List<MethodInfo> base_sigs; @@ -2349,7 +2349,7 @@ void VisualScriptEmitSignal::_validate_property(PropertyInfo &property) const { ml += E.name; } - property.hint_string = ml; + p_property.hint_string = ml; } } diff --git a/modules/visual_script/visual_script_func_nodes.h b/modules/visual_script/visual_script_func_nodes.h index 886ed7bc81..70f601307b 100644 --- a/modules/visual_script/visual_script_func_nodes.h +++ b/modules/visual_script/visual_script_func_nodes.h @@ -75,7 +75,7 @@ private: Dictionary _get_argument_cache() const; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); @@ -187,7 +187,7 @@ private: void _adjust_input_index(PropertyInfo &pinfo) const; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); @@ -275,7 +275,7 @@ private: void _adjust_input_index(PropertyInfo &pinfo) const; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); @@ -330,7 +330,7 @@ private: StringName name; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 5907e6a489..f02a79a617 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -1299,8 +1299,8 @@ StringName VisualScriptVariableGet::get_variable() const { return variable; } -void VisualScriptVariableGet::_validate_property(PropertyInfo &property) const { - if (property.name == "var_name" && get_visual_script().is_valid()) { +void VisualScriptVariableGet::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "var_name" && get_visual_script().is_valid()) { Ref<VisualScript> vs = get_visual_script(); List<StringName> vars; vs->get_variable_list(&vars); @@ -1314,8 +1314,8 @@ void VisualScriptVariableGet::_validate_property(PropertyInfo &property) const { vhint += E.operator String(); } - property.hint = PROPERTY_HINT_ENUM; - property.hint_string = vhint; + p_property.hint = PROPERTY_HINT_ENUM; + p_property.hint_string = vhint; } } @@ -1409,8 +1409,8 @@ StringName VisualScriptVariableSet::get_variable() const { return variable; } -void VisualScriptVariableSet::_validate_property(PropertyInfo &property) const { - if (property.name == "var_name" && get_visual_script().is_valid()) { +void VisualScriptVariableSet::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "var_name" && get_visual_script().is_valid()) { Ref<VisualScript> vs = get_visual_script(); List<StringName> vars; vs->get_variable_list(&vars); @@ -1424,8 +1424,8 @@ void VisualScriptVariableSet::_validate_property(PropertyInfo &property) const { vhint += E.operator String(); } - property.hint = PROPERTY_HINT_ENUM; - property.hint_string = vhint; + p_property.hint = PROPERTY_HINT_ENUM; + p_property.hint_string = vhint; } } @@ -1533,11 +1533,11 @@ Variant VisualScriptConstant::get_constant_value() const { return value; } -void VisualScriptConstant::_validate_property(PropertyInfo &property) const { - if (property.name == "value") { - property.type = type; +void VisualScriptConstant::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "value") { + p_property.type = type; if (type == Variant::NIL) { - property.usage = PROPERTY_USAGE_NONE; //do not save if nil + p_property.usage = PROPERTY_USAGE_NONE; //do not save if nil } } } @@ -1982,17 +1982,17 @@ VisualScriptNodeInstance *VisualScriptClassConstant::instantiate(VisualScriptIns return instance; } -void VisualScriptClassConstant::_validate_property(PropertyInfo &property) const { - if (property.name == "constant") { +void VisualScriptClassConstant::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "constant") { List<String> constants; ClassDB::get_integer_constant_list(base_type, &constants, true); - property.hint_string = ""; + p_property.hint_string = ""; for (const String &E : constants) { - if (!property.hint_string.is_empty()) { - property.hint_string += ","; + if (!p_property.hint_string.is_empty()) { + p_property.hint_string += ","; } - property.hint_string += E; + p_property.hint_string += E; } } } @@ -2115,21 +2115,21 @@ VisualScriptNodeInstance *VisualScriptBasicTypeConstant::instantiate(VisualScrip return instance; } -void VisualScriptBasicTypeConstant::_validate_property(PropertyInfo &property) const { - if (property.name == "constant") { +void VisualScriptBasicTypeConstant::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "constant") { List<StringName> constants; Variant::get_constants_for_type(type, &constants); if (constants.size() == 0) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; return; } - property.hint_string = ""; + p_property.hint_string = ""; for (const StringName &E : constants) { - if (!property.hint_string.is_empty()) { - property.hint_string += ","; + if (!p_property.hint_string.is_empty()) { + p_property.hint_string += ","; } - property.hint_string += String(E); + p_property.hint_string += String(E); } } } @@ -2344,7 +2344,7 @@ VisualScriptEngineSingleton::TypeGuess VisualScriptEngineSingleton::guess_output return tg; } -void VisualScriptEngineSingleton::_validate_property(PropertyInfo &property) const { +void VisualScriptEngineSingleton::_validate_property(PropertyInfo &p_property) const { String cc; List<Engine::Singleton> singletons; @@ -2362,8 +2362,8 @@ void VisualScriptEngineSingleton::_validate_property(PropertyInfo &property) con cc += E.name; } - property.hint = PROPERTY_HINT_ENUM; - property.hint_string = cc; + p_property.hint = PROPERTY_HINT_ENUM; + p_property.hint_string = cc; } void VisualScriptEngineSingleton::_bind_methods() { @@ -2525,9 +2525,9 @@ VisualScriptSceneNode::TypeGuess VisualScriptSceneNode::guess_output_type(TypeGu return tg; } -void VisualScriptSceneNode::_validate_property(PropertyInfo &property) const { +void VisualScriptSceneNode::_validate_property(PropertyInfo &p_property) const { #ifdef TOOLS_ENABLED - if (property.name == "node_path") { + if (p_property.name == "node_path") { Ref<Script> script = get_visual_script(); if (!script.is_valid()) { return; @@ -2552,7 +2552,7 @@ void VisualScriptSceneNode::_validate_property(PropertyInfo &property) const { return; } - property.hint_string = script_node->get_path(); + p_property.hint_string = script_node->get_path(); } #endif } @@ -2646,7 +2646,7 @@ VisualScriptSceneTree::TypeGuess VisualScriptSceneTree::guess_output_type(TypeGu return tg; } -void VisualScriptSceneTree::_validate_property(PropertyInfo &property) const { +void VisualScriptSceneTree::_validate_property(PropertyInfo &p_property) const { } void VisualScriptSceneTree::_bind_methods() { @@ -3757,9 +3757,9 @@ VisualScriptNodeInstance *VisualScriptInputAction::instantiate(VisualScriptInsta return instance; } -void VisualScriptInputAction::_validate_property(PropertyInfo &property) const { - if (property.name == "action") { - property.hint = PROPERTY_HINT_ENUM; +void VisualScriptInputAction::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "action") { + p_property.hint = PROPERTY_HINT_ENUM; String actions; List<PropertyInfo> pinfo; @@ -3785,7 +3785,7 @@ void VisualScriptInputAction::_validate_property(PropertyInfo &property) const { actions += al[i]; } - property.hint_string = actions; + p_property.hint_string = actions; } } @@ -3935,7 +3935,7 @@ VisualScriptNodeInstance *VisualScriptDeconstruct::instantiate(VisualScriptInsta return instance; } -void VisualScriptDeconstruct::_validate_property(PropertyInfo &property) const { +void VisualScriptDeconstruct::_validate_property(PropertyInfo &p_property) const { } void VisualScriptDeconstruct::_bind_methods() { diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h index 35e3c490cd..72a99b9fd2 100644 --- a/modules/visual_script/visual_script_nodes.h +++ b/modules/visual_script/visual_script_nodes.h @@ -269,7 +269,7 @@ class VisualScriptVariableGet : public VisualScriptNode { StringName variable; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); public: @@ -301,7 +301,7 @@ class VisualScriptVariableSet : public VisualScriptNode { StringName variable; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); public: @@ -334,7 +334,7 @@ class VisualScriptConstant : public VisualScriptNode { Variant value; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); public: @@ -478,7 +478,7 @@ class VisualScriptClassConstant : public VisualScriptNode { protected: static void _bind_methods(); - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; public: virtual int get_output_sequence_port_count() const override; @@ -514,7 +514,7 @@ class VisualScriptBasicTypeConstant : public VisualScriptNode { protected: static void _bind_methods(); - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; public: virtual int get_output_sequence_port_count() const override; @@ -598,7 +598,7 @@ class VisualScriptEngineSingleton : public VisualScriptNode { String singleton; protected: - void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); @@ -633,7 +633,7 @@ class VisualScriptSceneNode : public VisualScriptNode { NodePath path; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); public: @@ -665,7 +665,7 @@ class VisualScriptSceneTree : public VisualScriptNode { GDCLASS(VisualScriptSceneTree, VisualScriptNode); protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); public: @@ -1010,7 +1010,7 @@ public: Mode mode; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); @@ -1058,7 +1058,7 @@ class VisualScriptDeconstruct : public VisualScriptNode { void _set_elem_cache(const Array &p_elements); Array _get_elem_cache() const; - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; protected: static void _bind_methods(); diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp index 96e91a0baf..05dbe102f5 100644 --- a/modules/visual_script/visual_script_yield_nodes.cpp +++ b/modules/visual_script/visual_script_yield_nodes.cpp @@ -171,10 +171,10 @@ double VisualScriptYield::get_wait_time() { return wait_time; } -void VisualScriptYield::_validate_property(PropertyInfo &property) const { - if (property.name == "wait_time") { +void VisualScriptYield::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "wait_time") { if (yield_mode != YIELD_WAIT) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } } } @@ -417,26 +417,26 @@ VisualScriptYieldSignal::CallMode VisualScriptYieldSignal::get_call_mode() const return call_mode; } -void VisualScriptYieldSignal::_validate_property(PropertyInfo &property) const { - if (property.name == "base_type") { +void VisualScriptYieldSignal::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "base_type") { if (call_mode != CALL_MODE_INSTANCE) { - property.usage = PROPERTY_USAGE_NO_EDITOR; + p_property.usage = PROPERTY_USAGE_NO_EDITOR; } } - if (property.name == "node_path") { + if (p_property.name == "node_path") { if (call_mode != CALL_MODE_NODE_PATH) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } else { Node *bnode = _get_base_node(); if (bnode) { - property.hint_string = bnode->get_path(); //convert to long string + p_property.hint_string = bnode->get_path(); //convert to long string } } } - if (property.name == "signal") { - property.hint = PROPERTY_HINT_ENUM; + if (p_property.name == "signal") { + p_property.hint = PROPERTY_HINT_ENUM; List<MethodInfo> methods; @@ -460,7 +460,7 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo &property) const { ml += E; } - property.hint_string = ml; + p_property.hint_string = ml; } } diff --git a/modules/visual_script/visual_script_yield_nodes.h b/modules/visual_script/visual_script_yield_nodes.h index a7bf4e8a78..248f2b6e94 100644 --- a/modules/visual_script/visual_script_yield_nodes.h +++ b/modules/visual_script/visual_script_yield_nodes.h @@ -50,7 +50,7 @@ private: double wait_time; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); @@ -103,7 +103,7 @@ private: StringName _get_base_type() const; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); |