Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2021-07-13 19:07:57 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-07-15 17:12:36 +0300
commit8925d3b7bf989e1db364d989fbd0c6cdb9a2acdb (patch)
treeaaf7c43ee885ce4be384002cc59dcfadd8689541 /source/blender/makesrna/RNA_enum_types.h
parent6bd42baaebac3255082eb46884bdd3e27361c135 (diff)
UI/Assets: Initial Asset View UI template
The asset view UI template is a mini-version of the Asset Browser that can be placed in regular layouts, regions or popups. At this point it's made specifically for placement in vertical layouts, it can be made more flexible in the future. Generally the way this is implemented will likely change a lot still as the asset system evolves. The Pose Library add-on will use the asset view to display pose libraries in the 3D View sidebar. References: * https://developer.blender.org/T86139 * https://code.blender.org/2021/06/asset-browser-project-update/#what-are-we-building * https://code.blender.org/2021/05/pose-library-v2-0/#use-from-3d-viewport Notes: * Important limitation: Due to the early & WIP implementation of the asset list, all asset views showing the same library will show the same assets. That is despite the ID type filter option the template provides. The first asset view created will determine what's visible. Of course this should be made to work eventually. * The template supports passing an activate and a drag operator name. The former is called when an asset is clicked on (e.g. to apply the asset) the latter when dragging (e.g. to .blend a pose asset). If no drag operator is set, regular asset drag & drop will be executed. * The template returns the properties for both operators (see example below). * The argument list for using the template is quite long, but we can't avoid that currently. The UI list design requires that we pass a number of RNA or custom properties to work with, that for the Pose Libraries should be registered at the Pose Library add-on level, not in core Blender. * Idea is that Python scripts or add-ons that want to use the asset view can register custom properties, to hold data like the list of assets, and the active asset index. Maybe that will change in future and we can manage these internally. As an example, the pose library add-on uses it like this: ``` activate_op_props, drag_op_props = layout.template_asset_view( "pose_assets", workspace, "active_asset_library", wm, "pose_assets", workspace, "active_pose_asset_index", filter_id_types={"filter_action"}, activate_operator="poselib.apply_pose_asset", drag_operator="poselib.blend_pose_asset", ) drag_op_props.release_confirm = True drag_op_props.flipped = wm.poselib_flipped activate_op_props.flipped = wm.poselib_flipped ```
Diffstat (limited to 'source/blender/makesrna/RNA_enum_types.h')
-rw-r--r--source/blender/makesrna/RNA_enum_types.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index c8010a0e1ae..d544083a749 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -245,6 +245,22 @@ extern const EnumPropertyItem *rna_enum_attribute_domain_itemf(struct ID *id, bo
extern const EnumPropertyItem rna_enum_collection_color_items[];
+/**
+ * For ID filters (#FILTER_ID_AC, #FILTER_ID_AR, ...) an int isn't enough. This version allows 64
+ * bit integers. So can't use the regular #EnumPropertyItem. Would be nice if RNA supported this
+ * itself.
+ *
+ * Meant to be used with #RNA_def_property_boolean_sdna() which supports 64 bit flags as well.
+ */
+struct IDFilterEnumPropertyItem {
+ const uint64_t flag;
+ const char *identifier;
+ const int icon;
+ const char *name;
+ const char *description;
+};
+extern const struct IDFilterEnumPropertyItem rna_enum_id_type_filter_items[];
+
/* API calls */
int rna_node_tree_type_to_enum(struct bNodeTreeType *typeinfo);
int rna_node_tree_idname_to_enum(const char *idname);