- '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'
This commit is contained in:
@@ -108,7 +108,7 @@ def bake(frame_start, frame_end, step=1, only_selected=False):
|
||||
|
||||
#pbone.location = matrix.translation_part()
|
||||
#pbone.rotation_quaternion = matrix.to_quat()
|
||||
pbone.matrix_local = [f for v in matrix for f in v]
|
||||
pbone.matrix_basis = matrix
|
||||
|
||||
pbone.keyframe_insert("location", -1, f, name)
|
||||
|
||||
@@ -149,7 +149,7 @@ class BakeAction(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
action = bake(self.frame_start, self.frame_end, self.step, self.show_only_selected)
|
||||
action = bake(self.frame_start, self.frame_end, self.step, self.only_selected)
|
||||
|
||||
# basic cleanup, could move elsewhere
|
||||
for fcu in action.fcurves:
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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[] = {
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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", ""},
|
||||
|
||||
Reference in New Issue
Block a user