forked from bartvdbraak/blender
Code Cleanup: style and redundant casts
This commit is contained in:
parent
bb1a7e4d87
commit
af93ebcb50
@ -21,12 +21,16 @@
|
|||||||
* Windows-posix compatibility layer for opendir/readdir/closedir
|
* Windows-posix compatibility layer for opendir/readdir/closedir
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \file blender/blenlib/intern/winstuff.c
|
/** \file blender/blenlib/intern/winstuff_dir.c
|
||||||
* \ingroup bli
|
* \ingroup bli
|
||||||
|
*
|
||||||
|
* Posix compatibility functions for windows dealing with DIR
|
||||||
|
* (opendir, readdir, closedir)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(FREE_WINDOWS)
|
#if defined(WIN32) && !defined(FREE_WINDOWS)
|
||||||
|
|
||||||
|
/* standalone for inclusion in binaries other then blender */
|
||||||
# ifdef USE_STANDALONE
|
# ifdef USE_STANDALONE
|
||||||
# define MEM_mallocN(size, str) ((void)str, malloc(size))
|
# define MEM_mallocN(size, str) ((void)str, malloc(size))
|
||||||
# define MEM_callocN(size, str) ((void)str, calloc(size, 1))
|
# define MEM_callocN(size, str) ((void)str, calloc(size, 1))
|
||||||
|
@ -113,10 +113,11 @@ static void constraint_bone_name_fix(Object *ob, ListBase *conlist, const char *
|
|||||||
|
|
||||||
for (ct = targets.first; ct; ct = ct->next) {
|
for (ct = targets.first; ct; ct = ct->next) {
|
||||||
if (ct->tar == ob) {
|
if (ct->tar == ob) {
|
||||||
if (!strcmp(ct->subtarget, oldname) )
|
if (STREQ(ct->subtarget, oldname)) {
|
||||||
BLI_strncpy(ct->subtarget, newname, MAXBONENAME);
|
BLI_strncpy(ct->subtarget, newname, MAXBONENAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (cti->flush_constraint_targets)
|
if (cti->flush_constraint_targets)
|
||||||
cti->flush_constraint_targets(curcon, &targets, 0);
|
cti->flush_constraint_targets(curcon, &targets, 0);
|
||||||
|
@ -823,17 +823,17 @@ void UI_view2d_curRect_reset(View2D *v2d)
|
|||||||
/* handle width - posx and negx flags are mutually exclusive, so watch out */
|
/* handle width - posx and negx flags are mutually exclusive, so watch out */
|
||||||
if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) {
|
if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) {
|
||||||
/* width is in negative-x half */
|
/* width is in negative-x half */
|
||||||
v2d->cur.xmin = (float)-width;
|
v2d->cur.xmin = -width;
|
||||||
v2d->cur.xmax = 0.0f;
|
v2d->cur.xmax = 0.0f;
|
||||||
}
|
}
|
||||||
else if ((v2d->align & V2D_ALIGN_NO_NEG_X) && !(v2d->align & V2D_ALIGN_NO_POS_X)) {
|
else if ((v2d->align & V2D_ALIGN_NO_NEG_X) && !(v2d->align & V2D_ALIGN_NO_POS_X)) {
|
||||||
/* width is in positive-x half */
|
/* width is in positive-x half */
|
||||||
v2d->cur.xmin = 0.0f;
|
v2d->cur.xmin = 0.0f;
|
||||||
v2d->cur.xmax = (float)width;
|
v2d->cur.xmax = width;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* width is centered around (x == 0) */
|
/* width is centered around (x == 0) */
|
||||||
const float dx = (float)width / 2.0f;
|
const float dx = width / 2.0f;
|
||||||
|
|
||||||
v2d->cur.xmin = -dx;
|
v2d->cur.xmin = -dx;
|
||||||
v2d->cur.xmax = dx;
|
v2d->cur.xmax = dx;
|
||||||
@ -842,17 +842,17 @@ void UI_view2d_curRect_reset(View2D *v2d)
|
|||||||
/* handle height - posx and negx flags are mutually exclusive, so watch out */
|
/* handle height - posx and negx flags are mutually exclusive, so watch out */
|
||||||
if ((v2d->align & V2D_ALIGN_NO_POS_Y) && !(v2d->align & V2D_ALIGN_NO_NEG_Y)) {
|
if ((v2d->align & V2D_ALIGN_NO_POS_Y) && !(v2d->align & V2D_ALIGN_NO_NEG_Y)) {
|
||||||
/* height is in negative-y half */
|
/* height is in negative-y half */
|
||||||
v2d->cur.ymin = (float)-height;
|
v2d->cur.ymin = -height;
|
||||||
v2d->cur.ymax = 0.0f;
|
v2d->cur.ymax = 0.0f;
|
||||||
}
|
}
|
||||||
else if ((v2d->align & V2D_ALIGN_NO_NEG_Y) && !(v2d->align & V2D_ALIGN_NO_POS_Y)) {
|
else if ((v2d->align & V2D_ALIGN_NO_NEG_Y) && !(v2d->align & V2D_ALIGN_NO_POS_Y)) {
|
||||||
/* height is in positive-y half */
|
/* height is in positive-y half */
|
||||||
v2d->cur.ymin = 0.0f;
|
v2d->cur.ymin = 0.0f;
|
||||||
v2d->cur.ymax = (float)height;
|
v2d->cur.ymax = height;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* height is centered around (y == 0) */
|
/* height is centered around (y == 0) */
|
||||||
const float dy = (float)height / 2.0f;
|
const float dy = height / 2.0f;
|
||||||
|
|
||||||
v2d->cur.ymin = -dy;
|
v2d->cur.ymin = -dy;
|
||||||
v2d->cur.ymax = dy;
|
v2d->cur.ymax = dy;
|
||||||
|
@ -307,7 +307,7 @@ void OUTLINER_OT_item_rename(wmOperatorType *ot)
|
|||||||
|
|
||||||
/* Apply Settings ------------------------------- */
|
/* Apply Settings ------------------------------- */
|
||||||
|
|
||||||
static int outliner_count_levels(SpaceOops *soops, ListBase *lb, int curlevel)
|
static int outliner_count_levels(SpaceOops *soops, ListBase *lb, const int curlevel)
|
||||||
{
|
{
|
||||||
TreeElement *te;
|
TreeElement *te;
|
||||||
int level = curlevel, lev;
|
int level = curlevel, lev;
|
||||||
@ -320,7 +320,7 @@ static int outliner_count_levels(SpaceOops *soops, ListBase *lb, int curlevel)
|
|||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
int outliner_has_one_flag(SpaceOops *soops, ListBase *lb, short flag, short curlevel)
|
int outliner_has_one_flag(SpaceOops *soops, ListBase *lb, short flag, const int curlevel)
|
||||||
{
|
{
|
||||||
TreeElement *te;
|
TreeElement *te;
|
||||||
TreeStoreElem *tselem;
|
TreeStoreElem *tselem;
|
||||||
|
@ -177,7 +177,7 @@ void outliner_do_object_operation(struct bContext *C, struct Scene *scene, struc
|
|||||||
|
|
||||||
int common_restrict_check(struct bContext *C, struct Object *ob);
|
int common_restrict_check(struct bContext *C, struct Object *ob);
|
||||||
|
|
||||||
int outliner_has_one_flag(struct SpaceOops *soops, ListBase *lb, short flag, short curlevel);
|
bool outliner_has_one_flag(struct SpaceOops *soops, ListBase *lb, short flag, const int curlevel);
|
||||||
void outliner_set_flag(struct SpaceOops *soops, ListBase *lb, short flag, short set);
|
void outliner_set_flag(struct SpaceOops *soops, ListBase *lb, short flag, short set);
|
||||||
|
|
||||||
void object_toggle_visibility_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
|
void object_toggle_visibility_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
|
||||||
|
@ -1295,7 +1295,8 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(v3d->flag & V3D_INVALID_BACKBUF) ) return;
|
if (!(v3d->flag & V3D_INVALID_BACKBUF))
|
||||||
|
return;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (test) {
|
if (test) {
|
||||||
@ -3326,10 +3327,11 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
|
|||||||
/* draw selected and editmode */
|
/* draw selected and editmode */
|
||||||
for (base = scene->base.first; base; base = base->next) {
|
for (base = scene->base.first; base; base = base->next) {
|
||||||
if (v3d->lay & base->lay) {
|
if (v3d->lay & base->lay) {
|
||||||
if (base->object == scene->obedit || (base->flag & SELECT) )
|
if (base->object == scene->obedit || (base->flag & SELECT)) {
|
||||||
draw_object(scene, ar, v3d, base, 0);
|
draw_object(scene, ar, v3d, base, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// REEB_draw();
|
// REEB_draw();
|
||||||
|
|
||||||
|
@ -2897,8 +2897,9 @@ static int border_apply(bContext *C, wmOperator *op, int gesture_mode)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* XXX weak; border should be configured for this without reading event types */
|
/* XXX weak; border should be configured for this without reading event types */
|
||||||
if (RNA_struct_find_property(op->ptr, "gesture_mode") )
|
if (RNA_struct_find_property(op->ptr, "gesture_mode")) {
|
||||||
RNA_int_set(op->ptr, "gesture_mode", gesture_mode);
|
RNA_int_set(op->ptr, "gesture_mode", gesture_mode);
|
||||||
|
}
|
||||||
|
|
||||||
retval = op->type->exec(C, op);
|
retval = op->type->exec(C, op);
|
||||||
OPERATOR_RETVAL_CHECK(retval);
|
OPERATOR_RETVAL_CHECK(retval);
|
||||||
@ -2915,9 +2916,10 @@ static void wm_gesture_end(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
ED_area_tag_redraw(CTX_wm_area(C));
|
ED_area_tag_redraw(CTX_wm_area(C));
|
||||||
|
|
||||||
if (RNA_struct_find_property(op->ptr, "cursor") )
|
if (RNA_struct_find_property(op->ptr, "cursor")) {
|
||||||
WM_cursor_modal_restore(CTX_wm_window(C));
|
WM_cursor_modal_restore(CTX_wm_window(C));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int WM_border_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
int WM_border_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||||
{
|
{
|
||||||
@ -3194,11 +3196,12 @@ void wm_tweakevent_test(bContext *C, wmEvent *event, int action)
|
|||||||
if (win->tweak == NULL) {
|
if (win->tweak == NULL) {
|
||||||
if (CTX_wm_region(C)) {
|
if (CTX_wm_region(C)) {
|
||||||
if (event->val == KM_PRESS) {
|
if (event->val == KM_PRESS) {
|
||||||
if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) )
|
if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE)) {
|
||||||
win->tweak = WM_gesture_new(C, event, WM_GESTURE_TWEAK);
|
win->tweak = WM_gesture_new(C, event, WM_GESTURE_TWEAK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
/* no tweaks if event was handled */
|
/* no tweaks if event was handled */
|
||||||
if ((action & WM_HANDLER_BREAK)) {
|
if ((action & WM_HANDLER_BREAK)) {
|
||||||
@ -3220,8 +3223,9 @@ int WM_gesture_lasso_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||||||
|
|
||||||
wm_gesture_tag_redraw(C);
|
wm_gesture_tag_redraw(C);
|
||||||
|
|
||||||
if (RNA_struct_find_property(op->ptr, "cursor") )
|
if (RNA_struct_find_property(op->ptr, "cursor")) {
|
||||||
WM_cursor_modal_set(CTX_wm_window(C), RNA_int_get(op->ptr, "cursor"));
|
WM_cursor_modal_set(CTX_wm_window(C), RNA_int_get(op->ptr, "cursor"));
|
||||||
|
}
|
||||||
|
|
||||||
return OPERATOR_RUNNING_MODAL;
|
return OPERATOR_RUNNING_MODAL;
|
||||||
}
|
}
|
||||||
@ -3235,8 +3239,9 @@ int WM_gesture_lines_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||||||
|
|
||||||
wm_gesture_tag_redraw(C);
|
wm_gesture_tag_redraw(C);
|
||||||
|
|
||||||
if (RNA_struct_find_property(op->ptr, "cursor") )
|
if (RNA_struct_find_property(op->ptr, "cursor")) {
|
||||||
WM_cursor_modal_set(CTX_wm_window(C), RNA_int_get(op->ptr, "cursor"));
|
WM_cursor_modal_set(CTX_wm_window(C), RNA_int_get(op->ptr, "cursor"));
|
||||||
|
}
|
||||||
|
|
||||||
return OPERATOR_RUNNING_MODAL;
|
return OPERATOR_RUNNING_MODAL;
|
||||||
}
|
}
|
||||||
@ -3448,8 +3453,9 @@ int WM_gesture_straightline_invoke(bContext *C, wmOperator *op, const wmEvent *e
|
|||||||
|
|
||||||
wm_gesture_tag_redraw(C);
|
wm_gesture_tag_redraw(C);
|
||||||
|
|
||||||
if (RNA_struct_find_property(op->ptr, "cursor") )
|
if (RNA_struct_find_property(op->ptr, "cursor")) {
|
||||||
WM_cursor_modal_set(CTX_wm_window(C), RNA_int_get(op->ptr, "cursor"));
|
WM_cursor_modal_set(CTX_wm_window(C), RNA_int_get(op->ptr, "cursor"));
|
||||||
|
}
|
||||||
|
|
||||||
return OPERATOR_RUNNING_MODAL;
|
return OPERATOR_RUNNING_MODAL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user