Skip to content

Commit a05b93f

Browse files
committed
Added max_simulation_size to GaeaEditorSettings; used to limit the simulation world size in PreviewTexture.
1 parent 88a772d commit a05b93f

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

addons/gaea/editor/editor_settings.gd

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const LINE_CURVATURE := "gaea/graph/line_curvature"
77
const LINE_THICKNESS := "gaea/graph/line_thickness"
88
const MINIMAP_OPACITY := "gaea/graph/minimap_opacity"
99
const GRID_PATTERN := "gaea/graph/grid_pattern"
10-
const PREVIEW_RESOLUTION := "gaea/graph/preview_resolution"
10+
const PREVIEW_RESOLUTION := "gaea/graph/preview/preview_resolution"
11+
const PREVIEW_MAX_SIMULATION_SIZE := "gaea/graph/preview/max_simulation_size"
1112
const OUTPUT_TITLE_COLOR := "gaea/graph/output_title_color"
1213
const COLOR_BASE := "gaea/graph/slot_colors/%s"
1314
const ICON_BASE := "gaea/graph/slot_icons/%s"
@@ -54,6 +55,9 @@ func add_settings() -> void:
5455
_add_setting(PREVIEW_RESOLUTION, 64, {
5556
"type": TYPE_INT
5657
})
58+
_add_setting(PREVIEW_MAX_SIMULATION_SIZE, 128, {
59+
"type": TYPE_INT
60+
})
5761

5862
_add_setting(OUTPUT_TITLE_COLOR, Color("632639"), {"type": TYPE_COLOR, "hint": PROPERTY_HINT_COLOR_NO_ALPHA})
5963

@@ -131,3 +135,7 @@ static func get_grid_pattern() -> int:
131135

132136
static func get_preview_resolution() -> int:
133137
return EditorInterface.get_editor_settings().get_setting(PREVIEW_RESOLUTION)
138+
139+
140+
static func get_preview_max_simulation_size() -> int:
141+
return EditorInterface.get_editor_settings().get_setting(PREVIEW_MAX_SIMULATION_SIZE)

addons/gaea/graph/components/preview_texture.gd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,12 @@ func update() -> void:
7474
else:
7575
resolution = Vector2i(preview_resolution, preview_resolution)
7676

77+
var preview_max_sim := GaeaEditorSettings.get_preview_max_simulation_size()
7778
var sim_size:Vector3
7879
match (node.resource._get_preview_simulation_size()):
7980
GaeaNodeResource.SimSize.WORLD:
80-
sim_size = node.generator.world_size
81-
_: # GaeaNodeReousrce.SimSize.PREVIEW is the default
81+
sim_size = node.generator.world_size.mini(preview_max_sim)
82+
_: # GaeaNodeReousrce.SimSize.Preview is the default
8283
sim_size = Vector3(resolution.x, resolution.y, 1)
8384

8485
var data: Dictionary = node.resource.traverse(
@@ -93,7 +94,7 @@ func update() -> void:
9394
for x: int in resolution.x:
9495
for y: int in resolution.y:
9596
var color: Color
96-
var value = data.get(Vector3i(x, y, 0))
97+
var value = data.get(Vector3i(x, y, 0) + sim_offset)
9798
if value == null:
9899
continue
99100
match node.resource.get_output_port_type(selected_output):

0 commit comments

Comments
 (0)