I noticed that error when publishing a first asset Unable to retrieve version number from filename: Urbn-batman-Model-v001.ma.
We use dash - as a token separator in our file templates instead of the default underscore _.
The regex used to find the version number (here on github) is expecting an underscore [\._]v([0-9]+)
Could we either :
Add a dash [\._-]v([0-9]+)
Use a more generic approach like [^a-z\d]+v(\d+)
Make it talk to the template ?
Hereās the traceback for reference :
DEBUG: Collecting scene version from filename: Urbn-batman-Model-v001.ma
ERROR: templates:get_version_from_workfile:`Urbn-batman-Model-v001.ma` missing version string.Example `v004`
Traceback (most recent call last):
File "C:\Users\KernelPanic\AppData\Local\Ynput\AYON\dependency_packages\ayon_2310271602_windows.zip\dependencies\pyblish\plugin.py", line 527, in __explicit_process
runner(*args)
File "C:\Users\KernelPanic\AppData\Local\Ynput\AYON\addons\openpype_3.18.6\openpype\plugins\publish\collect_scene_version.py", line 63, in process
raise KnownPublishError("Unable to retrieve version number from "
openpype.pipeline.publish.publish_plugins.KnownPublishError: Unable to retrieve version number from filename: Urbn-batman-Model-v001.ma
This is too generic allowing many more characters than - and _
e.g. I can use & in filenames in windows and this regex [^a-z\d]+v(\d+) wonāt stop me.
It being configurable I personally think wouldnāt be all too bad - but I can imagine thereās some hesitance on this as well because OH BOY - do some people like to mess with the settings, breaking things they literally have no clue about with then having random errors getting spewed about on e.g. Discord which theyāve caused.
Anything thatās customizable basically also ends up being a āhey weāll also need to support this edge caseā which if thereās totally free control can easily become unmanageable.
In some way, having the AYON ecosystem is also about laying some foundational structures. Not saying that having _v is the best structure, but it does define a structure that can easily remain consistent.
I would like to add why in my company we forbid the dash - , and prefer to use the underscore _ .
On Windows, we have seen several tools (canāt remember which ones) who mistakenly treated the dash as an option tag.
Said differently, if we named a scene bottle-v1.ma , we ended up getting this error :
āthere is no option v1ā.
Thatās a problem I never faced. Old legacy code can have some hardcoded stuff that make rules hard to change later on.
On the other hand, we use underscores as a space in our entity names. sq0100_sh0010 treeHouse_int treeHouse_ext
And dashes as a token separator in our template paths.