diff options
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 23 | ||||
-rw-r--r-- | editor/property_selector.cpp | 33 | ||||
-rw-r--r-- | editor/property_selector.h | 3 | ||||
-rw-r--r-- | modules/visual_script/visual_script_editor.cpp | 177 | ||||
-rw-r--r-- | modules/visual_script/visual_script_editor.h | 7 | ||||
-rw-r--r-- | modules/visual_script/visual_script_nodes.cpp | 20 | ||||
-rw-r--r-- | scene/animation/animation_tree_player.cpp | 1 |
7 files changed, 130 insertions, 134 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 73268c1914..5f83033293 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -935,17 +935,26 @@ LIGHT_SHADER_CODE #elif defined(DIFFUSE_BURLEY) { - float NdotL = dot(L, N); - float NdotV = dot(N, V); - float VdotH = dot(N, normalize(L+V)); + + + vec3 H = normalize(V + L); + float NoL = max(0.0,dot(N, L)); + float VoH = max(0.0,dot(L, H)); + float NoV = max(0.0,dot(N, V)); + + float FD90 = 0.5 + 2.0 * VoH * VoH * roughness; + float FdV = 1.0 + (FD90 - 1.0) * pow( 1.0 - NoV, 5.0 ); + float FdL = 1.0 + (FD90 - 1.0) * pow( 1.0 - NoL, 5.0 ); + light_amount = ( (1.0 / M_PI) * FdV * FdL ); +/* float energyBias = mix(roughness, 0.0, 0.5); float energyFactor = mix(roughness, 1.0, 1.0 / 1.51); - float fd90 = energyBias + 2.0 * VdotH * VdotH * roughness; + float fd90 = energyBias + 2.0 * VoH * VoH * roughness; float f0 = 1.0; - float lightScatter = f0 + (fd90 - f0) * pow(1.0 - NdotL, 5.0); - float viewScatter = f0 + (fd90 - f0) * pow(1.0 - NdotV, 5.0); + float lightScatter = f0 + (fd90 - f0) * pow(1.0 - NoL, 5.0); + float viewScatter = f0 + (fd90 - f0) * pow(1.0 - NoV, 5.0); - light_amount = lightScatter * viewScatter * energyFactor; + light_amount = lightScatter * viewScatter * energyFactor;*/ } #else //lambert diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp index 6bbb35ceab..86de7c56e1 100644 --- a/editor/property_selector.cpp +++ b/editor/property_selector.cpp @@ -75,6 +75,8 @@ void PropertySelector::_update_search() { if (properties) set_title(TTR("Select Property")); + else if (virtuals_only) + set_title(TTR("Select Virtual Method")); else set_title(TTR("Select Method")); @@ -209,7 +211,7 @@ void PropertySelector::_update_search() { StringName base = base_type; while (base) { methods.push_back(MethodInfo("*" + String(base))); - ClassDB::get_method_list(base, &methods, true); + ClassDB::get_method_list(base, &methods, true, true); base = ClassDB::get_parent_class(base); } } @@ -230,11 +232,13 @@ void PropertySelector::_update_search() { Ref<Texture> icon; script_methods = false; + print_line("name: " + E->get().name); + String rep = E->get().name.replace("*", ""); if (E->get().name == "*Script Methods") { icon = get_icon("Script", "EditorIcons"); script_methods = true; - } else if (has_icon(E->get().name, "EditorIcons")) { - icon = get_icon(E->get().name, "EditorIcons"); + } else if (has_icon(rep, "EditorIcons")) { + icon = get_icon(rep, "EditorIcons"); } else { icon = get_icon("Object", "EditorIcons"); } @@ -247,6 +251,12 @@ void PropertySelector::_update_search() { if (!script_methods && name.begins_with("_") && !(E->get().flags & METHOD_FLAG_VIRTUAL)) continue; + if (virtuals_only && !(E->get().flags & METHOD_FLAG_VIRTUAL)) + continue; + + if (!virtuals_only && (E->get().flags & METHOD_FLAG_VIRTUAL)) + continue; + if (search_box->get_text() != String() && name.find(search_box->get_text()) == -1) continue; @@ -283,6 +293,12 @@ void PropertySelector::_update_search() { desc += " )"; + if (E->get().flags & METHOD_FLAG_CONST) + desc += " const"; + + if (E->get().flags & METHOD_FLAG_VIRTUAL) + desc += " virtual"; + item->set_text(0, desc); item->set_metadata(0, name); item->set_selectable(0, true); @@ -397,7 +413,7 @@ void PropertySelector::_notification(int p_what) { } } -void PropertySelector::select_method_from_base_type(const String &p_base, const String &p_current) { +void PropertySelector::select_method_from_base_type(const String &p_base, const String &p_current, bool p_virtuals_only) { base_type = p_base; selected = p_current; @@ -405,6 +421,7 @@ void PropertySelector::select_method_from_base_type(const String &p_base, const script = 0; properties = false; instance = NULL; + virtuals_only = p_virtuals_only; popup_centered_ratio(0.6); search_box->set_text(""); @@ -421,6 +438,7 @@ void PropertySelector::select_method_from_script(const Ref<Script> &p_script, co script = p_script->get_instance_id(); properties = false; instance = NULL; + virtuals_only = false; popup_centered_ratio(0.6); search_box->set_text(""); @@ -436,6 +454,7 @@ void PropertySelector::select_method_from_basic_type(Variant::Type p_type, const script = 0; properties = false; instance = NULL; + virtuals_only = false; popup_centered_ratio(0.6); search_box->set_text(""); @@ -456,6 +475,7 @@ void PropertySelector::select_method_from_instance(Object *p_instance, const Str } properties = false; instance = NULL; + virtuals_only = false; popup_centered_ratio(0.6); search_box->set_text(""); @@ -471,6 +491,7 @@ void PropertySelector::select_property_from_base_type(const String &p_base, cons script = 0; properties = true; instance = NULL; + virtuals_only = false; popup_centered_ratio(0.6); search_box->set_text(""); @@ -488,6 +509,7 @@ void PropertySelector::select_property_from_script(const Ref<Script> &p_script, script = p_script->get_instance_id(); properties = true; instance = NULL; + virtuals_only = false; popup_centered_ratio(0.6); search_box->set_text(""); @@ -503,6 +525,7 @@ void PropertySelector::select_property_from_basic_type(Variant::Type p_type, con script = 0; properties = true; instance = NULL; + virtuals_only = false; popup_centered_ratio(0.6); search_box->set_text(""); @@ -518,6 +541,7 @@ void PropertySelector::select_property_from_instance(Object *p_instance, const S script = 0; properties = true; instance = p_instance; + virtuals_only = false; popup_centered_ratio(0.6); search_box->set_text(""); @@ -554,6 +578,7 @@ PropertySelector::PropertySelector() { search_options->connect("cell_selected", this, "_item_selected"); search_options->set_hide_root(true); search_options->set_hide_folding(true); + virtuals_only = false; help_bit = memnew(EditorHelpBit); vbc->add_margin_child(TTR("Description:"), help_bit); diff --git a/editor/property_selector.h b/editor/property_selector.h index 3fa60771d7..eb745d776f 100644 --- a/editor/property_selector.h +++ b/editor/property_selector.h @@ -55,6 +55,7 @@ class PropertySelector : public ConfirmationDialog { String base_type; ObjectID script; Object *instance; + bool virtuals_only; void _item_selected(); @@ -63,7 +64,7 @@ protected: static void _bind_methods(); public: - void select_method_from_base_type(const String &p_base, const String &p_current = ""); + void select_method_from_base_type(const String &p_base, const String &p_current = "", bool p_virtuals_only = false); void select_method_from_script(const Ref<Script> &p_script, const String &p_current = ""); void select_method_from_basic_type(Variant::Type p_type, const String &p_current = ""); void select_method_from_instance(Object *p_instance, const String &p_current = ""); diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 37bd730d08..dfec1eea60 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -506,7 +506,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { gnode->set_show_close_button(true); } - if (Object::cast_to<VisualScriptExpression>(*node)) { + if (Object::cast_to<VisualScriptExpression>(node.ptr())) { LineEdit *line_edit = memnew(LineEdit); line_edit->set_text(node->get_text()); @@ -520,7 +520,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { gnode->add_child(text); } - if (Object::cast_to<VisualScriptExpression>(*node)) { + if (Object::cast_to<VisualScriptComment>(node.ptr())) { Ref<VisualScriptComment> vsc = node; gnode->set_comment(true); gnode->set_resizable(true); @@ -926,48 +926,6 @@ void VisualScriptEditor::_member_edited() { } } -void VisualScriptEditor::_override_pressed(int p_id) { - - //override a virtual function or method from base type - - ERR_FAIL_COND(!virtuals_in_menu.has(p_id)); - - VirtualInMenu vim = virtuals_in_menu[p_id]; - - String name = _validate_name(vim.name); - selected = name; - edited_func = selected; - Ref<VisualScriptFunction> func_node; - func_node.instance(); - func_node->set_name(vim.name); - - undo_redo->create_action(TTR("Add Function")); - undo_redo->add_do_method(script.ptr(), "add_function", name); - for (int i = 0; i < vim.args.size(); i++) { - func_node->add_argument(vim.args[i].first, vim.args[i].second); - } - - undo_redo->add_do_method(script.ptr(), "add_node", name, script->get_available_id(), func_node); - if (vim.ret != Variant::NIL || vim.ret_variant) { - Ref<VisualScriptReturn> ret_node; - ret_node.instance(); - ret_node->set_return_type(vim.ret); - ret_node->set_enable_return_value(true); - ret_node->set_name(vim.name); - undo_redo->add_do_method(script.ptr(), "add_node", name, script->get_available_id() + 1, ret_node, Vector2(500, 0)); - } - - undo_redo->add_undo_method(script.ptr(), "remove_function", name); - undo_redo->add_do_method(this, "_update_members"); - undo_redo->add_undo_method(this, "_update_members"); - undo_redo->add_do_method(this, "_update_graph"); - undo_redo->add_undo_method(this, "_update_graph"); - - undo_redo->commit_action(); - - _update_graph(); -} - void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_button) { TreeItem *ti = Object::cast_to<TreeItem>(p_item); @@ -980,64 +938,9 @@ void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_butt //add function, this one uses menu if (p_button == 1) { - new_function_menu->clear(); - new_function_menu->set_size(Size2(0, 0)); - int idx = 0; - - virtuals_in_menu.clear(); - - List<MethodInfo> mi; - ClassDB::get_method_list(script->get_instance_base_type(), &mi); - for (List<MethodInfo>::Element *E = mi.front(); E; E = E->next()) { - MethodInfo mi = E->get(); - if (mi.flags & METHOD_FLAG_VIRTUAL) { - - VirtualInMenu vim; - vim.name = mi.name; - vim.ret = mi.return_val.type; - if (mi.return_val.name != String()) - vim.ret_variant = true; - else - vim.ret_variant = false; - - String desc; - - if (mi.return_val.type == Variant::NIL) - desc = "var"; - else - desc = Variant::get_type_name(mi.return_val.type); - desc += " " + mi.name + " ( "; - - for (int i = 0; i < mi.arguments.size(); i++) { - - if (i > 0) - desc += ", "; - - if (mi.arguments[i].type == Variant::NIL) - desc += "var "; - else - desc += Variant::get_type_name(mi.arguments[i].type) + " "; - - desc += mi.arguments[i].name; - - Pair<Variant::Type, String> p; - p.first = mi.arguments[i].type; - p.second = mi.arguments[i].name; - vim.args.push_back(p); - } - desc += " )"; + new_virtual_method_select->select_method_from_base_type(script->get_instance_base_type(), String(), true); - virtuals_in_menu[idx] = vim; - - new_function_menu->add_item(desc, idx); - idx++; - } - } - - Rect2 pos = members->get_item_rect(ti); - new_function_menu->set_position(members->get_global_position() + pos.position + Vector2(0, pos.size.y)); - new_function_menu->popup(); return; } else if (p_button == 0) { @@ -2686,21 +2589,21 @@ void VisualScriptEditor::_selected_connect_node_method_or_setget(const String &p Ref<VisualScriptNode> vsn = script->get_node(edited_func, port_action_new_node); - if (Object::cast_to<VisualScriptFunctionCall>(*vsn)) { + if (Object::cast_to<VisualScriptFunctionCall>(vsn.ptr())) { Ref<VisualScriptFunctionCall> vsfc = vsn; vsfc->set_function(p_text); script->data_connect(edited_func, port_action_node, port_action_output, port_action_new_node, 0); } - if (Object::cast_to<VisualScriptPropertySet>(*vsn)) { + if (Object::cast_to<VisualScriptPropertySet>(vsn.ptr())) { Ref<VisualScriptPropertySet> vsp = vsn; vsp->set_property(p_text); script->data_connect(edited_func, port_action_node, port_action_output, port_action_new_node, 0); } - if (Object::cast_to<VisualScriptPropertyGet>(*vsn)) { + if (Object::cast_to<VisualScriptPropertyGet>(vsn.ptr())) { Ref<VisualScriptPropertyGet> vsp = vsn; vsp->set_property(p_text); @@ -2711,6 +2614,63 @@ void VisualScriptEditor::_selected_connect_node_method_or_setget(const String &p _update_graph_connections(); } +void VisualScriptEditor::_selected_new_virtual_method(const String &p_text) { + + String name = p_text; + if (script->has_function(name)) { + EditorNode::get_singleton()->show_warning(vformat(TTR("Script already has function '%s'"), name)); + return; + } + + MethodInfo minfo; + { + List<MethodInfo> methods; + bool found = false; + ClassDB::get_virtual_methods(script->get_instance_base_type(), &methods); + for (List<MethodInfo>::Element *E = methods.front(); E; E = E->next()) { + if (E->get().name == name) { + minfo = E->get(); + found = true; + } + } + + ERR_FAIL_COND(!found); + } + + selected = name; + edited_func = selected; + Ref<VisualScriptFunction> func_node; + func_node.instance(); + func_node->set_name(name); + + undo_redo->create_action(TTR("Add Function")); + undo_redo->add_do_method(script.ptr(), "add_function", name); + + for (int i = 0; i < minfo.arguments.size(); i++) { + func_node->add_argument(minfo.arguments[i].type, minfo.arguments[i].name); + } + + undo_redo->add_do_method(script.ptr(), "add_node", name, script->get_available_id(), func_node); + if (minfo.return_val.type != Variant::NIL || minfo.return_val.usage & PROPERTY_USAGE_NIL_IS_VARIANT) { + Ref<VisualScriptReturn> ret_node; + ret_node.instance(); + ret_node->set_return_type(minfo.return_val.type); + ret_node->set_enable_return_value(true); + ret_node->set_name(name); + undo_redo->add_do_method(script.ptr(), "add_node", name, script->get_available_id() + 1, ret_node, Vector2(500, 0)); + } + + undo_redo->add_undo_method(script.ptr(), "remove_function", name); + undo_redo->add_do_method(this, "_update_members"); + undo_redo->add_undo_method(this, "_update_members"); + undo_redo->add_do_method(this, "_update_graph"); + undo_redo->add_undo_method(this, "_update_graph"); + + undo_redo->commit_action(); + + _update_graph(); +} + void VisualScriptEditor::_cancel_connect_node_method_or_setget() { script->remove_node(edited_func, port_action_new_node); @@ -3147,7 +3107,6 @@ void VisualScriptEditor::_bind_methods() { ClassDB::bind_method("_update_members", &VisualScriptEditor::_update_members); ClassDB::bind_method("_change_base_type", &VisualScriptEditor::_change_base_type); ClassDB::bind_method("_change_base_type_callback", &VisualScriptEditor::_change_base_type_callback); - ClassDB::bind_method("_override_pressed", &VisualScriptEditor::_override_pressed); ClassDB::bind_method("_node_selected", &VisualScriptEditor::_node_selected); ClassDB::bind_method("_node_moved", &VisualScriptEditor::_node_moved); ClassDB::bind_method("_move_node", &VisualScriptEditor::_move_node); @@ -3166,6 +3125,8 @@ void VisualScriptEditor::_bind_methods() { ClassDB::bind_method("_button_resource_previewed", &VisualScriptEditor::_button_resource_previewed); ClassDB::bind_method("_port_action_menu", &VisualScriptEditor::_port_action_menu); ClassDB::bind_method("_selected_connect_node_method_or_setget", &VisualScriptEditor::_selected_connect_node_method_or_setget); + ClassDB::bind_method("_selected_new_virtual_method", &VisualScriptEditor::_selected_new_virtual_method); + ClassDB::bind_method("_cancel_connect_node_method_or_setget", &VisualScriptEditor::_cancel_connect_node_method_or_setget); ClassDB::bind_method("_expression_text_changed", &VisualScriptEditor::_expression_text_changed); @@ -3344,9 +3305,6 @@ VisualScriptEditor::VisualScriptEditor() { undo_redo = EditorNode::get_singleton()->get_undo_redo(); - new_function_menu = memnew(PopupMenu); - new_function_menu->connect("id_pressed", this, "_override_pressed"); - add_child(new_function_menu); updating_members = false; set_process_input(true); //for revert on drag @@ -3366,6 +3324,11 @@ VisualScriptEditor::VisualScriptEditor() { new_connect_node_select->connect("selected", this, "_selected_connect_node_method_or_setget"); new_connect_node_select->get_cancel()->connect("pressed", this, "_cancel_connect_node_method_or_setget"); + new_virtual_method_select = memnew(PropertySelector); + add_child(new_virtual_method_select); + new_virtual_method_select->connect("selected", this, "_selected_new_virtual_method"); + new_virtual_method_select->get_cancel()->connect("pressed", this, "_selected_new_virtual_method"); + port_action_popup = memnew(PopupMenu); add_child(port_action_popup); port_action_popup->connect("id_pressed", this, "_port_action_menu"); diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index dd051ef8e4..5b8c3ea74e 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -103,6 +103,7 @@ class VisualScriptEditor : public ScriptEditorBase { PropertySelector *method_select; PropertySelector *new_connect_node_select; + PropertySelector *new_virtual_method_select; VisualScriptEditorVariableEdit *variable_editor; @@ -135,10 +136,6 @@ class VisualScriptEditor : public ScriptEditorBase { Vector<Pair<Variant::Type, String> > args; }; - Map<int, VirtualInMenu> virtuals_in_menu; - - PopupMenu *new_function_menu; - StringName edited_func; void _update_graph_connections(); @@ -177,6 +174,7 @@ class VisualScriptEditor : public ScriptEditorBase { void _port_action_menu(int p_option); void _selected_connect_node_method_or_setget(const String &p_text); void _cancel_connect_node_method_or_setget(); + void _selected_new_virtual_method(const String &p_text); int error_line; @@ -188,7 +186,6 @@ class VisualScriptEditor : public ScriptEditorBase { void _change_base_type(); void _member_selected(); void _member_edited(); - void _override_pressed(int p_id); void _begin_node_move(); void _end_node_move(); diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 1decc004ab..093f01c49f 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -1493,7 +1493,7 @@ void VisualScriptGlobalConstant::_bind_methods() { cc += ","; cc += GlobalConstants::get_global_constant_name(i); } - ADD_PROPERTY(PropertyInfo(Variant::INT, "constant/constant", PROPERTY_HINT_ENUM, cc), "set_global_constant", "get_global_constant"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "constant", PROPERTY_HINT_ENUM, cc), "set_global_constant", "get_global_constant"); } VisualScriptGlobalConstant::VisualScriptGlobalConstant() { @@ -1622,7 +1622,7 @@ void VisualScriptClassConstant::_bind_methods() { ClassDB::bind_method(D_METHOD("get_base_type"), &VisualScriptClassConstant::get_base_type); ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_type", PROPERTY_HINT_TYPE_STRING, "Object"), "set_base_type", "get_base_type"); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "constant/constant", PROPERTY_HINT_ENUM, ""), "set_class_constant", "get_class_constant"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "constant", PROPERTY_HINT_ENUM, ""), "set_class_constant", "get_class_constant"); } VisualScriptClassConstant::VisualScriptClassConstant() { @@ -1760,7 +1760,7 @@ void VisualScriptBasicTypeConstant::_bind_methods() { } ADD_PROPERTY(PropertyInfo(Variant::INT, "basic_type", PROPERTY_HINT_ENUM, argt), "set_basic_type", "get_basic_type"); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "constant/constant", PROPERTY_HINT_ENUM, ""), "set_basic_type_constant", "get_basic_type_constant"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "constant", PROPERTY_HINT_ENUM, ""), "set_basic_type_constant", "get_basic_type_constant"); } VisualScriptBasicTypeConstant::VisualScriptBasicTypeConstant() { @@ -1881,7 +1881,7 @@ void VisualScriptMathConstant::_bind_methods() { cc += ","; cc += const_name[i]; } - ADD_PROPERTY(PropertyInfo(Variant::INT, "constant/constant", PROPERTY_HINT_ENUM, cc), "set_math_constant", "get_math_constant"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "constant", PROPERTY_HINT_ENUM, cc), "set_math_constant", "get_math_constant"); } VisualScriptMathConstant::VisualScriptMathConstant() { @@ -2002,7 +2002,7 @@ void VisualScriptEngineSingleton::_bind_methods() { cc += E->get().name; } - ADD_PROPERTY(PropertyInfo(Variant::STRING, "constant/constant", PROPERTY_HINT_ENUM, cc), "set_singleton", "get_singleton"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "/constant", PROPERTY_HINT_ENUM, cc), "set_singleton", "get_singleton"); } VisualScriptEngineSingleton::VisualScriptEngineSingleton() { @@ -3727,11 +3727,11 @@ void register_visual_script_nodes() { VisualScriptLanguage::singleton->add_register_func("data/preload", create_node_generic<VisualScriptPreload>); VisualScriptLanguage::singleton->add_register_func("data/action", create_node_generic<VisualScriptInputAction>); - VisualScriptLanguage::singleton->add_register_func("constant/constants/constant", create_node_generic<VisualScriptConstant>); - VisualScriptLanguage::singleton->add_register_func("constant/constants/math_constant", create_node_generic<VisualScriptMathConstant>); - VisualScriptLanguage::singleton->add_register_func("constant/constants/class_constant", create_node_generic<VisualScriptClassConstant>); - VisualScriptLanguage::singleton->add_register_func("constant/constants/global_constant", create_node_generic<VisualScriptGlobalConstant>); - VisualScriptLanguage::singleton->add_register_func("constant/constants/basic_type_constant", create_node_generic<VisualScriptBasicTypeConstant>); + VisualScriptLanguage::singleton->add_register_func("constants/constant", create_node_generic<VisualScriptConstant>); + VisualScriptLanguage::singleton->add_register_func("constants/math_constant", create_node_generic<VisualScriptMathConstant>); + VisualScriptLanguage::singleton->add_register_func("constants/class_constant", create_node_generic<VisualScriptClassConstant>); + VisualScriptLanguage::singleton->add_register_func("constants/global_constant", create_node_generic<VisualScriptGlobalConstant>); + VisualScriptLanguage::singleton->add_register_func("constants/basic_type_constant", create_node_generic<VisualScriptBasicTypeConstant>); VisualScriptLanguage::singleton->add_register_func("custom/custom_node", create_node_generic<VisualScriptCustomNode>); VisualScriptLanguage::singleton->add_register_func("custom/sub_call", create_node_generic<VisualScriptSubCall>); diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index e2330eb0d4..7a5c7e450b 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -1156,6 +1156,7 @@ void AnimationTreePlayer::transition_node_set_xfade_time(const StringName &p_nod } void AnimationTreePlayer::TransitionNode::set_current(int p_current) { + ERR_FAIL_INDEX(p_current, inputs.size()); if (current == p_current) |