diff options
Diffstat (limited to 'modules/visual_script/visual_script_nodes.cpp')
-rw-r--r-- | modules/visual_script/visual_script_nodes.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 923e425997..1decc004ab 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -1208,6 +1208,7 @@ void VisualScriptPreload::set_preload(const Ref<Resource> &p_preload) { preload = p_preload; ports_changed_notify(); } + Ref<Resource> VisualScriptPreload::get_preload() const { return preload; @@ -2078,7 +2079,7 @@ public: virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) { - Node *node = instance->get_owner_ptr()->cast_to<Node>(); + Node *node = Object::cast_to<Node>(instance->get_owner_ptr()); if (!node) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; r_error_str = "Base object is not a Node!"; @@ -2086,7 +2087,7 @@ public: } Node *another = node->get_node(path); - if (!node) { + if (!another) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; r_error_str = "Path does not lead Node!"; return 0; @@ -2142,10 +2143,7 @@ VisualScriptSceneNode::TypeGuess VisualScriptSceneNode::guess_output_type(TypeGu return tg; MainLoop *main_loop = OS::get_singleton()->get_main_loop(); - if (!main_loop) - return tg; - - SceneTree *scene_tree = main_loop->cast_to<SceneTree>(); + SceneTree *scene_tree = Object::cast_to<SceneTree>(main_loop); if (!scene_tree) return tg; @@ -2180,10 +2178,7 @@ void VisualScriptSceneNode::_validate_property(PropertyInfo &property) const { return; MainLoop *main_loop = OS::get_singleton()->get_main_loop(); - if (!main_loop) - return; - - SceneTree *scene_tree = main_loop->cast_to<SceneTree>(); + SceneTree *scene_tree = Object::cast_to<SceneTree>(main_loop); if (!scene_tree) return; @@ -2273,7 +2268,7 @@ public: virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) { - Node *node = instance->get_owner_ptr()->cast_to<Node>(); + Node *node = Object::cast_to<Node>(instance->get_owner_ptr()); if (!node) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; r_error_str = "Base object is not a Node!"; @@ -2707,13 +2702,16 @@ void VisualScriptCustomNode::_bind_methods() { BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_category")); BIND_VMETHOD(MethodInfo(Variant::INT, "_get_working_memory_size")); - BIND_VMETHOD(MethodInfo(Variant::NIL, "_step:Variant", PropertyInfo(Variant::ARRAY, "inputs"), PropertyInfo(Variant::ARRAY, "outputs"), PropertyInfo(Variant::INT, "start_mode"), PropertyInfo(Variant::ARRAY, "working_mem"))); + + MethodInfo stepmi(Variant::NIL, "_step", PropertyInfo(Variant::ARRAY, "inputs"), PropertyInfo(Variant::ARRAY, "outputs"), PropertyInfo(Variant::INT, "start_mode"), PropertyInfo(Variant::ARRAY, "working_mem")); + stepmi.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT; + BIND_VMETHOD(stepmi); ClassDB::bind_method(D_METHOD("_script_changed"), &VisualScriptCustomNode::_script_changed); - BIND_CONSTANT(START_MODE_BEGIN_SEQUENCE); - BIND_CONSTANT(START_MODE_CONTINUE_SEQUENCE); - BIND_CONSTANT(START_MODE_RESUME_YIELD); + BIND_ENUM_CONSTANT(START_MODE_BEGIN_SEQUENCE); + BIND_ENUM_CONSTANT(START_MODE_CONTINUE_SEQUENCE); + BIND_ENUM_CONSTANT(START_MODE_RESUME_YIELD); BIND_CONSTANT(STEP_PUSH_STACK_BIT); BIND_CONSTANT(STEP_GO_BACK_BIT); @@ -2844,7 +2842,9 @@ VisualScriptNodeInstance *VisualScriptSubCall::instance(VisualScriptInstance *p_ void VisualScriptSubCall::_bind_methods() { - BIND_VMETHOD(MethodInfo(Variant::NIL, "_subcall:Variant", PropertyInfo(Variant::NIL, "arguments:Variant"))); + MethodInfo scmi(Variant::NIL, "_subcall", PropertyInfo(Variant::NIL, "arguments")); + scmi.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT; + BIND_VMETHOD(scmi); } VisualScriptSubCall::VisualScriptSubCall() { |