1
$\begingroup$

Blender version 2.92.0

I'm trying to generate a custom property on an object using python but when i try to use the color wheel and value slider for that property in a menu, the value slider is broken until i press "edit" on the custom property. Is there a way to fix this with python? I have already set min and max to be 0 and 1 but the property still wont function properly.

def setup_color_property( obj, color ):

    #obj["node_outline_color"] = color
    obj["node_outline_color"] = [0.5,0.5,0.5]
    if not "_RNA_UI" in obj:
         obj["_RNA_UI"] = {}
    rna_ui = obj.get("_RNA_UI")
    rna_ui.update( {"node_outline_color": obj["node_outline_color"]})
    obj["_RNA_UI"]["node_outline_color"] = {
        "min": 0.0,
        "max":1.0,
        "default": [0.5,0.5,0.5],
        "subtype": "COLOR",
        "description":"node_outline_prop"}

This function gets passed an object and a FloatVectorProperty but in this case it doesnt matter whether I set the default value for the property to the input color or assign any new color to it. What happens is that the custom property gets made without problems but when I try to manipulate that color, the value slider is completely broken:

enter image description here

It does not move and does not display the right value, when i try to move it around it doesnt move either but changes the color value to either something high like 40 or something just below 0, nothing in between. As mentioned before the only thing to make it work as expected is to press that "edit" button all the way in the custom property panel. Is there any way to resolve this issue with python?

$\endgroup$
1
  • $\begingroup$ Welcome! Use soft_min and soft_max instead of min and max $\endgroup$ Apr 24 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.