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_game.py')
-rw-r--r--release/scripts/ui/properties_game.py327
1 files changed, 143 insertions, 184 deletions
diff --git a/release/scripts/ui/properties_game.py b/release/scripts/ui/properties_game.py
index 41af955d9ec..e703f4a9812 100644
--- a/release/scripts/ui/properties_game.py
+++ b/release/scripts/ui/properties_game.py
@@ -19,22 +19,22 @@
# <pep8 compliant>
import bpy
-narrowui = 180
-
-class PhysicsButtonsPanel(bpy.types.Panel):
+class PhysicsButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "physics"
- def poll(self, context):
- ob = context.active_object
- rd = context.scene.render
- return ob and ob.game and (rd.engine == 'BLENDER_GAME')
-
-class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
+class PHYSICS_PT_game_physics(PhysicsButtonsPanel, bpy.types.Panel):
bl_label = "Physics"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.active_object
+ rd = context.scene.render
+ return ob and ob.game and (rd.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -42,12 +42,8 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
ob = context.active_object
game = ob.game
soft = ob.game.soft_body
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(game, "physics_type")
- else:
- layout.prop(game, "physics_type", text="")
+ layout.prop(game, "physics_type")
layout.separator()
#if game.physics_type == 'DYNAMIC':
@@ -55,15 +51,14 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
split = layout.split()
col = split.column()
- col.prop(game, "actor")
- col.prop(game, "ghost")
- col.prop(ob, "restrict_render", text="Invisible") # out of place but useful
+ col.prop(game, "use_actor")
+ col.prop(game, "use_ghost")
+ col.prop(ob, "hide_render", text="Invisible") # out of place but useful
- if wide_ui:
- col = split.column()
- col.prop(game, "material_physics")
- col.prop(game, "rotate_from_normal")
- col.prop(game, "no_sleeping")
+ col = split.column()
+ col.prop(game, "use_material_physics")
+ col.prop(game, "use_rotate_from_normal")
+ col.prop(game, "use_sleep")
layout.separator()
@@ -75,13 +70,12 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
col.prop(game, "radius")
col.prop(game, "form_factor")
- if wide_ui:
- col = split.column()
+ col = split.column()
sub = col.column()
sub.active = (game.physics_type == 'RIGID_BODY')
- sub.prop(game, "anisotropic_friction")
+ sub.prop(game, "use_anisotropic_friction")
subsub = sub.column()
- subsub.active = game.anisotropic_friction
+ subsub.active = game.use_anisotropic_friction
subsub.prop(game, "friction_coefficients", text="", slider=True)
split = layout.split()
@@ -89,11 +83,10 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
col = split.column()
col.label(text="Velocity:")
sub = col.column(align=True)
- sub.prop(game, "minimum_velocity", text="Minimum")
- sub.prop(game, "maximum_velocity", text="Maximum")
+ sub.prop(game, "velocity_min", text="Minimum")
+ sub.prop(game, "velocity_max", text="Maximum")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Damping:")
sub = col.column(align=True)
sub.prop(game, "damping", text="Translation", slider=True)
@@ -105,21 +98,21 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
col = split.column()
col.label(text="Lock Translation:")
- col.prop(game, "lock_x_axis", text="X")
- col.prop(game, "lock_y_axis", text="Y")
- col.prop(game, "lock_z_axis", text="Z")
+ col.prop(game, "lock_location_x", text="X")
+ col.prop(game, "lock_location_y", text="Y")
+ col.prop(game, "lock_location_z", text="Z")
col = split.column()
col.label(text="Lock Rotation:")
- col.prop(game, "lock_x_rot_axis", text="X")
- col.prop(game, "lock_y_rot_axis", text="Y")
- col.prop(game, "lock_z_rot_axis", text="Z")
+ col.prop(game, "lock_rotation_x", text="X")
+ col.prop(game, "lock_rotation_y", text="Y")
+ col.prop(game, "lock_rotation_z", text="Z")
elif game.physics_type == 'SOFT_BODY':
col = layout.column()
- col.prop(game, "actor")
- col.prop(game, "ghost")
- col.prop(ob, "restrict_render", text="Invisible")
+ col.prop(game, "use_actor")
+ col.prop(game, "use_ghost")
+ col.prop(ob, "hide_render", text="Invisible")
layout.separator()
@@ -128,46 +121,47 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
col = split.column()
col.label(text="Attributes:")
col.prop(game, "mass")
- col.prop(soft, "welding")
- col.prop(soft, "position_iterations")
- col.prop(soft, "linstiff", slider=True)
+ col.prop(soft, "weld_threshold")
+ col.prop(soft, "location_iterations")
+ col.prop(soft, "linear_stiffness", slider=True)
col.prop(soft, "dynamic_friction", slider=True)
- col.prop(soft, "margin", slider=True)
- col.prop(soft, "bending_const", text="Bending Constraints")
+ col.prop(soft, "collision_margin", slider=True)
+ col.prop(soft, "use_bending_constraints", text="Bending Constraints")
- if wide_ui:
- col = split.column()
- col.prop(soft, "shape_match")
+ col = split.column()
+ col.prop(soft, "use_shape_match")
sub = col.column()
- sub.active = soft.shape_match
- sub.prop(soft, "threshold", slider=True)
+ sub.active = soft.use_shape_match
+ sub.prop(soft, "shape_threshold", slider=True)
col.separator()
col.label(text="Cluster Collision:")
- col.prop(soft, "cluster_rigid_to_softbody")
- col.prop(soft, "cluster_soft_to_softbody")
+ col.prop(soft, "use_cluster_rigid_to_softbody")
+ col.prop(soft, "use_cluster_soft_to_softbody")
sub = col.column()
- sub.active = (soft.cluster_rigid_to_softbody or soft.cluster_soft_to_softbody)
+ sub.active = (soft.use_cluster_rigid_to_softbody or soft.use_cluster_soft_to_softbody)
sub.prop(soft, "cluster_iterations", text="Iterations")
elif game.physics_type == 'STATIC':
col = layout.column()
- col.prop(game, "actor")
- col.prop(game, "ghost")
- col.prop(ob, "restrict_render", text="Invisible")
+ col.prop(game, "use_actor")
+ col.prop(game, "use_ghost")
+ col.prop(ob, "hide_render", text="Invisible")
elif game.physics_type in ('SENSOR', 'INVISIBLE', 'NO_COLLISION', 'OCCLUDE'):
- layout.prop(ob, "restrict_render", text="Invisible")
+ layout.prop(ob, "hide_render", text="Invisible")
-class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel):
+class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, bpy.types.Panel):
bl_label = "Collision Bounds"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
game = context.object.game
rd = context.scene.render
- return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine == 'BLENDER_GAME')
+ return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
game = context.active_object.game
@@ -178,36 +172,33 @@ class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel):
layout = self.layout
game = context.active_object.game
- wide_ui = context.region.width > narrowui
layout.active = game.use_collision_bounds
- if wide_ui:
- layout.prop(game, "collision_bounds", text="Bounds")
- else:
- layout.prop(game, "collision_bounds", text="")
+ layout.prop(game, "collision_bounds_type", text="Bounds")
split = layout.split()
col = split.column()
col.prop(game, "collision_margin", text="Margin", slider=True)
- if wide_ui:
- col = split.column()
- col.prop(game, "collision_compound", text="Compound")
+ col = split.column()
+ col.prop(game, "use_collision_compound", text="Compound")
-class RenderButtonsPanel(bpy.types.Panel):
+class RenderButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "render"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
- return (rd.engine == 'BLENDER_GAME')
+ return (rd.engine in cls.COMPAT_ENGINES)
-class RENDER_PT_game(RenderButtonsPanel):
+class RENDER_PT_game(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Game"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context):
layout = self.layout
@@ -217,16 +208,16 @@ class RENDER_PT_game(RenderButtonsPanel):
row.label()
-class RENDER_PT_game_player(RenderButtonsPanel):
+class RENDER_PT_game_player(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Standalone Player"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context):
layout = self.layout
- gs = context.scene.game_data
- wide_ui = context.region.width > narrowui
+ gs = context.scene.game_settings
- layout.prop(gs, "fullscreen")
+ layout.prop(gs, "show_fullscreen")
split = layout.split()
@@ -236,8 +227,7 @@ class RENDER_PT_game_player(RenderButtonsPanel):
sub.prop(gs, "resolution_x", slider=False, text="X")
sub.prop(gs, "resolution_y", slider=False, text="Y")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Quality:")
sub = col.column(align=True)
sub.prop(gs, "depth", text="Bit Depth", slider=False)
@@ -246,23 +236,20 @@ class RENDER_PT_game_player(RenderButtonsPanel):
# framing:
col = layout.column()
col.label(text="Framing:")
- if wide_ui:
- col.row().prop(gs, "framing_type", expand=True)
- else:
- col.prop(gs, "framing_type", text="")
- if gs.framing_type == 'LETTERBOX':
- col.prop(gs, "framing_color", text="")
+ col.row().prop(gs, "frame_type", expand=True)
+ if gs.frame_type == 'LETTERBOX':
+ col.prop(gs, "frame_color", text="")
-class RENDER_PT_game_stereo(RenderButtonsPanel):
+class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Stereo"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context):
layout = self.layout
- gs = context.scene.game_data
+ gs = context.scene.game_settings
stereo_mode = gs.stereo
- wide_ui = context.region.width > narrowui
# stereo options:
layout.prop(gs, "stereo", expand=True)
@@ -270,14 +257,11 @@ class RENDER_PT_game_stereo(RenderButtonsPanel):
# stereo:
if stereo_mode == 'STEREO':
layout.prop(gs, "stereo_mode")
- layout.prop(gs, "eye_separation")
+ layout.prop(gs, "stereo_eye_separation")
# dome:
elif stereo_mode == 'DOME':
- if wide_ui:
- layout.prop(gs, "dome_mode", text="Dome Type")
- else:
- layout.prop(gs, "dome_mode", text="")
+ layout.prop(gs, "dome_mode", text="Dome Type")
dome_type = gs.dome_mode
@@ -291,8 +275,7 @@ class RENDER_PT_game_stereo(RenderButtonsPanel):
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
col.prop(gs, "dome_angle", slider=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(gs, "dome_tesselation", text="Tesselation")
col.prop(gs, "dome_tilt")
@@ -300,55 +283,51 @@ class RENDER_PT_game_stereo(RenderButtonsPanel):
col = split.column()
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(gs, "dome_tesselation", text="Tesselation")
else: # cube map
col = split.column()
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
- if wide_ui:
- col = split.column()
+
+ col = split.column()
layout.prop(gs, "dome_text")
-class RENDER_PT_game_shading(RenderButtonsPanel):
+class RENDER_PT_game_shading(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Shading"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context):
layout = self.layout
- gs = context.scene.game_data
- wide_ui = context.region.width > narrowui
+ gs = context.scene.game_settings
- if wide_ui:
- layout.prop(gs, "material_mode", expand=True)
- else:
- layout.prop(gs, "material_mode", text="")
+ layout.prop(gs, "material_mode", expand=True)
if gs.material_mode == 'GLSL':
split = layout.split()
col = split.column()
- col.prop(gs, "glsl_lights", text="Lights")
- col.prop(gs, "glsl_shaders", text="Shaders")
- col.prop(gs, "glsl_shadows", text="Shadows")
+ col.prop(gs, "use_glsl_lights", text="Lights")
+ col.prop(gs, "use_glsl_shaders", text="Shaders")
+ col.prop(gs, "use_glsl_shadows", text="Shadows")
col = split.column()
- col.prop(gs, "glsl_ramps", text="Ramps")
- col.prop(gs, "glsl_nodes", text="Nodes")
- col.prop(gs, "glsl_extra_textures", text="Extra Textures")
+ col.prop(gs, "use_glsl_ramps", text="Ramps")
+ col.prop(gs, "use_glsl_nodes", text="Nodes")
+ col.prop(gs, "use_glsl_extra_textures", text="Extra Textures")
-class RENDER_PT_game_performance(RenderButtonsPanel):
+class RENDER_PT_game_performance(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Performance"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context):
layout = self.layout
- gs = context.scene.game_data
- wide_ui = context.region.width > narrowui
+ gs = context.scene.game_settings
split = layout.split()
@@ -359,45 +338,41 @@ class RENDER_PT_game_performance(RenderButtonsPanel):
col.prop(gs, "show_physics_visualization", text="Physics Visualization")
col.prop(gs, "use_deprecation_warnings")
- if wide_ui:
- col = split.column()
+ col = split.column()
+
col.label(text="Render:")
col.prop(gs, "use_frame_rate")
col.prop(gs, "use_display_lists")
-class RENDER_PT_game_sound(RenderButtonsPanel):
+class RENDER_PT_game_sound(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Sound"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context):
layout = self.layout
scene = context.scene
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(scene, "distance_model")
- else:
- layout.prop(scene, "distance_model", text="")
- layout.prop(scene, "speed_of_sound", text="Speed")
- layout.prop(scene, "doppler_factor")
+ layout.prop(scene, "audio_distance_model")
+
+ layout.prop(scene, "audio_doppler_speed", text="Speed")
+ layout.prop(scene, "audio_doppler_factor")
-class WorldButtonsPanel(bpy.types.Panel):
+class WorldButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "world"
- def poll(self, context):
- scene = context.scene
- return (scene.render.engine == 'BLENDER_GAME') and (scene.world is not None)
-
-class WORLD_PT_game_context_world(WorldButtonsPanel):
+class WORLD_PT_game_context_world(WorldButtonsPanel, bpy.types.Panel):
bl_label = ""
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
+ COMPAT_ENGINES = {'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
return (context.scene) and (rd.use_game_engine)
@@ -407,73 +382,79 @@ class WORLD_PT_game_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:
- if scene:
- layout.template_ID(scene, "world", new="world.new")
- elif world:
- layout.template_ID(space, "pin_id")
+
+ 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_game_world(WorldButtonsPanel):
+class WORLD_PT_game_world(WorldButtonsPanel, bpy.types.Panel):
bl_label = "World"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ scene = context.scene
+ return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
world = context.world
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(world, "horizon_color")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(world, "ambient_color")
-class WORLD_PT_game_mist(WorldButtonsPanel):
+class WORLD_PT_game_mist(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Mist"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ scene = context.scene
+ return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
world = context.world
- self.layout.prop(world.mist, "enabled", text="")
+ self.layout.prop(world.mist_settings, "use_mist", text="")
def draw(self, context):
layout = self.layout
world = context.world
- wide_ui = context.region.width > narrowui
- layout.active = world.mist.enabled
+ layout.active = world.mist_settings.use_mist
split = layout.split()
col = split.column()
- col.prop(world.mist, "start")
+ col.prop(world.mist_settings, "start")
- if wide_ui:
- col = split.column()
- col.prop(world.mist, "depth")
+ col = split.column()
+ col.prop(world.mist_settings, "depth")
-class WORLD_PT_game_physics(WorldButtonsPanel):
+class WORLD_PT_game_physics(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Physics"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ scene = context.scene
+ return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
- gs = context.scene.game_data
- wide_ui = context.region.width > narrowui
+ gs = context.scene.game_settings
layout.prop(gs, "physics_engine")
if gs.physics_engine != 'NONE':
@@ -488,8 +469,7 @@ class WORLD_PT_game_physics(WorldButtonsPanel):
sub.prop(gs, "physics_step_sub", text="Substeps")
col.prop(gs, "fps", text="FPS")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Logic Steps:")
col.prop(gs, "logic_step_max", text="Max")
@@ -511,33 +491,12 @@ class WORLD_PT_game_physics(WorldButtonsPanel):
col.prop(gs, "logic_step_max", text="Max")
-classes = [
- PHYSICS_PT_game_physics,
- PHYSICS_PT_game_collision_bounds,
-
- RENDER_PT_game,
- RENDER_PT_game_player,
- RENDER_PT_game_stereo,
- RENDER_PT_game_shading,
- RENDER_PT_game_performance,
- RENDER_PT_game_sound,
-
- WORLD_PT_game_context_world,
- WORLD_PT_game_world,
- WORLD_PT_game_mist,
- WORLD_PT_game_physics]
-
-
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()