Invalid Keying Set File (exported with keys containing a ref to 'Shader Nodetree' ID) #44453

Closed
opened 2015-04-20 01:39:05 +02:00 by J.P. P. · 7 comments

System Information
Linux Sabayon 64bit - Intel Quad Core Q9950 (6giga Ram) + AMD HD5870

Blender Version
2.70 and above up to 2.74 as far as I can tell, and may be some earlier versions as well.

Short description of error
Running a previously exported keyingset.py file in the text editor yields an error in a specific case. It happens when you have some keys belonging to the Shader Node editor (and probably the texture and compositing nodes as well).

Error:   File "/keyingset2.py", line 13
    id_0 = bpy.data.shader node trees["Shader Nodetree"]
                              ^
SyntaxError: invalid syntax

Exact steps for others to reproduce the error

(A blendfile with the script already loaded is available as a link at the end of the message)

Start a new project (Blender Internal or Cycles) with the default cube for instance, go to the material tab and enable "use node" for the current material.
Then in the node editor go with the mouse on whatever default value of any nodes, the color for instance or roughness and with the RMB menu do "Add to Keying set"
Go in the Scene Tab an the do "Export to File", then remove existing new keying set and open the text editor, load your "keyingset.py" file and run it, you should have an error because of this line:


id_0 = bpy.data.shader node trees["Shader Nodetree"]

Here is a full buggy keyingset.py file:

# Keying Set: ButtonKeyingSet
import bpy

scene = bpy.context.scene

# Keying Set Level declarations
ks = scene.keying_sets.new(idname="ButtonKeyingSet", name="Button Keying Set")
ks.bl_description = "3 materials"

ks.use_insertkey_needed = False
ks.use_insertkey_visual = False
ks.use_insertkey_xyz_to_rgb = True

# ID's that are commonly used
id_2 = bpy.data.shader node trees["Shader Nodetree"]
id_1 = bpy.data.shader node trees["Shader Nodetree"]
id_0 = bpy.data.shader node trees["Shader Nodetree"]

# Path Definitions
ksp = ks.paths.add(id_0, 'nodes["Diffuse BSDF"].inputs[0].default_value', index=-1)
ksp = ks.paths.add(id_1, 'nodes["Diffuse BSDF"].inputs[0].default_value', index=-1)
ksp = ks.paths.add(id_2, 'nodes["Diffuse BSDF"].inputs[0].default_value', index=-1)

I would like to ask for your attention to the fact that this keying set has been made with 3 keys from 3 different materials. As you may understand probably now there is a second more interesting dimension to the problem. Even if there were no unwanted spaces in the ID's, how blender could know which path belongs to which material ? The 3 ID's refer to the same unspecific "Shader Nodtree" node and this doesn't allow to differentiate the keys from the 3 different materials.

I have not done the test but a similar problem might occur with the Texture Nodes as well.

Keyingset_PBM.blend

**System Information** Linux Sabayon 64bit - Intel Quad Core Q9950 (6giga Ram) + AMD HD5870 **Blender Version** 2.70 and above up to 2.74 as far as I can tell, and may be some earlier versions as well. **Short description of error** Running a previously exported keyingset.py file in the text editor yields an error in a specific case. It happens when you have some keys belonging to the Shader Node editor (and probably the texture and compositing nodes as well). ``` Error: File "/keyingset2.py", line 13 id_0 = bpy.data.shader node trees["Shader Nodetree"] ^ SyntaxError: invalid syntax ``` **Exact steps for others to reproduce the error** (A blendfile with the script already loaded is available as a link at the end of the message) Start a new project (Blender Internal or Cycles) with the default cube for instance, go to the material tab and enable "use node" for the current material. Then in the node editor go with the mouse on whatever default value of any nodes, the color for instance or roughness and with the RMB menu do "Add to Keying set" Go in the Scene Tab an the do "Export to File", then remove existing new keying set and open the text editor, load your "keyingset.py" file and run it, you should have an error because of this line: ``` id_0 = bpy.data.shader node trees["Shader Nodetree"] ``` Here is a full buggy keyingset.py file: ``` # Keying Set: ButtonKeyingSet import bpy scene = bpy.context.scene # Keying Set Level declarations ks = scene.keying_sets.new(idname="ButtonKeyingSet", name="Button Keying Set") ks.bl_description = "3 materials" ks.use_insertkey_needed = False ks.use_insertkey_visual = False ks.use_insertkey_xyz_to_rgb = True # ID's that are commonly used id_2 = bpy.data.shader node trees["Shader Nodetree"] id_1 = bpy.data.shader node trees["Shader Nodetree"] id_0 = bpy.data.shader node trees["Shader Nodetree"] # Path Definitions ksp = ks.paths.add(id_0, 'nodes["Diffuse BSDF"].inputs[0].default_value', index=-1) ksp = ks.paths.add(id_1, 'nodes["Diffuse BSDF"].inputs[0].default_value', index=-1) ksp = ks.paths.add(id_2, 'nodes["Diffuse BSDF"].inputs[0].default_value', index=-1) ``` I would like to ask for your attention to the fact that this keying set has been made with 3 keys from 3 different materials. As you may understand probably now there is a second more interesting dimension to the problem. Even if there were no unwanted spaces in the ID's, how blender could know which path belongs to which material ? The 3 ID's refer to the same unspecific "Shader Nodtree" node and this doesn't allow to differentiate the keys from the 3 different materials. I have not done the test but a similar problem might occur with the Texture Nodes as well. [Keyingset_PBM.blend](https://archive.blender.org/developer/F164524/Keyingset_PBM.blend)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @jpfep

Added subscriber: @jpfep
Member

Added subscriber: @JoshuaLeung

Added subscriber: @JoshuaLeung
Member

Part of the problem here is that node trees for materials are only "dummy" id-blocks which get nested inside the material datablock. A few others have similar problems too (i.e. textures and also compositing nodes IIRC). This causes lots of problems all over the place, since we almost always forget about these, and then find that they need special treatment. It looks like this is one of those cases :)

Part of the problem here is that node trees for materials are only "dummy" id-blocks which get nested inside the material datablock. A few others have similar problems too (i.e. textures and also compositing nodes IIRC). This causes lots of problems all over the place, since we almost always forget about these, and then find that they need special treatment. It looks like this is one of those cases :)
Joshua Leung self-assigned this 2015-04-20 04:42:30 +02:00

Added subscriber: @Brachi

Added subscriber: @Brachi

This issue was referenced by 028c67c81e

This issue was referenced by 028c67c81eab341c6d98b139c3a81b91ac3e9308
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
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
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#44453
No description provided.