add new subtype PROP_COORDS, for generic coordinates that are not to be changed by units.

This commit is contained in:
Campbell Barton 2011-04-08 13:32:56 +00:00
parent 2b95549079
commit 70cd0803ab
5 changed files with 8 additions and 5 deletions

View File

@ -127,6 +127,7 @@ typedef enum PropertySubType {
PROP_XYZ = 29,
PROP_XYZ_LENGTH = 29|PROP_UNIT_LENGTH,
PROP_COLOR_GAMMA = 30,
PROP_COORDS = 31, /* generic array, no units applied, only that x/y/z/w are used (python vec) */
/* booleans */
PROP_LAYER = 40,

View File

@ -1776,6 +1776,7 @@ static const char *rna_property_subtypename(PropertySubType type)
case PROP_ACCELERATION: return "PROP_ACCELERATION";
case PROP_XYZ: return "PROP_XYZ";
case PROP_COLOR_GAMMA: return "PROP_COLOR_GAMMA";
case PROP_COORDS: return "PROP_COORDS";
case PROP_LAYER: return "PROP_LAYER";
case PROP_LAYER_MEMBER: return "PROP_LAYER_MEMBER";
default: {

View File

@ -1219,7 +1219,7 @@ static void rna_def_fpoint(BlenderRNA *brna)
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL);
/* Vector value */
prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_NONE); /* keyframes are dimensionless */
prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
RNA_def_property_float_sdna(prop, NULL, "vec");
RNA_def_property_array(prop, 2);
RNA_def_property_ui_text(prop, "Point", "Point coordinates");
@ -1281,19 +1281,19 @@ static void rna_def_fkeyframe(BlenderRNA *brna)
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
/* Vector values */
prop= RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_NONE); /* keyframes are dimensionless */
prop= RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
RNA_def_property_array(prop, 2);
RNA_def_property_float_funcs(prop, "rna_FKeyframe_handle1_get", "rna_FKeyframe_handle1_set", NULL);
RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle");
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_NONE); /* keyframes are dimensionless */
prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
RNA_def_property_array(prop, 2);
RNA_def_property_float_funcs(prop, "rna_FKeyframe_ctrlpoint_get", "rna_FKeyframe_ctrlpoint_set", NULL);
RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
prop= RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_NONE); /* keyframes are dimensionless */
prop= RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
RNA_def_property_array(prop, 2);
RNA_def_property_float_funcs(prop, "rna_FKeyframe_handle2_get", "rna_FKeyframe_handle2_set", NULL);
RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle");

View File

@ -967,6 +967,7 @@ static void rna_def_property(BlenderRNA *brna)
{PROP_QUATERNION, "QUATERNION", 0, "Quaternion", ""},
{PROP_XYZ, "XYZ", 0, "XYZ", ""},
{PROP_COLOR_GAMMA, "COLOR_GAMMA", 0, "Gamma Corrected Color", ""},
{PROP_COORDS, "COORDINATES", 0, "Vector Coordinates", ""},
{PROP_LAYER, "LAYER", 0, "Layer", ""},
{PROP_LAYER_MEMBER, "LAYER_MEMBERSHIP", 0, "Layer Membership", ""},
{0, NULL, 0, NULL, NULL}};

View File

@ -549,7 +549,7 @@ static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_
/* note that PROP_NONE is included as a vector subtype. this is because its handy to
* have x/y access to fcurve keyframes and other fixed size float arrayas of length 2-4. */
#define PROP_ALL_VECTOR_SUBTYPES PROP_NONE: case PROP_TRANSLATION: case PROP_DIRECTION: case PROP_VELOCITY: case PROP_ACCELERATION: case PROP_XYZ: case PROP_XYZ_LENGTH
#define PROP_ALL_VECTOR_SUBTYPES PROP_COORDS: case PROP_TRANSLATION: case PROP_DIRECTION: case PROP_VELOCITY: case PROP_ACCELERATION: case PROP_XYZ: case PROP_XYZ_LENGTH
PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
{