how to use SplineData

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

On 03/05/2009 at 14:37, xxxxxxxx wrote:

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

---------
hi there,

i am struggling while using the SplineData from my GUI and passing it directly to a sweepnurbs' SWEEPOBJECT_SPLINESCALE

i cannot find any examples showing how to use a Spline GUI Element

thanks for your help

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

On 05/05/2009 at 02:27, xxxxxxxx wrote:

Hi!

Take a look at this thread:click

With this stuff you have access to the internal GeData element of your BaseList2D object. The GeData is of type: CUSTOMDATATYPE_SPLINE and contains the SplineData Pointer. Just use GeData::GetCustomDataType(CUSTOMDATATYPE_SPLINE) and cast it to SplineData. Thats the way to get it. From this point the way to set it should be no problem.

GeData has a constructor GeData(LONG type, const CustomDataType& data); so you just have to call

> \> GeData d(CUSTOMDATATYPE_SPLINE, \*your_spline_data) \>

to create GeData which you have to pass via BaseLink::SetParameter(...)

Hope that helps.

EDIT: changed the thread link, wrong copy and paste 🙂

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

On 05/05/2009 at 14:03, xxxxxxxx wrote:

?? i guess i have not enough c++ knowledge to understand exactly what you told me there 😞

i have this to get the SplineData of my GUI:

> `

  
\>  SplineData *spdata=(SplineData* ) bc->GetCustomDataType(VIRAL_SPLINE, CUSTOMDATATYPE_SPLINE);  
\>  

`

and this is where i try to pass it to the Spline Scale (Detail)
> `

  
\>  GeData d ( CUSTOMDATATYPE_SPLINE, spdata ); //this is the error line  
\>  bc->SetData(SWEEPOBJECT_SPLINESCALE, d);  
\>  

`

i get this error:
c:\programme\maxon\cinema 4d r11\plugins\plugello\source\viral.cpp(172) : error C2664: 'GeData::GeData(void *,VOIDVALUETYPE)': Konvertierung des Parameters 1 von 'int' in 'void *' nicht möglich

what exactly am i doing wrong?

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

On 05/05/2009 at 14:26, xxxxxxxx wrote:

You need to pass an instance not a pointer. *spdata would dereference the pointer to the instance. So:

GeData d (CUSTOMDATATYPE_SPLINE, *spdata);

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

On 05/05/2009 at 14:28, xxxxxxxx wrote:

thank you, gonna try that, too..

but just a second ago i got it working like this:

first:

GeData spl = bc->GetData(VIRAL_SPLINE);

and later..

bc->SetData(SWEEPOBJECT_SPLINESCALE, spl);

is there any benefit using one or the other? or doesnt it really matter which way to go?

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

On 05/05/2009 at 15:12, xxxxxxxx wrote:

If it works, then it shouldn't matter.

The difference is that 'spl' is a GeData instance applied to SetData() whereas spldata is a SplineData pointer applied to the construction of GeData 'd'. But it must be a SplineData instance in that case.

When you see something like "Object* obj" in an argument list, you need to pass a pointer to the instance (if it is an instance, you use '&obj;' which means 'take the memory address of the instance' which is all a pointer is - the memory address). When you see something like "Object obj", "Object& obj", or "const Object& obj", you need to send the instance (or a reference which works similarly to an instance). If what is being passed is already a pointer, you need to get at the instance/reference using *obj.

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

On 05/05/2009 at 15:40, xxxxxxxx wrote:

thank you very much for the explanation!