[Bf-blender-cvs] [dce7e076dae] asset-engine: Amber: add new assets with relative path to repo, fix a bug in asset listing when path was aboslute.

Bastien Montagne noreply at git.blender.org
Fri Oct 27 12:22:23 CEST 2017


Commit: dce7e076dae9dae9d88d232300ac6c30e02f08c3
Author: Bastien Montagne
Date:   Thu Oct 26 10:01:31 2017 +0200
Branches: asset-engine
https://developer.blender.org/rBdce7e076dae9dae9d88d232300ac6c30e02f08c3

Amber: add new assets with relative path to repo, fix a bug in asset listing when path was aboslute.

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

M	release/scripts/startup/bl_operators/amber/engine.py
M	release/scripts/startup/bl_operators/amber/operators.py

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

diff --git a/release/scripts/startup/bl_operators/amber/engine.py b/release/scripts/startup/bl_operators/amber/engine.py
index 6c28fd68ee5..b06d773a255 100644
--- a/release/scripts/startup/bl_operators/amber/engine.py
+++ b/release/scripts/startup/bl_operators/amber/engine.py
@@ -323,7 +323,7 @@ class AssetEngineAmber(AssetEngine):
         variants_gen(entry, e, vuuid, ruuid, wuuid)
 
         if act_view:
-            entry.relpath = act_view.path
+            entry.relpath = os.path.relpath(act_view.path, self.repository.path)
 #        print("added entry for", entry.relpath)
 
     def pretty_version(self, v=None):
diff --git a/release/scripts/startup/bl_operators/amber/operators.py b/release/scripts/startup/bl_operators/amber/operators.py
index dd24f8bbfd1..541a350fe22 100644
--- a/release/scripts/startup/bl_operators/amber/operators.py
+++ b/release/scripts/startup/bl_operators/amber/operators.py
@@ -217,7 +217,7 @@ class AmberOpsAssetAdd(Operator, AmberOpsEditing):
                     os.mkdir(path_dir)
                 path_preview = os.path.join(path_dir, asset.name + "_" + utils.uuid_pack(asset.uuid) + ".dat")
                 utils.preview_write_dat(path_preview, w, h, datablock.preview.image_pixels)
-                asset.preview_path = path_preview
+                asset.preview_path = os.path.relpath(path_preview, repository.path)
 
         if self.copy_local:
             path_dir = os.path.join(repository.path, utils.AMBER_LOCAL_STORAGE)
@@ -240,7 +240,7 @@ class AmberOpsAssetAdd(Operator, AmberOpsEditing):
         view.name = "default"
         view.size = os.stat(path_lib).st_size
         view.timestamp = revision.timestamp
-        view.path = os.path.join(path_lib, path_sublib)
+        view.path = os.path.relpath(os.path.join(path_lib, path_sublib), repository.path)
         view.uuid = utils.uuid_view_gen(set(), revision.uuid, view.name, view.size, view.timestamp)
         revision.view_default = view.uuid



More information about the Bf-blender-cvs mailing list