Attribute Manamger Update Delay When Description Added Dynamically
-
@Cairyn Thank you for taking your time.
I see. So to execute GetDDescription, "c4d.EventAdd()" should be added to Message() function like below?
def Message(self, node, type, data): if type == c4d.MSG_DESCRIPTION_COMMAND: if data["id"][0].id == c4d.TTESTTAG_ADD_BUTTON: bc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_BASELISTLINK) self.links_list.append(bc) c4d.EventAdd() return True
I tried this code but it doesn't work and the result is the same as before.
-
Okay, I tested it on my machine, and it seems that you need to use
node.SetDirty(c4d.DIRTYFLAGS_DESCRIPTION)
instead of just refreshing the GUI. Apparently the change to the description through SetParameter does not suffice to inform C4D about a necessary redraw.This works for me... now I just would like to know why it creates float fields for the 2nd to 4th "Add", but link fields for all others...
-
@Cairyn Thank you again for helping me.
Yep,SetDirty(c4d.DIRTYFLAGS_DESCRIPTION)
works like a charm!def Message(self, node, type, data): if type == c4d.MSG_DESCRIPTION_COMMAND: if data["id"][0].id == c4d.TTESTTAG_ADD_BUTTON: bc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_BASELISTLINK) self.links_list.append(bc) node.SetDirty(c4d.DIRTYFLAGS_DESCRIPTION) # This was needed! return True
I'm sorry but I'm not sure what you mean about float fields for 2nd to 4th "Add". On my end, my code adds link fields everytime user click the Add button.
Let me know if my understanding is wrong. -
By the way, it is also worth mentioning the Note on MSG_CHANGE
-
@mp5gosu Oh I couldn't find that. Thank you for your heads up!
-
@beatgram I changed some parts of the code since I was wondering about a few details, so this may be solely on my side. Do you have a ttesttag.h file that you don't show, and a .str file? For my test, I created these files (plugin didn't start without). That may have created some differences.
-
@Cairyn Okay, here's my .h / .str files. Sorry, I should have shared these in the first post.
ttesttag.h
#ifndef _TTESTTAG_H_ #define _TTESTTAG_H_ enum { TTESTTAG_LINKS_GROUP = 1001, TTESTTAG_ADD_BUTTON = 1002, TTESTTAG_REMOVE_BUTTON = 1003, } #endif
ttesttag.str
STRINGTABLE Ttesttag { Ttesttag "Test Tag"; TTESTTAG_LINKS_GROUP ""; TTESTTAG_ADD_BUTTON "Add"; TTESTTAG_REMOVE_BUTTON "Remove"; }
-
@beatgram Ah yes, that makes sense that these files exist. It doesn't explain the phenomenon though, since I chose precisely the same numeric values...
I believe C4D is doing something in the background with these files, otherwise you wouldn't be able to write
c4d.TTESTTAG_LINKS_GROUP
- this is not a constant that C4D defines, so somehow it is generated in the header parsing process. I suppose I need to look into that, although the original question has been answered now -
@Cairyn Interesting investigation but it's a bit difficult for newbie like me.
Anyway, I appreciate your help! -
Hi @beatgram so far nothing to add from our side, what @Cairyn said is the correct way to proceed with
node.SetDirty(c4d.DIRTYFLAGS_DESCRIPTION)
.Regarding ttesttag.h and more generally about resources in Cinema 4D.
They are parsed during the startup of Cinema 4D, due to a bug currently if you change the content of the file it will not update it and you will need to update the symbolcache for more information about it see Dealing with Symbolcache.However, I can't really explain why it was creating float description and not DTYPE_BASELISTLINK, if you are able to reproduce the issue please share the whole project so we can look at it. And except if you override the value of DTYPE_BASELISTLINK I don't see any valid reason for the Python symbol parser to produce the change.
Cheers,
Maxime. -
@m_adam Thank you for confirming.
I already know symbolcache thingy, so it's no problem. -
Hi with the latest update of Cinema 4D (R24 SP1),
any update to a description files should now be reflected correctly to the symbolcache files, so it's not needed to delete it manually anymore.Cheers,
Maxime. -
@m_adam Oh, that's a little update for many users but huge for tiny developers like me!
Thank you so much for the heads up.