[Bf-extensions-cvs] [928d6a2e] master: Collection Manager: Update tooltips. Task: T69577
Ryan Inch
noreply at git.blender.org
Fri Mar 27 04:31:39 CET 2020
Commit: 928d6a2e0a68b1ff93928bf0efdac560fb4ce2f2
Author: Ryan Inch
Date: Thu Mar 26 23:28:02 2020 -0400
Branches: master
https://developer.blender.org/rBA928d6a2e0a68b1ff93928bf0efdac560fb4ce2f2
Collection Manager: Update tooltips. Task: T69577
Make tooltips for QCD slots show the slot number and its
collection's name in both the OpenGL widget and
the 3D View header widget.
===================================================================
M object_collection_manager/__init__.py
M object_collection_manager/qcd_move_widget.py
M object_collection_manager/qcd_operators.py
===================================================================
diff --git a/object_collection_manager/__init__.py b/object_collection_manager/__init__.py
index f273af7b..b272b917 100644
--- a/object_collection_manager/__init__.py
+++ b/object_collection_manager/__init__.py
@@ -22,7 +22,7 @@ bl_info = {
"name": "Collection Manager",
"description": "Manage collections and their objects",
"author": "Ryan Inch",
- "version": (2,4,3),
+ "version": (2,4,4),
"blender": (2, 80, 0),
"location": "View3D - Object Mode (Shortcut - M)",
"warning": '', # used for warning icon and text in addons panel
diff --git a/object_collection_manager/qcd_move_widget.py b/object_collection_manager/qcd_move_widget.py
index c787db67..441c39de 100644
--- a/object_collection_manager/qcd_move_widget.py
+++ b/object_collection_manager/qcd_move_widget.py
@@ -774,12 +774,13 @@ def draw_callback_px(self, context):
shader.bind()
in_tooltip_area = False
+ tooltip_slot_idx = None
for num in range(20):
slot_num = num + 1
- qcd_slot = qcd_slots.get_name(f"{slot_num}")
- if qcd_slot:
- qcd_laycol = layer_collections[qcd_slot]["ptr"]
+ qcd_slot_name = qcd_slots.get_name(f"{slot_num}")
+ if qcd_slot_name:
+ qcd_laycol = layer_collections[qcd_slot_name]["ptr"]
collection_objects = qcd_laycol.collection.objects
selected_objects = qcd_operators.get_move_selection()
active_object = qcd_operators.get_move_active()
@@ -794,6 +795,7 @@ def draw_callback_px(self, context):
if mouse_in_area(self.mouse_pos, button_area):
in_tooltip_area = True
+ tooltip_slot_idx = slot_num
mod = 0.1
@@ -908,7 +910,12 @@ def draw_callback_px(self, context):
if in_tooltip_area:
if self.draw_tooltip:
- draw_tooltip(self, context, shader,"Move Object To QCD Slot\n * Shift-Click to toggle objects\' slot")
+ slot_name = qcd_slots.get_name(f"{tooltip_slot_idx}")
+ slot_string = f"QCD Slot {tooltip_slot_idx}: \"{slot_name}\"\n"
+ hotkey_string = " * Shift-Click to toggle objects\' slot."
+
+ draw_tooltip(self, context, shader, f"{slot_string}{hotkey_string}")
+
self.hover_time = None
else:
@@ -930,8 +937,10 @@ def draw_tooltip(self, context, shader, message):
num_lines = len(lines)
for line in lines:
- if len(line) > longest[0]:
- longest[0] = len(line)
+ w, _ = blf.dimensions(font_id, line)
+
+ if w > longest[0]:
+ longest[0] = w
longest[1] = line
w, h = blf.dimensions(font_id, longest[1])
diff --git a/object_collection_manager/qcd_operators.py b/object_collection_manager/qcd_operators.py
index ea4187ec..2b45c1de 100644
--- a/object_collection_manager/qcd_operators.py
+++ b/object_collection_manager/qcd_operators.py
@@ -154,13 +154,28 @@ class MoveToQCDSlot(Operator):
class ViewMoveQCDSlot(Operator):
- ''' * Shift-Click to toggle QCD slots\n * Ctrl-Click to move objects to QCD slot\n * Ctrl-Shift-Click to toggle objects\' slot'''
- bl_label = "View QCD Slot"
+ bl_label = ""
bl_idname = "view3d.view_move_qcd_slot"
bl_options = {'REGISTER', 'UNDO'}
slot: StringProperty()
+ @classmethod
+ def description(cls, context, properties):
+ global qcd_slots
+
+ slot_name = qcd_slots.get_name(properties.slot)
+
+ slot_string = f"QCD Slot {properties.slot}: \"{slot_name}\"\n"
+
+ hotkey_string = (
+ " * Shift-Click to toggle QCD slot.\n"
+ " * Ctrl-Click to move objects to QCD slot.\n"
+ " * Ctrl-Shift-Click to toggle objects' slot"
+ )
+
+ return f"{slot_string}{hotkey_string}"
+
def invoke(self, context, event):
global layer_collections
global qcd_history
More information about the Bf-extensions-cvs
mailing list