diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-10-29 05:09:12 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-10-29 05:09:12 +0400 |
commit | 15ed8343437c6b304de72cd14591455da1d5b3ec (patch) | |
tree | cbe40f76668f5e8539744c4d2f8aeaa0ded72f52 /source/blender/editors | |
parent | 5acd5d14970c829c2873623716a67beeb6da5278 (diff) | |
parent | dd106b5c7a129e00bebe121c4da8cb90a16d48cb (diff) |
Merged changes in the trunk up to revision 51718.
Conflicts resolved:
source/blender/blenloader/intern/readfile.c
source/blender/makesrna/intern/rna_scene.c
release/datafiles/startup.blend
Diffstat (limited to 'source/blender/editors')
215 files changed, 2070 insertions, 1657 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 12c0e851f88..81ebca7b2fb 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -1187,7 +1187,7 @@ static void *acf_dsmat_setting_ptr(bAnimListElem *ale, int setting, short *type) if (ma->adt) return GET_ACF_FLAG_PTR(ma->adt->flag, type); else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -1264,7 +1264,7 @@ static void *acf_dslam_setting_ptr(bAnimListElem *ale, int setting, short *type) if (la->adt) return GET_ACF_FLAG_PTR(la->adt->flag, type); else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -1348,7 +1348,7 @@ static void *acf_dstex_setting_ptr(bAnimListElem *ale, int setting, short *type) if (tex->adt) return GET_ACF_FLAG_PTR(tex->adt->flag, type); else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -3330,7 +3330,7 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann /* get the flag and the pointer to that flag */ flag = acf->setting_flag(ac, setting, &negflag); ptr = acf->setting_ptr(ale, setting, &ptrsize); - /* enabled= ANIM_channel_setting_get(ac, ale, setting); */ /* UNUSED */ + /* enabled = ANIM_channel_setting_get(ac, ale, setting); */ /* UNUSED */ /* get the base icon for the setting */ switch (setting) { @@ -3345,13 +3345,13 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann break; case ACHANNEL_SETTING_EXPAND: /* expanded triangle */ - //icon= ((enabled)? ICON_TRIA_DOWN : ICON_TRIA_RIGHT); + //icon = ((enabled)? ICON_TRIA_DOWN : ICON_TRIA_RIGHT); icon = ICON_TRIA_RIGHT; tooltip = "Make channels grouped under this channel visible"; break; case ACHANNEL_SETTING_SOLO: /* NLA Tracks only */ - //icon= ((enabled)? ICON_LAYER_ACTIVE : ICON_LAYER_USED); + //icon = ((enabled)? ICON_LAYER_ACTIVE : ICON_LAYER_USED); icon = ICON_LAYER_USED; tooltip = "NLA Track is the only one evaluated for the AnimData block it belongs to"; break; @@ -3360,13 +3360,13 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann case ACHANNEL_SETTING_PROTECT: /* protected lock */ // TODO: what about when there's no protect needed? - //icon= ((enabled)? ICON_LOCKED : ICON_UNLOCKED); + //icon = ((enabled)? ICON_LOCKED : ICON_UNLOCKED); icon = ICON_UNLOCKED; tooltip = "Editability of keyframes for this channel"; break; case ACHANNEL_SETTING_MUTE: /* muted speaker */ - //icon= ((enabled)? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF); + //icon = ((enabled)? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF); icon = ICON_MUTE_IPO_OFF; if (ale->type == ALE_FCURVE) @@ -3449,7 +3449,7 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale y = (ymaxc - yminc) / 2 + yminc; ymid = y - 7; /* y-coordinates for text is only 4 down from middle */ - /* ytext= y - 4; */ + /* ytext = y - 4; */ /* no button backdrop behind icons */ uiBlockSetEmboss(block, UI_EMBOSSN); diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index ee31276a8c4..f6459bfc542 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -468,7 +468,7 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn /* store this level as the 'old' level now */ prevLevel = level; - } + } /* if the level is 'greater than' (i.e. less important) than the previous level... */ else if (level > prevLevel) { /* if previous level was a base-level (i.e. 0 offset / root of one hierarchy), @@ -604,7 +604,7 @@ static int animedit_poll_channels_nla_tweakmode_off(bContext *C) if (ELEM3(sa->spacetype, SPACE_ACTION, SPACE_IPO, SPACE_NLA) == 0) return 0; - /* NLA TweakMode test */ + /* NLA TweakMode test */ if (sa->spacetype == SPACE_NLA) { if ((scene == NULL) || (scene->flag & SCE_NLA_EDIT_ON)) return 0; @@ -798,7 +798,7 @@ static void rearrange_animchannel_add_to_islands(ListBase *islands, ListBase *sr FCurve *fcu = (FCurve *)channel; is_sel = SEL_FCU(fcu); - } + } break; case ANIMTYPE_NLATRACK: { @@ -914,7 +914,7 @@ static void rearrange_nla_channels(bAnimContext *UNUSED(ac), AnimData *adt, shor if (rearrange_func == NULL) return; - /* only consider NLA data if it's accessible */ + /* only consider NLA data if it's accessible */ //if (EXPANDED_DRVD(adt) == 0) // return; @@ -935,7 +935,7 @@ static void rearrange_driver_channels(bAnimContext *UNUSED(ac), AnimData *adt, s if (rearrange_func == NULL) return; - /* only consider drivers if they're accessible */ + /* only consider drivers if they're accessible */ if (EXPANDED_DRVD(adt) == 0) return; @@ -2211,7 +2211,7 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in } notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); - } + } break; case ANIMTYPE_GROUP: @@ -2224,7 +2224,7 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in agrp->flag ^= AGRP_SELECTED; } else if (selectmode == -1) { - /* select all in group (and deselect everthing else) */ + /* select all in group (and deselect everthing else) */ FCurve *fcu; /* deselect all other channels */ @@ -2233,7 +2233,7 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in /* only select channels in group and group itself */ for (fcu = agrp->channels.first; fcu && fcu->grp == agrp; fcu = fcu->next) fcu->flag |= FCURVE_SELECTED; - agrp->flag |= AGRP_SELECTED; + agrp->flag |= AGRP_SELECTED; } else { /* select group by itself */ @@ -2311,7 +2311,7 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in /* invert selection status of this layer only */ gpl->flag ^= GP_LAYER_SELECT; } - else { + else { /* select layer by itself */ ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); gpl->flag |= GP_LAYER_SELECT; diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 620f5de9db7..01c0a95e200 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -261,8 +261,8 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d) /* only draw two separate 'curtains' if there's no overlap between them */ if (PSFRA < PEFRA) { glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax); - glRectf((float)PEFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); - } + glRectf((float)PEFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); + } else { glRectf(v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); } diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 9b88c307cb6..f1fc93db60e 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -683,7 +683,7 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->datatype = ALE_ACT; ale->adt = BKE_animdata_from_id(data); - } + } break; case ANIMTYPE_DSSPK: { @@ -825,7 +825,7 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne } ale->datatype = (ale->key_data) ? ALE_FCURVE : ALE_NONE; } - } + } break; case ANIMTYPE_GPLAYER: @@ -1037,7 +1037,7 @@ static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, bActionGro if (skip_fcurve_selected_data(ads, fcu, owner_id, filter_mode)) continue; } - } + } /* only include if visible (Graph Editor check, not channels check) */ if (!(filter_mode & ANIMFILTER_CURVE_VISIBLE) || (fcu->flag & FCURVE_VISIBLE)) { @@ -1225,7 +1225,7 @@ static size_t animfilter_nla(bAnimContext *UNUSED(ac), ListBase *anim_data, bDop */ if (!(ads->filterflag & ADS_FILTER_NLA_NOACT) || (adt->action)) { /* there isn't really anything editable here, so skip if need editable */ - if ((filter_mode & ANIMFILTER_FOREDIT) == 0) { + if ((filter_mode & ANIMFILTER_FOREDIT) == 0) { /* just add the action track now (this MUST appear for drawing) * - as AnimData may not have an action, we pass a dummy pointer just to get the list elem created, then * overwrite this with the real value - REVIEW THIS... diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c index 5295950546d..d8e3349e998 100644 --- a/source/blender/editors/animation/anim_ipo_utils.c +++ b/source/blender/editors/animation/anim_ipo_utils.c @@ -89,7 +89,7 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu) * i.e. Bone1.Location.X, or Object.Location.X * 2) <array-index> <property-name> (<struct name>) * i.e. X Location (Bone1), or X Location (Object) - * + * * Currently, option 2 is in use, to try and make it easier to quickly identify F-Curves (it does have * problems with looking rather odd though). Option 1 is better in terms of revealing a consistent sense of * hierarchy though, which isn't so clear with option 2. diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 895aaec29da..852f3fa5469 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -150,7 +150,7 @@ int ED_markers_post_apply_transform(ListBase *markers, Scene *scene, int mode, f break; case TFM_TIME_SCALE: - { + { /* rescale the distance between the marker and the current frame */ marker->frame = cfra + (int)floorf(((float)(marker->frame - cfra) * value) + 0.5f); changed++; @@ -249,7 +249,7 @@ void ED_markers_get_minmax(ListBase *markers, short sel, float *first, float *la min = (float)marker->frame; if (marker->frame > max) max = (float)marker->frame; - } + } } } @@ -278,7 +278,7 @@ static void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only return; } else if (ce->cfra > marker->frame) break; - } + } cen = MEM_callocN(sizeof(CfraElem), "add_to_cfra_elem"); if (ce) BLI_insertlinkbefore(lb, ce, cen); @@ -360,7 +360,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag) glScalef(1.0f / xscale, 1.0f, 1.0f); glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); /* vertical line - dotted */ #ifdef DURIAN_CAMERA_SWITCH @@ -522,7 +522,7 @@ static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, wmEvent else if (op->type->exec) retval = op->type->exec(C, op); else - BKE_report(op->reports, RPT_ERROR, "Programming error: operator doesn't actually have code to do anything!"); + BKE_report(op->reports, RPT_ERROR, "Programming error: operator does not actually have code to do anything!"); /* return status modifications - for now, make this spacetype dependent as above */ if (sa->spacetype != SPACE_TIME) { @@ -726,7 +726,7 @@ static int ed_marker_move_cancel(bContext *C, wmOperator *op) { RNA_int_set(op->ptr, "frames", 0); ed_marker_move_apply(op); - ed_marker_move_exit(C, op); + ed_marker_move_exit(C, op); WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL); WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL); @@ -821,7 +821,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) } else { /* we only print the offset */ - if (mm->slink->spacetype == SPACE_TIME) { + if (mm->slink->spacetype == SPACE_TIME) { SpaceTime *stime = (SpaceTime *)mm->slink; if (stime->flag & TIME_DRAWFRAMES) BLI_snprintf(str, sizeof(str), "Marker offset %d ", offs); @@ -1030,7 +1030,7 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera) x = evt->x - ar->winrct.xmin; y = evt->y - ar->winrct.ymin; - UI_view2d_region_to_view(v2d, x, y, &viewx, NULL); + UI_view2d_region_to_view(v2d, x, y, &viewx, NULL); cfra = ED_markers_find_nearest_marker_time(markers, viewx); @@ -1377,7 +1377,7 @@ static int ed_marker_make_links_scene_exec(bContext *C, wmOperator *op) } if (scene_to == CTX_data_scene(C)) { - BKE_report(op->reports, RPT_ERROR, "Can't re-link markers into the same scene"); + BKE_report(op->reports, RPT_ERROR, "Cannot re-link markers into the same scene"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 38f9119104b..25833c13925 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -91,7 +91,7 @@ FCurve *verify_driver_fcurve(ID *id, const char rna_path[], const int array_inde adt = BKE_animdata_from_id(id); if ((adt == NULL) && (add)) adt = BKE_id_add_animdata(id); - if (adt == NULL) { + if (adt == NULL) { /* if still none (as not allowed to add, or ID doesn't have animdata for some reason) */ return NULL; } @@ -478,7 +478,7 @@ static int add_driver_button_exec(bContext *C, wmOperator *op) char *path = get_driver_path_hack(C, &ptr, prop); short flags = CREATEDRIVER_WITH_DEFAULT_DVAR; - if (path) { + if (path) { success += ANIM_add_driver(op->reports, ptr.id.data, path, index, flags, DRIVER_TYPE_PYTHON); MEM_freeN(path); diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 6c9105dde69..e520a95aa95 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -322,7 +322,7 @@ static void nupdate_abk_bezt(void *node, void *data) /* just add the BezTriple to the buffer if there's space, or allocate a new one */ if (abk->numBezts >= MAX_ABK_BUFSIZE) { // TODO: need to allocate new array to cater... - //bezts_extra= MEM_callocN(...); + //bezts_extra = MEM_callocN(...); if (G.debug & G_DEBUG) printf("FIXME: nupdate_abk_bezt() missing case for too many overlapping BezTriples\n"); } @@ -345,7 +345,7 @@ static BezTriple *abk_get_bezt_with_value(ActBeztColumn *abk, float value) return NULL; /* look over each BezTriple in this container */ - for (i = 0; i < abk->numBezts; i++) { + for (i = 0; i < abk->numBezts; i++) { /* only do exact match for now... */ if (/*i >= MAX_ABK_BUFSIZE*/ 0) { // TODO: this case needs special handling @@ -582,7 +582,7 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel, } /* tweak size of keyframe shape according to type of keyframe - * - 'proper' keyframes have key_type=0, so get drawn at full size + * - 'proper' keyframes have key_type = 0, so get drawn at full size */ hsize -= 0.5f * key_type; @@ -960,7 +960,7 @@ void fcurve_to_keylist(AnimData *adt, FCurve *fcu, DLRBT_Tree *keys, DLRBT_Tree if (fcu && fcu->totvert && fcu->bezt) { /* apply NLA-mapping (if applicable) */ - if (adt) + if (adt) ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 0); /* if getting long keyframes too, grab the BezTriples in a BST for diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index b277d0eccb5..015c2667a93 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -154,7 +154,7 @@ short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEdi if (fcu_cb) fcu_cb(fcu); - /* done */ + /* done */ return 0; } @@ -639,7 +639,7 @@ static short snap_bezier_horizontal(KeyframeEditData *UNUSED(ked), BezTriple *be if (ELEM3(bezt->h1, HD_AUTO, HD_AUTO_ANIM, HD_VECT)) bezt->h1 = HD_ALIGN; if (ELEM3(bezt->h2, HD_AUTO, HD_AUTO_ANIM, HD_VECT)) bezt->h2 = HD_ALIGN; } - return 0; + return 0; } /* value to snap to is stored in the custom data -> first float value slot */ @@ -880,7 +880,7 @@ KeyframeEditFunc ANIM_editkeyframes_ipo(short code) switch (code) { case BEZT_IPO_CONST: /* constant */ return set_bezt_constant; - case BEZT_IPO_LIN: /* linear */ + case BEZT_IPO_LIN: /* linear */ return set_bezt_linear; default: /* bezier */ return set_bezt_bezier; @@ -930,7 +930,7 @@ KeyframeEditFunc ANIM_editkeyframes_keytype(short code) case BEZT_KEYTYPE_JITTER: /* jitter keyframe */ return set_keytype_jitter; - case BEZT_KEYTYPE_KEYFRAME: /* proper keyframe */ + case BEZT_KEYTYPE_KEYFRAME: /* proper keyframe */ default: return set_keytype_keyframe; } diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index b5c0555bf63..9249b912da6 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -188,7 +188,7 @@ void clean_fcurve(FCurve *fcu, float thresh) /* make a copy of the old BezTriples, and clear F-Curve */ old_bezts = fcu->bezt; - totCount = fcu->totvert; + totCount = fcu->totvert; fcu->bezt = NULL; fcu->totvert = 0; @@ -256,7 +256,7 @@ void clean_fcurve(FCurve *fcu, float thresh) insert_vert_fcurve(fcu, cur[0], cur[1], 0); } } - else { + else { /* add if value doesn't equal that of previous */ if (IS_EQT(cur[1], prev[1], thresh) == 0) { /* add new keyframe */ diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index f0c5f063e57..4f16c1a6622 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -108,7 +108,7 @@ short ANIM_get_keyframing_flags(Scene *scene, short incl_mode) } /* only if including settings from the autokeying mode... */ - if (incl_mode) { + if (incl_mode) { /* keyframing mode - only replace existing keyframes */ if (IS_AUTOKEY_MODE(scene, EDITKEYS)) flag |= INSERTKEY_REPLACE; @@ -131,7 +131,7 @@ bAction *verify_adt_action(ID *id, short add) adt = BKE_animdata_from_id(id); if ((adt == NULL) && (add)) adt = BKE_id_add_animdata(id); - if (adt == NULL) { + if (adt == NULL) { /* if still none (as not allowed to add, or ID doesn't have animdata for some reason) */ printf("ERROR: Couldn't add AnimData (ID = %s)\n", (id) ? (id->name) : "<None>"); return NULL; @@ -240,7 +240,7 @@ int insert_bezt_fcurve(FCurve *fcu, BezTriple *bezt, short flag) i = binarysearch_bezt_index(fcu->bezt, bezt->vec[1][0], fcu->totvert, &replace); /* replace an existing keyframe? */ - if (replace) { + if (replace) { /* sanity check: 'i' may in rare cases exceed arraylen */ if ((i >= 0) && (i < fcu->totvert)) { /* just change the values when replacing, so as to not overwrite handles */ @@ -412,12 +412,12 @@ static short new_key_needed(FCurve *fcu, float cFrame, float nValue) float prevPosi = 0.0f, prevVal = 0.0f; float beztPosi = 0.0f, beztVal = 0.0f; - /* get current time+value */ + /* get current time+value */ beztPosi = bezt->vec[1][0]; beztVal = bezt->vec[1][1]; if (prev) { - /* there is a keyframe before the one currently being examined */ + /* there is a keyframe before the one currently being examined */ /* get previous time+value */ prevPosi = prev->vec[1][0]; @@ -789,7 +789,7 @@ short insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *p /* F-Curve not editable? */ if (fcurve_is_keyframable(fcu) == 0) { BKE_reportf(reports, RPT_ERROR, - "F-Curve with path = '%s' [%d] cannot be keyframed, ensure that it is not locked or sampled, " + "F-Curve with path '%s[%d]' cannot be keyframed, ensure that it is not locked or sampled, " "and try removing F-Modifiers", fcu->rna_path, fcu->array_index); return 0; @@ -940,7 +940,7 @@ short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char grou } /* key entire array convenience method */ - if (array_index == -1) { + if (array_index == -1) { array_index = 0; array_index_max = RNA_property_array_length(&ptr, prop); @@ -1028,13 +1028,13 @@ short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char grou cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP); } else { - BKE_reportf(reports, RPT_ERROR, "No action to delete keyframes from for ID = %s\n", id->name); + BKE_reportf(reports, RPT_ERROR, "No action to delete keyframes from for ID = %s", id->name); return 0; } } /* key entire array convenience method */ - if (array_index == -1) { + if (array_index == -1) { array_index = 0; array_index_max = RNA_property_array_length(&ptr, prop); @@ -1064,7 +1064,7 @@ short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char grou /* try to find index of beztriple to get rid of */ i = binarysearch_bezt_index(fcu->bezt, cfra, fcu->totvert, &found); - if (found) { + if (found) { /* delete the key at the index (will sanity check + do recalc afterwards) */ delete_fcurve_key(fcu, i, 1); @@ -1126,7 +1126,7 @@ static short clear_keyframe(ReportList *reports, ID *id, bAction *act, const cha act = adt->action; } else { - BKE_reportf(reports, RPT_ERROR, "No action to delete keyframes from for ID = %s\n", id->name); + BKE_reportf(reports, RPT_ERROR, "No action to delete keyframes from for ID = %s", id->name); return 0; } } @@ -1236,7 +1236,7 @@ static int insert_key_exec(bContext *C, wmOperator *op) /* try to insert keyframes for the channels specified by KeyingSet */ success = ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); if (G.debug & G_DEBUG) - BKE_reportf(op->reports, RPT_INFO, "Keying set '%s' - successfully added %d keyframes\n", ks->name, success); + BKE_reportf(op->reports, RPT_INFO, "Keying set '%s' - successfully added %d keyframes", ks->name, success); /* report failure or do updates? */ if (success == MODIFYKEY_INVALID_CONTEXT) { @@ -1863,7 +1863,7 @@ short fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter) /* binarysearch_bezt_index will set replace to be 0 or 1 * - obviously, 1 represents a match */ - if (replace) { + if (replace) { /* sanity check: 'i' may in rare cases exceed arraylen */ if ((i >= 0) && (i < fcu->totvert)) return 1; diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 5844bd6708f..ae7abd82600 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -377,7 +377,7 @@ void ANIM_OT_keyingset_button_add(wmOperatorType *ot) /* callbacks */ ot->exec = add_keyingset_button_exec; - //op->poll= ??? + //op->poll = ??? /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -457,7 +457,7 @@ void ANIM_OT_keyingset_button_remove(wmOperatorType *ot) /* callbacks */ ot->exec = remove_keyingset_button_exec; - //op->poll= ??? + //op->poll = ??? /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -947,7 +947,7 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe /* skip path if no ID pointer is specified */ if (ksp->id == NULL) { BKE_reportf(reports, RPT_WARNING, - "Skipping path in keying set, as it has no ID (KS = '%s', path = '%s'[%d])", + "Skipping path in keying set, as it has no ID (KS = '%s', path = '%s[%d]')", ks->name, ksp->rna_path, ksp->array_index); continue; } diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index c19904d39ac..7c5b75e56ae 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -88,7 +88,7 @@ void ED_operatortypes_armature(void) WM_operatortype_append(ARMATURE_OT_armature_layers); WM_operatortype_append(ARMATURE_OT_bone_layers); - /* SKETCH */ + /* SKETCH */ WM_operatortype_append(SKETCH_OT_gesture); WM_operatortype_append(SKETCH_OT_delete); WM_operatortype_append(SKETCH_OT_draw_stroke); @@ -221,7 +221,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf) /* Already part of view3d select */ //WM_keymap_add_item(keymap, "SKETCH_OT_select", SELECTMOUSE, KM_PRESS, 0, 0); - /* sketch poll checks mode */ + /* sketch poll checks mode */ WM_keymap_add_item(keymap, "SKETCH_OT_gesture", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", LEFTMOUSE, KM_PRESS, 0, 0); kmi = WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", LEFTMOUSE, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 8a75d07a678..48da23d5e8d 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -117,14 +117,14 @@ void ED_armature_sync_selection(ListBase *edbo) else ebo->flag &= ~BONE_SELECTED; } - } + } } void ED_armature_validate_active(struct bArmature *arm) { EditBone *ebone = arm->act_edbone; - if (ebone) { + if (ebone) { if (ebone->flag & BONE_HIDDEN_A) arm->act_edbone = NULL; } @@ -304,7 +304,7 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone eBone->ease2 = curBone->ease2; eBone->rad_head = curBone->rad_head; eBone->rad_tail = curBone->rad_tail; - eBone->segments = curBone->segments; + eBone->segments = curBone->segments; eBone->layer = curBone->layer; if (curBone->prop) @@ -897,7 +897,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann /* make tar armature be new parent */ ob->parent = tarArm; } - } + } } /* join armature exec is exported for use in object->join objects operator... */ @@ -1113,7 +1113,7 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm) } } } - } + } } /* Helper function for armature separating - remove certain bones from the given armature @@ -1440,7 +1440,7 @@ static int pose_select_connected_invoke(bContext *C, wmOperator *op, wmEvent *ev /* Select parents */ for (curBone = bone; curBone; curBone = next) { /* ignore bone if cannot be selected */ - if ((curBone->flag & BONE_UNSELECTABLE) == 0) { + if ((curBone->flag & BONE_UNSELECTABLE) == 0) { // XXX old cruft! use notifiers instead //select_actionchannel_by_name (ob->action, curBone->name, !(shift)); @@ -1493,7 +1493,7 @@ void POSE_OT_select_linked(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - /* props */ + /* props */ RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first"); } @@ -1550,7 +1550,7 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, wmEvent *e bone = curBone; break; } - else { + else { bone = NULL; break; } @@ -2687,7 +2687,7 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *UNUSED(op)) updateDuplicateSubtarget(eBone, arm->edbo, obedit); } } - } + } /* correct the active bone */ if (arm->act_edbone) { @@ -2802,7 +2802,7 @@ static void fill_add_joint(EditBone *ebo, short eb_tail, ListBase *points) } for (ebp = points->first; ebp; ebp = ebp->next) { - if (equals_v3v3(ebp->vec, vec)) { + if (equals_v3v3(ebp->vec, vec)) { if (eb_tail) { if ((ebp->head_owner) && (ebp->head_owner->parent == ebo)) { /* so this bone's tail owner is this bone */ @@ -2886,7 +2886,7 @@ static int armature_fill_bones_exec(bContext *C, wmOperator *op) mul_v3_m4v3(curs, obedit->imat, give_cursor(scene, v3d)); /* Create a bone */ - /* newbone= */ add_points_bone(obedit, ebp->vec, curs); + /* newbone = */ add_points_bone(obedit, ebp->vec, curs); } else if (count == 2) { EditBonePoint *ebp, *ebp2; @@ -2970,7 +2970,7 @@ static int armature_fill_bones_exec(bContext *C, wmOperator *op) } else { /* FIXME.. figure out a method for multiple bones */ - BKE_reportf(op->reports, RPT_ERROR, "Too many points selected: %d\n", count); + BKE_reportf(op->reports, RPT_ERROR, "Too many points selected: %d", count); BLI_freelistN(&points); return OPERATOR_CANCELLED; } @@ -3150,7 +3150,7 @@ static int armature_merge_exec(bContext *C, wmOperator *op) /* put back link */ BLI_insertlinkbefore(&chains, nchain, chain); - } + } armature_tag_unselect(arm); @@ -3301,7 +3301,9 @@ static void hide_unselected_armature_bones(Scene *scene) for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { bArmature *arm = obedit->data; if (EBONE_VISIBLE(arm, ebone)) { - if (ebone->flag & (BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL)) ; + if (ebone->flag & (BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL)) { + /* pass */ + } else { ebone->flag |= BONE_HIDDEN_A; } @@ -3457,7 +3459,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op) /* Deselect the old bone */ ebone->flag &= ~(BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL); - } + } } /* if only one bone, make this one active */ if (totbone == 1 && first) arm->act_edbone = first; @@ -3681,7 +3683,7 @@ static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op)) parent = ebo->parent; /* only if selected and editable */ - if (EBONE_VISIBLE(arm, ebo) && EBONE_EDITABLE(ebo)) { + if (EBONE_VISIBLE(arm, ebo) && EBONE_EDITABLE(ebo)) { /* swap head and tail coordinates */ SWAP(float, ebo->head[0], ebo->tail[0]); SWAP(float, ebo->head[1], ebo->tail[1]); @@ -3721,7 +3723,7 @@ static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op)) } /* free chains */ - BLI_freelistN(&chains); + BLI_freelistN(&chains); armature_tag_unselect(arm); @@ -3778,7 +3780,7 @@ static void bone_connect_to_new_parent(ListBase *edbo, EditBone *selbone, EditBo } } - if (mode == ARM_PAR_CONNECT) { + if (mode == ARM_PAR_CONNECT) { /* Connected: Child bones will be moved to the parent tip */ selbone->flag |= BONE_CONNECTED; sub_v3_v3v3(offset, actbone->tail, selbone->head); @@ -3893,7 +3895,7 @@ static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEve { if (ebone != actbone) { if (ebone->parent != actbone) allchildbones = 1; - } + } } CTX_DATA_END; @@ -3901,7 +3903,7 @@ static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEve /* ob becomes parent, make the associated menus */ if (allchildbones) - uiItemEnumO(layout, "ARMATURE_OT_parent_set", NULL, 0, "type", ARM_PAR_OFFSET); + uiItemEnumO(layout, "ARMATURE_OT_parent_set", NULL, 0, "type", ARM_PAR_OFFSET); uiPupMenuEnd(C, pup); @@ -3994,7 +3996,7 @@ static int armature_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) ebone->flag ^= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); } } - CTX_DATA_END; + CTX_DATA_END; WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, NULL); @@ -4055,7 +4057,7 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op) } } } - CTX_DATA_END; + CTX_DATA_END; WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, NULL); @@ -4295,7 +4297,7 @@ static int armature_select_hierarchy_exec(bContext *C, wmOperator *op) break; } - } + } else { // BONE_SELECT_CHILD chbone = editbone_get_child(arm, curbone, 1); if (chbone == NULL) continue; @@ -4566,7 +4568,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor nearBone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); arm->act_bone = nearBone; } - } + } } if (ob_act) { @@ -5118,7 +5120,7 @@ static void pchan_clear_rot(bPoseChannel *pchan) } } } /* Duplicated in source/blender/editors/object/object_transform.c */ - else { + else { if (pchan->rotmode == ROT_MODE_QUAT) { unit_qt(pchan->quat); } @@ -5544,7 +5546,7 @@ static void constraint_bone_name_fix(Object *ob, ListBase *conlist, char *oldnam if (cti->flush_constraint_targets) cti->flush_constraint_targets(curcon, &targets, 0); - } + } } } @@ -5631,7 +5633,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n } } - if (modifiers_usesArmature(ob, arm)) { + if (modifiers_usesArmature(ob, arm)) { bDeformGroup *dg = defgroup_find_name(ob, oldname); if (dg) { BLI_strncpy(dg->name, newname, MAXBONENAME); @@ -5959,7 +5961,7 @@ float arcLengthRatio(ReebArc *arc) embedLength = arcLength; } - return embedLength / arcLength; + return embedLength / arcLength; } EditBone *test_subdivideByLength(Scene *scene, Object *obedit, ReebArc *arc, ReebNode *head, ReebNode *tail) @@ -6060,7 +6062,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg) arc->flag = 1; /* mark arc direction */ } - /* Loop over subdivision methods */ + /* Loop over subdivision methods */ for (i = 0; lastBone == NULL && i < SKGEN_SUB_TOTAL; i++) { switch (scene->toolsettings->skgen_subdivisions[i]) { case SKGEN_SUB_LENGTH: diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c index 23dd3b15476..d9c7e78c01e 100644 --- a/source/blender/editors/armature/editarmature_generate.c +++ b/source/blender/editors/armature/editarmature_generate.c @@ -55,7 +55,7 @@ void setBoneRollFromNormal(EditBone *bone, const float no[3], float UNUSED(invma if (no != NULL && !is_zero_v3(no)) { float normal[3]; - copy_v3_v3(normal, no); + copy_v3_v3(normal, no); mul_m3_v3(tmat, normal); bone->roll = ED_rollBoneToVector(bone, normal, FALSE); diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index 196d03020e7..e5372c3ea09 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -191,7 +191,7 @@ static float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4] if (previous->bone) { sub_v3_v3v3(vec_first, previous->bone->tail, previous->bone->head); - } + } else if (previous->prev->bone) { sub_v3_v3v3(vec_first, edge->bone->head, previous->prev->bone->tail); } @@ -653,7 +653,7 @@ static int RIG_parentControl(RigControl *ctrl, EditBone *link) sub_v3_v3v3(offset, ctrl->bone->head, link->head); - /* if root matches, check for direction too */ + /* if root matches, check for direction too */ if (dot_v3v3(offset, offset) < 0.0001f) { float vbone[3], vparent[3]; @@ -802,7 +802,7 @@ static void RIG_reconnectControlBones(RigGraph *rg) } } - /* if not found yet, check child */ + /* if not found yet, check child */ if (found == 0) { RigArc *arc; RigArc *best_arc = NULL; @@ -863,7 +863,7 @@ static void RIG_reconnectControlBones(RigGraph *rg) /* SET bone link to ctrl corresponding to pchan */ RigControl *link = BLI_ghash_lookup(rg->controls_map, pchan->name); - /* if owner is a control bone, link with it */ + /* if owner is a control bone, link with it */ if (link && link->link) { RIG_parentControl(ctrl, link->bone); found = 1; @@ -876,7 +876,7 @@ static void RIG_reconnectControlBones(RigGraph *rg) cti->flush_constraint_targets(con, &targets, 0); } } - } + } if (found == 0) { /* check if parent is already linked */ @@ -1324,7 +1324,7 @@ void RIG_printArc(RigGraph *rg, RigArc *arc) printf("\t\t%s\n", edge->bone->name); RIG_printLinkedCtrl(rg, edge->bone, 3); } - } + } printf("symmetry level: %i flag: %i group %i\n", arc->symmetry_level, arc->symmetry_flag, arc->symmetry_group); RIG_printNode((RigNode *)arc->tail, "tail"); @@ -1336,7 +1336,7 @@ void RIG_printGraph(RigGraph *rg) printf("---- ARCS ----\n"); for (arc = rg->arcs.first; arc; arc = arc->next) { - RIG_printArc(rg, arc); + RIG_printArc(rg, arc); printf("\n"); } @@ -1345,7 +1345,7 @@ void RIG_printGraph(RigGraph *rg) } else { printf("HEAD NODE: NONE\n"); - } + } } /*******************************************************************************************************/ @@ -1584,7 +1584,7 @@ static void finalizeControl(RigGraph *rigg, RigControl *ctrl, float resize) repositionTailControl(rigg, ctrl_child); } } - } + } } static void repositionTailControl(RigGraph *rigg, RigControl *ctrl) @@ -1840,7 +1840,7 @@ static float calcCostAngleLengthDistance(BArcIterator *iter, float **UNUSED(vec_ length2 = normalize_v3(vec_second); - /* Angle cost */ + /* Angle cost */ if (edge->prev) { sub_v3_v3v3(vec_first, vec1, vec0); normalize_v3(vec_first); @@ -2135,7 +2135,7 @@ static void retargetArctoArcLength(bContext *C, RigGraph *rigg, RigArc *iarc, Ri no = node_end->no; } - /* no need to move virtual edges (space between unconnected bones) */ + /* no need to move virtual edges (space between unconnected bones) */ if (edge->bone) { repositionBone(C, rigg, edge, vec0, vec1, no); } @@ -2173,7 +2173,7 @@ void *exec_retargetArctoArc(void *param) RetargetParam *p = (RetargetParam *)param; RigGraph *rigg = p->rigg; RigArc *iarc = p->iarc; - bContext *C = p->context; + bContext *C = p->context; RigNode *inode_start = p->inode_start; ReebArc *earc = iarc->link_mesh; @@ -2222,7 +2222,7 @@ static void matchMultiResolutionNode(RigGraph *rigg, RigNode *inode, ReebNode *t enode = enode->link_down; reebg = BIF_graphForMultiNode(rigg->link_mesh, enode); /* replace with call to link_down once that exists */ eshape = BLI_subtreeShape((BGraph *)reebg, (BNode *)enode, NULL, 0) % SHAPE_LEVELS; - } + } } static void markMultiResolutionChildArc(ReebNode *end_enode, ReebNode *enode) @@ -2273,7 +2273,7 @@ static void matchMultiResolutionArc(RigGraph *rigg, RigNode *start_node, RigArc reebg = reebg->link_up; enode = next_earc->head; eshape = BLI_subtreeShape((BGraph *)reebg, (BNode *)enode, (BArc *)next_earc, 1) % SHAPE_LEVELS; - } + } next_earc->flag = ARC_USED; next_iarc->link_mesh = next_earc; @@ -2303,7 +2303,7 @@ static void matchMultiResolutionStartingNode(RigGraph *rigg, ReebGraph *reebg, R enode = reebg->nodes.first; eshape = BLI_subtreeShape((BGraph *)reebg, (BNode *)enode, NULL, 0) % SHAPE_LEVELS; - } + } inode->link_mesh = enode; } @@ -2600,7 +2600,7 @@ void BIF_retargetArmature(bContext *C) ED_undo_push(C, "Retarget Skeleton"); - // XXX + // XXX // allqueue(REDRAWVIEW3D, 0); } diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 68d8a8d721e..da8fc328343 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -440,7 +440,7 @@ static void sk_cancelStroke(SK_Sketch *sketch) static float sk_clampPointSize(SK_Point *pt, float size) { - return MAX2(size * pt->size, size / 2); + return max_ff(size * pt->size, size / 2); } static void sk_drawPoint(GLUquadric *quad, SK_Point *pt, float size) diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 82fef00b1e6..e7586311312 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -53,7 +53,6 @@ #include "BKE_modifier.h" #include "BKE_mesh.h" - #ifdef RIGID_DEFORM #include "BLI_polardecomp.h" #endif @@ -563,7 +562,7 @@ static void heat_set_H(LaplacianSystem *sys, int vertex) /* compute H entry */ if (numclosest > 0) { - mindist = maxf(mindist, 1e-4f); + mindist = max_ff(mindist, 1e-4f); h = numclosest * C_WEIGHT / (mindist * mindist); } else @@ -794,7 +793,7 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource, } } else if (*err_str == NULL) { - *err_str = "Bone Heat Weighting: failed to find solution for one or more bones"; + *err_str = N_("Bone Heat Weighting: failed to find solution for one or more bones"); break; } @@ -1195,7 +1194,7 @@ static int meshdeform_tri_intersect(const float orig[3], const float end[3], con } static void harmonic_ray_callback(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) - { +{ void **data = userdata; MeshDeformBind *mdb = data[1]; MFace *mface = data[0], *mf; @@ -1210,7 +1209,7 @@ static void harmonic_ray_callback(void *userdata, int index, const BVHTreeRay *r if (mf->v4) copy_v3_v3(face[3], mdb->cagecos[mf->v4]); - add_v3_v3v3(end, isec->start, isec->vec); + add_v3_v3v3(end, isec->start, isec->vec); if (!meshdeform_tri_intersect(ray->origin, end, face[0], face[1], face[2], co, uvw)) if (!mf->v4 || !meshdeform_tri_intersect(ray->origin, end, face[0], face[2], face[3], co, uvw)) @@ -1257,7 +1256,7 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float if (BLI_bvhtree_ray_cast(mdb->bvhtree, isect_mdef.start, isect_mdef.vec, 0.0, &hit, harmonic_ray_callback, data) != -1) { - len = isect_mdef.labda; + len = isect_mdef.labda; isect_mdef.face = mface = mface1 + hit.index; /* create MDefBoundIsect */ @@ -1722,7 +1721,7 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind } } else { - modifier_setError(&mmd->modifier, "%s", TIP_("Failed to find bind solution (increase precision?).")); + modifier_setError(&mmd->modifier, "Failed to find bind solution (increase precision?)"); error("Mesh Deform: failed to find bind solution."); break; } diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index 31398948b82..3fd65de6c04 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -105,7 +105,7 @@ typedef struct tPoseSlideOp { int nextFrame; /* frame after current frame (blend-to) */ int mode; /* sliding mode (ePoseSlide_Modes) */ - int flag; // unused for now, but can later get used for storing runtime settings.... + int flag; /* unused for now, but can later get used for storing runtime settings.... */ float percentage; /* 0-1 value for determining the influence of whatever is relevant */ } tPoseSlideOp; @@ -486,7 +486,7 @@ static void pose_slide_apply(bContext *C, tPoseSlideOp *pso) pose_slide_apply_vec3(pso, pfl, pchan->eul, "rotation_euler"); } else if (pchan->rotmode == ROT_MODE_AXISANGLE) { - // TODO: need to figure out how to do this! + /* TODO: need to figure out how to do this! */ } else { /* quaternions - use quaternion blending */ @@ -538,7 +538,7 @@ static void pose_slide_draw_status(tPoseSlideOp *pso) break; default: - // unknown + /* unknown */ strcpy(mode_str, "Sliding-Tool"); break; } @@ -606,7 +606,7 @@ static int pose_slide_invoke_common(bContext *C, wmOperator *op, tPoseSlideOp *p } /* initial apply for operator... */ - // TODO: need to calculate percentage for initial round too... + /* TODO: need to calculate percentage for initial round too... */ pose_slide_apply(C, pso); /* depsgraph updates + redraws */ @@ -1152,7 +1152,7 @@ static void pose_propagate_fcurve(wmOperator *op, Object *ob, FCurve *fcu, } /* just flatten handles, since values will now be the same either side... */ - // TODO: perhaps a fade-out modulation of the value is required here (optional once again)? + /* TODO: perhaps a fade-out modulation of the value is required here (optional once again)? */ bezt->vec[0][1] = bezt->vec[1][1] = bezt->vec[2][1] = refVal; /* select keyframe to indicate that it's been changed */ @@ -1247,13 +1247,13 @@ void POSE_OT_propagate(wmOperatorType *ot) /* callbacks */ ot->exec = pose_propagate_exec; - ot->poll = ED_operator_posemode; // XXX: needs selected bones! + ot->poll = ED_operator_posemode; /* XXX: needs selected bones! */ /* flag */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - // TODO: add "fade out" control for tapering off amount of propagation as time goes by? + /* TODO: add "fade out" control for tapering off amount of propagation as time goes by? */ ot->prop = RNA_def_enum(ot->srna, "mode", terminate_items, POSE_PROPAGATE_SMART_HOLDS, "Terminate Mode", "Method used to determine when to stop propagating pose to keyframes"); RNA_def_float(ot->srna, "end_frame", 250.0, FLT_MIN, FLT_MAX, "End Frame", "Frame to stop propagating frames to (for 'Before Frame' mode)", 1.0, 250.0); } diff --git a/source/blender/editors/armature/poseUtils.c b/source/blender/editors/armature/poseUtils.c index e2e3c49e7e0..f3c32399ad6 100644 --- a/source/blender/editors/armature/poseUtils.c +++ b/source/blender/editors/armature/poseUtils.c @@ -274,7 +274,7 @@ LinkData *poseAnim_mapping_getNextFCurve(ListBase *fcuLinks, LinkData *prev, con /* check if paths match */ if (strcmp(path, fcu->rna_path) == 0) return ld; - } + } /* none found */ return NULL; diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index a05a98c58ca..ae3d496b641 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -871,7 +871,7 @@ static void poselib_apply_pose(tPoseLib_PreviewData *pld) if (pld->marker) frame = pld->marker->frame; else - return; + return; /* init settings for testing groups for keyframes */ @@ -887,7 +887,7 @@ static void poselib_apply_pose(tPoseLib_PreviewData *pld) /* has keyframe on this frame, so try to get a PoseChannel with this name */ pchan = BKE_pose_channel_find_name(pose, agrp->name); - if (pchan) { + if (pchan) { short ok = 0; /* check if this bone should get any animation applied */ @@ -1079,7 +1079,7 @@ static void poselib_preview_get_next(tPoseLib_PreviewData *pld, int step) } /* check if any matches */ - if (pld->searchp.first == NULL) { + if (pld->searchp.first == NULL) { pld->marker = NULL; return; } @@ -1152,7 +1152,7 @@ static void poselib_preview_handle_search(tPoseLib_PreviewData *pld, unsigned sh poselib_preview_get_next(pld, 1); pld->redraw = PL_PREVIEW_REDRAWALL; return; - } + } break; case DELKEY: @@ -1639,7 +1639,7 @@ void POSELIB_OT_browse_interactive(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; - /* properties */ + /* properties */ // TODO: make the pose_index into a proper enum instead of a cryptic int... ot->prop = RNA_def_int(ot->srna, "pose_index", -1, -2, INT_MAX, "Pose", "Index of the pose to apply (-2 for no change to pose, -1 for poselib active pose)", 0, INT_MAX); diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 99de90bc9fa..576e5983d16 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -134,7 +134,7 @@ void ED_armature_exit_posemode(bContext *C, Base *base) ob->mode &= ~OB_MODE_POSE; WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL); - } + } } /* if a selected or active bone is protected, throw error (oonly if warn == 1) and return 1 */ @@ -500,7 +500,7 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op) found = 1; break; } - } + } else { /* direction == BONE_SELECT_CHILD */ /* the child member is only assigned to connected bones, see [#30340] */ #if 0 @@ -992,7 +992,7 @@ static void pose_copy_menu(Scene *scene) } } } - } + } else { /* constraints, optional (note: max we can have is 24 constraints) */ bConstraint *con, *con_back; int const_toggle[24] = {0}; /* XXX, initialize as 0 to quiet errors */ @@ -1018,7 +1018,7 @@ static void pose_copy_menu(Scene *scene) con_back = con->next; BLI_freelinkN(&const_copy, con); con = con_back; - } + } else con = con->next; } @@ -1035,7 +1035,7 @@ static void pose_copy_menu(Scene *scene) * appending to list of constraints for this channel */ copy_constraints(&tmp_constraints, &const_copy, TRUE); - if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) { + if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) { /* add proxy-local tags */ for (con = tmp_constraints.first; con; con = con->next) con->flag |= CONSTRAINT_PROXY_LOCAL; @@ -1097,7 +1097,7 @@ static void set_pose_keys(Object *ob) for (chan = ob->pose->chanbase.first; chan; chan = chan->next) { Bone *bone = chan->bone; if ((bone) && (bone->flag & BONE_SELECTED) && (arm->layer & bone->layer)) - chan->flag |= POSE_KEY; + chan->flag |= POSE_KEY; else chan->flag &= ~POSE_KEY; } @@ -1916,7 +1916,7 @@ static int pose_bone_rotmode_exec(bContext *C, wmOperator *op) Object *ob = CTX_data_active_object(C); int mode = RNA_enum_get(op->ptr, "type"); - /* set rotation mode of selected bones */ + /* set rotation mode of selected bones */ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) { pchan->rotmode = mode; @@ -2100,7 +2100,7 @@ static int pose_bone_layers_invoke(bContext *C, wmOperator *op, wmEvent *evt) { int layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ - /* get layers that are active already */ + /* get layers that are active already */ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) { short bit; @@ -2299,10 +2299,10 @@ static int pose_clear_user_transforms_exec(bContext *C, wmOperator *op) * just pose values should change, so this should be fine */ bPose *dummyPose = NULL; - Object workob = {{0}}; + Object workob = {{0}}; bPoseChannel *pchan; - /* execute animation step for current frame using a dummy copy of the pose */ + /* execute animation step for current frame using a dummy copy of the pose */ BKE_pose_copy_data(&dummyPose, ob->pose, 0); BLI_strncpy(workob.id.name, "OB<ClearTfmWorkOb>", sizeof(workob.id.name)); diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index 00f88a69fb6..b1bf13db69b 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -340,7 +340,7 @@ static ReebArc *copyArc(ReebGraph *rg, ReebArc *arc) cp_arc->edges.first = NULL; cp_arc->edges.last = NULL; - /* copy buckets */ + /* copy buckets */ cp_arc->buckets = MEM_callocN(sizeof(EmbedBucket) * cp_arc->bcount, "embed bucket"); memcpy(cp_arc->buckets, arc->buckets, sizeof(EmbedBucket) * cp_arc->bcount); @@ -377,7 +377,7 @@ static ReebGraph *copyReebGraph(ReebGraph *rg, int level) cp_rg->link_up = rg; cp_rg->multi_level = level; - /* Copy nodes */ + /* Copy nodes */ for (node = rg->nodes.first; node; node = node->next) { ReebNode *cp_node = copyNode(cp_rg, node); @@ -889,7 +889,7 @@ static void calculateArcLength(ReebArc *arc) vec0 = vec1; } - arc->length += len_v3v3(arc->tail->p, vec1); + arc->length += len_v3v3(arc->tail->p, vec1); } static void calculateGraphLength(ReebGraph *rg) @@ -948,7 +948,7 @@ void REEB_RadialSymmetry(BNode *root_node, RadialArc *ring, int count) bucket1 = IT_next(iter1); bucket2 = IT_next(iter2); - /* Make sure they both start at the same value */ + /* Make sure they both start at the same value */ while (bucket1 && bucket2 && bucket1->val < bucket2->val) { bucket1 = IT_next(iter1); } @@ -1005,7 +1005,7 @@ void REEB_RadialSymmetry(BNode *root_node, RadialArc *ring, int count) bucket1 = IT_next(iter1); bucket2 = IT_next(iter2); - /* Make sure they both start at the same value */ + /* Make sure they both start at the same value */ while (bucket1 && bucket1->val < bucket2->val) { bucket1 = IT_next(iter1); } @@ -1016,7 +1016,7 @@ void REEB_RadialSymmetry(BNode *root_node, RadialArc *ring, int count) for (; bucket1 && bucket2; bucket1 = IT_next(iter1), bucket2 = IT_next(iter2)) { - /* copy and mirror back to bucket2 */ + /* copy and mirror back to bucket2 */ bucket2->nv = bucket1->nv; copy_v3_v3(bucket2->p, bucket1->p); BLI_mirrorAlongAxis(bucket2->p, node->p, normal); @@ -1062,7 +1062,7 @@ void REEB_AxialSymmetry(BNode *root_node, BNode *node1, BNode *node2, struct BAr bucket1 = IT_next(iter1); bucket2 = IT_next(iter2); - /* Make sure they both start at the same value */ + /* Make sure they both start at the same value */ while (bucket1 && bucket1->val < bucket2->val) { bucket1 = IT_next(iter1); } @@ -1080,7 +1080,7 @@ void REEB_AxialSymmetry(BNode *root_node, BNode *node1, BNode *node2, struct BAr /* add bucket2 in bucket1 */ interp_v3_v3v3(bucket1->p, bucket1->p, bucket2->p, (float)bucket2->nv / (float)(bucket1->nv)); - /* copy and mirror back to bucket2 */ + /* copy and mirror back to bucket2 */ bucket2->nv = bucket1->nv; copy_v3_v3(bucket2->p, bucket1->p); BLI_mirrorAlongAxis(bucket2->p, root_node->p, nor); @@ -1212,7 +1212,7 @@ static void reweightArc(ReebGraph *rg, ReebArc *arc, ReebNode *start_node, float reweightArc(rg, next_arc, node, end_weight); } - /* update only if needed */ + /* update only if needed */ if (arc->head->weight != start_weight || arc->tail->weight != end_weight) { old_weight = arc->head->weight; /* backup head weight, other arcs need it intact, it will be fixed by the source arc */ @@ -1318,7 +1318,7 @@ static int joinSubgraphsEnds(ReebGraph *rg, float threshold, int nb_subgraphs) } joined = 1; - } + } } return joined; @@ -1450,7 +1450,7 @@ static void filterArc(ReebGraph *rg, ReebNode *newNode, ReebNode *removedNode, R arc->tail = newNode; } - // Remove looped arcs + // Remove looped arcs if (arc->head == arc->tail) { // v1 or v2 was already newNode, since we're removing an arc, decrement degree NodeDegreeDecrement(rg, newNode); @@ -1648,7 +1648,7 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold)) BLI_sortlist(&rg->arcs, compareArcs); #ifdef DEBUG_REEB - { + { EditFace *efa; for (efa = G.editMesh->faces.first; efa; efa = efa->next) { efa->tmp.fp = -1; @@ -1731,7 +1731,7 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold)) efa->tmp.fp = saacos(fabs(angle)); #endif #else - add_v3_v3(avg_vec, efa->n); + add_v3_v3(avg_vec, efa->n); #endif } @@ -1873,7 +1873,7 @@ static int compareVerts(const void *a, const void *b) value = 1; } - return value; + return value; } static void spreadWeight(EditMesh *em) @@ -1947,7 +1947,7 @@ void REEB_exportGraph(ReebGraph *rg, int count) fprintf(f, "angle %0.3f %0.3f %0.3f %0.3f %i\n", p[0], p[1], p[2], arc->angle, BLI_ghash_size(arc->faces)); exportNode(f, "v2", arc->tail); - } + } fclose(f); } @@ -1983,7 +1983,7 @@ void removeNormalNodes(ReebGraph *rg) /* If arcs are one after the other */ if (arc->head == connectedArc->tail) { - /* remove furthest arc */ + /* remove furthest arc */ if (arc->tail->weight < connectedArc->head->weight) { mergeConnectedArcs(rg, arc, connectedArc); nextArc = arc->next; @@ -2006,7 +2006,7 @@ void removeNormalNodes(ReebGraph *rg) /* If arcs are one after the other */ if (arc->tail == connectedArc->head) { - /* remove furthest arc */ + /* remove furthest arc */ if (arc->head->weight < connectedArc->tail->weight) { mergeConnectedArcs(rg, arc, connectedArc); nextArc = arc->next; @@ -2092,7 +2092,7 @@ void mergeArcEdges(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc, MergeDirection d newEdge->nextEdge = e; - // if edge was the first in the list, point the edit edge to the new reeb edge instead. + // if edge was the first in the list, point the edit edge to the new reeb edge instead. if (*p == e) { *p = (void *)newEdge; } @@ -2289,12 +2289,12 @@ static ReebEdge *createArc(ReebGraph *rg, ReebNode *node1, ReebNode *node2) arc->faces = BLI_ghash_ptr_new("createArc gh"); if (node1->weight <= node2->weight) { - v1 = node1; - v2 = node2; + v1 = node1; + v2 = node2; } else { - v1 = node2; - v2 = node1; + v1 = node2; + v2 = node1; } arc->head = v1; @@ -2857,7 +2857,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges) /* Apply dijkstra spf for each selected vert */ for (eve = em->verts.first; eve; eve = eve->next) { if (eve->f & SELECT) { - shortestPathsFromVert(em, eve, indexed_edges); + shortestPathsFromVert(em, eve, indexed_edges); } } @@ -2927,7 +2927,7 @@ static void initIteratorFct(ReebArcIterator *iter) iter->next = nextBucket; iter->nextN = nextNBucket; iter->previous = previousBucket; - iter->stopped = iteratorStopped; + iter->stopped = iteratorStopped; } static void setIteratorValues(ReebArcIterator *iter, EmbedBucket *bucket) @@ -3419,7 +3419,7 @@ void REEB_draw() if (G.scene->toolsettings->skgen_options & SKGEN_DISP_EMBED) { - glColor3f(1, 1, 1); + glColor3f(1, 1, 1); glBegin(GL_POINTS); glVertex3fv(arc->head->p); glVertex3fv(arc->tail->p); diff --git a/source/blender/editors/armature/reeb.h b/source/blender/editors/armature/reeb.h index bb8b3003baf..b0e1fd3ae34 100644 --- a/source/blender/editors/armature/reeb.h +++ b/source/blender/editors/armature/reeb.h @@ -114,7 +114,7 @@ typedef struct ReebArc { int bcount; struct EmbedBucket *buckets; - struct GHash *faces; + struct GHash *faces; float angle; struct ReebArc *link_up; /* for multi resolution filtering, points to higher levels */ } ReebArc; diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 874b31dd1ca..9ae5d3ca557 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -162,9 +162,9 @@ static short select_beztriple(BezTriple *bezt, short selstatus, short flag, shor bezt->f1 |= flag; bezt->f2 |= flag; bezt->f3 |= flag; - return 1; + return 1; } - else { /* deselects */ + else { /* deselects */ bezt->f1 &= ~flag; bezt->f2 &= ~flag; bezt->f3 &= ~flag; @@ -1361,7 +1361,7 @@ static int separate_exec(bContext *C, wmOperator *op) oldedit = oldcu->editnurb; if (oldcu->key) { - BKE_report(op->reports, RPT_ERROR, "Can't separate a curve with vertex keys"); + BKE_report(op->reports, RPT_ERROR, "Cannot separate a curve with vertex keys"); return OPERATOR_CANCELLED; } @@ -2063,7 +2063,7 @@ static int set_goal_weight_exec(bContext *C, wmOperator *op) bp->weight = weight; } } - } + } DAG_id_tag_update(obedit->data, 0); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); @@ -2115,7 +2115,7 @@ static int set_radius_exec(bContext *C, wmOperator *op) bp->radius = radius; } } - } + } WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); DAG_id_tag_update(obedit->data, 0); @@ -2408,7 +2408,7 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short for (nu = editnurb->first; nu; nu = nu->next) { lastsel = 0; - if (nu->type == CU_BEZIER) { + if (nu->type == CU_BEZIER) { a = nu->pntsu; bezt = nu->bezt; if (next < 0) bezt = &nu->bezt[a - 1]; @@ -2425,7 +2425,7 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short bezt += next; lastsel = 0; } - /* move around in zigzag way so that we go through each */ + /* move around in zigzag way so that we go through each */ bezt -= (next - next / abs(next)); } } @@ -2440,7 +2440,7 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short if (!(bp->f1 & SELECT) || (selstatus == 0)) { short sel = select_bpoint(bp, selstatus, 1, VISIBLE); if ((sel == 1) && (cont == 0)) lastsel = 1; - } + } } else { bp += next; @@ -2706,7 +2706,7 @@ static int hide_exec(bContext *C, wmOperator *op) DAG_id_tag_update(obedit->data, 0); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); - return OPERATOR_FINISHED; + return OPERATOR_FINISHED; } void CURVE_OT_hide(wmOperatorType *ot) @@ -2767,7 +2767,7 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) DAG_id_tag_update(obedit->data, 0); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); - return OPERATOR_FINISHED; + return OPERATOR_FINISHED; } void CURVE_OT_reveal(wmOperatorType *ot) @@ -3091,7 +3091,7 @@ static void subdividenurb(Object *obedit, int number_cuts) nu->pntsv = (number_cuts + 1) * nu->pntsv - number_cuts; BKE_nurb_knot_calc_u(nu); BKE_nurb_knot_calc_v(nu); - } /* End of 'if (sel == nu->pntsu*nu->pntsv)' (subdivide entire NURB) */ + } /* End of 'if (sel == nu->pntsu * nu->pntsv)' (subdivide entire NURB) */ else { /* subdivide in v direction? */ sel = 0; @@ -3200,7 +3200,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); DAG_id_tag_update(obedit->data, 0); - return OPERATOR_FINISHED; + return OPERATOR_FINISHED; } void CURVE_OT_subdivide(wmOperatorType *ot) @@ -3501,7 +3501,7 @@ static int set_spline_type_exec(bContext *C, wmOperator *op) int changed = 0, type = RNA_enum_get(op->ptr, "type"); if (type == CU_CARDINAL || type == CU_BSPLINE) { - BKE_report(op->reports, RPT_ERROR, "Not implemented yet"); + BKE_report(op->reports, RPT_ERROR, "Not yet implemented"); return OPERATOR_CANCELLED; } @@ -3833,7 +3833,7 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu } if (nu1->pntsv != nu2->pntsv) { - BKE_report(op->reports, RPT_ERROR, "Resolution doesn't match"); + BKE_report(op->reports, RPT_ERROR, "Resolution does not match"); return; } @@ -3943,7 +3943,7 @@ static int merge_nurb(bContext *C, wmOperator *op) } if (ok == 0) { - BKE_report(op->reports, RPT_ERROR, "Resolution doesn't match"); + BKE_report(op->reports, RPT_ERROR, "Resolution does not match"); BLI_freelistN(&nsortbase); return OPERATOR_CANCELLED; } @@ -4123,7 +4123,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) } if (!ok) { - BKE_report(op->reports, RPT_ERROR, "Can't make segment"); + BKE_report(op->reports, RPT_ERROR, "Cannot make segment"); return OPERATOR_CANCELLED; } @@ -4376,7 +4376,7 @@ static int spin_exec(bContext *C, wmOperator *op) unit_m4(viewmat); if (!spin_nurb(viewmat, obedit, axis, cent)) { - BKE_report(op->reports, RPT_ERROR, "Can't spin"); + BKE_report(op->reports, RPT_ERROR, "Cannot spin"); return OPERATOR_CANCELLED; } @@ -5252,10 +5252,10 @@ static int select_more_exec(bContext *C, wmOperator *UNUSED(op)) tempbp = bp + 1; if (!(tempbp->f1 & SELECT)) sel = select_bpoint(tempbp, SELECT, 1, VISIBLE); if (sel) { - bp++; + bp++; a--; } - } + } } bp++; @@ -5313,8 +5313,8 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) if ((bp->hide == 0) && (bp->f1 & SELECT)) { sel = 0; - /* check if neighbors have been selected */ - /* edges of surface are an exception */ + /* check if neighbors have been selected */ + /* edges of surface are an exception */ if ((a + 1) % nu->pntsu == 0) sel++; else { bp--; @@ -5346,7 +5346,7 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) if (sel != 4) { select_bpoint(bp, DESELECT, 1, VISIBLE); selbpoints[a] = 1; - } + } } else lastsel = 0; @@ -5360,7 +5360,7 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) for (nu = editnurb->first; nu; nu = nu->next) { lastsel = 0; /* check what type of curve/nurb it is */ - if (nu->type == CU_BEZIER) { + if (nu->type == CU_BEZIER) { a = nu->pntsu; bezt = nu->bezt; while (a--) { @@ -5368,10 +5368,10 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) if (lastsel == 1) sel = 1; else sel = 0; - /* check if neighbors have been selected */ - /* first and last are exceptions */ + /* check if neighbors have been selected */ + /* first and last are exceptions */ if (a == nu->pntsu - 1) sel++; - else { + else { bezt--; if ((bezt->hide == 0) && (bezt->f2 & SELECT)) sel++; bezt++; @@ -5385,14 +5385,14 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) } if (sel != 2) { - select_beztriple(bezt, DESELECT, 1, VISIBLE); + select_beztriple(bezt, DESELECT, 1, VISIBLE); lastsel = 1; } else lastsel = 0; } else lastsel = 0; - bezt++; + bezt++; } } else { @@ -5403,9 +5403,9 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) if (lastsel != 0) sel = 1; else sel = 0; - /* first and last are exceptions */ + /* first and last are exceptions */ if (a == nu->pntsu * nu->pntsv - 1) sel++; - else { + else { bp--; if ((bp->hide == 0) && (bp->f1 & SELECT)) sel++; bp++; @@ -5419,9 +5419,9 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) } if (sel != 2) { - select_bpoint(bp, DESELECT, 1, VISIBLE); + select_bpoint(bp, DESELECT, 1, VISIBLE); lastsel = 1; - } + } else lastsel = 0; } else lastsel = 0; @@ -5482,7 +5482,7 @@ static void selectrandom_curve(ListBase *editnurb, float randfac) select_bpoint(bp, SELECT, 1, VISIBLE); bp++; } - } + } } } @@ -5624,10 +5624,10 @@ static int select_nth_exec(bContext *C, wmOperator *op) if (!CU_select_nth(obedit, nth)) { if (obedit->type == OB_SURF) { - BKE_report(op->reports, RPT_ERROR, "Surface hasn't got active point"); + BKE_report(op->reports, RPT_ERROR, "Surface has not got active point"); } else { - BKE_report(op->reports, RPT_ERROR, "Curve hasn't got active point"); + BKE_report(op->reports, RPT_ERROR, "Curve has not got active point"); } return OPERATOR_CANCELLED; @@ -6627,7 +6627,7 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf) if (obedit == NULL || obedit->type != OB_SURF) { obedit = ED_object_add_type(C, OB_SURF, loc, rot, TRUE, layer); newob = 1; - } + } else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA); } diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index b379ce6e5cf..2d039cfaf7f 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -310,7 +310,7 @@ static int insert_lorem_exec(bContext *C, wmOperator *UNUSED(op)) lastlorem = ED_lorem; insert_into_textbuf(obedit, '\n'); - insert_into_textbuf(obedit, '\n'); + insert_into_textbuf(obedit, '\n'); DAG_id_tag_update(obedit->data, 0); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); @@ -458,7 +458,7 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, float nchars += strlen(tmp->line) + 1; if (cu->str) MEM_freeN(cu->str); - if (cu->strinfo) MEM_freeN(cu->strinfo); + if (cu->strinfo) MEM_freeN(cu->strinfo); cu->str = MEM_callocN(nchars + 4, "str"); cu->strinfo = MEM_callocN((nchars + 4) * sizeof(CharInfo), "strinfo"); @@ -757,7 +757,7 @@ static int paste_selection(Object *obedit, ReportList *reports) /* Verify that the copy buffer => [copy buffer len] + cu->len < MAXTEXT */ if (cu->len + len <= MAXTEXT) { - if (len) { + if (len) { int size = (cu->len * sizeof(wchar_t)) - (cu->pos * sizeof(wchar_t)) + sizeof(wchar_t); memmove(ef->textbuf + cu->pos + len, ef->textbuf + cu->pos, size); memcpy(ef->textbuf + cu->pos, ef->copybuf, len * sizeof(wchar_t)); @@ -835,7 +835,7 @@ static int move_cursor(bContext *C, int type, int select) if (ef->textbuf[cu->pos - 1] == '\n') break; if (ef->textbufinfo[cu->pos - 1].flag & CU_CHINFO_WRAP) break; cu->pos--; - } + } cursmove = FO_CURS; break; @@ -868,7 +868,7 @@ static int move_cursor(bContext *C, int type, int select) cursmove = FO_CURS; break; - case NEXT_CHAR: + case NEXT_CHAR: if ((select) && (cu->selstart == 0)) cu->selstart = cu->selend = cu->pos + 1; cu->pos++; cursmove = FO_CURS; diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 3b26c46a410..11e07584405 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -98,8 +98,8 @@ static void gp_draw_stroke_buffer(tGPspoint *points, int totpoints, short thickn if (dflag & (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_ONLYV2D)) return; - /* if drawing a single point, draw it larger */ - if (totpoints == 1) { + /* if drawing a single point, draw it larger */ + if (totpoints == 1) { /* draw point */ glBegin(GL_POINTS); glVertex2iv(&points->x); @@ -315,7 +315,7 @@ static void gp_draw_stroke(bGPDspoint *points, int totpoints, short thickness_s, s0[1] = (pt1->y / 100 * winy) + offsy; s1[0] = (pt2->x / 100 * winx) + offsx; s1[1] = (pt2->y / 100 * winy) + offsy; - } + } /* calculate gradient and normal - 'angle'=(ny/nx) */ m1[1] = s1[1] - s0[1]; @@ -331,7 +331,7 @@ static void gp_draw_stroke(bGPDspoint *points, int totpoints, short thickness_s, if (i == 0) { /* draw start cap first * - make points slightly closer to center (about halfway across) - */ + */ mt[0] = m2[0] * pthick * 0.5f; mt[1] = m2[1] * pthick * 0.5f; sc[0] = s0[0] - (m1[0] * pthick * 0.75f); @@ -382,7 +382,7 @@ static void gp_draw_stroke(bGPDspoint *points, int totpoints, short thickness_s, if (((athick * 2.0f) < pthick) && (IS_EQF(athick, pthick) == 0)) { mt[0] += (mb[0] * dfac); mt[1] += (mb[1] * dfac); - } + } /* calculate points for start of segment */ t0[0] = s0[0] - mt[0]; @@ -420,7 +420,7 @@ static void gp_draw_stroke(bGPDspoint *points, int totpoints, short thickness_s, /* draw end cap as last step * - make points slightly closer to center (about halfway across) - */ + */ mt[0] = m2[0] * pthick * 0.5f; mt[1] = m2[1] * pthick * 0.5f; sc[0] = s1[0] + (m1[0] * pthick * 0.75f); @@ -531,7 +531,7 @@ static void gp_draw_strokes(bGPDframe *gpf, int offsx, int offsy, int winx, int #endif } } - else if (gps->totpoints > 1) + else if (gps->totpoints > 1) gp_draw_stroke(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, offsx, offsy, winx, winy); } } @@ -611,7 +611,7 @@ static void gp_draw_data(bGPdata *gpd, int offsx, int offsy, int winx, int winy, } else break; - } + } /* restore alpha */ glColor4fv(color); @@ -661,11 +661,11 @@ static void gp_draw_data(bGPdata *gpd, int offsx, int offsy, int winx, int winy, /* ----- Grease Pencil Sketches Drawing API ------ */ -// ............................ -// XXX -// We need to review the calls below, since they may be/are not that suitable for -// the new ways that we intend to be drawing data... -// ............................ +/* ............................ + * XXX + * We need to review the calls below, since they may be/are not that suitable for + * the new ways that we intend to be drawing data... + * ............................ */ /* draw grease-pencil sketches to specified 2d-view that uses ibuf corrections */ void draw_gpencil_2dimage(const bContext *C) diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index b69db0040b5..a59a3f7a5ec 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -393,7 +393,7 @@ void paste_gpdata(Scene *scene) ScrArea *sa; /* get area that gp-data comes from */ - //sa= gpencil_data_findowner((bGPdata *)ale->owner); + //sa = gpencil_data_findowner((bGPdata *)ale->owner); sa = NULL; /* this should be the right frame... as it may be a pre-existing frame, diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 46df8ba5fac..ed8a1ea8280 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -212,7 +212,7 @@ static int gp_data_add_exec(bContext *C, wmOperator *op) bGPdata **gpd_ptr = gpencil_data_get_pointers(C, NULL); if (gpd_ptr == NULL) { - BKE_report(op->reports, RPT_ERROR, "Nowhere for Grease Pencil data to go"); + BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go"); return OPERATOR_CANCELLED; } else { @@ -260,7 +260,7 @@ static int gp_data_unlink_exec(bContext *C, wmOperator *op) bGPdata **gpd_ptr = gpencil_data_get_pointers(C, NULL); if (gpd_ptr == NULL) { - BKE_report(op->reports, RPT_ERROR, "Nowhere for Grease Pencil data to go"); + BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go"); return OPERATOR_CANCELLED; } else { @@ -299,7 +299,7 @@ static int gp_layer_add_exec(bContext *C, wmOperator *op) /* if there's no existing Grease-Pencil data there, add some */ if (gpd_ptr == NULL) { - BKE_report(op->reports, RPT_ERROR, "Nowhere for Grease Pencil data to go"); + BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go"); return OPERATOR_CANCELLED; } if (*gpd_ptr == NULL) @@ -348,7 +348,7 @@ static int gp_actframe_delete_exec(bContext *C, wmOperator *op) /* if there's no existing Grease-Pencil data there, add some */ if (gpd == NULL) { - BKE_report(op->reports, RPT_ERROR, "No Grease Pencil data"); + BKE_report(op->reports, RPT_ERROR, "No grease pencil data"); return OPERATOR_CANCELLED; } if (ELEM(NULL, gpl, gpf)) { @@ -634,7 +634,7 @@ static int gp_convert_layer_exec(bContext *C, wmOperator *op) /* check if there's data to work with */ if (gpd == NULL) { - BKE_report(op->reports, RPT_ERROR, "No Grease Pencil data to work on"); + BKE_report(op->reports, RPT_ERROR, "No grease pencil data to work on"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index e5afbdba50b..42ea924522c 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -536,7 +536,7 @@ static void gp_stroke_simplify(tGPsdata *p) j += 2; } - } + } /* free old buffer */ MEM_freeN(old_points); @@ -860,7 +860,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, } } } - else { + else { /* loop over the points in the stroke, checking for intersections * - an intersection will require the stroke to be split */ @@ -959,8 +959,8 @@ static int gp_session_initdata(bContext *C, tGPsdata *p) /* supported views first */ case SPACE_VIEW3D: { - // View3D *v3d= curarea->spacedata.first; - // RegionView3D *rv3d= ar->regiondata; + // View3D *v3d = curarea->spacedata.first; + // RegionView3D *rv3d = ar->regiondata; /* set current area * - must verify that region data is 3D-view (and not something else) @@ -979,7 +979,7 @@ static int gp_session_initdata(bContext *C, tGPsdata *p) case SPACE_NODE: { - //SpaceNode *snode= curarea->spacedata.first; + //SpaceNode *snode = curarea->spacedata.first; /* set current area */ p->sa = curarea; @@ -1007,7 +1007,7 @@ static int gp_session_initdata(bContext *C, tGPsdata *p) break; case SPACE_IMAGE: { - //SpaceImage *sima= curarea->spacedata.first; + //SpaceImage *sima = curarea->spacedata.first; /* set the current area */ p->sa = curarea; @@ -1210,7 +1210,7 @@ static void gp_paint_initstroke(tGPsdata *p, short paintmode) /* make strokes be drawn in screen space */ p->gpd->sbuffer_sflag &= ~GP_STROKE_2DSPACE; p->gpd->flag &= ~GP_DATA_VIEWALIGN; - } + } else p->gpd->sbuffer_sflag |= GP_STROKE_2DSPACE; } @@ -1342,7 +1342,7 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op) gp_session_cleanup(p); /* finally, free the temp data */ - MEM_freeN(p); + MEM_freeN(p); } op->customdata = NULL; @@ -1790,7 +1790,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event) if (p->status == GP_STATUS_ERROR) { estate = OPERATOR_CANCELLED; } - } + } else { p->status = GP_STATUS_IDLING; } diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index f55f7755668..078762065b4 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -61,6 +61,7 @@ struct BMEditMesh; struct BMEditSelection; struct BMesh; struct BMVert; +struct BMLoop; struct MLoopCol; struct BMEdge; struct BMFace; @@ -118,6 +119,7 @@ void EDBM_update_generic(struct bContext *C, struct BMEditMesh *em, const short struct UvElementMap *EDBM_uv_element_map_create(struct BMEditMesh *em, int selected, int doIslands); void EDBM_uv_element_map_free(struct UvElementMap *vmap); +struct UvElement *ED_uv_element_get(struct UvElementMap *map, struct BMFace *efa, struct BMLoop *l); int EDBM_mtexpoly_check(struct BMEditMesh *em); struct MTexPoly *EDBM_mtexpoly_active_get(struct BMEditMesh *em, struct BMFace **r_act_efa, int sloppy, int selected); diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index d6ac9eb750d..0d0b8d8e797 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -203,4 +203,3 @@ void ED_object_select_linked_by_id(struct bContext *C, struct ID *id); #endif #endif /* __ED_OBJECT_H__ */ - diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h index 527ebb6c3ef..9f42fd042c3 100644 --- a/source/blender/editors/include/ED_screen_types.h +++ b/source/blender/editors/include/ED_screen_types.h @@ -94,7 +94,7 @@ typedef struct AZone { /* for draw */ short x1, y1, x2, y2; /* for clip */ - rcti rect; + rcti rect; } AZone; /* actionzone type */ diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index fc24f68f2d1..bd85e93f1af 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -263,6 +263,7 @@ void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d); int ED_view3d_scene_layer_set(int lay, const int *values, int *active); int ED_view3d_context_activate(struct bContext *C); +void ED_view3d_draw_offscreen_init(struct Scene *scene, struct View3D *v3d); void ED_view3d_draw_offscreen(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int winx, int winy, float viewmat[][4], float winmat[][4], int do_bgpic, int colormanage_background); @@ -294,6 +295,7 @@ struct BGpic *ED_view3D_background_image_new(struct View3D *v3d); void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic); void ED_view3D_background_image_clear(struct View3D *v3d); +float ED_view3d_offset_distance(float mat[4][4], float ofs[3]); float ED_view3d_grid_scale(struct Scene *scene, struct View3D *v3d, const char **grid_unit); /* view matrix properties utilities */ diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h index 8f50edd1240..e400e44e944 100644 --- a/source/blender/editors/include/UI_icons.h +++ b/source/blender/editors/include/UI_icons.h @@ -94,7 +94,7 @@ DEF_ICON(LINK) DEF_ICON(INLINK) DEF_ICON(PLUGIN) - /* various ui */ + /* various ui */ DEF_ICON(HELP) DEF_ICON(GHOST_ENABLED) DEF_ICON(COLOR) @@ -799,13 +799,12 @@ DEF_ICON(NDOF_TRANS) DEF_ICON(LAYER_USED) DEF_ICON(LAYER_ACTIVE) #ifndef DEF_ICON_BLANK_SKIP + /* available */ DEF_ICON(BLANK254) DEF_ICON(BLANK255) DEF_ICON(BLANK256) DEF_ICON(BLANK257) DEF_ICON(BLANK257b) - - /* available */ DEF_ICON(BLANK258) DEF_ICON(BLANK259) DEF_ICON(BLANK260) @@ -890,8 +889,8 @@ DEF_ICON(FORWARD) DEF_ICON(BLANK313) DEF_ICON(BLANK314) DEF_ICON(BLANK315) - DEF_ICON(BLANK316) #endif +DEF_ICON(FILE_BACKUP) DEF_ICON(DISK_DRIVE) /* SHADING / TEXT */ diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 5d2709f0488..ed4b4ae027f 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -106,9 +106,9 @@ typedef struct uiLayout uiLayout; /* uiBlock->flag (controls) */ #define UI_BLOCK_LOOP 1 #define UI_BLOCK_REDRAW 2 -#define UI_BLOCK_RET_1 4 /* XXX 2.5 not implemented */ +#define UI_BLOCK_SEARCH_MENU 4 #define UI_BLOCK_NUMSELECT 8 -/*#define UI_BLOCK_ENTER_OK 16*/ /*UNUSED*/ +#define UI_BLOCK_NO_WIN_CLIP 16 /* don't apply window clipping */ /* was UI_BLOCK_ENTER_OK */ #define UI_BLOCK_CLIPBOTTOM 32 #define UI_BLOCK_CLIPTOP 64 #define UI_BLOCK_MOVEMOUSE_QUIT 128 diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index fcde4186778..b8e4fec1259 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -238,7 +238,7 @@ static void ui_text_bounds_block(uiBlock *block, float offset) bt->rect.xmax = bt->rect.xmin + i + block->bounds; if (col == lastcol) { - bt->rect.xmax = maxf(bt->rect.xmax, offset + block->minbounds); + bt->rect.xmax = max_ff(bt->rect.xmax, offset + block->minbounds); } ui_check_but(bt); /* clips text again */ @@ -275,7 +275,7 @@ void ui_bounds_block(uiBlock *block) block->rect.ymax += block->bounds; } - block->rect.xmax = block->rect.xmin + maxf(BLI_rctf_size_x(&block->rect), block->minbounds); + block->rect.xmax = block->rect.xmin + max_ff(BLI_rctf_size_x(&block->rect), block->minbounds); /* hardcoded exception... but that one is annoying with larger safety */ bt = block->buttons.first; @@ -527,7 +527,7 @@ static void ui_draw_links(uiBlock *block) foundselectline = TRUE; } } - } + } /* Draw any active lines (lines with either button being hovered over). * Do this last so they appear on top of inactive lines. */ @@ -539,7 +539,7 @@ static void ui_draw_links(uiBlock *block) ui_draw_linkline(line, !foundselectline); } } - } + } } } @@ -581,7 +581,7 @@ static void ui_but_update_linklines(uiBlock *block, uiBut *oldbut, uiBut *newbut if (line->from == newbut) line->from = oldbut; } - } + } /* check all other button links */ for (but = block->buttons.first; but; but = but->next) { @@ -610,28 +610,28 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut if (ui_but_equals_old(oldbut, but)) { if (oldbut->active) { #if 0 -// but->flag= oldbut->flag; +// but->flag = oldbut->flag; #else /* exception! redalert flag can't be update from old button. * perhaps it should only copy specific flags rather than all. */ -// but->flag= (oldbut->flag & ~UI_BUT_REDALERT) | (but->flag & UI_BUT_REDALERT); +// but->flag = (oldbut->flag & ~UI_BUT_REDALERT) | (but->flag & UI_BUT_REDALERT); #endif -// but->active= oldbut->active; -// but->pos= oldbut->pos; -// but->ofs= oldbut->ofs; -// but->editstr= oldbut->editstr; -// but->editval= oldbut->editval; -// but->editvec= oldbut->editvec; -// but->editcoba= oldbut->editcoba; -// but->editcumap= oldbut->editcumap; -// but->selsta= oldbut->selsta; -// but->selend= oldbut->selend; -// but->softmin= oldbut->softmin; -// but->softmax= oldbut->softmax; -// but->linkto[0]= oldbut->linkto[0]; -// but->linkto[1]= oldbut->linkto[1]; +// but->active = oldbut->active; +// but->pos = oldbut->pos; +// but->ofs = oldbut->ofs; +// but->editstr = oldbut->editstr; +// but->editval = oldbut->editval; +// but->editvec = oldbut->editvec; +// but->editcoba = oldbut->editcoba; +// but->editcumap = oldbut->editcumap; +// but->selsta = oldbut->selsta; +// but->selend = oldbut->selend; +// but->softmin = oldbut->softmin; +// but->softmax = oldbut->softmax; +// but->linkto[0] = oldbut->linkto[0]; +// but->linkto[1] = oldbut->linkto[1]; found = 1; -// oldbut->active= NULL; +// oldbut->active = NULL; /* move button over from oldblock to new block */ BLI_remlink(&oldblock->buttons, oldbut); @@ -1270,7 +1270,7 @@ void ui_delete_linkline(uiLinkLine *line, uiBut *but) (*(link->ppoin))[b] = (*(link->ppoin))[a]; b++; } - } + } (*(link->totlink))--; } } @@ -1303,7 +1303,7 @@ void ui_get_but_vectorf(uiBut *but, float vec[3]) if (RNA_property_type(prop) == PROP_FLOAT) { tot = RNA_property_array_length(&but->rnapoin, prop); - tot = MIN2(tot, 3); + tot = min_ii(tot, 3); for (a = 0; a < tot; a++) vec[a] = RNA_property_float_get_index(&but->rnapoin, prop, a); @@ -1348,7 +1348,7 @@ void ui_set_but_vectorf(uiBut *but, const float vec[3]) int a; tot = RNA_property_array_length(&but->rnapoin, prop); - tot = MIN2(tot, 3); + tot = min_ii(tot, 3); for (a = 0; a < tot; a++) { RNA_property_float_set_index(&but->rnapoin, prop, a, vec[a]); @@ -1391,7 +1391,7 @@ int ui_is_but_unit(uiBut *but) return 0; #endif - /* for now disable time unit conversion */ + /* for now disable time unit conversion */ if (unit_type == PROP_UNIT_TIME) return 0; @@ -1464,16 +1464,16 @@ double ui_get_but_val(uiBut *but) case 'S': value = hsv[1]; break; case 'V': value = hsv[2]; break; } - } + } else if (but->pointype == UI_BUT_POIN_CHAR) { value = *(char *)but->poin; } else if (but->pointype == UI_BUT_POIN_SHORT) { value = *(short *)but->poin; - } + } else if (but->pointype == UI_BUT_POIN_INT) { value = *(int *)but->poin; - } + } else if (but->pointype == UI_BUT_POIN_FLOAT) { value = *(float *)but->poin; } @@ -1697,7 +1697,7 @@ void ui_get_but_string(uiBut *but, char *str, size_t maxlen) } else if (buf && buf != str) { /* string was too long, we have to truncate */ - memcpy(str, buf, MIN2(maxlen, buf_len + 1)); + memcpy(str, buf, MIN2(maxlen, (size_t)buf_len + 1)); MEM_freeN(buf); } } @@ -1947,8 +1947,8 @@ void ui_set_but_soft_range(uiBut *but, double value) RNA_property_int_ui_range(&but->rnapoin, but->rnaprop, &imin, &imax, &istep); softmin = (imin == INT_MIN) ? -1e4 : imin; softmax = (imin == INT_MAX) ? 1e4 : imax; - /*step= istep;*/ /*UNUSED*/ - /*precision= 1;*/ /*UNUSED*/ + /*step = istep;*/ /*UNUSED*/ + /*precision = 1;*/ /*UNUSED*/ if (array_len >= 2) { int value_range[2]; @@ -1964,8 +1964,8 @@ void ui_set_but_soft_range(uiBut *but, double value) RNA_property_float_ui_range(&but->rnapoin, but->rnaprop, &fmin, &fmax, &fstep, &fprecision); softmin = (fmin == -FLT_MAX) ? (float)-1e4 : fmin; softmax = (fmax == FLT_MAX) ? (float)1e4 : fmax; - /*step= fstep;*/ /*UNUSED*/ - /*precision= fprecision;*/ /*UNUSED*/ + /*step = fstep;*/ /*UNUSED*/ + /*precision = fprecision;*/ /*UNUSED*/ if (array_len >= 2) { float value_range[2]; @@ -2006,7 +2006,7 @@ void ui_set_but_soft_range(uiBut *but, double value) static void ui_free_link(uiLink *link) { - if (link) { + if (link) { BLI_freelistN(&link->lines); MEM_freeN(link); } @@ -2055,7 +2055,7 @@ void uiFreeBlock(const bContext *C, uiBlock *block) uiBut *but; while ( (but = block->buttons.first) ) { - BLI_remlink(&block->buttons, but); + BLI_remlink(&block->buttons, but); ui_free_but(C, but); } @@ -2256,7 +2256,7 @@ void ui_check_but(uiBut *but) /* safety is 4 to enable small number buttons (like 'users') */ - // okwidth= -4 + (BLI_rcti_size_x(&but->rect)); // UNUSED + // okwidth = -4 + (BLI_rcti_size_x(&but->rect)); // UNUSED /* name: */ switch (but->type) { @@ -2398,7 +2398,7 @@ void uiBlockBeginAlign(uiBlock *block) /* if other align was active, end it */ if (block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block); - block->flag |= UI_BUT_ALIGN_DOWN; + block->flag |= UI_BUT_ALIGN_DOWN; block->alignnr++; /* buttons declared after this call will get this align nr */ // XXX flag? @@ -2439,7 +2439,7 @@ static void ui_block_do_align_but(uiBut *first, short nr) } } - /* rows==0: 1 row, cols==0: 1 column */ + /* rows == 0: 1 row, cols == 0: 1 column */ /* note; how it uses 'flag' in loop below (either set it, or OR it) is confusing */ for (but = first, prev = NULL; but && but->alignnr == nr; prev = but, but = but->next) { diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 010df0cbfbc..a73954e2075 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -160,13 +160,13 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl /* get current color, needs to be outside of glBegin/End */ glGetFloatv(GL_CURRENT_COLOR, color); - /* 'shade' defines strength of shading */ - coltop[0] = minf(1.0f, color[0] + shadetop); - coltop[1] = minf(1.0f, color[1] + shadetop); - coltop[2] = minf(1.0f, color[2] + shadetop); - coldown[0] = maxf(0.0f, color[0] + shadedown); - coldown[1] = maxf(0.0f, color[1] + shadedown); - coldown[2] = maxf(0.0f, color[2] + shadedown); + /* 'shade' defines strength of shading */ + coltop[0] = min_ff(1.0f, color[0] + shadetop); + coltop[1] = min_ff(1.0f, color[1] + shadetop); + coltop[2] = min_ff(1.0f, color[2] + shadetop); + coldown[0] = max_ff(0.0f, color[0] + shadedown); + coldown[1] = max_ff(0.0f, color[1] + shadedown); + coldown[2] = max_ff(0.0f, color[2] + shadedown); glShadeModel(GL_SMOOTH); glBegin(mode); @@ -269,13 +269,13 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float /* get current color, needs to be outside of glBegin/End */ glGetFloatv(GL_CURRENT_COLOR, color); - /* 'shade' defines strength of shading */ - colLeft[0] = minf(1.0f, color[0] + shadeLeft); - colLeft[1] = minf(1.0f, color[1] + shadeLeft); - colLeft[2] = minf(1.0f, color[2] + shadeLeft); - colRight[0] = maxf(0.0f, color[0] + shadeRight); - colRight[1] = maxf(0.0f, color[1] + shadeRight); - colRight[2] = maxf(0.0f, color[2] + shadeRight); + /* 'shade' defines strength of shading */ + colLeft[0] = min_ff(1.0f, color[0] + shadeLeft); + colLeft[1] = min_ff(1.0f, color[1] + shadeLeft); + colLeft[2] = min_ff(1.0f, color[2] + shadeLeft); + colRight[0] = max_ff(0.0f, color[0] + shadeRight); + colRight[1] = max_ff(0.0f, color[1] + shadeRight); + colRight[2] = max_ff(0.0f, color[2] + shadeRight); glShadeModel(GL_SMOOTH); glBegin(mode); @@ -510,7 +510,7 @@ static void ui_draw_but_CHARTAB(uiBut *but) if (G.selfont && BKE_vfont_is_builtin(G.selfont) == FALSE) { /* Is the font file packed, if so then use the packed file */ if (G.selfont->packedfile) { - pf = G.selfont->packedfile; + pf = G.selfont->packedfile; FTF_SetFont(pf->data, pf->size, 14.0); } else { @@ -608,7 +608,7 @@ static void ui_draw_but_CHARTAB(uiBut *but) ey -= buth; sx = rect->xmin; ex = rect->xmin + butw; - } + } glShadeModel(GL_FLAT); /* Return Font Settings to original */ @@ -1221,7 +1221,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect) glColor3ub(255, 255, 255); glVertex2fv(v2); glVertex2fv(v3); - } + } } glEnd(); @@ -1707,7 +1707,7 @@ static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float s glVertex2f(maxx, miny - shadsize); glEnd(); - /* bottom quad */ + /* bottom quad */ glBegin(GL_POLYGON); glColor4ub(0, 0, 0, alpha); glVertex2f(minx + 0.3f * shadsize, miny); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index c4440cf07ed..55b20bddd80 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -704,7 +704,7 @@ static int ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, wmEvent *event) BLI_rcti_rctf_copy(&rect, &but->rect); - if (but->imb) { + if (but->imb) { /* use button size itself */ } else if (but->flag & UI_ICON_LEFT) { @@ -774,7 +774,7 @@ static void ui_delete_active_linkline(uiBlock *block) (*(link->ppoin))[b] = (*(link->ppoin))[a]; b++; } - } + } (*(link->totlink))--; } } @@ -1063,7 +1063,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut break; case HSVSLI: break; - case TOG3: + case TOG3: ui_apply_but_TOG3(C, but, data); break; case MENU: @@ -1109,10 +1109,10 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut case INLINK: ui_apply_but_LINK(C, but, data); break; - case BUT_IMAGE: + case BUT_IMAGE: ui_apply_but_IMAGE(C, but, data); break; - case HISTOGRAM: + case HISTOGRAM: ui_apply_but_HISTOGRAM(C, but, data); break; case WAVEFORM: @@ -1299,6 +1299,71 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, } } +/* ************************ password text ****************************** + * + * Functions to convert password strings that should not be displayed + * to asterisk representation (e.g. mysecretpasswd -> *************) + * + * It converts every UTF-8 character to an asterisk, and also remaps + * the cursor position and selection start/end. + * + * Note: remaping is used, because password could contain UTF-8 characters. + * + */ + +static int ui_text_position_from_hidden(uiBut *but, int pos) +{ + const char *strpos; + int i; + + for (i = 0, strpos = but->drawstr; i < pos; i++) + strpos = BLI_str_find_next_char_utf8(strpos, NULL); + + return (strpos - but->drawstr); +} + +static int ui_text_position_to_hidden(uiBut *but, int pos) +{ + return BLI_strnlen_utf8(but->drawstr, pos); +} + +void ui_button_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut *but, int restore) +{ + if (!(but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_PASSWORD)) + return; + + if (restore) { + /* restore original string */ + BLI_strncpy(but->drawstr, password_str, UI_MAX_DRAW_STR); + + /* remap cursor positions */ + if (but->pos >= 0) { + but->pos = ui_text_position_from_hidden(but, but->pos); + but->selsta = ui_text_position_from_hidden(but, but->selsta); + but->selend = ui_text_position_from_hidden(but, but->selend); + } + } + else { + /* convert text to hidden test using asterisks (e.g. pass -> ****) */ + int i, len = BLI_strlen_utf8(but->drawstr); + + /* remap cursor positions */ + if (but->pos >= 0) { + but->pos = ui_text_position_to_hidden(but, but->pos); + but->selsta = ui_text_position_to_hidden(but, but->selsta); + but->selend = ui_text_position_to_hidden(but, but->selend); + } + + /* save original string */ + BLI_strncpy(password_str, but->drawstr, UI_MAX_DRAW_STR); + + for (i = 0; i < len; i++) + but->drawstr[i] = '*'; + but->drawstr[i] = '\0'; + } +} + + /* ************* in-button text selection/editing ************* */ @@ -1322,13 +1387,15 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho uiStyle *style = UI_GetStyle(); // XXX pass on as arg uiFontStyle *fstyle = &style->widget; int startx = but->rect.xmin; - char *origstr; + char *origstr, password_str[UI_MAX_DRAW_STR]; uiStyleFontSet(fstyle); if (fstyle->kerning == 1) /* for BLF_width */ BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT); + ui_button_text_password_hide(password_str, but, FALSE); + origstr = MEM_callocN(sizeof(char) * data->maxlen, "ui_textedit origstr"); BLI_strncpy(origstr, but->drawstr, data->maxlen); @@ -1343,7 +1410,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho } /* mouse dragged outside the widget to the left */ - if (x < startx && but->ofs > 0) { + if (x < startx && but->ofs > 0) { int i = but->ofs; origstr[but->ofs] = 0; @@ -1407,6 +1474,8 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho if (fstyle->kerning == 1) BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT); + ui_button_text_password_hide(password_str, but, TRUE); + MEM_freeN(origstr); } @@ -1587,7 +1656,7 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio but->pos -= step; changed = 1; } - } + } } return changed; @@ -1676,7 +1745,7 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste if (cut) if ((but->selend - but->selsta) > 0) changed = ui_textedit_delete_selection(but, data); - } + } return changed; } @@ -1715,7 +1784,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) /* optional searchbox */ if (but->type == SEARCH_MENU) { data->searchbox = ui_searchbox_create(C, data->region, but); - ui_searchbox_update(C, data->searchbox, but, 1); /* 1= reset */ + ui_searchbox_update(C, data->searchbox, but, 1); /* 1 = reset */ } ui_check_but(but); @@ -2157,7 +2226,7 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data } /* this makes adjacent blocks auto open from now on */ - //if (but->block->auto_open ==0 ) but->block->auto_open = 1; + //if (but->block->auto_open == 0) but->block->auto_open = 1; } static void ui_blockopen_end(bContext *C, uiBut *but, uiHandleButtonData *data) @@ -2254,7 +2323,7 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data ED_region_tag_redraw(data->region); if (event->val == KM_PRESS) { - if (ISHOTKEY(event->type)) { + if (ISHOTKEY(event->type)) { if (WM_key_event_string(event->type)[0]) ui_set_but_val(but, event->type); @@ -2935,7 +3004,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton data->value = temp; else data->cancel = TRUE; - } + } else { if (f < tempf) tempf -= 0.01f; else tempf += 0.01f; @@ -2961,7 +3030,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event) { - int mx, my /*, click= 0 */; + int mx, my /*, click = 0 */; int retval = WM_UI_HANDLER_CONTINUE; int horizontal = (BLI_rctf_size_x(&but->rect) > BLI_rctf_size_y(&but->rect)); @@ -3336,7 +3405,7 @@ static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOF case UI_GRAD_V: hsv[2] += ndof->ry * sensitivity; break; - case UI_GRAD_V_ALT: + case UI_GRAD_V_ALT: /* vertical 'value' strip */ /* exception only for value strip - use the range set in but->min/max */ @@ -3460,7 +3529,7 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, float data->ungrab_mval[0] = mx_fl; data->ungrab_mval[1] = my_fl; { /* clamp */ - const float radius = minf(BLI_rctf_size_x(&but->rect), BLI_rctf_size_y(&but->rect)) / 2.0f; + const float radius = min_ff(BLI_rctf_size_x(&but->rect), BLI_rctf_size_y(&but->rect)) / 2.0f; const float cent[2] = {BLI_rctf_cent_x(&but->rect), BLI_rctf_cent_y(&but->rect)}; const float len = len_v2v2(cent, data->ungrab_mval); if (len > radius) { @@ -3747,8 +3816,8 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap, zoomx = BLI_rctf_size_x(&but->rect) / BLI_rctf_size_x(&cumap->curr); zoomy = BLI_rctf_size_y(&but->rect) / BLI_rctf_size_y(&cumap->curr); - /* offsx= cumap->curr.xmin; */ - /* offsy= cumap->curr.ymin; */ + /* offsx = cumap->curr.xmin; */ + /* offsy = cumap->curr.ymin; */ if (snap) { float d[2]; @@ -3904,7 +3973,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt changed = 1; - /* reset cmp back to the curve points again, rather than drawing segments */ + /* reset cmp back to the curve points again, rather than drawing segments */ cmp = cuma->curve; /* find newly added point and make it 'sel' */ @@ -4008,7 +4077,7 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx } else { /* scale histogram values (dy / 10 for better control) */ - const float yfac = minf(powf(hist->ymax, 2.0f), 1.0f) * 0.5f; + const float yfac = min_ff(powf(hist->ymax, 2.0f), 1.0f) * 0.5f; hist->ymax += (dy * 0.1f) * yfac; /* 0.1 allows us to see HDR colors up to 10 */ @@ -4078,7 +4147,7 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx, Scopes *scopes = (Scopes *)but->poin; /* rcti rect; */ int changed = 1; - float /* dx, */ dy /* , yfac=1.f */; /* UNUSED */ + float /* dx, */ dy /* , yfac =1.0f */; /* UNUSED */ /* BLI_rcti_rctf_copy(&rect, &but->rect); */ @@ -4508,11 +4577,11 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg) int kmi_id; /* XXX this guess_opname can potentially return a different keymap than being found on adding later... */ - km = WM_keymap_guess_opname(C, but->optype->idname); + km = WM_keymap_guess_opname(C, but->optype->idname); kmi = WM_keymap_add_item(km, but->optype->idname, AKEY, KM_PRESS, 0, 0); kmi_id = kmi->id; - /* copy properties, prop can be NULL for reset */ + /* copy properties, prop can be NULL for reset */ if (prop) prop = IDP_CopyProperty(prop); WM_keymap_properties_reset(kmi, prop); @@ -4520,14 +4589,13 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg) /* update and get pointers again */ WM_keyconfig_update(wm); - km = WM_keymap_guess_opname(C, but->optype->idname); + km = WM_keymap_guess_opname(C, but->optype->idname); kmi = WM_keymap_item_find_id(km, kmi_id); RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr); block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS); uiBlockSetHandleFunc(block, but_shortcut_name_func, but); - uiBlockSetFlag(block, UI_BLOCK_RET_1); uiBlockSetDirection(block, UI_CENTER); layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, style); @@ -4865,14 +4933,11 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) if (but->flag & UI_BUT_DISABLED) return WM_UI_HANDLER_CONTINUE; - if ((data->state == BUTTON_STATE_HIGHLIGHT) && - /* check prevval because of modal operators [#24016], - * modifier check is to allow Ctrl+C for copy. - * if this causes other problems, remove this check and suffer the bug :) - campbell */ - ((event->prevval != KM_PRESS) || (ISKEYMODIFIER(event->prevtype)) || (event->type == EVT_DROP))) + if ((data->state == BUTTON_STATE_HIGHLIGHT) || (event->type == EVT_DROP)) { /* handle copy-paste */ if (ELEM(event->type, CKEY, VKEY) && event->val == KM_PRESS && (event->ctrl || event->oskey)) { + ui_but_copy_paste(C, but, data, (event->type == CKEY) ? 'c' : 'v'); return WM_UI_HANDLER_BREAK; } @@ -4954,7 +5019,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) button_activate_state(C, but, BUTTON_STATE_EXIT); return WM_UI_HANDLER_BREAK; } - } + } else if (but->pointype && but->poin == NULL) { /* there's a pointer needed */ BKE_reportf(NULL, RPT_WARNING, "DoButton pointer error: %s", but->str); @@ -6027,7 +6092,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but) } else { retval = ui_do_button(C, block, but, event); - // retval= WM_UI_HANDLER_BREAK; XXX why ? + // retval = WM_UI_HANDLER_BREAK; XXX why ? } if (data->state == BUTTON_STATE_EXIT) { @@ -6380,7 +6445,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle break; /* opening sublevels of pulldowns */ - case RIGHTARROWKEY: + case RIGHTARROWKEY: if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP)) { PASS_EVENT_TO_PARENT_IF_NONACTIVE; @@ -6567,7 +6632,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle case YKEY: case ZKEY: { - if ((event->val == KM_PRESS) && + if ((event->val == KM_PRESS || event->val == KM_DBL_CLICK) && (event->shift == FALSE) && (event->ctrl == FALSE) && (event->oskey == FALSE)) diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 0921107b8e6..bb0cc1176d8 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -142,7 +142,7 @@ static void def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs, int new_icon = MEM_callocN(sizeof(Icon), "texicon"); new_icon->obj = NULL; /* icon is not for library object */ - new_icon->type = 0; + new_icon->type = 0; di = MEM_callocN(sizeof(DrawInfo), "drawinfo"); di->type = type; @@ -852,7 +852,7 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage *prv_img, enum eIco if (G.debug & G_DEBUG) printf("%s: no preview image for this ID: %s\n", __func__, id->name); return; - } + } icon_create_rect(prv_img, size); @@ -982,8 +982,8 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al if (!di) { di = icon_create_drawinfo(); - icon->drawinfo = di; - icon->drawinfo_free = UI_icons_free_drawinfo; + icon->drawinfo = di; + icon->drawinfo_free = UI_icons_free_drawinfo; } /* scale width and height according to aspect */ @@ -994,13 +994,13 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al /* vector icons use the uiBlock transformation, they are not drawn * with untransformed coordinates like the other icons */ di->data.vector.func((int)x, (int)y, ICON_DEFAULT_HEIGHT, ICON_DEFAULT_HEIGHT, 1.0f); - } + } else if (di->type == ICON_TYPE_TEXTURE) { icon_draw_texture(x, y, (float)w, (float)h, di->data.texture.x, di->data.texture.y, di->data.texture.w, di->data.texture.h, alpha, rgb); } else if (di->type == ICON_TYPE_BUFFER) { - /* it is a builtin icon */ + /* it is a builtin icon */ iimg = di->data.buffer.image; if (!iimg->rect) return; /* something has gone wrong! */ @@ -1010,7 +1010,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al else if (di->type == ICON_TYPE_PREVIEW) { PreviewImage *pi = BKE_previewimg_get((ID *)icon->obj); - if (pi) { + if (pi) { /* no create icon on this level in code */ if (!pi->rect[size]) return; /* something has gone wrong! */ diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index b4b0686d6fc..98b75060aa8 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -160,7 +160,8 @@ struct uiBut { int flag, drawflag; eButType type; eButPointerType pointype; - short bit, bitnr, retval, strwidth, ofs, pos, selsta, selend, alignnr; + short bit, bitnr, retval, strwidth, alignnr; + short ofs, pos, selsta, selend; char *str; char strdata[UI_MAX_NAME_STR]; @@ -484,6 +485,7 @@ extern void ui_button_activate_do(struct bContext *C, struct ARegion *ar, uiBut extern void ui_button_active_free(const struct bContext *C, uiBut *but); extern int ui_button_is_active(struct ARegion *ar); extern int ui_button_open_menu_direction(uiBut *but); +extern void ui_button_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut *but, int restore); /* interface_widgets.c */ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 8e30b31f3fe..5170fc7d51b 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -41,6 +41,7 @@ #include "BLI_string.h" #include "BLI_rect.h" #include "BLI_utildefines.h" +#include "BLI_math.h" #include "BLF_translation.h" @@ -1313,7 +1314,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s BLI_addtail(items_list, cis); } MEM_freeN(name); - } + } i++; } @@ -1376,7 +1377,7 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN /* turn button into search button */ if (searchprop) { but->type = SEARCH_MENU; - but->hardmax = MAX2(but->hardmax, 256); + but->hardmax = MAX2(but->hardmax, 256.0f); but->rnasearchpoin = *searchptr; but->rnasearchprop = searchprop; but->flag |= UI_ICON_LEFT | UI_TEXT_LEFT; @@ -1449,6 +1450,11 @@ static void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt) menu.type = mt; menu.layout = layout; + + if (G.debug & G_DEBUG_WM) { + printf("%s: opening menu \"%s\"\n", __func__, mt->idname); + } + mt->draw(C, &menu); } @@ -1708,7 +1714,7 @@ static void ui_litem_layout_row(uiLayout *litem) int x, y, w, tot, totw, neww, itemw, minw, itemh, offset; int fixedw, freew, fixedx, freex, flag = 0, lastw = 0; - /* x= litem->x; */ /* UNUSED */ + /* x = litem->x; */ /* UNUSED */ y = litem->y; w = litem->w; totw = 0; @@ -1932,8 +1938,8 @@ static void ui_litem_estimate_column_flow(uiLayout *litem) return; } - flow->totcol = MAX2(litem->root->emw / maxw, 1); - flow->totcol = MIN2(flow->totcol, totitem); + flow->totcol = max_ii(litem->root->emw / maxw, 1); + flow->totcol = min_ii(flow->totcol, totitem); } else flow->totcol = flow->number; @@ -2007,7 +2013,7 @@ static void ui_litem_layout_column_flow(uiLayout *litem) emy -= itemh; ui_item_position(item, x + offset, y, itemw, itemh); y -= style->buttonspacey; - miny = MIN2(miny, y); + miny = min_ii(miny, y); /* decide to go to next one */ if (col < flow->totcol - 1 && emy <= -emh) { @@ -2038,8 +2044,8 @@ static void ui_litem_estimate_absolute(uiLayout *litem) ui_item_offset(item, &itemx, &itemy); ui_item_size(item, &itemw, &itemh); - minx = MIN2(minx, itemx); - miny = MIN2(miny, itemy); + minx = min_ii(minx, itemx); + miny = min_ii(miny, itemy); litem->w = MAX2(litem->w, itemx + itemw); litem->h = MAX2(litem->h, itemy + itemh); @@ -2064,11 +2070,11 @@ static void ui_litem_layout_absolute(uiLayout *litem) ui_item_offset(item, &itemx, &itemy); ui_item_size(item, &itemw, &itemh); - minx = MIN2(minx, itemx); - miny = MIN2(miny, itemy); + minx = min_ii(minx, itemx); + miny = min_ii(miny, itemy); - totw = MAX2(totw, itemx + itemw); - toth = MAX2(toth, itemy + itemh); + totw = max_ii(totw, itemx + itemw); + toth = max_ii(toth, itemy + itemh); } totw -= minx; diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 017ffdcfb14..e7a5f993d32 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -807,7 +807,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op, } if (text == NULL) { - BKE_reportf(op->reports, RPT_WARNING, "File: '%s' can't be opened", filepath); + BKE_reportf(op->reports, RPT_WARNING, "File '%s' cannot be opened", filepath); return OPERATOR_CANCELLED; } else { @@ -870,12 +870,12 @@ static int editsource_exec(bContext *C, wmOperator *op) but_store->py_dbg_ln); } else { - BKE_report(op->reports, RPT_ERROR, "Active button isn't from a script, cant edit source"); + BKE_report(op->reports, RPT_ERROR, "Active button is not from a script, cannot edit source"); ret = OPERATOR_CANCELLED; } } else { - BKE_report(op->reports, RPT_ERROR, "Active button match can't be found"); + BKE_report(op->reports, RPT_ERROR, "Active button match cannot be found"); ret = OPERATOR_CANCELLED; } @@ -973,12 +973,12 @@ static int edittranslation_exec(bContext *C, wmOperator *op) uiStringInfo rna_ctxt = {BUT_GET_RNA_LABEL_CONTEXT, NULL}; if (!BLI_is_dir(root)) { - BKE_report(op->reports, RPT_ERROR, "Please set your User Preferences' \"Translation Branches " - "Directory\" path to a valid directory"); + BKE_report(op->reports, RPT_ERROR, "Please set your User Preferences' 'Translation Branches " + "Directory' path to a valid directory"); return OPERATOR_CANCELLED; } if (!WM_operatortype_find(EDTSRC_I18N_OP_NAME, 0)) { - BKE_reportf(op->reports, RPT_ERROR, "Could not find operator \"%s\"! Please enable ui_translate addon " + BKE_reportf(op->reports, RPT_ERROR, "Could not find operator '%s'! Please enable ui_translate addon " "in the User Preferences", EDTSRC_I18N_OP_NAME); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 49e96bea6c6..2b170ea546b 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -240,7 +240,7 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int } } } - } + } } } @@ -545,7 +545,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) if (!(panel->flag & PNL_CLOSEDX)) { ui_draw_aligned_panel_header(style, block, &headrect, 'h'); - /* itemrect smaller */ + /* itemrect smaller */ itemrect.xmax = headrect.xmax - 5.0f / block->aspect; itemrect.xmin = itemrect.xmax - BLI_rcti_size_y(&headrect); itemrect.ymin = headrect.ymin; @@ -594,7 +594,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) /* draw collapse icon */ UI_ThemeColor(TH_TEXT); - /* itemrect smaller */ + /* itemrect smaller */ itemrect.xmin = headrect.xmin + 5.0f / block->aspect; itemrect.xmax = itemrect.xmin + BLI_rcti_size_y(&headrect); itemrect.ymin = headrect.ymin; @@ -814,8 +814,8 @@ static void ui_panels_size(ScrArea *sa, ARegion *ar, int *x, int *y) pa_sizey = pa->ofsy + get_panel_size_y(pa); } - sizex = MAX2(sizex, pa_sizex); - sizey = MIN2(sizey, pa_sizey); + sizex = max_ii(sizex, pa_sizex); + sizey = min_ii(sizey, pa_sizey); } } @@ -831,7 +831,7 @@ static void ui_do_animate(const bContext *C, Panel *panel) float fac; fac = (PIL_check_seconds_timer() - data->starttime) / ANIMATION_TIME; - fac = minf(sqrt(fac), 1.0f); + fac = min_ff(sqrt(fac), 1.0f); /* for max 1 second, interpolate positions */ if (uiAlignPanelStep(sa, ar, fac, 0)) { @@ -895,7 +895,7 @@ void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y) panew->paneltab = NULL; ED_region_tag_redraw(ar); /* the buttons panew were not made */ } - } + } } /* re-align, possibly with animation */ @@ -1200,7 +1200,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event) ED_region_tag_redraw(ar); retval = WM_UI_HANDLER_BREAK; - } + } } } #endif diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 14cb1cbe85a..f522af51c42 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -46,6 +46,7 @@ #include "BKE_context.h" #include "BKE_screen.h" +#include "BKE_global.h" #include "WM_api.h" #include "WM_types.h" @@ -213,7 +214,7 @@ static MenuData *decompose_menu_string(const char *str) else { menudata_add_item(md, nitem, nretval, nicon, 0); nretval = md->nitems + 1; - } + } nitem = NULL; nicon = 0; @@ -670,7 +671,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) for (a = 0, fontw = 0, fonth = 0; a < data->totline; a++) { w = BLF_width(data->fstyle.uifont_id, data->lines[a]); - fontw = MAX2(fontw, w); + fontw = max_ff(fontw, (float)w); fonth += (a == 0) ? h : h + TIP_MARGIN_Y; } @@ -1159,7 +1160,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) /* special case, hardcoded feature, not draw backdrop when called from menus, * assume for design that popup already added it */ - if (but->block->flag & UI_BLOCK_LOOP) + if (but->block->flag & UI_BLOCK_SEARCH_MENU) data->noback = 1; if (but->a1 > 0 && but->a2 > 0) { @@ -1169,7 +1170,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) } /* compute position */ - if (but->block->flag & UI_BLOCK_LOOP) { + if (but->block->flag & UI_BLOCK_SEARCH_MENU) { /* this case is search menu inside other menu */ /* we copy region size */ @@ -1463,7 +1464,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, if (top == 0 && down == 0) { if (dir1 == UI_LEFT || dir1 == UI_RIGHT) { /* align with bottom of screen */ - // yof= ysize; (not with menu scrolls) + // yof = ysize; (not with menu scrolls) } } @@ -1548,7 +1549,11 @@ static void ui_block_region_draw(const bContext *C, ARegion *ar) static void ui_popup_block_clip(wmWindow *window, uiBlock *block) { int winx, winy; - + + if (block->flag & UI_BLOCK_NO_WIN_CLIP) { + return; + } + wm_window_get_size(window, &winx, &winy); if (block->rect.xmin < MENU_SHADOW_SIDE) @@ -1950,7 +1955,7 @@ static void ui_update_block_buts_rgb(uiBlock *block, const float rgb[3]) else if (bt->str[0] == 'V') { ui_set_but_val(bt, hsv[2]); } - } + } ui_check_but(bt); } @@ -2377,7 +2382,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); if (pup->popup) { - uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_NUMSELECT | UI_BLOCK_RET_1); + uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_NUMSELECT); uiBlockSetDirection(block, direction); /* offset the mouse position, possibly based on earlier selection */ @@ -2396,7 +2401,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi * on the first item */ offset[0] = 0; for (bt = block->buttons.first; bt; bt = bt->next) - offset[0] = mini(offset[0], -(bt->rect.xmin + 0.8f * BLI_rctf_size_x(&bt->rect))); + offset[0] = min_ii(offset[0], -(bt->rect.xmin + 0.8f * BLI_rctf_size_x(&bt->rect))); offset[1] = 1.5 * UI_UNIT_Y; } @@ -2506,6 +2511,9 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon) pup->block->flag |= UI_BLOCK_POPUP_MEMORY; pup->block->puphash = ui_popup_menu_hash(title); pup->layout = uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style); + + /* note, this intentionally differs from the menu & submenu default because many operators + * use popups like this to select one of their options - where having invoke doesn't make sense */ uiLayoutSetOperatorContext(pup->layout, WM_OP_EXEC_REGION_WIN); /* create in advance so we can let buttons point to retval already */ @@ -2717,6 +2725,10 @@ void uiPupMenuInvoke(bContext *C, const char *idname) menu.layout = layout; menu.type = mt; + if (G.debug & G_DEBUG_WM) { + printf("%s: opening menu \"%s\"\n", __func__, idname); + } + mt->draw(C, &menu); uiPupMenuEnd(C, pup); diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index acf7712f97b..7e7db6aeaaa 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -348,7 +348,7 @@ void uiStyleInit(void) #else font->blf_id = BLF_load_mem("default", (unsigned char *)datatoc_bfont_ttf, datatoc_bfont_ttf_size); #endif - } + } else { font->blf_id = BLF_load(font->filename); if (font->blf_id == -1) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 974d492a364..c7e6a5f2882 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -175,7 +175,7 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem) idptr = RNA_property_pointer_get(&template.ptr, template.prop); block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS); - uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_RET_1); + uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_SEARCH_MENU); /* preview thumbnails */ if (template.prv_rows > 0 && template.prv_cols > 0) { @@ -199,7 +199,7 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem) uiBoundsBlock(block, 6); - uiBlockSetDirection(block, UI_DOWN); + uiBlockSetDirection(block, UI_DOWN); uiEndBlock(C, block); /* give search-field focus */ @@ -401,7 +401,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str //text_idbutton(id, name); name[0] = '\0'; - but = uiDefButR(block, TEX, 0, name, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y, &idptr, "name", -1, 0, 0, -1, -1, NULL); + but = uiDefButR(block, TEX, 0, name, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y, &idptr, "name", -1, 0, 0, -1, -1, RNA_struct_ui_description(type)); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_RENAME)); if (user_alert) uiButSetFlag(but, UI_BUT_REDALERT); @@ -581,7 +581,7 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co RNA_warning("pointer property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } - if (!propType || RNA_property_type(propType) != PROP_ENUM) { + if (!propType || RNA_property_type(propType) != PROP_ENUM) { RNA_warning("pointer-type property not found: %s.%s", RNA_struct_identifier(ptr->type), proptypename); return; } @@ -1222,7 +1222,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M else ma = (Material *)pparent; /* Create RNA Pointer */ - RNA_pointer_create(id, &RNA_Material, ma, &material_ptr); + RNA_pointer_create(&ma->id, &RNA_Material, ma, &material_ptr); col = uiLayoutColumn(row, TRUE); uiLayoutSetScaleX(col, 1.5); @@ -1282,7 +1282,7 @@ static void colorband_add_cb(bContext *C, void *cb_v, void *coba_v) if (colorband_element_add(coba, pos)) { rna_update_cb(C, cb_v, NULL); - ED_undo_push(C, "Add colorband"); + ED_undo_push(C, "Add colorband"); } } @@ -1406,7 +1406,7 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand uiItemR(layout, &ptr, "color", 0, "", ICON_NONE); } - bt = uiDefButS(block, MENU, 0, TIP_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4"), + bt = uiDefButS(block, MENU, 0, IFACE_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4"), xs + 10.0f * unit, butr->ymin + UI_UNIT_Y, unit * 4, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0, TIP_("Set interpolation between color stops")); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); @@ -2745,7 +2745,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C) uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0, 0, 85, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop screencast")); if (screen->animtimer) - uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_CANCEL, TIP_("Anim Player"), 0, 0, 100, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, + uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_CANCEL, IFACE_("Anim Player"), 0, 0, 100, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop animation playback")); } @@ -2775,8 +2775,8 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) block = uiLayoutGetBlock(ui_abs); width = BLF_width(style->widget.uifont_id, report->message); - width = MIN2(rti->widthfac * width, width); - width = MAX2(width, 10); + width = min_ii((int)(rti->widthfac * width), width); + width = max_ii(width, 10); /* make a box around the report to make it stand out */ uiBlockBeginAlign(block); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 3203237496f..238024a0856 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -345,7 +345,7 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl const int vnum = ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT) || (roundboxalign & (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) == (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) ? 1 : 2; - minsize = mini(BLI_rcti_size_x(rect) * hnum, + minsize = min_ii(BLI_rcti_size_x(rect) * hnum, BLI_rcti_size_y(rect) * vnum); if (2.0f * rad > minsize) @@ -491,7 +491,7 @@ static void widget_num_tria(uiWidgetTrias *tria, rcti *rect, float triasize, cha float centx, centy, sizex, sizey, minsize; int a, i1 = 0, i2 = 1; - minsize = mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)); + minsize = min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)); /* center position and size */ centx = (float)rect->xmin + 0.5f * minsize; @@ -501,16 +501,16 @@ static void widget_num_tria(uiWidgetTrias *tria, rcti *rect, float triasize, cha if (where == 'r') { centx = (float)rect->xmax - 0.5f * minsize; sizex = -sizex; - } + } else if (where == 't') { centy = (float)rect->ymax - 0.5f * minsize; sizey = -sizey; i2 = 0; i1 = 1; - } + } else if (where == 'b') { sizex = -sizex; i2 = 0; i1 = 1; - } + } for (a = 0; a < 3; a++) { tria->vec[a][0] = sizex * num_tria_vert[a][i1] + centx; @@ -526,7 +526,7 @@ static void widget_scroll_circle(uiWidgetTrias *tria, rcti *rect, float triasize float centx, centy, sizex, sizey, minsize; int a, i1 = 0, i2 = 1; - minsize = mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)); + minsize = min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)); /* center position and size */ centx = (float)rect->xmin + 0.5f * minsize; @@ -536,16 +536,16 @@ static void widget_scroll_circle(uiWidgetTrias *tria, rcti *rect, float triasize if (where == 'r') { centx = (float)rect->xmax - 0.5f * minsize; sizex = -sizex; - } + } else if (where == 't') { centy = (float)rect->ymax - 0.5f * minsize; sizey = -sizey; i2 = 0; i1 = 1; - } + } else if (where == 'b') { sizex = -sizex; i2 = 0; i1 = 1; - } + } for (a = 0; a < 16; a++) { tria->vec[a][0] = sizex * scroll_circle_vert[a][i1] + centx; @@ -572,12 +572,12 @@ static void widget_menu_trias(uiWidgetTrias *tria, rcti *rect) /* center position and size */ centx = rect->xmax - 0.5f * BLI_rcti_size_y(rect); centy = rect->ymin + 0.5f * BLI_rcti_size_y(rect); - size = 0.4f * BLI_rcti_size_y(rect); + size = 0.4f * (float)BLI_rcti_size_y(rect); /* XXX exception */ asp = ((float)BLI_rcti_size_x(rect)) / ((float)BLI_rcti_size_y(rect)); if (asp > 1.2f && asp < 2.6f) - centx = rect->xmax - 0.3f * BLI_rcti_size_y(rect); + centx = rect->xmax - 0.4f * (float)BLI_rcti_size_y(rect); for (a = 0; a < 6; a++) { tria->vec[a][0] = size * menu_tria_vert[a][0] + centx; @@ -878,7 +878,7 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect aspect = but->block->aspect; if (aspect != but->aspect) { /* prevent scaling up icon in pupmenu */ - if (aspect < 1.0f) { + if (aspect < 1.0f) { height = UI_DPI_ICON_SIZE; aspect = 1.0f; @@ -1276,9 +1276,12 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b /* draws text and icons for buttons */ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect) { - if (but == NULL) { + char password_str[UI_MAX_DRAW_STR]; + + if (but == NULL) return; - } + + ui_button_text_password_hide(password_str, but, FALSE); /* clip but->drawstr to fit in available space */ if (but->editstr && but->pos >= 0) { @@ -1337,6 +1340,8 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB widget_draw_text(fstyle, wcol, but, rect); } + + ui_button_text_password_hide(password_str, but, TRUE); } @@ -1852,7 +1857,7 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir else if (direction == UI_DOWN) { roundboxalign = (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT); rect->ymin -= 4.0; - } + } else if (direction == UI_TOP) { roundboxalign = UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT; rect->ymax += 4.0; @@ -1895,7 +1900,7 @@ void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rcti *rec /* duplication of code... well, simple is better now */ const float centx = BLI_rcti_cent_x_fl(rect); const float centy = BLI_rcti_cent_y_fl(rect); - const float radius = (float)mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f; + const float radius = (float)min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f; const float m_delta[2] = {mx - centx, my - centy}; const float dist_squared = len_squared_v2(m_delta); @@ -1910,7 +1915,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * const float centx = BLI_rcti_cent_x_fl(rect); const float centy = BLI_rcti_cent_y_fl(rect); - float radius = (float)mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f; + float radius = (float)min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f; /* gouraud triangle fan */ const float *hsv_ptr = ui_block_hsv_get(but->block); @@ -2364,7 +2369,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat wtb.emboss = 0; /* only emboss once */ /* exception for progress bar */ - if (state & UI_SCROLL_NO_OUTLINE) + if (state & UI_SCROLL_NO_OUTLINE) SWAP(short, outline, wtb.outline); round_box_edges(&wtb, UI_CNR_ALL, slider, rad); @@ -2388,7 +2393,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat if (state & UI_SCROLL_NO_OUTLINE) SWAP(short, outline, wtb.outline); - } + } } static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign)) @@ -2402,7 +2407,7 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat value = ui_get_but_val(but); size = (but->softmax + but->a1 - but->softmin); - size = MAX2(size, 2); + size = max_ff(size, 2.0f); /* position */ rect1 = *rect; @@ -2423,7 +2428,7 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat if (rect1.xmax > rect->xmax) { rect1.xmax = rect->xmax; - rect1.xmin = maxi(rect1.xmax - min, rect->xmin); + rect1.xmin = max_ii(rect1.xmax - min, rect->xmin); } } } @@ -2440,7 +2445,7 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat if (rect1.ymax > rect->ymax) { rect1.ymax = rect->ymax; - rect1.ymin = MAX2(rect1.ymax - min, rect->ymin); + rect1.ymin = max_ii(rect1.ymax - min, rect->ymin); } } } @@ -2627,7 +2632,7 @@ static void widget_icon_has_anim(uiBut *UNUSED(but), uiWidgetColors *wcol, rcti /* rounded */ round_box_edges(&wtb, UI_CNR_ALL, rect, 10.0f); widgetbase_draw(&wtb, wcol); - } + } } @@ -2662,8 +2667,8 @@ static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), widgetbase_draw(&wtb, wcol); - /* text space */ - rect->xmax -= BLI_rcti_size_y(rect); + /* text space, arrows are about 0.6 height of button */ + rect->xmax -= (6*BLI_rcti_size_y(rect))/10; } static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) @@ -3346,7 +3351,7 @@ void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) glColor3ubv((unsigned char *)wt->wcol.text); UI_DrawTriIcon(BLI_rcti_cent_x(rect), rect->ymin + 10, 'v'); } - } + } } uiWidgetColors *ui_tooltip_get_theme(void) diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index a964052cc23..de79a290cb3 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -655,7 +655,7 @@ void ui_theme_init_default(void) strcpy(btheme->name, "Default"); } - UI_SetTheme(0, 0); // make sure the global used in this file is set + UI_SetTheme(0, 0); /* make sure the global used in this file is set */ /* UI buttons */ ui_widget_color_init(&btheme->tui); @@ -814,9 +814,9 @@ void ui_theme_init_default(void) rgba_char_args_set_fl(btheme->tfile.list, 0.4, 0.4, 0.4, 1); rgba_char_args_set(btheme->tfile.text, 250, 250, 250, 255); rgba_char_args_set(btheme->tfile.text_hi, 15, 15, 15, 255); - rgba_char_args_set(btheme->tfile.panel, 145, 145, 145, 255); // bookmark/ui regions - rgba_char_args_set(btheme->tfile.active, 130, 130, 130, 255); // selected files - rgba_char_args_set(btheme->tfile.hilite, 255, 140, 25, 255); // selected files + rgba_char_args_set(btheme->tfile.panel, 145, 145, 145, 255); /* bookmark/ui regions */ + rgba_char_args_set(btheme->tfile.active, 130, 130, 130, 255); /* selected files */ + rgba_char_args_set(btheme->tfile.hilite, 255, 140, 25, 255); /* selected files */ rgba_char_args_set(btheme->tfile.grid, 250, 250, 250, 255); rgba_char_args_set(btheme->tfile.image, 250, 250, 250, 255); @@ -897,7 +897,7 @@ void ui_theme_init_default(void) btheme->ttime = btheme->tv3d; rgba_char_args_set_fl(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0); rgba_char_args_set_fl(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0); - rgba_char_args_set(btheme->ttime.shade1, 173, 173, 173, 255); // sliders + rgba_char_args_set(btheme->ttime.shade1, 173, 173, 173, 255); /* sliders */ /* space node, re-uses syntax color storage */ btheme->tnode = btheme->tv3d; @@ -938,7 +938,7 @@ void ui_theme_init_default(void) void UI_SetTheme(int spacetype, int regionid) { - if (spacetype == 0) { // called for safety, when delete themes + if (spacetype == 0) { /* called for safety, when delete themes */ theme_active = U.themes.first; theme_spacetype = SPACE_VIEW3D; theme_regionid = RGN_TYPE_WINDOW; @@ -956,7 +956,7 @@ bTheme *UI_GetTheme(void) return U.themes.first; } -// for space windows only +/* for space windows only */ void UI_ThemeColor(int colorid) { const unsigned char *cp; @@ -966,7 +966,7 @@ void UI_ThemeColor(int colorid) } -// plus alpha +/* plus alpha */ void UI_ThemeColor4(int colorid) { const unsigned char *cp; @@ -976,7 +976,7 @@ void UI_ThemeColor4(int colorid) } -// set the color with offset for shades +/* set the color with offset for shades */ void UI_ThemeColorShade(int colorid, int offset) { int r, g, b; @@ -1009,7 +1009,7 @@ void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset) glColor4ub(r, g, b, a); } -// blend between to theme colors, and set it +/* blend between to theme colors, and set it */ void UI_ThemeColorBlend(int colorid1, int colorid2, float fac) { int r, g, b; @@ -1026,7 +1026,7 @@ void UI_ThemeColorBlend(int colorid1, int colorid2, float fac) glColor3ub(r, g, b); } -// blend between to theme colors, shade it, and set it +/* blend between to theme colors, shade it, and set it */ void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset) { int r, g, b; @@ -1047,7 +1047,7 @@ void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset) glColor3ub(r, g, b); } -// blend between to theme colors, shade it, and set it +/* blend between to theme colors, shade it, and set it */ void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int offset, int alphaoffset) { int r, g, b, a; @@ -1071,7 +1071,7 @@ void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int off } -// get individual values, not scaled +/* get individual values, not scaled */ float UI_GetThemeValuef(int colorid) { const unsigned char *cp; @@ -1081,7 +1081,7 @@ float UI_GetThemeValuef(int colorid) } -// get individual values, not scaled +/* get individual values, not scaled */ int UI_GetThemeValue(int colorid) { const unsigned char *cp; @@ -1092,7 +1092,7 @@ int UI_GetThemeValue(int colorid) } -// get the color, range 0.0-1.0 +/* get the color, range 0.0-1.0 */ void UI_GetThemeColor3fv(int colorid, float col[3]) { const unsigned char *cp; @@ -1114,7 +1114,7 @@ void UI_GetThemeColor4fv(int colorid, float col[4]) col[3] = ((float)cp[3]) / 255.0f; } -// get the color, range 0.0-1.0, complete with shading offset +/* get the color, range 0.0-1.0, complete with shading offset */ void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]) { int r, g, b; @@ -1153,7 +1153,7 @@ void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]) col[2] = b; } -// get the color, in char pointer +/* get the color, in char pointer */ void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]) { const unsigned char *cp; @@ -1164,7 +1164,7 @@ void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]) col[2] = cp[2]; } -// get the color, in char pointer +/* get the color, in char pointer */ void UI_GetThemeColor4ubv(int colorid, unsigned char col[4]) { const unsigned char *cp; @@ -1187,7 +1187,7 @@ void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4]) col[3] = cp[3]; } -// blends and shades between two char color pointers +/* blends and shades between two char color pointers */ void UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], float fac, int offset) { int r, g, b; @@ -1220,7 +1220,7 @@ void UI_GetColorPtrShade3ubv(const unsigned char cp[3], unsigned char col[3], in col[2] = b; } -// get a 3 byte color, blended and shaded between two other char color pointers +/* 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) { @@ -1366,7 +1366,7 @@ void init_userdef_do_versions(void) btheme->ttime = btheme->tv3d; rgba_char_args_set_fl(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0); rgba_char_args_set_fl(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0); - rgba_char_args_set(btheme->ttime.shade1, 173, 173, 173, 255); // sliders + rgba_char_args_set(btheme->ttime.shade1, 173, 173, 173, 255); /* sliders */ } if (btheme->text.syntaxn[3] == 0) { rgba_char_args_set(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/ diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 47bee92be62..fb7a2615583 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -299,7 +299,7 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) /* other view types are completely defined using their own settings already */ default: /* we don't do anything here, as settings should be fine, but just make sure that rect */ - break; + break; } } @@ -476,8 +476,14 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize) if (winy < v2d->oldwiny) { float temp = v2d->oldwiny - winy; - cur->ymin += temp; - cur->ymax += temp; + if (v2d->align & V2D_ALIGN_NO_NEG_Y) { + cur->ymin -= temp; + cur->ymax -= temp; + } + else { /* Assume V2D_ALIGN_NO_POS_Y or combination */ + cur->ymin += temp; + cur->ymax += temp; + } } } @@ -1089,7 +1095,7 @@ static void step_to_grid(float *step, int *power, int unit) } /* prevents printing 1.0 2.0 3.0 etc */ - if (rem == 1.0f) (*power)++; + if (rem == 1.0f) (*power)++; } else { if (rem < 2.0f) rem = 2.0f; @@ -1100,7 +1106,7 @@ static void step_to_grid(float *step, int *power, int unit) (*power)++; /* prevents printing 1.0, 2.0, 3.0, etc. */ - if (rem == 10.0f) (*power)++; + if (rem == 10.0f) (*power)++; } } @@ -1256,7 +1262,7 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag) vec2[1] = vec1[1] -= 0.5f * grid->dy; step++; - if (flag & V2D_HORIZONTAL_FINELINES) { + if (flag & V2D_HORIZONTAL_FINELINES) { UI_ThemeColorShade(TH_GRID, 16); for (a = 0; a < step; a++) { glBegin(GL_LINE_STRIP); @@ -1487,7 +1493,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, /* check whether sliders can disappear due to the full-range being used */ if (v2d->keeptot) { - if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) { + if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) { v2d->scroll |= V2D_SCROLL_HORIZONTAL_FULLR; scrollers->horfull = 1; } @@ -1529,7 +1535,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, /* check whether sliders can disappear due to the full-range being used */ if (v2d->keeptot) { - if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) { + if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) { v2d->scroll |= V2D_SCROLL_VERTICAL_FULLR; scrollers->vertfull = 1; } @@ -1682,7 +1688,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v if (fac < hor.xmin + 10) continue; - switch (vs->xunits) { + switch (vs->xunits) { case V2D_UNIT_FRAMES: /* frames (as whole numbers)*/ scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMES, 'h'); break; @@ -1797,7 +1803,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v BLF_disable_default(BLF_ROTATION); } - } + } } } @@ -2066,7 +2072,7 @@ short UI_view2d_mouse_in_scrollers(const bContext *C, View2D *v2d, int x, int y) } if (scroll & V2D_SCROLL_VERTICAL) { if (IN_2D_VERT_SCROLL(v2d, co)) return 'v'; - } + } /* not found */ return 0; diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 12e04d392b4..48a1f8bf0f3 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -642,7 +642,7 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op) v2d->cur.ymin += ofs + dy; v2d->cur.ymax += ofs - dy; - } + } else { v2d->cur.ymin += dy; v2d->cur.ymax -= dy; @@ -956,7 +956,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event) view_zoomdrag_apply(C, op); view_zoomdrag_exit(C, op); return OPERATOR_FINISHED; - } + } /* set initial settings */ vzd->lastx = event->x; @@ -1065,7 +1065,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event) /* apply zooming */ view_zoomdrag_apply(C, op); - } + } else if (event->type == vzd->invoke_event || event->type == ESCKEY) { if (event->val == KM_RELEASE) { @@ -1243,16 +1243,16 @@ static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b) for (i = 0; i < 2; i++) { /* axis translation normalized to scale */ - tfac = fabsf(cent_a[i] - cent_b[i]) / minf(size_a[i], size_b[i]); - fac_max = maxf(fac_max, tfac); + tfac = fabsf(cent_a[i] - cent_b[i]) / min_ff(size_a[i], size_b[i]); + fac_max = max_ff(fac_max, tfac); if (fac_max >= 1.0f) break; /* axis scale difference, x2 so doubling or half gives 1.0f */ - tfac = (1.0f - (minf(size_a[i], size_b[i]) / maxf(size_a[i], size_b[i]))) * 2.0f; - fac_max = maxf(fac_max, tfac); + tfac = (1.0f - (min_ff(size_a[i], size_b[i]) / max_ff(size_a[i], size_b[i]))) * 2.0f; + fac_max = max_ff(fac_max, tfac); if (fac_max >= 1.0f) break; } - return minf(fac_max, 1.0f); + return min_ff(fac_max, 1.0f); } /* will start timer if appropriate */ @@ -1469,7 +1469,7 @@ static short mouse_in_scroller_handle(int mouse, int sc_min, int sc_max, int sh_ else if (in_min) return SCROLLHANDLE_MIN; else if (out_min) - return SCROLLHANDLE_MIN_OUTSIDE; + return SCROLLHANDLE_MIN_OUTSIDE; else if (out_max) return SCROLLHANDLE_MAX_OUTSIDE; @@ -1751,7 +1751,7 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, wmEvent *event) /* can't catch this event for ourselves, so let it go to someone else? */ return OPERATOR_PASS_THROUGH; - } + } } /* zone is also inappropriate if scroller is not visible... */ diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 490389c6d0c..1c23df1c11e 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -408,7 +408,7 @@ static void draw_spline_curve(const bContext *C, MaskLayer *masklay, MaskSpline const short is_active, int width, int height) { - const unsigned int resol = maxi(BKE_mask_spline_feather_resolution(spline, width, height), + const unsigned int resol = max_ii(BKE_mask_spline_feather_resolution(spline, width, height), BKE_mask_spline_resolution(spline, width, height)); unsigned char rgb_tmp[4]; @@ -579,7 +579,7 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar, y += v2d->tot.ymin * zoomy; /* frame the image */ - maxdim = maxf(width, height); + maxdim = max_ff(width, height); if (width == height) { xofs = yofs = 0; } diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c index dc204909577..cd1a47754f8 100644 --- a/source/blender/editors/mask/mask_select.c +++ b/source/blender/editors/mask/mask_select.c @@ -34,6 +34,7 @@ #include "BLI_utildefines.h" #include "BLI_rect.h" #include "BLI_lasso.h" +#include "BLI_math.h" #include "BKE_context.h" #include "BKE_mask.h" @@ -622,7 +623,7 @@ static int circle_select_exec(bContext *C, wmOperator *op) /* compute ellipse and position in unified coordinates */ ED_mask_get_size(sa, &width, &height); ED_mask_zoom(sa, ar, &zoomx, &zoomy); - width = height = MAX2(width, height); + width = height = max_ii(width, height); ellipse[0] = width * zoomx / radius; ellipse[1] = height * zoomy / radius; diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt index 9aa3f3633f3..417cf92c29f 100644 --- a/source/blender/editors/mesh/CMakeLists.txt +++ b/source/blender/editors/mesh/CMakeLists.txt @@ -73,4 +73,8 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +if(WITH_BULLET) + add_definitions(-DWITH_BULLET) +endif() + blender_add_lib(bf_editor_mesh "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/mesh/SConscript b/source/blender/editors/mesh/SConscript index 923bb3f9057..91ffdc91685 100644 --- a/source/blender/editors/mesh/SConscript +++ b/source/blender/editors/mesh/SConscript @@ -27,4 +27,7 @@ else: if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') +if env['WITH_BF_BULLET']: + defs.append('WITH_BULLET') + env.BlenderLib ( 'bf_editors_mesh', sources, Split(incs), defs, libtype=['core'], priority=[45] ) diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 99ed86d7a06..70b359d3e28 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -476,7 +476,7 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op) make_prim_finish(C, obedit, &state, enter_editmode); - return OPERATOR_FINISHED; + return OPERATOR_FINISHED; } void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot) diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 1d19d35ca34..82447cc0168 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -181,6 +181,7 @@ typedef struct KnifeTool_OpData { char select_result; /* set on initialization */ short is_ortho; + float ortho_extent; float clipsta, clipend; enum { @@ -1164,7 +1165,7 @@ static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree, /* for comparing distances, error of intersection depends on triangle scale. * need to scale down before squaring for accurate comparison */ - const float depsilon = (KNIFE_FLT_EPS / 2.0f) * len_v3_tri_side_max(v1, v2, v3); + const float depsilon = (FLT_EPSILON / 2.0f) * len_v3_tri_side_max(v1, v2, v3); const float depsilon_squared = depsilon * depsilon; copy_v3_v3(cos + 0, v1); @@ -1311,6 +1312,22 @@ static void knife_bgl_get_mats(KnifeTool_OpData *UNUSED(kcd), bglMats *mats) //copy_m4_m4(mats->projection, kcd->vc.rv3d->winmat); } +/* Calculate maximum excursion (doubled) from (0,0,0) of mesh */ +static void calc_ortho_extent(KnifeTool_OpData *kcd) +{ + BMIter iter; + BMVert *v; + BMesh* bm = kcd->em->bm; + float max_xyz = 0.0f; + int i; + + BM_ITER_MESH(v, &iter, bm, BM_VERTS_OF_MESH) { + for (i = 0; i < 3; i++) + max_xyz = max_ff(max_xyz, fabs(v->co[i])); + } + kcd->ortho_extent = 2 * max_xyz; +} + /* Finds visible (or all, if cutting through) edges that intersects the current screen drag line */ static void knife_find_line_hits(KnifeTool_OpData *kcd) { @@ -1353,8 +1370,10 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd) * (which may involve using doubles everywhere!), * limit the distance between these points */ if (kcd->is_ortho) { - limit_dist_v3(v1, v3, 200.0f); - limit_dist_v3(v2, v4, 200.0f); + if (kcd->ortho_extent == 0.0f) + calc_ortho_extent(kcd); + limit_dist_v3(v1, v3, kcd->ortho_extent + 10.0f); + limit_dist_v3(v2, v4, kcd->ortho_extent + 10.0f); } BLI_smallhash_init(ehash); @@ -1506,7 +1525,7 @@ static float knife_snap_size(KnifeTool_OpData *kcd, float maxsize) if (density < 1.0f) density = 1.0f; - return minf(maxsize / (density * 0.5f), maxsize); + return min_ff(maxsize / (density * 0.5f), maxsize); } /* p is closest point on edge to the mouse cursor */ diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 98fae2cc701..8e5c89adfca 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -419,7 +419,7 @@ static int ringcut_invoke(bContext *C, wmOperator *op, wmEvent *evt) float dist = 75.0f; if (modifiers_isDeformedByLattice(obedit) || modifiers_isDeformedByArmature(obedit)) - BKE_report(op->reports, RPT_WARNING, "Loop cut doesn't work well on deformed edit mesh display"); + BKE_report(op->reports, RPT_WARNING, "Loop cut does not work well on deformed edit mesh display"); view3d_operator_needs_opengl(C); @@ -505,7 +505,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event) if (event->val == KM_RELEASE) break; - cuts = MAX2(cuts - 1, 0); + cuts = max_ii(cuts - 1, 0); RNA_int_set(op->ptr, "number_cuts", cuts); ringsel_find_edge(lcd, cuts); show_cuts = TRUE; @@ -527,7 +527,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event) ED_region_tag_redraw(lcd->ar); break; - } + } } /* using the keyboard to input the number of cuts */ diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index 8fe2aa4b1a7..6379bdbc0ca 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -496,21 +496,21 @@ static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *u l_iter = BM_FACE_FIRST_LOOP(f); if (f_verts[3]) { - BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, ulp->l_pair[0]), l_iter); l_iter = l_iter->next; - BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[1]->e, ulp->l_pair[1]->next), l_iter); l_iter = l_iter->next; - BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[1]->e, ulp->l_pair[1]), l_iter); l_iter = l_iter->next; - BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, ulp->l_pair[0]->next), l_iter); + BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter); l_iter = l_iter->next; + BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[1]->e, l_iter), l_iter); l_iter = l_iter->next; + BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[1]->e, l_iter), l_iter); l_iter = l_iter->next; + BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter); } else { if (v_shared == f_verts[0]) { - BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, ulp->l_pair[0]->next), l_iter); l_iter = l_iter->next; - BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, ulp->l_pair[0]), l_iter); l_iter = l_iter->next; - BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[1]->e, ulp->l_pair[1]->next), l_iter); + BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter); l_iter = l_iter->next; + BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter); l_iter = l_iter->next; + BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[1]->e, l_iter), l_iter); } else { - BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, ulp->l_pair[0]->next), l_iter); l_iter = l_iter->next; - BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, ulp->l_pair[0]), l_iter); l_iter = l_iter->next; - BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[1]->e, ulp->l_pair[1]), l_iter); + BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter); l_iter = l_iter->next; + BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[0]->e, l_iter), l_iter); l_iter = l_iter->next; + BM_elem_attrs_copy(bm, bm, BM_edge_other_loop(ulp->l_pair[1]->e, l_iter), l_iter); } } @@ -1007,7 +1007,7 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) * with modified selection */ // WM_operator_name_call(C, "MESH_OT_region_to_loop", WM_OP_INVOKE_DEFAULT, NULL); - BKE_report(op->reports, RPT_ERROR, "Can't rip selected faces"); + BKE_report(op->reports, RPT_ERROR, "Cannot rip selected faces"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index bc792037443..99eee19f66d 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -1333,7 +1333,7 @@ static int edgetag_shortest_path(Scene *scene, BMEditMesh *em, BMEdge *source, B EDBM_index_arrays_init(em, 1, 1, 0); targetnum = BM_elem_index_get(target); - while (!BLI_heap_empty(heap)) { + while (!BLI_heap_is_empty(heap)) { mednum = GET_INT_FROM_POINTER(BLI_heap_popmin(heap)); e = EDBM_edge_at_index(em, mednum); @@ -1444,7 +1444,7 @@ static int mouse_mesh_shortest_path(bContext *C, int mval[2]) case EDGE_MODE_TAG_SHARP: me->drawflag |= ME_DRAWSHARP; break; - case EDGE_MODE_TAG_CREASE: + case EDGE_MODE_TAG_CREASE: me->drawflag |= ME_DRAWCREASES; break; case EDGE_MODE_TAG_BEVEL: @@ -1717,7 +1717,7 @@ void EDBM_selectmode_convert(BMEditMesh *em, const short selectmode_old, const s BM_edge_select_set(em->bm, eed, TRUE); } } - } + } else if (selectmode_new == SCE_SELECT_FACE) { BMIter liter; BMLoop *l; @@ -2482,7 +2482,7 @@ static int edbm_select_non_manifold_exec(bContext *C, wmOperator *op) */ if (em->selectmode == SCE_SELECT_FACE) { - BKE_report(op->reports, RPT_ERROR, "Doesn't work in face selection mode"); + BKE_report(op->reports, RPT_ERROR, "Does not work in face selection mode"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index ee615093c86..9d3cc7b7c76 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -255,7 +255,7 @@ static short edbm_extrude_discrete_faces(BMEditMesh *em, wmOperator *op, const c return 0; } - return 's'; // s is shrink/fatten + return 's'; /* s is shrink/fatten */ } /* extrudes individual edges */ @@ -275,7 +275,7 @@ static short edbm_extrude_edges_indiv(BMEditMesh *em, wmOperator *op, const char return 0; } - return 'n'; // n is normal grab + return 'n'; /* n is normal grab */ } /* extrudes individual vertices */ @@ -295,7 +295,7 @@ static short edbm_extrude_verts_indiv(BMEditMesh *em, wmOperator *op, const char return 0; } - return 'g'; // g is grab + return 'g'; /* g is grab */ } static short edbm_extrude_edge(Object *obedit, BMEditMesh *em, const char hflag, float nor[3]) @@ -1666,6 +1666,88 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot) RNA_def_boolean(ot->srna, "zaxis", 1, "Z-Axis", "Smooth along the Z axis"); } +static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op) +{ + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BMEdit_FromObject(obedit); + int usex = TRUE, usey = TRUE, usez = TRUE, volume_preservation = TRUE; + int i, repeat; + float lambda; + float lambda_border; + BMIter fiter; + BMFace *f; + + /* Check if select faces are triangles */ + BM_ITER_MESH (f, &fiter, em->bm, BM_FACES_OF_MESH) { + if (BM_elem_flag_test(f, BM_ELEM_SELECT)) { + if (f->len > 4) { + BKE_report(op->reports, RPT_WARNING, "Selected faces must be triangles or quads"); + return OPERATOR_CANCELLED; + } + } + } + + /* mirror before smooth */ + if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) { + EDBM_verts_mirror_cache_begin(em, TRUE); + } + + repeat = RNA_int_get(op->ptr, "repeat"); + lambda = RNA_float_get(op->ptr, "lambda"); + lambda_border = RNA_float_get(op->ptr, "lambda_border"); + usex = RNA_boolean_get(op->ptr, "use_x"); + usey = RNA_boolean_get(op->ptr, "use_y"); + usez = RNA_boolean_get(op->ptr, "use_z"); + volume_preservation = RNA_boolean_get(op->ptr, "volume_preservation"); + if (!repeat) + repeat = 1; + + for (i = 0; i < repeat; i++) { + if (!EDBM_op_callf(em, op, + "smooth_laplacian_vert verts=%hv lambda=%f lambda_border=%f use_x=%b use_y=%b use_z=%b volume_preservation=%b", + BM_ELEM_SELECT, lambda, lambda_border, usex, usey, usez, volume_preservation)) + { + return OPERATOR_CANCELLED; + } + } + + /* apply mirror */ + if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) { + EDBM_verts_mirror_apply(em, BM_ELEM_SELECT, 0); + EDBM_verts_mirror_cache_end(em); + } + + EDBM_update_generic(C, em, TRUE); + + return OPERATOR_FINISHED; +} + +void MESH_OT_vertices_smooth_laplacian(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Laplacian Smooth Vertex"; + ot->description = "Laplacian smooth of selected vertices"; + ot->idname = "MESH_OT_vertices_smooth_laplacian"; + + /* api callbacks */ + ot->exec = edbm_do_smooth_laplacian_vertex_exec; + ot->poll = ED_operator_editmesh; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + RNA_def_int(ot->srna, "repeat", 1, 1, 200, + "Number of iterations to smooth the mesh", "", 1, 200); + RNA_def_float(ot->srna, "lambda", 0.00005f, 0.0000001f, 1000.0f, + "Lambda factor", "", 0.0000001f, 1000.0f); + RNA_def_float(ot->srna, "lambda_border", 0.00005f, 0.0000001f, 1000.0f, + "Lambda factor in border", "", 0.0000001f, 1000.0f); + RNA_def_boolean(ot->srna, "use_x", 1, "Smooth X Axis", "Smooth object along X axis"); + RNA_def_boolean(ot->srna, "use_y", 1, "Smooth Y Axis", "Smooth object along Y axis"); + RNA_def_boolean(ot->srna, "use_z", 1, "Smooth Z Axis", "Smooth object along Z axis"); + RNA_def_boolean(ot->srna, "volume_preservation", 1, "Preserve Volume", "Apply volume preservation after smooth"); +} + /********************** Smooth/Solid Operators *************************/ static void mesh_set_smooth_faces(BMEditMesh *em, short smooth) @@ -2712,21 +2794,21 @@ static float bm_edge_seg_isect(const float sco_a[2], const float sco_b[2], m1 = MAXSLOPE; b1 = x12; } - x2max = maxf(x21, x22) + 0.001f; /* prevent missed edges */ - x2min = minf(x21, x22) - 0.001f; /* due to round off error */ - y2max = maxf(y21, y22) + 0.001f; - y2min = minf(y21, y22) - 0.001f; + x2max = max_ff(x21, x22) + 0.001f; /* prevent missed edges */ + x2min = min_ff(x21, x22) - 0.001f; /* due to round off error */ + y2max = max_ff(y21, y22) + 0.001f; + y2min = min_ff(y21, y22) - 0.001f; /* Found an intersect, calc intersect point */ if (m1 == m2) { /* co-incident lines */ /* cut at 50% of overlap area */ - x1max = maxf(x11, x12); - x1min = minf(x11, x12); - xi = (minf(x2max, x1max) + maxf(x2min, x1min)) / 2.0f; + x1max = max_ff(x11, x12); + x1min = min_ff(x11, x12); + xi = (min_ff(x2max, x1max) + max_ff(x2min, x1min)) / 2.0f; - y1max = maxf(y11, y12); - y1min = minf(y11, y12); - yi = (minf(y2max, y1max) + maxf(y2min, y1min)) / 2.0f; + y1max = max_ff(y11, y12); + y1min = min_ff(y11, y12); + yi = (min_ff(y2max, y1max) + max_ff(y2min, y1min)) / 2.0f; } else if (m2 == MAXSLOPE) { xi = x22; @@ -2766,7 +2848,7 @@ static float bm_edge_seg_isect(const float sco_a[2], const float sco_b[2], break; } - } + } lastdist = dist; } return perc; @@ -3412,7 +3494,8 @@ static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); BMesh *bm = em->bm; - float angle_limit = RNA_float_get(op->ptr, "angle_limit"); + const float angle_limit = RNA_float_get(op->ptr, "angle_limit"); + const int use_dissolve_boundaries = RNA_boolean_get(op->ptr, "use_dissolve_boundaries"); char dissolve_flag; @@ -3448,8 +3531,8 @@ static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op) } if (!EDBM_op_callf(em, op, - "dissolve_limit edges=%he verts=%hv angle_limit=%f", - dissolve_flag, dissolve_flag, angle_limit)) + "dissolve_limit edges=%he verts=%hv angle_limit=%f use_dissolve_boundaries=%b", + dissolve_flag, dissolve_flag, angle_limit, use_dissolve_boundaries)) { return OPERATOR_CANCELLED; } @@ -3476,8 +3559,10 @@ void MESH_OT_dissolve_limited(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; prop = RNA_def_float_rotation(ot->srna, "angle_limit", 0, NULL, 0.0f, DEG2RADF(180.0f), - "Max Angle", "Angle Limit in Degrees", 0.0f, DEG2RADF(180.0f)); + "Max Angle", "Angle limit", 0.0f, DEG2RADF(180.0f)); RNA_def_property_float_default(prop, DEG2RADF(15.0f)); + RNA_def_boolean(ot->srna, "use_dissolve_boundaries", 0, "All Boundaries", + "Dissolve all vertices inbetween face boundaries"); } static int edbm_split_exec(bContext *C, wmOperator *op) @@ -5147,7 +5232,7 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, wmEvent *event) if (handleNumInput(&opdata->num_input, event)) { applyNumInput(&opdata->num_input, amounts); - amounts[0] = maxf(amounts[0], 0.0f); + amounts[0] = max_ff(amounts[0], 0.0f); RNA_float_set(op->ptr, "thickness", amounts[0]); RNA_float_set(op->ptr, "depth", amounts[1]); @@ -5188,7 +5273,7 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, wmEvent *event) if (opdata->modify_depth) RNA_float_set(op->ptr, "depth", amount); else { - amount = maxf(amount, 0.0f); + amount = max_ff(amount, 0.0f); RNA_float_set(op->ptr, "thickness", amount); } @@ -5386,6 +5471,7 @@ void MESH_OT_wireframe(wmOperatorType *ot) RNA_def_boolean(ot->srna, "use_replace", TRUE, "Replace", "Remove original faces"); } +#ifdef WITH_BULLET static int edbm_convex_hull_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); @@ -5479,6 +5565,7 @@ void MESH_OT_convex_hull(wmOperatorType *ot) join_triangle_props(ot); } +#endif static int mesh_symmetrize_exec(bContext *C, wmOperator *op) { diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 537d463dfbc..ef3d8db4156 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -1012,6 +1012,19 @@ void EDBM_uv_element_map_free(UvElementMap *element_map) } } +UvElement *ED_uv_element_get(UvElementMap *map, BMFace *efa, BMLoop *l) +{ + UvElement *element; + + element = map->vert[BM_elem_index_get(l->v)]; + + for (; element; element = element->next) + if (element->face == efa) + return element; + + return NULL; +} + /* last_sel, use em->act_face otherwise get the last selected face in the editselections * at the moment, last_sel is mainly useful for making sure the space image dosnt flicker */ MTexPoly *EDBM_mtexpoly_active_get(BMEditMesh *em, BMFace **r_act_efa, int sloppy, int selected) diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 835b1ccd52d..65701663df4 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -135,6 +135,7 @@ void MESH_OT_mark_seam(struct wmOperatorType *ot); void MESH_OT_mark_sharp(struct wmOperatorType *ot); void MESH_OT_mark_freestyle_edge(struct wmOperatorType *ot); void MESH_OT_vertices_smooth(struct wmOperatorType *ot); +void MESH_OT_vertices_smooth_laplacian(struct wmOperatorType *ot); void MESH_OT_noise(struct wmOperatorType *ot); void MESH_OT_flip_normals(struct wmOperatorType *ot); void MESH_OT_solidify(struct wmOperatorType *ot); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index d06142d2654..64e61d436ee 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -135,6 +135,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_mark_sharp); WM_operatortype_append(MESH_OT_mark_freestyle_edge); WM_operatortype_append(MESH_OT_vertices_smooth); + WM_operatortype_append(MESH_OT_vertices_smooth_laplacian); WM_operatortype_append(MESH_OT_noise); WM_operatortype_append(MESH_OT_flip_normals); WM_operatortype_append(MESH_OT_rip); @@ -167,7 +168,9 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_wireframe); WM_operatortype_append(MESH_OT_edge_split); +#ifdef WITH_BULLET WM_operatortype_append(MESH_OT_convex_hull); +#endif WM_operatortype_append(MESH_OT_symmetrize); diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index d8793505608..765f9307247 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -113,7 +113,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) CustomData vdata, edata, fdata, ldata, pdata; if (scene->obedit) { - BKE_report(op->reports, RPT_WARNING, "Cannot join while in editmode"); + BKE_report(op->reports, RPT_WARNING, "Cannot join while in edit mode"); return OPERATOR_CANCELLED; } @@ -165,6 +165,9 @@ int join_mesh_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } + /* remove tessface to ensure we don't old references to invalid faces */ + BKE_mesh_tessface_clear(me); + /* new material indices and material array */ matar = MEM_callocN(sizeof(void *) * totmat, "join_mesh matar"); if (totmat) matmap = MEM_callocN(sizeof(int) * totmat, "join_mesh matmap"); @@ -264,7 +267,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) /* adjust settings to fit (allocate a new data-array) */ kbn->data = MEM_callocN(sizeof(float) * 3 * totvert, "joined_shapekey"); - kbn->totelem = totvert; + kbn->totelem = totvert; /* XXX 2.5 Animato */ #if 0 @@ -513,7 +516,8 @@ int join_mesh_exec(bContext *C, wmOperator *op) me->ldata = ldata; me->pdata = pdata; - mesh_update_customdata_pointers(me, TRUE); /* BMESH_TODO, check if this arg can be failse, non urgent - campbell */ + /* tessface data removed above, no need to update */ + mesh_update_customdata_pointers(me, FALSE); /* old material array */ for (a = 1; a <= ob->totcol; a++) { @@ -843,7 +847,7 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, const float co[3], char m minmax_v3v3_v3(min, max, eve->co); } } - else { + else { MVert *mvert; int a; @@ -878,7 +882,7 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, const float co[3], char m mesh_octree_add_nodes(MeshOctree.table, eve->co, MeshOctree.offs, MeshOctree.div, (intptr_t)(eve)); } } - else { + else { MVert *mvert; int a; diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index b9018914633..8633a7a9b38 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -124,7 +124,6 @@ MetaElem *add_metaball_primitive(bContext *UNUSED(C), Object *obedit, float mat[ /* Select or deselect all MetaElements */ static int mball_select_all_exec(bContext *C, wmOperator *op) { - //Scene *scene= CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); MetaBall *mb = (MetaBall *)obedit->data; MetaElem *ml; diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 9a2915a5d55..9fc4e0a906d 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -833,8 +833,6 @@ static int group_instance_add_exec(bContext *C, wmOperator *op) /* only used as menu */ void OBJECT_OT_group_instance_add(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name = "Add Group Instance"; ot->description = "Add a dupligroup instance"; @@ -849,9 +847,8 @@ void OBJECT_OT_group_instance_add(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - prop = RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", ""); - RNA_def_enum_funcs(prop, RNA_group_itemf); - ot->prop = prop; + ot->prop = RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", ""); + RNA_def_enum_funcs(ot->prop, RNA_group_itemf); ED_object_add_generic_props(ot, FALSE); } @@ -1124,13 +1121,13 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, basen->object = ob; /* make sure apply works */ - BKE_free_animdata(&ob->id); + BKE_free_animdata(&ob->id); ob->adt = NULL; ob->parent = NULL; ob->constraints.first = ob->constraints.last = NULL; ob->disp.first = ob->disp.last = NULL; - ob->transflag &= ~OB_DUPLI; + ob->transflag &= ~OB_DUPLI; ob->lay = base->lay; copy_m4_m4(ob->obmat, dob->mat); @@ -1410,7 +1407,7 @@ static int convert_exec(bContext *C, wmOperator *op) * cases this doesnt give correct results (when MDEF is used for eg) */ dm = mesh_get_derived_final(scene, newob, CD_MASK_MESH); - /* dm= mesh_create_derived_no_deform(ob1, NULL); this was called original (instead of get_derived). man o man why! (ton) */ + // dm = mesh_create_derived_no_deform(ob1, NULL); /* this was called original (instead of get_derived). man o man why! (ton) */ DM_to_mesh(dm, newob->data, newob); @@ -1576,7 +1573,7 @@ static int convert_exec(bContext *C, wmOperator *op) /* delete original if needed */ if (basedel) { if (!keep_original) - ED_base_object_free_and_unlink(bmain, scene, basedel); + ED_base_object_free_and_unlink(bmain, scene, basedel); basedel = NULL; } @@ -2060,11 +2057,11 @@ static int join_exec(bContext *C, wmOperator *op) Object *ob = CTX_data_active_object(C); if (scene->obedit) { - BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode"); + BKE_report(op->reports, RPT_ERROR, "This data does not support joining in edit mode"); return OPERATOR_CANCELLED; } else if (BKE_object_obdata_is_libdata(ob)) { - BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata"); + BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata"); return OPERATOR_CANCELLED; } @@ -2114,11 +2111,11 @@ static int join_shapes_exec(bContext *C, wmOperator *op) Object *ob = CTX_data_active_object(C); if (scene->obedit) { - BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode"); + BKE_report(op->reports, RPT_ERROR, "This data does not support joining in edit mode"); return OPERATOR_CANCELLED; } else if (BKE_object_obdata_is_libdata(ob)) { - BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata"); + BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index bc5d289d04c..2914a1ff673 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -966,6 +966,12 @@ static int multiresbake_check(bContext *C, wmOperator *op) break; } + if (mmd->lvl == 0) { + BKE_report(op->reports, RPT_ERROR, "Multires data baking is not supported for preview subdivision level 0"); + + break; + } + if (!me->mtpoly) { BKE_report(op->reports, RPT_ERROR, "Mesh should be unwrapped before multires data baking"); @@ -1030,8 +1036,7 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l tmp_mmd.lvl = *lvl; tmp_mmd.sculptlvl = *lvl; - dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob, - 0); + dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob, 0); cddm->release(cddm); } @@ -1051,8 +1056,7 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l tmp_mmd.lvl = mmd->totlvl; tmp_mmd.sculptlvl = mmd->totlvl; - dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob, - 0); + dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob, 0); cddm->release(cddm); return dm; diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 80993d6cca7..f78e1203bc4 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -494,9 +494,9 @@ static void test_constraints(Object *owner, bPoseChannel *pchan) /* auto-set 'Path' setting on curve so this works */ cu->flag |= CU_PATH; } - } + } } - } + } /* free any temporary targets */ if (cti->flush_constraint_targets) @@ -593,7 +593,7 @@ static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int if (owner == EDIT_CONSTRAINT_OWNER_OBJECT) { list = &ob->constraints; - } + } else if (owner == EDIT_CONSTRAINT_OWNER_BONE) { bPoseChannel *pchan = BKE_pose_channel_active(ob); if (pchan) @@ -807,7 +807,7 @@ static int childof_set_inverse_exec(bContext *C, wmOperator *op) /* despite 3 layers of checks, we may still not be able to find a constraint */ if (data == NULL) { printf("DEBUG: Child-Of Set Inverse - object = '%s'\n", (ob) ? ob->id.name + 2 : "<None>"); - BKE_report(op->reports, RPT_ERROR, "Couldn't find constraint data for Child-Of Set Inverse"); + BKE_report(op->reports, RPT_ERROR, "Could not find constraint data for Child-Of Set Inverse"); return OPERATOR_CANCELLED; } @@ -1028,7 +1028,7 @@ static int objectsolver_set_inverse_exec(bContext *C, wmOperator *op) /* despite 3 layers of checks, we may still not be able to find a constraint */ if (data == NULL) { printf("DEBUG: Child-Of Set Inverse - object = '%s'\n", (ob) ? ob->id.name + 2 : "<None>"); - BKE_report(op->reports, RPT_ERROR, "Couldn't find constraint data for Child-Of Set Inverse"); + BKE_report(op->reports, RPT_ERROR, "Could not find constraint data for Child-Of Set Inverse"); return OPERATOR_CANCELLED; } @@ -1628,15 +1628,15 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase return OPERATOR_CANCELLED; } if ((type == CONSTRAINT_TYPE_RIGIDBODYJOINT) && (list != &ob->constraints)) { - BKE_report(op->reports, RPT_ERROR, "Rigid Body Joint Constraint can only be added to Objects"); + BKE_report(op->reports, RPT_ERROR, "Rigid Body Joint constraint can only be added to objects"); return OPERATOR_CANCELLED; } if ((type == CONSTRAINT_TYPE_KINEMATIC) && ((!pchan) || (list != &pchan->constraints))) { - BKE_report(op->reports, RPT_ERROR, "IK Constraint can only be added to Bones"); + BKE_report(op->reports, RPT_ERROR, "IK constraint can only be added to bones"); return OPERATOR_CANCELLED; } if ((type == CONSTRAINT_TYPE_SPLINEIK) && ((!pchan) || (list != &pchan->constraints))) { - BKE_report(op->reports, RPT_ERROR, "Spline IK Constraint can only be added to Bones"); + BKE_report(op->reports, RPT_ERROR, "Spline IK constraint can only be added to bones"); return OPERATOR_CANCELLED; } @@ -1856,7 +1856,7 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) /* must have active bone */ if (ELEM(NULL, ob, pchan)) { - BKE_report(op->reports, RPT_ERROR, "Must have active bone to add IK Constraint to"); + BKE_report(op->reports, RPT_ERROR, "Must have an active bone to add IK constraint to"); return OPERATOR_CANCELLED; } @@ -1865,7 +1865,7 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) if (con->type == CONSTRAINT_TYPE_KINEMATIC) break; } if (con) { - BKE_report(op->reports, RPT_ERROR, "Bone already has IK Constraint"); + BKE_report(op->reports, RPT_ERROR, "Bone already has an IK constraint"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 43c6c332791..c0c2195592b 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -201,7 +201,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op) ED_base_object_activate(C, NULL); } } - } + } } CTX_DATA_END; @@ -684,7 +684,7 @@ static void copymenu_logicbricks(Scene *scene, View3D *v3d, Object *ob) if (TESTBASELIB(v3d, base)) { /* first: free all logic */ - free_sensors(&base->object->sensors); + free_sensors(&base->object->sensors); unlink_controllers(&base->object->controllers); free_controllers(&base->object->controllers); unlink_actuators(&base->object->actuators); @@ -885,7 +885,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) id_us_plus((ID *)cu1->vfonti); if (cu1->vfontbi) cu1->vfontbi->id.us--; cu1->vfontbi = cu->vfontbi; - id_us_plus((ID *)cu1->vfontbi); + id_us_plus((ID *)cu1->vfontbi); BKE_vfont_to_curve(bmain, scene, base->object, 0); /* needed? */ @@ -988,7 +988,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) cu1->flag |= CU_UV_ORCO; else cu1->flag &= ~CU_UV_ORCO; - } + } } else if (event == 29) { /* protected bits */ base->object->protectflag = ob->protectflag; @@ -1401,7 +1401,7 @@ static void UNUSED_FUNCTION(image_aspect) (Scene * scene, View3D * v3d) else ob->size[1] = ob->size[0] * y / x; done = TRUE; - DAG_id_tag_update(&ob->id, OB_RECALC_OB); + DAG_id_tag_update(&ob->id, OB_RECALC_OB); } } if (done) break; @@ -1795,7 +1795,7 @@ static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op)) { if (ob != ob_iter) { /* first: free all logic */ - free_sensors(&ob_iter->sensors); + free_sensors(&ob_iter->sensors); unlink_controllers(&ob_iter->controllers); free_controllers(&ob_iter->controllers); unlink_actuators(&ob_iter->actuators); @@ -1864,7 +1864,7 @@ static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op)) ob_iter->anisotropicFriction[0] = ob->anisotropicFriction[0]; ob_iter->anisotropicFriction[1] = ob->anisotropicFriction[1]; ob_iter->anisotropicFriction[2] = ob->anisotropicFriction[2]; - ob_iter->collision_boundtype = ob->collision_boundtype; + ob_iter->collision_boundtype = ob->collision_boundtype; ob_iter->margin = ob->margin; ob_iter->bsoft = copy_bulletsoftbody(ob->bsoft); if (ob->restrictflag & OB_RESTRICT_RENDER) diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c index cca37cf3a44..a3bf27a19d6 100644 --- a/source/blender/editors/object/object_group.c +++ b/source/blender/editors/object/object_group.c @@ -195,7 +195,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op) } } - if (!ok) BKE_report(op->reports, RPT_ERROR, "Active Object contains no groups"); + if (!ok) BKE_report(op->reports, RPT_ERROR, "Active object contains no groups"); DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL); @@ -211,7 +211,7 @@ void GROUP_OT_objects_remove_active(wmOperatorType *ot) ot->idname = "GROUP_OT_objects_remove_active"; /* api callbacks */ - ot->exec = objects_remove_active_exec; + ot->exec = objects_remove_active_exec; ot->poll = ED_operator_objectmode; /* flags */ @@ -333,7 +333,7 @@ void GROUP_OT_create(wmOperatorType *ot) ot->idname = "GROUP_OT_create"; /* api callbacks */ - ot->exec = group_create_exec; + ot->exec = group_create_exec; ot->poll = ED_operator_objectmode; /* flags */ diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 8bc249974f2..caeff1e82a7 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -515,12 +515,12 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op) CTX_DATA_END; if (!obsel) { - BKE_report(op->reports, RPT_ERROR, "Can't add hook with no other selected objects"); + BKE_report(op->reports, RPT_ERROR, "Cannot add hook with no other selected objects"); return OPERATOR_CANCELLED; } if (use_bone && obsel->type != OB_ARMATURE) { - BKE_report(op->reports, RPT_ERROR, "Can't add hook bone for a non armature object"); + BKE_report(op->reports, RPT_ERROR, "Cannot add hook bone for a non armature object"); return OPERATOR_CANCELLED; } @@ -590,7 +590,7 @@ static int object_hook_remove_exec(bContext *C, wmOperator *op) hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num); if (!hmd) { - BKE_report(op->reports, RPT_ERROR, "Couldn't find hook modifier"); + BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier"); return OPERATOR_CANCELLED; } @@ -667,13 +667,13 @@ static int object_hook_reset_exec(bContext *C, wmOperator *op) if (ptr.data) { /* if modifier context is available, use that */ ob = ptr.id.data; hmd = ptr.data; - } + } else { /* use the provided property */ ob = CTX_data_edit_object(C); hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num); } if (!ob || !hmd) { - BKE_report(op->reports, RPT_ERROR, "Couldn't find hook modifier"); + BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier"); return OPERATOR_CANCELLED; } @@ -735,13 +735,13 @@ static int object_hook_recenter_exec(bContext *C, wmOperator *op) if (ptr.data) { /* if modifier context is available, use that */ ob = ptr.id.data; hmd = ptr.data; - } + } else { /* use the provided property */ ob = CTX_data_edit_object(C); hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num); } if (!ob || !hmd) { - BKE_report(op->reports, RPT_ERROR, "Couldn't find hook modifier"); + BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier"); return OPERATOR_CANCELLED; } @@ -793,13 +793,13 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op) if (ptr.data) { /* if modifier context is available, use that */ ob = ptr.id.data; hmd = ptr.data; - } + } else { /* use the provided property */ ob = CTX_data_edit_object(C); hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num); } if (!ob || !hmd) { - BKE_report(op->reports, RPT_ERROR, "Couldn't find hook modifier"); + BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier"); return OPERATOR_CANCELLED; } @@ -855,13 +855,13 @@ static int object_hook_select_exec(bContext *C, wmOperator *op) if (ptr.data) { /* if modifier context is available, use that */ ob = ptr.id.data; hmd = ptr.data; - } + } else { /* use the provided property */ ob = CTX_data_edit_object(C); hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num); } if (!ob || !hmd) { - BKE_report(op->reports, RPT_ERROR, "Couldn't find hook modifier"); + BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index ac9c4f7adee..4aa2e825954 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -569,7 +569,7 @@ static void findnearestLattvert__doClosest(void *userData, BPoint *bp, const flo static BPoint *findnearestLattvert(ViewContext *vc, const int mval[2], int sel) { - /* sel==1: selected gets a disadvantage */ + /* (sel == 1): selected gets a disadvantage */ /* in nurb and bezt or bp the nearest is written */ /* return 0 1 2: handlepunt */ struct { BPoint *bp; float dist; int select; float mval_fl[2]; } data = {NULL}; diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 02070506937..3d2c4f95624 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -99,13 +99,13 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc /* only geometry objects should be able to get modifiers [#25291] */ if (!ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) { - BKE_reportf(reports, RPT_WARNING, "Modifiers cannot be added to Object '%s'", ob->id.name + 2); + BKE_reportf(reports, RPT_WARNING, "Modifiers cannot be added to object '%s'", ob->id.name + 2); return NULL; } if (mti->flags & eModifierTypeFlag_Single) { if (modifiers_findByType(ob, type)) { - BKE_report(reports, RPT_WARNING, "Only one modifier of this type allowed"); + BKE_report(reports, RPT_WARNING, "Only one modifier of this type is allowed"); return NULL; } } @@ -556,7 +556,7 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M KeyBlock *kb; if (!modifier_sameTopology(md) || mti->type == eModifierTypeType_NonGeometrical) { - BKE_report(reports, RPT_ERROR, "Only deforming modifiers can be applied to Shapes"); + BKE_report(reports, RPT_ERROR, "Only deforming modifiers can be applied to shapes"); return 0; } @@ -604,7 +604,7 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob, MultiresModifierData *mmd = find_multires_modifier_before(scene, md); if (me->key && mti->type != eModifierTypeType_NonGeometrical) { - BKE_report(reports, RPT_ERROR, "Modifier cannot be applied to Mesh with Shape Keys"); + BKE_report(reports, RPT_ERROR, "Modifier cannot be applied to a mesh with shape keys"); return 0; } @@ -681,7 +681,7 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi int prev_mode; if (scene->obedit) { - BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied in editmode"); + BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied in edit mode"); return 0; } else if (((ID *) ob->data)->us > 1) { diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index b6d3594c826..d19277d20a2 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -393,7 +393,7 @@ void ED_keymap_object(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "OBJECT_OT_proxy_make", PKEY, KM_PRESS, KM_CTRL | KM_ALT, 0); WM_keymap_add_item(keymap, "OBJECT_OT_make_local", LKEY, KM_PRESS, 0, 0); - // XXX this should probably be in screen instead... here for testing purposes in the meantime... - Aligorith + /* XXX this should probably be in screen instead... here for testing purposes in the meantime... - Aligorith */ WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_insert_menu", IKEY, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_delete_v3d", IKEY, KM_PRESS, KM_ALT, 0); WM_keymap_verify_item(keymap, "ANIM_OT_keying_set_active_set", IKEY, KM_PRESS, KM_CTRL | KM_SHIFT | KM_ALT, 0); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 447ba29e203..58c6959d6f0 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -622,13 +622,13 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object /* fall back on regular parenting now (for follow only) */ if (partype == PAR_FOLLOW) partype = PAR_OBJECT; - } + } } else if (partype == PAR_BONE) { pchan = BKE_pose_channel_active(par); if (pchan == NULL) { - BKE_report(reports, RPT_ERROR, "No active Bone"); + BKE_report(reports, RPT_ERROR, "No active bone"); return 0; } } @@ -667,7 +667,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object * NOTE: the old (2.4x) method was to set ob->partype = PARSKEL, creating the virtual modifiers */ ob->partype = PAROBJECT; /* note, dna define, not operator property */ - //ob->partype= PARSKEL; /* note, dna define, not operator property */ + //ob->partype = PARSKEL; /* note, dna define, not operator property */ /* BUT, to keep the deforms, we need a modifier, and then we need to set the object that it uses * - We need to ensure that the modifier we're adding doesn't already exist, so we check this by @@ -1036,7 +1036,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op) int type = RNA_enum_get(op->ptr, "type"); if (CTX_data_edit_object(C)) { - BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in EditMode"); + BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in edit mode"); return OPERATOR_CANCELLED; } CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) @@ -1260,7 +1260,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op) base->object->lay = lay; base->object->flag &= ~SELECT; base->flag &= ~SELECT; - /* if (base->object->type==OB_LAMP) is_lamp = TRUE; */ + /* if (base->object->type == OB_LAMP) is_lamp = TRUE; */ } CTX_DATA_END; } @@ -1273,7 +1273,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op) local = base->lay & 0xFF000000; base->lay = lay + local; base->object->lay = lay; - /* if (base->object->type==OB_LAMP) is_lamp = TRUE; */ + /* if (base->object->type == OB_LAMP) is_lamp = TRUE; */ } CTX_DATA_END; } @@ -1350,17 +1350,17 @@ static int make_links_scene_exec(bContext *C, wmOperator *op) Scene *scene_to = BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene")); if (scene_to == NULL) { - BKE_report(op->reports, RPT_ERROR, "Couldn't find scene"); + BKE_report(op->reports, RPT_ERROR, "Could not find scene"); return OPERATOR_CANCELLED; } if (scene_to == CTX_data_scene(C)) { - BKE_report(op->reports, RPT_ERROR, "Can't link objects into the same scene"); + BKE_report(op->reports, RPT_ERROR, "Cannot link objects into the same scene"); return OPERATOR_CANCELLED; } if (scene_to->id.lib) { - BKE_report(op->reports, RPT_ERROR, "Can't link objects into a linked scene"); + BKE_report(op->reports, RPT_ERROR, "Cannot link objects into a linked scene"); return OPERATOR_CANCELLED; } @@ -1710,7 +1710,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag) break; case OB_MESH: ob->data = BKE_mesh_copy(ob->data); - //me= ob->data; + //me = ob->data; //if (me && me->key) // ipo_idnew(me->key->ipo); /* drivers */ break; diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 4ed14c3cdce..2aa737d204d 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -425,7 +425,7 @@ static int object_select_linked_exec(bContext *C, wmOperator *op) ob = OBACT; if (ob == NULL) { - BKE_report(op->reports, RPT_ERROR, "No Active Object"); + BKE_report(op->reports, RPT_ERROR, "No active object"); return OPERATOR_CANCELLED; } @@ -608,11 +608,11 @@ static short select_grouped_group(bContext *C, Object *ob) /* Select objects in for (i = 0; i < group_count; i++) { group = ob_groups[i]; - uiItemStringO(layout, group->id.name + 2, 0, "OBJECT_OT_select_same_group", "group", group->id.name); + uiItemStringO(layout, group->id.name + 2, 0, "OBJECT_OT_select_same_group", "group", group->id.name + 2); } uiPupMenuEnd(C, pup); - return changed; // The operator already handle this! + return changed; /* The operator already handle this! */ } static short select_grouped_object_hooks(bContext *C, Object *ob) @@ -754,8 +754,8 @@ static short select_grouped_keyingset(bContext *C, Object *UNUSED(ob)) return 0; /* select each object that Keying Set refers to */ - // TODO: perhaps to be more in line with the rest of these, we should only take objects - // if the passed in object is included in this too + /* TODO: perhaps to be more in line with the rest of these, we should only take objects + * if the passed in object is included in this too */ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) { /* only check for this object if it isn't selected already, to limit time wasted */ @@ -800,7 +800,7 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op) ob = OBACT; if (ob == NULL) { - BKE_report(op->reports, RPT_ERROR, "No Active Object"); + BKE_report(op->reports, RPT_ERROR, "No active object"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 86a55a9b278..2b6d69ca694 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -211,7 +211,7 @@ static int object_shape_key_mirror(bContext *C, Object *ob) /* currently editmode isn't supported by mesh so * ignore here for now too */ - /* if (lt->editlatt) lt= lt->editlatt->latt; */ + /* if (lt->editlatt) lt = lt->editlatt->latt; */ for (w = 0; w < lt->pntsw; w++) { for (v = 0; v < lt->pntsv; v++) { diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 4c95884a51a..4476296866e 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -171,7 +171,7 @@ static void object_clear_rot(Object *ob) } } } // Duplicated in source/blender/editors/armature/editarmature.c - else { + else { if (ob->rotmode == ROT_MODE_QUAT) { unit_qt(ob->quat); unit_qt(ob->dquat); @@ -217,7 +217,7 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op, /* sanity checks */ if (ELEM(NULL, clear_func, default_ksName)) { - BKE_report(op->reports, RPT_ERROR, "Programming error: missing clear transform function or Keying Set Name"); + BKE_report(op->reports, RPT_ERROR, "Programming error: missing clear transform function or keying set name"); return OPERATOR_CANCELLED; } @@ -390,19 +390,19 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo if (ob->type == OB_MESH) { if (ID_REAL_USERS(ob->data) > 1) { - BKE_report(reports, RPT_ERROR, "Can't apply to a multi user mesh, doing nothing"); + BKE_report(reports, RPT_ERROR, "Cannot apply to a multi user mesh, doing nothing"); change = 0; } } else if (ob->type == OB_ARMATURE) { if (ID_REAL_USERS(ob->data) > 1) { - BKE_report(reports, RPT_ERROR, "Can't apply to a multi user armature, doing nothing"); + BKE_report(reports, RPT_ERROR, "Cannot apply to a multi user armature, doing nothing"); change = 0; } } else if (ob->type == OB_LATTICE) { if (ID_REAL_USERS(ob->data) > 1) { - BKE_report(reports, RPT_ERROR, "Can't apply to a multi user lattice, doing nothing"); + BKE_report(reports, RPT_ERROR, "Cannot apply to a multi user lattice, doing nothing"); change = 0; } } @@ -410,7 +410,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo Curve *cu; if (ID_REAL_USERS(ob->data) > 1) { - BKE_report(reports, RPT_ERROR, "Can't apply to a multi user curve, doing nothing"); + BKE_report(reports, RPT_ERROR, "Cannot apply to a multi user curve, doing nothing"); change = 0; } @@ -422,7 +422,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo change = 0; } if (cu->key) { - BKE_report(reports, RPT_ERROR, "Can't apply to a curve with vertex keys, doing nothing"); + BKE_report(reports, RPT_ERROR, "Cannot apply to a curve with vertex keys, doing nothing"); change = 0; } } @@ -654,7 +654,8 @@ void OBJECT_OT_transform_apply(wmOperatorType *ot) enum { GEOMETRY_TO_ORIGIN = 0, ORIGIN_TO_GEOMETRY, - ORIGIN_TO_CURSOR + ORIGIN_TO_CURSOR, + ORIGIN_TO_CENTER_OF_MASS }; static int object_origin_set_exec(bContext *C, wmOperator *op) @@ -671,7 +672,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) int tot_change = 0, tot_lib_error = 0, tot_multiuser_arm_error = 0; if (obedit && centermode != GEOMETRY_TO_ORIGIN) { - BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in EditMode"); + BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in edit mode"); return OPERATOR_CANCELLED; } else { @@ -785,6 +786,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) Mesh *me = ob->data; if (centermode == ORIGIN_TO_CURSOR) { /* done */ } + else if (centermode == ORIGIN_TO_CENTER_OF_MASS) { BKE_mesh_center_centroid(me, cent); } else if (around == V3D_CENTROID) { BKE_mesh_center_median(me, cent); } else { BKE_mesh_center_bounds(me, cent); } @@ -852,7 +854,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) if (ID_REAL_USERS(arm) > 1) { #if 0 - BKE_report(op->reports, RPT_ERROR, "Can't apply to a multi user armature"); + BKE_report(op->reports, RPT_ERROR, "Cannot apply to a multi user armature"); return; #endif tot_multiuser_arm_error++; @@ -865,7 +867,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) tot_change++; arm->id.flag |= LIB_DOIT; - /* do_inverse_offset= TRUE; */ /* docenter_armature() handles this */ + /* do_inverse_offset = TRUE; */ /* docenter_armature() handles this */ BKE_object_where_is_calc(scene, ob); BKE_pose_where_is(scene, ob); /* needed for bone parents */ @@ -980,6 +982,8 @@ void OBJECT_OT_origin_set(wmOperatorType *ot) "Move object origin to center of object geometry"}, {ORIGIN_TO_CURSOR, "ORIGIN_CURSOR", 0, "Origin to 3D Cursor", "Move object origin to position of the 3D cursor"}, + {ORIGIN_TO_CENTER_OF_MASS, "ORIGIN_CENTER_OF_MASS", 0, "Origin to Center of Mass", + "Move object origin to the object center of mass (assuming uniform density)"}, {0, NULL, 0, NULL, NULL} }; @@ -1006,4 +1010,3 @@ void OBJECT_OT_origin_set(wmOperatorType *ot) ot->prop = RNA_def_enum(ot->srna, "type", prop_set_center_types, 0, "Type", ""); RNA_def_enum(ot->srna, "center", prop_set_bounds_types, V3D_CENTROID, "Center", ""); } - diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 1be09847ef2..c0f9ecfa5a2 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -405,27 +405,27 @@ typedef enum WT_Method { typedef enum WT_ReplaceMode { WT_REPLACE_ALL_WEIGHTS = 1, - WT_REPLACE_EMPTY_WEIGHTS = 2, + WT_REPLACE_EMPTY_WEIGHTS = 2 } WT_ReplaceMode; static EnumPropertyItem WT_vertex_group_mode_item[] = { - {WT_REPLACE_ACTIVE_VERTEX_GROUP, "WT_REPLACE_ACTIVE_VERTEX_GROUP", 1, "Active", "Transfer active vertex group from selected to active mesh."}, - {WT_REPLACE_ALL_VERTEX_GROUPS, "WT_REPLACE_ALL_VERTEX_GROUPS", 1, "All", "Transfer all vertex groups from selected to active mesh."}, - {0, NULL, 0, NULL, NULL} + {WT_REPLACE_ACTIVE_VERTEX_GROUP, "WT_REPLACE_ACTIVE_VERTEX_GROUP", 1, "Active", "Transfer active vertex group from selected to active mesh"}, + {WT_REPLACE_ALL_VERTEX_GROUPS, "WT_REPLACE_ALL_VERTEX_GROUPS", 1, "All", "Transfer all vertex groups from selected to active mesh"}, + {0, NULL, 0, NULL, NULL} }; static EnumPropertyItem WT_method_item[] = { - {WT_BY_INDEX, "WT_BY_INDEX", 1, "Vertex index", "Copy for identical meshes."}, - {WT_BY_NEAREST_VERTEX, "WT_BY_NEAREST_VERTEX", 1, "Nearest vertex", "Copy weight from closest vertex."}, - {WT_BY_NEAREST_FACE, "WT_BY_NEAREST_FACE", 1, "Nearest face", "Barycentric interpolation from nearest face."}, - {WT_BY_NEAREST_VERTEX_IN_FACE, "WT_BY_NEAREST_VERTEX_IN_FACE", 1, "Nearest vertex in face", "Copy weight from closest vertex in nearest face."}, - {0, NULL, 0, NULL, NULL} + {WT_BY_INDEX, "WT_BY_INDEX", 1, "Vertex index", "Copy for identical meshes"}, + {WT_BY_NEAREST_VERTEX, "WT_BY_NEAREST_VERTEX", 1, "Nearest vertex", "Copy weight from closest vertex"}, + {WT_BY_NEAREST_FACE, "WT_BY_NEAREST_FACE", 1, "Nearest face", "Barycentric interpolation from nearest face"}, + {WT_BY_NEAREST_VERTEX_IN_FACE, "WT_BY_NEAREST_VERTEX_IN_FACE", 1, "Nearest vertex in face", "Copy weight from closest vertex in nearest face"}, + {0, NULL, 0, NULL, NULL} }; static EnumPropertyItem WT_replace_mode_item[] = { - {WT_REPLACE_ALL_WEIGHTS, "WT_REPLACE_ALL_WEIGHTS", 1, "All", "Overwrites all weights."}, - {WT_REPLACE_EMPTY_WEIGHTS, "WT_REPLACE_EMPTY_WEIGHTS", 1, "Empty", "Adds weights to vertices with no weight."}, - {0, NULL, 0, NULL, NULL} + {WT_REPLACE_ALL_WEIGHTS, "WT_REPLACE_ALL_WEIGHTS", 1, "All", "Overwrite all weights"}, + {WT_REPLACE_EMPTY_WEIGHTS, "WT_REPLACE_EMPTY_WEIGHTS", 1, "Empty", "Add weights to vertices with no weight"}, + {0, NULL, 0, NULL, NULL} }; /*copy weight*/ @@ -941,7 +941,7 @@ static void vgroup_select_verts(Object *ob, int select) } /* this has to be called, because this function operates on vertices only */ - if (select) EDBM_select_flush(em); // vertices to edges/faces + if (select) EDBM_select_flush(em); /* vertices to edges/faces */ else EDBM_deselect_flush(em); } else { @@ -1062,7 +1062,7 @@ static void vgroup_normalize(Object *ob) dw = defvert_find_index(dv, def_nr); if (dw) { - weight_max = MAX2(dw->weight, weight_max); + weight_max = max_ff(dw->weight, weight_max); } } @@ -1174,23 +1174,24 @@ static void getVerticalAndHorizontalChange(const float norm[3], float d, const f const float start[3], float distToStart, float *end, float (*changes)[2], float *dists, int index) { - // A=Q-((Q-P).N)N - // D = (a*x0 + b*y0 +c*z0 +d) + /* A = Q - ((Q - P).N)N + * D = (a * x0 + b * y0 +c * z0 + d) */ float projA[3], projB[3]; closest_to_plane_v3(projA, coord, norm, start); closest_to_plane_v3(projB, coord, norm, end); - // (vertical and horizontal refer to the plane's y and xz respectively) - // vertical distance + /* (vertical and horizontal refer to the plane's y and xz respectively) + * vertical distance */ dists[index] = dot_v3v3(norm, end) + d; - // vertical change + /* vertical change */ changes[index][0] = dists[index] - distToStart; //printf("vc %f %f\n", distance(end, projB, 3)-distance(start, projA, 3), changes[index][0]); - // horizontal change + /* horizontal change */ changes[index][1] = len_v3v3(projA, projB); } -// I need the derived mesh to be forgotten so the positions are recalculated with weight changes (see dm_deform_recalc) +/* I need the derived mesh to be forgotten so the positions are recalculated + * with weight changes (see dm_deform_recalc) */ static void dm_deform_clear(DerivedMesh *dm, Object *ob) { if (ob->derivedDeform && (ob->derivedDeform) == dm) { @@ -1311,7 +1312,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in } } } - // sort the changes by the vertical change + /* sort the changes by the vertical change */ for (k = 0; k < totweight; k++) { float tf; int ti; @@ -1323,7 +1324,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in bestIndex = i; } } - // switch with k + /* switch with k */ if (bestIndex != k) { ti = upDown[k]; upDown[k] = upDown[bestIndex]; @@ -1650,11 +1651,11 @@ static void vgroup_blend(Object *ob, const float fac) /* i1 is always the selected one */ if (sel1) { i1 = BM_elem_index_get(eed->v1); - /* i2= BM_elem_index_get(eed->v2); */ /* UNUSED */ + /* i2 = BM_elem_index_get(eed->v2); */ /* UNUSED */ eve = eed->v2; } else { - /* i2= BM_elem_index_get(eed->v1); */ /* UNUSED */ + /* i2 = BM_elem_index_get(eed->v1); */ /* UNUSED */ i1 = BM_elem_index_get(eed->v2); eve = eed->v1; } @@ -3139,7 +3140,7 @@ void OBJECT_OT_vertex_group_limit_total(wmOperatorType *ot) /* identifiers */ ot->name = "Limit Number of Weights per Vertex"; ot->idname = "OBJECT_OT_vertex_group_limit_total"; - ot->description = "Limits deform weights associated with a vertex to a specified number by removing lowest weights"; + ot->description = "Limit deform weights associated with a vertex to a specified number by removing lowest weights"; /* api callbacks */ ot->poll = vertex_group_poll; @@ -3469,7 +3470,7 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op) } } else { - BKE_report(op->reports, RPT_ERROR, "Editmode lattice isn't supported yet"); + BKE_report(op->reports, RPT_ERROR, "Editmode lattice is not supported yet"); MEM_freeN(sort_map_update); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt index 4d43c618568..da12a26e747 100644 --- a/source/blender/editors/physics/CMakeLists.txt +++ b/source/blender/editors/physics/CMakeLists.txt @@ -20,6 +20,7 @@ set(INC ../include + ../../blenfont ../../blenkernel ../../blenlib ../../blenloader @@ -54,4 +55,8 @@ if(WITH_OPENMP) add_definitions(-DPARALLEL=1) endif() +if(WITH_INTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) +endif() + blender_add_lib(bf_editor_physics "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/physics/SConscript b/source/blender/editors/physics/SConscript index 9fe6cff4349..fffe05d6a0d 100644 --- a/source/blender/editors/physics/SConscript +++ b/source/blender/editors/physics/SConscript @@ -3,12 +3,12 @@ Import ('env') sources = env.Glob('*.c') -incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' +incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../gpu ../../blenloader ../../bmesh' incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern' -defs = '' +defs = [] if env['OURPLATFORM'] == 'linux': cflags='-pthread' @@ -17,9 +17,11 @@ if env['OURPLATFORM'] == 'linux': if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] - if env['OURPLATFORM'] == 'darwin': if env['WITH_BF_OPENMP']: - defs += ' PARALLEL=1' + defs.append('PARALLEL=1') + +if env['WITH_BF_INTERNATIONAL']: + defs.append('WITH_INTERNATIONAL') -env.BlenderLib ( 'bf_editors_physics', sources, Split(incs), Split(defs), libtype=['core'], priority=[45] ) +env.BlenderLib ( 'bf_editors_physics', sources, Split(incs), defs, libtype=['core'], priority=[45] ) diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index 467ad5c6ff9..c51b3ca4c43 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -26,6 +26,8 @@ #include "BLI_string.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "DNA_dynamicpaint_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" @@ -280,7 +282,10 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf int frames; frames = surface->end_frame - surface->start_frame + 1; - if (frames <= 0) {BLI_strncpy(canvas->error, "No frames to bake.", sizeof(canvas->error)); return 0;} + if (frames <= 0) { + BLI_strncpy(canvas->error, N_("No frames to bake"), sizeof(canvas->error)); + return 0; + } /* Set frame to start point (also inits modifier data) */ frame = surface->start_frame; diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c index aff66b272fe..dc309ec3c31 100644 --- a/source/blender/editors/physics/particle_boids.c +++ b/source/blender/editors/physics/particle_boids.c @@ -273,7 +273,7 @@ static int state_del_exec(bContext *C, wmOperator *UNUSED(op)) /* there must be at least one state */ if (!part->boids->states.first) { state = boid_new_state(part->boids); - BLI_addtail(&part->boids->states, state); + BLI_addtail(&part->boids->states, state); } else state = part->boids->states.first; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 7343a44470a..f8ec51c7a7c 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -603,7 +603,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected ParticleSystemModifierData *psmd = NULL; ParticleEditSettings *pset= PE_settings(data->scene); POINT_P; KEY_K; - float mat[4][4]= MAT4_UNITY, imat[4][4]= MAT4_UNITY; + float mat[4][4] = MAT4_UNITY, imat[4][4] = MAT4_UNITY; if (edit->psys) psmd= psys_get_modifier(data->ob, edit->psys); @@ -673,7 +673,7 @@ static void foreach_point(PEData *data, ForPointFunc func) PTCacheEdit *edit = data->edit; POINT_P; - LOOP_POINTS { + LOOP_POINTS { func(data, p); } } @@ -744,15 +744,15 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys) psys_mat_hair_to_orco(ob, psmd->dm, psys->part->from, pa, mat); copy_v3_v3(co, key->co); mul_m4_v3(mat, co); - co[0]= -co[0]; + co[0] = -co[0]; index= BLI_kdtree_find_nearest(tree, co, NULL, &nearest); /* this needs a custom threshold still, duplicated for editmode mirror */ if (index != -1 && index != p && (nearest.dist <= 0.0002f)) - edit->mirror_cache[p]= index; + edit->mirror_cache[p] = index; else - edit->mirror_cache[p]= -1; + edit->mirror_cache[p] = -1; } /* make sure mirrors are in two directions */ @@ -760,7 +760,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys) if (edit->mirror_cache[p]) { index= edit->mirror_cache[p]; if (edit->mirror_cache[index] != p) - edit->mirror_cache[p]= -1; + edit->mirror_cache[p] = -1; } } @@ -829,7 +829,7 @@ static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys for (k=0; k<pa->totkey; k++, hkey++, mhkey++, key++, mkey++) { copy_v3_v3(mhkey->co, hkey->co); mul_m4_v3(mat, mhkey->co); - mhkey->co[0]= -mhkey->co[0]; + mhkey->co[0] = -mhkey->co[0]; mul_m4_v3(immat, mhkey->co); if (key->flag & PEK_TAG) @@ -986,9 +986,9 @@ static void pe_iterate_lengths(Scene *scene, PTCacheEdit *edit) PTCacheEditKey *key; int j, k; float tlen; - float dv0[3]= {0.0f, 0.0f, 0.0f}; - float dv1[3]= {0.0f, 0.0f, 0.0f}; - float dv2[3]= {0.0f, 0.0f, 0.0f}; + float dv0[3] = {0.0f, 0.0f, 0.0f}; + float dv1[3] = {0.0f, 0.0f, 0.0f}; + float dv2[3] = {0.0f, 0.0f, 0.0f}; if (edit==0 || (pset->flag & PE_KEEP_LENGTHS)==0) return; @@ -1003,12 +1003,12 @@ static void pe_iterate_lengths(Scene *scene, PTCacheEdit *edit) if (pset->flag & PE_LOCK_FIRST) { key= point->keys + 1; k= 1; - dv1[0]= dv1[1]= dv1[2]= 0.0; + dv1[0] = dv1[1] = dv1[2] = 0.0; } else { key= point->keys; k= 0; - dv0[0]= dv0[1]= dv0[2]= 0.0; + dv0[0] = dv0[1] = dv0[2] = 0.0; } for (; k<point->totkey; k++, key++) { @@ -1527,8 +1527,8 @@ static int select_linked_exec(bContext *C, wmOperator *op) int location[2]; RNA_int_get_array(op->ptr, "location", location); - mval[0]= location[0]; - mval[1]= location[1]; + mval[0] = location[0]; + mval[1] = location[1]; PE_set_view3d_data(C, &data); data.mval= mval; @@ -1643,7 +1643,7 @@ int PE_lasso_select(bContext *C, const int mcords[][2], const short moves, short ParticleSystem *psys = edit->psys; ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys); POINT_P; KEY_K; - float co[3], mat[4][4]= MAT4_UNITY; + float co[3], mat[4][4] = MAT4_UNITY; int screen_co[2]; PEData data; @@ -2535,7 +2535,7 @@ static void toggle_particle_cursor(bContext *C, int enable) enum { DEL_PARTICLE, DEL_KEY }; -static EnumPropertyItem delete_type_items[]= { +static EnumPropertyItem delete_type_items[] = { {DEL_PARTICLE, "PARTICLE", 0, "Particle", ""}, {DEL_KEY, "KEY", 0, "Key", ""}, {0, NULL, 0, NULL, NULL}}; @@ -2691,10 +2691,10 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged) /* rotate weights according to vertex index rotation */ rotation= mirrorfaces[pa->num*2+1]; - newpa->fuv[0]= pa->fuv[2]; - newpa->fuv[1]= pa->fuv[1]; - newpa->fuv[2]= pa->fuv[0]; - newpa->fuv[3]= pa->fuv[3]; + newpa->fuv[0] = pa->fuv[2]; + newpa->fuv[1] = pa->fuv[1]; + newpa->fuv[2] = pa->fuv[0]; + newpa->fuv[3] = pa->fuv[3]; while (rotation-- > 0) if (me->mface[pa->num].v4) { SHIFT4(float, newpa->fuv[0], newpa->fuv[1], newpa->fuv[2], newpa->fuv[3]); @@ -3088,9 +3088,9 @@ static void intersect_dm_quad_weights(const float v1[3], const float v2[3], cons copy_v3_v3(vert[2], v3); copy_v3_v3(vert[3], v4); - co[0]= v1[0]*w[0] + v2[0]*w[1] + v3[0]*w[2] + v4[0]*w[3]; - co[1]= v1[1]*w[0] + v2[1]*w[1] + v3[1]*w[2] + v4[1]*w[3]; - co[2]= v1[2]*w[0] + v2[2]*w[1] + v3[2]*w[2] + v4[2]*w[3]; + co[0] = v1[0]*w[0] + v2[0]*w[1] + v3[0]*w[2] + v4[0]*w[3]; + co[1] = v1[1]*w[0] + v2[1]*w[1] + v3[1]*w[2] + v4[1]*w[3]; + co[2] = v1[2]*w[0] + v2[2]*w[1] + v3[2]*w[2] + v4[2]*w[3]; interp_weights_poly_v3(w, vert, 4, co); } @@ -3198,10 +3198,10 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, if (isect_line_tri_v3(co1, co2, v1, v2, v3, &cur_d, cur_uv)) { if (cur_d<*min_d) { *min_d=cur_d; - min_w[0]= 1.0f - cur_uv[0] - cur_uv[1]; - min_w[1]= cur_uv[0]; - min_w[2]= cur_uv[1]; - min_w[3]= 0.0f; + min_w[0] = 1.0f - cur_uv[0] - cur_uv[1]; + min_w[1] = cur_uv[0]; + min_w[2] = cur_uv[1]; + min_w[3] = 0.0f; if (mface->v4) intersect_dm_quad_weights(v1, v2, v3, v4, min_w); *min_face=i; @@ -3212,10 +3212,10 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, if (isect_line_tri_v3(co1, co2, v1, v3, v4, &cur_d, cur_uv)) { if (cur_d<*min_d) { *min_d=cur_d; - min_w[0]= 1.0f - cur_uv[0] - cur_uv[1]; - min_w[1]= 0.0f; - min_w[2]= cur_uv[0]; - min_w[3]= cur_uv[1]; + min_w[0] = 1.0f - cur_uv[0] - cur_uv[1]; + min_w[1] = 0.0f; + min_w[2] = cur_uv[0]; + min_w[3] = cur_uv[1]; intersect_dm_quad_weights(v1, v2, v3, v4, min_w); *min_face=i; intersect=1; @@ -3274,8 +3274,8 @@ static int brush_add(PEData *data, short number) } } - mco[0]= data->mval[0] + dmx; - mco[1]= data->mval[1] + dmy; + mco[0] = data->mval[0] + dmx; + mco[1] = data->mval[1] + dmy; ED_view3d_win_to_segment_clip(data->vc.ar, data->vc.v3d, mco, co1, co2); mul_m4_v3(imat, co1); @@ -3368,11 +3368,11 @@ static int brush_add(PEData *data, short number) maxd= ptn[maxw-1].dist; for (w=0; w<maxw; w++) { - weight[w]= (float)pow(2.0, (double)(-6.0f * ptn[w].dist / maxd)); + weight[w] = (float)pow(2.0, (double)(-6.0f * ptn[w].dist / maxd)); totw += weight[w]; } for (;w<3; w++) { - weight[w]= 0.0f; + weight[w] = 0.0f; } for (w=0; w<maxw; w++) @@ -3506,15 +3506,15 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) flip= RNA_boolean_get(itemptr, "pen_flip"); if (bedit->first) { - bedit->lastmouse[0]= mouse[0]; - bedit->lastmouse[1]= mouse[1]; + bedit->lastmouse[0] = mouse[0]; + bedit->lastmouse[1] = mouse[1]; } dx= mouse[0] - bedit->lastmouse[0]; dy= mouse[1] - bedit->lastmouse[1]; - mval[0]= mouse[0]; - mval[1]= mouse[1]; + mval[0] = mouse[0]; + mval[1] = mouse[1]; /* disable locking temporatily for disconnected hair */ @@ -3529,7 +3529,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) view3d_operator_needs_opengl(C); selected= (short)count_selected_keys(scene, edit); - dmax = maxf(fabsf(dx), fabsf(dy)); + dmax = max_ff(fabsf(dx), fabsf(dy)); tot_steps = dmax/(0.2f * brush->size) + 1; dx /= (float)tot_steps; @@ -3639,7 +3639,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) data.mval= mval; data.rad= (float)brush->size; - data.vec[0]= data.vec[1]= data.vec[2]= 0.0f; + data.vec[0] = data.vec[1] = data.vec[2] = 0.0f; data.tot= 0; data.smoothfac= brush->strength; @@ -3693,8 +3693,8 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); } - bedit->lastmouse[0]= mouse[0]; - bedit->lastmouse[1]= mouse[1]; + bedit->lastmouse[0] = mouse[0]; + bedit->lastmouse[1] = mouse[1]; bedit->first= 0; } @@ -4109,7 +4109,7 @@ int PE_minmax(Scene *scene, float min[3], float max[3]) LOOP_SELECTED_KEYS { copy_v3_v3(co, key->co); mul_m4_v3(mat, co); - DO_MINMAX(co, min, max); + DO_MINMAX(co, min, max); ok= 1; } } diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index a17d84af128..221aad2161c 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -110,11 +110,14 @@ static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op)) /* possible this isn't the active object * object_remove_particle_system() clears the mode on the last psys - * */ - if (mode_orig & OB_MODE_PARTICLE_EDIT) - if ((ob->mode & OB_MODE_PARTICLE_EDIT)==0) - if (scene->basact && scene->basact->object==ob) + */ + if (mode_orig & OB_MODE_PARTICLE_EDIT) { + if ((ob->mode & OB_MODE_PARTICLE_EDIT) == 0) { + if (scene->basact && scene->basact->object == ob) { WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL); + } + } + } WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob); WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob); diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 315386a947e..4a313079ad0 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -196,10 +196,10 @@ static void fluidsimPrintChannel(FILE *file, float *channel, int paramsize, char int i, j; int channelSize = paramsize; - if (entries==3) { + if (entries == 3) { elbeemSimplifyChannelVec3(channel, &channelSize); } - else if (entries==1) { + else if (entries == 1) { elbeemSimplifyChannelFloat(channel, &channelSize); } else { @@ -211,10 +211,10 @@ static void fluidsimPrintChannel(FILE *file, float *channel, int paramsize, char fprintf(file, " "); for (j=0;j <= entries;j++) { // also print time value fprintf(file, " %f ", channel[i*(entries + 1) + j]); - if (j==entries-1) { fprintf(file, " "); } - } + if (j == entries-1) { fprintf(file, " "); } + } fprintf(file, "\n"); - } + } fprintf(file, " ;\n"); } @@ -402,7 +402,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid } /* now we loop over the frames and fill the allocated channels with data */ - for (i=0; i<channels->length; i++) { + for (i=0; i < channels->length; i++) { FluidObject *fobj; float viscosity, gravity[3]; float timeAtFrame, time; @@ -527,7 +527,7 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length) if ( ELEM(fsmesh.type, OB_FLUIDSIM_FLUID, OB_FLUIDSIM_INFLOW)) { fsmesh.channelInitialVel = fobj->InitialVelocity; fsmesh.localInivelCoords = ((fluidmd->fss->typeFlags & OB_FSINFLOW_LOCALCOORD)?1:0); - } + } if (fluidmd->fss->typeFlags & OB_FSBND_NOSLIP) fsmesh.obstacleType = FLUIDSIM_OBSTACLE_NOSLIP; @@ -593,7 +593,7 @@ static int fluid_validate_scene(ReportList *reports, Scene *scene, Object *fsDom for (base=scene->base.first; base; base= base->next) { Object *ob = base->object; - FluidsimModifierData *fluidmdtmp = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim); + FluidsimModifierData *fluidmdtmp = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim); /* only find objects with fluid modifiers */ if (!fluidmdtmp || ob->type != OB_MESH) continue; @@ -627,7 +627,7 @@ static int fluid_validate_scene(ReportList *reports, Scene *scene, Object *fsDom return 0; } - if (channelObjCount>=255) { + if (channelObjCount >= 255) { BKE_report(reports, RPT_ERROR, "Cannot bake with more then 256 objects"); return 0; } @@ -648,7 +648,7 @@ static int fluid_validate_scene(ReportList *reports, Scene *scene, Object *fsDom static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetFile, char *debugStrBuffer) { FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(fsDomain, eModifierType_Fluidsim); - FluidsimSettings *domainSettings= fluidmd->fss; + FluidsimSettings *domainSettings= fluidmd->fss; FILE *fileCfg; int dirExist = 0; char newSurfdataPath[FILE_MAX]; /* modified output settings */ @@ -673,7 +673,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF // check selected directory // simply try to open cfg file for writing to test validity of settings fileCfg = BLI_fopen(targetFile, "w"); - if (fileCfg) { + if (fileCfg) { dirExist = 1; fclose(fileCfg); // remove cfg dummy from directory test BLI_delete(targetFile, 0, 0); @@ -902,7 +902,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor /* make sure it corresponds to startFrame setting (old: noFrames = scene->r.efra - scene->r.sfra +1) */; noFrames = scene->r.efra - 0; if (noFrames<=0) { - BKE_report(reports, RPT_ERROR, "No frames to export - check your animation range settings"); + BKE_report(reports, RPT_ERROR, "No frames to export (check your animation range settings)"); fluidbake_free_data(channels, fobjects, fsset, fb); return 0; } @@ -1050,7 +1050,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor fsset->generateVertexVectors = (domainSettings->domainNovecgen==0); // init blender domain transform matrix - { int j; + { int j; for (i=0; i<4; i++) { for (j=0; j<4; j++) { fsset->surfaceTrafo[i*4+j] = invDomMat[j][i]; diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c index 89ddfe02208..fb99d296a54 100644 --- a/source/blender/editors/physics/physics_ops.c +++ b/source/blender/editors/physics/physics_ops.c @@ -61,7 +61,7 @@ static void operatortypes_particle(void) WM_operatortype_append(PARTICLE_OT_rekey); WM_operatortype_append(PARTICLE_OT_subdivide); WM_operatortype_append(PARTICLE_OT_remove_doubles); - WM_operatortype_append(PARTICLE_OT_weight_set); + WM_operatortype_append(PARTICLE_OT_weight_set); WM_operatortype_append(PARTICLE_OT_delete); WM_operatortype_append(PARTICLE_OT_mirror); diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index b61280f14ce..ad9b082d044 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -83,7 +83,7 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat /* if renrect argument, we only refresh scanlines */ if (renrect) { - /* if ymax==recty, rendering of layer is ready, we should not draw, other things happen... */ + /* if (ymax == recty), rendering of layer is ready, we should not draw, other things happen... */ if (rr->renlay == NULL || renrect->ymax >= rr->recty) return; @@ -202,7 +202,7 @@ static int screen_render_exec(bContext *C, wmOperator *op) screen_render_scene_layer_set(op, mainp, &scene, &srl); if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) { - BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected"); + BKE_report(op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected"); return OPERATOR_CANCELLED; } @@ -493,9 +493,9 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event) } if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) { - BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected"); + BKE_report(op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected"); return OPERATOR_CANCELLED; - } + } /* stop all running jobs, currently previews frustrate Render */ WM_jobs_stop_all(CTX_wm_manager(C)); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 1d0e5bb6d44..0b6b5cb8e4a 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -171,11 +171,13 @@ static void screen_opengl_render_apply(OGLRender *oglrender) } } else if (view_context) { + ED_view3d_draw_offscreen_init(scene, v3d); + GPU_offscreen_bind(oglrender->ofs); /* bind */ /* render 3d view */ if (rv3d->persp == RV3D_CAMOB && v3d->camera) { - /*int is_ortho= scene->r.mode & R_ORTHO;*/ + /*int is_ortho = scene->r.mode & R_ORTHO;*/ camera = v3d->camera; RE_GetCameraWindow(oglrender->re, camera, scene->r.cfra, winmat); @@ -189,7 +191,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender) else perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend); } - if ((scene->r.mode & R_OSA) == 0) { + if ((scene->r.mode & R_OSA) == 0) { ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat, TRUE, FALSE); GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, rr->rectf); } @@ -306,7 +308,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) char err_out[256] = "unknown"; if (G.background) { - BKE_report(op->reports, RPT_ERROR, "Can't use OpenGL render in background mode (no opengl context)"); + BKE_report(op->reports, RPT_ERROR, "Cannot use OpenGL render in background mode (no opengl context)"); return 0; } @@ -327,7 +329,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) } if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) { - BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected"); + BKE_report(op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected"); return 0; } @@ -716,7 +718,7 @@ static int screen_opengl_render_exec(bContext *C, wmOperator *op) } } - // no redraw needed, we leave state as we entered it + /* no redraw needed, we leave state as we entered it */ // ED_update_for_newframe(C, 1); WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, CTX_data_scene(C)); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 694d2302fbd..a2f31b35246 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -341,7 +341,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre if (sp->pr_method == PR_ICON_RENDER) { if (mat->material_type == MA_TYPE_HALO) { sce->lay = 1 << MA_FLAT; - } + } else { sce->lay = 1 << MA_SPHERE_A; } @@ -368,7 +368,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre if (OB_TYPE_SUPPORT_MATERIAL(base->object->type)) { /* don't use assign_material, it changed mat->id.us, which shows in the UI */ Material ***matar = give_matarar(base->object); - int actcol = MAX2(base->object->actcol - 1, 0); + int actcol = max_ii(base->object->actcol - 1, 0); if (matar && actcol < base->object->totcol) (*matar)[actcol] = mat; @@ -386,7 +386,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre tex = localize_texture(origtex); sp->texcopy = tex; BLI_addtail(&pr_main->tex, tex); - } + } sce->lay = 1 << MA_TEXTURE; for (base = sce->base.first; base; base = base->next) { @@ -518,8 +518,8 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int if (ABS(rres.rectx - newx) < 2 && ABS(rres.recty - newy) < 2) { - newrect->xmax = MAX2(newrect->xmax, rect->xmin + rres.rectx + offx); - newrect->ymax = MAX2(newrect->ymax, rect->ymin + rres.recty); + newrect->xmax = max_ii(newrect->xmax, rect->xmin + rres.rectx + offx); + newrect->ymax = max_ii(newrect->ymax, rect->ymin + rres.recty); if (rres.rectx && rres.recty) { /* temporary conversion to byte for drawing */ @@ -597,7 +597,7 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r if (ok == 0) { ED_preview_shader_job(C, sa, id, parent, slot, newx, newy, PR_BUTS_RENDER); } - } + } } /* **************************** new shader preview system ****************** */ @@ -649,7 +649,7 @@ static void shader_preview_updatejob(void *spv) if (sp->lampcopy && la->nodetree && sp->lampcopy->nodetree) ntreeLocalSync(sp->lampcopy->nodetree, la->nodetree); } - } + } } } @@ -861,7 +861,7 @@ static void icon_copy_rect(ImBuf *ibuf, unsigned int w, unsigned int h, unsigned scaledx = (float)w; scaledy = ( (float)ima->y / (float)ima->x) * (float)w; } - else { + else { scaledx = ( (float)ima->x / (float)ima->y) * (float)h; scaledy = (float)h; } diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index 5b1c03f65df..c5320fde0ff 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -82,7 +82,7 @@ void ED_render_scene_update(Main *bmain, Scene *scene, int updated) return; /* don't call this recursively for frame updates */ - if(recursive_check) + if (recursive_check) return; recursive_check = TRUE; diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c index 01c0169eb50..5ec7f4d05b6 100644 --- a/source/blender/editors/render/render_view.c +++ b/source/blender/editors/render/render_view.c @@ -220,7 +220,6 @@ void render_view_open(bContext *C, int mx, int my) else { /* Leave it alone so the image editor will just go back from * full screen to the original tiled setup */ - ; } } } @@ -282,7 +281,7 @@ static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent if (wincur->screen->temp) { wm_window_lower(wincur); } - else { + else { wmWindow *win, *winshow; ScrArea *sa = find_area_showing_r_result(C, &winshow); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index ad9b0f61eb1..f30e0abb4f3 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -390,7 +390,7 @@ void ED_area_overdraw(bContext *C) az->do_draw = FALSE; } } - } + } glDisable(GL_BLEND); } @@ -465,11 +465,11 @@ void ED_region_do_draw(bContext *C, ARegion *ar) if (ar->drawrct.xmin == ar->drawrct.xmax) ar->drawrct = winrct; else { - /* extra clip for safety */ - ar->drawrct.xmin = MAX2(winrct.xmin, ar->drawrct.xmin); - ar->drawrct.ymin = MAX2(winrct.ymin, ar->drawrct.ymin); - ar->drawrct.xmax = MIN2(winrct.xmax, ar->drawrct.xmax); - ar->drawrct.ymax = MIN2(winrct.ymax, ar->drawrct.ymax); + /* extra clip for safety (intersect the rects, could use API func) */ + ar->drawrct.xmin = max_ii(winrct.xmin, ar->drawrct.xmin); + ar->drawrct.ymin = max_ii(winrct.ymin, ar->drawrct.ymin); + ar->drawrct.xmax = min_ii(winrct.xmax, ar->drawrct.xmax); + ar->drawrct.ymax = min_ii(winrct.ymax, ar->drawrct.ymax); } /* note; this sets state, so we can use wmOrtho and friends */ @@ -533,10 +533,7 @@ void ED_region_tag_redraw_partial(ARegion *ar, rcti *rct) } else if (ar->drawrct.xmin != ar->drawrct.xmax) { /* partial redraw already set, expand region */ - ar->drawrct.xmin = MIN2(ar->drawrct.xmin, rct->xmin); - ar->drawrct.ymin = MIN2(ar->drawrct.ymin, rct->ymin); - ar->drawrct.xmax = MAX2(ar->drawrct.xmax, rct->xmax); - ar->drawrct.ymax = MAX2(ar->drawrct.ymax, rct->ymax); + BLI_rcti_union(&ar->drawrct, rct); } } } @@ -1260,19 +1257,15 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa) } else { /* prevent uiblocks to run */ - uiFreeBlocks(NULL, &ar->uiblocks); + uiFreeBlocks(NULL, &ar->uiblocks); } - - /* rechecks 2d matrix for header on dpi changing, do not do for other regions, it resets view && blocks view2d operator polls (ton) */ - if (ar->regiontype == RGN_TYPE_HEADER) - ar->v2d.flag &= ~V2D_IS_INITIALISED; } } /* externally called for floating regions like menus */ void ED_region_init(bContext *C, ARegion *ar) { -// ARegionType *at= ar->type; +// ARegionType *at = ar->type; /* refresh can be called before window opened */ region_subwindow(CTX_wm_window(C), ar); @@ -1414,7 +1407,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type) /* put in front of list */ BLI_remlink(&sa->spacedata, sl); BLI_addhead(&sa->spacedata, sl); - } + } else { /* new space */ if (st) { @@ -1457,7 +1450,8 @@ void ED_area_prevspace(bContext *C, ScrArea *sa) ED_area_newspace(C, sa, sl->next->spacetype); } else { - ED_area_newspace(C, sa, SPACE_INFO); + /* no change */ + return; } ED_area_tag_redraw(sa); @@ -1670,11 +1664,9 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * v2d->scroll |= V2D_SCROLL_HORIZONTAL_HIDE; v2d->scroll &= ~V2D_SCROLL_VERTICAL_HIDE; - /* don't jump back when panels close or hide */ - if (!newcontext) - y = MAX2(-y, -v2d->cur.ymin); - else - y = -y; + /* ensure tot is set correctly, to keep views on bottons, with sliders */ + y = min_ii(y, v2d->cur.ymin); + y = -y; } else { /* for now, allow scrolling in both directions (since layouts are optimized for vertical, @@ -1688,7 +1680,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * /* don't jump back when panels close or hide */ if (!newcontext) - x = MAX2(x, v2d->cur.xmax); + x = max_ii(x, v2d->cur.xmax); y = -y; } @@ -1741,7 +1733,7 @@ void ED_region_header(const bContext *C, ARegion *ar) int maxco, xco, yco; int headery = ED_area_headersize(); - /* clear */ + /* clear */ UI_ThemeClearColor((ED_screen_area_active(C)) ? TH_HEADER : TH_HEADERDESEL); glClear(GL_COLOR_BUFFER_BIT); @@ -1778,7 +1770,7 @@ void ED_region_header(const bContext *C, ARegion *ar) } /* always as last */ - UI_view2d_totRect_set(&ar->v2d, maxco + UI_UNIT_X + 80, BLI_rctf_size_y(&ar->v2d.tot)); + UI_view2d_totRect_set(&ar->v2d, maxco + UI_UNIT_X + 80, headery); /* restore view matrix? */ UI_view2d_view_restore(C); diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 24053d76672..ce2d045dc80 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -600,8 +600,8 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo /* The maximum pixel amounts the image can be cropped * at the lower left without exceeding the origin. */ - int off_x = floor(MAX2(ix, 0)); - int off_y = floor(MAX2(iy, 0)); + int off_x = floor(max_ff(ix, 0.0f)); + int off_y = floor(max_ff(iy, 0.0f)); /* The zoomed space coordinate of the raster position * (starting at the lower left most unclipped pixel). @@ -625,8 +625,8 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo * covers the entire screen). */ glGetFloatv(GL_SCISSOR_BOX, scissor); - draw_w = mini(img_w - off_x, ceil((scissor[2] - rast_x) / xzoom)); - draw_h = mini(img_h - off_y, ceil((scissor[3] - rast_y) / yzoom)); + draw_w = min_ii(img_w - off_x, ceil((scissor[2] - rast_x) / xzoom)); + draw_h = min_ii(img_h - off_y, ceil((scissor[3] - rast_y) / yzoom)); if (draw_w > 0 && draw_h > 0) { int old_row_length = glaGetOneInteger(GL_UNPACK_ROW_LENGTH); diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 352039c5a61..a516603cfd4 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -194,7 +194,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone); } } - } + } CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); return 1; } @@ -236,7 +236,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone); } } - } + } CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); return 1; } diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 2e1723027b8..60aad14efcf 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -36,6 +36,7 @@ #include "DNA_scene_types.h" #include "DNA_userdef_types.h" +#include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" @@ -271,7 +272,7 @@ ScrEdge *screen_find_active_scredge(bScreen *sc, int mx, int my) if (abs(my - se->v1->vec.y) <= 2 && mx >= min && mx <= max) return se; - } + } else { short min, max; min = MIN2(se->v1->vec.y, se->v2->vec.y); @@ -631,10 +632,8 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey) max[0] = max[1] = 0.0f; for (sv = sc->vertbase.first; sv; sv = sv->next) { - min[0] = MIN2(min[0], sv->vec.x); - min[1] = MIN2(min[1], sv->vec.y); - max[0] = MAX2(max[0], sv->vec.x); - max[1] = MAX2(max[1], sv->vec.y); + const float fv[2] = {(float)sv->vec.x, (float)sv->vec.y}; + minmax_v2v2_v2(min, max, fv); } /* always make 0.0 left under */ @@ -875,7 +874,7 @@ static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir)) glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA); glEnable(GL_BLEND); /* value 181 was hardly computed: 181~105 */ - glColor4ub(255, 255, 255, 50); + glColor4ub(255, 255, 255, 50); /* draw_join_shape(sa, dir); */ glRecti(sa->v1->vec.x, sa->v1->vec.y, sa->v3->vec.x, sa->v3->vec.y); glDisable(GL_BLEND); @@ -1066,7 +1065,7 @@ static void screen_refresh_headersizes(void) for (st = lb->first; st; st = st->next) { ARegionType *art = BKE_regiontype_from_id(st, RGN_TYPE_HEADER); if (art) art->prefsizey = ED_area_headersize(); - } + } } /* make this screen usable */ @@ -1320,7 +1319,7 @@ int ED_screen_area_active(const bContext *C) for (ar = sa->regionbase.first; ar; ar = ar->next) if (ar->swinid == sc->subwinactive) return 1; - } + } return 0; } @@ -1453,10 +1452,10 @@ void ED_screen_set_scene(bContext *C, bScreen *screen, Scene *scene) if (scene != sc->scene) { /* all areas endlocalview */ - // XXX ScrArea *sa= sc->areabase.first; + // XXX ScrArea *sa = sc->areabase.first; // while (sa) { // endlocalview(sa); - // sa= sa->next; + // sa = sa->next; // } sc->scene = scene; } @@ -1733,7 +1732,7 @@ void ED_refresh_viewport_fps(bContext *C) fpsi->redrawtime = fpsi->lredrawtime; fpsi->lredrawtime = animtimer->ltime; } - else { + else { /* playback stopped or shouldn't be running */ if (scene->fps_info) MEM_freeN(scene->fps_info); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 5eac841dec6..bd171ef247a 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -192,7 +192,7 @@ int ED_operator_region_view3d_active(bContext *C) return TRUE; CTX_wm_operator_poll_msg_set(C, "expected a view3d region"); - return FALSE; + return FALSE; } /* generic for any view2d which uses anim_ops */ @@ -256,7 +256,7 @@ int ED_operator_node_active(bContext *C) return 0; } -// XXX rename +/* XXX rename */ int ED_operator_graphedit_active(bContext *C) { return ed_spacetype_test(C, SPACE_IPO); @@ -580,7 +580,7 @@ static int actionzone_area_poll(bContext *C) for (az = sa->actionzones.first; az; az = az->next) if (BLI_rcti_isect_pt(&az->rect, x, y)) return 1; - } + } return 0; } @@ -628,6 +628,7 @@ static void actionzone_apply(bContext *C, wmOperator *op, int type) event.type = EVT_ACTIONZONE_AREA; else event.type = EVT_ACTIONZONE_REGION; + event.val = 0; event.customdata = op->customdata; event.customdatafree = TRUE; op->customdata = NULL; @@ -701,7 +702,7 @@ static int actionzone_modal(bContext *C, wmOperator *op, wmEvent *event) case ESCKEY: actionzone_exit(op); return OPERATOR_CANCELLED; - case LEFTMOUSE: + case LEFTMOUSE: actionzone_exit(op); return OPERATOR_CANCELLED; @@ -969,18 +970,18 @@ static void area_move_set_limits(bScreen *sc, int dir, int *bigger, int *smaller /* if top or down edge selected, test height */ if (sa->v1->flag && sa->v4->flag) - *bigger = MIN2(*bigger, y1); + *bigger = min_ii(*bigger, y1); else if (sa->v2->flag && sa->v3->flag) - *smaller = MIN2(*smaller, y1); + *smaller = min_ii(*smaller, y1); } else { int x1 = sa->v4->vec.x - sa->v1->vec.x - AREAMINX; /* if left or right edge selected, test width */ if (sa->v1->flag && sa->v2->flag) - *bigger = MIN2(*bigger, x1); + *bigger = min_ii(*bigger, x1); else if (sa->v3->flag && sa->v4->flag) - *smaller = MIN2(*smaller, x1); + *smaller = min_ii(*smaller, x1); } } } @@ -1341,7 +1342,7 @@ static int area_split_apply(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); return 1; - } + } return 0; } @@ -1691,7 +1692,7 @@ static int region_scale_invoke(bContext *C, wmOperator *op, wmEvent *event) AZone *az; if (event->type != EVT_ACTIONZONE_REGION) { - BKE_report(op->reports, RPT_ERROR, "Can only scale region size from an action zone"); + BKE_report(op->reports, RPT_ERROR, "Can only scale region size from an action zone"); return OPERATOR_CANCELLED; } @@ -1855,7 +1856,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event) break; case ESCKEY: - ; + break; } return OPERATOR_RUNNING_MODAL; @@ -2071,15 +2072,23 @@ static void SCREEN_OT_keyframe_jump(wmOperatorType *ot) /* ************** switch screen operator ***************************** */ +static int screen_set_is_ok(bScreen *screen, bScreen *screen_prev) +{ + return ((screen->winid == 0) && + (screen->full == 0) && + (screen != screen_prev) && + (screen->id.name[2] != '.' || !(U.uiflag & USER_HIDE_DOT))); +} /* function to be called outside UI context, or for redo */ static int screen_set_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); bScreen *screen = CTX_wm_screen(C); bScreen *screen_prev = screen; ScrArea *sa = CTX_wm_area(C); - int tot = BLI_countlist(&CTX_data_main(C)->screen); + int tot = BLI_countlist(&bmain->screen); int delta = RNA_int_get(op->ptr, "delta"); /* temp screens are for userpref or render display */ @@ -2089,17 +2098,19 @@ static int screen_set_exec(bContext *C, wmOperator *op) if (delta == 1) { while (tot--) { screen = screen->id.next; - if (screen == NULL) screen = CTX_data_main(C)->screen.first; - if (screen->winid == 0 && screen->full == 0 && screen != screen_prev) + if (screen == NULL) screen = bmain->screen.first; + if (screen_set_is_ok(screen, screen_prev)) { break; + } } } else if (delta == -1) { while (tot--) { screen = screen->id.prev; - if (screen == NULL) screen = CTX_data_main(C)->screen.last; - if (screen->winid == 0 && screen->full == 0 && screen != screen_prev) + if (screen == NULL) screen = bmain->screen.last; + if (screen_set_is_ok(screen, screen_prev)) { break; + } } } else { @@ -2359,14 +2370,14 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event) ScrArea *sa = screen_areahascursor(sc, event->x, event->y); int dir; - if (sa) { + if (sa) { if (jd->sa1 != sa) { dir = area_getorientation(jd->sa1, sa); if (dir >= 0) { if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO; jd->sa2 = sa; jd->sa2->flag |= AREA_FLAG_DRAWJOINTO; - } + } else { /* we are not bordering on the previously selected area * we check if area has common border with the one marked for removal @@ -2380,14 +2391,14 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event) jd->sa2 = sa; if (jd->sa1) jd->sa1->flag |= AREA_FLAG_DRAWJOINFROM; if (jd->sa2) jd->sa2->flag |= AREA_FLAG_DRAWJOINTO; - } + } else { if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO; jd->sa2 = NULL; } } WM_event_add_notifier(C, NC_WINDOW, NULL); - } + } else { /* we are back in the area previously selected for keeping * we swap the areas if possible to allow user to choose */ @@ -2402,7 +2413,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event) if (dir < 0) { printf("oops, didn't expect that!\n"); } - } + } else { dir = area_getorientation(jd->sa1, sa); if (dir >= 0) { @@ -2837,7 +2848,7 @@ static int header_flip_exec(bContext *C, wmOperator *UNUSED(op)) /* don't do anything if no region */ if (ar == NULL) return OPERATOR_CANCELLED; - } + } /* copied from SCREEN_OT_region_flip */ if (ar->alignment == RGN_ALIGN_TOP) @@ -2871,6 +2882,38 @@ static void SCREEN_OT_header_flip(wmOperatorType *ot) ot->flag = 0; } + + +/* ************** show menus operator ***************************** */ + +/* show/hide header text menus */ +static int header_toggle_menus_exec(bContext *C, wmOperator *UNUSED(op)) +{ + ScrArea *sa = CTX_wm_area(C); + + sa->flag = sa->flag ^ HEADER_NO_PULLDOWN; + + ED_area_tag_redraw(CTX_wm_area(C)); + WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); + + return OPERATOR_FINISHED; +} + + +static void SCREEN_OT_header_toggle_menus(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Show/Hide Header Menus"; + ot->idname = "SCREEN_OT_header_toggle_menus"; + ot->description = "Show or hide the header pulldown menus"; + + /* api callbacks */ + ot->exec = header_toggle_menus_exec; + ot->poll = ED_operator_areaactive; + ot->flag = 0; +} + + /* ************** header tools operator ***************************** */ void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg)) { @@ -2883,6 +2926,11 @@ void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UN else uiItemO(layout, IFACE_("Flip to Top"), ICON_NONE, "SCREEN_OT_header_flip"); + if (sa->flag & HEADER_NO_PULLDOWN) + uiItemO(layout, IFACE_("Show Menus"), ICON_NONE, "SCREEN_OT_header_toggle_menus"); + else + uiItemO(layout, IFACE_("Hide Menus"), ICON_NONE, "SCREEN_OT_header_toggle_menus"); + uiItemS(layout); /* file browser should be fullscreen all the time, but other regions can be maximized/restored... */ @@ -3035,7 +3083,11 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e } else { if (sync) { - int step = floor((wt->duration - sad->last_duration) * FPS); + /* note: this is very simplistic, + * its has problem that it may skip too many frames. + * however at least this gives a less jittery playback */ + const int step = max_ii(1, floor((wt->duration - sad->last_duration) * FPS)); + /* skip frames */ if (sad->flag & ANIMPLAY_FLAG_REVERSE) scene->r.cfra -= step; @@ -3125,7 +3177,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e /* recalculate the timestep for the timer now that we've finished calculating this, * since the frames-per-second value may have been changed */ - // TODO: this may make evaluation a bit slower if the value doesn't change... any way to avoid this? + /* TODO: this may make evaluation a bit slower if the value doesn't change... any way to avoid this? */ wt->timestep = (1.0 / FPS); return OPERATOR_FINISHED; @@ -3175,7 +3227,7 @@ int ED_screen_animation_play(bContext *C, int sync, int mode) else { int refresh = SPACE_TIME; /* these settings are currently only available from a menu in the TimeLine */ - if (mode == 1) // XXX only play audio forwards!? + if (mode == 1) /* XXX only play audio forwards!? */ sound_play_scene(scene); ED_screen_animation_timer(C, screen->redraws_flag, refresh, sync, mode); @@ -3427,7 +3479,7 @@ static int screen_delete_exec(bContext *C, wmOperator *UNUSED(op)) static void SCREEN_OT_delete(wmOperatorType *ot) { /* identifiers */ - ot->name = "Delete Screen"; //was scene + ot->name = "Delete Screen"; /* was scene */ ot->description = "Delete active screen"; ot->idname = "SCREEN_OT_delete"; @@ -3547,6 +3599,7 @@ void ED_operatortypes_screen(void) WM_operatortype_append(SCREEN_OT_region_scale); WM_operatortype_append(SCREEN_OT_region_flip); WM_operatortype_append(SCREEN_OT_header_flip); + WM_operatortype_append(SCREEN_OT_header_toggle_menus); WM_operatortype_append(SCREEN_OT_header_toolbox); WM_operatortype_append(SCREEN_OT_screen_set); WM_operatortype_append(SCREEN_OT_screen_full_area); @@ -3574,7 +3627,7 @@ void ED_operatortypes_screen(void) /* tools shared by more space types */ WM_operatortype_append(ED_OT_undo); WM_operatortype_append(ED_OT_undo_push); - WM_operatortype_append(ED_OT_redo); + WM_operatortype_append(ED_OT_redo); WM_operatortype_append(ED_OT_undo_history); } @@ -3744,7 +3797,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SCREEN_OT_animation_cancel", MEDIASTOP, KM_PRESS, 0, 0); /* Alternative keys for animation and sequencer playing */ -#if 0 // XXX: disabled for restoring later... bad implementation +#if 0 /* XXX: disabled for restoring later... bad implementation */ keymap = WM_keymap_find(keyconf, "Frames", 0, 0); kmi = WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0); RNA_boolean_set(kmi->ptr, "cycle_speed", TRUE); diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index aeae79aa9d0..0ecac5fc497 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -214,7 +214,7 @@ static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event) WM_event_add_fileselect(C, op); return OPERATOR_RUNNING_MODAL; - } + } return OPERATOR_CANCELLED; } @@ -365,7 +365,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float if (ok == 0) { printf("Write error: cannot save %s\n", name); - BKE_reportf(&sj->reports, RPT_INFO, "Write error: cannot save %s\n", name); + BKE_reportf(&sj->reports, RPT_INFO, "Write error: cannot save %s", name); break; } else { @@ -374,7 +374,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float } /* imbuf knows which rects are not part of ibuf */ - IMB_freeImBuf(ibuf); + IMB_freeImBuf(ibuf); } MEM_freeN(sj->dumprect); @@ -408,7 +408,7 @@ static int screencast_exec(bContext *C, wmOperator *op) sj->y = 0; sj->dumpsx = win->sizex; sj->dumpsy = win->sizey; - } + } else { ScrArea *curarea = CTX_wm_area(C); sj->x = curarea->totrct.xmin; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 34ff5efacc9..91a0a3821c9 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -113,26 +113,26 @@ #define IMAPAINT_CHAR_TO_FLOAT(c) ((c) / 255.0f) #define IMAPAINT_FLOAT_RGB_TO_CHAR(c, f) { \ - (c)[0]= FTOCHAR((f)[0]); \ - (c)[1]= FTOCHAR((f)[1]); \ - (c)[2]= FTOCHAR((f)[2]); \ + (c)[0] = FTOCHAR((f)[0]); \ + (c)[1] = FTOCHAR((f)[1]); \ + (c)[2] = FTOCHAR((f)[2]); \ } (void)0 #define IMAPAINT_FLOAT_RGBA_TO_CHAR(c, f) { \ - (c)[0]= FTOCHAR((f)[0]); \ - (c)[1]= FTOCHAR((f)[1]); \ - (c)[2]= FTOCHAR((f)[2]); \ - (c)[3]= FTOCHAR((f)[3]); \ + (c)[0] = FTOCHAR((f)[0]); \ + (c)[1] = FTOCHAR((f)[1]); \ + (c)[2] = FTOCHAR((f)[2]); \ + (c)[3] = FTOCHAR((f)[3]); \ } (void)0 #define IMAPAINT_CHAR_RGB_TO_FLOAT(f, c) { \ - (f)[0]= IMAPAINT_CHAR_TO_FLOAT((c)[0]); \ - (f)[1]= IMAPAINT_CHAR_TO_FLOAT((c)[1]); \ - (f)[2]= IMAPAINT_CHAR_TO_FLOAT((c)[2]); \ + (f)[0] = IMAPAINT_CHAR_TO_FLOAT((c)[0]); \ + (f)[1] = IMAPAINT_CHAR_TO_FLOAT((c)[1]); \ + (f)[2] = IMAPAINT_CHAR_TO_FLOAT((c)[2]); \ } (void)0 #define IMAPAINT_CHAR_RGBA_TO_FLOAT(f, c) { \ - (f)[0]= IMAPAINT_CHAR_TO_FLOAT((c)[0]); \ - (f)[1]= IMAPAINT_CHAR_TO_FLOAT((c)[1]); \ - (f)[2]= IMAPAINT_CHAR_TO_FLOAT((c)[2]); \ - (f)[3]= IMAPAINT_CHAR_TO_FLOAT((c)[3]); \ + (f)[0] = IMAPAINT_CHAR_TO_FLOAT((c)[0]); \ + (f)[1] = IMAPAINT_CHAR_TO_FLOAT((c)[1]); \ + (f)[2] = IMAPAINT_CHAR_TO_FLOAT((c)[2]); \ + (f)[3] = IMAPAINT_CHAR_TO_FLOAT((c)[3]); \ } (void)0 #define IMAPAINT_FLOAT_RGB_COPY(a, b) copy_v3_v3(a, b) @@ -173,7 +173,7 @@ typedef struct ImagePaintState { } ImagePaintState; typedef struct ImagePaintPartialRedraw { - int x1, y1, x2, y2; + int x1, y1, x2, y2; /* XXX, could use 'rcti' */ int enabled; } ImagePaintPartialRedraw; @@ -783,7 +783,7 @@ static int project_paint_PickColor(const ProjPaintState *ps, float pt[2], float else { //xi = (int)((uv[0]*ibuf->x) + 0.5f); //yi = (int)((uv[1]*ibuf->y) + 0.5f); - //if (xi<0 || xi>=ibuf->x || yi<0 || yi>=ibuf->y) return 0; + //if (xi < 0 || xi >= ibuf->x || yi < 0 || yi >= ibuf->y) return 0; /* wrap */ xi = ((int)(uv[0] * ibuf->x)) % ibuf->x; @@ -903,7 +903,7 @@ static int project_bucket_point_occluded(const ProjPaintState *ps, LinkNode *buc else isect_ret = project_paint_occlude_ptv(pixelScreenCo, ps->screenCoords[mf->v1], ps->screenCoords[mf->v2], ps->screenCoords[mf->v3], w, ps->is_ortho); - /* Note, if isect_ret==-1 then we don't want to test the other side of the quad */ + /* Note, if (isect_ret == -1) then we don't want to test the other side of the quad */ if (isect_ret == 0 && mf->v4) { if (do_clip) isect_ret = project_paint_occlude_ptv_clip(ps, mf, pixelScreenCo, ps->screenCoords[mf->v1], ps->screenCoords[mf->v3], ps->screenCoords[mf->v4], 1); @@ -942,7 +942,7 @@ static int line_isect_y(const float p1[2], const float p2[2], const float y_leve if (y_diff < 0.000001f) { *x_isect = (p1[0] + p2[0]) * 0.5f; - return ISECT_TRUE; + return ISECT_TRUE; } if (p1[1] > y_level && p2[1] < y_level) { @@ -975,7 +975,7 @@ static int line_isect_x(const float p1[2], const float p2[2], const float x_leve if (x_diff < 0.000001f) { /* yuck, vertical line, we cant do much here */ *y_isect = (p1[0] + p2[0]) * 0.5f; - return ISECT_TRUE; + return ISECT_TRUE; } if (p1[0] > x_level && p2[0] < x_level) { @@ -1003,7 +1003,7 @@ static int cmp_uv(const float vec2a[2], const float vec2b[2]) float ya = (float)fmodf(vec2a[1], 1.0f); float xb = (float)fmodf(vec2b[0], 1.0f); - float yb = (float)fmodf(vec2b[1], 1.0f); + float yb = (float)fmodf(vec2b[1], 1.0f); if (xa < 0.0f) xa += 1.0f; if (ya < 0.0f) ya += 1.0f; @@ -1860,7 +1860,7 @@ static int project_bucket_isect_circle(const float cent[2], const float radius_s /* lower left out of radius test */ if (cent[1] < bucket_bounds->ymin) { return (len_squared_v2v2_alt(cent, bucket_bounds->xmin, bucket_bounds->ymin) < radius_squared) ? 1 : 0; - } + } /* top left test */ else if (cent[1] > bucket_bounds->ymax) { return (len_squared_v2v2_alt(cent, bucket_bounds->xmin, bucket_bounds->ymax) < radius_squared) ? 1 : 0; @@ -1870,7 +1870,7 @@ static int project_bucket_isect_circle(const float cent[2], const float radius_s /* lower right out of radius test */ if (cent[1] < bucket_bounds->ymin) { return (len_squared_v2v2_alt(cent, bucket_bounds->xmax, bucket_bounds->ymin) < radius_squared) ? 1 : 0; - } + } /* top right test */ else if (cent[1] > bucket_bounds->ymax) { return (len_squared_v2v2_alt(cent, bucket_bounds->xmax, bucket_bounds->ymax) < radius_squared) ? 1 : 0; @@ -2111,7 +2111,7 @@ static void project_bucket_clip_face( if ((inside_bucket_flag & ISECT_2) == 0) { copy_v2_v2(isectVCosSS[*tot], v1_clipSS); (*tot)++; } if ((inside_bucket_flag & ISECT_3) == 0) { copy_v2_v2(isectVCosSS[*tot], v2_clipSS); (*tot)++; } } - } + } if ((inside_bucket_flag & (ISECT_3 | ISECT_1)) != (ISECT_3 | ISECT_1)) { if (line_clip_rect2f(bucket_bounds, v3coSS, v1coSS, v1_clipSS, v2_clipSS)) { @@ -2394,7 +2394,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i tf_uv_pxoffset[1][1] = tf->uv[1][1] - yhalfpx; tf_uv_pxoffset[2][0] = tf->uv[2][0] - xhalfpx; - tf_uv_pxoffset[2][1] = tf->uv[2][1] - yhalfpx; + tf_uv_pxoffset[2][1] = tf->uv[2][1] - yhalfpx; if (mf->v4) { vCo[3] = ps->dm_mvert[mf->v4].co; @@ -3432,7 +3432,7 @@ static void project_paint_begin_clone(ProjPaintState *ps, int mouse[2]) mul_m4_v4(ps->projectMat, projCo); ps->cloneOffset[0] = mouse[0] - ((float)(ps->winx / 2.0f) + (ps->winx / 2.0f) * projCo[0] / projCo[3]); ps->cloneOffset[1] = mouse[1] - ((float)(ps->winy / 2.0f) + (ps->winy / 2.0f) * projCo[1] / projCo[3]); - } + } } static void project_paint_end(ProjPaintState *ps) @@ -3561,7 +3561,7 @@ static void project_paint_end(ProjPaintState *ps) ps->dm->release(ps->dm); } -/* 1= an undo, -1 is a redo. */ +/* 1 = an undo, -1 is a redo. */ static void partial_redraw_array_init(ImagePaintPartialRedraw *pr) { int tot = PROJ_BOUNDBOX_SQUARED; @@ -3583,11 +3583,11 @@ static int partial_redraw_array_merge(ImagePaintPartialRedraw *pr, ImagePaintPar { int touch = 0; while (tot--) { - pr->x1 = MIN2(pr->x1, pr_other->x1); - pr->y1 = MIN2(pr->y1, pr_other->y1); + pr->x1 = min_ii(pr->x1, pr_other->x1); + pr->y1 = min_ii(pr->y1, pr_other->y1); - pr->x2 = MAX2(pr->x2, pr_other->x2); - pr->y2 = MAX2(pr->y2, pr_other->y2); + pr->x2 = max_ii(pr->x2, pr_other->x2); + pr->y2 = max_ii(pr->y2, pr_other->y2); if (pr->x2 != -1) touch = 1; @@ -4032,11 +4032,11 @@ static void *do_projectpaint_thread(void *ph_v) /* end copy */ last_partial_redraw_cell = last_projIma->partRedrawRect + projPixel->bb_cell_index; - last_partial_redraw_cell->x1 = MIN2(last_partial_redraw_cell->x1, projPixel->x_px); - last_partial_redraw_cell->y1 = MIN2(last_partial_redraw_cell->y1, projPixel->y_px); + last_partial_redraw_cell->x1 = min_ii(last_partial_redraw_cell->x1, (int)projPixel->x_px); + last_partial_redraw_cell->y1 = min_ii(last_partial_redraw_cell->y1, (int)projPixel->y_px); - last_partial_redraw_cell->x2 = MAX2(last_partial_redraw_cell->x2, projPixel->x_px + 1); - last_partial_redraw_cell->y2 = MAX2(last_partial_redraw_cell->y2, projPixel->y_px + 1); + last_partial_redraw_cell->x2 = max_ii(last_partial_redraw_cell->x2, (int)projPixel->x_px + 1); + last_partial_redraw_cell->y2 = max_ii(last_partial_redraw_cell->y2, (int)projPixel->y_px + 1); switch (tool) { @@ -4100,7 +4100,7 @@ static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), const float lastp { /* First unpack args from the struct */ ProjPaintState *ps = (ProjPaintState *)state; - int touch_any = 0; + int touch_any = 0; ProjectHandle handles[BLENDER_MAX_THREADS]; ListBase threads; @@ -4133,7 +4133,7 @@ static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), const float lastp /* image bounds */ for (i = 0; i < ps->image_tot; i++) { handles[a].projImages[i].partRedrawRect = (ImagePaintPartialRedraw *)BLI_memarena_alloc(ps->arena_mt[a], sizeof(ImagePaintPartialRedraw) * PROJ_BOUNDBOX_SQUARED); - memcpy(handles[a].projImages[i].partRedrawRect, ps->projImages[i].partRedrawRect, sizeof(ImagePaintPartialRedraw) * PROJ_BOUNDBOX_SQUARED); + memcpy(handles[a].projImages[i].partRedrawRect, ps->projImages[i].partRedrawRect, sizeof(ImagePaintPartialRedraw) * PROJ_BOUNDBOX_SQUARED); } if (ps->thread_tot > 1) @@ -4222,10 +4222,10 @@ static void imapaint_dirty_region(Image *ima, ImBuf *ibuf, int x, int y, int w, imapaintpartial.enabled = 1; } else { - imapaintpartial.x1 = MIN2(imapaintpartial.x1, x); - imapaintpartial.y1 = MIN2(imapaintpartial.y1, y); - imapaintpartial.x2 = MAX2(imapaintpartial.x2, x + w); - imapaintpartial.y2 = MAX2(imapaintpartial.y2, y + h); + imapaintpartial.x1 = min_ii(imapaintpartial.x1, x); + imapaintpartial.y1 = min_ii(imapaintpartial.y1, y); + imapaintpartial.x2 = max_ii(imapaintpartial.x2, x + w); + imapaintpartial.y2 = max_ii(imapaintpartial.y2, y + h); } w = ((x + w - 1) >> IMAPAINT_TILE_BITS); @@ -4554,7 +4554,7 @@ static int imapaint_canvas_set(ImagePaintState *s, Image *ima) else if (ima->packedfile && ima->rr) { s->warnpackedfile = ima->id.name + 2; return 0; - } + } else if (ibuf && ibuf->channels != 4) { s->warnmultifile = ima->id.name + 2; return 0; @@ -5048,7 +5048,7 @@ static void paint_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) pop->prevmouse[1] = mouse[1]; } - else { + else { redraw = imapaint_paint_stroke(&pop->vc, &pop->s, pop->painter, pop->mode == PAINT_MODE_3D, pop->prevmouse, mouse, time, pressure); pop->prevmouse[0] = mouse[0]; pop->prevmouse[1] = mouse[1]; @@ -5066,7 +5066,7 @@ static void paint_brush_exit_tex(Brush *brush) MTex *mtex = &brush->mtex; if (mtex->tex && mtex->tex->nodetree) ntreeTexEndExecTree(mtex->tex->nodetree->execdata, 1); - } + } } static void paint_exit(bContext *C, wmOperator *op) @@ -5285,7 +5285,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata) #define PX_SIZE_FADE_MIN 4.0f Scene *scene = CTX_data_scene(C); - //Brush *brush= image_paint_brush(C); + //Brush *brush = image_paint_brush(C); Paint *paint = paint_get_active_from_context(C); Brush *brush = paint_brush(paint); @@ -5302,7 +5302,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata) !(ts->use_uv_sculpt && (scene->basact->object->mode == OB_MODE_EDIT)); if (use_zoom) { - pixel_size = size * maxf(zoomx, zoomy); + pixel_size = size * max_ff(zoomx, zoomy); } else { pixel_size = size; @@ -5654,7 +5654,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; if (BKE_object_obdata_is_libdata(ob)) { - BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata"); + BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 39a95300d5d..40dcb92f087 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -93,7 +93,7 @@ static int brush_scale_size_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); Paint *paint = paint_get_active_from_context(C); struct Brush *brush = paint_brush(paint); - // Object *ob= CTX_data_active_object(C); + // Object *ob = CTX_data_active_object(C); float scalar = RNA_float_get(op->ptr, "scalar"); if (brush) { diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 2ae24db7c33..6396a0c2cbc 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -255,7 +255,7 @@ static int paint_space_stroke(bContext *C, wmOperator *op, wmEvent *event, const if (pressure > FLT_EPSILON) { /* brushes can have a minimum size of 1.0 but with pressure it can be smaller then a pixel * causing very high step sizes, hanging blender [#32381] */ - const float size_clamp = maxf(1.0f, BKE_brush_size_get(scene, stroke->brush) * pressure); + const float size_clamp = max_ff(1.0f, BKE_brush_size_get(scene, stroke->brush) * pressure); scale = (size_clamp * stroke->brush->spacing / 50.0f) / length; if (scale > FLT_EPSILON) { mul_v2_fl(vec, scale); @@ -406,10 +406,10 @@ int paint_stroke_modal(bContext *C, wmOperator *op, wmEvent *event) paint_stroke_add_sample(p, stroke, event->x, event->y); paint_stroke_sample_average(stroke, &sample_average); - // let NDOF motion pass through to the 3D view so we can paint and rotate simultaneously! - // this isn't perfect... even when an extra MOUSEMOVE is spoofed, the stroke discards it - // since the 2D deltas are zero -- code in this file needs to be updated to use the - // post-NDOF_MOTION MOUSEMOVE + /* let NDOF motion pass through to the 3D view so we can paint and rotate simultaneously! + * this isn't perfect... even when an extra MOUSEMOVE is spoofed, the stroke discards it + * since the 2D deltas are zero -- code in this file needs to be updated to use the + * post-NDOF_MOTION MOUSEMOVE */ if (event->type == NDOF_MOTION) return OPERATOR_PASS_THROUGH; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index bb931dd1ff2..b8ac88f4d65 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -326,7 +326,7 @@ static void make_vertexcol(Object *ob) /* single ob */ CustomData_add_layer(&me->fdata, CD_MCOL, CD_DEFAULT, NULL, me->totface); } if (!me->mloopcol) { - CustomData_add_layer(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop); + CustomData_add_layer(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop); } mesh_update_customdata_pointers(me, TRUE); } @@ -1526,7 +1526,7 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv, if (total_changed > 1 && do_multipaint) { float undo_change = get_mp_change(ndv, defbase_tot, defbase_sel, left_over); multipaint_selection(ndv, defbase_tot, undo_change, defbase_sel); - } + } /* or designatedw is still -1 put weight back as evenly as possible */ else { redistribute_change(ndv, defbase_tot, change_status, 2, -2, left_over, total_changed, do_auto_normalize); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 092ec32e724..38dbdcd8337 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3076,6 +3076,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, MultiresModifierData *mmd = sculpt_multires_active(scene, ob); ss->modifiers_active = sculpt_modifiers_active(scene, sd, ob); + ss->show_diffuse_color = sd->flags & SCULPT_SHOW_DIFFUSE; if (need_mask) { if (mmd == NULL) { @@ -3130,6 +3131,8 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, ss->pbvh = dm->getPBVH(ob, dm); ss->pmap = (need_pmap && dm->getPolyMap) ? dm->getPolyMap(ob, dm) : NULL; + pbvh_show_diffuse_color_set(ss->pbvh, ss->show_diffuse_color); + if (ss->modifiers_active) { if (!ss->orig_cos) { int a; @@ -3513,7 +3516,7 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush) if (tool == SCULPT_TOOL_GRAB) copy_v3_v3(sd->anchored_location, cache->true_location); else if (tool == SCULPT_TOOL_THUMB) - copy_v3_v3(sd->anchored_location, cache->orig_grab_location); + copy_v3_v3(sd->anchored_location, cache->orig_grab_location); if (ELEM(tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_THUMB)) { /* location stays the same for finding vertices in brush radius */ @@ -4151,7 +4154,7 @@ int ED_sculpt_mask_layers_ensure(Object *ob, MultiresModifierData *mmd) * isn't one already */ if (mmd && !CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK)) { GridPaintMask *gmask; - int level = MAX2(1, mmd->sculptlvl); + int level = max_ii(1, mmd->sculptlvl); int gridsize = ccg_gridsize(level); int gridarea = gridsize * gridsize; int i, j; diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index b204fc75255..1b3fd24ae22 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -99,7 +99,7 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; MVert *mvert; - int *index, i, j; + int *index, i, j; if (unode->maxvert) { /* regular mesh restore */ @@ -224,7 +224,7 @@ static int sculpt_undo_restore_mask(bContext *C, DerivedMesh *dm, SculptUndoNode SculptSession *ss = ob->sculpt; MVert *mvert; float *vmask; - int *index, i, j; + int *index, i, j; if (unode->maxvert) { /* regular mesh restore */ diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 10adeb3e721..9bd7d2a44ca 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -98,7 +98,7 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) /* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */ UI_view2d_sync(NULL, ac->sa, v2d, V2D_LOCK_COPY); - /* loop through channels, and set up drawing depending on their type */ + /* loop through channels, and set up drawing depending on their type */ { /* first pass: just the standard GL-drawing for backdrop + text */ y = (float)ACHANNEL_FIRST; @@ -189,7 +189,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) /* if in NLA there's a strip active, map the view */ if (ac->datatype == ANIMCONT_ACTION) { - /* adt= ANIM_nla_mapping_get(ac, NULL); */ /* UNUSED */ + /* adt = ANIM_nla_mapping_get(ac, NULL); */ /* UNUSED */ /* start and end of action itself */ calc_action_range(ac->data, &act_start, &act_end, 0); @@ -307,7 +307,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) /* Increment the step */ y -= ACHANNEL_STEP; - } + } glDisable(GL_BLEND); /* Draw keyframes diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index eeb297b7f57..ae78b71f2ad 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -132,7 +132,7 @@ void ACTION_OT_new(wmOperatorType *ot) /* api callbacks */ ot->exec = act_new_exec; - // NOTE: this is used in the NLA too... + /* NOTE: this is used in the NLA too... */ //ot->poll = ED_operator_action_active; /* flags */ @@ -234,8 +234,8 @@ static void get_keyframe_extents(bAnimContext *ac, float *min, float *max, const int filter; /* get data to filter, from Action or Dopesheet */ - // XXX: what is sel doing here?! - // Commented it, was breaking things (eg. the "auto preview range" tool). + /* XXX: what is sel doing here?! + * Commented it, was breaking things (eg. the "auto preview range" tool). */ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_SEL *//*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); @@ -254,8 +254,9 @@ static void get_keyframe_extents(bAnimContext *ac, float *min, float *max, const /* find gp-frame which is less than or equal to cframe */ for (gpf = gpl->frames.first; gpf; gpf = gpf->next) { - *min = MIN2(*min, gpf->framenum); - *max = MAX2(*max, gpf->framenum); + const float framenum = (float)gpf->framenum; + *min = min_ff(*min, framenum); + *max = max_ff(*max, framenum); } } else if (ale->datatype == ALE_MASKLAY) { @@ -267,8 +268,9 @@ static void get_keyframe_extents(bAnimContext *ac, float *min, float *max, const masklay_shape; masklay_shape = masklay_shape->next) { - *min = MIN2(*min, masklay_shape->frame); - *max = MAX2(*max, masklay_shape->frame); + const float framenum = (float)masklay_shape->frame; + *min = min_ff(*min, framenum); + *max = max_ff(*max, framenum); } } else { @@ -284,8 +286,8 @@ static void get_keyframe_extents(bAnimContext *ac, float *min, float *max, const } /* try to set cur using these values, if they're more extreme than previously set values */ - *min = MIN2(*min, tmin); - *max = MAX2(*max, tmax); + *min = min_ff(*min, tmin); + *max = max_ff(*max, tmax); } } @@ -493,7 +495,7 @@ static int actkeys_copy_exec(bContext *C, wmOperator *op) /* copy keyframes */ if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) { /* FIXME... */ - BKE_report(op->reports, RPT_ERROR, "Keyframe pasting is not available for Grease Pencil mode"); + BKE_report(op->reports, RPT_ERROR, "Keyframe pasting is not available for grease pencil mode"); return OPERATOR_CANCELLED; } else if (ac.datatype == ANIMCONT_MASK) { @@ -502,7 +504,7 @@ static int actkeys_copy_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } else { - if (copy_action_keys(&ac)) { + if (copy_action_keys(&ac)) { BKE_report(op->reports, RPT_ERROR, "No keyframes copied to keyframes copy/paste buffer"); return OPERATOR_CANCELLED; } @@ -542,8 +544,8 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op) /* paste keyframes */ if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) { - // FIXME... - BKE_report(op->reports, RPT_ERROR, "Keyframe pasting is not available for Grease Pencil or Mask mode"); + /* FIXME... */ + BKE_report(op->reports, RPT_ERROR, "Keyframe pasting is not available for grease pencil or mask mode"); return OPERATOR_CANCELLED; } else { @@ -588,7 +590,7 @@ void ACTION_OT_paste(wmOperatorType *ot) static EnumPropertyItem prop_actkeys_insertkey_types[] = { {1, "ALL", 0, "All Channels", ""}, {2, "SEL", 0, "Only Selected Channels", ""}, - {3, "GROUP", 0, "In Active Group", ""}, // xxx not in all cases + {3, "GROUP", 0, "In Active Group", ""}, /* XXX not in all cases */ {0, NULL, 0, NULL, NULL} }; @@ -1010,7 +1012,7 @@ static void setexpo_action_keys(bAnimContext *ac, short mode) if (mode == MAKE_CYCLIC_EXPO) { /* only add if one doesn't exist */ if (list_has_suitable_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES, -1) == 0) { - // TODO: add some more preset versions which set different extrapolation options? + /* TODO: add some more preset versions which set different extrapolation options? */ add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES); } } @@ -1319,7 +1321,7 @@ static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op)) if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - /* init edit data */ + /* init edit data */ /* loop over action data, averaging values */ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); @@ -1369,13 +1371,13 @@ void ACTION_OT_frame_jump(wmOperatorType *ot) /* defines for snap keyframes tool */ static EnumPropertyItem prop_actkeys_snap_types[] = { - {ACTKEYS_SNAP_CFRA, "CFRA", 0, "Current frame", + {ACTKEYS_SNAP_CFRA, "CFRA", 0, "Current frame", "Snap selected keyframes to the current frame"}, - {ACTKEYS_SNAP_NEAREST_FRAME, "NEAREST_FRAME", 0, "Nearest Frame", + {ACTKEYS_SNAP_NEAREST_FRAME, "NEAREST_FRAME", 0, "Nearest Frame", "Snap selected keyframes to the nearest (whole) frame (use to fix accidental sub-frame offsets)"}, - {ACTKEYS_SNAP_NEAREST_SECOND, "NEAREST_SECOND", 0, "Nearest Second", + {ACTKEYS_SNAP_NEAREST_SECOND, "NEAREST_SECOND", 0, "Nearest Second", "Snap selected keyframes to the nearest second"}, - {ACTKEYS_SNAP_NEAREST_MARKER, "NEAREST_MARKER", 0, "Nearest Marker", + {ACTKEYS_SNAP_NEAREST_MARKER, "NEAREST_MARKER", 0, "Nearest Marker", "Snap selected keyframes to the nearest marker"}, {0, NULL, 0, NULL, NULL} }; @@ -1435,7 +1437,7 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op) if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - // XXX... + /* XXX... */ if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) return OPERATOR_PASS_THROUGH; @@ -1477,11 +1479,11 @@ void ACTION_OT_snap(wmOperatorType *ot) /* defines for mirror keyframes tool */ static EnumPropertyItem prop_actkeys_mirror_types[] = { - {ACTKEYS_MIRROR_CFRA, "CFRA", 0, "By Times over Current frame", + {ACTKEYS_MIRROR_CFRA, "CFRA", 0, "By Times over Current frame", "Flip times of selected keyframes using the current frame as the mirror line"}, - {ACTKEYS_MIRROR_XAXIS, "XAXIS", 0, "By Values over Value=0", + {ACTKEYS_MIRROR_XAXIS, "XAXIS", 0, "By Values over Value=0", "Flip values of selected keyframes (i.e. negative values become positive, and vice versa)"}, - {ACTKEYS_MIRROR_MARKER, "MARKER", 0, "By Times over First Selected Marker", + {ACTKEYS_MIRROR_MARKER, "MARKER", 0, "By Times over First Selected Marker", "Flip times of selected keyframes using the first selected marker as the reference point"}, {0, NULL, 0, NULL, NULL} }; @@ -1502,7 +1504,7 @@ static void mirror_action_keys(bAnimContext *ac, short mode) ked.scene = ac->scene; /* for 'first selected marker' mode, need to find first selected marker first! */ - // XXX should this be made into a helper func in the API? + /* XXX should this be made into a helper func in the API? */ if (mode == ACTKEYS_MIRROR_MARKER) { TimeMarker *marker = ED_markers_get_first_selected(ac->markers); @@ -1548,7 +1550,7 @@ static int actkeys_mirror_exec(bContext *C, wmOperator *op) if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - // XXX... + /* XXX... */ if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) return OPERATOR_PASS_THROUGH; diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h index c684ae1de51..10085d8a149 100644 --- a/source/blender/editors/space_action/action_intern.h +++ b/source/blender/editors/space_action/action_intern.h @@ -111,7 +111,7 @@ enum { ACTKEYS_SNAP_CFRA = 1, ACTKEYS_SNAP_NEAREST_FRAME, ACTKEYS_SNAP_NEAREST_SECOND, - ACTKEYS_SNAP_NEAREST_MARKER, + ACTKEYS_SNAP_NEAREST_MARKER, } eActKeys_Snap_Mode; /* defines for mirror keyframes @@ -121,7 +121,7 @@ enum { ACTKEYS_MIRROR_CFRA = 1, ACTKEYS_MIRROR_YAXIS, ACTKEYS_MIRROR_XAXIS, - ACTKEYS_MIRROR_MARKER, + ACTKEYS_MIRROR_MARKER, } eActKeys_Mirror_Mode; /* ***************************************** */ diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 5da348b2a84..d0f76c21019 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -763,7 +763,7 @@ static void actkeys_select_leftright(bAnimContext *ac, short leftright, short se if (leftright == ACTKEYS_LRSEL_LEFT) { ked.f1 = MINAFRAMEF; ked.f2 = (float)(CFRA + 0.1f); - } + } else { ked.f1 = (float)(CFRA - 0.1f); ked.f2 = MAXFRAMEF; @@ -785,7 +785,7 @@ static void actkeys_select_leftright(bAnimContext *ac, short leftright, short se ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } - else if (ale->type == ANIMTYPE_GPLAYER) + else if (ale->type == ANIMTYPE_GPLAYER) ED_gplayer_frames_select_border(ale->data, ked.f1, ked.f2, select_mode); else if (ale->type == ANIMTYPE_MASKLAYER) ED_masklayer_frames_select_border(ale->data, ked.f1, ked.f2, select_mode); @@ -869,7 +869,7 @@ static int actkeys_select_leftright_invoke(bContext *C, wmOperator *op, wmEvent UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL); if (x < CFRA) RNA_enum_set(op->ptr, "mode", ACTKEYS_LRSEL_LEFT); - else + else RNA_enum_set(op->ptr, "mode", ACTKEYS_LRSEL_RIGHT); } @@ -1081,7 +1081,7 @@ static void mouse_action_keys(bAnimContext *ac, const int mval[2], short select_ /* dopesheet summary covers everything */ summary_to_keylist(ac, &anim_keys, NULL); } - else if (ale->type == ANIMTYPE_GROUP) { + else if (ale->type == ANIMTYPE_GROUP) { // TODO: why don't we just give groups key_data too? bActionGroup *agrp = (bActionGroup *)ale->data; agroup_to_keylist(adt, agrp, &anim_keys, NULL); @@ -1144,7 +1144,7 @@ static void mouse_action_keys(bAnimContext *ac, const int mval[2], short select_ agrp->flag |= AGRP_SELECTED; ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, agrp, ANIMTYPE_GROUP); - } + } else if (ale->type == ANIMTYPE_FCURVE) { FCurve *fcu = ale->data; @@ -1210,7 +1210,7 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even return OPERATOR_CANCELLED; /* get useful pointers from animation context data */ - /* ar= ac.ar; */ /* UNUSED */ + /* ar = ac.ar; */ /* UNUSED */ /* select mode is either replace (deselect all, then add) or add/extend */ if (RNA_boolean_get(op->ptr, "extend")) diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 2e92b1eea6f..c5f3ccee101 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -129,7 +129,7 @@ static SpaceLink *action_new(const bContext *C) /* not spacelink itself */ static void action_free(SpaceLink *UNUSED(sl)) { -// SpaceAction *saction= (SpaceAction *) sl; +// SpaceAction *saction = (SpaceAction *) sl; } @@ -377,7 +377,7 @@ static void action_listener(ScrArea *sa, wmNotifier *wmn) ED_area_tag_refresh(sa); break; case NC_SCENE: - switch (wmn->data) { + switch (wmn->data) { case ND_OB_ACTIVE: /* selection changed, so force refresh to flush (needs flag set to do syncing) */ case ND_OB_SELECT: saction->flag |= SACTION_TEMP_NEEDCHANSYNC; @@ -433,7 +433,7 @@ static void action_listener(ScrArea *sa, wmNotifier *wmn) saction->flag |= SACTION_TEMP_NEEDCHANSYNC; ED_area_tag_refresh(sa); break; - } + } break; case NC_WINDOW: if (saction->flag & SACTION_TEMP_NEEDCHANSYNC) { diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index 2cbcbcdbc9a..35344f2c5a4 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -193,7 +193,7 @@ void ED_spacetypes_keymap(wmKeyConfig *keyconf) typedef struct RegionDrawCB { struct RegionDrawCB *next, *prev; - void (*draw)(const struct bContext *, struct ARegion *, void *); + void (*draw)(const struct bContext *, struct ARegion *, void *); void *customdata; int type; @@ -239,7 +239,7 @@ void ED_region_draw_cb_draw(const bContext *C, ARegion *ar, int type) for (rdc = ar->type->drawcalls.first; rdc; rdc = rdc->next) { if (rdc->type == type) rdc->draw(C, ar, rdc->customdata); - } + } } diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index e5f5a4beac6..24e9effa9eb 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -236,7 +236,7 @@ static int buttons_context_path_material(ButsContextPath *path, int for_texture) if (ma) { RNA_id_pointer_create(&ma->id, &path->ptr[path->len]); path->len++; - } + } return 1; } } @@ -890,7 +890,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r else CTX_data_pointer_set(result, NULL, &RNA_ParticleSystem, NULL); return 1; - } + } else if (CTX_data_equals(member, "particle_settings")) { /* only available when pinned */ PointerRNA *ptr = get_pointer_type(path, &RNA_ParticleSettings); diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 9a7284de660..d40426a5bc9 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -162,7 +162,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event) char *str; if (CTX_wm_space_file(C)) { - BKE_report(op->reports, RPT_ERROR, "Can't activate a file selector, one already open"); + BKE_report(op->reports, RPT_ERROR, "Cannot activate a file selector, one already open"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index a24a292be06..7d2374738ef 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -326,7 +326,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) /* currently works by redraws... if preview is set, it (re)starts job */ sbuts->preview = 1; break; - } + } break; case NC_WORLD: buttons_area_redraw(sa, BCONTEXT_WORLD); diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index d7936c1e2e8..fc9c040852f 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -716,7 +716,7 @@ static float get_shortest_pattern_side(MovieTrackingMarker *marker) cur_len = len_v2v2(marker->pattern_corners[i], marker->pattern_corners[next]); - len = minf(cur_len, len); + len = min_ff(cur_len, len); } return len; @@ -788,11 +788,11 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo dy = 6.0f / height / sc->zoom; side = get_shortest_pattern_side(marker); - patdx = minf(dx * 2.0f / 3.0f, side / 6.0f); - patdy = minf(dy * 2.0f / 3.0f, side * width / height / 6.0f); + patdx = min_ff(dx * 2.0f / 3.0f, side / 6.0f); + patdy = min_ff(dy * 2.0f / 3.0f, side * width / height / 6.0f); - searchdx = minf(dx, (marker->search_max[0] - marker->search_min[0]) / 6.0f); - searchdy = minf(dy, (marker->search_max[1] - marker->search_min[1]) / 6.0f); + searchdx = min_ff(dx, (marker->search_max[0] - marker->search_min[0]) / 6.0f); + searchdy = min_ff(dy, (marker->search_max[1] - marker->search_min[1]) / 6.0f); px[0] = 1.0f / sc->zoom / width / sc->scale; px[1] = 1.0f / sc->zoom / height / sc->scale; diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index b495ca32813..71589517c83 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -395,7 +395,7 @@ int ED_clip_view_selection(const bContext *C, ARegion *ar, int fit) zoomx = (float)width / w / aspx; zoomy = (float)height / h / aspy; - newzoom = 1.0f / power_of_2(1.0f / minf(zoomx, zoomy)); + newzoom = 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy)); if (fit || sc->zoom > newzoom) sc->zoom = newzoom; diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 37eb0bcb7c1..9ec2ad82bef 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -197,8 +197,8 @@ static int open_exec(bContext *C, wmOperator *op) if (op->customdata) MEM_freeN(op->customdata); - BKE_reportf(op->reports, RPT_ERROR, "Can't read \"%s\": %s", str, - errno ? strerror(errno) : TIP_("Unsupported movie clip format")); + BKE_reportf(op->reports, RPT_ERROR, "Cannot read '%s': %s", str, + errno ? strerror(errno) : TIP_("unsupported movie clip format")); return OPERATOR_CANCELLED; } @@ -747,7 +747,7 @@ static int view_all_exec(bContext *C, wmOperator *op) zoomx = (float) width / (w + 2 * margin); zoomy = (float) height / (h + 2 * margin); - sclip_zoom_set(C, minf(zoomx, zoomy), NULL); + sclip_zoom_set(C, min_ff(zoomx, zoomy), NULL); } else { if ((w >= width || h >= height) && (width > 0 && height > 0)) { @@ -755,7 +755,7 @@ static int view_all_exec(bContext *C, wmOperator *op) zoomy = (float) height / h; /* find the zoom value that will fit the image in the image space */ - sclip_zoom_set(C, 1.0f / power_of_2(1.0f / minf(zoomx, zoomy)), NULL); + sclip_zoom_set(C, 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy)), NULL); } else sclip_zoom_set(C, 1.0f, NULL); diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index c061125b4d5..f4ad5eee61e 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -372,8 +372,8 @@ static int mouse_on_slide_zone(SpaceClip *sc, MovieTrackingMarker *marker, dx = size / width / sc->zoom; dy = size / height / sc->zoom; - dx = minf(dx, (max[0] - min[0]) / 6.0f); - dy = minf(dy, (max[1] - min[1]) / 6.0f); + dx = min_ff(dx, (max[0] - min[0]) / 6.0f); + dy = min_ff(dy, (max[1] - min[1]) / 6.0f); return IN_RANGE_INCL(co[0], slide_zone[0] - dx, slide_zone[0] + dx) && IN_RANGE_INCL(co[1], slide_zone[1] - dy, slide_zone[1] + dy); @@ -424,14 +424,14 @@ static int get_mouse_pattern_corner(SpaceClip *sc, MovieTrackingMarker *marker, cur_len = len_v2v2(marker->pattern_corners[i], marker->pattern_corners[next]); - len = minf(cur_len, len); + len = min_ff(cur_len, len); } dx = 12.0f / width / sc->zoom; dy = 12.0f / height / sc->zoom; - dx = minf(dx, len * 2.0f / 3.0f); - dy = minf(dy, len * width / height * 2.0f / 3.0f); + dx = min_ff(dx, len * 2.0f / 3.0f); + dy = min_ff(dy, len * width / height * 2.0f / 3.0f); for (i = 0; i < 4; i++) { float crn[2]; @@ -462,8 +462,8 @@ static int mouse_on_offset(SpaceClip *sc, MovieTrackingTrack *track, MovieTracki dx = 12.0f / width / sc->zoom; dy = 12.0f / height / sc->zoom; - dx = minf(dx, (pat_max[0] - pat_min[0]) / 2.0f); - dy = minf(dy, (pat_max[1] - pat_min[1]) / 2.0f); + dx = min_ff(dx, (pat_max[0] - pat_min[0]) / 2.0f); + dy = min_ff(dy, (pat_max[1] - pat_min[1]) / 2.0f); return co[0] >= pos[0] - dx && co[0] <= pos[0] + dx && co[1] >= pos[1] - dy && co[1] <= pos[1] + dy; } @@ -1018,7 +1018,7 @@ static void track_init_markers(SpaceClip *sc, MovieClip *clip, int *frames_limit if (frames_limit == 0) frames_limit = track->frames_limit; else - frames_limit = MIN2(frames_limit, track->frames_limit); + frames_limit = min_ii(frames_limit, (int)track->frames_limit); } } } @@ -1396,9 +1396,8 @@ static void solve_camera_freejob(void *scv) } solved = BKE_tracking_reconstruction_finish(scj->context, tracking); - if (!solved) - BKE_report(scj->reports, RPT_WARNING, "Some data failed to reconstruct, see console for details"); + BKE_report(scj->reports, RPT_WARNING, "Some data failed to reconstruct (see console for details)"); else BKE_reportf(scj->reports, RPT_INFO, "Average re-projection error: %.3f", tracking->reconstruction.error); @@ -1410,7 +1409,7 @@ static void solve_camera_freejob(void *scv) id_us_plus(&clip->id); /* set blender camera focal length so result would look fine there */ - if (scene->camera) { + if (scene->camera && GS(scene->camera->id.name) == ID_CA) { Camera *camera = (Camera *)scene->camera->data; int width, height; @@ -3372,7 +3371,7 @@ static int tracking_object_remove_exec(bContext *C, wmOperator *op) object = BKE_tracking_object_get_active(tracking); if (object->flag & TRACKING_OBJECT_CAMERA) { - BKE_report(op->reports, RPT_WARNING, "Object used for camera tracking can't be deleted"); + BKE_report(op->reports, RPT_WARNING, "Object used for camera tracking cannot be deleted"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c index feb523237ba..b8e162bfb17 100644 --- a/source/blender/editors/space_clip/tracking_select.c +++ b/source/blender/editors/space_clip/tracking_select.c @@ -107,7 +107,7 @@ static int mouse_on_crns(float co[2], float pos[2], float crns[4][2], float epsx { float dist = dist_to_crns(co, pos, crns); - return dist < maxf(epsx, epsy); + return dist < max_ff(epsx, epsy); } static int track_mouse_area(const bContext *C, float co[2], MovieTrackingTrack *track) @@ -128,8 +128,8 @@ static int track_mouse_area(const bContext *C, float co[2], MovieTrackingTrack * epsy = MIN4(pat_min[1] - marker->search_min[1], marker->search_max[1] - pat_max[1], fabsf(pat_min[1]), fabsf(pat_max[1])) / 2; - epsx = maxf(epsx, 2.0f / width); - epsy = maxf(epsy, 2.0f / height); + epsx = max_ff(epsx, 2.0f / width); + epsy = max_ff(epsy, 2.0f / height); if (sc->flag & SC_SHOW_MARKER_SEARCH) { if (mouse_on_rect(co, marker->pos, marker->search_min, marker->search_max, epsx, epsy)) diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index c4a5c2a0154..f19835b7f85 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -84,7 +84,7 @@ typedef struct ConsoleDrawContext { #if 0 /* used by textview, may use later */ int *xy; // [2] int *sel; // [2] - int *pos_pick; // bottom of view == 0, top of file == combine chars, end of line is lower then start. + int *pos_pick; /* bottom of view == 0, top of file == combine chars, end of line is lower then start. */ int *mval; // [2] int draw; #endif diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index ecd9e316cef..c2344cca557 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -39,6 +39,7 @@ #include "BLI_string.h" #include "BLI_dynstr.h" #include "BLI_utildefines.h" +#include "BLI_math.h" #include "BKE_context.h" #include "BKE_text.h" /* only for character utility funcs */ @@ -650,7 +651,7 @@ static int console_clear_exec(bContext *C, wmOperator *op) short scrollback = RNA_boolean_get(op->ptr, "scrollback"); short history = RNA_boolean_get(op->ptr, "history"); - /*ConsoleLine *ci= */ console_history_verify(C); + /*ConsoleLine *ci = */ console_history_verify(C); if (scrollback) { /* last item in mistory */ while (sc->scrollback.first) @@ -803,7 +804,7 @@ void CONSOLE_OT_history_append(wmOperatorType *ot) ot->poll = ED_operator_console_active; /* properties */ - RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position"); + RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position"); RNA_def_int(ot->srna, "current_character", 0, 0, INT_MAX, "Cursor", "The index of the cursor", 0, 10000); RNA_def_boolean(ot->srna, "remove_duplicates", 0, "Remove Duplicates", "Remove duplicate items in the history"); } @@ -904,8 +905,8 @@ static int console_copy_exec(bContext *C, wmOperator *UNUSED(op)) for (cl = sc->scrollback.first; cl; cl = cl->next) { if (sel[0] <= cl->len && sel[1] >= 0) { - int sta = MAX2(sel[0], 0); - int end = MIN2(sel[1], cl->len); + int sta = max_ii(sel[0], 0); + int end = min_ii(sel[1], cl->len); if (BLI_dynstr_get_len(buf_dyn)) BLI_dynstr_append(buf_dyn, "\n"); @@ -1050,7 +1051,7 @@ static void console_modal_select_apply(bContext *C, wmOperator *op, wmEvent *eve static void console_cursor_set_exit(bContext *UNUSED(C), wmOperator *op) { -// SpaceConsole *sc= CTX_wm_space_console(C); +// SpaceConsole *sc = CTX_wm_space_console(C); SetConsoleCursor *scu = op->customdata; #if 0 @@ -1067,7 +1068,7 @@ static void console_cursor_set_exit(bContext *UNUSED(C), wmOperator *op) static int console_modal_select_invoke(bContext *C, wmOperator *op, wmEvent *event) { SpaceConsole *sc = CTX_wm_space_console(C); -// ARegion *ar= CTX_wm_region(C); +// ARegion *ar = CTX_wm_region(C); SetConsoleCursor *scu; op->customdata = MEM_callocN(sizeof(SetConsoleCursor), "SetConsoleCursor"); diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index b7ef278275e..75add570708 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -91,7 +91,7 @@ static SpaceLink *console_new(const bContext *UNUSED(C)) ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f; /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */ - //ar->v2d.keepzoom= (V2D_KEEPASPECT|V2D_LIMITZOOM); + //ar->v2d.keepzoom = (V2D_KEEPASPECT|V2D_LIMITZOOM); return (SpaceLink *)sconsole; } @@ -162,7 +162,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar) static int id_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { -// SpaceConsole *sc= CTX_wm_space_console(C); +// SpaceConsole *sc = CTX_wm_space_console(C); if (drag->type == WM_DRAG_ID) return 1; return 0; @@ -184,7 +184,7 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop) static int path_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { -// SpaceConsole *sc= CTX_wm_space_console(C); + // SpaceConsole *sc = CTX_wm_space_console(C); if (drag->type == WM_DRAG_PATH) return 1; return 0; @@ -359,7 +359,7 @@ static void console_header_area_draw(const bContext *C, ARegion *ar) static void console_main_area_listener(ARegion *ar, wmNotifier *wmn) { - // SpaceInfo *sinfo= sa->spacedata.first; + // SpaceInfo *sinfo = sa->spacedata.first; /* context changes */ switch (wmn->category) { diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 55e75992b89..fb438ae45fb 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -257,21 +257,23 @@ static int get_file_icon(struct direntry *file) else if (file->flags & BLENDERFILE) return ICON_FILE_BLEND; else if (file->flags & BLENDERFILE_BACKUP) - return ICON_FILE_BLEND; + return ICON_FILE_BACKUP; else if (file->flags & IMAGEFILE) return ICON_FILE_IMAGE; else if (file->flags & MOVIEFILE) return ICON_FILE_MOVIE; else if (file->flags & PYSCRIPTFILE) return ICON_FILE_SCRIPT; - else if (file->flags & SOUNDFILE) + else if (file->flags & SOUNDFILE) return ICON_FILE_SOUND; - else if (file->flags & FTFONTFILE) + else if (file->flags & FTFONTFILE) return ICON_FILE_FONT; - else if (file->flags & BTXFILE) + else if (file->flags & BTXFILE) return ICON_FILE_BLANK; - else if (file->flags & COLLADAFILE) + else if (file->flags & COLLADAFILE) return ICON_FILE_BLANK; + else if (file->flags & TEXTFILE) + return ICON_FILE_TEXT; else return ICON_FILE_BLANK; } @@ -280,7 +282,7 @@ static void file_draw_icon(uiBlock *block, char *path, int sx, int sy, int icon, { uiBut *but; int x, y; - /*float alpha=1.0f;*/ + // float alpha = 1.0f; x = sx; y = sy - height; @@ -494,7 +496,7 @@ void file_draw_list(const bContext *C, ARegion *ar) sx += (int)(v2d->tot.xmin + 2.0f); sy = (int)(v2d->tot.ymax - sy); - file = filelist_file(files, i); + file = filelist_file(files, i); UI_ThemeColor4(TH_TEXT); @@ -544,7 +546,7 @@ void file_draw_list(const bContext *C, ARegion *ar) if (params->display == FILE_SHORTDISPLAY) { sx += (int)layout->column_widths[COLUMN_NAME] + 12; if (!(file->type & S_IFDIR)) { - file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align); + file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align); sx += (int)layout->column_widths[COLUMN_SIZE] + 12; } } diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 7a364eb8685..763b18788de 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -554,7 +554,7 @@ int file_highlight_set(SpaceFile *sfile, ARegion *ar, int mx, int my) { View2D *v2d = &ar->v2d; FileSelectParams *params; - int numfiles, origfile; + int numfiles, origfile; if (sfile == NULL || sfile->files == NULL) return 0; @@ -849,7 +849,7 @@ int file_parent_exec(bContext *C, wmOperator *UNUSED(unused)) file_change_dir(C, 0); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL); } - } + } return OPERATOR_FINISHED; @@ -942,7 +942,7 @@ int file_next_exec(bContext *C, wmOperator *UNUSED(unused)) folderlist_pushdir(sfile->folders_prev, sfile->params->dir); file_change_dir(C, 1); - } + } WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL); return OPERATOR_FINISHED; @@ -1105,7 +1105,7 @@ int file_directory_new_exec(bContext *C, wmOperator *op) if (generate_name) { /* create a new, non-existing folder name */ if (!new_folder_path(sfile->params->dir, path, name)) { - BKE_report(op->reports, RPT_ERROR, "Couldn't create new folder name"); + BKE_report(op->reports, RPT_ERROR, "Could not create new folder name"); return OPERATOR_CANCELLED; } } @@ -1114,9 +1114,9 @@ int file_directory_new_exec(bContext *C, wmOperator *op) BLI_dir_create_recursive(path); if (!BLI_exists(path)) { - BKE_report(op->reports, RPT_ERROR, "Couldn't create new folder"); + BKE_report(op->reports, RPT_ERROR, "Could not create new folder"); return OPERATOR_CANCELLED; - } + } /* now remember file to jump into editing */ BLI_strncpy(sfile->params->renamefile, name, FILE_MAXFILE); @@ -1427,11 +1427,11 @@ static int file_rename_poll(bContext *C) SpaceFile *sfile = CTX_wm_space_file(C); if (sfile && sfile->params) { - if (sfile->params->active_file < 0) { + if (sfile->params->active_file < 0) { poll = 0; } else { - char dir[FILE_MAX], group[FILE_MAX]; + char dir[FILE_MAX], group[FILE_MAX]; if (filelist_islibrary(sfile->files, dir, group)) poll = 0; } } @@ -1460,11 +1460,11 @@ static int file_delete_poll(bContext *C) struct direntry *file; if (sfile && sfile->params) { - if (sfile->params->active_file < 0) { + if (sfile->params->active_file < 0) { poll = 0; } else { - char dir[FILE_MAX], group[FILE_MAX]; + char dir[FILE_MAX], group[FILE_MAX]; if (filelist_islibrary(sfile->files, dir, group)) poll = 0; file = filelist_file(sfile->files, sfile->params->active_file); if (file && S_ISDIR(file->type)) poll = 0; @@ -1485,7 +1485,7 @@ int file_delete_exec(bContext *C, wmOperator *UNUSED(op)) file = filelist_file(sfile->files, sfile->params->active_file); BLI_make_file_string(G.main->name, str, sfile->params->dir, file->relname); - BLI_delete(str, 0, 0); + BLI_delete(str, 0, 0); ED_fileselect_clear(C, sfile); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL); diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index a7054909aaa..a159c88221e 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -135,6 +135,16 @@ static void file_panel_system(const bContext *C, Panel *pa) file_panel_category(C, pa, FS_CATEGORY_SYSTEM, &sfile->systemnr, ICON_DISK_DRIVE, 0); } +static void file_panel_system_bookmarks(const bContext *C, Panel *pa) +{ + SpaceFile *sfile = CTX_wm_space_file(C); + + if (sfile && !(U.uiflag & USER_HIDE_SYSTEM_BOOKMARKS) ) { + file_panel_category(C, pa, FS_CATEGORY_SYSTEM_BOOKMARKS, &sfile->systemnr, ICON_BOOKMARKS, 0); + } + +} + static void file_panel_bookmarks(const bContext *C, Panel *pa) { SpaceFile *sfile = CTX_wm_space_file(C); @@ -193,7 +203,7 @@ static void file_panel_operator(const bContext *C, Panel *pa) { SpaceFile *sfile = CTX_wm_space_file(C); wmOperator *op = sfile->op; - // int empty= 1, flag; + // int empty = 1, flag; uiBlockSetFunc(uiLayoutGetBlock(pa->layout), file_draw_check_cb, NULL, NULL); @@ -212,6 +222,12 @@ void file_panels_register(ARegionType *art) pt->draw = file_panel_system; BLI_addtail(&art->paneltypes, pt); + pt = MEM_callocN(sizeof(PanelType), "spacetype file system bookmarks"); + strcpy(pt->idname, "FILE_PT_system_bookmarks"); + strcpy(pt->label, N_("System Bookmarks")); + pt->draw = file_panel_system_bookmarks; + BLI_addtail(&art->paneltypes, pt); + pt = MEM_callocN(sizeof(PanelType), "spacetype file bookmarks"); strcpy(pt->idname, "FILE_PT_bookmarks"); strcpy(pt->label, N_("Bookmarks")); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 1408e8b801b..b505fed7baa 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -143,7 +143,8 @@ typedef struct FolderList { #define SPECIAL_IMG_FONTFILE 8 #define SPECIAL_IMG_UNKNOWNFILE 9 #define SPECIAL_IMG_LOADING 10 -#define SPECIAL_IMG_MAX SPECIAL_IMG_LOADING + 1 +#define SPECIAL_IMG_BACKUP 11 +#define SPECIAL_IMG_MAX SPECIAL_IMG_BACKUP + 1 static ImBuf *gSpecialFileImages[SPECIAL_IMG_MAX]; @@ -300,7 +301,7 @@ static int is_hidden_file(const char *filename, short hide_dot) if ( (len > 0) && (filename[len - 1] == '~') ) { is_hidden = 1; /* ignore file~ */ } - } + } } else { if (((filename[0] == '.') && (filename[1] == 0) )) { @@ -360,7 +361,7 @@ void filelist_filter(FileList *filelist) struct direntry *file = &filelist->filelist[i]; if (filelist->filterf(file, filelist->dir, filelist->filter, filelist->hide_dot) ) { num_filtered++; - } + } } if (filelist->fidx) { @@ -420,7 +421,7 @@ void filelist_free_icons(void) } } -//-----------------FOLDERLIST (previous/next) --------------// +/* -----------------FOLDERLIST (previous/next) -------------- */ ListBase *folderlist_new(void) { ListBase *p = MEM_callocN(sizeof(ListBase), "folderlist"); @@ -520,7 +521,7 @@ static void filelist_read_main(struct FileList *filelist); static void filelist_read_library(struct FileList *filelist); static void filelist_read_dir(struct FileList *filelist); -//------------------FILELIST------------------------// +/* ------------------FILELIST------------------------ */ FileList *filelist_new(short type) { FileList *p = MEM_callocN(sizeof(FileList), "filelist"); @@ -557,7 +558,7 @@ void filelist_free(struct FileList *filelist) } for (i = 0; i < filelist->numfiles; ++i) { - if (filelist->filelist[i].image) { + if (filelist->filelist[i].image) { IMB_freeImBuf(filelist->filelist[i].image); } filelist->filelist[i].image = NULL; @@ -573,7 +574,7 @@ void filelist_free(struct FileList *filelist) filelist->numfiles = 0; free(filelist->filelist); - filelist->filelist = NULL; + filelist->filelist = NULL; filelist->filter = 0; filelist->filter_glob[0] = '\0'; filelist->numfiltered = 0; @@ -683,6 +684,9 @@ ImBuf *filelist_geticon(struct FileList *filelist, int index) else if (file->flags & IMAGEFILE) { ibuf = gSpecialFileImages[SPECIAL_IMG_LOADING]; } + else if (file->flags & BLENDERFILE_BACKUP) { + ibuf = gSpecialFileImages[SPECIAL_IMG_BACKUP]; + } return ibuf; } @@ -791,7 +795,7 @@ static int file_extension_type(const char *relname) BLI_testextensie(relname, ".otf") || BLI_testextensie(relname, ".otc")) { - return FTFONTFILE; + return FTFONTFILE; } else if (BLI_testextensie(relname, ".btx")) { return BTXFILE; @@ -802,14 +806,14 @@ static int file_extension_type(const char *relname) else if (BLI_testextensie_array(relname, imb_ext_image) || (G.have_quicktime && BLI_testextensie_array(relname, imb_ext_image_qt))) { - return IMAGEFILE; + return IMAGEFILE; } else if (BLI_testextensie_array(relname, imb_ext_movie)) { - return MOVIEFILE; + return MOVIEFILE; } else if (BLI_testextensie_array(relname, imb_ext_audio)) { return SOUNDFILE; - } + } return 0; } @@ -817,8 +821,10 @@ int ED_file_extension_icon(const char *relname) { int type = file_extension_type(relname); - if (type == BLENDERFILE || type == BLENDERFILE_BACKUP) + if (type == BLENDERFILE) return ICON_FILE_BLEND; + else if (type == BLENDERFILE_BACKUP) + return ICON_FILE_BACKUP; else if (type == IMAGEFILE) return ICON_FILE_IMAGE; else if (type == MOVIEFILE) @@ -833,6 +839,8 @@ int ED_file_extension_icon(const char *relname) return ICON_FILE_BLANK; else if (type == COLLADAFILE) return ICON_FILE_BLANK; + else if (type == TEXTFILE) + return ICON_FILE_TEXT; return ICON_FILE_BLANK; } @@ -934,7 +942,7 @@ void filelist_parent(struct FileList *filelist) void filelist_select_file(struct FileList *filelist, int index, FileSelType select, unsigned int flag, FileCheckType check) { struct direntry *file = filelist_file(filelist, index); - if (file != NULL) { + if (file != NULL) { int check_ok = 0; switch (check) { case CHECK_DIRS: @@ -969,7 +977,7 @@ void filelist_select(struct FileList *filelist, FileSelection *sel, FileSelType /* select all valid files between first and last indicated */ if ( (sel->first >= 0) && (sel->first < filelist->numfiltered) && (sel->last >= 0) && (sel->last < filelist->numfiltered) ) { int current_file; - for (current_file = sel->first; current_file <= sel->last; current_file++) { + for (current_file = sel->first; current_file <= sel->last; current_file++) { filelist_select_file(filelist, current_file, select, flag, check); } } @@ -1036,7 +1044,7 @@ void filelist_from_library(struct FileList *filelist) struct ImBuf *ima; int ok, i, nprevs, nnames, idcode; char filename[FILE_MAX]; - char dir[FILE_MAX], group[GROUP_MAX]; + char dir[FILE_MAX], group[GROUP_MAX]; /* name test */ ok = filelist_islibrary(filelist, dir, group); @@ -1234,7 +1242,7 @@ void filelist_from_main(struct FileList *filelist) BLI_snprintf(files->relname, FILE_MAX + (MAX_ID_NAME - 2) + 3, "%s | %s", id->lib->name, id->name + 2); } files->type |= S_IFREG; -#if 0 // XXXXX TODO show the selection status of the objects +#if 0 /* XXXXX TODO show the selection status of the objects */ if (!filelist->has_func) { /* F4 DATA BROWSE */ if (idcode == ID_OB) { if ( ((Object *)id)->flag & SELECT) files->selflag |= SELECTED_FILE; @@ -1302,7 +1310,7 @@ static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float if (limg->flags & IMAGEFILE) { limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_IMAGE); } - else if (limg->flags & BLENDERFILE) { + else if (limg->flags & (BLENDERFILE | BLENDERFILE_BACKUP)) { limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_BLEND); } else if (limg->flags & MOVIEFILE) { @@ -1359,7 +1367,7 @@ void thumbnails_start(struct FileList *filelist, const struct bContext *C) tj->filelist = filelist; for (idx = 0; idx < filelist->numfiles; idx++) { if (!filelist->filelist[idx].image) { - if ( (filelist->filelist[idx].flags & (IMAGEFILE | MOVIEFILE | BLENDERFILE)) ) { + if ( (filelist->filelist[idx].flags & (IMAGEFILE | MOVIEFILE | BLENDERFILE | BLENDERFILE_BACKUP)) ) { FileImage *limg = MEM_callocN(sizeof(struct FileImage), "loadimage"); BLI_strncpy(limg->path, filelist->filelist[idx].path, FILE_MAX); limg->index = idx; diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 1fa89e5db9a..49562958f82 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -94,6 +94,9 @@ FileSelectParams *ED_fileselect_get_params(struct SpaceFile *sfile) return sfile->params; } +/** + * \note RNA_struct_property_is_set_ex is used here because we wan't + * the previously used settings to be used here rather then overriding them */ short ED_fileselect_set_params(SpaceFile *sfile) { FileSelectParams *params; @@ -124,7 +127,7 @@ short ED_fileselect_set_params(SpaceFile *sfile) else params->type = FILE_SPECIAL; - if (is_filepath && RNA_struct_property_is_set(op->ptr, "filepath")) { + if (is_filepath && RNA_struct_property_is_set_ex(op->ptr, "filepath", FALSE)) { char name[FILE_MAX]; RNA_string_get(op->ptr, "filepath", name); if (params->type == FILE_LOADLIB) { @@ -136,12 +139,12 @@ short ED_fileselect_set_params(SpaceFile *sfile) } } else { - if (is_directory && RNA_struct_property_is_set(op->ptr, "directory")) { + if (is_directory && RNA_struct_property_is_set_ex(op->ptr, "directory", FALSE)) { RNA_string_get(op->ptr, "directory", params->dir); sfile->params->file[0] = '\0'; } - if (is_filename && RNA_struct_property_is_set(op->ptr, "filename")) { + if (is_filename && RNA_struct_property_is_set_ex(op->ptr, "filename", FALSE)) { RNA_string_get(op->ptr, "filename", params->file); } } @@ -165,8 +168,6 @@ short ED_fileselect_set_params(SpaceFile *sfile) params->filter |= RNA_boolean_get(op->ptr, "filter_image") ? IMAGEFILE : 0; if (RNA_struct_find_property(op->ptr, "filter_movie")) params->filter |= RNA_boolean_get(op->ptr, "filter_movie") ? MOVIEFILE : 0; - if (RNA_struct_find_property(op->ptr, "filter_text")) - params->filter |= RNA_boolean_get(op->ptr, "filter_text") ? TEXTFILE : 0; if (RNA_struct_find_property(op->ptr, "filter_python")) params->filter |= RNA_boolean_get(op->ptr, "filter_python") ? PYSCRIPTFILE : 0; if (RNA_struct_find_property(op->ptr, "filter_font")) @@ -228,7 +229,7 @@ short ED_fileselect_set_params(SpaceFile *sfile) } if (is_relative_path) { - if (!RNA_struct_property_is_set(op->ptr, "relative_path")) { + if (!RNA_struct_property_is_set_ex(op->ptr, "relative_path", FALSE)) { RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); } } @@ -307,7 +308,7 @@ FileSelection ED_fileselect_layout_offset_rect(FileLayout *layout, const rcti *r CLAMP(rowmin, 0, layout->rows - 1); CLAMP(colmax, 0, layout->columns - 1); CLAMP(rowmax, 0, layout->rows - 1); - } + } if ((colmin > layout->columns - 1) || (rowmin > layout->rows - 1)) { sel.first = -1; diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index 66cda3082ea..c57bfaeeb2c 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -80,9 +80,9 @@ struct _FSMenuEntry { typedef struct FSMenu { FSMenuEntry *fsmenu_system; + FSMenuEntry *fsmenu_system_bookmarks; FSMenuEntry *fsmenu_bookmarks; FSMenuEntry *fsmenu_recent; - } FSMenu; static FSMenu *g_fsmenu = NULL; @@ -103,6 +103,9 @@ static FSMenuEntry *fsmenu_get_category(struct FSMenu *fsmenu, FSMenuCategory ca case FS_CATEGORY_SYSTEM: fsm_head = fsmenu->fsmenu_system; break; + case FS_CATEGORY_SYSTEM_BOOKMARKS: + fsm_head = fsmenu->fsmenu_system_bookmarks; + break; case FS_CATEGORY_BOOKMARKS: fsm_head = fsmenu->fsmenu_bookmarks; break; @@ -119,6 +122,9 @@ static void fsmenu_set_category(struct FSMenu *fsmenu, FSMenuCategory category, case FS_CATEGORY_SYSTEM: fsmenu->fsmenu_system = fsm_head; break; + case FS_CATEGORY_SYSTEM_BOOKMARKS: + fsmenu->fsmenu_system_bookmarks = fsm_head; + break; case FS_CATEGORY_BOOKMARKS: fsmenu->fsmenu_bookmarks = fsm_head; break; @@ -336,9 +342,9 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) /* Adding Desktop and My Documents */ if (read_bookmarks) { SHGetSpecialFolderPath(0, line, CSIDL_PERSONAL, 0); - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); SHGetSpecialFolderPath(0, line, CSIDL_DESKTOPDIRECTORY, 0); - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); } } #else @@ -361,7 +367,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) FSRefMakePath(&dir, path, FILE_MAX); if (strcmp((char *)path, "/home") && strcmp((char *)path, "/net")) { /* /net and /home are meaningless on OSX, home folders are stored in /Users */ - fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, (char *)path, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, (char *)path, FS_INSERT_SORTED); } } @@ -371,26 +377,26 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) home = getenv("HOME"); if (read_bookmarks && home) { BLI_snprintf(line, 256, "%s/", home); - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); BLI_snprintf(line, 256, "%s/Desktop/", home); if (BLI_exists(line)) { - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); } BLI_snprintf(line, 256, "%s/Documents/", home); if (BLI_exists(line)) { - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); } BLI_snprintf(line, 256, "%s/Pictures/", home); if (BLI_exists(line)) { - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); } BLI_snprintf(line, 256, "%s/Music/", home); if (BLI_exists(line)) { - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); } BLI_snprintf(line, 256, "%s/Movies/", home); if (BLI_exists(line)) { - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); } } #else @@ -423,7 +429,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) if (!CFStringGetCString(pathString, line, 256, kCFStringEncodingASCII)) continue; - fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); CFRelease(pathString); CFRelease(cfURL); @@ -450,7 +456,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) FSRefMakePath(&dir, path, FILE_MAX); - fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, (char *)path, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, (char *)path, FS_INSERT_SORTED); } /* Finally get user favorite places */ @@ -473,7 +479,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) if (!CFStringGetCString(pathString, line, 256, kCFStringEncodingASCII)) continue; - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); CFRelease(pathString); CFRelease(cfURL); @@ -491,10 +497,10 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) if (read_bookmarks && home) { BLI_snprintf(line, FILE_MAXDIR, "%s/", home); - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); BLI_snprintf(line, FILE_MAXDIR, "%s/Desktop/", home); if (BLI_exists(line)) { - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); } } @@ -564,13 +570,17 @@ void fsmenu_refresh_system_category(struct FSMenu *fsmenu) fsmenu_free_category(fsmenu, FS_CATEGORY_SYSTEM); fsmenu_set_category(fsmenu, FS_CATEGORY_SYSTEM, NULL); + fsmenu_free_category(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS); + fsmenu_set_category(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, NULL); + /* Add all entries to system category */ - fsmenu_read_system(fsmenu, FALSE); + fsmenu_read_system(fsmenu, TRUE); } void fsmenu_free(struct FSMenu *fsmenu) { fsmenu_free_category(fsmenu, FS_CATEGORY_SYSTEM); + fsmenu_free_category(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS); fsmenu_free_category(fsmenu, FS_CATEGORY_BOOKMARKS); fsmenu_free_category(fsmenu, FS_CATEGORY_RECENT); MEM_freeN(fsmenu); diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h index 30730578085..1b69eb09fce 100644 --- a/source/blender/editors/space_file/fsmenu.h +++ b/source/blender/editors/space_file/fsmenu.h @@ -39,6 +39,7 @@ typedef enum FSMenuCategory { FS_CATEGORY_SYSTEM, + FS_CATEGORY_SYSTEM_BOOKMARKS, FS_CATEGORY_BOOKMARKS, FS_CATEGORY_RECENT } FSMenuCategory; diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 4fe4ad133a9..be037a0d5ba 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -198,7 +198,7 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa)) params->active_file = -1; // added this so it opens nicer (ton) } filelist_hidedot(sfile->files, params->flag & FILE_HIDE_DOT); - filelist_setfilter(sfile->files, params->flag & FILE_FILTER ? params->filter : 0); + filelist_setfilter(sfile->files, params->flag & FILE_FILTER ? params->filter : 0); filelist_setfilter_types(sfile->files, params->filter_glob); if (filelist_empty(sfile->files)) { @@ -481,7 +481,7 @@ static void file_channel_area_init(wmWindowManager *wm, ARegion *ar) ED_region_panels_init(wm, ar); /* own keymaps */ - keymap = WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0); + keymap = WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } @@ -505,7 +505,7 @@ static void file_header_area_init(wmWindowManager *wm, ARegion *ar) ED_region_header_init(ar); - keymap = WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0); + keymap = WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } @@ -598,7 +598,7 @@ void ED_spacetype_file(void) art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER; art->init = file_header_area_init; art->draw = file_header_area_draw; - // art->listener= file_header_area_listener; + // art->listener = file_header_area_listener; BLI_addhead(&st->regiontypes, art); /* regions: ui */ diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 3e8f6f1c7fc..8bb57a32090 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -77,7 +77,7 @@ static void do_graph_region_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event) { - //Scene *scene= CTX_data_scene(C); + //Scene *scene = CTX_data_scene(C); switch (event) { @@ -299,7 +299,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa) if (RNA_path_resolve(&id_ptr, fcu->rna_path, &fcu_prop_ptr, &fcu_prop) && fcu_prop) { /* determine the unit for this property */ unit = RNA_SUBTYPE_UNIT(RNA_property_subtype(fcu_prop)); - } + } /* interpolation */ col = uiLayoutColumn(layout, FALSE); @@ -407,7 +407,7 @@ static void driver_remove_cb(bContext *C, void *ale_v, void *UNUSED(arg)) if (ELEM(NULL, id, fcu)) return; - /* call API method to remove this driver */ + /* call API method to remove this driver */ ANIM_remove_driver(reports, id, fcu->rna_path, fcu->array_index, 0); } diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index ef2e56afca0..f665b979559 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -83,7 +83,7 @@ static float fcurve_display_alpha(FCurve *fcu) /* Envelope -------------- */ -// TODO: draw a shaded poly showing the region of influence too!!! +/* TODO: draw a shaded poly showing the region of influence too!!! */ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d) { FMod_Envelope *env = (FMod_Envelope *)fcm->data; @@ -101,13 +101,13 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d) glVertex2f(v2d->cur.xmin, env->midval + env->max); glVertex2f(v2d->cur.xmax, env->midval + env->max); - glEnd(); // GL_LINES + glEnd(); /* GL_LINES */ setlinestyle(0); /* set size of vertices (non-adjustable for now) */ glPointSize(2.0f); - // for now, point color is fixed, and is white + /* for now, point color is fixed, and is white */ glColor3f(1.0f, 1.0f, 1.0f); /* we use bgl points not standard gl points, to workaround vertex @@ -123,7 +123,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d) glVertex2f(fed->time, fed->max); } } - bglEnd(); // GL_POINTS + bglEnd(); /* GL_POINTS */ glPointSize(1.0f); } @@ -160,13 +160,13 @@ static void draw_fcurve_vertices_keyframes(FCurve *fcu, SpaceIpo *UNUSED(sipo), } else { /* no check for selection here, as curve is not editable... */ - // XXX perhaps we don't want to even draw points? maybe add an option for that later + /* XXX perhaps we don't want to even draw points? maybe add an option for that later */ bglVertex3fv(bezt->vec[1]); } } } - bglEnd(); // GL_POINTS + bglEnd(); /* GL_POINTS */ } @@ -262,7 +262,7 @@ static void set_fcurve_vertex_color(FCurve *fcu, short sel) /* Curve's points ARE BEING edited */ if (sel) UI_ThemeColorShadeAlpha(TH_VERTEX_SELECT, 0, alphaOffset); else UI_ThemeColorShadeAlpha(TH_VERTEX, 0, alphaOffset); - } + } else { /* Curve's points CANNOT BE edited */ if (sel) UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, alphaOffset); @@ -318,7 +318,7 @@ static int draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu) ) { return 0; - } + } else { return 1; } @@ -404,7 +404,7 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu) } } - glEnd(); // GL_LINES + glEnd(); /* GL_LINES */ } /* Samples ---------------- */ @@ -428,7 +428,7 @@ static void draw_fcurve_sample_control(float x, float y, float xscale, float ysc glVertex2f(-0.7f, +0.7f); glVertex2f(+0.7f, -0.7f); - glEnd(); // GL_LINES + glEnd(); /* GL_LINES */ glEndList(); } @@ -515,7 +515,7 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d * chosen here is just the coarsest value which still looks reasonable... */ /* grid->dx represents the number of 'frames' between gridlines, but we divide by U.v2d_min_gridsize to get pixels-steps */ - // TODO: perhaps we should have 1.0 frames as upper limit so that curves don't get too distorted? + /* TODO: perhaps we should have 1.0 frames as upper limit so that curves don't get too distorted? */ samplefreq = dx / U.v2d_min_gridsize; if (samplefreq < 0.00001f) samplefreq = 0.00001f; @@ -561,7 +561,7 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (fcu->flag & FCURVE_INT_VALUES) || (fcu->totvert == 1)) { /* just extend across the first keyframe's value */ v[1] = prevfpt->vec[1]; - } + } else { /* extrapolate linear dosnt use the handle, use the next points center instead */ fac = (prevfpt->vec[0] - fpt->vec[0]) / (prevfpt->vec[0] - v[0]); @@ -599,7 +599,7 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (fcu->flag & FCURVE_INT_VALUES) || (fcu->totvert == 1)) { /* based on last keyframe's value */ v[1] = prevfpt->vec[1]; - } + } else { /* extrapolate linear dosnt use the handle, use the previous points center instead */ fpt = prevfpt - 1; @@ -642,13 +642,13 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2 if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (prevbezt->ipo == BEZT_IPO_CONST) || (fcu->totvert == 1)) { /* just extend across the first keyframe's value */ v1[1] = prevbezt->vec[1][1]; - } + } else if (prevbezt->ipo == BEZT_IPO_LIN) { /* extrapolate linear dosnt use the handle, use the next points center instead */ fac = (prevbezt->vec[1][0] - bezt->vec[1][0]) / (prevbezt->vec[1][0] - v1[0]); if (fac) fac = 1.0f / fac; v1[1] = prevbezt->vec[1][1] - fac * (prevbezt->vec[1][1] - bezt->vec[1][1]); - } + } else { /* based on angle of handle 1 (relative to keyframe) */ fac = (prevbezt->vec[0][0] - prevbezt->vec[1][0]) / (prevbezt->vec[1][0] - v1[0]); @@ -667,7 +667,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2 } /* draw curve between first and last keyframe (if there are enough to do so) */ - // TODO: optimize this to not have to calc stuff out of view too? + /* TODO: optimize this to not have to calc stuff out of view too? */ while (b--) { if (prevbezt->ipo == BEZT_IPO_CONST) { /* Constant-Interpolation: draw segment between previous keyframe and next, but holding same value */ @@ -691,7 +691,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2 */ /* resol depends on distance between points (not just horizontal) OR is a fixed high res */ - // TODO: view scale should factor into this someday too... + /* TODO: view scale should factor into this someday too... */ if (fcu->driver) resol = 32; else @@ -705,7 +705,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2 } else { /* clamp resolution to max of 32 */ - // NOTE: higher values will crash + /* NOTE: higher values will crash */ if (resol > 32) resol = 32; v1[0] = prevbezt->vec[1][0]; @@ -748,14 +748,14 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2 if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (fcu->flag & FCURVE_INT_VALUES) || (prevbezt->ipo == BEZT_IPO_CONST) || (fcu->totvert == 1)) { /* based on last keyframe's value */ v1[1] = prevbezt->vec[1][1]; - } + } else if (prevbezt->ipo == BEZT_IPO_LIN) { /* extrapolate linear dosnt use the handle, use the previous points center instead */ bezt = prevbezt - 1; fac = (prevbezt->vec[1][0] - bezt->vec[1][0]) / (prevbezt->vec[1][0] - v1[0]); if (fac) fac = 1.0f / fac; v1[1] = prevbezt->vec[1][1] - fac * (prevbezt->vec[1][1] - bezt->vec[1][1]); - } + } else { /* based on angle of handle 1 (relative to keyframe) */ fac = (prevbezt->vec[2][0] - prevbezt->vec[1][0]) / (prevbezt->vec[1][0] - v1[0]); @@ -852,7 +852,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid } if (((fcu->grp) && (fcu->grp->flag & AGRP_MUTED)) || (fcu->flag & FCURVE_MUTED)) { /* muted curves are drawn in a grayish hue */ - // XXX should we have some variations? + /* XXX should we have some variations? */ UI_ThemeColorShade(TH_HEADER, 50); } else { @@ -971,7 +971,7 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) height = (float)((items * ACHANNEL_STEP) + (ACHANNEL_HEIGHT * 2)); UI_view2d_totRect_set(v2d, ar->winx, height); - /* loop through channels, and set up drawing depending on their type */ + /* loop through channels, and set up drawing depending on their type */ { /* first pass: just the standard GL-drawing for backdrop + text */ y = (float)ACHANNEL_FIRST; diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 30ec32ec0aa..453549ebf79 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -332,7 +332,7 @@ static void create_ghost_curves(bAnimContext *ac, int start, int end) ChannelDriver *driver = fcu->driver; FPoint *fpt; float unitFac; - int cfra; + int cfra; /* disable driver so that it don't muck up the sampling process */ fcu->driver = NULL; @@ -724,7 +724,7 @@ static int graphkeys_copy_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; /* copy keyframes */ - if (copy_graph_keys(&ac)) { + if (copy_graph_keys(&ac)) { BKE_report(op->reports, RPT_ERROR, "No keyframes copied to keyframes copy/paste buffer"); return OPERATOR_CANCELLED; } @@ -1143,9 +1143,9 @@ static int graphkeys_sound_bake_exec(bContext *C, wmOperator *op) RNA_float_get(op->ptr, "attack"), RNA_float_get(op->ptr, "release"), RNA_float_get(op->ptr, "threshold"), - RNA_boolean_get(op->ptr, "accumulate"), + RNA_boolean_get(op->ptr, "use_accumulate"), RNA_boolean_get(op->ptr, "use_additive"), - RNA_boolean_get(op->ptr, "square"), + RNA_boolean_get(op->ptr, "use_square"), RNA_float_get(op->ptr, "sthreshold"), FPS, &sbi.length); @@ -1225,15 +1225,27 @@ void GRAPH_OT_sound_bake(wmOperatorType *ot) /* properties */ WM_operator_properties_filesel(ot, FOLDERFILE | SOUNDFILE | MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY); - RNA_def_float(ot->srna, "low", 0.0f, 0.0, 100000.0, "Lowest frequency", "", 0.1, 1000.00); - RNA_def_float(ot->srna, "high", 100000.0, 0.0, 100000.0, "Highest frequency", "", 0.1, 1000.00); - RNA_def_float(ot->srna, "attack", 0.005, 0.0, 2.0, "Attack time", "", 0.01, 0.1); - RNA_def_float(ot->srna, "release", 0.2, 0.0, 5.0, "Release time", "", 0.01, 0.2); - RNA_def_float(ot->srna, "threshold", 0.0, 0.0, 1.0, "Threshold", "", 0.01, 0.1); - RNA_def_boolean(ot->srna, "accumulate", 0, "Accumulate", ""); - RNA_def_boolean(ot->srna, "use_additive", 0, "Additive", ""); - RNA_def_boolean(ot->srna, "square", 0, "Square", ""); - RNA_def_float(ot->srna, "sthreshold", 0.1, 0.0, 1.0, "Square Threshold", "", 0.01, 0.1); + RNA_def_float(ot->srna, "low", 0.0f, 0.0, 100000.0, "Lowest frequency", + "Cutoff frequency of a high-pass filter that is applied to the audio data", 0.1, 1000.00); + RNA_def_float(ot->srna, "high", 100000.0, 0.0, 100000.0, "Highest frequency", + "Cutoff frequency of a low-pass filter that is applied to the audio data", 0.1, 1000.00); + RNA_def_float(ot->srna, "attack", 0.005, 0.0, 2.0, "Attack time", + "Value for the hull curve calculation that tells how fast the hull curve can rise " + "(the lower the value the steeper it can rise)", 0.01, 0.1); + RNA_def_float(ot->srna, "release", 0.2, 0.0, 5.0, "Release time", + "Value for the hull curve calculation that tells how fast the hull curve can fall " + "(the lower the value the steeper it can fall)", 0.01, 0.2); + RNA_def_float(ot->srna, "threshold", 0.0, 0.0, 1.0, "Threshold", + "Minimum amplitude value needed to influence the hull curve", 0.01, 0.1); + RNA_def_boolean(ot->srna, "use_accumulate", 0, "Accumulate", + "Only the positive differences of the hull curve amplitudes are summarized to produce the output"); + RNA_def_boolean(ot->srna, "use_additive", 0, "Additive", + "The amplitudes of the hull curve are summarized (or, when Accumulate is enabled, " + "both positive and negative differences are accumulated)"); + RNA_def_boolean(ot->srna, "use_square", 0, "Square", + "The output is a square curve (negative values always result in -1, and positive ones in 1)"); + RNA_def_float(ot->srna, "sthreshold", 0.1, 0.0, 1.0, "Square Threshold", + "Square only: all values with an absolute amplitude lower than that result in 0", 0.01, 0.1); } /* ******************** Sample Keyframes Operator *********************** */ @@ -1614,7 +1626,7 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op) else if (ELEM3(fcu->array_index, 0, 1, 2) == 0) { BKE_reportf(op->reports, RPT_WARNING, "Euler Rotation F-Curve has invalid index (ID='%s', Path='%s', Index=%d)", - (ale->id) ? ale->id->name : "<No ID>", fcu->rna_path, fcu->array_index); + (ale->id) ? ale->id->name : TIP_("<No ID>"), fcu->rna_path, fcu->array_index); continue; } @@ -1711,13 +1723,16 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op) /* updates + finishing warnings */ if (failed == groups) { BKE_report(op->reports, RPT_ERROR, - "No Euler Rotations could be corrected, ensure each rotation has keys for all components, and that F-Curves for these are in consecutive XYZ order and selected"); + "No Euler Rotations could be corrected, ensure each rotation has keys for all components, " + "and that F-Curves for these are in consecutive XYZ order and selected"); return OPERATOR_CANCELLED; } else { if (failed) { BKE_report(op->reports, RPT_ERROR, - "Some Euler Rotations couldn't be corrected due to missing/unselected/out-of-order F-Curves, ensure each rotation has keys for all components, and that F-Curves for these are in consecutive XYZ order and selected"); + "Some Euler Rotations could not be corrected due to missing/unselected/out-of-order F-Curves, " + "ensure each rotation has keys for all components, and that F-Curves for these are in " + "consecutive XYZ order and selected"); } /* validate keyframes after editing */ @@ -1824,17 +1839,17 @@ void GRAPH_OT_frame_jump(wmOperatorType *ot) /* defines for snap keyframes tool */ static EnumPropertyItem prop_graphkeys_snap_types[] = { - {GRAPHKEYS_SNAP_CFRA, "CFRA", 0, "Current Frame", + {GRAPHKEYS_SNAP_CFRA, "CFRA", 0, "Current Frame", "Snap selected keyframes to the current frame"}, - {GRAPHKEYS_SNAP_VALUE, "VALUE", 0, "Cursor Value", + {GRAPHKEYS_SNAP_VALUE, "VALUE", 0, "Cursor Value", "Set values of selected keyframes to the cursor value (Y/Horizontal component)"}, - {GRAPHKEYS_SNAP_NEAREST_FRAME, "NEAREST_FRAME", 0, "Nearest Frame", + {GRAPHKEYS_SNAP_NEAREST_FRAME, "NEAREST_FRAME", 0, "Nearest Frame", "Snap selected keyframes to the nearest (whole) frame (use to fix accidental sub-frame offsets)"}, - {GRAPHKEYS_SNAP_NEAREST_SECOND, "NEAREST_SECOND", 0, "Nearest Second", + {GRAPHKEYS_SNAP_NEAREST_SECOND, "NEAREST_SECOND", 0, "Nearest Second", "Snap selected keyframes to the nearest second"}, - {GRAPHKEYS_SNAP_NEAREST_MARKER, "NEAREST_MARKER", 0, "Nearest Marker", + {GRAPHKEYS_SNAP_NEAREST_MARKER, "NEAREST_MARKER", 0, "Nearest Marker", "Snap selected keyframes to the nearest marker"}, - {GRAPHKEYS_SNAP_HORIZONTAL, "HORIZONTAL", 0, "Flatten Handles", + {GRAPHKEYS_SNAP_HORIZONTAL, "HORIZONTAL", 0, "Flatten Handles", "Flatten handles for a smoother transition"}, {0, NULL, 0, NULL, NULL} }; @@ -1938,15 +1953,15 @@ void GRAPH_OT_snap(wmOperatorType *ot) /* defines for mirror keyframes tool */ static EnumPropertyItem prop_graphkeys_mirror_types[] = { - {GRAPHKEYS_MIRROR_CFRA, "CFRA", 0, "By Times over Current Frame", + {GRAPHKEYS_MIRROR_CFRA, "CFRA", 0, "By Times over Current Frame", "Flip times of selected keyframes using the current frame as the mirror line"}, - {GRAPHKEYS_MIRROR_VALUE, "VALUE", 0, "By Values over Cursor Value", + {GRAPHKEYS_MIRROR_VALUE, "VALUE", 0, "By Values over Cursor Value", "Flip values of selected keyframes using the cursor value (Y/Horizontal component) as the mirror line"}, - {GRAPHKEYS_MIRROR_YAXIS, "YAXIS", 0, "By Times over Time=0", + {GRAPHKEYS_MIRROR_YAXIS, "YAXIS", 0, "By Times over Time=0", "Flip times of selected keyframes, effectively reversing the order they appear in"}, - {GRAPHKEYS_MIRROR_XAXIS, "XAXIS", 0, "By Values over Value=0", + {GRAPHKEYS_MIRROR_XAXIS, "XAXIS", 0, "By Values over Value=0", "Flip values of selected keyframes (i.e. negative values become positive, and vice versa)"}, - {GRAPHKEYS_MIRROR_MARKER, "MARKER", 0, "By Times over First Selected Marker", + {GRAPHKEYS_MIRROR_MARKER, "MARKER", 0, "By Times over First Selected Marker", "Flip times of selected keyframes using the first selected marker as the reference point"}, {0, NULL, 0, NULL, NULL} }; @@ -2181,7 +2196,7 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op) if (fcm) set_active_fmodifier(&fcu->modifiers, fcm); else { - BKE_report(op->reports, RPT_ERROR, "Modifier couldn't be added, see console for details"); + BKE_report(op->reports, RPT_ERROR, "Modifier could not be added (see console for details)"); break; } } diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h index eb657169970..b2dbf764c1d 100644 --- a/source/blender/editors/space_graph/graph_intern.h +++ b/source/blender/editors/space_graph/graph_intern.h @@ -123,7 +123,7 @@ enum { GRAPHKEYS_SNAP_CFRA = 1, GRAPHKEYS_SNAP_NEAREST_FRAME, GRAPHKEYS_SNAP_NEAREST_SECOND, - GRAPHKEYS_SNAP_NEAREST_MARKER, + GRAPHKEYS_SNAP_NEAREST_MARKER, GRAPHKEYS_SNAP_HORIZONTAL, GRAPHKEYS_SNAP_VALUE, } eGraphKeys_Snap_Mode; diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index e2fc1657379..978b3224850 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -757,7 +757,7 @@ static void graphkeys_select_leftright(bAnimContext *ac, short leftright, short if (leftright == GRAPHKEYS_LRSEL_LEFT) { ked.f1 = MINAFRAMEF; ked.f2 = (float)(CFRA + 0.1f); - } + } else { ked.f1 = (float)(CFRA - 0.1f); ked.f2 = MAXFRAMEF; @@ -835,7 +835,7 @@ static int graphkeys_select_leftright_invoke(bContext *C, wmOperator *op, wmEven UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL); if (x < CFRA) RNA_enum_set(op->ptr, "mode", GRAPHKEYS_LRSEL_LEFT); - else + else RNA_enum_set(op->ptr, "mode", GRAPHKEYS_LRSEL_RIGHT); } @@ -1113,7 +1113,7 @@ static void mouse_graph_keys(bAnimContext *ac, const int mval[2], short select_m nvi = find_nearest_fcurve_vert(ac, mval); /* check if anything to select */ - if (nvi == NULL) + if (nvi == NULL) return; /* deselect all other curves? */ @@ -1241,7 +1241,7 @@ static void graphkeys_mselect_column(bAnimContext *ac, const int mval[2], short nvi = find_nearest_fcurve_vert(ac, mval); /* check if anything to select */ - if (nvi == NULL) + if (nvi == NULL) return; /* get frame number on which elements should be selected */ diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index a4611cf1453..f41169b6c39 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -441,7 +441,7 @@ static void graph_listener(ScrArea *sa, wmNotifier *wmn) ED_area_tag_refresh(sa); break; case NC_SCENE: - switch (wmn->data) { + switch (wmn->data) { case ND_OB_ACTIVE: /* selection changed, so force refresh to flush (needs flag set to do syncing) */ case ND_OB_SELECT: sipo->flag |= SIPO_TEMP_NEEDCHANSYNC; @@ -461,7 +461,7 @@ static void graph_listener(ScrArea *sa, wmNotifier *wmn) ED_area_tag_refresh(sa); break; case ND_TRANSFORM: - break; /*do nothing*/ + break; /*do nothing*/ default: /* just redrawing the view will do */ ED_area_tag_redraw(sa); diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 59416dcf0c3..ae7a718ab5b 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -191,7 +191,7 @@ void image_preview_event(int event) waitcursor(0); WM_event_add_notifier(C, NC_IMAGE, ima_v); - } + } } @@ -722,8 +722,10 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char split = uiLayoutSplit(layout, 0.0f, FALSE); col = uiLayoutColumn(split, TRUE); + uiLayoutSetEnabled(col, 0); uiItemR(col, &imaptr, "generated_width", 0, "X", ICON_NONE); uiItemR(col, &imaptr, "generated_height", 0, "Y", ICON_NONE); + uiItemR(col, &imaptr, "use_generated_float", 0, NULL, ICON_NONE); uiItemR(split, &imaptr, "generated_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE); @@ -759,9 +761,10 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_man uiItemR(sub, imfptr, "color_mode", UI_ITEM_R_EXPAND, IFACE_("Color"), ICON_NONE); /* only display depth setting if multiple depths can be used */ - if ((ELEM6(depth_ok, + if ((ELEM7(depth_ok, R_IMF_CHAN_DEPTH_1, R_IMF_CHAN_DEPTH_8, + R_IMF_CHAN_DEPTH_10, R_IMF_CHAN_DEPTH_12, R_IMF_CHAN_DEPTH_16, R_IMF_CHAN_DEPTH_24, @@ -801,9 +804,13 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_man uiItemR(col, imfptr, "use_jpeg2k_ycc", 0, NULL, ICON_NONE); } + if (imf->imtype == R_IMF_IMTYPE_DPX) { + uiItemR(col, imfptr, "use_cineon_log", 0, NULL, ICON_NONE); + } + if (imf->imtype == R_IMF_IMTYPE_CINEON) { #if 1 - uiItemL(col, IFACE_("Hard coded Non-Linear, Gamma: 1.0"), ICON_NONE); + uiItemL(col, IFACE_("Hard coded Non-Linear, Gamma:1.7"), ICON_NONE); #else uiItemR(col, imfptr, "use_cineon_log", 0, NULL, ICON_NONE); uiItemR(col, imfptr, "cineon_black", 0, NULL, ICON_NONE); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 04566af2b3b..9fc2b981547 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -578,7 +578,7 @@ void draw_image_grease_pencil(bContext *C, short onlyv2d) } else { /* assume that UI_view2d_restore(C) has been called... */ - //SpaceImage *sima= (SpaceImage *)CTX_wm_space_data(C); + //SpaceImage *sima = (SpaceImage *)CTX_wm_space_data(C); /* draw grease-pencil ('screen' strokes) */ draw_gpencil_view2d(C, 0); @@ -791,7 +791,7 @@ void draw_image_main(const bContext *C, ARegion *ar) xoffs = scene->r.disprect.xmin; yoffs = scene->r.disprect.ymin; glColor3ub(0, 0, 0); - calc_image_view(sima, 'f'); + calc_image_view(sima, 'f'); myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax); glRectf(0.0f, 0.0f, 1.0f, 1.0f); glLoadIdentity(); diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index 2f01483d23f..4ca2f8888f8 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -79,7 +79,7 @@ void ED_space_image_set(SpaceImage *sima, Scene *scene, Object *obedit, Image *i BKE_image_signal(sima->image, &sima->iuser, IMA_SIGNAL_USER_NEW_IMAGE); if (sima->image && ID_REAL_USERS(sima->image) <= 0) - sima->image->id.us = MAX2(sima->image->id.us, 0) + 1; + sima->image->id.us = max_ii(sima->image->id.us, 0) + 1; if (obedit) WM_main_add_notifier(NC_GEOM | ND_DATA, obedit->data); @@ -98,7 +98,7 @@ void ED_space_image_set_mask(bContext *C, SpaceImage *sima, Mask *mask) /* weak, but same as image/space */ if (sima->mask_info.mask && ID_REAL_USERS(sima->mask_info.mask) <= 0) - sima->mask_info.mask->id.us = MAX2(sima->mask_info.mask->id.us, 0) + 1; + sima->mask_info.mask->id.us = max_ii(sima->mask_info.mask->id.us, 0) + 1; if (C) { WM_event_add_notifier(C, NC_MASK | NA_SELECTED, mask); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 4793f995d98..c7f9bd87a1b 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -39,6 +39,8 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "DNA_object_types.h" #include "DNA_node_types.h" #include "DNA_packedFile_types.h" @@ -183,7 +185,7 @@ static int space_image_poll(bContext *C) int space_image_main_area_poll(bContext *C) { SpaceImage *sima = CTX_wm_space_image(C); - // XXX ARegion *ar= CTX_wm_region(C); + // XXX ARegion *ar = CTX_wm_region(C); if (sima) return 1; // XXX (ar && ar->type->regionid == RGN_TYPE_WINDOW); @@ -551,7 +553,7 @@ static int image_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent * sima->xof += pan_x; sima->yof += pan_y; - ED_region_tag_redraw(ar); + ED_region_tag_redraw(ar); return OPERATOR_FINISHED; } @@ -599,7 +601,7 @@ static int image_view_all_exec(bContext *C, wmOperator *UNUSED(op)) /* find the zoom value that will fit the image in the image space */ zoomx = width / w; zoomy = height / h; - sima_zoom_set(sima, ar, 1.0f / power_of_2(1.0f / minf(zoomx, zoomy)), NULL); + sima_zoom_set(sima, ar, 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy)), NULL); } else sima_zoom_set(sima, ar, 1.0f, NULL); @@ -858,7 +860,8 @@ static int image_open_exec(bContext *C, wmOperator *op) if (!ima) { if (op->customdata) MEM_freeN(op->customdata); - BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s", str, errno ? strerror(errno) : "Unsupported image format"); + BKE_reportf(op->reports, RPT_ERROR, "Cannot read '%s': %s", + str, errno ? strerror(errno) : TIP_("unsupported image format")); return OPERATOR_CANCELLED; } @@ -1147,7 +1150,7 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, else { simopts->im_format.imtype = BKE_ftype_to_imtype(ibuf->ftype); } - //simopts->subimtype= scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */ + //simopts->subimtype = scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */ simopts->im_format.quality = ibuf->ftype & 0xff; BLI_strncpy(simopts->filepath, ibuf->name, sizeof(simopts->filepath)); @@ -1313,7 +1316,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI } } else { - BKE_reportf(op->reports, RPT_ERROR, "Couldn't write image: %s", simopts->filepath); + BKE_reportf(op->reports, RPT_ERROR, "Could not write image %s", simopts->filepath); } @@ -1495,7 +1498,7 @@ static int image_save_exec(bContext *C, wmOperator *op) save_image_doit(C, sima, op, &simopts, FALSE); } else { - BKE_reportf(op->reports, RPT_ERROR, "Can not save image, path '%s' is not writable", simopts.filepath); + BKE_reportf(op->reports, RPT_ERROR, "Cannot save image, path '%s' is not writable", simopts.filepath); return OPERATOR_CANCELLED; } @@ -1536,7 +1539,7 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op) } if (sima->image->type == IMA_TYPE_MULTILAYER) { - BKE_report(op->reports, RPT_ERROR, "Can't save multilayer sequences"); + BKE_report(op->reports, RPT_ERROR, "Cannot save multilayer sequences"); return OPERATOR_CANCELLED; } @@ -1572,7 +1575,7 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op) break; } - BKE_reportf(op->reports, RPT_INFO, "Saved: %s\n", ibuf->name); + BKE_reportf(op->reports, RPT_INFO, "Saved %s", ibuf->name); ibuf->userflags &= ~IB_BITMAPDIRTY; } } @@ -1682,16 +1685,24 @@ static int image_new_exec(bContext *C, wmOperator *op) RNA_property_pointer_set(&ptr, prop, idptr); RNA_property_update(C, &ptr, prop); } - else if (sima) + else if (sima) { ED_space_image_set(sima, scene, obedit, ima); + } + else { + Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; + if (tex && tex->type == TEX_IMAGE) { + tex->ima = ima; + ED_area_tag_redraw(CTX_wm_area(C)); + } + } - // XXX other users? BKE_image_signal(ima, (sima) ? &sima->iuser : NULL, IMA_SIGNAL_USER_NEW_IMAGE); return OPERATOR_FINISHED; } /* XXX, Ton is not a fan of OK buttons but using this function to avoid undo/redo bug while in mesh-editmode, - campbell */ +/* XXX Note: the WM_operator_props_dialog_popup() doesn't work for uiIDContextProperty(), image is not being that way */ static int image_new_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { return WM_operator_props_dialog_popup(C, op, 300, 100); @@ -1844,7 +1855,7 @@ static int image_pack_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; if (!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) { - BKE_report(op->reports, RPT_ERROR, "Can't pack edited image from disk, only as internal PNG"); + BKE_report(op->reports, RPT_ERROR, "Cannot pack edited image from disk, only as internal PNG"); return OPERATOR_CANCELLED; } @@ -2362,8 +2373,8 @@ static int image_record_composite_apply(bContext *C, wmOperator *op) WM_cursor_time(CTX_wm_window(C), scene->r.cfra); - // XXX scene->nodetree->test_break= blender_test_break; - // XXX scene->nodetree->test_break= NULL; + // XXX scene->nodetree->test_break = blender_test_break; + // XXX scene->nodetree->test_break = NULL; BKE_image_all_free_anim_ibufs(scene->r.cfra); ntreeCompositTagAnimated(scene->nodetree); @@ -2429,8 +2440,7 @@ static int image_record_composite_exec(bContext *C, wmOperator *op) if (!image_record_composite_init(C, op)) return OPERATOR_CANCELLED; - while (image_record_composite_apply(C, op)) - ; + while (image_record_composite_apply(C, op)) {} image_record_composite_exit(C, op); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 7f53f378042..4131cbfdd0d 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -457,7 +457,7 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn) ED_area_tag_redraw(sa); } break; - case NC_SPACE: + case NC_SPACE: if (wmn->data == ND_SPACE_IMAGE) { image_scopes_tag_refresh(sa); ED_area_tag_redraw(sa); @@ -550,7 +550,7 @@ static void image_main_area_set_view2d(SpaceImage *sima, ARegion *ar) int width, height, winx, winy; #if 0 - if (image_preview_active(curarea, &width, &height)) ; + if (image_preview_active(curarea, &width, &height)) {} else #endif ED_space_image_get_size(sima, &width, &height); diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c index 35e19bcce38..5830c4574df 100644 --- a/source/blender/editors/space_info/info_draw.c +++ b/source/blender/editors/space_info/info_draw.c @@ -136,7 +136,7 @@ static int report_textview_skip__internal(TextViewContext *tvc) static int report_textview_begin(TextViewContext *tvc) { - // SpaceConsole *sc= (SpaceConsole *)tvc->arg1; + // SpaceConsole *sc = (SpaceConsole *)tvc->arg1; ReportList *reports = (ReportList *)tvc->arg2; tvc->lheight = 14; //sc->lheight; diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index bb2d55fa0f6..131908bc9db 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -196,7 +196,7 @@ static int make_paths_relative_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); if (!G.relbase_valid) { - BKE_report(op->reports, RPT_WARNING, "Can't set relative paths with an unsaved blend file"); + BKE_report(op->reports, RPT_WARNING, "Cannot set relative paths with an unsaved blend file"); return OPERATOR_CANCELLED; } @@ -229,7 +229,7 @@ static int make_paths_absolute_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); if (!G.relbase_valid) { - BKE_report(op->reports, RPT_WARNING, "Can't set absolute paths with an unsaved blend file"); + BKE_report(op->reports, RPT_WARNING, "Cannot set absolute paths with an unsaved blend file"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index 2324f735a33..049a50f89fc 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -68,9 +68,9 @@ int info_report_mask(SpaceInfo *UNUSED(sinfo)) // TODO, get this working again! static int report_replay_exec(bContext *C, wmOperator *UNUSED(op)) { -// SpaceInfo *sc= CTX_wm_space_info(C); -// ReportList *reports= CTX_wm_reports(C); -// int report_mask= info_report_mask(sc); +// SpaceInfo *sc = CTX_wm_space_info(C); +// ReportList *reports = CTX_wm_reports(C); +// int report_mask = info_report_mask(sc); // Report *report; #if 0 @@ -223,7 +223,7 @@ static int borderselect_exec(bContext *C, wmOperator *op) int extend = RNA_boolean_get(op->ptr, "extend"); Report *report_min, *report_max, *report; - //View2D *v2d= UI_view2d_fromcontext(C); + //View2D *v2d = UI_view2d_fromcontext(C); rcti rect; diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 034c382cfd2..f108881091a 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -93,7 +93,7 @@ static SpaceLink *info_new(const bContext *UNUSED(C)) ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f; /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */ - //ar->v2d.keepzoom= (V2D_KEEPASPECT|V2D_LIMITZOOM); + //ar->v2d.keepzoom = (V2D_KEEPASPECT|V2D_LIMITZOOM); return (SpaceLink *)sinfo; } @@ -228,7 +228,7 @@ static void info_header_area_draw(const bContext *C, ARegion *ar) static void info_main_area_listener(ARegion *ar, wmNotifier *wmn) { - // SpaceInfo *sinfo= sa->spacedata.first; + // SpaceInfo *sinfo = sa->spacedata.first; /* context changes */ switch (wmn->category) { @@ -249,7 +249,7 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn) if (ELEM(wmn->data, ND_SCREENCAST, ND_ANIMPLAY)) ED_region_tag_redraw(ar); break; - case NC_WM: + case NC_WM: if (wmn->data == ND_JOB) ED_region_tag_redraw(ar); break; @@ -257,7 +257,7 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn) if (wmn->data == ND_RENDER_RESULT) ED_region_tag_redraw(ar); break; - case NC_SPACE: + case NC_SPACE: if (wmn->data == ND_SPACE_INFO) ED_region_tag_redraw(ar); break; diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index cfab2542756..f454b1dbe7d 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -36,8 +36,6 @@ #include "BLI_math.h" #include "BLI_utildefines.h" - - #include "BIF_gl.h" #include "BIF_glutil.h" @@ -66,8 +64,8 @@ typedef struct ConsoleDrawContext { static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int lheight) { if (sel[0] <= str_len_draw && sel[1] >= 0) { - int sta = MAX2(sel[0], 0); - int end = MIN2(sel[1], str_len_draw); + int sta = max_ii(sel[0], 0); + int end = min_ii(sel[1], str_len_draw); glEnable(GL_POLYGON_STIPPLE); glPolygonStipple(stipple_halftone); diff --git a/source/blender/editors/space_logic/CMakeLists.txt b/source/blender/editors/space_logic/CMakeLists.txt index 8859d1d8bfd..13e6f9484e8 100644 --- a/source/blender/editors/space_logic/CMakeLists.txt +++ b/source/blender/editors/space_logic/CMakeLists.txt @@ -48,4 +48,8 @@ if(WITH_GAMEENGINE) add_definitions(-DWITH_GAMEENGINE) endif() +if(WITH_INTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) +endif() + blender_add_lib(bf_editor_space_logic "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_logic/SConscript b/source/blender/editors/space_logic/SConscript index 6beb3ecb48f..e63d88ea5de 100644 --- a/source/blender/editors/space_logic/SConscript +++ b/source/blender/editors/space_logic/SConscript @@ -3,7 +3,7 @@ Import ('env') sources = env.Glob('*.c') -incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' +incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../makesrna ../interface ../../blenloader' @@ -12,4 +12,7 @@ defs = [] if env['WITH_BF_GAMEENGINE']: defs.append('WITH_GAMEENGINE') +if env['WITH_BF_INTERNATIONAL']: + defs.append('WITH_INTERNATIONAL') + env.BlenderLib ( 'bf_editors_space_game', sources, Split(incs), defs, libtype=['core'], priority=[120] ) diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c index abdfa0ef4dd..e898a1baf74 100644 --- a/source/blender/editors/space_logic/logic_buttons.c +++ b/source/blender/editors/space_logic/logic_buttons.c @@ -52,8 +52,8 @@ static int logic_properties(bContext *C, wmOperator *UNUSED(op)) { - ScrArea *sa= CTX_wm_area(C); - ARegion *ar= logic_has_buttons_region(sa); + ScrArea *sa = CTX_wm_area(C); + ARegion *ar = logic_has_buttons_region(sa); if (ar) ED_region_toggle_hidden(C, ar); @@ -100,9 +100,9 @@ static int cut_links_intersect(uiLinkLine *line, float mcoords[][2], int tot) static int cut_links_exec(bContext *C, wmOperator *op) { - ARegion *ar= CTX_wm_region(C); + ARegion *ar = CTX_wm_region(C); float mcoords[256][2]; - int i= 0; + int i = 0; RNA_BEGIN (op->ptr, itemptr, "path") { @@ -113,7 +113,7 @@ static int cut_links_exec(bContext *C, wmOperator *op) (int)loc[0], (int)loc[1], &mcoords[i][0], &mcoords[i][1]); i++; - if (i>= 256) break; + if (i >= 256) break; } RNA_END; @@ -121,23 +121,23 @@ static int cut_links_exec(bContext *C, wmOperator *op) uiBlock *block; uiLinkLine *line, *nline; uiBut *but; - for (block= ar->uiblocks.first; block; block= block->next) { - but= block->buttons.first; + for (block = ar->uiblocks.first; block; block = block->next) { + but = block->buttons.first; while (but) { if (but->type==LINK && but->link) { - for (line= but->link->lines.first; line; line= nline) { - nline= line->next; + for (line = but->link->lines.first; line; line = nline) { + nline = line->next; if (cut_links_intersect(line, mcoords, i)) { ui_delete_linkline(line, but); } } } - but= but->next; + but = but->next; } } return OPERATOR_FINISHED; - } + } return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH; } @@ -159,7 +159,7 @@ void LOGIC_OT_links_cut(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; - prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE); + prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath); /* internal */ RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX); diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c index f2013e405e2..74be7c46d26 100644 --- a/source/blender/editors/space_logic/logic_ops.c +++ b/source/blender/editors/space_logic/logic_ops.c @@ -138,7 +138,7 @@ static bSensor *edit_sensor_property_get(bContext *C, wmOperator *op, Object **o *ob = edit_object_property_get(C, op); if (!*ob) return NULL; - sens = BLI_findstring(&((*ob)->sensors), sensor_name, offsetof(bSensor, name)); + sens = BLI_findstring(&((*ob)->sensors), sensor_name, offsetof(bSensor, name)); return sens; } @@ -177,7 +177,7 @@ static bController *edit_controller_property_get(bContext *C, wmOperator *op, Ob *ob = edit_object_property_get(C, op); if (!*ob) return NULL; - cont = BLI_findstring(&((*ob)->controllers), controller_name, offsetof(bController, name)); + cont = BLI_findstring(&((*ob)->controllers), controller_name, offsetof(bController, name)); return cont; } @@ -216,7 +216,7 @@ static bActuator *edit_actuator_property_get(bContext *C, wmOperator *op, Object *ob = edit_object_property_get(C, op); if (!*ob) return NULL; - act = BLI_findstring(&((*ob)->actuators), actuator_name, offsetof(bActuator, name)); + act = BLI_findstring(&((*ob)->actuators), actuator_name, offsetof(bActuator, name)); return act; } diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 5d7ff77e032..bffabe6d160 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -63,6 +63,8 @@ #include "BIF_gl.h" +#include "BLF_translation.h" + #include "UI_interface.h" #include "RNA_access.h" @@ -102,8 +104,8 @@ static int vergname(const void *v1, const void *v2) { char **x1, **x2; - x1= (char **)v1; - x2= (char **)v2; + x1 = (char **)v1; + x2 = (char **)v2; return BLI_natstrcmp(*x1, *x2); } @@ -134,7 +136,7 @@ void make_unique_prop_names(bContext *C, char *str) propcount+= BLI_countlist(&ob->sensors); propcount+= BLI_countlist(&ob->controllers); propcount+= BLI_countlist(&ob->actuators); - } + } if (propcount==0) { if (idar) MEM_freeN(idar); return; @@ -149,22 +151,22 @@ void make_unique_prop_names(bContext *C, char *str) ob= (Object *)idar[a]; prop= ob->prop.first; while (prop) { - names[nr++]= prop->name; + names[nr++] = prop->name; prop= prop->next; } sens= ob->sensors.first; while (sens) { - names[nr++]= sens->name; + names[nr++] = sens->name; sens= sens->next; } cont= ob->controllers.first; while (cont) { - names[nr++]= cont->name; + names[nr++] = cont->name; cont= cont->next; } act= ob->actuators.first; while (act) { - names[nr++]= act->name; + names[nr++] = act->name; act= act->next; } } @@ -524,7 +526,7 @@ static const char *actuator_name(int type) case ACT_ARMATURE: return "Armature"; case ACT_STEERING: - return "Steering"; + return "Steering"; } return "unknown"; } @@ -678,7 +680,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf ob= ob->id.next; } } - } + } /* now we count */ ob= bmain->object.first; @@ -687,8 +689,8 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf ob= ob->id.next; } - if (*count==0) return NULL; - if (*count>24) *count= 24; /* temporal */ + if (*count == 0) return NULL; + if (*count > 24) *count = 24; /* temporal */ idar= MEM_callocN((*count)*sizeof(void *), "idar"); @@ -697,16 +699,16 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf /* make the active object always the first one of the list */ if (obact) { - idar[0]= (ID *)obact; + idar[0] = (ID *)obact; nr++; } while (ob) { if ((ob->scavisflag) && (ob != obact)) { - idar[nr]= (ID *)ob; + idar[nr] = (ID *)ob; nr++; } - if (nr>=24) break; + if (nr >= 24) break; ob= ob->id.next; } @@ -768,11 +770,11 @@ static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP); uiBlockSetButmFunc(block, do_sensor_menu, NULL); - uiDefBut(block, BUTM, 1, "Show Objects", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefBut(block, BUTM, 1, "Hide Objects", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefBut(block, BUTM, 1, IFACE_("Show Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); + uiDefBut(block, BUTM, 1, IFACE_("Hide Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); uiDefBut(block, SEPR, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefBut(block, BUTM, 1, "Show Sensors", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, ""); - uiDefBut(block, BUTM, 1, "Hide Sensors", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, ""); + uiDefBut(block, BUTM, 1, IFACE_("Show Sensors"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, ""); + uiDefBut(block, BUTM, 1, IFACE_("Hide Sensors"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, ""); uiBlockSetDirection(block, UI_TOP); uiEndBlock(C, block); @@ -817,11 +819,11 @@ static uiBlock *controller_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP); uiBlockSetButmFunc(block, do_controller_menu, NULL); - uiDefBut(block, BUTM, 1, "Show Objects", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefBut(block, BUTM, 1, "Hide Objects", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefBut(block, BUTM, 1, IFACE_("Show Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); + uiDefBut(block, BUTM, 1, IFACE_("Hide Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); uiDefBut(block, SEPR, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefBut(block, BUTM, 1, "Show Controllers", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 2, 2, ""); - uiDefBut(block, BUTM, 1, "Hide Controllers", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 3, 3, ""); + uiDefBut(block, BUTM, 1, IFACE_("Show Controllers"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 2, 2, ""); + uiDefBut(block, BUTM, 1, IFACE_("Hide Controllers"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 3, 3, ""); uiBlockSetDirection(block, UI_TOP); uiEndBlock(C, block); @@ -866,11 +868,11 @@ static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP); uiBlockSetButmFunc(block, do_actuator_menu, NULL); - uiDefBut(block, BUTM, 1, "Show Objects", 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefBut(block, BUTM, 1, "Hide Objects", 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefBut(block, BUTM, 1, IFACE_("Show Objects"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); + uiDefBut(block, BUTM, 1, IFACE_("Hide Objects"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); uiDefBut(block, SEPR, 0, "", 0, (short)(xco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefBut(block, BUTM, 1, "Show Actuators", 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, ""); - uiDefBut(block, BUTM, 1, "Hide Actuators", 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, ""); + uiDefBut(block, BUTM, 1, IFACE_("Show Actuators"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, ""); + uiDefBut(block, BUTM, 1, IFACE_("Hide Actuators"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, ""); uiBlockSetDirection(block, UI_TOP); uiEndBlock(C, block); @@ -901,7 +903,7 @@ static uiBlock *controller_state_mask_menu(bContext *C, ARegion *ar, void *arg_c /* use this for a fake extra empy space around the buttons */ uiDefBut(block, LABEL, 0, "", -5, -5, 200, 34, NULL, 0, 0, 0, 0, ""); - for (offset=0; offset<15; offset+=5) { + for (offset=0; offset<15; offset += 5) { uiBlockBeginAlign(block); for (stbit=0; stbit<5; stbit++) { but = uiDefButBitI(block, TOG, (1<<(stbit+offset)), (stbit+offset), "", (short)(xco+12*stbit+13*offset), yco, 12, 12, (int *)&(cont->state_mask), 0, 0, 0, 0, ""); @@ -981,13 +983,13 @@ static void draw_sensor_internal_header(uiLayout *layout, PointerRNA *ptr) sub = uiLayoutRow(row, FALSE); uiLayoutSetActive(sub, (RNA_boolean_get(ptr, "use_pulse_true_level") || RNA_boolean_get(ptr, "use_pulse_false_level"))); - uiItemR(sub, ptr, "frequency", 0, "Freq", ICON_NONE); + uiItemR(sub, ptr, "frequency", 0, IFACE_("Freq"), ICON_NONE); row = uiLayoutRow(split, TRUE); uiItemR(row, ptr, "use_level", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); uiItemR(row, ptr, "use_tap", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - uiItemR(split, ptr, "invert", UI_ITEM_R_TOGGLE, "Invert", ICON_NONE); + uiItemR(split, ptr, "invert", UI_ITEM_R_TOGGLE, IFACE_("Invert"), ICON_NONE); } /* sensors in alphabetical order */ @@ -1010,7 +1012,7 @@ static void draw_sensor_armature(uiLayout *layout, PointerRNA *ptr) uiLayout *row; if (ob->type != OB_ARMATURE) { - uiItemL(layout, "Sensor only available for armatures", ICON_NONE); + uiItemL(layout, IFACE_("Sensor only available for armatures"), ICON_NONE); return; } @@ -1112,7 +1114,7 @@ static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr) uiLayout *row, *col; row = uiLayoutRow(layout, FALSE); - uiItemL(row, "Key:", ICON_NONE); + uiItemL(row, IFACE_("Key:"), ICON_NONE); col = uiLayoutColumn(row, FALSE); uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == FALSE); uiItemR(col, ptr, "key", UI_ITEM_R_EVENT, "", ICON_NONE); @@ -1122,11 +1124,11 @@ static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr) col = uiLayoutColumn(layout, FALSE); uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == FALSE); row = uiLayoutRow(col, FALSE); - uiItemL(row, "First Modifier:", ICON_NONE); + uiItemL(row, IFACE_("First Modifier:"), ICON_NONE); uiItemR(row, ptr, "modifier_key_1", UI_ITEM_R_EVENT, "", ICON_NONE); row = uiLayoutRow(col, FALSE); - uiItemL(row, "Second Modifier:", ICON_NONE); + uiItemL(row, IFACE_("Second Modifier:"), ICON_NONE); uiItemR(row, ptr, "modifier_key_2", UI_ITEM_R_EVENT, "", ICON_NONE); RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); @@ -1312,7 +1314,7 @@ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, i uiItemR(row, ptr, "type", 0, "", ICON_NONE); uiItemR(row, ptr, "name", 0, "", ICON_NONE); /* XXX provisory for Blender 2.50Beta */ - uiDefBlockBut(uiLayoutGetBlock(layout), controller_state_mask_menu, cont, state, (short)(xco+width-44), yco, 22+22, UI_UNIT_Y, "Set controller state index (from 1 to 30)"); + uiDefBlockBut(uiLayoutGetBlock(layout), controller_state_mask_menu, cont, state, (short)(xco+width-44), yco, 22+22, UI_UNIT_Y, IFACE_("Set controller state index (from 1 to 30)")); } else { uiItemL(row, controller_name(cont->type), ICON_NONE); @@ -1480,7 +1482,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr) PropertyRNA *bones_prop = NULL; if (ob->type != OB_ARMATURE) { - uiItemL(layout, "Actuator only available for armatures", ICON_NONE); + uiItemL(layout, IFACE_("Actuator only available for armatures"), ICON_NONE); return; } @@ -1586,7 +1588,7 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext row = uiLayoutRow(layout, FALSE); col = uiLayoutColumn(row, TRUE); - uiItemL(col, "Range:", ICON_NONE); + uiItemL(col, IFACE_("Range:"), ICON_NONE); uiItemR(col, ptr, "range", 0, "", ICON_NONE); col = uiLayoutColumn(row, TRUE); @@ -1684,7 +1686,7 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr) break; case ACT_EDOB_REPLACE_MESH: if (ob->type != OB_MESH) { - uiItemL(layout, "Mode only available for mesh objects", ICON_NONE); + uiItemL(layout, IFACE_("Mode only available for mesh objects"), ICON_NONE); break; } split = uiLayoutSplit(layout, 0.6, FALSE); @@ -1702,7 +1704,7 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr) break; case ACT_EDOB_DYNAMICS: if (ob->type != OB_MESH) { - uiItemL(layout, "Mode only available for mesh objects", ICON_NONE); + uiItemL(layout, IFACE_("Mode only available for mesh objects"), ICON_NONE); break; } uiItemR(layout, ptr, "dynamic_operation", 0, NULL, ICON_NONE); @@ -1772,7 +1774,7 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr) uiLayout *split, *row, *col, *sub; int physics_type; - ob = (Object *)ptr->id.data; + ob = (Object *)ptr->id.data; RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); physics_type = RNA_enum_get(&settings_ptr, "physics_type"); @@ -1790,8 +1792,8 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr) uiItemR(row, ptr, "offset_rotation", 0, NULL, ICON_NONE); uiItemR(split, ptr, "use_local_rotation", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - if (ELEM3(physics_type, OB_BODY_TYPE_DYNAMIC, OB_BODY_TYPE_RIGID, OB_BODY_TYPE_SOFT)) { - uiItemL(layout, "Dynamic Object Settings:", ICON_NONE); + if (ELEM3(physics_type, OB_BODY_TYPE_DYNAMIC, OB_BODY_TYPE_RIGID, OB_BODY_TYPE_SOFT)) { + uiItemL(layout, IFACE_("Dynamic Object Settings:"), ICON_NONE); split = uiLayoutSplit(layout, 0.9, FALSE); row = uiLayoutRow(split, FALSE); uiItemR(row, ptr, "force", 0, NULL, ICON_NONE); @@ -1941,7 +1943,7 @@ static void draw_actuator_random(uiLayout *layout, PointerRNA *ptr) break; case ACT_RANDOM_BOOL_UNIFORM: - uiItemL(row, "Choose between true and false, 50% chance each", ICON_NONE); + uiItemL(row, IFACE_("Choose between true and false, 50% chance each"), ICON_NONE); break; case ACT_RANDOM_BOOL_BERNOUILLI: @@ -2004,7 +2006,7 @@ static void draw_actuator_shape_action(uiLayout *layout, PointerRNA *ptr) uiLayout *row; if (ob->type != OB_MESH) { - uiItemL(layout, "Actuator only available for mesh objects", ICON_NONE); + uiItemL(layout, IFACE_("Actuator only available for mesh objects"), ICON_NONE); return; } @@ -2042,7 +2044,7 @@ static void draw_actuator_sound(uiLayout *layout, PointerRNA *ptr, bContext *C) uiTemplateID(layout, C, ptr, "sound", NULL, "SOUND_OT_open", NULL); if (!RNA_pointer_get(ptr, "sound").data) { - uiItemL(layout, "Select a sound from the list or load a new one", ICON_NONE); + uiItemL(layout, IFACE_("Select a sound from the list or load a new one"), ICON_NONE); return; } uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); @@ -2272,11 +2274,11 @@ void logic_buttons(bContext *C, ARegion *ar) layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle()); row = uiLayoutRow(layout, TRUE); - uiDefBlockBut(block, controller_menu, NULL, "Controllers", xco-10, yco, 300, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */ + uiDefBlockBut(block, controller_menu, NULL, IFACE_("Controllers"), xco-10, yco, 300, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */ - uiItemR(row, &logic_ptr, "show_controllers_selected_objects", 0, "Sel", ICON_NONE); - uiItemR(row, &logic_ptr, "show_controllers_active_object", 0, "Act", ICON_NONE); - uiItemR(row, &logic_ptr, "show_controllers_linked_controller", 0, "Link", ICON_NONE); + uiItemR(row, &logic_ptr, "show_controllers_selected_objects", 0, IFACE_("Sel"), ICON_NONE); + uiItemR(row, &logic_ptr, "show_controllers_active_object", 0, IFACE_("Act"), ICON_NONE); + uiItemR(row, &logic_ptr, "show_controllers_linked_controller", 0, IFACE_("Link"), ICON_NONE); for (a=0; a<count; a++) { bController *cont; @@ -2299,11 +2301,11 @@ void logic_buttons(bContext *C, ARegion *ar) uiItemR(split, &settings_ptr, "show_state_panel", UI_ITEM_R_NO_BG, "", ICON_DISCLOSURE_TRI_RIGHT); row = uiLayoutRow(split, TRUE); - uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide controllers"); + uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide controllers")); RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr); uiLayoutSetContextPointer(row, "object", &object_ptr); - uiItemMenuEnumO(row, "LOGIC_OT_controller_add", "type", "Add Controller", ICON_NONE); + uiItemMenuEnumO(row, "LOGIC_OT_controller_add", "type", IFACE_("Add Controller"), ICON_NONE); if (RNA_boolean_get(&settings_ptr, "show_state_panel")) { @@ -2311,8 +2313,8 @@ void logic_buttons(bContext *C, ARegion *ar) split = uiLayoutSplit(box, 0.2f, FALSE); col = uiLayoutColumn(split, FALSE); - uiItemL(col, "Visible", ICON_NONE); - uiItemL(col, "Initial", ICON_NONE); + uiItemL(col, IFACE_("Visible"), ICON_NONE); + uiItemL(col, IFACE_("Initial"), ICON_NONE); subsplit = uiLayoutSplit(split, 0.85f, FALSE); col = uiLayoutColumn(subsplit, FALSE); @@ -2379,12 +2381,12 @@ void logic_buttons(bContext *C, ARegion *ar) layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle()); row = uiLayoutRow(layout, TRUE); - uiDefBlockBut(block, sensor_menu, NULL, "Sensors", xco-10, yco, 300, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */ + uiDefBlockBut(block, sensor_menu, NULL, IFACE_("Sensors"), xco-10, yco, 300, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */ - uiItemR(row, &logic_ptr, "show_sensors_selected_objects", 0, "Sel", ICON_NONE); - uiItemR(row, &logic_ptr, "show_sensors_active_object", 0, "Act", ICON_NONE); - uiItemR(row, &logic_ptr, "show_sensors_linked_controller", 0, "Link", ICON_NONE); - uiItemR(row, &logic_ptr, "show_sensors_active_states", 0, "State", ICON_NONE); + uiItemR(row, &logic_ptr, "show_sensors_selected_objects", 0, IFACE_("Sel"), ICON_NONE); + uiItemR(row, &logic_ptr, "show_sensors_active_object", 0, IFACE_("Act"), ICON_NONE); + uiItemR(row, &logic_ptr, "show_sensors_linked_controller", 0, IFACE_("Link"), ICON_NONE); + uiItemR(row, &logic_ptr, "show_sensors_active_states", 0, IFACE_("State"), ICON_NONE); for (a=0; a<count; a++) { bSensor *sens; @@ -2396,11 +2398,11 @@ void logic_buttons(bContext *C, ARegion *ar) if ((ob->scavisflag & OB_VIS_SENS) == 0) continue; row = uiLayoutRow(layout, TRUE); - uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors"); + uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide sensors")); RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr); uiLayoutSetContextPointer(row, "object", &object_ptr); - uiItemMenuEnumO(row, "LOGIC_OT_sensor_add", "type", "Add Sensor", ICON_NONE); + uiItemMenuEnumO(row, "LOGIC_OT_sensor_add", "type", IFACE_("Add Sensor"), ICON_NONE); if ((ob->scaflag & OB_SHOWSENS) == 0) continue; @@ -2447,12 +2449,12 @@ void logic_buttons(bContext *C, ARegion *ar) layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle()); row = uiLayoutRow(layout, TRUE); - uiDefBlockBut(block, actuator_menu, NULL, "Actuators", xco-10, yco, 300, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */ + uiDefBlockBut(block, actuator_menu, NULL, IFACE_("Actuators"), xco-10, yco, 300, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */ - uiItemR(row, &logic_ptr, "show_actuators_selected_objects", 0, "Sel", ICON_NONE); - uiItemR(row, &logic_ptr, "show_actuators_active_object", 0, "Act", ICON_NONE); - uiItemR(row, &logic_ptr, "show_actuators_linked_controller", 0, "Link", ICON_NONE); - uiItemR(row, &logic_ptr, "show_actuators_active_states", 0, "State", ICON_NONE); + uiItemR(row, &logic_ptr, "show_actuators_selected_objects", 0, IFACE_("Sel"), ICON_NONE); + uiItemR(row, &logic_ptr, "show_actuators_active_object", 0, IFACE_("Act"), ICON_NONE); + uiItemR(row, &logic_ptr, "show_actuators_linked_controller", 0, IFACE_("Link"), ICON_NONE); + uiItemR(row, &logic_ptr, "show_actuators_active_states", 0, IFACE_("State"), ICON_NONE); for (a=0; a<count; a++) { bActuator *act; @@ -2466,11 +2468,11 @@ void logic_buttons(bContext *C, ARegion *ar) } row = uiLayoutRow(layout, TRUE); - uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators"); + uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide actuators")); RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr); uiLayoutSetContextPointer(row, "object", &object_ptr); - uiItemMenuEnumO(row, "LOGIC_OT_actuator_add", "type", "Add Actuator", ICON_NONE); + uiItemMenuEnumO(row, "LOGIC_OT_actuator_add", "type", IFACE_("Add Actuator"), ICON_NONE); if ((ob->scaflag & OB_SHOWACT) == 0) continue; diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index 1a50f72153a..c4ec801d6ed 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -62,20 +62,20 @@ ARegion *logic_has_buttons_region(ScrArea *sa) { ARegion *ar, *arnew; - ar= BKE_area_find_region_type(sa, RGN_TYPE_UI); + ar = BKE_area_find_region_type(sa, RGN_TYPE_UI); if (ar) return ar; /* add subdiv level; after header */ - ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER); + ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER); /* is error! */ - if (ar==NULL) return NULL; + if (ar == NULL) return NULL; arnew= MEM_callocN(sizeof(ARegion), "buttons for image"); BLI_insertlinkafter(&sa->regionbase, ar, arnew); - arnew->regiontype= RGN_TYPE_UI; - arnew->alignment= RGN_ALIGN_LEFT; + arnew->regiontype = RGN_TYPE_UI; + arnew->alignment = RGN_ALIGN_LEFT; arnew->flag = RGN_FLAG_HIDDEN; @@ -129,18 +129,18 @@ static SpaceLink *logic_new(const bContext *UNUSED(C)) ar->v2d.cur.xmax = 1280.0f; ar->v2d.cur.ymax = 240.0f; - ar->v2d.min[0]= 1.0f; - ar->v2d.min[1]= 1.0f; + ar->v2d.min[0] = 1.0f; + ar->v2d.min[1] = 1.0f; - ar->v2d.max[0]= 32000.0f; - ar->v2d.max[1]= 32000.0f; + ar->v2d.max[0] = 32000.0f; + ar->v2d.max[1] = 32000.0f; - ar->v2d.minzoom= 0.5f; - ar->v2d.maxzoom= 1.21f; + ar->v2d.minzoom = 0.5f; + ar->v2d.maxzoom = 1.21f; - ar->v2d.scroll= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM); - ar->v2d.keepzoom= V2D_LIMITZOOM|V2D_KEEPASPECT; - ar->v2d.keeptot= 0; + ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM); + ar->v2d.keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT; + ar->v2d.keeptot = 0; return (SpaceLink *)slogic; diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index badc4dbb533..ad6e66f7a7d 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -71,7 +71,7 @@ static void do_nla_region_buttons(bContext *C, void *UNUSED(arg), int event) { - //Scene *scene= CTX_data_scene(C); + //Scene *scene = CTX_data_scene(C); switch (event) { @@ -157,7 +157,7 @@ static int nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA found = -1; } } - } + } break; } @@ -243,7 +243,7 @@ static void nla_panel_animdata(const bContext *C, Panel *pa) if (!nla_panel_context(C, &adt_ptr, NULL, NULL)) return; - /* adt= adt_ptr.data; */ + /* adt = adt_ptr.data; */ block = uiLayoutGetBlock(layout); uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL); @@ -406,7 +406,7 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa) uiItemR(col, &strip_ptr, "use_animated_influence", 0, NULL, ICON_NONE); sub = uiLayoutColumn(col, TRUE); - uiLayoutSetEnabled(sub, RNA_boolean_get(&strip_ptr, "use_animated_influence")); + uiLayoutSetEnabled(sub, RNA_boolean_get(&strip_ptr, "use_animated_influence")); uiItemR(sub, &strip_ptr, "influence", 0, NULL, ICON_NONE); col = uiLayoutColumn(layout, TRUE); diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index 89a5e9feeef..cf56f254c36 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -200,7 +200,7 @@ static int mouse_nla_channels(bAnimContext *ac, float x, int channel_index, shor } notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); - } + } break; case ANIMTYPE_NLATRACK: diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 5c8e7e99a8c..9091699bd4b 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -163,7 +163,7 @@ static void nla_strip_get_color_inside(AnimData *adt, NlaStrip *strip, float col /* normal, unselected strip - use (hardly noticeable) blue tinge */ UI_GetThemeColor3fv(TH_NLA_TRANSITION, color); } - } + } else if (strip->type == NLASTRIP_TYPE_META) { /* Meta Clip */ // TODO: should temporary metas get different colors too? @@ -528,7 +528,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar) */ v2d->tot.ymin = (float)(-height); - /* loop through channels, and set up drawing depending on their type */ + /* loop through channels, and set up drawing depending on their type */ y = (float)(-NLACHANNEL_HEIGHT(snla)); for (ale = anim_data.first; ale; ale = ale->next) { @@ -628,7 +628,7 @@ static void draw_nla_channel_list_gl(bAnimContext *ac, ListBase *anim_data, View bAnimListElem *ale; float x = 0.0f; - /* loop through channels, and set up drawing depending on their type */ + /* loop through channels, and set up drawing depending on their type */ for (ale = anim_data->first; ale; ale = ale->next) { const float yminc = (float)(y - NLACHANNEL_HEIGHT_HALF(snla)); const float ymaxc = (float)(y + NLACHANNEL_HEIGHT_HALF(snla)); @@ -709,7 +709,7 @@ static void draw_nla_channel_list_gl(bAnimContext *ac, ListBase *anim_data, View // draw backdrops only... ANIM_channel_draw(ac, ale, yminc, ymaxc); break; - } + } /* if special types, draw manually for now... */ if (do_draw) { @@ -737,7 +737,7 @@ static void draw_nla_channel_list_gl(bAnimContext *ac, ListBase *anim_data, View /* even more */ offset = 21; indent = 1; - } + } break; default: @@ -936,7 +936,7 @@ void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - /* loop through channels, and set up drawing depending on their type */ + /* loop through channels, and set up drawing depending on their type */ for (ale = anim_data.first; ale; ale = ale->next) { const float yminc = (float)(y - NLACHANNEL_HEIGHT_HALF(snla)); const float ymaxc = (float)(y + NLACHANNEL_HEIGHT_HALF(snla)); diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index e0e5007aff0..3740c3fae5e 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -123,7 +123,7 @@ static int nlaedit_enable_tweakmode_exec(bContext *C, wmOperator *op) if (anim_data.first == NULL) { BKE_report(op->reports, RPT_ERROR, "No AnimData blocks to enter tweak mode for"); return OPERATOR_CANCELLED; - } + } /* for each AnimData block with NLA-data, try setting it in tweak-mode */ for (ale = anim_data.first; ale; ale = ale->next) { @@ -192,7 +192,7 @@ static int nlaedit_disable_tweakmode_exec(bContext *C, wmOperator *op) if (anim_data.first == NULL) { BKE_report(op->reports, RPT_ERROR, "No AnimData blocks to enter tweak mode for"); return OPERATOR_CANCELLED; - } + } /* for each AnimData block with NLA-data, try exitting tweak-mode */ for (ale = anim_data.first; ale; ale = ale->next) { @@ -266,8 +266,8 @@ static void get_nlastrip_extents(bAnimContext *ac, float *min, float *max, const /* only consider selected strips? */ if ((onlySel == 0) || (strip->flag & NLASTRIP_FLAG_SELECT)) { /* extend range if appropriate */ - *min = minf(*min, strip->start); - *max = maxf(*max, strip->end); + *min = min_ff(*min, strip->start); + *max = max_ff(*max, strip->end); } } } @@ -398,7 +398,7 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op) act = BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "action")); if (act == NULL) { - BKE_report(op->reports, RPT_ERROR, "No valid Action to add"); + BKE_report(op->reports, RPT_ERROR, "No valid action to add"); //printf("Add strip - actname = '%s'\n", actname); return OPERATOR_CANCELLED; } @@ -407,7 +407,7 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op) BKE_reportf(op->reports, RPT_WARNING, "Action '%s' does not specify what datablocks it can be used on " "(try setting the 'ID Root Type' setting from the Datablocks Editor " - "for this Action to avoid future problems)", + "for this action to avoid future problems)", act->id.name + 2); } @@ -433,7 +433,7 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op) */ if ((act->idroot) && (act->idroot != GS(ale->id->name))) { BKE_reportf(op->reports, RPT_ERROR, - "Couldn't add action '%s' as it cannot be used relative to ID-blocks of type '%s'", + "Could not add action '%s' as it cannot be used relative to ID-blocks of type '%s'", act->id.name + 2, ale->id->name); continue; } @@ -1364,7 +1364,7 @@ static int nlaedit_swap_exec(bContext *C, wmOperator *op) "Cannot swap selected strips as they will not be able to fit in their new places"); } else { - BKE_reportf(op->reports, RPT_WARNING, + BKE_reportf(op->reports, RPT_WARNING, "Cannot swap '%s' and '%s' as one or both will not be able to fit in their new places", sa->name, sb->name); } @@ -2023,7 +2023,7 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op) set_active_fmodifier(&strip->modifiers, fcm); else { BKE_reportf(op->reports, RPT_ERROR, - "Modifier couldn't be added to (%s : %s) (see console for details)", + "Modifier could not be added to (%s : %s) (see console for details)", nlt->name, strip->name); } } diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c index 3a74d0b4c9c..54ade829c0d 100644 --- a/source/blender/editors/space_nla/nla_ops.c +++ b/source/blender/editors/space_nla/nla_ops.c @@ -256,7 +256,7 @@ static void nla_keymap_main(wmKeyConfig *keyconf, wmKeyMap *keymap) WM_keymap_add_item(keymap, "NLA_OT_meta_remove", GKEY, KM_PRESS, KM_ALT, 0); /* duplicate */ - WM_keymap_add_item(keymap, "NLA_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_item(keymap, "NLA_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0); /* delete */ WM_keymap_add_item(keymap, "NLA_OT_delete", XKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index 79be0d0a194..97553b7aa56 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -390,7 +390,7 @@ static void nlaedit_select_leftright(bContext *C, bAnimContext *ac, short leftri if (leftright == NLAEDIT_LRSEL_LEFT) { xmin = MINAFRAMEF; xmax = (float)(CFRA + 0.1f); - } + } else { xmin = (float)(CFRA - 0.1f); xmax = MAXFRAMEF; @@ -471,7 +471,7 @@ static int nlaedit_select_leftright_invoke(bContext *C, wmOperator *op, wmEvent UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL); if (x < CFRA) RNA_int_set(op->ptr, "mode", NLAEDIT_LRSEL_LEFT); - else + else RNA_int_set(op->ptr, "mode", NLAEDIT_LRSEL_RIGHT); } @@ -582,7 +582,7 @@ static void mouse_nla_strips(bContext *C, bAnimContext *ac, const int mval[2], s ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); /* Highlight NLA-Track */ - if (ale->type == ANIMTYPE_NLATRACK) { + if (ale->type == ANIMTYPE_NLATRACK) { NlaTrack *nlt = (NlaTrack *)ale->data; nlt->flag |= NLATRACK_SELECTED; diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 67508f2087a..711944809fd 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -834,7 +834,7 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN layout = uiBlockLayout(gnode->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, (int)(rect.xmin + NODE_MARGIN_X), (int)(rect.ymax + (group_header - (2.5f * dpi_fac))), - mini((int)(BLI_rctf_size_x(&rect) - 18.0f), node_group_frame + 20), group_header, UI_GetStyle()); + min_ii((int)(BLI_rctf_size_x(&rect) - 18.0f), node_group_frame + 20), group_header, UI_GetStyle()); RNA_pointer_create(&ntree->id, &RNA_Node, gnode, &ptr); uiTemplateIDBrowse(layout, (bContext *)C, &ptr, "node_tree", NULL, NULL, NULL); uiBlockLayoutResolve(gnode->block, NULL, NULL); @@ -895,11 +895,6 @@ static void node_uifunc_group(uiLayout *layout, bContext *C, PointerRNA *ptr) uiTemplateIDBrowse(layout, C, ptr, "node_tree", NULL, NULL, NULL); } -static void node_common_buts_whileloop(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "max_iterations", 0, NULL, ICON_NONE); -} - /* XXX Does a bounding box update by iterating over all children. * Not ideal to do this in every draw call, but doing as transform callback doesn't work, * since the child node totr rects are not updated properly at that point. @@ -1179,16 +1174,6 @@ static void node_common_set_butfunc(bNodeType *ntype) ntype->drawfunc = node_draw_group; ntype->drawupdatefunc = node_update_group; break; - case NODE_FORLOOP: -// ntype->uifunc= node_common_buts_group; - ntype->drawfunc = node_draw_group; - ntype->drawupdatefunc = node_update_group; - break; - case NODE_WHILELOOP: - ntype->uifunc = node_common_buts_whileloop; - ntype->drawfunc = node_draw_group; - ntype->drawupdatefunc = node_update_group; - break; case NODE_FRAME: ntype->drawfunc = node_draw_frame; ntype->drawupdatefunc = node_update_frame; @@ -2595,7 +2580,7 @@ static void node_composit_buts_keyingscreen(uiLayout *layout, bContext *C, Point static void node_composit_buts_keying(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - /* bNode *node= ptr->data; */ /* UNUSED */ + /* bNode *node = ptr->data; */ /* UNUSED */ uiItemR(layout, ptr, "blur_pre", 0, NULL, ICON_NONE); uiItemR(layout, ptr, "screen_balance", 0, NULL, ICON_NONE); @@ -3226,7 +3211,7 @@ static void draw_nodespace_back_tex(ScrArea *sa, SpaceNode *snode) float zoomx, zoomy; zoomx = (float)sa->winx / ibuf->x; zoomy = (float)sa->winy / ibuf->y; - zoom = minf(zoomx, zoomy); + zoom = min_ff(zoomx, zoomy); } x = (sa->winx - zoom * ibuf->x) / 2 + snode->xof; @@ -3557,7 +3542,7 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link) } do_shaded = TRUE; do_triple = TRUE; - } + } else { th_col1 = TH_REDALERT; } diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index 99d49fa1e8f..df8a6f94d24 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -35,6 +35,8 @@ #include "BLI_math.h" +#include "BLF_translation.h" + #include "BKE_context.h" #include "BKE_image.h" #include "BKE_library.h" @@ -240,7 +242,8 @@ static int node_add_file_exec(bContext *C, wmOperator *op) ima = BKE_image_load_exists(path); if (!ima) { - BKE_reportf(op->reports, RPT_ERROR, "Can't read image: \"%s\", %s", path, errno ? strerror(errno) : "Unsupported format"); + BKE_reportf(op->reports, RPT_ERROR, "Cannot read image '%s': %s", + path, errno ? strerror(errno) : TIP_("unsupported format")); return OPERATOR_CANCELLED; } } @@ -250,7 +253,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op) ima = (Image *)BKE_libblock_find_name(ID_IM, name); if (!ima) { - BKE_reportf(op->reports, RPT_ERROR, "Image named \"%s\", not found", name); + BKE_reportf(op->reports, RPT_ERROR, "Image '%s' not found", name); return OPERATOR_CANCELLED; } } diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 379e9987c4c..1d3b21fe2d6 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -101,7 +101,7 @@ void ED_node_changed_update(ID *id, bNode *node) nodeUpdateID(nodetree, node->id); WM_main_add_notifier(NC_SCENE | ND_NODES, id); - } + } else if (treetype == NTREE_TEXTURE) { DAG_id_tag_update(id, 0); WM_main_add_notifier(NC_TEXTURE | ND_NODES, id); @@ -391,7 +391,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node) node->totr.xmin = locx; node->totr.xmax = locx + node->width; node->totr.ymax = locy; - node->totr.ymin = minf(dy, locy - 2 * NODE_DY); + node->totr.ymin = min_ff(dy, locy - 2 * NODE_DY); /* Set the block bounds to clip mouse events from underlying nodes. * Add a margin for sockets on each side. @@ -506,25 +506,16 @@ int node_get_colorid(bNode *node) /* note: in node_edit.c is similar code, for untangle node */ static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node) { - ListBase links; bNodeLink *link; - if (node->typeinfo->internal_connect == NULL) - return; - - /* Get default muting links. */ - links = node->typeinfo->internal_connect(snode->edittree, node); - glEnable(GL_BLEND); glEnable(GL_LINE_SMOOTH); - for (link = links.first; link; link = link->next) + for (link = node->internal_links.first; link; link = link->next) node_draw_link_bezier(v2d, snode, link, TH_REDALERT, 0, TH_WIRE, 0, TH_WIRE); glDisable(GL_BLEND); glDisable(GL_LINE_SMOOTH); - - BLI_freelistN(&links); } /* this might have some more generic use */ @@ -668,7 +659,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN bNodeSocket *sock; rctf *rct = &node->totr; float iconofs; - /* float socket_size= NODE_SOCKSIZE*U.dpi/72; */ /* UNUSED */ + /* float socket_size = NODE_SOCKSIZE*U.dpi/72; */ /* UNUSED */ float iconbutw = 0.8f * UI_UNIT_X; int color_id = node_get_colorid(node); char showname[128]; /* 128 used below */ @@ -915,7 +906,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b /* disable lines */ if (node->flag & NODE_MUTED) - node_draw_mute_line(&ar->v2d, snode, node); + node_draw_mute_line(&ar->v2d, snode, node); if (node->flag & SELECT) UI_ThemeColor(TH_SELECT); @@ -932,7 +923,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b (int)(rct->xmin + (NODE_MARGIN_X / snode->aspect_sqrt)), (int)(centy - 10), (short)(BLI_rctf_size_x(rct) - 18.0f - 12.0f), (short)NODE_DY, NULL, 0, 0, 0, 0, ""); - } + } /* scale widget thing */ UI_ThemeColorShade(color_id, -10); @@ -1108,7 +1099,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d) /* aspect+font, set each time */ snode->aspect = BLI_rctf_size_x(&v2d->cur) / (float)ar->winx; snode->aspect_sqrt = sqrtf(snode->aspect); - // XXX snode->curfont= uiSetCurFont_ext(snode->aspect); + // XXX snode->curfont = uiSetCurFont_ext(snode->aspect); /* grid */ UI_view2d_multi_grid_draw(v2d, 25.0f, 5, 2); @@ -1138,7 +1129,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d) #ifdef WITH_COMPOSITOR if (snode->nodetree->type == NTREE_COMPOSIT) { COM_startReadHighlights(); - } + } #endif node_draw_nodetree(C, ar, snode, snode->nodetree); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index f0afc647ed5..f21f343ea2b 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1622,7 +1622,7 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op)) for (node = snode->edittree->nodes.first; node; node = node->next) { /* Only allow muting of nodes having a mute func! */ - if ((node->flag & SELECT) && node->typeinfo->internal_connect) { + if ((node->flag & SELECT) && node->typeinfo->update_internal_links) { node->flag ^= NODE_MUTED; snode_update(snode, node); } @@ -1972,7 +1972,7 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op)) } /* transform to basic view space. child node location is relative to parent */ - if (!new_node->parent) { + if (!new_node->parent) { new_node->locx += gnode_x; new_node->locy += gnode_y; } diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index 5ab698cd415..e82917feb21 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -138,12 +138,6 @@ static void do_node_add_group(bContext *C, void *UNUSED(arg), int event) case NODE_GROUP: ntemp.ngroup = ntreeAddTree("Group", snode->treetype, ntemp.type); break; - case NODE_FORLOOP: - ntemp.ngroup = ntreeAddTree("For Loop", snode->treetype, ntemp.type); - break; - case NODE_WHILELOOP: - ntemp.ngroup = ntreeAddTree("While Loop", snode->treetype, ntemp.type); - break; default: ntemp.ngroup = NULL; } @@ -199,15 +193,11 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass) /* XXX hack: negative numbers used for empty group types */ if (node_tree_has_type(ntree->type, NODE_GROUP)) uiItemV(layout, IFACE_("New Group"), 0, -NODE_GROUP); - if (node_tree_has_type(ntree->type, NODE_FORLOOP)) - uiItemV(layout, IFACE_("New For Loop"), 0, -NODE_FORLOOP); - if (node_tree_has_type(ntree->type, NODE_WHILELOOP)) - uiItemV(layout, IFACE_("New While Loop"), 0, -NODE_WHILELOOP); uiItemS(layout); for (ngroup = bmain->nodetree.first, event = 0; ngroup; ngroup = ngroup->id.next, ++event) { /* only use group trees */ - if (ngroup->type == ntree->type && ELEM3(ngroup->nodetype, NODE_GROUP, NODE_FORLOOP, NODE_WHILELOOP)) { + if (ngroup->type == ntree->type && ngroup->nodetype == NODE_GROUP) { uiItemV(layout, ngroup->id.name + 2, 0, event); } } diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index fec7366ee73..7fa48c48ad6 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -136,7 +136,7 @@ static bNodeSocket *best_socket_input(bNodeTree *ntree, bNode *node, int num, in int a = 0; for (sock = node->inputs.first; sock; sock = sock->next) { - maxtype = MAX2(sock->type, maxtype); + maxtype = max_ii(sock->type, maxtype); } /* find sockets of higher 'types' first (i.e. image) */ @@ -1368,7 +1368,7 @@ static bNodeSocket *socket_best_match(ListBase *sockets) /* find type range */ for (sock = sockets->first; sock; sock = sock->next) - maxtype = MAX2(sock->type, maxtype); + maxtype = max_ii(sock->type, maxtype); /* try all types, starting from 'highest' (i.e. colors, vectors, values) */ for (type = maxtype; type >= 0; --type) { diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c index 42480c0c2d9..d4df449a41b 100644 --- a/source/blender/editors/space_node/node_templates.c +++ b/source/blender/editors/space_node/node_templates.c @@ -122,6 +122,7 @@ static void node_socket_disconnect(Main *bmain, bNodeTree *ntree, bNode *node_to return; nodeRemLink(ntree, sock_to->link); + sock_to->flag |= SOCK_COLLAPSED; nodeUpdate(ntree, node_to); ntreeUpdateTree(ntree); @@ -136,6 +137,7 @@ static void node_socket_remove(Main *bmain, bNodeTree *ntree, bNode *node_to, bN return; node_remove_linked(ntree, sock_to->link->fromnode); + sock_to->flag |= SOCK_COLLAPSED; nodeUpdate(ntree, node_to); ntreeUpdateTree(ntree); @@ -185,6 +187,7 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t /* add link */ sock_from_tmp = BLI_findlink(&node_from->outputs, sock_num); nodeAddLink(ntree, node_from, sock_from_tmp, node_to, sock_to); + sock_to->flag &= ~SOCK_COLLAPSED; /* copy input sockets from previous node */ if (node_prev && node_from != node_prev) { @@ -613,7 +616,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree, /* input linked to a node */ uiTemplateNodeLink(split, ntree, node, input); - if (!(input->flag & SOCK_COLLAPSED)) { + if (depth == 0 || !(input->flag & SOCK_COLLAPSED)) { if (depth == 0) uiItemS(layout); diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 76d1357a83c..4d2512cdc93 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -111,7 +111,6 @@ static SpaceLink *node_new(const bContext *UNUSED(C)) BLI_addtail(&snode->regionbase, ar); ar->regiontype = RGN_TYPE_UI; ar->alignment = RGN_ALIGN_RIGHT; - ar->flag = RGN_FLAG_HIDDEN; /* main area */ ar = MEM_callocN(sizeof(ARegion), "main area for node"); diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index d2e47427b94..c4afe32e85f 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -36,6 +36,7 @@ #include "DNA_scene_types.h" #include "DNA_sequence_types.h" +#include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" @@ -92,7 +93,7 @@ static void outliner_width(SpaceOops *soops, ListBase *lb, int *w) { TreeElement *te = lb->first; while (te) { -// TreeStoreElem *tselem= TREESTORE(te); +// TreeStoreElem *tselem = TREESTORE(te); // XXX fixme... te->xend is not set yet if (!TSELEM_OPEN(tselem, soops)) { @@ -238,9 +239,9 @@ static int group_select_flag(Group *gr) void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag) { - Scene *scene = (Scene *)poin; + Scene *scene = (Scene *)poin; GroupObject *gob; - Group *gr = (Group *)poin2; + Group *gr = (Group *)poin2; if (group_restrict_flag(gr, flag)) { for (gob = gr->gobject.first; gob; gob = gob->next) { @@ -309,7 +310,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) WM_event_add_notifier(C, NC_SCENE, NULL); break; default: WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL); break; - } + } /* Check the library target exists */ if (te->idcode == ID_LI) { Library *lib = (Library *)tselem->id; @@ -627,7 +628,7 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi) search[0] = 0; block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS); - uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_RET_1); + uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_SEARCH_MENU); /* fake button, it holds space for search items */ uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL); @@ -636,7 +637,7 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi) uiButSetSearchFunc(but, operator_search_cb, arg_kmi, operator_call_cb, ot); uiBoundsBlock(block, 6); - uiBlockSetDirection(block, UI_DOWN); + uiBlockSetDirection(block, UI_DOWN); uiEndBlock(C, block); event = *(win->eventstate); /* XXX huh huh? make api call */ @@ -1000,6 +1001,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto case eModifierType_Bevel: UI_icon_draw(x, y, ICON_MOD_BEVEL); break; case eModifierType_Smooth: + case eModifierType_LaplacianSmooth: UI_icon_draw(x, y, ICON_MOD_SMOOTH); break; case eModifierType_SimpleDeform: UI_icon_draw(x, y, ICON_MOD_SIMPLEDEFORM); break; @@ -1251,7 +1253,7 @@ static void outliner_set_coord_tree_element(SpaceOops *soops, TreeElement *te, i for (ten = te->subtree.first; ten; ten = ten->next) { outliner_set_coord_tree_element(soops, ten, startx + UI_UNIT_X, starty); - } + } } @@ -1396,7 +1398,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene UI_icon_draw((float)startx + offsx, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_DIRECT); glPixelTransferf(GL_ALPHA_SCALE, 1.0f); offsx += UI_UNIT_X; - } + } glDisable(GL_BLEND); /* name */ @@ -1433,7 +1435,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene } } } - } + } /* store coord and continue, we need coordinates for elements outside view too */ te->xs = (float)startx; te->ys = (float)*starty; @@ -1444,7 +1446,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene for (ten = te->subtree.first; ten; ten = ten->next) outliner_draw_tree_element(C, block, scene, ar, soops, ten, startx + UI_UNIT_X, starty); - } + } else { for (ten = te->subtree.first; ten; ten = ten->next) outliner_set_coord_tree_element(soops, te, startx, starty); @@ -1648,7 +1650,7 @@ void draw_outliner(const bContext *C) /* get actual width of column 1 */ outliner_rna_width(soops, &soops->tree, &sizex_rna, 0); - sizex_rna = MAX2(OL_RNA_COLX, sizex_rna + OL_RNA_COL_SPACEX); + sizex_rna = max_ii(OL_RNA_COLX, sizex_rna + OL_RNA_COL_SPACEX); /* get width of data (for setting 'tot' rect, this is column 1 + column 2 + a bit extra) */ if (soops->outlinevis == SO_KEYMAP) @@ -1701,7 +1703,7 @@ void draw_outliner(const bContext *C) } /* draw edit buttons if nessecery */ - outliner_buttons(C, block, ar, soops, &soops->tree); + outliner_buttons(C, block, ar, soops, &soops->tree); uiEndBlock(C, block); uiDrawBlock(C, block); diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 8f059b0a735..23766d6a6fe 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -81,7 +81,7 @@ static int outliner_open_back(SpaceOops *soops, TreeElement *te) for (te = te->parent; te; te = te->parent) { tselem = TREESTORE(te); - if (tselem->flag & TSE_CLOSED) { + if (tselem->flag & TSE_CLOSED) { tselem->flag &= ~TSE_CLOSED; retval = 1; } @@ -197,10 +197,10 @@ static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, } else if (tselem->id->lib) { // XXX error_libdata(); - } + } else if (te->idcode == ID_LI && te->parent) { BKE_report(reports, RPT_WARNING, "Cannot edit the path of an indirectly linked library"); - } + } else { tselem->flag |= TSE_TEXTBUT; ED_region_tag_redraw(ar); @@ -730,7 +730,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so /* determine which type of search to do */ if (again && last_find) { - /* no popup panel - previous + user wanted to search for next after previous */ + /* no popup panel - previous + user wanted to search for next after previous */ BLI_strncpy(name, soops->search_string, sizeof(name)); flags = soops->search_flags; @@ -746,7 +746,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so /* pop up panel - no previous, or user didn't want search after previous */ name[0] = '\0'; // XXX if (sbutton(name, 0, sizeof(name)-1, "Find: ") && name[0]) { -// te= outliner_find_name(soops, &soops->tree, name, flags, NULL, &prevFound); +// te = outliner_find_name(soops, &soops->tree, name, flags, NULL, &prevFound); // } // else return; /* XXX RETURN! XXX */ } @@ -786,7 +786,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so } else { /* no tree-element found */ - BKE_report(reports, RPT_WARNING, "Not found: %s", name); + BKE_reportf(reports, RPT_WARNING, "Not found: %s", name); } } #endif @@ -998,7 +998,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle char buf[128], *name; temnext = (TreeElement *)(ld->next->data); - /* tsenext= TREESTORE(temnext); */ /* UNUSED */ + /* tsenext = TREESTORE(temnext); */ /* UNUSED */ nextptr = &temnext->rnaptr; name = RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf), NULL); @@ -1858,7 +1858,7 @@ static int material_drop_invoke(bContext *C, wmOperator *op, wmEvent *event) assign_material(ob, ma, ob->totcol + 1, BKE_MAT_ASSIGN_USERPREF); DAG_ids_flush_update(bmain, 0); - WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING, ma); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 823de61d044..4668dfa1386 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -236,7 +236,7 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo if (ob == NULL) return 0; // no active object - /*tselem= TREESTORE(te);*/ /*UNUSED*/ + /*tselem = TREESTORE(te);*/ /*UNUSED*/ /* find buttons area (note, this is undefined really still, needs recode in blender) */ /* XXX removed finding sbuts */ @@ -250,8 +250,8 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo if (set) { if (sbuts) { - // XXX sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c - // XXX sbuts->texfrom= 1; + // XXX sbuts->tabo = TAB_SHADING_TEX; // hack from header_buttonswin.c + // XXX sbuts->texfrom = 1; } // XXX extern_set_butspace(F6KEY, 0); // force shading buttons texture wrld->texact = te->index; @@ -264,8 +264,8 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo Lamp *la = (Lamp *)tselemp->id; if (set) { if (sbuts) { - // XXX sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c - // XXX sbuts->texfrom= 2; + // XXX sbuts->tabo = TAB_SHADING_TEX; // hack from header_buttonswin.c + // XXX sbuts->texfrom = 2; } // XXX extern_set_butspace(F6KEY, 0); // force shading buttons texture la->texact = te->index; @@ -280,8 +280,8 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo Material *ma = (Material *)tselemp->id; if (set) { if (sbuts) { - //sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c - // XXX sbuts->texfrom= 0; + //sbuts->tabo = TAB_SHADING_TEX; // hack from header_buttonswin.c + // XXX sbuts->texfrom = 0; } // XXX extern_set_butspace(F6KEY, 0); // force shading buttons texture ma->texact = (char)te->index; diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index e4cd971dbd5..5fb9780c700 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -811,7 +811,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) ED_undo_push(C, "Unlink world"); break; default: - BKE_report(op->reports, RPT_WARNING, "Not yet"); + BKE_report(op->reports, RPT_WARNING, "Not yet implemented"); break; } } @@ -844,7 +844,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) break; default: - BKE_report(op->reports, RPT_WARNING, "Not yet"); + BKE_report(op->reports, RPT_WARNING, "Not yet implemented"); break; } } @@ -974,7 +974,7 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op) act = BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "action")); if (act == NULL) { - BKE_report(op->reports, RPT_ERROR, "No valid Action to add"); + BKE_report(op->reports, RPT_ERROR, "No valid action to add"); return OPERATOR_CANCELLED; } else if (act->idroot == 0) { @@ -982,7 +982,7 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op) BKE_reportf(op->reports, RPT_WARNING, "Action '%s' does not specify what datablocks it can be used on " "(try setting the 'ID Root Type' setting from the Datablocks Editor " - "for this Action to avoid future problems)", + "for this action to avoid future problems)", act->id.name + 2); } @@ -1202,6 +1202,7 @@ static int outliner_data_operation_exec(bContext *C, wmOperator *op) break; default: + BKE_report(op->reports, RPT_WARNING, "Not yet implemented"); break; } diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index ef0542130ea..af890a81ad6 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -553,16 +553,16 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree if (md->type == eModifierType_Lattice) { outliner_add_element(soops, &te->subtree, ((LatticeModifierData *) md)->object, te, TSE_LINKED_OB, 0); - } + } else if (md->type == eModifierType_Curve) { outliner_add_element(soops, &te->subtree, ((CurveModifierData *) md)->object, te, TSE_LINKED_OB, 0); - } + } else if (md->type == eModifierType_Armature) { outliner_add_element(soops, &te->subtree, ((ArmatureModifierData *) md)->object, te, TSE_LINKED_OB, 0); - } + } else if (md->type == eModifierType_Hook) { outliner_add_element(soops, &te->subtree, ((HookModifierData *) md)->object, te, TSE_LINKED_OB, 0); - } + } else if (md->type == eModifierType_ParticleSystem) { TreeElement *ten; ParticleSystem *psys = ((ParticleSystemModifierData *) md)->psys; @@ -590,7 +590,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree /* duplicated group */ if (ob->dup_group) - outliner_add_element(soops, &te->subtree, ob->dup_group, te, 0, 0); + outliner_add_element(soops, &te->subtree, ob->dup_group, te, 0, 0); } // can be inlined if necessary @@ -731,7 +731,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor case ID_AC: { // XXX do we want to be exposing the F-Curves here? - //bAction *act= (bAction *)id; + //bAction *act = (bAction *)id; } break; case ID_AR: @@ -1148,7 +1148,7 @@ static void outliner_add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *t } if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) - /* ch= */ /* UNUSED */ outliner_add_element(soops, &te->subtree, (void *)p, te, TSE_SEQUENCE, index); + /* ch = */ /* UNUSED */ outliner_add_element(soops, &te->subtree, (void *)p, te, TSE_SEQUENCE, index); p = p->next; } } @@ -1531,7 +1531,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) while (seq) { op = need_add_seq_dup(seq); if (op == 1) { - /* ten= */ outliner_add_element(soops, &soops->tree, (void *)seq, NULL, TSE_SEQUENCE, 0); + /* ten = */ outliner_add_element(soops, &soops->tree, (void *)seq, NULL, TSE_SEQUENCE, 0); } else if (op == 0) { ten = outliner_add_element(soops, &soops->tree, (void *)seq, NULL, TSE_SEQUENCE_DUP, 0); @@ -1569,7 +1569,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) wmKeyMap *km; for (km = wm->defaultconf->keymaps.first; km; km = km->next) { - /* ten= */ outliner_add_element(soops, &soops->tree, (void *)km, NULL, TSE_KEYMAP, 0); + /* ten = */ outliner_add_element(soops, &soops->tree, (void *)km, NULL, TSE_KEYMAP, 0); } } else { diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt index c1f7fc942e4..f108d9f1aaa 100644 --- a/source/blender/editors/space_sequencer/CMakeLists.txt +++ b/source/blender/editors/space_sequencer/CMakeLists.txt @@ -57,4 +57,8 @@ if(WITH_AUDASPACE) add_definitions(-DWITH_AUDASPACE) endif() +if(WITH_INTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) +endif() + blender_add_lib(bf_editor_space_sequencer "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_sequencer/SConscript b/source/blender/editors/space_sequencer/SConscript index ec06eacae9c..0b429ae750b 100644 --- a/source/blender/editors/space_sequencer/SConscript +++ b/source/blender/editors/space_sequencer/SConscript @@ -8,7 +8,12 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../makesrna ../../blenloader ../../blenfont' incs += ' #/intern/audaspace/intern' +defs = [] + if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] -env.BlenderLib ( 'bf_editors_space_sequencer', sources, Split(incs), [], libtype=['core'], priority=[100] ) +if env['WITH_BF_INTERNATIONAL']: + defs.append('WITH_INTERNATIONAL') + +env.BlenderLib ( 'bf_editors_space_sequencer', sources, Split(incs), defs, libtype=['core'], priority=[100] ) diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index ff895c06d57..fd46f69da83 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -325,7 +325,7 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op) clip = BLI_findlink(&CTX_data_main(C)->movieclip, RNA_enum_get(op->ptr, "clip")); if (clip == NULL) { - BKE_report(op->reports, RPT_ERROR, "MovieClip not found"); + BKE_report(op->reports, RPT_ERROR, "Movie clip not found"); return OPERATOR_CANCELLED; } @@ -553,7 +553,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad } if (seq_load.tot_success == 0) { - BKE_reportf(op->reports, RPT_ERROR, "File \"%s\" could not be loaded", seq_load.path); + BKE_reportf(op->reports, RPT_ERROR, "File '%s' could not be loaded", seq_load.path); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 7bec530fae9..29babd355ad 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -355,7 +355,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_cla y2 = seq->machine + SEQ_STRIP_OFSTOP; /* set up co-ordinates/dimensions for either left or right handle */ - if (direction == SEQ_LEFTHANDLE) { + if (direction == SEQ_LEFTHANDLE) { rx1 = x1; rx2 = x1 + handsize_clamped * 0.75f; @@ -415,7 +415,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_cla y1 = y2 + 0.05f; } UI_view2d_text_cache_add(v2d, x1, y1, numstr, col); - } + } } static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq) @@ -810,7 +810,7 @@ static void UNUSED_FUNCTION(set_special_seq_update) (int val) /* if mouse over a sequence && LEFTMOUSE */ if (val) { -// XXX special_seq_update= find_nearest_seq(&x); +// XXX special_seq_update = find_nearest_seq(&x); } else special_seq_update = NULL; } @@ -1189,7 +1189,7 @@ static void draw_seq_backdrop(View2D *v2d) glRectf(v2d->cur.xmin, -1.0, v2d->cur.xmax, 1.0); /* Alternating horizontal stripes */ - i = maxi(1, ((int)v2d->cur.ymin) - 1); + i = max_ii(1, ((int)v2d->cur.ymin) - 1); glBegin(GL_QUADS); while (i < v2d->cur.ymax) { @@ -1208,7 +1208,7 @@ static void draw_seq_backdrop(View2D *v2d) glEnd(); /* Darker lines separating the horizontal bands */ - i = maxi(1, ((int)v2d->cur.ymin) - 1); + i = max_ii(1, ((int)v2d->cur.ymin) - 1); UI_ThemeColor(TH_GRID); glBegin(GL_LINES); @@ -1240,8 +1240,8 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) /* boundbox and selection tests for NOT drawing the strip... */ if ((seq->flag & SELECT) != sel) continue; else if (seq == last_seq) continue; - else if (MIN2(seq->startdisp, seq->start) > v2d->cur.xmax) continue; - else if (MAX2(seq->enddisp, seq->start + seq->len) < v2d->cur.xmin) continue; + else if (min_ii(seq->startdisp, seq->start) > v2d->cur.xmax) continue; + else if (max_ii(seq->enddisp, seq->start + seq->len) < v2d->cur.xmin) continue; else if (seq->machine + 1.0f < v2d->cur.ymin) continue; else if (seq->machine > v2d->cur.ymax) continue; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 82d08be4da2..7270516aa51 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -46,6 +46,8 @@ #include "BLI_utildefines.h" #include "BLI_threads.h" +#include "BLF_translation.h" + #include "DNA_scene_types.h" #include "DNA_userdef_types.h" @@ -507,7 +509,7 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT) { if (seq->type == SEQ_TYPE_SOUND_RAM && BKE_sequence_effect_get_num_inputs(type) != 0) { - *error_str = "Can't apply effects to audio sequence strips"; + *error_str = N_("Cannot apply effects to audio sequence strips"); return 0; } if ((seq != activeseq) && (seq != seq2)) { @@ -515,7 +517,7 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen else if (seq1 == NULL) seq1 = seq; else if (seq3 == NULL) seq3 = seq; else { - *error_str = "Can't apply effect to more than 3 sequence strips"; + *error_str = N_("Cannot apply effect to more than 3 sequence strips"); return 0; } } @@ -537,21 +539,21 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen return 1; /* succsess */ case 1: if (seq2 == NULL) { - *error_str = "Need at least one selected sequence strip"; + *error_str = N_("At least one selected sequence strip is needed"); return 0; } if (seq1 == NULL) seq1 = seq2; if (seq3 == NULL) seq3 = seq2; case 2: if (seq1 == NULL || seq2 == NULL) { - *error_str = "Need 2 selected sequence strips"; + *error_str = N_("2 selected sequence strips are needed"); return 0; } if (seq3 == NULL) seq3 = seq2; } if (seq1 == NULL && seq2 == NULL && seq3 == NULL) { - *error_str = "TODO: in what cases does this happen?"; + *error_str = N_("TODO: in what cases does this happen?"); return 0; } @@ -680,7 +682,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) seqn = BKE_sequence_dupli_recursive(scene, NULL, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM); } - if (seqn) { + if (seqn) { seqn->flag |= SELECT; /* Second Strip! */ @@ -701,7 +703,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) seqn->anim_startofs += cutframe - ts.start; seqn->anim_endofs = ts.anim_endofs; seqn->endstill = ts.endstill; - } + } /* strips with extended stillframes after */ else if (((seqn->start + seqn->len) < cutframe) && (seqn->endstill)) { @@ -773,7 +775,7 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) seqn = BKE_sequence_dupli_recursive(scene, NULL, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM); } - if (seqn) { + if (seqn) { seqn->flag |= SELECT; /* Second Strip! */ @@ -791,7 +793,7 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) seqn->startofs = cutframe - ts.start; seqn->endofs = ts.endofs; seqn->endstill = ts.endstill; - } + } /* strips with extended stillframes after */ else if (((seqn->start + seqn->len) < cutframe) && (seqn->endstill)) { @@ -1056,7 +1058,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op) { if ((seq->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) == 0) { /* simple but no anim update */ - /* seq->start= snap_frame-seq->startofs+seq->startstill; */ + /* seq->start = snap_frame-seq->startofs+seq->startstill; */ BKE_sequence_translate(scene, seq, (snap_frame - seq->startofs + seq->startstill) - seq->start); } @@ -1384,7 +1386,7 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op) seq_is_predecessor(seq2, last_seq) || seq_is_predecessor(seq3, last_seq)) { - BKE_report(op->reports, RPT_ERROR, "Can't reassign inputs: no cycles allowed"); + BKE_report(op->reports, RPT_ERROR, "Cannot reassign inputs: no cycles allowed"); return OPERATOR_CANCELLED; } @@ -1952,7 +1954,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) while (seq) { next = seq->next; if (seq != seqm && (seq->flag & SELECT)) { - channel_max = MAX2(seq->machine, channel_max); + channel_max = max_ii(seq->machine, channel_max); BLI_remlink(ed->seqbasep, seq); BLI_addtail(&seqm->seqbase, seq); } @@ -2129,7 +2131,7 @@ static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op)) zoomY = ((float)height) / ((float)imgheight); sseq->zoom = (zoomX < zoomY) ? zoomX : zoomY; - sseq->zoom = 1.0f / power_of_2(1 / minf(zoomX, zoomY)); + sseq->zoom = 1.0f / power_of_2(1 / min_ff(zoomX, zoomY)); } else { sseq->zoom = 1.0f; @@ -2255,11 +2257,11 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT) { - xmin = MIN2(xmin, seq->startdisp); - xmax = MAX2(xmax, seq->enddisp); + xmin = min_ii(xmin, seq->startdisp); + xmax = max_ii(xmax, seq->enddisp); - ymin = MIN2(ymin, seq->machine); - ymax = MAX2(ymax, seq->machine); + ymin = min_ii(ymin, seq->machine); + ymax = max_ii(ymax, seq->machine); } } @@ -2905,7 +2907,7 @@ static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op) } if (*seq_1 == NULL || *seq_2 == NULL) { - BKE_report(op->reports, RPT_ERROR, "One of the effect inputs is unset, can't swap"); + BKE_report(op->reports, RPT_ERROR, "One of the effect inputs is unset, cannot swap"); return OPERATOR_CANCELLED; } else { @@ -3042,7 +3044,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) seq->anim_startofs = seq->anim_endofs = 0; /* correct start/end frames so we don't move - * important not to set seq->len= len; allow the function to handle it */ + * important not to set seq->len = len; allow the function to handle it */ BKE_sequence_reload_new_file(scene, seq, TRUE); BKE_sequence_calc(scene, seq); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index be33b782fdf..c4df89547ef 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -353,7 +353,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) } else { /* deselect_markers(0, 0); */ /* XXX, in 2.4x, seq selection used to deselect all, need to re-thnik this for 2.5 */ - marker->flag |= SELECT; + marker->flag |= SELECT; } } @@ -399,7 +399,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) } } else { - // seq= find_nearest_seq(scene, v2d, &hand, mval); + // seq = find_nearest_seq(scene, v2d, &hand, mval); act_orig = ed->act_seq; @@ -1167,7 +1167,7 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op) extend = RNA_boolean_get(op->ptr, "extend"); if (actseq == NULL) { - BKE_report(op->reports, RPT_ERROR, "No Active Sequence!"); + BKE_report(op->reports, RPT_ERROR, "No active sequence!"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 7bfe58cb50a..e8d47016608 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -311,7 +311,7 @@ static SpaceLink *sequencer_duplicate(SpaceLink *sl) SpaceSeq *sseqn = MEM_dupallocN(sl); /* clear or remove stuff from old */ -// XXX sseq->gpd= gpencil_data_duplicate(sseq->gpd); +// XXX sseq->gpd = gpencil_data_duplicate(sseq->gpd); return (SpaceLink *)sseqn; } @@ -363,7 +363,7 @@ static void sequencer_main_area_init(wmWindowManager *wm, ARegion *ar) static void sequencer_main_area_draw(const bContext *C, ARegion *ar) { -// ScrArea *sa= CTX_wm_area(C); +// ScrArea *sa = CTX_wm_area(C); /* NLE - strip editing timeline interface */ draw_timeline_seq(C, ar); diff --git a/source/blender/editors/space_text/CMakeLists.txt b/source/blender/editors/space_text/CMakeLists.txt index ead7de92c5c..9cc407f0604 100644 --- a/source/blender/editors/space_text/CMakeLists.txt +++ b/source/blender/editors/space_text/CMakeLists.txt @@ -54,4 +54,8 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() +if(WITH_INTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) +endif() + blender_add_lib(bf_editor_text "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_text/SConscript b/source/blender/editors/space_text/SConscript index 6ad6427f1d3..373564520c8 100644 --- a/source/blender/editors/space_text/SConscript +++ b/source/blender/editors/space_text/SConscript @@ -10,4 +10,7 @@ incs += ' ../../python ../../makesrna ../../blenfont ../../blenloader' if env['WITH_BF_PYTHON']: defs.append('WITH_PYTHON') +if env['WITH_BF_INTERNATIONAL']: + defs.append('WITH_INTERNATIONAL') + env.BlenderLib ( 'bf_editors_space_text', sources, Split(incs), defs, libtype=['core'], priority=[95] ) diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 501e1cad67e..3f70b2cb66e 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -431,7 +431,7 @@ static void text_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ SpaceText *st = CTX_wm_space_text(C); - //View2D *v2d= &ar->v2d; + //View2D *v2d = &ar->v2d; /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index a68524fcdd6..94f64563fd8 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1139,7 +1139,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back) barheight = (ltexth > 0) ? (st->viewlines * pix_available) / ltexth : 0; pix_bardiff = 0; if (barheight < 20) { - pix_bardiff = 20 - barheight; /* take into account the now non-linear sizing of the bar */ + pix_bardiff = 20 - barheight; /* take into account the now non-linear sizing of the bar */ barheight = 20; } barstart = (ltexth > 0) ? ((pix_available - pix_bardiff) * st->top) / ltexth : 0; @@ -1166,9 +1166,9 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back) /* the scrollbar is non-linear sized */ if (pix_bardiff > 0) { /* the start of the highlight is in the current viewport */ - if (ltexth && st->viewlines && lhlstart >= st->top && lhlstart <= st->top + st->viewlines) { + if (ltexth && st->viewlines && lhlstart >= st->top && lhlstart <= st->top + st->viewlines) { /* speed the progresion of the start of the highlight through the scrollbar */ - hlstart = ( ( (pix_available - pix_bardiff) * lhlstart) / ltexth) + (pix_bardiff * (lhlstart - st->top) / st->viewlines); + hlstart = ( ( (pix_available - pix_bardiff) * lhlstart) / ltexth) + (pix_bardiff * (lhlstart - st->top) / st->viewlines); } else if (lhlstart > st->top + st->viewlines && hlstart < barstart + barheight && hlstart > barstart) { /* push hl start down */ @@ -1179,35 +1179,35 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back) hlstart = barstart; } - if (hlend <= hlstart) { + if (hlend <= hlstart) { hlend = hlstart + 2; } /* the end of the highlight is in the current viewport */ - if (ltexth && st->viewlines && lhlend >= st->top && lhlend <= st->top + st->viewlines) { + if (ltexth && st->viewlines && lhlend >= st->top && lhlend <= st->top + st->viewlines) { /* speed the progresion of the end of the highlight through the scrollbar */ hlend = (((pix_available - pix_bardiff) * lhlend) / ltexth) + (pix_bardiff * (lhlend - st->top) / st->viewlines); } else if (lhlend < st->top && hlend >= barstart - 2 && hlend < barstart + barheight) { /* push hl end up */ hlend = barstart; - } + } else if (lhlend > st->top + st->viewlines && lhlstart < st->top + st->viewlines && hlend < barstart + barheight) { /* fill out end */ hlend = barstart + barheight; } - if (hlend <= hlstart) { + if (hlend <= hlstart) { hlstart = hlend - 2; - } - } + } + } } else { hlstart = 0; hlend = 0; } - if (hlend - hlstart < 2) { + if (hlend - hlstart < 2) { hlend = hlstart + 2; } @@ -1232,7 +1232,7 @@ static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back) uiWidgetScrollDraw(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT) ? UI_SCROLL_PRESSED : 0); uiSetRoundBox(UI_CNR_ALL); - rad = 0.4f * mini(BLI_rcti_size_x(&st->txtscroll), BLI_rcti_size_y(&st->txtscroll)); + rad = 0.4f * min_ii(BLI_rcti_size_x(&st->txtscroll), BLI_rcti_size_y(&st->txtscroll)); UI_GetThemeColor3ubv(TH_HILITE, col); col[3] = 48; glColor4ubv(col); @@ -1355,7 +1355,7 @@ static void draw_documentation(SpaceText *st, ARegion *ar) x += SUGG_LIST_WIDTH * st->cwidth + 50; } - /* top= */ /* UNUSED */ y = ar->winy - st->lheight * l - 2; + /* top = */ /* UNUSED */ y = ar->winy - st->lheight * l - 2; boxw = DOC_WIDTH * st->cwidth + 20; boxh = (DOC_HEIGHT + 1) * st->lheight; @@ -1702,7 +1702,7 @@ static void draw_brackets(SpaceText *st, ARegion *ar) if (!endl || endc == -1) return; - UI_ThemeColor(TH_HILITE); + UI_ThemeColor(TH_HILITE); x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; y = ar->winy - st->lheight; @@ -1789,7 +1789,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) text_font_begin(st); st->cwidth = BLF_fixed_width(mono); - st->cwidth = MAX2(st->cwidth, 1); + st->cwidth = MAX2(st->cwidth, (char)1); /* draw line numbers background */ if (st->showlinenrs) { @@ -1873,7 +1873,7 @@ void text_update_character_width(SpaceText *st) { text_font_begin(st); st->cwidth = BLF_fixed_width(mono); - st->cwidth = MAX2(st->cwidth, 1); + st->cwidth = MAX2(st->cwidth, (char)1); text_font_end(st); } diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index b2fb16ff7fe..2d902c4586a 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -44,6 +44,8 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "PIL_time.h" #include "BKE_context.h" @@ -93,7 +95,7 @@ static int text_edit_poll(bContext *C) return 0; if (text->id.lib) { - // BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata"); + // BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata"); return 0; } @@ -109,7 +111,7 @@ static int text_space_edit_poll(bContext *C) return 0; if (text->id.lib) { - // BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata"); + // BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata"); return 0; } @@ -129,7 +131,7 @@ static int text_region_edit_poll(bContext *C) return 0; if (text->id.lib) { - // BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata"); + // BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata"); return 0; } @@ -463,7 +465,8 @@ static void txt_write_file(Text *text, ReportList *reports) fp = BLI_fopen(filepath, "w"); if (fp == NULL) { - BKE_reportf(reports, RPT_ERROR, "Unable to save \"%s\": %s", filepath, errno ? strerror(errno) : "Unknown error writing file"); + BKE_reportf(reports, RPT_ERROR, "Unable to save '%s': %s", + filepath, errno ? strerror(errno) : TIP_("unknown error writing file")); return; } @@ -482,7 +485,8 @@ static void txt_write_file(Text *text, ReportList *reports) } else { text->mtime = 0; - BKE_reportf(reports, RPT_WARNING, "Unable to stat \"%s\": %s", filepath, errno ? strerror(errno) : "Unknown error starrng file"); + BKE_reportf(reports, RPT_WARNING, "Unable to stat '%s': %s", + filepath, errno ? strerror(errno) : TIP_("unknown error stating file")); } if (text->flags & TXT_ISDIRTY) @@ -970,21 +974,17 @@ static int text_unindent_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text = CTX_data_edit_text(C); - if (txt_has_sel(text)) { - text_drawcache_tag_update(CTX_wm_space_text(C), 0); - - txt_order_cursors(text); - txt_unindent(text); + text_drawcache_tag_update(CTX_wm_space_text(C), 0); - text_update_edited(text); + txt_order_cursors(text); + txt_unindent(text); - text_update_cursor_moved(C); - WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text); + text_update_edited(text); - return OPERATOR_FINISHED; - } + text_update_cursor_moved(C); + WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text); - return OPERATOR_CANCELLED; + return OPERATOR_FINISHED; } void TEXT_OT_unindent(wmOperatorType *ot) @@ -1948,7 +1948,7 @@ static int text_move_cursor(bContext *C, int type, int select) txt_move_left(text, select); break; - case NEXT_CHAR: + case NEXT_CHAR: txt_move_right(text, select); break; @@ -2669,7 +2669,7 @@ static void text_cursor_set_apply(bContext *C, wmOperator *op, wmEvent *event) text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text); - } + } else if (!st->wordwrap && (event->mval[0] < 0 || event->mval[0] > ar->winx)) { if (event->mval[0] > ar->winx) st->left++; else if (event->mval[0] < 0 && st->left > 0) st->left--; @@ -2679,7 +2679,7 @@ static void text_cursor_set_apply(bContext *C, wmOperator *op, wmEvent *event) text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text); // XXX PIL_sleep_ms(10); - } + } else { text_cursor_set_to_pos(st, ar, event->mval[0], event->mval[1], 1); @@ -2688,7 +2688,7 @@ static void text_cursor_set_apply(bContext *C, wmOperator *op, wmEvent *event) ssel->old[0] = event->mval[0]; ssel->old[1] = event->mval[1]; - } + } } static void text_cursor_set_exit(bContext *C, wmOperator *op) diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index 135e9b891bb..0649edc1ac4 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -84,7 +84,7 @@ void draw_motion_paths_init(View3D *v3d, ARegion *ar) void draw_motion_path_instance(Scene *scene, Object *ob, bPoseChannel *pchan, bAnimVizSettings *avs, bMotionPath *mpath) { - //RegionView3D *rv3d= ar->regiondata; + //RegionView3D *rv3d = ar->regiondata; bMotionPathVert *mpv, *mpv_start; int i, stepsize = avs->path_step; int sfra, efra, sind, len; @@ -148,11 +148,11 @@ void draw_motion_path_instance(Scene *scene, if ((sfra + i) < CFRA) { /* black - before cfra */ if (sel) { - // intensity= 0.5f; + // intensity = 0.5f; intensity = SET_INTENSITY(sfra, i, CFRA, 0.25f, 0.75f); } else { - //intensity= 0.8f; + //intensity = 0.8f; intensity = SET_INTENSITY(sfra, i, CFRA, 0.68f, 0.92f); } UI_ThemeColorBlend(TH_WIRE, TH_BACK, intensity); @@ -178,7 +178,7 @@ void draw_motion_path_instance(Scene *scene, intensity = 0.99f; } UI_ThemeColorBlendShade(TH_CFRAME, TH_BACK, intensity, 10); - } + } /* draw a vertex with this color */ glVertex3fv(mpv->co); diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 31df13343ce..beafee335d4 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -100,7 +100,7 @@ static void set_pchan_colorset(Object *ob, bPoseChannel *pchan) } /* only try to set custom color if enabled for armature */ - if (arm->flag & ARM_COL_CUSTOM) { + if (arm->flag & ARM_COL_CUSTOM) { /* currently, a bone can only use a custom color set if it's group (if it has one), * has been set to use one */ @@ -647,7 +647,7 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel /* this routine doesn't call get_matrix_editbone() that calculates it */ ebone->length = len_v3v3(ebone->head, ebone->tail); - /*length= ebone->length;*/ /*UNUSED*/ + /*length = ebone->length;*/ /*UNUSED*/ tail = ebone->rad_tail; dist = ebone->dist; if (ebone->parent && (ebone->flag & BONE_CONNECTED)) @@ -658,7 +658,7 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel tailvec = ebone->tail; } else { - /*length= pchan->bone->length;*/ /*UNUSED*/ + /*length = pchan->bone->length;*/ /*UNUSED*/ tail = pchan->bone->rad_tail; dist = pchan->bone->dist; if (pchan->parent && (pchan->bone->flag & BONE_CONNECTED)) @@ -767,7 +767,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], /* this routine doesn't call get_matrix_editbone() that calculates it */ ebone->length = len_v3v3(ebone->head, ebone->tail); - /*length= ebone->length;*/ /*UNUSED*/ + /*length = ebone->length;*/ /*UNUSED*/ tail = ebone->rad_tail; if (ebone->parent && (boneflag & BONE_CONNECTED)) head = ebone->parent->rad_tail; @@ -777,7 +777,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], tailvec = ebone->tail; } else { - /*length= pchan->bone->length;*/ /*UNUSED*/ + /*length = pchan->bone->length;*/ /*UNUSED*/ tail = pchan->bone->rad_tail; if ((pchan->parent) && (boneflag & BONE_CONNECTED)) head = pchan->parent->bone->rad_tail; @@ -969,7 +969,7 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co glTranslatef(0.0f, 0.0f, head); gluSphere(qobj, fac1 * head + (1.0f - fac1) * tail, 16, 10); } - else { + else { /* 1 sphere in center */ glTranslatef(0.0f, 0.0f, (head + length - tail) / 2.0f); gluSphere(qobj, fac1 * head + (1.0f - fac1) * tail, 16, 10); @@ -1040,7 +1040,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned glEnd(); /* tip */ - if (G.f & G_PICKSEL) { + if (G.f & G_PICKSEL) { /* no bitmap in selection mode, crashes 3d cards... */ glLoadName(id | BONESEL_TIP); glBegin(GL_POINTS); @@ -1189,7 +1189,7 @@ static void draw_b_bone(const short dt, int armflag, int boneflag, short constfl glDisable(GL_COLOR_MATERIAL); glDisable(GL_LIGHTING); } - else { + else { /* wire */ if (armflag & ARM_POSEMODE) { if (constflag) { @@ -1205,9 +1205,9 @@ static void draw_b_bone(const short dt, int armflag, int boneflag, short constfl /* restore colors */ set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); } - } + } - draw_b_bone_boxes(OB_WIRE, pchan, xwidth, length, zwidth); + draw_b_bone_boxes(OB_WIRE, pchan, xwidth, length, zwidth); } } @@ -1333,7 +1333,7 @@ static void draw_bone(const short dt, int armflag, int boneflag, short constflag else if (armflag & ARM_POSEMODE) { if (constflag) { /* draw constraint colors */ - if (set_pchan_glColor(PCHAN_COLOR_CONSTS, boneflag, constflag)) { + if (set_pchan_glColor(PCHAN_COLOR_CONSTS, boneflag, constflag)) { glEnable(GL_BLEND); draw_bone_solid_octahedral(); @@ -1344,10 +1344,10 @@ static void draw_bone(const short dt, int armflag, int boneflag, short constflag /* restore colors */ set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); } - } + } draw_bone_octahedral(); } - else { + else { /* solid */ if (armflag & ARM_POSEMODE) set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag); @@ -1741,7 +1741,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, if (use_custom && pchan->custom_tx) { glMultMatrixf(pchan->custom_tx->pose_mat); - } + } else { glMultMatrixf(pchan->pose_mat); } @@ -1803,7 +1803,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, */ if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) == 0 && (draw_wire == 0)) { /* object tag, for bordersel optim */ - glLoadName(index & 0xFFFF); + glLoadName(index & 0xFFFF); index = -1; } } @@ -1830,7 +1830,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, if (pchan->custom_tx) { glMultMatrixf(pchan->custom_tx->pose_mat); - } + } else { glMultMatrixf(pchan->pose_mat); } @@ -1869,7 +1869,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, /* stick or wire bones have not been drawn yet so don't clear object selection in this case */ if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) == 0 && draw_wire) { /* object tag, for bordersel optim */ - glLoadName(index & 0xFFFF); + glLoadName(index & 0xFFFF); index = -1; } } @@ -1938,7 +1938,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, glLoadName(index & 0xFFFF); pchan_draw_IK_root_lines(pchan, !(do_dashed & 2)); } - } + } } } @@ -1992,7 +1992,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, /* restore things */ if (!ELEM(arm->drawtype, ARM_WIRE, ARM_LINE) && (dt > OB_WIRE) && (arm->flag & ARM_POSEMODE)) bglPolygonOffset(rv3d->dist, 0.0); - } + } /* restore */ glDisable(GL_CULL_FACE); @@ -2045,7 +2045,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, if (arm->flag & ARM_DRAWNAMES) { mid_v3_v3v3(vec, pchan->pose_head, pchan->pose_tail); view3d_cached_text_draw_add(vec, pchan->name, 10, 0, col); - } + } /* Draw additional axes on the bone tail */ if ((arm->flag & ARM_DRAWAXES) && (arm->flag & ARM_POSEMODE)) { @@ -2075,7 +2075,7 @@ static void get_matrix_editbone(EditBone *eBone, float bmat[][4]) float mat[3][3]; /* Compose the parent transforms (i.e. their translations) */ - sub_v3_v3v3(delta, eBone->tail, eBone->head); + sub_v3_v3v3(delta, eBone->tail, eBone->head); eBone->length = (float)sqrt(delta[0] * delta[0] + delta[1] * delta[1] + delta[2] * delta[2]); @@ -2258,7 +2258,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt) mid_v3_v3v3(vec, eBone->head, eBone->tail); glRasterPos3fv(vec); view3d_cached_text_draw_add(vec, eBone->name, 10, 0, col); - } + } /* Draw additional axes */ if (arm->flag & ARM_DRAWAXES) { glPushMatrix(); @@ -2643,7 +2643,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, } draw_pose_paths(scene, v3d, ar, ob); } - } + } } draw_pose_bones(scene, v3d, ar, base, dt, ob_wire_col, (dflag & DRAW_CONSTCOLOR), is_outline); arm->flag &= ~ARM_POSEMODE; diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index cded7bbbdfc..cb5556396dd 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -382,7 +382,7 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O glEnable(GL_CULL_FACE); glCullFace(GL_BACK); } - else { + else { glDisable(GL_CULL_FACE); } glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, (me->flag & ME_TWOSIDED) ? GL_TRUE : GL_FALSE); @@ -406,7 +406,7 @@ static void draw_textured_end(void) * - zr */ glPushMatrix(); - glLoadIdentity(); + glLoadIdentity(); GPU_default_lights(); glPopMatrix(); } @@ -636,7 +636,7 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl) int a, totpoly = me->totpoly; /* fake values to pass to GPU_render_text() */ - MCol tmp_mcol[4] = {{0}}; + MCol tmp_mcol[4] = {{0}}; MCol *tmp_mcol_pt = mloopcol ? tmp_mcol : NULL; MTFace tmp_tf = {{{0}}}; @@ -703,7 +703,7 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl) /* COLOR */ if (mloopcol) { - unsigned int totloop_clamp = MIN2(4, mp->totloop); + unsigned int totloop_clamp = min_ii(4, mp->totloop); unsigned int j; lcol = &mloopcol[mp->loopstart]; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index ec54ae09fd2..27a660eac2b 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -578,7 +578,7 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char glTranslatef(0.0f, 0.0f, 0.0f); /* Calculate Image scale */ - scale = (ob->empty_drawsize / (float)MAX2(ima_x * sca_x, ima_y * sca_y)); + scale = (ob->empty_drawsize / max_ff((float)ima_x * sca_x, (float)ima_y * sca_y)); /* Set the object scale */ glScalef(scale * sca_x, scale * sca_y, 1.0f); @@ -4457,7 +4457,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv if (cdata2) MEM_freeN(cdata2); - /* cd2= */ /* UNUSED */ cdata2 = NULL; + /* cd2 = */ /* UNUSED */ cdata2 = NULL; glLineWidth(1.0f); @@ -5523,7 +5523,7 @@ static void drawcircle_size(float size) glBegin(GL_LINE_LOOP); - /* coordinates are: cos(degrees*11.25)=x, sin(degrees*11.25)=y, 0.0f=z */ + /* coordinates are: cos(degrees * 11.25) = x, sin(degrees*11.25) = y, 0.0f = z */ for (degrees = 0; degrees < CIRCLE_RESOL; degrees++) { x = cosval[degrees]; y = sinval[degrees]; @@ -6570,7 +6570,6 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short /* code for new particle system */ if ((warning_recursive == 0) && (ob->particlesystem.first) && - (dflag & DRAW_PICKING) == 0 && (ob != scene->obedit) ) { diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 236cbb86724..6818c78bbd6 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -185,7 +185,7 @@ int ED_view3d_context_user_region(bContext *C, View3D **v3d_r, ARegion **ar_r) ar_unlock_user = ar; break; } - } + } } } @@ -719,7 +719,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) case NC_BRUSH: if (wmn->action == NA_EDITED) ED_region_tag_redraw_overlay(ar); - break; + break; case NC_MATERIAL: switch (wmn->data) { case ND_SHADING_DRAW: @@ -748,12 +748,12 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) break; } break; - case NC_IMAGE: + case NC_IMAGE: /* this could be more fine grained checks if we had * more context than just the region */ ED_region_tag_redraw(ar); break; - case NC_TEXTURE: + case NC_TEXTURE: /* same as above */ ED_region_tag_redraw(ar); break; @@ -882,7 +882,7 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn) case ND_KEYFRAME: if (wmn->action == NA_EDITED) ED_region_tag_redraw(ar); - break; + break; } break; case NC_SCENE: diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 9755c7d1b7c..f1be0978c06 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1223,7 +1223,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa) if (ob == NULL) return; - lim = 10000.0f * MAX2(1.0f, v3d->grid); + lim = 10000.0f * max_ff(1.0f, v3d->grid); block = uiLayoutGetBlock(pa->layout); uiBlockSetHandleFunc(block, do_view3d_region_buttons, NULL); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 8e1b0716136..d61ba5f1181 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -523,7 +523,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit) GPU_print_error("sdsd"); } - /* draw the Z axis line */ + /* draw the Z axis line */ /* check for the 'show Z axis' preference */ if (v3d->gridflag & (V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_Z)) { int axis; @@ -1060,7 +1060,7 @@ static void drawviewborder_triangle(float x1, float x2, float y1, float y2, cons static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) { - float fac, a; + float hmargin, vmargin; float x1, x2, y1, y2; float x1i, x2i, y1i, y2i; float x3, y3, x4, y4; @@ -1115,7 +1115,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) } /* edge */ - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); setlinestyle(0); @@ -1214,20 +1214,15 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) } if (ca->flag & CAM_SHOWTITLESAFE) { - fac = 0.1; - - a = fac * (x2 - x1); - x1 += a; - x2 -= a; - - a = fac * (y2 - y1); - y1 += a; - y2 -= a; - UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0); + hmargin = 0.1 * (x2 - x1); + vmargin = 0.05 * (y2 - y1); + uiDrawBox(GL_LINE_LOOP, x1+hmargin, y1+vmargin, x2-hmargin, y2-vmargin, 2.0); + + hmargin = 0.035 * (x2 - x1); + vmargin = 0.035 * (y2 - y1); + uiDrawBox(GL_LINE_LOOP, x1+hmargin, y1+vmargin, x2-hmargin, y2-vmargin, 2.0); } if (ca && (ca->flag & CAM_SHOWSENSOR)) { /* determine sensor fit, and get sensor x/y, for auto fit we @@ -1429,7 +1424,7 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax, (ymaxc - yminc + 1), GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); - glReadBuffer(GL_BACK); + glReadBuffer(GL_BACK); if (ENDIAN_ORDER == B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf); @@ -1471,7 +1466,7 @@ unsigned int view3d_sample_backbuf_rect(ViewContext *vc, const int mval[2], int int a, b, rc, nr, amount, dirvec[4][2]; int distance = 0; unsigned int index = 0; - short indexok = 0; + short indexok = 0; amount = (size - 1) / 2; @@ -1640,7 +1635,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, /* apply offset last - camera offset is different to offset in blender units */ /* so this has some sane way of working - this matches camera's shift _exactly_ */ { - const float max_dim = maxf(x2 - x1, y2 - y1); + const float max_dim = max_ff(x2 - x1, y2 - y1); const float xof_scale = bgpic->xof * max_dim; const float yof_scale = bgpic->yof * max_dim; @@ -1689,7 +1684,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, /* calc window coord */ initgrabz(rv3d, 0.0, 0.0, 0.0); ED_view3d_win_to_delta(ar, mval_f, tvec); - fac = maxf(fabsf(tvec[0]), maxf(fabsf(tvec[1]), fabsf(tvec[2]))); /* largest abs axis */ + fac = max_ff(fabsf(tvec[0]), max_ff(fabsf(tvec[1]), fabsf(tvec[2]))); /* largest abs axis */ fac = 1.0f / fac; asp = (float)ibuf->y / (float)ibuf->x; @@ -1717,7 +1712,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, /* for some reason; zoomlevels down refuses to use GL_ALPHA_SCALE */ if (zoomx < 1.0f || zoomy < 1.0f) { - float tzoom = minf(zoomx, zoomy); + float tzoom = min_ff(zoomx, zoomy); int mip = 0; if ((ibuf->userflags & IB_MIPMAP_INVALID) != 0) { @@ -2024,7 +2019,7 @@ static void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *bas void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect) { - int x, y, w, h; + int x, y, w, h; rcti r; /* clamp rect by area */ @@ -2122,7 +2117,7 @@ float view3d_depth_near(ViewDepths *d) int i = (int)d->w * (int)d->h; /* cast to avoid short overflow */ /* far is both the starting 'far' value - * and the closest value found. */ + * and the closest value found. */ while (i--) { depth = *depths++; if ((depth < far) && (depth > near)) { @@ -2138,7 +2133,7 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d) short zbuf = v3d->zbuf; RegionView3D *rv3d = ar->regiondata; - setwinmatrixview3d(ar, v3d, NULL); /* 0= no pick rect */ + setwinmatrixview3d(ar, v3d, NULL); setviewmatrixview3d(scene, v3d, rv3d); /* note: calls BKE_object_where_is_calc for camera... */ mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat); @@ -2173,7 +2168,7 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (*func)(void *)) U.glalphaclip = 0.5; /* not that nice but means we wont zoom into billboards */ U.obcenter_dia = 0; - setwinmatrixview3d(ar, v3d, NULL); /* 0= no pick rect */ + setwinmatrixview3d(ar, v3d, NULL); setviewmatrixview3d(scene, v3d, rv3d); /* note: calls BKE_object_where_is_calc for camera... */ mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat); @@ -2371,6 +2366,7 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d) mult_m4_m4m4(rv3d.persmat, rv3d.winmat, rv3d.viewmat); invert_m4_m4(rv3d.persinv, rv3d.viewinv); + /* no need to call ED_view3d_draw_offscreen_init since shadow buffers were already updated */ ED_view3d_draw_offscreen(scene, v3d, &ar, winsize, winsize, viewmat, winmat, FALSE, FALSE); GPU_lamp_shadow_buffer_unbind(shadow->lamp); @@ -2460,7 +2456,7 @@ void ED_view3d_update_viewmat(Scene *scene, View3D *v3d, ARegion *ar, float view if (winmat) copy_m4_m4(rv3d->winmat, winmat); else - setwinmatrixview3d(ar, v3d, NULL); /* NULL= no pickrect */ + setwinmatrixview3d(ar, v3d, NULL); /* setup view matrix */ if (viewmat) @@ -2478,7 +2474,7 @@ void ED_view3d_update_viewmat(Scene *scene, View3D *v3d, ARegion *ar, float view /* note: '1.0f / len_v3(v1)' replaced 'len_v3(rv3d->viewmat[0])' * because of float point precision problems at large values [#23908] */ float v1[3], v2[3]; - float len1, len2; + float len_px, len_sc; v1[0] = rv3d->persmat[0][0]; v1[1] = rv3d->persmat[1][0]; @@ -2488,10 +2484,10 @@ void ED_view3d_update_viewmat(Scene *scene, View3D *v3d, ARegion *ar, float view v2[1] = rv3d->persmat[1][1]; v2[2] = rv3d->persmat[2][1]; - len1 = 1.0f / len_v3(v1); - len2 = 1.0f / len_v3(v2); + len_px = 2.0f / sqrtf(min_ff(len_squared_v3(v1), len_squared_v3(v2))); + len_sc = (float)MAX2(ar->winx, ar->winy); - rv3d->pixsize = (2.0f * MAX2(len1, len2)) / (float)MAX2(ar->winx, ar->winy); + rv3d->pixsize = len_px / len_sc; } } @@ -2508,6 +2504,16 @@ static void view3d_main_area_setup_view(Scene *scene, View3D *v3d, ARegion *ar, glLoadMatrixf(rv3d->viewmat); } +void ED_view3d_draw_offscreen_init(Scene *scene, View3D *v3d) +{ + /* shadow buffers, before we setup matrices */ + if (draw_glsl_material(scene, NULL, v3d, v3d->drawtype)) + gpu_update_lamps_shadows(scene, v3d); +} + +/* ED_view3d_draw_offscreen_init should be called before this to initialize + * stuff like shadow buffers + */ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, int winy, float viewmat[][4], float winmat[][4], int do_bgpic, int colormanage_background) @@ -2541,10 +2547,6 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, /* free images which can have changed on frame-change * warning! can be slow so only free animated images - campbell */ GPU_free_images_anim(); - - /* shadow buffers, before we setup matrices */ - if (draw_glsl_material(scene, NULL, v3d, v3d->drawtype)) - gpu_update_lamps_shadows(scene, v3d); /* set background color, fallback on the view background color * (if active clip is set but frame is failed to load fallback to horizon color as background) */ @@ -2687,6 +2689,8 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, if (ofs == NULL) return NULL; + ED_view3d_draw_offscreen_init(scene, v3d); + GPU_offscreen_bind(ofs); /* render 3d view */ @@ -2815,7 +2819,7 @@ static void draw_viewport_fps(Scene *scene, ARegion *ar) if (fps + 0.5f < (float)(FPS)) { UI_ThemeColor(TH_REDALERT); BLI_snprintf(printable, sizeof(printable), "fps: %.2f", fps); - } + } else { UI_ThemeColor(TH_TEXT_HI); BLI_snprintf(printable, sizeof(printable), "fps: %i", (int)(fps + 0.5f)); @@ -2859,8 +2863,8 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw /* clamp small tile sizes to prevent inefficient threading utilization * the same happens for final renders as well */ - engine->tile_x = MAX2(engine->tile_x, 64); - engine->tile_y = MAX2(engine->tile_x, 64); + engine->tile_x = max_ii(engine->tile_x, 64); + engine->tile_y = max_ii(engine->tile_x, 64); type->view_update(engine, C); @@ -3135,8 +3139,6 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); - Object *ob; - if (rv3d->persp == RV3D_CAMOB) { drawviewborder(scene, ar, v3d); } @@ -3153,44 +3155,48 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha } if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { + Object *ob; + /* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */ // if (v3d->flag2 & V3D_DISPGP) draw_gpencil_view3d(scene, v3d, ar, 0); drawcursor(scene, ar, v3d); + + if (U.uiflag & USER_SHOW_ROTVIEWICON) + draw_view_axis(rv3d); + else + draw_view_icon(rv3d); + + ob = OBACT; + if (U.uiflag & USER_DRAWVIEWINFO) + draw_selected_name(scene, ob); } - - if (U.uiflag & USER_SHOW_ROTVIEWICON) - draw_view_axis(rv3d); - else - draw_view_icon(rv3d); - - ob = OBACT; - if (U.uiflag & USER_DRAWVIEWINFO) - draw_selected_name(scene, ob); if (rv3d->render_engine) { view3d_main_area_draw_engine_info(rv3d, ar); return; } - if ((U.uiflag & USER_SHOW_FPS) && ED_screen_animation_playing(wm)) { - draw_viewport_fps(scene, ar); - } - else if (U.uiflag & USER_SHOW_VIEWPORTNAME) { - draw_viewport_name(ar, v3d); - } + if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { + if ((U.uiflag & USER_SHOW_FPS) && ED_screen_animation_playing(wm)) { + draw_viewport_fps(scene, ar); + } + else if (U.uiflag & USER_SHOW_VIEWPORTNAME) { + draw_viewport_name(ar, v3d); + } - if (grid_unit) { /* draw below the viewport name */ - char numstr[32] = ""; + if (grid_unit) { /* draw below the viewport name */ + char numstr[32] = ""; - UI_ThemeColor(TH_TEXT_HI); - if (v3d->grid != 1.0f) { - BLI_snprintf(numstr, sizeof(numstr), "%s x %.4g", grid_unit, v3d->grid); - } + UI_ThemeColor(TH_TEXT_HI); + if (v3d->grid != 1.0f) { + BLI_snprintf(numstr, sizeof(numstr), "%s x %.4g", grid_unit, v3d->grid); + } - BLF_draw_default_ascii(22, ar->winy - (USER_SHOW_VIEWPORTNAME ? 40 : 20), 0.0f, - numstr[0] ? numstr : grid_unit, sizeof(numstr)); + BLF_draw_default_ascii(22, ar->winy - (USER_SHOW_VIEWPORTNAME ? 40 : 20), 0.0f, + numstr[0] ? numstr : grid_unit, sizeof(numstr)); + } } } diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 96264081f10..242a3327b78 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -96,6 +96,7 @@ int ED_view3d_camera_lock_check(View3D *v3d, RegionView3D *rv3d) void ED_view3d_camera_lock_init(View3D *v3d, RegionView3D *rv3d) { if (ED_view3d_camera_lock_check(v3d, rv3d)) { + rv3d->dist = ED_view3d_offset_distance(v3d->camera->obmat, rv3d->ofs); ED_view3d_from_object(v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL); } } @@ -894,6 +895,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event) /* changed since 2.4x, use the camera view */ if (vod->v3d->camera) { + rv3d->dist = ED_view3d_offset_distance(vod->v3d->camera->obmat, rv3d->ofs); ED_view3d_from_object(vod->v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL); } @@ -921,7 +923,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_FINISHED; } - else { + else { /* add temp handler */ WM_event_add_modal_handler(C, op); @@ -1354,7 +1356,7 @@ static int ndof_all_invoke(bContext *C, wmOperator *op, wmEvent *event) ED_view3d_camera_lock_sync(v3d, rv3d); ED_region_tag_redraw(CTX_wm_region(C)); - viewops_data_free(C, op); + viewops_data_free(C, op); return OPERATOR_FINISHED; } } @@ -1501,7 +1503,7 @@ static int viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event) viewmove_apply(vod, event->prevx, event->prevy); ED_view3d_depth_tag_update(vod->rv3d); - viewops_data_free(C, op); + viewops_data_free(C, op); return OPERATOR_FINISHED; } @@ -2039,7 +2041,7 @@ static int viewdolly_exec(bContext *C, wmOperator *op) normalize_v3(mousevec); } - /* v3d= sa->spacedata.first; */ /* UNUSED */ + /* v3d = sa->spacedata.first; */ /* UNUSED */ rv3d = ar->regiondata; /* overwrite the mouse vector with the view direction (zoom into the center) */ @@ -2591,7 +2593,7 @@ static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was xfac = (float)ar->winx / (float)(size[0] + 4); yfac = (float)ar->winy / (float)(size[1] + 4); - rv3d->camzoom = BKE_screen_view3d_zoom_from_fac(minf(xfac, yfac)); + rv3d->camzoom = BKE_screen_view3d_zoom_from_fac(min_ff(xfac, yfac)); CLAMP(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); @@ -2695,7 +2697,7 @@ void VIEW3D_OT_render_border(wmOperatorType *ot) { /* identifiers */ ot->name = "Set Render Border"; - ot->description = "Set the boundaries of the border render and enables border render"; + ot->description = "Set the boundaries of the border render and enable border render"; ot->idname = "VIEW3D_OT_render_border"; /* api callbacks */ @@ -2715,7 +2717,7 @@ void VIEW3D_OT_render_border(wmOperatorType *ot) RNA_def_boolean(ot->srna, "camera_only", 0, "Camera Only", "Set render border for camera view and final render only"); } -/* ********************* Set render border operator ****************** */ +/* ********************* Clear render border operator ****************** */ static int clear_render_border_exec(bContext *C, wmOperator *UNUSED(op)) { @@ -2751,7 +2753,7 @@ void VIEW3D_OT_clear_render_border(wmOperatorType *ot) { /* identifiers */ ot->name = "Clear Render Border"; - ot->description = "Clear the boundaries of the border render and enables border render"; + ot->description = "Clear the boundaries of the border render and disable border render"; ot->idname = "VIEW3D_OT_clear_render_border"; /* api callbacks */ @@ -2879,7 +2881,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) /* work out the ratios, so that everything selected fits when we zoom */ xscale = (BLI_rcti_size_x(&rect) / vb[0]); yscale = (BLI_rcti_size_y(&rect) / vb[1]); - new_dist *= maxf(xscale, yscale); + new_dist *= max_ff(xscale, yscale); /* zoom in as required, or as far as we can go */ dist_range_min = 0.001f * v3d->grid; @@ -3924,6 +3926,18 @@ int ED_view3d_autodist_depth_seg(ARegion *ar, const int mval_sta[2], const int m return (*depth == FLT_MAX) ? 0 : 1; } +float ED_view3d_offset_distance(float mat[4][4], float ofs[3]) { + float pos[4] = {0.0f, 0.0f, 0.0f, 1.0f}; + float dir[4] = {0.0f, 0.0f, 1.0f, 0.0f}; + + mul_m4_v4(mat, pos); + add_v3_v3(pos, ofs); + mul_m4_v4(mat, dir); + normalize_v3(dir); + + return dot_v3v3(pos, dir); +} + /** * Set the view transformation from a 4x4 matrix. * diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index cd358dea869..5aee90f0860 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -27,7 +27,7 @@ /* defines VIEW3D_OT_fly modal operator */ //#define NDOF_FLY_DEBUG -//#define NDOF_FLY_DRAW_TOOMUCH // is this needed for ndof? - commented so redraw doesnt thrash - campbell +//#define NDOF_FLY_DRAW_TOOMUCH /* is this needed for ndof? - commented so redraw doesnt thrash - campbell */ #include "DNA_anim_types.h" #include "DNA_scene_types.h" #include "DNA_object_types.h" @@ -426,7 +426,6 @@ static int flyEnd(bContext *C, FlyInfo *fly) ED_region_draw_cb_exit(fly->ar->type, fly->draw_handle_pixel); rv3d->dist = fly->dist_backup; - if (fly->state == FLY_CANCEL) { /* Revert to original view? */ if (fly->persp_backup == RV3D_CAMOB) { /* a camera view */ @@ -441,12 +440,16 @@ static int flyEnd(bContext *C, FlyInfo *fly) else { /* Non Camera we need to reset the view back to the original location bacause the user canceled*/ copy_qt_qt(rv3d->viewquat, fly->rot_backup); - copy_v3_v3(rv3d->ofs, fly->ofs_backup); rv3d->persp = fly->persp_backup; } + /* always, is set to zero otherwise */ + copy_v3_v3(rv3d->ofs, fly->ofs_backup); } else if (fly->persp_backup == RV3D_CAMOB) { /* camera */ DAG_id_tag_update(fly->root_parent ? &fly->root_parent->id : &v3d->camera->id, OB_RECALC_OB); + + /* always, is set to zero otherwise */ + copy_v3_v3(rv3d->ofs, fly->ofs_backup); } else { /* not camera */ @@ -553,7 +556,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) time_wheel = (float)(time_currwheel - fly->time_lastwheel); fly->time_lastwheel = time_currwheel; /* Mouse wheel delays range from (0.5 == slow) to (0.01 == fast) */ - time_wheel = 1.0f + (10.0f - (20.0f * minf(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */ + time_wheel = 1.0f + (10.0f - (20.0f * min_ff(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */ if (fly->speed < 0.0f) { fly->speed = 0.0f; @@ -571,7 +574,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) time_currwheel = PIL_check_seconds_timer(); time_wheel = (float)(time_currwheel - fly->time_lastwheel); fly->time_lastwheel = time_currwheel; - time_wheel = 1.0f + (10.0f - (20.0f * minf(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */ + time_wheel = 1.0f + (10.0f - (20.0f * min_ff(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */ if (fly->speed > 0.0f) { fly->speed = 0; @@ -795,8 +798,8 @@ static int flyApply(bContext *C, FlyInfo *fly) ymargin = ar->winy / 20.0f; // UNUSED - // cent_orig[0]= ar->winrct.xmin + ar->winx/2; - // cent_orig[1]= ar->winrct.ymin + ar->winy/2; + // cent_orig[0] = ar->winrct.xmin + ar->winx / 2; + // cent_orig[1] = ar->winrct.ymin + ar->winy / 2; { @@ -847,7 +850,7 @@ static int flyApply(bContext *C, FlyInfo *fly) #endif time_current = PIL_check_seconds_timer(); time_redraw = (float)(time_current - fly->time_lastdraw); - time_redraw_clamped = minf(0.05f, time_redraw); /* clamp redraw time to avoid jitter in roll correction */ + time_redraw_clamped = min_ff(0.05f, time_redraw); /* clamp redraw time to avoid jitter in roll correction */ fly->time_lastdraw = time_current; /* Scale the time to use shift to scale the speed down- just like diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index b2ae63df662..d8fcc7e12e7 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -167,7 +167,7 @@ static int view3d_layers_exec(bContext *C, wmOperator *op) } else { v3d->lay |= (1 << 20) - 1; - } + } } else { int bit; @@ -452,7 +452,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) const float dpi_fac = UI_DPI_FAC; int is_paint = 0; - RNA_pointer_create(&screen->id, &RNA_SpaceView3D, v3d, &v3dptr); + RNA_pointer_create(&screen->id, &RNA_SpaceView3D, v3d, &v3dptr); RNA_pointer_create(&scene->id, &RNA_ToolSettings, ts, &toolsptr); RNA_pointer_create(&scene->id, &RNA_Scene, scene, &sceneptr); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 3017891183e..5beeda9f220 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -177,7 +177,7 @@ int ED_view3d_boundbox_clip(RegionView3D * rv3d, float obmat[][4], struct BoundB void view3d_smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *ar, struct Object *, struct Object *, float *ofs, float *quat, float *dist, float *lens); -void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect); /* rect: for picking */ +void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect); void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d); void fly_modal_keymap(struct wmKeyConfig *keyconf); diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c index 0472f9f2c10..b928e060ca0 100644 --- a/source/blender/editors/space_view3d/view3d_iterators.c +++ b/source/blender/editors/space_view3d/view3d_iterators.c @@ -130,11 +130,12 @@ static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, const flo if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { float screen_co_a[2]; float screen_co_b[2]; + eV3DProjTest clip_flag_nowin = data->clip_flag &= ~V3D_PROJ_TEST_CLIP_WIN; - if (ED_view3d_project_float_object(data->vc.ar, v0co, screen_co_a, data->clip_flag) != V3D_PROJ_RET_OK) { + if (ED_view3d_project_float_object(data->vc.ar, v0co, screen_co_a, clip_flag_nowin) != V3D_PROJ_RET_OK) { return; } - if (ED_view3d_project_float_object(data->vc.ar, v1co, screen_co_b, data->clip_flag) != V3D_PROJ_RET_OK) { + if (ED_view3d_project_float_object(data->vc.ar, v1co, screen_co_b, clip_flag_nowin) != V3D_PROJ_RET_OK) { return; } diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index c30adf844a8..43626b058d6 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -165,7 +165,7 @@ void view3d_get_transformation(const ARegion *ar, RegionView3D *rv3d, Object *ob mats->viewport[0] = ar->winrct.xmin; mats->viewport[1] = ar->winrct.ymin; mats->viewport[2] = ar->winx; - mats->viewport[3] = ar->winy; + mats->viewport[3] = ar->winy; } /* ********************** view3d_select: selection manipulations ********************* */ @@ -2359,7 +2359,7 @@ static void paint_facesel_circle_select(ViewContext *vc, int select, const int m if (me) { bm_vertoffs = me->totpoly + 1; /* max index array */ - /* bbsel= */ /* UNUSED */ EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f)); + /* bbsel = */ /* UNUSED */ EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f)); edbm_backbuf_check_and_select_tfaces(me, select == LEFTMOUSE); EDBM_backbuf_free(); paintface_flush_flags(ob); @@ -2376,7 +2376,7 @@ static void paint_vertsel_circle_select(ViewContext *vc, int select, const int m if (me) { bm_vertoffs = me->totvert + 1; /* max index array */ - /* bbsel= */ /* UNUSED */ EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f)); + /* bbsel = */ /* UNUSED */ EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f)); edbm_backbuf_check_and_select_verts_obmode(me, select == LEFTMOUSE); EDBM_backbuf_free(); diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index e55e97e501b..9517bc87721 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -233,7 +233,7 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod BMesh *bm = em->bm; BMIter iter; void *userdata[2] = {em, NULL}; - /*int proptrans= 0; */ /*UNUSED*/ + /*int proptrans = 0; */ /*UNUSED*/ /* abuses vertex index all over, set, just set dirty here, * perhaps this could use its own array instead? - campbell */ @@ -349,7 +349,7 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod tv->flag = 1; tv++; tottrans++; - } + } if ((mode & TM_ALL_JOINTS) && (tipsel)) { copy_v3_v3(tv->oldloc, ebo->tail); diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index b40e880591a..d36b0085acb 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -173,7 +173,7 @@ static uiBlock *tool_search_menu(bContext *C, ARegion *ar, void *arg_listbase) search[0] = 0; block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS); - uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_RET_1); + uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_SEARCH_MENU); /* fake button, it holds space for search items */ uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL); @@ -182,7 +182,7 @@ static uiBlock *tool_search_menu(bContext *C, ARegion *ar, void *arg_listbase) uiButSetSearchFunc(but, operator_search_cb, arg_listbase, operator_call_cb, NULL); uiBoundsBlock(block, 6); - uiBlockSetDirection(block, UI_DOWN); + uiBlockSetDirection(block, UI_DOWN); uiEndBlock(C, block); event = *(win->eventstate); /* XXX huh huh? make api call */ diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index de8cbd856e8..c16f04f01f3 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -161,6 +161,7 @@ void view3d_smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera if (lens) sms.new_lens = *lens; if (camera) { + sms.new_dist = ED_view3d_offset_distance(camera->obmat, ofs); ED_view3d_from_object(camera, sms.new_ofs, sms.new_quat, &sms.new_dist, &sms.new_lens); sms.to_camera = TRUE; /* restore view3d values in end */ } @@ -185,7 +186,7 @@ void view3d_smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera /* original values */ if (oldcamera) { - sms.orig_dist = rv3d->dist; /* below function does weird stuff with it... */ + sms.orig_dist = ED_view3d_offset_distance(oldcamera->obmat, rv3d->ofs); ED_view3d_from_object(oldcamera, sms.orig_ofs, sms.orig_quat, &sms.orig_dist, &sms.orig_lens); } else { @@ -657,7 +658,10 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winx, int winy, return params.is_ortho; } -void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) /* rect: for picking */ +/*! + * \param rect for picking, NULL not to use. + */ +void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) { RegionView3D *rv3d = ar->regiondata; rctf viewplane; @@ -690,7 +694,7 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) /* rect: for if (orth) wmOrtho(rect->xmin, rect->xmax, rect->ymin, rect->ymax, -clipend, clipend); else wmFrustum(rect->xmin, rect->xmax, rect->ymin, rect->ymax, clipsta, clipend); - + } else { if (orth) wmOrtho(x1, x2, y1, y2, clipsta, clipend); @@ -786,7 +790,7 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d) { if (rv3d->persp == RV3D_CAMOB) { /* obs/camera */ if (v3d->camera) { - BKE_object_where_is_calc(scene, v3d->camera); + BKE_object_where_is_calc(scene, v3d->camera); obmat_to_viewmat(v3d, rv3d, v3d->camera, 0); } else { @@ -891,8 +895,8 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b glLoadName(code); draw_object(scene, ar, v3d, base, DRAW_PICKING | DRAW_CONSTCOLOR); - /* we draw group-duplicators for selection too */ - if ((base->object->transflag & OB_DUPLI) && base->object->dup_group) { + /* we draw duplicators for selection too */ + if ((base->object->transflag & OB_DUPLI)) { ListBase *lb; DupliObject *dob; Base tbase; @@ -919,7 +923,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b free_object_duplilist(lb); } code++; - } + } } } v3d->xray = FALSE; /* restore */ @@ -1037,7 +1041,7 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL locallay = free_localbit(bmain); if (locallay == 0) { - BKE_reportf(reports, RPT_ERROR, "No more than 8 local views"); + BKE_report(reports, RPT_ERROR, "No more than 8 local views"); ok = FALSE; } else { @@ -1192,7 +1196,7 @@ static int view3d_localview_exit(Main *bmain, Scene *scene, ScrArea *sa) DAG_on_visible_update(bmain, FALSE); return TRUE; - } + } else { return FALSE; } @@ -1265,12 +1269,12 @@ static void RestoreState(bContext *C, wmWindow *win) GPU_paint_set_mipmap(0); //XXX curarea->win_swap = 0; - //XXX curarea->head_swap=0; + //XXX curarea->head_swap = 0; //XXX allqueue(REDRAWVIEW3D, 1); //XXX allqueue(REDRAWBUTSALL, 0); //XXX reset_slowparents(); //XXX waitcursor(0); - //XXX G.qual= 0; + //XXX G.qual = 0; if (win) /* check because closing win can set to NULL */ win->queue = queue_back; @@ -1395,7 +1399,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) WM_redraw_windows(C); rv3d = CTX_wm_region_view3d(C); - /* sa= CTX_wm_area(C); */ /* UNUSED */ + /* sa = CTX_wm_area(C); */ /* UNUSED */ ar = CTX_wm_region(C); view3d_operator_needs_opengl(C); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 4a61978cc80..1537b4f61ce 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -277,7 +277,7 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2]) //vec[0] = vec[0]/((t->scene->r.frs_sec / t->scene->r.frs_sec_base)); /* same as below */ UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out + 1); - } + } else #endif { @@ -469,11 +469,11 @@ static void viewRedrawForce(const bContext *C, TransInfo *t) } else if (t->spacetype == SPACE_ACTION) { - //SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first; + //SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first; WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); } else if (t->spacetype == SPACE_IPO) { - //SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first; + //SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first; WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); } else if (t->spacetype == SPACE_NLA) { @@ -1020,7 +1020,7 @@ int transformEvent(TransInfo *t, wmEvent *event) if (t->flag & T_PROP_EDIT) { t->prop_size *= 1.1f; if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO) - t->prop_size = minf(t->prop_size, ((View3D *)t->view)->far); + t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->far); calculatePropRatio(t); } t->redraw |= TREDRAW_HARD; @@ -1190,7 +1190,7 @@ int transformEvent(TransInfo *t, wmEvent *event) if (event->alt && t->flag & T_PROP_EDIT) { t->prop_size *= 1.1f; if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO) - t->prop_size = minf(t->prop_size, ((View3D *)t->view)->far); + t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->far); calculatePropRatio(t); } t->redraw = 1; @@ -1264,6 +1264,8 @@ int transformEvent(TransInfo *t, wmEvent *event) } } } + else + handled = 0; // Per transform event, if present if (t->handleEvent) @@ -1484,8 +1486,8 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) float dx = t->mval[0] - cent[0], dy = t->mval[1] - cent[1]; float angle = atan2f(dy, dx); float dist = sqrtf(dx * dx + dy * dy); - float delta_angle = minf(15.0f / dist, (float)M_PI / 4.0f); - float spacing_angle = minf(5.0f / dist, (float)M_PI / 12.0f); + float delta_angle = min_ff(15.0f / dist, (float)M_PI / 4.0f); + float spacing_angle = min_ff(5.0f / dist, (float)M_PI / 12.0f); UI_ThemeColor(TH_WIRE); setlinestyle(3); @@ -1598,8 +1600,10 @@ static void drawTransformPixel(const struct bContext *UNUSED(C), ARegion *ar, vo */ if ((U.autokey_flag & AUTOKEY_FLAG_NOWARNING) == 0) { if (ar == t->ar) { - if (ob && autokeyframe_cfra_can_key(scene, &ob->id)) { - drawAutoKeyWarning(t, ar); + if (t->flag & (T_OBJECT | T_POSE)) { + if (ob && autokeyframe_cfra_can_key(scene, &ob->id)) { + drawAutoKeyWarning(t, ar); + } } } } @@ -3383,7 +3387,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short /* this function works on end result */ protectedAxisAngleBits(td->protectflag, td->ext->rotAxis, td->ext->rotAngle, td->ext->irotAxis, td->ext->irotAngle); } - else { + else { float eulmat[3][3]; mul_m3_m3m3(totmat, mat, td->ext->r_mtx); @@ -4811,7 +4815,7 @@ static BMLoop *get_next_loop(BMVert *v, BMLoop *l, } l = l->radial_next; - } while (l != firstl); + } while (l != firstl); if (i) mul_v3_fl(a, 1.0f / (float)i); @@ -5612,7 +5616,7 @@ static int doEdgeSlide(TransInfo *t, float perc) for (i = 0; i < sld->totsv; i++, sv++) { const float sv_length = len_v3v3(sv->up->co, sv->down->co); - const float fac = minf(sv_length, curr_length_perc) / sv_length; + const float fac = min_ff(sv_length, curr_length_perc) / sv_length; if (sld->flipped_vtx) { interp_v3_v3v3(sv->v->co, sv->down->co, sv->up->co, fac); @@ -6108,7 +6112,7 @@ static short getAnimEdit_DrawTime(TransInfo *t) SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first; drawtime = (sipo->flag & SIPO_DRAWTIME) ? 1 : 0; - } + } else { drawtime = 0; } @@ -6589,5 +6593,5 @@ int TimeScale(TransInfo *t, const int UNUSED(mval[2])) void BIF_TransformSetUndo(const char *UNUSED(str)) { // TRANSFORM_FIX_ME - //Trans.undostr= str; + //Trans.undostr = str; } diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 0aa46a36afe..311cb5ee94d 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -782,7 +782,7 @@ void startConstraint(TransInfo *t) { t->con.mode |= CON_APPLY; *t->con.text = ' '; - t->num.idx_max = MIN2(getConstraintSpaceDimension(t) - 1, t->idx_max); + t->num.idx_max = min_ii(getConstraintSpaceDimension(t) - 1, t->idx_max); } void stopConstraint(TransInfo *t) diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 2e9d1ee670f..53cedc78d5c 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -76,6 +76,7 @@ #include "BKE_gpencil.h" #include "BKE_key.h" #include "BKE_main.h" +#include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_movieclip.h" #include "BKE_nla.h" @@ -124,62 +125,46 @@ static short constraints_list_needinv(TransInfo *t, ListBase *list); /* ************************** Functions *************************** */ -static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, TransData *temp) +static int trans_data_compare_dist(const void *A, const void *B) { - TransData *ihead = head; - TransData *itail = tail; - *temp = *head; + const TransData *td_A = (const TransData*)A; + const TransData *td_B = (const TransData*)B; - while (head < tail) { - if (t->flag & T_PROP_CONNECTED) { - while ((tail->dist >= temp->dist) && (head < tail)) - tail--; - } - else { - while ((tail->rdist >= temp->rdist) && (head < tail)) - tail--; - } - - if (head != tail) { - *head = *tail; - head++; - } - - if (t->flag & T_PROP_CONNECTED) { - while ((head->dist <= temp->dist) && (head < tail)) - head++; - } - else { - while ((head->rdist <= temp->rdist) && (head < tail)) - head++; - } + if(td_A->dist < td_B->dist) + return -1; + else if(td_A->dist > td_B->dist) + return 1; + + return 0; +} - if (head != tail) { - *tail = *head; - tail--; - } - } +static int trans_data_compare_rdist(const void *A, const void *B) +{ + const TransData *td_A = (const TransData*)A; + const TransData *td_B = (const TransData*)B; - *head = *temp; - if (ihead < head) { - qsort_trans_data(t, ihead, head - 1, temp); - } - if (itail > head) { - qsort_trans_data(t, head + 1, itail, temp); - } + if(td_A->rdist < td_B->rdist) + return -1; + else if(td_A->rdist > td_B->rdist) + return 1; + + return 0; } void sort_trans_data_dist(TransInfo *t) { - TransData temp; TransData *start = t->data; - int i = 1; + int i; - while (i < t->total && start->flag & TD_SELECTED) { + for (i = 0; i < t->total && start->flag & TD_SELECTED; i++) start++; - i++; + + if (i < t->total) { + if (t->flag & T_PROP_CONNECTED) + qsort(start, t->total - i, sizeof(TransData), trans_data_compare_dist); + else + qsort(start, t->total - i, sizeof(TransData), trans_data_compare_rdist); } - qsort_trans_data(t, start, t->data + t->total - 1, &temp); } static void sort_trans_data(TransInfo *t) @@ -332,7 +317,7 @@ static void createTransEdge(TransInfo *t) invert_m3_m3(smtx, mtx); BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) { - if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && (BM_elem_flag_test(eed, BM_ELEM_SELECT) || propmode)) { + if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && (BM_elem_flag_test(eed, BM_ELEM_SELECT) || propmode)) { float *bweight = CustomData_bmesh_get(&em->bm->edata, eed->head.data, CD_BWEIGHT); float *crease = CustomData_bmesh_get(&em->bm->edata, eed->head.data, CD_CREASE); @@ -419,7 +404,7 @@ static short apply_targetless_ik(Object *ob) float rmat[4][4] /*, tmat[4][4], imat[4][4]*/; /* pose_mat(b) = pose_mat(b-1) * offs_bone * channel * constraint * IK */ - /* we put in channel the entire result of rmat= (channel * constraint * IK) */ + /* we put in channel the entire result of rmat = (channel * constraint * IK) */ /* pose_mat(b) = pose_mat(b-1) * offs_bone * rmat */ /* rmat = pose_mat(b) * inv(pose_mat(b-1) * offs_bone ) */ @@ -850,7 +835,7 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan) con = add_pose_constraint(NULL, pchan, "TempConstraint", CONSTRAINT_TYPE_KINEMATIC); pchan->constflag |= (PCHAN_HAS_IK | PCHAN_HAS_TARGET); /* for draw, but also for detecting while pose solving */ data = con->data; - if (targetless) { + if (targetless) { /* if exists, use values from last targetless (but disabled) IK-constraint as base */ *data = *targetless; } @@ -973,7 +958,7 @@ static void createTransPose(TransInfo *t, Object *ob) if (arm->flag & ARM_RESTPOS) { if (ELEM(t->mode, TFM_DUMMY, TFM_BONESIZE) == 0) { // XXX use transform operator reports - // BKE_report(op->reports, RPT_ERROR, "Can't select linked when sync selection is enabled"); + // BKE_report(op->reports, RPT_ERROR, "Cannot select linked when sync selection is enabled"); return; } } @@ -1830,7 +1815,7 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f d2 = d + len_v3(vec); if (dists[BM_elem_index_get(v3)] != FLT_MAX) - dists[BM_elem_index_get(v3)] = minf(d2, dists[BM_elem_index_get(v3)]); + dists[BM_elem_index_get(v3)] = min_ff(d2, dists[BM_elem_index_get(v3)]); else dists[BM_elem_index_get(v3)] = d2; @@ -2359,6 +2344,7 @@ static void createTransUVs(bContext *C, TransInfo *t) SpaceImage *sima = CTX_wm_space_image(C); Image *ima = CTX_data_edit_image(C); Scene *scene = t->scene; + ToolSettings *ts = CTX_data_tool_settings(C); TransData *td = NULL; TransData2D *td2d = NULL; MTexPoly *tf; @@ -2367,12 +2353,26 @@ static void createTransUVs(bContext *C, TransInfo *t) BMFace *efa; BMLoop *l; BMIter iter, liter; - int count = 0, countsel = 0; + UvElementMap *elementmap; + char *island_enabled; + int count = 0, countsel = 0, count_rejected = 0; int propmode = t->flag & T_PROP_EDIT; + int propconnected = t->flag & T_PROP_CONNECTED; if (!ED_space_image_show_uvedit(sima, t->obedit)) return; /* count */ + if (propconnected) { + /* create element map with island information */ + if (ts->uv_flag & UV_SYNC_SELECTION) { + elementmap = EDBM_uv_element_map_create (em, FALSE, TRUE); + } + else { + elementmap = EDBM_uv_element_map_create (em, TRUE, TRUE); + } + island_enabled = MEM_callocN(sizeof(*island_enabled) * elementmap->totalIslands, "TransIslandData(UV Editing)"); + } + BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); @@ -2380,14 +2380,22 @@ static void createTransUVs(bContext *C, TransInfo *t) BM_elem_flag_disable(efa, BM_ELEM_TAG); continue; } - + BM_elem_flag_enable(efa, BM_ELEM_TAG); BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { - if (uvedit_uv_select_test(em, scene, l)) + if (uvedit_uv_select_test(em, scene, l)) { countsel++; - if (propmode) + if (propconnected) { + UvElement *element = ED_uv_element_get(elementmap, efa, l); + island_enabled[element->island] = TRUE; + } + + } + + if (propmode) { count++; + } } } @@ -2413,12 +2421,26 @@ static void createTransUVs(bContext *C, TransInfo *t) BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { if (!propmode && !uvedit_uv_select_test(em, scene, l)) continue; + + if (propconnected) { + UvElement *element = ED_uv_element_get(elementmap, efa, l); + if (!island_enabled[element->island]) { + count_rejected++; + continue; + } + } luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); UVsToTransData(sima, td++, td2d++, luv->uv, uvedit_uv_select_test(em, scene, l)); } } + if (propconnected) { + t->total -= count_rejected; + EDBM_uv_element_map_free(elementmap); + MEM_freeN(island_enabled); + } + if (sima->flag & SI_LIVE_UNWRAP) ED_uvedit_live_unwrap_begin(t->scene, t->obedit); } @@ -2510,8 +2532,8 @@ void clipUVData(TransInfo *t) if ((td->flag & TD_SKIP) || (!td->loc)) continue; - td->loc[0] = minf(maxf(0.0f, td->loc[0]), aspx); - td->loc[1] = minf(maxf(0.0f, td->loc[1]), aspy); + td->loc[0] = min_ff(max_ff(0.0f, td->loc[0]), aspx); + td->loc[1] = min_ff(max_ff(0.0f, td->loc[1]), aspy); } } @@ -3416,14 +3438,14 @@ static void bezt_to_transdata(TransData *td, TransData2D *td2d, AnimData *adt, B if (td->flag & TD_MOVEHANDLE1) { td2d->h1 = bezt->vec[0]; copy_v2_v2(td2d->ih1, td2d->h1); - } - else + } + else td2d->h1 = NULL; if (td->flag & TD_MOVEHANDLE2) { td2d->h2 = bezt->vec[2]; copy_v2_v2(td2d->ih2, td2d->h2); - } + } else td2d->h2 = NULL; @@ -3527,7 +3549,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) if (sel1) count++; if (sel3) count++; } - } + } else if (sipo->around == V3D_LOCAL) { /* for local-pivot we only need to count the number of selected handles only, so that centerpoints don't * don't get moved wrong @@ -3622,18 +3644,18 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) if (sel1) { hdata = initTransDataCurveHandles(td, bezt); bezt_to_transdata(td++, td2d++, adt, bezt, 0, 1, 1, intvals, mtx, smtx); - } + } else { - /* h1= 0; */ /* UNUSED */ + /* h1 = 0; */ /* UNUSED */ } if (sel3) { if (hdata == NULL) hdata = initTransDataCurveHandles(td, bezt); bezt_to_transdata(td++, td2d++, adt, bezt, 2, 1, 1, intvals, mtx, smtx); - } + } else { - /* h2= 0; */ /* UNUSED */ + /* h2 = 0; */ /* UNUSED */ } } @@ -4263,7 +4285,7 @@ static void freeSeqData(TransInfo *t) for (a = 0; a < t->total; a++, td++) { seq = ((TransDataSeq *)td->extra)->seq; if ((seq != seq_prev)) { - minframe = mini(minframe, seq->startdisp); + minframe = min_ii(minframe, seq->startdisp); } } @@ -4469,6 +4491,7 @@ static short constraints_list_needinv(TransInfo *t, ListBase *list) if (con->type == CONSTRAINT_TYPE_FOLLOWPATH) return 1; if (con->type == CONSTRAINT_TYPE_CLAMPTO) return 1; if (con->type == CONSTRAINT_TYPE_OBJECTSOLVER) return 1; + if (con->type == CONSTRAINT_TYPE_FOLLOWTRACK) return 1; /* constraints that require this only under special conditions */ if (con->type == CONSTRAINT_TYPE_ROTLIKE) { @@ -4545,7 +4568,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob) td->ext->irotAngle = ob->rotAngle; copy_v3_v3(td->ext->irotAxis, ob->rotAxis); - // td->ext->drotAngle= ob->drotAngle; // XXX, not implemented + // td->ext->drotAngle = ob->drotAngle; // XXX, not implemented // copy_v3_v3(td->ext->drotAxis, ob->drotAxis); // XXX, not implemented } else { @@ -4603,7 +4626,7 @@ static void set_trans_object_base_flags(TransInfo *t) /* * if Base selected and has parent selected: - * base->flag= BA_WAS_SEL + * base->flag = BA_WAS_SEL */ Base *base; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index a9d9ec7b010..f550cb05a8b 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -705,7 +705,7 @@ static void recalcData_view3d(TransInfo *t) BKE_nurb_handles_calc(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */ nu = nu->next; } - } + } else { /* Normal updating */ while (nu) { @@ -1002,9 +1002,9 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) /* moving: is shown in drawobject() (transform color) */ // TRANSFORM_FIX_ME -// if (obedit || (t->flag & T_POSE) ) G.moving= G_TRANSFORM_EDIT; -// else if (G.f & G_PARTICLEEDIT) G.moving= G_TRANSFORM_PARTICLE; -// else G.moving= G_TRANSFORM_OBJ; +// if (obedit || (t->flag & T_POSE) ) G.moving = G_TRANSFORM_EDIT; +// else if (G.f & G_PARTICLEEDIT) G.moving = G_TRANSFORM_PARTICLE; +// else G.moving = G_TRANSFORM_OBJ; t->scene = sce; t->sa = sa; @@ -1252,7 +1252,7 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) /* TRANSFORM_FIX_ME rna restrictions */ if (t->prop_size <= 0.00001f) { - printf("Proportional size (%f) under 0.00001, reseting to 1!\n", t->prop_size); + printf("Proportional size (%f) under 0.00001, resetting to 1!\n", t->prop_size); t->prop_size = 1.0f; } @@ -1712,8 +1712,9 @@ void calculatePropRatio(TransInfo *t) /* * The elements are sorted according to their dist member in the array, * that means we can stop when it finds one element outside of the propsize. + * do not set td->flag |= TD_NOACTION , the prop circle is being changed. */ - td->flag |= TD_NOACTION; + td->factor = 0.0f; restoreElement(td); } diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 74a2292d74c..0780b8f90b5 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -441,7 +441,7 @@ int calc_manipulator_stats(const bContext *C) } else if (obedit->type == OB_MBALL) { MetaBall *mb = (MetaBall *)obedit->data; - MetaElem *ml /* , *ml_sel=NULL */ /* UNUSED */; + MetaElem *ml /* , *ml_sel = NULL */ /* UNUSED */; ml = mb->editelems->first; while (ml) { @@ -498,7 +498,7 @@ int calc_manipulator_stats(const bContext *C) } } else if (ob && (ob->mode & OB_MODE_ALL_PAINT)) { - ; + /* pass */ } else if (ob && ob->mode & OB_MODE_PARTICLE_EDIT) { PTCacheEdit *edit = PE_get_current(scene, ob); diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index fc0c174a525..916cf540589 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -284,7 +284,7 @@ static int create_orientation_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "name", name); if (use && !CTX_wm_view3d(C)) { - BKE_report(op->reports, RPT_ERROR, "Create Orientation \"use\" parameter only valid in a 3dView context"); + BKE_report(op->reports, RPT_ERROR, "Create Orientation's 'use' parameter only valid in a 3DView context"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 845d5b73f0c..70e4d4cd027 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -142,7 +142,7 @@ TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports) strncpy(name, ob->id.name + 2, MAX_ID_NAME - 2); } - return addMatrixSpace(C, mat, name, overwrite); + return addMatrixSpace(C, mat, name, overwrite); } TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *name, int overwrite) diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 94b8abb8850..baca4629883 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -723,14 +723,14 @@ static float RotationBetween(TransInfo *t, float p1[3], float p2[3]) { float angle, start[3], end[3], center[3]; - copy_v3_v3(center, t->center); + copy_v3_v3(center, t->center); if (t->flag & (T_EDIT | T_POSE)) { Object *ob = t->obedit ? t->obedit : t->poseobj; mul_m4_v3(ob->obmat, center); } sub_v3_v3v3(start, p1, center); - sub_v3_v3v3(end, p2, center); + sub_v3_v3v3(end, p2, center); // Angle around a constraint axis (error prone, will need debug) if (t->con.applyRot != NULL && (t->con.mode & CON_APPLY)) { @@ -779,7 +779,7 @@ static float ResizeBetween(TransInfo *t, float p1[3], float p2[3]) { float d1[3], d2[3], center[3], len_d1; - copy_v3_v3(center, t->center); + copy_v3_v3(center, t->center); if (t->flag & (T_EDIT | T_POSE)) { Object *ob = t->obedit ? t->obedit : t->poseobj; mul_m4_v3(ob->obmat, center); @@ -846,7 +846,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) p2 = NULL; p1->flag = 1; - /* if peeling objects, take the first and last from each object */ + /* if peeling objects, take the first and last from each object */ if (t->settings->snap_flag & SCE_SNAP_PEEL_OBJECT) { DepthPeel *peel; for (peel = p1->next; peel; peel = peel->next) { @@ -982,7 +982,7 @@ static void TargetSnapCenter(TransInfo *t) { /* Only need to calculate once */ if ((t->tsnap.status & TARGET_INIT) == 0) { - copy_v3_v3(t->tsnap.snapTarget, t->center); + copy_v3_v3(t->tsnap.snapTarget, t->center); if (t->flag & (T_EDIT | T_POSE)) { Object *ob = t->obedit ? t->obedit : t->poseobj; @@ -991,7 +991,7 @@ static void TargetSnapCenter(TransInfo *t) TargetSnapOffset(t, NULL); - t->tsnap.status |= TARGET_INIT; + t->tsnap.status |= TARGET_INIT; } } @@ -1027,7 +1027,7 @@ static void TargetSnapActive(TransInfo *t) t->tsnap.target = SCE_SNAP_TARGET_MEDIAN; t->tsnap.targetSnap = TargetSnapMedian; TargetSnapMedian(t); - } + } } } @@ -1055,7 +1055,7 @@ static void TargetSnapMedian(TransInfo *t) TargetSnapOffset(t, NULL); - t->tsnap.status |= TARGET_INIT; + t->tsnap.status |= TARGET_INIT; } } @@ -1166,7 +1166,7 @@ static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], fl mul_m4_v3(obmat, location); - new_depth = len_v3v3(location, ray_start); + new_depth = len_v3v3(location, ray_start); ED_view3d_project_int(ar, location, screen_loc); new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]); @@ -1182,7 +1182,7 @@ static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], fl normalize_v3(no); *dist = new_dist; - } + } } return retval; @@ -1234,7 +1234,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh mul_m4_v3(obmat, location); - new_depth = len_v3v3(location, ray_start); + new_depth = len_v3v3(location, ray_start); if (ED_view3d_project_int_global(ar, location, screen_loc, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) { new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]); @@ -1259,17 +1259,17 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh mul = dot_v3v3(vec, edge_loc) / dot_v3v3(edge_loc, edge_loc); if (r_no) { - normal_short_to_float_v3(n1, v1no); + normal_short_to_float_v3(n1, v1no); normal_short_to_float_v3(n2, v2no); interp_v3_v3v3(r_no, n2, n1, mul); mul_m3_v3(timat, r_no); normalize_v3(r_no); - } + } copy_v3_v3(r_loc, location); *r_dist = new_dist; - } + } } } @@ -1318,7 +1318,7 @@ static int snapVertex(ARegion *ar, float vco[3], short vno[3], float obmat[][4], } *r_dist = new_dist; - } + } } return retval; @@ -1425,7 +1425,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh switch (snap_mode) { case SCE_SNAP_MODE_FACE: - { + { #ifdef USE_BVH_FACE_SNAP // Added for durian BVHTreeRayHit hit; BVHTreeFromMesh treeData; @@ -1858,7 +1858,7 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], mul_m4_v3(obmat, location); - new_depth = len_v3v3(location, ray_start); + new_depth = len_v3v3(location, ray_start); mul_m3_v3(timat, normal); normalize_v3(normal); @@ -1893,7 +1893,7 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], normalize_v3(normal); addDepthPeel(depth_peels, new_depth, location, normal, ob); - } + } } } } diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c index 9a3b0476205..c8c26ed771d 100644 --- a/source/blender/editors/util/editmode_undo.c +++ b/source/blender/editors/util/editmode_undo.c @@ -104,7 +104,7 @@ static UndoElem *curundo = NULL; static void undo_restore(UndoElem *undo, void *editdata, void *obdata) { if (undo) { - undo->to_editmode(undo->undodata, editdata, obdata); + undo->to_editmode(undo->undodata, editdata, obdata); } } @@ -233,7 +233,7 @@ static void undo_clean_stack(bContext *C) if (curundo == NULL) curundo = undobase.last; } -/* 1= an undo, -1 is a redo. we have to make sure 'curundo' remains at current situation */ +/* 1 = an undo, -1 is a redo. we have to make sure 'curundo' remains at current situation */ void undo_editmode_step(bContext *C, int step) { Object *obedit = CTX_data_edit_object(C); diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index 5eafc3e65a9..1753a564a3c 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -505,7 +505,7 @@ static int undo_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even MEM_freeN(item); uiPupMenuEnd(C, pup); - } + } } return OPERATOR_CANCELLED; diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 7aaae404d15..9c2c300c530 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -534,7 +534,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { tf = CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_MTEXPOLY); - if (uvedit_face_visible_test(scene, ima, efa, tf)) { + if (uvedit_face_visible_test(scene, ima, efa, tf)) { BM_elem_flag_enable(efa, BM_ELEM_TAG); } else { @@ -818,7 +818,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) bglVertex2fv(luv->uv); } } - bglEnd(); + bglEnd(); } glPointSize(1.0); diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h index 3a89d6ce892..b42875f20c2 100644 --- a/source/blender/editors/uvedit/uvedit_intern.h +++ b/source/blender/editors/uvedit/uvedit_intern.h @@ -72,7 +72,6 @@ void uv_find_nearest_edge(struct Scene *scene, struct Image *ima, struct BMEditM /* utility tool functions */ -struct UvElement *ED_uv_element_get(struct UvElementMap *map, struct BMFace *efa, struct BMLoop *l); void uvedit_live_unwrap_update(struct SpaceImage *sima, struct Scene *scene, struct Object *obedit); /* operators */ diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index acc69309a8c..4b008d9a30f 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -895,19 +895,6 @@ int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, const float c return found; } -UvElement *ED_uv_element_get(UvElementMap *map, BMFace *efa, BMLoop *l) -{ - UvElement *element; - - element = map->vert[BM_elem_index_get(l->v)]; - - for (; element; element = element->next) - if (element->face == efa) - return element; - - return NULL; -} - /*********************** loop select ***********************/ static void select_edgeloop_uv_vertex_loop_flag(UvMapVert *first) @@ -1953,7 +1940,7 @@ static int mouse_select(bContext *C, const float co[2], int extend, int loop) } flush = 1; - } + } } } else { diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index f017394356e..5b6125b558b 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -1566,7 +1566,7 @@ static void p_vert_harmonic_insert(PVert *v) e = v->edge; do { - npoints++; + npoints++; e = p_wheel_edge_next(e); } while (e && (e != v->edge)); @@ -3306,7 +3306,7 @@ static void p_chart_stretch_minimize(PChart *chart, RNG *rng) trusted_radius /= 2 * nedges; - random_angle = rng_getFloat(rng) * 2.0f * (float)M_PI; + random_angle = BLI_rng_get_float(rng) * 2.0f * (float)M_PI; dir[0] = trusted_radius * cosf(random_angle); dir[1] = trusted_radius * sinf(random_angle); @@ -3988,7 +3988,7 @@ static void p_smooth(PChart *chart) diff[1] = p[1] - oldp[1]; length = sqrt(diff[0] * diff[0] + diff[1] * diff[1]); - d = MAX2(d, length); + d = max_ff(d, length); moved += length; } } @@ -4285,7 +4285,7 @@ void param_stretch_begin(ParamHandle *handle) param_assert(phandle->state == PHANDLE_STATE_CONSTRUCTED); phandle->state = PHANDLE_STATE_STRETCH; - phandle->rng = rng_new(31415926); + phandle->rng = BLI_rng_new(31415926); phandle->blend = 0.0f; for (i = 0; i < phandle->ncharts; i++) { @@ -4332,7 +4332,7 @@ void param_stretch_end(ParamHandle *handle) param_assert(phandle->state == PHANDLE_STATE_STRETCH); phandle->state = PHANDLE_STATE_CONSTRUCTED; - rng_free(phandle->rng); + BLI_rng_free(phandle->rng); phandle->rng = NULL; } @@ -4400,7 +4400,7 @@ void param_pack(ParamHandle *handle, float margin) if (margin > 0.0f) area += sqrt(box->w * box->h); - } + } if (margin > 0.0f) { /* multiply the margin by the area to give predictable results not dependent on UV scale, diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 2b225118472..b1945c37048 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -432,8 +432,8 @@ static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchState *sta edgesin = uv1[0] * uv2[1] - uv2[0] * uv1[1]; rotation = (edgesin > 0.0f) ? - +acosf(maxf(-1.0f, minf(1.0f, edgecos))) : - -acosf(maxf(-1.0f, minf(1.0f, edgecos))); + +acosf(max_ff(-1.0f, min_ff(1.0f, edgecos))) : + -acosf(max_ff(-1.0f, min_ff(1.0f, edgecos))); island_stitch_data[element1->island].num_rot_elements++; island_stitch_data[element1->island].rotation += rotation; diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 19a1c4339ad..74d007e92c0 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -408,7 +408,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e smd.levels = scene->toolsettings->uv_subsurf_level; smd.subdivType = ME_CC_SUBSURF; - initialDerived = CDDM_from_BMEditMesh(em, NULL, 0, 0); + initialDerived = CDDM_from_editbmesh(em, FALSE, FALSE); derivedMesh = subsurf_make_derived_from_derived(initialDerived, &smd, NULL, SUBSURF_IN_EDIT_MODE); @@ -1436,8 +1436,8 @@ static void uv_map_mirror(BMEditMesh *em, BMFace *efa, MTexPoly *UNUSED(tf)) if (i != mi) { dx = uvs[mi][0] - uvs[i][0]; if (dx > 0.5f) uvs[i][0] += 1.0f; - } - } + } + } BLI_array_fixedstack_free(uvs); } |