Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-11-15 09:38:07 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-11-15 09:38:07 +0300
commitdb163103868d805cf9c847ed56d385cd4967216a (patch)
tree5468dac9c8b5bff42f8e5588a1d2d1385d8362fb /source/blender/makesrna/intern/rna_object.c
parent8fee9836193c6321dd2d43ee30a6c2a773d4098e (diff)
- 'matrix_basis' for objects and pose bones, this is an alternative access to directly adjusting the loc/scale/rot.
- pose bone 'matrix_local' wasn't well named since it didn't work like object or regular bones. - pose bone matrix values for rna had array access rather then 4x4 matrix access. note: for pose bones update scripts by renaming 'matrix_local' --> 'matrix_basis'
Diffstat (limited to 'source/blender/makesrna/intern/rna_object.c')
-rw-r--r--source/blender/makesrna/intern/rna_object.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index cfa194725c7..fab30668a5b 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -182,6 +182,18 @@ static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16])
object_apply_mat4(ob, ob->obmat, FALSE, FALSE);
}
+static void rna_Object_matrix_basis_get(PointerRNA *ptr, float values[16])
+{
+ Object *ob= ptr->id.data;
+ object_to_mat4(ob, (float(*)[4])values);
+}
+
+static void rna_Object_matrix_basis_set(PointerRNA *ptr, const float values[16])
+{
+ Object *ob= ptr->id.data;
+ object_apply_mat4(ob, (float(*)[4])values, FALSE, FALSE);
+}
+
void rna_Object_internal_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA);
@@ -1639,8 +1651,8 @@ static void rna_def_object(BlenderRNA *brna)
static float default_quat[4] = {1,0,0,0}; /* default quaternion values */
static float default_axisAngle[4] = {0,0,1,0}; /* default axis-angle rotation values */
static float default_scale[3] = {1,1,1}; /* default scale values */
- int matrix_dimsize[]= {4, 4};
- int boundbox_dimsize[]= {8, 3};
+ const int matrix_dimsize[]= {4, 4};
+ const int boundbox_dimsize[]= {8, 3};
srna= RNA_def_struct(brna, "Object", "ID");
RNA_def_struct_ui_text(srna, "Object", "Object datablock defining an object in a scene");
@@ -1886,6 +1898,12 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, "rna_Object_matrix_local_get", "rna_Object_matrix_local_set", NULL);
RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, NULL);
+ prop= RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(prop, 2, matrix_dimsize);
+ RNA_def_property_ui_text(prop, "Input Matrix", "Matrix access to location, rotation and scale (including deltas), before constraints and parenting are applied.");
+ RNA_def_property_float_funcs(prop, "rna_Object_matrix_basis_get", "rna_Object_matrix_basis_set", NULL);
+ RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
+
/* collections */
prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "Constraint");