2009-06-16 12:54:34 +00:00
|
|
|
|
2009-05-10 12:12:05 +00:00
|
|
|
import bpy
|
|
|
|
|
|
|
|
class MaterialButtonsPanel(bpy.types.Panel):
|
|
|
|
__space_type__ = "BUTTONS_WINDOW"
|
|
|
|
__region_type__ = "WINDOW"
|
|
|
|
__context__ = "material"
|
2009-05-20 13:34:04 +00:00
|
|
|
|
|
|
|
def poll(self, context):
|
2009-06-03 00:17:35 +00:00
|
|
|
return (context.material != None)
|
2009-05-28 23:45:50 +00:00
|
|
|
|
|
|
|
class MATERIAL_PT_preview(MaterialButtonsPanel):
|
|
|
|
__idname__= "MATERIAL_PT_preview"
|
|
|
|
__label__ = "Preview"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-06-03 00:17:35 +00:00
|
|
|
mat = context.material
|
2009-06-13 21:22:21 +00:00
|
|
|
|
2009-05-28 23:45:50 +00:00
|
|
|
layout.template_preview(mat)
|
2009-07-09 09:07:25 +00:00
|
|
|
|
2009-07-09 09:42:34 +00:00
|
|
|
class MATERIAL_PT_context_material(MaterialButtonsPanel):
|
|
|
|
__idname__= "MATERIAL_PT_context_material"
|
2009-07-26 03:54:17 +00:00
|
|
|
__show_header__ = False
|
2009-05-20 13:34:04 +00:00
|
|
|
|
2009-06-07 13:36:12 +00:00
|
|
|
def poll(self, context):
|
2009-07-09 16:09:44 +00:00
|
|
|
return (context.object)
|
2009-06-07 13:36:12 +00:00
|
|
|
|
2009-05-10 12:12:05 +00:00
|
|
|
def draw(self, context):
|
2009-05-12 19:28:49 +00:00
|
|
|
layout = self.layout
|
2009-06-13 21:22:21 +00:00
|
|
|
|
2009-06-03 00:17:35 +00:00
|
|
|
mat = context.material
|
2009-06-07 13:36:12 +00:00
|
|
|
ob = context.object
|
|
|
|
slot = context.material_slot
|
|
|
|
space = context.space_data
|
2009-05-20 13:34:04 +00:00
|
|
|
|
2009-07-09 19:45:27 +00:00
|
|
|
if ob:
|
|
|
|
row = layout.row()
|
2009-07-09 09:07:25 +00:00
|
|
|
|
2009-07-21 00:55:20 +00:00
|
|
|
row.template_list(ob, "materials", ob, "active_material_index", rows=2)
|
2009-07-09 09:07:25 +00:00
|
|
|
|
2009-07-09 19:45:27 +00:00
|
|
|
col = row.column(align=True)
|
2009-07-17 12:26:40 +00:00
|
|
|
col.itemO("object.material_slot_add", icon="ICON_ZOOMIN", text="")
|
|
|
|
col.itemO("object.material_slot_remove", icon="ICON_ZOOMOUT", text="")
|
2009-07-09 09:07:25 +00:00
|
|
|
|
2009-07-21 00:55:20 +00:00
|
|
|
if context.edit_object:
|
|
|
|
row = layout.row(align=True)
|
|
|
|
|
|
|
|
row.itemO("object.material_slot_assign", text="Assign")
|
|
|
|
row.itemO("object.material_slot_select", text="Select")
|
|
|
|
row.itemO("object.material_slot_deselect", text="Deselect")
|
|
|
|
|
2009-06-07 13:36:12 +00:00
|
|
|
split = layout.split(percentage=0.65)
|
|
|
|
|
2009-07-28 18:54:02 +00:00
|
|
|
if ob:
|
|
|
|
split.template_ID(ob, "active_material", new="material.new")
|
2009-07-13 00:40:20 +00:00
|
|
|
row = split.row()
|
2009-07-28 18:54:02 +00:00
|
|
|
if slot:
|
|
|
|
row.itemR(slot, "link", expand=True)
|
|
|
|
else:
|
|
|
|
row.itemL()
|
2009-06-07 13:36:12 +00:00
|
|
|
elif mat:
|
2009-06-23 00:19:10 +00:00
|
|
|
split.template_ID(space, "pin_id")
|
2009-06-07 13:36:12 +00:00
|
|
|
split.itemS()
|
2009-07-09 09:07:25 +00:00
|
|
|
|
|
|
|
class MATERIAL_PT_material(MaterialButtonsPanel):
|
|
|
|
__idname__= "MATERIAL_PT_material"
|
2009-07-17 12:35:57 +00:00
|
|
|
__label__ = "Shading"
|
2009-07-09 09:07:25 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
|
2009-07-09 09:07:25 +00:00
|
|
|
mat = context.material
|
|
|
|
ob = context.object
|
|
|
|
slot = context.material_slot
|
|
|
|
space = context.space_data
|
|
|
|
|
|
|
|
if mat:
|
2009-06-07 13:36:12 +00:00
|
|
|
layout.itemR(mat, "type", expand=True)
|
2009-07-17 12:35:57 +00:00
|
|
|
|
2009-07-25 21:31:17 +00:00
|
|
|
if mat.type in ('SURFACE', 'WIRE', 'VOLUME'):
|
2009-07-17 12:35:57 +00:00
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
sub = split.column()
|
|
|
|
sub.itemR(mat, "alpha", slider=True)
|
|
|
|
sub.itemR(mat, "ambient", slider=True)
|
|
|
|
sub.itemR(mat, "emit")
|
2009-07-25 21:31:17 +00:00
|
|
|
sub.itemR(mat, "translucency", slider=True)
|
2009-07-17 12:35:57 +00:00
|
|
|
|
|
|
|
sub = split.column()
|
2009-07-25 21:31:17 +00:00
|
|
|
sub.itemR(mat, "z_transparency")
|
2009-07-17 12:35:57 +00:00
|
|
|
sub.itemR(mat, "shadeless")
|
|
|
|
sub.itemR(mat, "tangent_shading")
|
|
|
|
sub.itemR(mat, "cubic", slider=True)
|
2009-07-25 12:22:22 +00:00
|
|
|
|
2009-07-17 12:35:57 +00:00
|
|
|
elif mat.type == 'HALO':
|
|
|
|
layout.itemR(mat, "alpha", slider=True)
|
2009-06-14 18:16:38 +00:00
|
|
|
|
2009-06-16 12:54:34 +00:00
|
|
|
class MATERIAL_PT_strand(MaterialButtonsPanel):
|
|
|
|
__idname__= "MATERIAL_PT_strand"
|
|
|
|
__label__ = "Strand"
|
2009-06-16 01:25:49 +00:00
|
|
|
__default_closed__ = True
|
2009-06-13 21:22:21 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
tan = context.material.strand
|
2009-06-14 18:16:38 +00:00
|
|
|
mat = context.material
|
2009-06-13 21:22:21 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
sub = split.column()
|
|
|
|
sub.itemL(text="Size:")
|
|
|
|
sub.itemR(tan, "start_size", text="Root")
|
|
|
|
sub.itemR(tan, "end_size", text="Tip")
|
|
|
|
sub.itemR(tan, "min_size", text="Minimum")
|
|
|
|
sub.itemR(tan, "blender_units")
|
2009-06-16 12:54:34 +00:00
|
|
|
colsub = sub.column()
|
|
|
|
colsub.active = mat.shadeless== False
|
|
|
|
colsub.itemR(tan, "tangent_shading")
|
2009-06-13 21:22:21 +00:00
|
|
|
|
|
|
|
sub = split.column()
|
|
|
|
sub.itemR(tan, "shape")
|
|
|
|
sub.itemR(tan, "width_fade")
|
|
|
|
sub.itemR(tan, "uv_layer")
|
2009-06-16 12:54:34 +00:00
|
|
|
colsub = sub.column()
|
|
|
|
colsub.active = mat.shadeless== False
|
|
|
|
colsub.itemR(tan, "surface_diffuse")
|
|
|
|
colsubsub = colsub.column()
|
|
|
|
colsubsub.active = tan.surface_diffuse
|
|
|
|
colsubsub.itemR(tan, "blend_distance", text="Distance")
|
2009-06-13 21:22:21 +00:00
|
|
|
|
|
|
|
class MATERIAL_PT_options(MaterialButtonsPanel):
|
|
|
|
__idname__= "MATERIAL_PT_options"
|
|
|
|
__label__ = "Options"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
mat = context.material
|
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
sub = split.column()
|
|
|
|
sub.itemR(mat, "traceable")
|
|
|
|
sub.itemR(mat, "full_oversampling")
|
|
|
|
sub.itemR(mat, "sky")
|
|
|
|
sub.itemR(mat, "exclude_mist")
|
2009-07-25 21:31:17 +00:00
|
|
|
sub.itemR(mat, "invert_z")
|
|
|
|
|
|
|
|
col = sub.column(align=True)
|
|
|
|
col.itemL(text="Light Group:")
|
|
|
|
col.itemR(mat, "light_group", text="")
|
|
|
|
row = col.row()
|
|
|
|
row.active = mat.light_group
|
|
|
|
row.itemR(mat, "light_group_exclusive", text="Exclusive")
|
|
|
|
|
2009-07-17 12:35:57 +00:00
|
|
|
sub = split.column()
|
2009-06-13 21:22:21 +00:00
|
|
|
sub.itemR(mat, "face_texture")
|
|
|
|
colsub = sub.column()
|
|
|
|
colsub.active = mat.face_texture
|
|
|
|
colsub.itemR(mat, "face_texture_alpha")
|
2009-07-25 21:31:17 +00:00
|
|
|
sub.itemR(mat, "vertex_color_paint")
|
|
|
|
sub.itemR(mat, "vertex_color_light")
|
|
|
|
sub.itemR(mat, "object_color")
|
2009-07-17 12:35:57 +00:00
|
|
|
|
|
|
|
class MATERIAL_PT_shadows(MaterialButtonsPanel):
|
|
|
|
__idname__= "MATERIAL_PT_shadows"
|
|
|
|
__label__ = "Shadows"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
mat = context.material
|
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
2009-06-13 21:22:21 +00:00
|
|
|
sub = split.column()
|
2009-07-18 04:09:23 +00:00
|
|
|
sub.itemR(mat, "shadows", text="Receive")
|
|
|
|
sub.itemR(mat, "transparent_shadows", text="Receive Transparent")
|
2009-06-14 18:16:38 +00:00
|
|
|
sub.itemR(mat, "only_shadow", text="Shadows Only")
|
2009-06-13 21:22:21 +00:00
|
|
|
sub.itemR(mat, "cast_shadows_only", text="Cast Only")
|
2009-06-14 18:16:38 +00:00
|
|
|
sub.itemR(mat, "shadow_casting_alpha", text="Casting Alpha", slider=True)
|
2009-07-17 12:35:57 +00:00
|
|
|
sub = split.column()
|
2009-07-14 04:13:04 +00:00
|
|
|
sub.itemR(mat, "ray_shadow_bias", text="Auto Ray Bias")
|
2009-06-13 21:22:21 +00:00
|
|
|
colsub = sub.column()
|
2009-07-14 04:13:04 +00:00
|
|
|
colsub.active = not mat.ray_shadow_bias
|
|
|
|
colsub.itemR(mat, "shadow_ray_bias", text="Ray Shadow Bias")
|
2009-06-13 21:22:21 +00:00
|
|
|
sub.itemR(mat, "cast_buffer_shadows")
|
2009-07-14 04:13:04 +00:00
|
|
|
sub.itemR(mat, "shadow_buffer_bias", text="Buffer Bias")
|
2009-06-13 21:22:21 +00:00
|
|
|
|
2009-07-17 12:35:57 +00:00
|
|
|
|
2009-06-14 18:16:38 +00:00
|
|
|
class MATERIAL_PT_diffuse(MaterialButtonsPanel):
|
|
|
|
__idname__= "MATERIAL_PT_diffuse"
|
|
|
|
__label__ = "Diffuse"
|
2009-06-13 21:22:21 +00:00
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
mat = context.material
|
2009-07-25 21:31:17 +00:00
|
|
|
return (mat and mat.type != 'HALO')
|
2009-06-13 21:22:21 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-06-14 18:16:38 +00:00
|
|
|
mat = context.material
|
2009-06-13 21:22:21 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
sub = split.column()
|
2009-06-14 18:16:38 +00:00
|
|
|
sub.itemR(mat, "diffuse_color", text="")
|
2009-07-25 21:31:17 +00:00
|
|
|
row = sub.row()
|
|
|
|
row.active = mat.shadeless== False
|
|
|
|
row.itemR(mat, "diffuse_reflection", text="Intensity", slider=True)
|
2009-06-14 18:16:38 +00:00
|
|
|
|
|
|
|
sub = split.column()
|
2009-06-16 12:54:34 +00:00
|
|
|
sub.active = mat.shadeless== False
|
2009-07-25 21:31:17 +00:00
|
|
|
sub.itemR(mat, "diffuse_shader", text="")
|
|
|
|
sub.itemR(mat, "use_diffuse_ramp", text="Ramp")
|
2009-06-16 12:54:34 +00:00
|
|
|
|
2009-06-14 18:16:38 +00:00
|
|
|
split = layout.split()
|
2009-06-16 12:54:34 +00:00
|
|
|
split.active = mat.shadeless== False
|
2009-06-14 18:16:38 +00:00
|
|
|
sub = split.column()
|
|
|
|
if mat.diffuse_shader == 'OREN_NAYAR':
|
2009-07-09 19:45:27 +00:00
|
|
|
sub.itemR(mat, "roughness")
|
2009-06-14 18:16:38 +00:00
|
|
|
if mat.diffuse_shader == 'MINNAERT':
|
|
|
|
sub.itemR(mat, "darkness")
|
2009-06-16 01:25:49 +00:00
|
|
|
if mat.diffuse_shader == 'TOON':
|
|
|
|
sub.itemR(mat, "diffuse_toon_size", text="Size")
|
|
|
|
sub = split.column()
|
|
|
|
sub.itemR(mat, "diffuse_toon_smooth", text="Smooth")
|
|
|
|
if mat.diffuse_shader == 'FRESNEL':
|
|
|
|
sub.itemR(mat, "diffuse_fresnel", text="Fresnel")
|
|
|
|
sub = split.column()
|
|
|
|
sub.itemR(mat, "diffuse_fresnel_factor", text="Factor")
|
2009-06-14 18:16:38 +00:00
|
|
|
|
2009-07-25 21:31:17 +00:00
|
|
|
if mat.use_diffuse_ramp:
|
|
|
|
layout.template_color_ramp(mat.diffuse_ramp, expand=True)
|
2009-07-25 12:22:22 +00:00
|
|
|
|
2009-06-14 18:16:38 +00:00
|
|
|
class MATERIAL_PT_specular(MaterialButtonsPanel):
|
|
|
|
__idname__= "MATERIAL_PT_specular"
|
|
|
|
__label__ = "Specular"
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
mat = context.material
|
2009-07-25 21:31:17 +00:00
|
|
|
return (mat and mat.type != 'HALO')
|
2009-06-14 18:16:38 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
mat = context.material
|
|
|
|
|
2009-06-16 12:54:34 +00:00
|
|
|
layout.active = mat.shadeless== False
|
|
|
|
|
2009-06-14 18:16:38 +00:00
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
sub = split.column()
|
|
|
|
sub.itemR(mat, "specular_color", text="")
|
2009-06-16 12:54:34 +00:00
|
|
|
sub.itemR(mat, "specular_reflection", text="Intensity", slider=True)
|
2009-07-25 21:31:17 +00:00
|
|
|
|
|
|
|
sub = split.column()
|
|
|
|
sub.itemR(mat, "specular_shader", text="")
|
|
|
|
sub.itemR(mat, "use_specular_ramp", text="Ramp")
|
2009-06-14 18:16:38 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
sub = split.column()
|
2009-07-25 21:31:17 +00:00
|
|
|
if mat.specular_shader in ('COOKTORR', 'PHONG'):
|
2009-06-14 18:16:38 +00:00
|
|
|
sub.itemR(mat, "specular_hardness", text="Hardness")
|
2009-07-25 21:31:17 +00:00
|
|
|
if mat.specular_shader == 'BLINN':
|
2009-06-16 12:54:34 +00:00
|
|
|
sub.itemR(mat, "specular_hardness", text="Hardness")
|
2009-06-16 01:25:49 +00:00
|
|
|
sub = split.column()
|
|
|
|
sub.itemR(mat, "specular_ior", text="IOR")
|
2009-07-25 21:31:17 +00:00
|
|
|
if mat.specular_shader == 'WARDISO':
|
2009-06-14 18:16:38 +00:00
|
|
|
sub.itemR(mat, "specular_slope", text="Slope")
|
2009-07-25 21:31:17 +00:00
|
|
|
if mat.specular_shader == 'TOON':
|
2009-06-16 01:25:49 +00:00
|
|
|
sub.itemR(mat, "specular_toon_size", text="Size")
|
|
|
|
sub = split.column()
|
|
|
|
sub.itemR(mat, "specular_toon_smooth", text="Smooth")
|
2009-06-14 18:16:38 +00:00
|
|
|
|
2009-07-25 21:31:17 +00:00
|
|
|
if mat.use_specular_ramp:
|
|
|
|
layout.template_color_ramp(mat.specular_ramp, expand=True)
|
2009-07-25 12:22:22 +00:00
|
|
|
|
2009-05-10 12:12:05 +00:00
|
|
|
class MATERIAL_PT_sss(MaterialButtonsPanel):
|
|
|
|
__idname__= "MATERIAL_PT_sss"
|
|
|
|
__label__ = "Subsurface Scattering"
|
2009-06-16 01:25:49 +00:00
|
|
|
__default_closed__ = True
|
2009-06-16 12:54:34 +00:00
|
|
|
|
2009-05-20 13:34:04 +00:00
|
|
|
def poll(self, context):
|
2009-06-03 00:17:35 +00:00
|
|
|
mat = context.material
|
2009-07-25 21:31:17 +00:00
|
|
|
return (mat and (mat.type == 'SURFACE' or mat.type == 'WIRE'))
|
2009-05-20 14:46:49 +00:00
|
|
|
|
|
|
|
def draw_header(self, context):
|
2009-06-13 21:22:21 +00:00
|
|
|
layout = self.layout
|
2009-06-03 00:17:35 +00:00
|
|
|
sss = context.material.subsurface_scattering
|
2009-05-20 14:46:49 +00:00
|
|
|
|
|
|
|
layout.itemR(sss, "enabled", text="")
|
2009-05-10 12:12:05 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
2009-05-12 19:28:49 +00:00
|
|
|
layout = self.layout
|
2009-06-03 00:17:35 +00:00
|
|
|
sss = context.material.subsurface_scattering
|
2009-06-16 12:54:34 +00:00
|
|
|
mat = context.material
|
2009-05-29 09:53:46 +00:00
|
|
|
layout.active = sss.enabled
|
2009-05-10 12:12:05 +00:00
|
|
|
|
2009-06-14 18:16:38 +00:00
|
|
|
split = layout.split()
|
2009-06-16 12:54:34 +00:00
|
|
|
split.active = mat.shadeless== False
|
2009-05-10 12:12:05 +00:00
|
|
|
|
2009-06-14 18:16:38 +00:00
|
|
|
sub = split.column()
|
|
|
|
sub.itemR(sss, "color", text="")
|
|
|
|
sub.itemL(text="Blend:")
|
|
|
|
sub.itemR(sss, "color_factor", slider=True)
|
|
|
|
sub.itemR(sss, "texture_factor", slider=True)
|
|
|
|
sub.itemL(text="Scattering Weight:")
|
|
|
|
sub.itemR(sss, "front")
|
|
|
|
sub.itemR(sss, "back")
|
2009-06-16 12:54:34 +00:00
|
|
|
|
|
|
|
sub = split.column()
|
|
|
|
sub.itemR(sss, "ior")
|
|
|
|
sub.itemR(sss, "scale")
|
|
|
|
sub.itemR(sss, "radius", text="RGB Radius")
|
|
|
|
sub.itemR(sss, "error_tolerance")
|
2009-06-14 18:16:38 +00:00
|
|
|
|
2009-05-10 12:12:05 +00:00
|
|
|
class MATERIAL_PT_raymir(MaterialButtonsPanel):
|
|
|
|
__idname__= "MATERIAL_PT_raymir"
|
|
|
|
__label__ = "Ray Mirror"
|
2009-06-16 01:25:49 +00:00
|
|
|
__default_closed__ = True
|
2009-05-10 12:12:05 +00:00
|
|
|
|
2009-05-19 17:13:33 +00:00
|
|
|
def poll(self, context):
|
2009-06-03 00:17:35 +00:00
|
|
|
mat = context.material
|
2009-07-25 21:31:17 +00:00
|
|
|
return (mat and (mat.type == 'SURFACE' or mat.type == 'WIRE'))
|
2009-05-19 17:13:33 +00:00
|
|
|
|
|
|
|
def draw_header(self, context):
|
2009-06-13 21:22:21 +00:00
|
|
|
layout = self.layout
|
2009-06-03 00:17:35 +00:00
|
|
|
raym = context.material.raytrace_mirror
|
2009-05-19 17:13:33 +00:00
|
|
|
|
2009-05-20 14:46:49 +00:00
|
|
|
layout.itemR(raym, "enabled", text="")
|
2009-05-19 17:13:33 +00:00
|
|
|
|
2009-05-10 12:12:05 +00:00
|
|
|
def draw(self, context):
|
2009-05-12 19:28:49 +00:00
|
|
|
layout = self.layout
|
2009-06-03 00:17:35 +00:00
|
|
|
raym = context.material.raytrace_mirror
|
2009-06-14 18:16:38 +00:00
|
|
|
mat = context.material
|
2009-06-13 21:22:21 +00:00
|
|
|
|
|
|
|
layout.active = raym.enabled
|
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
split = layout.split()
|
2009-05-10 12:12:05 +00:00
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
sub = split.column()
|
2009-06-16 12:54:34 +00:00
|
|
|
sub.itemR(raym, "reflect", text="Reflectivity", slider=True)
|
2009-06-14 18:16:38 +00:00
|
|
|
sub.itemR(mat, "mirror_color", text="")
|
2009-05-21 07:40:43 +00:00
|
|
|
sub.itemR(raym, "fresnel")
|
2009-05-20 16:24:04 +00:00
|
|
|
sub.itemR(raym, "fresnel_fac", text="Fac", slider=True)
|
2009-05-10 12:12:05 +00:00
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
sub = split.column()
|
2009-05-20 16:24:04 +00:00
|
|
|
sub.itemR(raym, "gloss", slider=True)
|
2009-06-16 12:54:34 +00:00
|
|
|
colsub = sub.column()
|
|
|
|
colsub.active = raym.gloss < 1
|
|
|
|
colsub.itemR(raym, "gloss_threshold", slider=True, text="Threshold")
|
|
|
|
colsub.itemR(raym, "gloss_samples", text="Samples")
|
|
|
|
colsub.itemR(raym, "gloss_anisotropic", slider=True, text="Anisotropic")
|
2009-05-10 12:12:05 +00:00
|
|
|
|
2009-05-24 12:37:55 +00:00
|
|
|
row = layout.row()
|
|
|
|
row.itemR(raym, "distance", text="Max Dist")
|
|
|
|
row.itemR(raym, "depth")
|
|
|
|
|
|
|
|
layout.itemR(raym, "fade_to")
|
2009-05-10 12:12:05 +00:00
|
|
|
|
|
|
|
class MATERIAL_PT_raytransp(MaterialButtonsPanel):
|
|
|
|
__idname__= "MATERIAL_PT_raytransp"
|
|
|
|
__label__= "Ray Transparency"
|
2009-06-16 01:25:49 +00:00
|
|
|
__default_closed__ = True
|
2009-06-16 12:54:34 +00:00
|
|
|
|
2009-05-20 13:34:04 +00:00
|
|
|
def poll(self, context):
|
2009-06-03 00:17:35 +00:00
|
|
|
mat = context.material
|
2009-07-25 21:31:17 +00:00
|
|
|
return (mat and (mat.type == 'SURFACE' or mat.type == 'WIRE'))
|
2009-05-10 12:12:05 +00:00
|
|
|
|
2009-05-20 14:46:49 +00:00
|
|
|
def draw_header(self, context):
|
2009-06-13 21:22:21 +00:00
|
|
|
layout = self.layout
|
2009-06-03 00:17:35 +00:00
|
|
|
rayt = context.material.raytrace_transparency
|
2009-05-20 14:46:49 +00:00
|
|
|
|
|
|
|
layout.itemR(rayt, "enabled", text="")
|
|
|
|
|
2009-05-10 12:12:05 +00:00
|
|
|
def draw(self, context):
|
2009-05-12 19:28:49 +00:00
|
|
|
layout = self.layout
|
2009-06-03 00:17:35 +00:00
|
|
|
rayt = context.material.raytrace_transparency
|
2009-06-16 12:54:34 +00:00
|
|
|
mat = context.material
|
2009-06-13 21:22:21 +00:00
|
|
|
|
2009-05-29 09:53:46 +00:00
|
|
|
layout.active = rayt.enabled
|
2009-05-10 12:12:05 +00:00
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
split = layout.split()
|
2009-06-16 12:54:34 +00:00
|
|
|
split.active = mat.shadeless== False
|
2009-05-10 12:12:05 +00:00
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
sub = split.column()
|
2009-05-10 12:12:05 +00:00
|
|
|
sub.itemR(rayt, "ior")
|
2009-05-21 07:40:43 +00:00
|
|
|
sub.itemR(rayt, "fresnel")
|
2009-05-20 16:24:04 +00:00
|
|
|
sub.itemR(rayt, "fresnel_fac", text="Fac", slider=True)
|
2009-05-10 12:12:05 +00:00
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
sub = split.column()
|
2009-05-20 16:24:04 +00:00
|
|
|
sub.itemR(rayt, "gloss", slider=True)
|
2009-06-16 12:54:34 +00:00
|
|
|
colsub = sub.column()
|
|
|
|
colsub.active = rayt.gloss < 1
|
|
|
|
colsub.itemR(rayt, "gloss_threshold", slider=True, text="Threshold")
|
|
|
|
colsub.itemR(rayt, "gloss_samples", text="Samples")
|
2009-05-10 12:12:05 +00:00
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
flow = layout.column_flow()
|
2009-06-16 12:54:34 +00:00
|
|
|
flow.active = mat.shadeless== False
|
2009-05-20 16:24:04 +00:00
|
|
|
flow.itemR(rayt, "filter", slider=True)
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
flow.itemR(rayt, "limit")
|
2009-05-21 07:40:43 +00:00
|
|
|
flow.itemR(rayt, "falloff")
|
2009-06-13 21:22:21 +00:00
|
|
|
flow.itemR(rayt, "specular_opacity", slider=True, text="Spec Opacity")
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
flow.itemR(rayt, "depth")
|
2009-05-12 19:28:49 +00:00
|
|
|
|
|
|
|
class MATERIAL_PT_halo(MaterialButtonsPanel):
|
|
|
|
__idname__= "MATERIAL_PT_halo"
|
|
|
|
__label__= "Halo"
|
|
|
|
|
2009-05-20 13:34:04 +00:00
|
|
|
def poll(self, context):
|
2009-06-03 00:17:35 +00:00
|
|
|
mat = context.material
|
2009-07-25 21:31:17 +00:00
|
|
|
return (mat and mat.type == 'HALO')
|
2009-05-20 13:34:04 +00:00
|
|
|
|
2009-05-12 19:28:49 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-06-13 21:22:21 +00:00
|
|
|
|
2009-06-03 00:17:35 +00:00
|
|
|
mat = context.material
|
2009-05-20 13:34:04 +00:00
|
|
|
halo = mat.halo
|
2009-05-12 19:28:49 +00:00
|
|
|
|
2009-05-20 13:34:04 +00:00
|
|
|
split = layout.split()
|
|
|
|
|
2009-06-13 21:22:21 +00:00
|
|
|
col = split.column()
|
2009-06-14 18:16:38 +00:00
|
|
|
col.itemR(mat, "diffuse_color", text="")
|
2009-05-21 11:10:34 +00:00
|
|
|
col.itemR(halo, "size")
|
|
|
|
col.itemR(halo, "hardness")
|
|
|
|
col.itemR(halo, "add", slider=True)
|
|
|
|
|
|
|
|
col.itemL(text="Options:")
|
|
|
|
col.itemR(halo, "use_texture", text="Texture")
|
|
|
|
col.itemR(halo, "use_vertex_normal", text="Vertex Normal")
|
|
|
|
col.itemR(halo, "xalpha")
|
|
|
|
col.itemR(halo, "shaded")
|
|
|
|
col.itemR(halo, "soft")
|
|
|
|
|
|
|
|
col = split.column()
|
2009-06-14 18:16:38 +00:00
|
|
|
col = col.column()
|
2009-05-29 09:53:46 +00:00
|
|
|
col.itemR(halo, "ring")
|
|
|
|
colsub = col.column()
|
|
|
|
colsub.active = halo.ring
|
|
|
|
colsub.itemR(halo, "rings")
|
2009-06-14 18:16:38 +00:00
|
|
|
colsub.itemR(mat, "mirror_color", text="")
|
2009-05-29 09:53:46 +00:00
|
|
|
col.itemR(halo, "lines")
|
|
|
|
colsub = col.column()
|
|
|
|
colsub.active = halo.lines
|
|
|
|
colsub.itemR(halo, "line_number", text="Lines")
|
2009-06-14 18:16:38 +00:00
|
|
|
colsub.itemR(mat, "specular_color", text="")
|
2009-05-29 09:53:46 +00:00
|
|
|
col.itemR(halo, "star")
|
|
|
|
colsub = col.column()
|
|
|
|
colsub.active = halo.star
|
|
|
|
colsub.itemR(halo, "star_tips")
|
|
|
|
col.itemR(halo, "flare_mode")
|
|
|
|
colsub = col.column()
|
|
|
|
colsub.active = halo.flare_mode
|
|
|
|
colsub.itemR(halo, "flare_size", text="Size")
|
|
|
|
colsub.itemR(halo, "flare_subsize", text="Subsize")
|
|
|
|
colsub.itemR(halo, "flare_boost", text="Boost")
|
|
|
|
colsub.itemR(halo, "flare_seed", text="Seed")
|
|
|
|
colsub.itemR(halo, "flares_sub", text="Sub")
|
|
|
|
|
2009-07-09 09:07:25 +00:00
|
|
|
|
2009-07-09 09:42:34 +00:00
|
|
|
bpy.types.register(MATERIAL_PT_context_material)
|
2009-05-28 23:45:50 +00:00
|
|
|
bpy.types.register(MATERIAL_PT_preview)
|
2009-05-10 12:12:05 +00:00
|
|
|
bpy.types.register(MATERIAL_PT_material)
|
2009-06-14 18:16:38 +00:00
|
|
|
bpy.types.register(MATERIAL_PT_diffuse)
|
|
|
|
bpy.types.register(MATERIAL_PT_specular)
|
2009-05-10 12:12:05 +00:00
|
|
|
bpy.types.register(MATERIAL_PT_raymir)
|
|
|
|
bpy.types.register(MATERIAL_PT_raytransp)
|
2009-05-12 19:28:49 +00:00
|
|
|
bpy.types.register(MATERIAL_PT_sss)
|
2009-06-03 00:17:35 +00:00
|
|
|
bpy.types.register(MATERIAL_PT_halo)
|
2009-06-16 12:54:34 +00:00
|
|
|
bpy.types.register(MATERIAL_PT_strand)
|
2009-06-18 14:20:25 +00:00
|
|
|
bpy.types.register(MATERIAL_PT_options)
|
2009-07-17 12:35:57 +00:00
|
|
|
bpy.types.register(MATERIAL_PT_shadows)
|