Merge branch 'blender-v4.3-release'

This commit is contained in:
Falk David
2024-11-04 17:04:09 +01:00
9 changed files with 54 additions and 16 deletions

View File

@@ -5724,7 +5724,6 @@ class VIEW3D_MT_edit_greasepencil_stroke(Menu):
layout.operator("grease_pencil.stroke_subdivide", text="Subdivide")
layout.operator("grease_pencil.stroke_subdivide_smooth", text="Subdivide and Smooth")
layout.operator("grease_pencil.stroke_simplify", text="Simplify")
layout.operator("grease_pencil.stroke_trim", text="Trim")
layout.separator()

View File

@@ -770,7 +770,14 @@ bool BKE_modifiers_uses_armature(Object *ob, bArmature *arm)
for (; md; md = md->next) {
if (md->type == eModifierType_Armature) {
ArmatureModifierData *amd = (ArmatureModifierData *)md;
ArmatureModifierData *amd = reinterpret_cast<ArmatureModifierData *>(md);
if (amd->object && amd->object->data == arm) {
return true;
}
}
else if (md->type == eModifierType_GreasePencilArmature) {
GreasePencilArmatureModifierData *amd = reinterpret_cast<GreasePencilArmatureModifierData *>(
md);
if (amd->object && amd->object->data == arm) {
return true;
}

View File

@@ -3589,7 +3589,7 @@ static void acf_gpd_color(bAnimContext * /*ac*/, bAnimListElem * /*ale*/, float
/* TODO: just get this from RNA? */
static int acf_gpd_icon(bAnimListElem * /*ale*/)
{
return ICON_OUTLINER_OB_GREASEPENCIL;
return ICON_OUTLINER_DATA_GREASEPENCIL;
}
/* check if some setting exists for this channel */

View File

@@ -2202,29 +2202,38 @@ static size_t animdata_filter_grease_pencil_data(bAnimContext *ac,
size_t items = 0;
/* The Grease Pencil mode is not supposed to show channels for regular F-Curves from regular
* Actions. At some point this might be desirable, but it would also require changing the
* filtering flags for pretty much all operators running there. */
const bool show_animdata = grease_pencil->adt && (ac->datatype != ANIMCONT_GPENCIL);
/* When asked from "AnimData" blocks (i.e. the top-level containers for normal animation),
* for convenience, this will return grease pencil data-blocks instead.
* This may cause issues down the track, but for now, this will do.
*/
if (filter_mode & ANIMFILTER_ANIMDATA) {
/* Just add data block container. */
if (grease_pencil->adt != nullptr) {
ANIMCHANNEL_NEW_CHANNEL(
ac->bmain, grease_pencil, ANIMTYPE_GREASE_PENCIL_DATABLOCK, grease_pencil, nullptr);
if (show_animdata) {
items += animfilter_block_data(ac, anim_data, (ID *)grease_pencil, filter_mode);
}
ANIMCHANNEL_NEW_CHANNEL(
ac->bmain, grease_pencil, ANIMTYPE_GREASE_PENCIL_DATABLOCK, grease_pencil, nullptr);
}
else {
ListBase tmp_data = {nullptr, nullptr};
size_t tmp_items = 0;
if (!(filter_mode & ANIMFILTER_FCURVESONLY)) {
/* Add grease pencil layer channels. */
BEGIN_ANIMFILTER_SUBCHANNELS (grease_pencil->flag &GREASE_PENCIL_ANIM_CHANNEL_EXPANDED) {
/* Add grease pencil layer channels. */
BEGIN_ANIMFILTER_SUBCHANNELS (grease_pencil->flag &GREASE_PENCIL_ANIM_CHANNEL_EXPANDED) {
if (show_animdata) {
tmp_items += animfilter_block_data(ac, &tmp_data, (ID *)grease_pencil, filter_mode);
}
if (!(filter_mode & ANIMFILTER_FCURVESONLY)) {
tmp_items += animdata_filter_grease_pencil_layers_data(
ac, &tmp_data, grease_pencil, filter_mode);
}
END_ANIMFILTER_SUBCHANNELS;
}
END_ANIMFILTER_SUBCHANNELS;
if (tmp_items == 0) {
/* If no sub-channels, return early. */

View File

@@ -30,6 +30,7 @@
#include "UI_resources.hh"
#include "UI_view2d.hh"
#include "ED_anim_api.hh"
#include "ED_keyframes_draw.hh"
#include "ED_keyframes_keylist.hh"
@@ -479,6 +480,9 @@ static void build_channel_keylist(ChannelListElement *elem, blender::float2 rang
break;
}
case ChannelType::GREASE_PENCIL_DATA: {
if (elem->ac->datatype != ANIMCONT_GPENCIL && elem->adt) {
action_to_keylist(elem->adt, elem->adt->action, elem->keylist, elem->saction_flag, range);
}
grease_pencil_data_block_to_keylist(
elem->adt, elem->grease_pencil, elem->keylist, elem->saction_flag, false);
break;
@@ -787,7 +791,8 @@ void ED_add_action_channel(ChannelDrawList *channel_list,
}
void ED_add_grease_pencil_datablock_channel(ChannelDrawList *channel_list,
bDopeSheet * /*ads*/,
bAnimContext *ac,
AnimData *adt,
const GreasePencil *grease_pencil,
const float ypos,
const float yscale_fac,
@@ -798,7 +803,12 @@ void ED_add_grease_pencil_datablock_channel(ChannelDrawList *channel_list,
ypos,
yscale_fac,
eSAction_Flag(saction_flag));
/* GreasePencil properties can be animated via an Action, so the GP-related
* animation data is not limited to GP drawings. */
draw_elem->adt = adt;
draw_elem->act = adt ? adt->action : nullptr;
draw_elem->grease_pencil = grease_pencil;
draw_elem->ac = ac;
}
void ED_add_grease_pencil_cels_channel(ChannelDrawList *channel_list,

View File

@@ -262,6 +262,12 @@ void ED_armature_bone_rename(Main *bmain,
bDeformGroup *dg = BKE_object_defgroup_find_name(ob, oldname);
if (dg) {
STRNCPY(dg->name, newname);
if (ob->type == OB_GREASE_PENCIL) {
/* Update vgroup names stored in CurvesGeometry */
BKE_grease_pencil_vgroup_name_update(ob, oldname, dg->name);
}
DEG_id_tag_update(static_cast<ID *>(ob->data), ID_RECALC_GEOMETRY);
}
}

View File

@@ -130,7 +130,8 @@ void ED_add_grease_pencil_layer_group_channel(ChannelDrawList *draw_list,
/* Grease Pencil data channels */
void ED_add_grease_pencil_datablock_channel(ChannelDrawList *draw_list,
bDopeSheet *ads,
bAnimContext *ac,
AnimData *adt,
const GreasePencil *grease_pencil,
const float ypos,
const float yscale_fac,

View File

@@ -432,7 +432,8 @@ static void draw_keyframes(bAnimContext *ac,
break;
case ALE_GREASE_PENCIL_DATA:
ED_add_grease_pencil_datablock_channel(draw_list,
ads,
ac,
ale->adt,
static_cast<const GreasePencil *>(ale->data),
ycenter,
scale_factor,

View File

@@ -75,8 +75,13 @@ static void transform_snap_anim_flush_data_ex(
BLI_assert(t->tsnap.flag);
float ival = td->iloc[0];
AnimData *adt = static_cast<AnimData *>(!ELEM(t->spacetype, SPACE_NLA, SPACE_SEQ) ? td->extra :
nullptr);
AnimData *adt = nullptr;
if (!ELEM(t->spacetype, SPACE_NLA, SPACE_SEQ) && !(td->flag & TD_GREASE_PENCIL_FRAME)) {
/* TD_GREASE_PENCIL_FRAME stores blender::bke::greasepencil::Layer* in
* td->extra, and not the AnimData. */
adt = static_cast<AnimData *>(td->extra);
}
/* Convert frame to nla-action time (if needed). */
if (adt) {