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

    Create an object to control all object

    SDK Help
    0
    14
    2.2k
    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 19/03/2018 at 07:03, xxxxxxxx wrote:

      Hi,

      just by changing the selection you won't achieve the desired effect. By the way, where do you execute your code?
      In order to achieve something like this, one would usually implement a custom tag (TagData plugin) or use the Python Scripting tag, which would then constrain certain parameters (e.g. position) of the host object to the parent of the host object.
      Fortunately there's no need to implement this yourself, as there are already a bunch of tags, which can do the trick.
      Protection tag, Constraint tag (from Character tags) and Xpresso tag come to my mind. And of course all of these can be created and configured or set up via code, in case you need a scripting solution.

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

        On 21/03/2018 at 04:13, xxxxxxxx wrote:

        I have tried constraint tag but it also treats like child and parent. If I select the parent, all child move with the parent but when I click child then it moves independently. I want all child and parent tied to each other and no child move independently.

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

          On 21/03/2018 at 09:38, xxxxxxxx wrote:

          Hm, if I create a Constraint tag in PSR mode on the parent object and set the child as target, I do get exactly what you describe. I can select the parent, move it around and the child follows. And vice versa I can select the child, move it around and the parent follows directly. Only problem I see, is workflow related, as one needs to set the offset between the two inside of the Constraint tag. And of course you need one Constraint tag per child object.

          And there's always the option to implement your own custom tag.

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

            On 22/03/2018 at 04:17, xxxxxxxx wrote:

            With PSR parent is also moved with a child but another child is not moved. My requirement is different, suppose, if I have created a null objcet as a parent and it has 4 child cubes. if I select cub1 (child object) and move it, all child and parent should also move with child1. If I select parent (null object), all child should be move with the parent object.

            Thank you so much.

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

              On 22/03/2018 at 09:52, xxxxxxxx wrote:

              As I wrote in my previous post, you'd need one Constraint tag per child.

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

                On 22/03/2018 at 10:52, xxxxxxxx wrote:

                Now when I am using Constraint tag in PSR mode for each child object then all object confine to each other and they behave like not controllable. You said that about the offset but it is not clear to me. Can elaborate it that will be very helpful for me.

                Thanks for quick reply.

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

                  On 23/03/2018 at 06:35, xxxxxxxx wrote:

                  Hi,

                  I'm sorry, but we should get through with this. This doesn't seem development related anymore and that's where we need to put our focus here.

                  Here's how I set it up:
                  ![]([URL-REMOVED]

                  Please note, I also "found" the "Maintain Original" checkbox, so you do not need to set the offset inside of the Constraint tag. With this configuration I can select any of the three objects, move it around and the other two stick to it as if it's one object.

                  For more information on the Constraint tag, I recommend our user help.


                  [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

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

                    On 24/03/2018 at 08:14, xxxxxxxx wrote:

                    Ok, thanks, Is there any example code related to Constrain tag implementation, that would be helpful for me.

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

                      On 26/03/2018 at 02:20, xxxxxxxx wrote:

                      The Py-LookAtCamera example probably comes closest to what you are looking for.

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

                        On 26/03/2018 at 06:46, xxxxxxxx wrote:

                        Thank you for help, actually, I am asking the API to create constraint tag. Like, suppose want to create a morph tag need to call the below API.

                        CAPoseMorphTag* poseMorphTag = CAPoseMorphTag::Alloc();
                        if (poseMorphTag)
                        {
                        obj->InsertTag(poseMorphTag);
                        poseMorphTag->InitMorphs();
                        }

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

                          On 26/03/2018 at 08:50, xxxxxxxx wrote:

                          Sorry, I misunderstood.

                              const Int32 ID_CONSTRAINT_TAG = 1019364;
                              BaseTag* const constraintTag = obj->MakeTag(ID_CONSTRAINT_TAG);
                              if (!constraintTag)
                                  // handle error
                          

                          1019364 is the ID of the Character Animation Constraint tag. Unfortunately there's no public symbol defined, so you need to use the numerical value. In order to find the ID (i.e. for another tag), simply drag the tag to the command line of the Console and press return.

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

                            On 26/03/2018 at 10:51, xxxxxxxx wrote:

                            What I am doing wrong here target is not going to set, Please check the below code.

                            BaseTag* const constraintTag= static_cast<BaseTag*>(pCameraRig->MakeTag(ID_CONSTRAINT_TAG));
                            if (!constraintTag)
                            return false;
                            constraintTag->SetParameter(ID_CA_CONSTRAINT_TAG_PSR, true, DESCFLAGS_SET_0);
                            constraintTag->SetParameter(ID_CA_CONSTRAINT_TAG_PSR_MAINTAIN, true, DESCFLAGS_SET_0);
                            constraintTag->SetParameter(ID_CA_CONSTRAINT_TAG_PSR_LINK, Target, DESCFLAGS_SET_0);

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

                              On 27/03/2018 at 02:05, xxxxxxxx wrote:

                              Hi,

                              ID_CA_CONSTRAINT_TAG_PSR_LINK is the wrong ID (although I totally understand, why you expected it to be the right one).
                              The Constraint tag is special, as it allows for an arbitrary number of for example PSR constraints, which can be added via the Add button. Of course every target field of these needs it's own ID.
                              ID of the target field of the first PSR constraint is 10001 (simply drag the parameter to the Commandline of the Console to find out). Incremented by ten for every additional constraint. So, if you add a second PSR constraint, the ID of the second target field is 10011.

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