Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/addon/ui.py
| Context not available. | |||||
| return context.engine in cls.COMPAT_ENGINES | return context.engine in cls.COMPAT_ENGINES | ||||
| class CyclesNodeButtonsPanel: | |||||
| bl_space_type = "NODE_EDITOR" | |||||
| bl_region_type = "UI" | |||||
| COMPAT_ENGINES = {'CYCLES'} | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| return context.engine in cls.COMPAT_ENGINES | |||||
| def get_device_type(context): | def get_device_type(context): | ||||
| return context.user_preferences.addons[__package__].preferences.compute_device_type | return context.user_preferences.addons[__package__].preferences.compute_device_type | ||||
| Context not available. | |||||
| (ao * aa, ml * aa, sss * aa, vol * aa)) | (ao * aa, ml * aa, sss * aa, vol * aa)) | ||||
| def draw_settings(layout, context): | |||||
| layout.use_property_split = True | |||||
| layout.use_property_decorate = False | |||||
| mat = context | |||||
| cmat = mat.cycles | |||||
| layout.prop(mat, "pass_index") | |||||
| def draw_settings_surface(layout, context): | |||||
| layout.use_property_split = True | |||||
| layout.use_property_decorate = False | |||||
| mat = context | |||||
| cmat = mat.cycles | |||||
| col = layout.column() | |||||
| col.prop(cmat, "sample_as_light", text="Multiple Importance") | |||||
| col.prop(cmat, "use_transparent_shadow") | |||||
| col.prop(cmat, "displacement_method", text="Displacement Method") | |||||
| def draw_settings_volume(layout, context, mat_context): | |||||
| layout.use_property_split = True | |||||
| layout.use_property_decorate = False | |||||
| mat = mat_context | |||||
| cmat = mat.cycles | |||||
| col = layout.column() | |||||
| sub = col.column() | |||||
| sub.active = use_cpu(context) | |||||
| sub.prop(cmat, "volume_sampling", text="Sampling") | |||||
| col.prop(cmat, "volume_interpolation", text="Interpolation") | |||||
| col.prop(cmat, "homogeneous_volume", text="Homogeneous") | |||||
| class CYCLES_RENDER_PT_sampling(CyclesButtonsPanel, Panel): | class CYCLES_RENDER_PT_sampling(CyclesButtonsPanel, Panel): | ||||
| bl_label = "Sampling" | bl_label = "Sampling" | ||||
| Context not available. | |||||
| class CYCLES_MATERIAL_PT_settings(CyclesButtonsPanel, Panel): | class CYCLES_MATERIAL_PT_settings(CyclesButtonsPanel, Panel): | ||||
| bl_label = "Settings" | bl_label = "Options" | ||||
| bl_context = "material" | bl_context = "material" | ||||
| bl_options = {'DEFAULT_CLOSED'} | bl_options = {'DEFAULT_CLOSED'} | ||||
| Context not available. | |||||
| return context.material and CyclesButtonsPanel.poll(context) | return context.material and CyclesButtonsPanel.poll(context) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | draw_settings(self.layout, context.material) | ||||
| layout.use_property_split = True | |||||
| layout.use_property_decorate = False | |||||
| mat = context.material | |||||
| cmat = mat.cycles | |||||
| layout.prop(mat, "pass_index") | |||||
| class CYCLES_MATERIAL_PT_settings_surface(CyclesButtonsPanel, Panel): | class CYCLES_MATERIAL_PT_settings_surface(CyclesButtonsPanel, Panel): | ||||
| Context not available. | |||||
| return context.material and CyclesButtonsPanel.poll(context) | return context.material and CyclesButtonsPanel.poll(context) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | draw_settings_surface(self.layout, context.material) | ||||
| layout.use_property_split = True | |||||
| layout.use_property_decorate = False | |||||
| mat = context.material | |||||
| cmat = mat.cycles | |||||
| col = layout.column() | |||||
| col.prop(cmat, "sample_as_light", text="Multiple Importance") | |||||
| col.prop(cmat, "use_transparent_shadow") | |||||
| col.prop(cmat, "displacement_method", text="Displacement Method") | |||||
| class CYCLES_MATERIAL_PT_settings_volume(CyclesButtonsPanel, Panel): | class CYCLES_MATERIAL_PT_settings_volume(CyclesButtonsPanel, Panel): | ||||
| Context not available. | |||||
| return context.material and CyclesButtonsPanel.poll(context) | return context.material and CyclesButtonsPanel.poll(context) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | draw_settings_volume(self.layout, context, context.material) | ||||
| layout.use_property_split = True | |||||
| layout.use_property_decorate = False | |||||
| mat = context.material | |||||
| cmat = mat.cycles | |||||
| col = layout.column() | |||||
| sub = col.column() | |||||
| sub.active = use_cpu(context) | |||||
| sub.prop(cmat, "volume_sampling", text="Sampling") | |||||
| col.prop(cmat, "volume_interpolation", text="Interpolation") | |||||
| col.prop(cmat, "homogeneous_volume", text="Homogeneous") | |||||
| class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel): | class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel): | ||||
| Context not available. | |||||
| sub.prop(cscene, "distance_cull_margin", text="Distance") | sub.prop(cscene, "distance_cull_margin", text="Distance") | ||||
| class CYCLES_NODE_PT_settings(CyclesNodeButtonsPanel, Panel): | |||||
| bl_label = "Options" | |||||
| bl_category = "Node" | |||||
| bl_options = {'DEFAULT_CLOSED'} | |||||
| @classmethod | |||||
brecht: This `bl_context` line should be left out, it does nothing in the node editor. | |||||
| def poll(cls, context): | |||||
| if context.space_data.id.name == "Material": | |||||
| return context.space_data.id and CyclesNodeButtonsPanel.poll(context) | |||||
| return False | |||||
Done Inline ActionsYou are not testing if this ID is a material datablock rather than e.g. a scene or texture datablock. brecht: You are not testing if this ID is a material datablock rather than e.g. a scene or texture… | |||||
| def draw(self, context): | |||||
| draw_settings(self.layout, context.space_data.id) | |||||
| class CYCLES_NODE_PT_settings_surface(CyclesNodeButtonsPanel, Panel): | |||||
| bl_label = "Surface" | |||||
| bl_category = "Node" | |||||
| bl_parent_id = "CYCLES_NODE_PT_settings" | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| if context.space_data.id.name == "Material": | |||||
| return context.space_data.id and CyclesNodeButtonsPanel.poll(context) | |||||
| return False | |||||
| def draw(self, context): | |||||
| draw_settings_surface(self.layout, context.space_data.id) | |||||
| class CYCLES_NODE_PT_settings_volume(CyclesNodeButtonsPanel, Panel): | |||||
| bl_label = "Volume" | |||||
| bl_category = "Node" | |||||
| bl_parent_id = "CYCLES_NODE_PT_settings" | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| if context.space_data.id.name == "Material": | |||||
| return context.space_data.id and CyclesNodeButtonsPanel.poll(context) | |||||
| return False | |||||
| def draw(self, context): | |||||
| draw_settings_volume(self.layout, context, context.space_data.id) | |||||
| def draw_device(self, context): | def draw_device(self, context): | ||||
| scene = context.scene | scene = context.scene | ||||
| layout = self.layout | layout = self.layout | ||||
| Context not available. | |||||
| CYCLES_MATERIAL_PT_settings_volume, | CYCLES_MATERIAL_PT_settings_volume, | ||||
| CYCLES_RENDER_PT_bake, | CYCLES_RENDER_PT_bake, | ||||
| CYCLES_RENDER_PT_debug, | CYCLES_RENDER_PT_debug, | ||||
| CYCLES_NODE_PT_settings, | |||||
| CYCLES_NODE_PT_settings_surface, | |||||
| CYCLES_NODE_PT_settings_volume, | |||||
| ) | ) | ||||
| Context not available. | |||||
This bl_context line should be left out, it does nothing in the node editor.