Changing Math node input value Xpresso

  • On 23/11/2017 at 06:54, xxxxxxxx wrote:

    Hi everyone,

    I'm trying to change a math node value and unfortunately can't do it with:

    math[0][2000, 1001] = 1.0

    it gives the TypeError: __setitem__ got unexpected type 'float'.
    The error appears with any assigned value type.

    Interestingly enough if I change the value manually first and than run the line it works fine.
    Don't understand what I'm missing.

    Thank you very much in advance! 🙂


  • On 23/11/2017 at 07:14, xxxxxxxx wrote:

    import c4d
    def main() :
        nodeMaster = doc.GetActiveTag().GetNodeMaster()
        node = nodeMaster.GetRoot().GetDown()
        # GET
        lv1 = c4d.DescLevel(2000, c4d.DTYPE_SUBCONTAINER, 0)
        lv2 = c4d.DescLevel(1000, c4d.DTYPE_REAL, 0) # or DTYPE_DYNAMIC that will automaticly adapt
        print node.GetParameter(c4d.DescID(lv1, lv2), c4d.DESCFLAGS_GET_0)
        # SET
        lv1 = c4d.DescLevel(2000, c4d.DTYPE_SUBCONTAINER, 0)
        lv2 = c4d.DescLevel(1000, c4d.DTYPE_DYNAMIC, 0)
        node.SetParameter(c4d.DescID(lv1, lv2), 50.0, c4d.DESCFLAGS_SET_0)
    if __name__=='__main__':

    As you may know or not, [] operators are just a python wrapper around Get/SetParameter, and sometime it fails. So you need to build it yourself

  • On 23/11/2017 at 07:34, xxxxxxxx wrote:

    Hi Graphos,

    It works great and understand better the containers.

    Thank you very much once again! You are a live saver and a technical wizard 😄

Log in to reply