forked from bartvdbraak/blender
0eda51f2ea
- Make gettext stuff draw-time. so switching between languages can happens without restart now. - Added option to translate visible interface (menus, buttons, labels) and tooltips. Now it's possible to have english UI and localized tooltips. - Clean-up sources, do not use gettext stuff for things which can be collected with RNA. - Fix issues with windows 64bit and ru_RU locale on my desktop (it was codepage issue). - Added operator "Get Messages" which generates new text block with with all strings collected from RNA. - Changed script for updating blender.pot so now it appends messages collected from rna to automatically gathered messages. To update .pot you have to re-generate messages.txt using "Get Messages" operator and then run update_pot script. - Clean up old translation stuff which wasn't used and most probably wouldn't be used. - Return back "International Fonts" option, so if it's disabled, no gettext lookups happens on draw. - Merged read_homefile function back. No need in splitting it. TODO: - Custom fonts and font size. Current font isn't nice at least for russian locale, it's difficult to read it. - Put references to messages.txt so gettext can merge translation when name/description of some property changes.
603 lines
18 KiB
Python
603 lines
18 KiB
Python
# ##### 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.
|
|
#
|
|
# 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.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
#
|
|
# ##### END GPL LICENSE BLOCK #####
|
|
|
|
# <pep8 compliant>
|
|
import bpy
|
|
from bpy.types import Panel
|
|
from blf import gettext as _
|
|
|
|
class PhysicsButtonsPanel():
|
|
bl_space_type = 'PROPERTIES'
|
|
bl_region_type = 'WINDOW'
|
|
bl_context = "physics"
|
|
|
|
|
|
class PHYSICS_PT_game_physics(PhysicsButtonsPanel, 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
|
|
|
|
ob = context.active_object
|
|
game = ob.game
|
|
soft = ob.game.soft_body
|
|
|
|
layout.prop(game, "physics_type")
|
|
layout.separator()
|
|
|
|
#if game.physics_type == 'DYNAMIC':
|
|
if game.physics_type in {'DYNAMIC', 'RIGID_BODY'}:
|
|
split = layout.split()
|
|
|
|
col = split.column()
|
|
col.prop(game, "use_actor")
|
|
col.prop(game, "use_ghost")
|
|
col.prop(ob, "hide_render", text=_("Invisible")) # out of place but useful
|
|
|
|
col = split.column()
|
|
col.prop(game, "use_material_physics_fh")
|
|
col.prop(game, "use_rotate_from_normal")
|
|
col.prop(game, "use_sleep")
|
|
|
|
layout.separator()
|
|
|
|
split = layout.split()
|
|
|
|
col = split.column()
|
|
col.label(text=_("Attributes:"))
|
|
col.prop(game, "mass")
|
|
col.prop(game, "radius")
|
|
col.prop(game, "form_factor")
|
|
|
|
col = split.column()
|
|
sub = col.column()
|
|
sub.prop(game, "use_anisotropic_friction")
|
|
subsub = sub.column()
|
|
subsub.active = game.use_anisotropic_friction
|
|
subsub.prop(game, "friction_coefficients", text="", slider=True)
|
|
|
|
split = layout.split()
|
|
|
|
col = split.column()
|
|
col.label(text=_("Velocity:"))
|
|
sub = col.column(align=True)
|
|
sub.prop(game, "velocity_min", text=_("Minimum"))
|
|
sub.prop(game, "velocity_max", text=_("Maximum"))
|
|
|
|
col = split.column()
|
|
col.label(text=_("Damping:"))
|
|
sub = col.column(align=True)
|
|
sub.prop(game, "damping", text=_("Translation"), slider=True)
|
|
sub.prop(game, "rotation_damping", text=_("Rotation"), slider=True)
|
|
|
|
layout.separator()
|
|
|
|
split = layout.split()
|
|
|
|
col = split.column()
|
|
col.label(text=_("Lock Translation:"))
|
|
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_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, "use_actor")
|
|
col.prop(game, "use_ghost")
|
|
col.prop(ob, "hide_render", text=_("Invisible"))
|
|
|
|
layout.separator()
|
|
|
|
split = layout.split()
|
|
|
|
col = split.column()
|
|
col.label(text=_("Attributes:"))
|
|
col.prop(game, "mass")
|
|
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, "collision_margin", slider=True)
|
|
col.prop(soft, "use_bending_constraints", text=_("Bending Constraints"))
|
|
|
|
col = split.column()
|
|
col.prop(soft, "use_shape_match")
|
|
sub = col.column()
|
|
sub.active = soft.use_shape_match
|
|
sub.prop(soft, "shape_threshold", slider=True)
|
|
|
|
col.separator()
|
|
|
|
col.label(text=_("Cluster Collision:"))
|
|
col.prop(soft, "use_cluster_rigid_to_softbody")
|
|
col.prop(soft, "use_cluster_soft_to_softbody")
|
|
sub = col.column()
|
|
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, "use_actor")
|
|
col.prop(game, "use_ghost")
|
|
col.prop(ob, "hide_render", text=_("Invisible"))
|
|
|
|
layout.separator()
|
|
|
|
split = layout.split()
|
|
|
|
col = split.column()
|
|
col.label(text=_("Attributes:"))
|
|
col.prop(game, "radius")
|
|
|
|
col = split.column()
|
|
sub = col.column()
|
|
sub.prop(game, "use_anisotropic_friction")
|
|
subsub = sub.column()
|
|
subsub.active = game.use_anisotropic_friction
|
|
subsub.prop(game, "friction_coefficients", text="", slider=True)
|
|
|
|
elif game.physics_type in {'SENSOR', 'INVISIBLE', 'NO_COLLISION', 'OCCLUDE'}:
|
|
layout.prop(ob, "hide_render", text=_("Invisible"))
|
|
|
|
|
|
class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, Panel):
|
|
bl_label = "Collision Bounds"
|
|
COMPAT_ENGINES = {'BLENDER_GAME'}
|
|
|
|
@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 in cls.COMPAT_ENGINES)
|
|
|
|
def draw_header(self, context):
|
|
game = context.active_object.game
|
|
|
|
self.layout.prop(game, "use_collision_bounds", text="")
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
game = context.active_object.game
|
|
|
|
layout.active = game.use_collision_bounds
|
|
layout.prop(game, "collision_bounds_type", text=_("Bounds"))
|
|
|
|
row = layout.row()
|
|
row.prop(game, "collision_margin", text=_("Margin"), slider=True)
|
|
row.prop(game, "use_collision_compound", text=_("Compound"))
|
|
|
|
|
|
class PHYSICS_PT_game_obstacles(PhysicsButtonsPanel, Panel):
|
|
bl_label = "Create Obstacle"
|
|
COMPAT_ENGINES = {'BLENDER_GAME'}
|
|
|
|
@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 in cls.COMPAT_ENGINES)
|
|
|
|
def draw_header(self, context):
|
|
game = context.active_object.game
|
|
|
|
self.layout.prop(game, "create_obstacle", text="")
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
game = context.active_object.game
|
|
|
|
layout.active = game.create_obstacle
|
|
|
|
row = layout.row()
|
|
row.prop(game, "obstacle_radius", text="Radius")
|
|
row.label()
|
|
|
|
|
|
class RenderButtonsPanel():
|
|
bl_space_type = 'PROPERTIES'
|
|
bl_region_type = 'WINDOW'
|
|
bl_context = "render"
|
|
|
|
@classmethod
|
|
def poll(cls, context):
|
|
rd = context.scene.render
|
|
return (rd.engine in cls.COMPAT_ENGINES)
|
|
|
|
|
|
class RENDER_PT_game(RenderButtonsPanel, Panel):
|
|
bl_label = "Game"
|
|
COMPAT_ENGINES = {'BLENDER_GAME'}
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
row = layout.row()
|
|
row.operator("view3d.game_start", text=_("Start"))
|
|
row.label()
|
|
|
|
|
|
class RENDER_PT_game_player(RenderButtonsPanel, Panel):
|
|
bl_label = "Standalone Player"
|
|
COMPAT_ENGINES = {'BLENDER_GAME'}
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
gs = context.scene.game_settings
|
|
|
|
layout.prop(gs, "show_fullscreen")
|
|
|
|
split = layout.split()
|
|
|
|
col = split.column()
|
|
col.label(text=_("Resolution:"))
|
|
sub = col.column(align=True)
|
|
sub.prop(gs, "resolution_x", slider=False, text="X")
|
|
sub.prop(gs, "resolution_y", slider=False, text="Y")
|
|
|
|
col = split.column()
|
|
col.label(text=_("Quality:"))
|
|
sub = col.column(align=True)
|
|
sub.prop(gs, "depth", text=_("Bit Depth"), slider=False)
|
|
sub.prop(gs, "frequency", text=_("FPS"), slider=False)
|
|
|
|
# framing:
|
|
col = layout.column()
|
|
col.label(text=_("Framing:"))
|
|
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, Panel):
|
|
bl_label = "Stereo"
|
|
COMPAT_ENGINES = {'BLENDER_GAME'}
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
gs = context.scene.game_settings
|
|
stereo_mode = gs.stereo
|
|
|
|
# stereo options:
|
|
layout.prop(gs, "stereo", expand=True)
|
|
|
|
# stereo:
|
|
if stereo_mode == 'STEREO':
|
|
layout.prop(gs, "stereo_mode")
|
|
layout.prop(gs, "stereo_eye_separation")
|
|
|
|
# dome:
|
|
elif stereo_mode == 'DOME':
|
|
layout.prop(gs, "dome_mode", text=_("Dome Type"))
|
|
|
|
dome_type = gs.dome_mode
|
|
|
|
split = layout.split()
|
|
|
|
if dome_type == 'FISHEYE' or \
|
|
dome_type == 'TRUNCATED_REAR' or \
|
|
dome_type == 'TRUNCATED_FRONT':
|
|
|
|
col = split.column()
|
|
col.prop(gs, "dome_buffer_resolution", text=_("Resolution"), slider=True)
|
|
col.prop(gs, "dome_angle", slider=True)
|
|
|
|
col = split.column()
|
|
col.prop(gs, "dome_tesselation", text=_("Tesselation"))
|
|
col.prop(gs, "dome_tilt")
|
|
|
|
elif dome_type == 'PANORAM_SPH':
|
|
col = split.column()
|
|
|
|
col.prop(gs, "dome_buffer_resolution", text=_("Resolution"), slider=True)
|
|
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)
|
|
|
|
col = split.column()
|
|
|
|
layout.prop(gs, "dome_text")
|
|
|
|
|
|
class RENDER_PT_game_shading(RenderButtonsPanel, Panel):
|
|
bl_label = "Shading"
|
|
COMPAT_ENGINES = {'BLENDER_GAME'}
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
gs = context.scene.game_settings
|
|
|
|
layout.prop(gs, "material_mode", expand=True)
|
|
|
|
if gs.material_mode == 'GLSL':
|
|
split = layout.split()
|
|
|
|
col = split.column()
|
|
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.prop(gs, "use_glsl_color_management", text=_("Color Management"))
|
|
|
|
col = split.column()
|
|
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, Panel):
|
|
bl_label = "Performance"
|
|
COMPAT_ENGINES = {'BLENDER_GAME'}
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
gs = context.scene.game_settings
|
|
col = layout.column()
|
|
row = col.row()
|
|
row.prop(gs, "use_frame_rate")
|
|
row.prop(gs, "use_display_lists")
|
|
|
|
col.prop(gs, "restrict_animation_updates")
|
|
|
|
|
|
class RENDER_PT_game_display(RenderButtonsPanel, Panel):
|
|
bl_label = "Display"
|
|
COMPAT_ENGINES = {'BLENDER_GAME'}
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
gs = context.scene.game_settings
|
|
flow = layout.column_flow()
|
|
flow.prop(gs, "show_debug_properties", text=_("Debug Properties"))
|
|
flow.prop(gs, "show_framerate_profile", text=_("Framerate and Profile"))
|
|
flow.prop(gs, "show_physics_visualization", text=_("Physics Visualization"))
|
|
flow.prop(gs, "use_deprecation_warnings")
|
|
flow.prop(gs, "show_mouse", text=_("Mouse Cursor"))
|
|
|
|
|
|
class SceneButtonsPanel():
|
|
bl_space_type = 'PROPERTIES'
|
|
bl_region_type = 'WINDOW'
|
|
bl_context = "scene"
|
|
|
|
|
|
class SCENE_PT_game_navmesh(SceneButtonsPanel, bpy.types.Panel):
|
|
bl_label = "Navigation mesh"
|
|
bl_default_closed = True
|
|
COMPAT_ENGINES = {'BLENDER_GAME'}
|
|
|
|
@classmethod
|
|
def poll(cls, context):
|
|
scene = context.scene
|
|
return (scene and scene.render.engine in cls.COMPAT_ENGINES)
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
rd = context.scene.game_settings.recast_data
|
|
|
|
layout.operator("object.create_navmesh", text='Build navigation mesh')
|
|
|
|
col = layout.column()
|
|
col.label(text="Rasterization:")
|
|
row = col.row()
|
|
row.prop(rd, "cell_size")
|
|
row.prop(rd, "cell_height")
|
|
|
|
col = layout.column()
|
|
col.label(text="Agent:")
|
|
split = col.split()
|
|
|
|
col = split.column()
|
|
col.prop(rd, "agent_height", text="Height")
|
|
col.prop(rd, "agent_radius", text="Radius")
|
|
|
|
col = split.column()
|
|
col.prop(rd, "max_slope")
|
|
col.prop(rd, "max_climb")
|
|
|
|
col = layout.column()
|
|
col.label(text="Region:")
|
|
row = col.row()
|
|
row.prop(rd, "region_min_size")
|
|
row.prop(rd, "region_merge_size")
|
|
|
|
col = layout.column()
|
|
col.label(text="Polygonization:")
|
|
split = col.split()
|
|
|
|
col = split.column()
|
|
col.prop(rd, "edge_max_len")
|
|
col.prop(rd, "edge_max_error")
|
|
|
|
split.prop(rd, "verts_per_poly")
|
|
|
|
col = layout.column()
|
|
col.label(text="Detail Mesh:")
|
|
row = col.row()
|
|
row.prop(rd, "sample_dist")
|
|
row.prop(rd, "sample_max_error")
|
|
|
|
|
|
class WorldButtonsPanel():
|
|
bl_space_type = 'PROPERTIES'
|
|
bl_region_type = 'WINDOW'
|
|
bl_context = "world"
|
|
|
|
|
|
class WORLD_PT_game_context_world(WorldButtonsPanel, Panel):
|
|
bl_label = ""
|
|
bl_options = {'HIDE_HEADER'}
|
|
COMPAT_ENGINES = {'BLENDER_GAME'}
|
|
|
|
@classmethod
|
|
def poll(cls, context):
|
|
rd = context.scene.render
|
|
return (context.scene) and (rd.use_game_engine)
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
scene = context.scene
|
|
world = context.world
|
|
space = context.space_data
|
|
|
|
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, 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
|
|
|
|
row = layout.row()
|
|
row.column().prop(world, "horizon_color")
|
|
row.column().prop(world, "ambient_color")
|
|
|
|
|
|
class WORLD_PT_game_mist(WorldButtonsPanel, 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_settings, "use_mist", text="")
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
world = context.world
|
|
|
|
layout.active = world.mist_settings.use_mist
|
|
|
|
row = layout.row()
|
|
row.prop(world.mist_settings, "start")
|
|
row.prop(world.mist_settings, "depth")
|
|
|
|
|
|
class WORLD_PT_game_physics(WorldButtonsPanel, 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_settings
|
|
|
|
layout.prop(gs, "physics_engine")
|
|
if gs.physics_engine != 'NONE':
|
|
layout.prop(gs, "physics_gravity", text=_("Gravity"))
|
|
|
|
split = layout.split()
|
|
|
|
col = split.column()
|
|
col.label(text=_("Physics Steps:"))
|
|
sub = col.column(align=True)
|
|
sub.prop(gs, "physics_step_max", text=_("Max"))
|
|
sub.prop(gs, "physics_step_sub", text=_("Substeps"))
|
|
col.prop(gs, "fps", text=_("FPS"))
|
|
|
|
col = split.column()
|
|
col.label(text=_("Logic Steps:"))
|
|
col.prop(gs, "logic_step_max", text=_("Max"))
|
|
|
|
col = layout.column()
|
|
col.prop(gs, "use_occlusion_culling", text=_("Occlusion Culling"))
|
|
sub = col.column()
|
|
sub.active = gs.use_occlusion_culling
|
|
sub.prop(gs, "occlusion_culling_resolution", text=_("Resolution"))
|
|
|
|
else:
|
|
split = layout.split()
|
|
|
|
col = split.column()
|
|
col.label(text=_("Physics Steps:"))
|
|
col.prop(gs, "fps", text=_("FPS"))
|
|
|
|
col = split.column()
|
|
col.label(text=_("Logic Steps:"))
|
|
col.prop(gs, "logic_step_max", text=_("Max"))
|
|
|
|
|
|
class WORLD_PT_game_physics_obstacles(WorldButtonsPanel, Panel):
|
|
bl_label = "Obstacle simulation"
|
|
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_settings
|
|
|
|
layout.prop(gs, "obstacle_simulation", text="Type")
|
|
if gs.obstacle_simulation != 'NONE':
|
|
layout.prop(gs, "level_height")
|
|
layout.prop(gs, "show_obstacle_simulation")
|
|
|
|
if __name__ == "__main__": # only for live edit.
|
|
bpy.utils.register_module(__name__)
|