Detect tag attach in object
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/02/2004 at 00:29, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.207
Platform: Windows ;
Language(s) : C++ ;---------
I wrote my own object, use a own shader, and the texture tag to connect them. My problem is, that I need to change some specific things in the object according to the attached shader, for example I need to change the objects size to adjust it to the size of a texture which is loaded within my shader. If I drop my shader onto my object, my objects receives a MSG_CHANGE. When I get this message, I look for attached tags with GetTag, but this only returns a null pointer, the tag is not completely attached to the object at this moment but only a bit later. Later I can look for the tag, get the shader, get the size and adjust my object, but I have to start this manually. Would be nice if my object could do this automatically when the tag is attached to the object, but only the MSG_CHANGE and no more messages are sent. MSG_CHANGE indicates that any object data has been changed....which object data has changed??? You see any solution for my problem? -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/02/2004 at 04:45, xxxxxxxx wrote:
Ok...found a workaround now, within the draw function of the shader I sent a update message to the object, after attaching a draw is called, and then the tag is initialized.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/02/2004 at 07:40, xxxxxxxx wrote:
New problems....first of all, the solution is not nice...works, but not nice. But now I also want the object to do something when a tag is deleted. I really dont understand that MSG_CHANGE. I always get that message BEFORE a change will haben...before a tag is attached, and also before a tag is to be deleted. But how should I destinguish, WHAT the soon comming change will be???? I only know, that _soon_ _something_ will change...but to react to it, I need to know what will change? SDK says, that MSG_ChANGE has to be sent, if any object data HAS BEEN changed....but when I get the message, the change has not beed processed, it WILL process soon....doesnt make any sense that way, does it? And is there a way to find out what will change, in my case, if the MSG_CHANGE indicates that a tag will be attached, or a tag will be deleted?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/02/2004 at 16:46, xxxxxxxx wrote:
Yeah, I've confirmed that the messages are sent before the event they are announcing. I don't know why this is so, but I've asked the programmers and will report back what they have to say.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/02/2004 at 19:15, xxxxxxxx wrote:
Unfortunately this is just the way it is. The MSG_CHANGE message is sent to increment the dirty count so the order isn't exactly specified.
Since messages generally aren't reliable in C4D for detecting changes (or rather, shouldn't be relied on), you'll have to perform your routines at the first time you actually discover that a tag has been added or removed. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/02/2004 at 08:27, xxxxxxxx wrote:
Maybe I found a more reliable solution now, I added a MessageData plugin to my bunch of objects. This one can listen to all core messages, which seem to be relieable. EVMSG_CHANGE and EVMSG_DOCUMENTRECALCULATED seem to be very nice, at least I tried them with one of my jobs to do, that story from above, detect when a tag is attached, and even when it is released and modify the according object, this seems to work nice.
In general I think that the object messages are not very relieable. For example if I change the objects position by editing the position values in the attribute manager, a MSG_CHANGE is sent. If I do the same by just moving the object with the mouse in the editor, which of course also modifies the objects container, then no message is sent. That seems to be a bit inconsequent to the own rules...or I didn't understand these rules