= Addendum to UVProject's multiple UV handling - "Override Image" button =

* Added an "Override Image" button to the UVProject modifier; this overrides
  faces' currently assigned image with the one given in the modifier panel.
  This provides some of the functionality previously provided by the "Add UVs"
  button - you still need to add a UV layer manually, but you only need to
  change the image in one place.
* Note that the "Override Image" option uses the bit position previously used
  by the "Add UVs" option, so old files which had "Add UVs" enabled will now
  have "Override Image" enabled.
This commit is contained in:
2007-01-29 16:28:11 +00:00
parent 2a47217cba
commit 1f35fd7929
3 changed files with 14 additions and 6 deletions

View File

@@ -2616,7 +2616,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
int i, numVerts, numFaces;
Image *image = umd->image;
MFace *mface, *mf;
int new_tfaces = 0;
int override_image = ((umd->flags & MOD_UVPROJECT_OVERRIDEIMAGE) != 0);
Projector projectors[MOD_UVPROJECT_MAXPROJECTORS];
int num_projectors = 0;
float aspect;
@@ -2729,7 +2729,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
/* apply coords as UVs, and apply image if tfaces are new */
for(i = 0, mf = mface; i < numFaces; ++i, ++mf, ++tface) {
if(new_tfaces || !image || tface->tpage == image) {
if(override_image || !image || tface->tpage == image) {
if(num_projectors == 1) {
/* apply transformed coords as UVs */
tface->uv[0][0] = coords[mf->v1][0];
@@ -2799,10 +2799,9 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
}
}
if(new_tfaces) {
if(override_image) {
tface->mode = TF_TEX;
if(image)
tface->tpage = image;
tface->tpage = image;
}
}

View File

@@ -214,6 +214,9 @@ typedef struct UVProjectModifierData {
#define MOD_UVPROJECT_MAXPROJECTORS 10
/* UVProjectModifierData->flags */
#define MOD_UVPROJECT_OVERRIDEIMAGE 1<<0
typedef struct DecimateModifierData {
ModifierData modifier;

View File

@@ -1559,7 +1559,7 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
dmd->texmapping == MOD_DISP_MAP_UV)
height += 19;
} else if (md->type==eModifierType_UVProject) {
height = 105 + ((UVProjectModifierData *)md)->num_projectors * 19;
height = 114 + ((UVProjectModifierData *)md)->num_projectors * 19;
} else if (md->type==eModifierType_Decimate) {
height = 48;
} else if (md->type==eModifierType_Wave) {
@@ -1759,6 +1759,12 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
"Image to project (only faces with this image "
"will be altered");
uiButSetCompleteFunc(but, autocomplete_image, (void *)ob);
uiDefButBitI(block, TOG, MOD_UVPROJECT_OVERRIDEIMAGE,
B_MODIFIER_RECALC, "Override Image",
lx, (cy -= 19), buttonWidth, 19,
&umd->flags, 0, 0, 0, 0,
"Override faces' current images with the "
"given image");
} else if (md->type==eModifierType_Decimate) {
DecimateModifierData *dmd = (DecimateModifierData*) md;
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Ratio:", lx,(cy-=19),buttonWidth,19, &dmd->percent, 0.0, 1.0, 10, 0, "Defines the percentage of triangles to reduce to");