[Bf-extensions-cvs] [78bf358b] blender2.7: Remove support for blender2.79
mano-wii
noreply at git.blender.org
Wed Apr 3 01:03:26 CEST 2019
Commit: 78bf358bf0805f69bc7317c4c5d1e10c0ece4dca
Author: mano-wii
Date: Tue Apr 2 20:03:16 2019 -0300
Branches: blender2.7
https://developer.blender.org/rBA78bf358bf0805f69bc7317c4c5d1e10c0ece4dca
Remove support for blender2.79
The addon does not work on all OS.
And now there is an improved version of it for blender2.8.
===================================================================
D mesh_snap_utilities_line.py
D modules/snap_context/__init__.py
D modules/snap_context/mesh_drawing.py
D modules/snap_context/resources/3D_vert.glsl
D modules/snap_context/resources/primitive_id_frag.glsl
D modules/snap_context/utils_projection.py
D modules/snap_context/utils_shader.py
===================================================================
diff --git a/mesh_snap_utilities_line.py b/mesh_snap_utilities_line.py
deleted file mode 100644
index 8f2f2a94..00000000
--- a/mesh_snap_utilities_line.py
+++ /dev/null
@@ -1,1191 +0,0 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 3
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# Contact for more information about the Addon:
-# Email: germano.costa at ig.com.br
-# Twitter: wii_mano @mano_wii
-
-
-bl_info = {
- "name": "Snap Utilities Line",
- "author": "Germano Cavalcante",
- "version": (5, 7, 6),
- "blender": (2, 75, 0),
- "location": "View3D > TOOLS > Snap Utilities > snap utilities",
- "description": "Extends Blender Snap controls",
- "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Modeling/Snap_Utils_Line",
- "category": "Mesh"}
-
-import bpy
-import bgl
-import bmesh
-from mathutils import Vector
-from mathutils.geometry import (
- intersect_point_line,
- intersect_line_line,
- intersect_line_plane,
- intersect_ray_tri
- )
-from bpy.types import (
- Operator,
- Panel,
- AddonPreferences,
- )
-from bpy.props import (
- BoolProperty,
- FloatProperty,
- FloatVectorProperty,
- StringProperty,
- )
-
-##DEBUG = False
-##if DEBUG:
-## from .snap_framebuffer_debug import screenTexture
-## from .snap_context import mesh_drawing
-
-
-def get_units_info(scale, unit_system, separate_units):
- if unit_system == 'METRIC':
- scale_steps = ((1000, 'km'), (1, 'm'), (1 / 100, 'cm'),
- (1 / 1000, 'mm'), (1 / 1000000, '\u00b5m'))
- elif unit_system == 'IMPERIAL':
- scale_steps = ((5280, 'mi'), (1, '\''),
- (1 / 12, '"'), (1 / 12000, 'thou'))
- scale /= 0.3048 # BU to feet
- else:
- scale_steps = ((1, ' BU'),)
- separate_units = False
-
- return (scale, scale_steps, separate_units)
-
-
-def convert_distance(val, units_info, precision=5):
- scale, scale_steps, separate_units = units_info
- sval = val * scale
- idx = 0
- while idx < len(scale_steps) - 1:
- if sval >= scale_steps[idx][0]:
- break
- idx += 1
- factor, suffix = scale_steps[idx]
- sval /= factor
- if not separate_units or idx == len(scale_steps) - 1:
- dval = str(round(sval, precision)) + suffix
- else:
- ival = int(sval)
- dval = str(round(ival, precision)) + suffix
- fval = sval - ival
- idx += 1
- while idx < len(scale_steps):
- fval *= scale_steps[idx - 1][0] / scale_steps[idx][0]
- if fval >= 1:
- dval += ' ' \
- + ("%.1f" % fval) \
- + scale_steps[idx][1]
- break
- idx += 1
-
- return dval
-
-
-def location_3d_to_region_2d(region, rv3d, coord):
- prj = rv3d.perspective_matrix * Vector((coord[0], coord[1], coord[2], 1.0))
- width_half = region.width / 2.0
- height_half = region.height / 2.0
- return Vector((width_half + width_half * (prj.x / prj.w),
- height_half + height_half * (prj.y / prj.w),
- prj.z / prj.w
- ))
-
-
-def out_Location(rv3d, region, orig, vector):
- view_matrix = rv3d.view_matrix
- v1 = Vector((int(view_matrix[0][0] * 1.5), int(view_matrix[0][1] * 1.5), int(view_matrix[0][2] * 1.5)))
- v2 = Vector((int(view_matrix[1][0] * 1.5), int(view_matrix[1][1] * 1.5), int(view_matrix[1][2] * 1.5)))
-
- hit = intersect_ray_tri(Vector((1, 0, 0)), Vector((0, 1, 0)), Vector(), (vector), (orig), False)
- if hit is None:
- hit = intersect_ray_tri(v1, v2, Vector(), (vector), (orig), False)
- if hit is None:
- hit = intersect_ray_tri(v1, v2, Vector(), (-vector), (orig), False)
- if hit is None:
- hit = Vector()
- return hit
-
-
-def get_closest_edge(bm, point, dist):
- r_edge = None
- for edge in bm.edges:
- v1 = edge.verts[0].co
- v2 = edge.verts[1].co
- # Test the BVH (AABB) first
- for i in range(3):
- if v1[i] <= v2[i]:
- isect = v1[i] - dist <= point[i] <= v2[i] + dist
- else:
- isect = v2[i] - dist <= point[i] <= v1[i] + dist
-
- if not isect:
- break
- else:
- ret = intersect_point_line(point, v1, v2)
-
- if ret[1] < 0.0:
- tmp = v1
- elif ret[1] > 1.0:
- tmp = v2
- else:
- tmp = ret[0]
-
- new_dist = (point - tmp).length
- if new_dist <= dist:
- dist = new_dist
- r_edge = edge
-
- return r_edge
-
-
-class SnapCache():
- bvert = None
- vco = None
-
- bedge = None
- v0 = None
- v1 = None
- vmid = None
- vperp = None
- v2d0 = None
- v2d1 = None
- v2dmid = None
- v2dperp = None
-
- bm_geom_selected = None
-
-
-def snap_utilities(
- sctx, obj,
- cache, context, obj_matrix_world,
- bm, mcursor,
- constrain = None,
- previous_vert = None,
- increment = 0.0):
-
- rv3d = context.region_data
- region = context.region
- scene = context.scene
- is_increment = False
- r_loc = None
- r_type = None
- r_len = 0.0
- bm_geom = None
-
- if cache.bm_geom_selected:
- try:
- cache.bm_geom_selected.select = False
- except ReferenceError as e:
- print(e)
-
- snp_obj, loc, elem = sctx.snap_get(mcursor)
- view_vector, orig = sctx.last_ray
-
- if not snp_obj:
- is_increment = True
- if constrain:
- end = orig + view_vector
- t_loc = intersect_line_line(constrain[0], constrain[1], orig, end)
- if t_loc is None:
- t_loc = constrain
- r_loc = t_loc[0]
- else:
- r_type = 'OUT'
- r_loc = out_Location(rv3d, region, orig, view_vector)
-
- elif snp_obj.data[0] != obj: #OUT
- r_loc = loc
-
- if constrain:
- is_increment = False
- r_loc = intersect_point_line(r_loc, constrain[0], constrain[1])[0]
- if not r_loc:
- r_loc = out_Location(rv3d, region, orig, view_vector)
- elif len(elem) == 1:
- is_increment = False
- r_type = 'VERT'
- elif len(elem) == 2:
- is_increment = True
- r_type = 'EDGE'
- else:
- is_increment = True
- r_type = 'FACE'
-
- elif len(elem) == 1:
- r_type = 'VERT'
- bm_geom = bm.verts[elem[0]]
-
- if cache.bvert != bm_geom:
- cache.bvert = bm_geom
- cache.vco = loc
- #cache.v2d = location_3d_to_region_2d(region, rv3d, cache.vco)
-
- if constrain:
- r_loc = intersect_point_line(cache.vco, constrain[0], constrain[1])[0]
- else:
- r_loc = cache.vco
-
- elif len(elem) == 2:
- v1 = bm.verts[elem[0]]
- v2 = bm.verts[elem[1]]
- bm_geom = bm.edges.get([v1, v2])
-
- if cache.bedge != bm_geom:
- cache.bedge = bm_geom
- cache.v0 = obj_matrix_world * v1.co
- cache.v1 = obj_matrix_world * v2.co
- cache.vmid = 0.5 * (cache.v0 + cache.v1)
- cache.v2d0 = location_3d_to_region_2d(region, rv3d, cache.v0)
- cache.v2d1 = location_3d_to_region_2d(region, rv3d, cache.v1)
- cache.v2dmid = location_3d_to_region_2d(region, rv3d, cache.vmid)
-
- if previous_vert and previous_vert not in {v1, v2}:
- pvert_co = obj_matrix_world * previous_vert.co
- perp_point = intersect_point_line(pvert_co, cache.v0, cache.v1)
- cache.vperp = perp_point[0]
- #factor = point_perpendicular[1]
- cache.v2dperp = location_3d_to_region_2d(region, rv3d, perp_point[0])
-
- #else: cache.v2dperp = None
-
- if constrain:
- t_loc = intersect_line_line(constrain[0], constrain[1], cache.v0, cache.v1)
- if t_loc is None:
- is_increment = True
- end = orig + view_vector
- t_loc = intersect_line_line(constrain[0], constrain[1], orig, end)
- r_loc = t_loc[0]
-
- elif cache.v2dperp and\
- abs(cache.v2dperp[0] - mcursor[0]) < 10 and abs(cache.v2dperp[1] - mcursor[1]) < 10:
- r_type = 'PERPENDICULAR'
- r_loc = cache.vperp
-
- elif abs(cache.v2dmid[0] - mcursor[0]) < 10 and abs(cache.v2dmid[1] - mcursor[1]) < 10:
- r_type = 'CENTER'
- r_loc = cache.vmid
-
- else:
- if increment and previous_vert in cache.bedge.verts:
- is_increment = True
-
- r_type = 'EDGE'
- r_loc = loc
-
- elif len(elem) == 3:
- is_increment = True
- r_type = 'FACE'
- tri = [
- bm.verts[elem[0]],
- bm.verts[elem[1]],
- bm.verts[elem[2]],
- ]
-
- faces = set(tri[0].link_faces).intersection(tri[1].link_faces, tri[2].link_faces)
- if len(faces) == 1:
- bm_geom = faces.pop()
- else:
- i = -2
- edge = None
- while not edge and i != 1:
- edge = bm.edges.get([tri[i], tri[i + 1]])
- i += 1
- if edge:
- for l in edge.link_loops:
- if l.link_loop_n
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list