Jump to content

Sample Takes script try


Hello world

Recommended Posts

Hi there,

I am trying to implement the below to execute two takes for reflection and specular passes.But dont know why the takes doesnt seem to take effect,but i dont get any errors and the script is working.Here is the code snippet of what Im trying.

hou.hscript('takeadd -c -p Main spec')
hou.hscript('takeautomode on')
#hou.hscript('takeinclude /obj/ *')
klig1.parm('shadow_type').set('off')
flig1.parm('shadow_type').set('off')
rlig1.parm('shadow_type').set('off')
hou.hscript('takeautomode off')

hou.hscript('takeadd -c -p Main ReflectionPass')
hou.hscript('takeautomode on')
#hou.hscript('takeinclude /obj/ *')
klig1.parm('shadow_type').set('off')
flig1.parm('shadow_type').set('off')
rlig1.parm('shadow_type').set('off')

hou.hscript('takeautomode off')

klig1,flig1,rlig1 are the variables for lights

thank you very much

Edited by Hello world
Link to comment
Share on other sites

Weird mixture of python and hscript.

flig1.parm('shadow_type').set('off') <-- This is wrong.

hou.parm('/obj/flig1/shadow_type').set(0) <-- This is right.

flig1 = hou.node('/obj/flig1')

flig1.parm('shadow_type').set(0) <-- This also works.

Edited by Erik_JE
Link to comment
Share on other sites

SAMPLE SCENE

sh=hou.node('shop')
msurf=hou.galleries.galleryEntries("mantrasurface")[0]
node=hou.node('/obj')
klig1=node.createNode('hlight','KeyLight1')
flig1=node.createNode('hlight','FillLight1')
rlig1=node.createNode('hlight','RimLight1')

klig1.moveToGoodPosition()
flig1.moveToGoodPosition()
rlig1.moveToGoodPosition()


#position the lights
klig1.parm('tx').set('536.254')
klig1.parm('ty').set('489.605')
klig1.parm('tz').set('-91.884')
klig1.parm('rx').set('-39.0293')
klig1.parm('ry').set('100.776')
klig1.parm('rz').set('9.132')

flig1.parm('tx').set('-356.148')
flig1.parm('ty').set('475.435')
flig1.parm('tz').set('-573.03')
flig1.parm('rx').set('-30.582')
flig1.parm('ry').set('206.504')
flig1.parm('rz').set('7.632')

rlig1.parm('tx').set('-540.86')
rlig1.parm('ty').set('402.254')
rlig1.parm('tz').set('596.632')
rlig1.parm('rx').set('-25.92')
rlig1.parm('ry').set('321.352')
rlig1.parm('rz').set('-4.37')


msurf.createChildNode(hou.node("shop"))

rp=hou.node('out').createNode('ifd','testmantra')

hou.hscript('takeadd -c -p Main spec')
hou.hscript('takeautomode on')

hou.parm('obj/KeyLight1/shadow_type').set(0)
hou.parm('obj/FillLight1/shadow_type').set(0)
hou.parm('obj/RimLight1/shadow_type').set(0)
hou.parm('shop/mantrasurface/diff_enable').set(0)
hou.parm('shop/mantrasurface/refl_objs').set(0)
hou.hscript('takeautomode off')

hou.hscript('takeadd -c -p Main ReflectionPass')
hou.hscript('takeautomode on')
hou.parm('obj/KeyLight1/shadow_type').set(0)
hou.parm('obj/FillLight1/shadow_type').set(0)
hou.parm('obj/RimLight1/shadow_type').set(0)
hou.parm('shop/mantrasurface/diff_enable').set(0)
hou.parm('shop/mantrasurface/refl_objs').set(1)

#dummyobjs
hou.hscript('takeautomode off')
box = node.createNode('geo', 'box', run_init_scripts=True)
box.createNode('box')
bo=hou.node('/obj/box/file1')
bo.destroy()
grid=node.createNode('geo','grid',run_init_scripts=True)
grid.createNode('grid')
gr=hou.node('obj/grid/file1')
gr.destroy()

Hi erik,

Still I am getting some problems.Takes are not working perfectly.Few parameters still remain the same.

Link to comment
Share on other sites

Yeah, the Auto Takes don't respond when setting parameters with python. I have no idea why. Maybe you need to explicitly add the parameter to the take as well. Never created takes through scripts before so can't help more.

EDIT: Yeah, you need to do takeinclude first before changing the parameter for it to pick it up.

http://www.sidefx.com/docs/houdini11.1/commands/takeinclude

Edited by Erik_JE
Link to comment
Share on other sites

Yeah, the Auto Takes don't respond when setting parameters with python. I have no idea why. Maybe you need to explicitly add the parameter to the take as well. Never created takes through scripts before so can't help more.

EDIT: Yeah, you need to do takeinclude first before changing the parameter for it to pick it up.

http://www.sidefx.com/docs/houdini11.1/commands/takeinclude

thank you very much for the reply.

But in my case,the changes are occurring for the only one pass.and for the 2nd or 3rd pass still the parameters remains same even after chnging

#adds a take
hou.hscript('takeadd -c -p Main spec')
#sets to specular take
hou.hscript('takeset spec')
#make  it live
hou.hscript('takeautomode on')
#include all the objects within the path defined
hou.hscript('takeinclude /obj/ *')
#changes
hou.parm('obj/KeyLight1/shadow_type').set(0)
hou.parm('obj/FillLight1/shadow_type').set(0)
hou.parm('obj/RimLight1/shadow_type').set(0)
hou.parm('obj/testshop/mantrasurface/diff_enable').set(0)
hou.parm('obj/testshop/mantrasurface/refl_objs').set(0)


hou.hscript('takeadd -c -p Main ReflectionPass')
hou.hscript('takeset ReflectionPass')
hou.hscript('takeautomode on')
hou.hscript('takeinclude /obj *')
hou.parm('obj/KeyLight1/shadow_type').set(0)
hou.parm('obj/FillLight1/shadow_type').set(0)
hou.parm('obj/RimLight1/shadow_type').set(0)
hou.parm('obj/testshop/mantrasurface/diff_enable').set(0)
hou.parm('obj/testshop/mantrasurface/refl_objs').set(1)
hou.hscript('takeset Main')

Edited by Hello world
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...