Fix #118637: crash after editbone duplication in certain case #118676
|
@ -87,7 +87,7 @@ FCurve *action_fcurve_ensure(Main *bmain,
|
|||
agrp = action_groups_add_new(act, group);
|
||||
|
||||
/* Sync bone group colors if applicable. */
|
||||
if (ptr && (ptr->type == &RNA_PoseBone)) {
|
||||
if (ptr && (ptr->type == &RNA_PoseBone) && ptr->data) {
|
||||
const bPoseChannel *pchan = static_cast<const bPoseChannel *>(ptr->data);
|
||||
action_group_colors_set_from_posebone(agrp, pchan);
|
||||
}
|
||||
|
|
|
@ -136,6 +136,8 @@ void action_group_colors_set(struct bActionGroup *grp, const struct BoneColor *c
|
|||
*
|
||||
* If `pchan->color` is set to a non-default color, that is used. Otherwise the
|
||||
* armature bone color is used.
|
||||
*
|
||||
* Note that if `pchan->bone` is `nullptr`, this function silently does nothing.
|
||||
*/
|
||||
void action_group_colors_set_from_posebone(bActionGroup *grp, const bPoseChannel *pchan);
|
||||
|
||||
|
|
|
@ -374,6 +374,12 @@ void action_group_colors_sync(bActionGroup *grp, const bActionGroup *ref_grp)
|
|||
|
||||
void action_group_colors_set_from_posebone(bActionGroup *grp, const bPoseChannel *pchan)
|
||||
{
|
||||
BLI_assert_msg(pchan, "cannot 'set action group colors from posebone' without a posebone");
|
||||
if (!pchan->bone) {
|
||||
/* pchan->bone is only set after leaving editmode. */
|
||||
return;
|
||||
}
|
||||
|
||||
const BoneColor &color = blender::animrig::ANIM_bonecolor_posebone_get(pchan);
|
||||
action_group_colors_set(grp, &color);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue