Merge branch 'master' into blender2.8
This commit is contained in:
commit
ce3adc090d
|
@ -82,9 +82,8 @@ Object *ED_pose_object_from_context(bContext *C)
|
|||
}
|
||||
|
||||
/* This function is used to process the necessary updates for */
|
||||
bool ED_object_posemode_enter_ex(struct Main *bmain, Base *base)
|
||||
bool ED_object_posemode_enter_ex(struct Main *bmain, Object *ob)
|
||||
{
|
||||
Object *ob = base->object;
|
||||
BLI_assert(!ID_IS_LINKED(ob));
|
||||
bool ok = false;
|
||||
|
||||
|
@ -95,6 +94,7 @@ bool ED_object_posemode_enter_ex(struct Main *bmain, Base *base)
|
|||
/* Inform all CoW versions that we changed the mode. */
|
||||
DEG_id_tag_update_ex(bmain, &ob->id, DEG_TAG_COPY_ON_WRITE);
|
||||
ok = true;
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -102,34 +102,42 @@ bool ED_object_posemode_enter_ex(struct Main *bmain, Base *base)
|
|||
|
||||
return ok;
|
||||
}
|
||||
bool ED_object_posemode_enter(bContext *C, Base *base)
|
||||
bool ED_object_posemode_enter(bContext *C, Object *ob)
|
||||
{
|
||||
ReportList *reports = CTX_wm_reports(C);
|
||||
if (ID_IS_LINKED(base->object)) {
|
||||
if (ID_IS_LINKED(ob)) {
|
||||
BKE_report(reports, RPT_WARNING, "Cannot pose libdata");
|
||||
return false;
|
||||
}
|
||||
struct Main *bmain = CTX_data_main(C);
|
||||
bool ok = ED_object_posemode_enter_ex(bmain, base);
|
||||
bool ok = ED_object_posemode_enter_ex(bmain, ob);
|
||||
if (ok) {
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_POSE, NULL);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
void ED_object_posemode_exit(bContext *C, Base *base)
|
||||
bool ED_object_posemode_exit_ex(struct Main *bmain, Object *ob)
|
||||
{
|
||||
if (base) {
|
||||
Object *ob = base->object;
|
||||
|
||||
bool ok = false;
|
||||
if (ob) {
|
||||
ob->restore_mode = ob->mode;
|
||||
ob->mode &= ~OB_MODE_POSE;
|
||||
|
||||
/* Inform all CoW versions that we changed the mode. */
|
||||
DEG_id_tag_update_ex(CTX_data_main(C), &ob->id, DEG_TAG_COPY_ON_WRITE);
|
||||
|
||||
DEG_id_tag_update_ex(bmain, &ob->id, DEG_TAG_COPY_ON_WRITE);
|
||||
ok = true;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
bool ED_object_posemode_exit(bContext *C, Object *ob)
|
||||
{
|
||||
struct Main *bmain = CTX_data_main(C);
|
||||
bool ok = ED_object_posemode_exit_ex(bmain, ob);
|
||||
if (ok) {
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
/* if a selected or active bone is protected, throw error (oonly if warn == 1) and return 1 */
|
||||
|
|
|
@ -205,9 +205,10 @@ void ED_armature_ebone_listbase_free(struct ListBase *lb);
|
|||
void ED_armature_ebone_listbase_copy(struct ListBase *lb_dst, struct ListBase *lb_src);
|
||||
|
||||
/* poseobject.c */
|
||||
void ED_object_posemode_exit(struct bContext *C, struct Base *base);
|
||||
bool ED_object_posemode_enter_ex(struct Main *bmain, struct Base *base);
|
||||
bool ED_object_posemode_enter(struct bContext *C, struct Base *base);
|
||||
bool ED_object_posemode_exit_ex(struct Main *bmain, struct Object *ob);
|
||||
bool ED_object_posemode_exit(struct bContext *C, struct Object *ob);
|
||||
bool ED_object_posemode_enter_ex(struct Main *bmain, struct Object *ob);
|
||||
bool ED_object_posemode_enter(struct bContext *C, struct Object *ob);
|
||||
void ED_pose_de_selectall(struct Object *ob, int select_mode, const bool ignore_visibility);
|
||||
void ED_pose_bone_select(struct Object *ob, struct bPoseChannel *pchan, bool select);
|
||||
void ED_pose_recalculate_paths(struct bContext *C, struct Scene *scene, struct Object *ob);
|
||||
|
|
|
@ -527,10 +527,10 @@ static int posemode_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
if (is_mode_set) {
|
||||
ED_object_posemode_exit(C, base);
|
||||
ED_object_posemode_exit(C, ob);
|
||||
}
|
||||
else {
|
||||
ED_object_posemode_enter(C, base);
|
||||
ED_object_posemode_enter(C, ob);
|
||||
}
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
|
|
@ -667,13 +667,16 @@ static eOLDrawState tree_element_active_pose(
|
|||
}
|
||||
|
||||
if (set != OL_SETSEL_NONE) {
|
||||
if (OBEDIT_FROM_VIEW_LAYER(view_layer))
|
||||
if (OBEDIT_FROM_VIEW_LAYER(view_layer)) {
|
||||
ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR | EM_DO_UNDO);
|
||||
}
|
||||
|
||||
if (ob->mode & OB_MODE_POSE)
|
||||
ED_object_posemode_exit(C, base);
|
||||
else
|
||||
ED_object_posemode_enter(C, base);
|
||||
if (ob->mode & OB_MODE_POSE) {
|
||||
ED_object_posemode_exit(C, ob);
|
||||
}
|
||||
else {
|
||||
ED_object_posemode_enter(C, ob);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ob->mode & OB_MODE_POSE) {
|
||||
|
|
Loading…
Reference in New Issue