diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-09-19 20:28:52 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-09-19 20:28:52 +0400 |
commit | 28ae78a745bab375ee227be8846479a4afc02ffd (patch) | |
tree | b69d30c61a66b1a8e430c78f149154d96d1967f0 /source/blender/src/editmesh_tools.c | |
parent | 1c603b63c712a539056e122f3facbfdfcc3dd912 (diff) |
reworked how tile functions, seperated image and tile setting functions/events and made tile work with image pinning.
changed how image replace works,
it used to load a new image and then assign that image to all faces in meshes active UV layer.
without replacing images in textures or images on inactive UV layers
now it simply changes the filename of the existing image and reloads the contense.
This is different in some other subtle ways,
1) replace used to use an existing image if it was available,
this could be confusing because when I replaced with an image I didnt like, but had alredy applied to objects in some other scene, replacing again would alter the images from models unintentionally.
2) since replace used to load a new image, it would load with a new name. at the moment the name is left unchanged,
This is better when dealing with linked libraries. because when replacing a images, anything linking to that texture gets broken. since imaged can get automatically named strings longer then its possible to enter into the user interface, you could wind up with some really annoying cases where it wasnt possible to type in the original name again.
Since this replace effects everything usiung the image, we may want to have 2 replace functions, "Replace Globaly" and "Replace in Mesh"
Diffstat (limited to 'source/blender/src/editmesh_tools.c')
-rw-r--r-- | source/blender/src/editmesh_tools.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/source/blender/src/editmesh_tools.c b/source/blender/src/editmesh_tools.c index 27584d569cf..88d1cb172c3 100644 --- a/source/blender/src/editmesh_tools.c +++ b/source/blender/src/editmesh_tools.c @@ -5103,6 +5103,57 @@ int EdgeSlide(short immediate, float imperc) /* -------------------- More tools ------------------ */ +void mesh_set_face_flags(short mode) +{ + EditMesh *em = G.editMesh; + EditFace *efa; + MTFace *tface; + short m_tex=0, m_tiles=0, m_shared=0, m_light=0, m_invis=0, m_collision=0, m_twoside=0, m_obcolor=0; + short flag = 0, change = 0; + + if(G.obedit==0) return; + + if(G.obedit->type != OB_MESH) return; + + add_numbut(0, TOG|SHO, "Texture", 0, 0, &m_tex, NULL); + add_numbut(1, TOG|SHO, "Tiles", 0, 0, &m_tiles, NULL); + add_numbut(2, TOG|SHO, "Shared", 0, 0, &m_shared, NULL); + add_numbut(3, TOG|SHO, "Light", 0, 0, &m_light, NULL); + add_numbut(4, TOG|SHO, "Invisible", 0, 0, &m_invis, NULL); + add_numbut(5, TOG|SHO, "Collision", 0, 0, &m_collision, NULL); + add_numbut(6, TOG|SHO, "Twoside", 0, 0, &m_twoside, NULL); + add_numbut(7, TOG|SHO, "ObColor", 0, 0, &m_obcolor, NULL); + + if (!do_clever_numbuts((mode ? "Set Flags" : "Clear Flags"), 8, REDRAW)) + return; + + if (m_tex) flag |= TF_TEX; + if (m_tiles) flag |= TF_TILES; + if (m_shared) flag |= TF_SHAREDCOL; + if (m_light) flag |= TF_LIGHT; + if (m_invis) flag |= TF_INVISIBLE; + if (m_collision) flag |= TF_DYNAMIC; + if (m_twoside) flag |= TF_TWOSIDE; + if (m_obcolor) flag |= TF_OBCOL; + + efa= em->faces.first; + while(efa) { + if(efa->f & SELECT) { + tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); + if (mode) tface->mode |= flag; + else tface->mode &= ~flag; + } + efa= efa->next; + } + + if (change) { + BIF_undo_push((mode ? "Set Flags" : "Clear Flags")); + + allqueue(REDRAWIMAGE, 0); + allqueue(REDRAWVIEW3D, 0); + } +} + void mesh_set_smooth_faces(short event) { EditMesh *em = G.editMesh; |