Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDA creation fails when project name starts with number #52

Open
2 tasks done
MustafaJafar opened this issue Jul 25, 2024 · 13 comments
Open
2 tasks done

HDA creation fails when project name starts with number #52

MustafaJafar opened this issue Jul 25, 2024 · 13 comments
Labels
sponsored This is directly sponsored by a client or community member type: bug Something isn't working

Comments

@MustafaJafar
Copy link
Contributor

MustafaJafar commented Jul 25, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior:

HDA creation fails when project name starts with number.
Houdini doesn't names that start with number.
and, we currently use this hardcoded template name {project_name}{folder_path}_{node_name} for HDA asset type.
Which result in this line in Houdini's log

The name must start with an alphabetic character.

however it works fine for projects starts with an alphabetic character. here's an example from my end.

Expected Behavior:

We should find some solution for it.

Version

1.0.0

What platform you are running on?

Windows

Steps To Reproduce:

  1. Launch Houdini in an AYON project starts with a number.
  2. Create an HDA

Are there any labels you wish to add?

  • I have added the relevant labels to the bug report.

Relevant log output:

Traceback (most recent call last):
  File "E:\Ynput\ayon-houdini\client\ayon_houdini\api\plugin.py", line 125, in create
    instance_node = self.create_instance_node(
  File "E:\Ynput\ayon-houdini\client\ayon_houdini\plugins\create\create_hda.py", line 221, in create_instance_node
    hda_node = to_hda.createDigitalAsset(
  File "C:\PROGRA~1/SIDEEF~1/HOUDIN~1.805/houdini/python3.9libs\houpythonportion\ui.py", line 1119, in decorator
    return func(*args, **kwargs)
  File "C:\PROGRA~1/SIDEEF~1/HOUDIN~1.805/houdini/python3.9libs\hou.py", line 16238, in createDigitalAsset
    return _hou.Node_createDigitalAsset(self, name, hda_file_name, description, min_num_inputs, max_num_inputs, compress_contents, comment, version, save_as_embedded, ignore_external_references, compile_asset, change_node_type, create_backup, install_path)
hou.OperationFailed: The attempted operation failed.
The name must start with an alphabetic character.


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "ayon_create.io.openpype.creators.houdini.hda", line 3, in <module>
  File "E:\Ynput\ayon-houdini\client\ayon_houdini\api\creator_node_shelves.py", line 119, in create_interactive
    context.create(
  File "E:\Ynput\ayon-core\client\ayon_core\pipeline\create\context.py", line 2140, in create
    return creator.create(
  File "E:\Ynput\ayon-houdini\client\ayon_houdini\api\plugin.py", line 152, in create
    six.reraise(
  File "E:\Ynput\ayon-launcher\.venv\lib\site-packages\six.py", line 718, in reraise
    raise value.with_traceback(tb)
  File "E:\Ynput\ayon-houdini\client\ayon_houdini\api\plugin.py", line 125, in create
    instance_node = self.create_instance_node(
  File "E:\Ynput\ayon-houdini\client\ayon_houdini\plugins\create\create_hda.py", line 221, in create_instance_node
    hda_node = to_hda.createDigitalAsset(
  File "C:\PROGRA~1/SIDEEF~1/HOUDIN~1.805/houdini/python3.9libs\houpythonportion\ui.py", line 1119, in decorator
    return func(*args, **kwargs)
  File "C:\PROGRA~1/SIDEEF~1/HOUDIN~1.805/houdini/python3.9libs\hou.py", line 16238, in createDigitalAsset
    return _hou.Node_createDigitalAsset(self, name, hda_file_name, description, min_num_inputs, max_num_inputs, compress_contents, comment, version, save_as_embedded, ignore_external_references, compile_asset, change_node_type, create_backup, install_path)
ayon_core.pipeline.create.creator_plugins.CreatorError: Creator error: The attempted operation failed.
The name must start with an alphabetic character.

Additional context:

Sometimes we can't avoid starting project names with numbers.

Internal Ticket Number: AY-6177

@MustafaJafar MustafaJafar added type: bug Something isn't working sponsored This is directly sponsored by a client or community member labels Jul 25, 2024
@MustafaJafar
Copy link
Contributor Author

@moonyuet @BigRoy
What do you think guys about this issue ?
I thought about exposing the HDA asset type in HDA creator settings, which may/might break something or bring this issue back ynput/ayon-core#534 .

@BigRoy
Copy link
Contributor

BigRoy commented Jul 25, 2024

I'm not sure - we may need to discuss this in a call. I still wonder why this is "so complicated" even though we have full control over how we name the HDA inside the file.

As far as I know the filename containing the HDA can have any name, including starting with a number whilst the node it defines internally we can define any name we want as well. I wonder what is currently REALLY restricting that "alphabetic number" thing, etc.

@MustafaJafar
Copy link
Contributor Author

it's the to_hda.createDigitalAsset call. it didn't like the type_name that starts with number.

@moonyuet
Copy link
Member

I'm not sure - we may need to discuss this in a call. I still wonder why this is "so complicated" even though we have full control over how we name the HDA inside the file.

As far as I know the filename containing the HDA can have any name, including starting with a number whilst the node it defines internally we can define any name we want as well. I wonder what is currently REALLY restricting that "alphabetic number" thing, etc.

This is really weird bug and it's only happened when you have a scene starting with a number?
it could have been their functions itself encounter some decoding issue when dealing with some characters.

@MustafaJafar
Copy link
Contributor Author

This is really weird bug and it's only happened when you have a scene starting with a number?

The problem happens because the project name is put at the beginning of the HDA type name template which causes Houdini to error as the asset type name in this situation will be starting by a number.

# Pick a unique type name for HDA product per folder path per project.
type_name = (
"{project_name}{folder_path}_{node_name}".format(
project_name=get_current_project_name(),
folder_path=folder_path.replace("/","_"),
node_name=node_name
)
)
hda_node = to_hda.createDigitalAsset(
name=type_name,
description=node_name,
hda_file_name="$HIP/{}.hda".format(node_name),
ignore_external_references=True
)

@BigRoy
Copy link
Contributor

BigRoy commented Jul 25, 2024

What we've done in the past when e.g. defining namespaces for maya using the folder name when a folder name started with digits (which maya doesn't like in node names or namespaces) then we prefixed it with _. I wonder if that'd be 'ok' here too?

Or does that make usage of the node that much less nice?
Or we just always prefix it with AYON_ hehe. Or hda_ - also doesn't sound too nice.

@MustafaJafar
Copy link
Contributor Author

MustafaJafar commented Jul 25, 2024

What we've done in the past when e.g. defining namespaces for maya using the folder name when a folder name started with digits (which maya doesn't like in node names or namespaces) then we prefixed it with _. I wonder if that'd be 'ok' here too?

I wonder if we should expose that template name to settings with a note about changing the name may break something ?

Or does that make usage of the node that much less nice? Or we just always prefix it with AYON_ hehe. Or hda_ - also doesn't sound too nice.

hda_{project_name}{folder_path}_{node_name} 🤔 this could work.
I think some projects may start with ayon making the asset type name look weird ayon_ayon..._....

@BigRoy
Copy link
Contributor

BigRoy commented Jul 25, 2024

When does the user 'access' these names? Where does it see it? what does it influence? The default node name when created? In the tab creation menu?

Also, what if we just start the type name with the node name (but end with the project and folder path?) Or doesn't it allow trailing numbers either?

@MustafaJafar
Copy link
Contributor Author

It doesn't affect the node name at all.
It won't show up to users until they enable viewing asset definition.
where they will be able to see the type name.
image

I think reversing the template will fix the problem as well.
{node_name}_{project_name}{folder_path}

@BigRoy
Copy link
Contributor

BigRoy commented Jul 25, 2024

I think reversing the template will fix the problem as well.
{node_name}_{project_name}{folder_path}

Maybe that is nicer anyway so that the node name (defining the type's name) is the most visible? :)

@MustafaJafar
Copy link
Contributor Author

Maybe that is nicer anyway so that the node name (defining the type's name) is the most visible? :)

Maybe. also, it is defiantly starts with a alphabetic character.

@BigRoy
Copy link
Contributor

BigRoy commented Jul 25, 2024

Maybe confirm with client whether it's "fine" for them as well, and when confirmed - make a PR to swap it around to resolve the issue for now. We can always keep an issue open to investigate other ways to customize it? Or maybe the user can already customize it manually after create?

@MustafaJafar
Copy link
Contributor Author

MustafaJafar commented Jul 25, 2024

I'm not sure if artists need to deal with the asset type name/ operator type name/internal name
Unlike TDs because they may use it for some automations (I mean Houdinish automations that don't use AYON api to get the data)

image


I was testing the new HDA operator type name template {node_name}_{project_name}{folder_path}
It fixed the problem with the HDA creation but exposed a bug in the HDA Loader!
I opened a new scene and created an HDA with the same name as existent published HDA product.
AYON recognized it as a new version and worked as expected but when loading that back, I can't switch the HDA product to an older version.

This bug can be replicated when the product name is the same but the operator type differs when publishing from multiple workfiles.

Traceback (most recent call last):
  File "E:\Ynput\ayon-core\client\ayon_core\tools\sceneinventory\view.py", line 366, in <lambda>
    lambda: self._show_version_dialog(item_ids, active_repre_id)
  File "E:\Ynput\ayon-core\client\ayon_core\tools\sceneinventory\view.py", line 843, in _show_version_dialog
    self._update_containers_to_version(
  File "E:\Ynput\ayon-core\client\ayon_core\tools\sceneinventory\view.py", line 1032, in _update_containers_to_version
    self._update_containers(item_ids, versions)
  File "E:\Ynput\ayon-core\client\ayon_core\tools\sceneinventory\view.py", line 1007, in _update_containers
    update_container(container, item_version)
  File "E:\Ynput\ayon-core\client\ayon_core\pipeline\load\utils.py", line 539, in update_container
    return Loader().update(container, context)
  File "E:\Ynput\ayon-houdini\client\ayon_houdini\plugins\load\load_hda.py", line 72, in update
    new = def_paths.index(file_path)
ValueError: '//storage/work/ayon_projects/Robo/Assets/Character/moco/publish/hda/mocopigHead/v002/robo_moco_mocopigHead_v002.hda' is not in list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sponsored This is directly sponsored by a client or community member type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants