[Bf-blender-cvs] [8124e69] asset-experiments: Backport some changes from asset-engine branch:

Bastien Montagne noreply at git.blender.org
Wed Apr 15 16:42:02 CEST 2015


Commit: 8124e69a91909d72f28de465f87c8901d94d36bf
Author: Bastien Montagne
Date:   Wed Apr 15 16:40:52 2015 +0200
Branches: asset-experiments
https://developer.blender.org/rB8124e69a91909d72f28de465f87c8901d94d36bf

Backport some changes from asset-engine branch:

* uuids as int[4] instead of char[16];
* move use_library_browsing to params instead of spacefile.

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

M	release/scripts/startup/bl_ui/space_filebrowser.py
M	source/blender/editors/space_file/filelist.c
M	source/blender/editors/space_file/filelist.h
M	source/blender/editors/space_file/filesel.c
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py
index cc13419..78a2def 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -26,11 +26,8 @@ class FILEBROWSER_HT_header(Header):
 
     def draw(self, context):
         layout = self.layout
-
         st = context.space_data
 
-        is_lib_browser = st.use_library_browsing
-
         layout.template_header()
 
         row = layout.row()
@@ -54,6 +51,8 @@ class FILEBROWSER_HT_header(Header):
 
         # can be None when save/reload with a file selector open
         if params:
+            is_lib_browser = params.use_library_browsing
+
             layout.prop(params, "display_type", expand=True, text="")
             layout.prop(params, "sort_method", expand=True, text="")
 
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index f675c96..cd02567 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1172,7 +1172,7 @@ static void filelist_cache_init(FileListEntryCache *cache)
 	cache->misc_cursor = 0;
 
 	/* XXX This assumes uint is 32 bits and uuid is 128 bits (char[16]), be careful! */
-	cache->uuids = BLI_ghash_new_ex(BLI_ghashutil_uinthash_v4, BLI_ghashutil_uinthash_v4_cmp,
+	cache->uuids = BLI_ghash_new_ex(BLI_ghashutil_uinthash_v4_p, BLI_ghashutil_uinthash_v4_cmp,
 	                                __func__, FILELIST_ENTRYCACHESIZE * 2);
 }
 
@@ -1484,7 +1484,7 @@ int filelist_file_findpath(struct FileList *filelist, const char *filename)
 	return -1;
 }
 
