Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/screen/screen_ops.c')
-rw-r--r--source/blender/editors/screen/screen_ops.c63
1 files changed, 21 insertions, 42 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index c24d08d5fed..0b893d23e13 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -153,7 +153,6 @@ int ED_operator_scene_editable(bContext *C)
int ED_operator_objectmode(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
@@ -163,7 +162,7 @@ int ED_operator_objectmode(bContext *C)
return 0;
/* add a check for ob->mode too? */
- if (obact && (workspace->object_mode != OB_MODE_OBJECT))
+ if (obact && (obact->mode != OB_MODE_OBJECT))
return 0;
return 1;
@@ -305,39 +304,35 @@ int ED_operator_console_active(bContext *C)
return ed_spacetype_test(C, SPACE_CONSOLE);
}
-static int ed_object_hidden(Object *ob, eObjectMode object_mode)
+static int ed_object_hidden(Object *ob)
{
/* if hidden but in edit mode, we still display, can happen with animation */
- return ((ob->restrictflag & OB_RESTRICT_VIEW) && !(object_mode & OB_MODE_EDIT));
+ return ((ob->restrictflag & OB_RESTRICT_VIEW) && !(ob->mode & OB_MODE_EDIT));
}
int ED_operator_object_active(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_active_context(C);
- return ((ob != NULL) && !ed_object_hidden(ob, workspace->object_mode));
+ return ((ob != NULL) && !ed_object_hidden(ob));
}
int ED_operator_object_active_editable(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_active_context(C);
- return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob, workspace->object_mode));
+ return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob));
}
int ED_operator_object_active_editable_mesh(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_active_context(C);
- return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob, workspace->object_mode) &&
+ return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob) &&
(ob->type == OB_MESH) && !ID_IS_LINKED(ob->data));
}
int ED_operator_object_active_editable_font(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_active_context(C);
- return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob, workspace->object_mode) &&
+ return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob) &&
(ob->type == OB_FONT));
}
@@ -382,14 +377,11 @@ int ED_operator_posemode_exclusive(bContext *C)
{
Object *obact = CTX_data_active_object(C);
- if (obact) {
- const WorkSpace *workspace = CTX_wm_workspace(C);
- if ((workspace->object_mode & OB_MODE_EDIT) == 0) {
- Object *obpose;
- if ((obpose = BKE_object_pose_armature_get(obact))) {
- if (obact == obpose) {
- return 1;
- }
+ if (obact && !(obact->mode & OB_MODE_EDIT)) {
+ Object *obpose;
+ if ((obpose = BKE_object_pose_armature_get(obact))) {
+ if (obact == obpose) {
+ return 1;
}
}
}
@@ -403,15 +395,9 @@ int ED_operator_posemode_context(bContext *C)
{
Object *obpose = ED_pose_object_from_context(C);
- if (obpose) {
- const WorkSpace *workspace = CTX_wm_workspace(C);
- /* TODO, should we allow this out of pose mode? */
- if (workspace->object_mode & OB_MODE_POSE) {
- // if ((workspace->object_mode & OB_MODE_EDIT) == 0) {
- if (BKE_object_pose_context_check(obpose)) {
- return 1;
- }
- // }
+ if (obpose && !(obpose->mode & OB_MODE_EDIT)) {
+ if (BKE_object_pose_context_check(obpose)) {
+ return 1;
}
}
@@ -422,17 +408,11 @@ int ED_operator_posemode(bContext *C)
{
Object *obact = CTX_data_active_object(C);
-
- if (obact) {
- const WorkSpace *workspace = CTX_wm_workspace(C);
- if ((workspace->object_mode & OB_MODE_EDIT) == 0) {
- Object *obpose;
- if ((obpose = BKE_object_pose_armature_get(obact))) {
- if (((workspace->object_mode & OB_MODE_POSE) && (obact == obpose)) ||
- (workspace->object_mode & OB_MODE_WEIGHT_PAINT))
- {
- return 1;
- }
+ if (obact && !(obact->mode & OB_MODE_EDIT)) {
+ Object *obpose;
+ if ((obpose = BKE_object_pose_armature_get(obact))) {
+ if ((obact == obpose) || (obact->mode & OB_MODE_WEIGHT_PAINT)) {
+ return 1;
}
}
}
@@ -568,10 +548,9 @@ int ED_operator_mask(bContext *C)
}
case SPACE_IMAGE:
{
- WorkSpace *workspace = CTX_wm_workspace(C);
SpaceImage *sima = sa->spacedata.first;
ViewLayer *view_layer = CTX_data_view_layer(C);
- return ED_space_image_check_show_maskedit(sima, workspace, view_layer);
+ return ED_space_image_check_show_maskedit(sima, view_layer);
}
}
}