2009-11-01 15:21:20 +00:00
|
|
|
# ##### BEGIN GPL LICENSE BLOCK #####
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
2009-11-03 07:23:02 +00:00
|
|
|
#
|
2009-11-01 15:21:20 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2009-11-03 07:23:02 +00:00
|
|
|
#
|
2009-11-01 15:21:20 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-11-01 15:21:20 +00:00
|
|
|
#
|
|
|
|
# ##### END GPL LICENSE BLOCK #####
|
2009-10-31 20:16:59 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
# <pep8 compliant>
|
2009-05-10 12:12:05 +00:00
|
|
|
import bpy
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
from bpy.types import Menu, Panel, UIList
|
2010-01-08 08:54:41 +00:00
|
|
|
from rna_prop_ui import PropertyPanel
|
2013-02-10 10:29:38 +00:00
|
|
|
from bpy.app.translations import pgettext_iface as iface_
|
2013-02-10 09:09:26 +00:00
|
|
|
|
2011-09-20 18:29:19 +00:00
|
|
|
|
2010-03-22 15:50:16 +00:00
|
|
|
def active_node_mat(mat):
|
|
|
|
# TODO, 2.4x has a pipeline section, for 2.5 we need to communicate
|
|
|
|
# which settings from node-materials are used
|
2010-08-10 18:21:33 +00:00
|
|
|
if mat is not None:
|
2010-03-22 15:50:16 +00:00
|
|
|
mat_node = mat.active_node_material
|
|
|
|
if mat_node:
|
|
|
|
return mat_node
|
|
|
|
else:
|
|
|
|
return mat
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-02-16 19:39:45 +00:00
|
|
|
def check_material(mat):
|
|
|
|
if mat is not None:
|
|
|
|
if mat.use_nodes:
|
|
|
|
if mat.active_node_material is not None:
|
|
|
|
return True
|
|
|
|
return False
|
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
2011-02-22 19:22:27 +00:00
|
|
|
def simple_material(mat):
|
|
|
|
if (mat is not None) and (not mat.use_nodes):
|
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_MT_sss_presets(Menu):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "SSS Presets"
|
2009-11-22 11:23:19 +00:00
|
|
|
preset_subdir = "sss"
|
* Interaction Presets
This adds a new presets menu in the splash screen and the Input section of
User Preferences to choose a preset interaction style, consisting of key configurations
and also other user preferences such as select mouse button, view rotation style, etc.
Currently, just 'Blender' and 'Maya' presets are included, hopefully we can have more
presets contributed (and maintained!) by the community.
It's best to keep these presets minimal to avoid too many key conflicts. In the Maya one
I changed the view manipulation key/mouse combos and also the transform
manipulator keys, not much more than that.
To save an interaction preset, open the user preferences Input section, and press the
[ + ] button next to the presets menu. It will save out a .py file containing any edited key
maps and navigation preferences to the presets/interaction folder in your scripts folder.
---
Part of this commit changes the way that key maps are exported/displayed in
preferences - now partial key configs are allowed. Previously it would export/import the
entire key configuration, regardless of whether individual key maps were edited or not
(which would make them more susceptible to conflicts in unexpected areas).
(note, in blender terminology, a key map is a category of key items, such as
'Object Mode' or 'View 2d'.)
Now, the export and the UI display work in a similar way to how key maps are
processed internally - Locally edited key maps (after pressing the 'Edit' button) are
processed first, falling back to other key maps in the current key config, and then falling
back to the default key config. So it's possible for a key config to only include a few
key maps, and the rest just gets pulled from the default key config. The preferences
UI display works like this too behind the scenes in deciding what to show users,
however using it is just like it was before, the complexity is hidden.
2010-04-14 06:27:50 +00:00
|
|
|
preset_operator = "script.execute_preset"
|
2011-08-12 06:57:00 +00:00
|
|
|
draw = Menu.draw_preset
|
2009-11-22 00:22:29 +00:00
|
|
|
|
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_MT_specials(Menu):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Material Specials"
|
2010-01-28 17:31:11 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
layout.operator("object.material_slot_copy", icon='COPY_ID')
|
|
|
|
layout.operator("material.copy", icon='COPYDOWN')
|
|
|
|
layout.operator("material.paste", icon='PASTEDOWN')
|
|
|
|
|
|
|
|
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
class MATERIAL_UL_matslots(UIList):
|
|
|
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
2012-12-28 10:45:59 +00:00
|
|
|
# assert(isinstance(item, bpy.types.MaterialSlot)
|
2014-04-24 19:31:20 +00:00
|
|
|
# ob = data
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
slot = item
|
|
|
|
ma = slot.material
|
|
|
|
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
2013-11-23 19:37:23 +00:00
|
|
|
if ma:
|
|
|
|
layout.prop(ma, "name", text="", emboss=False, icon_value=icon)
|
|
|
|
else:
|
|
|
|
layout.label(text="", icon_value=icon)
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
if ma and not context.scene.render.use_shading_nodes:
|
|
|
|
manode = ma.active_node_material
|
|
|
|
if manode:
|
2013-02-10 10:29:38 +00:00
|
|
|
layout.label(text=iface_("Node %s") % manode.name, translate=False, icon_value=layout.icon(manode))
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
elif ma.use_nodes:
|
2013-02-09 18:26:40 +00:00
|
|
|
layout.label(text="Node <none>")
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
elif self.layout_type in {'GRID'}:
|
|
|
|
layout.alignment = 'CENTER'
|
2013-02-08 16:01:21 +00:00
|
|
|
layout.label(text="", icon_value=icon)
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
|
|
|
|
|
2010-08-02 02:55:12 +00:00
|
|
|
class MaterialButtonsPanel():
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
bl_region_type = 'WINDOW'
|
|
|
|
bl_context = "material"
|
|
|
|
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
|
2009-05-20 13:34:04 +00:00
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
|
|
|
return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
|
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_context_material(MaterialButtonsPanel, Panel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = ""
|
2010-08-26 01:05:37 +00:00
|
|
|
bl_options = {'HIDE_HEADER'}
|
2009-12-13 16:20:18 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2011-10-17 06:58:07 +00:00
|
|
|
# An exception, don't call the parent poll func because
|
2009-10-31 19:31:45 +00:00
|
|
|
# this manages materials for all engine types
|
|
|
|
|
2010-02-23 12:48:35 +00:00
|
|
|
engine = context.scene.render.engine
|
2010-08-09 01:37:09 +00:00
|
|
|
return (context.material or context.object) and (engine in cls.COMPAT_ENGINES)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
mat = context.material
|
|
|
|
ob = context.object
|
|
|
|
slot = context.material_slot
|
|
|
|
space = context.space_data
|
|
|
|
|
|
|
|
if ob:
|
|
|
|
row = layout.row()
|
|
|
|
|
2013-10-13 23:24:37 +00:00
|
|
|
row.template_list("MATERIAL_UL_matslots", "", ob, "material_slots", ob, "active_material_index", rows=1)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
col = row.column(align=True)
|
2009-12-10 10:23:53 +00:00
|
|
|
col.operator("object.material_slot_add", icon='ZOOMIN', text="")
|
|
|
|
col.operator("object.material_slot_remove", icon='ZOOMOUT', text="")
|
2010-01-31 14:46:28 +00:00
|
|
|
|
2012-05-23 14:24:40 +00:00
|
|
|
col.menu("MATERIAL_MT_specials", icon='DOWNARROW_HLT', text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
if ob.mode == 'EDIT':
|
|
|
|
row = layout.row(align=True)
|
2011-09-21 15:18:38 +00:00
|
|
|
row.operator("object.material_slot_assign", text="Assign")
|
|
|
|
row.operator("object.material_slot_select", text="Select")
|
|
|
|
row.operator("object.material_slot_deselect", text="Deselect")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
split = layout.split(percentage=0.65)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
if ob:
|
|
|
|
split.template_ID(ob, "active_material", new="material.new")
|
|
|
|
row = split.row()
|
|
|
|
if mat:
|
2011-11-08 01:32:34 +00:00
|
|
|
row.prop(mat, "use_nodes", icon='NODETREE', text="")
|
2010-08-06 15:17:44 +00:00
|
|
|
|
|
|
|
if slot:
|
|
|
|
row.prop(slot, "link", text="")
|
2009-11-12 12:35:37 +00:00
|
|
|
else:
|
2010-08-06 15:17:44 +00:00
|
|
|
row.label()
|
|
|
|
elif mat:
|
|
|
|
split.template_ID(space, "pin_id")
|
|
|
|
split.separator()
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
if mat:
|
|
|
|
layout.prop(mat, "type", expand=True)
|
2011-02-16 19:39:45 +00:00
|
|
|
if mat.use_nodes:
|
|
|
|
row = layout.row()
|
|
|
|
row.label(text="", icon='NODETREE')
|
|
|
|
if mat.active_node_material:
|
|
|
|
row.prop(mat.active_node_material, "name", text="")
|
|
|
|
else:
|
2011-09-21 15:18:38 +00:00
|
|
|
row.label(text="No material node selected")
|
2010-09-07 15:17:42 +00:00
|
|
|
|
2009-11-14 13:35:44 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_preview(MaterialButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Preview"
|
2009-12-13 16:20:18 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
2010-08-12 19:36:10 +00:00
|
|
|
self.layout.template_preview(context.material)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_pipeline(MaterialButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Render Pipeline Options"
|
2011-02-16 19:39:45 +00:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2011-02-16 19:39:45 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
|
|
|
mat = context.material
|
|
|
|
engine = context.scene.render.engine
|
2011-03-07 13:23:45 +00:00
|
|
|
return mat and (not simple_material(mat)) and (mat.type in {'SURFACE', 'WIRE', 'VOLUME'}) and (engine in cls.COMPAT_ENGINES)
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2011-02-16 19:39:45 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self. layout
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2011-02-16 19:39:45 +00:00
|
|
|
mat = context.material
|
2011-03-07 13:23:45 +00:00
|
|
|
mat_type = mat.type in {'SURFACE', 'WIRE'}
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2011-02-16 19:39:45 +00:00
|
|
|
row = layout.row()
|
|
|
|
row.active = mat_type
|
|
|
|
row.prop(mat, "use_transparency")
|
|
|
|
sub = row.column()
|
|
|
|
sub.prop(mat, "offset_z")
|
2011-07-19 08:31:53 +00:00
|
|
|
|
2011-02-16 19:39:45 +00:00
|
|
|
sub.active = mat_type and mat.use_transparency and mat.transparency_method == 'Z_TRANSPARENCY'
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2011-02-16 19:39:45 +00:00
|
|
|
row = layout.row()
|
|
|
|
row.active = mat.use_transparency or not mat_type
|
|
|
|
row.prop(mat, "transparency_method", expand=True)
|
2011-02-17 04:35:41 +00:00
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
|
2011-02-16 19:39:45 +00:00
|
|
|
split = layout.split()
|
|
|
|
col = split.column()
|
2011-02-17 04:35:41 +00:00
|
|
|
|
|
|
|
col.prop(mat, "use_raytrace")
|
|
|
|
col.prop(mat, "use_full_oversampling")
|
2011-02-16 19:39:45 +00:00
|
|
|
sub = col.column()
|
|
|
|
sub.active = mat_type
|
|
|
|
sub.prop(mat, "use_sky")
|
|
|
|
sub.prop(mat, "invert_z")
|
2014-04-23 06:02:06 +00:00
|
|
|
col.prop(mat, "pass_index")
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2011-02-16 19:39:45 +00:00
|
|
|
col = split.column()
|
|
|
|
col.active = mat_type
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2014-04-23 06:02:06 +00:00
|
|
|
col.prop(mat, "use_cast_shadows", text="Cast")
|
2011-09-21 15:18:38 +00:00
|
|
|
col.prop(mat, "use_cast_shadows_only", text="Cast Only")
|
2014-02-11 20:41:09 +00:00
|
|
|
col.prop(mat, "use_cast_buffer_shadows")
|
2014-04-23 06:02:06 +00:00
|
|
|
sub = col.column()
|
|
|
|
sub.active = mat.use_cast_buffer_shadows
|
|
|
|
sub.prop(mat, "shadow_cast_alpha", text="Casting Alpha")
|
2011-02-16 19:39:45 +00:00
|
|
|
col.prop(mat, "use_cast_approximate")
|
|
|
|
|
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_diffuse(MaterialButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Diffuse"
|
2009-12-13 16:20:18 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2011-02-16 19:39:45 +00:00
|
|
|
mat = context.material
|
2010-02-23 12:48:35 +00:00
|
|
|
engine = context.scene.render.engine
|
2011-03-07 13:23:45 +00:00
|
|
|
return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
2010-03-22 15:50:16 +00:00
|
|
|
mat = active_node_mat(context.material)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(mat, "diffuse_color", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
sub = col.column()
|
2010-08-20 06:09:58 +00:00
|
|
|
sub.active = (not mat.use_shadeless)
|
2011-09-21 15:18:38 +00:00
|
|
|
sub.prop(mat, "diffuse_intensity", text="Intensity")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2010-08-20 06:09:58 +00:00
|
|
|
col.active = (not mat.use_shadeless)
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(mat, "diffuse_shader", text="")
|
2011-09-21 15:18:38 +00:00
|
|
|
col.prop(mat, "use_diffuse_ramp", text="Ramp")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
col = layout.column()
|
2010-08-20 06:09:58 +00:00
|
|
|
col.active = (not mat.use_shadeless)
|
2009-10-31 19:31:45 +00:00
|
|
|
if mat.diffuse_shader == 'OREN_NAYAR':
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(mat, "roughness")
|
2009-10-31 19:31:45 +00:00
|
|
|
elif mat.diffuse_shader == 'MINNAERT':
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(mat, "darkness")
|
2009-10-31 19:31:45 +00:00
|
|
|
elif mat.diffuse_shader == 'TOON':
|
2011-02-16 19:52:32 +00:00
|
|
|
row = col.row()
|
2011-09-21 15:18:38 +00:00
|
|
|
row.prop(mat, "diffuse_toon_size", text="Size")
|
|
|
|
row.prop(mat, "diffuse_toon_smooth", text="Smooth")
|
2009-10-31 19:31:45 +00:00
|
|
|
elif mat.diffuse_shader == 'FRESNEL':
|
2011-02-16 19:52:32 +00:00
|
|
|
row = col.row()
|
2011-09-21 15:18:38 +00:00
|
|
|
row.prop(mat, "diffuse_fresnel", text="Fresnel")
|
|
|
|
row.prop(mat, "diffuse_fresnel_factor", text="Factor")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
if mat.use_diffuse_ramp:
|
2011-08-02 18:56:03 +00:00
|
|
|
col = layout.column()
|
|
|
|
col.active = (not mat.use_shadeless)
|
|
|
|
col.separator()
|
|
|
|
col.template_color_ramp(mat, "diffuse_ramp", expand=True)
|
|
|
|
col.separator()
|
2009-11-14 13:35:44 +00:00
|
|
|
|
2011-08-02 18:56:03 +00:00
|
|
|
row = col.row()
|
2011-09-21 15:18:38 +00:00
|
|
|
row.prop(mat, "diffuse_ramp_input", text="Input")
|
|
|
|
row.prop(mat, "diffuse_ramp_blend", text="Blend")
|
2011-02-26 16:27:58 +00:00
|
|
|
|
2011-09-21 15:18:38 +00:00
|
|
|
col.prop(mat, "diffuse_ramp_factor", text="Factor")
|
2009-08-25 14:26:27 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_specular(MaterialButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Specular"
|
2009-12-13 16:20:18 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2011-02-16 19:39:45 +00:00
|
|
|
mat = context.material
|
2010-02-23 12:48:35 +00:00
|
|
|
engine = context.scene.render.engine
|
2011-03-07 13:23:45 +00:00
|
|
|
return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
2010-03-22 15:50:16 +00:00
|
|
|
mat = active_node_mat(context.material)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-20 06:09:58 +00:00
|
|
|
layout.active = (not mat.use_shadeless)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(mat, "specular_color", text="")
|
2011-09-21 15:18:38 +00:00
|
|
|
col.prop(mat, "specular_intensity", text="Intensity")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(mat, "specular_shader", text="")
|
2011-09-21 15:18:38 +00:00
|
|
|
col.prop(mat, "use_specular_ramp", text="Ramp")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
col = layout.column()
|
2011-03-07 13:23:45 +00:00
|
|
|
if mat.specular_shader in {'COOKTORR', 'PHONG'}:
|
2011-09-21 15:18:38 +00:00
|
|
|
col.prop(mat, "specular_hardness", text="Hardness")
|
2009-10-31 19:31:45 +00:00
|
|
|
elif mat.specular_shader == 'BLINN':
|
2011-02-16 19:52:32 +00:00
|
|
|
row = col.row()
|
2011-09-21 15:18:38 +00:00
|
|
|
row.prop(mat, "specular_hardness", text="Hardness")
|
|
|
|
row.prop(mat, "specular_ior", text="IOR")
|
2009-10-31 19:31:45 +00:00
|
|
|
elif mat.specular_shader == 'WARDISO':
|
2011-09-21 15:18:38 +00:00
|
|
|
col.prop(mat, "specular_slope", text="Slope")
|
2009-10-31 19:31:45 +00:00
|
|
|
elif mat.specular_shader == 'TOON':
|
2011-02-16 19:52:32 +00:00
|
|
|
row = col.row()
|
2011-09-21 15:18:38 +00:00
|
|
|
row.prop(mat, "specular_toon_size", text="Size")
|
|
|
|
row.prop(mat, "specular_toon_smooth", text="Smooth")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
if mat.use_specular_ramp:
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.separator()
|
2009-10-31 19:31:45 +00:00
|
|
|
layout.template_color_ramp(mat, "specular_ramp", expand=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.separator()
|
2009-11-14 13:35:44 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
row = layout.row()
|
2011-09-21 15:18:38 +00:00
|
|
|
row.prop(mat, "specular_ramp_input", text="Input")
|
|
|
|
row.prop(mat, "specular_ramp_blend", text="Blend")
|
2011-02-26 16:04:14 +00:00
|
|
|
|
2011-09-21 15:18:38 +00:00
|
|
|
layout.prop(mat, "specular_ramp_factor", text="Factor")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_shading(MaterialButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Shading"
|
2010-08-12 19:36:10 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2011-02-16 19:39:45 +00:00
|
|
|
mat = context.material
|
2010-02-23 12:48:35 +00:00
|
|
|
engine = context.scene.render.engine
|
2011-03-07 13:23:45 +00:00
|
|
|
return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
2010-03-22 15:50:16 +00:00
|
|
|
mat = active_node_mat(context.material)
|
2009-11-28 23:37:56 +00:00
|
|
|
|
2011-03-07 13:23:45 +00:00
|
|
|
if mat.type in {'SURFACE', 'WIRE'}:
|
2010-08-12 19:36:10 +00:00
|
|
|
split = layout.split()
|
2009-11-22 00:22:29 +00:00
|
|
|
|
2010-08-12 19:36:10 +00:00
|
|
|
col = split.column()
|
|
|
|
sub = col.column()
|
2010-08-20 06:09:58 +00:00
|
|
|
sub.active = not mat.use_shadeless
|
2010-08-12 19:36:10 +00:00
|
|
|
sub.prop(mat, "emit")
|
|
|
|
sub.prop(mat, "ambient")
|
|
|
|
sub = col.column()
|
|
|
|
sub.prop(mat, "translucency")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-12 19:36:10 +00:00
|
|
|
col = split.column()
|
2010-08-20 06:09:58 +00:00
|
|
|
col.prop(mat, "use_shadeless")
|
2010-08-12 19:36:10 +00:00
|
|
|
sub = col.column()
|
2010-08-20 06:09:58 +00:00
|
|
|
sub.active = not mat.use_shadeless
|
|
|
|
sub.prop(mat, "use_tangent_shading")
|
2010-08-21 04:51:00 +00:00
|
|
|
sub.prop(mat, "use_cubic")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_transp(MaterialButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Transparency"
|
2009-12-13 16:20:18 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2011-02-16 19:39:45 +00:00
|
|
|
mat = context.material
|
2010-02-23 12:48:35 +00:00
|
|
|
engine = context.scene.render.engine
|
2011-03-07 13:23:45 +00:00
|
|
|
return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
|
2011-02-25 16:06:14 +00:00
|
|
|
|
2011-02-22 19:22:27 +00:00
|
|
|
def draw_header(self, context):
|
|
|
|
mat = context.material
|
2011-02-25 16:06:14 +00:00
|
|
|
|
2011-02-22 19:22:27 +00:00
|
|
|
if simple_material(mat):
|
|
|
|
self.layout.prop(mat, "use_transparency", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2011-02-16 19:39:45 +00:00
|
|
|
base_mat = context.material
|
2010-03-22 15:50:16 +00:00
|
|
|
mat = active_node_mat(context.material)
|
2010-08-12 19:36:10 +00:00
|
|
|
rayt = mat.raytrace_transparency
|
2011-02-25 16:06:14 +00:00
|
|
|
|
2011-02-22 19:22:27 +00:00
|
|
|
if simple_material(base_mat):
|
|
|
|
row = layout.row()
|
|
|
|
row.active = mat.use_transparency
|
|
|
|
row.prop(mat, "transparency_method", expand=True)
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
split = layout.split()
|
2011-03-11 07:59:43 +00:00
|
|
|
split.active = base_mat.use_transparency
|
2011-02-25 16:06:14 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
col = split.column()
|
2010-08-12 19:36:10 +00:00
|
|
|
col.prop(mat, "alpha")
|
|
|
|
row = col.row()
|
2011-03-11 07:59:43 +00:00
|
|
|
row.active = (base_mat.transparency_method != 'MASK') and (not mat.use_shadeless)
|
2011-09-21 15:18:38 +00:00
|
|
|
row.prop(mat, "specular_alpha", text="Specular")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2010-08-20 06:09:58 +00:00
|
|
|
col.active = (not mat.use_shadeless)
|
2010-08-12 19:36:10 +00:00
|
|
|
col.prop(rayt, "fresnel")
|
2009-10-31 19:31:45 +00:00
|
|
|
sub = col.column()
|
2014-01-17 22:13:51 +00:00
|
|
|
sub.active = (rayt.fresnel > 0.0)
|
2011-09-21 15:18:38 +00:00
|
|
|
sub.prop(rayt, "fresnel_factor", text="Blend")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2011-02-16 19:39:45 +00:00
|
|
|
if base_mat.transparency_method == 'RAYTRACE':
|
2010-08-12 19:36:10 +00:00
|
|
|
layout.separator()
|
|
|
|
split = layout.split()
|
2011-02-16 19:39:45 +00:00
|
|
|
split.active = base_mat.use_transparency
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-12 19:36:10 +00:00
|
|
|
col = split.column()
|
|
|
|
col.prop(rayt, "ior")
|
|
|
|
col.prop(rayt, "filter")
|
|
|
|
col.prop(rayt, "falloff")
|
2010-08-21 04:51:00 +00:00
|
|
|
col.prop(rayt, "depth_max")
|
2010-08-12 19:36:10 +00:00
|
|
|
col.prop(rayt, "depth")
|
2009-08-25 14:26:27 +00:00
|
|
|
|
2010-08-12 19:36:10 +00:00
|
|
|
col = split.column()
|
2011-09-21 15:18:38 +00:00
|
|
|
col.label(text="Gloss:")
|
|
|
|
col.prop(rayt, "gloss_factor", text="Amount")
|
2010-08-12 19:36:10 +00:00
|
|
|
sub = col.column()
|
|
|
|
sub.active = rayt.gloss_factor < 1.0
|
2011-09-21 15:18:38 +00:00
|
|
|
sub.prop(rayt, "gloss_threshold", text="Threshold")
|
|
|
|
sub.prop(rayt, "gloss_samples", text="Samples")
|
2010-09-07 15:17:42 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_mirror(MaterialButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Mirror"
|
2010-08-26 01:05:37 +00:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
2009-12-13 16:20:18 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2011-02-16 19:39:45 +00:00
|
|
|
mat = context.material
|
2010-02-23 12:48:35 +00:00
|
|
|
engine = context.scene.render.engine
|
2011-03-07 13:23:45 +00:00
|
|
|
return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw_header(self, context):
|
2010-08-12 19:36:10 +00:00
|
|
|
raym = active_node_mat(context.material).raytrace_mirror
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2010-08-18 07:14:10 +00:00
|
|
|
self.layout.prop(raym, "use", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
2010-03-22 15:50:16 +00:00
|
|
|
mat = active_node_mat(context.material)
|
2010-08-12 19:36:10 +00:00
|
|
|
raym = mat.raytrace_mirror
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-18 07:14:10 +00:00
|
|
|
layout.active = raym.use
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2010-08-12 19:36:10 +00:00
|
|
|
col.prop(raym, "reflect_factor")
|
|
|
|
col.prop(mat, "mirror_color", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2010-08-12 19:36:10 +00:00
|
|
|
col.prop(raym, "fresnel")
|
2009-10-31 19:31:45 +00:00
|
|
|
sub = col.column()
|
2014-01-17 22:13:51 +00:00
|
|
|
sub.active = (raym.fresnel > 0.0)
|
2011-09-21 15:18:38 +00:00
|
|
|
sub.prop(raym, "fresnel_factor", text="Blend")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-12 19:36:10 +00:00
|
|
|
split = layout.split()
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-12 19:36:10 +00:00
|
|
|
col = split.column()
|
|
|
|
col.separator()
|
|
|
|
col.prop(raym, "depth")
|
2011-09-21 15:18:38 +00:00
|
|
|
col.prop(raym, "distance", text="Max Dist")
|
2010-08-12 19:36:10 +00:00
|
|
|
col.separator()
|
|
|
|
sub = col.split(percentage=0.4)
|
2014-01-17 22:13:51 +00:00
|
|
|
sub.active = (raym.distance > 0.0)
|
2011-09-21 15:18:38 +00:00
|
|
|
sub.label(text="Fade To:")
|
2010-08-12 19:36:10 +00:00
|
|
|
sub.prop(raym, "fade_to", text="")
|
2009-08-13 05:21:25 +00:00
|
|
|
|
2010-08-12 19:36:10 +00:00
|
|
|
col = split.column()
|
2011-09-21 15:18:38 +00:00
|
|
|
col.label(text="Gloss:")
|
|
|
|
col.prop(raym, "gloss_factor", text="Amount")
|
2010-08-12 19:36:10 +00:00
|
|
|
sub = col.column()
|
2014-01-17 22:13:51 +00:00
|
|
|
sub.active = (raym.gloss_factor < 1.0)
|
2011-09-21 15:18:38 +00:00
|
|
|
sub.prop(raym, "gloss_threshold", text="Threshold")
|
|
|
|
sub.prop(raym, "gloss_samples", text="Samples")
|
|
|
|
sub.prop(raym, "gloss_anisotropic", text="Anisotropic")
|
2010-01-31 14:46:28 +00:00
|
|
|
|
2010-08-12 19:36:10 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_sss(MaterialButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Subsurface Scattering"
|
2010-08-26 01:05:37 +00:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
2010-08-12 19:36:10 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
2010-01-12 02:32:21 +00:00
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2011-02-16 19:39:45 +00:00
|
|
|
mat = context.material
|
2010-02-23 12:48:35 +00:00
|
|
|
engine = context.scene.render.engine
|
2011-03-07 13:23:45 +00:00
|
|
|
return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
|
2010-01-12 02:32:21 +00:00
|
|
|
|
|
|
|
def draw_header(self, context):
|
2010-03-22 15:50:16 +00:00
|
|
|
mat = active_node_mat(context.material)
|
2010-08-12 19:36:10 +00:00
|
|
|
sss = mat.subsurface_scattering
|
2010-01-12 02:32:21 +00:00
|
|
|
|
2010-08-20 06:09:58 +00:00
|
|
|
self.layout.active = (not mat.use_shadeless)
|
2010-08-18 07:14:10 +00:00
|
|
|
self.layout.prop(sss, "use", text="")
|
2010-01-12 02:32:21 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
2010-03-22 15:50:16 +00:00
|
|
|
mat = active_node_mat(context.material)
|
2010-08-12 19:36:10 +00:00
|
|
|
sss = mat.subsurface_scattering
|
2010-01-12 02:32:21 +00:00
|
|
|
|
2010-08-20 06:09:58 +00:00
|
|
|
layout.active = (sss.use) and (not mat.use_shadeless)
|
2010-08-12 19:36:10 +00:00
|
|
|
|
|
|
|
row = layout.row().split()
|
2013-10-11 15:45:42 +00:00
|
|
|
sub = row.row(align=True).split(align=True, percentage=0.75)
|
2010-08-12 19:36:10 +00:00
|
|
|
sub.menu("MATERIAL_MT_sss_presets", text=bpy.types.MATERIAL_MT_sss_presets.bl_label)
|
2011-11-08 01:32:34 +00:00
|
|
|
sub.operator("material.sss_preset_add", text="", icon='ZOOMIN')
|
|
|
|
sub.operator("material.sss_preset_add", text="", icon='ZOOMOUT').remove_active = True
|
2010-01-12 02:32:21 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2010-08-12 19:36:10 +00:00
|
|
|
col.prop(sss, "ior")
|
|
|
|
col.prop(sss, "scale")
|
|
|
|
col.prop(sss, "color", text="")
|
2011-09-21 15:18:38 +00:00
|
|
|
col.prop(sss, "radius", text="RGB Radius", expand=True)
|
2010-08-12 19:36:10 +00:00
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
sub = col.column(align=True)
|
2011-09-21 15:18:38 +00:00
|
|
|
sub.label(text="Blend:")
|
|
|
|
sub.prop(sss, "color_factor", text="Color")
|
|
|
|
sub.prop(sss, "texture_factor", text="Texture")
|
|
|
|
sub.label(text="Scattering Weight:")
|
2010-08-12 19:36:10 +00:00
|
|
|
sub.prop(sss, "front")
|
|
|
|
sub.prop(sss, "back")
|
|
|
|
col.separator()
|
2011-09-21 15:18:38 +00:00
|
|
|
col.prop(sss, "error_threshold", text="Error")
|
2010-01-31 14:46:28 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_halo(MaterialButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Halo"
|
2009-12-13 16:20:18 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-10-31 19:31:45 +00:00
|
|
|
mat = context.material
|
2010-02-23 12:48:35 +00:00
|
|
|
engine = context.scene.render.engine
|
2010-08-09 01:37:09 +00:00
|
|
|
return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
2011-10-17 06:58:07 +00:00
|
|
|
mat = context.material # don't use node material
|
2009-10-31 19:31:45 +00:00
|
|
|
halo = mat.halo
|
|
|
|
|
2010-12-08 20:10:59 +00:00
|
|
|
def number_but(layout, toggle, number, name, color):
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.prop(halo, toggle, text="")
|
2013-08-23 20:41:21 +00:00
|
|
|
sub = row.column(align=True)
|
2010-12-08 20:10:59 +00:00
|
|
|
sub.active = getattr(halo, toggle)
|
2013-02-17 13:56:49 +00:00
|
|
|
sub.prop(halo, number, text=name, translate=False)
|
2010-12-08 20:10:59 +00:00
|
|
|
if not color == "":
|
|
|
|
sub.prop(mat, color, text="")
|
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2010-12-08 20:10:59 +00:00
|
|
|
col.prop(mat, "alpha")
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(mat, "diffuse_color", text="")
|
2011-05-02 08:56:53 +00:00
|
|
|
col.prop(halo, "seed")
|
2010-12-08 20:10:59 +00:00
|
|
|
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(halo, "size")
|
|
|
|
col.prop(halo, "hardness")
|
|
|
|
col.prop(halo, "add")
|
2010-12-08 20:10:59 +00:00
|
|
|
|
2011-09-21 15:18:38 +00:00
|
|
|
layout.label(text="Options:")
|
2010-12-08 20:10:59 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
col = split.column()
|
2010-08-21 04:51:00 +00:00
|
|
|
col.prop(halo, "use_texture")
|
2010-08-20 06:09:58 +00:00
|
|
|
col.prop(halo, "use_vertex_normal")
|
|
|
|
col.prop(halo, "use_extreme_alpha")
|
2010-08-21 04:51:00 +00:00
|
|
|
col.prop(halo, "use_shaded")
|
|
|
|
col.prop(halo, "use_soft")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2013-02-17 13:56:49 +00:00
|
|
|
number_but(col, "use_ring", "ring_count", iface_("Rings"), "mirror_color")
|
|
|
|
number_but(col, "use_lines", "line_count", iface_("Lines"), "specular_color")
|
|
|
|
number_but(col, "use_star", "star_tip_count", iface_("Star Tips"), "")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_flare(MaterialButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Flare"
|
2009-12-13 16:20:18 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-10-31 19:31:45 +00:00
|
|
|
mat = context.material
|
2010-02-23 12:48:35 +00:00
|
|
|
engine = context.scene.render.engine
|
2010-08-09 01:37:09 +00:00
|
|
|
return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw_header(self, context):
|
|
|
|
halo = context.material.halo
|
|
|
|
|
2010-08-20 06:09:58 +00:00
|
|
|
self.layout.prop(halo, "use_flare_mode", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
2011-10-17 06:58:07 +00:00
|
|
|
mat = context.material # don't use node material
|
2009-10-31 19:31:45 +00:00
|
|
|
halo = mat.halo
|
|
|
|
|
2010-08-20 06:09:58 +00:00
|
|
|
layout.active = halo.use_flare_mode
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2011-09-21 15:18:38 +00:00
|
|
|
col.prop(halo, "flare_size", text="Size")
|
|
|
|
col.prop(halo, "flare_boost", text="Boost")
|
|
|
|
col.prop(halo, "flare_seed", text="Seed")
|
2010-08-06 15:17:44 +00:00
|
|
|
|
|
|
|
col = split.column()
|
2011-09-21 15:18:38 +00:00
|
|
|
col.prop(halo, "flare_subflare_count", text="Subflares")
|
|
|
|
col.prop(halo, "flare_subflare_size", text="Subsize")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-01-31 14:46:28 +00:00
|
|
|
|
2011-11-11 03:28:46 +00:00
|
|
|
class MATERIAL_PT_game_settings(MaterialButtonsPanel, Panel):
|
TexFace to Material Settings big patch
Summary:
========
The idea here is to move the texface options into the material panel.
For images with the change please visit:
http://code.blender.org/index.php/2011/09/bge-material-texface-changes
1 - Some of the legacy problems 2.49 and 2.5x has with the texface system:
==========================================================================
1.1) Shadow, Bilboard and Halo are mutual exclusive (in the code), yet you can
select a face to be more than one mode.
1.2) Sort only works for blend Alpha yet it's an option regardless of the
Transparency Blend you pick.
1.3) Shared doesn't affect anything in BGE.
1.4) ObColor only works for Text objects (old bitmap texts) when using Texture
Face Materials. (not address yet, I so far ignored obcolor)
2 - Notes:
============
2.1) Now "Use Face Textures" in material Option panel will work in Multitexture
even if there is no texture channel.
2.2) In FaceTexture mode it will use TexFace all the time, even if you don't
check the "Use Texture Face" option in the UI. It's a matter of decision, since
the code for either way is there. I decided by the solution that makes the
creation of a material fast - in this mode the user doesn't need to mess with
textures or this "Use Texture Face" option at all. I'm not strong in my opinion
here. But I think if we don't have this then what is the point of the Texture
Face mode?
2.3) I kept references for tface only when we need the image, UV or the tiling
setting. It should help later when/if we split the Image and UV layers from the
tface struct (Campbell and Brecht proposal).
3 - Changes in a Nutshell:
==========================
3.1) "Texture Face" panel (in the Mesh/Object Data panel) no longer exists. Those settings are all part of the material properties, visible when Game Render is set.
3.2) "Texture Face" Shading mode (in the Render panel) is now called “Single Texture”, it needs a material for special settings (e.g. Billboard, Alpha Sort, …).
3.3) New options in the Material Panel
* Shadeless option in the Material panel is now supported for all three Shading modes.
* Physics is now toggleable, this is the old Collision option.
* Two Side (on) is now called Back Culling (off).
* Alpha Sort is one of the Alpha options, together (and mutually exclusive) to Alpha Blend, Alpha Clip, Add and Opaque (i.e. solid).
* Shadow, Billboard and Halo are grouped in the “Face Orientation” property.
* "Face Textures" and "Face Textures Alpha" (under Options) can be used for all but GLSL shading mode (to be supported in GLSL eventually).
* The backend in the game engine is still the same as before. The only changes are in the interface and in the way you need to think your materials. The bottomline is: It’s no longer possible to share materials between faces that do not share the same game properties.
4 - Acknowledgment:
==================
Mike Pan for the design discussions, and testing along the whole development process.
Vitor Balbio for the first hands-on code with the interface changes. That helped me a lot to push me into work on that.
Benoit Bolsee and Brecht van Lommel for patch review (* no one reviewed the whole patch, or the latest iteractions, so I still hold liability for any problems).
Blender artists that gave feedback and helped testing the patch.
Patch review and original documentation can be found here:
http://wiki.blender.org/index.php/User:Dfelinto/TexFace
http://codereview.appspot.com/4289041/
2011-09-19 19:55:59 +00:00
|
|
|
bl_label = "Game Settings"
|
|
|
|
COMPAT_ENGINES = {'BLENDER_GAME'}
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2011-09-20 18:29:19 +00:00
|
|
|
return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
|
TexFace to Material Settings big patch
Summary:
========
The idea here is to move the texface options into the material panel.
For images with the change please visit:
http://code.blender.org/index.php/2011/09/bge-material-texface-changes
1 - Some of the legacy problems 2.49 and 2.5x has with the texface system:
==========================================================================
1.1) Shadow, Bilboard and Halo are mutual exclusive (in the code), yet you can
select a face to be more than one mode.
1.2) Sort only works for blend Alpha yet it's an option regardless of the
Transparency Blend you pick.
1.3) Shared doesn't affect anything in BGE.
1.4) ObColor only works for Text objects (old bitmap texts) when using Texture
Face Materials. (not address yet, I so far ignored obcolor)
2 - Notes:
============
2.1) Now "Use Face Textures" in material Option panel will work in Multitexture
even if there is no texture channel.
2.2) In FaceTexture mode it will use TexFace all the time, even if you don't
check the "Use Texture Face" option in the UI. It's a matter of decision, since
the code for either way is there. I decided by the solution that makes the
creation of a material fast - in this mode the user doesn't need to mess with
textures or this "Use Texture Face" option at all. I'm not strong in my opinion
here. But I think if we don't have this then what is the point of the Texture
Face mode?
2.3) I kept references for tface only when we need the image, UV or the tiling
setting. It should help later when/if we split the Image and UV layers from the
tface struct (Campbell and Brecht proposal).
3 - Changes in a Nutshell:
==========================
3.1) "Texture Face" panel (in the Mesh/Object Data panel) no longer exists. Those settings are all part of the material properties, visible when Game Render is set.
3.2) "Texture Face" Shading mode (in the Render panel) is now called “Single Texture”, it needs a material for special settings (e.g. Billboard, Alpha Sort, …).
3.3) New options in the Material Panel
* Shadeless option in the Material panel is now supported for all three Shading modes.
* Physics is now toggleable, this is the old Collision option.
* Two Side (on) is now called Back Culling (off).
* Alpha Sort is one of the Alpha options, together (and mutually exclusive) to Alpha Blend, Alpha Clip, Add and Opaque (i.e. solid).
* Shadow, Billboard and Halo are grouped in the “Face Orientation” property.
* "Face Textures" and "Face Textures Alpha" (under Options) can be used for all but GLSL shading mode (to be supported in GLSL eventually).
* The backend in the game engine is still the same as before. The only changes are in the interface and in the way you need to think your materials. The bottomline is: It’s no longer possible to share materials between faces that do not share the same game properties.
4 - Acknowledgment:
==================
Mike Pan for the design discussions, and testing along the whole development process.
Vitor Balbio for the first hands-on code with the interface changes. That helped me a lot to push me into work on that.
Benoit Bolsee and Brecht van Lommel for patch review (* no one reviewed the whole patch, or the latest iteractions, so I still hold liability for any problems).
Blender artists that gave feedback and helped testing the patch.
Patch review and original documentation can be found here:
http://wiki.blender.org/index.php/User:Dfelinto/TexFace
http://codereview.appspot.com/4289041/
2011-09-19 19:55:59 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2011-10-17 06:58:07 +00:00
|
|
|
game = context.material.game_settings # don't use node material
|
TexFace to Material Settings big patch
Summary:
========
The idea here is to move the texface options into the material panel.
For images with the change please visit:
http://code.blender.org/index.php/2011/09/bge-material-texface-changes
1 - Some of the legacy problems 2.49 and 2.5x has with the texface system:
==========================================================================
1.1) Shadow, Bilboard and Halo are mutual exclusive (in the code), yet you can
select a face to be more than one mode.
1.2) Sort only works for blend Alpha yet it's an option regardless of the
Transparency Blend you pick.
1.3) Shared doesn't affect anything in BGE.
1.4) ObColor only works for Text objects (old bitmap texts) when using Texture
Face Materials. (not address yet, I so far ignored obcolor)
2 - Notes:
============
2.1) Now "Use Face Textures" in material Option panel will work in Multitexture
even if there is no texture channel.
2.2) In FaceTexture mode it will use TexFace all the time, even if you don't
check the "Use Texture Face" option in the UI. It's a matter of decision, since
the code for either way is there. I decided by the solution that makes the
creation of a material fast - in this mode the user doesn't need to mess with
textures or this "Use Texture Face" option at all. I'm not strong in my opinion
here. But I think if we don't have this then what is the point of the Texture
Face mode?
2.3) I kept references for tface only when we need the image, UV or the tiling
setting. It should help later when/if we split the Image and UV layers from the
tface struct (Campbell and Brecht proposal).
3 - Changes in a Nutshell:
==========================
3.1) "Texture Face" panel (in the Mesh/Object Data panel) no longer exists. Those settings are all part of the material properties, visible when Game Render is set.
3.2) "Texture Face" Shading mode (in the Render panel) is now called “Single Texture”, it needs a material for special settings (e.g. Billboard, Alpha Sort, …).
3.3) New options in the Material Panel
* Shadeless option in the Material panel is now supported for all three Shading modes.
* Physics is now toggleable, this is the old Collision option.
* Two Side (on) is now called Back Culling (off).
* Alpha Sort is one of the Alpha options, together (and mutually exclusive) to Alpha Blend, Alpha Clip, Add and Opaque (i.e. solid).
* Shadow, Billboard and Halo are grouped in the “Face Orientation” property.
* "Face Textures" and "Face Textures Alpha" (under Options) can be used for all but GLSL shading mode (to be supported in GLSL eventually).
* The backend in the game engine is still the same as before. The only changes are in the interface and in the way you need to think your materials. The bottomline is: It’s no longer possible to share materials between faces that do not share the same game properties.
4 - Acknowledgment:
==================
Mike Pan for the design discussions, and testing along the whole development process.
Vitor Balbio for the first hands-on code with the interface changes. That helped me a lot to push me into work on that.
Benoit Bolsee and Brecht van Lommel for patch review (* no one reviewed the whole patch, or the latest iteractions, so I still hold liability for any problems).
Blender artists that gave feedback and helped testing the patch.
Patch review and original documentation can be found here:
http://wiki.blender.org/index.php/User:Dfelinto/TexFace
http://codereview.appspot.com/4289041/
2011-09-19 19:55:59 +00:00
|
|
|
|
|
|
|
row = layout.row()
|
2011-09-26 10:35:47 +00:00
|
|
|
row.prop(game, "use_backface_culling")
|
TexFace to Material Settings big patch
Summary:
========
The idea here is to move the texface options into the material panel.
For images with the change please visit:
http://code.blender.org/index.php/2011/09/bge-material-texface-changes
1 - Some of the legacy problems 2.49 and 2.5x has with the texface system:
==========================================================================
1.1) Shadow, Bilboard and Halo are mutual exclusive (in the code), yet you can
select a face to be more than one mode.
1.2) Sort only works for blend Alpha yet it's an option regardless of the
Transparency Blend you pick.
1.3) Shared doesn't affect anything in BGE.
1.4) ObColor only works for Text objects (old bitmap texts) when using Texture
Face Materials. (not address yet, I so far ignored obcolor)
2 - Notes:
============
2.1) Now "Use Face Textures" in material Option panel will work in Multitexture
even if there is no texture channel.
2.2) In FaceTexture mode it will use TexFace all the time, even if you don't
check the "Use Texture Face" option in the UI. It's a matter of decision, since
the code for either way is there. I decided by the solution that makes the
creation of a material fast - in this mode the user doesn't need to mess with
textures or this "Use Texture Face" option at all. I'm not strong in my opinion
here. But I think if we don't have this then what is the point of the Texture
Face mode?
2.3) I kept references for tface only when we need the image, UV or the tiling
setting. It should help later when/if we split the Image and UV layers from the
tface struct (Campbell and Brecht proposal).
3 - Changes in a Nutshell:
==========================
3.1) "Texture Face" panel (in the Mesh/Object Data panel) no longer exists. Those settings are all part of the material properties, visible when Game Render is set.
3.2) "Texture Face" Shading mode (in the Render panel) is now called “Single Texture”, it needs a material for special settings (e.g. Billboard, Alpha Sort, …).
3.3) New options in the Material Panel
* Shadeless option in the Material panel is now supported for all three Shading modes.
* Physics is now toggleable, this is the old Collision option.
* Two Side (on) is now called Back Culling (off).
* Alpha Sort is one of the Alpha options, together (and mutually exclusive) to Alpha Blend, Alpha Clip, Add and Opaque (i.e. solid).
* Shadow, Billboard and Halo are grouped in the “Face Orientation” property.
* "Face Textures" and "Face Textures Alpha" (under Options) can be used for all but GLSL shading mode (to be supported in GLSL eventually).
* The backend in the game engine is still the same as before. The only changes are in the interface and in the way you need to think your materials. The bottomline is: It’s no longer possible to share materials between faces that do not share the same game properties.
4 - Acknowledgment:
==================
Mike Pan for the design discussions, and testing along the whole development process.
Vitor Balbio for the first hands-on code with the interface changes. That helped me a lot to push me into work on that.
Benoit Bolsee and Brecht van Lommel for patch review (* no one reviewed the whole patch, or the latest iteractions, so I still hold liability for any problems).
Blender artists that gave feedback and helped testing the patch.
Patch review and original documentation can be found here:
http://wiki.blender.org/index.php/User:Dfelinto/TexFace
http://codereview.appspot.com/4289041/
2011-09-19 19:55:59 +00:00
|
|
|
row.prop(game, "invisible")
|
|
|
|
row.prop(game, "text")
|
|
|
|
|
|
|
|
row = layout.row()
|
|
|
|
row.label(text="Alpha Blend:")
|
|
|
|
row.label(text="Face Orientation:")
|
|
|
|
row = layout.row()
|
2011-09-20 18:29:19 +00:00
|
|
|
row.prop(game, "alpha_blend", text="")
|
|
|
|
row.prop(game, "face_orientation", text="")
|
|
|
|
|
TexFace to Material Settings big patch
Summary:
========
The idea here is to move the texface options into the material panel.
For images with the change please visit:
http://code.blender.org/index.php/2011/09/bge-material-texface-changes
1 - Some of the legacy problems 2.49 and 2.5x has with the texface system:
==========================================================================
1.1) Shadow, Bilboard and Halo are mutual exclusive (in the code), yet you can
select a face to be more than one mode.
1.2) Sort only works for blend Alpha yet it's an option regardless of the
Transparency Blend you pick.
1.3) Shared doesn't affect anything in BGE.
1.4) ObColor only works for Text objects (old bitmap texts) when using Texture
Face Materials. (not address yet, I so far ignored obcolor)
2 - Notes:
============
2.1) Now "Use Face Textures" in material Option panel will work in Multitexture
even if there is no texture channel.
2.2) In FaceTexture mode it will use TexFace all the time, even if you don't
check the "Use Texture Face" option in the UI. It's a matter of decision, since
the code for either way is there. I decided by the solution that makes the
creation of a material fast - in this mode the user doesn't need to mess with
textures or this "Use Texture Face" option at all. I'm not strong in my opinion
here. But I think if we don't have this then what is the point of the Texture
Face mode?
2.3) I kept references for tface only when we need the image, UV or the tiling
setting. It should help later when/if we split the Image and UV layers from the
tface struct (Campbell and Brecht proposal).
3 - Changes in a Nutshell:
==========================
3.1) "Texture Face" panel (in the Mesh/Object Data panel) no longer exists. Those settings are all part of the material properties, visible when Game Render is set.
3.2) "Texture Face" Shading mode (in the Render panel) is now called “Single Texture”, it needs a material for special settings (e.g. Billboard, Alpha Sort, …).
3.3) New options in the Material Panel
* Shadeless option in the Material panel is now supported for all three Shading modes.
* Physics is now toggleable, this is the old Collision option.
* Two Side (on) is now called Back Culling (off).
* Alpha Sort is one of the Alpha options, together (and mutually exclusive) to Alpha Blend, Alpha Clip, Add and Opaque (i.e. solid).
* Shadow, Billboard and Halo are grouped in the “Face Orientation” property.
* "Face Textures" and "Face Textures Alpha" (under Options) can be used for all but GLSL shading mode (to be supported in GLSL eventually).
* The backend in the game engine is still the same as before. The only changes are in the interface and in the way you need to think your materials. The bottomline is: It’s no longer possible to share materials between faces that do not share the same game properties.
4 - Acknowledgment:
==================
Mike Pan for the design discussions, and testing along the whole development process.
Vitor Balbio for the first hands-on code with the interface changes. That helped me a lot to push me into work on that.
Benoit Bolsee and Brecht van Lommel for patch review (* no one reviewed the whole patch, or the latest iteractions, so I still hold liability for any problems).
Blender artists that gave feedback and helped testing the patch.
Patch review and original documentation can be found here:
http://wiki.blender.org/index.php/User:Dfelinto/TexFace
http://codereview.appspot.com/4289041/
2011-09-19 19:55:59 +00:00
|
|
|
|
2011-11-11 03:28:46 +00:00
|
|
|
class MATERIAL_PT_physics(MaterialButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Physics"
|
2010-08-12 19:36:10 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_GAME'}
|
2011-09-20 18:29:19 +00:00
|
|
|
|
TexFace to Material Settings big patch
Summary:
========
The idea here is to move the texface options into the material panel.
For images with the change please visit:
http://code.blender.org/index.php/2011/09/bge-material-texface-changes
1 - Some of the legacy problems 2.49 and 2.5x has with the texface system:
==========================================================================
1.1) Shadow, Bilboard and Halo are mutual exclusive (in the code), yet you can
select a face to be more than one mode.
1.2) Sort only works for blend Alpha yet it's an option regardless of the
Transparency Blend you pick.
1.3) Shared doesn't affect anything in BGE.
1.4) ObColor only works for Text objects (old bitmap texts) when using Texture
Face Materials. (not address yet, I so far ignored obcolor)
2 - Notes:
============
2.1) Now "Use Face Textures" in material Option panel will work in Multitexture
even if there is no texture channel.
2.2) In FaceTexture mode it will use TexFace all the time, even if you don't
check the "Use Texture Face" option in the UI. It's a matter of decision, since
the code for either way is there. I decided by the solution that makes the
creation of a material fast - in this mode the user doesn't need to mess with
textures or this "Use Texture Face" option at all. I'm not strong in my opinion
here. But I think if we don't have this then what is the point of the Texture
Face mode?
2.3) I kept references for tface only when we need the image, UV or the tiling
setting. It should help later when/if we split the Image and UV layers from the
tface struct (Campbell and Brecht proposal).
3 - Changes in a Nutshell:
==========================
3.1) "Texture Face" panel (in the Mesh/Object Data panel) no longer exists. Those settings are all part of the material properties, visible when Game Render is set.
3.2) "Texture Face" Shading mode (in the Render panel) is now called “Single Texture”, it needs a material for special settings (e.g. Billboard, Alpha Sort, …).
3.3) New options in the Material Panel
* Shadeless option in the Material panel is now supported for all three Shading modes.
* Physics is now toggleable, this is the old Collision option.
* Two Side (on) is now called Back Culling (off).
* Alpha Sort is one of the Alpha options, together (and mutually exclusive) to Alpha Blend, Alpha Clip, Add and Opaque (i.e. solid).
* Shadow, Billboard and Halo are grouped in the “Face Orientation” property.
* "Face Textures" and "Face Textures Alpha" (under Options) can be used for all but GLSL shading mode (to be supported in GLSL eventually).
* The backend in the game engine is still the same as before. The only changes are in the interface and in the way you need to think your materials. The bottomline is: It’s no longer possible to share materials between faces that do not share the same game properties.
4 - Acknowledgment:
==================
Mike Pan for the design discussions, and testing along the whole development process.
Vitor Balbio for the first hands-on code with the interface changes. That helped me a lot to push me into work on that.
Benoit Bolsee and Brecht van Lommel for patch review (* no one reviewed the whole patch, or the latest iteractions, so I still hold liability for any problems).
Blender artists that gave feedback and helped testing the patch.
Patch review and original documentation can be found here:
http://wiki.blender.org/index.php/User:Dfelinto/TexFace
http://codereview.appspot.com/4289041/
2011-09-19 19:55:59 +00:00
|
|
|
def draw_header(self, context):
|
|
|
|
game = context.material.game_settings
|
|
|
|
self.layout.prop(game, "physics", text="")
|
2010-08-12 19:36:10 +00:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
|
|
|
return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
TexFace to Material Settings big patch
Summary:
========
The idea here is to move the texface options into the material panel.
For images with the change please visit:
http://code.blender.org/index.php/2011/09/bge-material-texface-changes
1 - Some of the legacy problems 2.49 and 2.5x has with the texface system:
==========================================================================
1.1) Shadow, Bilboard and Halo are mutual exclusive (in the code), yet you can
select a face to be more than one mode.
1.2) Sort only works for blend Alpha yet it's an option regardless of the
Transparency Blend you pick.
1.3) Shared doesn't affect anything in BGE.
1.4) ObColor only works for Text objects (old bitmap texts) when using Texture
Face Materials. (not address yet, I so far ignored obcolor)
2 - Notes:
============
2.1) Now "Use Face Textures" in material Option panel will work in Multitexture
even if there is no texture channel.
2.2) In FaceTexture mode it will use TexFace all the time, even if you don't
check the "Use Texture Face" option in the UI. It's a matter of decision, since
the code for either way is there. I decided by the solution that makes the
creation of a material fast - in this mode the user doesn't need to mess with
textures or this "Use Texture Face" option at all. I'm not strong in my opinion
here. But I think if we don't have this then what is the point of the Texture
Face mode?
2.3) I kept references for tface only when we need the image, UV or the tiling
setting. It should help later when/if we split the Image and UV layers from the
tface struct (Campbell and Brecht proposal).
3 - Changes in a Nutshell:
==========================
3.1) "Texture Face" panel (in the Mesh/Object Data panel) no longer exists. Those settings are all part of the material properties, visible when Game Render is set.
3.2) "Texture Face" Shading mode (in the Render panel) is now called “Single Texture”, it needs a material for special settings (e.g. Billboard, Alpha Sort, …).
3.3) New options in the Material Panel
* Shadeless option in the Material panel is now supported for all three Shading modes.
* Physics is now toggleable, this is the old Collision option.
* Two Side (on) is now called Back Culling (off).
* Alpha Sort is one of the Alpha options, together (and mutually exclusive) to Alpha Blend, Alpha Clip, Add and Opaque (i.e. solid).
* Shadow, Billboard and Halo are grouped in the “Face Orientation” property.
* "Face Textures" and "Face Textures Alpha" (under Options) can be used for all but GLSL shading mode (to be supported in GLSL eventually).
* The backend in the game engine is still the same as before. The only changes are in the interface and in the way you need to think your materials. The bottomline is: It’s no longer possible to share materials between faces that do not share the same game properties.
4 - Acknowledgment:
==================
Mike Pan for the design discussions, and testing along the whole development process.
Vitor Balbio for the first hands-on code with the interface changes. That helped me a lot to push me into work on that.
Benoit Bolsee and Brecht van Lommel for patch review (* no one reviewed the whole patch, or the latest iteractions, so I still hold liability for any problems).
Blender artists that gave feedback and helped testing the patch.
Patch review and original documentation can be found here:
http://wiki.blender.org/index.php/User:Dfelinto/TexFace
http://codereview.appspot.com/4289041/
2011-09-19 19:55:59 +00:00
|
|
|
layout.active = context.material.game_settings.physics
|
2010-08-12 19:36:10 +00:00
|
|
|
|
2011-10-17 06:58:07 +00:00
|
|
|
phys = context.material.physics # don't use node material
|
2010-08-12 19:36:10 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
2011-03-03 01:47:17 +00:00
|
|
|
row = split.row()
|
|
|
|
row.prop(phys, "friction")
|
|
|
|
row.prop(phys, "elasticity", slider=True)
|
2010-08-12 19:36:10 +00:00
|
|
|
|
2011-03-03 01:47:17 +00:00
|
|
|
row = layout.row()
|
2011-09-21 15:18:38 +00:00
|
|
|
row.label(text="Force Field:")
|
2011-03-03 01:47:17 +00:00
|
|
|
|
|
|
|
row = layout.row()
|
|
|
|
row.prop(phys, "fh_force")
|
|
|
|
row.prop(phys, "fh_damping", slider=True)
|
|
|
|
|
|
|
|
row = layout.row()
|
|
|
|
row.prop(phys, "fh_distance")
|
|
|
|
row.prop(phys, "use_fh_normal")
|
2010-08-12 19:36:10 +00:00
|
|
|
|
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_strand(MaterialButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Strand"
|
2010-08-26 01:05:37 +00:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
2010-08-12 19:36:10 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
|
|
|
mat = context.material
|
|
|
|
engine = context.scene.render.engine
|
2011-03-07 13:23:45 +00:00
|
|
|
return mat and (mat.type in {'SURFACE', 'WIRE', 'HALO'}) and (engine in cls.COMPAT_ENGINES)
|
2010-08-12 19:36:10 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
2011-10-17 06:58:07 +00:00
|
|
|
mat = context.material # don't use node material
|
2010-08-12 19:36:10 +00:00
|
|
|
tan = mat.strand
|
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
sub = col.column(align=True)
|
2011-09-21 15:18:38 +00:00
|
|
|
sub.label(text="Size:")
|
|
|
|
sub.prop(tan, "root_size", text="Root")
|
|
|
|
sub.prop(tan, "tip_size", text="Tip")
|
|
|
|
sub.prop(tan, "size_min", text="Minimum")
|
2010-08-20 06:09:58 +00:00
|
|
|
sub.prop(tan, "use_blender_units")
|
2010-08-12 19:36:10 +00:00
|
|
|
sub = col.column()
|
2010-08-20 06:09:58 +00:00
|
|
|
sub.active = (not mat.use_shadeless)
|
|
|
|
sub.prop(tan, "use_tangent_shading")
|
2010-08-12 19:36:10 +00:00
|
|
|
col.prop(tan, "shape")
|
|
|
|
|
|
|
|
col = split.column()
|
2011-09-21 15:18:38 +00:00
|
|
|
col.label(text="Shading:")
|
2010-08-12 19:36:10 +00:00
|
|
|
col.prop(tan, "width_fade")
|
|
|
|
ob = context.object
|
|
|
|
if ob and ob.type == 'MESH':
|
2010-08-23 05:47:45 +00:00
|
|
|
col.prop_search(tan, "uv_layer", ob.data, "uv_textures", text="")
|
2010-08-12 19:36:10 +00:00
|
|
|
else:
|
|
|
|
col.prop(tan, "uv_layer", text="")
|
|
|
|
col.separator()
|
|
|
|
sub = col.column()
|
2010-08-20 06:09:58 +00:00
|
|
|
sub.active = (not mat.use_shadeless)
|
2011-09-21 15:18:38 +00:00
|
|
|
sub.label("Surface diffuse:")
|
2010-08-12 19:36:10 +00:00
|
|
|
sub = col.column()
|
2011-09-21 15:18:38 +00:00
|
|
|
sub.prop(tan, "blend_distance", text="Distance")
|
2010-08-12 19:36:10 +00:00
|
|
|
|
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_options(MaterialButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Options"
|
2010-08-12 19:36:10 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2011-02-16 19:39:45 +00:00
|
|
|
mat = context.material
|
2010-08-12 19:36:10 +00:00
|
|
|
engine = context.scene.render.engine
|
2011-03-07 13:23:45 +00:00
|
|
|
return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2010-08-12 19:36:10 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2011-02-25 16:06:14 +00:00
|
|
|
|
2011-02-22 19:22:27 +00:00
|
|
|
base_mat = context.material
|
|
|
|
mat = active_node_mat(base_mat)
|
2010-08-12 19:36:10 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2011-02-22 19:22:27 +00:00
|
|
|
if simple_material(base_mat):
|
|
|
|
col.prop(mat, "use_raytrace")
|
|
|
|
col.prop(mat, "use_full_oversampling")
|
|
|
|
col.prop(mat, "use_sky")
|
2010-08-20 02:08:43 +00:00
|
|
|
col.prop(mat, "use_mist")
|
2011-02-22 19:22:27 +00:00
|
|
|
if simple_material(base_mat):
|
|
|
|
col.prop(mat, "invert_z")
|
|
|
|
sub = col.row()
|
|
|
|
sub.prop(mat, "offset_z")
|
|
|
|
sub.active = mat.use_transparency and mat.transparency_method == 'Z_TRANSPARENCY'
|
2010-08-12 19:36:10 +00:00
|
|
|
sub = col.column(align=True)
|
2011-09-21 15:18:38 +00:00
|
|
|
sub.label(text="Light Group:")
|
2010-08-12 19:36:10 +00:00
|
|
|
sub.prop(mat, "light_group", text="")
|
2013-08-23 20:41:21 +00:00
|
|
|
row = sub.row(align=True)
|
2010-08-12 19:36:10 +00:00
|
|
|
row.active = bool(mat.light_group)
|
2011-09-21 15:18:38 +00:00
|
|
|
row.prop(mat, "use_light_group_exclusive", text="Exclusive")
|
2012-10-17 13:32:43 +00:00
|
|
|
row.prop(mat, "use_light_group_local", text="Local")
|
2010-08-12 19:36:10 +00:00
|
|
|
|
|
|
|
col = split.column()
|
2010-08-20 06:09:58 +00:00
|
|
|
col.prop(mat, "use_face_texture")
|
2010-08-12 19:36:10 +00:00
|
|
|
sub = col.column()
|
2010-08-20 06:09:58 +00:00
|
|
|
sub.active = mat.use_face_texture
|
|
|
|
sub.prop(mat, "use_face_texture_alpha")
|
2010-08-12 19:36:10 +00:00
|
|
|
col.separator()
|
2010-08-20 06:09:58 +00:00
|
|
|
col.prop(mat, "use_vertex_color_paint")
|
|
|
|
col.prop(mat, "use_vertex_color_light")
|
|
|
|
col.prop(mat, "use_object_color")
|
2012-09-22 04:57:55 +00:00
|
|
|
col.prop(mat, "use_uv_project")
|
2011-07-19 08:31:53 +00:00
|
|
|
if simple_material(base_mat):
|
|
|
|
col.prop(mat, "pass_index")
|
2010-08-12 19:36:10 +00:00
|
|
|
|
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_shadow(MaterialButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Shadow"
|
2010-08-26 01:05:37 +00:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
2010-08-12 19:36:10 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2011-02-16 19:39:45 +00:00
|
|
|
mat = context.material
|
2010-08-12 19:36:10 +00:00
|
|
|
engine = context.scene.render.engine
|
2011-03-07 13:23:45 +00:00
|
|
|
return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2010-08-12 19:36:10 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2011-02-25 16:06:14 +00:00
|
|
|
|
2011-02-22 19:22:27 +00:00
|
|
|
base_mat = context.material
|
|
|
|
mat = active_node_mat(base_mat)
|
2010-08-12 19:36:10 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2011-09-21 15:18:38 +00:00
|
|
|
col.prop(mat, "use_shadows", text="Receive")
|
|
|
|
col.prop(mat, "use_transparent_shadows", text="Receive Transparent")
|
|
|
|
col.prop(mat, "use_only_shadow", text="Shadows Only")
|
2011-03-08 16:08:43 +00:00
|
|
|
sub = col.column()
|
|
|
|
sub.active = mat.use_only_shadow
|
|
|
|
sub.prop(mat, "shadow_only_type", text="")
|
2010-08-12 19:36:10 +00:00
|
|
|
|
2014-04-23 06:02:06 +00:00
|
|
|
if not simple_material(base_mat):
|
|
|
|
col = split.column()
|
|
|
|
|
|
|
|
col.prop(mat, "use_ray_shadow_bias", text="Auto Ray Bias")
|
|
|
|
sub = col.column()
|
|
|
|
sub.active = (not mat.use_ray_shadow_bias)
|
|
|
|
sub.prop(mat, "shadow_ray_bias", text="Ray Bias")
|
|
|
|
|
2011-02-22 19:22:27 +00:00
|
|
|
if simple_material(base_mat):
|
2014-04-23 06:02:06 +00:00
|
|
|
col = split.column()
|
|
|
|
|
|
|
|
col.prop(mat, "use_cast_shadows", text="Cast")
|
|
|
|
col.prop(mat, "use_cast_shadows_only", text="Cast Only")
|
2014-02-11 20:41:09 +00:00
|
|
|
col.prop(mat, "use_cast_buffer_shadows")
|
2010-08-12 19:36:10 +00:00
|
|
|
sub = col.column()
|
2014-02-11 20:41:09 +00:00
|
|
|
sub.active = mat.use_cast_buffer_shadows
|
2014-04-23 06:02:06 +00:00
|
|
|
if simple_material(base_mat):
|
|
|
|
sub.prop(mat, "shadow_cast_alpha", text="Casting Alpha")
|
2011-09-21 15:18:38 +00:00
|
|
|
sub.prop(mat, "shadow_buffer_bias", text="Buffer Bias")
|
2011-02-22 19:22:27 +00:00
|
|
|
if simple_material(base_mat):
|
|
|
|
col.prop(mat, "use_cast_approximate")
|
2010-08-12 19:36:10 +00:00
|
|
|
|
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_transp_game(MaterialButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Transparency"
|
2010-08-26 01:05:37 +00:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
2010-08-12 19:36:10 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_GAME'}
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2011-02-16 19:39:45 +00:00
|
|
|
mat = context.material
|
2010-08-12 19:36:10 +00:00
|
|
|
engine = context.scene.render.engine
|
2011-02-16 19:39:45 +00:00
|
|
|
return check_material(mat) and (engine in cls.COMPAT_ENGINES)
|
2010-08-12 19:36:10 +00:00
|
|
|
|
2011-02-22 19:22:27 +00:00
|
|
|
def draw_header(self, context):
|
|
|
|
mat = context.material
|
|
|
|
|
|
|
|
if simple_material(mat):
|
|
|
|
self.layout.prop(mat, "use_transparency", text="")
|
|
|
|
|
2010-08-12 19:36:10 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2011-02-22 19:22:27 +00:00
|
|
|
base_mat = context.material
|
|
|
|
mat = active_node_mat(base_mat)
|
2010-08-12 19:36:10 +00:00
|
|
|
|
2011-02-22 19:22:27 +00:00
|
|
|
if simple_material(base_mat):
|
|
|
|
row = layout.row()
|
|
|
|
row.active = mat.use_transparency
|
|
|
|
row.prop(mat, "transparency_method", expand=True)
|
2011-02-25 16:06:14 +00:00
|
|
|
|
2011-02-16 19:39:45 +00:00
|
|
|
layout.prop(mat, "alpha")
|
2010-08-12 19:36:10 +00:00
|
|
|
|
|
|
|
|
2010-08-02 02:55:12 +00:00
|
|
|
class VolumeButtonsPanel():
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
bl_region_type = 'WINDOW'
|
|
|
|
bl_context = "material"
|
2010-08-05 16:05:30 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
2009-09-01 00:33:39 +00:00
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-10-31 19:31:45 +00:00
|
|
|
mat = context.material
|
2010-02-23 12:48:35 +00:00
|
|
|
engine = context.scene.render.engine
|
2010-08-09 01:37:09 +00:00
|
|
|
return mat and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES)
|
Rework of volume shading
After code review and experimentation, this commit makes some changes to the way that volumes are shaded. Previously, there were problems with the 'scattering' component, in that it wasn't physically correct - it didn't conserve energy and was just acting as a brightness multiplier. This has been changed to be more correct, so that as the light is scattered out of the volume, there is less remaining to penetrate through.
Since this behaviour is very similar to absorption but more useful, absorption has been removed and has been replaced by a 'transmission colour' - controlling the colour of light penetrating through the volume after it has been scattered/absorbed. As well as this, there's now 'reflection', a non-physically correct RGB multiplier for out-scattered light. This is handy for tweaking the overall colour of the volume, without having to worry about wavelength dependent absorption, and its effects on transmitted light. Now at least, even though there is the ability to tweak things non-physically, volume shading is physically based by default, and has a better combination of correctness and ease of use.
There's more detailed information and example images here:
http://wiki.blender.org/index.php/User:Broken/VolumeRendering
Also did some tweaks/optimisation:
* Removed shading step size (was a bit annoying, if it comes back, it will be in a different form)
* Removed phase function options, now just one asymmetry slider controls the range between back-scattering, isotropic scattering, and forward scattering. (note, more extreme values gives artifacts with light cache, will fix...)
* Disabled the extra 'bounce lights' from the preview render for volumes, speeds updates significantly
* Enabled voxeldata texture in preview render
* Fixed volume shadows (they were too dark, fixed by avoiding using the shadfac/AddAlphaLight stuff)
More revisions to come later...
2009-09-29 22:01:32 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_volume_density(VolumeButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Density"
|
2009-12-13 16:20:18 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
Rework of volume shading
After code review and experimentation, this commit makes some changes to the way that volumes are shaded. Previously, there were problems with the 'scattering' component, in that it wasn't physically correct - it didn't conserve energy and was just acting as a brightness multiplier. This has been changed to be more correct, so that as the light is scattered out of the volume, there is less remaining to penetrate through.
Since this behaviour is very similar to absorption but more useful, absorption has been removed and has been replaced by a 'transmission colour' - controlling the colour of light penetrating through the volume after it has been scattered/absorbed. As well as this, there's now 'reflection', a non-physically correct RGB multiplier for out-scattered light. This is handy for tweaking the overall colour of the volume, without having to worry about wavelength dependent absorption, and its effects on transmitted light. Now at least, even though there is the ability to tweak things non-physically, volume shading is physically based by default, and has a better combination of correctness and ease of use.
There's more detailed information and example images here:
http://wiki.blender.org/index.php/User:Broken/VolumeRendering
Also did some tweaks/optimisation:
* Removed shading step size (was a bit annoying, if it comes back, it will be in a different form)
* Removed phase function options, now just one asymmetry slider controls the range between back-scattering, isotropic scattering, and forward scattering. (note, more extreme values gives artifacts with light cache, will fix...)
* Disabled the extra 'bounce lights' from the preview render for volumes, speeds updates significantly
* Enabled voxeldata texture in preview render
* Fixed volume shadows (they were too dark, fixed by avoiding using the shadfac/AddAlphaLight stuff)
More revisions to come later...
2009-09-29 22:01:32 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
Rework of volume shading
After code review and experimentation, this commit makes some changes to the way that volumes are shaded. Previously, there were problems with the 'scattering' component, in that it wasn't physically correct - it didn't conserve energy and was just acting as a brightness multiplier. This has been changed to be more correct, so that as the light is scattered out of the volume, there is less remaining to penetrate through.
Since this behaviour is very similar to absorption but more useful, absorption has been removed and has been replaced by a 'transmission colour' - controlling the colour of light penetrating through the volume after it has been scattered/absorbed. As well as this, there's now 'reflection', a non-physically correct RGB multiplier for out-scattered light. This is handy for tweaking the overall colour of the volume, without having to worry about wavelength dependent absorption, and its effects on transmitted light. Now at least, even though there is the ability to tweak things non-physically, volume shading is physically based by default, and has a better combination of correctness and ease of use.
There's more detailed information and example images here:
http://wiki.blender.org/index.php/User:Broken/VolumeRendering
Also did some tweaks/optimisation:
* Removed shading step size (was a bit annoying, if it comes back, it will be in a different form)
* Removed phase function options, now just one asymmetry slider controls the range between back-scattering, isotropic scattering, and forward scattering. (note, more extreme values gives artifacts with light cache, will fix...)
* Disabled the extra 'bounce lights' from the preview render for volumes, speeds updates significantly
* Enabled voxeldata texture in preview render
* Fixed volume shadows (they were too dark, fixed by avoiding using the shadfac/AddAlphaLight stuff)
More revisions to come later...
2009-09-29 22:01:32 +00:00
|
|
|
|
2011-10-17 06:58:07 +00:00
|
|
|
vol = context.material.volume # don't use node material
|
2011-02-26 16:27:58 +00:00
|
|
|
|
2011-02-26 16:04:14 +00:00
|
|
|
row = layout.row()
|
|
|
|
row.prop(vol, "density")
|
|
|
|
row.prop(vol, "density_scale")
|
Rework of volume shading
After code review and experimentation, this commit makes some changes to the way that volumes are shaded. Previously, there were problems with the 'scattering' component, in that it wasn't physically correct - it didn't conserve energy and was just acting as a brightness multiplier. This has been changed to be more correct, so that as the light is scattered out of the volume, there is less remaining to penetrate through.
Since this behaviour is very similar to absorption but more useful, absorption has been removed and has been replaced by a 'transmission colour' - controlling the colour of light penetrating through the volume after it has been scattered/absorbed. As well as this, there's now 'reflection', a non-physically correct RGB multiplier for out-scattered light. This is handy for tweaking the overall colour of the volume, without having to worry about wavelength dependent absorption, and its effects on transmitted light. Now at least, even though there is the ability to tweak things non-physically, volume shading is physically based by default, and has a better combination of correctness and ease of use.
There's more detailed information and example images here:
http://wiki.blender.org/index.php/User:Broken/VolumeRendering
Also did some tweaks/optimisation:
* Removed shading step size (was a bit annoying, if it comes back, it will be in a different form)
* Removed phase function options, now just one asymmetry slider controls the range between back-scattering, isotropic scattering, and forward scattering. (note, more extreme values gives artifacts with light cache, will fix...)
* Disabled the extra 'bounce lights' from the preview render for volumes, speeds updates significantly
* Enabled voxeldata texture in preview render
* Fixed volume shadows (they were too dark, fixed by avoiding using the shadfac/AddAlphaLight stuff)
More revisions to come later...
2009-09-29 22:01:32 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_volume_shading(VolumeButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Shading"
|
2009-12-13 16:20:18 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
2011-10-17 06:58:07 +00:00
|
|
|
vol = context.material.volume # don't use node material
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(vol, "scattering")
|
|
|
|
col.prop(vol, "asymmetry")
|
|
|
|
col.prop(vol, "transmission_color")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2009-10-31 19:31:45 +00:00
|
|
|
sub = col.column(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.prop(vol, "emission")
|
|
|
|
sub.prop(vol, "emission_color", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
sub = col.column(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.prop(vol, "reflection")
|
|
|
|
sub.prop(vol, "reflection_color", text="")
|
2009-08-16 06:10:31 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Lighting"
|
2009-12-13 16:20:18 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
2011-10-17 06:58:07 +00:00
|
|
|
vol = context.material.volume # don't use node material
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2010-08-20 06:09:58 +00:00
|
|
|
col.prop(vol, "light_method", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-20 06:09:58 +00:00
|
|
|
if vol.light_method == 'SHADED':
|
|
|
|
col.prop(vol, "use_external_shadows")
|
|
|
|
col.prop(vol, "use_light_cache")
|
2009-10-31 19:31:45 +00:00
|
|
|
sub = col.column()
|
2010-08-20 06:09:58 +00:00
|
|
|
sub.active = vol.use_light_cache
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.prop(vol, "cache_resolution")
|
2011-03-07 13:23:45 +00:00
|
|
|
elif vol.light_method in {'MULTIPLE_SCATTERING', 'SHADED_PLUS_MULTIPLE_SCATTERING'}:
|
2009-10-31 19:31:45 +00:00
|
|
|
sub = col.column()
|
|
|
|
sub.enabled = True
|
|
|
|
sub.active = False
|
2011-09-21 15:18:38 +00:00
|
|
|
sub.label("Light Cache Enabled")
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(vol, "cache_resolution")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
sub = col.column(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.prop(vol, "ms_diffusion")
|
|
|
|
sub.prop(vol, "ms_spread")
|
|
|
|
sub.prop(vol, "ms_intensity")
|
Rework of volume shading
After code review and experimentation, this commit makes some changes to the way that volumes are shaded. Previously, there were problems with the 'scattering' component, in that it wasn't physically correct - it didn't conserve energy and was just acting as a brightness multiplier. This has been changed to be more correct, so that as the light is scattered out of the volume, there is less remaining to penetrate through.
Since this behaviour is very similar to absorption but more useful, absorption has been removed and has been replaced by a 'transmission colour' - controlling the colour of light penetrating through the volume after it has been scattered/absorbed. As well as this, there's now 'reflection', a non-physically correct RGB multiplier for out-scattered light. This is handy for tweaking the overall colour of the volume, without having to worry about wavelength dependent absorption, and its effects on transmitted light. Now at least, even though there is the ability to tweak things non-physically, volume shading is physically based by default, and has a better combination of correctness and ease of use.
There's more detailed information and example images here:
http://wiki.blender.org/index.php/User:Broken/VolumeRendering
Also did some tweaks/optimisation:
* Removed shading step size (was a bit annoying, if it comes back, it will be in a different form)
* Removed phase function options, now just one asymmetry slider controls the range between back-scattering, isotropic scattering, and forward scattering. (note, more extreme values gives artifacts with light cache, will fix...)
* Disabled the extra 'bounce lights' from the preview render for volumes, speeds updates significantly
* Enabled voxeldata texture in preview render
* Fixed volume shadows (they were too dark, fixed by avoiding using the shadfac/AddAlphaLight stuff)
More revisions to come later...
2009-09-29 22:01:32 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_volume_transp(VolumeButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Transparency"
|
2011-02-22 19:22:27 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
2011-02-25 16:06:14 +00:00
|
|
|
|
2011-02-22 19:22:27 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
|
|
|
mat = context.material
|
|
|
|
engine = context.scene.render.engine
|
|
|
|
return mat and simple_material(mat) and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES)
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
2011-10-17 06:58:07 +00:00
|
|
|
mat = context.material # don't use node material
|
2011-02-22 19:22:27 +00:00
|
|
|
|
|
|
|
layout.prop(mat, "transparency_method", expand=True)
|
|
|
|
|
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_volume_integration(VolumeButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Integration"
|
2009-12-13 16:20:18 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
2011-10-17 06:58:07 +00:00
|
|
|
vol = context.material.volume # don't use node material
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2011-09-21 15:18:38 +00:00
|
|
|
col.label(text="Step Calculation:")
|
2010-08-20 06:09:58 +00:00
|
|
|
col.prop(vol, "step_method", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
col = col.column(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(vol, "step_size")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label()
|
2010-08-20 06:09:58 +00:00
|
|
|
col.prop(vol, "depth_threshold")
|
2010-04-17 19:05:53 +00:00
|
|
|
|
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_volume_options(VolumeButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Options"
|
2010-04-16 04:24:29 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
2010-08-26 01:05:37 +00:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2011-02-16 19:39:45 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
|
|
|
mat = context.material
|
|
|
|
engine = context.scene.render.engine
|
|
|
|
return check_material(mat) and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES)
|
2011-02-17 04:35:41 +00:00
|
|
|
|
2010-04-16 04:24:29 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
mat = active_node_mat(context.material)
|
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2011-02-22 19:22:27 +00:00
|
|
|
if simple_material(context.material):
|
|
|
|
col.prop(mat, "use_raytrace")
|
|
|
|
col.prop(mat, "use_full_oversampling")
|
2010-08-20 02:08:43 +00:00
|
|
|
col.prop(mat, "use_mist")
|
2010-04-17 19:05:53 +00:00
|
|
|
|
2010-04-16 04:24:29 +00:00
|
|
|
col = split.column()
|
2011-09-21 15:18:38 +00:00
|
|
|
col.label(text="Light Group:")
|
2010-04-16 04:24:29 +00:00
|
|
|
col.prop(mat, "light_group", text="")
|
|
|
|
row = col.row()
|
|
|
|
row.active = bool(mat.light_group)
|
2011-09-21 15:18:38 +00:00
|
|
|
row.prop(mat, "use_light_group_exclusive", text="Exclusive")
|
2010-04-16 04:24:29 +00:00
|
|
|
|
2009-11-22 00:22:29 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, Panel):
|
2010-08-12 19:36:10 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
|
|
|
_context_path = "material"
|
2010-12-17 10:33:28 +00:00
|
|
|
_property_type = bpy.types.Material
|
2011-04-04 10:13:04 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__": # only for live edit.
|
|
|
|
bpy.utils.register_module(__name__)
|