-FileDirEntry *filelist_entry_find_uuid(struct FileList *filelist, const char uuid[ASSET_UUID_LENGTH])
+FileDirEntry *filelist_entry_find_uuid(struct FileList *filelist, const int uuid[4])
 {
 	if (filelist->filelist.nbr_entries_filtered < 0) {
 		return NULL;
diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h
index e76616b..5d025fe 100644
--- a/source/blender/editors/space_file/filelist.h
+++ b/source/blender/editors/space_file/filelist.h
@@ -92,7 +92,7 @@ int                 filelist_empty(struct FileList *filelist);
 int                 filelist_numfiles(struct FileList *filelist);
 FileDirEntry *      filelist_file(struct FileList *filelist, int index);
 int                 filelist_file_findpath(struct FileList *filelist, const char *file);
-FileDirEntry *      filelist_entry_find_uuid(struct FileList *filelist, const char uuid[ASSET_UUID_LENGTH]);
+FileDirEntry *      filelist_entry_find_uuid(struct FileList *filelist, const int uuid[4]);
 bool                filelist_file_cache_block(struct FileList *filelist, const int index);
 
 bool                filelist_force_reset(struct FileList *filelist);
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index d665542..83d26c0 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -483,13 +483,14 @@ float file_font_pointsize(void)
 static void column_widths(struct FileList *files, struct FileLayout *layout)
 {
 	int i;
-	int numfiles = filelist_numfiles(files);
 
 	for (i = 0; i < MAX_FILE_COLUMN; ++i) {
 		layout->column_widths[i] = 0;
 	}
 
 #if 0
+	{
+	int numfiles = filelist_numfiles(files);
 	for (i = 0; (i < numfiles); ++i) {
 		FileDirEntry *file = filelist_file(files, i);
 		if (file) {
@@ -512,7 +513,9 @@ static void column_widths(struct FileList *files, struct FileLayout *layout)
 			if (len > layout->column_widths[COLUMN_OWNER]) layout->column_widths[COLUMN_OWNER] = len;
 		}
 	}
+	}
 #else
+	UNUSED_VARS(files);
 	{
 		/* Biggest possible reasonable values...
 		 * TODO: better ways to get those! */
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 425eb69..d5c4ad5 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -743,14 +743,15 @@ typedef enum eDirEntry_SelectFlag {
 
 /* ***** Related to file browser, but never saved in DNA, only here to help with RNA. ***** */
 
-/* Be careful, we assume uuid is 128 bits (char[16]) in a few places, like uuids ghash in filecache of filebrowser. */
+/* Be careful, we assume uuid is 128 bits (char[16]) in a few places, like uuids ghash in filecache of filebrowser,
+ * or current int_32[4] representation in RNA... */
 #define ASSET_UUID_LENGTH     16
 
 /* Used to communicate with asset engines outside of 'import' context. */
 typedef struct AssetUUID {
-	char uuid_asset[16];     /* ASSET_UUID_LENGTH */
-	char uuid_variant[16];   /* ASSET_UUID_LENGTH */
-	char uuid_revision[16];  /* ASSET_UUID_LENGTH */
+	int uuid_asset[4];
+	int uuid_variant[4];
+	int uuid_revision[4];
 } AssetUUID;
 
 typedef struct AssetUUIDList {
@@ -766,7 +767,7 @@ typedef struct FileDirEntryRevision {
 	 * asset/variant/version (concatenating the three into a single 72 bytes one).
 	 * Handled as bytes, **but** NULL-terminated (because of RNA).
 	 */
-	char uuid[16];  /* ASSET_UUID_LENGTH */
+	int uuid[4];
 
 	char *comment;
 
@@ -793,7 +794,7 @@ typedef struct FileDirEntryVariant {
 	 * asset/variant/version (concatenating the three into a single 72 bytes one).
 	 * Handled as bytes, **but** NULL-terminated (because of RNA).
 	 */
-	char uuid[16];  /* ASSET_UUID_LENGTH */
+	int uuid[4];
 
 	char *name;
 	char *description;
@@ -811,7 +812,7 @@ typedef struct FileDirEntry {
 	 * asset/variant/version (concatenating the three into a single 72 bytes one).
 	 * Handled as bytes, **but** NULL-terminated (because of RNA).
 	 */
-	char uuid[16];  /* ASSET_UUID_LENGTH */
+	int uuid[4];
 
 	char *name;
 	char *description;
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 7387eee..7cba2d7 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1472,15 +1472,15 @@ static void rna_SpaceClipEditor_view_type_update(Main *UNUSED(bmain), Scene *UNU
 	ED_area_tag_refresh(sa);
 }
 
-static int rna_SpaceFileBrowser_use_lib_get(PointerRNA *ptr)
+/* File browser. */
+
+static int rna_FileSelectParams_use_lib_get(PointerRNA *ptr)
 {
-	SpaceFile *sf = ptr->data;
+	FileSelectParams *params = ptr->data;
 
-	return sf->params && (sf->params->type == FILE_LOADLIB);
+	return params && (params->type == FILE_LOADLIB);
 }
 
-/* File browser. */
-
 static void rna_FileBrowser_FSMenuEntry_path_get(PointerRNA *ptr, char *value)
 {
 	char *path = ED_fsmenu_entry_get_path(ptr->data);
@@ -3650,33 +3650,33 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
 	};
 
 	static EnumPropertyItem file_filter_idtypes_items[] = {
-		{FILTER_ID_AC, "FILTER_ID_AC", ICON_ANIM_DATA, "Actions", "Show/hide Action datablocks"},
-		{FILTER_ID_AR, "FILTER_ID_AR", ICON_ARMATURE_DATA, "Armatures", "Show/hide Armature datablocks"},
-		{FILTER_ID_BR, "FILTER_ID_BR", ICON_BRUSH_DATA, "Brushes", "Show/hide Brushe datablocks"},
-		{FILTER_ID_CA, "FILTER_ID_CA", ICON_CAMERA_DATA, "Cameras", "Show/hide Camera datablocks"},
-		{FILTER_ID_CU, "FILTER_ID_CU", ICON_CURVE_DATA, "Curves", "Show/hide Curve datablocks"},
-		{FILTER_ID_GD, "FILTER_ID_GD", ICON_GREASEPENCIL, "Grease Pencil", "Show/hide Grease pencil datablocks"},
-		{FILTER_ID_GR, "FILTER_ID_GR", ICON_GROUP, "Groups", "Show/hide Group datablocks"},
-		{FILTER_ID_IM, "FILTER_ID_IM", ICON_IMAGE_DATA, "Images", "Show/hide Image datablocks"},
-		{FILTER_ID_LA, "FILTER_ID_LA", ICON_LAMP_DATA, "Lamps", "Show/hide Lamp datablocks"},
-		{FILTER_ID_LS, "FILTER_ID_LS", ICON_LINE_DATA, "Freestyle Linestyles", "Show/hide Freestyle's Line Style datablocks"},
-		{FILTER_ID_LT, "FILTER_ID_LT", ICON_LATTICE_DATA, "Lattices", "Show/hide Lattice datablocks"},
-		{FILTER_ID_MA, "FILTER_ID_MA", ICON_MATERIAL_DATA, "Materials", "Show/hide Material datablocks"},
-		{FILTER_ID_MB, "FILTER_ID_MB", ICON_META_DATA, "Metaballs", "Show/hide Mateball datablocks"},
-		{FILTER_ID_MC, "FILTER_ID_MC", ICON_CLIP, "Movie Clips", "Show/hide Movie Clip datablocks"},
-		{FILTER_ID_ME, "FILTER_ID_ME", ICON_MESH_DATA, "Meshes", "Show/hide Mesh datablocks"},
-		{FILTER_ID_MSK, "FILTER_ID_MSK", ICON_MOD_MASK, "Masks", "Show/hide Mask datablocks"},
-		{FILTER_ID_NT, "FILTER_ID_NT", ICON_NODETREE, "Node Trees", "Show/hide Node Tree datablocks"},
-		{FILTER_ID_OB, "FILTER_ID_OB", ICON_OBJECT_DATA, "Objects", "Show/hide Object datablocks"},
-		{FILTER_ID_PAL, "FILTER_ID_PAL", ICON_COLOR, "Palettes", "Show/hide Palette datablocks"},
-		{FILTER_ID_PC, "FILTER_ID_PC", ICON_CURVE_BEZCURVE, "Paint Curves", "Show/hide Paint Curve datablocks"},
-		{FILTER_ID_SCE, "FILTER_ID_SCE", ICON_SCENE_DATA, "Scenes", "Show/hide Scene datablocks"},
-		{FILTER_ID_SPK, "FILTER_ID_SPK", ICON_SPEAKER, "Speakers", "Show/hide Speaker datablocks"},
-		{FILTER_ID_SO, "FILTER_ID_SO", ICON_SOUND, "Sounds", "Show/hide Sound datablocks"},
-		{FILTER_ID_TE, "FILTER_ID_TE", ICON_TEXTURE_DATA, "Textures", "Show/hide Texture datablocks"},
-		{FILTER_ID_TXT, "FILTER_ID_TXT", ICON_TEXT, "Texts", "Show/hide Text datablocks"},
-		{FILTER_ID_VF, "FILTER_ID_VF", ICON_FONT_DATA, "Fonts", "Show/hide Font datablocks"},
-		{FILTER_ID_WO, "FILTER_ID_WO", ICON_WORLD_DATA, "Worlds", "Show/hide World datablocks"},
+		{FILTER_ID_AC, "ACTION", ICON_ANIM_DATA, "Actions", "Show/hide Action datablocks"},
+		{FILTER_ID_AR, "ARMATURE", ICON_ARMATURE_DATA, "Armatures", "Show/hide Armature datablocks"},
+		{FILTER_ID_BR, "BRUSH", ICON_BRUSH_DATA, "Brushes", "Show/hide Brushe datablocks"},
+		{FILTER_ID_CA, "CAMERA", ICON_CAMERA_DATA, "Cameras", "Show/hide Camera datablocks"},
+		{FILTER_ID_CU, "CURVE", ICON_CURVE_DATA, "Curves", "Show/hide Curve datablocks"},
+		{FILTER_ID_GD, "GREASE_PENCIL", ICON_GREASEPENCIL, "Grease Pencil", "Show/hide Grease pencil datablocks"},
+		{FILTER_ID_GR, "GROUP", ICON_GROUP, "Groups", "Show/hide Group datablocks"},
+		{FILTER_ID_IM, "IMAGE", ICON_IMAGE_DATA, "Images", "Show/hide Image datablocks"},
+		{FILTER_ID_LA, "LAMP", ICON_LAMP_DATA, "Lamps", "Show/hide Lamp datablocks"},
+		{FILTER_ID_LS, "LINESTYLE", ICON_L

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list