Setting Read-Only STRING value in Description

  • Hello,
    I'm trying to set the value of a string with a Static Text interface in my ObjectData plugin.

    Here is an example of what I'm trying to achieve. I created it in the UserData by adding Data with a String Data Type and Interface set to String, setting the value, then changing the Interface to Static Text:

    In my current Descriptions, I've tried using STRING and STATICTEXT but neither has produced the desired result.


    When using STRING, I try to set the value, but I get the error TypeError:__setitem__ expected float, not str. I don't know how to set it's value then make it a read-only/Static Interface.

    op[c4d.READOUT_WIDTH] = str(width)

    Can anyone please help me create this type of static text string? Thank you!

  • I sort of have a solution, but would love feedback on the right way to do this:

    I'm setting the string with this code:

    node.SetParameter(c4d.READOUT_WIDTH, str(width), c4d.DESCFLAGS_SET_0)

    Then in NodeData.GetDDescription, I'm setting the Description Parameter's DESC_CUSTOMGUI to DTYPE_STATICTEXT.

            width = description.GetParameterI(c4d.READOUT_WIDTH)
            if width :
                width[c4d.DESC_CUSTOMGUI] = c4d.DTYPE_STATICTEXT

    The difference between this and the UserData version is the UserData version has a box around the String's value while the above does not. Any feedback would be fantastic. Thank you!

Log in to reply