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
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-11-21 01:02:12 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-11-21 01:02:12 +0400
commit2676f2d58f71f438008b413a86b873e7787d80ea (patch)
treeeb541972cf32d5958b7c0f7f8ece525b78cfcbff /intern/cycles/blender
parentbb9976f058ba2090812074e1b774213d20821a30 (diff)
parent4ab1dadf72a821b344a714fff59aed11d15ecb14 (diff)
Merged changes in the trunk up to revision 42021.
Conflicts resolved: source/blender/blenkernel/intern/scene.c source/blender/blenloader/intern/readfile.c source/blender/editors/interface/resources.c source/blender/render/intern/source/pipeline.c
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r--intern/cycles/blender/CMakeLists.txt7
-rw-r--r--intern/cycles/blender/addon/__init__.py19
-rw-r--r--intern/cycles/blender/addon/engine.py24
-rw-r--r--intern/cycles/blender/addon/enums.py39
-rw-r--r--intern/cycles/blender/addon/presets.py10
-rw-r--r--intern/cycles/blender/addon/properties.py22
-rw-r--r--intern/cycles/blender/addon/ui.py85
-rw-r--r--intern/cycles/blender/addon/xml.py10
-rw-r--r--intern/cycles/blender/blender_shader.cpp11
-rw-r--r--intern/cycles/blender/blender_util.h8
10 files changed, 165 insertions, 70 deletions
diff --git a/intern/cycles/blender/CMakeLists.txt b/intern/cycles/blender/CMakeLists.txt
index f3da1a30eb2..e81f02f2090 100644
--- a/intern/cycles/blender/CMakeLists.txt
+++ b/intern/cycles/blender/CMakeLists.txt
@@ -6,15 +6,18 @@ set(INC
../kernel/svm
../util
../subd
+ ../../../intern/guardedalloc
+ ../../../source/blender/makesdna
+ ../../../source/blender/makesrna
+ ../../../source/blender/blenloader
+ ${CMAKE_BINARY_DIR}/source/blender/makesrna/intern
)
set(INC_SYS
- ${BLENDER_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIRS}
${GLEW_INCLUDE_PATH}
)
-
set(SRC
blender_camera.cpp
blender_mesh.cpp
diff --git a/intern/cycles/blender/addon/__init__.py b/intern/cycles/blender/addon/__init__.py
index 979e3e872d7..ccb04eea0a8 100644
--- a/intern/cycles/blender/addon/__init__.py
+++ b/intern/cycles/blender/addon/__init__.py
@@ -16,17 +16,20 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
+# <pep8 compliant>
+
bl_info = {
"name": "Cycles Render Engine",
"author": "",
- "version": (0,0),
- "blender": (2, 5, 6),
- "api": 34462,
+ "version": (0, 0),
+ "blender": (2, 6, 0),
+ "api": 41670,
"location": "Info header, render engine menu",
"description": "Cycles Render Engine integration.",
"warning": "",
- "wiki_url": "",
+ "wiki_url": "http://wiki.blender.org/index.php/Dev:2.6/Source/Render/Cycles",
"tracker_url": "",
+ "support": 'OFFICIAL',
"category": "Render"}
import bpy
@@ -37,6 +40,7 @@ from cycles import xml
from cycles import engine
from cycles import presets
+
class CyclesRender(bpy.types.RenderEngine):
bl_idname = 'CYCLES'
bl_label = "Cycles"
@@ -45,7 +49,7 @@ class CyclesRender(bpy.types.RenderEngine):
def __init__(self):
engine.init()
self.session = None
-
+
def __del__(self):
engine.free(self)
@@ -63,7 +67,7 @@ class CyclesRender(bpy.types.RenderEngine):
#
# def preview_render(self):
# pass
-
+
# viewport render
def view_update(self, context):
if not self.session:
@@ -74,6 +78,7 @@ class CyclesRender(bpy.types.RenderEngine):
def view_draw(self, context):
engine.draw(self, context.region, context.space_data, context.region_data)
+
def register():
properties.register()
ui.register()
@@ -81,10 +86,10 @@ def register():
presets.register()
bpy.utils.register_module(__name__)
+
def unregister():
xml.unregister()
ui.unregister()
properties.unregister()
presets.unregister()
bpy.utils.unregister_module(__name__)
-
diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py
index 097909ca058..a32a9e91499 100644
--- a/intern/cycles/blender/addon/engine.py
+++ b/intern/cycles/blender/addon/engine.py
@@ -16,8 +16,11 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
+# <pep8 compliant>
+
import bpy
+
def init():
import bcycles
import os.path
@@ -27,7 +30,8 @@ def init():
bcycles.init(path, user_path)
-def create(engine, data, scene, region = 0, v3d = 0, rv3d = 0):
+
+def create(engine, data, scene, region=0, v3d=0, rv3d=0):
import bcycles
data = data.as_pointer()
@@ -41,20 +45,29 @@ def create(engine, data, scene, region = 0, v3d = 0, rv3d = 0):
engine.session = bcycles.create(engine.as_pointer(), data, scene, region, v3d, rv3d)
+
def free(engine):
- if "session" in dir(engine):
+ if hasattr(engine, "session"):
if engine.session:
import bcycles
bcycles.free(engine.session)
del engine.session
+
def render(engine):
import bcycles
- bcycles.render(engine.session)
+ if "session" in dir(engine):
+ bcycles.render(engine.session)
+
def update(engine, data, scene):
import bcycles
- bcycles.sync(engine.session)
+ if scene.render.use_border:
+ engine.report({'ERROR'}, "Border rendering not supported yet")
+ free(engine)
+ else:
+ bcycles.sync(engine.session)
+
def draw(engine, region, v3d, rv3d):
import bcycles
@@ -64,11 +77,12 @@ def draw(engine, region, v3d, rv3d):
# draw render image
bcycles.draw(engine.session, v3d, rv3d)
+
def available_devices():
import bcycles
return bcycles.available_devices()
+
def with_osl():
import bcycles
return bcycles.with_osl()
-
diff --git a/intern/cycles/blender/addon/enums.py b/intern/cycles/blender/addon/enums.py
index 4aef2553050..463fdc19534 100644
--- a/intern/cycles/blender/addon/enums.py
+++ b/intern/cycles/blender/addon/enums.py
@@ -16,8 +16,11 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
+# <pep8 compliant>
+
from cycles import engine
+
def get_gpu_device():
available_devices = engine.available_devices()
cuda = 'cuda' in available_devices
@@ -28,32 +31,36 @@ def get_gpu_device():
gpu_string = "CUDA GPU"
else:
gpu_string = "OpenCL GPU"
-
+
return gpu_string
devices = (
-("CPU", "CPU", "Processor"),
-("GPU", get_gpu_device(), "Graphics card"))
+ ("CPU", "CPU", "Processor"),
+ ("GPU", get_gpu_device(), "Graphics card"),
+ )
gpu_type = (
-("CUDA", "CUDA", "NVidia only"),
-("OPENCL", "OpenCL (incomplete)", ""))
+ ("CUDA", "CUDA", "NVidia only"),
+ ("OPENCL", "OpenCL (incomplete)", ""),
+ )
shading_systems = (
-("GPU_COMPATIBLE", "GPU Compatible", "Restricted shading system compatible with GPU rendering"),
-("OSL", "Open Shading Language", "Open Shading Language shading system that only runs on the CPU"))
+ ("GPU_COMPATIBLE", "GPU Compatible", "Restricted shading system compatible with GPU rendering"),
+ ("OSL", "Open Shading Language", "Open Shading Language shading system that only runs on the CPU"),
+ )
displacement_methods = (
-("BUMP", "Bump", "Bump mapping to simulate the appearance of displacement"),
-("TRUE", "True", "Use true displacement only, requires fine subdivision"),
-("BOTH", "Both", "Combination of displacement and bump mapping"))
+ ("BUMP", "Bump", "Bump mapping to simulate the appearance of displacement"),
+ ("TRUE", "True", "Use true displacement only, requires fine subdivision"),
+ ("BOTH", "Both", "Combination of displacement and bump mapping"),
+ )
bvh_types = (
-("DYNAMIC_BVH", "Dynamic BVH", "Objects can be individually updated, at the cost of slower render time"),
-("STATIC_BVH", "Static BVH", "Any object modification requires a complete BVH rebuild, but renders faster"))
+ ("DYNAMIC_BVH", "Dynamic BVH", "Objects can be individually updated, at the cost of slower render time"),
+ ("STATIC_BVH", "Static BVH", "Any object modification requires a complete BVH rebuild, but renders faster"),
+ )
filter_types = (
-("BOX", "Box", "Box filter"),
-("GAUSSIAN", "Gaussian", "Gaussian filter"))
-
-
+ ("BOX", "Box", "Box filter"),
+ ("GAUSSIAN", "Gaussian", "Gaussian filter"),
+ )
diff --git a/intern/cycles/blender/addon/presets.py b/intern/cycles/blender/addon/presets.py
index e5243b633be..e2836b2cc21 100644
--- a/intern/cycles/blender/addon/presets.py
+++ b/intern/cycles/blender/addon/presets.py
@@ -16,9 +16,12 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
+# <pep8 compliant>
+
from bl_operators.presets import AddPresetBase
from bpy.types import Operator
+
class AddPresetIntegrator(AddPresetBase, Operator):
'''Add an Integrator Preset'''
bl_idname = "render.cycles_integrator_preset_add"
@@ -41,13 +44,14 @@ class AddPresetIntegrator(AddPresetBase, Operator):
]
preset_subdir = "cycles/integrator"
-
+
+
def register():
pass
+
def unregister():
pass
-
+
if __name__ == "__main__":
register()
-
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 5a56240865a..0c7deb01ed8 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -16,6 +16,8 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
+# <pep8 compliant>
+
import bpy
from bpy.props import *
@@ -23,6 +25,7 @@ import math
from cycles import enums
+
class CyclesRenderSettings(bpy.types.PropertyGroup):
@classmethod
def register(cls):
@@ -30,7 +33,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
cls.device = EnumProperty(name="Device", description="Device to use for rendering",
items=enums.devices, default="CPU")
-
+
cls.gpu_type = EnumProperty(name="GPU Type", description="Processing system to use on the GPU",
items=enums.gpu_type, default="CUDA")
@@ -101,6 +104,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
def unregister(cls):
del bpy.types.Scene.cycles
+
class CyclesCameraSettings(bpy.types.PropertyGroup):
@classmethod
def register(cls):
@@ -108,26 +112,28 @@ class CyclesCameraSettings(bpy.types.PropertyGroup):
cls.aperture_size = FloatProperty(name="Aperture Size", description="Radius of the aperture for depth of field",
default=0.0, min=0.0, max=10.0)
- cls.aperture_blades = IntProperty(name="Aperture Blades", description="Number of blades in aperture for polygonal bokeh (need 3 or more)",
+ cls.aperture_blades = IntProperty(name="Aperture Blades", description="Number of blades in aperture for polygonal bokeh (at least 3)",
default=0, min=0, max=100)
cls.aperture_rotation = FloatProperty(name="Aperture Rotation", description="Rotation of blades in aperture",
default=0, soft_min=-math.pi, soft_max=math.pi, subtype='ANGLE')
-
+
@classmethod
def unregister(cls):
del bpy.types.Camera.cycles
+
class CyclesMaterialSettings(bpy.types.PropertyGroup):
@classmethod
def register(cls):
bpy.types.Material.cycles = PointerProperty(type=cls, name="Cycles Material Settings", description="Cycles material settings")
- cls.sample_as_light = BoolProperty(name="Sample as Light", description="Use direct light sampling, to reduce noise for small or strong emitting materials", default=True)
+ cls.sample_as_light = BoolProperty(name="Sample as Lamp", description="Use direct light sampling for this material, disabling may reduce overall noise for large objects that emit little light compared to other light sources", default=True)
cls.homogeneous_volume = BoolProperty(name="Homogeneous Volume", description="When using volume rendering, assume volume has the same density everywhere, for faster rendering", default=False)
@classmethod
def unregister(cls):
del bpy.types.Material.cycles
+
class CyclesLampSettings(bpy.types.PropertyGroup):
@classmethod
def register(cls):
@@ -138,6 +144,7 @@ class CyclesLampSettings(bpy.types.PropertyGroup):
def unregister(cls):
del bpy.types.Lamp.cycles
+
class CyclesWorldSettings(bpy.types.PropertyGroup):
@classmethod
def register(cls):
@@ -147,6 +154,7 @@ class CyclesWorldSettings(bpy.types.PropertyGroup):
def unregister(cls):
del bpy.types.World.cycles
+
class CyclesVisibilitySettings(bpy.types.PropertyGroup):
@classmethod
def register(cls):
@@ -162,6 +170,7 @@ class CyclesVisibilitySettings(bpy.types.PropertyGroup):
def unregister(cls):
del bpy.types.Object.cycles_visibility
+
class CyclesMeshSettings(bpy.types.PropertyGroup):
@classmethod
def register(cls):
@@ -181,6 +190,7 @@ class CyclesMeshSettings(bpy.types.PropertyGroup):
del bpy.types.Curve.cycles
del bpy.types.MetaBall.cycles
+
def register():
bpy.utils.register_class(CyclesRenderSettings)
bpy.utils.register_class(CyclesCameraSettings)
@@ -189,7 +199,8 @@ def register():
bpy.utils.register_class(CyclesWorldSettings)
bpy.utils.register_class(CyclesVisibilitySettings)
bpy.utils.register_class(CyclesMeshSettings)
-
+
+
def unregister():
bpy.utils.unregister_class(CyclesRenderSettings)
bpy.utils.unregister_class(CyclesCameraSettings)
@@ -198,4 +209,3 @@ def unregister():
bpy.utils.unregister_class(CyclesWorldSettings)
bpy.utils.unregister_class(CyclesMeshSettings)
bpy.utils.unregister_class(CyclesVisibilitySettings)
-
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 7c7d4c81b89..f3ed3b677fb 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -16,6 +16,8 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
+# <pep8 compliant>
+
import bpy
from bpy.types import Panel, Menu
@@ -23,6 +25,7 @@ from bpy.types import Panel, Menu
from cycles import enums
from cycles import engine
+
class CYCLES_MT_integrator_presets(Menu):
bl_label = "Integrator Presets"
preset_subdir = "cycles/integrator"
@@ -30,16 +33,18 @@ class CYCLES_MT_integrator_presets(Menu):
COMPAT_ENGINES = {'CYCLES'}
draw = Menu.draw_preset
+
class CyclesButtonsPanel():
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "render"
-
+
@classmethod
def poll(cls, context):
rd = context.scene.render
return rd.engine == 'CYCLES'
+
class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
bl_label = "Integrator"
bl_options = {'DEFAULT_CLOSED'}
@@ -49,7 +54,7 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
scene = context.scene
cscene = scene.cycles
-
+
row = layout.row(align=True)
row.menu("CYCLES_MT_integrator_presets", text=bpy.types.CYCLES_MT_integrator_presets.bl_label)
row.operator("render.cycles_integrator_preset_add", text="", icon="ZOOMIN")
@@ -87,7 +92,8 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
#row = col.row()
#row.prop(cscene, "blur_caustics")
#row.active = not cscene.no_caustics
-
+
+
class CyclesRender_PT_film(CyclesButtonsPanel, Panel):
bl_label = "Film"
@@ -99,7 +105,7 @@ class CyclesRender_PT_film(CyclesButtonsPanel, Panel):
split = layout.split()
- col = split.column();
+ col = split.column()
col.prop(cscene, "film_exposure")
col.prop(cscene, "film_transparent")
@@ -109,6 +115,7 @@ class CyclesRender_PT_film(CyclesButtonsPanel, Panel):
if cscene.filter_type != 'BOX':
sub.prop(cscene, "filter_width", text="Width")
+
class CyclesRender_PT_performance(CyclesButtonsPanel, Panel):
bl_label = "Performance"
bl_options = {'DEFAULT_CLOSED'}
@@ -142,6 +149,7 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel):
sub.prop(cscene, "debug_bvh_type", text="")
sub.prop(cscene, "debug_use_spatial_splits")
+
class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
bl_label = "Layers"
bl_options = {'DEFAULT_CLOSED'}
@@ -178,6 +186,7 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
layout.prop(rl, "material_override", text="Material")
+
class Cycles_PT_post_processing(CyclesButtonsPanel, Panel):
bl_label = "Post Processing"
bl_options = {'DEFAULT_CLOSED'}
@@ -196,6 +205,7 @@ class Cycles_PT_post_processing(CyclesButtonsPanel, Panel):
col = split.column()
col.prop(rd, "dither_intensity", text="Dither", slider=True)
+
class CyclesCamera_PT_dof(CyclesButtonsPanel, Panel):
bl_label = "Depth of Field"
bl_context = "data"
@@ -229,6 +239,7 @@ class CyclesCamera_PT_dof(CyclesButtonsPanel, Panel):
sub.prop(ccam, "aperture_blades", text="Blades")
sub.prop(ccam, "aperture_rotation", text="Rotation")
+
class Cycles_PT_context_material(CyclesButtonsPanel, Panel):
bl_label = "Surface"
bl_context = "material"
@@ -277,13 +288,14 @@ class Cycles_PT_context_material(CyclesButtonsPanel, Panel):
split.template_ID(space, "pin_id")
split.separator()
+
class Cycles_PT_mesh_displacement(CyclesButtonsPanel, Panel):
bl_label = "Displacement"
bl_context = "data"
@classmethod
def poll(cls, context):
- return context.mesh or context.curve or context.meta_ball
+ return CyclesButtonsPanel.poll(context) and (context.mesh or context.curve or context.meta_ball)
def draw(self, context):
layout = self.layout
@@ -300,8 +312,9 @@ class Cycles_PT_mesh_displacement(CyclesButtonsPanel, Panel):
cdata = mball.cycles
layout.prop(cdata, "displacement_method", text="Method")
- layout.prop(cdata, "use_subdivision");
- layout.prop(cdata, "dicing_rate");
+ layout.prop(cdata, "use_subdivision")
+ layout.prop(cdata, "dicing_rate")
+
class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
bl_label = "Ray Visibility"
@@ -311,7 +324,7 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
ob = context.object
- return CyclesButtonsPanel.poll(context) and ob and ob.type in ('MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META') # todo: 'LAMP'
+ return CyclesButtonsPanel.poll(context) and ob and ob.type in ('MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META') # todo: 'LAMP'
def draw(self, context):
layout = self.layout
@@ -330,6 +343,7 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
col.prop(visibility, "transmission")
col.prop(visibility, "shadow")
+
def find_node(material, nodetype):
if material and material.node_tree:
ntree = material.node_tree
@@ -337,16 +351,18 @@ def find_node(material, nodetype):
for node in ntree.nodes:
if hasattr(node, 'type') and node.type == nodetype:
return node
-
+
return None
+
def find_node_input(node, name):
for input in node.inputs:
if input.name == name:
return input
-
+
return None
+
def panel_node_draw(layout, id, output_type, input_name):
if not id.node_tree:
layout.prop(id, "use_nodes", icon='NODETREE')
@@ -359,10 +375,11 @@ def panel_node_draw(layout, id, output_type, input_name):
layout.label(text="No output node.")
else:
input = find_node_input(node, input_name)
- layout.template_node_view(ntree, node, input);
-
+ layout.template_node_view(ntree, node, input)
+
return True
+
class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
bl_label = "Lamp"
bl_context = "data"
@@ -401,7 +418,8 @@ class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
layout.label(text="Not supported, interpreted as point lamp.")
elif lamp.type == 'HEMI':
layout.label(text="Not supported, interpreted as sun lamp.")
-
+
+
class CyclesLamp_PT_nodes(CyclesButtonsPanel, Panel):
bl_label = "Nodes"
bl_context = "data"
@@ -417,6 +435,7 @@ class CyclesLamp_PT_nodes(CyclesButtonsPanel, Panel):
if not panel_node_draw(layout, lamp, 'OUTPUT_LAMP', 'Surface'):
layout.prop(lamp, "color")
+
class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel):
bl_label = "Surface"
bl_context = "world"
@@ -432,6 +451,7 @@ class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel):
if not panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Surface'):
layout.prop(world, "horizon_color", text="Color")
+
class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel):
bl_label = "Volume"
bl_context = "world"
@@ -439,8 +459,8 @@ class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
- world = context.world
- return False # world and world.node_tree and CyclesButtonsPanel.poll(context)
+ # world = context.world
+ return False # world and world.node_tree and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
@@ -449,6 +469,7 @@ class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel):
world = context.world
panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Volume')
+
class CyclesMaterial_PT_surface(CyclesButtonsPanel, Panel):
bl_label = "Surface"
bl_context = "material"
@@ -464,6 +485,7 @@ class CyclesMaterial_PT_surface(CyclesButtonsPanel, Panel):
if not panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Surface'):
layout.prop(mat, "diffuse_color")
+
class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel):
bl_label = "Volume"
bl_context = "material"
@@ -471,8 +493,8 @@ class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
- mat = context.material
- return False #mat and mat.node_tree and CyclesButtonsPanel.poll(context)
+ # mat = context.material
+ return False # mat and mat.node_tree and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
@@ -485,6 +507,7 @@ class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel):
layout.prop(cmat, "homogeneous_volume")
+
class CyclesMaterial_PT_displacement(CyclesButtonsPanel, Panel):
bl_label = "Displacement"
bl_context = "material"
@@ -500,6 +523,7 @@ class CyclesMaterial_PT_displacement(CyclesButtonsPanel, Panel):
mat = context.material
panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Displacement')
+
class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel):
bl_label = "Settings"
bl_context = "material"
@@ -523,6 +547,7 @@ class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel):
col = split.column()
col.prop(cmat, "sample_as_light")
+
class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
bl_label = ""
bl_context = "texture"
@@ -535,9 +560,9 @@ class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
tex = context.texture
space = context.space_data
pin_id = space.pin_id
- use_pin_id = space.use_pin_id;
+ use_pin_id = space.use_pin_id
user = context.texture_user
- node = context.texture_node
+ # node = context.texture_node
if not use_pin_id or not isinstance(pin_id, bpy.types.Texture):
pin_id = None
@@ -555,7 +580,7 @@ class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
col.template_ID(space, "pin_id")
elif user:
col.template_ID(user, "texture", new="texture.new")
-
+
if tex:
row = split.row()
row.prop(tex, "use_nodes", icon="NODETREE", text="")
@@ -566,6 +591,7 @@ class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
split.label(text="Type:")
split.prop(tex, "type", text="")
+
class CyclesTexture_PT_nodes(CyclesButtonsPanel, Panel):
bl_label = "Nodes"
bl_context = "texture"
@@ -581,6 +607,7 @@ class CyclesTexture_PT_nodes(CyclesButtonsPanel, Panel):
tex = context.texture
panel_node_draw(layout, tex, 'OUTPUT_TEXTURE', 'Color')
+
class CyclesTexture_PT_node(CyclesButtonsPanel, Panel):
bl_label = "Node"
bl_context = "texture"
@@ -597,6 +624,7 @@ class CyclesTexture_PT_node(CyclesButtonsPanel, Panel):
ntree = node.id_data
layout.template_node_view(ntree, node, None)
+
class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel):
bl_label = "Mapping"
bl_context = "texture"
@@ -610,7 +638,7 @@ class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
- tex = context.texture
+ # tex = context.texture
node = context.texture_node
mapping = node.texture_mapping
@@ -628,6 +656,7 @@ class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel):
row.prop(mapping, "mapping_y", text="")
row.prop(mapping, "mapping_z", text="")
+
class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel):
bl_label = "Color"
bl_context = "texture"
@@ -635,15 +664,15 @@ class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
- tex = context.texture
- node = context.texture_node
+ # tex = context.texture
+ # node = context.texture_node
return False
#return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
- tex = context.texture
+ # tex = context.texture
node = context.texture_node
mapping = node.color_mapping
@@ -668,6 +697,7 @@ class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel):
if mapping.use_color_ramp:
layout.template_color_ramp(mapping, "color_ramp", expand=True)
+
def draw_device(self, context):
scene = context.scene
layout = self.layout
@@ -686,6 +716,7 @@ def draw_device(self, context):
if cscene.device == 'CPU' and engine.with_osl():
layout.prop(cscene, "shading_system")
+
def draw_pause(self, context):
layout = self.layout
scene = context.scene
@@ -697,6 +728,7 @@ def draw_pause(self, context):
cscene = scene.cycles
layout.prop(cscene, "preview_pause", icon="PAUSE", text="")
+
def get_panels():
return [
bpy.types.RENDER_PT_render,
@@ -752,17 +784,18 @@ def get_panels():
bpy.types.PARTICLE_PT_vertexgroups,
bpy.types.PARTICLE_PT_custom_props]
+
def register():
bpy.types.RENDER_PT_render.append(draw_device)
bpy.types.VIEW3D_HT_header.append(draw_pause)
for panel in get_panels():
panel.COMPAT_ENGINES.add('CYCLES')
-
+
+
def unregister():
bpy.types.RENDER_PT_render.remove(draw_device)
bpy.types.VIEW3D_HT_header.remove(draw_pause)
for panel in get_panels():
panel.COMPAT_ENGINES.remove('CYCLES')
-
diff --git a/intern/cycles/blender/addon/xml.py b/intern/cycles/blender/addon/xml.py
index 3713da09235..e64023f046b 100644
--- a/intern/cycles/blender/addon/xml.py
+++ b/intern/cycles/blender/addon/xml.py
@@ -16,6 +16,8 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
+# <pep8 compliant>
+
# XML exporter for generating test files, not intended for end users
import os
@@ -24,6 +26,7 @@ from bpy_extras.io_utils import ExportHelper
import xml.etree.ElementTree as etree
import xml.dom.minidom as dom
+
def strip(root):
root.text = None
root.tail = None
@@ -31,6 +34,7 @@ def strip(root):
for elem in root:
strip(elem)
+
def write(node, fname):
strip(node)
@@ -40,6 +44,7 @@ def write(node, fname):
f = open(fname, "w")
f.write(s)
+
class ExportCyclesXML(bpy.types.Operator, ExportHelper):
''''''
bl_idname = "export_mesh.cycles_xml"
@@ -82,18 +87,19 @@ class ExportCyclesXML(bpy.types.Operator, ExportHelper):
verts += " "
node = etree.Element('mesh', attrib={'nverts': nverts, 'verts': verts, 'P': P})
-
+
# write to file
write(node, filepath)
return {'FINISHED'}
+
def register():
pass
+
def unregister():
pass
if __name__ == "__main__":
register()
-
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index 6f78fe1f0d4..a6ce0e9bfa8 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -100,7 +100,7 @@ static float get_node_output_value(BL::Node b_node, const string& name)
static void get_tex_mapping(TextureMapping *mapping, BL::TexMapping b_mapping)
{
mapping->translation = get_float3(b_mapping.location());
- mapping->rotation = get_float3(b_mapping.rotation())*(M_PI/180.0f); /* in degrees! */
+ mapping->rotation = get_float3(b_mapping.rotation());
mapping->scale = get_float3(b_mapping.scale());
mapping->x_mapping = (TextureMapping::Mapping)b_mapping.mapping_x();
@@ -108,6 +108,13 @@ static void get_tex_mapping(TextureMapping *mapping, BL::TexMapping b_mapping)
mapping->z_mapping = (TextureMapping::Mapping)b_mapping.mapping_z();
}
+static void get_tex_mapping(TextureMapping *mapping, BL::ShaderNodeMapping b_mapping)
+{
+ mapping->translation = get_float3(b_mapping.location());
+ mapping->rotation = get_float3(b_mapping.rotation());
+ mapping->scale = get_float3(b_mapping.scale());
+}
+
static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Node *b_group_node, BL::ShaderNode b_node)
{
ShaderNode *node = NULL;
@@ -174,7 +181,7 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Node *
BL::ShaderNodeMapping b_mapping_node(b_node);
MappingNode *mapping = new MappingNode();
- get_tex_mapping(&mapping->tex_mapping, b_mapping_node.mapping());
+ get_tex_mapping(&mapping->tex_mapping, b_mapping_node);
node = mapping;
break;
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index c5cceff6242..ff6d55c6f3e 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -176,7 +176,13 @@ static inline string get_enum_identifier(PointerRNA& ptr, const char *name)
static inline string blender_absolute_path(BL::BlendData b_data, BL::ID b_id, const string& path)
{
if(path.size() >= 2 && path[0] == '/' && path[1] == '/') {
- string dirname = (b_id.library())? b_id.library().filepath(): b_data.filepath();
+ string dirname;
+
+ if(b_id.library())
+ dirname = blender_absolute_path(b_data, b_id.library(), b_id.library().filepath());
+ else
+ dirname = b_data.filepath();
+
return path_join(path_dirname(dirname), path.substr(2));
}