code cleanup: remove some paranoid checks which would have crashed anyway earlier on.

Also some minor formatting.
This commit is contained in:
Campbell Barton
2013-01-20 14:50:50 +00:00
parent 160dd1dc3b
commit f414d2980a
9 changed files with 30 additions and 22 deletions

View File

@@ -106,7 +106,7 @@ __device float3 primitive_tangent(KernelGlobals *kg, ShaderData *sd)
float3 data = primitive_attribute_float3(kg, sd, attr_elem, attr_offset, NULL, NULL); float3 data = primitive_attribute_float3(kg, sd, attr_elem, attr_offset, NULL, NULL);
data = make_float3(-(data.y - 0.5f), (data.x - 0.5f), 0.0f); data = make_float3(-(data.y - 0.5f), (data.x - 0.5f), 0.0f);
object_normal_transform(kg, sd, &data); object_normal_transform(kg, sd, &data);
return cross(sd->N, normalize(cross(data, sd->N)));; return cross(sd->N, normalize(cross(data, sd->N)));
} }
else { else {
/* otherwise use surface derivatives */ /* otherwise use surface derivatives */

View File

@@ -90,7 +90,7 @@ public:
Transform worldtocamera; Transform worldtocamera;
Transform rastertocamera; Transform rastertocamera;
Transform cameratoraster;; Transform cameratoraster;
float3 dx; float3 dx;
float3 dy; float3 dy;

View File

@@ -144,7 +144,7 @@ ImageTextureNode::ImageTextureNode()
filename = ""; filename = "";
is_builtin = false; is_builtin = false;
color_space = ustring("Color"); color_space = ustring("Color");
projection = ustring("Flat");; projection = ustring("Flat");
projection_blend = 0.0f; projection_blend = 0.0f;
animated = false; animated = false;

View File

@@ -182,7 +182,8 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
(SInt32) this); // Store a pointer to the class in the refCon (SInt32) this); // Store a pointer to the class in the refCon
#endif #endif
//GHOST_PRINT("GHOST_WindowCarbon::GHOST_WindowCarbon(): creating full-screen OpenGL context\n"); //GHOST_PRINT("GHOST_WindowCarbon::GHOST_WindowCarbon(): creating full-screen OpenGL context\n");
setDrawingContextType(GHOST_kDrawingContextTypeOpenGL);; installDrawingContext(GHOST_kDrawingContextTypeOpenGL); setDrawingContextType(GHOST_kDrawingContextTypeOpenGL);
installDrawingContext(GHOST_kDrawingContextTypeOpenGL);
updateDrawingContext(); updateDrawingContext();
activateDrawingContext(); activateDrawingContext();

View File

@@ -1416,18 +1416,25 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
float no[3]; float no[3];
for (S = 0; S < f->numVerts; S++) { for (S = 0; S < f->numVerts; S++) {
for (y = 0; y < gridSize - 1; y++) for (y = 0; y < gridSize - 1; y++) {
for (x = 0; x < gridSize - 1; x++) for (x = 0; x < gridSize - 1; x++) {
NormZero(FACE_getIFNo(f, lvl, S, x, y)); NormZero(FACE_getIFNo(f, lvl, S, x, y));
}
}
if (FACE_getEdges(f)[(S - 1 + f->numVerts) % f->numVerts]->flags & Edge_eEffected) if (FACE_getEdges(f)[(S - 1 + f->numVerts) % f->numVerts]->flags & Edge_eEffected) {
for (x = 0; x < gridSize - 1; x++) for (x = 0; x < gridSize - 1; x++) {
NormZero(FACE_getIFNo(f, lvl, S, x, gridSize - 1)); NormZero(FACE_getIFNo(f, lvl, S, x, gridSize - 1));
if (FACE_getEdges(f)[S]->flags & Edge_eEffected) }
for (y = 0; y < gridSize - 1; y++) }
if (FACE_getEdges(f)[S]->flags & Edge_eEffected) {
for (y = 0; y < gridSize - 1; y++) {
NormZero(FACE_getIFNo(f, lvl, S, gridSize - 1, y)); NormZero(FACE_getIFNo(f, lvl, S, gridSize - 1, y));
if (FACE_getVerts(f)[S]->flags & Vert_eEffected) }
}
if (FACE_getVerts(f)[S]->flags & Vert_eEffected) {
NormZero(FACE_getIFNo(f, lvl, S, gridSize - 1, gridSize - 1)); NormZero(FACE_getIFNo(f, lvl, S, gridSize - 1, gridSize - 1));
}
} }
for (S = 0; S < f->numVerts; S++) { for (S = 0; S < f->numVerts; S++) {

View File

@@ -308,8 +308,9 @@ static void ptcache_particle_read(int index, void *psys_v, void **data, float cf
pa->lifetime = times[2]; pa->lifetime = times[2];
} }
if (boid) if (boid) {
PTCACHE_DATA_TO(data, BPHYS_DATA_BOIDS, 0, &boid->data); PTCACHE_DATA_TO(data, BPHYS_DATA_BOIDS, 0, &boid->data);
}
/* determine velocity from previous location */ /* determine velocity from previous location */
if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_VELOCITY]) { if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_VELOCITY]) {

View File

@@ -517,7 +517,7 @@ static void bm_edge_collapse_loop_customdata(BMesh *bm, BMLoop *l, BMVert *v_cle
const int type = bm->ldata.layers[i].type; const int type = bm->ldata.layers[i].type;
void *cd_src[2] = {(char *)src[0] + offset, void *cd_src[2] = {(char *)src[0] + offset,
(char *)src[1] + offset}; (char *)src[1] + offset};
void *cd_iter = (char *)l_iter->head.data + offset;; void *cd_iter = (char *)l_iter->head.data + offset;
/* detect seams */ /* detect seams */
if (CustomData_data_equals(type, cd_src[0], cd_iter)) { if (CustomData_data_equals(type, cd_src[0], cd_iter)) {

View File

@@ -2598,9 +2598,8 @@ static int set_vpaint(bContext *C, wmOperator *op) /* toggle */
BKE_paint_init(&vp->paint, PAINT_CURSOR_VERTEX_PAINT); BKE_paint_init(&vp->paint, PAINT_CURSOR_VERTEX_PAINT);
} }
if (me) /* update modifier stack for mapping requirements */
/* update modifier stack for mapping requirements */ DAG_id_tag_update(&me->id, 0);
DAG_id_tag_update(&me->id, 0);
WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene); WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene);

