Change to text3d: When back or front is enabled, the bevel rim on the other side is not created anymore, just as the back/front filling faces are not created when disabled.

when both are off the behavior is unchanged.

This is needed when rendering alpha text so its possible to have a single layer of faces but use the bevel option to make text thicker.
adding a rim on the back when back is disabled also doesnt make much sense IMHO.

minor python edits too.
This commit is contained in:
Campbell Barton 2010-07-14 17:47:58 +00:00
parent fe958e647f
commit 8e3a9634a3
4 changed files with 56 additions and 50 deletions

@ -53,7 +53,7 @@ blender_version = blender_version.split("Build")[0]
date_string = datetime.date.fromtimestamp(time.time()).strftime("%B %d, %Y")
filepath = __file__.replace(".py", "")
filepath = os.path.splitext(__file__)[0] + ".1"
file = open(filepath, "w")

@ -68,7 +68,7 @@ def get_console(console_id):
stderr = io.StringIO()
else:
namespace = {'__builtins__': __builtins__, 'bpy': bpy}
console = InteractiveConsole(namespace)
console = InteractiveConsole(locals=namespace, filename="<blender_console>")
import io
stdout = io.StringIO()

@ -1318,30 +1318,33 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
short dnr;
/* bevel now in three parts, for proper vertex normals */
/* part 1 */
dnr= nr= 2+ cu->bevresol;
if( (cu->flag & (CU_FRONT|CU_BACK))==0)
nr= 3+ 2*cu->bevresol;
dl= MEM_callocN(sizeof(DispList), "makebevelcurve p1");
dl->verts= MEM_mallocN(nr*3*sizeof(float), "makebevelcurve p1");
BLI_addtail(disp, dl);
dl->type= DL_SEGM;
dl->parts= 1;
dl->flag= DL_BACK_CURVE;
dl->nr= nr;
/* part 1, back */
/* half a circle */
fp= dl->verts;
dangle= (0.5*M_PI/(dnr-1));
angle= -(nr-1)*dangle;
for(a=0; a<nr; a++) {
fp[0]= 0.0;
fp[1]= (float)(cos(angle)*(cu->ext2));
fp[2]= (float)(sin(angle)*(cu->ext2)) - cu->ext1;
angle+= dangle;
fp+= 3;
if((cu->flag & CU_BACK) || !(cu->flag & CU_FRONT)) {
dnr= nr= 2+ cu->bevresol;
if( (cu->flag & (CU_FRONT|CU_BACK))==0)
nr= 3+ 2*cu->bevresol;
dl= MEM_callocN(sizeof(DispList), "makebevelcurve p1");
dl->verts= MEM_mallocN(nr*3*sizeof(float), "makebevelcurve p1");
BLI_addtail(disp, dl);
dl->type= DL_SEGM;
dl->parts= 1;
dl->flag= DL_BACK_CURVE;
dl->nr= nr;
/* half a circle */
fp= dl->verts;
dangle= (0.5*M_PI/(dnr-1));
angle= -(nr-1)*dangle;
for(a=0; a<nr; a++) {
fp[0]= 0.0;
fp[1]= (float)(cos(angle)*(cu->ext2));
fp[2]= (float)(sin(angle)*(cu->ext2)) - cu->ext1;
angle+= dangle;
fp+= 3;
}
}
/* part 2, sidefaces */
@ -1374,30 +1377,32 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
}
}
/* part 3 */
dnr= nr= 2+ cu->bevresol;
if( (cu->flag & (CU_FRONT|CU_BACK))==0)
nr= 3+ 2*cu->bevresol;
dl= MEM_callocN(sizeof(DispList), "makebevelcurve p3");
dl->verts= MEM_mallocN(nr*3*sizeof(float), "makebevelcurve p3");
BLI_addtail(disp, dl);
dl->type= DL_SEGM;
dl->flag= DL_FRONT_CURVE;
dl->parts= 1;
dl->nr= nr;
/* half a circle */
fp= dl->verts;
angle= 0.0;
dangle= (0.5*M_PI/(dnr-1));
for(a=0; a<nr; a++) {
fp[0]= 0.0;
fp[1]= (float)(cos(angle)*(cu->ext2));
fp[2]= (float)(sin(angle)*(cu->ext2)) + cu->ext1;
angle+= dangle;
fp+= 3;
/* part 3, front */
if((cu->flag & CU_FRONT) || !(cu->flag & CU_BACK)) {
dnr= nr= 2+ cu->bevresol;
if( (cu->flag & (CU_FRONT|CU_BACK))==0)
nr= 3+ 2*cu->bevresol;
dl= MEM_callocN(sizeof(DispList), "makebevelcurve p3");
dl->verts= MEM_mallocN(nr*3*sizeof(float), "makebevelcurve p3");
BLI_addtail(disp, dl);
dl->type= DL_SEGM;
dl->flag= DL_FRONT_CURVE;
dl->parts= 1;
dl->nr= nr;
/* half a circle */
fp= dl->verts;
angle= 0.0;
dangle= (0.5*M_PI/(dnr-1));
for(a=0; a<nr; a++) {
fp[0]= 0.0;
fp[1]= (float)(cos(angle)*(cu->ext2));
fp[2]= (float)(sin(angle)*(cu->ext2)) + cu->ext1;
angle+= dangle;
fp+= 3;
}
}
}
}

@ -18,7 +18,8 @@ if "Cube" in bpy.data.meshes:
# write images into a file next to the blend
file = open(bpy.data.filepath.replace(".blend", ".txt"), 'w')
import os
file = open(os.path.splitext(bpy.data.filepath)[0] + ".txt", 'w')
for image in bpy.data.images:
file.write("%s %dx%d\n" % (image.filepath, image.size[0], image.size[1]))