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

    created spline disappear in Points Mode

    Scheduled Pinned Locked Moved SDK Help
    6 Posts 0 Posters 410 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 19/09/2012 at 04:14, xxxxxxxx wrote:

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

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

      ---------
      Hi

      i have a plugin which creates a SplineObject sets the Points and inserts it into the Document.

      Well all its write but if i select the Spline in Points Mode in Cinema the Spline disappear.
      If I Select a point of the Spline and move it the Spline appears.

      What have i done wrong?

      The Code:
        BaseDocument *doc = GetActiveDocument();
        SplineObject *myspline = SplineObject::Alloc(5,SPLINETYPE_BSPLINE);
        Vector *point = myspline->GetPointW();
        for (int i = 0; i < myspline->GetPointCount(); i++)
        {
            point _.x = (LReal)(i * 100);
            point _.z = (LReal)((i%2) * 100);
        }
        myspline->SetName("newname");
        doc->InsertObject(myspline,NULL,NULL);

      greatings
      RM


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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 19/09/2012 at 04:52, xxxxxxxx wrote:

        Hi and welcome Ralf,

        After changing its points, a point object (polygon, spline etc.) needs to be updated by calling Message(MSG_UPDATE).
        Your code doesn't compile because of the point array declaration and usage. Also don't forget to notify Cinema that a change happened in the scene with EventAdd() to see the created spline effectively added to the scene. Here's the code:

        SplineObject *myspline = SplineObject::Alloc(5,SPLINETYPE_BSPLINE);
        Vector *points = myspline->GetPointW();
        for (LONG i = 0; i < myspline->GetPointCount(); i++)
        {
            points[i].x = (LReal)(i * 100);
            points[i].z = (LReal)((i%2) * 100);
        }
         **myspline- >Message(MSG_UPDATE);**
        myspline->SetName("newname");
          
        doc->InsertObject(myspline,NULL,NULL);
         **EventAdd();**
        
        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 19/09/2012 at 23:00, xxxxxxxx wrote:

          thx for the fast reply

          => could be closed

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

            On 27/07/2015 at 08:21, xxxxxxxx wrote:

            Hi,

            I have one more question relevant to this post:
            If you create objects inside GetVirtualObjects(), they don't need to be updated, right?
            And there should also be no need to call EventAdd(), right?

            At least I don't have it, and my code works perfectly fine (as far as I can see).

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

              On 28/07/2015 at 00:50, xxxxxxxx wrote:

              Hi Casimir,

              Originally posted by xxxxxxxx

              I have one more question relevant to this post:
              If you create objects inside GetVirtualObjects(), they don't need to be updated, right?
              And there should also be no need to call EventAdd(), right?

              At least I don't have it, and my code works perfectly fine (as far as I can see).

              Exactly. The code I posted above is to be run in the context of a CommandData plugin Execute().
              In ObjectData::GetVirtualObjects() an object created isn't in the document till it's returned. Cinema then takes care of updating the shown object and the document.

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

                On 28/07/2015 at 02:19, xxxxxxxx wrote:

                Hi Yannick,

                Thanks for your answer, I'm glad I was right 😛

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