Collection Export: Allow renaming of exporters in the UI list #125553
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#125553
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "deadpin/blender:collexport-renaming"
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?
Allow the user to rename their collection exporters.
8709203920
tocd5aea6191
I would rather move the logic in
rna_CollectionExport_friendly_name
into the CollectionExporter code (akacollection_exporter_add_exec
). that way, the name is defined as part of creation process, instead of using some random accessor code. ;)Then you can probably get rid of all RNA callbacks for this property, since it becomes just a standard DNA-defined fixed-size char buffer.
There is also the question of whether this name should be unique or not? I would say yes, since that allows to reference the collection exporters data by their name. Just like we do e.g. with constraints or modifiers (and of course IDs themselves).
The following may be going out of scope for this PR, and could be addressed separately. But I think it would be good to also move the core creation code of
CollectionExporter
into BKE code (there is already aBKE_collection_exporter_free_data
there). That way, other areas of code can easily create this data (thinking mainly about a RNA API to create and remove these exporters).Fair feedback, thanks! I did leave the RNA setter because I need to prevent assignment of completely empty names as that seems like something reasonable to do. I'll keep the last part of the feedback in mind if/when more changes in the area occur.
Would suggest adding a
BKE_collection_exporter_name_set
function, and call it from the everywhere (doversion, add operator, name set RNA callback)? Avoids duplicating the same logic everywhere, with the usual risk of getting it out of sync at some point in the future.@ -4448,0 +4454,4 @@
LISTBASE_FOREACH (Collection *, collection, &bmain->collections) {
ListBase *exporters = &collection->exporters;
LISTBASE_FOREACH (CollectionExport *, data, exporters) {
if (data->name[0] == '\0') {
You need to call
BLI_uniquename
here too, even if the name is not emptyThe lastest commit now calls
BLI_uniquename
as part of the processing but I think the check for data->name being empty is fine? This should only be the case during versioning unless I'm missing a scenario perhaps?Hmmm in fact since you are bumping subversion number, I think you can drop the
if
block and replace it by an assert that the name is empty?@ -475,1 +459,3 @@
return strlen(value);
/* Only set the name if it's not empty. */
if (value[0] != '\0') {
STRNCPY(data->name, value);
You need to call
BLI_uniquename
here as well.LGTM now, added some notes below, don't think it needs further review once they are addressed.
@ -516,6 +517,18 @@ void BKE_collection_free_data(Collection *collection)
collection_free_data(&collection->id);
}
void BKE_collection_exporter_name_set(CollectionExport *data, const char *newname)
Doing a pointer look up in the listbase is not really expensive, especially when the list is expected to be small, but I would pass the owner listbase as a parameter here (handling cases where it's
nullptr
). Calling code knows it in two cases over three already, and hopefully once #122431 is finished the RNA code will have access to this info too.@blender-bot build