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
AgeCommit message (Collapse)Author
2021-07-20Fix memory leak with asset view template operator propertiesJulian Eisel
2021-07-20Cleanup: Fix missing braces warning on ClangAnkit Meel
2021-07-15Cleanup: Clang tidyHans Goudey
2021-07-15Cleanup: Remove use of designated initializers in C++ codeHans Goudey
Does not compile on Windows.
2021-07-15Cleanup: Move UI list template code to own file (C++)Julian Eisel
This move was already prepared with 788d38046032 and 26b098c04fbe. The template is quite big already, better to give it its own file. Plus it could use some C++ features like RAII and maybe some more object oriented code. I plan further refactoring there.
2021-07-15UI/Assets: Initial Asset View UI templateJulian Eisel
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 ```
2021-07-15UI: Support defining UI lists in CJulian Eisel
So far all UI lists had to be defined in Python, this makes it possible to define them in C as well. Note that there is a whole bunch of special handling for the Python API that isn't there for C. I think most importantly custom properties support, which currently can't be added for C defined UI lists. The upcoming asset view UI template will use this, which needs to be defined in C. Adds a new file `interface_template_list.cc`, which at this point is mostly a dummy to have a place for the `ED_uilisttypes_ui()` definition. I plan a separate cleanup to move the UI-list template to that file.