diff options
author | Roel Spruit <roel@spruitje.nl> | 2003-09-21 00:58:14 +0400 |
---|---|---|
committer | Roel Spruit <roel@spruitje.nl> | 2003-09-21 00:58:14 +0400 |
commit | b5450f08155ab50ce4b7a74e1d7cdae69a3ef899 (patch) | |
tree | 1023d1bc0e5698b85259935af5d00851872a3844 /source/blender/src/editface.c | |
parent | c0303d78b4c25a095208d33a7d809ebb3db79404 (diff) |
added 2 new features:
- "Seperate loose parts" is an option in the new pkey popup (in mesh editmode) that seperates a mesh based on objects in it that are not connected.
- "Select same uv" is an option in the wkey popup (in facemode) that selects all faces in the mesh that have the same uv texture assigned as the current active face.
ps. first commit! I hope I can live up to expectations...but don't expect too much! :D
Diffstat (limited to 'source/blender/src/editface.c')
-rw-r--r-- | source/blender/src/editface.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/source/blender/src/editface.c b/source/blender/src/editface.c index bf4d030d00b..290c9b2aa9e 100644 --- a/source/blender/src/editface.c +++ b/source/blender/src/editface.c @@ -1362,4 +1362,70 @@ void face_draw() allqueue(REDRAWIMAGE, 0); allqueue(REDRAWHEADERS, 0); } + + /* Selects all faces which have the same uv-texture as the active face + * @author Roel Spruit + * @return Void + * Errors: - Active object not in this layer + * - No active face or active face has no UV-texture + */ +void get_same_uv(void) +{ + Object *ob; + Mesh *me; + TFace *tface; + short a, foundtex=0; + Image *ima; + char uvname[160]; + + ob = OBACT; + if (!(ob->lay & G.vd->lay)) { + error("Active object not in this layer!"); + return; + } + me = get_mesh(ob); + + + /* Search for the active face with a UV-Texture */ + tface = me->tface; + a = me->totface; + while (a--) { + if(tface->flag & TF_ACTIVE){ + ima=tface->tpage; + if(ima && ima->name){ + strcpy(uvname,ima->name); + a=0; + foundtex=1; + } + } + tface++; + } + + if(!foundtex) { + error("No active face or active face has no UV-texture"); + return; + } + + /* select everything with the same texture */ + tface = me->tface; + a = me->totface; + while (a--) { + ima=tface->tpage; + if(ima && ima->name){ + if(!strcmp(ima->name, uvname)){ + tface->flag |= TF_SELECT; + } + else tface->flag &= ~TF_SELECT; + } + else tface->flag &= ~TF_SELECT; + tface++; + } + + + + /* image window redraw */ + allqueue(REDRAWIMAGE, 0); + allqueue(REDRAWBUTSGAME, 0); + allqueue(REDRAWVIEW3D, 0); +} #endif /* NAN_TPT */ |