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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    How to assign target object to target expression.

    SDK Help
    0
    3
    692
    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
      Helper
      last edited by

      On 26/02/2018 at 05:37, xxxxxxxx wrote:

      I have created a camera and assigned it a  target expression.

      TextureTag* textureTag = static_cast<TextureTag*>(camera->MakeTag(Ttargetexpression));
      if (!textureTag)
      return false;

      I able to assign target object to the target expression using drag and drop but here I want to set target object through the C++ API. Please do the needful.😢

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

        On 27/02/2018 at 07:39, xxxxxxxx wrote:

        Hi,

        this is just a matter of setting the right parameter of the Target tag.

        One option to find out about parameters is to simply drag the parameter (grab its name) to the Commandline (the input field below the Console). Another option is to check the resource files directly, in this case it's in <C4D install path>/resource/modules/c4dplugin/description/ttargetexpression.res, easily found if you know the ID of the entity (here Ttargetexpression) already.

        So, with the above you get TARGETEXPRESSIONTAG_LINK. And then it's just a matter of tag->SetParameter(TARGETEXPRESSIONTAG_LINK, object, DESCFLAGS_SET_0).

        One more note on your code, you shouldn't cast the Target tag into a Texture tag.

        Last note, I moved this thread to the SDK Help forum, as you seem to prefer C++ instead of Python.

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

          On 28/02/2018 at 05:23, xxxxxxxx wrote:

          Thanks, Andreas Block, My problem is solved.

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