diff options
author | Wayde Moss <wbmoss_dev@yahoo.com> | 2020-11-26 16:15:59 +0300 |
---|---|---|
committer | Wayde Moss <wbmoss_dev@yahoo.com> | 2020-12-10 07:16:58 +0300 |
commit | 28fefc3205c3040df66903946355a860710fd904 (patch) | |
tree | 781a3ed2bf7ca29f13c3bb88adf1e56f562f33e6 | |
parent | a87a4de7b1d504ad6d501f014672f8dded878640 (diff) |
- actionclip raw eval temporarily always creates new channels until I update function call
-rw-r--r-- | release/scripts/startup/bl_ui/properties_nla.py | 15 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 24 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_buttons.c | 14 | ||||
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nla.c | 16 |
5 files changed, 57 insertions, 14 deletions
diff --git a/release/scripts/startup/bl_ui/properties_nla.py b/release/scripts/startup/bl_ui/properties_nla.py index 3fa55ef6f7e..4276cf7f17b 100644 --- a/release/scripts/startup/bl_ui/properties_nla.py +++ b/release/scripts/startup/bl_ui/properties_nla.py @@ -45,8 +45,11 @@ class OBJECT_OT_nla_add_preblend(bpy.types.Operator): def execute(self, context): active_strip = get_active_strip(context) print(dict(active_strip.preblend_transforms)) - active_strip.preblend_transforms.add() + k = active_strip.preblend_transforms.add() + # print(k.path_from_id("location")) + # print(active_strip.path_resolve("preblend_transforms")) + # print(k.id_data) return {'FINISHED'} class OBJECT_OT_nla_remove_preblend(bpy.types.Operator): bl_idname = "object.nla_remove_preblend" @@ -106,6 +109,7 @@ class OBJECT_PT_nla_alignment(Panel): bl_region_type = 'UI' bl_label = "Alignment" bl_category = "Alignment" + bl_context = "object" def draw(self, context): @@ -117,6 +121,15 @@ class OBJECT_PT_nla_alignment(Panel): active_strip = get_active_strip(context) + layout.prop(active_strip,"preblend_transforms") + + layout.prop(active_strip,"frame_start") + layout.prop(context.active_object,"location") + layout.prop(context.active_object.pose.bones["Hips"],"location") + if(context.active_pose_bone): + c = context.active_pose_bone.constraints + if(c): + layout.prop(c[0],'type') layout.operator(OBJECT_OT_nla_add_preblend.bl_idname,text='New Transform',icon='ADD') box = layout.box() for i,preblend in enumerate(active_strip.preblend_transforms): diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index cf16544b6eb..d5da4100b48 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -2281,13 +2281,33 @@ static void nlastrip_evaluate_actionclip_raw_value(PointerRNA *ptr, float value = 0.0f; NlaEvalChannel *nec = NULL; + bool allow_alloc_channels = true; for (fcu = strip->act->curves.first; fcu; fcu = fcu->next) { if (!is_fcurve_evaluatable(fcu)) continue; /** Only fill values for existing channels in snapshot, those that caller wants inverted. */ - if (nlaevalchan_try_get(upper_eval_data, fcu->rna_path, &nec)) { + //if (nlaevalchan_try_get(upper_eval_data, fcu->rna_path, &nec)) { + if (true){ + + + /* Get an NLA evaluation channel to work with, and accumulate the evaluated value with the + * value(s) stored in this channel if it has been used already. */ + NlaEvalChannel *nec = NULL; + if (allow_alloc_channels) { + /** Guarantees NlaEvalChannel. */ + nec = nlaevalchan_verify(ptr, upper_eval_data, fcu->rna_path); + } + else { + /** Only get NlaEvalChannel if it exists. */ + nlaevalchan_try_get(upper_eval_data, fcu->rna_path, &nec); + } + + if (!nec) { + /** Skip since caller only wants to fill values for existing channels in snapshot. */ + continue; + } necs = nlaeval_snapshot_ensure_channel(snapshot, nec); if (!nlaevalchan_validate_index_ex(nec, fcu->array_index)) @@ -2995,7 +3015,7 @@ void nlastrip_evaluate(PointerRNA *ptr, ptr, channels, NULL, nes, &snapshot_raw, anim_eval_context, &blendmode, &influence); /* Apply preblend transforms to each bone's raw snapshot values. */ - Object *object = (Object *)ptr->owner_id; + Object *object = (Object *)ptr->data; bPose *pose = object->pose; /** * Assumes preblend xformed bones are root bones with no parents. ( I think that would affect diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 083fd641dc1..fe26f0ba069 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -377,6 +377,20 @@ static void nla_panel_properties(const bContext *C, Panel *panel) uiItemR(column, &strip_ptr, "frame_start", 0, IFACE_("Frame Start"), ICON_NONE); uiItemR(column, &strip_ptr, "frame_end", 0, IFACE_("End"), ICON_NONE); + + + NlaStrip *strip = ((NlaStrip *)strip_ptr.data); + + if (strip->preblend_transforms.first) { + + PointerRNA preblend_rna; + RNA_pointer_create(strip_ptr.owner_id, + &RNA_NlaStripPreBlendTransform, + strip->preblend_transforms.first, + &preblend_rna); + + uiItemR(column, &preblend_rna, "location", 0, NULL, ICON_NONE); + } /* Evaluation-Related Strip Properties ------------------ */ /* sound properties strips don't have these settings */ diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index a581edcb04b..6f140e43df5 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -429,6 +429,8 @@ extern StructRNA RNA_MulticamSequence; extern StructRNA RNA_MultiplyGpencilModifier; extern StructRNA RNA_MultiresModifier; extern StructRNA RNA_MusgraveTexture; +extern StructRNA RNA_NlaStripPreBlendTransform_BoneName; +extern StructRNA RNA_NlaStripPreBlendTransform; extern StructRNA RNA_NlaStrip; extern StructRNA RNA_NlaTrack; extern StructRNA RNA_Node; diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index 869c2ac10bf..9e7c76bda30 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -715,7 +715,6 @@ static void rna_def_strip_fcurves(BlenderRNA *brna, PropertyRNA *cprop) static void rna_def_nlastrip_blendXforms(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; - PropertyRNA *prop; FunctionRNA *func; PropertyRNA *parm; @@ -998,10 +997,10 @@ static void rna_def_nlastrip(BlenderRNA *brna) "after tweaking strip and its keyframes"); RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update"); - prop = RNA_def_property(srna, "use_alignment", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_ALIGNED); - RNA_def_property_ui_text( - prop, "Use Alignment", "Mark strip as aligned with other marked overlapping strips"); + // prop = RNA_def_property(srna, "use_alignment", PROP_BOOLEAN, PROP_NONE); + // RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_ALIGNED); + // RNA_def_property_ui_text( + // prop, "Use Alignment", "Mark strip as aligned with other marked overlapping strips"); prop = RNA_def_property(srna, "preblend_transforms", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "preblend_transforms", NULL); @@ -1173,18 +1172,14 @@ static void rna_def_nlastrip_blendXform(BlenderRNA *brna) srna = RNA_def_struct(brna, "NlaStripPreBlendTransform", NULL); RNA_def_struct_ui_text(srna, "NLA Strip Pre-Blend Transform", ""); RNA_def_struct_path_func(srna, "rna_NlaStripPreBlendTransform_path"); - RNA_def_struct_ui_icon(srna, ICON_GIZMO); /* XXX */ - /* name property */ /** Note: should not be animated */ prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION); - RNA_def_property_float_sdna(prop, NULL, "location"); RNA_def_property_ui_text(prop, "Location", ""); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update"); prop = RNA_def_property(srna, "euler", PROP_FLOAT, PROP_EULER); - RNA_def_property_float_sdna(prop, NULL, "euler"); RNA_def_property_ui_text(prop, "Rotation", ""); RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update"); @@ -1195,7 +1190,7 @@ static void rna_def_nlastrip_blendXform(BlenderRNA *brna) RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update"); prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE); - RNA_def_property_struct_type(prop, "Bone"); + RNA_def_property_struct_type(prop, "NlaStripPreBlendTransform_BoneName"); RNA_def_property_ui_text(prop, "Bones", "Bones to apply pre-blend transform to before blending"); rna_def_preblend_bones(brna, prop); } @@ -1212,7 +1207,6 @@ static void rna_def_nlastrip_blendXform_bone_name(BlenderRNA *brna) RNA_def_struct_ui_icon(srna, ICON_GIZMO); /* XXX */ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "Name", "Bone Name"); RNA_def_struct_name_property(srna, prop); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_nlastrip_blendXform_bone_name_set"); |