Remap: Refactor scripts #177

Merged
Nick Alberelli merged 17 commits from :feature/refactor-remap-script into main 2023-12-07 16:17:27 +01:00
Showing only changes of commit 77d4185c2e - Show all commits

View File

@ -3,8 +3,9 @@
This directory contains scripts that are useful for re-organizing production directories. The tools are intended to be used when some directories need to be changed, and references to these directories need to be updated in .blend files. This directory contains scripts that are useful for re-organizing production directories. The tools are intended to be used when some directories need to be changed, and references to these directories need to be updated in .blend files.
## Usage ## Usage
1. Set the variable `json_file_path` to match in all script files. Set `folder_path` in both has_map script files. 1. Enter remap directory `cd blender-studio-pipeline/scripts/remap`
2. Run `hash_map_make.py` to create a JSON file listing every file in directory via hash, plus a list directories leading to that file (duplicate files included). 2. Run the remap tool via `python -m remap`. You will be prompted for a directory to map, and a location to store the map (outside of your remap directory).
3. Re-organize/rename items in the directory you have made a map for. 3. Now you are ready to re-organize your mapped directory, move files into different folders, rename files and remove duplicates.
4. Run `hash_map_update.py` to find the new locations of these files using the Hash to match them up. This will add a `new` directory for each hash. 4. Re-run the remap tool via `python -m remap` to update your map with the new file locations. The tool will print a bbatch, copy this for use in step 6.
5. Using [`bbatch`](https://projects.blender.org/studio/blender-studio-pipeline/src/branch/main/scripts/bbatch/README.md) run the script `remap_blender_paths.py` to update references in .blend files from the old path to the new path. 5. Enter bbatch directory `cd blender-studio-pipeline/scripts/bbatch`
6. Run provided bbatch command, similar to `python -m bbatch /my_files/ --script /{path_to_script}/remap_blender_paths_for_my_files.py --nosave --recursive` to update all references to the remapped directory contents in your .blend files.
TinyNick marked this conversation as resolved Outdated

Hmm, this command seems out of date?
The python file is not called remap_blender_paths_for_my_files.py anymore and it also takes the json file path as a command now.

I would also drop the leading slashed in /my_files/ and /{path_to_script}.

Also to make it consistent I would do convert my_files/ to {my_files}/ to indicate that this is something the user has to replace.

Hmm, this command seems out of date? The python file is not called `remap_blender_paths_for_my_files.py` anymore and it also takes the json file path as a command now. I would also drop the leading slashed in `/my_files/` and `/{path_to_script}`. Also to make it consistent I would do convert `my_files/` to `{my_files}/` to indicate that this is something the user has to replace.

Thank you for pointing that out. I have updated the README with this commit 104fb27eab thank you!

Thank you for pointing that out. I have updated the README with this commit 104fb27eab223b16d1a2c50e24f240126b1d7c81 thank you!