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

    SplineObject::ResizeObject help

    SDK Help
    0
    14
    1.1k
    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

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

      On 11/11/2004 at 15:46, xxxxxxxx wrote:

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

      ---------
      Hi, I'm trying to resize a spline to give it more points. I am currently trying it using the SplineObject::ResizeObject

        
      // oSpline is the spline object  
      oSpline->ResizeObject(10,1);  
      

      But in the viewport. There is no points on the spline object. Using the life selection tool highlights a point at {0,0,0} but it doesn't keep it highlighted. Also the structure tab for the spline object shows there are 10 points, with every point at {0,0,0}.
      So it seems the points are there, just they are not usuable.

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

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

        On 12/11/2004 at 06:35, xxxxxxxx wrote:

        Hi, ResizeObject will only add new points but as you have noticed they are all placed at 0,0,0. It is YOUR job to place them to the correct spot!

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

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

          On 12/11/2004 at 11:35, xxxxxxxx wrote:

          Hi 3D Designer.

          Thing is, I HAVE moved them to another spot in the 3D world. But the spline doesn't show in the viewport, nor does any of the control points.

          It's fine if I create the spline object with default point count in the constructer, but after I Resize it, all points just dissappear.

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

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

            On 12/11/2004 at 11:39, xxxxxxxx wrote:

            did you call oSpline->Message(MSG_CHANGE); ? This is always necessary when modifying pointdata.

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

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

              On 12/11/2004 at 11:55, xxxxxxxx wrote:

              Yeah, I tried that

              This is the full code that i'm trying to work

                
                   // Find Spline Object (This object is a empty spline)  
                   SplineObject *oSpline = (SplineObject* )hh->GetDocument()->SearchObject("Spline");  
                   if(!oSpline) return NULL;  
                
                   // Resize the Spline to have 10 points  
                   oSpline->ResizeObject(10,1);  
                
                   // Move the points  
                   for(LONG i=0; i < 10; i++)  
                   {  
                        Vector *vadr = oSpline->GetPoint();  
                        vadr _= Vector(0.0,0.0,i*50.0);  
                   }  
                     
                   oSpline->Message(MSG_UPDATE);  
                
                
              

              The thing that confuses me is that the points seem to be there (even though I can't see them), but I cannot access them with any of the C4D tools. Using live selection tool for example, actually highlights the points, but as soon as I release the mouse button, they de-select themselves

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

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

                On 12/11/2004 at 12:13, xxxxxxxx wrote:

                Hi,

                your code seems to be a bit wrong. It should look like this:

                SplineObject *oSpline = (SplineObject* )hh->GetDocument()->SearchObject("Spline");  
                     if(!oSpline) return NULL;  
                  
                     // Resize the Spline to have 10 points  
                     oSpline->ResizeObject(10,1);  
                      **oSpline- >Message(MSG_CHANGE);** //Call it after resizing  
                     // Move the points  
                      **Vector *vadr = oSpline- >GetPoint();** //Get points already here (performance)  
                     for(LONG i=0; i < 10; i++)  
                     {  
                          vadr **[ i ]** = Vector(0.0,0.0,i*50.0); //Missing index  
                     }
                

                oSpline->Message(MSG_UPDATE);

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

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

                  On 12/11/2004 at 14:35, xxxxxxxx wrote:

                  It was a bit wrong because i typed it up and was rushing 🙂

                  the only difference I did was I didnt do the message after resize. will try that next!

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

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

                    On 12/11/2004 at 14:57, xxxxxxxx wrote:

                    Howdy,

                    I know this may look wrong but try changing your resize line to this:

                    oSpline->ResizeObject(10,0);

                    Adios,
                    Cactus Dan

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

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

                      On 12/11/2004 at 16:18, xxxxxxxx wrote:

                      Quote: Originally posted by Cactus Dan on 12 November 2004
                      >
                      > * * *
                      >
                      > Howdy,
                      >
                      > I know this may look wrong but try changing your resize line to this:
                      >
                      > oSpline- >ResizeObject(10,0);
                      >
                      > Adios,
                      > Cactus Dan
                      >
                      >
                      > * * *

                      THANK YOU!

                      I thought it was me going crazy. Everything I tried wouldn't, but I never imagined resizing the spline with 0 segments would of worked.

                      Thanks for your help people, works a charm 🙂

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

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

                        On 12/11/2004 at 16:38, xxxxxxxx wrote:

                        Howdy,

                        I struggled for a long time with the same thing. One segment seemed more logical to me, but then I did a GetSegmentCount() beforehand and printed the result and it displayed the number 0.

                        Adios,
                        Cactus Dan

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

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

                          On 12/11/2004 at 18:59, xxxxxxxx wrote:

                          Good point. Haven´t thought of this myself. 🙂

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

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

                            On 13/11/2004 at 09:13, xxxxxxxx wrote:

                            Howdy,

                            > Quote: Originally posted by 3D Designer on 12 November 2004
                            >
                            > * * *
                            >
                            > Good point. Haven´t thought of this myself. 🙂
                            >
                            >
                            > * * *

                            Actually, I started using it like this:

                            LONG seg = oSpline- >GetSegmentCount();
                            oSpline->ResizeObject(10, seg);

                            That way I avoid any confusion on my part.

                            Adios,
                            Cactus Dan

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

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

                              On 13/11/2004 at 09:56, xxxxxxxx wrote:

                              Yeah, but it´s anyway not really logical. It´s plausible that if it is no multi-segment spline the count is unnecessary and is set to 0 but it would be more logical if one had to pass 1.

                              Anyway, I am not using this at all but always use the VariableChanged class, so I haven´t gotten into this problem yet either. 🙂

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

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

                                On 13/11/2004 at 10:27, xxxxxxxx wrote:

                                Howdy,

                                Hey, thanks for the tip. I wasn't aware of that class. It looks like a good one to know.

                                Adios,
                                Cactus Dan

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