Fix #113255: LineStyle modifiers cannot be accessed by name anymore #113290
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#113290
Loading…
Reference in New Issue
No description provided.
Delete Branch "lichtwerk/blender:113255"
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?
Caused by
6a49041be3
.Above commit checks an existing nameproperty for collection items, but
it does so in a way that it only checks the "parent" type. If these are
"subclassed" though, we might not have the nameproperty defined on the
"parent" class (but on the subclass instead).
Code would then error out with e.g. "FreestyleLineStyle.color_modifiers
does not support string lookups".
In the case of the report the following happened.
LineStyleModifier
) can be any of:--
color_modifiers
/LineStyleColorModifier
--
alpha_modifiers
/LineStyleAlphaModifier
--
thickness_modifiers
/LineStyleThicknessModifier
--
geometry_modifiers
/LineStyleGeometryModifier
But all of the above have subtypes, e.g.
LineStyleColorModifier_AlongStroke
,LineStyleColorModifier_DistanceFromCamera
, ...Currently, the
nameproperty
is not defined e.g. on theLineStyleColorModifier
(but instead on the subtypes).Prior to
6a49041be3
(withoutRNA_property_collection_lookup_string_has_nameprop
in place),pyrna_prop_collection_subscript_str
could still actually find thenameprop because it iterates into the collection and got it on the
actual Item (
LineStyleColorModifier_DistanceFromCamera
instead ofLineStyleColorModifier
).So while it might be possible to refine
RNA_property_collection_lookup_string_has_nameprop
to descend intosubclasses (I didnt find an obvious way though other than scanning all
existing modifiers [not modifier types -- we would need a way to find
all types that inherit from e.g.
LineStyleColorModifier
] which kind ofdefeats the purpose of checking this early), this PR moves the name
definition from the subclass to the parent class (so way from
rna_def_modifier_type_common
) -- and this way,RNA_property_collection_lookup_string_has_nameprop
can properly pickup the nameprop. It does a bit of code duplication though.
At first it seemed like this should be able to use a single name property, although having to select the listbase to use makes this unnecessarily awkward (attached patch for reference), we could also have a unique naming function that doesn't require the listbase, but the advantages are minimal.
So this PR looks like the way to go.