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).
Hi, I am trying to make a custom item that works in the same way as a polygon object, but with more options. These options would be simple things, like showing certain parameters in the UI that depend on other parameters and the points and polygons of the object itself, but the problem is creating the object.
I found out that the OBJECT_POLYGONOBJECT tag in RegisterObjectData makes C4D create a PolygonObject, instead of a BaseObject, so one could apply all the PolygonObject methods (like GetAllPolygons or GetAllPoints) to the custom object without getting an error, but with no result. I started with ResizeObject, but the size wouldn't change. SetPoint returns index out of range since the size is 0, and GetAllPoints/Polygons always returns an empty list. Tried to use these methods in ObjectData.Init (using node as the object) and ObjectData.GetVirtualObjects (using op), but the object just refuses to change size without returning any error. Also tried creating a polygon object in GetVirtualObjects, manually giving it points and polygons, and it displays if OBJECT_GENERATOR is set, but when entering point/edge/polygon mode it disappears from the view and can't be edited.
I couldn't find any Python examples for this, and the only thing I found for C++ (which I don't know too much about), was the Lattice Plane Modifier plugin (using OBJECT_POINTOBJECT, not polygon), where it seems to ResizeObject and access the points with GetPointW and replace them with no problem. Also browsed the SDK documentation for ObjectData and NodeData and didn't see anything useful, except maybe ObjectData.Draw, but I don't know how it should be used.
My goal is to make multiple object types that can be edited by the user with the same tools as a polygon object, andthen giving them different icons and displaying different parameters in the UI depending on the object type. Is there a way to do this?
Thanks, Oscar
Hello @johnnyasdf,
thank you for reaching out to us. First of all I would point out that your stated project goals are not clear to me, as you give two which are not the same. You say (emphasis by me):
I am trying to make a custom [...] polygon object, but with more options. These options would be simple things, like showing certain parameters in the UI [...]
My goal is to make multiple object types that can be edited by the user with the same tools as a polygon object, [...]
These two statements are not the same.
The problem here is also that you are still very early in your search process, and implicitly ask for how to go about these goals of yours. This is out of scope of support, we cannot design applications for you, as stated in our Forum Guidelines. Your question also lacks the code you have already written or excerpts from it, which makes it also hard to give here answers.
I will however try to provide some guidance, but please understand that I cannot do this the whole way. I will also answer in bullet points, as there is so much ground to cover.
OBJECT_POLYGONOBJECT
OBJECT_POINTOBJECT
BaseObject
Opolygon
Cheers, Ferdinand
PS: It is not that haven't read your accessing points and polygons questions, but without having sorted out these design issues first, they are irrelevant. In short: Without code they are not answerable, but I would assume they are caused by the Python bindings in some shape or form.
First of all, thanks for your support.
It is not possible, at least not without A LOT of work, to implement polygonal geometry that is driven by Attribute Manger parameters and can maintain vertex-by-vertex manipulations of users. You must reimplement all its vertex/edge/polygon interactions OBJECT_POLYGONOBJECT is sort of uncharted territory.
That answers my question. My approach was trying if I could use the already implemented geometry interactions and add from that point. Since I found no example for OBJECT_POLYGONOBJECT, thought that could be it, but seems not.
If you just want to some information being displayed for objects, I would recommend implementing a tag which does that. If you want to, you could hide that tag from the users view, and also write a plugin which automatically distributes that tag in a scene
My plan B was along these lines, with a dialog to show the info.