diff options
Diffstat (limited to 'release/scripts/ui/properties_texture.py')
-rw-r--r-- | release/scripts/ui/properties_texture.py | 324 |
1 files changed, 100 insertions, 224 deletions
diff --git a/release/scripts/ui/properties_texture.py b/release/scripts/ui/properties_texture.py index 2bfbe188c9e..b675576ec3f 100644 --- a/release/scripts/ui/properties_texture.py +++ b/release/scripts/ui/properties_texture.py @@ -20,8 +20,6 @@ import bpy from rna_prop_ui import PropertyPanel -narrowui = bpy.context.user_preferences.view.properties_width_check - class TEXTURE_MT_specials(bpy.types.Menu): bl_label = "Texture Specials" @@ -65,20 +63,18 @@ def context_tex_datablock(context): return idblock -class TextureButtonsPanel(bpy.types.Panel): +class TextureButtonsPanel(): bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_context = "texture" - def poll(self, context): + @classmethod + def poll(cls, context): tex = context.texture - if not tex: - return False - engine = context.scene.render.engine - return (tex.type != 'NONE' or tex.use_nodes) and (engine in self.COMPAT_ENGINES) + return tex and (tex.type != 'NONE' or tex.use_nodes) and (context.scene.render.engine in cls.COMPAT_ENGINES) -class TEXTURE_PT_preview(TextureButtonsPanel): +class TEXTURE_PT_preview(TextureButtonsPanel, bpy.types.Panel): bl_label = "Preview" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -95,17 +91,18 @@ class TEXTURE_PT_preview(TextureButtonsPanel): layout.template_preview(tex, slot=slot) -class TEXTURE_PT_context_texture(TextureButtonsPanel): +class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel): bl_label = "" bl_show_header = False COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} - def poll(self, context): + @classmethod + def poll(cls, context): engine = context.scene.render.engine if not hasattr(context, "texture_slot"): return False return ((context.material or context.world or context.lamp or context.brush or context.texture) - and (engine in self.COMPAT_ENGINES)) + and (engine in cls.COMPAT_ENGINES)) def draw(self, context): layout = self.layout @@ -113,7 +110,6 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel): node = context.texture_node space = context.space_data tex = context.texture - wide_ui = context.region.width > narrowui idblock = context_tex_datablock(context) tex_collection = space.pin_id == None and type(idblock) != bpy.types.Brush and not node @@ -127,11 +123,8 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel): col.operator("texture.slot_move", text="", icon='TRIA_DOWN').type = 'DOWN' col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="") - if wide_ui: - split = layout.split(percentage=0.65) - col = split.column() - else: - col = layout.column() + split = layout.split(percentage=0.65) + col = split.column() if tex_collection: col.template_ID(idblock, "active_texture", new="texture.new") @@ -143,8 +136,7 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel): if space.pin_id: col.template_ID(space, "pin_id") - if wide_ui: - col = split.column() + col = split.column() if not space.pin_id: col.prop(space, "brush_texture", text="Brush", toggle=True) @@ -159,23 +151,16 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel): split.prop(slot, "output_node", text="") else: - if wide_ui: - split.label(text="Type:") - split.prop(tex, "type", text="") - else: - layout.prop(tex, "type", text="") + split.label(text="Type:") + split.prop(tex, "type", text="") -class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel): - _context_path = "texture" +class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, bpy.types.Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} - - def poll(self, context): # use alternate poll since NONE texture type is ok - engine = context.scene.render.engine - return context.texture and (engine in self.COMPAT_ENGINES) + _context_path = "texture" -class TEXTURE_PT_colors(TextureButtonsPanel): +class TEXTURE_PT_colors(TextureButtonsPanel, bpy.types.Panel): bl_label = "Colors" bl_default_closed = True COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -184,7 +169,6 @@ class TEXTURE_PT_colors(TextureButtonsPanel): layout = self.layout tex = context.texture - wide_ui = context.region.width > narrowui layout.prop(tex, "use_color_ramp", text="Ramp") if tex.use_color_ramp: @@ -199,8 +183,7 @@ class TEXTURE_PT_colors(TextureButtonsPanel): sub.prop(tex, "factor_green", text="G") sub.prop(tex, "factor_blue", text="B") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Adjust:") col.prop(tex, "brightness") col.prop(tex, "contrast") @@ -212,19 +195,21 @@ class TEXTURE_PT_colors(TextureButtonsPanel): class TextureSlotPanel(TextureButtonsPanel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} - def poll(self, context): + @classmethod + def poll(cls, context): if not hasattr(context, "texture_slot"): return False engine = context.scene.render.engine - return TextureButtonsPanel.poll(self, context) and (engine in self.COMPAT_ENGINES) + return TextureButtonsPanel.poll(self, context) and (engine in cls.COMPAT_ENGINES) -class TEXTURE_PT_mapping(TextureSlotPanel): +class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel): bl_label = "Mapping" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} - def poll(self, context): + @classmethod + def poll(cls, context): idblock = context_tex_datablock(context) if type(idblock) == bpy.types.Brush and not context.sculpt_object: return False @@ -233,7 +218,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel): return False engine = context.scene.render.engine - return (engine in self.COMPAT_ENGINES) + return (engine in cls.COMPAT_ENGINES) def draw(self, context): layout = self.layout @@ -242,7 +227,6 @@ class TEXTURE_PT_mapping(TextureSlotPanel): tex = context.texture_slot # textype = context.texture - wide_ui = context.region.width > narrowui if type(idblock) != bpy.types.Brush: split = layout.split(percentage=0.3) @@ -294,11 +278,10 @@ class TEXTURE_PT_mapping(TextureSlotPanel): col.prop(tex, "from_dupli") elif tex.texture_coordinates == 'OBJECT': col.prop(tex, "from_original") - elif wide_ui: + else: col.label() - if wide_ui: - col = split.column() + col = split.column() row = col.row() row.prop(tex, "x_mapping", text="") row.prop(tex, "y_mapping", text="") @@ -309,19 +292,17 @@ class TEXTURE_PT_mapping(TextureSlotPanel): col = split.column() col.prop(tex, "offset") - if wide_ui: - col = split.column() - else: - col.separator() + col = split.column() col.prop(tex, "size") -class TEXTURE_PT_influence(TextureSlotPanel): +class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel): bl_label = "Influence" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} - def poll(self, context): + @classmethod + def poll(cls, context): idblock = context_tex_datablock(context) if type(idblock) == bpy.types.Brush: return False @@ -330,7 +311,7 @@ class TEXTURE_PT_influence(TextureSlotPanel): return False engine = context.scene.render.engine - return (engine in self.COMPAT_ENGINES) + return (engine in cls.COMPAT_ENGINES) def draw(self, context): @@ -340,7 +321,6 @@ class TEXTURE_PT_influence(TextureSlotPanel): # textype = context.texture tex = context.texture_slot - wide_ui = context.region.width > narrowui def factor_but(layout, active, toggle, factor, name): row = layout.row(align=True) @@ -365,8 +345,7 @@ class TEXTURE_PT_influence(TextureSlotPanel): factor_but(col, tex.map_colorspec, "map_colorspec", "colorspec_factor", "Color") factor_but(col, tex.map_hardness, "map_hardness", "hardness_factor", "Hardness") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Shading:") factor_but(col, tex.map_ambient, "map_ambient", "ambient_factor", "Ambient") factor_but(col, tex.map_emit, "map_emit", "emit_factor", "Emit") @@ -391,9 +370,8 @@ class TEXTURE_PT_influence(TextureSlotPanel): factor_but(col, tex.map_scattering, "map_scattering", "scattering_factor", "Scattering") factor_but(col, tex.map_reflection, "map_reflection", "reflection_factor", "Reflection") - if wide_ui: - col = split.column() - col.label(text=" ") + col = split.column() + col.label(text=" ") factor_but(col, tex.map_coloremission, "map_coloremission", "coloremission_factor", "Emission Color") factor_but(col, tex.map_colortransmission, "map_colortransmission", "colortransmission_factor", "Transmission Color") factor_but(col, tex.map_colorreflection, "map_colorreflection", "colorreflection_factor", "Reflection Color") @@ -404,8 +382,7 @@ class TEXTURE_PT_influence(TextureSlotPanel): col = split.column() factor_but(col, tex.map_color, "map_color", "color_factor", "Color") - if wide_ui: - col = split.column() + col = split.column() factor_but(col, tex.map_shadow, "map_shadow", "shadow_factor", "Shadow") elif type(idblock) == bpy.types.World: @@ -415,8 +392,7 @@ class TEXTURE_PT_influence(TextureSlotPanel): factor_but(col, tex.map_blend, "map_blend", "blend_factor", "Blend") factor_but(col, tex.map_horizon, "map_horizon", "horizon_factor", "Horizon") - if wide_ui: - col = split.column() + col = split.column() factor_but(col, tex.map_zenith_up, "map_zenith_up", "zenith_up_factor", "Zenith Up") factor_but(col, tex.map_zenith_down, "map_zenith_down", "zenith_down_factor", "Zenith Down") @@ -431,8 +407,7 @@ class TEXTURE_PT_influence(TextureSlotPanel): sub.active = tex.rgb_to_intensity sub.prop(tex, "color", text="") - if wide_ui: - col = split.column() + col = split.column() col.prop(tex, "negate", text="Negative") col.prop(tex, "stencil") @@ -443,15 +418,15 @@ class TEXTURE_PT_influence(TextureSlotPanel): class TextureTypePanel(TextureButtonsPanel): - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} - def poll(self, context): + @classmethod + def poll(cls, context): tex = context.texture engine = context.scene.render.engine - return ((tex and tex.type == self.tex_type and not tex.use_nodes) and (engine in self.COMPAT_ENGINES)) + return tex and ((tex.type == cls.tex_type and not tex.use_nodes) and (engine in cls.COMPAT_ENGINES)) -class TEXTURE_PT_clouds(TextureTypePanel): +class TEXTURE_PT_clouds(TextureTypePanel, bpy.types.Panel): bl_label = "Clouds" tex_type = 'CLOUDS' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -460,15 +435,11 @@ class TEXTURE_PT_clouds(TextureTypePanel): layout = self.layout tex = context.texture - wide_ui = context.region.width > narrowui layout.prop(tex, "stype", expand=True) layout.label(text="Noise:") layout.prop(tex, "noise_type", text="Type", expand=True) - if wide_ui: - layout.prop(tex, "noise_basis", text="Basis") - else: - layout.prop(tex, "noise_basis", text="") + layout.prop(tex, "noise_basis", text="Basis") split = layout.split() @@ -476,12 +447,11 @@ class TEXTURE_PT_clouds(TextureTypePanel): col.prop(tex, "noise_size", text="Size") col.prop(tex, "noise_depth", text="Depth") - if wide_ui: - col = split.column() + col = split.column() col.prop(tex, "nabla", text="Nabla") -class TEXTURE_PT_wood(TextureTypePanel): +class TEXTURE_PT_wood(TextureTypePanel, bpy.types.Panel): bl_label = "Wood" tex_type = 'WOOD' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -490,22 +460,15 @@ class TEXTURE_PT_wood(TextureTypePanel): layout = self.layout tex = context.texture - wide_ui = context.region.width > narrowui layout.prop(tex, "noisebasis2", expand=True) - if wide_ui: - layout.prop(tex, "stype", expand=True) - else: - layout.prop(tex, "stype", text="") + layout.prop(tex, "stype", expand=True) col = layout.column() col.active = tex.stype in ('RINGNOISE', 'BANDNOISE') col.label(text="Noise:") col.row().prop(tex, "noise_type", text="Type", expand=True) - if wide_ui: - layout.prop(tex, "noise_basis", text="Basis") - else: - layout.prop(tex, "noise_basis", text="") + layout.prop(tex, "noise_basis", text="Basis") split = layout.split() split.active = tex.stype in ('RINGNOISE', 'BANDNOISE') @@ -518,7 +481,7 @@ class TEXTURE_PT_wood(TextureTypePanel): col.prop(tex, "nabla") -class TEXTURE_PT_marble(TextureTypePanel): +class TEXTURE_PT_marble(TextureTypePanel, bpy.types.Panel): bl_label = "Marble" tex_type = 'MARBLE' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -527,16 +490,12 @@ class TEXTURE_PT_marble(TextureTypePanel): layout = self.layout tex = context.texture - wide_ui = context.region.width > narrowui layout.prop(tex, "stype", expand=True) layout.prop(tex, "noisebasis2", expand=True) layout.label(text="Noise:") layout.prop(tex, "noise_type", text="Type", expand=True) - if wide_ui: - layout.prop(tex, "noise_basis", text="Basis") - else: - layout.prop(tex, "noise_basis", text="") + layout.prop(tex, "noise_basis", text="Basis") split = layout.split() @@ -544,13 +503,12 @@ class TEXTURE_PT_marble(TextureTypePanel): col.prop(tex, "noise_size", text="Size") col.prop(tex, "noise_depth", text="Depth") - if wide_ui: - col = split.column() + col = split.column() col.prop(tex, "turbulence") col.prop(tex, "nabla") -class TEXTURE_PT_magic(TextureTypePanel): +class TEXTURE_PT_magic(TextureTypePanel, bpy.types.Panel): bl_label = "Magic" tex_type = 'MAGIC' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -559,19 +517,17 @@ class TEXTURE_PT_magic(TextureTypePanel): layout = self.layout tex = context.texture - wide_ui = context.region.width > narrowui split = layout.split() col = split.column() col.prop(tex, "noise_depth", text="Depth") - if wide_ui: - col = split.column() + col = split.column() col.prop(tex, "turbulence") -class TEXTURE_PT_blend(TextureTypePanel): +class TEXTURE_PT_blend(TextureTypePanel, bpy.types.Panel): bl_label = "Blend" tex_type = 'BLEND' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -580,12 +536,8 @@ class TEXTURE_PT_blend(TextureTypePanel): layout = self.layout tex = context.texture - wide_ui = context.region.width > narrowui - if wide_ui: - layout.prop(tex, "progression") - else: - layout.prop(tex, "progression", text="") + layout.prop(tex, "progression") sub = layout.row() @@ -593,7 +545,7 @@ class TEXTURE_PT_blend(TextureTypePanel): sub.prop(tex, "flip_axis", expand=True) -class TEXTURE_PT_stucci(TextureTypePanel): +class TEXTURE_PT_stucci(TextureTypePanel, bpy.types.Panel): bl_label = "Stucci" tex_type = 'STUCCI' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -602,27 +554,22 @@ class TEXTURE_PT_stucci(TextureTypePanel): layout = self.layout tex = context.texture - wide_ui = context.region.width > narrowui layout.prop(tex, "stype", expand=True) layout.label(text="Noise:") layout.prop(tex, "noise_type", text="Type", expand=True) - if wide_ui: - layout.prop(tex, "noise_basis", text="Basis") - else: - layout.prop(tex, "noise_basis", text="") + layout.prop(tex, "noise_basis", text="Basis") split = layout.split() col = split.column() col.prop(tex, "noise_size", text="Size") - if wide_ui: - col = split.column() + col = split.column() col.prop(tex, "turbulence") -class TEXTURE_PT_image(TextureTypePanel): +class TEXTURE_PT_image(TextureTypePanel, bpy.types.Panel): bl_label = "Image" tex_type = 'IMAGE' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -648,7 +595,7 @@ def texture_filter_common(tex, layout): layout.prop(tex, "filter_size_minimum") -class TEXTURE_PT_image_sampling(TextureTypePanel): +class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel): bl_label = "Image Sampling" bl_default_closed = True tex_type = 'IMAGE' @@ -659,7 +606,6 @@ class TEXTURE_PT_image_sampling(TextureTypePanel): tex = context.texture # slot = context.texture_slot - wide_ui = context.region.width > narrowui split = layout.split() @@ -671,10 +617,8 @@ class TEXTURE_PT_image_sampling(TextureTypePanel): col.separator() col.prop(tex, "flip_axis", text="Flip X/Y Axis") - if wide_ui: - col = split.column() - else: - col.separator() + col = split.column() + col.prop(tex, "normal_map") row = col.row() row.active = tex.normal_map @@ -689,7 +633,7 @@ class TEXTURE_PT_image_sampling(TextureTypePanel): texture_filter_common(tex, col) -class TEXTURE_PT_image_mapping(TextureTypePanel): +class TEXTURE_PT_image_mapping(TextureTypePanel, bpy.types.Panel): bl_label = "Image Mapping" bl_default_closed = True tex_type = 'IMAGE' @@ -699,12 +643,8 @@ class TEXTURE_PT_image_mapping(TextureTypePanel): layout = self.layout tex = context.texture - wide_ui = context.region.width > narrowui - if wide_ui: - layout.prop(tex, "extension") - else: - layout.prop(tex, "extension", text="") + layout.prop(tex, "extension") split = layout.split() @@ -714,8 +654,7 @@ class TEXTURE_PT_image_mapping(TextureTypePanel): col.prop(tex, "repeat_x", text="X") col.prop(tex, "repeat_y", text="Y") - if wide_ui: - col = split.column(align=True) + col = split.column(align=True) col.label(text="Mirror:") col.prop(tex, "mirror_x", text="X") col.prop(tex, "mirror_y", text="Y") @@ -727,8 +666,7 @@ class TEXTURE_PT_image_mapping(TextureTypePanel): row.prop(tex, "checker_even", text="Even") row.prop(tex, "checker_odd", text="Odd") - if wide_ui: - col = split.column() + col = split.column() col.prop(tex, "checker_distance", text="Distance") layout.separator() @@ -741,14 +679,13 @@ class TEXTURE_PT_image_mapping(TextureTypePanel): col.prop(tex, "crop_min_x", text="X") col.prop(tex, "crop_min_y", text="Y") - if wide_ui: - col = split.column(align=True) + col = split.column(align=True) col.label(text="Crop Maximum:") col.prop(tex, "crop_max_x", text="X") col.prop(tex, "crop_max_y", text="Y") -class TEXTURE_PT_plugin(TextureTypePanel): +class TEXTURE_PT_plugin(TextureTypePanel, bpy.types.Panel): bl_label = "Plugin" tex_type = 'PLUGIN' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -761,7 +698,7 @@ class TEXTURE_PT_plugin(TextureTypePanel): layout.label(text="Nothing yet") -class TEXTURE_PT_envmap(TextureTypePanel): +class TEXTURE_PT_envmap(TextureTypePanel, bpy.types.Panel): bl_label = "Environment Map" tex_type = 'ENVIRONMENT_MAP' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -772,7 +709,6 @@ class TEXTURE_PT_envmap(TextureTypePanel): tex = context.texture env = tex.environment_map - wide_ui = context.region.width > narrowui row = layout.row() row.prop(env, "source", expand=True) @@ -794,15 +730,14 @@ class TEXTURE_PT_envmap(TextureTypePanel): col.prop(env, "resolution") col.prop(env, "depth") - if wide_ui: - col = split.column(align=True) + col = split.column(align=True) col.label(text="Clipping:") col.prop(env, "clip_start", text="Start") col.prop(env, "clip_end", text="End") -class TEXTURE_PT_envmap_sampling(TextureTypePanel): +class TEXTURE_PT_envmap_sampling(TextureTypePanel, bpy.types.Panel): bl_label = "Environment Map Sampling" bl_default_closed = True tex_type = 'ENVIRONMENT_MAP' @@ -816,7 +751,7 @@ class TEXTURE_PT_envmap_sampling(TextureTypePanel): texture_filter_common(tex, layout) -class TEXTURE_PT_musgrave(TextureTypePanel): +class TEXTURE_PT_musgrave(TextureTypePanel, bpy.types.Panel): bl_label = "Musgrave" tex_type = 'MUSGRAVE' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -825,12 +760,8 @@ class TEXTURE_PT_musgrave(TextureTypePanel): layout = self.layout tex = context.texture - wide_ui = context.region.width > narrowui - if wide_ui: - layout.prop(tex, "musgrave_type") - else: - layout.prop(tex, "musgrave_type", text="") + layout.prop(tex, "musgrave_type") split = layout.split() @@ -839,8 +770,7 @@ class TEXTURE_PT_musgrave(TextureTypePanel): col.prop(tex, "lacunarity") col.prop(tex, "octaves") - if wide_ui: - col = split.column() + col = split.column() if (tex.musgrave_type in ('HETERO_TERRAIN', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')): col.prop(tex, "offset") if (tex.musgrave_type in ('RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')): @@ -849,22 +779,18 @@ class TEXTURE_PT_musgrave(TextureTypePanel): layout.label(text="Noise:") - if wide_ui: - layout.prop(tex, "noise_basis", text="Basis") - else: - layout.prop(tex, "noise_basis", text="") + layout.prop(tex, "noise_basis", text="Basis") split = layout.split() col = split.column() col.prop(tex, "noise_size", text="Size") - if wide_ui: - col = split.column() + col = split.column() col.prop(tex, "nabla") -class TEXTURE_PT_voronoi(TextureTypePanel): +class TEXTURE_PT_voronoi(TextureTypePanel, bpy.types.Panel): bl_label = "Voronoi" tex_type = 'VORONOI' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -873,7 +799,6 @@ class TEXTURE_PT_voronoi(TextureTypePanel): layout = self.layout tex = context.texture - wide_ui = context.region.width > narrowui split = layout.split() @@ -887,8 +812,7 @@ class TEXTURE_PT_voronoi(TextureTypePanel): col.prop(tex, "coloring", text="") col.prop(tex, "noise_intensity", text="Intensity") - if wide_ui: - col = split.column() + col = split.column() sub = col.column(align=True) sub.label(text="Feature Weights:") sub.prop(tex, "weight_1", text="1", slider=True) @@ -903,12 +827,11 @@ class TEXTURE_PT_voronoi(TextureTypePanel): col = split.column() col.prop(tex, "noise_size", text="Size") - if wide_ui: - col = split.column() + col = split.column() col.prop(tex, "nabla") -class TEXTURE_PT_distortednoise(TextureTypePanel): +class TEXTURE_PT_distortednoise(TextureTypePanel, bpy.types.Panel): bl_label = "Distorted Noise" tex_type = 'DISTORTED_NOISE' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -917,14 +840,9 @@ class TEXTURE_PT_distortednoise(TextureTypePanel): layout = self.layout tex = context.texture - wide_ui = context.region.width > narrowui - if wide_ui: - layout.prop(tex, "noise_distortion") - layout.prop(tex, "noise_basis", text="Basis") - else: - layout.prop(tex, "noise_distortion", text="") - layout.prop(tex, "noise_basis", text="") + layout.prop(tex, "noise_distortion") + layout.prop(tex, "noise_basis", text="Basis") split = layout.split() @@ -932,19 +850,19 @@ class TEXTURE_PT_distortednoise(TextureTypePanel): col.prop(tex, "distortion", text="Distortion") col.prop(tex, "noise_size", text="Size") - if wide_ui: - col = split.column() + col = split.column() col.prop(tex, "nabla") -class TEXTURE_PT_voxeldata(TextureButtonsPanel): +class TEXTURE_PT_voxeldata(TextureButtonsPanel, bpy.types.Panel): bl_label = "Voxel Data" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} - def poll(self, context): + @classmethod + def poll(cls, context): tex = context.texture engine = context.scene.render.engine - return (tex and tex.type == 'VOXEL_DATA' and (engine in self.COMPAT_ENGINES)) + return tex and (tex.type == 'VOXEL_DATA' and (engine in cls.COMPAT_ENGINES)) def draw(self, context): layout = self.layout @@ -975,26 +893,23 @@ class TEXTURE_PT_voxeldata(TextureButtonsPanel): layout.prop(vd, "intensity") -class TEXTURE_PT_pointdensity(TextureButtonsPanel): +class TEXTURE_PT_pointdensity(TextureButtonsPanel, bpy.types.Panel): bl_label = "Point Density" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} - def poll(self, context): + @classmethod + def poll(cls, context): tex = context.texture engine = context.scene.render.engine - return (tex and tex.type == 'POINT_DENSITY' and (engine in self.COMPAT_ENGINES)) + return tex and (tex.type == 'POINT_DENSITY' and (engine in cls.COMPAT_ENGINES)) def draw(self, context): layout = self.layout tex = context.texture pd = tex.pointdensity - wide_ui = context.region.width > narrowui - if wide_ui: - layout.prop(pd, "point_source", expand=True) - else: - layout.prop(pd, "point_source", text="") + layout.prop(pd, "point_source", expand=True) split = layout.split() @@ -1025,8 +940,7 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel): if pd.color_source in ('PARTICLE_SPEED', 'PARTICLE_AGE'): layout.template_color_ramp(pd, "color_ramp", expand=True) - if wide_ui: - col = split.column() + col = split.column() col.label() col.prop(pd, "radius") col.label(text="Falloff:") @@ -1035,14 +949,15 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel): col.prop(pd, "falloff_softness") -class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel): +class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel, bpy.types.Panel): bl_label = "Turbulence" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} - def poll(self, context): + @classmethod + def poll(cls, context): tex = context.texture engine = context.scene.render.engine - return (tex and tex.type == 'POINT_DENSITY' and (engine in self.COMPAT_ENGINES)) + return tex and (tex.type == 'POINT_DENSITY' and (engine in cls.COMPAT_ENGINES)) def draw_header(self, context): layout = self.layout @@ -1058,7 +973,6 @@ class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel): tex = context.texture pd = tex.pointdensity layout.active = pd.turbulence - wide_ui = context.region.width > narrowui split = layout.split() @@ -1068,57 +982,19 @@ class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel): col.label(text="Noise Basis:") col.prop(pd, "noise_basis", text="") - if wide_ui: - col = split.column() - col.label() + col = split.column() + col.label() col.prop(pd, "turbulence_size") col.prop(pd, "turbulence_depth") col.prop(pd, "turbulence_strength") -classes = [ - TEXTURE_MT_specials, - TEXTURE_MT_envmap_specials, - - TEXTURE_PT_context_texture, - TEXTURE_PT_preview, - - TEXTURE_PT_clouds, # Texture Type Panels - TEXTURE_PT_wood, - TEXTURE_PT_marble, - TEXTURE_PT_magic, - TEXTURE_PT_blend, - TEXTURE_PT_stucci, - TEXTURE_PT_image, - TEXTURE_PT_image_sampling, - TEXTURE_PT_image_mapping, - TEXTURE_PT_plugin, - TEXTURE_PT_envmap, - TEXTURE_PT_envmap_sampling, - TEXTURE_PT_musgrave, - TEXTURE_PT_voronoi, - TEXTURE_PT_distortednoise, - TEXTURE_PT_voxeldata, - TEXTURE_PT_pointdensity, - TEXTURE_PT_pointdensity_turbulence, - - TEXTURE_PT_colors, - TEXTURE_PT_mapping, - TEXTURE_PT_influence, - - TEXTURE_PT_custom_props] - - def register(): - register = bpy.types.register - for cls in classes: - register(cls) + pass def unregister(): - unregister = bpy.types.unregister - for cls in classes: - unregister(cls) + pass if __name__ == "__main__": register() |