@@ -15,7 +15,7 @@ use graph_craft::document::value::*;
15
15
use graph_craft:: document:: * ;
16
16
use graphene_core:: raster:: brush_cache:: BrushCache ;
17
17
use graphene_core:: raster:: image:: ImageFrameTable ;
18
- use graphene_core:: raster:: { Color , RedGreenBlue , RedGreenBlueAlpha } ;
18
+ use graphene_core:: raster:: { CellularDistanceFunction , CellularReturnType , Color , DomainWarpType , FractalType , NoiseType , RedGreenBlue , RedGreenBlueAlpha } ;
19
19
use graphene_core:: text:: { Font , TypesettingConfig } ;
20
20
use graphene_core:: transform:: Footprint ;
21
21
use graphene_core:: vector:: VectorDataTable ;
@@ -128,6 +128,87 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
128
128
description: Cow :: Borrowed ( "Passes-through the input value without changing it. This is useful for rerouting wires for organization purposes." ) ,
129
129
properties: Some ( "identity_properties" ) ,
130
130
} ,
131
+ DocumentNodeDefinition {
132
+ identifier: "Cache" ,
133
+ category: "General" ,
134
+ node_template: NodeTemplate {
135
+ document_node: DocumentNode {
136
+ implementation: DocumentNodeImplementation :: Network ( NodeNetwork {
137
+ exports: vec![ NodeInput :: node( NodeId ( 2 ) , 0 ) ] ,
138
+ nodes: [
139
+ DocumentNode {
140
+ inputs: vec![ NodeInput :: network( generic!( T ) , 0 ) ] ,
141
+ implementation: DocumentNodeImplementation :: ProtoNode ( ProtoNodeIdentifier :: new( "graphene_core::memo::MemoNode" ) ) ,
142
+ manual_composition: Some ( generic!( T ) ) ,
143
+ ..Default :: default ( )
144
+ } ,
145
+ DocumentNode {
146
+ inputs: vec![ NodeInput :: node( NodeId ( 0 ) , 0 ) ] ,
147
+ implementation: DocumentNodeImplementation :: ProtoNode ( ProtoNodeIdentifier :: new( "graphene_core::transform::FreezeRealTimeNode" ) ) ,
148
+ manual_composition: Some ( generic!( T ) ) ,
149
+ ..Default :: default ( )
150
+ } ,
151
+ DocumentNode {
152
+ inputs: vec![ NodeInput :: node( NodeId ( 1 ) , 0 ) ] ,
153
+ implementation: DocumentNodeImplementation :: ProtoNode ( ProtoNodeIdentifier :: new( "graphene_core::transform::BoundlessFootprintNode" ) ) ,
154
+ manual_composition: Some ( generic!( T ) ) ,
155
+ ..Default :: default ( )
156
+ } ,
157
+ ]
158
+ . into_iter( )
159
+ . enumerate( )
160
+ . map( |( id, node) | ( NodeId ( id as u64 ) , node) )
161
+ . collect( ) ,
162
+ ..Default :: default ( )
163
+ } ) ,
164
+ inputs: vec![ NodeInput :: value( TaggedValue :: None , true ) ] ,
165
+ ..Default :: default ( )
166
+ } ,
167
+ persistent_node_metadata: DocumentNodePersistentMetadata {
168
+ network_metadata: Some ( NodeNetworkMetadata {
169
+ persistent_metadata: NodeNetworkPersistentMetadata {
170
+ node_metadata: [
171
+ DocumentNodeMetadata {
172
+ persistent_metadata: DocumentNodePersistentMetadata {
173
+ display_name: "Memoize" . to_string( ) ,
174
+ node_type_metadata: NodeTypePersistentMetadata :: node( IVec2 :: new( 0 , 0 ) ) ,
175
+ ..Default :: default ( )
176
+ } ,
177
+ ..Default :: default ( )
178
+ } ,
179
+ DocumentNodeMetadata {
180
+ persistent_metadata: DocumentNodePersistentMetadata {
181
+ display_name: "Freeze Real Time" . to_string( ) ,
182
+ node_type_metadata: NodeTypePersistentMetadata :: node( IVec2 :: new( 7 , 0 ) ) ,
183
+ ..Default :: default ( )
184
+ } ,
185
+ ..Default :: default ( )
186
+ } ,
187
+ DocumentNodeMetadata {
188
+ persistent_metadata: DocumentNodePersistentMetadata {
189
+ display_name: "Boundless Footprint" . to_string( ) ,
190
+ node_type_metadata: NodeTypePersistentMetadata :: node( IVec2 :: new( 14 , 0 ) ) ,
191
+ ..Default :: default ( )
192
+ } ,
193
+ ..Default :: default ( )
194
+ } ,
195
+ ]
196
+ . into_iter( )
197
+ . enumerate( )
198
+ . map( |( id, node) | ( NodeId ( id as u64 ) , node) )
199
+ . collect( ) ,
200
+ ..Default :: default ( )
201
+ } ,
202
+ ..Default :: default ( )
203
+ } ) ,
204
+ input_properties: vec![ ( "Data" , "TODO" ) . into( ) ] ,
205
+ output_names: vec![ "Data" . to_string( ) ] ,
206
+ ..Default :: default ( )
207
+ } ,
208
+ } ,
209
+ description: Cow :: Borrowed ( "TODO" ) ,
210
+ properties: None ,
211
+ } ,
131
212
// TODO: Auto-generate this from its proto node macro
132
213
DocumentNodeDefinition {
133
214
identifier: "Monitor" ,
@@ -716,6 +797,87 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
716
797
description: Cow :: Borrowed ( "Rasterizes the given vector data" ) ,
717
798
properties: None ,
718
799
} ,
800
+ DocumentNodeDefinition {
801
+ identifier: "Noise Pattern" ,
802
+ category: "Raster" ,
803
+ node_template: NodeTemplate {
804
+ document_node: DocumentNode {
805
+ manual_composition: Some ( concrete!( Context ) ) ,
806
+ implementation: DocumentNodeImplementation :: ProtoNode ( ProtoNodeIdentifier :: new( "graphene_std::raster::NoisePatternNode" ) ) ,
807
+ inputs: vec![
808
+ NodeInput :: value( TaggedValue :: None , false ) ,
809
+ NodeInput :: value( TaggedValue :: Bool ( true ) , false ) ,
810
+ NodeInput :: value( TaggedValue :: U32 ( 0 ) , false ) ,
811
+ NodeInput :: value( TaggedValue :: F64 ( 10. ) , false ) ,
812
+ NodeInput :: value( TaggedValue :: NoiseType ( NoiseType :: default ( ) ) , false ) ,
813
+ NodeInput :: value( TaggedValue :: DomainWarpType ( DomainWarpType :: default ( ) ) , false ) ,
814
+ NodeInput :: value( TaggedValue :: F64 ( 100. ) , false ) ,
815
+ NodeInput :: value( TaggedValue :: FractalType ( FractalType :: default ( ) ) , false ) ,
816
+ NodeInput :: value( TaggedValue :: U32 ( 3 ) , false ) ,
817
+ NodeInput :: value( TaggedValue :: F64 ( 2. ) , false ) ,
818
+ NodeInput :: value( TaggedValue :: F64 ( 0.5 ) , false ) ,
819
+ NodeInput :: value( TaggedValue :: F64 ( 0. ) , false ) , // 0-1 range
820
+ NodeInput :: value( TaggedValue :: F64 ( 2. ) , false ) ,
821
+ NodeInput :: value( TaggedValue :: CellularDistanceFunction ( CellularDistanceFunction :: default ( ) ) , false ) ,
822
+ NodeInput :: value( TaggedValue :: CellularReturnType ( CellularReturnType :: default ( ) ) , false ) ,
823
+ NodeInput :: value( TaggedValue :: F64 ( 1. ) , false ) ,
824
+ ] ,
825
+ ..Default :: default ( )
826
+ } ,
827
+ persistent_node_metadata: DocumentNodePersistentMetadata {
828
+ input_properties: vec![
829
+ ( "Spacer" , "TODO" ) . into( ) ,
830
+ ( "Clip" , "TODO" ) . into( ) ,
831
+ ( "Seed" , "TODO" ) . into( ) ,
832
+ PropertiesRow :: with_override( "Scale" , "TODO" , WidgetOverride :: Custom ( "noise_properties_scale" . to_string( ) ) ) ,
833
+ PropertiesRow :: with_override( "Noise Type" , "TODO" , WidgetOverride :: Custom ( "noise_properties_noise_type" . to_string( ) ) ) ,
834
+ PropertiesRow :: with_override( "Domain Warp Type" , "TODO" , WidgetOverride :: Custom ( "noise_properties_domain_warp_type" . to_string( ) ) ) ,
835
+ PropertiesRow :: with_override( "Domain Warp Amplitude" , "TODO" , WidgetOverride :: Custom ( "noise_properties_domain_warp_amplitude" . to_string( ) ) ) ,
836
+ PropertiesRow :: with_override( "Fractal Type" , "TODO" , WidgetOverride :: Custom ( "noise_properties_fractal_type" . to_string( ) ) ) ,
837
+ PropertiesRow :: with_override( "Fractal Octaves" , "TODO" , WidgetOverride :: Custom ( "noise_properties_fractal_octaves" . to_string( ) ) ) ,
838
+ PropertiesRow :: with_override( "Fractal Lacunarity" , "TODO" , WidgetOverride :: Custom ( "noise_properties_fractal_lacunarity" . to_string( ) ) ) ,
839
+ PropertiesRow :: with_override( "Fractal Gain" , "TODO" , WidgetOverride :: Custom ( "noise_properties_fractal_gain" . to_string( ) ) ) ,
840
+ PropertiesRow :: with_override( "Fractal Weighted Strength" , "TODO" , WidgetOverride :: Custom ( "noise_properties_fractal_weighted_strength" . to_string( ) ) ) ,
841
+ PropertiesRow :: with_override( "Fractal Ping Pong Strength" , "TODO" , WidgetOverride :: Custom ( "noise_properties_ping_pong_strength" . to_string( ) ) ) ,
842
+ PropertiesRow :: with_override( "Cellular Distance Function" , "TODO" , WidgetOverride :: Custom ( "noise_properties_cellular_distance_function" . to_string( ) ) ) ,
843
+ PropertiesRow :: with_override( "Cellular Return Type" , "TODO" , WidgetOverride :: Custom ( "noise_properties_cellular_return_type" . to_string( ) ) ) ,
844
+ PropertiesRow :: with_override( "Cellular Jitter" , "TODO" , WidgetOverride :: Custom ( "noise_properties_cellular_jitter" . to_string( ) ) ) ,
845
+ ] ,
846
+ output_names: vec![ "Image" . to_string( ) ] ,
847
+ network_metadata: Some ( NodeNetworkMetadata {
848
+ persistent_metadata: NodeNetworkPersistentMetadata {
849
+ node_metadata: [
850
+ DocumentNodeMetadata {
851
+ persistent_metadata: DocumentNodePersistentMetadata {
852
+ display_name: "Noise Pattern" . to_string( ) ,
853
+ node_type_metadata: NodeTypePersistentMetadata :: node( IVec2 :: new( 0 , 0 ) ) ,
854
+ ..Default :: default ( )
855
+ } ,
856
+ ..Default :: default ( )
857
+ } ,
858
+ DocumentNodeMetadata {
859
+ persistent_metadata: DocumentNodePersistentMetadata {
860
+ display_name: "Cull" . to_string( ) ,
861
+ node_type_metadata: NodeTypePersistentMetadata :: node( IVec2 :: new( 0 , 0 ) ) ,
862
+ ..Default :: default ( )
863
+ } ,
864
+ ..Default :: default ( )
865
+ } ,
866
+ ]
867
+ . into_iter( )
868
+ . enumerate( )
869
+ . map( |( id, node) | ( NodeId ( id as u64 ) , node) )
870
+ . collect( ) ,
871
+ ..Default :: default ( )
872
+ } ,
873
+ ..Default :: default ( )
874
+ } ) ,
875
+ ..Default :: default ( )
876
+ } ,
877
+ } ,
878
+ description: Cow :: Borrowed ( "Generates different noise patterns." ) ,
879
+ properties: None ,
880
+ } ,
719
881
// TODO: This needs to work with resolution-aware (raster with footprint, post-Cull node) data.
720
882
// TODO: Auto-generate this from its proto node macro
721
883
DocumentNodeDefinition {
@@ -3559,7 +3721,7 @@ impl DocumentNodeDefinition {
3559
3721
} ;
3560
3722
nested_node_metadata. persistent_metadata . input_properties . resize_with ( input_length, PropertiesRow :: default) ;
3561
3723
3562
- //Recurse over all sub nodes if the current node is a network implementation
3724
+ // Recurse over all sub- nodes if the current node is a network implementation
3563
3725
let mut current_path = path. clone ( ) ;
3564
3726
current_path. push ( current_node) ;
3565
3727
let DocumentNodeImplementation :: Network ( template_network) = & node_template. document_node . implementation else {
0 commit comments