Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts/ui/properties_world.py')
-rw-r--r--release/scripts/ui/properties_world.py104
1 files changed, 38 insertions, 66 deletions
diff --git a/release/scripts/ui/properties_world.py b/release/scripts/ui/properties_world.py
index 22acd49f897..eec1caf58f7 100644
--- a/release/scripts/ui/properties_world.py
+++ b/release/scripts/ui/properties_world.py
@@ -20,36 +20,41 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class WorldButtonsPanel(bpy.types.Panel):
+class WorldButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "world"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
- return (context.world) and (not rd.use_game_engine) and (rd.engine in self.COMPAT_ENGINES)
+ return (rd.engine in cls.COMPAT_ENGINES)
-class WORLD_PT_preview(WorldButtonsPanel):
+class WORLD_PT_preview(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER'}
+ @classmethod
+ def poll(cls, context):
+ rd = context.scene.render
+ return (context.world) and (not rd.use_game_engine) and (rd.engine in cls.COMPAT_ENGINES)
+
def draw(self, context):
self.layout.template_preview(context.world)
-class WORLD_PT_context_world(WorldButtonsPanel):
+class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
- return (not rd.use_game_engine) and (rd.engine in self.COMPAT_ENGINES)
+ return (not rd.use_game_engine) and (rd.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -57,43 +62,31 @@ class WORLD_PT_context_world(WorldButtonsPanel):
scene = context.scene
world = context.world
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
- if scene:
- split.template_ID(scene, "world", new="world.new")
- elif world:
- split.template_ID(space, "pin_id")
- else:
- layout.template_ID(scene, "world", new="world.new")
+ split = layout.split(percentage=0.65)
+ if scene:
+ split.template_ID(scene, "world", new="world.new")
+ elif world:
+ split.template_ID(space, "pin_id")
-class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel):
- COMPAT_ENGINES = {'BLENDER_RENDER'}
+class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "world"
-class WORLD_PT_world(WorldButtonsPanel):
+class WORLD_PT_world(WorldButtonsPanel, bpy.types.Panel):
bl_label = "World"
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
layout = self.layout
- wide_ui = context.region.width > narrowui
world = context.world
- if wide_ui:
- row = layout.row()
- row.prop(world, "paper_sky")
- row.prop(world, "blend_sky")
- row.prop(world, "real_sky")
- else:
- col = layout.column()
- col.prop(world, "paper_sky")
- col.prop(world, "blend_sky")
- col.prop(world, "real_sky")
+ row = layout.row()
+ row.prop(world, "paper_sky")
+ row.prop(world, "blend_sky")
+ row.prop(world, "real_sky")
row = layout.row()
row.column().prop(world, "horizon_color")
@@ -103,7 +96,7 @@ class WORLD_PT_world(WorldButtonsPanel):
row.column().prop(world, "ambient_color")
-class WORLD_PT_mist(WorldButtonsPanel):
+class WORLD_PT_mist(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Mist"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -115,7 +108,6 @@ class WORLD_PT_mist(WorldButtonsPanel):
def draw(self, context):
layout = self.layout
- wide_ui = context.region.width > narrowui
world = context.world
layout.active = world.mist.use_mist
@@ -126,15 +118,14 @@ class WORLD_PT_mist(WorldButtonsPanel):
col.prop(world.mist, "intensity", slider=True)
col.prop(world.mist, "start")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(world.mist, "depth")
col.prop(world.mist, "height")
layout.prop(world.mist, "falloff")
-class WORLD_PT_stars(WorldButtonsPanel):
+class WORLD_PT_stars(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Stars"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -146,7 +137,6 @@ class WORLD_PT_stars(WorldButtonsPanel):
def draw(self, context):
layout = self.layout
- wide_ui = context.region.width > narrowui
world = context.world
layout.active = world.stars.use_stars
@@ -157,13 +147,12 @@ class WORLD_PT_stars(WorldButtonsPanel):
col.prop(world.stars, "size")
col.prop(world.stars, "color_randomization", text="Colors")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(world.stars, "min_distance", text="Min. Dist")
col.prop(world.stars, "average_separation", text="Separation")
-class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
+class WORLD_PT_ambient_occlusion(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Ambient Occlusion"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -182,7 +171,7 @@ class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
split.prop(light, "ao_blend_mode", text="")
-class WORLD_PT_environment_lighting(WorldButtonsPanel):
+class WORLD_PT_environment_lighting(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Environment Lighting"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -201,11 +190,12 @@ class WORLD_PT_environment_lighting(WorldButtonsPanel):
split.prop(light, "environment_color", text="")
-class WORLD_PT_indirect_lighting(WorldButtonsPanel):
+class WORLD_PT_indirect_lighting(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Indirect Lighting"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
light = context.world.lighting
return light.gather_method == 'APPROXIMATE'
@@ -224,7 +214,7 @@ class WORLD_PT_indirect_lighting(WorldButtonsPanel):
split.prop(light, "indirect_bounces", text="Bounces")
-class WORLD_PT_gather(WorldButtonsPanel):
+class WORLD_PT_gather(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Gather"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -272,30 +262,12 @@ class WORLD_PT_gather(WorldButtonsPanel):
col.prop(light, "correction")
-classes = [
- WORLD_PT_context_world,
- WORLD_PT_preview,
- WORLD_PT_world,
- WORLD_PT_ambient_occlusion,
- WORLD_PT_environment_lighting,
- WORLD_PT_indirect_lighting,
- WORLD_PT_gather,
- WORLD_PT_mist,
- WORLD_PT_stars,
-
- WORLD_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()