[Bf-blender-cvs] [3da834e83c] render-layers: Collection Editor based on patch by Julian Eisel

Dalai Felinto noreply at git.blender.org
Mon Jan 30 18:26:28 CET 2017


Commit: 3da834e83ce9d7056c033148dab04885a6d3b1b7
Author: Dalai Felinto
Date:   Mon Jan 30 14:14:27 2017 +0100
Branches: render-layers
https://developer.blender.org/rB3da834e83ce9d7056c033148dab04885a6d3b1b7

Collection Editor based on patch by Julian Eisel

This is extracted from the layer-manager branch. With the following
changes:

* Renamed references of layer manager to collections manager
* I didn't include the editors/space_collections/ draw and util files.

I still need to bring the drawing code here, so we see something.

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

M	build_files/cmake/macros.cmake
M	release/scripts/startup/bl_ui/__init__.py
A	release/scripts/startup/bl_ui/space_collections.py
M	source/blender/blenkernel/BKE_context.h
M	source/blender/blenkernel/intern/context.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/editors/CMakeLists.txt
M	source/blender/editors/include/BIF_glutil.h
M	source/blender/editors/include/ED_object.h
M	source/blender/editors/include/ED_screen.h
M	source/blender/editors/include/ED_space_api.h
M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/include/UI_interface_icons.h
M	source/blender/editors/interface/interface_icons.c
M	source/blender/editors/interface/interface_widgets.c
M	source/blender/editors/interface/resources.c
M	source/blender/editors/screen/glutil.c
M	source/blender/editors/screen/screen_ops.c
M	source/blender/editors/space_api/spacetypes.c
A	source/blender/editors/space_collections/CMakeLists.txt
A	source/blender/editors/space_collections/collections_intern.h
A	source/blender/editors/space_collections/collections_ops.c
A	source/blender/editors/space_collections/space_collections.c
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/makesrna/intern/rna_userdef.c
M	source/blender/python/intern/bpy_rna_callback.c
M	source/blender/windowmanager/WM_types.h
M	source/blender/windowmanager/intern/wm_keymap.c

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

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 09428953a4..83ae56636b 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -566,6 +566,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
 		bf_editor_space_userpref
 		bf_editor_space_view3d
 		bf_editor_space_clip
+		bf_editor_space_collections
 
 		bf_editor_transform
 		bf_editor_util
diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py
index 2389be6787..e39fca6e16 100644
--- a/release/scripts/startup/bl_ui/__init__.py
+++ b/release/scripts/startup/bl_ui/__init__.py
@@ -69,6 +69,7 @@ _modules = [
     "space_graph",
     "space_image",
     "space_info",
+    "space_collections",
     "space_logic",
     "space_nla",
     "space_node",
diff --git a/release/scripts/startup/bl_ui/space_collections.py b/release/scripts/startup/bl_ui/space_collections.py
new file mode 100644
index 0000000000..e46684b62b
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_collections.py
@@ -0,0 +1,35 @@
+# ##### 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 #####
+
+# <pep8 compliant>
+import bpy
+from bpy.types import Header, Menu
+
+
+class COLLECTIONS_HT_header(Header):
+    bl_space_type = 'COLLECTION_MANAGER'
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.template_header()
+        layout.label(text="Work in progress")
+
+
+if __name__ == "__main__":  # only for live edit.
+    bpy.utils.register_module(__name__)
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index 649d142d1c..3f13105069 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -169,6 +169,7 @@ struct SpaceAction *CTX_wm_space_action(const bContext *C);
 struct SpaceInfo *CTX_wm_space_info(const bContext *C);
 struct SpaceUserPref *CTX_wm_space_userpref(const bContext *C);
 struct SpaceClip *CTX_wm_space_clip(const bContext *C);
+struct SpaceCollections *CTX_wm_space_collections(const bContext *C);
 
 void CTX_wm_manager_set(bContext *C, struct wmWindowManager *wm);
 void CTX_wm_window_set(bContext *C, struct wmWindow *win);
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 8025732efe..85fa57f788 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -815,6 +815,14 @@ struct SpaceClip *CTX_wm_space_clip(const bContext *C)
 	return NULL;
 }
 
+struct SpaceCollections *CTX_wm_space_collections(const bContext *C)
+{
+	ScrArea *sa = CTX_wm_area(C);
+	if (sa && sa->spacetype == SPACE_COLLECTIONS)
+		return sa->spacedata.first;
+	return NULL;
+}
+
 void CTX_wm_manager_set(bContext *C, wmWindowManager *wm)
 {
 	C->wm.manager = wm;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index cec886b4ce..90f7ddc5f6 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -103,6 +103,8 @@
 #include "DNA_movieclip_types.h"
 #include "DNA_mask_types.h"
 
+#include "RNA_access.h"
+
 #include "MEM_guardedalloc.h"
 
 #include "BLI_endian_switch.h"
@@ -6552,6 +6554,10 @@ static void lib_link_screen(FileData *fd, Main *main)
 						
 						slogic->gpd = newlibadr_us(fd, sc->id.lib, slogic->gpd);
 					}
+					else if (sl->spacetype == SPACE_COLLECTIONS) {
+						SpaceCollections *slayer = (SpaceCollections *)sl;
+						slayer->flag |= SC_COLLECTION_DATA_REFRESH;
+					}
 				}
 			}
 			sc->id.tag &= ~LIB_TAG_NEED_LINK;
