@@ -104,7 +104,7 @@ def drawTransformHandler(self, painter, sx, sy, source_width, source_height, ori
104
104
x1 = None , y1 = None , x2 = None , y2 = None , rotation = None ):
105
105
# Draw transform corners and center origin circle
106
106
# Corner size
107
- cs = 14.0
107
+ cs = self . cs
108
108
os = 12.0
109
109
110
110
# Rotate the transform handler
@@ -206,6 +206,7 @@ def paintEvent(self, event, *args):
206
206
# Calculate new frame image size, maintaining aspect ratio
207
207
pixSize = self .current_image .size ()
208
208
pixSize .scale (event .rect ().width (), event .rect ().height (), Qt .KeepAspectRatio )
209
+ self .curr_frame_size = pixSize
209
210
210
211
# Scale image
211
212
scaledPix = self .current_image .scaled (pixSize , Qt .KeepAspectRatio , Qt .SmoothTransformation )
@@ -374,7 +375,7 @@ def paintEvent(self, event, *args):
374
375
375
376
# Draw transform corners and center origin circle
376
377
# Corner size
377
- cs = 14.0
378
+ cs = self . cs
378
379
379
380
if self .regionTopLeftHandle and self .regionBottomRightHandle :
380
381
# Draw 2 corners and bounding box
@@ -805,7 +806,7 @@ def mouseMoveEvent(self, event):
805
806
if self .region_enabled :
806
807
# Modify region selection (x, y, width, height)
807
808
# Corner size
808
- cs = 14.0
809
+ cs = self . cs
809
810
810
811
# Adjust existing region coordinates (if any)
811
812
if not self .mouse_dragging and self .resize_button .isVisible () and self .resize_button .rect ().contains (event .pos ()):
@@ -1001,15 +1002,13 @@ def updateEffectProperty(self, effect_id, frame_number, property_key, new_value,
1001
1002
found_point = False
1002
1003
effect_updated = False
1003
1004
1004
- raw_properties = json .loads (self .transforming_effect_object .Json ())
1005
-
1006
1005
c = Effect .get (id = effect_id )
1007
1006
1008
1007
if not c :
1009
1008
# No clip found
1010
1009
return
1011
1010
1012
- for point in raw_properties [property_key ]["Points" ]:
1011
+ for point in c . data [property_key ]["Points" ]:
1013
1012
log .info ("looping points: co.X = %s" % point ["co" ]["X" ])
1014
1013
1015
1014
if point ["co" ]["X" ] == frame_number :
@@ -1021,18 +1020,17 @@ def updateEffectProperty(self, effect_id, frame_number, property_key, new_value,
1021
1020
if not found_point and new_value != None :
1022
1021
effect_updated = True
1023
1022
log .info ("Created new point at X=%s" % frame_number )
1024
- raw_properties [property_key ]["Points" ].append ({'co' : {'X' : frame_number , 'Y' : new_value }, 'interpolation' : openshot .BEZIER })
1023
+ c . data [property_key ]["Points" ].append ({'co' : {'X' : frame_number , 'Y' : new_value }, 'interpolation' : openshot .BEZIER })
1025
1024
1026
- raw_properties_string = json .dumps (raw_properties )
1025
+ # Reduce # of clip properties we are saving (performance boost)
1026
+ c .data = {property_key : c .data .get (property_key )}
1027
1027
1028
1028
if effect_updated :
1029
1029
c .save ()
1030
1030
# Update the preview
1031
1031
if refresh :
1032
1032
get_app ().window .refreshFrameSignal .emit ()
1033
1033
1034
- self .transforming_effect_object .SetJson (raw_properties_string )
1035
-
1036
1034
def refreshTriggered (self ):
1037
1035
"""Signal to refresh viewport (i.e. a property might have changed that effects the preview)"""
1038
1036
@@ -1202,7 +1200,9 @@ def __init__(self, watch_project=True, *args):
1202
1200
self .region_mode = None
1203
1201
self .regionTopLeftHandle = None
1204
1202
self .regionBottomRightHandle = None
1203
+ self .curr_frame_size = None # Frame size
1205
1204
self .zoom = 1.0 # Zoom of widget (does not affect video, only workspace)
1205
+ self .cs = 14.0 # Corner size of Transform Handler rectangles
1206
1206
self .resize_button = QPushButton (_ ('Reset Zoom' ), self )
1207
1207
self .resize_button .hide ()
1208
1208
self .resize_button .setStyleSheet ('QPushButton { margin: 10px; padding: 2px; }' )
0 commit comments