SplineObject::ResizeObject help

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.

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!

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.

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.

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

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);

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!

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

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 🙂

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

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. 🙂

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

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. 🙂

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