Single Compilation Unit build.
Adds support for simple SCU build. This speeds up compilation by compiling multiple cpp files within a single translation unit.
This commit is contained in:
@ -2227,27 +2227,6 @@ bool VisualScriptEditor::can_drop_data_fw(const Point2 &p_point, const Variant &
|
||||
return false;
|
||||
}
|
||||
|
||||
static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) {
|
||||
if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Ref<Script> scr = p_current_node->get_script();
|
||||
|
||||
if (scr.is_valid() && scr == script) {
|
||||
return p_current_node;
|
||||
}
|
||||
|
||||
for (int i = 0; i < p_current_node->get_child_count(); i++) {
|
||||
Node *n = _find_script_node(p_edited_scene, p_current_node->get_child(i), script);
|
||||
if (n) {
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
|
||||
if (p_from != graph) {
|
||||
return;
|
||||
@ -2441,7 +2420,7 @@ void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
|
||||
}
|
||||
|
||||
if (String(d["type"]) == "nodes") {
|
||||
Node *sn = _find_script_node(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root(), script);
|
||||
Node *sn = NSVisualScript::_find_script_node(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root(), script);
|
||||
|
||||
if (!sn) {
|
||||
EditorNode::get_singleton()->show_warning(vformat(TTR("Can't drop nodes because script '%s' is not used in this scene."), get_name()));
|
||||
@ -2495,7 +2474,7 @@ void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
|
||||
}
|
||||
|
||||
if (String(d["type"]) == "obj_property") {
|
||||
Node *sn = _find_script_node(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root(), script);
|
||||
Node *sn = NSVisualScript::_find_script_node(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root(), script);
|
||||
|
||||
if (!sn && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||
EditorNode::get_singleton()->show_warning(vformat(TTR("Can't drop properties because script '%s' is not used in this scene.\nDrop holding 'Shift' to just copy the signature."), get_name()));
|
||||
@ -4145,7 +4124,7 @@ void VisualScriptEditor::_default_value_edited(Node *p_button, int p_id, int p_i
|
||||
if (pinfo.type == Variant::NODE_PATH) {
|
||||
Node *edited_scene = get_tree()->get_edited_scene_root();
|
||||
if (edited_scene) { // Fixing an old crash bug ( Visual Script Crashes on editing NodePath with an empty scene open)
|
||||
Node *script_node = _find_script_node(edited_scene, edited_scene, script);
|
||||
Node *script_node = NSVisualScript::_find_script_node(edited_scene, edited_scene, script);
|
||||
|
||||
if (script_node) {
|
||||
//pick a node relative to the script, IF the script exists
|
||||
|
||||
@ -53,30 +53,7 @@ int VisualScriptFunctionCall::get_output_sequence_port_count() const {
|
||||
bool VisualScriptFunctionCall::has_input_sequence_port() const {
|
||||
return !((method_cache.flags & METHOD_FLAG_CONST && call_mode != CALL_MODE_INSTANCE) || (call_mode == CALL_MODE_BASIC_TYPE && Variant::is_method_const(basic_type, function)));
|
||||
}
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) {
|
||||
if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Ref<Script> scr = p_current_node->get_script();
|
||||
|
||||
if (scr.is_valid() && scr == script) {
|
||||
return p_current_node;
|
||||
}
|
||||
|
||||
for (int i = 0; i < p_current_node->get_child_count(); i++) {
|
||||
Node *n = _find_script_node(p_edited_scene, p_current_node->get_child(i), script);
|
||||
if (n) {
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
Node *VisualScriptFunctionCall::_get_base_node() const {
|
||||
#ifdef TOOLS_ENABLED
|
||||
Ref<Script> script = get_visual_script();
|
||||
@ -97,7 +74,7 @@ Node *VisualScriptFunctionCall::_get_base_node() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Node *script_node = _find_script_node(edited_scene, edited_scene, script);
|
||||
Node *script_node = NSVisualScript::_find_script_node(edited_scene, edited_scene, script);
|
||||
|
||||
if (!script_node) {
|
||||
return nullptr;
|
||||
@ -933,7 +910,7 @@ Node *VisualScriptPropertySet::_get_base_node() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Node *script_node = _find_script_node(edited_scene, edited_scene, script);
|
||||
Node *script_node = NSVisualScript::_find_script_node(edited_scene, edited_scene, script);
|
||||
|
||||
if (!script_node) {
|
||||
return nullptr;
|
||||
@ -1682,7 +1659,7 @@ Node *VisualScriptPropertyGet::_get_base_node() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Node *script_node = _find_script_node(edited_scene, edited_scene, script);
|
||||
Node *script_node = NSVisualScript::_find_script_node(edited_scene, edited_scene, script);
|
||||
|
||||
if (!script_node) {
|
||||
return nullptr;
|
||||
|
||||
@ -2342,7 +2342,8 @@ VisualScriptNodeInstance *VisualScriptSceneNode::instance(VisualScriptInstance *
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) {
|
||||
namespace NSVisualScript {
|
||||
Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) {
|
||||
if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -2354,7 +2355,7 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
|
||||
}
|
||||
|
||||
for (int i = 0; i < p_current_node->get_child_count(); i++) {
|
||||
Node *n = _find_script_node(p_edited_scene, p_current_node->get_child(i), script);
|
||||
Node *n = NSVisualScript::_find_script_node(p_edited_scene, p_current_node->get_child(i), script);
|
||||
if (n) {
|
||||
return n;
|
||||
}
|
||||
@ -2362,6 +2363,7 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
} //namespace NSVisualScript
|
||||
|
||||
#endif
|
||||
|
||||
@ -2389,7 +2391,7 @@ VisualScriptSceneNode::TypeGuess VisualScriptSceneNode::guess_output_type(TypeGu
|
||||
return tg;
|
||||
}
|
||||
|
||||
Node *script_node = _find_script_node(edited_scene, edited_scene, script);
|
||||
Node *script_node = NSVisualScript::_find_script_node(edited_scene, edited_scene, script);
|
||||
|
||||
if (!script_node) {
|
||||
return tg;
|
||||
@ -2426,7 +2428,7 @@ void VisualScriptSceneNode::_validate_property(PropertyInfo &property) const {
|
||||
return;
|
||||
}
|
||||
|
||||
Node *script_node = _find_script_node(edited_scene, edited_scene, script);
|
||||
Node *script_node = NSVisualScript::_find_script_node(edited_scene, edited_scene, script);
|
||||
|
||||
if (!script_node) {
|
||||
return;
|
||||
|
||||
@ -1060,4 +1060,10 @@ public:
|
||||
void register_visual_script_nodes();
|
||||
void unregister_visual_script_nodes();
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
namespace NSVisualScript {
|
||||
Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // VISUAL_SCRIPT_NODES_H
|
||||
|
||||
@ -217,30 +217,7 @@ int VisualScriptYieldSignal::get_output_sequence_port_count() const {
|
||||
bool VisualScriptYieldSignal::has_input_sequence_port() const {
|
||||
return true;
|
||||
}
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) {
|
||||
if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Ref<Script> scr = p_current_node->get_script();
|
||||
|
||||
if (scr.is_valid() && scr == script) {
|
||||
return p_current_node;
|
||||
}
|
||||
|
||||
for (int i = 0; i < p_current_node->get_child_count(); i++) {
|
||||
Node *n = _find_script_node(p_edited_scene, p_current_node->get_child(i), script);
|
||||
if (n) {
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
Node *VisualScriptYieldSignal::_get_base_node() const {
|
||||
#ifdef TOOLS_ENABLED
|
||||
Ref<Script> script = get_visual_script();
|
||||
@ -261,7 +238,7 @@ Node *VisualScriptYieldSignal::_get_base_node() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Node *script_node = _find_script_node(edited_scene, edited_scene, script);
|
||||
Node *script_node = NSVisualScript::_find_script_node(edited_scene, edited_scene, script);
|
||||
|
||||
if (!script_node) {
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user