Custom data split normals are taking active object from the area even if the active object is overriden #106612
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#106612
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
Blender 3.5
Short description of error
Operators
customdata_custom_splitnormals_add
andcustomdata_custom_splitnormals_clear
if called from properties panel seem to take active object from currently active area even if youcontext.temp_override(object=obj)
orcontext.view_layer.objects.active = obj
to change active object which is counterintuitive and contradicts with how other operators active object override work.Found a workaround - if you
context.temp_override(area=None, object=obj)
it will take active object into account.Exact steps for others to reproduce the error
You need to overwrite "mesh".
I don't know why overriding the "area" removes the keyword "mesh".
@ideasman42 can you shed some light?
mesh.customdata_custom_splitnormals_add
andmesh.customdata_custom_splitnormals_clear
useED_mesh_context
to get the mesh to operate on, which first attempts to get the "mesh" from the current context. You should be able to override "mesh" to thebpy.types.Mesh
that you want to operate on to achieve your desired results.If there's no "mesh" in the current context, it falls back to getting the Object with
ED_object_active_context
which tries to get it from "object" if it exists (ED_object_context
) or then falls back to "active_object" if it exists (CTX_data_active_object
).There's basically no rhyme nor reason to how each operator gets what to operate on from the current context, some will prefer "object", some will prefer "active_object", some will get the active object directly from the "view_layer" or you might have something different like "mesh" in this case. You will have to look up the source code of the operator every time that you want to use a context override.
Thanks for the insight, never seen overriding
mesh
parameter before. Never thought there is such option because usuallymesh
is not an attribute of https://docs.blender.org/api/current/bpy.types.Context.htmlBut if you check it from the operator that was executed from properties panel it's indeed there.
https://docs.blender.org/api/current/bpy.context.html gives a more complete list of the context members that are available in different contexts.