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:
authorCampbell Barton <ideasman42@gmail.com>2017-11-20 12:45:03 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-11-20 12:45:03 +0300
commita8777f905846f80385fc90135e000c3169bbefc6 (patch)
tree928a7db22a8553abd35f99a0afe2990be87d69ac /source/blender
parentc0c696b014e3c21b923a2c21fb33a18839a3faa3 (diff)
parent65af15ad887b30e678db9acab75efc7897c9197e (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_utildefines.h45
-rw-r--r--source/blender/blenkernel/CMakeLists.txt1
-rw-r--r--source/blender/blenkernel/intern/mesh_remap.c8
-rw-r--r--source/blender/blenlib/BLI_utildefines.h10
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.c12
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.h2
-rw-r--r--source/blender/editors/animation/anim_markers.c9
-rw-r--r--source/blender/editors/animation/keyframes_general.c16
-rw-r--r--source/blender/editors/armature/armature_add.c11
-rw-r--r--source/blender/editors/armature/armature_edit.c8
-rw-r--r--source/blender/editors/armature/pose_edit.c21
-rw-r--r--source/blender/editors/armature/pose_transform.c13
-rw-r--r--source/blender/editors/curve/editcurve.c11
-rw-r--r--source/blender/editors/gpencil/gpencil_data.c52
-rw-r--r--source/blender/editors/include/ED_mesh.h4
-rw-r--r--source/blender/editors/mask/mask_ops.c7
-rw-r--r--source/blender/editors/mesh/editface.c9
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c9
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c4
-rw-r--r--source/blender/editors/metaball/mball_edit.c19
-rw-r--r--source/blender/editors/object/object_lattice.c3
-rw-r--r--source/blender/editors/physics/particle_edit.c11
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c7
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c8
-rw-r--r--source/blender/editors/space_graph/graph_ops.c12
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h8
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c64
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c13
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c7
-rw-r--r--source/blender/editors/transform/transform_generics.c3
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c18
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c127
-rw-r--r--source/blender/freestyle/intern/system/StringUtils.h1
-rw-r--r--source/blender/makesrna/intern/rna_animviz.c7
-rw-r--r--source/blender/makesrna/intern/rna_wm_manipulator.c5
-rw-r--r--source/blender/render/extern/include/RE_pipeline.h2
-rw-r--r--source/blender/windowmanager/intern/wm_files.c41
37 files changed, 385 insertions, 223 deletions
diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h
deleted file mode 100644
index 7c1e0e97565..00000000000
--- a/source/blender/blenkernel/BKE_utildefines.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file BKE_utildefines.h
- * \ingroup bke
- * \brief blender format specific macros
- * \note generic defines should go in BLI_utildefines.h
- */
-
-
-#ifndef __BKE_UTILDEFINES_H__
-#define __BKE_UTILDEFINES_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BKE_BIT_TEST_SET(value, test, flag) \
-{ \
- if (test) (value) |= flag; \
- else (value) &= ~flag; \
-} (void)0
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __BKE_UTILDEFINES_H__ */
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 6063c068909..24b0adb1adb 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -304,7 +304,6 @@ set(SRC
BKE_texture.h
BKE_tracking.h
BKE_unit.h
- BKE_utildefines.h
BKE_workspace.h
BKE_world.h
BKE_writeavi.h
diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c
index b0580f75044..f321c94bf00 100644
--- a/source/blender/blenkernel/intern/mesh_remap.c
+++ b/source/blender/blenkernel/intern/mesh_remap.c
@@ -1482,6 +1482,7 @@ void BKE_mesh_remap_calc_loops_from_dm(
for (i = vert_to_refelem_map_src[nearest.index].count; i--;) {
const int index_src = vert_to_refelem_map_src[nearest.index].indices[i];
+ BLI_assert(index_src != -1);
const float dot = dot_v3v3(nors_src[index_src], *nor_dst);
pidx_src = (mode == MREMAP_MODE_LOOP_NEAREST_LOOPNOR) ?
@@ -1522,7 +1523,12 @@ void BKE_mesh_remap_calc_loops_from_dm(
}
}
}
- if (mode == MREMAP_MODE_LOOP_NEAREST_POLYNOR) {
+ if (best_index_src == -1) {
+ /* We found no item to map back from closest vertex... */
+ best_nor_dot = -1.0f;
+ hit_dist = FLT_MAX;
+ }
+ else if (mode == MREMAP_MODE_LOOP_NEAREST_POLYNOR) {
/* Our best_index_src is a poly one for now!
* Have to find its loop matching our closest vertex. */
mp_src = &polys_src[best_index_src];
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index b13d5e368ec..8f8d7cc3b7f 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -509,6 +509,16 @@ extern bool BLI_memory_is_zero(const void *arr, const size_t arr_size);
#define SET_UINT_IN_POINTER(i) ((void *)(uintptr_t)(i))
#define GET_UINT_FROM_POINTER(i) ((void)0, ((unsigned int)(uintptr_t)(i)))
+/* Set flag from a single test */
+#define SET_FLAG_FROM_TEST(value, test, flag) \
+{ \
+ if (test) { \
+ (value) |= (flag); \
+ } \
+ else { \
+ (value) &= ~(flag); \
+ } \
+} ((void)0)
/* Macro to convert a value to string in the preprocessor
* STRINGIFY_ARG: gives the argument as a string
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index bf5fc18935d..66fcd739839 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -510,6 +510,18 @@ void BM_face_calc_tangent_auto(const BMFace *f, float r_tangent[3])
}
/**
+ * expands bounds (min/max must be initialized).
+ */
+void BM_face_calc_bounds_expand(const BMFace *f, float min[3], float max[3])
+{
+ const BMLoop *l_iter, *l_first;
+ l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+ do {
+ minmax_v3v3_v3(min, max, l_iter->v->co);
+ } while ((l_iter = l_iter->next) != l_first);
+}
+
+/**
* computes center of face in 3d. uses center of bounding box.
*/
void BM_face_calc_center_bounds(const BMFace *f, float r_cent[3])
diff --git a/source/blender/bmesh/intern/bmesh_polygon.h b/source/blender/bmesh/intern/bmesh_polygon.h
index 4ec8ea59018..a40da2bfbfa 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.h
+++ b/source/blender/bmesh/intern/bmesh_polygon.h
@@ -57,6 +57,8 @@ void BM_face_calc_center_mean_vcos(
float const (*vertexCos)[3]) ATTR_NONNULL();
void BM_face_calc_center_mean_weighted(const BMFace *f, float center[3]) ATTR_NONNULL();
+void BM_face_calc_bounds_expand(const BMFace *f, float min[3], float max[3]);
+
void BM_face_normal_update(BMFace *f) ATTR_NONNULL();
void BM_edge_normals_update(BMEdge *e) ATTR_NONNULL();
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 4821fdd6af7..a5965336e12 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -136,10 +136,13 @@ int ED_markers_post_apply_transform(ListBase *markers, Scene *scene, int mode, f
float cfra = (float)CFRA;
int changed_tot = 0;
- /* sanity check */
- if (markers == NULL)
+ /* sanity check - no markers, or locked markers */
+ if ((scene->toolsettings->lock_markers) ||
+ (markers == NULL))
+ {
return changed_tot;
-
+ }
+
/* affect selected markers - it's unlikely that we will want to affect all in this way? */
for (marker = markers->first; marker; marker = marker->next) {
if (marker->flag & SELECT) {
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index 97f53561bfe..bf5d4ec0300 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -448,6 +448,18 @@ void sample_fcurve(FCurve *fcu)
/* check if selected, and which end this is */
if (BEZT_ISSEL_ANY(bezt)) {
if (start) {
+ /* If next bezt is also selected, don't start sampling yet,
+ * but instead wait for that one to reconsider, to avoid
+ * changing the curve when sampling consecutive segments
+ * (T53229)
+ */
+ if (i < fcu->totvert - 1) {
+ BezTriple *next = &fcu->bezt[i + 1];
+ if (BEZT_ISSEL_ANY(next)) {
+ continue;
+ }
+ }
+
/* set end */
end = bezt;
@@ -480,8 +492,8 @@ void sample_fcurve(FCurve *fcu)
i += (range - 1);
}
- /* bezt was selected, so it now marks the start of a whole new chain to search */
- start = bezt;
+ /* the current selection island has ended, so start again from scratch */
+ start = NULL;
end = NULL;
}
else {
diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c
index e419100bd04..368d54fc3ad 100644
--- a/source/blender/editors/armature/armature_add.c
+++ b/source/blender/editors/armature/armature_add.c
@@ -944,9 +944,16 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
}
}
/* if only one bone, make this one active */
- if (totbone == 1 && first) arm->act_edbone = first;
+ if (totbone == 1 && first) {
+ arm->act_edbone = first;
+ }
+ else {
+ arm->act_edbone = newbone;
+ }
- if (totbone == 0) return OPERATOR_CANCELLED;
+ if (totbone == 0) {
+ return OPERATOR_CANCELLED;
+ }
/* Transform the endpoints */
ED_armature_sync_selection(arm->edbo);
diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c
index ab9a3e068d0..a2fbfe645f7 100644
--- a/source/blender/editors/armature/armature_edit.c
+++ b/source/blender/editors/armature/armature_edit.c
@@ -1564,17 +1564,18 @@ void ARMATURE_OT_hide(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected");
}
-static int armature_reveal_exec(bContext *C, wmOperator *UNUSED(op))
+static int armature_reveal_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
bArmature *arm = obedit->data;
EditBone *ebone;
+ const bool select = RNA_boolean_get(op->ptr, "select");
for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
if (arm->layer & ebone->layer) {
if (ebone->flag & BONE_HIDDEN_A) {
if (!(ebone->flag & BONE_UNSELECTABLE)) {
- ebone->flag |= (BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL);
+ SET_FLAG_FROM_TEST(ebone->flag, select, (BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL));
}
ebone->flag &= ~BONE_HIDDEN_A;
}
@@ -1593,7 +1594,7 @@ void ARMATURE_OT_reveal(wmOperatorType *ot)
/* identifiers */
ot->name = "Reveal Bones";
ot->idname = "ARMATURE_OT_reveal";
- ot->description = "Unhide all bones that have been tagged to be hidden in Edit Mode";
+ ot->description = "Reveal all bones hidden in Edit Mode";
/* api callbacks */
ot->exec = armature_reveal_exec;
@@ -1602,4 +1603,5 @@ void ARMATURE_OT_reveal(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ RNA_def_boolean(ot->srna, "select", true, "Select", "");
}
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index 90383f3451d..97316010bc9 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -270,8 +270,8 @@ void POSE_OT_paths_calculate(wmOperatorType *ot)
static int pose_update_paths_poll(bContext *C)
{
if (ED_operator_posemode_exclusive(C)) {
- bPoseChannel *pchan = CTX_data_active_pose_bone(C);
- return (pchan && pchan->mpath);
+ Object *ob = CTX_data_active_object(C);
+ return (ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS) != 0;
}
return false;
@@ -1103,16 +1103,18 @@ void POSE_OT_hide(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "");
}
-static int show_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
+static int show_pose_bone_cb(Object *ob, Bone *bone, void *data)
{
+ const bool select = GET_INT_FROM_POINTER(data);
+
bArmature *arm = ob->data;
if (arm->layer & bone->layer) {
if (bone->flag & BONE_HIDDEN_P) {
- bone->flag &= ~BONE_HIDDEN_P;
if (!(bone->flag & BONE_UNSELECTABLE)) {
- bone->flag |= BONE_SELECTED;
+ SET_FLAG_FROM_TEST(bone->flag, select, BONE_SELECTED);
}
+ bone->flag &= ~BONE_HIDDEN_P;
}
}
@@ -1120,12 +1122,13 @@ static int show_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
}
/* active object is armature in posemode, poll checked */
-static int pose_reveal_exec(bContext *C, wmOperator *UNUSED(op))
+static int pose_reveal_exec(bContext *C, wmOperator *op)
{
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm = ob->data;
+ const bool select = RNA_boolean_get(op->ptr, "select");
- bone_looper(ob, arm->bonebase.first, NULL, show_pose_bone_cb);
+ bone_looper(ob, arm->bonebase.first, SET_INT_IN_POINTER(select), show_pose_bone_cb);
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
@@ -1138,7 +1141,7 @@ void POSE_OT_reveal(wmOperatorType *ot)
/* identifiers */
ot->name = "Reveal Selected";
ot->idname = "POSE_OT_reveal";
- ot->description = "Unhide all bones that have been tagged to be hidden in Pose Mode";
+ ot->description = "Reveal all bones hidden in Pose Mode";
/* api callbacks */
ot->exec = pose_reveal_exec;
@@ -1146,6 +1149,8 @@ void POSE_OT_reveal(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ RNA_def_boolean(ot->srna, "select", true, "Select", "");
}
/* ********************************************** */
diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c
index 948c7803420..18d6408f026 100644
--- a/source/blender/editors/armature/pose_transform.c
+++ b/source/blender/editors/armature/pose_transform.c
@@ -491,12 +491,15 @@ static int pose_paste_exec(bContext *C, wmOperator *op)
bPoseChannel *chan;
const bool flip = RNA_boolean_get(op->ptr, "flipped");
bool selOnly = RNA_boolean_get(op->ptr, "selected_mask");
+
/* Get KeyingSet to use. */
KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_WHOLE_CHARACTER_ID);
+
/* Sanity checks. */
if (ELEM(NULL, ob, ob->pose)) {
return OPERATOR_CANCELLED;
}
+
/* Read copy buffer .blend file. */
char str[FILE_MAX];
Main *tmp_bmain = BKE_main_new();
@@ -512,6 +515,7 @@ static int pose_paste_exec(bContext *C, wmOperator *op)
BKE_main_free(tmp_bmain);
return OPERATOR_CANCELLED;
}
+
Object *object_from = tmp_bmain->object.first;
bPose *pose_from = object_from->pose;
if (pose_from == NULL) {
@@ -519,6 +523,7 @@ static int pose_paste_exec(bContext *C, wmOperator *op)
BKE_main_free(tmp_bmain);
return OPERATOR_CANCELLED;
}
+
/* If selOnly option is enabled, if user hasn't selected any bones,
* just go back to default behavior to be more in line with other
* pose tools.
@@ -528,6 +533,7 @@ static int pose_paste_exec(bContext *C, wmOperator *op)
selOnly = false;
}
}
+
/* Safely merge all of the channels in the buffer pose into any
* existing pose.
*/
@@ -542,8 +548,15 @@ static int pose_paste_exec(bContext *C, wmOperator *op)
}
}
BKE_main_free(tmp_bmain);
+
/* Update event for pose and deformation children. */
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
+
+ /* Recalculate paths if any of the bones have paths... */
+ if ((ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) {
+ ED_pose_recalculate_paths(C, scene, ob);
+ }
+
/* Notifiers for updates, */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 3716827c113..7666fc15209 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -2930,7 +2930,7 @@ void CURVE_OT_hide(wmOperatorType *ot)
/********************** reveal operator *********************/
-static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
+static int reveal_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
ListBase *editnurb = object_editcurve_get(obedit);
@@ -2938,6 +2938,7 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
BPoint *bp;
BezTriple *bezt;
int a;
+ const bool select = RNA_boolean_get(op->ptr, "select");
for (nu = editnurb->first; nu; nu = nu->next) {
nu->hide = 0;
@@ -2946,7 +2947,7 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
a = nu->pntsu;
while (a--) {
if (bezt->hide) {
- select_beztriple(bezt, SELECT, SELECT, HIDDEN);
+ select_beztriple(bezt, select, SELECT, HIDDEN);
bezt->hide = 0;
}
bezt++;
@@ -2957,7 +2958,7 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
a = nu->pntsu * nu->pntsv;
while (a--) {
if (bp->hide) {
- select_bpoint(bp, SELECT, SELECT, HIDDEN);
+ select_bpoint(bp, select, SELECT, HIDDEN);
bp->hide = 0;
}
bp++;
@@ -2976,7 +2977,7 @@ void CURVE_OT_reveal(wmOperatorType *ot)
/* identifiers */
ot->name = "Reveal Hidden";
ot->idname = "CURVE_OT_reveal";
- ot->description = "Show again hidden control points";
+ ot->description = "Reveal hidden control points";
/* api callbacks */
ot->exec = reveal_exec;
@@ -2984,6 +2985,8 @@ void CURVE_OT_reveal(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ RNA_def_boolean(ot->srna, "select", true, "Select", "");
}
/********************** subdivide operator *********************/
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index 93c9d21e717..5bd5c9c74b9 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -423,18 +423,59 @@ static int gp_reveal_poll(bContext *C)
return ED_gpencil_data_get_active(C) != NULL;
}
-static int gp_reveal_exec(bContext *C, wmOperator *UNUSED(op))
+static void gp_reveal_select_frame(bContext *C, bGPDframe *frame, bool select)
+{
+ bGPDstroke *gps;
+ for (gps = frame->strokes.first; gps; gps = gps->next) {
+
+ /* only deselect strokes that are valid in this view */
+ if (ED_gpencil_stroke_can_use(C, gps)) {
+
+ /* (de)select points */
+ int i;
+ bGPDspoint *pt;
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ SET_FLAG_FROM_TEST(pt->flag, select, GP_SPOINT_SELECT);
+ }
+
+ /* (de)select stroke */
+ SET_FLAG_FROM_TEST(gps->flag, select, GP_STROKE_SELECT);
+ }
+ }
+}
+
+static int gp_reveal_exec(bContext *C, wmOperator *op)
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
bGPDlayer *gpl;
-
+ const bool select = RNA_boolean_get(op->ptr, "select");
+
/* sanity checks */
if (gpd == NULL)
return OPERATOR_CANCELLED;
- /* make all layers visible */
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
- gpl->flag &= ~GP_LAYER_HIDE;
+
+ if (gpl->flag & GP_LAYER_HIDE) {
+ gpl->flag &= ~GP_LAYER_HIDE;
+
+ /* select or deselect if requested, only on hidden layers */
+ if (gpd->flag & GP_DATA_STROKE_EDITMODE) {
+ if (select) {
+ /* select all strokes on active frame only (same as select all operator) */
+ if (gpl->actframe) {
+ gp_reveal_select_frame(C, gpl->actframe, true);
+ }
+ }
+ else {
+ /* deselect strokes on all frames (same as deselect all operator) */
+ bGPDframe *gpf;
+ for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
+ gp_reveal_select_frame(C, gpf, false);
+ }
+ }
+ }
+ }
}
/* notifiers */
@@ -456,6 +497,9 @@ void GPENCIL_OT_reveal(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* props */
+ RNA_def_boolean(ot->srna, "select", true, "Select", "");
}
/* ***************** Lock/Unlock All Layers ************************ */
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 1703ec6194f..1c8cf0665b3 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -104,7 +104,7 @@ void undo_push_mesh(struct bContext *C, const char *name);
bool EDBM_vert_color_check(struct BMEditMesh *em);
void EDBM_mesh_hide(struct BMEditMesh *em, bool swap);
-void EDBM_mesh_reveal(struct BMEditMesh *em);
+void EDBM_mesh_reveal(struct BMEditMesh *em, bool select);
void EDBM_update_generic(struct BMEditMesh *em, const bool do_tessface, const bool is_destructive);
@@ -207,7 +207,7 @@ void paintface_select_linked(struct bContext *C, struct Object *ob, const int mv
bool paintface_minmax(struct Object *ob, float r_min[3], float r_max[3]);
void paintface_hide(struct Object *ob, const bool unselected);
-void paintface_reveal(struct Object *ob);
+void paintface_reveal(struct Object *ob, const bool select);
void paintvert_deselect_all_visible(struct Object *ob, int action, bool flush_flags);
void paintvert_select_ungrouped(struct Object *ob, bool extend, bool flush_flags);
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c
index c170fbde7dc..b6ac23a37e8 100644
--- a/source/blender/editors/mask/mask_ops.c
+++ b/source/blender/editors/mask/mask_ops.c
@@ -1938,16 +1938,17 @@ void MASK_OT_handle_type_set(wmOperatorType *ot)
/* ********* clear/set restrict view *********/
-static int mask_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
+static int mask_hide_view_clear_exec(bContext *C, wmOperator *op)
{
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *masklay;
bool changed = false;
+ const bool select = RNA_boolean_get(op->ptr, "select");
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
if (masklay->restrictflag & OB_RESTRICT_VIEW) {
- ED_mask_layer_select_set(masklay, true);
+ ED_mask_layer_select_set(masklay, select);
masklay->restrictflag &= ~OB_RESTRICT_VIEW;
changed = true;
}
@@ -1978,6 +1979,8 @@ void MASK_OT_hide_view_clear(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ RNA_def_boolean(ot->srna, "select", true, "Select", "");
}
static int mask_hide_view_set_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 870eb68600a..992d0fada5e 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -42,7 +42,6 @@
#include "BKE_mesh.h"
#include "BKE_context.h"
#include "BKE_editmesh.h"
-#include "BKE_utildefines.h"
#include "BIF_gl.h"
@@ -141,7 +140,7 @@ void paintface_hide(Object *ob, const bool unselected)
}
-void paintface_reveal(Object *ob)
+void paintface_reveal(Object *ob, const bool select)
{
Mesh *me;
MPoly *mpoly;
@@ -154,8 +153,8 @@ void paintface_reveal(Object *ob)
a = me->totpoly;
while (a--) {
if (mpoly->flag & ME_HIDE) {
- mpoly->flag |= ME_FACE_SEL;
- mpoly->flag -= ME_HIDE;
+ SET_FLAG_FROM_TEST(mpoly->flag, select, ME_FACE_SEL);
+ mpoly->flag &= ~ME_HIDE;
}
mpoly++;
}
@@ -233,7 +232,7 @@ static void select_linked_tfaces_with_seams(Mesh *me, const unsigned int index,
for (a = 0, mp = me->mpoly; a < me->totpoly; a++, mp++) {
if (BLI_BITMAP_TEST(poly_tag, a)) {
- BKE_BIT_TEST_SET(mp->flag, select, ME_FACE_SEL);
+ SET_FLAG_FROM_TEST(mp->flag, select, ME_FACE_SEL);
}
}
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index aff82cd1204..cee9ee90b24 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -1655,12 +1655,13 @@ void MESH_OT_hide(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "unselected", false, "Unselected", "Hide unselected rather than selected");
}
-static int edbm_reveal_exec(bContext *C, wmOperator *UNUSED(op))
+static int edbm_reveal_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
-
- EDBM_mesh_reveal(em);
+ const bool select = RNA_boolean_get(op->ptr, "select");
+
+ EDBM_mesh_reveal(em, select);
EDBM_update_generic(em, true, false);
@@ -1680,6 +1681,8 @@ void MESH_OT_reveal(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ RNA_def_boolean(ot->srna, "select", true, "Select", "");
}
static int edbm_normals_make_consistent_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index eb3fea24cc1..0ad73dd45c8 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -1221,7 +1221,7 @@ void EDBM_mesh_hide(BMEditMesh *em, bool swap)
}
-void EDBM_mesh_reveal(BMEditMesh *em)
+void EDBM_mesh_reveal(BMEditMesh *em, bool select)
{
const char iter_types[3] = {BM_VERTS_OF_MESH,
BM_EDGES_OF_MESH,
@@ -1260,7 +1260,7 @@ void EDBM_mesh_reveal(BMEditMesh *em)
BM_ITER_MESH (ele, &iter, em->bm, iter_types[i]) {
if (BM_elem_flag_test(ele, BM_ELEM_TAG)) {
- BM_elem_select_set(em->bm, ele, true);
+ BM_elem_select_set(em->bm, ele, select);
}
}
}
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index 175b40d72ff..935f1a5ea4a 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -543,19 +543,21 @@ void MBALL_OT_hide_metaelems(wmOperatorType *ot)
/***************************** Unhide operator *****************************/
/* Unhide all edited MetaElems */
-static int reveal_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
+static int reveal_metaelems_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
MetaBall *mb = (MetaBall *)obedit->data;
- MetaElem *ml;
-
- ml = mb->editelems->first;
+ const bool select = RNA_boolean_get(op->ptr, "select");
+ bool changed = false;
- if (ml) {
- while (ml) {
+ for (MetaElem *ml = mb->editelems->first; ml; ml = ml->next) {
+ if (ml->flag & MB_HIDE) {
+ SET_FLAG_FROM_TEST(ml->flag, select, SELECT);
ml->flag &= ~MB_HIDE;
- ml = ml->next;
+ changed = true;
}
+ }
+ if (changed) {
WM_event_add_notifier(C, NC_GEOM | ND_DATA, mb);
DEG_id_tag_update(obedit->data, 0);
}
@@ -576,6 +578,9 @@ void MBALL_OT_reveal_metaelems(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* props */
+ RNA_def_boolean(ot->srna, "select", true, "Select", "");
}
/* Select MetaElement with mouse click (user can select radius circle or
diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c
index 557e0a0eccf..b2f9bee27ff 100644
--- a/source/blender/editors/object/object_lattice.c
+++ b/source/blender/editors/object/object_lattice.c
@@ -56,7 +56,6 @@
#include "BKE_lattice.h"
#include "BKE_deform.h"
#include "BKE_report.h"
-#include "BKE_utildefines.h"
#include "DEG_depsgraph.h"
@@ -370,7 +369,7 @@ static int lattice_select_more_less(bContext *C, const bool select)
lattice_test_bitmap_uvw(lt, selpoints, u, v, w + 1, select) ||
lattice_test_bitmap_uvw(lt, selpoints, u, v, w - 1, select))
{
- BKE_BIT_TEST_SET(bp->f1, select, SELECT);
+ SET_FLAG_FROM_TEST(bp->f1, select, SELECT);
}
}
bp++;
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index a46425a937e..8986ebd26e9 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -1973,12 +1973,13 @@ void PARTICLE_OT_hide(wmOperatorType *ot)
/*************************** reveal operator **************************/
-static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
+static int reveal_exec(bContext *C, wmOperator *op)
{
Object *ob= CTX_data_active_object(C);
Scene *scene= CTX_data_scene(C);
SceneLayer *sl = CTX_data_scene_layer(C);
PTCacheEdit *edit= PE_get_current(scene, sl, ob);
+ const bool select = RNA_boolean_get(op->ptr, "select");
POINT_P; KEY_K;
LOOP_POINTS {
@@ -1986,8 +1987,9 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
point->flag &= ~PEP_HIDE;
point->flag |= PEP_EDIT_RECALC;
- LOOP_KEYS
- key->flag |= PEK_SELECT;
+ LOOP_KEYS {
+ SET_FLAG_FROM_TEST(key->flag, select, PEK_SELECT);
+ }
}
}
@@ -2010,6 +2012,9 @@ void PARTICLE_OT_reveal(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* props */
+ RNA_def_boolean(ot->srna, "select", true, "Select", "");
}
/************************ select less operator ************************/
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 70a3b7bc1bd..6eadf373da4 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -753,10 +753,11 @@ void PAINT_OT_face_select_hide(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects");
}
-static int face_select_reveal_exec(bContext *C, wmOperator *UNUSED(op))
+static int face_select_reveal_exec(bContext *C, wmOperator *op)
{
+ const bool select = RNA_boolean_get(op->ptr, "select");
Object *ob = CTX_data_active_object(C);
- paintface_reveal(ob);
+ paintface_reveal(ob, select);
ED_region_tag_redraw(CTX_wm_region(C));
return OPERATOR_FINISHED;
}
@@ -772,5 +773,5 @@ void PAINT_OT_face_select_reveal(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects");
+ RNA_def_boolean(ot->srna, "select", true, "Select", "");
}
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index ab55221c1dc..49f498b3419 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -64,6 +64,7 @@
#include "ED_anim_api.h"
#include "ED_keyframing.h"
#include "ED_screen.h"
+#include "ED_util.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -503,25 +504,28 @@ static void driver_remove_cb(bContext *C, void *ale_v, void *UNUSED(arg))
/* call API method to remove this driver */
ANIM_remove_driver(reports, id, fcu->rna_path, fcu->array_index, 0);
+ ED_undo_push(C, "Remove Driver");
}
/* callback to add a target variable to the active driver */
-static void driver_add_var_cb(bContext *UNUSED(C), void *driver_v, void *UNUSED(arg))
+static void driver_add_var_cb(bContext *C, void *driver_v, void *UNUSED(arg))
{
ChannelDriver *driver = (ChannelDriver *)driver_v;
/* add a new variable */
driver_add_new_variable(driver);
+ ED_undo_push(C, "Add Driver Variable");
}
/* callback to remove target variable from active driver */
-static void driver_delete_var_cb(bContext *UNUSED(C), void *driver_v, void *dvar_v)
+static void driver_delete_var_cb(bContext *C, void *driver_v, void *dvar_v)
{
ChannelDriver *driver = (ChannelDriver *)driver_v;
DriverVar *dvar = (DriverVar *)dvar_v;
/* remove the active variable */
driver_free_variable_ex(driver, dvar);
+ ED_undo_push(C, "Delete Driver Variable");
}
/* callback to report why a driver variable is invalid */
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index 5c670a216d8..62275abcd02 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -333,13 +333,14 @@ static void GRAPH_OT_hide(wmOperatorType *ot)
/* ........ */
-static int graphview_curves_reveal_exec(bContext *C, wmOperator *UNUSED(op))
+static int graphview_curves_reveal_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
ListBase all_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
+ const bool select = RNA_boolean_get(op->ptr, "select");
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
@@ -364,8 +365,11 @@ static int graphview_curves_reveal_exec(bContext *C, wmOperator *UNUSED(op))
continue;
/* select if it is not visible */
- if (ANIM_channel_setting_get(&ac, ale, ACHANNEL_SETTING_VISIBLE) == 0)
- ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_SELECT, ACHANNEL_SETFLAG_ADD);
+ if (ANIM_channel_setting_get(&ac, ale, ACHANNEL_SETTING_VISIBLE) == 0) {
+ ANIM_channel_setting_set(
+ &ac, ale, ACHANNEL_SETTING_SELECT,
+ select ? ACHANNEL_SETFLAG_ADD : ACHANNEL_SETFLAG_CLEAR);
+ }
/* change the visibility setting */
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_ADD);
@@ -397,6 +401,8 @@ static void GRAPH_OT_reveal(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ RNA_def_boolean(ot->srna, "select", true, "Select", "");
}
/* ************************** registration - operator types **********************************/
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 8d93f6bca55..1edb3c88396 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -196,7 +196,13 @@ eOLDrawState tree_element_type_active(
TreeElement *te, TreeStoreElem *tselem, const eOLSetState set, bool recursive);
eOLDrawState tree_element_active(struct bContext *C, struct Scene *scene, struct SceneLayer *sl, SpaceOops *soops,
TreeElement *te, const eOLSetState set, const bool handle_all_types);
-int outliner_item_activate_or_toggle_closed(struct bContext *C, int x, int y, bool extend, bool recursive);
+
+void outliner_item_do_activate_from_tree_element(
+ struct bContext *C, TreeElement *te, TreeStoreElem *tselem,
+ bool extend, bool recursive);
+int outliner_item_do_activate_from_cursor(
+ struct bContext *C, const int mval[2],
+ bool extend, bool recursive);
/* outliner_edit.c ---------------------------------------------- */
typedef void (*outliner_operation_cb)(
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 606cc2fd14a..670be7611e4 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -876,21 +876,25 @@ eOLDrawState tree_element_type_active(
/* ================================================ */
-static void outliner_item_activate(
- bContext *C, SpaceOops *soops, TreeElement *te,
+/**
+ * Action when clicking to activate an item (typically under the mouse cursor),
+ * but don't do any cursor intersection checks.
+ *
+ * Needed to run from operators accessed from a menu.
+ */
+static void do_outliner_item_activate_tree_element(
+ bContext *C, Scene *scene, SceneLayer *sl, SpaceOops *soops,
+ TreeElement *te, TreeStoreElem *tselem,
const bool extend, const bool recursive)
{
- Scene *scene = CTX_data_scene(C);
- SceneLayer *sl = CTX_data_scene_layer(C);
- TreeStoreElem *tselem = TREESTORE(te);
-
/* always makes active object, except for some specific types.
* Note about TSE_EBONE: In case of a same ID_AR datablock shared among several objects, we do not want
* to switch out of edit mode (see T48328 for details). */
if (!ELEM(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP, TSE_EBONE, TSE_LAYER_COLLECTION)) {
- tree_element_set_active_object(C, scene, sl, soops, te,
- (extend && tselem->type == 0) ? OL_SETSEL_EXTEND : OL_SETSEL_NORMAL,
- recursive && tselem->type == 0);
+ tree_element_set_active_object(
+ C, scene, sl, soops, te,
+ (extend && tselem->type == 0) ? OL_SETSEL_EXTEND : OL_SETSEL_NORMAL,
+ recursive && tselem->type == 0);
}
if (tselem->type == 0) { // the lib blocks
@@ -903,7 +907,7 @@ static void outliner_item_activate(
else if (te->idcode == ID_GR) {
Group *gr = (Group *)tselem->id;
GroupObject *gob;
-
+
if (extend) {
int sel = BA_SELECT;
for (gob = gr->gobject.first; gob; gob = gob->next) {
@@ -989,7 +993,34 @@ static bool outliner_is_co_within_restrict_columns(const SpaceOops *soops, const
(view_co_x > ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX));
}
-int outliner_item_activate_or_toggle_closed(bContext *C, int x, int y, bool extend, bool recursive)
+/**
+ * A version of #outliner_item_do_acticate_from_cursor that takes the tree element directly.
+ * and doesn't depend on the pointer position.
+ *
+ * This allows us to simulate clicking on an item without dealing with the mouse cursor.
+ */
+void outliner_item_do_activate_from_tree_element(
+ bContext *C, TreeElement *te, TreeStoreElem *tselem,
+ bool extend, bool recursive)
+{
+ Scene *scene = CTX_data_scene(C);
+ SceneLayer *sl = CTX_data_scene_layer(C);
+ SpaceOops *soops = CTX_wm_space_outliner(C);
+
+ do_outliner_item_activate_tree_element(
+ C, scene, sl, soops,
+ te, tselem,
+ extend, recursive);
+}
+
+/**
+ * Action to run when clicking in the outliner,
+ *
+ * May expend/collapse branches or activate items.
+ * */
+int outliner_item_do_activate_from_cursor(
+ bContext *C, const int mval[2],
+ bool extend, bool recursive)
{
ARegion *ar = CTX_wm_region(C);
SpaceOops *soops = CTX_wm_space_outliner(C);
@@ -997,7 +1028,7 @@ int outliner_item_activate_or_toggle_closed(bContext *C, int x, int y, bool exte
float view_mval[2];
bool changed = false, rebuild_tree = false;
- UI_view2d_region_to_view(&ar->v2d, x, y, &view_mval[0], &view_mval[1]);
+ UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &view_mval[0], &view_mval[1]);
if (outliner_is_co_within_restrict_columns(soops, ar, view_mval[0])) {
return OPERATOR_CANCELLED;
@@ -1012,11 +1043,14 @@ int outliner_item_activate_or_toggle_closed(bContext *C, int x, int y, bool exte
rebuild_tree = true;
}
else {
+ Scene *scene = CTX_data_scene(C);
+ SceneLayer *sl = CTX_data_scene_layer(C);
/* the row may also contain children, if one is hovered we want this instead of current te */
TreeElement *activate_te = outliner_find_item_at_x_in_row(soops, te, view_mval[0]);
+ TreeStoreElem *activate_tselem = TREESTORE(activate_te);
outliner_item_select(soops, activate_te, extend, extend);
- outliner_item_activate(C, soops, activate_te, extend, recursive);
+ do_outliner_item_activate_tree_element(C, scene, sl, soops, activate_te, activate_tselem, extend, recursive);
changed = true;
}
@@ -1037,9 +1071,7 @@ static int outliner_item_activate_invoke(bContext *C, wmOperator *op, const wmEv
{
bool extend = RNA_boolean_get(op->ptr, "extend");
bool recursive = RNA_boolean_get(op->ptr, "recursive");
- int x = event->mval[0];
- int y = event->mval[1];
- return outliner_item_activate_or_toggle_closed(C, x, y, extend, recursive);
+ return outliner_item_do_activate_from_cursor(C, event->mval, extend, recursive);
}
void OUTLINER_OT_item_activate(wmOperatorType *ot)
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index ca168094ae2..79122de70dd 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -376,17 +376,14 @@ static void object_select_cb(
}
static void object_select_hierarchy_cb(
- bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *UNUSED(te),
- TreeStoreElem *UNUSED(tsep), TreeStoreElem *UNUSED(tselem), void *UNUSED(user_data))
+ bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *te,
+ TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data))
{
- /* From where do i get the x,y coordinate of the mouse event ? */
- wmWindow *win = CTX_wm_window(C);
- int x = win->eventstate->mval[0];
- int y = win->eventstate->mval[1];
- outliner_item_activate_or_toggle_closed(C, x, y, true, true);
+ /* Don't extend because this toggles, which is nice for Ctrl-Click but not for a menu item.
+ * it's especially confusing when multiple items are selected since some toggle on/off. */
+ outliner_item_do_activate_from_tree_element(C, te, tselem, false, true);
}
-
static void object_deselect_cb(
bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *UNUSED(te),
TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data))
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 9a058598580..297bd5c4aa1 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -71,7 +71,6 @@
#include "BKE_editmesh.h"
#include "BKE_scene.h"
#include "BKE_tracking.h"
-#include "BKE_utildefines.h"
#include "DEG_depsgraph.h"
@@ -703,7 +702,7 @@ static void do_lasso_select_meshobject__doSelectVert(void *userData, MVert *mv,
if (BLI_rctf_isect_pt_v(data->rect_fl, screen_co) &&
BLI_lasso_is_point_inside(data->mcords, data->moves, screen_co[0], screen_co[1], IS_CLIPPED))
{
- BKE_BIT_TEST_SET(mv->flag, data->select, SELECT);
+ SET_FLAG_FROM_TEST(mv->flag, data->select, SELECT);
}
}
static void do_lasso_select_paintvert(const struct EvaluationContext *eval_ctx, ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
@@ -1660,7 +1659,7 @@ static void do_paintvert_box_select__doSelectVert(void *userData, MVert *mv, con
BoxSelectUserData *data = userData;
if (BLI_rctf_isect_pt_v(data->rect_fl, screen_co)) {
- BKE_BIT_TEST_SET(mv->flag, data->select, SELECT);
+ SET_FLAG_FROM_TEST(mv->flag, data->select, SELECT);
}
}
static int do_paintvert_box_select(
@@ -2522,7 +2521,7 @@ static void paint_vertsel_circle_select_doSelectVert(void *userData, MVert *mv,
CircleSelectUserData *data = userData;
if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
- BKE_BIT_TEST_SET(mv->flag, data->select, SELECT);
+ SET_FLAG_FROM_TEST(mv->flag, data->select, SELECT);
}
}
static void paint_vertsel_circle_select(const struct EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad)
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 863e0c822dd..8d2fb595e24 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -81,7 +81,6 @@
#include "BKE_editmesh.h"
#include "BKE_tracking.h"
#include "BKE_mask.h"
-#include "BKE_utildefines.h"
#include "BKE_workspace.h"
#include "DEG_depsgraph.h"
@@ -1225,7 +1224,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
if (prop_id && (prop = RNA_struct_find_property(op->ptr, prop_id)) &&
RNA_property_is_set(op->ptr, prop))
{
- BKE_BIT_TEST_SET(t->flag, RNA_property_boolean_get(op->ptr, prop), T_ALT_TRANSFORM);
+ SET_FLAG_FROM_TEST(t->flag, RNA_property_boolean_get(op->ptr, prop), T_ALT_TRANSFORM);
}
}
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 12ff1ebe566..03a5f4dddc8 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -3619,7 +3619,7 @@ static void UV_OT_hide(wmOperatorType *ot)
/****************** reveal operator ******************/
-static int uv_reveal_exec(bContext *C, wmOperator *UNUSED(op))
+static int uv_reveal_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
Object *obedit = CTX_data_edit_object(C);
@@ -3635,12 +3635,14 @@ static int uv_reveal_exec(bContext *C, wmOperator *UNUSED(op))
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
+ const bool select = RNA_boolean_get(op->ptr, "select");
+
/* note on tagging, selecting faces needs to be delayed so it doesn't select the verts and
* confuse our checks on selected verts. */
/* call the mesh function if we are in mesh sync sel */
if (ts->uv_flag & UV_SYNC_SELECTION) {
- EDBM_mesh_reveal(em);
+ EDBM_mesh_reveal(em, select);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
@@ -3652,7 +3654,7 @@ static int uv_reveal_exec(bContext *C, wmOperator *UNUSED(op))
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- luv->flag |= MLOOPUV_VERTSEL;
+ SET_FLAG_FROM_TEST(luv->flag, select, MLOOPUV_VERTSEL);
}
/* BM_face_select_set(em->bm, efa, true); */
BM_elem_flag_enable(efa, BM_ELEM_TAG);
@@ -3673,7 +3675,7 @@ static int uv_reveal_exec(bContext *C, wmOperator *UNUSED(op))
if (!totsel) {
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- luv->flag |= MLOOPUV_VERTSEL;
+ SET_FLAG_FROM_TEST(luv->flag, select, MLOOPUV_VERTSEL);
}
/* BM_face_select_set(em->bm, efa, true); */
BM_elem_flag_enable(efa, BM_ELEM_TAG);
@@ -3688,7 +3690,7 @@ static int uv_reveal_exec(bContext *C, wmOperator *UNUSED(op))
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if (BM_elem_flag_test(l->v, BM_ELEM_SELECT) == 0) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- luv->flag |= MLOOPUV_VERTSEL;
+ SET_FLAG_FROM_TEST(luv->flag, select, MLOOPUV_VERTSEL);
}
}
/* BM_face_select_set(em->bm, efa, true); */
@@ -3704,7 +3706,7 @@ static int uv_reveal_exec(bContext *C, wmOperator *UNUSED(op))
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- luv->flag |= MLOOPUV_VERTSEL;
+ SET_FLAG_FROM_TEST(luv->flag, select, MLOOPUV_VERTSEL);
}
/* BM_face_select_set(em->bm, efa, true); */
BM_elem_flag_enable(efa, BM_ELEM_TAG);
@@ -3718,7 +3720,7 @@ static int uv_reveal_exec(bContext *C, wmOperator *UNUSED(op))
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if (BM_elem_flag_test(l->v, BM_ELEM_SELECT) == 0) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- luv->flag |= MLOOPUV_VERTSEL;
+ SET_FLAG_FROM_TEST(luv->flag, select, MLOOPUV_VERTSEL);
}
}
/* BM_face_select_set(em->bm, efa, true); */
@@ -3746,6 +3748,8 @@ static void UV_OT_reveal(wmOperatorType *ot)
/* api callbacks */
ot->exec = uv_reveal_exec;
ot->poll = ED_operator_uvedit;
+
+ RNA_def_boolean(ot->srna, "select", true, "Select", "");
}
/******************** set 3d cursor operator ********************/
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 93a87096369..4f28d1f9eea 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -869,70 +869,89 @@ void ED_uvedit_live_unwrap(Scene *scene, Object *obedit)
#define POLAR_ZX 0
#define POLAR_ZY 1
-static void uv_map_transform_center(Scene *scene, View3D *v3d, float *result, Object *ob, BMEditMesh *em)
+static void uv_map_transform_calc_bounds(BMEditMesh *em, float r_min[3], float r_max[3])
+{
+ BMFace *efa;
+ BMIter iter;
+ INIT_MINMAX(r_min, r_max);
+ BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+ if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+ BM_face_calc_bounds_expand(efa, r_min, r_max);
+ }
+ }
+}
+
+static void uv_map_transform_calc_center_median(BMEditMesh *em, float r_center[3])
+{
+ BMFace *efa;
+ BMIter iter;
+ uint center_accum_num = 0;
+ zero_v3(r_center);
+ BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+ if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+ float center[3];
+ BM_face_calc_center_mean(efa, center);
+ add_v3_v3(r_center, center);
+ center_accum_num += 1;
+ }
+ }
+ mul_v3_fl(r_center, 1.0f / (float)center_accum_num);
+}
+
+static void uv_map_transform_center(
+ Scene *scene, View3D *v3d, Object *ob, BMEditMesh *em,
+ float r_center[3],
+ float r_bounds[2][3])
{
/* only operates on the edit object - this is all that's needed now */
const int around = (v3d) ? v3d->around : V3D_AROUND_CENTER_BOUNDS;
+ float bounds[2][3];
+ INIT_MINMAX(bounds[0], bounds[1]);
+ bool is_minmax_set = false;
+
switch (around) {
case V3D_AROUND_CENTER_BOUNDS: /* bounding box center */
{
- BMFace *efa;
- BMLoop *l;
- BMIter iter, liter;
- float min[3], max[3];
-
- INIT_MINMAX(min, max);
-
- BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
- BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
- minmax_v3v3_v3(min, max, l->v->co);
- }
- }
- }
- mid_v3_v3v3(result, min, max);
+ uv_map_transform_calc_bounds(em, bounds[0], bounds[1]);
+ is_minmax_set = true;
+ mid_v3_v3v3(r_center, bounds[0], bounds[1]);
break;
}
case V3D_AROUND_CENTER_MEAN:
{
- BMFace *efa;
- BMLoop *l;
- BMIter iter, liter;
- int result_accum = 0;
-
- zero_v3(result);
- BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
- BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
- add_v3_v3(result, l->v->co);
- result_accum += 1;
- }
- }
- }
- mul_v3_fl(result, 1.0f / (float)result_accum);
+ uv_map_transform_calc_center_median(em, r_center);
break;
}
case V3D_AROUND_CURSOR: /* cursor center */
{
invert_m4_m4(ob->imat, ob->obmat);
- mul_v3_m4v3(result, ob->imat, ED_view3d_cursor3d_get(scene, v3d));
+ mul_v3_m4v3(r_center, ob->imat, ED_view3d_cursor3d_get(scene, v3d));
break;
}
case V3D_AROUND_ACTIVE:
{
BMEditSelection ese;
if (BM_select_history_active_get(em->bm, &ese)) {
- BM_editselection_center(&ese, result);
+ BM_editselection_center(&ese, r_center);
break;
}
ATTR_FALLTHROUGH;
}
case V3D_AROUND_LOCAL_ORIGINS: /* object center */
default:
- zero_v3(result);
+ zero_v3(r_center);
break;
}
+
+ /* if this is passed, always set! */
+ if (r_bounds) {
+ if (!is_minmax_set) {
+ uv_map_transform_calc_bounds(em, bounds[0], bounds[1]);
+ }
+ copy_v3_v3(r_bounds[0], bounds[0]);
+ copy_v3_v3(r_bounds[1], bounds[1]);
+ }
}
static void uv_map_rotation_matrix(float result[4][4], RegionView3D *rv3d, Object *ob,
@@ -1514,7 +1533,7 @@ static int sphere_project_exec(bContext *C, wmOperator *op)
cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
uv_map_transform(C, op, rotmat);
- uv_map_transform_center(scene, v3d, center, obedit, em);
+ uv_map_transform_center(scene, v3d, obedit, em, center, NULL);
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
@@ -1593,7 +1612,7 @@ static int cylinder_project_exec(bContext *C, wmOperator *op)
cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
uv_map_transform(C, op, rotmat);
- uv_map_transform_center(scene, v3d, center, obedit, em);
+ uv_map_transform_center(scene, v3d, obedit, em, center, NULL);
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
@@ -1666,26 +1685,10 @@ void ED_uvedit_unwrap_cube_project(BMesh *bm, float cube_size, bool use_select,
axis_dominant_v3(&cox, &coy, efa->no);
- float uv_delta[2] = {0.0f};
-
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
luv->uv[0] = 0.5f + 0.5f * cube_size * (l->v->co[cox] - loc[cox]);
luv->uv[1] = 0.5f + 0.5f * cube_size * (l->v->co[coy] - loc[coy]);
-
- add_v2_v2(uv_delta, luv->uv);
- }
-
- mul_v2_fl(uv_delta, 1.0f / (float)efa->len);
- uv_delta[0] = floor(uv_delta[0]);
- uv_delta[1] = floor(uv_delta[1]);
-
- if (uv_delta[0] != 0.0f || uv_delta[1] != 0.0f) {
- BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
- luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- luv->uv[0] -= uv_delta[0];
- luv->uv[1] -= uv_delta[1];
- }
}
}
}
@@ -1696,15 +1699,31 @@ static int cube_project_exec(bContext *C, wmOperator *op)
View3D *v3d = CTX_wm_view3d(C);
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
- float cube_size = RNA_float_get(op->ptr, "cube_size");
+ PropertyRNA *prop_cube_size = RNA_struct_find_property(op->ptr, "cube_size");
+ float cube_size = RNA_property_float_get(op->ptr, prop_cube_size);
float center[3];
+ float bounds[2][3];
+ float (*bounds_buf)[3] = NULL;
/* add uvs if they don't exist yet */
if (!ED_uvedit_ensure_uvs(C, scene, obedit)) {
return OPERATOR_CANCELLED;
}
- uv_map_transform_center(scene, v3d, center, obedit, em);
+ if (!RNA_property_is_set(op->ptr, prop_cube_size)) {
+ bounds_buf = bounds;
+ }
+
+ uv_map_transform_center(scene, v3d, obedit, em, center, bounds_buf);
+
+ /* calculate based on bounds */
+ if (bounds_buf) {
+ float dims[3];
+ sub_v3_v3v3(dims, bounds[1], bounds[0]);
+ cube_size = max_fff(UNPACK3(dims));
+ cube_size = cube_size ? 2.0f / cube_size : 1.0f;
+ RNA_property_float_set(op->ptr, prop_cube_size, cube_size);
+ }
ED_uvedit_unwrap_cube_project(em->bm, cube_size, true, center);
diff --git a/source/blender/freestyle/intern/system/StringUtils.h b/source/blender/freestyle/intern/system/StringUtils.h
index e11798762e4..10748c45c19 100644
--- a/source/blender/freestyle/intern/system/StringUtils.h
+++ b/source/blender/freestyle/intern/system/StringUtils.h
@@ -35,7 +35,6 @@
#include <vector>
extern "C" {
-#include "BKE_utildefines.h"
#include "BLI_string.h"
#include "BLI_path_util.h"
}
diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c
index 0ae07874853..2ba067629a9 100644
--- a/source/blender/makesrna/intern/rna_animviz.c
+++ b/source/blender/makesrna/intern/rna_animviz.c
@@ -174,6 +174,7 @@ static void rna_def_animviz_motion_path(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Use Bone Heads",
"For PoseBone paths, use the bone head location when calculating this path");
+ /* FIXME: Motion Paths are not currently editable... */
prop = RNA_def_property(srna, "is_modified", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOTIONPATH_FLAG_EDIT);
RNA_def_property_ui_text(prop, "Edit Path", "Path is being edited");
@@ -364,6 +365,12 @@ static void rna_def_animviz_paths(BlenderRNA *brna)
"(only for 'Around Current Frame' Onion-skinning method)");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
+
+ /* Readonly Property - Do any motion paths exist/need updating? (Mainly for bone paths) */
+ prop = RNA_def_property(srna, "has_motion_paths", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "path_bakeflag", MOTIONPATH_BAKE_HAS_PATHS);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* NOTE: This is really an internal state var for convenience, so don't allow edits! */
+ RNA_def_property_ui_text(prop, "Has Motion Paths", "Are there any bone paths that will need updating (read-only)");
}
/* --- */
diff --git a/source/blender/makesrna/intern/rna_wm_manipulator.c b/source/blender/makesrna/intern/rna_wm_manipulator.c
index a8dcd563ed3..00705456fc7 100644
--- a/source/blender/makesrna/intern/rna_wm_manipulator.c
+++ b/source/blender/makesrna/intern/rna_wm_manipulator.c
@@ -62,7 +62,6 @@
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_workspace.h"
-#include "BKE_utildefines.h"
#include "MEM_guardedalloc.h"
@@ -354,7 +353,7 @@ static int rna_Manipulator_##func_id##_get(PointerRNA *ptr) \
static void rna_Manipulator_##func_id##_set(PointerRNA *ptr, int value) \
{ \
wmManipulator *mpr = ptr->data; \
- BKE_BIT_TEST_SET(mpr->member_id, value, flag_value); \
+ SET_FLAG_FROM_TEST(mpr->member_id, value, flag_value); \
}
/* wmManipulator.flag (negative) */
@@ -367,7 +366,7 @@ static int rna_Manipulator_##func_id##_get(PointerRNA *ptr) \
static void rna_Manipulator_##func_id##_set(PointerRNA *ptr, int value) \
{ \
wmManipulator *mpr = ptr->data; \
- BKE_BIT_TEST_SET(mpr->member_id, !value, flag_value); \
+ SET_FLAG_FROM_TEST(mpr->member_id, !value, flag_value); \
}
#define RNA_MANIPULATOR_FLAG_RO_DEF(func_id, member_id, flag_value) \
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h
index 243aff8ae54..81e411700fa 100644
--- a/source/blender/render/extern/include/RE_pipeline.h
+++ b/source/blender/render/extern/include/RE_pipeline.h
@@ -316,7 +316,7 @@ void RE_PreviewRender(struct Render *re, struct Main *bmain, struct Scene *scene
bool RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode);
bool RE_WriteRenderResult(
struct ReportList *reports, RenderResult *rr, const char *filename,
- struct ImageFormatData *imf, const char *view, const int layer);
+ struct ImageFormatData *imf, const char *view, int layer);
struct RenderResult *RE_MultilayerConvert(
void *exrhandle, const char *colorspace, bool predivide, int rectx, int recty);
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 07104e034fb..81c6443b2d9 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -72,7 +72,6 @@
#include "DNA_workspace_types.h"
#include "BKE_appdir.h"
-#include "BKE_utildefines.h"
#include "BKE_autoexec.h"
#include "BKE_blender.h"
#include "BKE_blendfile.h"
@@ -338,12 +337,12 @@ static void wm_init_userdef(Main *bmain, const bool read_userdef_from_memory)
BKE_sound_init(bmain);
/* needed so loading a file from the command line respects user-pref [#26156] */
- BKE_BIT_TEST_SET(G.fileflags, U.flag & USER_FILENOUI, G_FILE_NO_UI);
+ SET_FLAG_FROM_TEST(G.fileflags, U.flag & USER_FILENOUI, G_FILE_NO_UI);
/* set the python auto-execute setting from user prefs */
/* enabled by default, unless explicitly enabled in the command line which overrides */
if ((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) {
- BKE_BIT_TEST_SET(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_SCRIPT_AUTOEXEC);
+ SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_SCRIPT_AUTOEXEC);
}
/* avoid re-saving for every small change to our prefs, allow overrides */
@@ -677,7 +676,7 @@ int wm_homefile_read(
BLI_assert((use_factory_settings && filepath_startup_override) == 0);
if ((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) {
- BKE_BIT_TEST_SET(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_SCRIPT_AUTOEXEC);
+ SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_SCRIPT_AUTOEXEC);
}
BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_PRE);
@@ -1173,8 +1172,8 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
G.save_over = 1; /* disable untitled.blend convention */
}
- BKE_BIT_TEST_SET(G.fileflags, fileflags & G_FILE_COMPRESS, G_FILE_COMPRESS);
- BKE_BIT_TEST_SET(G.fileflags, fileflags & G_FILE_AUTOPLAY, G_FILE_AUTOPLAY);
+ SET_FLAG_FROM_TEST(G.fileflags, fileflags & G_FILE_COMPRESS, G_FILE_COMPRESS);
+ SET_FLAG_FROM_TEST(G.fileflags, fileflags & G_FILE_AUTOPLAY, G_FILE_AUTOPLAY);
/* prevent background mode scripts from clobbering history */
if (do_history) {
@@ -1597,7 +1596,7 @@ static int wm_homefile_read_exec(bContext *C, wmOperator *op)
/* This can be used when loading of a start-up file should only change
* the scene content but keep the blender UI as it is. */
wm_open_init_load_ui(op, true);
- BKE_BIT_TEST_SET(G.fileflags, !RNA_boolean_get(op->ptr, "load_ui"), G_FILE_NO_UI);
+ SET_FLAG_FROM_TEST(G.fileflags, !RNA_boolean_get(op->ptr, "load_ui"), G_FILE_NO_UI);
if (RNA_property_is_set(op->ptr, prop)) {
RNA_property_string_get(op->ptr, prop, filepath_buf);
@@ -2080,20 +2079,24 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
fileflags = G.fileflags & ~G_FILE_USERPREFS;
/* set compression flag */
- BKE_BIT_TEST_SET(fileflags, RNA_boolean_get(op->ptr, "compress"),
- G_FILE_COMPRESS);
- BKE_BIT_TEST_SET(fileflags, RNA_boolean_get(op->ptr, "relative_remap"),
- G_FILE_RELATIVE_REMAP);
- BKE_BIT_TEST_SET(fileflags,
- (RNA_struct_property_is_set(op->ptr, "copy") &&
- RNA_boolean_get(op->ptr, "copy")),
- G_FILE_SAVE_COPY);
+ SET_FLAG_FROM_TEST(
+ fileflags, RNA_boolean_get(op->ptr, "compress"),
+ G_FILE_COMPRESS);
+ SET_FLAG_FROM_TEST(
+ fileflags, RNA_boolean_get(op->ptr, "relative_remap"),
+ G_FILE_RELATIVE_REMAP);
+ SET_FLAG_FROM_TEST(
+ fileflags,
+ (RNA_struct_property_is_set(op->ptr, "copy") &&
+ RNA_boolean_get(op->ptr, "copy")),
+ G_FILE_SAVE_COPY);
#ifdef USE_BMESH_SAVE_AS_COMPAT
- BKE_BIT_TEST_SET(fileflags,
- (RNA_struct_find_property(op->ptr, "use_mesh_compat") &&
- RNA_boolean_get(op->ptr, "use_mesh_compat")),
- G_FILE_MESH_COMPAT);
+ SET_FLAG_FROM_TEST(
+ fileflags,
+ (RNA_struct_find_property(op->ptr, "use_mesh_compat") &&
+ RNA_boolean_get(op->ptr, "use_mesh_compat")),
+ G_FILE_MESH_COMPAT);
#else
# error "don't remove by accident"
#endif