@@ -16,7 +16,7 @@ use graph_craft::document::value::*;
16
16
use graph_craft:: document:: * ;
17
17
use graphene_core:: raster:: brush_cache:: BrushCache ;
18
18
use graphene_core:: raster:: image:: ImageFrameTable ;
19
- use graphene_core:: raster:: { CellularDistanceFunction , CellularReturnType , Color , DomainWarpType , FractalType , NoiseType , RedGreenBlue , RedGreenBlueAlpha } ;
19
+ use graphene_core:: raster:: { CellularDistanceFunction , CellularReturnType , Color , DomainWarpType , FractalType , NoiseType , RedGreenBlueAlpha } ;
20
20
use graphene_core:: text:: { Font , TypesettingConfig } ;
21
21
use graphene_core:: transform:: Footprint ;
22
22
use graphene_core:: vector:: VectorDataTable ;
@@ -94,30 +94,35 @@ static DOCUMENT_NODE_TYPES: once_cell::sync::Lazy<Vec<DocumentNodeDefinition>> =
94
94
/// The [`DocumentNode`] is the instance while these [`DocumentNodeDefinition`]s are the "classes" or "blueprints" from which the instances are built.
95
95
fn static_nodes ( ) -> Vec < DocumentNodeDefinition > {
96
96
let mut custom = vec ! [
97
+ // TODO: Auto-generate this from its proto node macro
97
98
DocumentNodeDefinition {
98
- identifier: "Default Network " ,
99
+ identifier: "Identity " ,
99
100
category: "General" ,
100
101
node_template: NodeTemplate {
101
102
document_node: DocumentNode {
102
- implementation: DocumentNodeImplementation :: Network ( NodeNetwork :: default ( ) ) ,
103
+ implementation: DocumentNodeImplementation :: proto( "graphene_core::ops::IdentityNode" ) ,
104
+ inputs: vec![ NodeInput :: value( TaggedValue :: None , true ) ] ,
103
105
..Default :: default ( )
104
106
} ,
105
107
persistent_node_metadata: DocumentNodePersistentMetadata {
106
- network_metadata: Some ( NodeNetworkMetadata :: default ( ) ) ,
108
+ input_properties: vec![ ( "In" , "TODO" ) . into( ) ] ,
109
+ output_names: vec![ "Out" . to_string( ) ] ,
107
110
..Default :: default ( )
108
111
} ,
109
112
} ,
110
- description: Cow :: Borrowed ( "A default node network you can use to create your own custom nodes ." ) ,
111
- properties: None ,
113
+ description: Cow :: Borrowed ( "Passes-through the input value without changing it. This is useful for rerouting wires for organization purposes ." ) ,
114
+ properties: Some ( "identity_properties" ) ,
112
115
} ,
113
116
// TODO: Auto-generate this from its proto node macro
114
117
DocumentNodeDefinition {
115
- identifier: "Identity " ,
116
- category: "General " ,
118
+ identifier: "Monitor " ,
119
+ category: "Debug " ,
117
120
node_template: NodeTemplate {
118
121
document_node: DocumentNode {
119
- implementation: DocumentNodeImplementation :: proto( "graphene_core::ops::IdentityNode " ) ,
122
+ implementation: DocumentNodeImplementation :: proto( "graphene_core::memo::MonitorNode " ) ,
120
123
inputs: vec![ NodeInput :: value( TaggedValue :: None , true ) ] ,
124
+ manual_composition: Some ( generic!( T ) ) ,
125
+ skip_deduplication: true ,
121
126
..Default :: default ( )
122
127
} ,
123
128
persistent_node_metadata: DocumentNodePersistentMetadata {
@@ -126,8 +131,24 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
126
131
..Default :: default ( )
127
132
} ,
128
133
} ,
129
- description: Cow :: Borrowed ( "Passes-through the input value without changing it. This is useful for rerouting wires for organization purposes." ) ,
130
- properties: Some ( "identity_properties" ) ,
134
+ description: Cow :: Borrowed ( "The Monitor node is used by the editor to access the data flowing through it." ) ,
135
+ properties: Some ( "monitor_properties" ) ,
136
+ } ,
137
+ DocumentNodeDefinition {
138
+ identifier: "Default Network" ,
139
+ category: "General" ,
140
+ node_template: NodeTemplate {
141
+ document_node: DocumentNode {
142
+ implementation: DocumentNodeImplementation :: Network ( NodeNetwork :: default ( ) ) ,
143
+ ..Default :: default ( )
144
+ } ,
145
+ persistent_node_metadata: DocumentNodePersistentMetadata {
146
+ network_metadata: Some ( NodeNetworkMetadata :: default ( ) ) ,
147
+ ..Default :: default ( )
148
+ } ,
149
+ } ,
150
+ description: Cow :: Borrowed ( "A default node network you can use to create your own custom nodes." ) ,
151
+ properties: None ,
131
152
} ,
132
153
DocumentNodeDefinition {
133
154
identifier: "Cache" ,
@@ -210,27 +231,6 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
210
231
description: Cow :: Borrowed ( "TODO" ) ,
211
232
properties: None ,
212
233
} ,
213
- // TODO: Auto-generate this from its proto node macro
214
- DocumentNodeDefinition {
215
- identifier: "Monitor" ,
216
- category: "Debug" ,
217
- node_template: NodeTemplate {
218
- document_node: DocumentNode {
219
- implementation: DocumentNodeImplementation :: proto( "graphene_core::memo::MonitorNode" ) ,
220
- inputs: vec![ NodeInput :: value( TaggedValue :: None , true ) ] ,
221
- manual_composition: Some ( generic!( T ) ) ,
222
- skip_deduplication: true ,
223
- ..Default :: default ( )
224
- } ,
225
- persistent_node_metadata: DocumentNodePersistentMetadata {
226
- input_properties: vec![ ( "In" , "TODO" ) . into( ) ] ,
227
- output_names: vec![ "Out" . to_string( ) ] ,
228
- ..Default :: default ( )
229
- } ,
230
- } ,
231
- description: Cow :: Borrowed ( "The Monitor node is used by the editor to access the data flowing through it." ) ,
232
- properties: Some ( "monitor_properties" ) ,
233
- } ,
234
234
DocumentNodeDefinition {
235
235
identifier: "Merge" ,
236
236
category: "General" ,
@@ -837,92 +837,6 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
837
837
description: Cow :: Borrowed ( "Generates different noise patterns." ) ,
838
838
properties: None ,
839
839
} ,
840
- // TODO: This needs to work with resolution-aware data.
841
- // TODO: Auto-generate this from its proto node macro
842
- DocumentNodeDefinition {
843
- identifier: "Mask" ,
844
- category: "Raster" ,
845
- node_template: NodeTemplate {
846
- document_node: DocumentNode {
847
- implementation: DocumentNodeImplementation :: proto( "graphene_std::raster::MaskImageNode" ) ,
848
- inputs: vec![
849
- NodeInput :: value( TaggedValue :: ImageFrame ( ImageFrameTable :: one_empty_image( ) ) , true ) ,
850
- NodeInput :: value( TaggedValue :: ImageFrame ( ImageFrameTable :: one_empty_image( ) ) , true ) ,
851
- ] ,
852
- manual_composition: Some ( generic!( T ) ) ,
853
- ..Default :: default ( )
854
- } ,
855
- persistent_node_metadata: DocumentNodePersistentMetadata {
856
- input_properties: vec![
857
- ( "Image" , "TODO" ) . into( ) ,
858
- PropertiesRow :: with_override( "Stencil" , "TODO" , WidgetOverride :: Custom ( "mask_stencil" . to_string( ) ) ) ,
859
- ] ,
860
- output_names: vec![ "Image" . to_string( ) ] ,
861
- ..Default :: default ( )
862
- } ,
863
- } ,
864
- description: Cow :: Borrowed ( "TODO" ) ,
865
- properties: None ,
866
- } ,
867
- // TODO: This needs to work with resolution-aware data.
868
- // TODO: Auto-generate this from its proto node macro
869
- DocumentNodeDefinition {
870
- identifier: "Insert Channel" ,
871
- category: "Raster" ,
872
- node_template: NodeTemplate {
873
- document_node: DocumentNode {
874
- implementation: DocumentNodeImplementation :: proto( "graphene_std::raster::InsertChannelNode" ) ,
875
- inputs: vec![
876
- NodeInput :: value( TaggedValue :: ImageFrame ( ImageFrameTable :: one_empty_image( ) ) , true ) ,
877
- NodeInput :: value( TaggedValue :: ImageFrame ( ImageFrameTable :: one_empty_image( ) ) , true ) ,
878
- NodeInput :: value( TaggedValue :: RedGreenBlue ( RedGreenBlue :: default ( ) ) , false ) ,
879
- ] ,
880
- ..Default :: default ( )
881
- } ,
882
- persistent_node_metadata: DocumentNodePersistentMetadata {
883
- input_properties: vec![
884
- ( "Image" , "TODO" ) . into( ) ,
885
- PropertiesRow :: with_override( "Insertion" , "TODO" , WidgetOverride :: Hidden ) ,
886
- ( "Into" , "TODO" ) . into( ) ,
887
- ] ,
888
- output_names: vec![ "Image" . to_string( ) ] ,
889
- ..Default :: default ( )
890
- } ,
891
- } ,
892
- description: Cow :: Borrowed ( "TODO" ) ,
893
- properties: None ,
894
- } ,
895
- // TODO: This needs to work with resolution-aware data.
896
- DocumentNodeDefinition {
897
- identifier: "Combine Channels" ,
898
- category: "Raster" ,
899
- node_template: NodeTemplate {
900
- document_node: DocumentNode {
901
- implementation: DocumentNodeImplementation :: proto( "graphene_std::raster::CombineChannelsNode" ) ,
902
- inputs: vec![
903
- NodeInput :: value( TaggedValue :: None , false ) ,
904
- NodeInput :: value( TaggedValue :: ImageFrame ( ImageFrameTable :: one_empty_image( ) ) , true ) ,
905
- NodeInput :: value( TaggedValue :: ImageFrame ( ImageFrameTable :: one_empty_image( ) ) , true ) ,
906
- NodeInput :: value( TaggedValue :: ImageFrame ( ImageFrameTable :: one_empty_image( ) ) , true ) ,
907
- NodeInput :: value( TaggedValue :: ImageFrame ( ImageFrameTable :: one_empty_image( ) ) , true ) ,
908
- ] ,
909
- ..Default :: default ( )
910
- } ,
911
- persistent_node_metadata: DocumentNodePersistentMetadata {
912
- input_properties: vec![
913
- ( "None" , "TODO" ) . into( ) ,
914
- ( "Red" , "TODO" ) . into( ) ,
915
- ( "Green" , "TODO" ) . into( ) ,
916
- ( "Blue" , "TODO" ) . into( ) ,
917
- ( "Alpha" , "TODO" ) . into( ) ,
918
- ] ,
919
- output_names: vec![ "Image" . to_string( ) ] ,
920
- ..Default :: default ( )
921
- } ,
922
- } ,
923
- description: Cow :: Borrowed ( "TODO" ) ,
924
- properties: None ,
925
- } ,
926
840
DocumentNodeDefinition {
927
841
identifier: "Split Channels" ,
928
842
category: "Raster" ,
@@ -1937,28 +1851,6 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
1937
1851
description: Cow :: Borrowed ( "TODO" ) ,
1938
1852
properties: None ,
1939
1853
} ,
1940
- #[ cfg( feature = "gpu" ) ]
1941
- DocumentNodeDefinition {
1942
- identifier: "GPU Image" ,
1943
- category: "Debug: GPU" ,
1944
- node_template: NodeTemplate {
1945
- document_node: DocumentNode {
1946
- implementation: DocumentNodeImplementation :: proto( "graphene_std::executor::MapGpuSingleImageNode" ) ,
1947
- inputs: vec![
1948
- NodeInput :: value( TaggedValue :: ImageFrame ( ImageFrameTable :: one_empty_image( ) ) , true ) ,
1949
- NodeInput :: value( TaggedValue :: DocumentNode ( DocumentNode :: default ( ) ) , true ) ,
1950
- ] ,
1951
- ..Default :: default ( )
1952
- } ,
1953
- persistent_node_metadata: DocumentNodePersistentMetadata {
1954
- input_properties: vec![ ( "Image" , "TODO" ) . into( ) , ( "Node" , "TODO" ) . into( ) ] ,
1955
- output_names: vec![ "Image" . to_string( ) ] ,
1956
- ..Default :: default ( )
1957
- } ,
1958
- } ,
1959
- description: Cow :: Borrowed ( "TODO" ) ,
1960
- properties: None ,
1961
- } ,
1962
1854
DocumentNodeDefinition {
1963
1855
identifier: "Extract" ,
1964
1856
category: "Debug" ,
@@ -1977,40 +1869,12 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
1977
1869
description: Cow :: Borrowed ( "TODO" ) ,
1978
1870
properties: None ,
1979
1871
} ,
1980
- DocumentNodeDefinition {
1981
- // Aims for interoperable compatibility with:
1982
- // https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#:~:text=%27brit%27%20%3D%20Brightness/Contrast
1983
- // https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#:~:text=Padding-,Brightness%20and%20Contrast,-Key%20is%20%27brit
1984
- identifier: "Brightness/Contrast" ,
1985
- category: "Raster: Adjustment" ,
1986
- node_template: NodeTemplate {
1987
- document_node: DocumentNode {
1988
- implementation: DocumentNodeImplementation :: proto( "graphene_core::raster::BrightnessContrastNode" ) ,
1989
- inputs: vec![
1990
- NodeInput :: value( TaggedValue :: ImageFrame ( ImageFrameTable :: one_empty_image( ) ) , true ) ,
1991
- NodeInput :: value( TaggedValue :: F64 ( 0. ) , false ) ,
1992
- NodeInput :: value( TaggedValue :: F64 ( 0. ) , false ) ,
1993
- NodeInput :: value( TaggedValue :: Bool ( false ) , false ) ,
1994
- ] ,
1995
- ..Default :: default ( )
1996
- } ,
1997
- persistent_node_metadata: DocumentNodePersistentMetadata {
1998
- input_properties: vec![
1999
- ( "Image" , "TODO" ) . into( ) ,
2000
- PropertiesRow :: with_override( "Brightness" , "TODO" , WidgetOverride :: Custom ( "brightness" . to_string( ) ) ) ,
2001
- PropertiesRow :: with_override( "Brightness" , "TODO" , WidgetOverride :: Custom ( "contrast" . to_string( ) ) ) ,
2002
- ( "Use Classic" , "TODO" ) . into( ) ,
2003
- ] ,
2004
- output_names: vec![ "Image" . to_string( ) ] ,
2005
- ..Default :: default ( )
2006
- } ,
2007
- } ,
2008
- description: Cow :: Borrowed ( "TODO" ) ,
2009
- properties: None ,
2010
- } ,
2011
1872
// Aims for interoperable compatibility with:
2012
1873
// https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#:~:text=levl%27%20%3D%20Levels-,%27curv%27%20%3D%20Curves,-%27expA%27%20%3D%20Exposure
2013
1874
// https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#:~:text=Max%20input%20range-,Curves,-Curves%20settings%20files
1875
+ //
1876
+ // Some further analysis available at:
1877
+ // https://geraldbakker.nl/psnumbers/curves.html
2014
1878
// TODO: Fix this, it's currently broken
2015
1879
// DocumentNodeDefinition {
2016
1880
// identifier: "Curves",
@@ -2034,51 +1898,6 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
2034
1898
// properties: None,
2035
1899
// },
2036
1900
// (*IMAGINATE_NODE).clone(),
2037
- DocumentNodeDefinition {
2038
- identifier: "Line" ,
2039
- category: "Vector: Shape" ,
2040
- node_template: NodeTemplate {
2041
- document_node: DocumentNode {
2042
- implementation: DocumentNodeImplementation :: proto( "graphene_core::vector::generator_nodes::LineNode" ) ,
2043
- manual_composition: Some ( concrete!( Context ) ) ,
2044
- inputs: vec![
2045
- NodeInput :: value( TaggedValue :: None , false ) ,
2046
- NodeInput :: value( TaggedValue :: DVec2 ( DVec2 :: new( 0. , -50. ) ) , false ) ,
2047
- NodeInput :: value( TaggedValue :: DVec2 ( DVec2 :: new( 0. , 50. ) ) , false ) ,
2048
- ] ,
2049
- ..Default :: default ( )
2050
- } ,
2051
- persistent_node_metadata: DocumentNodePersistentMetadata {
2052
- input_properties: vec![
2053
- ( "None" , "TODO" ) . into( ) ,
2054
- PropertiesRow :: with_override(
2055
- "Start" ,
2056
- "TODO" ,
2057
- WidgetOverride :: Vec2 ( Vec2InputSettings {
2058
- x: "X" . to_string( ) ,
2059
- y: "Y" . to_string( ) ,
2060
- unit: " px" . to_string( ) ,
2061
- ..Default :: default ( )
2062
- } ) ,
2063
- ) ,
2064
- PropertiesRow :: with_override(
2065
- "End" ,
2066
- "TODO" ,
2067
- WidgetOverride :: Vec2 ( Vec2InputSettings {
2068
- x: "X" . to_string( ) ,
2069
- y: "Y" . to_string( ) ,
2070
- unit: " px" . to_string( ) ,
2071
- ..Default :: default ( )
2072
- } ) ,
2073
- ) ,
2074
- ] ,
2075
- output_names: vec![ "Vector" . to_string( ) ] ,
2076
- ..Default :: default ( )
2077
- } ,
2078
- } ,
2079
- description: Cow :: Borrowed ( "TODO" ) ,
2080
- properties: None ,
2081
- } ,
2082
1901
DocumentNodeDefinition {
2083
1902
identifier: "Path" ,
2084
1903
category: "Vector" ,
@@ -2948,6 +2767,7 @@ pub static NODE_OVERRIDES: once_cell::sync::Lazy<NodeProperties> = once_cell::sy
2948
2767
/// Defines the logic for inputs to display a custom properties panel widget.
2949
2768
fn static_node_properties ( ) -> NodeProperties {
2950
2769
let mut map: NodeProperties = HashMap :: new ( ) ;
2770
+ map. insert ( "brightness_contrast_properties" . to_string ( ) , Box :: new ( node_properties:: brightness_contrast_properties) ) ;
2951
2771
map. insert ( "channel_mixer_properties" . to_string ( ) , Box :: new ( node_properties:: channel_mixer_properties) ) ;
2952
2772
map. insert ( "fill_properties" . to_string ( ) , Box :: new ( node_properties:: fill_properties) ) ;
2953
2773
map. insert ( "stroke_properties" . to_string ( ) , Box :: new ( node_properties:: stroke_properties) ) ;
0 commit comments