Hi all, I have another question. I need to add some properties that will give me RGB values. How do I add a custom RGB color swatch in a panel and make that a property?
register a FloatVectorProperty:
bpy.props.FloatVectorProperty(subtype=“COLOR”, min=0, max=1)
and add it to UI (.prop)
If you want RGB+A, use
bpy.props.FloatVectorProperty(size=4, subtype=“COLOR”, min=0, max=1)
What if I need integers from 0 to 255? Can I use an IntVectorProperty instead, with max of 255, subtype ‘COLOR’? Does that work?
no, that makes blender crash.
You would usually do int(color_component*255) for that
Thanks for your advice, I ended up doing just that (well, basically :)) in my script.