← Back to team overview

openshot.code team mailing list archive

[Branch ~openshot.code/openshot/main] Rev 583: Fixed a few bugs related to saving projects that contained image sequences that were created by t...

 

------------------------------------------------------------
revno: 583
committer: Jonathan Thomas <Jonathan.Oomph@xxxxxxxxx>
branch nick: openshot
timestamp: Thu 2011-09-22 14:59:16 -0500
message:
  Fixed a few bugs related to saving projects that contained image sequences that were created by the animated title feature.  The file_exists_in_project() method broke when it encountered an image sequence, and image sequences inside the ".openshot" folder were not being copied correctly to the new project folder.
modified:
  openshot/classes/files.py
  openshot/classes/save_project.py


--
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/classes/files.py'
--- openshot/classes/files.py	2011-09-21 19:34:36 +0000
+++ openshot/classes/files.py	2011-09-22 19:59:16 +0000
@@ -472,12 +472,13 @@
 			# File does not exist!
 			return False
 		
-		# don't add a file that is alrady in this folder (i.e. dupe check)
+		# don't add a file that is already in this folder (i.e. dupe check)
 		for item in self.items:
-			folder = self.FindFolder(item.name)
-			if not folder:
-				if os.path.samefile(file_name, item.name):
-					return True
+			
+			if isinstance(item, OpenShotFile):
+				if item.file_type != "image sequence":
+					if os.path.samefile(file_name, item.name):
+						return True
 		
 		# didn't find a match
 		return False

=== modified file 'openshot/classes/save_project.py'
--- openshot/classes/save_project.py	2011-03-07 04:42:33 +0000
+++ openshot/classes/save_project.py	2011-09-22 19:59:16 +0000
@@ -30,27 +30,44 @@
 			# create new thumbnail folder
 			os.mkdir(os.path.join(project_object.folder, "thumbnail"))
 			
-		# copy all temp thumbnails to this project's folder
-		copy_files(os.path.join(project.USER_DIR, "thumbnail"), os.path.join(project_object.folder, "thumbnail"))
-
-		# Loop through the files, and update the thumbnail location
-		for item in project_object.project_folder.items:
-			
-			if isinstance(item, files.OpenShotFile):
-
-				# split thumbnail file path
-				(dirName, fname) = os.path.split(item.thumb_location)
-				(fileBaseName, fileExtension)=os.path.splitext(fname)
+		# copy all temp thumbnails to this project's folder (if it's different)
+		if project.USER_DIR != project_object.folder:
+			# different path, so copy thumbnails, adjust paths
+			copy_files(os.path.join(project.USER_DIR, "thumbnail"), os.path.join(project_object.folder, "thumbnail"))
+
+			# Loop through the files, and update file path for images and image sequences
+			for item in project_object.project_folder.items:
+				
+				# Is this item a File (i.e. ignore folders)
+				if isinstance(item, files.OpenShotFile):
 	
-				# update the thumbnail location
-				item.thumb_location = os.path.join(project_object.folder, "thumbnail", fname)
-				
-				# UPDATE TITLES... so they move with the project
-				# update the thumbnail location
-				if ".svg" in item.name and "thumbnail" in item.name:
+					# Get file path info for this item
 					(dirName, fname) = os.path.split(item.name)
-					(fileBaseName, fileExtension)=os.path.splitext(fname)
-					item.name = os.path.join(project_object.folder, "thumbnail", fname)
+					(thumbdirName, thumbfname) = os.path.split(item.thumb_location)
+	
+					# Update the thumbnail location
+					item.thumb_location = os.path.join(project_object.folder, "thumbnail", thumbfname)
+					
+					# if image sequence and in the .openshot folder
+					if item.file_type == "image sequence" and project.USER_DIR in item.name:
+						# Determine folder name of image sequence 
+						(rootFolder, blenderFolderName) = os.path.split(dirName)
+						
+						# create new folder (if needed)
+						if os.path.exists(os.path.join(project_object.folder, blenderFolderName)) == False:
+							# create new thumbnail folder
+							os.mkdir(os.path.join(project_object.folder, blenderFolderName))
+						
+						# Copy files to new project folder
+						copy_files(dirName, os.path.join(project_object.folder, blenderFolderName))
+						
+						# Update Path to Image Sequence
+						item.name = os.path.join(project_object.folder, blenderFolderName, fname)
+					
+					elif item.file_type == "image" and ".svg" in item.name and "thumbnail" in item.name:
+						# UPDATE TITLES... so they move with the project
+						item.name = os.path.join(project_object.folder, "thumbnail", fname)
+					
 
 
 		# clear the following temporary properties which can't be pickeled