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") 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") file = open(filepath, "w")

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

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

@ -18,7 +18,8 @@ if "Cube" in bpy.data.meshes:
# write images into a file next to the blend # 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: for image in bpy.data.images:
file.write("%s %dx%d\n" % (image.filepath, image.size[0], image.size[1])) file.write("%s %dx%d\n" % (image.filepath, image.size[0], image.size[1]))