Skip to content

Commit

Permalink
UPBGE: Cleanup UI. (#772)
Browse files Browse the repository at this point in the history
Some unused options/entities are removed from the UI in game engine mode:
- scene keying set
- speaker and force field in add menu

The game engine is renamed UPBGE and the audio panel under scene tab is siplified
to expose only the speed of sound, doppler factor and the distance model, these
attributes are used by LA_Launcher to initialize the AUD_Device.

Fix issue #756.
  • Loading branch information
panzergame authored Sep 1, 2018
1 parent fa68fed commit 6065fbd
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 8 deletions.
25 changes: 25 additions & 0 deletions release/scripts/startup/bl_ui/properties_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,30 @@ def draw(self, context):
row.prop(gs, "python_console_key4", text="", event=True)


class SCENE_PT_game_audio(SceneButtonsPanel, Panel):
bl_label = "Audio"
bl_options = {'DEFAULT_CLOSED'}
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

scene = context.scene

split = layout.split()

col = layout.column()
col.prop(scene, "audio_distance_model", text="Distance Model")
col = layout.column(align=True)
col.prop(scene, "audio_doppler_speed", text="Speed")
col.prop(scene, "audio_doppler_factor", text="Doppler")


class WorldButtonsPanel:
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
Expand Down Expand Up @@ -1034,6 +1058,7 @@ def draw(self, context):
SCENE_PT_game_navmesh,
SCENE_PT_game_hysteresis,
SCENE_PT_game_console,
SCENE_PT_game_audio,
WORLD_PT_game_context_world,
WORLD_PT_game_world,
WORLD_PT_game_environment_lighting,
Expand Down
6 changes: 3 additions & 3 deletions release/scripts/startup/bl_ui/properties_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def _draw_keyframing_setting(context, layout, ks, ksp, label, toggle_prop, prop,

class SCENE_PT_keying_sets(SceneButtonsPanel, SceneKeyingSetsPanel, Panel):
bl_label = "Keying Sets"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
COMPAT_ENGINES = {'BLENDER_RENDER'}

def draw(self, context):
layout = self.layout
Expand Down Expand Up @@ -200,7 +200,7 @@ def draw(self, context):

class SCENE_PT_keying_set_paths(SceneButtonsPanel, SceneKeyingSetsPanel, Panel):
bl_label = "Active Keying Set"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
COMPAT_ENGINES = {'BLENDER_RENDER'}

@classmethod
def poll(cls, context):
Expand Down Expand Up @@ -282,7 +282,7 @@ def draw(self, context):
class SCENE_PT_audio(SceneButtonsPanel, Panel):
bl_label = "Audio"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
COMPAT_ENGINES = {'BLENDER_RENDER'}

def draw(self, context):
layout = self.layout
Expand Down
12 changes: 8 additions & 4 deletions release/scripts/startup/bl_ui/space_view3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,7 @@ class INFO_MT_add(Menu):
bl_label = "Add"

def draw(self, context):
rd = context.scene.render.engine
layout = self.layout

# note, don't use 'EXEC_SCREEN' or operators wont get the 'v3d' context.
Expand All @@ -1316,8 +1317,9 @@ def draw(self, context):
layout.operator_menu_enum("object.empty_add", "type", text="Empty", icon='OUTLINER_OB_EMPTY')
layout.separator()

layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')
layout.separator()
if rd != "BLENDER_GAME":
layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')
layout.separator()

if INFO_MT_camera_add.is_extended():
layout.menu("INFO_MT_camera_add", icon='OUTLINER_OB_CAMERA')
Expand All @@ -1327,8 +1329,10 @@ def draw(self, context):
layout.menu("INFO_MT_lamp_add", icon='OUTLINER_OB_LAMP')
layout.separator()

layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_FORCE_FIELD')
layout.separator()
print(rd)
if rd != "BLENDER_GAME":
layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_FORCE_FIELD')
layout.separator()

if len(bpy.data.groups) > 10:
layout.operator_context = 'INVOKE_REGION_WIN'
Expand Down
2 changes: 1 addition & 1 deletion source/blender/render/intern/source/external_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static RenderEngineType internal_render_type = {

static RenderEngineType internal_game_type = {
NULL, NULL,
"BLENDER_GAME", N_("Blender Game"), RE_INTERNAL | RE_GAME,
"BLENDER_GAME", N_("UPBGE"), RE_INTERNAL | RE_GAME,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
{NULL, NULL, NULL}
};
Expand Down

0 comments on commit 6065fbd

Please sign in to comment.