Mesh: Move vertex/edge crease to generic attributes #108089
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#108089
Loading…
Reference in New Issue
No description provided.
Delete Branch "HooglyBoogly/blender:refactor-mesh-crease-generic"
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?
Store subdivion surface creases in two new named float attributes:
crease_vert
crease_edge
The attributes are naming conventions, so their data type and domain
aren't enforced, and may be interpolated when necessary. Editing tools
and the subdivision surface modifier use the hard-coded name. It might
be best if these were edited as generic attributes in the future, but
in the meantime using generic attributes helps.
The attributes are visible in the list, which is how they're now meant
to be removed. They are now interchangeable with any tool that works
with the generic attribute system-- even tools like vertex paint can
affect creases now.
This is a breaking change. Forward compatibility isn't preserved, and
the
crease
property in RNA is removed in favor of making a smallerAPI surface area with just the attribute API.
Mesh.vertex_creases
and
Mesh.edge_creases
now just return the matching attribute ifpossible, and are now implemented in Python.
A few extrude node test files have to be updated because of different
(now generic) attribute interpolation behavior.
Move face...👀
I think we should definitely keep
vertex_creases
andedge_creases
. Such properties are more discoverable in the API docs, and give clear errors where string lookups in attributes do not. And maybe also avoid users have to write validation to ensure the attribute has the right domain?Personally I would keep
crease
too, but care less about that one.What do you think about implementing these and similar attributes in Python, in
scripts/modules/bpy_types.py
? That way we can simplify the RNA code.That's a great idea! And I agree it helps to document these things, especially since they're used for such a common use cases.
I add the properties back, defined in Python. Like before, you can't add or remove the attribute with the property, but I think it's fine to require the attribute API for that (before I think the recommended way was the operators).
@ -600,0 +627,4 @@
return None
return creases
except KeyError:
return None
If we are going to do this for more attributes, a utility function to implement this would be nice:
Otherwise looks fine.
I think we also need functions to add/remove creases, since the operators for doing that were removed. Implementing this correctly is non-trivial when the attribute exists on the wrong domain, and add-ons are likely to get it wrong when we don't provide the functionality ourselves.
Good ideas, thanks!
@ -523,6 +523,36 @@ def ord_ind(i1, i2):
return i2, i1
def name_convention_attribute_get(attributes, name, domain, data_type):
Should prefix with
_
to mark it private.