Skip to content

Commit

Permalink
Allow disabling graph nodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
WhalesState committed Dec 20, 2024
1 parent 71a24dd commit 7e7af47
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 11 deletions.
11 changes: 11 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ opts.Add(BoolVariable("disable_navigation", "Disable 2D and 3D navigation for a
opts.Add(BoolVariable("disable_physics", "Disable 2D and 3D physics for a smaller executable", False))
opts.Add(BoolVariable("disable_visual_shader", "Disable visual shader for a smaller executable", False))
opts.Add(BoolVariable("disable_advanced_gui", "Disable advanced GUI nodes and behaviors", False))
opts.Add(BoolVariable("disable_graph", "Disable graph nodes for a smaller executable", False))
opts.Add("build_profile", "Path to a file containing a feature build profile", "")
opts.Add(BoolVariable("modules_enabled_by_default", "If no, disable all modules except ones explicitly enabled", True))
opts.Add(BoolVariable("no_editor_splash", "Don't use the custom splash screen for the editor", True))
Expand Down Expand Up @@ -1051,6 +1052,16 @@ if env["disable_advanced_gui"]:
else:
env.Append(CPPDEFINES=["ADVANCED_GUI_DISABLED"])

if env["disable_graph"]:
if env.editor_build:
print_error(
"Build option `disable_graph=yes` cannot be used for editor builds, "
"only for export template builds."
)
Exit(255)
else:
env.Append(CPPDEFINES=["_GRAPH_DISABLED"])

if env["minizip"]:
env.Append(CPPDEFINES=["MINIZIP_ENABLED"])
if env["brotli"]:
Expand Down
3 changes: 3 additions & 0 deletions scene/gui/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ from misc.utility.scons_hints import *
Import("env")

env.add_source_files(env.scene_sources, "*.cpp")

if not env["disable_graph"]:
env.add_source_files(env.scene_sources, "graph/*.cpp")
File renamed without changes.
6 changes: 3 additions & 3 deletions scene/gui/graph_edit.cpp → scene/gui/graph/graph_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
#include "scene/2d/line_2d.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
#include "scene/gui/graph_edit_arranger.h"
#include "scene/gui/graph_frame.h"
#include "scene/gui/graph_node.h"
#include "scene/gui/graph/graph_edit_arranger.h"
#include "scene/gui/graph/graph_frame.h"
#include "scene/gui/graph/graph_node.h"
#include "scene/gui/label.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/scroll_bar.h"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

#include "graph_edit_arranger.h"

#include "scene/gui/graph_edit.h"
#include "scene/gui/graph_node.h"
#include "scene/gui/graph/graph_edit.h"
#include "scene/gui/graph/graph_node.h"

void GraphEditArranger::arrange_nodes() {
ERR_FAIL_NULL(graph_edit);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include "graph_element.h"

#include "scene/gui/graph_edit.h"
#include "scene/gui/graph/graph_edit.h"
#include "scene/theme/theme_db.h"

#ifdef TOOLS_ENABLED
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion scene/gui/graph_frame.h → scene/gui/graph/graph_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#ifndef GRAPH_FRAME_H
#define GRAPH_FRAME_H

#include "scene/gui/graph_element.h"
#include "scene/gui/graph/graph_element.h"

class HBoxContainer;

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion scene/gui/graph_node.h → scene/gui/graph/graph_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#ifndef GRAPH_NODE_H
#define GRAPH_NODE_H

#include "scene/gui/graph_element.h"
#include "scene/gui/graph/graph_element.h"

class HBoxContainer;

Expand Down
14 changes: 11 additions & 3 deletions scene/register_scene_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@
#include "scene/gui/dialogs.h"
#include "scene/gui/file_dialog.h"
#include "scene/gui/flow_container.h"
#include "scene/gui/graph_edit.h"
#include "scene/gui/graph_frame.h"
#include "scene/gui/graph_node.h"
#ifndef _GRAPH_DISABLED
#include "scene/gui/graph/graph_edit.h"
#include "scene/gui/graph/graph_frame.h"
#include "scene/gui/graph/graph_node.h"
#endif // !_GRAPH_DISABLED
#include "scene/gui/grid_container.h"
#include "scene/gui/item_list.h"
#include "scene/gui/label.h"
Expand Down Expand Up @@ -504,10 +506,12 @@ void register_scene_types() {
GDREGISTER_CLASS(HSplitContainer);
GDREGISTER_CLASS(VSplitContainer);

#ifndef _GRAPH_DISABLED
GDREGISTER_CLASS(GraphElement);
GDREGISTER_CLASS(GraphNode);
GDREGISTER_CLASS(GraphFrame);
GDREGISTER_CLASS(GraphEdit);
#endif // !_GRAPH_DISABLED

OS::get_singleton()->yield(); // may take time to init

Expand Down Expand Up @@ -1292,7 +1296,9 @@ void register_scene_types() {
if (RenderingServer::get_singleton()) {
// RenderingServer needs to exist for this to succeed.
ColorPicker::init_shaders();
#ifndef _GRAPH_DISABLED
GraphEdit::init_shaders();
#endif // !_GRAPH_DISABLED
}

SceneDebugger::initialize();
Expand Down Expand Up @@ -1344,7 +1350,9 @@ void unregister_scene_types() {
ParticleProcessMaterial::finish_shaders();
CanvasItemMaterial::finish_shaders();
ColorPicker::finish_shaders();
#ifndef _GRAPH_DISABLED
GraphEdit::finish_shaders();
#endif // !_GRAPH_DISABLED
SceneStringNames::free();

OS::get_singleton()->benchmark_end_measure("Scene", "Unregister Types");
Expand Down

0 comments on commit 7e7af47

Please sign in to comment.