summaryrefslogtreecommitdiff
path: root/modules/visual_script/visual_script.h
diff options
context:
space:
mode:
Diffstat (limited to 'modules/visual_script/visual_script.h')
-rw-r--r--modules/visual_script/visual_script.h37
1 files changed, 14 insertions, 23 deletions
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 29309aa156..d54b1faf42 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -89,7 +89,6 @@ public:
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance) = 0;
struct TypeGuess {
-
Variant::Type type;
StringName gdclass;
Ref<Script> script;
@@ -166,16 +165,13 @@ public:
};
class VisualScript : public Script {
-
GDCLASS(VisualScript, Script);
RES_BASE_EXTENSION("vs");
public:
struct SequenceConnection {
-
union {
-
struct {
uint64_t from_node : 24;
uint64_t from_output : 16;
@@ -185,15 +181,12 @@ public:
};
bool operator<(const SequenceConnection &p_connection) const {
-
return id < p_connection.id;
}
};
struct DataConnection {
-
union {
-
struct {
uint64_t from_node : 24;
uint64_t from_port : 8;
@@ -204,7 +197,6 @@ public:
};
bool operator<(const DataConnection &p_connection) const {
-
return id < p_connection.id;
}
};
@@ -272,6 +264,8 @@ protected:
static void _bind_methods();
public:
+ bool inherits_script(const Ref<Script> &p_script) const;
+
// TODO: Remove it in future when breaking changes are acceptable
StringName get_default_func() const;
void add_function(const StringName &p_name);
@@ -429,20 +423,20 @@ public:
String to_string(bool *r_valid);
bool set_variable(const StringName &p_variable, const Variant &p_value) {
-
Map<StringName, Variant>::Element *E = variables.find(p_variable);
- if (!E)
+ if (!E) {
return false;
+ }
E->get() = p_value;
return true;
}
bool get_variable(const StringName &p_variable, Variant *r_variable) const {
-
const Map<StringName, Variant>::Element *E = variables.find(p_variable);
- if (!E)
+ if (!E) {
return false;
+ }
*r_variable = E->get();
return true;
@@ -474,7 +468,6 @@ public:
};
class VisualScriptFunctionState : public Reference {
-
GDCLASS(VisualScriptFunctionState, Reference);
friend class VisualScriptInstance;
@@ -505,11 +498,9 @@ public:
typedef Ref<VisualScriptNode> (*VisualScriptNodeRegisterFunc)(const String &p_type);
class VisualScriptLanguage : public ScriptLanguage {
-
Map<String, VisualScriptNodeRegisterFunc> register_funcs;
struct CallLevel {
-
Variant *stack;
Variant **work_mem;
const StringName *function;
@@ -538,12 +529,13 @@ public:
bool debug_break_parse(const String &p_file, int p_node, const String &p_error);
_FORCE_INLINE_ void enter_function(VisualScriptInstance *p_instance, const StringName *p_function, Variant *p_stack, Variant **p_work_mem, int *current_id) {
-
- if (Thread::get_main_id() != Thread::get_caller_id())
+ if (Thread::get_main_id() != Thread::get_caller_id()) {
return; //no support for other threads than main for now
+ }
- if (EngineDebugger::get_script_debugger()->get_lines_left() > 0 && EngineDebugger::get_script_debugger()->get_depth() >= 0)
+ if (EngineDebugger::get_script_debugger()->get_lines_left() > 0 && EngineDebugger::get_script_debugger()->get_depth() >= 0) {
EngineDebugger::get_script_debugger()->set_depth(EngineDebugger::get_script_debugger()->get_depth() + 1);
+ }
if (_debug_call_stack_pos >= _debug_max_call_stack) {
//stack overflow
@@ -561,15 +553,15 @@ public:
}
_FORCE_INLINE_ void exit_function() {
-
- if (Thread::get_main_id() != Thread::get_caller_id())
+ if (Thread::get_main_id() != Thread::get_caller_id()) {
return; //no support for other threads than main for now
+ }
- if (EngineDebugger::get_script_debugger()->get_lines_left() > 0 && EngineDebugger::get_script_debugger()->get_depth() >= 0)
+ if (EngineDebugger::get_script_debugger()->get_lines_left() > 0 && EngineDebugger::get_script_debugger()->get_depth() >= 0) {
EngineDebugger::get_script_debugger()->set_depth(EngineDebugger::get_script_debugger()->get_depth() - 1);
+ }
if (_debug_call_stack_pos == 0) {
-
_debug_error = "Stack Underflow (Engine Bug)";
EngineDebugger::get_script_debugger()->debug(this);
return;
@@ -643,7 +635,6 @@ public:
//aid for registering
template <class T>
static Ref<VisualScriptNode> create_node_generic(const String &p_name) {
-
Ref<T> node;
node.instance();
return node;