On 18/04/2017 at 03:15, xxxxxxxx wrote:
I try to create an selection effector with plain effector(as in the screenshot).I don't know how to delete xpresso tag when Idelete an polygon selection from taglist.In other words,I want to keep the counts of xpresso tags equel to the counts of taglist all the time.This is my first question.I know how to add xpresso tags according to the polygon selection in the taglist,but the xpresso tags can't be update,but I delete some xpresso tags,they can be update,I don't know how to fix it,This is my second question.
Thanks in advanced!
def main() :
plain = op.GetObject()
taglist = plain[c4d.ID_USERDATA,1]
xptag = plain.GetTag(c4d.Texpresso,0)
cnt = taglist.GetObjectCount()
if len(plain.GetTags()) <= cnt-1:
for i in xrange(1,cnt) :
xptag1 = plain.MakeTag(c4d.Texpresso,xptag)
for i in xrange(cnt) :
seltag = taglist.ObjectFromIndex(doc,i)
plain.GetTag(c4d.Texpresso,i)[c4d.ID_USERDATA,1] = seltag
On 19/04/2017 at 02:51, xxxxxxxx wrote:
you are not allowed to modify the scene (in this case adding a new tag) from a tag's Execute() function (and the main() function of the Python tag is basically the same, it's called during evaluation of the scene). See also the Important Threading Information on this topic.
So you will need to do the creation (and deletion) of tags in main thread, easiest to do it is in message function. Declare a message() function next to your main() function in the Python tag. Now, you have several options, like having a button to sync selection tags and xpresso tags or to react on changes of your InExcludeList.
It would roughly look like so:
def message(msgType, data) :
# react to parameter change
if msgType == c4d.MSG_DESCRIPTION_POSTSETPARAMETER:
# check for your InEx user data ID:
if data['descid'].id == c4d.ID_USERDATA and data['descid'].id == ID_UD_INEX:
# react on change of the InExList
# or react to a button
elif msgType == c4d.MSG_DESCRIPTION_COMMAND:
# check for your button's user data ID:
if data['id'].id == c4d.ID_USERDATA and data['id'].id == ID_UD_BUTTON:
# react to button press
On 22/04/2017 at 01:38, xxxxxxxx wrote:
Thanks Andreas. but the problem is still not fixed.
On 25/04/2017 at 05:59, xxxxxxxx wrote:
which problem specifically?