code cleanup:
- cycles ui used 'cscene' for scene.cycles and scene.cycles_curves - style cleanup
This commit is contained in:
@@ -34,6 +34,7 @@ import bpy
|
||||
|
||||
from . import engine
|
||||
|
||||
|
||||
class CyclesRender(bpy.types.RenderEngine):
|
||||
bl_idname = 'CYCLES'
|
||||
bl_label = "Cycles Render"
|
||||
@@ -68,7 +69,7 @@ class CyclesRender(bpy.types.RenderEngine):
|
||||
def view_update(self, context):
|
||||
if not self.session:
|
||||
engine.create(self, context.blend_data, context.scene,
|
||||
context.region, context.space_data, context.region_data)
|
||||
context.region, context.space_data, context.region_data)
|
||||
engine.update(self, context.blend_data, context.scene)
|
||||
|
||||
def view_draw(self, context):
|
||||
@@ -104,4 +105,3 @@ def unregister():
|
||||
properties.unregister()
|
||||
presets.unregister()
|
||||
bpy.utils.unregister_module(__name__)
|
||||
|
||||
|
@@ -18,6 +18,7 @@
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
|
||||
def init():
|
||||
import bpy
|
||||
import _cycles
|
||||
@@ -89,4 +90,3 @@ def available_devices():
|
||||
def with_osl():
|
||||
import _cycles
|
||||
return _cycles.with_osl
|
||||
|
||||
|
@@ -18,10 +18,13 @@
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy, _cycles, os, tempfile
|
||||
import bpy
|
||||
import _cycles
|
||||
|
||||
|
||||
# compile .osl file with given filepath to temporary .oso file
|
||||
def osl_compile(input_path, report):
|
||||
"""compile .osl file with given filepath to temporary .oso file"""
|
||||
import tempfile
|
||||
output_file = tempfile.NamedTemporaryFile(mode='w', suffix=".oso", delete=False)
|
||||
output_path = output_file.name
|
||||
output_file.close()
|
||||
@@ -33,9 +36,12 @@ def osl_compile(input_path, report):
|
||||
|
||||
return ok, output_path
|
||||
|
||||
# compile and update shader script node
|
||||
|
||||
def update_script_node(node, report):
|
||||
import os, shutil
|
||||
"""compile and update shader script node"""
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
if node.mode == 'EXTERNAL':
|
||||
# compile external script file
|
||||
@@ -103,7 +109,7 @@ def update_script_node(node, report):
|
||||
|
||||
report({'ERROR'}, "Can't read OSO bytecode to store in node at %r" % oso_path)
|
||||
ok = False
|
||||
|
||||
|
||||
else:
|
||||
report({'WARNING'}, "No text or file specified in node, nothing to compile")
|
||||
return
|
||||
@@ -125,4 +131,3 @@ def update_script_node(node, report):
|
||||
pass
|
||||
|
||||
return ok
|
||||
|
||||
|
@@ -96,7 +96,7 @@ enum_curves_interpolation = (
|
||||
('CARDINAL', "Cardinal interpolation", "Use cardinal interpolation between segments"),
|
||||
('BSPLINE', "B-spline interpolation", "Use b-spline interpolation between segments"),
|
||||
)
|
||||
|
||||
|
||||
enum_tile_order = (
|
||||
('CENTER', "Center", "Render from center to the edges"),
|
||||
('RIGHT_TO_LEFT', "Right to Left", "Render from right to left"),
|
||||
@@ -105,6 +105,7 @@ enum_tile_order = (
|
||||
('BOTTOM_TO_TOP', "Bottom to Top", "Render from bottom to top"),
|
||||
)
|
||||
|
||||
|
||||
class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
@classmethod
|
||||
def register(cls):
|
||||
@@ -620,6 +621,7 @@ class CyclesMeshSettings(bpy.types.PropertyGroup):
|
||||
del bpy.types.Curve.cycles
|
||||
del bpy.types.MetaBall.cycles
|
||||
|
||||
|
||||
class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
|
||||
@classmethod
|
||||
def register(cls):
|
||||
@@ -706,7 +708,7 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
|
||||
name="Use Cycles Hair Rendering",
|
||||
description="Activate Cycles hair rendering for particle system",
|
||||
default=True,
|
||||
)
|
||||
)
|
||||
cls.segments = IntProperty(
|
||||
name="Segments",
|
||||
description="Number of segments between path keys (note that this combines with the 'draw step' value)",
|
||||
@@ -742,6 +744,7 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
|
||||
def unregister(cls):
|
||||
del bpy.types.Scene.cycles_curves
|
||||
|
||||
|
||||
class CyclesCurveSettings(bpy.types.PropertyGroup):
|
||||
@classmethod
|
||||
def register(cls):
|
||||
@@ -778,6 +781,7 @@ class CyclesCurveSettings(bpy.types.PropertyGroup):
|
||||
def unregister(cls):
|
||||
del bpy.types.ParticleSettings.cycles
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_class(CyclesRenderSettings)
|
||||
bpy.utils.register_class(CyclesCameraSettings)
|
||||
|
@@ -946,91 +946,98 @@ class CyclesParticle_PT_textures(CyclesButtonsPanel, Panel):
|
||||
slot = part.texture_slots[part.active_texture_index]
|
||||
layout.template_ID(slot, "texture", new="texture.new")
|
||||
|
||||
|
||||
class CyclesRender_PT_CurveRendering(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Cycles Hair Rendering"
|
||||
bl_context = "particle"
|
||||
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
scene = context.scene
|
||||
cscene = scene.cycles
|
||||
psys = context.particle_system
|
||||
device_type = context.user_preferences.system.compute_device_type
|
||||
experimental = context.scene.cycles.feature_set == 'EXPERIMENTAL' and (context.scene.cycles.device == 'CPU' or device_type == 'NONE')
|
||||
experimental = ((cscene.feature_set == 'EXPERIMENTAL') and (cscene.device == 'CPU' or device_type == 'NONE'))
|
||||
return CyclesButtonsPanel.poll(context) and experimental and psys
|
||||
|
||||
|
||||
def draw_header(self, context):
|
||||
cscene = context.scene.cycles_curves
|
||||
self.layout.prop(cscene, "use_curves", text="")
|
||||
|
||||
ccscene = context.scene.cycles_curves
|
||||
self.layout.prop(ccscene, "use_curves", text="")
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
||||
scene = context.scene
|
||||
cscene = scene.cycles_curves
|
||||
|
||||
layout.active = cscene.use_curves
|
||||
|
||||
layout.prop(cscene, "preset", text="Mode")
|
||||
|
||||
if cscene.preset == 'CUSTOM':
|
||||
layout.prop(cscene, "primitive", text="Primitive")
|
||||
|
||||
if cscene.primitive == 'TRIANGLES':
|
||||
layout.prop(cscene, "triangle_method", text="Method")
|
||||
if cscene.triangle_method == 'TESSELLATED_TRIANGLES':
|
||||
layout.prop(cscene, "resolution", text="Resolution")
|
||||
layout.prop(cscene, "use_smooth", text="Smooth")
|
||||
elif cscene.primitive == 'LINE_SEGMENTS':
|
||||
layout.prop(cscene, "use_backfacing", text="Check back-faces")
|
||||
|
||||
ccscene = scene.cycles_curves
|
||||
|
||||
layout.active = ccscene.use_curves
|
||||
|
||||
layout.prop(ccscene, "preset", text="Mode")
|
||||
|
||||
if ccscene.preset == 'CUSTOM':
|
||||
layout.prop(ccscene, "primitive", text="Primitive")
|
||||
|
||||
if ccscene.primitive == 'TRIANGLES':
|
||||
layout.prop(ccscene, "triangle_method", text="Method")
|
||||
if ccscene.triangle_method == 'TESSELLATED_TRIANGLES':
|
||||
layout.prop(ccscene, "resolution", text="Resolution")
|
||||
layout.prop(ccscene, "use_smooth", text="Smooth")
|
||||
elif ccscene.primitive == 'LINE_SEGMENTS':
|
||||
layout.prop(ccscene, "use_backfacing", text="Check back-faces")
|
||||
|
||||
row = layout.row()
|
||||
row.prop(cscene, "use_encasing", text="Exclude encasing")
|
||||
row.prop(ccscene, "use_encasing", text="Exclude encasing")
|
||||
sub = row.row()
|
||||
sub.active = cscene.use_encasing
|
||||
sub.prop(cscene, "encasing_ratio", text="Ratio for encasing")
|
||||
|
||||
layout.prop(cscene, "line_method", text="Method")
|
||||
layout.prop(cscene, "use_tangent_normal", text="Use tangent normal as default")
|
||||
layout.prop(cscene, "use_tangent_normal_geometry", text="Use tangent normal geometry")
|
||||
layout.prop(cscene, "use_tangent_normal_correction", text="Correct tangent normal for slope")
|
||||
layout.prop(cscene, "interpolation", text="Interpolation")
|
||||
|
||||
sub.active = ccscene.use_encasing
|
||||
sub.prop(ccscene, "encasing_ratio", text="Ratio for encasing")
|
||||
|
||||
layout.prop(ccscene, "line_method", text="Method")
|
||||
layout.prop(ccscene, "use_tangent_normal", text="Use tangent normal as default")
|
||||
layout.prop(ccscene, "use_tangent_normal_geometry", text="Use tangent normal geometry")
|
||||
layout.prop(ccscene, "use_tangent_normal_correction", text="Correct tangent normal for slope")
|
||||
layout.prop(ccscene, "interpolation", text="Interpolation")
|
||||
|
||||
row = layout.row()
|
||||
row.prop(cscene, "segments", text="Segments")
|
||||
row.prop(cscene, "normalmix", text="Ray Mix")
|
||||
elif cscene.primitive == 'CURVE_SEGMENTS' or cscene.primitive == 'CURVE_RIBBONS':
|
||||
layout.prop(cscene, "subdivisions", text="Curve subdivisions")
|
||||
layout.prop(cscene, "use_backfacing", text="Check back-faces")
|
||||
|
||||
layout.prop(cscene, "interpolation", text="Interpolation")
|
||||
row.prop(ccscene, "segments", text="Segments")
|
||||
row.prop(ccscene, "normalmix", text="Ray Mix")
|
||||
elif ccscene.primitive in {'CURVE_SEGMENTS', 'CURVE_RIBBONS'}:
|
||||
layout.prop(ccscene, "subdivisions", text="Curve subdivisions")
|
||||
layout.prop(ccscene, "use_backfacing", text="Check back-faces")
|
||||
|
||||
layout.prop(ccscene, "interpolation", text="Interpolation")
|
||||
row = layout.row()
|
||||
row.prop(cscene, "segments", text="Segments")
|
||||
|
||||
row.prop(ccscene, "segments", text="Segments")
|
||||
|
||||
row = layout.row()
|
||||
row.prop(cscene, "use_cache", text="Export cache with children")
|
||||
if cscene.use_cache:
|
||||
row.prop(cscene, "use_parents", text="Include parents")
|
||||
|
||||
row.prop(ccscene, "use_cache", text="Export cache with children")
|
||||
if ccscene.use_cache:
|
||||
row.prop(ccscene, "use_parents", text="Include parents")
|
||||
|
||||
|
||||
class CyclesParticle_PT_CurveSettings(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Cycles Hair Settings"
|
||||
bl_context = "particle"
|
||||
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
use_curves = context.scene.cycles_curves.use_curves and context.particle_system
|
||||
scene = context.scene
|
||||
cscene = scene.cycles
|
||||
ccscene = scene.cycles_curves
|
||||
use_curves = ccscene.use_curves and context.particle_system
|
||||
device_type = context.user_preferences.system.compute_device_type
|
||||
experimental = context.scene.cycles.feature_set == 'EXPERIMENTAL' and (context.scene.cycles.device == 'CPU' or device_type == 'NONE')
|
||||
experimental = cscene.feature_set == 'EXPERIMENTAL' and (cscene.device == 'CPU' or device_type == 'NONE')
|
||||
return CyclesButtonsPanel.poll(context) and experimental and use_curves
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
||||
psys = context.particle_settings
|
||||
cpsys = psys.cycles
|
||||
|
||||
|
||||
row = layout.row()
|
||||
row.prop(cpsys, "shape", text="Shape")
|
||||
row.prop(cpsys, "use_closetip", text="Close tip")
|
||||
|
||||
|
||||
layout.label(text="Width multiplier:")
|
||||
row = layout.row()
|
||||
row.prop(cpsys, "root_width", text="Root")
|
||||
@@ -1097,74 +1104,75 @@ def draw_pause(self, context):
|
||||
|
||||
|
||||
def get_panels():
|
||||
types = bpy.types
|
||||
return (
|
||||
bpy.types.RENDER_PT_render,
|
||||
bpy.types.RENDER_PT_output,
|
||||
bpy.types.RENDER_PT_encoding,
|
||||
bpy.types.RENDER_PT_dimensions,
|
||||
bpy.types.RENDER_PT_stamp,
|
||||
bpy.types.SCENE_PT_scene,
|
||||
bpy.types.SCENE_PT_audio,
|
||||
bpy.types.SCENE_PT_unit,
|
||||
bpy.types.SCENE_PT_keying_sets,
|
||||
bpy.types.SCENE_PT_keying_set_paths,
|
||||
bpy.types.SCENE_PT_physics,
|
||||
bpy.types.WORLD_PT_context_world,
|
||||
bpy.types.DATA_PT_context_mesh,
|
||||
bpy.types.DATA_PT_context_camera,
|
||||
bpy.types.DATA_PT_context_lamp,
|
||||
bpy.types.DATA_PT_context_speaker,
|
||||
bpy.types.DATA_PT_texture_space,
|
||||
bpy.types.DATA_PT_curve_texture_space,
|
||||
bpy.types.DATA_PT_mball_texture_space,
|
||||
bpy.types.DATA_PT_vertex_groups,
|
||||
bpy.types.DATA_PT_shape_keys,
|
||||
bpy.types.DATA_PT_uv_texture,
|
||||
bpy.types.DATA_PT_vertex_colors,
|
||||
bpy.types.DATA_PT_camera,
|
||||
bpy.types.DATA_PT_camera_display,
|
||||
bpy.types.DATA_PT_lens,
|
||||
bpy.types.DATA_PT_speaker,
|
||||
bpy.types.DATA_PT_distance,
|
||||
bpy.types.DATA_PT_cone,
|
||||
bpy.types.DATA_PT_customdata,
|
||||
bpy.types.DATA_PT_custom_props_mesh,
|
||||
bpy.types.DATA_PT_custom_props_camera,
|
||||
bpy.types.DATA_PT_custom_props_lamp,
|
||||
bpy.types.DATA_PT_custom_props_speaker,
|
||||
bpy.types.TEXTURE_PT_clouds,
|
||||
bpy.types.TEXTURE_PT_wood,
|
||||
bpy.types.TEXTURE_PT_marble,
|
||||
bpy.types.TEXTURE_PT_magic,
|
||||
bpy.types.TEXTURE_PT_blend,
|
||||
bpy.types.TEXTURE_PT_stucci,
|
||||
bpy.types.TEXTURE_PT_image,
|
||||
bpy.types.TEXTURE_PT_image_sampling,
|
||||
bpy.types.TEXTURE_PT_image_mapping,
|
||||
bpy.types.TEXTURE_PT_musgrave,
|
||||
bpy.types.TEXTURE_PT_voronoi,
|
||||
bpy.types.TEXTURE_PT_distortednoise,
|
||||
bpy.types.TEXTURE_PT_voxeldata,
|
||||
bpy.types.TEXTURE_PT_pointdensity,
|
||||
bpy.types.TEXTURE_PT_pointdensity_turbulence,
|
||||
bpy.types.TEXTURE_PT_mapping,
|
||||
bpy.types.TEXTURE_PT_influence,
|
||||
bpy.types.TEXTURE_PT_colors,
|
||||
bpy.types.PARTICLE_PT_context_particles,
|
||||
bpy.types.PARTICLE_PT_emission,
|
||||
bpy.types.PARTICLE_PT_hair_dynamics,
|
||||
bpy.types.PARTICLE_PT_cache,
|
||||
bpy.types.PARTICLE_PT_velocity,
|
||||
bpy.types.PARTICLE_PT_rotation,
|
||||
bpy.types.PARTICLE_PT_physics,
|
||||
bpy.types.PARTICLE_PT_boidbrain,
|
||||
bpy.types.PARTICLE_PT_render,
|
||||
bpy.types.PARTICLE_PT_draw,
|
||||
bpy.types.PARTICLE_PT_children,
|
||||
bpy.types.PARTICLE_PT_field_weights,
|
||||
bpy.types.PARTICLE_PT_force_fields,
|
||||
bpy.types.PARTICLE_PT_vertexgroups,
|
||||
bpy.types.PARTICLE_PT_custom_props,
|
||||
types.RENDER_PT_render,
|
||||
types.RENDER_PT_output,
|
||||
types.RENDER_PT_encoding,
|
||||
types.RENDER_PT_dimensions,
|
||||
types.RENDER_PT_stamp,
|
||||
types.SCENE_PT_scene,
|
||||
types.SCENE_PT_audio,
|
||||
types.SCENE_PT_unit,
|
||||
types.SCENE_PT_keying_sets,
|
||||
types.SCENE_PT_keying_set_paths,
|
||||
types.SCENE_PT_physics,
|
||||
types.WORLD_PT_context_world,
|
||||
types.DATA_PT_context_mesh,
|
||||
types.DATA_PT_context_camera,
|
||||
types.DATA_PT_context_lamp,
|
||||
types.DATA_PT_context_speaker,
|
||||
types.DATA_PT_texture_space,
|
||||
types.DATA_PT_curve_texture_space,
|
||||
types.DATA_PT_mball_texture_space,
|
||||
types.DATA_PT_vertex_groups,
|
||||
types.DATA_PT_shape_keys,
|
||||
types.DATA_PT_uv_texture,
|
||||
types.DATA_PT_vertex_colors,
|
||||
types.DATA_PT_camera,
|
||||
types.DATA_PT_camera_display,
|
||||
types.DATA_PT_lens,
|
||||
types.DATA_PT_speaker,
|
||||
types.DATA_PT_distance,
|
||||
types.DATA_PT_cone,
|
||||
types.DATA_PT_customdata,
|
||||
types.DATA_PT_custom_props_mesh,
|
||||
types.DATA_PT_custom_props_camera,
|
||||
types.DATA_PT_custom_props_lamp,
|
||||
types.DATA_PT_custom_props_speaker,
|
||||
types.TEXTURE_PT_clouds,
|
||||
types.TEXTURE_PT_wood,
|
||||
types.TEXTURE_PT_marble,
|
||||
types.TEXTURE_PT_magic,
|
||||
types.TEXTURE_PT_blend,
|
||||
types.TEXTURE_PT_stucci,
|
||||
types.TEXTURE_PT_image,
|
||||
types.TEXTURE_PT_image_sampling,
|
||||
types.TEXTURE_PT_image_mapping,
|
||||
types.TEXTURE_PT_musgrave,
|
||||
types.TEXTURE_PT_voronoi,
|
||||
types.TEXTURE_PT_distortednoise,
|
||||
types.TEXTURE_PT_voxeldata,
|
||||
types.TEXTURE_PT_pointdensity,
|
||||
types.TEXTURE_PT_pointdensity_turbulence,
|
||||
types.TEXTURE_PT_mapping,
|
||||
types.TEXTURE_PT_influence,
|
||||
types.TEXTURE_PT_colors,
|
||||
types.PARTICLE_PT_context_particles,
|
||||
types.PARTICLE_PT_emission,
|
||||
types.PARTICLE_PT_hair_dynamics,
|
||||
types.PARTICLE_PT_cache,
|
||||
types.PARTICLE_PT_velocity,
|
||||
types.PARTICLE_PT_rotation,
|
||||
types.PARTICLE_PT_physics,
|
||||
types.PARTICLE_PT_boidbrain,
|
||||
types.PARTICLE_PT_render,
|
||||
types.PARTICLE_PT_draw,
|
||||
types.PARTICLE_PT_children,
|
||||
types.PARTICLE_PT_field_weights,
|
||||
types.PARTICLE_PT_force_fields,
|
||||
types.PARTICLE_PT_vertexgroups,
|
||||
types.PARTICLE_PT_custom_props,
|
||||
)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user