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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2006-01-17 09:14:52 +0300
committerCampbell Barton <ideasman42@gmail.com>2006-01-17 09:14:52 +0300
commit0ea84e4a075645831f0356950d721d655d00b730 (patch)
treeed2bfc4ffd2f7c90bbf1150800e86933b94807c8 /release
parentcfdf71bc5cde72a63008f84e16626ba3d4ab82af (diff)
Fixed a problem with non mesh objects
Stopped seams from tearing away with xclip enabled.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/mesh_bbrush.py58
1 files changed, 52 insertions, 6 deletions
diff --git a/release/scripts/mesh_bbrush.py b/release/scripts/mesh_bbrush.py
index ba9e6454d39..7f19e0b6499 100644
--- a/release/scripts/mesh_bbrush.py
+++ b/release/scripts/mesh_bbrush.py
@@ -295,6 +295,10 @@ def event_main():
return
"""
+ ob = Scene.GetCurrent().getActiveObject()
+ if not ob or ob.getType() != 'Mesh':
+ return
+
# Mouse button down with no modifiers.
if Blender.event == Draw.LEFTMOUSE and not [True for m in mod if m & qual]:
# Do not exit (draw)
@@ -307,6 +311,7 @@ def event_main():
del qual
+
try:
Blender.bbrush
except:
@@ -380,9 +385,6 @@ def event_main():
me.faces.extend(newFaces)
"""
- ob = Scene.GetCurrent().getActiveObject()
- if not ob or ob.getType() != 'Mesh':
- return
me = ob.getData(mesh=1)
@@ -534,6 +536,11 @@ def event_main():
# ================================================================#
if BRUSH_MODE == 1: # NORMAL PAINT
for v,l in brush_verts:
+ if XPLANE_CLIP:
+ origx = False
+ if abs(v.co.x) < 0.001: origx = True
+
+
v.sel = 1 # MARK THE VERT AS DIRTY.
falloff = (BRUSH_RADIUS-l) / BRUSH_RADIUS # falloff between 0 and 1
@@ -552,9 +559,18 @@ def event_main():
v.co += (iFaceNormal * BRUSH_PRESSURE) * falloff
elif DISPLACE_NORMAL_MODE == 4: # VIEW NORMAL
v.co += (Direction * BRUSH_PRESSURE) * falloff
+
+ # Clamp back to original x if needs be.
+ if XPLANE_CLIP and origx:
+ v.co.x = 0
elif BRUSH_MODE == 2: # SCALE
for v,l in brush_verts:
+
+ if XPLANE_CLIP:
+ origx = False
+ if abs(v.co.x) < 0.001: origx = True
+
v.sel = 1 # MARK THE VERT AS DIRTY.
falloff = (BRUSH_RADIUS-l) / BRUSH_RADIUS # falloff between 0 and 1
@@ -563,9 +579,13 @@ def event_main():
# falloff needs to be scaled for this tool
falloff = falloff / 10
v.co += (vert_scale_vec * BRUSH_PRESSURE) * falloff # FLAT BRUSH
-
+
+ # Clamp back to original x if needs be.
+ if XPLANE_CLIP and origx:
+ v.co.x = 0
if BRUSH_MODE == 3: # ROTATE.
+
if DISPLACE_NORMAL_MODE == 1: # VERTEX NORMAL
ROTATE_MATRIX = Mathutils.RotationMatrix(BRUSH_PRESSURE*10, 4, 'r', iFaceNormal) # Cant use vertex normal, use face normal
elif DISPLACE_NORMAL_MODE == 2: # MEDIAN NORMAL
@@ -577,6 +597,11 @@ def event_main():
# Brush code
for v,l in brush_verts:
+
+ if XPLANE_CLIP:
+ origx = False
+ if abs(v.co.x) < 0.001: origx = True
+
# MARK THE VERT AS DIRTY.
v.sel = 1
falloff = (BRUSH_RADIUS-l) / BRUSH_RADIUS # falloff between 0 and 1
@@ -584,7 +609,10 @@ def event_main():
# Vectors handeled with rotation matrix creation.
rot_vert_loc = (ROTATE_MATRIX * (v.co-best_isect)) + best_isect
v.co = (v.co*(1-falloff)) + (rot_vert_loc*(falloff))
-
+
+ # Clamp back to original x if needs be.
+ if XPLANE_CLIP and origx:
+ v.co.x = 0
elif BRUSH_MODE == 4: # RELAX
vert_orig_loc = [Vector(v.co) for v in me.verts ] # save orig vert location.
@@ -592,6 +620,11 @@ def event_main():
# Brush code
for v,l in brush_verts:
+
+ if XPLANE_CLIP:
+ origx = False
+ if abs(v.co.x) < 0.001: origx = True
+
v.sel = 1 # Mark the vert as dirty.
falloff = (BRUSH_RADIUS-l) / BRUSH_RADIUS # falloff between 0 and 1
connected_verts = verts_connected_by_edge[v.index]
@@ -616,7 +649,11 @@ def event_main():
except:
pass
'''
-
+
+ # Clamp back to original x if needs be.
+ if XPLANE_CLIP and origx:
+ v.co.x = 0
+
elif BRUSH_MODE == 5: # GOO
#print last_best_isect, best_isect, 'AA'
if not last_best_isect:
@@ -670,6 +707,11 @@ def event_main():
# Brush code
for v,l in brush_verts:
+
+ if XPLANE_CLIP:
+ origx = False
+ if abs(v.co.x) < 0.001: origx = True
+
# MARK THE VERT AS DIRTY.
v.sel = 1
@@ -693,6 +735,10 @@ def event_main():
v.co = (v.co*(1-falloff)) + (rotatedVertLocation*(falloff))
# USe for goo only.
'''
+
+ # Clamp back to original x if needs be.
+ if XPLANE_CLIP and origx:
+ v.co.x = 0
# Remember for the next sample