Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Vray and python

    Scheduled Pinned Locked Moved PYTHON Development
    7 Posts 0 Posters 571 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

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

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            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 light

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

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

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

              You can also use BaseObject.MakeTag() instead of the BaseTag() and BaseObject.InsertTag() construct.

              Best,
              -Niklas

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                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-

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  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 🙂

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post