@@ -2252,15 +2252,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
2252
2252
..Default :: default ( )
2253
2253
} ) ,
2254
2254
) ,
2255
- PropertiesRow :: with_override(
2256
- "Skew" ,
2257
- WidgetOverride :: Vec2 ( Vec2InputSettings {
2258
- x: "X" . to_string( ) ,
2259
- y: "Y" . to_string( ) ,
2260
- unit: "°" . to_string( ) ,
2261
- ..Default :: default ( )
2262
- } ) ,
2263
- ) ,
2255
+ PropertiesRow :: with_override( "Skew" , WidgetOverride :: Custom ( "transform_skew" . to_string( ) ) ) ,
2264
2256
PropertiesRow :: with_override( "Pivot" , WidgetOverride :: Hidden ) ,
2265
2257
] ,
2266
2258
output_names: vec![ "Data" . to_string( ) ] ,
@@ -3360,6 +3352,52 @@ fn static_input_properties() -> InputProperties {
3360
3352
Ok ( vec ! [ LayoutGroup :: Row { widgets } ] )
3361
3353
} ) ,
3362
3354
) ;
3355
+ // Skew has a custom override that maps to degrees
3356
+ map. insert (
3357
+ "transform_skew" . to_string ( ) ,
3358
+ Box :: new ( |node_id, index, context| {
3359
+ let ( document_node, input_name) = node_properties:: query_node_and_input_name ( node_id, index, context) ?;
3360
+
3361
+ let mut widgets = node_properties:: start_widgets ( document_node, node_id, index, input_name, super :: utility_types:: FrontendGraphDataType :: Number , true ) ;
3362
+
3363
+ let Some ( input) = document_node. inputs . get ( index) else {
3364
+ return Err ( "Input not found in transform skew input override" . to_string ( ) ) ;
3365
+ } ;
3366
+ if let Some ( & TaggedValue :: DVec2 ( val) ) = input. as_non_exposed_value ( ) {
3367
+ let to_skew = |input : & NumberInput | input. value . unwrap ( ) . to_radians ( ) . tan ( ) ;
3368
+ widgets. extend_from_slice ( & [
3369
+ Separator :: new ( SeparatorType :: Unrelated ) . widget_holder ( ) ,
3370
+ NumberInput :: new ( Some ( val. x . atan ( ) . to_degrees ( ) ) )
3371
+ . label ( "X" )
3372
+ . unit ( "°" )
3373
+ . min ( -89.9 )
3374
+ . max ( 89.9 )
3375
+ . on_update ( node_properties:: update_value (
3376
+ move |input : & NumberInput | TaggedValue :: DVec2 ( DVec2 :: new ( to_skew ( input) , val. y ) ) ,
3377
+ node_id,
3378
+ index,
3379
+ ) )
3380
+ . on_commit ( node_properties:: commit_value)
3381
+ . widget_holder ( ) ,
3382
+ Separator :: new ( SeparatorType :: Related ) . widget_holder ( ) ,
3383
+ NumberInput :: new ( Some ( val. y . atan ( ) . to_degrees ( ) ) )
3384
+ . label ( "Y" )
3385
+ . unit ( "°" )
3386
+ . min ( -89.9 )
3387
+ . max ( 89.9 )
3388
+ . on_update ( node_properties:: update_value (
3389
+ move |input : & NumberInput | TaggedValue :: DVec2 ( DVec2 :: new ( val. x , to_skew ( input) ) ) ,
3390
+ node_id,
3391
+ index,
3392
+ ) )
3393
+ . on_commit ( node_properties:: commit_value)
3394
+ . widget_holder ( ) ,
3395
+ ] ) ;
3396
+ }
3397
+
3398
+ Ok ( vec ! [ LayoutGroup :: Row { widgets } ] )
3399
+ } ) ,
3400
+ ) ;
3363
3401
map. insert (
3364
3402
"text_area" . to_string ( ) ,
3365
3403
Box :: new ( |node_id, index, context| {
0 commit comments