[Bf-blender-cvs] [9c6eea60348] asset-browser-poselib: Pose asset operators: Check the type of the asset in the operator poll

Julian Eisel noreply at git.blender.org
Wed Mar 31 18:12:31 CEST 2021


Commit: 9c6eea6034869be035440849fc7d58ff89bd7333
Author: Julian Eisel
Date:   Wed Mar 31 18:11:00 2021 +0200
Branches: asset-browser-poselib
https://developer.blender.org/rB9c6eea6034869be035440849fc7d58ff89bd7333

Pose asset operators: Check the type of the asset in the operator poll

Check that the asset received from context actually is an action ID
asset.

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

M	source/blender/editors/armature/pose_lib_2.c

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

diff --git a/source/blender/editors/armature/pose_lib_2.c b/source/blender/editors/armature/pose_lib_2.c
index ff66f0cef44..cd4a23c9105 100644
--- a/source/blender/editors/armature/pose_lib_2.c
+++ b/source/blender/editors/armature/pose_lib_2.c
@@ -669,9 +669,10 @@ static bool poselib_asset_in_context(bContext *C)
   bool asset_handle_valid;
   /* Check whether the context provides the asset data needed to add a pose. */
   const AssetLibraryReference *asset_library = CTX_wm_asset_library(C);
-  CTX_wm_asset_handle(C, &asset_handle_valid);
+  AssetHandle asset_handle = CTX_wm_asset_handle(C, &asset_handle_valid);
 
-  return (asset_library != NULL) && asset_handle_valid;
+  return (asset_library != NULL) && asset_handle_valid &&
+         (asset_handle.file_data->blentype == ID_AC);
 }
 
 /* Poll callback for operators that require existing PoseLib data (with poses) to work. */



More information about the Bf-blender-cvs mailing list