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:
authorGermano <germano.costa@ig.com.br>2017-09-15 20:14:01 +0300
committerGermano <germano.costa@ig.com.br>2017-09-15 20:14:01 +0300
commit7c2d2fb096f5899f82c16e3d81039f38335dd1be (patch)
treecab7fcea7b8673823619d87882fdd04e3db01a45
parentb119529556663cd77d7eb63c3ad22c90a9c0ec3c (diff)
snap_context module: Use clip planes exposed by RNA
-rw-r--r--modules/snap_context/bgl_ext.py10
-rw-r--r--modules/snap_context/mesh_drawing.py7
2 files changed, 4 insertions, 13 deletions
diff --git a/modules/snap_context/bgl_ext.py b/modules/snap_context/bgl_ext.py
index 46ce3186..f8dbff09 100644
--- a/modules/snap_context/bgl_ext.py
+++ b/modules/snap_context/bgl_ext.py
@@ -128,13 +128,3 @@ def bgl_Buffer_reshape(buf, shape):
del c_buf
del c_tmp_buf
del tmp_buf
-
-
-def get_clip_planes(rv3d):
- #(int)(&((struct RegionView3D *)0)->rflag) == 842
- #(int)(&((struct RegionView3D *)0)->clip) == 464
- rv3d_ptr = rv3d.as_pointer()
- rflag = ctypes.c_short.from_address(rv3d_ptr + 842).value
- if rflag & 4: # RV3D_CLIPPING
- clip = (6 * (4 * ctypes.c_float)).from_address(rv3d_ptr + 464)
- return bgl.Buffer(bgl.GL_FLOAT, (6, 4), clip)
diff --git a/modules/snap_context/mesh_drawing.py b/modules/snap_context/mesh_drawing.py
index dc6619a0..14e358a8 100644
--- a/modules/snap_context/mesh_drawing.py
+++ b/modules/snap_context/mesh_drawing.py
@@ -21,7 +21,7 @@ import bmesh
import numpy as np
from mathutils import Matrix
-from .bgl_ext import VoidBufValue, np_array_as_bgl_Buffer, bgl_Buffer_reshape, get_clip_planes
+from .bgl_ext import VoidBufValue, np_array_as_bgl_Buffer, bgl_Buffer_reshape
from .utils_shader import Shader
@@ -502,8 +502,9 @@ def gpu_Indices_restore_state():
def gpu_Indices_use_clip_planes(rv3d, value):
- planes = get_clip_planes(rv3d)
- if planes:
+ if rv3d.use_clip_planes:
+ planes = bgl.Buffer(bgl.GL_FLOAT, (6, 4), rv3d.clip_planes)
+
_store_current_shader_state(PreviousGLState)
bgl.glUseProgram(GPU_Indices_Mesh.shader.program)
bgl.glUniform1i(GPU_Indices_Mesh.unif_use_clip_planes, value)