gemini Posted April 6, 2020 Share Posted April 6, 2020 Hi, Can It be possible to modify a Digitial Asset Parameter's Menu Script by Python ? I use a similar code like this to modify the callbacks , but I could not figure out with menu script.. if not script == None: pt.setScriptCallback( script) pt.setScriptCallbackLanguage(hou.scriptLanguage.Python) elif not replace_in_script == None: replace_what = replace_in_script.split('|')[0] replace_to = replace_in_script.split('|')[1] pt.setScriptCallback( pt.scriptCallback().replace( replace_what, replace_to)) pt.setScriptCallbackLanguage(hou.scriptLanguage.Python) ptg.replace( parm, pt) if not node.type().definition(): node.setParmTemplateGroup(ptg) else: ptg = node.type().definition().setParmTemplateGroup(ptg) Any Help is Wellcome!! Cheers, G Quote Link to comment Share on other sites More sharing options...
DonRomano Posted April 6, 2020 Share Posted April 6, 2020 Hey, if you want to put a script into the hda menu script, it must return a dictionnary with your menu items and their id, like def myMenu(): do something items = {"0" : "item1", "1" : "item2"} return items myMenu() I don't know if that seems clear to you, but as you replace the "classic" item list by a script, it must return some items, and those items are evaluated as a dictionnary. Cheers, Quote Link to comment Share on other sites More sharing options...
gemini Posted April 6, 2020 Author Share Posted April 6, 2020 (edited) Yes. Thanks, but this is not what i am searching for. I would replace my menu script ( which has been written ) with an other script by a python script. Edited April 6, 2020 by gemini Quote Link to comment Share on other sites More sharing options...
DonRomano Posted April 6, 2020 Share Posted April 6, 2020 I don't understand what's your goal here. If you want to replace your script by another script using some condition, create a python module in your hda with your different functions and call them in the menu using hou.pwd().hdaModule.myFunction(). Quote Link to comment Share on other sites More sharing options...
gemini Posted April 7, 2020 Author Share Posted April 7, 2020 (edited) Sorry the goal is clear as I wrote. If you have an asset which has about 150 parameters you would not like to modify it by hand too. And you will have the chance to make a mistake ! Any help ? Edited April 7, 2020 by gemini Quote Link to comment Share on other sites More sharing options...
anim Posted April 7, 2020 Share Posted April 7, 2020 use pt.itemGeneratorScript(), pt.itemGeneratorScriptLanguage() and pt.setItemGeneratorScript(), pt.setItemGeneratorScriptLanguage() Quote Link to comment Share on other sites More sharing options...
gemini Posted April 8, 2020 Author Share Posted April 8, 2020 Thanks ! I check. G Quote Link to comment Share on other sites More sharing options...
gemini Posted April 8, 2020 Author Share Posted April 8, 2020 Tomas , maybe you got into this: oplib:/digic::Object/dScene2_test::1?digic::Object/dScene2_test::1 Warning(1314): incorrect number of #s in 'nassets' for multiparm depth of 1 oplib:/digic::Object/dScene2_test::1?digic::Object/dScene2_test::1 Warning(1446): incorrect number of #s in 'nrassets' for multiparm depth of 1 oplib:/digic::Object/dScene2_test::1?digic::Object/dScene2_test::1 Warning(1560): incorrect number of #s in 'nsagroups' for multiparm depth of 1 Did you? Probably an old Houdini version's asset , but I coudl not figure out how to solve. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.