[Bf-blender-cvs] [bd0e78b] asset-engine: Add needed asset-related data to Library and ID structs.

Bastien Montagne noreply at git.blender.org
Tue May 26 21:18:53 CEST 2015


Commit: bd0e78bb23af93b6894988d8d5e9471b491aab88
Author: Bastien Montagne
Date:   Tue May 26 20:47:43 2015 +0200
Branches: asset-engine
https://developer.blender.org/rBbd0e78bb23af93b6894988d8d5e9471b491aab88

Add needed asset-related data to Library and ID structs.

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

M	source/blender/makesdna/DNA_ID.h
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/windowmanager/intern/wm_operators.c

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

diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 6d2d5b0..8bf05e7 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -106,6 +106,25 @@ enum {
 
 /* add any future new id property types here.*/
 
+/* About Unique identifier.
+ * Each engine is free to use it as it likes - it will be the only thing passed to it by blender to identify
+ * asset/variant/version (concatenating the three into a single 48 bytes one).
+ * Assumed to be 128bits, handled as four integers due to lack of real bytes proptype in RNA :|.
+ */
+#define ASSET_UUID_LENGTH     16
+
+/* Used to communicate with asset engines outside of 'import' context. */
+typedef struct AssetUUID {
+	int uuid_asset[4];
+	int uuid_variant[4];
+	int uuid_revision[4];
+} AssetUUID;
+
+typedef struct AssetUUIDList {
+	AssetUUID *uuids;
+	int nbr_uuids, pad;
+} AssetUUIDList;
+
 /* watch it: Sequence has identical beginning. */
 /**
  * ID is the first thing included in all serializable types. It
@@ -130,6 +149,8 @@ typedef struct ID {
 	int us;
 	int icon_id, pad2;
 	IDProperty *properties;
+
+	AssetUUID *uuid;
 } ID;
 
 /**
@@ -140,7 +161,9 @@ typedef struct Library {
 	ID id;
 	ID *idblock;
 	struct FileData *filedata;
-	char name[1024];  /* path name used for reading, can be relative and edited in the outliner */
+	/* path name used for reading, can be relative and edited in the outliner.
+     * In case it's an asset engine, it's path to aset engine 'root' (meaning depends on asset engine). */
+	char name[1024];
 
 	/* absolute filepath, this is only for convenience, 'name' is the real path used on file read but in
 	 * some cases its useful to access the absolute one.
@@ -151,6 +174,10 @@ typedef struct Library {
 	struct Library *parent;	/* set for indirectly linked libs, used in the outliner and while reading */
 	
 	struct PackedFile *packedfile;
+
+	char asset_engine[64];  /* MAX_ST_NAME */
+	int asset_engine_version;
+	int pad_i1;
 } Library;
 
 enum eIconSizes {
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 4a4a604..976e80a 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -750,26 +750,6 @@ typedef enum eDirEntry_SelectFlag {
 
 /* ***** Related to file browser, but never saved in DNA, only here to help with RNA. ***** */
 
-/* About Unique identifier.
- * Stored in a CustomProps once imported.
- * Each engine is free to use it as it likes - it will be the only thing passed to it by blender to identify
- * asset/variant/version (concatenating the three into a single 48 bytes one).
- * Assumed to be 128bits, handled as four integers due to lack of real bytes proptype in RNA :|.
- */
-#define ASSET_UUID_LENGTH     16
-
-/* Used to communicate with asset engines outside of 'import' context. */
-typedef struct AssetUUID {
-	int uuid_asset[4];
-	int uuid_variant[4];
-	int uuid_revision[4];
-} AssetUUID;
-
-typedef struct AssetUUIDList {
-	AssetUUID *uuids;
-	int nbr_uuids, pad;
-} AssetUUIDList;
-
 /* Container for a revision, only relevant in asset context. */
 typedef struct FileDirEntryRevision {
 	struct FileDirEntryRevision *next, *prev;
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index e0873e5..9c40c69 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -69,7 +69,13 @@
 
 #include "BLO_readfile.h"
 
+#include "RNA_access.h"
+#include "RNA_define.h"
+#include "RNA_types.h"
+#include "RNA_enum_types.h"
+
 #include "BKE_appdir.h"
+#include "BKE_asset.h"
 #include "BKE_autoexec.h"
 #include "BKE_blender.h"
 #include "BKE_brush.h"
@@ -106,10 +112,6 @@
 
 #include "GPU_material.h"
 
-#include "RNA_access.h"
-#include "RNA_define.h"
-#include "RNA_enum_types.h"
-
 #include "UI_interface.h"
 #include "UI_interface_icons.h"
 #include "UI_resources.h"
@@ -2845,6 +2847,10 @@ static void wm_link_append_properties_common(wmOperatorType *ot, bool is_link)
 
 	/* better not save _any_ settings for this operator */
 	/* properties */
+	prop = RNA_def_string(ot->srna, "asset_engine", NULL, sizeof(((AssetEngineType *)NULL)->idname),
+	                      "Asset Engine", "Asset engine identifier used to append/link the data");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN);
+
 	prop = RNA_def_boolean(ot->srna, "link", is_link,
 	                       "Link", "Link the objects or datablocks rather than appending");
 	RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN);




More information about the Bf-blender-cvs mailing list