View File

@@ -1505,7 +1505,7 @@ int RNA_property_path_from_ID_check(PointerRNA *ptr, PropertyRNA *prop)
static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop) static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
{ {
int is_rna = (prop->magic == RNA_MAGIC); const bool is_rna = (prop->magic == RNA_MAGIC);
prop = rna_ensure_property(prop); prop = rna_ensure_property(prop);
if (is_rna) { if (is_rna) {
@@ -1585,19 +1585,19 @@ static ListBase rna_updates_cache = {NULL, NULL};
void RNA_property_update_cache_add(PointerRNA *ptr, PropertyRNA *prop) void RNA_property_update_cache_add(PointerRNA *ptr, PropertyRNA *prop)
{ {
const bool is_rna = (prop->magic == RNA_MAGIC);
tRnaUpdateCacheElem *uce = NULL; tRnaUpdateCacheElem *uce = NULL;
UpdateFunc fn = NULL; UpdateFunc fn = NULL;
LinkData *ld; LinkData *ld;
short is_rna = (prop->magic == RNA_MAGIC);
/* sanity check */ /* sanity check */
if (ELEM(NULL, ptr, prop)) if (NULL == ptr)
return; return;
prop = rna_ensure_property(prop); prop = rna_ensure_property(prop);
/* we can only handle update calls with no context args for now (makes animsys updates easier) */ /* we can only handle update calls with no context args for now (makes animsys updates easier) */
if ((is_rna == 0) || (prop->update == NULL) || (prop->flag & PROP_CONTEXT_UPDATE)) if ((is_rna == false) || (prop->update == NULL) || (prop->flag & PROP_CONTEXT_UPDATE))
return; return;
fn = prop->update; fn = prop->update;
@@ -4210,11 +4210,11 @@ char *RNA_path_from_ID_to_struct(PointerRNA *ptr)
char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop) char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop)
{ {
int is_rna = (prop->magic == RNA_MAGIC); const bool is_rna = (prop->magic == RNA_MAGIC);
const char *propname; const char *propname;
char *ptrpath, *path; char *ptrpath, *path;
if (!ptr->id.data || !ptr->data || !prop) if (!ptr->id.data || !ptr->data)
return NULL; return NULL;
/* path from ID to the struct holding this property */ /* path from ID to the struct holding this property */