[Bf-blender-cvs] [bcb56f09c98] asset-metadata: Show info report on successful asset creation

Julian Eisel noreply at git.blender.org
Sat Jul 4 15:16:41 CEST 2020


Commit: bcb56f09c9862a6fd4468ac5bc8276e2f2875cfb
Author: Julian Eisel
Date:   Sat Jul 4 15:04:58 2020 +0200
Branches: asset-metadata
https://developer.blender.org/rBbcb56f09c9862a6fd4468ac5bc8276e2f2875cfb

Show info report on successful asset creation

Also set fake-user for new asset data-block so it's not purged when closing the
file.

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

M	source/blender/editors/asset/asset_ops.c

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

diff --git a/source/blender/editors/asset/asset_ops.c b/source/blender/editors/asset/asset_ops.c
index 1ee5b876618..f78f8cc0d75 100644
--- a/source/blender/editors/asset/asset_ops.c
+++ b/source/blender/editors/asset/asset_ops.c
@@ -24,10 +24,10 @@
 #include "BKE_lib_id.h"
 #include "BKE_report.h"
 
-#include "ED_asset.h"
-
 #include "DNA_asset_types.h"
 
+#include "ED_asset.h"
+
 #include "RNA_access.h"
 #include "RNA_define.h"
 
@@ -62,6 +62,7 @@ static int asset_create_exec(bContext *C, wmOperator *op)
                 id->name);
     return OPERATOR_CANCELLED;
   }
+  id_fake_user_set(asset_id);
 
   asset_id->asset_data = BKE_asset_data_create();
   UI_id_icon_render(C, NULL, asset_id, true, false);
@@ -71,6 +72,8 @@ static int asset_create_exec(bContext *C, wmOperator *op)
   /* TODO generate default meta-data */
   /* TODO create asset in the asset DB, not in the local file. */
 
+  BKE_reportf(op->reports, RPT_INFO, "Asset '%s' created", asset_id->name + 2);
+
   WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
 
   return OPERATOR_FINISHED;



More information about the Bf-blender-cvs mailing list