corrections for redundant null checks & transform printing a string into its self.
This commit is contained in:
@@ -3030,7 +3030,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
|
||||
|
||||
psys->totcached = totpart;
|
||||
|
||||
if(psys && psys->lattice){
|
||||
if(psys->lattice){
|
||||
end_latt_deform(psys->lattice);
|
||||
psys->lattice= NULL;
|
||||
}
|
||||
|
||||
@@ -1382,7 +1382,7 @@ static void ptcache_find_frames_around(PTCacheID *pid, unsigned int frame, int *
|
||||
}
|
||||
}
|
||||
|
||||
if(pm && !pm2) {
|
||||
if(!pm2) {
|
||||
*fra1 = 0;
|
||||
*fra2 = pm->frame;
|
||||
}
|
||||
@@ -1844,7 +1844,8 @@ static int ptcache_write(PTCacheID *pid, int cfra, int overwrite)
|
||||
if(cache->flag & PTCACHE_DISK_CACHE) {
|
||||
error += !ptcache_mem_frame_to_disk(pid, pm);
|
||||
|
||||
if(pm) {
|
||||
// if(pm) /* pm is always set */
|
||||
{
|
||||
ptcache_data_free(pm);
|
||||
ptcache_extra_free(pm);
|
||||
MEM_freeN(pm);
|
||||
|
||||
@@ -1234,7 +1234,6 @@ void make_editNurb(Object *obedit)
|
||||
Nurb *nu, *newnu, *nu_act= NULL;
|
||||
KeyBlock *actkey;
|
||||
|
||||
if(obedit==NULL) return;
|
||||
|
||||
set_actNurb(obedit, NULL);
|
||||
|
||||
@@ -1591,7 +1590,7 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
|
||||
BPoint *bp, *bpn, *newbp;
|
||||
int a, b, newu, newv, sel;
|
||||
|
||||
if(obedit && obedit->type==OB_SURF);
|
||||
if(obedit->type==OB_SURF);
|
||||
else return OPERATOR_CANCELLED;
|
||||
|
||||
cu->lastsel= NULL;
|
||||
|
||||
@@ -765,8 +765,6 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol)
|
||||
//float alpha;
|
||||
GLint scissor[4];
|
||||
|
||||
if (hist==NULL) { printf("hist is null \n"); return; }
|
||||
|
||||
rect.xmin = (float)recti->xmin+1;
|
||||
rect.xmax = (float)recti->xmax-1;
|
||||
rect.ymin = (float)recti->ymin+SCOPE_RESIZE_PAD+2;
|
||||
|
||||
@@ -484,11 +484,8 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode)
|
||||
*/
|
||||
for (ce= ked.list.first; ce; ce= ce->next) {
|
||||
/* set frame for validation callback to refer to */
|
||||
if (ale)
|
||||
ked.f1= BKE_nla_tweakedit_remap(adt, ce->cfra, NLATIME_CONVERT_UNMAP);
|
||||
else
|
||||
ked.f1= ce->cfra;
|
||||
|
||||
ked.f1= BKE_nla_tweakedit_remap(adt, ce->cfra, NLATIME_CONVERT_UNMAP);
|
||||
|
||||
/* select elements with frame number matching cfraelem */
|
||||
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL);
|
||||
}
|
||||
|
||||
@@ -49,15 +49,15 @@
|
||||
#include "time_intern.h"
|
||||
|
||||
/* ****************** Start/End Frame Operators *******************************/
|
||||
|
||||
static int time_set_sfra_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
int frame= CFRA;
|
||||
|
||||
int frame;
|
||||
|
||||
if (scene == NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
|
||||
frame= CFRA;
|
||||
/* if 'end frame' (Preview Range or Actual) is less than 'frame',
|
||||
* clamp 'frame' to 'end frame'
|
||||
*/
|
||||
@@ -93,11 +93,13 @@ static void TIME_OT_start_frame_set (wmOperatorType *ot)
|
||||
static int time_set_efra_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
int frame= CFRA;
|
||||
|
||||
int frame;
|
||||
|
||||
if (scene == NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
|
||||
frame= CFRA;
|
||||
|
||||
/* if 'start frame' (Preview Range or Actual) is greater than 'frame',
|
||||
* clamp 'frame' to 'end frame'
|
||||
*/
|
||||
|
||||
@@ -3151,7 +3151,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3])
|
||||
|
||||
int Rotation(TransInfo *t, const short UNUSED(mval[2]))
|
||||
{
|
||||
char str[128];
|
||||
char str[128], *spos= str;
|
||||
|
||||
float final;
|
||||
|
||||
@@ -3177,18 +3177,20 @@ int Rotation(TransInfo *t, const short UNUSED(mval[2]))
|
||||
|
||||
outputNumInput(&(t->num), c);
|
||||
|
||||
sprintf(str, "Rot: %s %s %s", &c[0], t->con.text, t->proptext);
|
||||
spos+= sprintf(spos, "Rot: %s %s %s", &c[0], t->con.text, t->proptext);
|
||||
|
||||
/* Clamp between -180 and 180 */
|
||||
final= angle_wrap_rad(DEG2RADF(final));
|
||||
}
|
||||
else {
|
||||
sprintf(str, "Rot: %.2f%s %s", RAD2DEGF(final), t->con.text, t->proptext);
|
||||
spos += sprintf(spos, "Rot: %.2f%s %s", RAD2DEGF(final), t->con.text, t->proptext);
|
||||
}
|
||||
|
||||
if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED))
|
||||
sprintf(str, "%s Proportional size: %.2f", str, t->prop_size);
|
||||
|
||||
if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) {
|
||||
spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
|
||||
}
|
||||
(void)spos;
|
||||
|
||||
t->values[0] = final;
|
||||
|
||||
applyRotation(t, final, t->axis);
|
||||
@@ -3257,7 +3259,7 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a
|
||||
|
||||
int Trackball(TransInfo *t, const short UNUSED(mval[2]))
|
||||
{
|
||||
char str[128];
|
||||
char str[128], *spos= str;
|
||||
float axis1[3], axis2[3];
|
||||
float mat[3][3], totmat[3][3], smat[3][3];
|
||||
float phi[2];
|
||||
@@ -3281,15 +3283,20 @@ int Trackball(TransInfo *t, const short UNUSED(mval[2]))
|
||||
|
||||
outputNumInput(&(t->num), c);
|
||||
|
||||
sprintf(str, "Trackball: %s %s %s", &c[0], &c[20], t->proptext);
|
||||
spos += sprintf(spos, "Trackball: %s %s %s", &c[0], &c[20], t->proptext);
|
||||
|
||||
phi[0] = DEG2RADF(phi[0]);
|
||||
phi[1] = DEG2RADF(phi[1]);
|
||||
}
|
||||
else {
|
||||
sprintf(str, "Trackball: %.2f %.2f %s", RAD2DEGF(phi[0]), RAD2DEGF(phi[1]), t->proptext);
|
||||
spos += sprintf(spos, "Trackball: %.2f %.2f %s", RAD2DEGF(phi[0]), RAD2DEGF(phi[1]), t->proptext);
|
||||
}
|
||||
|
||||
if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) {
|
||||
spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
|
||||
}
|
||||
(void)spos;
|
||||
|
||||
vec_rot_to_mat3( smat,axis1, phi[0]);
|
||||
vec_rot_to_mat3( totmat,axis2, phi[1]);
|
||||
|
||||
@@ -3345,6 +3352,7 @@ void initTranslation(TransInfo *t)
|
||||
}
|
||||
|
||||
static void headerTranslation(TransInfo *t, float vec[3], char *str) {
|
||||
char *spos= str;
|
||||
char tvec[60];
|
||||
char distvec[20];
|
||||
char autoik[20];
|
||||
@@ -3395,24 +3403,26 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) {
|
||||
if (t->con.mode & CON_APPLY) {
|
||||
switch(t->num.idx_max) {
|
||||
case 0:
|
||||
sprintf(str, "D: %s (%s)%s %s %s", &tvec[0], distvec, t->con.text, t->proptext, &autoik[0]);
|
||||
spos += sprintf(spos, "D: %s (%s)%s %s %s", &tvec[0], distvec, t->con.text, t->proptext, &autoik[0]);
|
||||
break;
|
||||
case 1:
|
||||
sprintf(str, "D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext, &autoik[0]);
|
||||
spos += sprintf(spos, "D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext, &autoik[0]);
|
||||
break;
|
||||
case 2:
|
||||
sprintf(str, "D: %s D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
|
||||
spos += sprintf(spos, "D: %s D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(t->flag & T_2D_EDIT)
|
||||
sprintf(str, "Dx: %s Dy: %s (%s)%s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext);
|
||||
spos += sprintf(spos, "Dx: %s Dy: %s (%s)%s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext);
|
||||
else
|
||||
sprintf(str, "Dx: %s Dy: %s Dz: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
|
||||
spos += sprintf(spos, "Dx: %s Dy: %s Dz: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
|
||||
}
|
||||
|
||||
if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED))
|
||||
sprintf(str, "%s Proportional size: %.2f", str, t->prop_size);
|
||||
if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) {
|
||||
spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
|
||||
}
|
||||
(void)spos;
|
||||
}
|
||||
|
||||
static void applyTranslation(TransInfo *t, float vec[3]) {
|
||||
|
||||
@@ -1670,7 +1670,7 @@ static void removeDoublesPeel(ListBase *depth_peels)
|
||||
{
|
||||
DepthPeel *next_peel = peel->next;
|
||||
|
||||
if (peel && next_peel && ABS(peel->depth - next_peel->depth) < 0.0015f)
|
||||
if (next_peel && ABS(peel->depth - next_peel->depth) < 0.0015f)
|
||||
{
|
||||
peel->next = next_peel->next;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user