syncing some minor formatting edits from bmesh branch.

This commit is contained in:
Campbell Barton 2011-12-04 23:04:43 +00:00
parent 577730daad
commit eb233d9332
11 changed files with 51 additions and 32 deletions

@ -285,7 +285,8 @@ void CustomData_validate_layer_name(const struct CustomData *data, int type, cha
int CustomData_verify_versions(struct CustomData *data, int index);
/*BMesh specific customdata stuff*/
void CustomData_to_bmeshpoly(struct CustomData *fdata, struct CustomData *pdata, struct CustomData *ldata);
void CustomData_to_bmeshpoly(struct CustomData *fdata, struct CustomData *pdata,
struct CustomData *ldata);
void CustomData_from_bmeshpoly(struct CustomData *fdata, struct CustomData *pdata, struct CustomData *ldata, int total);
void CustomData_bmesh_init_pool(struct CustomData *data, int allocsize);

@ -36,6 +36,10 @@
#ifndef BKE_UTILDEFINES_H
#define BKE_UTILDEFINES_H
#ifdef __cplusplus
extern "C" {
#endif
/* these values need to be hardcoded in structs, dna does not recognize defines */
/* also defined in DNA_space_types.h */
#ifndef FILE_MAXDIR
@ -81,6 +85,8 @@
/* bit-row */
#define BROW(min, max) (((max)>=31? 0xFFFFFFFF: (1<<(max+1))-1) - ((min)? ((1<<(min))-1):0) )
#define BMEMSET(mem, val, size) {unsigned int _i; char *_c = (char*) mem; for (_i=0; _i<size; _i++) *_c++ = val;}
#ifdef __cplusplus
}
#endif
#endif // BKE_UTILDEFINES_H

@ -481,10 +481,10 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
fVerts[2] = SET_INT_IN_POINTER(mf->v3);
fVerts[3] = SET_INT_IN_POINTER(mf->v4);
// this is very bad, means mesh is internally consistent.
// it is not really possible to continue without modifying
// other parts of code significantly to handle missing faces.
// since this really shouldn't even be possible we just bail.
/* this is very bad, means mesh is internally inconsistent.
* it is not really possible to continue without modifying
* other parts of code significantly to handle missing faces.
* since this really shouldn't even be possible we just bail.*/
if(ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), fVerts[3] ? 4 : 3,
fVerts, &f) == eCCGError_InvalidValue) {
static int hasGivenError = 0;

@ -39,7 +39,7 @@
#define BLI_MATH_BASE_INLINE_H
/* A few small defines. Keep'em local! */
#define SMALL_NUMBER 1.e-8
#define SMALL_NUMBER 1.e-8f
MINLINE float sqrt3f(float f)
{
@ -106,7 +106,7 @@ MINLINE float interpf(float target, float origin, float fac)
* the distance gets very high, 180d would be inf, but this case isn't valid */
MINLINE float shell_angle_to_dist(const float angle)
{
return (angle < (float)SMALL_NUMBER) ? 1.0f : fabsf(1.0f / cosf(angle));
return (angle < SMALL_NUMBER) ? 1.0f : fabsf(1.0f / cosf(angle));
}
/* used for zoom values*/

@ -102,8 +102,11 @@ float ED_object_new_primitive_matrix(struct bContext *C, struct Object *editob,
void ED_object_add_generic_props(struct wmOperatorType *ot, int do_editmode);
int ED_object_add_generic_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
int ED_object_add_generic_get_opts(struct bContext *C, struct wmOperator *op, float *loc, float *rot, int *enter_editmode, unsigned int *layer);
struct Object *ED_object_add_type(struct bContext *C, int type, float *loc, float *rot, int enter_editmode, unsigned int layer);
int ED_object_add_generic_get_opts(struct bContext *C, struct wmOperator *op,
float *loc, float *rot, int *enter_editmode, unsigned int *layer);
struct Object *ED_object_add_type(struct bContext *C, int type, float *loc,
float *rot, int enter_editmode, unsigned int layer);
void ED_object_single_users(struct Main *bmain, struct Scene *scene, int full);
void ED_object_single_user(struct Scene *scene, struct Object *ob);

@ -244,7 +244,8 @@ int ED_object_add_generic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
return op->type->exec(C, op);
}
int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, float *rot, int *enter_editmode, unsigned int *layer)
int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc,
float *rot, int *enter_editmode, unsigned int *layer)
{
View3D *v3d = CTX_wm_view3d(C);
int a, layer_values[20];
@ -305,7 +306,8 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, floa
/* for object add primitive operators */
/* do not call undo push in this function (users of this function have to) */
Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot, int enter_editmode, unsigned int layer)
Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot,
int enter_editmode, unsigned int layer)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);

