tom.vujnovic Posted December 31, 2018 Share Posted December 31, 2018 (edited) I'm trying to python script maya->houdini transfer script via alembic. I've sorted out most of kinks, but there is one hurdle that's giving me a headache for days now ... I have to use alembicArchive because I need node tree. In script I create a alembicArchive node, set all params as desired and execute aNode.parm("buildHierarchy").pressButton() While I was testing this in houdini's python shell pane everything worked great. Once I left houdini UI and went to python I can't generate subtree. I need that because I need to assign shaders and some other things before I save a file. I tried to force cook node (aNode.cook(force=true)) but it didn't solve it. Any ideas how to force this node to rebuild hierarchy? thanks. edit: of course that i meant pressButton() method instead clickButton … lapsus. Also I found that I can call calback script on this button (item.hdamodule().BuildHierarchyRoot(item)) or do i via hscript's “opparm -c” but that also does not work without UI … so I'm still on square one. I know that there is a possibility to build alembic hierarchy myself, but I would like to avoid that if possible. tom. Edited January 1, 2019 by tom.vujnovic updated info Quote Link to comment Share on other sites More sharing options...
anim Posted January 1, 2019 Share Posted January 1, 2019 seems to work for me, this was executed in hython process run from command line aa = hou.node("/obj").createNode('alembicarchive') aa.parm('fileName').set("default.abc") print("Has UI: {}".format( hou.isUIAvailable() )) print("Subnet Content before update: {}".format( aa.children() )) aa.parm('buildHierarchy').pressButton() print("Subnet Content after update: {}".format( aa.children() )) output Has UI: False Subnet Content before update: () Subnet Content after update: (<hou.ObjNode of type alembicxform at /obj/alembicarchive1/gabc>,) 1 1 Quote Link to comment Share on other sites More sharing options...
tom.vujnovic Posted January 3, 2019 Author Share Posted January 3, 2019 (edited) Hi Tomas, thanks for answer ... It's soooo wierd ... You are right, when I execute those commands in python shell they work as expected. But when I execute script in same shell it does nothing. This is part of script that is handling import into houdini ... tempTime = time.clock() print "Importing into Houdini ... ", m = hou.node("/obj").createNode("alembicarchive", ns[1:],run_init_scripts=True, load_contents=True, exact_type_name=False) # m.parm("fileName").set(os.path.normpath(os.path.join(abcPath, ns[1:] + '.abc'))) print "Node",m.name() m.parm("fileName").set("$HIP/../anim/sceneABCexport/"+ns[1:]+'.abc') print("Subnet Content before update: {}".format(m.children())) m.parm('buildHierarchy').pressButton() print("Subnet Content after update: {}".format(m.children())) # hou.hscript("opparm -c /obj/"+str(ns[1:])+" buildHierarchy") # m.hdaModule().BuildHierarchyRoot(m) # m.parm("buildHierarchy").pressButton() # m.parm("buildHierarchy").eval() # m.cook(force=True,frame_range=(1001,1001)) m.moveToGoodPosition() print "done. ("+str(time.clock() - tempTime)+" sec)" No error, no warning ... just nothing :((( (commented out are things that I've tried and didn't work) This is output ... Importing into Houdini ... Node ttv_prop_oldsafe_rig_mr_MASTER Subnet Content before update: () Subnet Content after update: () done. (0.00554966969401 sec) Superstrange. I'm digging into it but still have no idea what is wrong. Is there a chance that callbacks are executed in different thread and I have to wait (timer.sleep(100) or something) for .pressButton() to finish?? How I can find when it's done? Edited January 3, 2019 by tom.vujnovic Quote Link to comment Share on other sites More sharing options...
anim Posted January 3, 2019 Share Posted January 3, 2019 what does your $HIP evaluate to? In other words, does your fileName path: "$HIP/../anim/sceneABCexport/"+ns[1:]+'.abc' result in a valid path? 1 Quote Link to comment Share on other sites More sharing options...
tom.vujnovic Posted January 3, 2019 Author Share Posted January 3, 2019 No. just found that. It's weird combo of "\\" and "/" mixup between python and houdini internals. I wouldn't mind that some Hou.Error was raised, like "File not found" or something. For some reason while in python $HIP variable get wrong value. I save my houdini scene to r"U:\projects\ttv\episodes\e408\work\sq010\sh070\Houdini" but $HIP gets reseted to "u:/" After some experimentation, I found that houdini want to set $HIP to something like "U:projects tvepisodese408worksq010sh070Houdini" (notice space instead of \t - hou must interpret it as tab escape char :))) I think I'm on right track now. Thanks a lot for initial push :))) Quote Link to comment Share on other sites More sharing options...
tom.vujnovic Posted January 3, 2019 Author Share Posted January 3, 2019 hipFile='U:/projects/ttv/episodes/e408/work/sq010/sh070/Houdini' Version 1: print "before", print hou.hscript('echo $HIP') hou.hipFile.save(os.path.join(hipPath,"ttv_"+shotBaseName+"v001.hip")) print "after", print hou.hscript('echo $HIP') output: before ('U:/posterToolsBase/mayaScripts\n', '') after ('U:/projects/ttv/episodes/e408/work/sq010/sh070\n', '') Version 2: print "before", print hou.hscript('echo $HIP') pa=os.path.join(hipPath,"ttv_"+shotBaseName+"v001.hip") pa=pa.replace("\\","/") hou.hipFile.save(pa) print "after", print hou.hscript('echo $HIP') output: before ('U:/posterToolsBase/mayaScripts\n', '') after ('U:/projects/ttv/episodes/e408/work/sq010/sh070/Houdini\n', '') WTF???? Where is Houdini folder gone in version 1? in both versions .hip file is saved in correct location (in 'U:/projects/ttv/episodes/e408/work/sq010/sh070/Houdini' folder) But it works now :)) 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.