Questions about Ngons
On 05/12/2015 at 05:03, xxxxxxxx wrote:
Cinema 4D Version: R17
Platform: Mac ;
Language(s) : C++ ;
Greetings to all.
I'm knee deep in the NgonBase/Pgon/PgonEdge APIs, and I've got a few questions that the documentation doesn't seem to answer.
Do the inner edges passed to NgonBase::BuildNgon() need to be in any kind of order?
Must the inner edges passed to NgonBase::BuildNgon() always be paired- ie, you must include both edges that make up an edge between two points relative to either polygon on either side? It seems like this function always fails unless you do that (especially if "outer" is NULL), but it's not stipulated in the documentation.
Ditto for the outer edges- do they need to be paired up as well, or do you just include the edges relative to the polygons on the inside of the ngon?
Does anyone know how NgonBase::BuildNgon() builds the outlines of a polygon when the "outer" parameter is NULL? Failing that, are there any examples out there of how to build an outline from a list of edges?
What do PGONEDGE_REPEAT, PGONEDGE_RESET, and PGONEDGE_EDGEINDEX do?
Is there any easy way to merge ngons? It seems like NgonBase::BuildNgon() doesn't make any attempt at doing so, which means you can land up with a whacky situation where multiple ngons overlap each other.
When attempting to retrieve a list of hidden edges in a mesh, what is faster- iterating over the output from PolygonObject::GetNgonEdgesCompact(), or calling NgonBase::ToSelect(bs, NGON_TOSELECTION_INNEREDGES) and iterating over the resulting BaseSelect using BaseSelect::GetRange()?
Please note that for various reasons I cannot use the modelling library, as much as I'd like to. I'm stuck manipulating ngons directly through the PolygonObject, and there aren't many examples of doing this out there, hence my questions. Any help would be much appreciated!
On 07/12/2015 at 10:59, xxxxxxxx wrote:
first of all I need to ask, will this thread stay? Because during the last weeks you opened two threads on similar topics, and each time I invested some time for research and when I was about to answer, the threads were gone.
And then I'd like to know the reasons for not using the modelling library? As you already found out, the direct ngon access is poorly documented and we strongly discourage everybody to do it without modelling library. Nor do we usually support it.
That does not mean, I won't try to help you, but I will need some good reason to invest the time it will probably cost.
On 07/12/2015 at 18:42, xxxxxxxx wrote:
Sorry about that.
Each time I thought I'd answered my own question, in so far as the viewport started to reflect the changes I was making through the API. I didn't want to waste anybodies time, so I figured I should just erase the thread- apparently I landed up doing exactly that, so I apologize.
I need a way of hiding edges in a mesh without making C4D think the polygon object has been changed. If I use the modelling library to create the ngons, then things like the Pose Morph tag will see that change and recalculate accordingly, which I don't want (even though the underlying topology has not changed, nor have any points been added or removed).
The only way I've been able to do this is to manipulate the ngons directly through NgonBase.
On 08/12/2015 at 06:41, xxxxxxxx wrote:
well, if you "hide" edges (by merging polygons into Ngons) you DO change the polygon object by changing its internal data. And I don't think you can do that properly without informing Cinema about it.
Could you share your code so far so we see the context of your questions?
On 12/12/2015 at 05:23, xxxxxxxx wrote:
There is no code, or rather, there wasn't until I wrote it...
I just wanted to know how the NgonBase/Pgon/PgonEdge libraries worked together in general so that I could try and write my plugin as efficiently as possible. I've figured most of it out myself, though I'm still not clear on a lot of things the SDK documentation makes no attempt to explain at all (mainly #5).
Unless I'm mistaken, most of the answers to my questions are as follows (please correct me if I'm wrong) :
- No, you just need to include the edges of the polygons the inner edges are a part of
- No clue, I didn't need to figure this out (I'm assuming it just walks around the edges of each polygon manually)
- Nope, easier to get the inner edges somehow and rebuild the ngons yourself (only alternative I know of is to interact with the Pgon stuff directly, which I tried briefly, and ran away screaming)
- Looks like ToSelect() is faster, since GetNgonEdgesCompact() needs to populate an array the size of GetPolygonCount()