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

    Scheduled Pinned Locked Moved SDK Help
    14 Posts 0 Posters 1.1k 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 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 Offline
        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 Offline
          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 Offline
            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 Offline
              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 Offline
                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 Offline
                  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 Offline
                    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 Offline
                      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 Offline
                        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