Vray and python
-
On 08/11/2013 at 12:19, xxxxxxxx wrote:
Does anyone know how to add a Vray light tag using python? I have opened up the res file for vray and found: tVrayLightTag is used to define the tag however I cannot seam to get it to work.
Any ideas on this would be really helpfull!
thanks.
-
On 08/11/2013 at 21:25, xxxxxxxx wrote:
Hi,
I do not use vray but I think that if you use the Script Log, when you choose the vray tag, you will see the CallCommand ID. -
On 11/11/2013 at 19:25, xxxxxxxx wrote:
the call command comes up as c4d.CallCommand(100004788) and when I run that nothing happens. no light tag is created.
-
On 12/11/2013 at 15:27, xxxxxxxx wrote:
hi,
sorry my mistake , this is a tag so callcommand not working.Here I will show you how you should work when scripting:
1- Will we find the Vray light tag ID:
add a light to your scene;
add to it a Vray light tag
Select the lightimport c4d from c4d import gui #Welcome to the world of Python def main() : mydoc = c4d.documents.GetActiveDocument() myobj = doc.GetActiveObject() print myobj.GetTags() if __name__=='__main__': main()
In my case, I added Xpresso tag and I get:
[<c4d.modules.graphview.XPressoTag object called 'XPresso/XPresso' with ID 1001149 at 0x10C249A0>]2- Now you have the ID, so we will call it myID:
add a new light and select it:import c4d from c4d import gui #Welcome to the world of Python def main() : myID = (put here the ID returned by the 1 print) mydoc = c4d.documents.GetActiveDocument() myobj = doc.GetActiveObject() if myobj==None or myobj.GetType() != c4d.Olight: gui.MessageDialog('Select a Light!') return mytag = c4d.BaseTag(myID) myobj.InsertTag(mytag, None) c4d.EventAdd() if __name__=='__main__': main()
-Focus3D-
-
On 13/11/2013 at 07:55, xxxxxxxx wrote:
On a side note: Built-in tags have a symbol name in the c4d module which should be preferred over
using integer IDs. Eg c4d.TexpressoYou can also use BaseObject.MakeTag() instead of the BaseTag() and BaseObject.InsertTag() construct.
Best,
-Niklas -
On 15/11/2013 at 01:09, xxxxxxxx wrote:
Thanks Niklas,
Need to refresh c4d sdk in my brain.
Thansk again for this note
-Focus3D-
-
On 21/11/2013 at 11:35, xxxxxxxx wrote:
Thanks for your help guys! I finally got a chance to get back on this project. Both of your solutions worked like a charm