summaryrefslogtreecommitdiff
path: root/modules/visual_script
diff options
context:
space:
mode:
Diffstat (limited to 'modules/visual_script')
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.cpp59
-rw-r--r--modules/visual_script/visual_script_editor.cpp35
-rw-r--r--modules/visual_script/visual_script_expression.cpp4
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp22
-rw-r--r--modules/visual_script/visual_script_nodes.cpp17
5 files changed, 123 insertions, 14 deletions
diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp
index 2c8796820e..972be5f5a4 100644
--- a/modules/visual_script/visual_script_builtin_funcs.cpp
+++ b/modules/visual_script/visual_script_builtin_funcs.cpp
@@ -1175,6 +1175,65 @@ void VisualScriptBuiltinFunc::_bind_methods() {
cc += func_name[i];
}
ADD_PROPERTY(PropertyInfo(Variant::INT, "function", PROPERTY_HINT_ENUM, cc), "set_func", "get_func");
+
+ BIND_ENUM_CONSTANT(MATH_SIN);
+ BIND_ENUM_CONSTANT(MATH_COS);
+ BIND_ENUM_CONSTANT(MATH_TAN);
+ BIND_ENUM_CONSTANT(MATH_SINH);
+ BIND_ENUM_CONSTANT(MATH_COSH);
+ BIND_ENUM_CONSTANT(MATH_TANH);
+ BIND_ENUM_CONSTANT(MATH_ASIN);
+ BIND_ENUM_CONSTANT(MATH_ACOS);
+ BIND_ENUM_CONSTANT(MATH_ATAN);
+ BIND_ENUM_CONSTANT(MATH_ATAN2);
+ BIND_ENUM_CONSTANT(MATH_SQRT);
+ BIND_ENUM_CONSTANT(MATH_FMOD);
+ BIND_ENUM_CONSTANT(MATH_FPOSMOD);
+ BIND_ENUM_CONSTANT(MATH_FLOOR);
+ BIND_ENUM_CONSTANT(MATH_CEIL);
+ BIND_ENUM_CONSTANT(MATH_ROUND);
+ BIND_ENUM_CONSTANT(MATH_ABS);
+ BIND_ENUM_CONSTANT(MATH_SIGN);
+ BIND_ENUM_CONSTANT(MATH_POW);
+ BIND_ENUM_CONSTANT(MATH_LOG);
+ BIND_ENUM_CONSTANT(MATH_EXP);
+ BIND_ENUM_CONSTANT(MATH_ISNAN);
+ BIND_ENUM_CONSTANT(MATH_ISINF);
+ BIND_ENUM_CONSTANT(MATH_EASE);
+ BIND_ENUM_CONSTANT(MATH_DECIMALS);
+ BIND_ENUM_CONSTANT(MATH_STEPIFY);
+ BIND_ENUM_CONSTANT(MATH_LERP);
+ BIND_ENUM_CONSTANT(MATH_DECTIME);
+ BIND_ENUM_CONSTANT(MATH_RANDOMIZE);
+ BIND_ENUM_CONSTANT(MATH_RAND);
+ BIND_ENUM_CONSTANT(MATH_RANDF);
+ BIND_ENUM_CONSTANT(MATH_RANDOM);
+ BIND_ENUM_CONSTANT(MATH_SEED);
+ BIND_ENUM_CONSTANT(MATH_RANDSEED);
+ BIND_ENUM_CONSTANT(MATH_DEG2RAD);
+ BIND_ENUM_CONSTANT(MATH_RAD2DEG);
+ BIND_ENUM_CONSTANT(MATH_LINEAR2DB);
+ BIND_ENUM_CONSTANT(MATH_DB2LINEAR);
+ BIND_ENUM_CONSTANT(LOGIC_MAX);
+ BIND_ENUM_CONSTANT(LOGIC_MIN);
+ BIND_ENUM_CONSTANT(LOGIC_CLAMP);
+ BIND_ENUM_CONSTANT(LOGIC_NEAREST_PO2);
+ BIND_ENUM_CONSTANT(OBJ_WEAKREF);
+ BIND_ENUM_CONSTANT(FUNC_FUNCREF);
+ BIND_ENUM_CONSTANT(TYPE_CONVERT);
+ BIND_ENUM_CONSTANT(TYPE_OF);
+ BIND_ENUM_CONSTANT(TYPE_EXISTS);
+ BIND_ENUM_CONSTANT(TEXT_CHAR);
+ BIND_ENUM_CONSTANT(TEXT_STR);
+ BIND_ENUM_CONSTANT(TEXT_PRINT);
+ BIND_ENUM_CONSTANT(TEXT_PRINTERR);
+ BIND_ENUM_CONSTANT(TEXT_PRINTRAW);
+ BIND_ENUM_CONSTANT(VAR_TO_STR);
+ BIND_ENUM_CONSTANT(STR_TO_VAR);
+ BIND_ENUM_CONSTANT(VAR_TO_BYTES);
+ BIND_ENUM_CONSTANT(BYTES_TO_VAR);
+ BIND_ENUM_CONSTANT(COLORN);
+ BIND_ENUM_CONSTANT(FUNC_MAX);
}
VisualScriptBuiltinFunc::VisualScriptBuiltinFunc() {
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 671a507377..ee83c44793 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -491,10 +491,6 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->set_overlay(GraphNode::OVERLAY_BREAKPOINT);
}
- if (node_styles.has(node->get_category())) {
- gnode->add_style_override("frame", node_styles[node->get_category()]);
- }
-
gnode->set_meta("__vnode", node);
gnode->set_name(itos(E->get()));
gnode->connect("dragged", this, "_node_moved", varray(E->get()));
@@ -527,6 +523,25 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->connect("resize_request", this, "_comment_node_resized", varray(E->get()));
}
+ if (node_styles.has(node->get_category())) {
+ Ref<StyleBoxFlat> sbf = node_styles[node->get_category()];
+ if (gnode->is_comment())
+ sbf = EditorNode::get_singleton()->get_theme_base()->get_theme()->get_stylebox("comment", "GraphNode");
+
+ 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);
+ mono_color.a = 0.85;
+ c = mono_color;
+ }
+
+ gnode->add_color_override("title_color", c);
+ c.a = 0.7;
+ gnode->add_color_override("close_color", c);
+ gnode->add_style_override("frame", sbf);
+ }
+
int slot_idx = 0;
bool single_seq_output = node->get_output_sequence_port_count() == 1 && node->get_output_sequence_port_text(0) == String();
@@ -2753,12 +2768,12 @@ void VisualScriptEditor::_notification(int p_what) {
signal_editor->connect("changed", this, "_update_members");
List<Pair<String, Color> > colors;
- colors.push_back(Pair<String, Color>("functions", Color(1, 0.9, 0.9)));
- colors.push_back(Pair<String, Color>("data", Color(0.9, 1.0, 0.9)));
- colors.push_back(Pair<String, Color>("operators", Color(0.9, 0.9, 1.0)));
- colors.push_back(Pair<String, Color>("flow_control", Color(1.0, 1.0, 1.0)));
- colors.push_back(Pair<String, Color>("custom", Color(0.8, 1.0, 1.0)));
- colors.push_back(Pair<String, Color>("constants", Color(1.0, 0.8, 1.0)));
+ 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")));
for (List<Pair<String, Color> >::Element *E = colors.front(); E; E = E->next()) {
print_line(E->get().first);
diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp
index eae866d167..897e910f20 100644
--- a/modules/visual_script/visual_script_expression.cpp
+++ b/modules/visual_script/visual_script_expression.cpp
@@ -1023,7 +1023,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
case TK_OP_OR: op = Variant::OP_OR; break;
case TK_OP_NOT: op = Variant::OP_NOT; break;
case TK_OP_ADD: op = Variant::OP_ADD; break;
- case TK_OP_SUB: op = Variant::OP_SUBSTRACT; break;
+ case TK_OP_SUB: op = Variant::OP_SUBTRACT; break;
case TK_OP_MUL: op = Variant::OP_MULTIPLY; break;
case TK_OP_DIV: op = Variant::OP_DIVIDE; break;
case TK_OP_MOD: op = Variant::OP_MODULE; break;
@@ -1085,7 +1085,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
case Variant::OP_MODULE: priority = 2; break;
case Variant::OP_ADD: priority = 3; break;
- case Variant::OP_SUBSTRACT: priority = 3; break;
+ case Variant::OP_SUBTRACT: priority = 3; break;
case Variant::OP_SHIFT_LEFT: priority = 4; break;
case Variant::OP_SHIFT_RIGHT: priority = 4; break;
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index 5fcc5b0ad9..f02e797fe6 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -748,6 +748,13 @@ void VisualScriptFunctionCall::_bind_methods() {
BIND_ENUM_CONSTANT(CALL_MODE_NODE_PATH);
BIND_ENUM_CONSTANT(CALL_MODE_INSTANCE);
BIND_ENUM_CONSTANT(CALL_MODE_BASIC_TYPE);
+ BIND_ENUM_CONSTANT(CALL_MODE_SINGLETON);
+
+ BIND_ENUM_CONSTANT(RPC_DISABLED);
+ BIND_ENUM_CONSTANT(RPC_RELIABLE);
+ BIND_ENUM_CONSTANT(RPC_UNRELIABLE);
+ BIND_ENUM_CONSTANT(RPC_RELIABLE_TO_ID);
+ BIND_ENUM_CONSTANT(RPC_UNRELIABLE_TO_ID);
}
class VisualScriptNodeInstanceFunctionCall : public VisualScriptNodeInstance {
@@ -1487,6 +1494,19 @@ void VisualScriptPropertySet::_bind_methods() {
BIND_ENUM_CONSTANT(CALL_MODE_SELF);
BIND_ENUM_CONSTANT(CALL_MODE_NODE_PATH);
BIND_ENUM_CONSTANT(CALL_MODE_INSTANCE);
+ BIND_ENUM_CONSTANT(CALL_MODE_BASIC_TYPE);
+
+ BIND_ENUM_CONSTANT(ASSIGN_OP_NONE);
+ BIND_ENUM_CONSTANT(ASSIGN_OP_ADD);
+ BIND_ENUM_CONSTANT(ASSIGN_OP_SUB);
+ BIND_ENUM_CONSTANT(ASSIGN_OP_MUL);
+ BIND_ENUM_CONSTANT(ASSIGN_OP_DIV);
+ BIND_ENUM_CONSTANT(ASSIGN_OP_MOD);
+ BIND_ENUM_CONSTANT(ASSIGN_OP_SHIFT_LEFT);
+ BIND_ENUM_CONSTANT(ASSIGN_OP_SHIFT_RIGHT);
+ BIND_ENUM_CONSTANT(ASSIGN_OP_BIT_AND);
+ BIND_ENUM_CONSTANT(ASSIGN_OP_BIT_OR);
+ BIND_ENUM_CONSTANT(ASSIGN_OP_BIT_XOR);
}
class VisualScriptNodeInstancePropertySet : public VisualScriptNodeInstance {
@@ -1526,7 +1546,7 @@ public:
value = Variant::evaluate(Variant::OP_ADD, value, p_argument);
} break;
case VisualScriptPropertySet::ASSIGN_OP_SUB: {
- value = Variant::evaluate(Variant::OP_SUBSTRACT, value, p_argument);
+ value = Variant::evaluate(Variant::OP_SUBTRACT, value, p_argument);
} break;
case VisualScriptPropertySet::ASSIGN_OP_MUL: {
value = Variant::evaluate(Variant::OP_MULTIPLY, value, p_argument);
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 39f23fcf50..16aec76e57 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -1882,6 +1882,16 @@ void VisualScriptMathConstant::_bind_methods() {
cc += const_name[i];
}
ADD_PROPERTY(PropertyInfo(Variant::INT, "constant", PROPERTY_HINT_ENUM, cc), "set_math_constant", "get_math_constant");
+
+ BIND_ENUM_CONSTANT(MATH_CONSTANT_ONE);
+ BIND_ENUM_CONSTANT(MATH_CONSTANT_PI);
+ BIND_ENUM_CONSTANT(MATH_CONSTANT_2PI);
+ BIND_ENUM_CONSTANT(MATH_CONSTANT_HALF_PI);
+ BIND_ENUM_CONSTANT(MATH_CONSTANT_E);
+ BIND_ENUM_CONSTANT(MATH_CONSTANT_SQRT2);
+ BIND_ENUM_CONSTANT(MATH_CONSTANT_INF);
+ BIND_ENUM_CONSTANT(MATH_CONSTANT_NAN);
+ BIND_ENUM_CONSTANT(MATH_CONSTANT_MAX);
}
VisualScriptMathConstant::VisualScriptMathConstant() {
@@ -3535,6 +3545,11 @@ void VisualScriptInputAction::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::STRING, "action"), "set_action_name", "get_action_name");
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Pressed,Released,JustPressed,JustReleased"), "set_action_mode", "get_action_mode");
+
+ BIND_ENUM_CONSTANT(MODE_PRESSED);
+ BIND_ENUM_CONSTANT(MODE_RELEASED);
+ BIND_ENUM_CONSTANT(MODE_JUST_PRESSED);
+ BIND_ENUM_CONSTANT(MODE_JUST_RELEASED);
}
VisualScriptInputAction::VisualScriptInputAction() {
@@ -3747,7 +3762,7 @@ void register_visual_script_nodes() {
VisualScriptLanguage::singleton->add_register_func("operators/compare/greater_equal", create_op_node<Variant::OP_GREATER_EQUAL>);
//mathematic
VisualScriptLanguage::singleton->add_register_func("operators/math/add", create_op_node<Variant::OP_ADD>);
- VisualScriptLanguage::singleton->add_register_func("operators/math/subtract", create_op_node<Variant::OP_SUBSTRACT>);
+ VisualScriptLanguage::singleton->add_register_func("operators/math/subtract", create_op_node<Variant::OP_SUBTRACT>);
VisualScriptLanguage::singleton->add_register_func("operators/math/multiply", create_op_node<Variant::OP_MULTIPLY>);
VisualScriptLanguage::singleton->add_register_func("operators/math/divide", create_op_node<Variant::OP_DIVIDE>);
VisualScriptLanguage::singleton->add_register_func("operators/math/negate", create_op_node<Variant::OP_NEGATE>);