Merge branch 'blender-v4.4-release'
This commit is contained in:
@@ -260,6 +260,9 @@ static void trace_start_job(void *customdata, wmJobWorkerStatus *worker_status)
|
||||
BKE_image_release_ibuf(trace_job.image, ibuf, lock);
|
||||
*(trace_job.progress) = 1.0f;
|
||||
}
|
||||
/* If source type is not sequence, override `trace_job.mode` to single because we need the
|
||||
* correct mode for finalization. */
|
||||
trace_job.mode = TraceMode::Single;
|
||||
}
|
||||
/* Image sequence. */
|
||||
else if (trace_job.image->type == IMA_TYPE_IMAGE) {
|
||||
|
||||
@@ -62,6 +62,7 @@ GreasePencil *merge_layers(const GreasePencil &src_grease_pencil,
|
||||
const int first_src_layer_i = src_layer_indices[0];
|
||||
const Layer &first_src_layer = src_grease_pencil.layer(first_src_layer_i);
|
||||
layer.set_name(first_src_layer.name());
|
||||
layer.opacity = first_src_layer.opacity;
|
||||
Drawing *drawing = new_grease_pencil->get_eval_drawing(layer);
|
||||
BLI_assert(drawing != nullptr);
|
||||
curves_by_new_layer[new_layer_i] = &drawing->strokes_for_write();
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "ED_armature.hh"
|
||||
#include "ED_object_vgroup.hh"
|
||||
|
||||
#include "ANIM_action.hh"
|
||||
#include "ANIM_animdata.hh"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -61,19 +62,6 @@ inline float max_mag_component(const pxr::GfVec3d &vec)
|
||||
return pxr::GfMax(pxr::GfAbs(vec[0]), pxr::GfAbs(vec[1]), pxr::GfAbs(vec[2]));
|
||||
}
|
||||
|
||||
/* Utility: create curve at the given array index. */
|
||||
FCurve *create_fcurve(const int array_index, const std::string &rna_path, const int totvert)
|
||||
{
|
||||
FCurve *fcu = BKE_fcurve_create();
|
||||
fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED);
|
||||
fcu->rna_path = BLI_strdup(rna_path.c_str());
|
||||
fcu->array_index = array_index;
|
||||
fcu->bezt = MEM_cnew_array<BezTriple>(totvert, "beztriple");
|
||||
fcu->totvert = totvert;
|
||||
|
||||
return fcu;
|
||||
}
|
||||
|
||||
void resize_fcurve(FCurve *fcu, uint bezt_count)
|
||||
{
|
||||
/* There is no need to resize if the counts match. */
|
||||
@@ -93,17 +81,15 @@ void resize_fcurve(FCurve *fcu, uint bezt_count)
|
||||
fcu->totvert = bezt_count;
|
||||
}
|
||||
|
||||
/* Utility: create curve at the given array index and
|
||||
* add it as a channel to a group. */
|
||||
FCurve *create_chan_fcurve(bAction *act,
|
||||
bActionGroup *grp,
|
||||
const int array_index,
|
||||
const std::string &rna_path,
|
||||
const int totvert)
|
||||
/* Utility: create curve at the given array index and add it as a channel to a group. */
|
||||
FCurve *create_fcurve(blender::animrig::Channelbag &channelbag,
|
||||
const blender::animrig::FCurveDescriptor &fcurve_descriptor,
|
||||
const int totvert)
|
||||
{
|
||||
FCurve *fcu = create_fcurve(array_index, rna_path, totvert);
|
||||
action_groups_add_channel(act, grp, fcu);
|
||||
return fcu;
|
||||
FCurve *fcurve = channelbag.fcurve_create_unique(nullptr, fcurve_descriptor);
|
||||
BLI_assert_msg(fcurve, "The same F-Curve is being created twice, this is unexpected.");
|
||||
BKE_fcurve_bezt_resize(fcurve, totvert);
|
||||
return fcurve;
|
||||
}
|
||||
|
||||
/* Utility: add curve sample. */
|
||||
@@ -167,6 +153,9 @@ void import_skeleton_curves(Main *bmain,
|
||||
bAction *act = blender::animrig::id_action_ensure(bmain, &arm_obj->id);
|
||||
BKE_id_rename(*bmain, act->id, anim_query.GetPrim().GetName().GetText());
|
||||
|
||||
blender::animrig::Channelbag &channelbag = blender::animrig::action_channelbag_ensure(
|
||||
*act, arm_obj->id);
|
||||
|
||||
/* Create the curves. */
|
||||
|
||||
/* Get the joint paths. */
|
||||
@@ -191,26 +180,24 @@ void import_skeleton_curves(Main *bmain,
|
||||
continue;
|
||||
}
|
||||
|
||||
bActionGroup *grp = action_groups_add_new(act, name->c_str());
|
||||
|
||||
/* Add translation curves. */
|
||||
std::string rna_path = "pose.bones[\"" + *name + "\"].location";
|
||||
loc_curves.append(create_chan_fcurve(act, grp, 0, rna_path, num_samples));
|
||||
loc_curves.append(create_chan_fcurve(act, grp, 1, rna_path, num_samples));
|
||||
loc_curves.append(create_chan_fcurve(act, grp, 2, rna_path, num_samples));
|
||||
loc_curves.append(create_fcurve(channelbag, {rna_path, 0, {}, *name}, num_samples));
|
||||
loc_curves.append(create_fcurve(channelbag, {rna_path, 1, {}, *name}, num_samples));
|
||||
loc_curves.append(create_fcurve(channelbag, {rna_path, 2, {}, *name}, num_samples));
|
||||
|
||||
/* Add rotation curves. */
|
||||
rna_path = "pose.bones[\"" + *name + "\"].rotation_quaternion";
|
||||
rot_curves.append(create_chan_fcurve(act, grp, 0, rna_path, num_samples));
|
||||
rot_curves.append(create_chan_fcurve(act, grp, 1, rna_path, num_samples));
|
||||
rot_curves.append(create_chan_fcurve(act, grp, 2, rna_path, num_samples));
|
||||
rot_curves.append(create_chan_fcurve(act, grp, 3, rna_path, num_samples));
|
||||
rot_curves.append(create_fcurve(channelbag, {rna_path, 0, {}, *name}, num_samples));
|
||||
rot_curves.append(create_fcurve(channelbag, {rna_path, 1, {}, *name}, num_samples));
|
||||
rot_curves.append(create_fcurve(channelbag, {rna_path, 2, {}, *name}, num_samples));
|
||||
rot_curves.append(create_fcurve(channelbag, {rna_path, 3, {}, *name}, num_samples));
|
||||
|
||||
/* Add scale curves. */
|
||||
rna_path = "pose.bones[\"" + *name + "\"].scale";
|
||||
scale_curves.append(create_chan_fcurve(act, grp, 0, rna_path, num_samples));
|
||||
scale_curves.append(create_chan_fcurve(act, grp, 1, rna_path, num_samples));
|
||||
scale_curves.append(create_chan_fcurve(act, grp, 2, rna_path, num_samples));
|
||||
scale_curves.append(create_fcurve(channelbag, {rna_path, 0, {}, *name}, num_samples));
|
||||
scale_curves.append(create_fcurve(channelbag, {rna_path, 1, {}, *name}, num_samples));
|
||||
scale_curves.append(create_fcurve(channelbag, {rna_path, 2, {}, *name}, num_samples));
|
||||
}
|
||||
|
||||
/* Sanity checks: make sure we have a curve entry for each joint. */
|
||||
@@ -648,6 +635,9 @@ void import_blendshapes(Main *bmain,
|
||||
|
||||
/* Create the animation and curves. */
|
||||
bAction *act = blender::animrig::id_action_ensure(bmain, &key->id);
|
||||
blender::animrig::Channelbag &channelbag = blender::animrig::action_channelbag_ensure(*act,
|
||||
key->id);
|
||||
|
||||
blender::Vector<FCurve *> curves;
|
||||
curves.reserve(blendshapes.size());
|
||||
|
||||
@@ -661,9 +651,8 @@ void import_blendshapes(Main *bmain,
|
||||
|
||||
/* Create the curve for this shape key. */
|
||||
std::string rna_path = "key_blocks[\"" + blendshape_name.GetString() + "\"].value";
|
||||
FCurve *fcu = create_fcurve(0, rna_path, times.size());
|
||||
FCurve *fcu = create_fcurve(channelbag, {rna_path, 0}, times.size());
|
||||
curves.append(fcu);
|
||||
BLI_addtail(&act->curves, fcu);
|
||||
}
|
||||
|
||||
/* Add the weight time samples to the curves. */
|
||||
|
||||
@@ -165,7 +165,7 @@ static void modify_curves(ModifierData &md,
|
||||
edit_hints->deform_mats.emplace(drawing.strokes().points_num(), float3x3::identity());
|
||||
}
|
||||
deform_mats = edit_hints->deform_mats->as_mutable_span();
|
||||
if (has_bezier_curves) {
|
||||
if (edit_hints->positions()) {
|
||||
deform_positions = edit_hints->positions_for_write();
|
||||
}
|
||||
}
|
||||
@@ -180,24 +180,39 @@ static void modify_curves(ModifierData &md,
|
||||
deform_mats_for_curve = deform_mats->slice(points);
|
||||
}
|
||||
|
||||
BKE_armature_deform_coords_with_curves(*amd.object,
|
||||
*ctx.object,
|
||||
&curves.vertex_group_names,
|
||||
positions.slice(points),
|
||||
old_positions_for_curve,
|
||||
deform_mats_for_curve,
|
||||
dverts.slice(points),
|
||||
deformflag,
|
||||
amd.influence.vertex_group_name);
|
||||
if (deform_positions) {
|
||||
const IndexRange orig_points = orig_points_by_curve[curve_i];
|
||||
if (has_bezier_curves) {
|
||||
const IndexRange orig_points = orig_points_by_curve[curve_i];
|
||||
BKE_armature_deform_coords_with_curves(*amd.object,
|
||||
*ctx.object,
|
||||
&curves.vertex_group_names,
|
||||
deform_positions->slice(orig_points),
|
||||
{},
|
||||
{},
|
||||
orig_dverts.as_span().slice(orig_points),
|
||||
deformflag,
|
||||
amd.influence.vertex_group_name);
|
||||
}
|
||||
else {
|
||||
BKE_armature_deform_coords_with_curves(*amd.object,
|
||||
*ctx.object,
|
||||
&curves.vertex_group_names,
|
||||
deform_positions->slice(points),
|
||||
old_positions_for_curve,
|
||||
deform_mats_for_curve,
|
||||
dverts.slice(points),
|
||||
deformflag,
|
||||
amd.influence.vertex_group_name);
|
||||
}
|
||||
}
|
||||
else {
|
||||
BKE_armature_deform_coords_with_curves(*amd.object,
|
||||
*ctx.object,
|
||||
&curves.vertex_group_names,
|
||||
deform_positions->slice(orig_points),
|
||||
{},
|
||||
{},
|
||||
orig_dverts.as_span().slice(orig_points),
|
||||
positions.slice(points),
|
||||
old_positions_for_curve,
|
||||
deform_mats_for_curve,
|
||||
dverts.slice(points),
|
||||
deformflag,
|
||||
amd.influence.vertex_group_name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user