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-04-26 00:44:37 +0300
committermano-wii <germano.costa@ig.com.br>2019-04-26 00:44:37 +0300
commitd140d94badebe22122ba90afee700b5a45035193 (patch)
tree69c07d54c11ada518e6ad7f38515a5470d64dd2b /mesh_snap_utilities_line
parent7f1ac1abfa5d35973c17300972be7dba8bffd6ab (diff)
mesh_snap_utilities_line: match blender 2.8 updates
Diffstat (limited to 'mesh_snap_utilities_line')
-rw-r--r--mesh_snap_utilities_line/__init__.py4
-rw-r--r--mesh_snap_utilities_line/preferences.py134
-rw-r--r--mesh_snap_utilities_line/snap_context_l/__init__.py30
-rw-r--r--mesh_snap_utilities_line/widgets.py6
4 files changed, 125 insertions, 49 deletions
diff --git a/mesh_snap_utilities_line/__init__.py b/mesh_snap_utilities_line/__init__.py
index c3d26dd7..0092ebe6 100644
--- a/mesh_snap_utilities_line/__init__.py
+++ b/mesh_snap_utilities_line/__init__.py
@@ -22,11 +22,11 @@
bl_info = {
"name": "Snap_Utilities_Line",
"author": "Germano Cavalcante",
- "version": (5, 9, 9),
+ "version": (5, 9, 12),
"blender": (2, 80, 0),
"location": "View3D > TOOLS > Line Tool",
"description": "Extends Blender Snap controls",
- "wiki_url" : "http://blenderartists.org/forum/showthread.php?363859-Addon-CAD-Snap-Utilities",
+ "wiki_url" : "https://blenderartists.org/t/cad-snap-utilities",
"category": "Mesh"}
if "bpy" in locals():
diff --git a/mesh_snap_utilities_line/preferences.py b/mesh_snap_utilities_line/preferences.py
index 11b91dc4..be8199c1 100644
--- a/mesh_snap_utilities_line/preferences.py
+++ b/mesh_snap_utilities_line/preferences.py
@@ -37,56 +37,103 @@ class SnapUtilitiesPreferences(bpy.types.AddonPreferences):
bl_idname = __package__
intersect: BoolProperty(
- name="Intersect",
- description="intersects created line with the existing edges, even if the lines do not intersect",
- default=True)
+ name="Intersect",
+ description="intersects created line with the existing edges, even if the lines do not intersect",
+ default=True)
create_face: BoolProperty(
- name="Create faces",
- description="Create faces defined by enclosed edges",
- default=False)
+ name="Create faces",
+ description="Create faces defined by enclosed edges",
+ default=False)
outer_verts: BoolProperty(
- name="Snap to outer vertices",
- description="The vertices of the objects are not activated also snapped",
- default=True)
+ name="Snap to outer vertices",
+ description="The vertices of the objects are not activated also snapped",
+ default=True)
increments_grid: BoolProperty(
- name="Increments of Grid",
- description="Snap to increments of grid",
- default=False)
+ name="Increments of Grid",
+ description="Snap to increments of grid",
+ default=False)
incremental: FloatProperty(
- name="Incremental",
- description="Snap in defined increments",
- default=0,
- min=0,
- step=1,
- precision=3)
+ name="Incremental",
+ description="Snap in defined increments",
+ default=0,
+ min=0,
+ step=1,
+ precision=3)
relative_scale: FloatProperty(
- name="Relative Scale",
- description="Value that divides the global scale",
- default=1,
- min=0,
- step=1,
- precision=3)
-
- out_color: FloatVectorProperty(name="Floor", default=(0.0, 0.0, 0.0, 0.5), size=4, subtype="COLOR", min=0, max=1)
- face_color: FloatVectorProperty(name="Face Highlighted", default=(1.0, 0.8, 0.0, 0.5), size=4, subtype="COLOR", min=0, max=1)
- edge_color: FloatVectorProperty(name="Edge Highlighted", default=(0.0, 0.8, 1.0, 0.5), size=4, subtype="COLOR", min=0, max=1)
- vert_color: FloatVectorProperty(name="Vertex Highlighted", default=(1.0, 0.5, 0.0, 0.5), size=4, subtype="COLOR", min=0, max=1)
- center_color: FloatVectorProperty(name="Middle of the Edge", default=(1.0, 0.0, 1.0, 1.0), size=4, subtype="COLOR", min=0, max=1)
- perpendicular_color: FloatVectorProperty(name="Perpendicular Point", default=(0.1, 0.5, 0.5, 1.0), size=4, subtype="COLOR", min=0, max=1)
- constrain_shift_color: FloatVectorProperty(name="Shift Constrain", default=(0.8, 0.5, 0.4, 1.0), size=4, subtype="COLOR", min=0, max=1)
-
- # hidden
+ name="Relative Scale",
+ description="Value that divides the global scale",
+ default=1,
+ min=0,
+ step=1,
+ precision=3)
+
+ out_color: FloatVectorProperty(
+ name="Floor",
+ default=(0.0, 0.0, 0.0, 0.5),
+ size=4,
+ subtype="COLOR",
+ min=0,
+ max=1)
+
+ face_color: FloatVectorProperty(
+ name="Face Highlighted",
+ default=(1.0, 0.8, 0.0, 0.5),
+ size=4,
+ subtype="COLOR",
+ min=0,
+ max=1)
+
+ edge_color: FloatVectorProperty(
+ name="Edge Highlighted",
+ default=(0.0, 0.8, 1.0, 0.5),
+ size=4,
+ subtype="COLOR",
+ min=0,
+ max=1)
+
+ vert_color: FloatVectorProperty(
+ name="Vertex Highlighted",
+ default=(1.0, 0.5, 0.0, 0.5),
+ size=4, subtype="COLOR",
+ min=0,
+ max=1)
+
+ center_color: FloatVectorProperty(
+ name="Middle of the Edge",
+ default=(1.0, 0.0, 1.0, 1.0),
+ size=4,
+ subtype="COLOR",
+ min=0,
+ max=1)
+
+ perpendicular_color: FloatVectorProperty(
+ name="Perpendicular Point",
+ default=(0.1, 0.5, 0.5, 1.0),
+ size=4,
+ subtype="COLOR",
+ min=0,
+ max=1)
+
+ constrain_shift_color: FloatVectorProperty(
+ name="Shift Constrain",
+ default=(0.8, 0.5, 0.4, 1.0),
+ size=4,
+ subtype="COLOR",
+ min=0,
+ max=1)
+
tabs: EnumProperty(
name="Tabs",
items = [
("GENERAL", "General", ""),
("KEYMAPS", "Keymaps", ""),
("COLORS", "Colors", ""),
+ ("HELP", "Links", ""),
],
default="GENERAL")
@@ -102,12 +149,15 @@ class SnapUtilitiesPreferences(bpy.types.AddonPreferences):
if self.tabs == "GENERAL":
self.draw_general(box)
- if self.tabs == "COLORS":
+ elif self.tabs == "COLORS":
self.draw_snap_utilities_colors(box)
elif self.tabs == "KEYMAPS":
self.draw_snap_utilities_keymaps(context, box)
+ elif self.tabs == "HELP":
+ self.draw_snap_utilities_help(box)
+
def draw_general(self, layout):
row = layout.row()
col = row.column()
@@ -139,6 +189,20 @@ class SnapUtilitiesPreferences(bpy.types.AddonPreferences):
flow.prop(self, "center_color")
flow.prop(self, "perpendicular_color")
+ def draw_snap_utilities_help(self, layout):
+ layout.operator(
+ "wm.url_open", text="Download Page", icon='HELP',
+ ).url = "https://blendermarket.com/products/snap-utilities"
+
+ layout.operator(
+ "wm.url_open", text="Wiki", icon='HELP',
+ ).url = "https://github.com/Mano-Wii/Addon-Snap-Utilities-Line/wiki"
+
+ layout.operator(
+ "wm.url_open", text="Forum", icon='HELP',
+ ).url = "https://blenderartists.org/t/cad-snap-utilities"
+
+
def draw_snap_utilities_keymaps(self, context, layout):
from .keys import (
generate_snap_utilities_global_keymaps,
diff --git a/mesh_snap_utilities_line/snap_context_l/__init__.py b/mesh_snap_utilities_line/snap_context_l/__init__.py
index 7fa15215..aed904f6 100644
--- a/mesh_snap_utilities_line/snap_context_l/__init__.py
+++ b/mesh_snap_utilities_line/snap_context_l/__init__.py
@@ -118,7 +118,7 @@ class _SnapOffscreen():
bgl.glBindTexture(bgl.GL_TEXTURE_2D, self.buf_color[0])
bgl.glTexImage2D(
bgl.GL_TEXTURE_2D, 0, bgl.GL_R32UI, self.width, self.height,
- 0, bgl.GL_RED_INTEGER, bgl.GL_UNSIGNED_INT, NULL)
+ 0, bgl.GL_RED_INTEGER, bgl.GL_UNSIGNED_INT, None)
del NULL
bgl.glTexParameteri(bgl.GL_TEXTURE_2D, bgl.GL_TEXTURE_MIN_FILTER, bgl.GL_NEAREST)
@@ -266,6 +266,24 @@ class SnapContext():
return snap_obj
return None
+ def _read_buffer(self, mval):
+ xmin = int(mval[0]) - self._dist_px
+ ymin = int(mval[1]) - self._dist_px
+ size_x = size_y = self.threshold
+
+ if xmin < 0:
+ #size_x += xmin
+ xmin = 0
+
+ if ymin < 0:
+ #size_y += ymin
+ ymin = 0
+
+ bgl.glReadBuffer(bgl.GL_COLOR_ATTACHMENT0)
+ bgl.glReadPixels(
+ xmin, ymin, size_x, size_y,
+ bgl.GL_RED_INTEGER, bgl.GL_UNSIGNED_INT, self._snap_buffer)
+
def _get_nearest_index(self):
r_snap_obj = None
r_value = 0
@@ -507,7 +525,7 @@ class SnapContext():
if bbmin != bbmax:
MVP = proj_mat @ snap_obj.mat
- mat_inv = snap_obj.mat.inverted()
+ mat_inv = snap_obj.mat.inverted_safe()
ray_orig_local = mat_inv @ ray_orig
ray_dir_local = mat_inv.to_3x3() @ ray_dir
in_threshold = _Internal.intersect_boundbox_threshold(
@@ -542,13 +560,7 @@ class SnapContext():
self.drawn_count += 1
- bgl.glReadBuffer(bgl.GL_COLOR_ATTACHMENT0)
-
- bgl.glReadPixels(
- int(self.mval[0]) - self._dist_px, int(self.mval[1]) - self._dist_px,
- self.threshold, self.threshold, bgl.GL_RED_INTEGER, bgl.GL_UNSIGNED_INT, self._snap_buffer)
-
- #bgl.glReadBuffer(bgl.GL_BACK)
+ self._read_buffer(mval)
#import numpy as np
#a = np.array(self._snap_buffer)
#print(a)
diff --git a/mesh_snap_utilities_line/widgets.py b/mesh_snap_utilities_line/widgets.py
index 3060d74e..235657b1 100644
--- a/mesh_snap_utilities_line/widgets.py
+++ b/mesh_snap_utilities_line/widgets.py
@@ -145,9 +145,9 @@ class SnapPointWidget(SnapWidgetCommon):
def context_mode_check(context, widget_group):
- workspace = context.workspace
- mode = workspace.tools_mode
- for tool in workspace.tools:
+ tools = context.workspace.tools
+ mode = context.mode
+ for tool in tools:
if (tool.widget == widget_group) and (tool.mode == mode):
break
else: