created spline disappear in Points Mode
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/09/2012 at 04:14, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 13
Platform: Windows ;
Language(s) : C++ ;---------
User Information:
Cinema 4D Version: 13
Platform: Windows ;
Language(s) : C++ ;---------
Hii have a plugin which creates a SplineObject sets the Points and inserts it into the Document.
Well all its write but if i select the Spline in Points Mode in Cinema the Spline disappear.
If I Select a point of the Spline and move it the Spline appears.What have i done wrong?
The Code:
BaseDocument *doc = GetActiveDocument();
SplineObject *myspline = SplineObject::Alloc(5,SPLINETYPE_BSPLINE);
Vector *point = myspline->GetPointW();
for (int i = 0; i < myspline->GetPointCount(); i++)
{
point _.x = (LReal)(i * 100);
point _.z = (LReal)((i%2) * 100);
}
myspline->SetName("newname");
doc->InsertObject(myspline,NULL,NULL);greatings
RM
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/09/2012 at 04:52, xxxxxxxx wrote:
Hi and welcome Ralf,
After changing its points, a point object (polygon, spline etc.) needs to be updated by calling Message(MSG_UPDATE).
Your code doesn't compile because of the point array declaration and usage. Also don't forget to notify Cinema that a change happened in the scene with EventAdd() to see the created spline effectively added to the scene. Here's the code:SplineObject *myspline = SplineObject::Alloc(5,SPLINETYPE_BSPLINE); Vector *points = myspline->GetPointW(); for (LONG i = 0; i < myspline->GetPointCount(); i++) { points[i].x = (LReal)(i * 100); points[i].z = (LReal)((i%2) * 100); } **myspline- >Message(MSG_UPDATE);** myspline->SetName("newname"); doc->InsertObject(myspline,NULL,NULL); **EventAdd();**
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/09/2012 at 23:00, xxxxxxxx wrote:
thx for the fast reply
=> could be closed
-
On 27/07/2015 at 08:21, xxxxxxxx wrote:
Hi,
I have one more question relevant to this post:
If you create objects inside GetVirtualObjects(), they don't need to be updated, right?
And there should also be no need to call EventAdd(), right?At least I don't have it, and my code works perfectly fine (as far as I can see).
-
On 28/07/2015 at 00:50, xxxxxxxx wrote:
Hi Casimir,
Originally posted by xxxxxxxx
I have one more question relevant to this post:
If you create objects inside GetVirtualObjects(), they don't need to be updated, right?
And there should also be no need to call EventAdd(), right?At least I don't have it, and my code works perfectly fine (as far as I can see).
Exactly. The code I posted above is to be run in the context of a CommandData plugin Execute().
In ObjectData::GetVirtualObjects() an object created isn't in the document till it's returned. Cinema then takes care of updating the shown object and the document. -
On 28/07/2015 at 02:19, xxxxxxxx wrote:
Hi Yannick,
Thanks for your answer, I'm glad I was right