@@ -6937,6 +6943,10 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
 					
 					slogic->gpd = restore_pointer_by_name(id_map, (ID *)slogic->gpd, USER_REAL);
 				}
+				else if (sl->spacetype == SPACE_COLLECTIONS) {
+					SpaceCollections *slayer = (SpaceCollections *)sl;
+					slayer->flag |= SC_COLLECTION_DATA_REFRESH;
+				}
 			}
 		}
 	}
@@ -7331,6 +7341,10 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
 				sclip->scopes.track_preview = NULL;
 				sclip->scopes.ok = 0;
 			}
+			else if (sl->spacetype == SPACE_COLLECTIONS) {
+				SpaceCollections *slayer = (SpaceCollections *)sl;
+				slayer->flag |= SC_COLLECTION_DATA_REFRESH;
+			}
 		}
 		
 		BLI_listbase_clear(&sa->actionzones);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 1621bb7843..c22acf2f75 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -3200,6 +3200,9 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
 				else if (sl->spacetype == SPACE_INFO) {
 					writestruct(wd, DATA, SpaceInfo, 1, sl);
 				}
+				else if (sl->spacetype == SPACE_COLLECTIONS) {
+					writestruct(wd, DATA, SpaceCollections, 1, sl);
+				}
 
 				sl = sl->next;
 			}
diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt
index 1559512d71..7e804a5bbf 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -47,6 +47,7 @@ if(WITH_BLENDER)
 	add_subdirectory(space_graph)
 	add_subdirectory(space_image)
 	add_subdirectory(space_info)
+	add_subdirectory(space_collections)
 	add_subdirectory(space_logic)
 	add_subdirectory(space_nla)
 	add_subdirectory(space_node)
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index 35d38bf4ca..96532f748e 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -49,6 +49,7 @@ struct ColorManagedDisplaySettings;
 
 void fdrawline(float x1, float y1, float x2, float y2); /* DEPRECATED */
 void fdrawbox(float x1, float y1, float x2, float y2); /* DEPRECATED */
+void fdrawbox_filled(float x1, float y1, float x2, float y2);
 void sdrawline(int x1, int y1, int x2, int y2); /* DEPRECATED */
 void sdrawbox(int x1, int y1, int x2, int y2); /* DEPRECATED */
 
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 40112bc20f..c1c0463ee5 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -55,6 +55,7 @@ struct wmOperatorType;
 struct PointerRNA;
 struct PropertyRNA;
 struct EnumPropertyItem;
+struct LayerTree;
 
 /* object_edit.c */
 struct Object *ED_object_context(struct bContext *C);               /* context.object */
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index f5f66a07ae..01be63919b 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -162,6 +162,7 @@ int     ED_operator_image_active(struct bContext *C);
 int     ED_operator_nla_active(struct bContext *C);
 int     ED_operator_logic_active(struct bContext *C);
 int     ED_operator_info_active(struct bContext *C);
+int     ED_operator_collections_active(struct bContext *C);
 int     ED_operator_console_active(struct bContext *C);
 
 
diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h
index d268c578cf..b754e1ba20 100644
--- a/source/blender/editors/include/ED_space_api.h
+++ b/source/blender/editors/include/ED_space_api.h
@@ -58,6 +58,7 @@ void ED_spacetype_logic(void);
 void ED_spacetype_console(void);
 void ED_spacetype_userpref(void);
 void ED_spacetype_clip(void);
+void ED_spacetype_collections(void);
 
 /* calls for instancing and freeing spacetype static data 
  * called in WM_init_exit */
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index d48cfbee41..55f11b94eb 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -212,6 +212,9 @@ enum {
 	UI_BUT_ALIGN_STITCH_TOP  = (1 << 18),
 	UI_BUT_ALIGN_STITCH_LEFT = (1 << 19),
 	UI_BUT_ALIGN_ALL         = (UI_BUT_ALIGN | UI_BUT_ALIGN_STITCH_TOP | UI_BUT_ALIGN_STITCH_LEFT),
+
+	/* Another hack, in some rare cases we don't want any text margin */
+	UI_BUT_TEXT_NO_MARGIN    = (1 << 20),
 };
 
 /* scale fixed button widths by this to account for DPI */
diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h
index 945ac1b6db..f08c46af8a 100644
--- a/source/blender/editors/include/UI_interface_icons.h
+++ b/source/blender/editors/include/UI_interface_icons.h
@@ -83,5 +83,6 @@ struct PreviewImage *UI_icon_to_preview(int icon_id);
 
 int UI_rnaptr_icon_get(struct bContext *C, struct PointerRNA *ptr, int rnaicon, const bool big);
 int UI_idcode_icon_get(const int idcode);
+int UI_colorset_icon_get(const int set_idx);
 
 #endif /*  __UI_INTERFACE_ICONS_H__ */
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 0573e8d9c9..70bfd30c2d 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1385,6 +1385,14 @@ int UI_idcode_icon_get(const int idcode)
 	}
 }
 
+/**
+ * \param set_idx: A value from #rna_enum_color_sets_items.
+ */
+int UI_colorset_icon_get(const int set_idx)
+{
+	return (set_idx < 1) ? ICON_NONE : VICO_COLORSET_01_VEC - 1 + set_idx;
+}
+
 static void icon_draw_at_size(
         float x, float y, int icon_id, float aspect, float alpha,
         enum eIconSiz

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list