Fields that should be Color, Quaternion etc are all rendered as Vector. #126
Closed
Description
It is necessary to find a way to distinguish fields of different mathutils vector variants, which are currently all represented as Vector.
It seems the difference is not reflected in official API documentation, but it is of course known to Blender itself through the subtype
property of RNA metadata:
>>> bpy.types.ThemeView3D.bl_rna.properties['wire'].subtype # Color
'COLOR_GAMMA'
>>> bpy.types.Object.bl_rna.properties['color'].subtype # bpy_prop_array
'COLOR'
>>> bpy.types.Object.bl_rna.properties['rotation_quaternion'].subtype # Quaternion
'QUATERNION'
>>> bpy.types.Object.bl_rna.properties['rotation_euler'].subtype # Euler
'EULER'
>>> bpy.types.Object.bl_rna.properties['rotation_axis_angle'].subtype # bpy_prop_array
'AXISANGLE'
>>> bpy.types.Object.bl_rna.properties['location'].subtype # Vector
'TRANSLATION'
>>> bpy.types.Object.bl_rna.properties['scale'].subtype # Vector
'XYZ'
The exact rules from code in bpy_rna.c
are:
COLOR
,COLOR_GAMMA
: useColor
if length 3; otherwisebpy_prop_array
.QUATERNION
,EULER
: use Euler if length 3, or Quaternion if length 4; otherwisebpy_prop_array
.- other float vector types: use Vector if length 2, 3, 4; otherwise
bpy_prop_array
.