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
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')
-rw-r--r--source/blender/makesrna/RNA_define.h2
-rw-r--r--source/blender/makesrna/intern/rna_define.c8
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c2
-rw-r--r--source/blender/makesrna/intern/rna_object.c22
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c2
-rw-r--r--source/blender/makesrna/intern/rna_pose.c21
-rw-r--r--source/blender/makesrna/intern/rna_scene.c2
-rw-r--r--source/blender/makesrna/intern/rna_space.c2
8 files changed, 45 insertions, 16 deletions
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index dc31573e8dd..f97187d6e15 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -134,7 +134,7 @@ void RNA_def_property_flag(PropertyRNA *prop, int flag);
void RNA_def_property_clear_flag(PropertyRNA *prop, int flag);
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype);
void RNA_def_property_array(PropertyRNA *prop, int length);
-void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, int length[]);
+void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[]);
void RNA_def_property_range(PropertyRNA *prop, double min, double max);
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item);
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 85f31e245d4..c44b55764b6 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -1026,6 +1026,12 @@ void RNA_def_property_array(PropertyRNA *prop, int length)
return;
}
+ if(prop->arraydimension > 1) {
+ fprintf(stderr, "RNA_def_property_array: \"%s.%s\", array dimensions has been set to %d but would be overwritten as 1.\n", srna->identifier, prop->identifier, prop->arraydimension);
+ DefRNA.error= 1;
+ return;
+ }
+
switch(prop->type) {
case PROP_BOOLEAN:
case PROP_INT:
@@ -1041,7 +1047,7 @@ void RNA_def_property_array(PropertyRNA *prop, int length)
}
}
-void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, int length[])
+void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
{
StructRNA *srna= DefRNA.laststruct;
int i;
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 95e17451e62..8d16c705d96 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -1300,7 +1300,7 @@ static void rna_def_mtface(BlenderRNA *brna)
{TF_ALPHA, "ALPHA", 0, "Alpha", "Render polygon transparent, depending on alpha channel of the texture"},
{TF_CLIP, "CLIPALPHA", 0, "Clip Alpha", "Use the images alpha values clipped with no blending (binary alpha)"},
{0, NULL, 0, NULL, NULL}};
- int uv_dim[]= {4, 2};
+ const int uv_dim[]= {4, 2};
srna= RNA_def_struct(brna, "MeshTextureFaceLayer", NULL);
RNA_def_struct_ui_text(srna, "Mesh Texture Face Layer", "Layer of texture faces in a Mesh datablock");
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");
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 13a62c913d1..a28e0b32eae 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -1437,7 +1437,7 @@ static void rna_def_softbody(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
- int matrix_dimsize[]= {3, 3};
+ const int matrix_dimsize[]= {3, 3};
static EnumPropertyItem collision_type_items[] = {
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index b4a132dd1ec..df332ffa253 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -541,13 +541,13 @@ PointerRNA rna_PoseBones_lookup_string(PointerRNA *ptr, const char *key)
return rptr;
}
-static void rna_PoseChannel_matrix_local_get(PointerRNA *ptr, float *values)
+static void rna_PoseChannel_matrix_basis_get(PointerRNA *ptr, float *values)
{
bPoseChannel *pchan= (bPoseChannel*)ptr->data;
pchan_to_mat4(pchan, (float (*)[4])values);
}
-static void rna_PoseChannel_matrix_local_set(PointerRNA *ptr, const float *values)
+static void rna_PoseChannel_matrix_basis_set(PointerRNA *ptr, const float *values)
{
bPoseChannel *pchan= (bPoseChannel*)ptr->data;
pchan_apply_mat4(pchan, (float (*)[4])values, FALSE); /* no compat for pradictable result */
@@ -683,6 +683,8 @@ static void rna_def_pose_channel(BlenderRNA *brna)
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 */
+ const int matrix_dimsize[]= {4, 4};
+
StructRNA *srna;
PropertyRNA *prop;
@@ -784,18 +786,21 @@ static void rna_def_pose_channel(BlenderRNA *brna)
/* transform matrices - should be read-only since these are set directly by AnimSys evaluation */
prop= RNA_def_property(srna, "matrix_channel", PROP_FLOAT, PROP_MATRIX);
RNA_def_property_float_sdna(prop, NULL, "chan_mat");
- RNA_def_property_array(prop, 16);
+ RNA_def_property_multi_array(prop, 2, matrix_dimsize);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Channel Matrix", "4x4 matrix, before constraints");
- prop= RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_array(prop, 16);
- RNA_def_property_ui_text(prop, "Local Matrix", "Matrix representing the parent relative location, scale and rotation. Provides an alternative access to these properties.");
- RNA_def_property_float_funcs(prop, "rna_PoseChannel_matrix_local_get", "rna_PoseChannel_matrix_local_set", NULL);
+ /* writable because it touches loc/scale/rot directly */
+ 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, "Basis Matrix", "Provides an alternative access to loc/scale/rotation relative to the parent and own rest bone.");
+ RNA_def_property_float_funcs(prop, "rna_PoseChannel_matrix_basis_get", "rna_PoseChannel_matrix_basis_set", NULL);
+ RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
+ /* final matrix */
prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
RNA_def_property_float_sdna(prop, NULL, "pose_mat");
- RNA_def_property_array(prop, 16);
+ RNA_def_property_multi_array(prop, 2, matrix_dimsize);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Pose Matrix", "Final 4x4 matrix for this channel");
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 0a15e894552..ecade727bb6 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -979,7 +979,7 @@ static void rna_def_transform_orientation(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- int matrix_dimsize[]= {3, 3};
+ const int matrix_dimsize[]= {3, 3};
srna= RNA_def_struct(brna, "TransformOrientation", NULL);
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 36c4647a6e4..45ad7700229 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1003,7 +1003,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
- int matrix_dimsize[]= {4, 4};
+ const int matrix_dimsize[]= {4, 4};
static EnumPropertyItem pivot_items[] = {
{V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", ""},