Merge Tags
-
Hi,
Assume one would have developed a custom tag to store and process data (max one tag allowed per object). A scene is constructed with i.e. 3
PolygonObject
, each having such a custom tag assigned.
The user then performs a "Connect" or "Connect + Delete".How does the custom tags get triggered to perform a "merge" ?
Same question when a plugin performs a
SendModelingCommand(MCOMMAND_JOIN ...
.
Here we know the first object in the list to be joined (and thus its tag) will be the resulting "joined" object, while the other objects in the list are the "joinee".
Still, how does this (joined) tag gets triggered to merge?Is this related to the Write/Read/Copy implementation, or is there a specific "Merge" functionality which I don't seem to have come across?
-
Hi Daniel, thanks for reaching out us.
With regard to the question posed, since R20 you can make use of the MeshAttribute Interfaces that have been designed to make such tasks of handling information tightly connected with meshes as easy as possible.
If, on the contrary, you need to make this working with releases < R20 (as from your tags), then things get more complicated and I've the feeling that the merging of data contained in custom tags is not possible - the merging of UV data it's likely to be hard-coded in Cinema 4D and I think there's no chance to replicate such behavior -.
Rest assured, that being this nothing more than a guess, I'll check with our developers and report accordingly to the findings.
Cheers, R
-
Hi Daniel, I've checked more in detail about a potential answer to your question and actually you should consider to implement
TagData::Message()
and actually establish the related business logic whenMSG_POINTS_CHANGED
,MSG_POLYGONS_CHANGED
are caught for data respectively stored per-point or per-polygon orMSG_PRETRANSLATE_POLYGONS
,MSG_TRANSLATE_POLYGONS
when n-gons are part of the process.Cheers, R
-
@r_gigante
Thanks for this info.
In two of my plugins I am already handling theTagData::Message
to check for point and polygon changes (and other things as well).
To my understanding, all this would be performed on the object remaining after the merge.
What happens to the objects being merged "into" the remaining object, and especially the tags assigned to them.
I am still wondering how to actually be able to merge the data from the other tags.Say you have 3 objects: cube. sphere, cylinder. Each has a custom tag assigned.
To keep it simple let's say that the tag stores a user specified value.
User has entered value 10 for the cube, 15 for the sphere, 12 for the cylinder.Now, when the 3 objects get merged (via
connect
orconnect + delete
orSendModelingCommand(MCOMMAND_JOIN ...
, ...) the end result is the cube object receiving all the polygons and points, etc ... from all 3 objects. Internally theUVW tag
is merged, etc ...
The custom tag from the original cube remains as is, with value 10, and could react to i.e.MSG_POLYGONS_CHANGED
in theTagData::Message
.
But ... how and where would I be able to handle the merging of values 15 and 12 into the custom tag ?Only when perform a
SendModelingCommand(MCOMMAND_JOIN ...
am I able to actively merge the values, as I know which objects will be merged, and thus can obtain the values from their tags before the joining is performed.
With a connect or connect + delete, how to know about the other objects, and especially their custom tags? I don't expect this to be available inside aTagData::Message
-
Hi,
Funny how I lost track of this topic, and I am apparently not the only oneIt's been quite a while ago, and I can't for the life of me remember why I started this topic.
While working on a new plugin I needed a way to identify a tag of typeTpolygonselection
.
I create said tag and add it as the first tag to aPolygonObject
.
After which I perform multipleSendModelingCommand
on the object (MCOMMAND_JOIN, MCOMMAND_DELETE, MCOMMAND_OPTIMIZE, etc ...). As a result of these actions, the order of the tags get reorganized.I was wondering, except of providing the tag a "unique" name, how could I distinguish it from any other polygon selection tag the user might have created?
At first I thought to simply add some information into the tag'sBaseContainer
. But as a result of all theSendModelingCommand
that information does not survive. I seem to have tried this already in the past, hence the reason why I performed a search in the forum ... only to encounter this unresolved topic.I will create a separate topic for the above question, but I just wanted to mention it here as being to reason to revive this thread. An answer to this one might maybe help resolve some other issues I am having with tags in general.
-
Sorry Daniel, I'm late here. I'll try to come back asap.
Riccardo
-
Hi @C4DS, thanks for following up and sorry for the delay.
You're right on stating that you can access the data of the "source" custom tags only when doing the merging programmatically. Viceversa acquiring these data when the modeling command is performed via the UI, it's not doable without introducing strong performance penalties in Cinema 4D since there's no way to hook into the modeling command and query for these data (as much UVW, vertexcolor and other hardcoded tags are doing).
Cheers,
-
@r_gigante said in Merge Tags:
Hi @C4DS, thanks for following up and sorry for the delay.
Thanks for getting back.
No worries regarding the delay. I had lost track of it as well.
And since this topic seems to be quite "advanced level" I can understand an answer isn't readily available.
Although I am not to sure what to make from your response?The part which says " it's not doable without ... " seems to imply that it might be possible, but on the other hand it also seems not possible at all, since hooks into the modeling commands are currently not available (and will probably never be available in near, nor far future).
So as far as I seem to understand tags are currently only good to be used for storing data (and so on) ... if the objects they are assigned to remain static. Merging of objects, splitting, cloning, etc ... none of these actions can be handled properly by 3rd party plugin developer. Not for existing tags, not for custom created tags.
If that is the end conclusion, then that's good to know.
Not the answer I was hoping for, but nonetheless good to know.Thanks for your time.
-
Hi @C4DS, thanks for following up.
One note that it's worthy to share: the outcomes of this thread are valid as long as you need to stick to Classic API. In Maxon API (R20 and higher) you can make very good use of the CustomDataTag (see also GitHub example) whose data merging is managed directly by the modeling kernel.
Last but not least, as usual, if the discussion has come to an end, please don't forget to mark the question as SOLVED.
Cheers, R