[Bf-blender-cvs] [cc3f7abbb09] soc-2019-outliner: Outliner: Move sync_select_dirty_flag to new file

Nathan Craddock noreply at git.blender.org
Sun Jun 30 06:43:26 CEST 2019


Commit: cc3f7abbb09a85f8c80084ad1baecbe71369415a
Author: Nathan Craddock
Date:   Sat Jun 29 20:40:45 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rBcc3f7abbb09a85f8c80084ad1baecbe71369415a

Outliner: Move sync_select_dirty_flag to new file

Adds `outliner_sync.c` for the global rather than storing in Main.

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

M	source/blender/blenkernel/BKE_main.h
M	source/blender/editors/include/ED_outliner.h
M	source/blender/editors/object/object_select.c
M	source/blender/editors/space_outliner/CMakeLists.txt
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/editors/space_outliner/outliner_select.c
A	source/blender/editors/space_outliner/outliner_sync.c

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

diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h
index 415a9aecd5d..1c987d5eb8e 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -82,10 +82,6 @@ typedef struct Main {
   /** All current ID's exist in the last memfile undo step. */
   char is_memfile_undo_written;
 
-  /* Flag to indicate if a sync is to extend or replace the outliner selection */
-  char sync_select_dirty_flag;
-  struct SpaceOutliner *clean_outliner; /* to store the clean outliner to be synced from */
-
   BlendThumbnail *blen_thumb;
 
   struct Library *curlib;
@@ -136,13 +132,6 @@ typedef struct Main {
   struct MainLock *lock;
 } Main;
 
-/* Main->sync_select_dirty_flag */
-enum {
-  SYNC_SELECT_NONE = 0,
-  SYNC_SELECT_REPLACE = 1,
-  SYNC_SELECT_EXTEND = 2,
-};
-
 struct Main *BKE_main_new(void);
 void BKE_main_free(struct Main *mainvar);
 
diff --git a/source/blender/editors/include/ED_outliner.h b/source/blender/editors/include/ED_outliner.h
index 55bc5e2d92b..fc64785ca93 100644
--- a/source/blender/editors/include/ED_outliner.h
+++ b/source/blender/editors/include/ED_outliner.h
@@ -26,6 +26,16 @@
 struct ListBase;
 struct bContext;
 
+/* Flag to indicate if a sync is to extend or replace the outliner selection */
+extern short sync_select_dirty_flag;
+
+/* sync_select_dirty_flag types */
+enum {
+  SYNC_SELECT_NONE = 0,
+  SYNC_SELECT_REPLACE = 1,
+  SYNC_SELECT_EXTEND = 2,
+};
+
 bool ED_outliner_collections_editor_poll(struct bContext *C);
 
 void ED_outliner_selected_objects_get(const struct bContext *C, struct ListBase *objects);
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index d2d8a7680e2..b96ccde8046 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -50,7 +50,6 @@
 #include "BKE_collection.h"
 #include "BKE_context.h"
 #include "BKE_deform.h"
-#include "BKE_global.h"
 #include "BKE_layer.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
@@ -70,6 +69,7 @@
 
 #include "ED_armature.h"
 #include "ED_object.h"
+#include "ED_outliner.h"
 #include "ED_screen.h"
 #include "ED_select_utils.h"
 #include "ED_keyframing.h"
@@ -119,7 +119,7 @@ void ED_object_base_select(Base *base, eObjectSelect_Mode mode)
   }
 
   /* Using globals to sync selection for now */
-  G_MAIN->sync_select_dirty_flag = SYNC_SELECT_REPLACE;
+  sync_select_dirty_flag = SYNC_SELECT_REPLACE;
 }
 
 /**
diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt
index d235dd47136..616915dbc2c 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -41,6 +41,7 @@ set(SRC
   outliner_edit.c
   outliner_ops.c
   outliner_select.c
+  outliner_sync.c
   outliner_tools.c
   outliner_tree.c
   outliner_utils.c
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index a9c8f421a18..b513fc1d060 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -45,7 +45,6 @@
 #include "BKE_context.h"
 #include "BKE_deform.h"
 #include "BKE_fcurve.h"
-#include "BKE_global.h"
 #include "BKE_gpencil.h"
 #include "BKE_idcode.h"
 #include "BKE_layer.h"
@@ -62,6 +61,7 @@
 #include "ED_armature.h"
 #include "ED_keyframing.h"
 #include "ED_object.h"
+#include "ED_outliner.h"
 #include "ED_screen.h"
 
 #include "WM_api.h"
@@ -3631,12 +3631,12 @@ static void outliner_sync_selection(const bContext *C, SpaceOutliner *soops)
   ViewLayer *view_layer = CTX_data_view_layer(C);
 
   /* If 3D view selection occurred, mark outliners as dirty */
-  if (G_MAIN->sync_select_dirty_flag != SYNC_SELECT_NONE) {
+  if (sync_select_dirty_flag != SYNC_SELECT_NONE) {
     printf("Marking outliners as dirty\n");
 
     outliners_mark_dirty(C);
 
-    G_MAIN->sync_select_dirty_flag = SYNC_SELECT_NONE;
+    sync_select_dirty_flag = SYNC_SELECT_NONE;
   }
 
   /* If dirty, sync from view layer */
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index f2f5c7affdd..7c727f6bd64 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -41,7 +41,6 @@
 #include "BKE_armature.h"
 #include "BKE_collection.h"
 #include "BKE_context.h"
-#include "BKE_global.h"
 #include "BKE_gpencil.h"
 #include "BKE_layer.h"
 #include "BKE_main.h"
@@ -78,7 +77,7 @@ void outliner_select_sync(bContext *C, SpaceOutliner *soops)
 {
   puts("Outliner select... Mark other outliners as dirty for syncing");
   outliner_sync_selection_to_view_layer(C, &soops->tree);
-  G_MAIN->sync_select_dirty_flag = SYNC_SELECT_NONE;
+  sync_select_dirty_flag = SYNC_SELECT_NONE;
 
   /* Don't need to mark self as dirty here... */
   outliners_mark_dirty(C);
diff --git a/source/blender/editors/include/ED_outliner.h b/source/blender/editors/space_outliner/outliner_sync.c
similarity index 63%
copy from source/blender/editors/include/ED_outliner.h
copy to source/blender/editors/space_outliner/outliner_sync.c
index 55bc5e2d92b..3aaf51b607f 100644
--- a/source/blender/editors/include/ED_outliner.h
+++ b/source/blender/editors/space_outliner/outliner_sync.c
@@ -13,23 +13,21 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * The Original Code is Copyright (C) 2015, Blender Foundation
+ * The Original Code is Copyright (C) 2004 Blender Foundation.
+ * All rights reserved.
  */
 
 /** \file
- * \ingroup editors
+ * \ingroup spoutliner
  */
 
-#ifndef __ED_OUTLINER_H__
-#define __ED_OUTLINER_H__
+#include "DNA_layer_types.h"
+#include "DNA_outliner_types.h"
+#include "DNA_space_types.h"
 
-struct ListBase;
-struct bContext;
+#include "ED_outliner.h"
 
-bool ED_outliner_collections_editor_poll(struct bContext *C);
+#include "outliner_intern.h"
 
-void ED_outliner_selected_objects_get(const struct bContext *C, struct ListBase *objects);
-
-Base *ED_outliner_give_base_under_cursor(struct bContext *C, const int mval[2]);
-
-#endif /*  __ED_OUTLINER_H__ */
+/* Default value for sync selection state */
+short sync_select_dirty_flag = SYNC_SELECT_NONE;
\ No newline at end of file



More information about the Bf-blender-cvs mailing list