Edit: Draw cache and mesh things

On 11/06/2013 at 13:30, xxxxxxxx wrote:

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

    Hi Folks,

bare with me here, I'm wanting to clean up some fundamentals in my plugin that I can't seem to work out myself.

My plugin houses it's own polygon object data and draw. You can edit the mesh, etc etc. But there's a few nitty gritty things that are bugging me.

1. the drawn object in the viewport (looks like) it's not drawing the Z depth correctly. Polygons at the rear are showing up in front of polygons that are in front. I have no idea what to look for here... a flag for the basedraw? This happens when in object/model mode. It displays fine when in point/polygon/line mode. And it renders correctly.

2. my viewport mesh won't display a texture. When I add a texture tag to the polygon object draw (PolygonObject) Pobj->InsertTag(Ttexture) Cinema crashes. What do I need to be looking for to draw textures/materials on poly objects that I draw my in the viewport?

3. how does the cache system work? Can I 'set' the cache? Or, can I return a PolyObj of the cache? I can't use GVO to do my object drawing because of the plugin being an editable object.

4. can I run a modeling command on a polygon object during the Draw() function? I tried the below code, but it crashes Cinema:

ModelingCommandData mcd;   
BaseContainer bc;   
bc.SetReal(MDATA_SUBDIVIDE_SUB, 2);    // 2 used just for example   
mcd.bc = &bc;   
mcd.op = PMesh;   // also tried (BaseObject* )PMesh; --> PMesh is a PolygonObject   
mcd.doc = doc;   
SendModelingCommand(MCOMMAND_SUBDIVIDE, mcd);   


Edit: updates to some of the points - might make the query a bit clearer.. removed some of the late-night jibber-jabber I had written that's irrelevant..

On 20/06/2013 at 06:29, xxxxxxxx wrote:

Hi WP,

1. Sorry can't help you with this.
2. Neither.
3. You can not set it, it is set to the return-value of GVO(). But a Polygon-Object does not have a cache (at least Cinema's built in Polygon Object).
4. Why would you want do to this? Do it once and cache the result.

Btw, do you have some topics here on the PluginCafé to point me to? I also want to know how to
create ones own Polygon Object, or at least make my own object where you can modify the points
in the viewport.


On 20/06/2013 at 14:11, xxxxxxxx wrote:

Hi Niklas,

1. no worries 😃 - support?
2. sounds like I need to revisit this...
3. if Cinema's PolygonObject doesn't have a cache (or use a cache) - how does it work? I can't use GVO unless it can be used without the OBJECT_GENERATOR flag...
4. this one depends heavily on point 3, so until that makes more sense to me, I might leave this point blank for the moment!

While I do have something 'kind-of-working' it's not entirely satisfying. I really have just fumbled my way through this myself, but I have used a few previous topics as idea-generators! Some of them my own, others are just ones from random searches that I've used to get ideas. Here's a few I've used to read up on:


There are a couple of others, but I'm not able to get to my home station from here and thus can't get other links. But those might be a start for now?