Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Blender: Fix long names for instances#6070

Merged
simonebarbieri merged 7 commits intodevelopfrom
bugfix/OP-7597-blender_fix-long-instance-names
Jan 12, 2024
Merged

Blender: Fix long names for instances#6070
simonebarbieri merged 7 commits intodevelopfrom
bugfix/OP-7597-blender_fix-long-instance-names

Conversation

@simonebarbieri
Copy link
Copy Markdown
Contributor

Changelog Description

Changed naming for instances to use only final part of the folderPath.

Additional info

With the changes from #5817, it could happen that the instance names were too long for Blender, that supports up to 63 characters long names. This PR changes the naming to be only the final part of folderPath, to have names similar to before #5817. The PR also include an error message in case a name for an instance or a container becomes too long.

Testing notes:

Creating and loading assets should work as before. Long names (more than 63 characters) will raise an error now. New instances will not have the whole folder path as name, but the instances that have should work fine, if the name is shorter than 63 characters.

@simonebarbieri simonebarbieri added type: bug Something isn't working sponsored Client endorsed or requested host: Blender labels Dec 18, 2023
@simonebarbieri simonebarbieri self-assigned this Dec 18, 2023
@ynbot
Copy link
Copy Markdown
Contributor

ynbot commented Dec 18, 2023

Task linked: OP-7597 Blender: Avalon Containers bug

@ynbot ynbot added the size/XS Denotes a PR changes 0-99 lines, ignoring general files label Dec 18, 2023
@simonebarbieri simonebarbieri changed the title Use only the final part of folderPath in the instance name Blender: Fix long names for instances Dec 18, 2023
@LiborBatek
Copy link
Copy Markdown
Member

LiborBatek commented Dec 20, 2023

gives me error when trying to load asset into my workfile

Traceback (most recent call last):

  File "C:\Users\lbate\AppData\Local\Ynput\AYON\addons\openpype_3.18.2-nightly.1\openpype\hosts\blender\api\ops.py", line 113, in execute
    result = callback(*args, **kwargs)

  File "C:\Users\lbate\AppData\Local\Ynput\AYON\addons\openpype_3.18.2-nightly.1\openpype\hosts\blender\api\plugin.py", line 484, in _load
    nodes = self.process_asset(

  File "C:\Users\lbate\AppData\Local\Ynput\AYON\addons\openpype_3.18.2-nightly.1\openpype\hosts\blender\plugins\load\load_blend.py", line 146, in process_asset
    container, members = self._process_data(libpath, group_name)

  File "C:\Users\lbate\AppData\Local\Ynput\AYON\addons\openpype_3.18.2-nightly.1\openpype\hosts\blender\plugins\load\load_blend.py", line 110, in _process_data
    bpy.data.libraries.remove(library)

TypeError: BlendDataLibraries.remove(): error with argument 1, "library" -  Function.library does not support a 'None' assignment Library type

and as seen in blender

image

@LiborBatek
Copy link
Copy Markdown
Member

LiborBatek commented Dec 21, 2023

Hmm I cant publish due to WIN file system path being too long I guess??

Gives me following error on Integrate Asset step during publish...

    return os.stat(filename).st_size
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\projects\\Ayon_Tests\\blender\\xtraLongNameFolderVariantName\\ThisHasToBeTheLongestNameEverCreatedBySomeCrazyFoolishArtistEverExisted\\publish\\workfile\\workfileModeling\\v002\\ATS_ThisHasToBeTheLongestNameEverCreatedBySomeCrazyFoolishArtistEverExisted_workfileModeling_v002.blend'

Works ok for this one (being slightly shorter)
image

@LiborBatek
Copy link
Copy Markdown
Member

Now it shows an error msg if name exceeds 63 characters during Publish Instance creation and user has to change it to a reasonable length...

Screenshot 2024-01-12 125145

Havent spotted any loading issues of assets due to long file paths so far... I will continue testing it in AYON mode (legacy mode so far)

Copy link
Copy Markdown
Member

@LiborBatek LiborBatek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didnt experience any issues neither in legacy OP nor AYON mode.

Seems working as expected in both cases.

@simonebarbieri simonebarbieri merged commit 2af78ce into develop Jan 12, 2024
@simonebarbieri simonebarbieri deleted the bugfix/OP-7597-blender_fix-long-instance-names branch January 12, 2024 15:12
@ynbot ynbot added this to the next-patch milestone Jan 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

host: Blender size/XS Denotes a PR changes 0-99 lines, ignoring general files sponsored Client endorsed or requested target: AYON type: bug Something isn't working

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants