diff options
author | mano-wii <germano.costa@ig.com.br> | 2019-02-11 05:21:05 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2019-02-11 05:21:05 +0300 |
commit | a5aec7f5a5558bf0c08b9c5a75eb4272f586dfa8 (patch) | |
tree | 86435a92c23b723dc5a90dba862bda7ecd6c98a8 /mesh_snap_utilities_line/widgets.py | |
parent | 62ce90ff1a32cfa7bc3bb750f1b20039146643fb (diff) |
mesh_snap_utilities_line: New solution for creating framebuffer out of the right rendering context
The way was to delay the initialization of the framebuffer for the test_select method.
(This rendering context issue gives a lot of headache)!
Diffstat (limited to 'mesh_snap_utilities_line/widgets.py')
-rw-r--r-- | mesh_snap_utilities_line/widgets.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/mesh_snap_utilities_line/widgets.py b/mesh_snap_utilities_line/widgets.py index 92256f81..2849075c 100644 --- a/mesh_snap_utilities_line/widgets.py +++ b/mesh_snap_utilities_line/widgets.py @@ -53,7 +53,12 @@ class SnapWidgetCommon(SnapUtilities): self.draw_cache.draw(self.type, self.location, None, None, None) + def init_delayed(self): + self.inited = False + def init_snapwidget(self, context, snap_edge_and_vert = True): + self.inited = True + self.snap_context_init(context, snap_edge_and_vert) self.snap_context_update(context) self.mode = context.mode @@ -118,6 +123,9 @@ class SnapPointWidget(SnapWidgetCommon, bpy.types.Gizmo): bl_idname = "VIEW3D_GT_snap_point" def test_select(self, context, mval): + if not self.inited: + self.init_snapwidget(context) + self.update_snap(context, mval) self.snap_to_grid() @@ -125,11 +133,11 @@ class SnapPointWidget(SnapWidgetCommon, bpy.types.Gizmo): return -1 def draw(self, context): - self.draw_point_and_elem() + if self.inited: + self.draw_point_and_elem() def setup(self): - self.init_snapwidget(bpy.context) - + self.init_delayed() def context_mode_check(context, widget_group): workspace = context.workspace |