Jump to content

Juanf

Assign object to target

Recommended Posts

Hi all,

 

I did a small script on Python R20 where a camera is added to the scene with a target tag and a null, but what I can't find is a way to add the null to the target tag, could I get some assistance please?

 

Here is the script:

 

import c4d
#Welcome to the world of Python

def main():
    def tool():
        return c4d.plugins.FindPlugin(doc.GetAction(), c4d.PLUGINTYPE_TOOL)

    def object():
        return doc.GetActiveObject()

    def tag():
        return doc.GetActiveTag()

    def renderdata():
        return doc.GetActiveRenderData()

    def prefs(id):
        return c4d.plugins.FindPlugin(id, c4d.PLUGINTYPE_PREFS)

    c4d.CallCommand(5103) # Camera
    c4d.CallCommand(100004788, 50026) # New Tag
    object()[c4d.CAMERAOBJECT_USETARGETOBJECT] = True
    c4d.CallCommand(55000, 2) # Use Camera
    prefs(465001620)[c4d.PREF_INTERFACE_CENTEROBJECT] = True
    c4d.CallCommand(5140) # Null
    prefs(465001620)[c4d.PREF_INTERFACE_CENTEROBJECT] = False
    c4d.TARGETEXPRESSIONTAG_LINK

if __name__=='__main__':
    main()
    c4d.EventAdd()

 

Cheers,

Juan

Share this post


Link to post
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.


  • Recently Browsing   0 members

    No registered users viewing this page.

YOUTUBE CHANNEL:

ABOUT US:

C4D Cafe is the largest CINEMA 4D community. We provide facilities for discussion, showcasing and learning our favorite software :) Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, get your own private messenger, post status updates, manage your profile and much more. If you need to find solution to your problem or otherwise ask for help, Cafe is the right place.
×
×
  • Create New...