[Bf-blender-cvs] [d450a791c37] master: Cleanup: assign operator type flags in their initialization

Campbell Barton noreply at git.blender.org
Sun Jun 5 15:25:59 CEST 2022


Commit: d450a791c37e4df0b37aab4feb8925fef206c4c8
Author: Campbell Barton
Date:   Sun Jun 5 23:05:38 2022 +1000
Branches: master
https://developer.blender.org/rBd450a791c37e4df0b37aab4feb8925fef206c4c8

Cleanup: assign operator type flags in their initialization

Some operators OR'ed the existing flags in a way that made it seem
the value might already have some values set.
Replace this with assignment as no flags are set and the convention
with almost all operators is to write the value directly.

===================================================================

M	source/blender/editors/io/io_alembic.c
M	source/blender/editors/io/io_collada.c
M	source/blender/editors/io/io_obj.c
M	source/blender/editors/io/io_usd.c
M	source/blender/editors/space_clip/clip_ops.c
M	source/blender/editors/space_outliner/outliner_select.cc
M	source/blender/editors/space_outliner/outliner_tools.cc
M	source/blender/windowmanager/intern/wm_files_link.c

===================================================================

diff --git a/source/blender/editors/io/io_alembic.c b/source/blender/editors/io/io_alembic.c
index 87923d9fdf8..0e8e0f83597 100644
--- a/source/blender/editors/io/io_alembic.c
+++ b/source/blender/editors/io/io_alembic.c
@@ -282,7 +282,7 @@ void WM_OT_alembic_export(wmOperatorType *ot)
   ot->poll = WM_operator_winactive;
   ot->ui = wm_alembic_export_draw;
   ot->check = wm_alembic_export_check;
