BuildNgonFromPolys() failing...

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/03/2006 at 01:29, xxxxxxxx wrote:

Strange. Tested 9.1 this morning with no problems either. What happens if you run the retriangulate ngons function or the remove ngons function, does the structure manager then work?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/03/2006 at 02:34, xxxxxxxx wrote:

Hmmm... I just tried retriangulate ngons and that fixes the SM display list, but on that sample file I sent you now the top and bottom (both ngons) are missing one triangle (the last triangle created in each case.. where the sequence of points connects back to the start point.
Remove ngons also fixes the SM display.
Just for reference, my C4D version is V9.102

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/03/2006 at 02:44, xxxxxxxx wrote:

...apparently selecting an ngon and doing a 'reverse normals' also does a retriangulate... giving the same results as above - it loses a triangle.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/03/2006 at 03:37, xxxxxxxx wrote:

Anything that causes the ngon to be retriangulated will give it the optimal mesh, which can include quads. I'm at a loss why your SM isn't working, given it works fine here under 9.1 and 9.5 I'm afraid I have no way to help you find out why yours does not work. For the SM to not work would suggest a problem with the ngons, also given that retriangulate then makes it work that too suggests a ngon data problem yet it works ok here, very odd :-/
All I can suggest is to try a clean install of CINEMA to ensure nothing else is causing it, but I can't think what would.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/03/2006 at 04:14, xxxxxxxx wrote:

Strange... any thoughts on retriangulate causing a missing triangle?  Are you seeing that too, or not? (I'm just wondering if it's the same/related issue that's only showing up on my system).

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/03/2006 at 04:45, xxxxxxxx wrote:

Ah sorry, my mistake actually. I'd been just loading and thought the obj import would use your own, but it doesn't :-o I noticed the plugin menu entry, on trying it with that yes I do get the missing SM data.
I looked through the ngon edge data, there is a missing ENDSEGMENT marker, on looking at your import code again I also couldn't see one there. In the docs it mentions PGONEDGE_ENDSEGMENT but doesn't clarify why or when you need to use it. This marks the end of an ngon segment, with BuildNgon you could have multiple segments (holes). On the last edge for each segment you need to mark it. I forced the marker bit during BuildNgon and it then works fine, so you just need to add that to your code and all should be working now.
I'll ask that the docs make this clearer and that we add some more helpers so you don't need to deal with such raw data in/out of the ngons without needing to go to the modeling library which isn't always suitable for non-modeling cases like this.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/03/2006 at 06:02, xxxxxxxx wrote:

Ah! Great - thanks.  Now I just need to figure out how (and where) to set that bit... :).

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/03/2006 at 06:38, xxxxxxxx wrote:

On the last edge in the array, just do |PGONEDGE_ENDSEGMENT. That is assuming you aren't adding any holes, otherwise it would be the last edge for each segment (the main outline, then each hole).

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 23/03/2006 at 04:31, xxxxxxxx wrote:

Got it... and that fixed the problem - thanks!
Just to recap a bit...
On the BuildNgonFromPolys() issue, since you have to pass the edge list to it afterall (not optional, as the docs say) then that function doesn't really seem to provide anything useful over BuildNgon()... I'd just get rid of it if noone's using it (maybe just remove it from the docs).
And yes, in my case, I'm not really modelling (on export, at least), so having some easy way to just get an ordered list of points of an Ngon would make writing things like export plugins a lot easier.
After looking around some more, it looks like I could have maybe used the modelling library pNgonBase- >GetNgon() and had a list of points in the Ngon class (instead of  working with the Pgon class from the PolygonObject's op- >GetNgon()), but it's not clear from the docs whether that list of points is in the right order (?) so I might still have had to walk the segment list (?).
Anyway, I think everything is working now, so thanks a lot for all the help!
- Keith

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/04/2008 at 11:12, xxxxxxxx wrote:

I'm in the process of a massive revamp of all the code listed previously in this thread, but I just wanted to add a comment for future reference...
While not specifically documented as such, pNgonBase- >BuildNgon() requires that in addition to the PGONEDGE_ENDSEGMENT flag for end segments, you also have to set the PGONEDGE_NOEDGES flag for any polys included in the Ngon, but have no outer (or potentially inner) edges that make up the edge list.
In my case, it seems to be sufficient to just add one edge (I use the 0 edge) to the list for each of those polys, like so...
pEdges[edgecount++] = (noedge_poly_index * 4)+0 | PGONEDGE_NOEDGES;
...I am adding that (or those) to the 'outer' edge list that I'm passing to **pNgonBase- >BuildNgon() **and this seems to have fixed some cases where a poly contributed no outer edges (I'm not passing the inner edge list, since I'm not doing 'holes').

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/04/2008 at 11:17, xxxxxxxx wrote:

(I realize the '+0' is unneeded and not doing anything, it's just there to indicate the 0 edge :) ).