diff options
Diffstat (limited to 'modules/visual_script')
-rw-r--r-- | modules/visual_script/visual_script.cpp | 5 | ||||
-rw-r--r-- | modules/visual_script/visual_script_builtin_funcs.cpp | 48 | ||||
-rw-r--r-- | modules/visual_script/visual_script_builtin_funcs.h | 2 | ||||
-rw-r--r-- | modules/visual_script/visual_script_editor.cpp | 172 | ||||
-rw-r--r-- | modules/visual_script/visual_script_nodes.cpp | 9 | ||||
-rw-r--r-- | modules/visual_script/visual_script_yield_nodes.cpp | 8 | ||||
-rw-r--r-- | modules/visual_script/visual_script_yield_nodes.h | 2 |
7 files changed, 170 insertions, 76 deletions
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index c665fa12cf..48145495e4 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -125,6 +125,7 @@ void VisualScriptNode::_bind_methods() { ClassDB::bind_method(D_METHOD("get_visual_script"), &VisualScriptNode::get_visual_script); ClassDB::bind_method(D_METHOD("set_default_input_value", "port_idx", "value"), &VisualScriptNode::set_default_input_value); ClassDB::bind_method(D_METHOD("get_default_input_value", "port_idx"), &VisualScriptNode::get_default_input_value); + ClassDB::bind_method(D_METHOD("ports_changed_notify"), &VisualScriptNode::ports_changed_notify); ClassDB::bind_method(D_METHOD("_set_default_input_values", "values"), &VisualScriptNode::_set_default_input_values); ClassDB::bind_method(D_METHOD("_get_default_input_values"), &VisualScriptNode::_get_default_input_values); @@ -2008,8 +2009,8 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o Node *node = Object::cast_to<Node>(p_owner); if (p_script->functions.has("_process")) node->set_process(true); - if (p_script->functions.has("_fixed_process")) - node->set_fixed_process(true); + if (p_script->functions.has("_physics_process")) + node->set_physics_process(true); if (p_script->functions.has("_input")) node->set_process_input(true); if (p_script->functions.has("_unhandled_input")) diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index 972be5f5a4..1980f86114 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -65,6 +65,8 @@ const char *VisualScriptBuiltinFunc::func_name[VisualScriptBuiltinFunc::FUNC_MAX "decimals", "stepify", "lerp", + "inverse_lerp", + "range_lerp", "dectime", "randomize", "randi", @@ -194,9 +196,12 @@ int VisualScriptBuiltinFunc::get_func_argument_count(BuiltinFunc p_func) { case COLORN: return 2; case MATH_LERP: + case MATH_INVERSE_LERP: case MATH_DECTIME: case LOGIC_CLAMP: return 3; + case MATH_RANGE_LERP: + return 5; case FUNC_MAX: { } } @@ -297,7 +302,26 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const return PropertyInfo(Variant::REAL, "to"); else return PropertyInfo(Variant::REAL, "weight"); - + } break; + case MATH_INVERSE_LERP: { + if (p_idx == 0) + return PropertyInfo(Variant::REAL, "from"); + else if (p_idx == 1) + return PropertyInfo(Variant::REAL, "to"); + else + return PropertyInfo(Variant::REAL, "value"); + } break; + case MATH_RANGE_LERP: { + if (p_idx == 0) + return PropertyInfo(Variant::REAL, "value"); + else if (p_idx == 1) + return PropertyInfo(Variant::REAL, "istart"); + else if (p_idx == 2) + return PropertyInfo(Variant::REAL, "istop"); + else if (p_idx == 3) + return PropertyInfo(Variant::REAL, "ostart"); + else + return PropertyInfo(Variant::REAL, "ostop"); } break; case MATH_DECTIME: { if (p_idx == 0) @@ -495,6 +519,8 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons } break; case MATH_STEPIFY: case MATH_LERP: + case MATH_INVERSE_LERP: + case MATH_RANGE_LERP: case MATH_DECTIME: { t = Variant::REAL; @@ -795,6 +821,22 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in VALIDATE_ARG_NUM(2); *r_return = Math::lerp((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2]); } break; + case VisualScriptBuiltinFunc::MATH_INVERSE_LERP: { + + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + VALIDATE_ARG_NUM(2); + *r_return = Math::inverse_lerp((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2]); + } break; + case VisualScriptBuiltinFunc::MATH_RANGE_LERP: { + + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + VALIDATE_ARG_NUM(2); + VALIDATE_ARG_NUM(3); + VALIDATE_ARG_NUM(4); + *r_return = Math::range_lerp((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2], (double)*p_inputs[3], (double)*p_inputs[4]); + } break; case VisualScriptBuiltinFunc::MATH_DECTIME: { VALIDATE_ARG_NUM(0); @@ -1203,6 +1245,8 @@ void VisualScriptBuiltinFunc::_bind_methods() { BIND_ENUM_CONSTANT(MATH_DECIMALS); BIND_ENUM_CONSTANT(MATH_STEPIFY); BIND_ENUM_CONSTANT(MATH_LERP); + BIND_ENUM_CONSTANT(MATH_INVERSE_LERP); + BIND_ENUM_CONSTANT(MATH_RANGE_LERP); BIND_ENUM_CONSTANT(MATH_DECTIME); BIND_ENUM_CONSTANT(MATH_RANDOMIZE); BIND_ENUM_CONSTANT(MATH_RAND); @@ -1282,6 +1326,8 @@ void register_visual_script_builtin_func_node() { VisualScriptLanguage::singleton->add_register_func("functions/built_in/decimals", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_DECIMALS>); VisualScriptLanguage::singleton->add_register_func("functions/built_in/stepify", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_STEPIFY>); VisualScriptLanguage::singleton->add_register_func("functions/built_in/lerp", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_LERP>); + VisualScriptLanguage::singleton->add_register_func("functions/built_in/inverse_lerp", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_INVERSE_LERP>); + VisualScriptLanguage::singleton->add_register_func("functions/built_in/range_lerp", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANGE_LERP>); VisualScriptLanguage::singleton->add_register_func("functions/built_in/dectime", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_DECTIME>); VisualScriptLanguage::singleton->add_register_func("functions/built_in/randomize", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANDOMIZE>); VisualScriptLanguage::singleton->add_register_func("functions/built_in/rand", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RAND>); diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h index 97ab307039..af24f16a2f 100644 --- a/modules/visual_script/visual_script_builtin_funcs.h +++ b/modules/visual_script/visual_script_builtin_funcs.h @@ -64,6 +64,8 @@ public: MATH_DECIMALS, MATH_STEPIFY, MATH_LERP, + MATH_INVERSE_LERP, + MATH_RANGE_LERP, MATH_DECTIME, MATH_RANDOMIZE, MATH_RAND, diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 985f8a8d0e..47ef0182dc 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -331,44 +331,83 @@ public: VisualScriptEditorVariableEdit() { undo_redo = NULL; } }; -static Color _color_from_type(Variant::Type p_type) { +static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) { Color color; - switch (p_type) { - case Variant::NIL: color = Color::html("69ecbd"); break; - - case Variant::BOOL: color = Color::html("8da6f0"); break; - case Variant::INT: color = Color::html("7dc6ef"); break; - case Variant::REAL: color = Color::html("61daf4"); break; - case Variant::STRING: color = Color::html("6ba7ec"); break; - - case Variant::VECTOR2: color = Color::html("bd91f1"); break; - case Variant::RECT2: color = Color::html("f191a5"); break; - case Variant::VECTOR3: color = Color::html("d67dee"); break; - case Variant::TRANSFORM2D: color = Color::html("c4ec69"); break; - case Variant::PLANE: color = Color::html("f77070"); break; - case Variant::QUAT: color = Color::html("ec69a3"); break; - case Variant::RECT3: color = Color::html("ee7991"); break; - case Variant::BASIS: color = Color::html("e3ec69"); break; - case Variant::TRANSFORM: color = Color::html("f6a86e"); break; - - case Variant::COLOR: color = Color::html("9dff70"); break; - case Variant::NODE_PATH: color = Color::html("6993ec"); break; - case Variant::_RID: color = Color::html("69ec9a"); break; - case Variant::OBJECT: color = Color::html("79f3e8"); break; - case Variant::DICTIONARY: color = Color::html("77edb1"); break; - - case Variant::ARRAY: color = Color::html("e0e0e0"); break; - case Variant::POOL_BYTE_ARRAY: color = Color::html("aaf4c8"); break; - case Variant::POOL_INT_ARRAY: color = Color::html("afdcf5"); break; - case Variant::POOL_REAL_ARRAY: color = Color::html("97e7f8"); break; - case Variant::POOL_STRING_ARRAY: color = Color::html("9dc4f2"); break; - case Variant::POOL_VECTOR2_ARRAY: color = Color::html("d1b3f5"); break; - case Variant::POOL_VECTOR3_ARRAY: color = Color::html("df9bf2"); break; - case Variant::POOL_COLOR_ARRAY: color = Color::html("e9ff97"); break; - - default: - color.set_hsv(p_type / float(Variant::VARIANT_MAX), 0.7, 0.7); - } + if (dark_theme) + switch (p_type) { + case Variant::NIL: color = Color::html("#69ecbd"); break; + + case Variant::BOOL: color = Color::html("#8da6f0"); break; + case Variant::INT: color = Color::html("#7dc6ef"); break; + case Variant::REAL: color = Color::html("#61daf4"); break; + case Variant::STRING: color = Color::html("#6ba7ec"); break; + + case Variant::VECTOR2: color = Color::html("#bd91f1"); break; + case Variant::RECT2: color = Color::html("#f191a5"); break; + case Variant::VECTOR3: color = Color::html("#d67dee"); break; + case Variant::TRANSFORM2D: color = Color::html("#c4ec69"); break; + case Variant::PLANE: color = Color::html("#f77070"); break; + case Variant::QUAT: color = Color::html("#ec69a3"); break; + case Variant::RECT3: color = Color::html("#ee7991"); break; + case Variant::BASIS: color = Color::html("#e3ec69"); break; + case Variant::TRANSFORM: color = Color::html("#f6a86e"); break; + + case Variant::COLOR: color = Color::html("#9dff70"); break; + case Variant::NODE_PATH: color = Color::html("#6993ec"); break; + case Variant::_RID: color = Color::html("#69ec9a"); break; + case Variant::OBJECT: color = Color::html("#79f3e8"); break; + case Variant::DICTIONARY: color = Color::html("#77edb1"); break; + + case Variant::ARRAY: color = Color::html("#e0e0e0"); break; + case Variant::POOL_BYTE_ARRAY: color = Color::html("#aaf4c8"); break; + case Variant::POOL_INT_ARRAY: color = Color::html("#afdcf5"); break; + case Variant::POOL_REAL_ARRAY: color = Color::html("#97e7f8"); break; + case Variant::POOL_STRING_ARRAY: color = Color::html("#9dc4f2"); break; + case Variant::POOL_VECTOR2_ARRAY: color = Color::html("#d1b3f5"); break; + case Variant::POOL_VECTOR3_ARRAY: color = Color::html("#df9bf2"); break; + case Variant::POOL_COLOR_ARRAY: color = Color::html("#e9ff97"); break; + + default: + color.set_hsv(p_type / float(Variant::VARIANT_MAX), 0.7, 0.7); + } + else + switch (p_type) { + case Variant::NIL: color = Color::html("#25e3a0"); break; + + case Variant::BOOL: color = Color::html("#6d8eeb"); break; + case Variant::INT: color = Color::html("#4fb2e9"); break; + case Variant::REAL: color = Color::html("#27ccf0"); break; + case Variant::STRING: color = Color::html("#4690e7"); break; + + case Variant::VECTOR2: color = Color::html("#ad76ee"); break; + case Variant::RECT2: color = Color::html("#ee758e"); break; + case Variant::VECTOR3: color = Color::html("#dc6aed"); break; + case Variant::TRANSFORM2D: color = Color::html("#96ce1a"); break; + case Variant::PLANE: color = Color::html("#f77070"); break; + case Variant::QUAT: color = Color::html("#ec69a3"); break; + case Variant::RECT3: color = Color::html("#ee7991"); break; + case Variant::BASIS: color = Color::html("#b2bb19"); break; + case Variant::TRANSFORM: color = Color::html("#f49047"); break; + + case Variant::COLOR: color = Color::html("#3cbf00"); break; + case Variant::NODE_PATH: color = Color::html("#6993ec"); break; + case Variant::_RID: color = Color::html("#2ce573"); break; + case Variant::OBJECT: color = Color::html("#12d5c3"); break; + case Variant::DICTIONARY: color = Color::html("#57e99f"); break; + + case Variant::ARRAY: color = Color::html("#737373"); break; + case Variant::POOL_BYTE_ARRAY: color = Color::html("#61ea98"); break; + case Variant::POOL_INT_ARRAY: color = Color::html("#61baeb"); break; + case Variant::POOL_REAL_ARRAY: color = Color::html("#40d3f2"); break; + case Variant::POOL_STRING_ARRAY: color = Color::html("#609fea"); break; + case Variant::POOL_VECTOR2_ARRAY: color = Color::html("#9d5dea"); break; + case Variant::POOL_VECTOR3_ARRAY: color = Color::html("#ca5aea"); break; + case Variant::POOL_COLOR_ARRAY: color = Color::html("#92ba00"); break; + + default: + color.set_hsv(p_type / float(Variant::VARIANT_MAX), 0.3, 0.3); + } + return color; } @@ -531,7 +570,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { Color c = sbf->get_border_color(MARGIN_TOP); c.a = 1; if (EditorSettings::get_singleton()->get("interface/theme/use_graph_node_headers")) { - Color mono_color = ((c.r + c.g + c.b) / 3) < 0.5 ? Color(1.0, 1.0, 1.0) : Color(0, 0, 0); + Color mono_color = ((c.r + c.g + c.b) / 3) < 0.7 ? Color(1.0, 1.0, 1.0) : Color(0.0, 0.0, 0.0); mono_color.a = 0.85; c = mono_color; } @@ -542,10 +581,12 @@ void VisualScriptEditor::_update_graph(int p_only_id) { gnode->add_style_override("frame", sbf); } + const Color mono_color = get_color("mono_color", "Editor"); + int slot_idx = 0; bool single_seq_output = node->get_output_sequence_port_count() == 1 && node->get_output_sequence_port_text(0) == String(); - gnode->set_slot(0, node->has_input_sequence_port(), TYPE_SEQUENCE, Color(1, 1, 1, 1), single_seq_output, TYPE_SEQUENCE, Color(1, 1, 1, 1), seq_port, seq_port); + gnode->set_slot(0, node->has_input_sequence_port(), TYPE_SEQUENCE, mono_color, single_seq_output, TYPE_SEQUENCE, mono_color, seq_port, seq_port); gnode->set_offset(pos * EDSCALE); slot_idx++; @@ -562,7 +603,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { text2->set_text(node->get_output_sequence_port_text(i)); text2->set_align(Label::ALIGN_RIGHT); gnode->add_child(text2); - gnode->set_slot(slot_idx, false, 0, Color(), true, TYPE_SEQUENCE, Color(1, 1, 1, 1), seq_port, seq_port); + gnode->set_slot(slot_idx, false, 0, Color(), true, TYPE_SEQUENCE, mono_color, seq_port, seq_port); slot_idx++; } } @@ -677,10 +718,11 @@ void VisualScriptEditor::_update_graph(int p_only_id) { gnode->add_child(hbc); + bool dark_theme = get_constant("dark_theme", "Editor"); if (i < mixed_seq_ports) { - gnode->set_slot(slot_idx, left_ok, left_type, _color_from_type(left_type), true, TYPE_SEQUENCE, Color(1, 1, 1, 1), Ref<Texture>(), seq_port); + gnode->set_slot(slot_idx, left_ok, left_type, _color_from_type(left_type, dark_theme), true, TYPE_SEQUENCE, mono_color, Ref<Texture>(), seq_port); } else { - gnode->set_slot(slot_idx, left_ok, left_type, _color_from_type(left_type), right_ok, right_type, _color_from_type(right_type)); + gnode->set_slot(slot_idx, left_ok, left_type, _color_from_type(left_type, dark_theme), right_ok, right_type, _color_from_type(right_type, dark_theme)); } slot_idx++; @@ -710,7 +752,7 @@ void VisualScriptEditor::_update_members() { functions->set_text(0, TTR("Functions:")); functions->add_button(0, Control::get_icon("Override", "EditorIcons"), 1); functions->add_button(0, Control::get_icon("Add", "EditorIcons"), 0); - functions->set_custom_bg_color(0, Control::get_color("prop_section", "Editor")); + functions->set_custom_color(0, Control::get_color("mono_color", "Editor")); List<StringName> func_names; script->get_function_list(&func_names); @@ -719,13 +761,7 @@ void VisualScriptEditor::_update_members() { ti->set_text(0, E->get()); ti->set_selectable(0, true); ti->set_editable(0, true); - //ti->add_button(0,Control::get_icon("Edit","EditorIcons"),0); function arguments are in the node now - //ti->add_button(0, Control::get_icon("Del", "EditorIcons"), 1); ti->set_metadata(0, E->get()); - if (E->get() == edited_func) { - ti->set_custom_bg_color(0, get_color("prop_category", "Editor")); - ti->set_custom_color(0, Color(1, 1, 1, 1)); - } if (selected == E->get()) ti->select(0); } @@ -734,7 +770,7 @@ void VisualScriptEditor::_update_members() { variables->set_selectable(0, false); variables->set_text(0, TTR("Variables:")); variables->add_button(0, Control::get_icon("Add", "EditorIcons")); - variables->set_custom_bg_color(0, Control::get_color("prop_section", "Editor")); + variables->set_custom_color(0, Control::get_color("mono_color", "Editor")); Ref<Texture> type_icons[Variant::VARIANT_MAX] = { Control::get_icon("MiniVariant", "EditorIcons"), @@ -778,8 +814,6 @@ void VisualScriptEditor::_update_members() { ti->set_selectable(0, true); ti->set_editable(0, true); - //ti->add_button(0, Control::get_icon("Edit", "EditorIcons"), 0); - //ti->add_button(0, Control::get_icon("Del", "EditorIcons"), 1); ti->set_metadata(0, E->get()); if (selected == E->get()) ti->select(0); @@ -789,7 +823,7 @@ void VisualScriptEditor::_update_members() { _signals->set_selectable(0, false); _signals->set_text(0, TTR("Signals:")); _signals->add_button(0, Control::get_icon("Add", "EditorIcons")); - _signals->set_custom_bg_color(0, Control::get_color("prop_section", "Editor")); + _signals->set_custom_color(0, Control::get_color("mono_color", "Editor")); List<StringName> signal_names; script->get_custom_signal_list(&signal_names); @@ -798,8 +832,6 @@ void VisualScriptEditor::_update_members() { ti->set_text(0, E->get()); ti->set_selectable(0, true); ti->set_editable(0, true); - //ti->add_button(0, Control::get_icon("Edit", "EditorIcons"), 0); - //ti->add_button(0, Control::get_icon("Del", "EditorIcons"), 1); ti->set_metadata(0, E->get()); if (selected == E->get()) ti->select(0); @@ -2767,18 +2799,30 @@ void VisualScriptEditor::_notification(int p_what) { variable_editor->connect("changed", this, "_update_members"); signal_editor->connect("changed", this, "_update_members"); + Ref<Theme> tm = EditorNode::get_singleton()->get_theme_base()->get_theme(); + + bool dark_theme = tm->get_constant("dark_theme", "Editor"); + List<Pair<String, Color> > colors; - colors.push_back(Pair<String, Color>("flow_control", Color::html("#f4f4f4"))); - colors.push_back(Pair<String, Color>("functions", Color::html("#f58581"))); - colors.push_back(Pair<String, Color>("data", Color::html("#80f6cf"))); - colors.push_back(Pair<String, Color>("operators", Color::html("#ab97df"))); - colors.push_back(Pair<String, Color>("custom", Color::html("#80bbf6"))); - colors.push_back(Pair<String, Color>("constants", Color::html("#f680b0"))); + if (dark_theme) { + colors.push_back(Pair<String, Color>("flow_control", Color::html("#f4f4f4"))); + colors.push_back(Pair<String, Color>("functions", Color::html("#f58581"))); + colors.push_back(Pair<String, Color>("data", Color::html("#80f6cf"))); + colors.push_back(Pair<String, Color>("operators", Color::html("#ab97df"))); + colors.push_back(Pair<String, Color>("custom", Color::html("#80bbf6"))); + colors.push_back(Pair<String, Color>("constants", Color::html("#f680b0"))); + } else { + colors.push_back(Pair<String, Color>("flow_control", Color::html("#424242"))); + colors.push_back(Pair<String, Color>("functions", Color::html("#f26661"))); + colors.push_back(Pair<String, Color>("data", Color::html("#13bb83"))); + colors.push_back(Pair<String, Color>("operators", Color::html("#8265d0"))); + colors.push_back(Pair<String, Color>("custom", Color::html("#4ea0f2"))); + colors.push_back(Pair<String, Color>("constants", Color::html("#f02f7d"))); + } for (List<Pair<String, Color> >::Element *E = colors.front(); E; E = E->next()) { - print_line(E->get().first); - Ref<StyleBoxFlat> sb = EditorNode::get_singleton()->get_theme_base()->get_theme()->get_stylebox("frame", "GraphNode"); - if (sb != NULL) { + Ref<StyleBoxFlat> sb = tm->get_stylebox("frame", "GraphNode"); + if (!sb.is_null()) { Ref<StyleBoxFlat> frame_style = sb->duplicate(); Color c = sb->get_border_color(MARGIN_TOP); Color cn = E->get().second; diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 16aec76e57..d3cd839cf3 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -532,6 +532,7 @@ String VisualScriptOperator::get_text() const { L"A or B", //OP_OR, L"A xor B", //OP_XOR, L"not A", //OP_NOT, + L"A in B", //OP_IN, }; return op_names[op]; @@ -1109,7 +1110,7 @@ void VisualScriptConstant::_bind_methods() { } ADD_PROPERTY(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_ENUM, argt), "set_constant_type", "get_constant_type"); - ADD_PROPERTY(PropertyInfo(Variant::NIL, "value"), "set_constant_value", "get_constant_value"); + ADD_PROPERTY(PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT), "set_constant_value", "get_constant_value"); } class VisualScriptNodeInstanceConstant : public VisualScriptNodeInstance { @@ -1598,7 +1599,7 @@ VisualScriptNodeInstance *VisualScriptClassConstant::instance(VisualScriptInstan void VisualScriptClassConstant::_validate_property(PropertyInfo &property) const { - if (property.name == "constant/constant") { + if (property.name == "constant") { List<String> constants; ClassDB::get_integer_constant_list(base_type, &constants, true); @@ -1727,7 +1728,7 @@ VisualScriptNodeInstance *VisualScriptBasicTypeConstant::instance(VisualScriptIn void VisualScriptBasicTypeConstant::_validate_property(PropertyInfo &property) const { - if (property.name == "constant/constant") { + if (property.name == "constant") { List<StringName> constants; Variant::get_numeric_constants_for_type(type, &constants); @@ -2689,7 +2690,7 @@ VisualScriptNodeInstance *VisualScriptCustomNode::instance(VisualScriptInstance } void VisualScriptCustomNode::_script_changed() { - ports_changed_notify(); + call_deferred("ports_changed_notify"); } void VisualScriptCustomNode::_bind_methods() { diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp index b6d4021ca3..bc033418ba 100644 --- a/modules/visual_script/visual_script_yield_nodes.cpp +++ b/modules/visual_script/visual_script_yield_nodes.cpp @@ -82,7 +82,7 @@ String VisualScriptYield::get_text() const { switch (yield_mode) { case YIELD_RETURN: return ""; break; case YIELD_FRAME: return "Next Frame"; break; - case YIELD_FIXED_FRAME: return "Next Fixed Frame"; break; + case YIELD_PHYSICS_FRAME: return "Next Fixed Frame"; break; case YIELD_WAIT: return rtos(wait_time) + " sec(s)"; break; } @@ -122,7 +122,7 @@ public: ret = STEP_EXIT_FUNCTION_BIT; break; //return the yield case VisualScriptYield::YIELD_FRAME: state->connect_to_signal(tree, "idle_frame", Array()); break; - case VisualScriptYield::YIELD_FIXED_FRAME: state->connect_to_signal(tree, "fixed_frame", Array()); break; + case VisualScriptYield::YIELD_PHYSICS_FRAME: state->connect_to_signal(tree, "physics_frame", Array()); break; case VisualScriptYield::YIELD_WAIT: state->connect_to_signal(tree->create_timer(wait_time).ptr(), "timeout", Array()); break; } @@ -190,7 +190,7 @@ void VisualScriptYield::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "wait_time"), "set_wait_time", "get_wait_time"); BIND_ENUM_CONSTANT(YIELD_FRAME); - BIND_ENUM_CONSTANT(YIELD_FIXED_FRAME); + BIND_ENUM_CONSTANT(YIELD_PHYSICS_FRAME); BIND_ENUM_CONSTANT(YIELD_WAIT); } @@ -597,7 +597,7 @@ static Ref<VisualScriptNode> create_yield_signal_node(const String &p_name) { void register_visual_script_yield_nodes() { VisualScriptLanguage::singleton->add_register_func("functions/wait/wait_frame", create_yield_node<VisualScriptYield::YIELD_FRAME>); - VisualScriptLanguage::singleton->add_register_func("functions/wait/wait_fixed_frame", create_yield_node<VisualScriptYield::YIELD_FIXED_FRAME>); + VisualScriptLanguage::singleton->add_register_func("functions/wait/wait_physics_frame", create_yield_node<VisualScriptYield::YIELD_PHYSICS_FRAME>); VisualScriptLanguage::singleton->add_register_func("functions/wait/wait_time", create_yield_node<VisualScriptYield::YIELD_WAIT>); VisualScriptLanguage::singleton->add_register_func("functions/yield", create_yield_node<VisualScriptYield::YIELD_RETURN>); diff --git a/modules/visual_script/visual_script_yield_nodes.h b/modules/visual_script/visual_script_yield_nodes.h index d074962471..4a595a875a 100644 --- a/modules/visual_script/visual_script_yield_nodes.h +++ b/modules/visual_script/visual_script_yield_nodes.h @@ -39,7 +39,7 @@ public: enum YieldMode { YIELD_RETURN, YIELD_FRAME, - YIELD_FIXED_FRAME, + YIELD_PHYSICS_FRAME, YIELD_WAIT }; |