diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-03-03 05:43:44 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-03-03 05:43:44 +0400 |
commit | 9e93fc1e8acacb99b4b7638590ca4f1491e8b587 (patch) | |
tree | e42fb8ecc337a617a98e01f6c882b890ab9387e6 /source/blender/editors | |
parent | 00782aae1f5f3159c7afb1cb227bd8de1bc4b9c4 (diff) | |
parent | 95bba22af075148f9cbdb5a9b1ef41aeff1f560f (diff) |
Merged changes in the trunk up to revision 44612.
Conflicts resolved:
source/blender/blenloader/intern/readfile.c
source/blender/bmesh/bmesh.h
Diffstat (limited to 'source/blender/editors')
103 files changed, 848 insertions, 801 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index e6be35c48a7..d5282249dc3 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -2571,12 +2571,12 @@ static bAnimChannelType ACF_GPL = static bAnimChannelType *animchannelTypeInfo[ANIMTYPE_NUM_TYPES]; static short ACF_INIT= 1; /* when non-zero, the list needs to be updated */ -/* Initialise type info definitions */ +/* Initialize type info definitions */ static void ANIM_init_channel_typeinfo_data (void) { int type= 0; - /* start initialising if necessary... */ + /* start initializing if necessary... */ if (ACF_INIT) { ACF_INIT= 0; @@ -3361,7 +3361,7 @@ void ANIM_channel_draw_widgets (bContext *C, bAnimContext *ac, bAnimListElem *al * - even if we can draw sliders for this view, we must also check that the channel-type supports them * (only only F-Curves really can support them for now) * - to make things easier, we use RNA-autobuts for this so that changes are reflected immediately, - * whereever they occurred. BUT, we don't use the layout engine, otherwise we'd get wrong alignment, + * wherever they occurred. BUT, we don't use the layout engine, otherwise we'd get wrong alignment, * and wouldn't be able to auto-keyframe... * - slider should start before the toggles (if they're visible) to keep a clean line down the side */ diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 0c8d633be5c..20582e40ce4 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -371,7 +371,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype, * - anim_data: list of the all the anim channels that can be chosen * -> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too, * then the channels under closed expanders get ignored... - * - ale_setting: the anim channel (not in the anim_data list directly, though occuring there) + * - ale_setting: the anim channel (not in the anim_data list directly, though occurring there) * with the new state of the setting that we want flushed up/down the hierarchy * - setting: type of setting to set * - on: whether the visibility setting has been enabled or disabled @@ -955,7 +955,7 @@ static void split_groups_action_temp (bAction *act, bActionGroup *tgrp) } } - /* Initialise memory for temp-group */ + /* Initialize memory for temp-group */ memset(tgrp, 0, sizeof(bActionGroup)); tgrp->flag |= (AGRP_EXPANDED|AGRP_TEMP); BLI_strncpy(tgrp->name, "#TempGroup", sizeof(tgrp->name)); @@ -1788,7 +1788,7 @@ static int animchannels_deselectall_exec (bContext *C, wmOperator *op) if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - /* 'standard' behaviour - check if selected, then apply relevant selection */ + /* 'standard' behavior - check if selected, then apply relevant selection */ if (RNA_boolean_get(op->ptr, "invert")) ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, 0, ACHANNEL_SETFLAG_TOGGLE); else diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index 3f851938a83..8e91e575db1 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -115,7 +115,7 @@ void ANIM_id_update(Scene *UNUSED(scene), ID *id) } /* **************************** animation data <-> data syncing ******************************** */ -/* This code here is used to synchronise the +/* This code here is used to synchronize the * - selection (to find selected data easier) * - ... (insert other relevant items here later) * status in relevant Blender data with the status stored in animation channels. diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 32e5fe82ed4..714c3276769 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -189,7 +189,7 @@ static void draw_cfra_number (Scene *scene, View2D *v2d, float cfra, short time) /* get timecode string * - padding on str-buf passed so that it doesn't sit on the frame indicator - * - power = 0, gives 'standard' behaviour for time + * - power = 0, gives 'standard' behavior for time * but power = 1 is required for frames (to get integer frames) */ if (time) diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 00c849ed02d..7e92c9eb690 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -232,7 +232,7 @@ void ED_markers_get_minmax (ListBase *markers, short sel, float *first, float *l selcount= BLI_countlist(markers); /* if only selected are to be considered, only consider the selected ones - * (optimisation for not searching list) + * (optimization for not searching list) */ if (selcount > 1) { for (marker= markers->first; marker; marker= marker->next) { @@ -323,7 +323,7 @@ TimeMarker *ED_markers_get_first_selected(ListBase *markers) /* --------------------------------- */ /* Print debugging prints of list of markers - * BSI's: do NOT make static or put in if-defs as "unused code". That's too much trouble when we need to use for quick debuggging! + * BSI's: do NOT make static or put in if-defs as "unused code". That's too much trouble when we need to use for quick debugging! */ void debug_markers_print_list(ListBase *markers) { @@ -933,7 +933,7 @@ static void ed_marker_duplicate_apply(bContext *C) return; /* go through the list of markers, duplicate selected markers and add duplicated copies - * to the begining of the list (unselect original markers) + * to the beginning of the list (unselect original markers) */ for (marker= markers->first; marker; marker= marker->next) { if (marker->flag & SELECT) { @@ -950,7 +950,7 @@ static void ed_marker_duplicate_apply(bContext *C) newmarker->camera= marker->camera; #endif - /* new marker is added to the begining of list */ + /* new marker is added to the beginning of list */ // FIXME: bad ordering! BLI_addhead(markers, newmarker); } @@ -1339,7 +1339,7 @@ static int ed_marker_rename_exec(bContext *C, wmOperator *op) static int ed_marker_rename_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt) { - /* must initialise the marker name first if there is a marker selected */ + /* must initialize the marker name first if there is a marker selected */ TimeMarker *marker = ED_markers_get_first_selected(ED_context_get_markers(C)); if (marker) RNA_string_set(op->ptr, "name", marker->name); diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 05f9248e0a6..0b63a0ad752 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -175,7 +175,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s } break; - case FCM_GENERATOR_POLYNOMIAL_FACTORISED: /* factorised polynomial expression */ + case FCM_GENERATOR_POLYNOMIAL_FACTORISED: /* Factorized polynomial expression */ { float *cp = NULL; unsigned int i; @@ -312,7 +312,7 @@ static int binarysearch_fcm_envelopedata_index (FCM_EnvelopeData array[], float int start=0, end=arraylen; int loopbreaker= 0, maxloop= arraylen * 2; - /* initialise exists-flag first */ + /* initialize exists-flag first */ *exists= 0; /* sneaky optimisations (don't go through searching process if...): diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index c1e81cd0901..8b93688f4cb 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -374,7 +374,7 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, DLRBT_Tree *beztTree, ActKeyBlock *ab, *abn=NULL; /* try to find a keyblock that starts on the previous beztriple, and add a new one if none start there - * Note: we can't search from end to try to optimise this as it causes errors there's + * Note: we can't search from end to try to optimize this as it causes errors there's * an A ___ B |---| B situation */ // FIXME: here there is a bug where we are trying to get the summary for the following channels @@ -499,7 +499,7 @@ void draw_keyframe_shape (float x, float y, float xscale, float hsize, short sel static GLuint displist1=0; static GLuint displist2=0; - /* initialise 2 display lists for diamond shape - one empty, one filled */ + /* initialize 2 display lists for diamond shape - one empty, one filled */ if (displist1 == 0) { displist1= glGenLists(1); glNewList(displist1, GL_COMPILE); @@ -621,7 +621,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa float kalpha = (channelLocked)? 0.35f : 1.0f; for (ak= keys->first; ak; ak= ak->next) { - /* optimisation: if keyframe doesn't appear within 5 units (screenspace) in visible area, don't draw + /* optimization: if keyframe doesn't appear within 5 units (screenspace) in visible area, don't draw * - this might give some improvements, since we current have to flip between view/region matrices */ if (IN_RANGE_INCL(ak->cfra, v2d->cur.xmin, v2d->cur.xmax) == 0) diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 5557923c3d6..5e617979716 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -446,7 +446,7 @@ static short new_key_needed (FCurve *fcu, float cFrame, float nValue) } else { /* just add a keyframe if there's only one keyframe - * and the new one occurs before the exisiting one does. + * and the new one occurs before the existing one does. */ if ((cFrame < beztPosi) && (totCount==1)) return KEYNEEDED_JUSTADD; @@ -755,7 +755,7 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_ * Use this when validation of necessary animation data is not necessary, since an RNA-pointer to the necessary * data being keyframed, and a pointer to the F-Curve to use have both been provided. * - * The flag argument is used for special settings that alter the behaviour of + * The flag argument is used for special settings that alter the behavior of * the keyframe insertion. These include the 'visual' keyframing modes, quick refresh, * and extra keyframe filtering. */ @@ -874,7 +874,7 @@ short insert_keyframe_direct (ReportList *reports, PointerRNA ptr, PropertyRNA * /* Main Keyframing API call: * Use this when validation of necessary animation data is necessary, since it may not exist yet. * - * The flag argument is used for special settings that alter the behaviour of + * The flag argument is used for special settings that alter the behavior of * the keyframe insertion. These include the 'visual' keyframing modes, quick refresh, * and extra keyframe filtering. * @@ -968,7 +968,7 @@ short insert_keyframe (ReportList *reports, ID *id, bAction *act, const char gro * Use this when validation of necessary animation data isn't necessary as it * already exists. It will delete a keyframe at the current frame. * - * The flag argument is used for special settings that alter the behaviour of + * The flag argument is used for special settings that alter the behavior of * the keyframe deletion. These include the quick refresh options. */ short delete_keyframe (ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short UNUSED(flag)) @@ -1239,8 +1239,8 @@ void ANIM_OT_keyframe_insert_menu (wmOperatorType *ot) RNA_def_property_flag(prop, PROP_HIDDEN); /* whether the menu should always be shown - * - by default, the menu should only be shown when there is no active Keying Set (2.5 behaviour), - * although in some cases it might be useful to always shown (pre 2.5 behaviour) + * - by default, the menu should only be shown when there is no active Keying Set (2.5 behavior), + * although in some cases it might be useful to always shown (pre 2.5 behavior) */ prop= RNA_def_boolean(ot->srna, "always_prompt", 0, "Always Show Menu", ""); RNA_def_property_flag(prop, PROP_HIDDEN); @@ -1711,7 +1711,7 @@ short id_frame_has_keyframe (ID *id, float frame, short filter) break; case ID_SCE: /* scene */ - // XXX TODO... for now, just use 'normal' behaviour + // XXX TODO... for now, just use 'normal' behavior // break; default: /* 'normal type' */ diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 25432260387..5d440bae2bc 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -839,7 +839,7 @@ typedef struct tRKS_DSource { } tRKS_DSource; -/* Iterator used for overriding the behaviour of iterators defined for +/* Iterator used for overriding the behavior of iterators defined for * relative Keying Sets, with the main usage of this being operators * requiring Auto Keyframing. Internal Use Only! */ diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 59645f10677..27a18980b34 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -4297,7 +4297,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor * armature object was not active yet. * note, special exception for armature mode so we can do multi-select * we could check for multi-select explicitly but think its fine to - * always give pradictable behavior in weight paint mode - campbell */ + * always give predictable behavior in weight paint mode - campbell */ if (!extend || ((ob_act && (ob_act != ob) && (ob_act->mode & OB_MODE_WEIGHT_PAINT)==0))) { ED_pose_deselectall(ob, 0); nearBone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL); diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 41a7b20de3d..9ea731150e8 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -1799,7 +1799,7 @@ void sk_applyCutGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED SK_Point pt; pt.type = PT_EXACT; - pt.mode = PT_PROJECT; /* take mode from neighbouring points */ + pt.mode = PT_PROJECT; /* take mode from neighboring points */ copy_v3_v3(pt.p, isect->p); copy_v3_v3(pt.no, isect->stroke->points[isect->before].no); @@ -1841,7 +1841,7 @@ void sk_applyTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSE float stroke_dir[3]; pt.type = PT_EXACT; - pt.mode = PT_PROJECT; /* take mode from neighbouring points */ + pt.mode = PT_PROJECT; /* take mode from neighboring points */ copy_v3_v3(pt.p, isect->p); copy_v3_v3(pt.no, isect->stroke->points[isect->before].no); diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index e2b89ba90e1..a592e727988 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -1494,7 +1494,7 @@ static float meshdeform_boundary_total_weight(MeshDeformBind *mdb, int x, int y, a= meshdeform_index(mdb, x, y, z, 0); - /* count weight for neighbour cells */ + /* count weight for neighbor cells */ for(i=1; i<=6; i++) { if(meshdeform_index(mdb, x, y, z, i) == -1) continue; diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index c28b688e377..8698ac00913 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -159,7 +159,7 @@ static int pose_slide_init (bContext *C, wmOperator *op, short mode) pso->ob->pose->flag |= POSE_LOCKED; pso->ob->pose->flag &= ~POSE_DO_UNLOCK; - /* do basic initialise of RB-BST used for finding keyframes, but leave the filling of it up + /* do basic initialize of RB-BST used for finding keyframes, but leave the filling of it up * to the caller of this (usually only invoke() will do it, to make things more efficient). */ BLI_dlrbTree_init(&pso->keys); @@ -730,7 +730,7 @@ static int pose_slide_push_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED( { tPoseSlideOp *pso; - /* initialise data */ + /* initialize data */ if (pose_slide_init(C, op, POSESLIDE_PUSH) == 0) { pose_slide_exit(op); return OPERATOR_CANCELLED; @@ -747,7 +747,7 @@ static int pose_slide_push_exec (bContext *C, wmOperator *op) { tPoseSlideOp *pso; - /* initialise data (from RNA-props) */ + /* initialize data (from RNA-props) */ if (pose_slide_init(C, op, POSESLIDE_PUSH) == 0) { pose_slide_exit(op); return OPERATOR_CANCELLED; @@ -787,7 +787,7 @@ static int pose_slide_relax_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED { tPoseSlideOp *pso; - /* initialise data */ + /* initialize data */ if (pose_slide_init(C, op, POSESLIDE_RELAX) == 0) { pose_slide_exit(op); return OPERATOR_CANCELLED; @@ -804,7 +804,7 @@ static int pose_slide_relax_exec (bContext *C, wmOperator *op) { tPoseSlideOp *pso; - /* initialise data (from RNA-props) */ + /* initialize data (from RNA-props) */ if (pose_slide_init(C, op, POSESLIDE_RELAX) == 0) { pose_slide_exit(op); return OPERATOR_CANCELLED; @@ -844,7 +844,7 @@ static int pose_slide_breakdown_invoke (bContext *C, wmOperator *op, wmEvent *UN { tPoseSlideOp *pso; - /* initialise data */ + /* initialize data */ if (pose_slide_init(C, op, POSESLIDE_BREAKDOWN) == 0) { pose_slide_exit(op); return OPERATOR_CANCELLED; @@ -861,7 +861,7 @@ static int pose_slide_breakdown_exec (bContext *C, wmOperator *op) { tPoseSlideOp *pso; - /* initialise data (from RNA-props) */ + /* initialize data (from RNA-props) */ if (pose_slide_init(C, op, POSESLIDE_BREAKDOWN) == 0) { pose_slide_exit(op); return OPERATOR_CANCELLED; @@ -1231,7 +1231,7 @@ static int pose_propagate_exec (bContext *C, wmOperator *op) void POSE_OT_propagate (wmOperatorType *ot) { static EnumPropertyItem terminate_items[]= { - {POSE_PROPAGATE_SMART_HOLDS, "WHILE_HELD", 0, "While Held", "Propagate pose to all keyframes after current frame that don't change (Default behaviour)"}, + {POSE_PROPAGATE_SMART_HOLDS, "WHILE_HELD", 0, "While Held", "Propagate pose to all keyframes after current frame that don't change (Default behavior)"}, {POSE_PROPAGATE_NEXT_KEY, "NEXT_KEY", 0, "To Next Keyframe", "Propagate pose to first keyframe following the current frame only"}, {POSE_PROPAGATE_LAST_KEY, "LAST_KEY", 0, "To Last Keyframe", "Propagate pose to the last keyframe only (i.e. making action cyclic)"}, {POSE_PROPAGATE_BEFORE_FRAME, "BEFORE_FRAME", 0, "Before Frame", "Propagate pose to all keyframes between current frame and 'Frame' property"}, diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 5ce44cb7a58..cd3017c0e0f 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -186,7 +186,7 @@ static int has_poselib_pose_data_poll (bContext *C) /* ----------------------------------- */ -/* Initialise a new poselib (whether it is needed or not) */ +/* Initialize a new poselib (whether it is needed or not) */ static bAction *poselib_init_new (Object *ob) { /* sanity checks - only for armatures */ @@ -201,7 +201,7 @@ static bAction *poselib_init_new (Object *ob) return ob->poselib; } -/* Initialise a new poselib (checks if that needs to happen) */ +/* Initialize a new poselib (checks if that needs to happen) */ static bAction *poselib_validate (Object *ob) { if (ELEM(NULL, ob, ob->pose)) diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index dc4af18be11..0d1a7c7173b 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -497,7 +497,7 @@ static short pose_select_same_group (bContext *C, Object *ob, short extend) } CTX_DATA_END; - /* small optimisation: only loop through bones a second time if there are any groups tagged */ + /* small optimization: only loop through bones a second time if there are any groups tagged */ if (tagged) { /* only if group matches (and is not selected or current bone) */ CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones) @@ -1164,7 +1164,7 @@ static int pose_paste_exec (bContext *C, wmOperator *op) } /* if selOnly option is enabled, if user hasn't selected any bones, - * just go back to default behaviour to be more in line with other pose tools + * just go back to default behavior to be more in line with other pose tools */ if (selOnly) { if (CTX_DATA_COUNT(C, selected_pose_bones) == 0) diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index e05f61de9dd..c09f4d16936 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -2367,7 +2367,7 @@ void CURVE_OT_smooth_radius(wmOperatorType *ot) /* next == 1 -> select next */ /* next == -1 -> select previous */ /* cont == 1 -> select continuously */ -/* selstatus, inverts behaviour */ +/* selstatus, inverts behavior */ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short selstatus) { Nurb *nu; @@ -5084,7 +5084,7 @@ static int select_more_exec(bContext *C, wmOperator *UNUSED(op)) short *selbpoints; /* note that NURBS surface is a special case because we mimic */ - /* the behaviour of "select more" of mesh tools. */ + /* the behavior of "select more" of mesh tools. */ /* The algorithm is designed to work in planar cases so it */ /* may not be optimal always (example: end of NURBS sphere) */ if(obedit->type==OB_SURF) { diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index cf3961e0820..19dc25dd282 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -286,7 +286,7 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness_s glEnd(); } - /* tesselation code - draw stroke as series of connected quads with connection + /* tessellation code - draw stroke as series of connected quads with connection * edges rotated to minimise shrinking artifacts, and rounded endcaps */ else diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index 81a5f6777e7..c932eb4c7d0 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -580,7 +580,7 @@ static short mirror_gpf_marker (bGPDframe *gpf, Scene *scene) } } else { - /* initialisation time */ + /* initialization time */ if (initialised) { /* reset everything for safety */ marker = NULL; diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c index 53ef16a70a0..46241f3d378 100644 --- a/source/blender/editors/gpencil/gpencil_buttons.c +++ b/source/blender/editors/gpencil/gpencil_buttons.c @@ -293,7 +293,7 @@ static void draw_gpencil_panel (bContext *C, uiLayout *layout, bGPdata *gpd, Poi } -/* Standard panel to be included whereever Grease Pencil is used... */ +/* Standard panel to be included wherever Grease Pencil is used... */ void gpencil_panel_standard(const bContext *C, Panel *pa) { bGPdata **gpd_ptr = NULL; diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 8d2454ffac4..673d7c637ff 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -524,7 +524,7 @@ static void gp_stroke_simplify (tGPsdata *p) float co[2], pressure; int mco[2]; - /* initialise values */ + /* initialize values */ co[0]= 0; co[1]= 0; pressure = 0; @@ -701,7 +701,7 @@ static void gp_stroke_newfrombuffer (tGPsdata *p) pt= gps->points; - /* convert all points (normal behaviour) */ + /* convert all points (normal behavior) */ for (i=0, ptc=gpd->sbuffer; i < gpd->sbuffer_size && ptc; i++, ptc++, pt++) { /* convert screen-coordinates to appropriate coordinates (and store them) */ gp_stroke_convertcoords(p, &ptc->x, &pt->x, depth_arr ? depth_arr+i:NULL); @@ -802,7 +802,7 @@ static short gp_stroke_eraser_strokeinside (int mval[], int UNUSED(mvalo[]), sho } /* eraser tool - evaluation per stroke */ -// TODO: this could really do with some optimisation (KD-Tree/BVH?) +// TODO: this could really do with some optimization (KD-Tree/BVH?) static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], short rad, rcti *rect, bGPDframe *gpf, bGPDstroke *gps) { bGPDspoint *pt1, *pt2; @@ -1600,7 +1600,7 @@ static int gpencil_draw_exec (bContext *C, wmOperator *op) //printf("GPencil - Starting Re-Drawing \n"); - /* try to initialise context data needed while drawing */ + /* try to initialize context data needed while drawing */ if (!gpencil_draw_init(C, op)) { if (op->customdata) MEM_freeN(op->customdata); //printf("\tGP - no valid data \n"); @@ -1674,7 +1674,7 @@ static int gpencil_draw_invoke (bContext *C, wmOperator *op, wmEvent *event) if (G.f & G_DEBUG) printf("GPencil - Starting Drawing \n"); - /* try to initialise context data needed while drawing */ + /* try to initialize context data needed while drawing */ if (!gpencil_draw_init(C, op)) { if (op->customdata) MEM_freeN(op->customdata); @@ -1938,7 +1938,7 @@ void GPENCIL_OT_draw (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; /* settings for drawing */ - RNA_def_enum(ot->srna, "mode", prop_gpencil_drawmodes, 0, "Mode", "Way to intepret mouse movements"); + RNA_def_enum(ot->srna, "mode", prop_gpencil_drawmodes, 0, "Mode", "Way to interpret mouse movements"); RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); } diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index b5dbf906d84..77c50f9ca6d 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -55,27 +55,27 @@ extern unsigned char stipple_diag_stripes_neg[128]; /** * Draw a lined (non-looping) arc with the given - * @a radius, starting at angle @a start and arcing - * through @a angle. The arc is centered at the origin + * \a radius, starting at angle \a start and arcing + * through \a angle. The arc is centered at the origin * and drawn in the XY plane. * - * @param start The initial angle (in radians). - * @param angle The length of the arc (in radians). - * @param radius The arc radius. - * @param nsegments The number of segments to use in drawing the arc. + * \param start The initial angle (in radians). + * \param angle The length of the arc (in radians). + * \param radius The arc radius. + * \param nsegments The number of segments to use in drawing the arc. */ void glutil_draw_lined_arc (float start, float angle, float radius, int nsegments); /** - * Draw a filled arc with the given @a radius, - * starting at angle @a start and arcing through - * @a angle. The arc is centered at the origin + * Draw a filled arc with the given \a radius, + * starting at angle \a start and arcing through + * \a angle. The arc is centered at the origin * and drawn in the XY plane. * - * @param start The initial angle (in radians). - * @param angle The length of the arc (in radians). - * @param radius The arc radius. - * @param nsegments The number of segments to use in drawing the arc. + * \param start The initial angle (in radians). + * \param angle The length of the arc (in radians). + * \param radius The arc radius. + * \param nsegments The number of segments to use in drawing the arc. */ void glutil_draw_filled_arc (float start, float angle, float radius, int nsegments); @@ -93,11 +93,11 @@ float glaGetOneFloat (int param); /** * Functions like glRasterPos2i, except ensures that the resulting - * raster position is valid. @a known_good_x and @a known_good_y + * raster position is valid. \a known_good_x and \a known_good_y * should be coordinates of a point known to be within the current * view frustum. - * @attention This routine should be used when the distance of @a x - * and @a y away from the known good point is small (ie. for small icons + * \attention This routine should be used when the distance of \a x + * and \a y away from the known good point is small (ie. for small icons * and for bitmap characters), when drawing large+zoomed images it is * possible for overflow to occur, the glaDrawPixelsSafe routine should * be used instead. @@ -106,20 +106,20 @@ void glaRasterPosSafe2f (float x, float y, float known_good_x, float known_good /** * Functions like a limited glDrawPixels, except ensures that - * the image is displayed onscreen even if the @a x and @a y + * the image is displayed onscreen even if the \a x and \a y * coordinates for would be clipped. The routine respects the * glPixelZoom values, pixel unpacking parameters are _not_ * respected. - * @attention This routine makes many assumptions: the rect data + * \attention This routine makes many assumptions: the rect data * is expected to be in RGBA unsigned byte format, the coordinate * (0.375, 0.375) is assumed to be within the view frustum, and the * modelview and projection matrices are assumed to define a * 1-to-1 mapping to screen space. - * @attention Furthmore, in the case of zoomed or unpixel aligned + * \attention Furthmore, in the case of zoomed or unpixel aligned * images extending outside the view frustum, but still within the * window, some portion of the image may be visible left and/or - * below of the given @a x and @a y coordinates. It is recommended + * below of the given \a x and \a y coordinates. It is recommended * to use the glScissor functionality if images are to be drawn * with an inset view matrix. */ @@ -132,7 +132,7 @@ void glaDrawPixelsSafe (float x, float y, int img_w, int img_h, int row_w, int * clipped when offscreen. The routine respects the glPixelZoom values, * pixel unpacking parameters are _not_ respected. - * @attention This routine makes many assumptions: the rect data + * \attention This routine makes many assumptions: the rect data * is expected to be in RGBA byte or float format, and the * modelview and projection matrices are assumed to define a * 1-to-1 mapping to screen space. @@ -152,7 +152,7 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, * thus no reason to +-0.5 the coordinates or perform other silly * tricks. * - * @param screen_rect The screen rectangle to be defined for 2D drawing. + * \param screen_rect The screen rectangle to be defined for 2D drawing. */ void glaDefine2DArea (struct rcti *screen_rect); @@ -170,17 +170,17 @@ typedef struct gla2DDrawInfo gla2DDrawInfo; * thus no reason to +-0.5 the coordinates or perform other silly * tricks. * - * @param screen_rect The screen rectangle to be used for 2D drawing. - * @param world_rect The world rectangle that the 2D area represented - * by @a screen_rect is supposed to represent. If NULL it is assumed the + * \param screen_rect The screen rectangle to be used for 2D drawing. + * \param world_rect The world rectangle that the 2D area represented + * by \a screen_rect is supposed to represent. If NULL it is assumed the * world has a 1 to 1 mapping to the screen. */ gla2DDrawInfo* glaBegin2DDraw (struct rcti *screen_rect, struct rctf *world_rect); - /** Translate the (@a wo_x, @a wo_y) point from world coordinates into screen space. */ + /** Translate the (\a wo_x, \a wo_y) point from world coordinates into screen space. */ void gla2DDrawTranslatePt (gla2DDrawInfo *di, float wo_x, float wo_y, int *sc_x_r, int *sc_y_r); - /** Translate the @a world point from world coordiantes into screen space. */ + /** Translate the \a world point from world coordiantes into screen space. */ void gla2DDrawTranslatePtv (gla2DDrawInfo *di, float world[2], int screen_r[2]); /* Restores the previous OpenGL state and free's the auxilary diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 9167b6c30d2..a8dc33ffccd 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -341,7 +341,7 @@ short ANIM_animdata_context_getdata(bAnimContext *ac); /* ------------------------ Drawing TypeInfo -------------------------- */ -/* flag-setting behaviour */ +/* flag-setting behavior */ typedef enum eAnimChannels_SetFlag { ACHANNEL_SETFLAG_CLEAR = 0, /* turn off */ ACHANNEL_SETFLAG_ADD, /* turn on */ @@ -360,7 +360,7 @@ typedef enum eAnimChannel_Settings { } eAnimChannel_Settings; -/* Drawing, mouse handling, and flag setting behaviour... */ +/* Drawing, mouse handling, and flag setting behavior... */ typedef struct bAnimChannelType { /* type data */ /* name of the channel type, for debugging */ @@ -429,7 +429,7 @@ void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting, * - anim_data: list of the all the anim channels that can be chosen * -> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too, * then the channels under closed expanders get ignored... - * - ale_setting: the anim channel (not in the anim_data list directly, though occuring there) + * - ale_setting: the anim channel (not in the anim_data list directly, though occurring there) * with the new state of the setting that we want flushed up/down the hierarchy * - setting: type of setting to set * - on: whether the visibility setting has been enabled or disabled diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 4b43233fe40..986c2abad69 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -292,7 +292,7 @@ void ED_mesh_vertices_remove(struct Mesh *mesh, struct ReportList *reports, int void ED_mesh_transform(struct Mesh *me, float *mat); void ED_mesh_calc_normals(struct Mesh *me); void ED_mesh_material_link(struct Mesh *me, struct Material *ma); -void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges); +void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges, int calc_tessface); int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me, const char *name, int active_set); int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 4c68b53d5cd..23321e0e48f 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -91,10 +91,10 @@ int initgrabz(struct RegionView3D *rv3d, float x, float y, float z); /** * Calculate a 3d location from 2d window coordinates. - * @param ar The region (used for the window width and height). - * @param depth_pt The reference location used to calculate the Z depth. - * @param mval The area relative location (such as event->mval converted to floats). - * @param out The resulting world-space location. + * \param ar The region (used for the window width and height). + * \param depth_pt The reference location used to calculate the Z depth. + * \param mval The area relative location (such as event->mval converted to floats). + * \param out The resulting world-space location. */ void ED_view3d_win_to_3d(struct ARegion *ar, const float depth_pt[3], const float mval[2], float out[3]); @@ -102,9 +102,9 @@ void ED_view3d_win_to_3d(struct ARegion *ar, const float depth_pt[3], const floa * Calculate a 3d difference vector from 2d window offset. * note that initgrabz() must be called first to determine * the depth used to calculate the delta. - * @param ar The region (used for the window width and height). - * @param mval The area relative 2d difference (such as event->mval[0] - other_x). - * @param out The resulting world-space delta. + * \param ar The region (used for the window width and height). + * \param mval The area relative 2d difference (such as event->mval[0] - other_x). + * \param out The resulting world-space delta. */ void ED_view3d_win_to_delta(struct ARegion *ar, const float mval[2], float out[3]); @@ -112,9 +112,9 @@ void ED_view3d_win_to_delta(struct ARegion *ar, const float mval[2], float out[3 * Calculate a 3d direction vector from 2d window coordinates. * This direction vector starts and the view in the direction of the 2d window coordinates. * In orthographic view all window coordinates yield the same vector. - * @param ar The region (used for the window width and height). - * @param mval The area relative 2d location (such as event->mval converted to floats). - * @param out The resulting normalized world-space direction vector. + * \param ar The region (used for the window width and height). + * \param mval The area relative 2d location (such as event->mval converted to floats). + * \param out The resulting normalized world-space direction vector. */ void ED_view3d_win_to_vector(struct ARegion *ar, const float mval[2], float out[3]); @@ -124,11 +124,11 @@ void ED_view3d_win_to_vector(struct ARegion *ar, const float mval[2], float out[ * ray_start and ray_end are clipped by the view near and far limits * so points along this line are always in view. * In orthographic view all resulting segments will be parallel. - * @param ar The region (used for the window width and height). - * @param v3d The 3d viewport (used for near and far clipping range). - * @param mval The area relative 2d location (such as event->mval, converted into float[2]). - * @param ray_start The world-space starting point of the segment. - * @param ray_end The world-space end point of the segment. + * \param ar The region (used for the window width and height). + * \param v3d The 3d viewport (used for near and far clipping range). + * \param mval The area relative 2d location (such as event->mval, converted into float[2]). + * \param ray_start The world-space starting point of the segment. + * \param ray_end The world-space end point of the segment. */ void ED_view3d_win_to_segment_clip(struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3]); @@ -137,58 +137,58 @@ void ED_view3d_win_to_segment_clip(struct ARegion *ar, struct View3D *v3d, const * This ray_start is located at the viewpoint, ray_normal is the direction towards mval. * ray_start is clipped by the view near limit so points in front of it are always in view. * In orthographic view the resulting ray_normal will match the view vector. - * @param ar The region (used for the window width and height). - * @param v3d The 3d viewport (used for near clipping value). - * @param mval The area relative 2d location (such as event->mval, converted into float[2]). - * @param ray_start The world-space starting point of the segment. - * @param ray_normal The normalized world-space direction of towards mval. + * \param ar The region (used for the window width and height). + * \param v3d The 3d viewport (used for near clipping value). + * \param mval The area relative 2d location (such as event->mval, converted into float[2]). + * \param ray_start The world-space starting point of the segment. + * \param ray_normal The normalized world-space direction of towards mval. */ void ED_view3d_win_to_ray(struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_normal[3]); /** * Calculate a normalized 3d direction vector from the viewpoint towards a global location. * In orthographic view the resulting vector will match the view vector. - * @param rv3d The region (used for the window width and height). - * @param coord The world-space location. - * @param vec The resulting normalized vector. + * \param rv3d The region (used for the window width and height). + * \param coord The world-space location. + * \param vec The resulting normalized vector. */ void ED_view3d_global_to_vector(struct RegionView3D *rv3d, const float coord[3], float vec[3]); /** * Calculate the view transformation matrix from RegionView3D input. * The resulting matrix is equivalent to RegionView3D.viewinv - * @param mat The view 4x4 transformation matrix to calculate. - * @param ofs The view offset, normally from RegionView3D.ofs. - * @param quat The view rotation, quaternion normally from RegionView3D.viewquat. - * @param dist The view distance from ofs, normally from RegionView3D.dist. + * \param mat The view 4x4 transformation matrix to calculate. + * \param ofs The view offset, normally from RegionView3D.ofs. + * \param quat The view rotation, quaternion normally from RegionView3D.viewquat. + * \param dist The view distance from ofs, normally from RegionView3D.dist. */ void ED_view3d_to_m4(float mat[][4], const float ofs[3], const float quat[4], const float dist); /** * Set the view transformation from a 4x4 matrix. - * @param mat The view 4x4 transformation matrix to assign. - * @param ofs The view offset, normally from RegionView3D.ofs. - * @param quat The view rotation, quaternion normally from RegionView3D.viewquat. - * @param dist The view distance from ofs, normally from RegionView3D.dist. + * \param mat The view 4x4 transformation matrix to assign. + * \param ofs The view offset, normally from RegionView3D.ofs. + * \param quat The view rotation, quaternion normally from RegionView3D.viewquat. + * \param dist The view distance from ofs, normally from RegionView3D.dist. */ void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist); /** * Set the RegionView3D members from an objects transformation and optionally lens. - * @param ob The object to set the view to. - * @param ofs The view offset to be set, normally from RegionView3D.ofs. - * @param quat The view rotation to be set, quaternion normally from RegionView3D.viewquat. - * @param dist The view distance from ofs to be set, normally from RegionView3D.dist. - * @param lens The view lens angle set for cameras and lamps, normally from View3D.lens. + * \param ob The object to set the view to. + * \param ofs The view offset to be set, normally from RegionView3D.ofs. + * \param quat The view rotation to be set, quaternion normally from RegionView3D.viewquat. + * \param dist The view distance from ofs to be set, normally from RegionView3D.dist. + * \param lens The view lens angle set for cameras and lamps, normally from View3D.lens. */ void ED_view3d_from_object(struct Object *ob, float ofs[3], float quat[4], float *dist, float *lens); /** * Set the object transformation from RegionView3D members. - * @param ob The object which has the transformation assigned. - * @param ofs The view offset, normally from RegionView3D.ofs. - * @param quat The view rotation, quaternion normally from RegionView3D.viewquat. - * @param dist The view distance from ofs, normally from RegionView3D.dist. + * \param ob The object which has the transformation assigned. + * \param ofs The view offset, normally from RegionView3D.ofs. + * \param quat The view rotation, quaternion normally from RegionView3D.viewquat. + * \param dist The view distance from ofs, normally from RegionView3D.dist. */ void ED_view3d_to_object(struct Object *ob, const float ofs[3], const float quat[4], const float dist); diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 880c5c049ca..fafd35bf911 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -497,7 +497,7 @@ int uiButGetUnitType(uiBut *but); /* Special Buttons * - * Butons with a more specific purpose: + * Buttons with a more specific purpose: * - IDPoinBut: for creating buttons that work on a pointer to an ID block. * - MenuBut: buttons that popup a menu (in headers usually). * - PulldownBut: like MenuBut, but creating a uiBlock (for compatibility). diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 8bb9ceb121c..1944f81ec2d 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3384,7 +3384,7 @@ int uiButGetUnitType(uiBut *but) { int ownUnit = (int)but->unit_type; - /* own unit define always takes precidence over RNA provided, allowing for overriding + /* own unit define always takes precedence over RNA provided, allowing for overriding * default value provided in RNA in a few special cases (i.e. Active Keyframe in Graph Edit) */ // XXX: this doesn't allow clearing unit completely, though the same could be said for icons diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 2e0d4323fa5..41385292707 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1474,7 +1474,7 @@ static void ui_textedit_set_cursor_select(uiBut *but, uiHandleButtonData *data, } /* this is used for both utf8 and ascii, its meant to be used for single keys, - * notie the buffer is either copied or not, so its not suitable for pasting in + * notice the buffer is either copied or not, so its not suitable for pasting in * - campbell */ static int ui_textedit_type_buf(uiBut *but, uiHandleButtonData *data, const char *utf8_buf, int utf8_buf_len) @@ -3034,7 +3034,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm ui_apply_button(C, but->block, but, data, 1); /* button's state need to be changed to EXIT so moving mouse away from this mouse wouldn't lead - * to cancel changes made to this button, but shanging state to EXIT also makes no button active for + * to cancel changes made to this button, but changing state to EXIT also makes no button active for * a while which leads to triggering operator when doing fast scrolling mouse wheel. * using post activate stuff from button allows to make button be active again after checking for all * all that mouse leave and cancel stuff, so wuick scrool wouldnt't be an issue anumore. diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index c912bce1c77..32f284826a7 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -154,8 +154,8 @@ static void menudata_free(MenuData *md) * indicates a seperator, sss%l indicates a label and * new column. * - * @param str String to be parsed. - * @retval new menudata structure, free with menudata_free() + * \param str String to be parsed. + * \retval new menudata structure, free with menudata_free() */ static MenuData *decompose_menu_string(const char *str) { diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 3e7049b5b1e..805acff0a77 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -315,7 +315,7 @@ static const char *template_id_browse_tip(StructRNA *type) case ID_OB: return N_("Browse Object to be linked"); case ID_ME: return N_("Browse Mesh Data to be linked"); case ID_CU: return N_("Browse Curve Data to be linked"); - case ID_MB: return N_("Browse MetaBall Data to be linked"); + case ID_MB: return N_("Browse Metaball Data to be linked"); case ID_MA: return N_("Browse Material to be linked"); case ID_TE: return N_("Browse Texture to be linked"); case ID_IM: return N_("Browse Image to be linked"); @@ -793,7 +793,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, uiButSetFlag(but, UI_BUT_DISABLED); uiBlockSetEmboss(block, UI_EMBOSS); } - } /* tesselation point for curve-typed objects */ + } /* tessellation point for curve-typed objects */ else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) { /* some modifiers could work with pre-tesselated curves only */ if (ELEM3(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) { diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 4d2a1b69293..e8d4cba81c8 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -157,7 +157,7 @@ static void view2d_masks(View2D *v2d) /* Refresh and Validation */ -/* Initialise all relevant View2D data (including view rects if first time) and/or refresh mask sizes after view resize +/* Initialize all relevant View2D data (including view rects if first time) and/or refresh mask sizes after view resize * - for some of these presets, it is expected that the region will have defined some * additional settings necessary for the customisation of the 2D viewport to its requirements * - this function should only be called from region init() callbacks, where it is expected that @@ -168,7 +168,7 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) short tot_changed= 0, init= 0; uiStyle *style= UI_GetStyle(); - /* initialise data if there is a need for such */ + /* initialize data if there is a need for such */ if ((v2d->flag & V2D_IS_INITIALISED) == 0) { /* set initialised flag so that View2D doesn't get reinitialised next time again */ v2d->flag |= V2D_IS_INITIALISED; @@ -177,7 +177,7 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) /* see eView2D_CommonViewTypes in UI_view2d.h for available view presets */ switch (type) { - /* 'standard view' - optimum setup for 'standard' view behaviour, + /* 'standard view' - optimum setup for 'standard' view behavior, * that should be used new views as basis for their * own unique View2D settings, which should be used instead of this in most cases... */ @@ -588,7 +588,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize) * * So, resolution is to just shift view by the gap between the extremities. * We favour moving the 'minimum' across, as that's origin for most things - * (XXX - in the past, max was favoured... if there are bugs, swap!) + * (XXX - in the past, max was favored... if there are bugs, swap!) */ if ((cur->xmin < tot->xmin) && (cur->xmax > tot->xmax)) { /* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */ @@ -980,7 +980,7 @@ void UI_view2d_view_ortho(View2D *v2d) rctf curmasked; float xofs, yofs; - /* pixel offsets (-0.375f) are needed to get 1:1 correspondance with pixels for smooth UI drawing, + /* pixel offsets (-0.375f) are needed to get 1:1 correspondence with pixels for smooth UI drawing, * but only applied where requsted */ /* XXX brecht: instead of zero at least use a tiny offset, otherwise @@ -1019,7 +1019,7 @@ void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, short xaxis) rctf curmasked; float xofs, yofs; - /* pixel offsets (-0.375f) are needed to get 1:1 correspondance with pixels for smooth UI drawing, + /* pixel offsets (-0.375f) are needed to get 1:1 correspondence with pixels for smooth UI drawing, * but only applied where requsted */ /* XXX temp (ton) */ @@ -1200,7 +1200,7 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag) /* vertical lines */ if (flag & V2D_VERTICAL_LINES) { - /* initialise initial settings */ + /* initialize initial settings */ vec1[0]= vec2[0]= grid->startx; vec1[1]= grid->starty; vec2[1]= v2d->cur.ymax; diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 234b2733bd3..6632cfc62ac 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -90,7 +90,7 @@ typedef struct v2dViewPanData { short in_scroller; /* for MMB in scrollers (old feature in past, but now not that useful) */ } v2dViewPanData; -/* initialise panning customdata */ +/* initialize panning customdata */ static int view_pan_init(bContext *C, wmOperator *op) { ARegion *ar= CTX_wm_region(C); @@ -315,7 +315,7 @@ static int view_scrollright_exec(bContext *C, wmOperator *op) { v2dViewPanData *vpd; - /* initialise default settings (and validate if ok to run) */ + /* initialize default settings (and validate if ok to run) */ if (!view_pan_init(C, op)) return OPERATOR_PASS_THROUGH; @@ -359,7 +359,7 @@ static int view_scrollleft_exec(bContext *C, wmOperator *op) { v2dViewPanData *vpd; - /* initialise default settings (and validate if ok to run) */ + /* initialize default settings (and validate if ok to run) */ if (!view_pan_init(C, op)) return OPERATOR_PASS_THROUGH; @@ -402,7 +402,7 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op) { v2dViewPanData *vpd; - /* initialise default settings (and validate if ok to run) */ + /* initialize default settings (and validate if ok to run) */ if (!view_pan_init(C, op)) return OPERATOR_PASS_THROUGH; @@ -452,7 +452,7 @@ static int view_scrollup_exec(bContext *C, wmOperator *op) { v2dViewPanData *vpd; - /* initialise default settings (and validate if ok to run) */ + /* initialize default settings (and validate if ok to run) */ if (!view_pan_init(C, op)) return OPERATOR_PASS_THROUGH; @@ -527,7 +527,7 @@ typedef struct v2dViewZoomData { } v2dViewZoomData; -/* initialise panning customdata */ +/* initialize panning customdata */ static int view_zoomdrag_init(bContext *C, wmOperator *op) { ARegion *ar= CTX_wm_region(C); @@ -1286,7 +1286,7 @@ static short mouse_in_scroller_handle(int mouse, int sc_min, int sc_max, int sh_ return SCROLLHANDLE_BAR; } -/* initialise customdata for scroller manipulation operator */ +/* initialize customdata for scroller manipulation operator */ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event, short in_scroller) { v2dScrollerMove *vsm; @@ -1510,7 +1510,7 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, wmEvent *event) if (in_scroller) { v2dScrollerMove *vsm; - /* initialise customdata */ + /* initialize customdata */ scroller_activate_init(C, op, event, in_scroller); vsm= (v2dScrollerMove *)op->customdata; diff --git a/source/blender/editors/mesh/bmesh_select.c b/source/blender/editors/mesh/bmesh_select.c index 43a598da28d..19802d7f667 100644 --- a/source/blender/editors/mesh/bmesh_select.c +++ b/source/blender/editors/mesh/bmesh_select.c @@ -104,7 +104,7 @@ void EDBM_automerge(Scene *scene, Object *obedit, int update) if ((scene->toolsettings->automerge) && (obedit && obedit->type == OB_MESH)) { - em = ((Mesh *)obedit->data)->edit_btmesh; + em = BMEdit_FromObject(obedit); if (!em) return; @@ -694,7 +694,7 @@ static EnumPropertyItem prop_similar_types[] = { static int similar_face_select_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)ob->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(ob); BMOperator bmop; /* get the type from RNA */ @@ -735,7 +735,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op) static int similar_edge_select_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)ob->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(ob); BMOperator bmop; /* get the type from RNA */ @@ -782,7 +782,7 @@ VERT GROUP static int similar_vert_select_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)ob->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(ob); BMOperator bmop; /* get the type from RNA */ int type = RNA_enum_get(op->ptr, "type"); @@ -835,7 +835,7 @@ static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *UNUS if (obedit && obedit->type == OB_MESH) { EnumPropertyItem *item = NULL; int a, totitem = 0; - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); if (em->selectmode & SCE_SELECT_VERTEX) { for (a = SIMVERT_NORMAL; a < SIMEDGE_LENGTH; a++) { @@ -910,7 +910,7 @@ static void walker_select(BMEditMesh *em, int walkercode, void *start, int selec static int loop_multiselect(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMEdge *eed; BMEdge **edarray; int edindex; @@ -1089,7 +1089,7 @@ void MESH_OT_loop_select(wmOperatorType *ot) RNA_def_boolean(ot->srna, "ring", 0, "Select Ring", "Select ring"); } -void MESH_OT_edgering_select (wmOperatorType *ot) +void MESH_OT_edgering_select(wmOperatorType *ot) { /* description */ ot->name = "Edge Ring Select"; @@ -1738,7 +1738,7 @@ static void linked_limit_default(bContext *C, wmOperator *op) { if (!RNA_struct_property_is_set(op->ptr, "limit")) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); if (em->selectmode == SCE_SELECT_FACE) RNA_boolean_set(op->ptr, "limit", TRUE); else @@ -1860,7 +1860,7 @@ void MESH_OT_select_linked_pick(wmOperatorType *ot) static int select_linked_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMesh *bm = em->bm; BMIter iter; BMVert *v; @@ -1904,7 +1904,7 @@ static int select_linked_exec(bContext *C, wmOperator *op) } else { BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) { - if (BM_elem_flag_test(v, BM_ELEM_SELECT) && !BM_elem_flag_test(v, BM_ELEM_HIDDEN)) { + if (BM_elem_flag_test(v, BM_ELEM_SELECT)) { BM_elem_flag_enable(v, BM_ELEM_TAG); } else { @@ -1955,7 +1955,7 @@ void MESH_OT_select_linked(wmOperatorType *ot) static int select_more(bContext *C, wmOperator *UNUSED(op)) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = (((Mesh *)obedit->data))->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); EDBM_select_more(em); @@ -1981,7 +1981,7 @@ void MESH_OT_select_more(wmOperatorType *ot) static int select_less(bContext *C, wmOperator *UNUSED(op)) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = (((Mesh *)obedit->data))->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); EDBM_select_less(em); @@ -2155,7 +2155,7 @@ static int EM_deselect_nth(BMEditMesh *em, int nth, int offset) static int mesh_select_nth_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); int nth = RNA_int_get(op->ptr, "nth"); int offset = RNA_int_get(op->ptr, "offset"); @@ -2217,7 +2217,7 @@ static int select_sharp_edges_exec(bContext *C, wmOperator *op) * small enough, select the edge */ Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMIter iter; BMEdge *e; BMLoop *l1, *l2; @@ -2270,7 +2270,7 @@ void MESH_OT_edges_select_sharp(wmOperatorType *ot) static int select_linked_flat_faces_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMIter iter, liter, liter2; BMFace *f, **stack = NULL; BLI_array_declare(stack); @@ -2351,7 +2351,7 @@ void MESH_OT_faces_select_linked_flat(wmOperatorType *ot) static int select_non_manifold_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMVert *v; BMEdge *e; BMIter iter; @@ -2400,7 +2400,7 @@ void MESH_OT_select_non_manifold(wmOperatorType *ot) static int mesh_select_random_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMVert *eve; BMEdge *eed; BMFace *efa; @@ -2466,7 +2466,7 @@ void MESH_OT_select_random(wmOperatorType *ot) static int select_next_loop(bContext *C, wmOperator *UNUSED(op)) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = (((Mesh *)obedit->data))->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *f; BMVert *v; BMIter iter; @@ -2480,7 +2480,7 @@ static int select_next_loop(bContext *C, wmOperator *UNUSED(op)) BMIter liter; BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, f) { - if (BM_elem_flag_test(l->v, BM_ELEM_SELECT) && !BM_elem_flag_test(l->v, BM_ELEM_HIDDEN)) { + if (BM_elem_flag_test(l->v, BM_ELEM_SELECT)) { BM_elem_flag_enable(l->next->v, BM_ELEM_TAG); BM_elem_select_set(em->bm, l->v, FALSE); } @@ -2516,7 +2516,7 @@ void MESH_OT_select_next_loop(wmOperatorType *ot) static int region_to_loop(bContext *C, wmOperator *UNUSED(op)) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *f; BMEdge *e; BMIter iter; @@ -2720,7 +2720,7 @@ static int loop_find_regions(BMEditMesh *em, int selbigger) static int loop_to_region(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMIter iter; BMFace *f; int selbigger = RNA_boolean_get(op->ptr, "select_bigger"); diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c index 7006434e89a..1d40f61bef5 100644 --- a/source/blender/editors/mesh/bmesh_tools.c +++ b/source/blender/editors/mesh/bmesh_tools.c @@ -77,7 +77,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) { ToolSettings *ts = CTX_data_tool_settings(C); Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); int cuts = RNA_int_get(op->ptr,"number_cuts"); float smooth = 0.292f * RNA_float_get(op->ptr, "smoothness"); float fractal = RNA_float_get(op->ptr, "fractal")/2.5; @@ -248,8 +248,7 @@ static short EDBM_Extrude_edge(Object *obedit, BMEditMesh *em, const char hflag, BMElem *ele; BMO_op_init(bm, &extop, "extrude_face_region"); - BMO_slot_from_hflag(bm, &extop, "edgefacein", - hflag, BM_VERT|BM_EDGE|BM_FACE); + BMO_slot_buffer_from_hflag(bm, &extop, "edgefacein", hflag, BM_VERT|BM_EDGE|BM_FACE); /* If a mirror modifier with clipping is on, we need to adjust some * of the cases above to handle edges on the line of symmetry. @@ -271,7 +270,10 @@ static short EDBM_Extrude_edge(Object *obedit, BMEditMesh *em, const char hflag, edge; edge = BM_iter_step(&iter)) { - if (BM_elem_flag_test(edge, hflag)) { + if (BM_elem_flag_test(edge, hflag) && + BM_edge_is_boundary(edge) && + BM_elem_flag_test(edge->l->f, hflag)) + { float co1[3], co2[3]; copy_v3_v3(co1, edge->v1->co); @@ -366,7 +368,7 @@ static short EDBM_Extrude_vert(Object *obedit, BMEditMesh *em, const char hflag, static int extrude_repeat_mesh(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); RegionView3D *rv3d = CTX_wm_region_view3d(C); int steps = RNA_int_get(op->ptr,"steps"); @@ -506,7 +508,7 @@ static int mesh_extrude_region_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); EDBM_Extrude_Mesh(scene, obedit, em, op, NULL); @@ -514,7 +516,7 @@ static int mesh_extrude_region_exec(bContext *C, wmOperator *op) * like this one don't push undo data until after modal mode is * done.*/ EDBM_RecalcNormals(em); - BMEdit_RecalcTesselation(em); + BMEdit_RecalcTessellation(em); WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit); @@ -541,7 +543,7 @@ void MESH_OT_extrude_region(wmOperatorType *ot) static int mesh_extrude_verts_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); float nor[3]; EDBM_Extrude_verts_indiv(em, op, BM_ELEM_SELECT, nor); @@ -571,7 +573,7 @@ void MESH_OT_extrude_verts_indiv(wmOperatorType *ot) static int mesh_extrude_edges_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); float nor[3]; EDBM_Extrude_edges_indiv(em, op, BM_ELEM_SELECT, nor); @@ -601,7 +603,7 @@ void MESH_OT_extrude_edges_indiv(wmOperatorType *ot) static int mesh_extrude_faces_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); float nor[3]; EDBM_Extrude_face_indiv(em, op, BM_ELEM_SELECT, nor); @@ -640,7 +642,7 @@ void EDBM_toggle_select_all(BMEditMesh *em) /* exported for UV */ static int mesh_select_all_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); int action = RNA_enum_get(op->ptr, "action"); switch (action) { @@ -683,7 +685,7 @@ void MESH_OT_select_all(wmOperatorType *ot) static int mesh_faces_select_interior_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); if (EDBM_select_interior_faces(em)) { WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit); @@ -874,7 +876,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) * like this one don't push undo data until after modal mode is * done. */ EDBM_RecalcNormals(vc.em); - BMEdit_RecalcTesselation(vc.em); + BMEdit_RecalcTessellation(vc.em); WM_event_add_notifier(C, NC_GEOM|ND_DATA, vc.obedit->data); DAG_id_tag_update(vc.obedit->data, OB_RECALC_DATA); @@ -901,7 +903,7 @@ void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot) static int delete_mesh(bContext *C, Object *obedit, wmOperator *op, int event, Scene *UNUSED(scene)) { - BMEditMesh *bem = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *bem = BMEdit_FromObject(obedit); if (event < 1) return OPERATOR_CANCELLED; @@ -976,7 +978,7 @@ static EnumPropertyItem prop_mesh_delete_types[] = { static int delete_mesh_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); Scene *scene = CTX_data_scene(C); int type = RNA_enum_get(op->ptr, "type"); @@ -1025,7 +1027,7 @@ static int addedgeface_mesh_exec(bContext *C, wmOperator *op) { BMOperator bmop; Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); if (!EDBM_InitOpf(em, &bmop, op, "contextual_create geom=%hfev", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; @@ -1064,7 +1066,7 @@ static int editbmesh_mark_seam(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); Mesh *me = ((Mesh *)obedit->data); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMesh *bm = em->bm; BMEdge *eed; BMIter iter; @@ -1118,7 +1120,7 @@ static int editbmesh_mark_sharp(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); Mesh *me = ((Mesh *)obedit->data); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMesh *bm = em->bm; BMEdge *eed; BMIter iter; @@ -1174,7 +1176,7 @@ void MESH_OT_mark_sharp(wmOperatorType *ot) static int editbmesh_vert_connect(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMesh *bm = em->bm; BMOperator bmop; int len = 0; @@ -1211,7 +1213,7 @@ void MESH_OT_vert_connect(wmOperatorType *ot) static int editbmesh_edge_split(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMesh *bm = em->bm; BMOperator bmop; int len = 0; @@ -1254,7 +1256,7 @@ void MESH_OT_edge_split(wmOperatorType *ot) static int mesh_duplicate_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)ob->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(ob); BMOperator bmop; EDBM_InitOpf(em, &bmop, op, "dupe geom=%hvef", BM_ELEM_SELECT); @@ -1303,7 +1305,7 @@ void MESH_OT_duplicate(wmOperatorType *ot) static int flip_normals(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = (((Mesh *)obedit->data))->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); if (!EDBM_CallOpf(em, op, "reversefaces faces=%hf", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; @@ -1338,7 +1340,7 @@ static const EnumPropertyItem direction_items[] = { static int edge_rotate_selected(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMOperator bmop; BMEdge *eed; BMIter iter; @@ -1370,7 +1372,7 @@ static int edge_rotate_selected(bContext *C, wmOperator *op) if (!eed) { BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) { - if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { + if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) { /* de-select the edge before */ do_deselect = TRUE; break; @@ -1456,7 +1458,7 @@ void EDBM_hide_mesh(BMEditMesh *em, int swap) static int hide_mesh_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = (((Mesh *)obedit->data))->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); EDBM_hide_mesh(em, RNA_boolean_get(op->ptr, "unselected")); @@ -1530,7 +1532,7 @@ void EDBM_reveal_mesh(BMEditMesh *em) static int reveal_mesh_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = (((Mesh *)obedit->data))->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); EDBM_reveal_mesh(em); @@ -1558,7 +1560,7 @@ void MESH_OT_reveal(wmOperatorType *ot) static int normals_make_consistent_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); /* doflip has to do with bmesh_rationalize_normals, it's an internal * thing */ @@ -1596,7 +1598,7 @@ void MESH_OT_normals_make_consistent(wmOperatorType *ot) static int do_smooth_vertex(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); ModifierData *md; int mirrx = FALSE, mirry = FALSE, mirrz = FALSE; int i, repeat; @@ -1675,7 +1677,7 @@ static int bm_test_exec(bContext *C, wmOperator *UNUSED(op)) Object *obedit = CTX_data_edit_object(C); ARegion *ar = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMBVHTree *tree = BMBVH_NewBVH(em, 0, NULL, NULL); BMIter iter; BMEdge *e; @@ -1763,7 +1765,7 @@ static void mesh_set_smooth_faces(BMEditMesh *em, short smooth) static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); mesh_set_smooth_faces(em, 1); @@ -1791,7 +1793,7 @@ void MESH_OT_faces_shade_smooth(wmOperatorType *ot) static int mesh_faces_shade_flat_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); mesh_set_smooth_faces(em, 0); @@ -1828,7 +1830,7 @@ static const EnumPropertyItem axis_items[] = { static int mesh_rotate_uvs(bContext *C, wmOperator *op) { Object *ob = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)ob->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(ob); BMOperator bmop; /* get the direction from RNA */ @@ -1856,7 +1858,7 @@ static int mesh_rotate_uvs(bContext *C, wmOperator *op) static int mesh_reverse_uvs(bContext *C, wmOperator *op) { Object *ob = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)ob->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(ob); BMOperator bmop; /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ @@ -1881,7 +1883,7 @@ static int mesh_reverse_uvs(bContext *C, wmOperator *op) static int mesh_rotate_colors(bContext *C, wmOperator *op) { Object *ob = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)ob->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(ob); BMOperator bmop; /* get the direction from RNA */ @@ -1912,7 +1914,7 @@ static int mesh_rotate_colors(bContext *C, wmOperator *op) static int mesh_reverse_colors(bContext *C, wmOperator *op) { Object *ob = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)ob->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(ob); BMOperator bmop; /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ @@ -2082,7 +2084,7 @@ static int merge_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); int status = 0, uvs = RNA_boolean_get(op->ptr, "uvs"); switch(RNA_enum_get(op->ptr, "type")) { @@ -2133,7 +2135,7 @@ static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), obedit = CTX_data_edit_object(C); if (obedit && obedit->type == OB_MESH) { - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); if (em->selectmode & SCE_SELECT_VERTEX) { if (em->bm->selected.first && em->bm->selected.last && @@ -2188,7 +2190,7 @@ void MESH_OT_merge(wmOperatorType *ot) static int removedoublesflag_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMOperator bmop; int count; @@ -2252,7 +2254,7 @@ typedef struct PathEdge { static int select_vertex_path_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)ob->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(ob); BMOperator bmop; BMEditSelection *sv, *ev; @@ -2343,7 +2345,7 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) ARegion *ar = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMesh *bm = em->bm; BMOperator bmop; BMBVHTree *bvhtree; @@ -2729,7 +2731,7 @@ void MESH_OT_blend_from_shape(wmOperatorType *ot) static int select_axis_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMEditSelection *ese = em->bm->selected.last; int axis = RNA_enum_get(op->ptr, "axis"); int mode = RNA_enum_get(op->ptr, "mode"); /* -1 == aligned, 0 == neg, 1 == pos */ @@ -3066,7 +3068,7 @@ static float bm_edge_seg_isect(BMEdge *e, CutCurve *c, int len, char mode, static int knife_cut_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = (((Mesh *)obedit->data))->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMesh *bm = em->bm; ARegion *ar = CTX_wm_region(C); BMVert *bv; @@ -3140,7 +3142,7 @@ static int knife_cut_exec(bContext *C, wmOperator *op) } } - BMO_slot_from_flag(bm, &bmop, "edges", 1, BM_EDGE); + BMO_slot_buffer_from_flag(bm, &bmop, "edges", 1, BM_EDGE); if (mode == KNIFE_MIDPOINT) numcuts = 1; BMO_slot_int_set(&bmop, "numcuts", numcuts); @@ -3199,28 +3201,28 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO Object *obedit = editbase->object; Mesh *me = obedit->data; BMEditMesh *em = me->edit_btmesh; - BMesh *bmnew; + BMesh *bm_new; if (!em) return OPERATOR_CANCELLED; - bmnew = BM_mesh_create(obedit, bm_mesh_allocsize_default); - CustomData_copy(&em->bm->vdata, &bmnew->vdata, CD_MASK_BMESH, CD_CALLOC, 0); - CustomData_copy(&em->bm->edata, &bmnew->edata, CD_MASK_BMESH, CD_CALLOC, 0); - CustomData_copy(&em->bm->ldata, &bmnew->ldata, CD_MASK_BMESH, CD_CALLOC, 0); - CustomData_copy(&em->bm->pdata, &bmnew->pdata, CD_MASK_BMESH, CD_CALLOC, 0); - - CustomData_bmesh_init_pool(&bmnew->vdata, bm_mesh_allocsize_default[0]); - CustomData_bmesh_init_pool(&bmnew->edata, bm_mesh_allocsize_default[1]); - CustomData_bmesh_init_pool(&bmnew->ldata, bm_mesh_allocsize_default[2]); - CustomData_bmesh_init_pool(&bmnew->pdata, bm_mesh_allocsize_default[3]); + bm_new = BM_mesh_create(obedit, &bm_mesh_allocsize_default); + CustomData_copy(&em->bm->vdata, &bm_new->vdata, CD_MASK_BMESH, CD_CALLOC, 0); + CustomData_copy(&em->bm->edata, &bm_new->edata, CD_MASK_BMESH, CD_CALLOC, 0); + CustomData_copy(&em->bm->ldata, &bm_new->ldata, CD_MASK_BMESH, CD_CALLOC, 0); + CustomData_copy(&em->bm->pdata, &bm_new->pdata, CD_MASK_BMESH, CD_CALLOC, 0); + + CustomData_bmesh_init_pool(&bm_new->vdata, bm_mesh_allocsize_default.totvert, BM_VERT); + CustomData_bmesh_init_pool(&bm_new->edata, bm_mesh_allocsize_default.totedge, BM_EDGE); + CustomData_bmesh_init_pool(&bm_new->ldata, bm_mesh_allocsize_default.totloop, BM_LOOP); + CustomData_bmesh_init_pool(&bm_new->pdata, bm_mesh_allocsize_default.totface, BM_FACE); basenew = ED_object_add_duplicate(bmain, scene, editbase, USER_DUP_MESH); /* 0 = fully linked */ assign_matarar(basenew->object, give_matarar(obedit), *give_totcolp(obedit)); /* new in 2.5 */ ED_base_object_select(basenew, BA_DESELECT); - EDBM_CallOpf(em, wmop, "dupe geom=%hvef dest=%p", BM_ELEM_SELECT, bmnew); + EDBM_CallOpf(em, wmop, "dupe geom=%hvef dest=%p", BM_ELEM_SELECT, bm_new); EDBM_CallOpf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_FACES); /* clean up any loose edges */ @@ -3246,11 +3248,11 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO EDBM_CallOpf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_VERTS); - BM_mesh_normals_update(bmnew, TRUE); - BMO_op_callf(bmnew, "bmesh_to_mesh mesh=%p object=%p notesselation=%b", + BM_mesh_normals_update(bm_new, TRUE); + BMO_op_callf(bm_new, "bmesh_to_mesh mesh=%p object=%p notessellation=%b", basenew->object->data, basenew->object, TRUE); - BM_mesh_free(bmnew); + BM_mesh_free(bm_new); ((Mesh *)basenew->object->data)->edit_btmesh = NULL; return 1; @@ -3346,7 +3348,7 @@ static int mesh_separate_exec(bContext *C, wmOperator *op) if (type == 0) retval = mesh_separate_selected(bmain, scene, base, op); else if (type == 1) - retval = mesh_separate_material (bmain, scene, base, op); + retval = mesh_separate_material(bmain, scene, base, op); else if (type == 2) retval = mesh_separate_loose(bmain, scene, base, op); @@ -3390,7 +3392,7 @@ void MESH_OT_separate(wmOperatorType *ot) static int fill_mesh_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMOperator bmop; if (!EDBM_InitOpf(em, &bmop, op, "triangle_fill edges=%he", BM_ELEM_SELECT)) { @@ -3430,7 +3432,7 @@ void MESH_OT_fill(wmOperatorType *ot) static int beautify_fill_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); if (!EDBM_CallOpf(em, op, "beautify_fill faces=%hf", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; @@ -3460,7 +3462,7 @@ void MESH_OT_beautify_fill(wmOperatorType *ot) static int quads_convert_to_tris_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); if (!EDBM_CallOpf(em, op, "triangulate faces=%hf", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; @@ -3488,7 +3490,7 @@ void MESH_OT_quads_convert_to_tris(wmOperatorType *ot) static int tris_convert_to_quads_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); int dosharp, douvs, dovcols, domaterials; float limit = RNA_float_get(op->ptr, "limit"); @@ -3538,7 +3540,7 @@ void MESH_OT_tris_convert_to_quads(wmOperatorType *ot) static int dissolve_limited_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); float angle_limit = RNA_float_get(op->ptr, "angle_limit"); if (!EDBM_CallOpf(em, op, @@ -3578,7 +3580,7 @@ void MESH_OT_dissolve_limited(wmOperatorType *ot) static int split_mesh_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)ob->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(ob); BMOperator bmop; EDBM_InitOpf(em, &bmop, op, "split geom=%hvef use_only_faces=%b", BM_ELEM_SELECT, FALSE); @@ -3590,7 +3592,7 @@ static int split_mesh_exec(bContext *C, wmOperator *op) } /* Geometry has changed, need to recalc normals and looptris */ - BMEdit_RecalcTesselation(em); + BMEdit_RecalcTessellation(em); EDBM_RecalcNormals(em); DAG_id_tag_update(ob->data, OB_RECALC_DATA); @@ -3618,7 +3620,7 @@ static int spin_mesh_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); ToolSettings *ts = CTX_data_tool_settings(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMesh *bm = em->bm; BMOperator spinop; float cent[3], axis[3], imat[3][3]; @@ -3698,7 +3700,7 @@ void MESH_OT_spin(wmOperatorType *ot) static int screw_mesh_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMesh *bm = em->bm; BMEdge *eed; BMVert *eve, *v1, *v2; @@ -3824,7 +3826,7 @@ void MESH_OT_screw(wmOperatorType *ot) static int select_by_number_vertices_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMIter iter; int numverts = RNA_int_get(op->ptr, "number"); @@ -3883,7 +3885,7 @@ void MESH_OT_select_by_number_vertices(wmOperatorType *ot) static int select_loose_verts_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMVert *eve; BMEdge *eed; BMIter iter; @@ -3928,7 +3930,7 @@ void MESH_OT_select_loose_verts(wmOperatorType *ot) static int select_mirror_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); int extend = RNA_boolean_get(op->ptr, "extend"); EDBM_select_mirrored(obedit, em, extend); @@ -4316,7 +4318,7 @@ static void hashvert_flag(EditMesh *em, int flag) static int mesh_vertices_randomize_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); #if 1 /* BMESH TODO */ (void)em; #else @@ -4347,27 +4349,29 @@ void MESH_OT_vertices_randomize(wmOperatorType *ot) static int mesh_noise_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = (((Mesh *)obedit->data))->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); Material *ma; Tex *tex; BMVert *eve; BMIter iter; float fac = RNA_float_get(op->ptr, "factor"); - if (em == NULL) return OPERATOR_FINISHED; + if (em == NULL) { + return OPERATOR_FINISHED; + } - ma = give_current_material(obedit, obedit->actcol); - if (ma == 0 || ma->mtex[0] == 0 || ma->mtex[0]->tex == 0) { + if ((ma = give_current_material(obedit, obedit->actcol)) == NULL || + (tex = give_current_material_texture(ma)) == NULL) + { BKE_report(op->reports, RPT_WARNING, "Mesh has no material or texture assigned"); return OPERATOR_FINISHED; } - tex = give_current_material_texture(ma); if (tex->type == TEX_STUCCI) { float b2, vec[3]; float ofs = tex->turbul / 200.0; BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) { - if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && !BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { + if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) { b2 = BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1], eve->co[2]); if (tex->stype) ofs *= (b2 * b2); vec[0] = fac * (b2 - BLI_hnoise(tex->noisesize, eve->co[0] + ofs, eve->co[1], eve->co[2])); @@ -4380,7 +4384,7 @@ static int mesh_noise_exec(bContext *C, wmOperator *op) } else { BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) { - if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && !BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { + if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) { float tin, dum; externtex(ma->mtex[0], eve->co, &tin, &dum, &dum, &dum, &dum, 0); eve->co[2] += fac * tin; @@ -4417,7 +4421,7 @@ void MESH_OT_noise(wmOperatorType *ot) static int mesh_bevel_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = (((Mesh *)obedit->data))->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMIter iter; BMEdge *eed; BMOperator bmop; @@ -4511,7 +4515,7 @@ void MESH_OT_bevel(wmOperatorType *ot) static int bridge_edge_loops(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); if (!EDBM_CallOpf(em, op, "bridge_loops edges=%he", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/mesh/bmesh_utils.c b/source/blender/editors/mesh/bmesh_utils.c index e5c79150dab..0f9bc29a16d 100644 --- a/source/blender/editors/mesh/bmesh_utils.c +++ b/source/blender/editors/mesh/bmesh_utils.c @@ -73,7 +73,7 @@ void EDBM_ClearMesh(BMEditMesh *em) em->derivedCage = em->derivedFinal = NULL; - /* free tesselation data */ + /* free tessellation data */ em->tottri = 0; if (em->looptris) MEM_freeN(em->looptris); @@ -143,7 +143,7 @@ int EDBM_FinishOp(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const int re BMEdit_Free(em); *em = *emcopy; - BMEdit_RecalcTesselation(em); + BMEdit_RecalcTessellation(em); MEM_freeN(emcopy); em->emcopyusers = 0; @@ -245,7 +245,7 @@ void EDBM_selectmode_to_scene(bContext *C) { Scene *scene = CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); if (!em) return; @@ -521,13 +521,13 @@ static void *editbtMesh_to_undoMesh(void *emv, void *obdata) #ifdef BMESH_EM_UNDO_RECALC_TESSFACE_WORKAROUND - /* we recalc the tesselation here, to avoid seeding calls to - * BMEdit_RecalcTesselation throughout the code. */ - BMEdit_RecalcTesselation(em); + /* we recalc the tessellation here, to avoid seeding calls to + * BMEdit_RecalcTessellation throughout the code. */ + BMEdit_RecalcTessellation(em); #endif - BMO_op_callf(em->bm, "bmesh_to_mesh mesh=%p notesselation=%b", &um->me, TRUE); + BMO_op_callf(em->bm, "bmesh_to_mesh mesh=%p notessellation=%b", &um->me, TRUE); um->selectmode = em->selectmode; return um; @@ -546,7 +546,7 @@ static void undoMesh_to_editbtMesh(void *umv, void *emv, void *UNUSED(obdata)) BMEdit_Free(em); - bm = BM_mesh_create(ob, bm_mesh_allocsize_default); + bm = BM_mesh_create(ob, &bm_mesh_allocsize_default); BMO_op_callf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%b", &um->me, ob, FALSE); em2 = BMEdit_Create(bm, TRUE); diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index f13f15a2cc3..1794e5d6e21 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -379,7 +379,7 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op) make_prim_finish(C, &state, enter_editmode); - return OPERATOR_FINISHED; + return OPERATOR_FINISHED; } void MESH_OT_primitive_cone_add(wmOperatorType *ot) @@ -388,7 +388,7 @@ void MESH_OT_primitive_cone_add(wmOperatorType *ot) /* identifiers */ ot->name= "Add Cone"; - ot->description= "Construct a conic mesh (ends filled)"; + ot->description= "Construct a conic mesh"; ot->idname= "MESH_OT_primitive_cone_add"; /* api callbacks */ diff --git a/source/blender/editors/mesh/editmesh_bvh.c b/source/blender/editors/mesh/editmesh_bvh.c index cc1f89e2c8b..fc7818183bb 100644 --- a/source/blender/editors/mesh/editmesh_bvh.c +++ b/source/blender/editors/mesh/editmesh_bvh.c @@ -90,7 +90,7 @@ BMBVHTree *BMBVH_NewBVH(BMEditMesh *em, int flag, Scene *scene, Object *obedit) so that e.g. mirror or array use original vertex coordiantes and not mirrored or duplicate*/ BLI_smallhash_init(&shash); - BMEdit_RecalcTesselation(em); + BMEdit_RecalcTessellation(em); tree->ob = obedit; tree->scene = scene; diff --git a/source/blender/editors/mesh/knifetool.c b/source/blender/editors/mesh/knifetool.c index fe1cc18086f..3b78ceada98 100644 --- a/source/blender/editors/mesh/knifetool.c +++ b/source/blender/editors/mesh/knifetool.c @@ -29,13 +29,13 @@ #include "MEM_guardedalloc.h" - #include "BLI_blenlib.h" #include "BLI_array.h" #include "BLI_math.h" #include "BLI_rand.h" #include "BLI_smallhash.h" #include "BLI_scanfill.h" +#include "BLI_memarena.h" #include "BKE_DerivedMesh.h" #include "BKE_context.h" @@ -1678,7 +1678,7 @@ static void remerge_faces(knifetool_opdata *kcd) } } } - /* BMESH_TODO, check if the code above validates the indicies */ + /* BMESH_TODO, check if the code above validates the indices */ /* bm->elem_index_dirty &= ~BM_FACE; */ bm->elem_index_dirty |= BM_FACE; @@ -1721,7 +1721,7 @@ static void knifenet_fill_faces(knifetool_opdata *kcd) BMO_elem_flag_enable(bm, e, BOUNDARY); } - /* turn knife verts into real verts, as necassary */ + /* turn knife verts into real verts, as necessary */ BLI_mempool_iternew(kcd->kverts, &iter); for (kfv = BLI_mempool_iterstep(&iter); kfv; kfv = BLI_mempool_iterstep(&iter)) { if (!kfv->v) { @@ -2051,7 +2051,7 @@ static int knifetool_init(bContext *C, wmOperator *op, int UNUSED(do_cut)) kcd->draw_handle = ED_region_draw_cb_activate(kcd->ar->type, knifetool_draw, kcd, REGION_DRAW_POST_VIEW); em_setup_viewcontext(C, &kcd->vc); - kcd->em = ((Mesh *)kcd->ob->data)->edit_btmesh; + kcd->em = BMEdit_FromObject(kcd->ob); BM_mesh_elem_index_ensure(kcd->em->bm, BM_VERT); @@ -2076,9 +2076,9 @@ static int knifetool_init(bContext *C, wmOperator *op, int UNUSED(do_cut)) ED_region_tag_redraw(kcd->ar); - kcd->refs = BLI_mempool_create(sizeof(Ref), 1, 2048, FALSE, FALSE); - kcd->kverts = BLI_mempool_create(sizeof(KnifeVert), 1, 512, FALSE, TRUE); - kcd->kedges = BLI_mempool_create(sizeof(KnifeEdge), 1, 512, FALSE, TRUE); + kcd->refs = BLI_mempool_create(sizeof(Ref), 1, 2048, 0); + kcd->kverts = BLI_mempool_create(sizeof(KnifeVert), 1, 512, BLI_MEMPOOL_ALLOW_ITER); + kcd->kedges = BLI_mempool_create(sizeof(KnifeEdge), 1, 512, BLI_MEMPOOL_ALLOW_ITER); kcd->origedgemap = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "knife origedgemap"); kcd->origvertmap = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "knife origvertmap"); @@ -2185,7 +2185,7 @@ static int knifetool_modal (bContext *C, wmOperator *op, wmEvent *event) } obedit = CTX_data_edit_object(C); - if (!obedit || obedit->type != OB_MESH || ((Mesh *)obedit->data)->edit_btmesh != kcd->em) { + if (!obedit || obedit->type != OB_MESH || BMEdit_FromObject(obedit) != kcd->em) { knifetool_exit(C, op); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c index 30dedf10618..a82310be926 100644 --- a/source/blender/editors/mesh/loopcut.c +++ b/source/blender/editors/mesh/loopcut.c @@ -373,7 +373,7 @@ static int ringsel_init (bContext *C, wmOperator *op, int do_cut) lcd->ar= CTX_wm_region(C); lcd->draw_handle= ED_region_draw_cb_activate(lcd->ar->type, ringsel_draw, lcd, REGION_DRAW_POST_VIEW); lcd->ob = CTX_data_edit_object(C); - lcd->em= ((Mesh *)lcd->ob->data)->edit_btmesh; + lcd->em = BMEdit_FromObject(lcd->ob); lcd->extend = do_cut ? 0 : RNA_boolean_get(op->ptr, "extend"); lcd->do_cut = do_cut; diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 2be66ca5310..4259f7fc558 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -100,7 +100,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la layer data pointer to find where the active layer has ended up. - this is necassary because the deletion functions only support deleting the active + this is necessary because the deletion functions only support deleting the active layer. */ actlayerdata = data->layers[CustomData_get_active_layer_index(data, type)].data; rndlayerdata = data->layers[CustomData_get_render_layer_index(data, type)].data; @@ -751,19 +751,24 @@ void MESH_OT_sticky_remove(wmOperatorType *ot) /************************** Add Geometry Layers *************************/ -void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges) +void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface) { int *polyindex = NULL; float (*face_nors)[3]; - if(mesh->totface > 0 && mesh->totpoly == 0) + if(mesh->totface > 0 && mesh->totpoly == 0) { convert_mfaces_to_mpolys(mesh); + /* would only be converting back again, dont bother */ + calc_tessface = FALSE; + } + if(calc_edges || (mesh->totpoly && mesh->totedge == 0)) BKE_mesh_calc_edges(mesh, calc_edges); - /* TODO, make this optional, we dont always want this! */ - BKE_mesh_tessface_calc(mesh); + if (calc_tessface) { + BKE_mesh_tessface_calc(mesh); + } polyindex = CustomData_get_layer(&mesh->fdata, CD_POLYINDEX); /* add a normals layer for tesselated faces, a tessface normal will diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index 374fbca0659..38d632ffaee 100644 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -321,7 +321,7 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh, } ED_object_enter_editmode(C, EM_DO_UNDO|EM_IGNORE_LAYER); - em= (((Mesh *)obedit->data))->edit_btmesh; + em = BMEdit_FromObject(obedit); if(!createob) { /* clear */ @@ -483,8 +483,8 @@ void MESH_OT_navmesh_make(wmOperatorType *ot) static int navmesh_face_copy_exec(bContext *C, wmOperator *op) { - Object *obedit= CTX_data_edit_object(C); - BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh; + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BMEdit_FromObject(obedit); /* do work here */ BMFace *efa_act= BM_active_face_get(em->bm, FALSE); @@ -571,8 +571,8 @@ static int findFreeNavPolyIndex(BMEditMesh* em) static int navmesh_face_add_exec(bContext *C, wmOperator *UNUSED(op)) { - Object *obedit= CTX_data_edit_object(C); - BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh; + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *ef; BMIter iter; diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 1f2918e8504..08cd3d7cd94 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -176,7 +176,7 @@ static int ED_operator_editmesh_face_select(bContext *C) { Object *obedit= CTX_data_edit_object(C); if(obedit && obedit->type==OB_MESH) { - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); if (em && em->selectmode & SCE_SELECT_FACE) { return 1; } diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index bad0718c613..7bf41bdce00 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -594,7 +594,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op) key= me->key= add_key((ID *)me); key->type= KEY_RELATIVE; - /* first key added, so it was the basis. initialise it with the existing mesh */ + /* first key added, so it was the basis. initialize it with the existing mesh */ kb= add_keyblock(key, NULL); mesh_to_key(me, kb); } diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 27ed9f5b46e..29526825736 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1372,7 +1372,7 @@ static int convert_exec(bContext *C, wmOperator *op) DM_to_mesh(dm, newob->data, newob); - /* re-tesselation is called by DM_to_mesh */ + /* re-tessellation is called by DM_to_mesh */ dm->release(dm); object_free_modifiers(newob); /* after derivedmesh calls! */ diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 55dbbb50958..c5d81969098 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -478,7 +478,7 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M key= me->key= add_key((ID *)me); key->type= KEY_RELATIVE; /* if that was the first key block added, then it was the basis. - * Initialise it with the mesh, and add another for the modifier */ + * Initialize it with the mesh, and add another for the modifier */ kb= add_keyblock(key, NULL); mesh_to_key(me, kb); } @@ -1655,7 +1655,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op) for (f=omd->bakestart; f<=omd->bakeend; f++) { /* from physics_fluid.c: - * XXX: This can't be used due to an anim sys optimisation that ignores recalc object animation, + * XXX: This can't be used due to an anim sys optimization that ignores recalc object animation, * leaving it for the depgraph (this ignores object animation such as modifier properties though... :/ ) * --> BKE_animsys_evaluate_all_animation(G.main, eval_time); * This doesn't work with drivers: diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 1e075fd4d43..2281d7a26d8 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -544,7 +544,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object bAction *act = verify_adt_action(&cu->id, 1); FCurve *fcu = verify_fcurve(act, NULL, "eval_time", 0, 1); - /* setup dummy 'generator' modifier here to get 1-1 correspondance still working */ + /* setup dummy 'generator' modifier here to get 1-1 correspondence still working */ if (!fcu->bezt && !fcu->fpt && !fcu->modifiers.first) add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_GENERATOR); } diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index c60041fe67b..f610d758243 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -92,7 +92,7 @@ static Lattice *vgroup_edit_lattice(Object *ob) int ED_vgroup_object_is_edit_mode(Object *ob) { if(ob->type == OB_MESH) - return (((Mesh*)ob->data)->edit_btmesh != NULL); + return (BMEdit_FromObject(ob) != NULL); else if(ob->type == OB_LATTICE) return (((Lattice*)ob->data)->editlatt != NULL); @@ -769,7 +769,7 @@ static int* getSurroundingVerts(Mesh *me, int vert, int *count) MLoop *ml = &me->mloop[mp->loopstart]; while(j--) { /* XXX This assume a vert can only be once in a poly, even though - * it seems logical to me, not totaly sure of that. */ + * it seems logical to me, not totally sure of that. */ if (ml->v == vert) { int a, b, k; if(j == first_l) { @@ -1257,11 +1257,12 @@ static void vgroup_blend(Object *ob) int i, dvert_tot=0; const int def_nr= ob->actdef-1; - BMEditMesh *em= ((Mesh *)ob->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(ob); // ED_vgroup_give_array(ob->data, &dvert_array, &dvert_tot); - if (em==NULL) + if (em == NULL) { return; + } if (BLI_findlink(&ob->defbase, def_nr)) { BMEdge *eed; @@ -1604,7 +1605,7 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v } /* unlike editmesh we know that by only looping over the first hald of - * the 'u' indicies it will cover all points except the middle which is + * the 'u' indices it will cover all points except the middle which is * ok in this case */ pntsu_half= lt->pntsu / 2; @@ -1880,7 +1881,7 @@ static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *dg) static int vgroup_object_in_edit_mode(Object *ob) { if(ob->type == OB_MESH) - return (((Mesh*)ob->data)->edit_btmesh != NULL); + return (BMEdit_FromObject(ob) != NULL); else if(ob->type == OB_LATTICE) return (((Lattice*)ob->data)->editlatt != NULL); @@ -2644,7 +2645,7 @@ static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op) if((change == 0 && fail == 0) || fail) { BKE_reportf(op->reports, RPT_ERROR, - "Copy to VGroups to Selected warning done %d, failed %d, object data must have matching indicies", + "Copy to VGroups to Selected warning done %d, failed %d, object data must have matching indices", change, fail); } @@ -2773,7 +2774,7 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op) if(ob->mode == OB_MODE_EDIT) { if(ob->type==OB_MESH) { - BMEditMesh *em = ((Mesh*)ob->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(ob); BMIter iter; BMVert *eve; @@ -2795,7 +2796,7 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op) ED_vgroup_give_array(ob->data, &dvert, &dvert_tot); - /*create as necassary*/ + /*create as necessary*/ while(dvert && dvert_tot--) { if(dvert->totweight) defvert_remap(dvert, sort_map, defbase_tot); diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index cdcaae91070..7f568833866 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -48,7 +48,6 @@ #include "RNA_define.h" #include "RNA_enum_types.h" -/* Platform independend time */ #include "PIL_time.h" #include "WM_types.h" @@ -169,7 +168,7 @@ static int type_toggle_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - /* update dependancy */ + /* update dependency */ DAG_id_tag_update(&cObject->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, cObject); DAG_scene_sort(CTX_data_main(C), scene); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 5648bc69099..2a7f9b2a626 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -952,7 +952,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit) } } } -/* force set distances between neighbouring keys */ +/* force set distances between neighboring keys */ static void PE_apply_lengths(Scene *scene, PTCacheEdit *edit) { @@ -977,7 +977,7 @@ static void PE_apply_lengths(Scene *scene, PTCacheEdit *edit) } } } -/* try to find a nice solution to keep distances between neighbouring keys */ +/* try to find a nice solution to keep distances between neighboring keys */ static void pe_iterate_lengths(Scene *scene, PTCacheEdit *edit) { ParticleEditSettings *pset=PE_settings(scene); @@ -2196,7 +2196,7 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys) /************************ subdivide opertor *********************/ -/* works like normal edit mode subdivide, inserts keys between neighbouring selected keys */ +/* works like normal edit mode subdivide, inserts keys between neighboring selected keys */ static void subdivide_particle(PEData *data, int pa_index) { PTCacheEdit *edit= data->edit; diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index e8ada1e0655..d3af007d2e6 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -423,7 +423,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid eval_time = domainSettings->bakeStart + i; - /* XXX: This can't be used due to an anim sys optimisation that ignores recalc object animation, + /* XXX: This can't be used due to an anim sys optimization that ignores recalc object animation, * leaving it for the depgraph (this ignores object animation such as modifier properties though... :/ ) * --> BKE_animsys_evaluate_all_animation(G.main, eval_time); * This doesn't work with drivers: @@ -975,7 +975,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor channels->length = scene->r.efra; channels->aniFrameTime = (domainSettings->animEnd - domainSettings->animStart)/(double)noFrames; - /* ******** initialise and allocate animation channels ******** */ + /* ******** initialize and allocate animation channels ******** */ fluid_init_all_channels(C, fsDomain, domainSettings, channels, fobjects); /* reset to original current frame */ diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index e35df217761..d018a8d03d3 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -119,7 +119,7 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat if(xmax < 1 || ymax < 1) return; - /* find current float rect for display, first case is after composit... still weak */ + /* find current float rect for display, first case is after composite... still weak */ if(rr->rectf) rectf= rr->rectf; else { diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index d7a9d96830b..7d7063b621c 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -169,7 +169,7 @@ static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op)) if(ob && ob->actcol>0) { if(ob->type == OB_MESH) { - BMEditMesh *em= ((Mesh*)ob->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(ob); BMFace *efa; BMIter iter; @@ -224,13 +224,13 @@ void OBJECT_OT_material_slot_assign(wmOperatorType *ot) static int material_slot_de_select(bContext *C, int select) { - Object *ob= ED_object_context(C); + Object *ob = ED_object_context(C); if(!ob) return OPERATOR_CANCELLED; if(ob->type == OB_MESH) { - BMEditMesh *em= ((Mesh*)ob->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(ob); if(em) { EDBM_deselect_by_material(em, ob->actcol-1, select); diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 235c5da08c3..918df2f90e0 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -410,7 +410,7 @@ void glaRasterPosSafe2f(float x, float y, float known_good_x, float known_good_y GLubyte dummy= 0; /* As long as known good coordinates are correct - * this is guarenteed to generate an ok raster + * this is guaranteed to generate an ok raster * position (ignoring potential (real) overflow * issues). */ diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 039b1c2f866..8818bd66b23 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -315,7 +315,7 @@ int ED_operator_editmesh(bContext *C) { Object *obedit= CTX_data_edit_object(C); if(obedit && obedit->type==OB_MESH) - return NULL != ((Mesh *)obedit->data)->edit_btmesh; + return NULL != BMEdit_FromObject(obedit); return 0; } @@ -367,17 +367,18 @@ int ED_operator_uvedit(bContext *C) int ED_operator_uvmap(bContext *C) { - Object *obedit= CTX_data_edit_object(C); - BMEditMesh *em= NULL; + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = NULL; - if(obedit && obedit->type==OB_MESH) - em= ((Mesh *)obedit->data)->edit_btmesh; + if(obedit && obedit->type == OB_MESH) { + em = BMEdit_FromObject(obedit); + } if(em && (em->bm->totface)) { - return 1; + return TRUE; } - return 0; + return FALSE; } int ED_operator_editsurfcurve(bContext *C) diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 6f1da1895e9..63e976693e3 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -1850,9 +1850,11 @@ static int project_bucket_isect_circle(const float cent[2], const float radius_s /* Note for rect_to_uvspace_ortho() and rect_to_uvspace_persp() * in ortho view this function gives good results when bucket_bounds are outside the triangle - * however in some cases, perspective view will mess up with faces that have minimal screenspace area (viewed from the side) + * however in some cases, perspective view will mess up with faces that have minimal screenspace area + * (viewed from the side) * - * for this reason its not relyable in this case so we'll use the Simple Barycentric' funcs that only account for points inside the triangle. + * for this reason its not reliable in this case so we'll use the Simple Barycentric' + * funcs that only account for points inside the triangle. * however switching back to this for ortho is always an option */ static void rect_to_uvspace_ortho( @@ -2434,7 +2436,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i if (is_ortho) screen_px_from_ortho(uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo, w); else screen_px_from_persp(uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo, w); - /* a pitty we need to get the worldspace pixel location here */ + /* a pity we need to get the worldspace pixel location here */ if(do_clip) { interp_v3_v3v3v3(wco, ps->dm_mvert[ (*(&mf->v1 + i1)) ].co, ps->dm_mvert[ (*(&mf->v1 + i2)) ].co, ps->dm_mvert[ (*(&mf->v1 + i3)) ].co, w); if (ED_view3d_clipping_test(ps->rv3d, wco, TRUE)) { @@ -2655,7 +2657,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i #endif } - /* a pitty we need to get the worldspace pixel location here */ + /* a pity we need to get the worldspace pixel location here */ if(do_clip) { if (side) interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w); else interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w); @@ -2731,7 +2733,7 @@ static void project_bucket_bounds(const ProjPaintState *ps, const int bucket_x, /* Fill this bucket with pixels from the faces that intersect it. * - * have bucket_bounds as an argument so we don;t need to give bucket_x/y the rect function needs */ + * have bucket_bounds as an argument so we don't need to give bucket_x/y the rect function needs */ static void project_bucket_init(const ProjPaintState *ps, const int thread_index, const int bucket_index, rctf *bucket_bounds) { LinkNode *node; @@ -4659,7 +4661,7 @@ static int uv_sculpt_brush_poll(bContext *C) if(!uv_sculpt_brush(C) || !obedit || obedit->type != OB_MESH) return 0; - em = ((Mesh *)obedit->data)->edit_btmesh; + em = BMEdit_FromObject(obedit); ret = EDBM_texFaceCheck(em); if(ret && sima) { diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index ad5aeea1b18..1937cb7b05c 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2837,8 +2837,8 @@ static void vpaint_paint_poly(VPaint *vp, VPaintData *vpd, Object *ob, #endif #define CPYCOL(c, l) (c)->a = (l)->a, (c)->r = (l)->r, (c)->g = (l)->g, (c)->b = (l)->b - /* update vertex colors for tesselations incrementally, - * rather then regenerating the tesselation altogether */ + /* update vertex colors for tessellations incrementally, + * rather then regenerating the tessellation altogether */ for (e = vpd->polyfacemap[index].first; e; e = e->next) { mf = me->mface + e->facenr; mc = me->mcol + e->facenr*4; diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 9bdb151d55d..f0aedae88ac 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -299,7 +299,7 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, wmEvent *event, float co[2], radius, radius_root; Scene *scene = CTX_data_scene(C); ARegion *ar = CTX_wm_region(C); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); unsigned int tool; UvSculptData *sculptdata = (UvSculptData *)op->customdata; SpaceImage *sima; @@ -471,7 +471,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, wmEvent Object *obedit = CTX_data_edit_object(C); ToolSettings *ts = scene->toolsettings; UvSculptData *data = MEM_callocN(sizeof(*data), "UV Smooth Brush Data"); - BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMesh *bm = em->bm; op->customdata = data; diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 3f3369ac6cb..4f145a617f7 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -299,7 +299,7 @@ static void SOUND_OT_bake_animation(wmOperatorType *ot) { /* identifiers */ ot->name= "Update animation cache"; - ot->description= "Updates the audio animation cache so that it's up to date"; + ot->description= "Update the audio animation cache"; ot->idname= "SOUND_OT_bake_animation"; /* api callbacks */ diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 309b455e2a2..f29dba4c568 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -300,7 +300,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) /* Draw keyframes * 1) Only channels that are visible in the Action Editor get drawn/evaluated. - * This is to try to optimise this for heavier data sets + * This is to try to optimize this for heavier data sets * 2) Keyframes which are out of view horizontally are disregarded */ y= (float)(-ACHANNEL_HEIGHT); diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 414999b2f2b..1b0b305b7aa 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -146,7 +146,7 @@ static int actkeys_deselectall_exec(bContext *C, wmOperator *op) if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - /* 'standard' behaviour - check if selected, then apply relevant selection */ + /* 'standard' behavior - check if selected, then apply relevant selection */ if (RNA_boolean_get(op->ptr, "invert")) deselect_action_keys(&ac, 0, SELECT_INVERT); else @@ -296,7 +296,7 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op) if (RNA_boolean_get(op->ptr, "axis_range")) { /* mode depends on which axis of the range is larger to determine which axis to use * - checking this in region-space is fine, as it's fundamentally still going to be a different rect size - * - the frame-range select option is favoured over the channel one (x over y), as frame-range one is often + * - the frame-range select option is favored over the channel one (x over y), as frame-range one is often * used for tweaking timing when "blocking", while channels is not that useful... */ if ((rect.xmax - rect.xmin) >= (rect.ymax - rect.ymin)) @@ -422,7 +422,7 @@ static void columnselect_action_keys (bAnimContext *ac, short mode) KeyframeEditFunc select_cb, ok_cb; KeyframeEditData ked= {{NULL}}; - /* initialise keyframe editing data */ + /* initialize keyframe editing data */ /* build list of columns */ switch (mode) { diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c index 6fabe802ff0..1e21d0e5120 100644 --- a/source/blender/editors/space_clip/clip_graph_draw.c +++ b/source/blender/editors/space_clip/clip_graph_draw.c @@ -63,7 +63,7 @@ static void draw_curve_knot(float x, float y, float xscale, float yscale, float { static GLuint displist=0; - /* initialise round circle shape */ + /* initialize round circle shape */ if (displist == 0) { GLUquadricObj *qobj; diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h index 0d046fd985d..c926a4f382c 100644 --- a/source/blender/editors/space_file/fsmenu.h +++ b/source/blender/editors/space_file/fsmenu.h @@ -50,21 +50,21 @@ struct FSMenu* fsmenu_get (void); /** Returns the number of entries in the Fileselect Menu */ int fsmenu_get_nentries (struct FSMenu* fsmenu, FSMenuCategory category); - /** Returns the fsmenu entry at @a index (or NULL if a bad index) + /** Returns the fsmenu entry at \a index (or NULL if a bad index) * or a separator. */ char* fsmenu_get_entry (struct FSMenu* fsmenu, FSMenuCategory category, int index); - /** Inserts a new fsmenu entry with the given @a path. + /** Inserts a new fsmenu entry with the given \a path. * Duplicate entries are not added. - * @param sorted Should entry be inserted in sorted order? + * \param sorted Should entry be inserted in sorted order? */ void fsmenu_insert_entry (struct FSMenu* fsmenu, FSMenuCategory category, const char *path, int sorted, short save); /** Return whether the entry was created by the user and can be saved and deleted */ short fsmenu_can_save (struct FSMenu* fsmenu, FSMenuCategory category, int index); - /** Removes the fsmenu entry at the given @a index. */ + /** Removes the fsmenu entry at the given \a index. */ void fsmenu_remove_entry (struct FSMenu* fsmenu, FSMenuCategory category, int index); /** saves the 'bookmarks' to the specified file */ diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index e2ea6849a72..1115d3c4cb4 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -458,7 +458,7 @@ static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVa PointerRNA dtar_ptr; uiLayout *row, *col; - /* initialise RNA pointer to the target */ + /* initialize RNA pointer to the target */ RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); /* Target ID */ @@ -489,7 +489,7 @@ static void graph_panel_driverVar__rotDiff(uiLayout *layout, ID *id, DriverVar * PointerRNA dtar_ptr, dtar2_ptr; uiLayout *col; - /* initialise RNA pointer to the target */ + /* initialize RNA pointer to the target */ RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); RNA_pointer_create(id, &RNA_DriverTarget, dtar2, &dtar2_ptr); @@ -525,7 +525,7 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar * PointerRNA dtar_ptr, dtar2_ptr; uiLayout *col; - /* initialise RNA pointer to the target */ + /* initialize RNA pointer to the target */ RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); RNA_pointer_create(id, &RNA_DriverTarget, dtar2, &dtar2_ptr); @@ -563,7 +563,7 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar PointerRNA dtar_ptr; uiLayout *col, *sub; - /* initialise RNA pointer to the target */ + /* initialize RNA pointer to the target */ RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); /* properties */ diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 7bdb37d9651..f1afb3c82db 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -153,7 +153,7 @@ static void draw_fcurve_vertices_keyframes (FCurve *fcu, SpaceIpo *UNUSED(sipo), bglBegin(GL_POINTS); for (i = 0; i < fcu->totvert; i++, bezt++) { - /* as an optimisation step, only draw those in view + /* as an optimization step, only draw those in view * - we apply a correction factor to ensure that points don't pop in/out due to slight twitches of view size */ if IN_RANGE(bezt->vec[1][0], (v2d->cur.xmin - fac), (v2d->cur.xmax + fac)) { @@ -185,7 +185,7 @@ static void draw_fcurve_handle_control (float x, float y, float xscale, float ys { static GLuint displist=0; - /* initialise round circle shape */ + /* initialize round circle shape */ if (displist == 0) { GLUquadricObj *qobj; @@ -428,7 +428,7 @@ static void draw_fcurve_sample_control (float x, float y, float xscale, float ys { static GLuint displist=0; - /* initialise X shape */ + /* initialize X shape */ if (displist == 0) { displist= glGenLists(1); glNewList(displist, GL_COMPILE); @@ -678,7 +678,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View } /* draw curve between first and last keyframe (if there are enough to do so) */ - // TODO: optimise 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 */ @@ -850,7 +850,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri /* draw curve: * - curve line may be result of one or more destructive modifiers or just the raw data, * so we need to check which method should be used - * - controls from active modifier take precidence over keyframes + * - controls from active modifier take precedence over keyframes * (XXX! editing tools need to take this into account!) */ diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index fbcb9546a1b..ffe5147074a 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1582,7 +1582,7 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op) continue; } - /* optimisation: assume that xyz curves will always be stored consecutively, + /* optimization: assume that xyz curves will always be stored consecutively, * so if the paths or the ID's don't match up, then a curve needs to be added * to a new group */ diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 617dd172c05..2307f1db4f2 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -154,7 +154,7 @@ static int graphkeys_deselectall_exec(bContext *C, wmOperator *op) if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - /* 'standard' behaviour - check if selected, then apply relevant selection */ + /* 'standard' behavior - check if selected, then apply relevant selection */ if (RNA_boolean_get(op->ptr, "invert")) deselect_graph_keys(&ac, 0, SELECT_INVERT, TRUE); else @@ -325,7 +325,7 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op) if (RNA_boolean_get(op->ptr, "axis_range")) { /* mode depends on which axis of the range is larger to determine which axis to use * - checking this in region-space is fine, as it's fundamentally still going to be a different rect size - * - the frame-range select option is favoured over the channel one (x over y), as frame-range one is often + * - the frame-range select option is favored over the channel one (x over y), as frame-range one is often * used for tweaking timing when "blocking", while channels is not that useful... */ if ((rect.xmax - rect.xmin) >= (rect.ymax - rect.ymin)) @@ -449,7 +449,7 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode) KeyframeEditFunc select_cb, ok_cb; KeyframeEditData ked; - /* initialise keyframe editing data */ + /* initialize keyframe editing data */ memset(&ked, 0, sizeof(KeyframeEditData)); /* build list of columns */ @@ -1180,7 +1180,7 @@ static void mouse_graph_keys (bAnimContext *ac, const int mval[2], short select_ KeyframeEditFunc select_cb; KeyframeEditData ked; - /* initialise keyframe editing data */ + /* initialize keyframe editing data */ memset(&ked, 0, sizeof(KeyframeEditData)); /* set up BezTriple edit callbacks */ @@ -1262,7 +1262,7 @@ static void graphkeys_mselect_column (bAnimContext *ac, const int mval[2], short deselect_graph_keys(ac, 0, SELECT_SUBTRACT, FALSE); } - /* initialise keyframe editing data */ + /* initialize keyframe editing data */ memset(&ked, 0, sizeof(KeyframeEditData)); /* set up BezTriple edit callbacks */ diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index ce7338ced13..7abc0c6ea71 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -276,7 +276,7 @@ int ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit) return 0; if(obedit && obedit->type == OB_MESH) { - struct BMEditMesh *em = ((Mesh*)obedit->data)->edit_btmesh; + struct BMEditMesh *em = BMEdit_FromObject(obedit); int ret; ret = EDBM_texFaceCheck(em); @@ -294,7 +294,7 @@ int ED_space_image_show_uvshadow(SpaceImage *sima, Object *obedit) if(ED_space_image_show_paint(sima)) if(obedit && obedit->type == OB_MESH) { - struct BMEditMesh *em = ((Mesh*)obedit->data)->edit_btmesh; + struct BMEditMesh *em = BMEdit_FromObject(obedit); int ret; ret = EDBM_texFaceCheck(em); diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 54e8b1b490d..e4febdef73b 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -362,7 +362,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm } if (rti->widthfac == 0.0f) { - /* initialise colors based on report type */ + /* initialize colors based on report type */ if(report->type & RPT_ERROR_ALL) { rti->col[0] = 1.0; rti->col[1] = 0.2; diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index cf003d8c1eb..120783db340 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -140,7 +140,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) static void stats_object_edit(Object *obedit, SceneStats *stats) { if(obedit->type==OB_MESH) { - BMEditMesh *em = ((Mesh*)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); stats->totvert = em->bm->totvert; stats->totvertsel = em->bm->totvertsel; diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index d7a1053f3c1..0253f04a05d 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -172,7 +172,7 @@ static void nla_strip_get_color_inside (AnimData *adt, NlaStrip *strip, float co color[2]= 0.86f; } else { - /* normal, unselected strip - use (hardly noticable) blue tinge */ + /* normal, unselected strip - use (hardly noticeable) blue tinge */ // FIXME: hardcoded temp-hack colors color[0]= 0.11f; color[1]= 0.15f; @@ -190,7 +190,7 @@ static void nla_strip_get_color_inside (AnimData *adt, NlaStrip *strip, float co color[2]= 0.59f; } else { - /* normal, unselected strip - use (hardly noticable) dark purple tinge */ + /* normal, unselected strip - use (hardly noticeable) dark purple tinge */ // FIXME: hardcoded temp-hack colors color[0]= 0.20f; color[1]= 0.15f; @@ -207,7 +207,7 @@ static void nla_strip_get_color_inside (AnimData *adt, NlaStrip *strip, float co color[2]= 0.48f; } else { - /* normal, unselected strip - use (hardly noticable) teal tinge */ + /* normal, unselected strip - use (hardly noticeable) teal tinge */ // FIXME: hardcoded temp-hack colors color[0]= 0.17f; color[1]= 0.24f; @@ -813,7 +813,7 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie /* only on top two corners, to show that this channel sits on top of the preceding ones */ uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); - /* draw slightly shifted up vertically to look like it has more separtion from other channels, + /* draw slightly shifted up vertically to look like it has more separation from other channels, * but we then need to slightly shorten it so that it doesn't look like it overlaps */ uiDrawBox(GL_POLYGON, x+offset, yminc+NLACHANNEL_SKIP, (float)v2d->cur.xmax, ymaxc+NLACHANNEL_SKIP-1, 8); diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index d7dfea0b7e7..a142119d685 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -1619,7 +1619,7 @@ void NLA_OT_action_sync_length (wmOperatorType *ot) /* identifiers */ ot->name= "Sync Action Length"; ot->idname= "NLA_OT_action_sync_length"; - ot->description= "Synchronise the length of the referenced Action with the length used in the strip"; + ot->description= "Synchronize the length of the referenced Action with the length used in the strip"; /* api callbacks */ ot->exec= nlaedit_sync_actlen_exec; diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index 0cb48582bc9..6ad83f6591a 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -171,7 +171,7 @@ static int nlaedit_deselectall_exec(bContext *C, wmOperator *op) if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - /* 'standard' behaviour - check if selected, then apply relevant selection */ + /* 'standard' behavior - check if selected, then apply relevant selection */ if (RNA_boolean_get(op->ptr, "invert")) deselect_nla_strips(&ac, DESELECT_STRIPS_NOTEST, SELECT_INVERT); else @@ -308,7 +308,7 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op) if (RNA_boolean_get(op->ptr, "axis_range")) { /* mode depends on which axis of the range is larger to determine which axis to use * - checking this in region-space is fine, as it's fundamentally still going to be a different rect size - * - the frame-range select option is favoured over the channel one (x over y), as frame-range one is often + * - the frame-range select option is favored over the channel one (x over y), as frame-range one is often * used for tweaking timing when "blocking", while channels is not that useful... */ if ((rect.xmax - rect.xmin) >= (rect.ymax - rect.ymin)) diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index a58e03be237..bc22e668b5a 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -102,24 +102,71 @@ static void node_socket_button_label(const bContext *UNUSED(C), uiBlock *block, uiDefBut(block, LABEL, 0, sock->name, x, y, width, NODE_DY, NULL, 0, 0, 0, 0, ""); } +/* draw function for file output node sockets. + * XXX a bit ugly use atm, called from datatype button functions, + * since all node types and callbacks only use data type without struct_type. + */ +static void node_socket_button_output_file(const bContext *C, uiBlock *block, + bNodeTree *ntree, bNode *node, bNodeSocket *sock, + const char *UNUSED(name), int x, int y, int width) +{ + uiLayout *layout, *row; + PointerRNA nodeptr, sockptr, imfptr; + int imtype; + int rx, ry; + RNA_pointer_create(&ntree->id, &RNA_Node, node, &nodeptr); + RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &sockptr); + + layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, x, y+NODE_DY, width, 20, UI_GetStyle()); + row = uiLayoutRow(layout, 0); + + uiItemL(row, sock->name, 0); + + imfptr = RNA_pointer_get(&nodeptr, "format"); + imtype = RNA_enum_get(&imfptr, "file_format"); + /* in multilayer format all socket format details are ignored */ + if (imtype != R_IMF_IMTYPE_MULTILAYER) { + PropertyRNA *imtype_prop; + const char *imtype_name; + + if (!RNA_boolean_get(&sockptr, "use_node_format")) + imfptr = RNA_pointer_get(&sockptr, "format"); + + imtype_prop = RNA_struct_find_property(&imfptr, "file_format"); + RNA_property_enum_name((bContext*)C, &imfptr, imtype_prop, RNA_property_enum_get(&imfptr, imtype_prop), &imtype_name); + uiBlockSetEmboss(block, UI_EMBOSSP); + uiItemL(row, imtype_name, 0); + uiBlockSetEmboss(block, UI_EMBOSSN); + } + + uiBlockLayoutResolve(block, &rx, &ry); +} static void node_socket_button_default(const bContext *C, uiBlock *block, bNodeTree *ntree, bNode *node, bNodeSocket *sock, const char *name, int x, int y, int width) { - if (sock->link || (sock->flag & SOCK_HIDE_VALUE)) - node_socket_button_label(C, block, ntree, node, sock, name, x, y, width); - else { - PointerRNA ptr; - uiBut *bt; - - RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr); - - bt = uiDefButR(block, NUM, B_NODE_EXEC, name, - x, y+1, width, NODE_DY-2, - &ptr, "default_value", 0, 0, 0, -1, -1, NULL); - if (node) - uiButSetFunc(bt, node_sync_cb, CTX_wm_space_node(C), node); + switch (sock->struct_type) { + case SOCK_STRUCT_NONE: { + if (sock->link || (sock->flag & SOCK_HIDE_VALUE)) + node_socket_button_label(C, block, ntree, node, sock, name, x, y, width); + else { + PointerRNA ptr; + uiBut *bt; + + RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr); + + bt = uiDefButR(block, NUM, B_NODE_EXEC, name, + x, y+1, width, NODE_DY-2, + &ptr, "default_value", 0, 0, 0, -1, -1, NULL); + if (node) + uiButSetFunc(bt, node_sync_cb, CTX_wm_space_node(C), node); + } + break; + } + case SOCK_STRUCT_OUTPUT_FILE: + node_socket_button_output_file(C, block, ntree, node, sock, name, x, y, width); + break; } } @@ -149,25 +196,33 @@ static void node_socket_button_components(const bContext *C, uiBlock *block, bNodeTree *ntree, bNode *node, bNodeSocket *sock, const char *name, int x, int y, int width) { - if (sock->link || (sock->flag & SOCK_HIDE_VALUE)) - node_socket_button_label(C, block, ntree, node, sock, name, x, y, width); - else { - PointerRNA ptr; - SocketComponentMenuArgs *args; - - RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr); - - args= MEM_callocN(sizeof(SocketComponentMenuArgs), "SocketComponentMenuArgs"); - - args->ptr = ptr; - args->x = x; - args->y = y; - args->width = width; - args->cb = node_sync_cb; - args->arg1 = CTX_wm_space_node(C); - args->arg2 = node; - - uiDefBlockButN(block, socket_component_menu, args, name, x, y+1, width, NODE_DY-2, ""); + switch (sock->struct_type) { + case SOCK_STRUCT_NONE: { + if (sock->link || (sock->flag & SOCK_HIDE_VALUE)) + node_socket_button_label(C, block, ntree, node, sock, name, x, y, width); + else { + PointerRNA ptr; + SocketComponentMenuArgs *args; + + RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr); + + args= MEM_callocN(sizeof(SocketComponentMenuArgs), "SocketComponentMenuArgs"); + + args->ptr = ptr; + args->x = x; + args->y = y; + args->width = width; + args->cb = node_sync_cb; + args->arg1 = CTX_wm_space_node(C); + args->arg2 = node; + + uiDefBlockButN(block, socket_component_menu, args, name, x, y+1, width, NODE_DY-2, ""); + } + break; + } + case SOCK_STRUCT_OUTPUT_FILE: + node_socket_button_output_file(C, block, ntree, node, sock, name, x, y, width); + break; } } @@ -200,29 +255,10 @@ static void node_socket_button_color(const bContext *C, uiBlock *block, } break; } - case SOCK_STRUCT_OUTPUT_MULTI_FILE: { - uiLayout *layout, *row; - PointerRNA ptr, imfptr; - PropertyRNA *imtype_prop; - const char *imtype_name; - int rx, ry; - RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr); - imfptr = RNA_pointer_get(&ptr, "format"); - - layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, x, y+NODE_DY, width, 20, UI_GetStyle()); - row = uiLayoutRow(layout, 0); - - uiItemL(row, sock->name, 0); - imtype_prop = RNA_struct_find_property(&imfptr, "file_format"); - RNA_property_enum_name((bContext*)C, &imfptr, imtype_prop, RNA_property_enum_get(&imfptr, imtype_prop), &imtype_name); - uiBlockSetEmboss(block, UI_EMBOSSP); - uiItemL(row, imtype_name, 0); - uiBlockSetEmboss(block, UI_EMBOSSN); - - uiBlockLayoutResolve(block, &rx, &ry); + case SOCK_STRUCT_OUTPUT_FILE: + node_socket_button_output_file(C, block, ntree, node, sock, name, x, y, width); break; } - } } /* ****************** BASE DRAW FUNCTIONS FOR NEW OPERATOR NODES ***************** */ @@ -1699,56 +1735,54 @@ static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), Po static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - bNode *node= ptr->data; - NodeImageFile *nif= node->storage; - PointerRNA imfptr; - - uiLayout *row; - - uiItemR(layout, ptr, "filepath", 0, "", ICON_NONE); - - RNA_pointer_create(NULL, &RNA_ImageFormatSettings, &nif->im_format, &imfptr); - uiTemplateImageSettings(layout, &imfptr); - - row= uiLayoutRow(layout, 1); - uiItemR(row, ptr, "frame_start", 0, "Start", ICON_NONE); - uiItemR(row, ptr, "frame_end", 0, "End", ICON_NONE); -} - -static void node_composit_buts_multi_file_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemL(layout, "Base Path:", 0); + PointerRNA imfptr = RNA_pointer_get(ptr, "format"); + int multilayer = (RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_MULTILAYER); + + if (multilayer) + uiItemL(layout, "Path:", 0); + else + uiItemL(layout, "Base Path:", 0); uiItemR(layout, ptr, "base_path", 0, "", ICON_NONE); } -static void node_composit_buts_multi_file_output_details(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C, PointerRNA *ptr) { + PointerRNA imfptr = RNA_pointer_get(ptr, "format"); PointerRNA active_input_ptr = RNA_pointer_get(ptr, "active_input"); + int multilayer = (RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_MULTILAYER); - node_composit_buts_multi_file_output(layout, C, ptr); + node_composit_buts_file_output(layout, C, ptr); + uiTemplateImageSettings(layout, &imfptr); + + uiItemS(layout); - uiItemO(layout, "Add Input", ICON_ZOOMIN, "NODE_OT_output_multi_file_add_socket"); + uiItemO(layout, "Add Input", ICON_ZOOMIN, "NODE_OT_output_file_add_socket"); uiTemplateList(layout, C, ptr, "inputs", ptr, "active_input_index", NULL, 0, 0, 0); if (active_input_ptr.data) { - PointerRNA imfptr = RNA_pointer_get(&active_input_ptr, "format"); uiLayout *row, *col; col = uiLayoutColumn(layout, 1); - uiItemL(col, "File Path:", 0); + if (multilayer) + uiItemL(col, "Layer Name:", 0); + else + uiItemL(col, "File Path:", 0); row = uiLayoutRow(col, 0); uiItemR(row, &active_input_ptr, "name", 0, "", 0); - uiItemFullO(row, "NODE_OT_output_multi_file_remove_active_socket", "", ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY); - - uiItemS(layout); + uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "", ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY); - col = uiLayoutColumn(layout, 1); - uiItemL(col, "Format:", 0); - uiItemR(col, &active_input_ptr, "use_render_format", 0, NULL, 0); - - col= uiLayoutColumn(layout, 0); - uiLayoutSetActive(col, RNA_boolean_get(&active_input_ptr, "use_render_format")==0); - uiTemplateImageSettings(col, &imfptr); + /* in multilayer format all socket format details are ignored */ + if (!multilayer) { + imfptr = RNA_pointer_get(&active_input_ptr, "format"); + + col = uiLayoutColumn(layout, 1); + uiItemL(col, "Format:", 0); + uiItemR(col, &active_input_ptr, "use_node_format", 0, NULL, 0); + + col= uiLayoutColumn(layout, 0); + uiLayoutSetActive(col, RNA_boolean_get(&active_input_ptr, "use_node_format")==0); + uiTemplateImageSettings(col, &imfptr); + } } } @@ -1986,10 +2020,7 @@ static void node_composit_set_butfunc(bNodeType *ntype) break; case CMP_NODE_OUTPUT_FILE: ntype->uifunc= node_composit_buts_file_output; - break; - case CMP_NODE_OUTPUT_MULTI_FILE: - ntype->uifunc= node_composit_buts_multi_file_output; - ntype->uifuncbut= node_composit_buts_multi_file_output_details; + ntype->uifuncbut= node_composit_buts_file_output_details; break; case CMP_NODE_DIFF_MATTE: ntype->uifunc=node_composit_buts_diff_matte; diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index c89e91724fb..a6d18b58cca 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -2254,6 +2254,8 @@ static void node_remove_extra_links(SpaceNode *snode, bNodeSocket *tsock, bNodeL } else nodeRemLink(snode->edittree, tlink); + + snode->edittree->update |= NTREE_UPDATE_LINKS; } } } @@ -3515,49 +3517,47 @@ void NODE_OT_new_node_tree(wmOperatorType *ot) RNA_def_string(ot->srna, "name", "NodeTree", MAX_ID_NAME-2, "Name", ""); } -/* ****************** Multi File Output Add Socket ******************* */ +/* ****************** File Output Add Socket ******************* */ -static int node_output_multi_file_add_socket_exec(bContext *C, wmOperator *UNUSED(op)) +static int node_output_file_add_socket_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); SpaceNode *snode= CTX_wm_space_node(C); bNodeTree *ntree = snode->edittree; bNode *node = nodeGetActive(ntree); + char file_path[MAX_NAME]; if (!node) return OPERATOR_CANCELLED; - ntreeCompositOutputMultiFileAddSocket(ntree, node, &scene->r.im_format); + RNA_string_get(op->ptr, "file_path", file_path); + ntreeCompositOutputFileAddSocket(ntree, node, file_path, &scene->r.im_format); snode_notify(C, snode); return OPERATOR_FINISHED; } -static int node_output_multi_file_add_socket_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) -{ - return node_output_multi_file_add_socket_exec(C, op); -} - -void NODE_OT_output_multi_file_add_socket(wmOperatorType *ot) +void NODE_OT_output_file_add_socket(wmOperatorType *ot) { /* identifiers */ - ot->name= "Add Multi File Node Socket"; - ot->description= "Add a new input to a multi file output node"; - ot->idname= "NODE_OT_output_multi_file_add_socket"; + ot->name= "Add File Node Socket"; + ot->description= "Add a new input to a file output node"; + ot->idname= "NODE_OT_output_file_add_socket"; /* callbacks */ - ot->exec= node_output_multi_file_add_socket_exec; - ot->invoke= node_output_multi_file_add_socket_invoke; + ot->exec= node_output_file_add_socket_exec; ot->poll= composite_node_active; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + RNA_def_string(ot->srna, "file_path", "Image", MAX_NAME, "File Path", "Sub-path of the output file"); } /* ****************** Multi File Output Remove Socket ******************* */ -static int node_output_multi_file_remove_active_socket_exec(bContext *C, wmOperator *UNUSED(op)) +static int node_output_file_remove_active_socket_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); bNodeTree *ntree = snode->edittree; @@ -3566,7 +3566,7 @@ static int node_output_multi_file_remove_active_socket_exec(bContext *C, wmOpera if (!node) return OPERATOR_CANCELLED; - if (!ntreeCompositOutputMultiFileRemoveActiveSocket(ntree, node)) + if (!ntreeCompositOutputFileRemoveActiveSocket(ntree, node)) return OPERATOR_CANCELLED; snode_notify(C, snode); @@ -3574,15 +3574,15 @@ static int node_output_multi_file_remove_active_socket_exec(bContext *C, wmOpera return OPERATOR_FINISHED; } -void NODE_OT_output_multi_file_remove_active_socket(wmOperatorType *ot) +void NODE_OT_output_file_remove_active_socket(wmOperatorType *ot) { /* identifiers */ - ot->name= "Remove Multi File Node Socket"; - ot->description= "Remove active input from a multi file output node"; - ot->idname= "NODE_OT_output_multi_file_remove_active_socket"; + ot->name= "Remove File Node Socket"; + ot->description= "Remove active input from a file output node"; + ot->idname= "NODE_OT_output_file_remove_active_socket"; /* callbacks */ - ot->exec= node_output_multi_file_remove_active_socket_exec; + ot->exec= node_output_file_remove_active_socket_exec; ot->poll= composite_node_active; /* flags */ diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index f6d52aa9474..2524454d9c0 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -157,8 +157,8 @@ void NODE_OT_add_file(struct wmOperatorType *ot); void NODE_OT_new_node_tree(struct wmOperatorType *ot); -void NODE_OT_output_multi_file_add_socket(struct wmOperatorType *ot); -void NODE_OT_output_multi_file_remove_active_socket(struct wmOperatorType *ot); +void NODE_OT_output_file_add_socket(struct wmOperatorType *ot); +void NODE_OT_output_file_remove_active_socket(struct wmOperatorType *ot); extern const char *node_context_dir[]; diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index 608c6b51f70..d358556d36a 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -101,8 +101,8 @@ void node_operatortypes(void) WM_operatortype_append(NODE_OT_new_node_tree); - WM_operatortype_append(NODE_OT_output_multi_file_add_socket); - WM_operatortype_append(NODE_OT_output_multi_file_remove_active_socket); + WM_operatortype_append(NODE_OT_output_file_add_socket); + WM_operatortype_append(NODE_OT_output_file_remove_active_socket); } void ED_operatormacros_node(void) diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 493fb854585..93d3b22e092 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -339,7 +339,7 @@ static void node_buttons_area_draw(const bContext *C, ARegion *ar) ED_region_panels(C, ar, 1, NULL, -1); } -/* Initialise main area, setting handlers. */ +/* Initialize main area, setting handlers. */ static void node_main_area_init(wmWindowManager *wm, ARegion *ar) { wmKeyMap *keymap; diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index de798e5c23b..ca0a9c15c8c 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -978,7 +978,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle PropertyRNA *prop; char *newpath=NULL; - /* optimise tricks: + /* optimize tricks: * - Don't do anything if the selected item is a 'struct', but arrays are allowed */ if (tselem->type == TSE_RNA_STRUCT) diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 438016a38fa..df38f87b798 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -92,7 +92,7 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag) RNA_def_int(ot->srna, "frame_start", 0, INT_MIN, INT_MAX, "Start Frame", "Start frame of the sequence strip", INT_MIN, INT_MAX); if(flag & SEQPROP_ENDFRAME) - RNA_def_int(ot->srna, "frame_end", 0, INT_MIN, INT_MAX, "End Frame", "End frame for the color strip", INT_MIN, INT_MAX); /* not useual since most strips have a fixed length */ + RNA_def_int(ot->srna, "frame_end", 0, INT_MIN, INT_MAX, "End Frame", "End frame for the color strip", INT_MIN, INT_MAX); /* not usual since most strips have a fixed length */ RNA_def_int(ot->srna, "channel", 1, 1, MAXSEQ, "Channel", "Channel to place this strip into", 1, MAXSEQ); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 55fc84b6707..32c7be99e94 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -1094,7 +1094,7 @@ static short select_grouped_effect_link(Editing *ed, Sequence *actseq) seq->flag |= SELECT; changed = TRUE; - /* Unfortunately, we must restart checks from the begining. */ + /* Unfortunately, we must restart checks from the beginning. */ seq_end(&iter); seq_begin(ed, &iter, 1); } diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index db8c1b230ba..a44d5909a4f 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -1133,7 +1133,7 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op) } if(type == TO_TABS) // Converting to tabs - { //start over from the begining + { //start over from the beginning tmp = text->lines.first; while(tmp) { diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index 553a04206f7..922102e3921 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -179,7 +179,7 @@ void draw_motion_path_instance(Scene *scene, glPointSize(1.0); /* draw little black point at each frame - * NOTE: this is not really visible/noticable + * NOTE: this is not really visible/noticeable */ glBegin(GL_POINTS); for (i=0, mpv=mpv_start; i < len; i++, mpv++) diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 705b3c52d4b..e611ae1b64c 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -662,7 +662,7 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel dirvec[2]= 0.0f; if (head != tail) { - /* correcyion when viewing along the bones axis + /* correction when viewing along the bones axis * it pops in and out but better then artifacts, [#23841] */ float view_dist= len_v2(dirvec); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 083b6ad06db..fd978cf8fef 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1482,7 +1482,7 @@ static void draw_limit_line(float sta, float end, unsigned int col) /* yafray: draw camera focus point (cross, similar to aqsis code in tuhopuu) */ -/* qdn: now also enabled for Blender to set focus point for defocus composit node */ +/* qdn: now also enabled for Blender to set focus point for defocus composite node */ static void draw_focus_cross(float dist, float size) { glBegin(GL_LINES); @@ -1822,7 +1822,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base if (cam->flag & CAM_SHOWLIMITS) { draw_limit_line(cam->clipsta, cam->clipend, 0x77FFFF); - /* qdn: was yafray only, now also enabled for Blender to be used with defocus composit node */ + /* qdn: was yafray only, now also enabled for Blender to be used with defocus composite node */ draw_focus_cross(object_camera_dof_distance(ob), cam->drawsize); } @@ -2018,7 +2018,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob) /* Note! - foreach funcs should be called while drawing or directly after * if not, ED_view3d_init_mats_rv3d() can be used for selection tools * but would not give correct results with dupli's for eg. which dont - * use the object matrix in the useual way */ + * use the object matrix in the usual way */ static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { foreachScreenVert_userData *data = userData; @@ -4159,7 +4159,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix /* mostly tries to use vertex arrays for speed */ /* 1. check that everything is ok & updated */ -/* 2. start initialising things */ +/* 2. start initializing things */ /* 3. initialize according to draw type */ /* 4. allocate drawing data arrays */ /* 5. start filling the arrays */ diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 3c4e3b6009c..3e2979a7e88 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -131,6 +131,36 @@ typedef struct { float *defweightp; } TransformProperties; +/* Helper function to compute a median changed value, + * when the value should be clamped in [0.0, 1.0]. + * Returns either 0.0, 1.0 (both can be applied directly), a positive scale factor + * for scale down, or a negative one for scale up. + */ +static float compute_scale_factor(const float ve_median, const float median) +{ + if (ve_median <= 0.0f) + return 0.0f; + else if (ve_median >= 1.0f) + return 1.0f; + else { + /* Scale value to target median. */ + float median_new = ve_median; + float median_orig = ve_median - median; /* Previous median value. */ + + /* In case of floating point error. */ + CLAMP(median_orig, 0.0f, 1.0f); + CLAMP(median_new, 0.0f, 1.0f); + + if (median_new <= median_orig) { + /* Scale down. */ + return median_new / median_orig; + } + else { + /* Scale up, negative to indicate it... */ + return -(1.0f - median_new) / (1.0f - median_orig); + } + } +} /* is used for both read and write... */ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim) @@ -312,78 +342,45 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float uiBut *but; memcpy(tfp->ve_median, median, sizeof(tfp->ve_median)); - + uiBlockBeginAlign(block); if (tot==1) { uiDefBut(block, LABEL, 0, "Vertex:", 0, 150, 200, 20, NULL, 0, 0, 0, 0, ""); - uiBlockBeginAlign(block); - - but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "X:", 0, 130, 200, 20, &(tfp->ve_median[0]), -lim, lim, 10, 3, ""); - uiButSetUnitType(but, PROP_UNIT_LENGTH); - but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Y:", 0, 110, 200, 20, &(tfp->ve_median[1]), -lim, lim, 10, 3, ""); - uiButSetUnitType(but, PROP_UNIT_LENGTH); - but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:", 0, 90, 200, 20, &(tfp->ve_median[2]), -lim, lim, 10, 3, ""); - uiButSetUnitType(but, PROP_UNIT_LENGTH); - - if (totw==1) { - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:", 0, 70, 200, 20, &(tfp->ve_median[3]), 0.01, 100.0, 1, 3, ""); - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values"); - uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values"); - uiBlockEndAlign(block); - if (totweight) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 20, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, ""); - if (totradius) { - if (totradius==1) uiDefButR(block, NUM, 0, "Radius", 0, 20, 200, 20, &radius_ptr, "radius", 0, 0.0, 100.0, 10, 3, NULL); - else uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs"); - } - } - else { - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values"); - uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values"); - uiBlockEndAlign(block); - if (totweight) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 40, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, ""); - if (totradius) { - if (totradius==1) uiDefButR(block, NUM, 0, "Radius", 0, 40, 200, 20, &radius_ptr, "radius", 0, 0.0, 100.0, 10, 3, NULL); - else uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 40, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs"); - } - } } else { uiDefBut(block, LABEL, 0, "Median:", 0, 150, 200, 20, NULL, 0, 0, 0, 0, ""); - uiBlockBeginAlign(block); - but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "X:", 0, 130, 200, 20, &(tfp->ve_median[0]), -lim, lim, 10, 3, ""); - uiButSetUnitType(but, PROP_UNIT_LENGTH); - but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Y:", 0, 110, 200, 20, &(tfp->ve_median[1]), -lim, lim, 10, 3, ""); - uiButSetUnitType(but, PROP_UNIT_LENGTH); - but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:", 0, 90, 200, 20, &(tfp->ve_median[2]), -lim, lim, 10, 3, ""); - uiButSetUnitType(but, PROP_UNIT_LENGTH); - if (totw==tot) { - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:", 0, 70, 200, 20, &(tfp->ve_median[3]), 0.01, 100.0, 1, 3, ""); - uiBlockEndAlign(block); - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values"); - uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values"); - uiBlockEndAlign(block); - if (totweight) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 20, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, "Weight is used for SoftBody Goal"); - if (totradius) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs"); - uiBlockEndAlign(block); - } - else { - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values"); - uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values"); - uiBlockEndAlign(block); - if (totweight) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 40, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, "Weight is used for SoftBody Goal"); - if (totradius) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs"); - uiBlockEndAlign(block); - } + } + + uiBlockBeginAlign(block); + + but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "X:", 0, 130, 200, 20, &(tfp->ve_median[0]), -lim, lim, 10, 3, ""); + uiButSetUnitType(but, PROP_UNIT_LENGTH); + but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Y:", 0, 110, 200, 20, &(tfp->ve_median[1]), -lim, lim, 10, 3, ""); + uiButSetUnitType(but, PROP_UNIT_LENGTH); + but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:", 0, 90, 200, 20, &(tfp->ve_median[2]), -lim, lim, 10, 3, ""); + uiButSetUnitType(but, PROP_UNIT_LENGTH); + + if (totw==tot) { + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:", 0, 70, 200, 20, &(tfp->ve_median[3]), 0.01, 100.0, 1, 3, ""); + } + + uiBlockBeginAlign(block); + uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values"); + uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values"); + uiBlockEndAlign(block); + + if (totweight == 1) { + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 40, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, "Weight is used for SoftBody Goal"); + } + else if (totweight > 1) { + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Mean Weight:", 0, 40, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, "Weight is used for SoftBody Goal"); + } + + if (totradius == 1) { + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs"); + } + else if (totradius > 1) { + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Mean Radius:", 0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs"); } if (totedge==1) { @@ -395,6 +392,9 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Mean Bevel Weight:", 0, 20, 200, 20, &(tfp->ve_median[6]), 0.0, 1.0, 1, 3, ""); } + uiBlockEndAlign(block); + uiBlockEndAlign(block); + } else { // apply memcpy(ve_median, tfp->ve_median, sizeof(tfp->ve_median)); @@ -430,54 +430,35 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float if (median[3] != 0.0f) { BMEdge *eed; - const float fixed_crease= (ve_median[3] <= 0.0f ? 0.0f : (ve_median[3] >= 1.0f ? 1.0f : FLT_MAX)); - - if (fixed_crease != FLT_MAX) { - /* simple case */ + const float sca = compute_scale_factor(ve_median[3], median[3]); + if (ELEM(sca, 0.0f, 1.0f)) { BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) { if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) { float *crease = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_CREASE); - if (!crease) break; - - *crease= fixed_crease; + if (crease) { + *crease = sca; + } } } } - else { - /* scale crease to target median */ - float median_new= ve_median[3]; - float median_orig= ve_median[3] - median[3]; /* previous median value */ - - /* incase of floating point error */ - CLAMP(median_orig, 0.0f, 1.0f); - CLAMP(median_new, 0.0f, 1.0f); - - if (median_new < median_orig) { - /* scale down */ - const float sca= median_new / median_orig; - - BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) { - if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { - float *crease = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_CREASE); - - if (!crease) break; - + else if (sca > 0.0f) { + BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) { + if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { + float *crease = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_CREASE); + if (crease) { *crease *= sca; CLAMP(*crease, 0.0f, 1.0f); } } } - else { - /* scale up */ - const float sca= (1.0f - median_new) / (1.0f - median_orig); - - BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) { - if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { - float *crease = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_CREASE); - if (!crease) break; - - *crease = 1.0f - ((1.0f - *crease) * sca); + } + else { + BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) { + if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { + float *crease = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_CREASE); + if (crease) { + *crease = 1.0f + ((1.0f - *crease) * sca); CLAMP(*crease, 0.0f, 1.0f); } } @@ -487,53 +468,35 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float if (median[6] != 0.0f) { BMEdge *eed; - const float fixed_bweight = (ve_median[6] <= 0.0f ? 0.0f : (ve_median[6] >= 1.0f ? 1.0f : FLT_MAX)); - - if (fixed_bweight != FLT_MAX) { - /* simple case */ + const float sca = compute_scale_factor(ve_median[6], median[6]); + if (ELEM(sca, 0.0f, 1.0f)) { BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) { if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) { float *bweight = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_BWEIGHT); - if (!bweight) break; - - *bweight = fixed_bweight; + if (bweight) { + *bweight = sca; + } } } } - else { - /* scale crease to target median */ - float median_new = ve_median[6]; - float median_orig = ve_median[6] - median[6]; /* previous median value */ - - /* incase of floating point error */ - CLAMP(median_orig, 0.0f, 1.0f); - CLAMP(median_new, 0.0f, 1.0f); - - if (median_new < median_orig) { - /* scale down */ - const float sca = median_new / median_orig; - - BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) { - if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { - float *bweight = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_BWEIGHT); - if (!bweight) break; - + else if (sca > 0.0f) { + BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) { + if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { + float *bweight = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_BWEIGHT); + if (bweight) { *bweight *= sca; CLAMP(*bweight, 0.0f, 1.0f); } } } - else { - /* scale up */ - const float sca = (1.0f - median_new) / (1.0f - median_orig); - - BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) { - if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { - float *bweight = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_BWEIGHT); - if (!bweight) break; - - *bweight = 1.0f - ((1.0f - *bweight) * sca); + } + else { + BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) { + if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { + float *bweight = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_BWEIGHT); + if (bweight) { + *bweight = 1.0f + ((1.0f - *bweight) * sca); CLAMP(*bweight, 0.0f, 1.0f); } } @@ -549,6 +512,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float BezTriple *bezt; int a; ListBase *nurbs= curve_editnurbs(cu); + const float scale_w = compute_scale_factor(ve_median[4], median[4]); nu= nurbs->first; while (nu) { @@ -560,7 +524,18 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float add_v3_v3(bezt->vec[0], median); add_v3_v3(bezt->vec[1], median); add_v3_v3(bezt->vec[2], median); - bezt->weight+= median[4]; + + if (median[4] != 0.0f) { + if (ELEM(scale_w, 0.0f, 1.0f)) { + bezt->weight = scale_w; + } + else { + bezt->weight = scale_w > 0.0f ? bezt->weight * scale_w : + 1.0f + ((1.0f - bezt->weight) * scale_w); + CLAMP(bezt->weight, 0.0f, 1.0f); + } + } + bezt->radius+= median[5]; } else { @@ -581,7 +556,18 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float if (bp->f1 & SELECT) { add_v3_v3(bp->vec, median); bp->vec[3]+= median[3]; - bp->weight+= median[4]; + + if (median[4] != 0.0f) { + if (ELEM(scale_w, 0.0f, 1.0f)) { + bp->weight = scale_w; + } + else { + bp->weight = scale_w > 0.0f ? bp->weight * scale_w : + 1.0f + ((1.0f - bp->weight) * scale_w); + CLAMP(bp->weight, 0.0f, 1.0f); + } + } + bp->radius+= median[5]; } bp++; @@ -597,13 +583,24 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float Lattice *lt= ob->data; BPoint *bp; int a; - + const float scale_w = compute_scale_factor(ve_median[4], median[4]); + a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw; bp= lt->editlatt->latt->def; while (a--) { if (bp->f1 & SELECT) { add_v3_v3(bp->vec, median); - bp->weight+= median[4]; + + if (median[4] != 0.0f) { + if (ELEM(scale_w, 0.0f, 1.0f)) { + bp->weight = scale_w; + } + else { + bp->weight = scale_w > 0.0f ? bp->weight * scale_w : + 1.0f + ((1.0f - bp->weight) * scale_w); + CLAMP(bp->weight, 0.0f, 1.0f); + } + } } bp++; } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 1fdffbed42c..dd121265522 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1078,7 +1078,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) /* note: quite un-scientific but without this bit extra * 0.0001 on the lower left the 2D border sometimes * obscures the 3D camera border */ - /* note: with VIEW3D_CAMERA_BORDER_HACK defined this error isn't noticable + /* note: with VIEW3D_CAMERA_BORDER_HACK defined this error isn't noticeable * but keep it here incase we need to remove the workaround */ x1i= (int)(x1 - 1.0001f); y1i= (int)(y1 - 1.0001f); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 8d91962594f..c78d63c174b 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -3108,7 +3108,7 @@ void VIEW3D_OT_background_image_remove(wmOperatorType *ot) /* flags */ ot->flag = 0; - RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Background image index to remove ", 0, INT_MAX); + RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Background image index to remove", 0, INT_MAX); } /* ********************* set clipping operator ****************** */ diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 29ef1f1b617..f80bd6c3807 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -333,17 +333,17 @@ static char *view3d_modeselect_pup(Scene *scene) static void do_view3d_header_buttons(bContext *C, void *UNUSED(arg), int event) { - wmWindow *win= CTX_wm_window(C); - ToolSettings *ts= CTX_data_tool_settings(C); - ScrArea *sa= CTX_wm_area(C); - View3D *v3d= sa->spacedata.first; + wmWindow *win = CTX_wm_window(C); + ToolSettings *ts = CTX_data_tool_settings(C); + ScrArea *sa = CTX_wm_area(C); + View3D *v3d = sa->spacedata.first; Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em= NULL; - int ctrl= win->eventstate->ctrl, shift= win->eventstate->shift; + BMEditMesh *em = NULL; + int ctrl = win->eventstate->ctrl, shift= win->eventstate->shift; PointerRNA props_ptr; - if (obedit && obedit->type==OB_MESH) { - em= ((Mesh *)obedit->data)->edit_btmesh; + if (obedit && obedit->type == OB_MESH) { + em = BMEdit_FromObject(obedit); } /* watch it: if sa->win does not exist, check that when calling direct drawing routines */ @@ -449,7 +449,7 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C) uiBlockSetHandleFunc(block, do_view3d_header_buttons, NULL); if (obedit && (obedit->type == OB_MESH)) { - BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); uiLayout *row; row= uiLayoutRow(layout, 1); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 4cf0c9d0c9b..168775deae2 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -199,7 +199,7 @@ extern const char *view3d_context_dir[]; /* doc access */ /* draw_volume.c */ void draw_volume(struct ARegion *ar, struct GPUTexture *tex, float *min, float *max, int res[3], float dx, struct GPUTexture *tex_shadow); -/* workaround for trivial but noticable camera bug caused by imprecision +/* workaround for trivial but noticeable camera bug caused by imprecision * between view border calculation in 2D/3D space, workaround for bug [#28037]. * without this deifne we get the old behavior which is to try and align them * both which _mostly_ works fine, but when the camera moves beyond ~1000 in diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index dfd8b4a3568..a5c7e21e3b4 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -516,7 +516,7 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves, lasso_select_boundbox(&rect, mcords, moves); /* set editmesh */ - vc->em= ((Mesh *)vc->obedit->data)->edit_btmesh; + vc->em = BMEdit_FromObject(vc->obedit); data.vc= vc; data.rect = ▭ @@ -2073,7 +2073,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) if (vc.obedit) { switch(vc.obedit->type) { case OB_MESH: - vc.em= ((Mesh *)vc.obedit->data)->edit_btmesh; + vc.em = BMEdit_FromObject(vc.obedit); ret= do_mesh_box_select(&vc, &rect, select, extend); // if (EM_texFaceCheck()) if (ret & OPERATOR_FINISHED) { @@ -2336,7 +2336,7 @@ static void mesh_circle_select(ViewContext *vc, int select, const int mval[2], f bbsel= EDBM_init_backbuf_circle(vc, mval[0], mval[1], (short)(rad+1.0)); ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */ - vc->em= ((Mesh *)vc->obedit->data)->edit_btmesh; + vc->em = BMEdit_FromObject(vc->obedit); data.vc = vc; data.select = select; diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 3f49df88ff8..5d2f0c432fb 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -285,7 +285,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode) BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) if (BM_elem_index_get(eve)) tottrans++; } - /* for any of the 3 loops above which all dirty the indicies */ + /* for any of the 3 loops above which all dirty the indices */ bm->elem_index_dirty |= BM_VERT; /* and now make transverts */ diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 98046ecb991..61fcf0d6def 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4783,16 +4783,6 @@ void freeSlideVerts(TransInfo *t) if (!sld) return; - /*handle multires reprojection, done - on transform completion since it's - really slow -joeedh*/ - if (t->state != TRANS_CANCEL) { - projectSVData(t, 1); - } else { - sld->perc = 0.0; - projectSVData(t, 0); - } - freeSlideTempFaces(sld); sld->em->bm->ob = t->obedit; @@ -5365,7 +5355,7 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d, #if 0 /* 'doTime' disabled for now */ const Scene *scene= t->scene; - const short doTime= 0; //getAnimEdit_DrawTime(t); // NOTE: this works, but may be confusing behaviour given the option's label, hence disabled + const short doTime= 0; //getAnimEdit_DrawTime(t); // NOTE: this works, but may be confusing behavior given the option's label, hence disabled const double secf= FPS; #endif double val; @@ -5446,7 +5436,7 @@ void initTimeTranslate(TransInfo *t) t->num.flag = 0; t->num.idx_max = t->idx_max; - /* initialise snap like for everything else */ + /* initialize snap like for everything else */ t->snap[0] = 0.0f; t->snap[1] = t->snap[2] = 1.0f; @@ -5600,7 +5590,7 @@ void initTimeSlide(TransInfo *t) t->num.flag = 0; t->num.idx_max = t->idx_max; - /* initialise snap like for everything else */ + /* initialize snap like for everything else */ t->snap[0] = 0.0f; t->snap[1] = t->snap[2] = 1.0f; @@ -5742,7 +5732,7 @@ void initTimeScale(TransInfo *t) t->num.flag = 0; t->num.idx_max = t->idx_max; - /* initialise snap like for everything else */ + /* initialize snap like for everything else */ t->snap[0] = 0.0f; t->snap[1] = t->snap[2] = 1.0f; diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 545d2348f82..07c90f95840 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -691,5 +691,6 @@ int getTransformOrientation(const struct bContext *C, float normal[3], float pla void freeSlideTempFaces(SlideData *sld); void freeSlideVerts(TransInfo *t); +void projectSVData(TransInfo *t, int final); #endif diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 39a89940e17..d6097615ff6 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -303,7 +303,7 @@ static void createTransTexspace(TransInfo *t) static void createTransEdge(TransInfo *t) { - BMEditMesh *em = ((Mesh *)t->obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(t->obedit); TransData *td = NULL; BMEdge *eed; BMIter iter; @@ -1095,7 +1095,7 @@ static void createTransPose(TransInfo *t, Object *ob) // BKE_report(op->reports, RPT_DEBUG, "Bone selection count error"); } - /* initialise initial auto=ik chainlen's? */ + /* initialize initial auto=ik chainlen's? */ if (ik_on) transform_autoik_update(t, 0); } @@ -2022,7 +2022,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t) { ToolSettings *ts = CTX_data_tool_settings(C); TransData *tob = NULL; - BMEditMesh *em = ((Mesh *)t->obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(t->obedit); BMesh *bm = em->bm; BMVert *eve; BMIter iter; @@ -2442,7 +2442,7 @@ static void createTransUVs(bContext *C, TransInfo *t) TransData2D *td2d = NULL; MTexPoly *tf; MLoopUV *luv; - BMEditMesh *em = ((Mesh *)t->obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(t->obedit); BMFace *efa; BMLoop *l; BMIter iter, liter; @@ -3055,7 +3055,7 @@ static TransData *ActionFCurveToTransData(TransData *td, TransData2D **td2dv, FC if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) { TimeToTransData(td, bezt->vec[1], adt); - /*set flags to move handles as necassary*/ + /*set flags to move handles as necessary*/ td->flag |= TD_MOVEHANDLE1|TD_MOVEHANDLE2; td2d->h1 = bezt->vec[0]; td2d->h2 = bezt->vec[2]; @@ -3274,7 +3274,7 @@ static void createTransActionData(bContext *C, TransInfo *t) /* ********************* GRAPH EDITOR ************************* */ -/* Helper function for createTransGraphEditData, which is reponsible for associating +/* Helper function for createTransGraphEditData, which is responsible for associating * source data with transform data */ static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt, BezTriple *bezt, @@ -3650,7 +3650,7 @@ static void sort_time_beztmaps (BeztMap *bezms, int totvert, const short UNUSED( } /* do we need to check if the handles need to be swapped? - * optimisation: this only needs to be performed in the first loop + * optimization: this only needs to be performed in the first loop */ if (bezm->swapHs == 0) { if ( (bezm->bezt->vec[0][0] > bezm->bezt->vec[1][0]) && @@ -4356,7 +4356,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob) td->con= ob->constraints.first; - /* hack: tempolarily disable tracking and/or constraints when getting + /* hack: temporarily disable tracking and/or constraints when getting * object matrix, if tracking is on, or if constraints don't need * inverse correction to stop it from screwing up space conversion * matrix later @@ -4877,10 +4877,26 @@ void special_aftertrans_update(bContext *C, TransInfo *t) /* we need to delete the temporary faces before automerging */ if(t->mode == TFM_EDGE_SLIDE){ SlideData *sld = t->customData; + + /* handle multires reprojection, done + * on transform completion since it's + * really slow -joeedh */ + projectSVData(t, TRUE); + + /* free temporary faces to avoid automerging and deleting + * during cleanup - psy-fi */ freeSlideTempFaces(sld); } EDBM_automerge(t->scene, t->obedit, 1); } + else { + if (t->mode == TFM_EDGE_SLIDE) { + SlideData *sld = t->customData; + + sld->perc = 0.0; + projectSVData(t, FALSE); + } + } } } @@ -4931,7 +4947,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first; bAnimContext ac; - /* initialise relevant anim-context 'context' data */ + /* initialize relevant anim-context 'context' data */ if (ANIM_animdata_get_context(C, &ac) == 0) return; @@ -5046,7 +5062,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) bAnimContext ac; const short use_handle = !(sipo->flag & SIPO_NOHANDLES); - /* initialise relevant anim-context 'context' data */ + /* initialize relevant anim-context 'context' data */ if (ANIM_animdata_get_context(C, &ac) == 0) return; @@ -5096,7 +5112,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) else if (t->spacetype == SPACE_NLA) { bAnimContext ac; - /* initialise relevant anim-context 'context' data */ + /* initialize relevant anim-context 'context' data */ if (ANIM_animdata_get_context(C, &ac) == 0) return; @@ -5129,7 +5145,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) else if (t->obedit) { if (t->obedit->type == OB_MESH) { - BMEditMesh *em = ((Mesh *)t->obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(t->obedit); /* table needs to be created for each edit command, since vertices can move etc */ mesh_octree_table(t->obedit, em, NULL, 'e'); } diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 13f45ff58b9..557a6936f2f 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -339,7 +339,7 @@ static void recalcData_actedit(TransInfo *t) bAnimListElem *ale; int filter; - /* initialise relevant anim-context 'context' data from TransInfo data */ + /* initialize relevant anim-context 'context' data from TransInfo data */ /* NOTE: sync this with the code in ANIM_animdata_get_context() */ ac.scene= t->scene; ac.obact= OBACT; @@ -389,7 +389,7 @@ static void recalcData_graphedit(TransInfo *t) int dosort = 0; - /* initialise relevant anim-context 'context' data from TransInfo data */ + /* initialize relevant anim-context 'context' data from TransInfo data */ /* NOTE: sync this with the code in ANIM_animdata_get_context() */ scene= ac.scene= t->scene; ac.obact= OBACT; @@ -500,7 +500,7 @@ static void recalcData_nla(TransInfo *t) continue; } - /* firstly, check if the proposed transform locations would overlap with any neighbouring strips + /* firstly, check if the proposed transform locations would overlap with any neighboring strips * (barring transitions) which are absolute barriers since they are not being moved * * this is done as a iterative procedure (done 5 times max for now) @@ -714,7 +714,7 @@ static void recalcData_view3d(TransInfo *t) if(la->editlatt->latt->flag & LT_OUTSIDE) outside_lattice(la->editlatt->latt); } else if (t->obedit->type == OB_MESH) { - BMEditMesh *em = ((Mesh*)t->obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(t->obedit); /* mirror modifier clipping? */ if(t->state != TRANS_CANCEL) { /* apply clipping after so we never project past the clip plane [#25423] */ @@ -727,7 +727,7 @@ static void recalcData_view3d(TransInfo *t) DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */ EDBM_RecalcNormals(em); - BMEdit_RecalcTesselation(em); + BMEdit_RecalcTessellation(em); } else if(t->obedit->type==OB_ARMATURE) { /* no recalc flag, does pose */ bArmature *arm= t->obedit->data; @@ -1540,7 +1540,7 @@ void calculateCenter(TransInfo *t) if (t->obedit) { if (t->obedit && t->obedit->type == OB_MESH) { BMEditSelection ese; - BMEditMesh *em = ((Mesh*)t->obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(t->obedit); if (EDBM_get_actSelection(em, &ese)) { EDBM_editselection_center(em, t->center, &ese); diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index bd687ddfe40..296fea75317 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -299,7 +299,7 @@ int calc_manipulator_stats(const bContext *C) if((ob->lay & v3d->lay)==0) return 0; if(obedit->type==OB_MESH) { - BMEditMesh *em = ((Mesh*)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMEditSelection ese; float vec[3]= {0,0,0}; diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index b36670bafa5..c17667cd639 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -1650,7 +1650,7 @@ static int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, flo if (editobject) { - em = ((Mesh *)ob->data)->edit_btmesh; + em = BMEdit_FromObject(ob); /* dm = editbmesh_get_derived_cage(scene, ob, em, CD_MASK_BAREMESH); */ dm = editbmesh_get_derived_base(ob, em); /* limitation, em & dm MUST have the same number of faces */ } @@ -1976,7 +1976,7 @@ static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, L } else { - em = ((Mesh *)ob->data)->edit_btmesh; + em = BMEdit_FromObject(ob); dm = editbmesh_get_derived_cage(scene, obedit, em, CD_MASK_BAREMESH); val = peelDerivedMesh(ob, dm, ob->obmat, ray_start, ray_normal, mval, depth_peels); diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index 6ab68d2261e..d3049e97f9e 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -95,7 +95,7 @@ void ED_undo_push(bContext *C, const char *str) if (U.undosteps == 0) { if (obedit->type == OB_MESH) { Mesh *me= obedit->data; - BMEdit_RecalcTesselation(me->edit_btmesh); + BMEdit_RecalcTessellation(me->edit_btmesh); } } diff --git a/source/blender/editors/uvedit/uvedit_buttons.c b/source/blender/editors/uvedit/uvedit_buttons.c index 20ff8b07bc6..a45a3555b51 100644 --- a/source/blender/editors/uvedit/uvedit_buttons.c +++ b/source/blender/editors/uvedit/uvedit_buttons.c @@ -112,17 +112,17 @@ static float uvedit_old_center[2]; static void uvedit_vertex_buttons(const bContext *C, uiBlock *block) { - SpaceImage *sima= CTX_wm_space_image(C); - Scene *scene= CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - Image *ima= sima->image; + SpaceImage *sima = CTX_wm_space_image(C); + Scene *scene = CTX_data_scene(C); + Object *obedit = CTX_data_edit_object(C); + Image *ima = sima->image; BMEditMesh *em; float center[2]; int imx, imy, step, digits; ED_space_image_size(sima, &imx, &imy); - em= ((Mesh *)obedit->data)->edit_btmesh; + em = BMEdit_FromObject(obedit); if(uvedit_center(scene, em, ima, center)) { copy_v2_v2(uvedit_old_center, center); @@ -161,7 +161,7 @@ static void do_uvedit_vertex(bContext *C, void *UNUSED(arg), int event) if(event != B_UVEDIT_VERTEX) return; - em= ((Mesh *)obedit->data)->edit_btmesh; + em = BMEdit_FromObject(obedit); ED_space_image_size(sima, &imx, &imy); uvedit_center(scene, em, ima, center); diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index ef09ec3c3e8..db71f74b8e1 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -132,7 +132,7 @@ static void draw_uvs_shadow(Object *obedit) BMIter iter, liter; MLoopUV *luv; - em= ((Mesh*)obedit->data)->edit_btmesh; + em = BMEdit_FromObject(obedit); /* draws the grey mesh when painting */ glColor3ub(112, 112, 112); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 3deb4636200..42e6ec39e46 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -97,7 +97,7 @@ int ED_uvedit_test(Object *obedit) if(obedit->type != OB_MESH) return 0; - em = ((Mesh*)obedit->data)->edit_btmesh; + em = BMEdit_FromObject(obedit); ret = EDBM_texFaceCheck(em); return ret; @@ -180,7 +180,7 @@ void ED_uvedit_assign_image(Main *bmain, Scene *scene, Object *obedit, Image *im if(!obedit || (obedit->type != OB_MESH)) return; - em= ((Mesh*)obedit->data)->edit_btmesh; + em = BMEdit_FromObject(obedit); if(!em || !em->bm->totface) { return; } @@ -249,7 +249,7 @@ static int uvedit_set_tile(Object *obedit, Image *ima, int curtile) if(ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE) return 0; - em= ((Mesh*)obedit->data)->edit_btmesh; + em = BMEdit_FromObject(obedit); BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) { tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); @@ -586,7 +586,7 @@ void uv_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy) int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float *min, float *max) { - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMLoop *l; BMIter iter, liter; @@ -616,7 +616,7 @@ int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float *min, float static int ED_uvedit_median(Scene *scene, Image *ima, Object *obedit, float co[3]) { - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMLoop *l; BMIter iter, liter; @@ -868,7 +868,7 @@ void uv_find_nearest_vert(Scene *scene, Image *ima, BMEditMesh *em, int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, float co[2], float uv[2]) { - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMLoop *l; BMIter iter, liter; @@ -1339,11 +1339,11 @@ static void weld_align_uv(bContext *C, int tool) MLoopUV *luv; float cent[2], min[2], max[2]; - scene= CTX_data_scene(C); - obedit= CTX_data_edit_object(C); - em= ((Mesh*)obedit->data)->edit_btmesh; - ima= CTX_data_edit_image(C); - sima= CTX_wm_space_image(C); + scene = CTX_data_scene(C); + obedit = CTX_data_edit_object(C); + em = BMEdit_FromObject(obedit); + ima = CTX_data_edit_image(C); + sima = CTX_wm_space_image(C); INIT_MINMAX2(min, max); @@ -1606,17 +1606,17 @@ static void select_all_perform(bContext *C, int action) MTexPoly *tf; MLoopUV *luv; - scene= CTX_data_scene(C); - ts= CTX_data_tool_settings(C); - obedit= CTX_data_edit_object(C); - em= ((Mesh*)obedit->data)->edit_btmesh; - ima= CTX_data_edit_image(C); + scene = CTX_data_scene(C); + ts = CTX_data_tool_settings(C); + obedit = CTX_data_edit_object(C); + em = BMEdit_FromObject(obedit); + ima = CTX_data_edit_image(C); if(ts->uv_flag & UV_SYNC_SELECTION) { switch (action) { case SEL_TOGGLE: - EDBM_toggle_select_all(((Mesh*)obedit->data)->edit_btmesh); + EDBM_toggle_select_all(BMEdit_FromObject(obedit)); break; case SEL_SELECT: EDBM_flag_enable_all(em, BM_ELEM_SELECT); @@ -1729,12 +1729,12 @@ static int sticky_select(float *limit, int hitv[4], int v, float *hituv[4], floa static int mouse_select(bContext *C, float co[2], int extend, int loop) { - SpaceImage *sima= CTX_wm_space_image(C); - Scene *scene= CTX_data_scene(C); - ToolSettings *ts= CTX_data_tool_settings(C); - Object *obedit= CTX_data_edit_object(C); - Image *ima= CTX_data_edit_image(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + SpaceImage *sima = CTX_wm_space_image(C); + Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); + Object *obedit = CTX_data_edit_object(C); + Image *ima = CTX_data_edit_image(C); + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMLoop *l; BMIter iter, liter; @@ -2115,12 +2115,12 @@ static void UV_OT_select_loop(wmOperatorType *ot) static int select_linked_internal(bContext *C, wmOperator *op, wmEvent *event, int pick) { - SpaceImage *sima= CTX_wm_space_image(C); - Scene *scene= CTX_data_scene(C); - ToolSettings *ts= CTX_data_tool_settings(C); - Object *obedit= CTX_data_edit_object(C); - Image *ima= CTX_data_edit_image(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + SpaceImage *sima = CTX_wm_space_image(C); + Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); + Object *obedit = CTX_data_edit_object(C); + Image *ima = CTX_data_edit_image(C); + BMEditMesh *em = BMEdit_FromObject(obedit); float limit[2]; int extend; @@ -2218,11 +2218,11 @@ static void UV_OT_select_linked_pick(wmOperatorType *ot) static int unlink_selection_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - ToolSettings *ts= CTX_data_tool_settings(C); - Object *obedit= CTX_data_edit_object(C); - Image *ima= CTX_data_edit_image(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); + Object *obedit = CTX_data_edit_object(C); + Image *ima = CTX_data_edit_image(C); + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMLoop *l; BMIter iter, liter; @@ -2294,8 +2294,8 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje * This only needs to be done when the Mesh is not used for * selection (so for sticky modes, vertex or location based). */ - ToolSettings *ts= CTX_data_tool_settings(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + ToolSettings *ts = CTX_data_tool_settings(C); + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMLoop *l; BMIter iter, liter; @@ -2416,13 +2416,13 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje static int border_select_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= CTX_wm_space_image(C); - Scene *scene= CTX_data_scene(C); - ToolSettings *ts= CTX_data_tool_settings(C); - Object *obedit= CTX_data_edit_object(C); - Image *ima= CTX_data_edit_image(C); - ARegion *ar= CTX_wm_region(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + SpaceImage *sima = CTX_wm_space_image(C); + Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); + Object *obedit = CTX_data_edit_object(C); + Image *ima = CTX_data_edit_image(C); + ARegion *ar = CTX_wm_region(C); + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMLoop *l; BMIter iter, liter; @@ -2573,11 +2573,11 @@ static void select_uv_inside_ellipse(BMEditMesh *em, SpaceImage *UNUSED(sima), S static int circle_select_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= CTX_wm_space_image(C); - Scene *scene= CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; - ARegion *ar= CTX_wm_region(C); + SpaceImage *sima = CTX_wm_space_image(C); + Scene *scene = CTX_data_scene(C); + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BMEdit_FromObject(obedit); + ARegion *ar = CTX_wm_region(C); BMFace *efa; BMLoop *l; BMIter iter, liter; @@ -2610,7 +2610,7 @@ static int circle_select_exec(bContext *C, wmOperator *op) } } -#if 0 //I think the BM_elem_select_set api stuff handles all this as necassary? +#if 0 //I think the BM_elem_select_set api stuff handles all this as necessary? if(select) EM_select_flush(em); else EM_deselect_flush(em); #endif @@ -2715,7 +2715,7 @@ static void UV_OT_snap_cursor(wmOperatorType *ot) static int snap_uvs_to_cursor(Scene *scene, Image *ima, Object *obedit, SpaceImage *sima) { - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMLoop *l; BMIter iter, liter; @@ -2742,7 +2742,7 @@ static int snap_uvs_to_cursor(Scene *scene, Image *ima, Object *obedit, SpaceIma static int snap_uvs_to_adjacent_unselected(Scene *scene, Image *ima, Object *obedit) { - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMLoop *l; BMIter iter, liter; @@ -2839,14 +2839,14 @@ static int snap_uvs_to_adjacent_unselected(Scene *scene, Image *ima, Object *obe static int snap_uvs_to_pixels(SpaceImage *sima, Scene *scene, Object *obedit) { - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; - Image *ima= sima->image; + BMEditMesh *em = BMEdit_FromObject(obedit); + Image *ima = sima->image; BMFace *efa; BMLoop *l; BMIter iter, liter; MTexPoly *tface; MLoopUV *luv; - int width= 0, height= 0; + int width = 0, height = 0; float w, h; short change = 0; @@ -2928,16 +2928,16 @@ static void UV_OT_snap_selected(wmOperatorType *ot) static int pin_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - Image *ima= CTX_data_edit_image(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + Scene *scene = CTX_data_scene(C); + Object *obedit = CTX_data_edit_object(C); + Image *ima = CTX_data_edit_image(C); + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMLoop *l; BMIter iter, liter; MTexPoly *tface; MLoopUV *luv; - int clear= RNA_boolean_get(op->ptr, "clear"); + int clear = RNA_boolean_get(op->ptr, "clear"); BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) { tface= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); @@ -2982,10 +2982,10 @@ static void UV_OT_pin(wmOperatorType *ot) static int select_pinned_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - Image *ima= CTX_data_edit_image(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + Scene *scene = CTX_data_scene(C); + Object *obedit = CTX_data_edit_object(C); + Image *ima = CTX_data_edit_image(C); + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMLoop *l; BMIter iter, liter; @@ -3027,16 +3027,16 @@ static void UV_OT_select_pinned(wmOperatorType *ot) static int hide_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= CTX_wm_space_image(C); - ToolSettings *ts= CTX_data_tool_settings(C); - Object *obedit= CTX_data_edit_object(C); + SpaceImage *sima = CTX_wm_space_image(C); + ToolSettings *ts = CTX_data_tool_settings(C); + Object *obedit = CTX_data_edit_object(C); Scene *scene = CTX_data_scene(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMLoop *l; BMIter iter, liter; MLoopUV *luv; - int swap= RNA_boolean_get(op->ptr, "unselected"); + int swap = RNA_boolean_get(op->ptr, "unselected"); int facemode= sima ? sima->flag & SI_SELACTFACE : 0; if(ts->uv_flag & UV_SYNC_SELECTION) { @@ -3127,7 +3127,7 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) ToolSettings *ts= CTX_data_tool_settings(C); Object *obedit= CTX_data_edit_object(C); /*Scene *scene = CTX_data_scene(C);*/ /*UNUSED*/ - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMLoop *l; BMIter iter, liter; diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 68c8669ccc7..49bfb786f20 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -4377,7 +4377,7 @@ void param_pack(ParamHandle *handle, float margin) } if(margin>0.0f) { - /* multiply the margin by the area to give predictable results not dependant on UV scale, + /* multiply the margin by the area to give predictable results not dependent on UV scale, * ...Without using the area running pack multiple times also gives a bad feedback loop. * multiply by 0.1 so the margin value from the UI can be from 0.0 to 1.0 but not give a massive margin */ margin = (margin*(float)area) * 0.1f; diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 1fc1a0c7053..c7750fd516b 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -881,7 +881,7 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final) return 1; } -/* Stitch hash initialisation functions */ +/* Stitch hash initialization functions */ static unsigned int uv_edge_hash(const void *key) { UvEdge *edge = (UvEdge *)key; @@ -985,7 +985,7 @@ static int stitch_init(bContext *C, wmOperator *op) /* initialize state */ state->use_limit = RNA_boolean_get(op->ptr, "use_limit"); state->limit_dist = RNA_float_get(op->ptr, "limit"); - state->em = em = ((Mesh *)obedit->data)->edit_btmesh; + state->em = em = BMEdit_FromObject(obedit); state->snap_islands = RNA_boolean_get(op->ptr, "snap_islands"); state->static_island = RNA_int_get(op->ptr, "static_island"); state->midpoints = RNA_boolean_get(op->ptr, "midpoint_snap"); @@ -1174,7 +1174,7 @@ static int stitch_init(bContext *C, wmOperator *op) } } - /***** initialise static island preview data *****/ + /***** initialize static island preview data *****/ state->tris_per_island = MEM_mallocN(sizeof(*state->tris_per_island)*state->element_map->totalIslands, "stitch island tris"); diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 7233efef20f..56d088577b6 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -88,8 +88,8 @@ static int ED_uvedit_ensure_uvs(bContext *C, Scene *scene, Object *obedit) { - Main *bmain= CTX_data_main(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + Main *bmain = CTX_data_main(C); + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMIter iter; Image *ima; @@ -345,7 +345,7 @@ static void texface_from_original_index(BMFace *efa, int index, float **uv, Para } } -/* unwrap handle initialisation for subsurf aware-unwrapper. The many modifications required to make the original function(see above) +/* unwrap handle initialization for subsurf aware-unwrapper. The many modifications required to make the original function(see above) * work justified the existence of a new function. */ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *em, short fill, short sel, short correct_aspect) { @@ -356,7 +356,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e BMFace *editFace; int i; - /* modifier initialisation data, will control what type of subdivision will happen*/ + /* modifier initialization data, will control what type of subdivision will happen*/ SubsurfModifierData smd = {{0}}; /* Used to hold subsurfed Mesh */ DerivedMesh *derivedMesh, *initialDerived; @@ -509,12 +509,12 @@ typedef struct MinStretch { static int minimize_stretch_init(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + Scene *scene = CTX_data_scene(C); + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BMEdit_FromObject(obedit); MinStretch *ms; - int fill_holes= RNA_boolean_get(op->ptr, "fill_holes"); - short implicit= 1; + int fill_holes = RNA_boolean_get(op->ptr, "fill_holes"); + short implicit = 1; if(!uvedit_have_selection(scene, em, implicit)) { return 0; @@ -706,11 +706,11 @@ void UV_OT_minimize_stretch(wmOperatorType *ot) static int pack_islands_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + Scene *scene = CTX_data_scene(C); + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BMEdit_FromObject(obedit); ParamHandle *handle; - short implicit= 1; + short implicit = 1; if(!uvedit_have_selection(scene, em, implicit)) { return OPERATOR_CANCELLED; @@ -753,11 +753,11 @@ void UV_OT_pack_islands(wmOperatorType *ot) static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + Scene *scene = CTX_data_scene(C); + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BMEdit_FromObject(obedit); ParamHandle *handle; - short implicit= 1; + short implicit = 1; if(!uvedit_have_selection(scene, em, implicit)) { return OPERATOR_CANCELLED; @@ -792,7 +792,7 @@ static ParamHandle *liveHandle = NULL; void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit) { - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); short abf = scene->toolsettings->unwrapper == 0; short fillholes = scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES; short use_subsurf = scene->toolsettings->uvcalc_flag & UVCALC_USESUBSURF; @@ -930,11 +930,11 @@ static void uv_map_rotation_matrix(float result[][4], RegionView3D *rv3d, Object static void uv_map_transform(bContext *C, wmOperator *op, float center[3], float rotmat[4][4]) { /* context checks are messy here, making it work in both 3d view and uv editor */ - Scene *scene= CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; - View3D *v3d= CTX_wm_view3d(C); - RegionView3D *rv3d= CTX_wm_region_view3d(C); + Scene *scene = CTX_data_scene(C); + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BMEdit_FromObject(obedit); + View3D *v3d = CTX_wm_view3d(C); + RegionView3D *rv3d = CTX_wm_region_view3d(C); /* common operator properties */ int align= RNA_enum_get(op->ptr, "align"); int direction= RNA_enum_get(op->ptr, "direction"); @@ -1112,7 +1112,7 @@ static void uv_map_clip_correct(BMEditMesh *em, wmOperator *op) /* assumes UV Map is checked, doesn't run update funcs */ void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel) { - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); ParamHandle *handle; const short fill_holes= scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES; @@ -1137,9 +1137,9 @@ void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel) static int unwrap_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + Scene *scene = CTX_data_scene(C); + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BMEdit_FromObject(obedit); int method = RNA_enum_get(op->ptr, "method"); int fill_holes = RNA_boolean_get(op->ptr, "fill_holes"); int correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect"); @@ -1217,13 +1217,13 @@ void UV_OT_unwrap(wmOperatorType *ot) /**************** Project From View operator **************/ static int uv_from_view_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - Camera *camera= NULL; - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + Scene *scene = CTX_data_scene(C); + Object *obedit = CTX_data_edit_object(C); + Camera *camera = NULL; + BMEditMesh *em = BMEdit_FromObject(obedit); ARegion *ar = CTX_wm_region(C); - View3D *v3d= CTX_wm_view3d(C); - RegionView3D *rv3d= CTX_wm_region_view3d(C); + View3D *v3d = CTX_wm_view3d(C); + RegionView3D *rv3d = CTX_wm_region_view3d(C); BMFace *efa; BMLoop *l; BMIter iter, liter; @@ -1403,9 +1403,9 @@ static void uv_map_mirror(BMEditMesh *em, BMFace *efa, MTexPoly *UNUSED(tf)) static int sphere_project_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + Scene *scene = CTX_data_scene(C); + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMLoop *l; BMIter iter, liter; @@ -1476,9 +1476,9 @@ static void uv_cylinder_project(float target[2], float source[3], float center[3 static int cylinder_project_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + Scene *scene = CTX_data_scene(C); + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMLoop *l; BMIter iter, liter; @@ -1535,9 +1535,9 @@ void UV_OT_cylinder_project(wmOperatorType *ot) static int cube_project_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; + Scene *scene = CTX_data_scene(C); + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMLoop *l; BMIter iter, liter; |