From 70cd0803ab1552e3ec625070a8753349ec704e78 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 8 Apr 2011 13:32:56 +0000 Subject: add new subtype PROP_COORDS, for generic coordinates that are not to be changed by units. --- source/blender/makesrna/RNA_types.h | 1 + source/blender/makesrna/intern/makesrna.c | 1 + source/blender/makesrna/intern/rna_fcurve.c | 8 ++++---- source/blender/makesrna/intern/rna_rna.c | 1 + source/blender/python/intern/bpy_rna.c | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index e19ae4cf56d..3a15146770f 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -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, diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 8b69c764961..97d0f535a5b 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -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: { diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index d43de0acdc5..efb5bf0244c 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -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"); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 10c784b51e7..de2b551909c 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -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}}; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 612d8063424..61ccd0d9310 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -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) { -- cgit v1.2.3