diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2004-07-28 21:46:29 +0400 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2004-07-28 21:46:29 +0400 |
commit | 6b1eb45dda4e61c143c608de8e429a34a31e453f (patch) | |
tree | d9b06405b2c7deb69c00105173b2949ed31c3a6f /release/scripts | |
parent | d2da4f7160974717ee0c7fd2c4030055cffe1312 (diff) |
Scripts:
- Campbell Barton updated his sel_same.py script;
- Added to Mesh scripts a call to Window.EditMode(0) to leave editmode before changing meshes.
BPython:
- small doc fixes / updates;
- added a call to undo_push_mesh inside Window.EditMode(0).
Mesh scripts could change the mesh but not the editmesh -- that would then overwrite the changed mesh. Made all mesh scripts leave edit mode before changing a mesh.
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/disp_paint.py | 3 | ||||
-rw-r--r-- | release/scripts/knife.py | 2 | ||||
-rw-r--r-- | release/scripts/rvk1_torvk2.py | 1 | ||||
-rw-r--r-- | release/scripts/sel_same.py | 34 | ||||
-rw-r--r-- | release/scripts/unweld044.py | 6 |
5 files changed, 24 insertions, 22 deletions
diff --git a/release/scripts/disp_paint.py b/release/scripts/disp_paint.py index 934ab6f9c54..8dac2a26dbf 100644 --- a/release/scripts/disp_paint.py +++ b/release/scripts/disp_paint.py @@ -378,7 +378,7 @@ def draw(): def event(evt, val): - if (evt== QKEY and not val): Exit() + if ((evt== QKEY or evt== ESCKEY) and not val): Exit() def bevent(evt): global MODEMenu, NSIZE, ng, TMATList @@ -430,4 +430,5 @@ def bevent(evt): Blender.Redraw() +Window.EditMode(0) Register(draw, event, bevent) diff --git a/release/scripts/knife.py b/release/scripts/knife.py index dfe3135dd68..4a7943d8902 100644 --- a/release/scripts/knife.py +++ b/release/scripts/knife.py @@ -657,7 +657,7 @@ def draw(): msg = '' def event(evt, val): - if evt == Draw.QKEY and not val: + if (evt == Draw.QKEY or evt == Draw.ESCKEY) and not val: Draw.Exit() if evt == Draw.CKEY and not val: CutMesh() diff --git a/release/scripts/rvk1_torvk2.py b/release/scripts/rvk1_torvk2.py index 0671e44938b..8350f82d84b 100644 --- a/release/scripts/rvk1_torvk2.py +++ b/release/scripts/rvk1_torvk2.py @@ -107,4 +107,5 @@ def rvk2rvk(): Draw.PupMenu('Error| You need to select two meshes.') +Blender.Window.EditMode(0) rvk2rvk() diff --git a/release/scripts/sel_same.py b/release/scripts/sel_same.py index 38c216116ba..15941272f1c 100644 --- a/release/scripts/sel_same.py +++ b/release/scripts/sel_same.py @@ -61,13 +61,12 @@ else: mesh = object.getData() # We have a mesh so find AF. - for f in mesh.faces: - if f.flag & NMesh.FaceFlags['ACTIVE']: - af = f + af = mesh.getActiveFace() + if af: af = mesh.faces[af] if af == None: error('no active face') - + else: # Okay everything seems sane #===================================== @@ -152,7 +151,7 @@ else: # Okay everything seems sane avcolIdx = 0 while avcolIdx < len(f1.col): match = 0 - + vcolIdx = 0 while vcolIdx < len(f2.col): if colCompare(f1.col[avcolIdx], f2.col[vcolIdx], limit): @@ -164,8 +163,6 @@ else: # Okay everything seems sane avcolIdx += 1 return 1 - - # Makes sure face 2 has matching UVs within the limit. def faceUvCompare(f1, f2, limit): for auv in f1.uv: @@ -193,7 +190,6 @@ else: # Okay everything seems sane #====================# - #=============================# # Blender functions/shortcuts # #=============================# @@ -212,7 +208,6 @@ else: # Okay everything seems sane elif len(f.v) == 3: return (measure(f.v[0].co, f.v[1].co), measure(f.v[1].co, f.v[2].co), measure(f.v[2].co, f.v[0].co) ) - def faceCent(f): x = y = z = 0 for v in f.v: @@ -229,7 +224,9 @@ else: # Okay everything seems sane #========================================# def fShouldCompare(f): # Only calculate for faces that will be affected. - if faceOp == 1 and f.flag == 1: + if len(f.v) < 3: # cant be an edge + return 0 + elif faceOp == 1 and f.flag == 1: return 0 elif faceOp == 0 and f.flag == 0: return 0 @@ -247,10 +244,13 @@ else: # Okay everything seems sane else: setFUnSel(f) def get_same_image(): - for f in mesh.faces: - if fShouldCompare(f): - if af.image == f.image: setFSel(f) - else: setFUnSel(f) + if mesh.hasFaceUV() == 0: + error('mesh has no uv image') + else: + for f in mesh.faces: + if fShouldCompare(f): + if af.image == f.image: setFSel(f) + else: setFUnSel(f) def get_same_mode(): for f in mesh.faces: @@ -280,9 +280,7 @@ else: # Okay everything seems sane if compare(afArea, faceArea(f), limit): setFSel(f) else: setFUnSel(f) - def get_same_prop(limit): - # Here we get the perimeter and use it for a proportional limit modifier. afEdgeLens = getEdgeLengths(af) perim = 0 @@ -326,10 +324,10 @@ else: # Okay everything seems sane setFSel(f) else: setFUnSel(f) + #=====================# # End Sel same funcs # #=====================# - limit = 1 # some of these dont use the limit so it needs to be set, to somthing. # act on the menu item selected if method == 1: # Material @@ -365,4 +363,4 @@ else: # Okay everything seems sane # If limit is not set then dont bother if limit != None: - mesh.update() + mesh.update(0) diff --git a/release/scripts/unweld044.py b/release/scripts/unweld044.py index d93ef474703..06551a0de53 100644 --- a/release/scripts/unweld044.py +++ b/release/scripts/unweld044.py @@ -1,7 +1,7 @@ #!BPY """ Registration info for Blender menus: <- these words are ignored Name: 'UnWeld' -Blender: 232 +Blender: 234 Group: 'Mesh' Tip: 'Unweld all faces from a selected and common vertex. Made vertex bevelling.' """ @@ -57,6 +57,8 @@ from Blender import Noise from Blender.Draw import * from Blender.BGL import * +Blender.Window.EditMode(0) + Nr=Noise.random decal=0.03 t=[0.0,0.0,0.0] @@ -196,7 +198,7 @@ def D(): def E(evt,val): global mouse_x,x,pl,orig,me,debut global mouse_y,y, MouseClickG,MouseClickD,MouseClickM - if (evt== QKEY): Exit() + if (evt== QKEY or evt== ESCKEY): Exit() if (evt == MOUSEX): mouse_x = val |