Merging r49105 through r49107 from trunk into soc-2011-tomato
This commit is contained in:
@@ -547,13 +547,32 @@ static uint quadMerge(std::map<MeshSet<3>::vertex_t*, uint> *vertexToIndex_map,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool Carve_checkDegeneratedFace(MeshSet<3>::face_t *face)
|
||||
static bool Carve_checkDegeneratedFace(std::map<MeshSet<3>::vertex_t*, uint> *vertexToIndex_map, MeshSet<3>::face_t *face)
|
||||
{
|
||||
/* only tris and quads for now */
|
||||
if (face->n_edges == 3) {
|
||||
uint v1, v2, v3;
|
||||
|
||||
v1 = vertexToIndex_map->find(face->edge->prev->vert)->second;
|
||||
v2 = vertexToIndex_map->find(face->edge->vert)->second;
|
||||
v3 = vertexToIndex_map->find(face->edge->next->vert)->second;
|
||||
|
||||
if (v1 == v2 || v2 == v3 || v1 == v3)
|
||||
return true;
|
||||
|
||||
return triangleArea(face->edge->prev->vert->v, face->edge->vert->v, face->edge->next->vert->v) < DBL_EPSILON;
|
||||
}
|
||||
else if (face->n_edges == 4) {
|
||||
uint v1, v2, v3, v4;
|
||||
|
||||
v1 = vertexToIndex_map->find(face->edge->prev->vert)->second;
|
||||
v2 = vertexToIndex_map->find(face->edge->vert)->second;
|
||||
v3 = vertexToIndex_map->find(face->edge->next->vert)->second;
|
||||
v4 = vertexToIndex_map->find(face->edge->next->next->vert)->second;
|
||||
|
||||
if (v1 == v2 || v1 == v3 || v1 == v4 || v2 == v3 || v2 == v4 || v3 == v4)
|
||||
return true;
|
||||
|
||||
return triangleArea(face->edge->vert->v, face->edge->next->vert->v, face->edge->next->next->vert->v) +
|
||||
triangleArea(face->edge->prev->vert->v, face->edge->vert->v, face->edge->next->next->vert->v) < DBL_EPSILON;
|
||||
}
|
||||
@@ -595,8 +614,14 @@ static BSP_CSGMesh *Carve_exportMesh(MeshSet<3>* &poly, carve::interpolate::Face
|
||||
MeshSet<3>::face_iter face_iter = poly->faceBegin();
|
||||
for (i = 0; face_iter != poly->faceEnd(); ++face_iter, ++i) {
|
||||
MeshSet<3>::face_t *f = *face_iter;
|
||||
|
||||
if (Carve_checkDegeneratedFace(&vertexToIndex_map, f))
|
||||
continue;
|
||||
|
||||
ofaces[oface_num.getAttribute(f)].push_back(i);
|
||||
|
||||
MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin();
|
||||
|
||||
for (; edge_iter != f->end(); ++edge_iter) {
|
||||
int index = vertexToIndex_map[edge_iter->vert];
|
||||
vi[index].push_back(i);
|
||||
@@ -659,36 +684,27 @@ static BSP_CSGMesh *Carve_exportMesh(MeshSet<3>* &poly, carve::interpolate::Face
|
||||
}
|
||||
}
|
||||
|
||||
bool degenerativeFace = false;
|
||||
// add all information except vertices to the output mesh
|
||||
outputMesh->FaceSet().push_back(BSP_MFace());
|
||||
BSP_MFace& outFace = outputMesh->FaceSet().back();
|
||||
outFace.m_verts.clear();
|
||||
outFace.m_plane.setValue(f->plane.N.v);
|
||||
outFace.m_orig_face = orig;
|
||||
|
||||
if (!result) {
|
||||
/* merged triangles are already checked for degenerative quad */
|
||||
degenerativeFace = Carve_checkDegeneratedFace(f);
|
||||
}
|
||||
|
||||
if (!degenerativeFace) {
|
||||
// add all information except vertices to the output mesh
|
||||
outputMesh->FaceSet().push_back(BSP_MFace());
|
||||
BSP_MFace& outFace = outputMesh->FaceSet().back();
|
||||
outFace.m_verts.clear();
|
||||
outFace.m_plane.setValue(f->plane.N.v);
|
||||
outFace.m_orig_face = orig;
|
||||
|
||||
// if we merged faces, use the list of common vertices; otherwise
|
||||
// use the faces's vertices
|
||||
if (result) {
|
||||
// make quat using verts stored in result
|
||||
outFace.m_verts.push_back(quadverts[0]);
|
||||
outFace.m_verts.push_back(quadverts[1]);
|
||||
outFace.m_verts.push_back(quadverts[2]);
|
||||
outFace.m_verts.push_back(quadverts[3]);
|
||||
} else {
|
||||
MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin();
|
||||
for (; edge_iter != f->end(); ++edge_iter) {
|
||||
//int index = ofacevert_num.getAttribute(f, edge_iter.idx());
|
||||
int index = vertexToIndex_map[edge_iter->vert];
|
||||
outFace.m_verts.push_back( index );
|
||||
}
|
||||
// if we merged faces, use the list of common vertices; otherwise
|
||||
// use the faces's vertices
|
||||
if (result) {
|
||||
// make quat using verts stored in result
|
||||
outFace.m_verts.push_back(quadverts[0]);
|
||||
outFace.m_verts.push_back(quadverts[1]);
|
||||
outFace.m_verts.push_back(quadverts[2]);
|
||||
outFace.m_verts.push_back(quadverts[3]);
|
||||
} else {
|
||||
MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin();
|
||||
for (; edge_iter != f->end(); ++edge_iter) {
|
||||
//int index = ofacevert_num.getAttribute(f, edge_iter.idx());
|
||||
int index = vertexToIndex_map[edge_iter->vert];
|
||||
outFace.m_verts.push_back( index );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1164,8 +1164,8 @@ void mat3_to_compatible_eul(float eul[3], const float oldrot[3], float mat[][3])
|
||||
compatible_eul(eul1, oldrot);
|
||||
compatible_eul(eul2, oldrot);
|
||||
|
||||
d1 = (float)fabsf(eul1[0] - oldrot[0]) + (float)fabsf(eul1[1] - oldrot[1]) + (float)fabsf(eul1[2] - oldrot[2]);
|
||||
d2 = (float)fabsf(eul2[0] - oldrot[0]) + (float)fabsf(eul2[1] - oldrot[1]) + (float)fabsf(eul2[2] - oldrot[2]);
|
||||
d1 = fabsf(eul1[0] - oldrot[0]) + fabsf(eul1[1] - oldrot[1]) + fabsf(eul1[2] - oldrot[2]);
|
||||
d2 = fabsf(eul2[0] - oldrot[0]) + fabsf(eul2[1] - oldrot[1]) + fabsf(eul2[2] - oldrot[2]);
|
||||
|
||||
/* return best, which is just the one with lowest difference */
|
||||
if (d1 > d2) {
|
||||
|
||||
@@ -2243,8 +2243,12 @@ void ui_check_but(uiBut *but)
|
||||
UI_GET_BUT_VALUE_INIT(but, value);
|
||||
|
||||
if (ui_is_but_float(but)) {
|
||||
if (value == (double) FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str);
|
||||
else if (value == (double) -FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str);
|
||||
if (value == (double) FLT_MAX) {
|
||||
BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str);
|
||||
}
|
||||
else if (value == (double) -FLT_MAX) {
|
||||
BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str);
|
||||
}
|
||||
/* support length type buttons */
|
||||
else if (ui_is_but_unit(but)) {
|
||||
char new_str[sizeof(but->drawstr)];
|
||||
@@ -2550,7 +2554,9 @@ void ui_block_do_align(uiBlock *block)
|
||||
* - \a a2 Number of decimal point values to display. 0 defaults to 3 (0.000)
|
||||
* 1,2,3, and a maximum of 4, all greater values will be clamped to 4.
|
||||
*/
|
||||
static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
|
||||
int x1, int y1, short x2, short y2,
|
||||
void *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
uiBut *but;
|
||||
int slen;
|
||||
@@ -2622,10 +2628,14 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
|
||||
}
|
||||
}
|
||||
|
||||
if ((block->flag & UI_BLOCK_LOOP) || ELEM8(but->type, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR))
|
||||
if ((block->flag & UI_BLOCK_LOOP) ||
|
||||
ELEM8(but->type, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR))
|
||||
{
|
||||
but->flag |= (UI_TEXT_LEFT | UI_ICON_LEFT);
|
||||
else if (but->type == BUT_TOGDUAL)
|
||||
}
|
||||
else if (but->type == BUT_TOGDUAL) {
|
||||
but->flag |= UI_ICON_LEFT;
|
||||
}
|
||||
|
||||
but->flag |= (block->flag & UI_BUT_ALIGN);
|
||||
|
||||
@@ -2670,7 +2680,10 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
|
||||
but->lockstr = ""
|
||||
|
||||
|
||||
static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip)
|
||||
static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str,
|
||||
int x1, int y1, short x2, short y2,
|
||||
PointerRNA *ptr, PropertyRNA *prop, int index,
|
||||
float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
const PropertyType proptype = RNA_property_type(prop);
|
||||
uiBut *but;
|
||||
|
||||
@@ -861,7 +861,8 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage *prv_img, enum eIco
|
||||
prv_img->w[size], prv_img->h[size]);
|
||||
}
|
||||
|
||||
static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, const float rgb[3], short is_preview)
|
||||
static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh,
|
||||
unsigned int *rect, float alpha, const float rgb[3], short is_preview)
|
||||
{
|
||||
ImBuf *ima = NULL;
|
||||
|
||||
@@ -914,7 +915,8 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
|
||||
}
|
||||
}
|
||||
|
||||
static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, int UNUSED(iw), int ih, float alpha, const float rgb[3])
|
||||
static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy,
|
||||
int UNUSED(iw), int ih, float alpha, const float rgb[3])
|
||||
{
|
||||
float x1, x2, y1, y2;
|
||||
|
||||
@@ -957,7 +959,8 @@ static int get_draw_size(enum eIconSizes size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, const float rgb[3], enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview)
|
||||
static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, const float rgb[3],
|
||||
enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview)
|
||||
{
|
||||
bTheme *btheme = UI_GetTheme();
|
||||
Icon *icon = NULL;
|
||||
|
||||
@@ -1213,7 +1213,8 @@ void UI_GetColorPtrShade3ubv(const unsigned char cp[3], unsigned char col[3], in
|
||||
}
|
||||
|
||||
// get a 3 byte color, blended and shaded between two other char color pointers
|
||||
void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset)
|
||||
void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3],
|
||||
float fac, int offset)
|
||||
{
|
||||
int r, g, b;
|
||||
|
||||
@@ -1740,7 +1741,8 @@ void init_userdef_do_versions(void)
|
||||
}
|
||||
|
||||
if (bmain->versionfile < 257) {
|
||||
/* clear "AUTOKEY_FLAG_ONLYKEYINGSET" flag from userprefs, so that it doesn't linger around from old configs like a ghost */
|
||||
/* clear "AUTOKEY_FLAG_ONLYKEYINGSET" flag from userprefs,
|
||||
* so that it doesn't linger around from old configs like a ghost */
|
||||
U.autokey_flag &= ~AUTOKEY_FLAG_ONLYKEYINGSET;
|
||||
}
|
||||
|
||||
|
||||
@@ -499,15 +499,15 @@ static void VIEW2D_OT_scroll_up(wmOperatorType *ot)
|
||||
/* ********************************************************* */
|
||||
/* SINGLE-STEP VIEW ZOOMING OPERATOR */
|
||||
|
||||
/* This group of operators come in several forms:
|
||||
* 1) Scrollwheel 'steps' - rolling mousewheel by one step zooms view by predefined amount
|
||||
* 2) Scrollwheel 'steps' + alt + ctrl/shift - zooms view on one axis only (ctrl=x, shift=y) // XXX this could be implemented...
|
||||
* 3) Pad +/- Keys - pressing each key moves the zooms the view by a predefined amount
|
||||
/* This group of operators come in several forms:
|
||||
* 1) Scrollwheel 'steps' - rolling mousewheel by one step zooms view by predefined amount
|
||||
* 2) Scrollwheel 'steps' + alt + ctrl/shift - zooms view on one axis only (ctrl=x, shift=y) // XXX this could be implemented...
|
||||
* 3) Pad +/- Keys - pressing each key moves the zooms the view by a predefined amount
|
||||
*
|
||||
* In order to make sure this works, each operator must define the following RNA-Operator Props:
|
||||
* zoomfacx, zoomfacy - These two zoom factors allow for non-uniform scaling.
|
||||
* It is safe to scale by 0, as these factors are used to determine
|
||||
* amount to enlarge 'cur' by
|
||||
* In order to make sure this works, each operator must define the following RNA-Operator Props:
|
||||
* zoomfacx, zoomfacy - These two zoom factors allow for non-uniform scaling.
|
||||
* It is safe to scale by 0, as these factors are used to determine
|
||||
* amount to enlarge 'cur' by
|
||||
*/
|
||||
|
||||
/* ------------------ 'Shared' stuff ------------------------ */
|
||||
|
||||
Reference in New Issue
Block a user