Assets: Do Not Show Blank Read-Only Metadata #105812
No reviewers
Labels
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 project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#105812
Loading…
Reference in New Issue
No description provided.
Delete Branch "Harley/blender:AssetMetaReadOnly"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Do not show asset metadata "description", "license", "copyright", or
"author" if they are empty AND read-only, since they can't be edited
and contain no useful information to show.
No need to display these if they are both blank and read-only. This mostly allows the bundled assets to leave some items blank and not have them show up.
@ -749,2 +747,2 @@
layout.prop(asset_file_handle.asset_data, "copyright")
layout.prop(asset_file_handle.asset_data, "author")
# Don't show these if they are blank and read-only.
if asset_file_handle.asset_data.description or not asset_file_handle.asset_data.is_property_readonly("description"):
Maybe make the code more compact with:
e5cb86c6e6
to464b93aadc
@ -750,1 +747,3 @@
layout.prop(asset_file_handle.asset_data, "author")
asset_data = asset_file_handle.asset_data
# Do not show these fields if they are blank and read-only.
if asset_data.description or not asset_data.is_property_readonly("description"):
Would add a function to avoid duplication, give further info in a comment, and to make clear that each conditional follows the same logic:
464b93aadc
toc2cd2361d5
Yes, that is much nicer. Thanks!
@ -701,2 +701,4 @@
@staticmethod
def add_metadata_prop(layout, asset_data, propname):
Would move this into the
ASSETBROWSER_PT_metadata()
class, to keep the context more clear. Outside of that class a name likeadd_metadata_prop()
isn't very clear. (Also there's no point in@staticmethod
outside of a class).Coming to think of it,
metadata_prop()
is probably enough as a name.So, invocation would read
self.metadata_prop(layout, asset_data, "license")
then.@ -702,1 +702,4 @@
@staticmethod
def add_metadata_prop(layout, asset_data, propname):
# Only display properties that are either set or can be modified (i.e. the asset
This should use a Python
docstring
, like in my snippet.@ -748,3 +755,1 @@
layout.prop(asset_file_handle.asset_data, "license")
layout.prop(asset_file_handle.asset_data, "copyright")
layout.prop(asset_file_handle.asset_data, "author")
add_metadata_prop(layout, asset_file_handle.asset_data, "description")
Instead of repeating
asset_file_handle.asset_data
every time, just declare anasset_data
variable.c2cd2361d5
to7f930ac771
@JulianEisel - Sorry, but I somehow missed the notification of your last review comments. I actually thought this was all done.
Updated to include your required changes.