[Bf-blender-cvs] [7c80dddb8c6] temp-nla-strip-alignment: - typo fix: rna_nla: remove parm - blend xform allocation separated from adding to list to make duplication simpler
Wayde Moss
noreply at git.blender.org
Thu Dec 10 06:13:38 CET 2020
Commit: 7c80dddb8c63e98a0ab9c84fd502e78713b22d8a
Author: Wayde Moss
Date: Sun Nov 29 15:11:36 2020 -0500
Branches: temp-nla-strip-alignment
https://developer.blender.org/rB7c80dddb8c63e98a0ab9c84fd502e78713b22d8a
- typo fix: rna_nla: remove parm
- blend xform allocation separated from adding to list to make duplication simpler
===================================================================
M release/scripts/startup/bl_ui/properties_nla.py
M source/blender/blenkernel/BKE_nla.h
M source/blender/blenkernel/intern/anim_sys.c
M source/blender/blenkernel/intern/nla.c
M source/blender/makesrna/intern/rna_nla.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_nla.py b/release/scripts/startup/bl_ui/properties_nla.py
index e7f15270173..b1e78f8613e 100644
--- a/release/scripts/startup/bl_ui/properties_nla.py
+++ b/release/scripts/startup/bl_ui/properties_nla.py
@@ -100,7 +100,7 @@ class OBJECT_OT_nla_blend_remove_bone(bpy.types.Operator):
def execute(self, context):
active_strip = get_active_strip(context)
blend = active_strip.blend_transforms[self.blend_index]
- blend.bones.remove_at(self.bone_index)
+ blend.bones.remove_at(bone_index=self.bone_index)
return {'FINISHED'}
@@ -108,7 +108,7 @@ class OBJECT_PT_nla_alignment(Panel):
bl_space_type = 'NLA_EDITOR'
bl_region_type = 'UI'
bl_label = "Alignment"
- bl_category = "Alignment"
+ bl_category = "Strip"
bl_context = "object"
@@ -121,6 +121,8 @@ class OBJECT_PT_nla_alignment(Panel):
active_strip = get_active_strip(context)
+ layout.prop(active_strip,"name")
+ layout.prop(active_strip,"action")
layout.prop(active_strip,"blend_transforms")
# layout.prop(active_strip,"frame_start")
@@ -149,8 +151,8 @@ class OBJECT_PT_nla_alignment(Panel):
for j,bone in enumerate(blend.bones):
row = col.row(align=True)
# print([b for b in context.active_object.data.bones])
- # row.prop_search(bone,"name",context.active_object.data,"bones",text='')
- row.prop(bone,"name")
+ row.prop_search(bone,"name",context.active_object.data,"bones",text='')
+ #row.prop(bone,"name")
op = row.operator(OBJECT_OT_nla_blend_remove_bone.bl_idname,text='',icon='REMOVE')
op.blend_index = i
op.bone_index = j
diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h
index ba3e3d73701..67ffa37d753 100644
--- a/source/blender/blenkernel/BKE_nla.h
+++ b/source/blender/blenkernel/BKE_nla.h
@@ -68,11 +68,12 @@ struct NlaStrip *BKE_nlastrip_new(struct bAction *act);
struct NlaStrip *BKE_nlastack_add_strip(struct AnimData *adt,
struct bAction *act,
const bool is_liboverride);
-struct NlaBlendTransform *BKE_nlastrip_new_blend_transform(struct NlaStrip *strip);
+
+struct NlaBlendTransform *BKE_nlastrip_new_blend_transform();
void BKE_nlastrip_free_blend_transform(struct NlaStrip *strip, struct NlaBlendTransform *blend);
void BKE_nlastrip_free_blend_transform_at(struct NlaStrip *strip, int blend_index);
-struct NlaBlendTransform_BoneTarget *BKE_blend_transform_new_bone(struct NlaBlendTransform *blend);
+struct NlaBlendTransform_BoneTarget *BKE_blend_transform_new_bone();
void BKE_blend_transform_free_bone(struct NlaBlendTransform *blend,
struct NlaBlendTransform_BoneTarget *bone_name);
void BKE_blend_transform_free_bone_at(struct NlaBlendTransform *blend, int bone_name_index);
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index b2eb9dce398..51b6d0b7c57 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -2956,12 +2956,18 @@ static void nlastrip_evaluate_meta_raw_value(PointerRNA *ptr,
/*
* lower is also output
*/
-static void nlaeval_snapshot_blend(NlaEvalData *nlaeval,
+static void nlaeval_snapshot_blend(PointerRNA *ptr,
+ NlaEvalData *nlaeval,
NlaEvalSnapshot *raw_upper,
short upper_blendmode,
float upper_influence,
NlaEvalSnapshot *lower)
{
+ /**
+ * todo: keyframe remapping support for blend
+ * todo: move python UI for belnd xforms to C (nla_buttons.c)
+ * -since python side is broken for some reason?
+ */
nlaeval_snapshot_ensure_size(lower, nlaeval->num_channels);
for (int i = 0; i < nlaeval->num_channels; i++) {
@@ -3033,6 +3039,13 @@ static void nlaeval_snapshot_blend(NlaEvalData *nlaeval,
continue;
}
}
+
+ NlaEvalChannel *scale_channel = nlaevalchan_verify(
+ ptr, nlaeval, "pose.bones[\"Hips\"].scale");
+ if (nec == scale_channel) {
+ nec->is_array = scale_channel->is_array;
+ }
+
for (int j = 0; j < c_lower->length; j++) {
c_lower->values[j] = nla_blend_value(
upper_blendmode, c_lower->values[j], c_upper->values[j], upper_influence);
@@ -3157,10 +3170,45 @@ void nlastrip_evaluate(PointerRNA *ptr,
float decomposed_quat[4];
switch (pose_channel->rotmode) {
case ROT_MODE_QUAT:
+ // todo:... large error for some reason here? Maybe its a separate IK issue?
+ // (seems fine with FK blends, but when I use the same animation with IK i get scealing
+ // issues.)
+ //...but I doi think there may be a memory leak caused by this patch?
+
+ //..l.but when I use a non-NLA anim eval (full replace Action track) then everything
+ // works fine...
+ //..whats going on??? (nvm other strips ahd scale channels)
+ // --but seems to occur when strip with preblend xform doens't have the scale
+ // channels? After adding scale channels then it works fine? What if
+ // nlaeevalchan_verify() keeps the path str key and assumes it survived (this isn't it
+ // since not freeing memory doesnt solve it)
+ // -can't be verify() func since problem still exists if other strips have scale
+ // channels, thus it already exists. maybe its a depsgraph issue? There is no
+ // deps created for the blended scale channels despite it making changes-seems
+ // unliekly?-still, blend xforms should still work if strip itself doesn't have
+ // the channels. Notably, even if blend xform has scvale=2, then hips won't show
+ // up in properties as having 2.0 scale, which is weird..,and why is this not a
+ // problem for FK? (maybe the bake creates scale channels?)
+ //
+ // scale with be non-one afterward even if scale is one every where else...
+ // maybe it would be better to manually do scaling since its only affected by blend
+ // xform's scale? but would error lead to issues with rotation and location?
loc_quat_size_to_mat4(
raw_snapshot_matrix, location_values, rotation_values, scale_values);
mul_m4_m4m4(raw_snapshot_matrix, bone_blend_matrix, raw_snapshot_matrix);
- mat4_decompose(location_values, rotation_values, scale_values, raw_snapshot_matrix);
+
+ copy_v3_v3(location_values, raw_snapshot_matrix[3]);
+ mat4_to_quat(rotation_values, raw_snapshot_matrix);
+ //***********
+ //***IF SCALE NOT PART OF NLA DOMAIN, then it leads to serious scale errors?
+ // And the solution is literally to add scale channels in the dopesheet, then its 100%
+ // fine?
+ //...but why is this even a problem??!?!?
+ //...wait...if scale is not part of domain.. then why did it ever work in the viewport?
+ // at what point was it being written back to the bone????
+ mat4_to_size(scale_values, raw_snapshot_matrix); //...why is this 1.0 as expected.. but
+ // blender shows .8 for scale??(hips)
+ // mat4_decompose(location_values, rotation_values, scale_values, raw_snapshot_matrix);
break;
case ROT_MODE_AXISANGLE:
@@ -3189,7 +3237,7 @@ void nlastrip_evaluate(PointerRNA *ptr,
}
/** Blend raw snapshot with lower snapshot. */
- nlaeval_snapshot_blend(channels, &snapshot_raw, blendmode, influence, snapshot);
+ nlaeval_snapshot_blend(ptr, channels, &snapshot_raw, blendmode, influence, snapshot);
nlaeval_snapshot_free_data(&snapshot_raw);
}
@@ -3368,6 +3416,12 @@ static void nla_eval_domain_action(PointerRNA *ptr,
NlaEvalChannel *nec = nlaevalchan_verify(ptr, channels, fcu->rna_path);
+ NlaEvalChannel *scale_channel = nlaevalchan_verify(
+ ptr, channels, "pose.bones[\"Hips\"].scale");
+ if (nec == scale_channel) {
+ nec->is_array = scale_channel->is_array;
+ }
+
if (nec != NULL) {
/* For quaternion properties, enable all sub-channels. */
if (nec->mix_mode == NEC_MIX_QUATERNION) {
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 0da23940958..c03c0269c35 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -215,8 +215,8 @@ NlaStrip *BKE_nlastrip_copy(Main *bmain,
BLI_listbase_clear(&strip_d->blend_transforms);
LISTBASE_FOREACH (NlaBlendTransform *, blend_xform, &strip->blend_transforms) {
- NlaBlendTransform *blend_xform = BKE_nlastrip_blend_transform_copy(&strip_d);
- BLI_addtail(&strip_d.blend_transforms, blend_xform);
+ NlaBlendTransform *duplicate_blend_xform = BKE_nlastrip_blend_transform_copy(blend_xform);
+ BLI_addtail(&strip_d->blend_transforms, duplicate_blend_xform);
}
/* return the strip */
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index 3502a6e5df6..1478e43116d 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -662,7 +662,7 @@ static void rna_NlaStrip_blend_remove_at(NlaStrip *strip, ReportList *reports, i
static NlaBlendTransform_BoneTarget *rna_blend_bone_name_new(NlaBlendTransform *blend,
ReportList *reports)
{
- NlaBlendTransform_BoneTarget *bone_target = BKE_blend_transform_new_bone(blend);
+ NlaBlendTransform_BoneTarget *bone_target = BKE_blend_transform_new_bone();
BLI_addtail(&blend->bones, bone_target);
return bone_target;
}
@@ -1154,7 +1154,7 @@ static void rna_def_blen
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list