Asset menu script annoying warning

   2426   3   1
User Avatar
Member
951 posts
Joined: April 2008
Offline
I´ve builded a ordered menu for my asset using this script:

set result = “”
foreach menuname(`run(“opls ./materials”)`)
set result = $result $menuname `tolower($menuname)`
end
echo $result

Which works ok, every material that I add inside my “materials” context is automatically added to the list, thanks to sidefx help documentation it was easy to achieve that.

So I´ve also created a button which opens in a new window the parameters for any of the materials listed in the menu which is great and it works, for the button callback script I used this:

oppane -t parmeditor ./materials/`chs(“./shader”)` -> where “shader” is the value for my ordered menu.

So far so good but, there is always a but , everytime I load the file or load the asset Houdini says to me that the default value for the paramenter “shader” is invalid and it needs to be set to 0, no problem I could ignore that and continue to work but I can´t! it´s too annoying I need to know what I am missing, I don´t know why it says that the default value is invalid, I already set the default value to integer and string and the problem persists, can someone help me with that if my problem make sense?

Thanks!
https://vimeo.com/user2163076 [vimeo.com]
User Avatar
Member
7737 posts
Joined: July 2005
Online
My guess is that the menu parameter is being loaded before your materials are fully loaded. So when it runs your menu script during the loading of that menu parameter, it can't find a matching menu item. I think the only way around this is to make your menu a string parameter where the menu is one of those small drop downs to the right instead.
User Avatar
Member
951 posts
Joined: April 2008
Offline
edward
My guess is that the menu parameter is being loaded before your materials are fully loaded. So when it runs your menu script during the loading of that menu parameter, it can't find a matching menu item. I think the only way around this is to make your menu a string parameter where the menu is one of those small drop downs to the right instead.

It makes sense, maybe there is a way to delay the execution of the script, I'll try your sugestion anyway.

Thanks!
https://vimeo.com/user2163076 [vimeo.com]
User Avatar
Member
951 posts
Joined: April 2008
Offline
Hi it's me again struggling with the same issue.

I could make my HDAs with a dynamic menu to work setting a keyframe on the menu, this way I get rid of the warning and also my option doesn't change to 0 when the asset loads.

But the problem with keyframes is that you have to remember to delete it and set it again when you need to change things and sometimes this get some confusion like setting keyframes on different times.

I tried all the menu type options (normal, mini, etc..) and the problem is the same, like @edward said before this must be something to do with the options are not available on the moment that the asset loads currently I have a alembic file with a lot of nodes inside and my dynamic menu needs it to build it's options.

I am using a script template from the help file to build my menu, maybe there is some command that can wait the whole file to load first before building the menu but I couldn't find it.

I was hoping that someone here could have some idea to share.

Thanks.
https://vimeo.com/user2163076 [vimeo.com]
  • Quick Links