-  ot->flag |= OPTYPE_PRESET;
+  ot->flag = OPTYPE_PRESET;
 
   WM_operator_properties_filesel(ot,
                                  FILE_TYPE_FOLDER | FILE_TYPE_ALEMBIC,
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index dc62212bf53..c491e7a5815 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -468,7 +468,7 @@ void WM_OT_collada_export(wmOperatorType *ot)
   ot->poll = WM_operator_winactive;
   ot->check = wm_collada_export_check;
 
-  ot->flag |= OPTYPE_PRESET;
+  ot->flag = OPTYPE_PRESET;
 
   ot->ui = wm_collada_export_draw;
 
@@ -786,7 +786,7 @@ void WM_OT_collada_import(wmOperatorType *ot)
   ot->exec = wm_collada_import_exec;
   ot->poll = WM_operator_winactive;
 
-  // ot->flag |= OPTYPE_PRESET;
+  // ot->flag = OPTYPE_PRESET;
 
   ot->ui = wm_collada_import_draw;
 
diff --git a/source/blender/editors/io/io_obj.c b/source/blender/editors/io/io_obj.c
index 5537b2575d8..59e8c20da04 100644
--- a/source/blender/editors/io/io_obj.c
+++ b/source/blender/editors/io/io_obj.c
@@ -261,7 +261,7 @@ void WM_OT_obj_export(struct wmOperatorType *ot)
   ot->ui = wm_obj_export_draw;
   ot->check = wm_obj_export_check;
 
-  ot->flag |= OPTYPE_PRESET;
+  ot->flag = OPTYPE_PRESET;
 
   WM_operator_properties_filesel(ot,
                                  FILE_TYPE_FOLDER,
diff --git a/source/blender/editors/io/io_usd.c b/source/blender/editors/io/io_usd.c
index 8a24b48be5e..45d658d5b25 100644
--- a/source/blender/editors/io/io_usd.c
+++ b/source/blender/editors/io/io_usd.c
@@ -216,8 +216,7 @@ void WM_OT_usd_export(struct wmOperatorType *ot)
   ot->ui = wm_usd_export_draw;
   ot->check = wm_usd_export_check;
 
-  ot->flag = OPTYPE_REGISTER; /* No UNDO possible. */
-  ot->flag |= OPTYPE_PRESET;
+  ot->flag = OPTYPE_REGISTER | OPTYPE_PRESET; /* No UNDO possible. */
 
   WM_operator_properties_filesel(ot,
                                  FILE_TYPE_FOLDER | FILE_TYPE_USD,
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index e61c264ca06..f5bf850791a 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -777,7 +777,7 @@ void CLIP_OT_view_zoom_in(wmOperatorType *ot)
   ot->poll = ED_space_clip_view_clip_poll;
 
   /* flags */
-  ot->flag |= OPTYPE_LOCK_BYPASS;
+  ot->flag = OPTYPE_LOCK_BYPASS;
 
   /* properties */
   prop = RNA_def_float_vector(ot->srna,
@@ -834,7 +834,7 @@ void CLIP_OT_view_zoom_out(wmOperatorType *ot)
   ot->poll = ED_space_clip_view_clip_poll;
 
   /* flags */
-  ot->flag |= OPTYPE_LOCK_BYPASS;
+  ot->flag = OPTYPE_LOCK_BYPASS;
 
   /* properties */
   prop = RNA_def_float_vector(ot->srna,
@@ -883,7 +883,7 @@ void CLIP_OT_view_zoom_ratio(wmOperatorType *ot)
   ot->poll = ED_space_clip_view_clip_poll;
 
   /* flags */
-  ot->flag |= OPTYPE_LOCK_BYPASS;
+  ot->flag = OPTYPE_LOCK_BYPASS;
 
   /* properties */
   RNA_def_float(ot->srna,
diff --git a/source/blender/editors/space_outliner/outliner_select.cc b/source/blender/editors/space_outliner/outliner_select.cc
index bd6d3d89706..877e0fc325c 100644
--- a/source/blender/editors/space_outliner/outliner_select.cc
+++ b/source/blender/editors/space_outliner/outliner_select.cc
@@ -1693,7 +1693,7 @@ void OUTLINER_OT_item_activate(wmOperatorType *ot)
 
   ot->poll = ED_operator_outliner_active;
 
-  ot->flag |= OPTYPE_REGISTER | OPTYPE_UNDO;
+  ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
   PropertyRNA *prop;
   prop = RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend selection for activation");
@@ -2028,7 +2028,7 @@ void OUTLINER_OT_select_walk(wmOperatorType *ot)
   ot->invoke = outliner_walk_select_invoke;
   ot->poll = ED_operator_outliner_active;
 
-  ot->flag |= OPTYPE_REGISTER | OPTYPE_UNDO;
+  ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
   /* properties */
   PropertyRNA *prop;
diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc
index bfb4c7251a8..475d02020d0 100644
--- a/source/blender/editors/space_outliner/outliner_tools.cc
+++ b/source/blender/editors/space_outliner/outliner_tools.cc
@@ -1954,7 +1954,7 @@ void OUTLINER_OT_delete(wmOperatorType *ot)
   ot->poll = ED_operator_outliner_active;
 
   /* flags */
-  ot->flag |= OPTYPE_REGISTER | OPTYPE_UNDO;
+  ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
   /* properties */
   PropertyRNA *prop = RNA_def_boolean(
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index b41ffb4cfc2..f2c41dada48 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -438,7 +438,7 @@ void WM_OT_link(wmOperatorType *ot)
   ot->exec = wm_link_append_exec;
   ot->poll = wm_link_append_poll;
 
-  ot->flag |= OPTYPE_UNDO;
+  ot->flag = OPTYPE_UNDO;
 
   WM_operator_properties_filesel(ot,
                                  FILE_TYPE_FOLDER | FILE_TYPE_BLENDER | FILE_TYPE_BLENDERLIB,
@@ -462,7 +462,7 @@ void WM_OT_append(wmOperatorType *ot)
   ot->exec = wm_link_append_exec;
   ot->poll = wm_link_append_poll;
 
-  ot->flag |= OPTYPE_UNDO;
+  ot->flag = OPTYPE_UNDO;
 
   WM_operator_properties_filesel(ot,
                                  FILE_TYPE_FOLDER | FILE_TYPE_BLENDER | FILE_TYPE_BLENDERLIB,
@@ -803,7 +803,7 @@ void WM_OT_lib_relocate(wmOperatorType *ot)
   ot->invoke = wm_lib_relocate_invoke;
   ot->exec = wm_lib_relocate_exec;
 
-  ot->flag |= OPTYPE_UNDO;
+  ot->flag = OPTYPE_UNDO;
 
   prop = RNA_def_string(ot->srna, "library", NULL, MAX_NAME, "Library", "Library to relocate");
   RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -833,7 +833,7 @@ void WM_OT_lib_reload(wmOperatorType *ot)
 
   ot->exec = wm_lib_reload_exec;
 
-  ot->flag |= OPTYPE_UNDO;
+  ot->flag = OPTYPE_UNDO;
 
   prop = RNA_def_string(ot->srna, "library", NULL, MAX_NAME, "Library", "Library to reload");
   RNA_def_property_flag(prop, PROP_HIDDEN);



More information about the Bf-blender-cvs mailing list