use python script change joint weight isn't update in viewport


I write a python script for smooth joint weight,just a simple test.
This script works correctly,i can see weight change real time,but joint effect isn't change,polygon isn't change with weight smooth(when i move polygon and 'ctrl z',it work).I try to add "c4d.EventAdd" and "Message(c4d.MSG_UPDATE)",but no effect.
Could you give me some suggestions?this is my code.Thank you very much!

import c4d
from c4d import utils

pcount = op.GetPointCount()
WeightTag = op.GetFirstTag()

def GetPointWeight():
    pweightandjoint = {}
    for pindex in xrange(0,pcount):
        pweight = WeightTag.GetWeight(0,pindex)

    return pweightandjoint

def GetNeighborPoint():
    n = utils.Neighbor()
    np = dict()
    for index in xrange(0,pcount):
        polys = n.GetPointPolys(index)
        for p in polys:
            poly = op.GetPolygon(p)
            if index == poly.a:
            elif index == poly.b:
            elif index == poly.c:
                np[index].add(poly.d if poly.c != poly.d else poly.a)
            elif index == poly.d:
                np.setdefault(index,set()).add(poly.c if poly.c != poly.d else poly.b)


    return np

def main():
    nearpoint = GetNeighborPoint()
    pointweight = GetPointWeight()
    weight = 0
    for index in xrange(0,pcount):
        length = len(nearpoint[index])
        for pnt in xrange(0,length):
            weight += pointweight[nearpoint[index][pnt]]

        weight += pointweight[index]
        length += 1
        weight = 0


if __name__=='__main__':



CAWeightTag.WeightDirty() use this☺

@chuanzhen wow!thank you very much!可以给我解答一下C4D里面的带dirty这类函数是什么意思么?一直不太明白(Could you explain to me the meaning of this function?)

dirty 一般是记录操作的更改,例如你想检测发生的变化后,从而执行某些操作,就是检测dirty,这是我的理解,更准确的回答可以让maxon SDK团队人回答你,或者观看文档
(Answer translation:dirty is usually a change in the record operation. For example, if you want to detect the change that has occurred, and then perform some operations, it is to detect dirty. This is my understanding. A more accurate answer can let the maxon SDK team answer you or watch the document.)


not much to contribute here, yet.

But I have a few requests:
I hope you don't mind, I restored the first two posts, so others will have a chance to follow the discussion and can make use of the answer in future. I'd say, please, do only delete posts, if these are really redundant, otherwise rather leave it.

To be honest (and please bear my ignorance) I'm not completely sure about the language being used in your last posts, I hope I'm not insulting anyone, suspecting it to be Chinese. While we are fine with people discussing in their native language, we'd like to kindly ask you to provide us with some sort of translation in such cases. In the end this forum is all about sharing information with an international community.

Please also consider using the tagging system to categorize your threads (as I did here now), it will help us to keep this forum tidy.

A more accurate answer can let the maxon SDK team answer you or watch the document.

Can you maybe rephrase the question or provide some more details, we are not sure, on what to provide more details or a more accurate answer.


@a_block i'm sorry but i didn't want delete posts,i just write some error and hope to rewrite(i didn't see 'edit' at that time).
I will use english or give annotation next time ,Thank you for this wonderful community.

@mike No need to apologize, we are all new here. No worries. Especially during the starting phase of this new forum, we try to point even at small issues, hoping it will lead to a cleaner forum in future.