Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Aha I see, this makes sense for the NormalTag data. And yeah of course cross product is what I need...
Regarding the primitives not turning into polygon object, I thought that was happening with a cube, but now after testing it again it definitely is. So I must have been mistaken before.
Thanks for the help, going to mark this as solved.
I'm developing a plugin on Windows 10 with C++, R23, which represents a fluid volume.
So I've got a functionality which needs to preview the intersection of my object with a Cinema 4D object. You can imagine the below screenshot to have the magenta mesh only in the hollow hemisphere.
Anyway for that I need the vertices, triangle faces and normals data from the hemisphere. For that I do the following:
BaseObject *intersectionGeometry = ...; // ACQUIRED FROM LINK if (intersectionObject != nullptr) { ModelingCommandData mcd; mcd.doc = document; mcd.op = intersectionObject; if (!SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT, mcd)) return; C4DAtom* atom = mcd.result->GetIndex(0); BaseObject* const res = static_cast<BaseObject*>(atom); // WITH SOME STANDARD PRIMITIVES THIS IS NULLPTR if (res != nullptr && res->GetType() == Opolygon) { PolygonObject* polyObjectRes= static_cast<PolygonObject*>(res); Vector* points = polyObjectRes->GetPointW(); CPolygon* polygons = polyObjectRes->GetPolygonW(); unsigned polygonsCount = polyObjectRes->GetPolygonCount(); unsigned pointsCount = polyObjectRes->GetPointCount(); NormalTag* normalTag = static_cast<NormalTag*>(polyObjectRes>GetTag(Tnormal)); // THIS IS ALWAYS NULLPTR! } }
So as you can see I'm taking a BaseObject* and convert to a PolygonObject* with ModelingCommandData* . Not sure if this is the best way but it works for most standard primitives (like a sphere or torus). After I have the PolygonObject* I take its vertices and polygons arrays which is fine. But then I'm having difficulty with the NormalTag* which is never anything else but nullptr.
BaseObject*
PolygonObject*
ModelingCommandData*
NormalTag*
My main question is about the NormalTag and how can I access that data? And my secondary question is how come not all primitives can be converted to a PolygonObject*? Any help would be appreciated.
NormalTag
Regards, Georgi.
Hey guys, thanks for the explanations.
My only concern is that I can't really do anything besides closing Cinema4D to cancel the operation. Just for reference my plugin is a fluid volume that needs to be visualized in the viewport. This is not an expected workload, stumbled on it by chance, but so can one of the users.
Anyway we can close this thread if it's not a bug.
@Cairyn hey man thanks for the suggestion!
Actually my object data plugin is no longer crashing, but enters an infinite loop trying to allocate the memory it needs until it sends "Not enough memory" message and tries again. I only have 16GB ram. This behavior is reproducible with a simple cube with segmentation to 100x100x100, inserted in a subdivision surface object with subdivision editor field set to 6. I'm not sure if it's a bug guys, but it seems to require a reboot to fix.
Hey guys,
I'm developing an ObjectData plugin with C++ on Windows10, Cinema 4D R23.
I'm getting a crash when I insert my plugin in a subdivision surface and crank up the subdivision editor field to 6. The crash is in Cinema 4D but the culprit is probably my implementation. Just in case I wanted to test this with some native Cinema4D object to see if I can reproduce it, but I'm having a hard time to simply create a PolygonObject with say 100k polygons.
What would be the easiest way to generate such an object? I think I can also reproduce it with less polygons so it doesn't have to be 100k, could be less.
Warm regards, Georgi.
@ferdinand
Hey I recently noticed that when I get over 2 million points and 1 million segments the viewport freezes. The UI is still responsive so I can reduce the lines in my object and it starts drawing in the viewport again.
So I'm wondering if this is expected for this amount of points and segments? I haven't found anything that is obviously wrong in my implementation yet.
@ferdinand thank you for the suggestions, totally forgot to write back.
Grouping the LineObject objects by a few shades worked out pretty well.
Hey @PluginStudent, yeah that's an alternative but I want to avoid overriding Draw() unless there's no other way.
Hi guys, Using C++, R23. I've got an ObjectData plugin that represents a volume in the viewport. One of the representations is a velocity field, which is just a bunch of lines with colors. I'm inserting a LineObject in GetVirtualObjects() to do the job, and it is being generated and working as expected, but I'm not sure how to pass my custom colors. Is there something like the VertexColorTag for a PolygonObject or an alternative routine?
ObjectData
LineObject
GetVirtualObjects()
VertexColorTag
PolygonObject
All right, thank you for all the help.
I'll close this now.