Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormano-wii <germano.costa@ig.com.br>2019-02-11 05:21:05 +0300
committermano-wii <germano.costa@ig.com.br>2019-02-11 05:21:05 +0300
commita5aec7f5a5558bf0c08b9c5a75eb4272f586dfa8 (patch)
tree86435a92c23b723dc5a90dba862bda7ecd6c98a8 /mesh_snap_utilities_line
parent62ce90ff1a32cfa7bc3bb750f1b20039146643fb (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')
-rw-r--r--mesh_snap_utilities_line/__init__.py9
-rw-r--r--mesh_snap_utilities_line/snap_context_l/__init__.py12
-rw-r--r--mesh_snap_utilities_line/widgets.py14
3 files changed, 14 insertions, 21 deletions
diff --git a/mesh_snap_utilities_line/__init__.py b/mesh_snap_utilities_line/__init__.py
index 40194f1d..604c1b15 100644
--- a/mesh_snap_utilities_line/__init__.py
+++ b/mesh_snap_utilities_line/__init__.py
@@ -22,7 +22,7 @@
bl_info = {
"name": "Snap_Utilities_Line",
"author": "Germano Cavalcante",
- "version": (5, 9, 2),
+ "version": (5, 9, 3),
"blender": (2, 80, 0),
"location": "View3D > TOOLS > Line Tool",
"description": "Extends Blender Snap controls",
@@ -154,10 +154,6 @@ classes = (
)
def register():
- from .snap_context_l import global_snap_context_init
- # This makes sure that the framebuffer is created in the correct context
- global_snap_context_init(None, None, None)
-
for cls in classes:
bpy.utils.register_class(cls)
@@ -165,9 +161,6 @@ def register():
def unregister():
- from .snap_context_l import global_snap_context_destroy
- global_snap_context_destroy()
-
unregister_snap_tools()
for cls in reversed(classes):
diff --git a/mesh_snap_utilities_line/snap_context_l/__init__.py b/mesh_snap_utilities_line/snap_context_l/__init__.py
index 739500e1..62a39bb3 100644
--- a/mesh_snap_utilities_line/snap_context_l/__init__.py
+++ b/mesh_snap_utilities_line/snap_context_l/__init__.py
@@ -548,7 +548,7 @@ class SnapContext():
self.freed = True
-def global_snap_context_init(depsgraph, region, space):
+def global_snap_context_get(depsgraph, region, space):
if _Internal.global_snap_context == None:
import atexit
@@ -558,15 +558,7 @@ def global_snap_context_init(depsgraph, region, space):
atexit.unregister(_Internal.snap_context_free)
atexit.register(_Internal.snap_context_free)
-
-def global_snap_context_get(depsgraph, region, space):
- if (depsgraph and region and space):
+ elif (depsgraph and region and space):
_Internal.global_snap_context.update_viewport_context(depsgraph, region, space, True)
return _Internal.global_snap_context
-
-
-def global_snap_context_destroy():
- if _Internal.global_snap_context != None:
- _Internal.global_snap_context.free()
- _Internal.global_snap_context = None
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