MoText dosn't updates after changing MoGraph Weightmap



  • Hello all!
    I have this python code running in a Python Tag:

    import c4d
    from c4d.modules import mograph as mo
    from c4d.utils import RangeMap
    
    def main():
    
        obj = op.GetObject()
        cl_count = mo.GeGetMoData(obj).GetCount()
    
        spline = obj[c4d.ID_USERDATA,2]
    
        ms_tag = obj.GetTag(c4d.Tmgweight)
    
        if not ms_tag:
            print 'No weight tag'
            return
    
        wlist = []
    
        for val in xrange(cl_count):
            res = RangeMap(value=val, mininput=0, maxinput=cl_count-1, minoutput=0.0, maxoutput=1.0, clampval=False,curve=spline)
            wlist.append(res)
    
        mo.GeSetMoDataWeights(ms_tag,wlist)
    

    it works if applied to Matrix Object, Cloner, but problem with MoText it updates after object reenabling.
    In Cinema 4D R18 it works fine.
    alt text
    0_1551888567454_mikeudin_mograph_tag_weight.c4d



  • Hi @mikeudin, first of all, I would like to remind you about the Q&A New Functionality, I've setup your post as a question but please try to do it yourself for the next topics.

    With that's said, some optimizations have been done since R18 and now a MoText retrieves data from its Tmgweight only if this one is getting dirty while before it was retrieved for each execution.
    Unfortunately, the Python method GeSetMoDataWeights have not been adapted, so I've filled a BugReport, for now, please consider to call

        mo.GeSetMoDataWeights(ms_tag, wlist)
        ms_tag.SetDirty(c4d.DIRTYFLAGS_DATA)
    
        # Since you are in a tag, next one are not necessary since tag is part of the scene graph execution
        # and are executed before the current object evaluated.
        # Meaning that obj GetVirtualObject will be called in in any case after reading the tag
        # and since the dirty count of the tag has changed, the Motext will retrieve them and not the one cached.
        obj.SetDirty(c4d.DIRTYFLAGS_DATA)
        obj.Message(c4d.MSG_UPDATE)
    

    Btw, thanks a lot for the scene, that help us to quickly reproduce the issue !

    If you have any questions, please let me know.
    Cheers,
    Maxime.