@@ -73,12 +73,20 @@ def changed(self, action):
73
73
74
74
75
75
def drawTransformHandler (self , painter , sx , sy , source_width , source_height , origin_x , origin_y ,
76
- x1 = None , y1 = None , x2 = None , y2 = None ):
76
+ x1 = None , y1 = None , x2 = None , y2 = None , rotation = None ):
77
77
# Draw transform corners and center origin circle
78
78
# Corner size
79
79
cs = 14.0
80
80
os = 12.0
81
81
82
+ # Rotate the transform handler
83
+ if rotation :
84
+ bbox_center_x = (((x1 * source_width + x2 * source_width ) / 2.0 ) ) - ( (os / 2 ) / sx )
85
+ bbox_center_y = (((y1 * source_height + y2 * source_height ) / 2.0 ) ) - ( (os / 2 ) / sy )
86
+ painter .translate (bbox_center_x , bbox_center_y )
87
+ painter .rotate (rotation )
88
+ painter .translate (- bbox_center_x , - bbox_center_y )
89
+
82
90
if (x1 and y1 and x2 and y2 ):
83
91
# Calculate bounds of clip
84
92
self .clipBounds = QRectF (QPointF (x1 * source_width , y1 * source_height ), QPointF (x2 * source_width , y2 * source_height ))
@@ -300,8 +308,9 @@ def paintEvent(self, event, *args):
300
308
y1 = raw_properties_effect .get ('y1' ).get ('value' )
301
309
x2 = raw_properties_effect .get ('x2' ).get ('value' )
302
310
y2 = raw_properties_effect .get ('y2' ).get ('value' )
311
+ rotation_effect = raw_properties_effect .get ('rotation' ).get ('value' )
303
312
self .drawTransformHandler (painter , sx , sy , source_width , source_height , origin_x , origin_y ,
304
- x1 , y1 , x2 , y2 )
313
+ x1 , y1 , x2 , y2 , rotation_effect )
305
314
else :
306
315
self .drawTransformHandler (painter , sx , sy , source_width , source_height , origin_x , origin_y )
307
316
@@ -605,7 +614,6 @@ def mouseMoveEvent(self, event):
605
614
origin_y = 0.0
606
615
if origin_y > 1.0 :
607
616
origin_y = 1.0
608
-
609
617
# Update keyframe value (or create new one)
610
618
self .updateClipProperty (self .transforming_clip .id , clip_frame_number , 'origin_x' , origin_x , refresh = False )
611
619
self .updateClipProperty (self .transforming_clip .id , clip_frame_number , 'origin_y' , origin_y )
@@ -951,7 +959,7 @@ def mouseMoveEvent(self, event):
951
959
elif self .transform_mode == 'scale_bottom' :
952
960
scale_y += (event .pos ().y () - self .mouse_position .y ()) / (self .clipBounds .height () / 2.0 )
953
961
elif self .transform_mode == 'scale_left' :
954
- scale_x -= (event .pos ().x () - self .mouse_position .x ()) / (self .clipBounds .width () / 2.0 )
962
+ scale_x -= (event .pos ().x () - self .mouse_position .x ()) / (self .clipBounds .width () / 2.0 )
955
963
elif self .transform_mode == 'scale_right' :
956
964
scale_x += (event .pos ().x () - self .mouse_position .x ()) / (self .clipBounds .width () / 2.0 )
957
965
@@ -1040,14 +1048,17 @@ def updateEffectProperty(self, effect_id, frame_number, property_key, new_value,
1040
1048
1041
1049
# Reduce # of clip properties we are saving (performance boost)
1042
1050
# raw_properties = {property_key: raw_properties.get(property_key)}
1051
+
1043
1052
raw_properties_string = json .dumps (raw_properties )
1044
1053
1045
1054
self .transforming_effect_object .SetJson (frame_number , raw_properties_string )
1046
1055
1047
- if refresh :
1056
+ if effect_updated :
1048
1057
c .save ()
1049
- # Update the preview
1050
- get_app ().window .refreshFrameSignal .emit ()
1058
+ if refresh :
1059
+ get_app ().window .refreshFrameSignal .emit ()
1060
+
1061
+ self .transforming_effect_object .SetJson (frame_number , raw_properties_string )
1051
1062
1052
1063
def refreshTriggered (self ):
1053
1064
"""Signal to refresh viewport (i.e. a property might have changed that effects the preview)"""
0 commit comments