Need feed back on new "Asset Consolidation" script
Moderators: Víctor Paredes, Belgarath, slowtiger
Need feed back on new "Asset Consolidation" script
Below is my proposed steps for the function of an asset consolidation script. Everything described below works well from some basic testing. I would just like feed back on what others think.
Proposed functionality for AS File Asset Consolidation script
Description:
The goal of this script is to save AS files to a new location and copy all linked assets to a new organized directory structure for easy portability.
This script will require an enclosing project folder to be created. Step 4 can be done ahead of time or during the save as step.
1. Open AS file for consolidation.
2. Select Save as... from the File menu.
3. Navigate to the desired location to save the consolidated file and assets.
4. Create a project folder to contain the asset folders
5. Save the file.
6. Run the consolidation script.
The script will produce the following directories inside the project folder based on any linked assets in the AS file:
Project Folder (user created)
----->images
----->audio
----->scripts
If the file contains any linked assets they will be copied from the "old" locations and saved to the new location in the appropriate folder. Folders will not be created for any assets that aren't in the file.
At the end of the process the script will produce a text file that contains the path locations of the original files. This could be used to find them on the hard drive and delete them manually or whatever. (I'm adding this for me... I can tend to get a bit disorganized when I'm in a hurry.)
I was hoping to have the script consolidate files without needing to open in AS. Unfortunately I don't think that will work so I'm going with the "sure thing" that I know works well.
------
I will also need help from linux users at some point. I have Mac and PC versions to test with. I am pretty sure the Mac "version" will work with linux because they use similar OS commands but can't be sure.
Please let me know what you think. If you have any other ideas for other options or things I missed post them here and I will look at them and consider them.
-vern
Proposed functionality for AS File Asset Consolidation script
Description:
The goal of this script is to save AS files to a new location and copy all linked assets to a new organized directory structure for easy portability.
This script will require an enclosing project folder to be created. Step 4 can be done ahead of time or during the save as step.
1. Open AS file for consolidation.
2. Select Save as... from the File menu.
3. Navigate to the desired location to save the consolidated file and assets.
4. Create a project folder to contain the asset folders
5. Save the file.
6. Run the consolidation script.
The script will produce the following directories inside the project folder based on any linked assets in the AS file:
Project Folder (user created)
----->images
----->audio
----->scripts
If the file contains any linked assets they will be copied from the "old" locations and saved to the new location in the appropriate folder. Folders will not be created for any assets that aren't in the file.
At the end of the process the script will produce a text file that contains the path locations of the original files. This could be used to find them on the hard drive and delete them manually or whatever. (I'm adding this for me... I can tend to get a bit disorganized when I'm in a hurry.)
I was hoping to have the script consolidate files without needing to open in AS. Unfortunately I don't think that will work so I'm going with the "sure thing" that I know works well.
------
I will also need help from linux users at some point. I have Mac and PC versions to test with. I am pretty sure the Mac "version" will work with linux because they use similar OS commands but can't be sure.
Please let me know what you think. If you have any other ideas for other options or things I missed post them here and I will look at them and consider them.
-vern
I think it would be handy for some people who like to create everything in AS. Personally I have not really had a problem with misplaced images or audio etc as I use AS purely for animating scenes and composite them with audio etc in a secondary video editing app. But that said, it's something that I may end up having a use for.
D.K
D.K
- synthsin75
- Posts: 10276
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
Here's the implementation I was thinking of:
1) Open any previoously saved AS file (or save the new file to any location).
2) Run script. This will create the project folder in the same location as the AS file, move the AS file into it, and copy (or have the option to move, so you don't have to hunt up stray files) the resources read from the file format.
The project folder would just automatically be named the same as the AS file.

1) Open any previoously saved AS file (or save the new file to any location).
2) Run script. This will create the project folder in the same location as the AS file, move the AS file into it, and copy (or have the option to move, so you don't have to hunt up stray files) the resources read from the file format.
The project folder would just automatically be named the same as the AS file.

in looking it over again.. it appears I may have to go with my original concept that does the whole thing in one process and doesn't require opening the AS file at all.rylleman wrote:Sounds useful.
Are there no way to get around steps 2-5? Seems easier if those could be done directly from the script.
You would just launch AS with any file open even just a blank one (have to have something open), and run the script, select the file to consolidate and a new location for it and it would copy and modify that file, and copy all the assets.
The reason I didn't like that version is due to a strange step that involves saving an "untitled" document to the new location. It is the only way to get the path to the new folder to move all the files. This "untitled' file would eventually "become" the copied AS file and renamed. Or the user would have to type the name by hand WITH the extension... which to me is a pain in the arse. Having to save that untitled file seems odd to me. Like it might be confusing.
I can't figure out anyway to insert the name of the original selected AS file into the "save" dialog within the AS script interface. There is no option to do this. You can't get the path to the new location first unless you save a file. Only the "File/Save as..." menu would keep the original name.
-------
DK, the reason this would be very useful for me at least, is if you use a lot of layer scripts and use images from another project or location. If you have scripts in one place and link to them for layer scripts and forget possibly where they all are or which version it is etc, this could gather them up. If you import an image layer from another project or say, import another whole AS file or character layer into a different project in another folder, you can then consolidate all of those parts into one folder.
Imagine if you opened a file after 6 months... and you didn't know exactly where all the assets were. Maybe the last time you worked on it you were experimenting with a different layer script somewhere else, or different images etc. This could save a lot of fiddling around. Just consolidate it to a new location and your good to go. No worries.
Still early days yet. Keep the feed back coming.
-vern
That works better!synthsin75 wrote:Here's the implementation I was thinking of:
1) Open any previoously saved AS file (or save the new file to any location).
2) Run script. This will create the project folder in the same location as the AS file, move the AS file into it, and copy (or have the option to move, so you don't have to hunt up stray files) the resources read from the file format.
The project folder would just automatically be named the same as the AS file.
I posted before I read this. The only drawback is that it won't allow saving to a different location using the script but that is very minor I think. You could always do a save as to a new location and THEN run the script.... which is pretty much what I described above. That would work.
This is great! Use the name of the file for the new folder. Create the folders in the same place as the original file then there is no need to find the path to any new location.
Thanks for that one Synth. I over complicate sometimes.
-vern
- synthsin75
- Posts: 10276
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
I just so happened to have put quite a bit of thought into this while I was planning my script. I'm glad you can make use of it now, since it'd take me quite some time to get around to it.Thanks for that one Synth. I over complicate sometimes.

p.s. Perhaps you could make a move/copy option for each type of resource? That way the resources that you plan on being dedicated to a project can just be moved. I would want to move audio files, but may only copy scripts and images.
I don't plan on "moving" files. This is only going to be a copying or duplication process to start with. Moving stuff around on the users hard drive with AS scripting makes me VERY VERY nervous. What if AS crashed in the middle of it?
It's bad enough when my scripts don't work exactly right... I don't want that responsibility on my head just yet. It took me a couple of weeks to get over the anxiety of deleting spammer accounts on the forum.
That's why I'm going to create a text file with the locations of the originals if you want to delete duplicated files. 
I suppose this could be an option with a big red warning that I can't be held responsible.
-vern
It's bad enough when my scripts don't work exactly right... I don't want that responsibility on my head just yet. It took me a couple of weeks to get over the anxiety of deleting spammer accounts on the forum.


I suppose this could be an option with a big red warning that I can't be held responsible.
-vern
- Víctor Paredes
- Site Admin
- Posts: 5817
- Joined: Wed Jan 26, 2005 12:18 am
- Location: Barcelona/Chile
- Contact:
- synthsin75
- Posts: 10276
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
I hadn't thought about AS crashing. That's a good point. What if you had a 'clean up' button? With a warning about verifying that the resources are working properly, you could then use that text file to clean up (delete?) the scattered resources.
Mmm, maybe you're right. I don't think I'd want to delete stuff with a lua script either.
I'd go for the big red warning though. Hell, if you write the script, I can always add the move bit myself if I want it.
The only other issue I can think of would be what would happen if, after the resources are moved, the user saves the file? Would this overwrite all the changes your script just did? I don't remember if you can actually open an AS file with a script. Maybe just a warning asking the user to reopen the file?
Mmm, maybe you're right. I don't think I'd want to delete stuff with a lua script either.
I'd go for the big red warning though. Hell, if you write the script, I can always add the move bit myself if I want it.
The only other issue I can think of would be what would happen if, after the resources are moved, the user saves the file? Would this overwrite all the changes your script just did? I don't remember if you can actually open an AS file with a script. Maybe just a warning asking the user to reopen the file?
That was my concern with my ORIGINAL process. The script would be editing the OPEN file. Your description however allows me to process an open file without having it open. Yes you open the file you want to consolidate but the consolidated file is NOT opened during the process. The original is still open and still exists afterwards. I would be duplicating the open document. The user would then need to close that document and open the new one thus eliminating any issues with editing an open document.synthsin75 wrote: The only other issue I can think of would be what would happen if, after the resources are moved, the user saves the file? Would this overwrite all the changes your script just did? I don't remember if you can actually open an AS file with a script. Maybe just a warning asking the user to reopen the file?
My philosophy to stay very safe is to "do no harm". No destruction or changing of files on the hard drive. Only creation and duplication of files and folders. All the originals are left as they are. Only new files are created or existing files duplicated. This is how the consolidation feature works in Animation Master.
I would like to see if I can script the opening of the consolidated file after the script ends. There would no "save" issues with the currently open file because it would need to be saved to do the consolidation and no changes are made to it.
I'm very very close to a working prototype. So far I can copy an existing file to a new folder while creating all the asset folders. I just have to start working on the extraction of the linked assets and modifying the file before saving it. I'm so excited!
-vern