Fix #119030: Only access Location node input when available #119354
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#119354
Loading…
Reference in New Issue
No description provided.
Delete Branch "deadpin/blender:fix119030-nodelookup"
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?
Our
node_shader_utils.py
module needs to be updated to account for APIchanges made during the 4.0 release cycle [1].
Here we need to guard against accessing the "Location" node input if not
dealing with the appropriate type of Mapping node.
[1]
e4ad58114b
@ -799,3 +799,3 @@
def translation_get(self):
if self.node_mapping is None:
if self.node_mapping is None or self.node_mapping.vector_type not in ('POINT', 'TEXTURE'):
.__contains__
also respects input/output availability, so I think it would be more robust to usethan checking for specific
vector_type
values.@JacquesLucke How do you feel about the fix here? It handles the problem at the common api location, to mimic the prior behavior, rather than the downstream call site.
LGTM.
This patch will fix the reported issue, but I think it should get more generic, since there potentially are (or will be) other sockets hidden that way? Feels like all accesses to a node's sockets should be protected now?
@mont29 I added a set of helper methods that can make future changes easier but I'm not sure about protecting all such accesses at the moment. There's close to 50 other accesses in this file alone that would have to be inspected.
LGTM, especially for 4.1.
@JacquesLucke the change in
e4ad58114b
is very... questionable to me. Having keys listed inkeys()
but returning KeyError with item subscription is very disturbing from a Python PoV. At the very (very) least, I would have expected a complete detailed explanation of that new behavior in the API docs ofNode.inputs
andNode.outputs
.@deadpin Indeed checking all cases that can potentially need these protected accessors (or deciding to always use them) can be done later. IMHO it should also cover outputs.
Also not for this PR, but for a later improvement (could be good to add a comment about it now though): I would move this check into its own utils, and make it a bit more 'safe' by checking that the key is actually defined in the inputs (or outputs), with something like that: