Fix: Missing node asset menu updates after mark asset #112743

Merged
Hans Goudey merged 5 commits from HooglyBoogly/blender:asset-mark-fix into main 2023-09-26 16:38:57 +02:00
Member

Use of node group assets relies on a few properties written to asset
meta-data for proper filtering of assets in menus (add modifier menu,
node add menu, 3D view menus for tools). Currently these meta-data
properties are written when updating their source properties and when
saving the file. That means they aren't written when marking a group
as an asset, which is necessary because the meta-data doesn't exist
before when the group isn't an asset. Currently users have to save the
file to update menus in this case, which isn't intuitive.

As a fix, call the function to write the meta-data when marking a
data-block as an asset.

Use of node group assets relies on a few properties written to asset meta-data for proper filtering of assets in menus (add modifier menu, node add menu, 3D view menus for tools). Currently these meta-data properties are written when updating their source properties and when saving the file. That means they *aren't* written when marking a group as an asset, which is necessary because the meta-data doesn't exist before when the group isn't an asset. Currently users have to save the file to update menus in this case, which isn't intuitive. As a fix, call the function to write the meta-data when marking a data-block as an asset.
Hans Goudey added 1 commit 2023-09-22 20:39:41 +02:00
944e997d2f Fix: Missing node asset menu updates after mark asset
Use of node group assets relies on a few properties written to asset
meta-data for proper filtering of assets in menus (add modifier menu,
node add menu, 3D view menus for tools). Currently these meta-data
properties are written when updating their source properties and when
saving the file. That means they *aren't* written when marking a group
as an asset, which is necessary because the meta-data doesn't exist
before when the group isn't an asset. Currently users have to save the
file to update menus in this case, which isn't intuitive.

As a fix, call the function to write the meta-data when marking a
data-block as an asset.
Hans Goudey requested review from Julian Eisel 2023-09-22 20:39:56 +02:00
Hans Goudey added this to the Pipeline, Assets & IO project 2023-09-22 20:40:22 +02:00
Julian Eisel reviewed 2023-09-25 18:18:15 +02:00
Julian Eisel left a comment
Member

Calling the pre_save_fn() is a bit weird here since this has little to do with saving. I would either rename it to something like ensure_metadata_fn() or add a new on_mark_asset_fn(). I think I prefer the second one, because the name contains important info this way.

Calling the `pre_save_fn()` is a bit weird here since this has little to do with saving. I would either rename it to something like `ensure_metadata_fn()` or add a new `on_mark_asset_fn()`. I think I prefer the second one, because the name contains important info this way.
Hans Goudey added 2 commits 2023-09-25 20:35:54 +02:00
Author
Member

I added a new on_mark_asset_fn function to the asset type info.

I also made the 3D view reset the asset tree caches when assets are removed or added.

I added a new `on_mark_asset_fn` function to the asset type info. I also made the 3D view reset the asset tree caches when assets are removed or added.
Julian Eisel reviewed 2023-09-26 11:56:42 +02:00
@ -26,6 +26,7 @@ struct IDProperty;
struct PreviewImage;
typedef void (*PreSaveFn)(void *asset_ptr, struct AssetMetaData *asset_data);
typedef void (*MarkAssetFn)(void *asset_ptr, struct AssetMetaData *asset_data);
Member

Should be OnMarkAssetFn (otherwise it says this is what marks the asset).

Should be `OnMarkAssetFn` (otherwise it says this is what marks the asset).
HooglyBoogly marked this conversation as resolved
@ -1127,10 +1127,16 @@ static void node_tree_asset_pre_save(void *asset_ptr, AssetMetaData * /*asset_da
node_update_asset_metadata(*static_cast<bNodeTree *>(asset_ptr));
}
static void node_tree_asset_mark_asset(void *asset_ptr, AssetMetaData * /*asset_data*/)
Member

node_tree_asset_on_mark_asset()

`node_tree_asset_on_mark_asset()`
HooglyBoogly marked this conversation as resolved
Hans Goudey added 2 commits 2023-09-26 14:15:18 +02:00
Julian Eisel approved these changes 2023-09-26 15:47:27 +02:00
Hans Goudey merged commit 395f279166 into main 2023-09-26 16:38:57 +02:00
Hans Goudey deleted branch asset-mark-fix 2023-09-26 16:38:58 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#112743
No description provided.