Can't set segments on a spline
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/07/2008 at 23:04, xxxxxxxx wrote:
User Information:
Cinema 4D Version:
Platform:
Language(s) : C.O.F.F.E.E ;---------
I created a spline object (set to Linear) to which I added the following COFFEE code, through a COFFEE tag:> <code>
> main(doc,op)
> {
> var points,segments,current1,current2,vc1,vc2;
> points=new(array,5);
> points[0]=vector(-100,-100,0);
> points[1]=vector(0,100,0);
> points[2]=vector(100,-100,0);
> points[3]=vector(-50,0,0);
> points[4]=vector(50,0,0);
>
> segments=new(array,2);
>
> segments[0]=3;
> segments[1]=2;
>
> vc1=new(VariableChanged);
> if(!vc1)
> {
> println("Error 1");
> return;
> }
>
> vc2=new(VariableChanged);
> if(!vc2)
> {
> println("Error 2");
> return;
> }
>
> current1=op->GetPointCount();
> if(!vc1->Init(current1,5))
> {
> println("Error 3");
> return;
> }
>
> current2=op->GetSegmentCount();
>
> println(current2);
>
> if(!vc2->Init(current2,2))
> {
> println("Error 4");
> return;
> }
>
> if(!op->MultiMessage(MSG_POINTS_CHANGED,vc1))
> {
> println("Error 5");
> return;
> }
>
> if(!op->MultiMessage(MSG_SEGMENTS_CHANGED,vc2))
> {
> println("Error 6");
> return;
> }
>
> if(!op->SetPoints(points))
> {
> println("Error 7");
> return;
> }
>
> if(!op->SetSegments(segments))
> {
> println("Error 8");
> }
> op->Message(MSG_UPDATE);
> }
> </code>I always get a report of "Error 8" in the console. Why is it failing to set the segments? Is it a bug or am I making a mistake?
Rui Batista
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/07/2008 at 03:58, xxxxxxxx wrote:
Do you actually need to set segments?
The little spline making I do, I only set the points w/o problems.Cheers
Lennart -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/07/2008 at 04:13, xxxxxxxx wrote:
My example creates a letter A. It has an inverted V shape and a crossed line. So, segments are the obvious way to do it, if I only want a single spline.
Anyways, I really would like to know if it is possible to create multi-segment splines in COFFEE. And, if it is, how... because this seems not to be working.Rui Batista
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/07/2008 at 05:26, xxxxxxxx wrote:
Ah, I see, of coarse. Should be good to see a solution as I haven't
used multi-segments myself yet..Cheers
Lennart -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/07/2008 at 02:23, xxxxxxxx wrote:
It's a bug in Cinema's spline segment handling.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/07/2008 at 03:09, xxxxxxxx wrote:
Must be fixed!!!
While it is being fixed, some more improvements could be added to COFFEE (hint! hint!)Rui Batista
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/07/2008 at 15:35, xxxxxxxx wrote:
Hi folks.
The work around for this bug is to work the code on an existing (or duplicated) spline that is segmented already. Then the segment array will work, once the sum of the points for the new segment equals the new point count.
Lar -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/07/2008 at 03:01, xxxxxxxx wrote:
Turned out it's not a bug but you were missing to check for a SegmentTag. The segment information is stored the SegmentTag. YOu have to allocate a new SegmentTag before sending the VariableChanged message.
Fixed code
>
\> var points,segments,current1,current2,vc1,vc2; \> points=new(array,5); \> points[0]=vector(-100,-100,0); \> points[1]=vector(0,100,0); \> points[2]=vector(100,-100,0); \> points[3]=vector(-50,0,0); \> points[4]=vector(50,0,0); \> segments=new(array,2); \> segments[0]=3; \> segments[1]=2; \> vc1=new(VariableChanged); \> \> if(!vc1) \> { \> println("Error 1"); \> return; \> } \> \> vc2=new(VariableChanged); \> if(!vc2) \> { \> println("Error 2"); \> return; \> } \> \> current1=op->GetPointCount(); \> if(!vc1->Init(current1,5)) \> { \> println("Error 3"); \> return; \> } \> \> current2=op->GetSegmentCount(); \> println(current2); \> if(!vc2->Init(current2,2)) \> { \> println("Error 4"); \> return; \> } \> \> var stag=new(SegmentTag); \> op->InsertTag(stag); \> \> if(!op->MultiMessage(MSG_SEGMENTS_CHANGED,vc2)) \> { \> println("Error 6"); \> return; \> } \> \> if(!op->MultiMessage(MSG_POINTS_CHANGED,vc1)) \> { \> println("Error 5"); \> return; \> } \> \> if(!op->SetPoints(points)) \> { \> println("Error 7"); \> return; \> } \> \> if(!op->SetSegments(segments)) \> { \> println("Error 8"); \> } \> \> op->Message(MSG_UPDATE); \>
cheers,
Matthias