Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-06-25 20:38:40 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-06-25 20:38:40 +0400
commit8574808b2d60305439bc2af9e3a6be6f34cd5375 (patch)
tree3bc5da1120895ab179e1db5cf3f8f283e201583e /intern
parentdaa54f0f5cbbacf519d6ce354a2ae5c289b6f056 (diff)
Fix #35546: clicking cycles "Use Nodes" did not do a proper undo push, due to
button disappearing as soon as it's clicked. Workaround now is to make this an operator. Thanks to Lukas and Campbell for tracking this down.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/blender/addon/ui.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index dc632b9bb2c..e9ef771a6fb 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -20,7 +20,7 @@
import bpy
-from bpy.types import Panel, Menu
+from bpy.types import Panel, Menu, Operator
class CYCLES_MT_integrator_presets(Menu):
@@ -547,6 +547,26 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
flow.prop(visibility, "shadow")
+class CYCLES_OT_use_shading_nodes(Operator):
+ """Enable nodes on a material, world or lamp"""
+ bl_idname = "cycles.use_shading_nodes"
+ bl_label = "Use Nodes"
+
+ @classmethod
+ def poll(cls, context):
+ return context.material or context.world or context.lamp
+
+ def execute(self, context):
+ if context.material:
+ context.material.use_nodes = True
+ elif context.world:
+ context.world.use_nodes = True
+ elif context.lamp:
+ context.lamp.use_nodes = True
+
+ return {'FINISHED'}
+
+
def find_node(material, nodetype):
if material and material.node_tree:
ntree = material.node_tree
@@ -568,7 +588,7 @@ def find_node_input(node, name):
def panel_node_draw(layout, id_data, output_type, input_name):
if not id_data.use_nodes:
- layout.prop(id_data, "use_nodes", icon='NODETREE')
+ layout.operator("cycles.use_shading_nodes", icon='NODETREE')
return False
ntree = id_data.node_tree