@ -99,6 +99,7 @@ int ED_vgroup_object_is_edit_mode(Object *ob)
bDeformGroup *ED_vgroup_add_name(Object *ob, const char *name)
{
bDeformGroup *defgroup;
if(!ob || !OB_TYPE_SUPPORT_VGROUP(ob->type))
return NULL;

@ -2473,7 +2473,8 @@ static void draw_dm_bweights(Scene *scene, DerivedMesh *dm)
/* EditMesh drawing routines*/
static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, DerivedMesh *cageDM, EditVert *eve_act)
static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit,
DerivedMesh *cageDM, EditVert *eve_act)
{
ToolSettings *ts= scene->toolsettings;
int sel;
@ -2530,7 +2531,9 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, Deriv
glPointSize(1.0);
}
static void draw_em_fancy_edges(Scene *scene, View3D *v3d, Mesh *me, DerivedMesh *cageDM, short sel_only, EditEdge *eed_act)
static void draw_em_fancy_edges(Scene *scene, View3D *v3d,
Mesh *me, DerivedMesh *cageDM, short sel_only,
EditEdge *eed_act)
{
ToolSettings *ts= scene->toolsettings;
int pass;
@ -2588,7 +2591,8 @@ static void draw_em_fancy_edges(Scene *scene, View3D *v3d, Mesh *me, DerivedMesh
}
}
static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, EditMesh *em, UnitSettings *unit)
static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d,
Object *ob, EditMesh *em, UnitSettings *unit)
{
Mesh *me= ob->data;
EditEdge *eed;
@ -2799,11 +2803,11 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
if(CHECK_OB_DRAWTEXTURE(v3d, dt)) {
if(draw_glsl_material(scene, ob, v3d, dt)) {
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
finalDM->drawMappedFacesGLSL(finalDM, GPU_enable_material,
draw_em_fancy__setGLSLFaceOpts, NULL);
draw_em_fancy__setGLSLFaceOpts, em);
GPU_disable_material();
glFrontFace(GL_CCW);
}
else {
@ -2814,12 +2818,11 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
/* 3 floats for position,
* 3 for normal and times two because the faces may actually be quads instead of triangles */
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED);
glEnable(GL_LIGHTING);
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, GPU_enable_material, NULL, NULL, 0);
glFrontFace(GL_CCW);
glDisable(GL_LIGHTING);
}
@ -2908,7 +2911,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
if(me->drawflag & ME_DRAWBWEIGHTS) {
draw_dm_bweights(scene, cageDM);
}
draw_em_fancy_edges(scene, v3d, me, cageDM, 0, eed_act);
}
if(em) {
@ -6904,7 +6907,8 @@ static void bbs_mesh_solid__drawCenter(void *UNUSED(userData), int index, float
}
/* two options, facecolors or black */
static void bbs_mesh_solid_EM(Scene *scene, View3D *v3d, Object *ob, DerivedMesh *dm, int facecol)
static void bbs_mesh_solid_EM(Scene *scene, View3D *v3d,
Object *ob, DerivedMesh *dm, int facecol)
{
cpack(0);

@ -283,16 +283,16 @@ static char *view3d_modeselect_pup(Scene *scene)
BLI_strncpy(str, title, sizeof(string));
str += modeselect_addmode(str, N_("Object Mode"), OB_MODE_OBJECT, ICON_OBJECT_DATA);
if(ob==NULL || ob->data==NULL) return string;
if(ob->id.lib) return string;
if(!((ID *)ob->data)->lib) {
/* if active object is editable */
if ( ((ob->type == OB_MESH)
|| (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT)
|| (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) {
str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
}
else if (ob->type == OB_ARMATURE) {
@ -310,7 +310,7 @@ static char *view3d_modeselect_pup(Scene *scene)
str += modeselect_addmode(str, N_("Weight Paint"), OB_MODE_WEIGHT_PAINT, ICON_WPAINT_HLT);
}
}
/* if active object is an armature */
if (ob->type==OB_ARMATURE) {
str += modeselect_addmode(str, N_("Pose Mode"), OB_MODE_POSE, ICON_POSE_HLT);
@ -485,10 +485,12 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
uiBlockSetEmboss(block, UI_EMBOSS);
/* mode */
if(ob)
if(ob) {
v3d->modeselect = ob->mode;
else
}
else {
v3d->modeselect = OB_MODE_OBJECT;
}
row= uiLayoutRow(layout, 1);
uiDefIconTextButS(block, MENU, B_MODESELECT, object_mode_icon(v3d->modeselect), view3d_modeselect_pup(scene) ,

@ -1552,7 +1552,7 @@ void calculateCenter(TransInfo *t)
if(t->obedit->type == OB_MESH) {
EditSelection ese;
EditMesh *em = BKE_mesh_get_editmesh(t->obedit->data);
if (EM_get_actSelection(em, &ese)) {
EM_editselection_center(t->center, &ese);
calculateCenter2D(t);
@ -1570,7 +1570,7 @@ void calculateCenter(TransInfo *t)
}
}
} /* END EDIT MODE ACTIVE ELEMENT */
calculateCenterMedian(t);
if((t->flag & (T_EDIT|T_POSE))==0)
{

@ -135,7 +135,7 @@ typedef struct Object {
/* materials */
struct Material **mat; /* material slots */
char *matbits; /* 1 if material linked to object */
char *matbits; /* a boolean field, with each byte 1 if corrusponding material is linked to object */
int totcol; /* copy of mesh or curve or meta */
int actcol; /* currently selected material in the UI */