Polygon Selection tags during Polygonization

On 18/03/2016 at 14:27, xxxxxxxx wrote:

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

This is a tricky one for me as it gets complex.  A user can use an object with a hierarchy of children for a process.  The user can use Polygon Selection tags, in an InExclude list on my plugin object, to denote areas not to be processed.  When processing, this (possible) hierarchy of objects is:

1. CurrentStateToObject'd
2. Join'd
3. Triangulate'd

using SendModelingCommand().

In order to maintain only the Polygon Selection tags in the InExclude list, a clone of the object hierarchy will need to be made so that any non-relevant P.Sel tags can be removed for MDATA_JOIN_MERGE_SELTAGS in Join.  Obviously can't remove them on the originals in the document.

So, when the clone is made, how do I maintain correlation between the InExclude list of tags in my plugin object and the tags on the cloned hierarchy?

On 21/03/2016 at 06:39, xxxxxxxx wrote:

Hi Robert,

we discussed your request in our daily team meeting and we are not sure, we understood the question.
Can you perhaps provide us with some code? Or some more details?

On 21/03/2016 at 08:45, xxxxxxxx wrote:

While I have decided to simply use a naming convention on the PolygonSelection tags on the objects being used by my plugin, it would still be interesting to know how this would work.  I don't have any code at this point but maybe this will help:

-> PolygonSelection tags
-> Link to Object
-> InExclude List to receive PolygonSelection tags from Object linked in this object

The user would drag-and-drop whatever PolygonSelection tags to be used for the process into the InExlude List.  Any other PolygonSelection tags on Object would be ignored by the process.

Chicken and Egg: In order to remove those ignored tags, a clone of Object would need to be made.  At that point, is there still some relevant connection between the clone's PolygonSelection tags and those from the original Object in MyPluginObject's InExclude List?  How does one maintain correlation when one object points to the orignal tags but I have to clone the original to remove the other tags?

My only thought here would be to get the positions of the InExclude List tags in the original Object (first, second, etc.) and use that to pick off the ones to keep and remove the rest.  Can't expect naming conventions for determination and pointers can't possibly work on the clone.

Just To Add: It sounds simple in that simple explanation but this Object linked to MyPluginObject could be a hierachy of relevant objects (all with their own PolygonSelection tags).  Then the entire enterprise gets even worse.  As soon as the clone is made and the Join is done, I have no access to a proper merged set of PolygonSelection tags unless I can recurse the hierarchy and associate each InExlude List tag with the object and tag on the object.

On 22/03/2016 at 06:30, xxxxxxxx wrote:

Hello Robert,

indeed no trivial problem.

My first thought was, if you couldn't do the cloning of the tags all by yourself based on the In-/Exclude list and in the process of doing so, build some kind of map keeping the relation you need.

The GetOrigin() function of BaseTag doesn't help either, as it provides results only in conjunction with cache building.

Then I had another idea (haven't tried it here, though) :
How about "tagging" the needed tags on the original object in some way. I mean, you can store information in the tags BaseContainer (using your plugin ID). And nobody would mind, if you used this temporarily to get your relation going. You could for example store a BaseLink to itself in the original tag. I'd just make sure, to remove this information, when you are done.

And lastly when talking about cloning stuff, one should never forget AliasTrans, which can be a tremendous helper. But I'm just mentioning it here for completeness, not sure it will be of help in this particular case.

On 23/03/2016 at 13:01, xxxxxxxx wrote:

The idea of the user actually placing a plugin tag with an InExclude list on each object that would be using PolygonSelection tags was something that I had considered.  At least cloning with AliasTrans would maintain the links in the list to the tags on the object since they are being cloned as well (unlike my plugin object).  That would give the user autonomy and my plugin a means to get at the proper Selection tags.