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

    setting ALIGNTOSPLINETAG_LINK ?

    SDK Help
    0
    3
    323
    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 11/04/2016 at 12:39, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   r14+ 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hi there, after some absence from coding i am struggling setting the ALIGNTOSPLINETAG_LINK of tag.

      this is the code (where step is just some other BaseObject created in a loop) :

      BaseObject* splineLink = static_cast<BaseObject*>((BaseObject* )bc->GetObjectLink(USERSPLINE, doc)->GetClone(COPYFLAGS_0, NULL));
      splineLink->InsertUnder(main);
        
      BaseTag* alignToSpline = step->MakeTag(Taligntospline);
      alignToSpline -> SetParameter(DescID(ALIGNTOSPLINETAG_LINK),GeData(splineLink),DESCFLAGS_SET_0);
      alignToSpline -> SetParameter(DescID(ALIGNTOSPLINETAG_TANGENTIAL),GeData(useTangent),DESCFLAGS_SET_0);
      alignToSpline -> SetParameter(DescID(ALIGNTOSPLINETAG_POSITION),GeData((1.0/(max-1))*current),DESCFLAGS_SET_0);
      

      this results in that the tangent rotation is working, but the positioning only works after converting the object to an editable one.

      any ideas what i may be missing?

      thanks,
      Ello

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

        On 12/04/2016 at 02:40, xxxxxxxx wrote:

        Hi Ello,
        welcome back!

        I quickly tried tested your code in a simple Python script and it worked out of the box.
        So I guess, your issue must have something to do with wither surrounding code or the place you are using this code in. Can you give us some more details?

        A quick note on the first two lines (even if I assume, that you probably shortened the code for posting it here) :
        You are directly dereferencing the link you pull out of the BaseContainer. This is quite dangerous, the result may be a nullptr.
        Then you clone the referenced object and again dereference it directly in order to insert it into the document. As cloning involves memory allocations, this can fail as well and a nullptr check is needed, too.
        Of course this has nothing to do with your actual problem, just wanted to mention it.

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

          On 12/04/2016 at 05:06, xxxxxxxx wrote:

          hm, i guess posting the whole code would be a bit too much lines.
          i have however tried disabeling fragments whereever the spline was referenced or added to the dependency list, etc. maybe i need to create a fresh object to sort things out step by step. i was trying to change/add something to an existing older plugin.

          btw, you are right about the referenced object. it is checked previously.

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