From 2303d32c29aaed11a5d2152d6c8caedd53f71a51 Mon Sep 17 00:00:00 2001 From: ChristopheSeux Date: Sun, 24 Apr 2022 08:55:35 +0200 Subject: [PATCH] tooltip for operator --- picker.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/picker.py b/picker.py index 46cdf3c..f540613 100644 --- a/picker.py +++ b/picker.py @@ -254,9 +254,9 @@ class BoneShape(Shape): border_tri2 = border[2], border[3], border[0] if (not intersect_tri_tri_2d(*border_tri1, *bound_tri1) and - not intersect_tri_tri_2d(*border_tri1, *border_tri2) and - not intersect_tri_tri_2d(*border_tri2, *border_tri2) and - not intersect_tri_tri_2d(*border_tri2, *border_tri2)): + not intersect_tri_tri_2d(*border_tri1, *bound_tri2) and + not intersect_tri_tri_2d(*border_tri2, *bound_tri1) and + not intersect_tri_tri_2d(*border_tri2, *bound_tri2)): return select = True @@ -297,6 +297,9 @@ class OperatorShape(Shape): #self.arguments = arguments#{k:eval(v)} #self.operator = get_operator_from_id(self.operator) + if not tooltip: + self.tooltip = self.operator.replace('bpy.ops.', '').replace("'INVOKE_DEFAULT', ", '') + #self.reg_args = re.compile(r'(\w+)=') ''' def parse_args(self): @@ -421,12 +424,14 @@ class Picker: def tooltip_event(self): - print('Tooltip Event', self) + #print('Tooltip Event', self) - if self.hover_shape: + if self.hover_shape and self.hover_shape.type != 'display': if self.hover_shape.type == 'bone': self.tooltip = self.hover_shape.bone.name - self.tooltip_shape = self.hover_shape + else: + self.tooltip = self.hover_shape.tooltip + self.tooltip_shape = self.hover_shape else: self.tooltip = '' self.tooltip_shape = None