Skip to content

Commit 0b2f4fd

Browse files
committed
Node parameter
1 parent 003c38a commit 0b2f4fd

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

node-graph/nodes/vector/src/generator_nodes.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use core_types::Ctx;
2-
use core_types::context::ExtractFootprint;
32
use core_types::registry::types::{Angle, PixelLength, PixelSize};
43
use core_types::table::Table;
54
use dyn_any::DynAny;
@@ -391,7 +390,7 @@ fn grid<T: GridSpacing>(
391390

392391
#[node_macro::node(category("Vector: Shape"), name("Aperiodic Tiling"))]
393392
fn aperiodic_tiling(
394-
ctx: impl Ctx + ExtractFootprint,
393+
_: impl Ctx,
395394
_primary: (),
396395
#[unit(" px")]
397396
#[default(10.)]
@@ -401,10 +400,22 @@ fn aperiodic_tiling(
401400
#[hard_min(1.)]
402401
#[hard_max(6.)]
403402
levels: u32,
403+
#[expose]
404+
#[default(false)]
405+
cull_viewport: bool,
406+
#[expose]
407+
#[default((0., 0.).into())]
408+
culling_bound_min: DVec2,
409+
#[expose]
410+
#[default((100., 100.).into())]
411+
culling_bound_max: DVec2,
404412
) -> Table<Vector> {
405-
let footprint = ctx.footprint();
406-
let bounds = footprint.viewport_bounds_in_local_space();
407-
let vector = crate::aperiodic_tiling::generate_hat_tiling(levels, scale, Some([bounds.start, bounds.end]));
413+
let culling_bounds = if cull_viewport {
414+
Some([culling_bound_min, culling_bound_max])
415+
} else {
416+
None
417+
};
418+
let vector = crate::aperiodic_tiling::generate_hat_tiling(levels, scale, culling_bounds);
408419
Table::new_from_element(vector)
409420
}
410421

0 commit comments

Comments
 (0)