Skip to content

Commit

Permalink
fix: configurable display of names on gizmos
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeCrassous committed Feb 10, 2021
1 parent 3155c91 commit 42f7eb5
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@

- MovieClip: synchronization
- TextCurve: synchronization (with builtin VectorFont only)
- Mixer panel: simplify and make Gizmos settings more accessible
- UI: can disable display of peer names on selection boxes in Mixer Gizmos preferences

## Fixes

- Libraries: synchronization error after using "duplicate linked" on an Object from a library
- UI: selection box displayed with offset for instances of collections with instance_offset

## Breaking changes

Expand Down
29 changes: 21 additions & 8 deletions mixer/bl_panels.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,16 @@ def draw_developer_settings_ui(layout: bpy.types.UILayout):
layout.prop(mixer_prefs, "send_base_meshes", text="Send Base Meshes")
layout.prop(mixer_prefs, "send_baked_meshes", text="Send Baked Meshes")
layout.prop(mixer_prefs, "commands_send_interval")
layout.prop(mixer_prefs, "display_own_gizmos")
layout.prop(mixer_prefs, "display_ids_gizmos")

box = layout.box().column()
box.label(text="Gizmos")
box.prop(mixer_prefs, "display_own_gizmos")
box.prop(mixer_prefs, "display_frustums_gizmos")
box.prop(mixer_prefs, "display_names_gizmos")
box.prop(mixer_prefs, "display_ids_gizmos")
box.prop(mixer_prefs, "display_selections_gizmos")

def draw_gizmos_settings_ui(layout: bpy.types.UILayout):
mixer_prefs = get_mixer_prefs()
layout.prop(mixer_prefs, "display_frustums_gizmos")
layout.prop(mixer_prefs, "display_frustums_names_gizmos")
layout.prop(mixer_prefs, "display_selections_gizmos")
layout.prop(mixer_prefs, "display_selections_names_gizmos")


def draw_preferences_ui(mixer_prefs: MixerPreferences, context: bpy.types.Context):
Expand All @@ -268,6 +270,10 @@ def draw_preferences_ui(mixer_prefs: MixerPreferences, context: bpy.types.Contex
layout.label(text="Room Settings")
layout.prop(mixer_prefs, "room", text="Default Room Name")

layout = mixer_prefs.layout.box().column()
layout.label(text="Gizmos")
draw_gizmos_settings_ui(layout)

layout = mixer_prefs.layout.box().column()
layout.label(text="Advanced Settings")
draw_advanced_settings_ui(layout)
Expand Down Expand Up @@ -393,8 +399,9 @@ def draw(self, context):
self.draw_users(layout)

self.draw_shared_folders_options(layout)
if self.connected():
self.draw_gizmos_options(layout)
self.draw_advanced_options(layout)
self.draw_developer_options(layout)

def draw_rooms(self, layout):
mixer_props = get_mixer_props()
Expand Down Expand Up @@ -428,6 +435,12 @@ def draw_shared_folders_options(self, layout):
if mixer_props.display_shared_folders_options:
draw_shared_folders_settings_ui(layout.box().column())

def draw_gizmos_options(self, layout):
mixer_props = get_mixer_props()
collapsable_panel(layout, mixer_props, "display_gizmos_options", text="Gizmos")
if mixer_props.display_gizmos_options:
draw_gizmos_settings_ui(layout.box().column())

def draw_advanced_options(self, layout):
mixer_props = get_mixer_props()
collapsable_panel(layout, mixer_props, "display_advanced_options", text="Advanced Options")
Expand Down
6 changes: 4 additions & 2 deletions mixer/bl_preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,12 @@ def get_log_level(self):
send_baked_meshes: bpy.props.BoolProperty(default=True)

display_own_gizmos: bpy.props.BoolProperty(default=False, name="Display Own Gizmos")
display_frustums_gizmos: bpy.props.BoolProperty(default=True, name="Display Frustums Gizmos")
display_names_gizmos: bpy.props.BoolProperty(default=True, name="Display Name Gizmos")
display_ids_gizmos: bpy.props.BoolProperty(default=False, name="Display ID Gizmos")

display_frustums_gizmos: bpy.props.BoolProperty(default=True, name="Display Frustums Gizmos")
display_frustums_names_gizmos: bpy.props.BoolProperty(default=True, name="Display Frustums User Names")
display_selections_gizmos: bpy.props.BoolProperty(default=True, name="Display Selection Gizmos")
display_selections_names_gizmos: bpy.props.BoolProperty(default=True, name="Display Selection User Names")

commands_send_interval: bpy.props.FloatProperty(
name="Command Send Interval",
Expand Down
1 change: 1 addition & 0 deletions mixer/bl_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class MixerProperties(bpy.types.PropertyGroup):
user_index: bpy.props.IntProperty() # index in the list of users

display_shared_folders_options: bpy.props.BoolProperty(default=True)
display_gizmos_options: bpy.props.BoolProperty(default=True)
display_advanced_options: bpy.props.BoolProperty(default=False)
display_developer_options: bpy.props.BoolProperty(default=False)
display_rooms: bpy.props.BoolProperty(default=True)
Expand Down
12 changes: 10 additions & 2 deletions mixer/draw_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ def per_frustum_callback(user_dict, frustum):
def users_frustum_name_draw():
prefs = get_mixer_prefs()

if not prefs.display_names_gizmos or share_data.client.current_room is None:
if (
not prefs.display_frustums_gizmos
or not prefs.display_frustums_names_gizmos
or share_data.client.current_room is None
):
return

def per_user_callback(user_dict):
Expand Down Expand Up @@ -243,7 +247,11 @@ def per_object_callback(user_dict, object, matrix, local_bbox):
def users_selection_name_draw():
prefs = get_mixer_prefs()

if not prefs.display_names_gizmos or share_data.client.current_room is None:
if (
not prefs.display_selections_gizmos
or not prefs.display_selections_names_gizmos
or share_data.client.current_room is None
):
return

def per_user_callback(user_dict):
Expand Down

0 comments on commit 42f7eb5

Please sign in to comment.