Jump to content

Scripting doubt


Recommended Posts

I wrote a script to find the number of lights in the obj level,for every light I want to create a take

//finds the number of lights in the scene and stores in lightsh

if lightsh[0]:

hou.hscript('takeadd -c -p Main lightsh[0]')

say suppose if there is a point light in the scene by name pointlight1

I want to create the take by name pointlight1

but in my case i get lightsh_0_

Please help me out on how to get the name same as that of the name of the light we creat

Thank you.

Link to comment
Share on other sites

You need to properly convert your variable value to a string using some sort of string operation such as the following.

This assumes lightsh is list of node names.

hou.hscript('takeadd -c -p Main %s' % lightsh[0])
hou.hscript('takeadd -c -p Main ' + lightsh[0])
hou.hscript('takeadd -c -p Main {0}'.format(lightsh[0]))

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...