← Back to team overview

openshot.code team mailing list archive

[Branch ~openshot.code/openshot/main] Rev 711: Added the ability to drop an effect on a track, which then applies it to all clips on the track, ...

 

------------------------------------------------------------
revno: 711
fixes bug: https://launchpad.net/bugs/1049488
committer: Jonathan Thomas <Jonathan.Oomph@xxxxxxxxx>
branch nick: openshot
timestamp: Wed 2012-09-12 02:02:29 -0500
message:
  Added the ability to drop an effect on a track, which then applies it to all clips on the track, and also added a super cool checkbox to the "Clip Properties / Effect Tab", called "Apply effects to all clips on track", which takes the entire stack of effects (or lack of effects), and applies it to all clips on the same track. Seems to work really good, and really improves the ability to manage lots of effects across lots of clips.
modified:
  openshot/windows/ClipProperties.py
  openshot/windows/MainGTK.py
  openshot/windows/ui/ClipProperties.ui


--
lp:openshot
https://code.launchpad.net/~openshot.code/openshot/main

Your team OpenShot Code is subscribed to branch lp:openshot.
To unsubscribe from this branch go to https://code.launchpad.net/~openshot.code/openshot/main/+edit-subscription
=== modified file 'openshot/windows/ClipProperties.py'
--- openshot/windows/ClipProperties.py	2012-09-07 03:12:12 +0000
+++ openshot/windows/ClipProperties.py	2012-09-12 07:02:29 +0000
@@ -97,6 +97,7 @@
 		self.txtRotate.set_value(round(self.current_clip.rotation, 2))
 		self.sliderVolume.set_value(self.current_clip.volume)
 		self.chkFill.set_active(self.current_clip.fill)
+		self.chkEffectsApplyAll.set_active(False)
 		
 		if self.current_clip.distort:
 			self.chkMaintainAspect.set_active(False)
@@ -1006,7 +1007,14 @@
 			self.apply_settings(self.current_clip)
 			
 			# update the effects list
-			self.current_clip.effects = copy.deepcopy(self.copy_of_clip.effects)
+			if not self.chkEffectsApplyAll.get_active():
+				# Apply effects to just this clip
+				self.current_clip.effects = copy.deepcopy(self.copy_of_clip.effects)
+			else:
+				# Apply to all clips on this track
+				for other_clip in self.current_clip.parent.clips:
+					# Apply effects to all clips
+					other_clip.effects = copy.deepcopy(self.copy_of_clip.effects)
 			
 			# mark project as modified
 			self.project.set_project_modified(is_modified=True, refresh_xml=True, type = self._("Modified clip properties"))

=== modified file 'openshot/windows/MainGTK.py'
--- openshot/windows/MainGTK.py	2012-09-10 04:31:28 +0000
+++ openshot/windows/MainGTK.py	2012-09-12 07:02:29 +0000
@@ -307,12 +307,20 @@
 										 dnd_list, gtk.gdk.ACTION_COPY)
 
 
+		# Drag signals for the main canvas widget
 		self.MyCanvas.drag_dest_set(0, [], 0)
 		self.MyCanvas.connect('drag_motion', self.motion_cb)
 		self.MyCanvas.connect('drag_drop', self.drop_cb)
 		self.MyCanvas.connect('motion_notify_event', self.canvas_motion_notify)
 		self.last_files_added = ""
 		
+		# Drag signals for the track names (left canvas)
+		self.MyCanvas_Left.drag_dest_set(0, [], 0)
+		self.MyCanvas_Left.connect('drag_motion', self.motion_over_tracks)
+		self.MyCanvas_Left.connect('drag_drop', self.drop_cb)
+		self.MyCanvas_Left.connect('motion_notify_event', self.canvas_motion_notify)
+		self.dropped_on_tracks = False
+		
 		
 		
 		# track the cursor, and what position it was last changed
@@ -1165,6 +1173,9 @@
 		# set the drag status
 		context.drag_status(gtk.gdk.ACTION_COPY, time)
 		
+		# This was not dropped on the track names
+		self.dropped_on_tracks = False
+		
 		if self.drag_type == "file":
 			# call file drag method
 			self.motion_file_drag(wid, context, x, y, time)
@@ -1174,6 +1185,26 @@
 			self.motion_transition_drag(wid, context, x, y, time)
 		
 		return True
+	
+	#////////////////////
+	def motion_over_tracks(self, wid, context, x, y, time):
+		
+		# track context object
+		self.tree_drag_context = context
+		self.tree_drag_time = time
+
+		# set the drag status
+		context.drag_status(gtk.gdk.ACTION_COPY, time)
+		
+		if self.drag_type == "effect":
+			# Yes, dropped on the track names
+			self.dropped_on_tracks = True
+			
+			# Only allow effects
+			return True
+		else:
+			return False
+	
 
 	def motion_tree(self, wid, context, x, y, time):
 		
@@ -1350,20 +1381,27 @@
 				# get pixel settings
 				pixels_per_second = self.project.sequences[0].get_pixels_per_second()
 				
-				# find clip (if any)
-				for clip in drop_track.clips:
-					if adjusted_x >= (clip.position_on_track * pixels_per_second) and adjusted_x <= ((clip.position_on_track + clip.length()) * pixels_per_second):
-
-						# Get Effect service name
-						selected = self.icvEffects.get_selected_items()
-						if len(selected) > 1:
-							return
-						i = selected[0][0]
-						model = self.icvEffects.get_model()
-						Name_of_Effect = model[i][1]
-						Effect_Service = model[i][2]
-
-						# Add Effect to Clip
+				# Get Effect service name
+				selected = self.icvEffects.get_selected_items()
+				if len(selected) > 1:
+					return
+				i = selected[0][0]
+				model = self.icvEffects.get_model()
+				Name_of_Effect = model[i][1]
+				Effect_Service = model[i][2]
+				
+				if not self.dropped_on_tracks:
+					# ONLY APPLY EFFECT TO 1 CLIP
+					for clip in drop_track.clips:
+						# Find correct clip
+						if adjusted_x >= (clip.position_on_track * pixels_per_second) and adjusted_x <= ((clip.position_on_track + clip.length()) * pixels_per_second):
+							# Add Effect to Clip
+							clip.Add_Effect(Effect_Service)
+							self.project.Render()
+				else:
+					# APPLY EFFECT TO ALL CLIPS ON THIS TRACK
+					for clip in drop_track.clips:
+						# Add Effect to all Clips
 						clip.Add_Effect(Effect_Service)
 						self.project.Render()
 

=== modified file 'openshot/windows/ui/ClipProperties.ui'
--- openshot/windows/ui/ClipProperties.ui	2012-08-28 20:16:14 +0000
+++ openshot/windows/ui/ClipProperties.ui	2012-09-12 07:02:29 +0000
@@ -1743,6 +1743,20 @@
                             <property name="position">1</property>
                           </packing>
                         </child>
+                        <child>
+                          <object class="GtkCheckButton" id="chkEffectsApplyAll">
+                            <property name="label" translatable="yes">Apply effects to all clips on this track</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="padding">4</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
                       </object>
                       <packing>
                         <property name="resize">False</property>