prman-pixar / RenderManForBlender

RenderMan for Blender render addon
MIT License
803 stars 134 forks source link

Package Scene doesn't work if user has "assets" directory #703

Closed erjiang closed 9 months ago

erjiang commented 10 months ago

os.mkdir(os.path.join(assets_dir)) at rman_operators_utils.py:130 throws if there already is a directory called "assets"

Steps to reproduce:

  1. Create Blender scene at /my/path/scene.blend
  2. Create directory /my/path/assets
  3. Reference textures or assets in /my/path/assets from the Blender scene
  4. Open RenderMan pane and click Package Scene

Expected:

Zip archive created successfully

Actual:

Partway through, Python throws a FileExistsError at rman_operators_utils.py:130. Wrapping that line in a try handler that catches FileExistsError seems to let the job finish, but not sure if anything is broken.

prman-pixar commented 9 months ago

@erjiang were you trying to package the scene into a directory that wasn't empty?

I was half assuming people would be packaging the scene into an empty or a new directory. If that's the case, I'd rather add a warning rather than a bunch of try/except, but maybe you have a good reason to go into a non-empty directory?

prman-pixar commented 9 months ago

This should be addressed in RenderMan 26. The operator will print an error message if the selected directory is not empty.