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-22 12:07:03 +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
2012-01-18 06:11:56 +00:00
from bpy . types import ( Brush ,
Lamp ,
Material ,
2012-06-21 07:32:06 +00:00
Object ,
2012-01-18 06:11:56 +00:00
ParticleSettings ,
Texture ,
World )
2010-01-08 08:54:41 +00:00
from rna_prop_ui import PropertyPanel
2009-11-14 13:35:44 +00:00
2013-01-16 12:57:35 +00:00
from bl_ui . properties_paint_common import brush_texture_settings
2012-05-15 04:50:47 +00:00
2009-11-14 13:35:44 +00:00
2011-08-12 06:57:00 +00:00
class TEXTURE_MT_specials ( Menu ) :
2011-09-15 13:20:18 +00:00
bl_label = " Texture Specials "
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2010-03-09 09:17:45 +00:00
def draw ( self , context ) :
layout = self . layout
2010-03-29 05:37:34 +00:00
layout . operator ( " texture.slot_copy " , icon = ' COPYDOWN ' )
layout . operator ( " texture.slot_paste " , icon = ' PASTEDOWN ' )
2010-03-09 09:17:45 +00:00
2011-08-12 06:57:00 +00:00
class TEXTURE_MT_envmap_specials ( Menu ) :
2011-09-15 13:20:18 +00:00
bl_label = " Environment Map Specials "
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2010-03-11 07:43:49 +00:00
def draw ( self , context ) :
layout = self . layout
layout . operator ( " texture.envmap_save " , icon = ' IMAGEFILE ' )
layout . operator ( " texture.envmap_clear " , icon = ' FILE_REFRESH ' )
layout . operator ( " texture.envmap_clear_all " , icon = ' FILE_REFRESH ' )
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 TEXTURE_UL_texslots ( 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.MaterialTextureSlot)
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
ma = data
slot = item
tex = slot . texture if slot else None
if self . layout_type in { ' DEFAULT ' , ' COMPACT ' } :
2013-11-23 19:37:23 +00:00
if tex :
layout . prop ( tex , " name " , text = " " , emboss = False , icon_value = icon )
else :
layout . label ( text = " " , icon_value = icon )
2013-01-10 10:10:34 +00:00
if tex and isinstance ( item , bpy . types . MaterialTextureSlot ) :
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
layout . prop ( ma , " use_textures " , text = " " , index = index )
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
2012-04-04 14:39:52 +00:00
from bl_ui . properties_material import active_node_mat
2010-03-11 07:43:49 +00:00
2010-05-03 16:00:42 +00:00
2009-10-12 14:38:35 +00:00
def context_tex_datablock ( context ) :
2010-03-17 22:54:55 +00:00
idblock = context . material
2009-11-14 13:35:44 +00:00
if idblock :
2010-04-23 02:25:19 +00:00
return active_node_mat ( idblock )
2009-10-31 19:31:45 +00:00
2009-11-14 13:35:44 +00:00
idblock = context . lamp
if idblock :
return idblock
2009-10-31 19:31:45 +00:00
2009-11-14 13:35:44 +00:00
idblock = context . world
if idblock :
2009-10-31 19:31:45 +00:00
return idblock
2009-10-09 15:25:19 +00:00
2009-11-14 13:35:44 +00:00
idblock = context . brush
2011-02-12 14:38:34 +00:00
if idblock :
return idblock
2011-02-16 02:25:03 +00:00
2011-02-12 14:38:34 +00:00
if context . particle_system :
idblock = context . particle_system . settings
2011-02-16 02:25:03 +00:00
2009-11-14 13:35:44 +00:00
return idblock
2009-10-31 23:35:56 +00:00
2012-06-21 07:32:06 +00:00
def id_tex_datablock ( bid ) :
if isinstance ( bid , Object ) :
if bid . type == ' LAMP ' :
return bid . data
return bid . active_material
return bid
2010-08-02 02:55:12 +00:00
class TextureButtonsPanel ( ) :
2009-10-31 19:31:45 +00:00
bl_space_type = ' PROPERTIES '
bl_region_type = ' WINDOW '
bl_context = " texture "
2010-08-09 01:37:09 +00:00
@classmethod
def poll ( cls , context ) :
tex = context . texture
return tex and ( tex . type != ' NONE ' or tex . use_nodes ) 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 TEXTURE_PT_context_texture ( TextureButtonsPanel , Panel ) :
2009-10-31 19:31:45 +00:00
bl_label = " "
2010-08-26 01:05:37 +00:00
bl_options = { ' HIDE_HEADER ' }
2010-04-19 00:39:46 +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 ) :
2010-04-19 00:39:46 +00:00
engine = context . scene . render . engine
This commit addresses the somewhat weak handling of stackless textures in Blender with default (BI) renderer. To do so, it's defining an "other" texture context, and when in this one, it switches to using the "new shading" texture handling already known with Cycles engine.
So now, in the new "other" tex context, you can (depending on active data) have direct access to modifiers', force's or brushes' textures...
I also refactored a bit how texture contexts are handled (once again, we had some quite similar code in both space_buttons and RNA sources). This should also solve some harmless glitches like "no texture context selected in UI" sometimes when you remove data related to current texture (see e.g. after removing the material from default cube, in startup scene).
This usage of two different systems for textures, and the handling of switches between them, has been a bit tricky to get working right, but it is OK now I think. I also had to add a bool flag to buttons space, SB_TEX_USER_LIMITED (use_limited_texture_context in RNA), which indicates "new shading" texture code whether it has to ignore materials, lamps etc. (BI) or not (Cycles).
Btw, pinned textures from modifiers/force/etc. were also broken (showing nothing), now it should work too.
Thanks to Brecht for reviewing.
2013-05-17 07:10:10 +00:00
#if not (hasattr(context, "texture_slot") or hasattr(context, "texture_node")):
#return False
2012-10-08 08:28:05 +00:00
return ( ( context . material or
context . world or
context . lamp or
context . texture or
context . particle_system or
This commit addresses the somewhat weak handling of stackless textures in Blender with default (BI) renderer. To do so, it's defining an "other" texture context, and when in this one, it switches to using the "new shading" texture handling already known with Cycles engine.
So now, in the new "other" tex context, you can (depending on active data) have direct access to modifiers', force's or brushes' textures...
I also refactored a bit how texture contexts are handled (once again, we had some quite similar code in both space_buttons and RNA sources). This should also solve some harmless glitches like "no texture context selected in UI" sometimes when you remove data related to current texture (see e.g. after removing the material from default cube, in startup scene).
This usage of two different systems for textures, and the handling of switches between them, has been a bit tricky to get working right, but it is OK now I think. I also had to add a bool flag to buttons space, SB_TEX_USER_LIMITED (use_limited_texture_context in RNA), which indicates "new shading" texture code whether it has to ignore materials, lamps etc. (BI) or not (Cycles).
Btw, pinned textures from modifiers/force/etc. were also broken (showing nothing), now it should work too.
Thanks to Brecht for reviewing.
2013-05-17 07:10:10 +00:00
isinstance ( context . space_data . pin_id , ParticleSettings ) or
context . texture_user ) and
2012-10-08 08:28:05 +00:00
( engine in cls . COMPAT_ENGINES ) )
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
layout = self . layout
2012-07-29 12:07:06 +00:00
2011-07-13 17:52:23 +00:00
slot = getattr ( context , " texture_slot " , None )
node = getattr ( context , " texture_node " , None )
2010-01-03 08:37:18 +00:00
space = context . space_data
2009-10-31 19:31:45 +00:00
tex = context . texture
idblock = context_tex_datablock ( context )
2010-12-07 12:51:03 +00:00
pin_id = space . pin_id
This commit addresses the somewhat weak handling of stackless textures in Blender with default (BI) renderer. To do so, it's defining an "other" texture context, and when in this one, it switches to using the "new shading" texture handling already known with Cycles engine.
So now, in the new "other" tex context, you can (depending on active data) have direct access to modifiers', force's or brushes' textures...
I also refactored a bit how texture contexts are handled (once again, we had some quite similar code in both space_buttons and RNA sources). This should also solve some harmless glitches like "no texture context selected in UI" sometimes when you remove data related to current texture (see e.g. after removing the material from default cube, in startup scene).
This usage of two different systems for textures, and the handling of switches between them, has been a bit tricky to get working right, but it is OK now I think. I also had to add a bool flag to buttons space, SB_TEX_USER_LIMITED (use_limited_texture_context in RNA), which indicates "new shading" texture code whether it has to ignore materials, lamps etc. (BI) or not (Cycles).
Btw, pinned textures from modifiers/force/etc. were also broken (showing nothing), now it should work too.
Thanks to Brecht for reviewing.
2013-05-17 07:10:10 +00:00
space . use_limited_texture_context = True
2012-01-18 06:11:56 +00:00
if space . use_pin_id and not isinstance ( pin_id , Texture ) :
2012-06-21 07:32:06 +00:00
idblock = id_tex_datablock ( pin_id )
2010-12-07 12:51:03 +00:00
pin_id = None
2011-02-08 14:29:48 +00:00
if not space . use_pin_id :
layout . prop ( space , " texture_context " , expand = True )
This commit addresses the somewhat weak handling of stackless textures in Blender with default (BI) renderer. To do so, it's defining an "other" texture context, and when in this one, it switches to using the "new shading" texture handling already known with Cycles engine.
So now, in the new "other" tex context, you can (depending on active data) have direct access to modifiers', force's or brushes' textures...
I also refactored a bit how texture contexts are handled (once again, we had some quite similar code in both space_buttons and RNA sources). This should also solve some harmless glitches like "no texture context selected in UI" sometimes when you remove data related to current texture (see e.g. after removing the material from default cube, in startup scene).
This usage of two different systems for textures, and the handling of switches between them, has been a bit tricky to get working right, but it is OK now I think. I also had to add a bool flag to buttons space, SB_TEX_USER_LIMITED (use_limited_texture_context in RNA), which indicates "new shading" texture code whether it has to ignore materials, lamps etc. (BI) or not (Cycles).
Btw, pinned textures from modifiers/force/etc. were also broken (showing nothing), now it should work too.
Thanks to Brecht for reviewing.
2013-05-17 07:10:10 +00:00
pin_id = None
if space . texture_context == ' OTHER ' :
if not pin_id :
layout . template_texture_user ( )
user = context . texture_user
if user or pin_id :
layout . separator ( )
split = layout . split ( percentage = 0.65 )
col = split . column ( )
if pin_id :
col . template_ID ( space , " pin_id " )
else :
propname = context . texture_user_property . identifier
col . template_ID ( user , propname , new = " texture.new " )
if tex :
split = layout . split ( percentage = 0.2 )
if tex . use_nodes :
if slot :
split . label ( text = " Output: " )
split . prop ( slot , " output_node " , text = " " )
else :
split . label ( text = " Type: " )
split . prop ( tex , " type " , text = " " )
return
2011-02-08 14:29:48 +00:00
2012-01-18 06:11:56 +00:00
tex_collection = ( pin_id is None ) and ( node is None ) and ( not isinstance ( idblock , Brush ) )
2009-10-31 19:31:45 +00:00
2010-01-03 08:37:18 +00:00
if tex_collection :
2009-10-31 19:31:45 +00:00
row = layout . row ( )
2011-01-01 07:20:34 +00:00
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
row . template_list ( " TEXTURE_UL_texslots " , " " , idblock , " texture_slots " , idblock , " active_texture_index " , rows = 2 )
2009-10-31 19:31:45 +00:00
col = row . column ( align = True )
2009-12-10 10:23:53 +00:00
col . operator ( " texture.slot_move " , text = " " , icon = ' TRIA_UP ' ) . type = ' UP '
col . operator ( " texture.slot_move " , text = " " , icon = ' TRIA_DOWN ' ) . type = ' DOWN '
2012-05-23 14:24:40 +00:00
col . menu ( " TEXTURE_MT_specials " , icon = ' DOWNARROW_HLT ' , text = " " )
2010-01-31 14:46:28 +00:00
2010-01-03 08:37:18 +00:00
if tex_collection :
2012-10-21 11:04:04 +00:00
layout . template_ID ( idblock , " active_texture " , new = " texture.new " )
2010-01-29 16:32:06 +00:00
elif node :
2012-10-21 11:04:04 +00:00
layout . template_ID ( node , " texture " , new = " texture.new " )
2010-01-03 08:37:18 +00:00
elif idblock :
2012-10-21 11:04:04 +00:00
layout . template_ID ( idblock , " texture " , new = " texture.new " )
2010-01-31 14:46:28 +00:00
2010-12-07 12:51:03 +00:00
if pin_id :
2012-10-21 11:04:04 +00:00
layout . template_ID ( space , " pin_id " )
2009-10-31 23:35:56 +00:00
2009-10-31 19:31:45 +00:00
if tex :
split = layout . split ( percentage = 0.2 )
if tex . use_nodes :
if slot :
2011-09-21 15:18:38 +00:00
split . label ( text = " Output: " )
2009-11-23 00:27:30 +00:00
split . prop ( slot , " output_node " , text = " " )
2009-10-31 19:31:45 +00:00
else :
2011-09-21 15:18:38 +00:00
split . label ( text = " Type: " )
2010-08-06 15:17:44 +00:00
split . prop ( tex , " type " , text = " " )
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 TEXTURE_PT_preview ( TextureButtonsPanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Preview "
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2010-08-12 19:36:10 +00:00
def draw ( self , context ) :
layout = self . layout
tex = context . texture
slot = getattr ( context , " texture_slot " , None )
idblock = context_tex_datablock ( context )
if idblock :
layout . template_preview ( tex , parent = idblock , slot = slot )
else :
layout . template_preview ( tex , slot = slot )
2011-12-05 22:19:30 +00:00
2011-12-04 16:55:46 +00:00
#Show Alpha Button for Brush Textures, see #29502
if context . space_data . texture_context == ' BRUSH ' :
layout . prop ( tex , " use_preview_alpha " )
2010-01-08 08:54:41 +00:00
2011-08-12 06:57:00 +00:00
class TEXTURE_PT_colors ( TextureButtonsPanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Colors "
2010-08-26 01:05:37 +00:00
bl_options = { ' DEFAULT_CLOSED ' }
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
layout = self . layout
tex = context . texture
2011-09-21 15:18:38 +00:00
layout . prop ( tex , " use_color_ramp " , text = " Ramp " )
2009-10-31 19:31:45 +00:00
if tex . use_color_ramp :
layout . template_color_ramp ( tex , " color_ramp " , expand = True )
split = layout . split ( )
col = split . column ( )
2011-09-21 15:18:38 +00:00
col . label ( text = " RGB Multiply: " )
2009-10-31 19:31:45 +00:00
sub = col . column ( align = True )
2009-11-23 00:27:30 +00:00
sub . prop ( tex , " factor_red " , text = " R " )
sub . prop ( tex , " factor_green " , text = " G " )
sub . prop ( tex , " factor_blue " , text = " B " )
2009-10-31 19:31:45 +00:00
2010-08-06 15:17:44 +00:00
col = split . column ( )
2011-09-21 15:18:38 +00:00
col . label ( text = " Adjust: " )
2010-08-21 04:51:00 +00:00
col . prop ( tex , " intensity " )
2009-11-23 00:27:30 +00:00
col . prop ( tex , " contrast " )
2010-07-05 10:18:59 +00:00
col . prop ( tex , " saturation " )
2009-10-31 19:31:45 +00:00
2009-08-17 18:37:58 +00:00
# Texture Slot Panels #
2009-10-31 19:31:45 +00:00
2009-10-31 23:35:56 +00:00
2009-08-17 18:37:58 +00:00
class TextureSlotPanel ( TextureButtonsPanel ) :
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2009-10-31 23:35:56 +00:00
2010-08-09 01:37:09 +00:00
@classmethod
def poll ( cls , context ) :
2010-04-22 16:22:47 +00:00
if not hasattr ( context , " texture_slot " ) :
return False
2010-05-03 16:00:42 +00:00
2010-04-19 00:39:46 +00:00
engine = context . scene . render . engine
2011-07-10 17:26:15 +00:00
return TextureButtonsPanel . poll ( cls , context ) and ( engine in cls . COMPAT_ENGINES )
2009-10-31 23:35:56 +00:00
2009-10-31 19:31:45 +00:00
2009-08-08 17:21:34 +00:00
# Texture Type Panels #
2009-06-03 00:17:35 +00:00
2009-10-31 23:35:56 +00:00
2009-08-17 18:37:58 +00:00
class TextureTypePanel ( TextureButtonsPanel ) :
2010-08-09 01:37:09 +00:00
@classmethod
def poll ( cls , context ) :
tex = context . texture
engine = context . scene . render . engine
return tex and ( ( tex . type == cls . tex_type and not tex . use_nodes ) and ( engine in cls . COMPAT_ENGINES ) )
2009-08-17 18:37:58 +00:00
2009-10-31 23:35:56 +00:00
2011-08-12 06:57:00 +00:00
class TEXTURE_PT_clouds ( TextureTypePanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Clouds "
2009-10-31 19:31:45 +00:00
tex_type = ' CLOUDS '
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
layout = self . layout
tex = context . texture
2010-08-21 04:51:00 +00:00
layout . prop ( tex , " cloud_type " , expand = True )
2011-09-21 15:18:38 +00:00
layout . label ( text = " Noise: " )
layout . prop ( tex , " noise_type " , text = " Type " , expand = True )
layout . prop ( tex , " noise_basis " , text = " Basis " )
2009-11-12 15:41:44 +00:00
split = layout . split ( )
2009-10-31 19:31:45 +00:00
2009-11-12 15:41:44 +00:00
col = split . column ( )
2011-09-21 15:18:38 +00:00
col . prop ( tex , " noise_scale " , text = " Size " )
col . prop ( tex , " noise_depth " , text = " Depth " )
2009-11-14 13:35:44 +00:00
2011-09-21 15:18:38 +00:00
split . prop ( tex , " nabla " , text = " Nabla " )
2009-05-22 12:07:03 +00:00
2009-10-31 23:35:56 +00:00
2011-08-12 06:57:00 +00:00
class TEXTURE_PT_wood ( TextureTypePanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Wood "
2009-10-31 19:31:45 +00:00
tex_type = ' WOOD '
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
layout = self . layout
tex = context . texture
2011-04-05 06:05:55 +00:00
layout . prop ( tex , " noise_basis_2 " , expand = True )
2010-08-21 04:51:00 +00:00
layout . prop ( tex , " wood_type " , expand = True )
2009-10-31 19:31:45 +00:00
col = layout . column ( )
2011-03-07 13:23:45 +00:00
col . active = tex . wood_type in { ' RINGNOISE ' , ' BANDNOISE ' }
2011-09-21 15:18:38 +00:00
col . label ( text = " Noise: " )
col . row ( ) . prop ( tex , " noise_type " , text = " Type " , expand = True )
layout . prop ( tex , " noise_basis " , text = " Basis " )
2009-10-31 19:31:45 +00:00
2009-11-12 15:41:44 +00:00
split = layout . split ( )
2011-03-07 13:23:45 +00:00
split . active = tex . wood_type in { ' RINGNOISE ' , ' BANDNOISE ' }
2009-11-14 13:35:44 +00:00
2009-11-12 15:41:44 +00:00
col = split . column ( )
2011-09-21 15:18:38 +00:00
col . prop ( tex , " noise_scale " , text = " Size " )
2009-11-23 00:27:30 +00:00
col . prop ( tex , " turbulence " )
2009-11-14 13:35:44 +00:00
2011-02-26 16:04:14 +00:00
split . prop ( tex , " nabla " )
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 TEXTURE_PT_marble ( TextureTypePanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Marble "
2009-10-31 19:31:45 +00:00
tex_type = ' MARBLE '
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
layout = self . layout
tex = context . texture
2010-08-21 04:51:00 +00:00
layout . prop ( tex , " marble_type " , expand = True )
2011-04-05 06:05:55 +00:00
layout . prop ( tex , " noise_basis_2 " , expand = True )
2011-09-21 15:18:38 +00:00
layout . label ( text = " Noise: " )
layout . prop ( tex , " noise_type " , text = " Type " , expand = True )
layout . prop ( tex , " noise_basis " , text = " Basis " )
2009-10-31 19:31:45 +00:00
2009-11-12 15:41:44 +00:00
split = layout . split ( )
2009-11-14 13:35:44 +00:00
2009-11-12 15:41:44 +00:00
col = split . column ( )
2011-09-21 15:18:38 +00:00
col . prop ( tex , " noise_scale " , text = " Size " )
col . prop ( tex , " noise_depth " , text = " Depth " )
2009-11-14 13:35:44 +00:00
2010-08-06 15:17:44 +00:00
col = split . column ( )
2009-11-23 00:27:30 +00:00
col . prop ( tex , " turbulence " )
col . prop ( tex , " nabla " )
2009-05-22 12:07:03 +00:00
2009-10-31 23:35:56 +00:00
2011-08-12 06:57:00 +00:00
class TEXTURE_PT_magic ( TextureTypePanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Magic "
2009-10-31 19:31:45 +00:00
tex_type = ' MAGIC '
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
layout = self . layout
tex = context . texture
2011-02-26 16:04:14 +00:00
row = layout . row ( )
2011-09-21 15:18:38 +00:00
row . prop ( tex , " noise_depth " , text = " Depth " )
2011-02-26 16:04:14 +00:00
row . prop ( tex , " turbulence " )
2009-05-22 12:07:03 +00:00
2009-10-31 23:35:56 +00:00
2011-08-12 06:57:00 +00:00
class TEXTURE_PT_blend ( TextureTypePanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Blend "
2009-10-31 19:31:45 +00:00
tex_type = ' BLEND '
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
layout = self . layout
tex = context . texture
2010-08-06 15:17:44 +00:00
layout . prop ( tex , " progression " )
2009-11-14 13:35:44 +00:00
2009-10-31 19:31:45 +00:00
sub = layout . row ( )
2011-03-07 13:23:45 +00:00
sub . active = ( tex . progression in { ' LINEAR ' , ' QUADRATIC ' , ' EASING ' , ' RADIAL ' } )
2010-08-20 06:09:58 +00:00
sub . prop ( tex , " use_flip_axis " , expand = True )
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 TEXTURE_PT_stucci ( TextureTypePanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Stucci "
2009-10-31 19:31:45 +00:00
tex_type = ' STUCCI '
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
layout = self . layout
tex = context . texture
2010-08-21 04:51:00 +00:00
layout . prop ( tex , " stucci_type " , expand = True )
2011-09-21 15:18:38 +00:00
layout . label ( text = " Noise: " )
layout . prop ( tex , " noise_type " , text = " Type " , expand = True )
layout . prop ( tex , " noise_basis " , text = " Basis " )
2009-10-31 19:31:45 +00:00
2011-02-26 16:04:14 +00:00
row = layout . row ( )
2011-09-21 15:18:38 +00:00
row . prop ( tex , " noise_scale " , text = " Size " )
2011-02-26 16:04:14 +00:00
row . prop ( tex , " turbulence " )
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 TEXTURE_PT_image ( TextureTypePanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Image "
2009-10-31 19:31:45 +00:00
tex_type = ' IMAGE '
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2009-09-16 18:47:42 +00:00
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
layout = self . layout
2009-07-21 12:57:55 +00:00
2009-10-31 19:31:45 +00:00
tex = context . texture
layout . template_image ( tex , " image " , tex . image_user )
2009-07-21 12:57:55 +00:00
2010-03-14 23:26:17 +00:00
2010-03-11 07:43:49 +00:00
def texture_filter_common ( tex , layout ) :
2011-09-21 15:18:38 +00:00
layout . label ( text = " Filter: " )
2010-08-21 04:51:00 +00:00
layout . prop ( tex , " filter_type " , text = " " )
2011-03-07 13:23:45 +00:00
if tex . use_mipmap and tex . filter_type in { ' AREA ' , ' EWA ' , ' FELINE ' } :
2010-08-22 16:33:26 +00:00
if tex . filter_type == ' FELINE ' :
2011-09-21 15:18:38 +00:00
layout . prop ( tex , " filter_probes " , text = " Probes " )
2010-03-14 23:26:17 +00:00
else :
2011-09-21 15:18:38 +00:00
layout . prop ( tex , " filter_eccentricity " , text = " Eccentricity " )
2010-03-14 23:26:17 +00:00
layout . prop ( tex , " filter_size " )
2010-08-20 06:09:58 +00:00
layout . prop ( tex , " use_filter_size_min " )
2010-03-11 07:43:49 +00:00
2009-10-31 23:35:56 +00:00
2011-08-12 06:57:00 +00:00
class TEXTURE_PT_image_sampling ( TextureTypePanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Image Sampling "
2010-08-26 01:05:37 +00:00
bl_options = { ' DEFAULT_CLOSED ' }
2009-10-31 19:31:45 +00:00
tex_type = ' IMAGE '
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
2013-01-22 18:42:16 +00:00
if context . scene . render . engine == ' BLENDER_GAME ' :
self . draw_bge ( context )
else :
self . draw_bi ( context )
def draw_bi ( self , context ) :
2009-10-31 19:31:45 +00:00
layout = self . layout
2011-01-01 07:20:34 +00:00
2010-12-27 12:12:43 +00:00
idblock = context_tex_datablock ( context )
2009-10-31 19:31:45 +00:00
tex = context . texture
2011-07-13 18:07:30 +00:00
slot = getattr ( context , " texture_slot " , None )
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 = " Alpha: " )
2013-03-04 13:18:14 +00:00
row = col . row ( )
2013-09-29 02:07:48 +00:00
row . active = bool ( tex . image and tex . image . use_alpha )
2013-03-04 13:18:14 +00:00
row . prop ( tex , " use_alpha " , text = " Use " )
2011-09-21 15:18:38 +00:00
col . prop ( tex , " use_calculate_alpha " , text = " Calculate " )
col . prop ( tex , " invert_alpha " , text = " Invert " )
2009-11-23 00:27:30 +00:00
col . separator ( )
2011-09-21 15:18:38 +00:00
col . prop ( tex , " use_flip_axis " , text = " Flip X/Y Axis " )
2009-10-31 19:31:45 +00:00
2010-08-06 15:17:44 +00:00
col = split . column ( )
2011-01-01 07:20:34 +00:00
2010-12-27 12:12:43 +00:00
#Only for Material based textures, not for Lamp/World...
2012-01-18 06:11:56 +00:00
if slot and isinstance ( idblock , Material ) :
2010-12-27 12:12:43 +00:00
col . prop ( tex , " use_normal_map " )
row = col . row ( )
row . active = tex . use_normal_map
row . prop ( slot , " normal_map_space " , text = " " )
2009-10-31 19:31:45 +00:00
2011-08-22 19:57:54 +00:00
row = col . row ( )
row . active = not tex . use_normal_map
row . prop ( tex , " use_derivative_map " )
2009-10-31 19:31:45 +00:00
2010-08-21 04:51:00 +00:00
col . prop ( tex , " use_mipmap " )
2009-10-31 19:31:45 +00:00
row = col . row ( )
2010-08-21 04:51:00 +00:00
row . active = tex . use_mipmap
2010-08-20 06:09:58 +00:00
row . prop ( tex , " use_mipmap_gauss " )
2010-08-21 04:51:00 +00:00
col . prop ( tex , " use_interpolation " )
2009-05-22 12:07:03 +00:00
2010-03-11 07:43:49 +00:00
texture_filter_common ( tex , col )
2010-03-14 23:26:17 +00:00
2013-01-22 18:42:16 +00:00
def draw_bge ( self , context ) :
layout = self . layout
idblock = context_tex_datablock ( context )
tex = context . texture
slot = getattr ( context , " texture_slot " , None )
split = layout . split ( )
col = split . column ( )
col . label ( text = " Alpha: " )
col . prop ( tex , " use_calculate_alpha " , text = " Calculate " )
col . prop ( tex , " invert_alpha " , text = " Invert " )
col = split . column ( )
#Only for Material based textures, not for Lamp/World...
if slot and isinstance ( idblock , Material ) :
col . prop ( tex , " use_normal_map " )
row = col . row ( )
row . active = tex . use_normal_map
row . prop ( slot , " normal_map_space " , text = " " )
row = col . row ( )
row . active = not tex . use_normal_map
row . prop ( tex , " use_derivative_map " )
2009-10-31 23:35:56 +00:00
2011-08-12 06:57:00 +00:00
class TEXTURE_PT_image_mapping ( TextureTypePanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Image Mapping "
2010-08-26 01:05:37 +00:00
bl_options = { ' DEFAULT_CLOSED ' }
2009-10-31 19:31:45 +00:00
tex_type = ' IMAGE '
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
layout = self . layout
tex = context . texture
2010-08-06 15:17:44 +00:00
layout . prop ( tex , " extension " )
2009-10-31 19:31:45 +00:00
split = layout . split ( )
if tex . extension == ' REPEAT ' :
col = split . column ( align = True )
2011-09-21 15:18:38 +00:00
col . label ( text = " Repeat: " )
2009-11-23 00:27:30 +00:00
col . prop ( tex , " repeat_x " , text = " X " )
col . prop ( tex , " repeat_y " , text = " Y " )
2009-10-31 19:31:45 +00:00
2010-08-06 15:17:44 +00:00
col = split . column ( align = True )
2011-09-21 15:18:38 +00:00
col . label ( text = " Mirror: " )
2013-08-23 20:41:21 +00:00
row = col . row ( align = True )
2010-12-20 18:57:59 +00:00
row . prop ( tex , " use_mirror_x " , text = " X " )
row . active = ( tex . repeat_x > 1 )
2013-08-23 20:41:21 +00:00
row = col . row ( align = True )
2010-12-20 18:57:59 +00:00
row . prop ( tex , " use_mirror_y " , text = " Y " )
row . active = ( tex . repeat_y > 1 )
2009-11-23 00:27:30 +00:00
layout . separator ( )
2009-10-31 19:31:45 +00:00
elif tex . extension == ' CHECKER ' :
col = split . column ( align = True )
2013-08-23 20:41:21 +00:00
row = col . row ( align = True )
2011-09-21 15:18:38 +00:00
row . prop ( tex , " use_checker_even " , text = " Even " )
row . prop ( tex , " use_checker_odd " , text = " Odd " )
2009-11-14 13:35:44 +00:00
2010-08-06 15:17:44 +00:00
col = split . column ( )
2011-09-21 15:18:38 +00:00
col . prop ( tex , " checker_distance " , text = " Distance " )
2009-11-14 13:35:44 +00:00
2009-11-23 00:27:30 +00:00
layout . separator ( )
2009-10-31 19:31:45 +00:00
split = layout . split ( )
col = split . column ( align = True )
2009-11-23 00:27:30 +00:00
#col.prop(tex, "crop_rectangle")
2011-09-21 15:18:38 +00:00
col . label ( text = " Crop Minimum: " )
2009-11-23 00:27:30 +00:00
col . prop ( tex , " crop_min_x " , text = " X " )
col . prop ( tex , " crop_min_y " , text = " Y " )
2009-10-31 19:31:45 +00:00
2010-08-06 15:17:44 +00:00
col = split . column ( align = True )
2011-09-21 15:18:38 +00:00
col . label ( text = " Crop Maximum: " )
2009-11-23 00:27:30 +00:00
col . prop ( tex , " crop_max_x " , text = " X " )
col . prop ( tex , " crop_max_y " , text = " Y " )
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 TEXTURE_PT_envmap ( TextureTypePanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Environment Map "
2009-10-31 19:31:45 +00:00
tex_type = ' ENVIRONMENT_MAP '
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
layout = self . layout
2010-03-11 07:43:49 +00:00
tex = context . texture
env = tex . environment_map
2010-03-14 23:26:17 +00:00
2010-03-11 07:43:49 +00:00
row = layout . row ( )
row . prop ( env , " source " , expand = True )
2012-05-23 14:24:40 +00:00
row . menu ( " TEXTURE_MT_envmap_specials " , icon = ' DOWNARROW_HLT ' , text = " " )
2010-03-14 23:26:17 +00:00
2010-03-11 07:43:49 +00:00
if env . source == ' IMAGE_FILE ' :
layout . template_ID ( tex , " image " , open = " image.open " )
layout . template_image ( tex , " image " , tex . image_user , compact = True )
else :
layout . prop ( env , " mapping " )
if env . mapping == ' PLANE ' :
layout . prop ( env , " zoom " )
layout . prop ( env , " viewpoint_object " )
2010-03-14 23:26:17 +00:00
2010-03-11 07:43:49 +00:00
split = layout . split ( )
2010-03-14 23:26:17 +00:00
2010-03-11 07:43:49 +00:00
col = split . column ( )
2010-08-19 12:51:31 +00:00
col . prop ( env , " layers_ignore " )
2010-03-11 07:43:49 +00:00
col . prop ( env , " resolution " )
col . prop ( env , " depth " )
2010-08-06 15:17:44 +00:00
col = split . column ( align = True )
2010-03-14 23:26:17 +00:00
2011-09-21 15:18:38 +00:00
col . label ( text = " Clipping: " )
col . prop ( env , " clip_start " , text = " Start " )
col . prop ( env , " clip_end " , text = " End " )
2009-10-31 19:31:45 +00:00
2011-08-12 06:57:00 +00:00
class TEXTURE_PT_envmap_sampling ( TextureTypePanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Environment Map Sampling "
2010-08-26 01:05:37 +00:00
bl_options = { ' DEFAULT_CLOSED ' }
2010-03-11 07:43:49 +00:00
tex_type = ' ENVIRONMENT_MAP '
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2010-03-11 07:43:49 +00:00
def draw ( self , context ) :
layout = self . layout
tex = context . texture
2010-03-14 23:26:17 +00:00
2010-03-11 07:43:49 +00:00
texture_filter_common ( tex , layout )
2010-03-14 23:26:17 +00:00
2009-10-31 23:35:56 +00:00
2011-08-12 06:57:00 +00:00
class TEXTURE_PT_musgrave ( TextureTypePanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Musgrave "
2009-10-31 19:31:45 +00:00
tex_type = ' MUSGRAVE '
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
layout = self . layout
tex = context . texture
2010-08-06 15:17:44 +00:00
layout . prop ( tex , " musgrave_type " )
2009-10-31 19:31:45 +00:00
split = layout . split ( )
col = split . column ( )
2011-09-21 15:18:38 +00:00
col . prop ( tex , " dimension_max " , text = " Dimension " )
2009-11-23 00:27:30 +00:00
col . prop ( tex , " lacunarity " )
col . prop ( tex , " octaves " )
2009-10-31 19:31:45 +00:00
2010-12-09 03:22:03 +00:00
musgrave_type = tex . musgrave_type
2010-08-06 15:17:44 +00:00
col = split . column ( )
2011-03-07 13:23:45 +00:00
if musgrave_type in { ' HETERO_TERRAIN ' , ' RIDGED_MULTIFRACTAL ' , ' HYBRID_MULTIFRACTAL ' } :
2009-11-23 00:27:30 +00:00
col . prop ( tex , " offset " )
2011-03-07 13:23:45 +00:00
if musgrave_type in { ' MULTIFRACTAL ' , ' RIDGED_MULTIFRACTAL ' , ' HYBRID_MULTIFRACTAL ' } :
2011-09-21 15:18:38 +00:00
col . prop ( tex , " noise_intensity " , text = " Intensity " )
2011-03-07 13:23:45 +00:00
if musgrave_type in { ' RIDGED_MULTIFRACTAL ' , ' HYBRID_MULTIFRACTAL ' } :
2010-12-09 03:22:03 +00:00
col . prop ( tex , " gain " )
2009-10-31 19:31:45 +00:00
2011-09-21 15:18:38 +00:00
layout . label ( text = " Noise: " )
2009-10-31 19:31:45 +00:00
2011-09-21 15:18:38 +00:00
layout . prop ( tex , " noise_basis " , text = " Basis " )
2009-10-31 19:31:45 +00:00
2011-02-26 16:04:14 +00:00
row = layout . row ( )
2011-09-21 15:18:38 +00:00
row . prop ( tex , " noise_scale " , text = " Size " )
2011-02-26 16:04:14 +00:00
row . prop ( tex , " nabla " )
2009-05-22 12:07:03 +00:00
2009-10-31 23:35:56 +00:00
2011-08-12 06:57:00 +00:00
class TEXTURE_PT_voronoi ( TextureTypePanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Voronoi "
2009-10-31 19:31:45 +00:00
tex_type = ' VORONOI '
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
layout = self . layout
tex = context . texture
split = layout . split ( )
col = split . column ( )
2011-09-21 15:18:38 +00:00
col . label ( text = " Distance Metric: " )
2009-11-23 00:27:30 +00:00
col . prop ( tex , " distance_metric " , text = " " )
2009-10-31 19:31:45 +00:00
sub = col . column ( )
sub . active = tex . distance_metric == ' MINKOVSKY '
2011-09-21 15:18:38 +00:00
sub . prop ( tex , " minkovsky_exponent " , text = " Exponent " )
col . label ( text = " Coloring: " )
2010-08-20 06:09:58 +00:00
col . prop ( tex , " color_mode " , text = " " )
2011-09-21 15:18:38 +00:00
col . prop ( tex , " noise_intensity " , text = " Intensity " )
2009-10-31 19:31:45 +00:00
2010-08-06 15:17:44 +00:00
col = split . column ( )
2009-11-12 15:41:44 +00:00
sub = col . column ( align = True )
2011-09-21 15:18:38 +00:00
sub . label ( text = " Feature Weights: " )
2009-11-23 00:27:30 +00:00
sub . prop ( tex , " weight_1 " , text = " 1 " , slider = True )
sub . prop ( tex , " weight_2 " , text = " 2 " , slider = True )
sub . prop ( tex , " weight_3 " , text = " 3 " , slider = True )
sub . prop ( tex , " weight_4 " , text = " 4 " , slider = True )
2009-10-31 19:31:45 +00:00
2011-09-21 15:18:38 +00:00
layout . label ( text = " Noise: " )
2011-02-26 16:04:14 +00:00
row = layout . row ( )
2011-09-21 15:18:38 +00:00
row . prop ( tex , " noise_scale " , text = " Size " )
2011-02-26 16:04:14 +00:00
row . prop ( tex , " nabla " )
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 TEXTURE_PT_distortednoise ( TextureTypePanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Distorted Noise "
2009-10-31 19:31:45 +00:00
tex_type = ' DISTORTED_NOISE '
2010-04-19 00:39:46 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
layout = self . layout
tex = context . texture
2009-11-12 15:41:44 +00:00
2010-08-06 15:17:44 +00:00
layout . prop ( tex , " noise_distortion " )
2011-09-21 15:18:38 +00:00
layout . prop ( tex , " noise_basis " , text = " Basis " )
2009-10-31 19:31:45 +00:00
2009-11-12 15:41:44 +00:00
split = layout . split ( )
2009-10-31 19:31:45 +00:00
2009-11-12 15:41:44 +00:00
col = split . column ( )
2011-09-21 15:18:38 +00:00
col . prop ( tex , " distortion " , text = " Distortion " )
col . prop ( tex , " noise_scale " , text = " Size " )
2009-11-14 13:35:44 +00:00
2011-02-26 16:04:14 +00:00
split . prop ( tex , " nabla " )
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 TEXTURE_PT_voxeldata ( TextureButtonsPanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Voxel Data "
2010-04-19 00:39:46 +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 ) :
2009-10-31 19:31:45 +00:00
tex = context . texture
2010-04-19 00:39:46 +00:00
engine = context . scene . render . engine
2010-08-09 01:37:09 +00:00
return tex and ( tex . type == ' VOXEL_DATA ' and ( engine in cls . COMPAT_ENGINES ) )
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
layout = self . layout
tex = context . texture
2010-08-18 08:26:18 +00:00
vd = tex . voxel_data
2009-10-31 19:31:45 +00:00
2009-11-23 00:27:30 +00:00
layout . prop ( vd , " file_format " )
2011-03-07 13:23:45 +00:00
if vd . file_format in { ' BLENDER_VOXEL ' , ' RAW_8BIT ' } :
2010-08-20 06:09:58 +00:00
layout . prop ( vd , " filepath " )
2009-10-31 19:31:45 +00:00
if vd . file_format == ' RAW_8BIT ' :
2009-11-23 00:27:30 +00:00
layout . prop ( vd , " resolution " )
2009-10-31 19:31:45 +00:00
elif vd . file_format == ' SMOKE ' :
2009-11-23 00:27:30 +00:00
layout . prop ( vd , " domain_object " )
2010-01-25 15:10:14 +00:00
layout . prop ( vd , " smoke_data_type " )
2010-01-15 07:26:38 +00:00
elif vd . file_format == ' IMAGE_SEQUENCE ' :
2010-06-01 06:07:22 +00:00
layout . template_ID ( tex , " image " , open = " image.open " )
layout . template_image ( tex , " image " , tex . image_user , compact = True )
2010-08-21 04:51:00 +00:00
#layout.prop(vd, "frame_duration")
2009-10-31 19:31:45 +00:00
2011-03-07 13:23:45 +00:00
if vd . file_format in { ' BLENDER_VOXEL ' , ' RAW_8BIT ' } :
2010-10-08 08:56:04 +00:00
layout . prop ( vd , " use_still_frame " )
row = layout . row ( )
row . active = vd . use_still_frame
row . prop ( vd , " still_frame " )
2009-10-31 19:31:45 +00:00
2009-11-23 00:27:30 +00:00
layout . prop ( vd , " interpolation " )
layout . prop ( vd , " extension " )
layout . prop ( vd , " intensity " )
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 TEXTURE_PT_pointdensity ( TextureButtonsPanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Point Density "
2010-04-19 00:39:46 +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 ) :
2009-10-31 19:31:45 +00:00
tex = context . texture
2010-04-19 00:39:46 +00:00
engine = context . scene . render . engine
2010-08-09 01:37:09 +00:00
return tex and ( tex . type == ' POINT_DENSITY ' and ( engine in cls . COMPAT_ENGINES ) )
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
layout = self . layout
tex = context . texture
2010-08-18 08:26:18 +00:00
pd = tex . point_density
2009-10-31 19:31:45 +00:00
2010-08-06 15:17:44 +00:00
layout . prop ( pd , " point_source " , expand = True )
2009-10-31 19:31:45 +00:00
split = layout . split ( )
col = split . column ( )
if pd . point_source == ' PARTICLE_SYSTEM ' :
2011-09-21 15:18:38 +00:00
col . label ( text = " Object: " )
2009-11-23 00:27:30 +00:00
col . prop ( pd , " object " , text = " " )
2009-10-31 19:31:45 +00:00
sub = col . column ( )
2009-11-22 22:09:06 +00:00
sub . enabled = bool ( pd . object )
2009-10-31 19:31:45 +00:00
if pd . object :
2011-09-21 15:18:38 +00:00
sub . label ( text = " System: " )
2010-08-23 05:47:45 +00:00
sub . prop_search ( pd , " particle_system " , pd . object , " particle_systems " , text = " " )
2011-09-21 15:18:38 +00:00
sub . label ( text = " Cache: " )
2010-08-20 06:09:58 +00:00
sub . prop ( pd , " particle_cache_space " , text = " " )
2009-10-31 19:31:45 +00:00
else :
2011-09-21 15:18:38 +00:00
col . label ( text = " Object: " )
2009-11-23 00:27:30 +00:00
col . prop ( pd , " object " , text = " " )
2011-09-21 15:18:38 +00:00
col . label ( text = " Cache: " )
2010-08-20 06:09:58 +00:00
col . prop ( pd , " vertex_cache_space " , text = " " )
2009-10-31 19:31:45 +00:00
2009-11-23 00:27:30 +00:00
col . separator ( )
2009-10-31 19:31:45 +00:00
2011-03-16 18:21:31 +00:00
if pd . point_source == ' PARTICLE_SYSTEM ' :
2011-09-21 15:18:38 +00:00
col . label ( text = " Color Source: " )
2011-03-16 18:21:31 +00:00
col . prop ( pd , " color_source " , text = " " )
if pd . color_source in { ' PARTICLE_SPEED ' , ' PARTICLE_VELOCITY ' } :
col . prop ( pd , " speed_scale " )
if pd . color_source in { ' PARTICLE_SPEED ' , ' PARTICLE_AGE ' } :
layout . template_color_ramp ( pd , " color_ramp " , expand = True )
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 ( )
col . prop ( pd , " radius " )
2011-09-21 15:18:38 +00:00
col . label ( text = " Falloff: " )
2009-11-23 00:27:30 +00:00
col . prop ( pd , " falloff " , text = " " )
2009-10-31 19:31:45 +00:00
if pd . falloff == ' SOFT ' :
2010-08-20 06:09:58 +00:00
col . prop ( pd , " falloff_soft " )
2011-11-11 03:28:46 +00:00
if pd . falloff == ' PARTICLE_VELOCITY ' :
2011-05-01 03:57:53 +00:00
col . prop ( pd , " falloff_speed_scale " )
2011-05-02 17:29:30 +00:00
2011-05-01 03:57:53 +00:00
col . prop ( pd , " use_falloff_curve " )
2011-05-02 17:29:30 +00:00
2011-05-01 03:57:53 +00:00
if pd . use_falloff_curve :
col = layout . column ( )
2011-09-21 15:18:38 +00:00
col . label ( text = " Falloff Curve " )
2011-05-01 03:57:53 +00:00
col . template_curve_mapping ( pd , " falloff_curve " , brush = False )
2009-09-01 14:59:50 +00:00
2009-10-31 23:35:56 +00:00
2011-08-12 06:57:00 +00:00
class TEXTURE_PT_pointdensity_turbulence ( TextureButtonsPanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Turbulence "
2010-04-19 00:39:46 +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 ) :
2009-10-31 19:31:45 +00:00
tex = context . texture
2010-04-19 00:39:46 +00:00
engine = context . scene . render . engine
2010-08-09 01:37:09 +00:00
return tex and ( tex . type == ' POINT_DENSITY ' and ( engine in cls . COMPAT_ENGINES ) )
2009-10-31 19:31:45 +00:00
def draw_header ( self , context ) :
2011-03-16 18:21:31 +00:00
pd = context . texture . point_density
2009-11-14 13:35:44 +00:00
2011-02-26 16:04:14 +00:00
self . layout . prop ( pd , " use_turbulence " , text = " " )
2009-10-31 19:31:45 +00:00
def draw ( self , context ) :
layout = self . layout
tex = context . texture
2010-08-18 08:26:18 +00:00
pd = tex . point_density
2010-08-20 06:09:58 +00:00
layout . active = pd . use_turbulence
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 = " Influence: " )
2009-11-23 00:27:30 +00:00
col . prop ( pd , " turbulence_influence " , text = " " )
2011-09-21 15:18:38 +00:00
col . label ( text = " Noise Basis: " )
2009-11-23 00:27:30 +00:00
col . prop ( pd , " noise_basis " , text = " " )
2009-10-31 19:31:45 +00:00
2010-08-06 15:17:44 +00:00
col = split . column ( )
col . label ( )
2010-08-20 06:09:58 +00:00
col . prop ( pd , " turbulence_scale " )
2009-11-23 00:27:30 +00:00
col . prop ( pd , " turbulence_depth " )
col . prop ( pd , " turbulence_strength " )
2009-08-27 19:10:53 +00:00
2010-02-14 11:21:21 +00:00
2011-11-13 12:17:27 +00:00
class TEXTURE_PT_ocean ( TextureTypePanel , Panel ) :
bl_label = " Ocean "
tex_type = ' OCEAN '
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
2011-11-13 14:38:00 +00:00
2011-11-13 12:17:27 +00:00
def draw ( self , context ) :
layout = self . layout
2011-11-13 14:38:00 +00:00
2011-11-13 12:17:27 +00:00
tex = context . texture
ot = tex . ocean
2011-11-13 14:38:00 +00:00
col = layout . column ( )
2011-11-13 12:17:27 +00:00
col . prop ( ot , " ocean_object " )
col . prop ( ot , " output " )
2011-08-12 06:57:00 +00:00
class TEXTURE_PT_mapping ( TextureSlotPanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Mapping "
2010-11-30 01:03:17 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
@classmethod
def poll ( cls , context ) :
idblock = context_tex_datablock ( context )
2012-01-18 06:11:56 +00:00
if isinstance ( idblock , Brush ) and not context . sculpt_object :
2010-11-30 01:03:17 +00:00
return False
if not getattr ( context , " texture_slot " , None ) :
return False
engine = context . scene . render . engine
return ( engine in cls . COMPAT_ENGINES )
def draw ( self , context ) :
layout = self . layout
idblock = context_tex_datablock ( context )
tex = context . texture_slot
2012-01-18 06:11:56 +00:00
if not isinstance ( idblock , Brush ) :
2010-11-30 01:03:17 +00:00
split = layout . split ( percentage = 0.3 )
col = split . column ( )
2011-09-21 15:18:38 +00:00
col . label ( text = " Coordinates: " )
2010-11-30 01:03:17 +00:00
col = split . column ( )
col . prop ( tex , " texture_coords " , text = " " )
if tex . texture_coords == ' ORCO ' :
"""
ob = context . object
if ob and ob . type == ' MESH ' :
split = layout . split ( percentage = 0.3 )
2011-09-21 15:18:38 +00:00
split . label ( text = " Mesh: " )
2010-11-30 01:03:17 +00:00
split . prop ( ob . data , " texco_mesh " , text = " " )
"""
elif tex . texture_coords == ' UV ' :
split = layout . split ( percentage = 0.3 )
2011-11-23 17:25:25 +00:00
split . label ( text = " Map: " )
2010-11-30 01:03:17 +00:00
ob = context . object
if ob and ob . type == ' MESH ' :
split . prop_search ( tex , " uv_layer " , ob . data , " uv_textures " , text = " " )
else :
split . prop ( tex , " uv_layer " , text = " " )
elif tex . texture_coords == ' OBJECT ' :
split = layout . split ( percentage = 0.3 )
2011-09-21 15:18:38 +00:00
split . label ( text = " Object: " )
2010-11-30 01:03:17 +00:00
split . prop ( tex , " object " , text = " " )
2012-01-18 06:11:56 +00:00
if isinstance ( idblock , Brush ) :
2013-01-16 12:57:35 +00:00
if context . sculpt_object or context . image_paint_object :
brush_texture_settings ( layout , idblock , context . sculpt_object )
2010-11-30 01:03:17 +00:00
else :
2012-01-18 06:11:56 +00:00
if isinstance ( idblock , Material ) :
2010-11-30 01:03:17 +00:00
split = layout . split ( percentage = 0.3 )
2011-09-21 15:18:38 +00:00
split . label ( text = " Projection: " )
2010-11-30 01:03:17 +00:00
split . prop ( tex , " mapping " , text = " " )
split = layout . split ( )
col = split . column ( )
2011-03-07 13:23:45 +00:00
if tex . texture_coords in { ' ORCO ' , ' UV ' } :
2010-11-30 01:03:17 +00:00
col . prop ( tex , " use_from_dupli " )
2012-10-10 13:18:07 +00:00
if ( idblock . type == ' VOLUME ' and tex . texture_coords == ' ORCO ' ) :
col . prop ( tex , " use_map_to_bounds " )
2010-11-30 01:03:17 +00:00
elif tex . texture_coords == ' OBJECT ' :
col . prop ( tex , " use_from_original " )
2012-10-10 13:18:07 +00:00
if ( idblock . type == ' VOLUME ' ) :
col . prop ( tex , " use_map_to_bounds " )
2010-11-30 01:03:17 +00:00
else :
col . label ( )
col = split . column ( )
row = col . row ( )
row . prop ( tex , " mapping_x " , text = " " )
row . prop ( tex , " mapping_y " , text = " " )
row . prop ( tex , " mapping_z " , text = " " )
2012-05-15 04:50:47 +00:00
row = layout . row ( )
row . column ( ) . prop ( tex , " offset " )
row . column ( ) . prop ( tex , " scale " )
2010-11-30 01:03:17 +00:00
2011-08-12 06:57:00 +00:00
class TEXTURE_PT_influence ( TextureSlotPanel , Panel ) :
2011-09-15 13:20:18 +00:00
bl_label = " Influence "
2010-11-30 01:03:17 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
@classmethod
def poll ( cls , context ) :
idblock = context_tex_datablock ( context )
2012-01-18 06:11:56 +00:00
if isinstance ( idblock , Brush ) :
2010-11-30 01:03:17 +00:00
return False
if not getattr ( context , " texture_slot " , None ) :
return False
engine = context . scene . render . engine
return ( engine in cls . COMPAT_ENGINES )
def draw ( self , context ) :
layout = self . layout
idblock = context_tex_datablock ( context )
tex = context . texture_slot
2010-12-08 05:51:16 +00:00
def factor_but ( layout , toggle , factor , name ) :
2010-11-30 01:03:17 +00:00
row = layout . row ( align = True )
row . prop ( tex , toggle , text = " " )
2013-08-23 20:41:21 +00:00
sub = row . row ( align = True )
2010-12-08 05:51:16 +00:00
sub . active = getattr ( tex , toggle )
2010-11-30 01:03:17 +00:00
sub . prop ( tex , factor , text = name , slider = True )
2011-01-01 07:20:34 +00:00
return sub # XXX, temp. use_map_normal needs to override.
2010-11-30 01:03:17 +00:00
2012-01-18 06:11:56 +00:00
if isinstance ( idblock , Material ) :
2011-03-07 13:23:45 +00:00
if idblock . type in { ' SURFACE ' , ' WIRE ' } :
2010-11-30 01:03:17 +00:00
split = layout . split ( )
col = split . column ( )
2011-09-21 15:18:38 +00:00
col . label ( text = " Diffuse: " )
factor_but ( col , " use_map_diffuse " , " diffuse_factor " , " Intensity " )
factor_but ( col , " use_map_color_diffuse " , " diffuse_color_factor " , " Color " )
factor_but ( col , " use_map_alpha " , " alpha_factor " , " Alpha " )
factor_but ( col , " use_map_translucency " , " translucency_factor " , " Translucency " )
2010-11-30 01:03:17 +00:00
2011-09-21 15:18:38 +00:00
col . label ( text = " Specular: " )
factor_but ( col , " use_map_specular " , " specular_factor " , " Intensity " )
factor_but ( col , " use_map_color_spec " , " specular_color_factor " , " Color " )
factor_but ( col , " use_map_hardness " , " hardness_factor " , " Hardness " )
2010-11-30 01:03:17 +00:00
col = split . column ( )
2011-09-21 15:18:38 +00:00
col . label ( text = " Shading: " )
factor_but ( col , " use_map_ambient " , " ambient_factor " , " Ambient " )
factor_but ( col , " use_map_emit " , " emit_factor " , " Emit " )
factor_but ( col , " use_map_mirror " , " mirror_factor " , " Mirror " )
factor_but ( col , " use_map_raymir " , " raymir_factor " , " Ray Mirror " )
2010-11-30 01:03:17 +00:00
2011-09-21 15:18:38 +00:00
col . label ( text = " Geometry: " )
2010-11-30 01:03:17 +00:00
# XXX replace 'or' when displacement is fixed to not rely on normal influence value.
2011-09-21 15:18:38 +00:00
sub_tmp = factor_but ( col , " use_map_normal " , " normal_factor " , " Normal " )
2010-12-08 05:51:16 +00:00
sub_tmp . active = ( tex . use_map_normal or tex . use_map_displacement )
# END XXX
2011-09-21 15:18:38 +00:00
factor_but ( col , " use_map_warp " , " warp_factor " , " Warp " )
factor_but ( col , " use_map_displacement " , " displacement_factor " , " Displace " )
2010-11-30 01:03:17 +00:00
2011-10-17 06:58:07 +00:00
#~ sub = col.column()
#~ sub.active = tex.use_map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror
#~ sub.prop(tex, "default_value", text="Amount", slider=True)
2010-12-08 20:10:59 +00:00
elif idblock . type == ' HALO ' :
2011-09-21 15:18:38 +00:00
layout . label ( text = " Halo: " )
2011-01-01 07:20:34 +00:00
2010-12-08 20:10:59 +00:00
split = layout . split ( )
2011-01-01 07:20:34 +00:00
2010-12-08 20:10:59 +00:00
col = split . column ( )
2011-09-21 15:18:38 +00:00
factor_but ( col , " use_map_color_diffuse " , " diffuse_color_factor " , " Color " )
factor_but ( col , " use_map_alpha " , " alpha_factor " , " Alpha " )
2011-01-01 07:20:34 +00:00
2010-12-08 20:10:59 +00:00
col = split . column ( )
2011-09-21 15:18:38 +00:00
factor_but ( col , " use_map_raymir " , " raymir_factor " , " Size " )
factor_but ( col , " use_map_hardness " , " hardness_factor " , " Hardness " )
factor_but ( col , " use_map_translucency " , " translucency_factor " , " Add " )
2010-11-30 01:03:17 +00:00
elif idblock . type == ' VOLUME ' :
split = layout . split ( )
col = split . column ( )
2011-09-21 15:18:38 +00:00
factor_but ( col , " use_map_density " , " density_factor " , " Density " )
factor_but ( col , " use_map_emission " , " emission_factor " , " Emission " )
factor_but ( col , " use_map_scatter " , " scattering_factor " , " Scattering " )
factor_but ( col , " use_map_reflect " , " reflection_factor " , " Reflection " )
2010-11-30 01:03:17 +00:00
col = split . column ( )
col . label ( text = " " )
2011-09-21 15:18:38 +00:00
factor_but ( col , " use_map_color_emission " , " emission_color_factor " , " Emission Color " )
factor_but ( col , " use_map_color_transmission " , " transmission_color_factor " , " Transmission Color " )
factor_but ( col , " use_map_color_reflection " , " reflection_color_factor " , " Reflection Color " )
2010-11-30 01:03:17 +00:00
2012-01-18 06:11:56 +00:00
elif isinstance ( idblock , Lamp ) :
2010-11-30 01:03:17 +00:00
split = layout . split ( )
col = split . column ( )
2011-09-21 15:18:38 +00:00
factor_but ( col , " use_map_color " , " color_factor " , " Color " )
2010-11-30 01:03:17 +00:00
col = split . column ( )
2011-09-21 15:18:38 +00:00
factor_but ( col , " use_map_shadow " , " shadow_factor " , " Shadow " )
2010-11-30 01:03:17 +00:00
2012-01-18 06:11:56 +00:00
elif isinstance ( idblock , World ) :
2010-11-30 01:03:17 +00:00
split = layout . split ( )
col = split . column ( )
2011-09-21 15:18:38 +00:00
factor_but ( col , " use_map_blend " , " blend_factor " , " Blend " )
factor_but ( col , " use_map_horizon " , " horizon_factor " , " Horizon " )
2010-11-30 01:03:17 +00:00
col = split . column ( )
2011-09-21 15:18:38 +00:00
factor_but ( col , " use_map_zenith_up " , " zenith_up_factor " , " Zenith Up " )
factor_but ( col , " use_map_zenith_down " , " zenith_down_factor " , " Zenith Down " )
2012-01-18 06:11:56 +00:00
elif isinstance ( idblock , ParticleSettings ) :
2011-02-12 14:38:34 +00:00
split = layout . split ( )
2011-02-16 02:25:03 +00:00
2011-02-12 14:38:34 +00:00
col = split . column ( )
2011-09-21 15:18:38 +00:00
col . label ( text = " General: " )
factor_but ( col , " use_map_time " , " time_factor " , " Time " )
factor_but ( col , " use_map_life " , " life_factor " , " Lifetime " )
factor_but ( col , " use_map_density " , " density_factor " , " Density " )
factor_but ( col , " use_map_size " , " size_factor " , " Size " )
2010-11-30 01:03:17 +00:00
2011-02-12 14:38:34 +00:00
col = split . column ( )
2011-09-21 15:18:38 +00:00
col . label ( text = " Physics: " )
factor_but ( col , " use_map_velocity " , " velocity_factor " , " Velocity " )
factor_but ( col , " use_map_damp " , " damp_factor " , " Damp " )
factor_but ( col , " use_map_gravity " , " gravity_factor " , " Gravity " )
factor_but ( col , " use_map_field " , " field_factor " , " Force Fields " )
2011-02-16 02:25:03 +00:00
2011-09-21 15:18:38 +00:00
layout . label ( text = " Hair: " )
2011-02-16 02:25:03 +00:00
2011-02-12 14:38:34 +00:00
split = layout . split ( )
2011-02-16 02:25:03 +00:00
2011-02-12 14:38:34 +00:00
col = split . column ( )
2011-09-21 15:18:38 +00:00
factor_but ( col , " use_map_length " , " length_factor " , " Length " )
factor_but ( col , " use_map_clump " , " clump_factor " , " Clump " )
2011-02-16 02:25:03 +00:00
2011-02-12 14:38:34 +00:00
col = split . column ( )
2011-09-21 15:18:38 +00:00
factor_but ( col , " use_map_kink " , " kink_factor " , " Kink " )
factor_but ( col , " use_map_rough " , " rough_factor " , " Rough " )
2010-11-30 01:03:17 +00:00
2011-02-12 14:38:34 +00:00
layout . separator ( )
2011-02-16 02:25:03 +00:00
2012-01-18 06:11:56 +00:00
if not isinstance ( idblock , ParticleSettings ) :
2011-02-12 14:38:34 +00:00
split = layout . split ( )
2010-11-30 01:03:17 +00:00
2011-02-12 14:38:34 +00:00
col = split . column ( )
2011-09-21 15:18:38 +00:00
col . prop ( tex , " blend_type " , text = " Blend " )
2011-02-12 14:38:34 +00:00
col . prop ( tex , " use_rgb_to_intensity " )
2011-10-17 06:58:07 +00:00
# color is used on gray-scale textures even when use_rgb_to_intensity is disabled.
2011-02-12 14:38:34 +00:00
col . prop ( tex , " color " , text = " " )
2010-11-30 01:03:17 +00:00
2011-02-12 14:38:34 +00:00
col = split . column ( )
2011-09-21 15:18:38 +00:00
col . prop ( tex , " invert " , text = " Negative " )
2011-02-12 14:38:34 +00:00
col . prop ( tex , " use_stencil " )
2010-11-30 01:03:17 +00:00
2012-01-18 06:11:56 +00:00
if isinstance ( idblock , Material ) or isinstance ( idblock , World ) :
2011-09-21 15:18:38 +00:00
col . prop ( tex , " default_value " , text = " DVar " , slider = True )
2010-11-30 01:03:17 +00:00
2012-01-18 06:11:56 +00:00
if isinstance ( idblock , Material ) :
2011-09-21 15:18:38 +00:00
layout . label ( text = " Bump Mapping: " )
2011-01-29 11:56:11 +00:00
2011-10-17 06:58:07 +00:00
# only show bump settings if activated but not for normal-map images
2011-02-26 16:04:14 +00:00
row = layout . row ( )
2011-01-29 11:56:11 +00:00
2011-08-22 19:57:54 +00:00
sub = row . row ( )
sub . active = ( tex . use_map_normal or tex . use_map_warp ) and not ( tex . texture . type == ' IMAGE ' and ( tex . texture . use_normal_map or tex . texture . use_derivative_map ) )
2011-09-21 15:18:38 +00:00
sub . prop ( tex , " bump_method " , text = " Method " )
2011-01-29 11:56:11 +00:00
2011-10-17 06:58:07 +00:00
# the space setting is supported for: derivative-maps + bump-maps (DEFAULT,BEST_QUALITY), not for normal-maps
2011-02-26 16:04:14 +00:00
sub = row . row ( )
2011-12-15 13:58:09 +00:00
sub . active = ( tex . use_map_normal or tex . use_map_warp ) and not ( tex . texture . type == ' IMAGE ' and tex . texture . use_normal_map ) and ( ( tex . bump_method in { ' BUMP_LOW_QUALITY ' , ' BUMP_MEDIUM_QUALITY ' , ' BUMP_BEST_QUALITY ' } ) or ( tex . texture . type == ' IMAGE ' and tex . texture . use_derivative_map ) )
2011-09-21 15:18:38 +00:00
sub . prop ( tex , " bump_objectspace " , text = " Space " )
2011-02-26 16:27:58 +00:00
2010-11-30 01:03:17 +00:00
2011-08-12 06:57:00 +00:00
class TEXTURE_PT_custom_props ( TextureButtonsPanel , PropertyPanel , Panel ) :
2010-08-12 19:36:10 +00:00
COMPAT_ENGINES = { ' BLENDER_RENDER ' , ' BLENDER_GAME ' }
_context_path = " texture "
2012-01-18 06:11:56 +00:00
_property_type = Texture
2011-04-04 10:13:04 +00:00
if __name__ == " __main__ " : # only for live edit.
bpy . utils . register_module ( __name__ )