1
$\begingroup$

Using the Blender Python API, I am creating a float array custom property for the selected object using the following code:

import bpy

obj = bpy.context.active_object

float_array = "Paint - Custom Color"
obj[float_array] = (1.0, 1.0, 1.0)
obj.id_properties_ensure()
property_manager = obj.id_properties_ui(float_array)
property_manager.update(
    default=(1.0, 1.0, 1.0), min=0.0, max=1.0, soft_min=0.0, soft_max=1.0
)

Is there a way to change the default subtype value from 'Plain Data' to 'Linear Color'enter image description here

$\endgroup$

1 Answer 1

0
$\begingroup$

You can use the subtype argument in the update method.

property_manager.update(
    default=(1.0, 1.0, 1.0), 
    min=0.0, 
    max=1.0, 
    soft_min=0.0, 
    soft_max=1.0, 
    subtype="COLOR"
)

Other possible values are defined in the docs.

COLOR
TRANSLATION
DIRECTION
VELOCITY
ACCELERATION
MATRIX
EULER
QUATERNION
AXISANGLE
XYZ
XYZ_LENGTH
COLOR_GAMMA
COORDINATES
LAYER
LAYER_MEMBER
NONE

You can find all the available arguments in the docs.

$\endgroup$
1
  • $\begingroup$ Works like a charm. Many thanks $\endgroup$
    – ancalleja
    May 1, 2023 at 13:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .