diff options
Diffstat (limited to 'source/blender/editors')
157 files changed, 747 insertions, 596 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 1ea4c7ead77..5515aa075b9 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -1094,7 +1094,7 @@ static bool acf_nla_controls_setting_valid(bAnimContext *UNUSED(ac), bAnimListEl case ACHANNEL_SETTING_EXPAND: return true; - // TOOD: selected? + // TODO: selected? default: /* unsupported */ return false; @@ -3022,7 +3022,7 @@ static int acf_gpl_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings case ACHANNEL_SETTING_MUTE: /* animation muting - similar to frame lock... */ return GP_LAYER_FRAMELOCK; - case ACHANNEL_SETTING_VISIBLE: /* visiblity of the layers (NOT muting) */ + case ACHANNEL_SETTING_VISIBLE: /* visibility of the layers (NOT muting) */ *neg = true; return GP_LAYER_HIDE; @@ -4009,7 +4009,7 @@ static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void bAnimContext ac; ListBase anim_data = {NULL, NULL}; int filter; - int setting = GET_INT_FROM_POINTER(setting_wrap); + int setting = POINTER_AS_INT(setting_wrap); short on = 0; /* send notifiers before doing anything else... */ @@ -4339,7 +4339,7 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAni case ACHANNEL_SETTING_PINNED: /* NLA Actions - 'map/nomap' */ case ACHANNEL_SETTING_MOD_OFF: case ACHANNEL_SETTING_ALWAYS_VISIBLE: - UI_but_funcN_set(but, achannel_setting_flush_widget_cb, MEM_dupallocN(ale), SET_INT_IN_POINTER(setting)); + UI_but_funcN_set(but, achannel_setting_flush_widget_cb, MEM_dupallocN(ale), POINTER_FROM_INT(setting)); break; /* settings needing special attention */ diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 75557e60e21..8149326750e 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2808,7 +2808,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index, agrp->flag ^= AGRP_SELECTED; } else if (selectmode == -1) { - /* select all in group (and deselect everthing else) */ + /* select all in group (and deselect everything else) */ FCurve *fcu; /* deselect all other channels */ @@ -3184,7 +3184,7 @@ void ED_operatortypes_animchannels(void) // TODO: check on a poll callback for this, to get hotkeys into menus void ED_keymap_animchannels(wmKeyConfig *keyconf) { - wmKeyMap *keymap = WM_keymap_find(keyconf, "Animation Channels", 0, 0); + wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Animation Channels", 0, 0); wmKeyMapItem *kmi; /* click-select */ diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 4659fc2ca18..12b53ecbf24 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -1501,7 +1501,7 @@ static size_t animfilter_nla_controls(ListBase *anim_data, bDopeSheet *ads, Anim items += tmp_items; } - /* return the numebr of items added to the list */ + /* return the number of items added to the list */ return items; } diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 88166ac65c8..05682292485 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -588,7 +588,7 @@ static int ed_markers_opwrap_invoke(bContext *C, wmOperator *op, const wmEvent * /* ************************** add markers *************************** */ -/* add TimeMarker at curent frame */ +/* add TimeMarker at current frame */ static int ed_marker_add_exec(bContext *C, wmOperator *UNUSED(op)) { ListBase *markers = ED_context_get_markers(C); @@ -816,7 +816,7 @@ static int ed_marker_move_invoke_wrapper(bContext *C, wmOperator *op, const wmEv return ed_markers_opwrap_invoke_custom(C, op, event, ed_marker_move_invoke); } -/* note, init has to be called succesfully */ +/* note, init has to be called successfully */ static void ed_marker_move_apply(bContext *C, wmOperator *op) { #ifdef DURIAN_CAMERA_SWITCH @@ -1581,7 +1581,7 @@ void ED_operatortypes_marker(void) /* called in screen_ops.c:ED_keymap_screen() */ void ED_keymap_marker(wmKeyConfig *keyconf) { - wmKeyMap *keymap = WM_keymap_find(keyconf, "Markers", 0, 0); + wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Markers", 0, 0); wmKeyMapItem *kmi; WM_keymap_verify_item(keymap, "MARKER_OT_add", MKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 939d547dc94..ce991f64d5d 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -422,7 +422,7 @@ void ED_operatortypes_anim(void) void ED_keymap_anim(wmKeyConfig *keyconf) { - wmKeyMap *keymap = WM_keymap_find(keyconf, "Animation", 0, 0); + wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Animation", 0, 0); wmKeyMapItem *kmi; /* frame management */ diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 3e4e3a551fe..66d636e6008 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -285,8 +285,8 @@ static int add_driver_with_target( } /* Main Driver Management API calls: - * Add a new driver for the specified property on the given ID block, - * and make it be driven by the specified target. + * Add a new driver for the specified property on the given ID block, + * and make it be driven by the specified target. * * This is intended to be used in conjunction with a modal "eyedropper" * for picking the variable that is going to be used to drive this one. @@ -368,7 +368,7 @@ int ANIM_add_driver_with_target( /* --------------------------------- */ /* Main Driver Management API calls: - * Add a new driver for the specified property on the given ID block + * Add a new driver for the specified property on the given ID block */ int ANIM_add_driver(ReportList *reports, ID *id, const char rna_path[], int array_index, short flag, int type) { @@ -464,7 +464,7 @@ int ANIM_add_driver(ReportList *reports, ID *id, const char rna_path[], int arra } /* Main Driver Management API calls: - * Remove the driver for the specified property on the given ID block (if available) + * Remove the driver for the specified property on the given ID block (if available) */ bool ANIM_remove_driver(ReportList *UNUSED(reports), ID *id, const char rna_path[], int array_index, short UNUSED(flag)) { diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 951dcc2dddf..f1d8f9a1ebf 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -387,7 +387,7 @@ static void fmod_envelope_deletepoint_cb(bContext *UNUSED(C), void *fcm_dv, void { FMod_Envelope *env = (FMod_Envelope *)fcm_dv; FCM_EnvelopeData *fedn; - int index = GET_INT_FROM_POINTER(ind_v); + int index = POINTER_AS_INT(ind_v); /* check that no data exists for the current frame... */ if (env->totvert > 1) { @@ -465,7 +465,7 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh but = uiDefIconBut(block, UI_BTYPE_BUT, B_FMODIFIER_REDRAW, ICON_X, 0, 0, 0.9 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete envelope control point")); - UI_but_func_set(but, fmod_envelope_deletepoint_cb, env, SET_INT_IN_POINTER(i)); + UI_but_func_set(but, fmod_envelope_deletepoint_cb, env, POINTER_FROM_INT(i)); UI_block_align_begin(block); } } diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 1bbfa6cc979..d3b8e1e3d5b 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -107,7 +107,7 @@ short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEdi ked->curflags = 0; } - /* Only operate on this BezTriple if it fullfills the criteria of the validation func */ + /* Only operate on this BezTriple if it fulfills the criteria of the validation func */ if ((ok = key_ok(ked, bezt))) { if (ked) ked->curflags = ok; @@ -761,7 +761,7 @@ static short snap_bezier_nearest(KeyframeEditData *UNUSED(ked), BezTriple *bezt) return 0; } -/* snaps the keyframe to the neares second */ +/* snaps the keyframe to the nearest second */ static short snap_bezier_nearestsec(KeyframeEditData *ked, BezTriple *bezt) { const Scene *scene = ked->scene; @@ -882,7 +882,7 @@ static short mirror_bezier_cframe(KeyframeEditData *ked, BezTriple *bezt) static short mirror_bezier_yaxis(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) { - /* Yes, names are inverted, we are mirroring accross y axis, hence along x axis... */ + /* Yes, names are inverted, we are mirroring across y axis, hence along x axis... */ mirror_bezier_xaxis_ex(bezt, 0.0f); } @@ -892,7 +892,7 @@ static short mirror_bezier_yaxis(KeyframeEditData *UNUSED(ked), BezTriple *bezt) static short mirror_bezier_xaxis(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) { - /* Yes, names are inverted, we are mirroring accross x axis, hence along y axis... */ + /* Yes, names are inverted, we are mirroring across x axis, hence along y axis... */ mirror_bezier_yaxis_ex(bezt, 0.0f); } @@ -911,7 +911,7 @@ static short mirror_bezier_marker(KeyframeEditData *ked, BezTriple *bezt) static short mirror_bezier_time(KeyframeEditData *ked, BezTriple *bezt) { - /* value to mirror over is strored in f1 */ + /* value to mirror over is stored in f1 */ if (bezt->f2 & SELECT) { mirror_bezier_xaxis_ex(bezt, ked->f1); } diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index a6ed6643257..347e3f373bb 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -973,18 +973,18 @@ short paste_animedit_keys(bAnimContext *ac, ListBase *anim_data, } else { /* from selected channels - * This "passes" system aims to try to find "matching" channels to paste keyframes - * into with increasingly loose matching heuristics. The process finishes when at least - * one F-Curve has been pasted into. + * This "passes" system aims to try to find "matching" channels to paste keyframes + * into with increasingly loose matching heuristics. The process finishes when at least + * one F-Curve has been pasted into. */ for (pass = 0; pass < 3; pass++) { unsigned int totmatch = 0; for (ale = anim_data->first; ale; ale = ale->next) { /* find buffer item to paste from - * - if names don't matter (i.e. only 1 channel in buffer), don't check id/group - * - if names do matter, only check if id-type is ok for now (group check is not that important) - * - most importantly, rna-paths should match (array indices are unimportant for now) + * - if names don't matter (i.e. only 1 channel in buffer), don't check id/group + * - if names do matter, only check if id-type is ok for now (group check is not that important) + * - most importantly, rna-paths should match (array indices are unimportant for now) */ AnimData *adt = ANIM_nla_mapping_get(ac, ale); FCurve *fcu = (FCurve *)ale->data; /* destination F-Curve */ diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index f7cfec4d48a..f3396da58bb 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -748,7 +748,7 @@ static bool visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop) case CONSTRAINT_TYPE_KINEMATIC: return true; - /* single-transform constraits */ + /* single-transform constraints */ case CONSTRAINT_TYPE_TRACKTO: if (searchtype == VISUALKEY_ROT) return true; break; @@ -1686,7 +1686,7 @@ static int delete_key_v3d_exec(bContext *C, wmOperator *op) } /* special exception for bones, as this makes this operator more convenient to use - * NOTE: This is only done in pose mode. In object mode, we're dealign with the entire object. + * NOTE: This is only done in pose mode. In object mode, we're dealing with the entire object. */ if ((ob->mode & OB_MODE_POSE) && strstr(fcu->rna_path, "pose.bones[\"")) { bPoseChannel *pchan; diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 5e4db3ca61c..6962647b9b7 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -709,7 +709,7 @@ int ANIM_scene_get_keyingset_index(Scene *scene, KeyingSet *ks) } /* Get Keying Set to use for Auto-Keyframing some transforms */ -KeyingSet *ANIM_get_keyingset_for_autokeying(Scene *scene, const char *tranformKSName) +KeyingSet *ANIM_get_keyingset_for_autokeying(Scene *scene, const char *transformKSName) { /* get KeyingSet to use * - use the active KeyingSet if defined (and user wants to use it for all autokeying), @@ -720,7 +720,7 @@ KeyingSet *ANIM_get_keyingset_for_autokeying(Scene *scene, const char *tranformK else if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)) return ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_AVAILABLE_ID); else - return ANIM_builtin_keyingset_get_named(NULL, tranformKSName); + return ANIM_builtin_keyingset_get_named(NULL, transformKSName); } /* Menu of All Keying Sets ----------------------------- */ diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c index b268baf0f97..8769a4c0f31 100644 --- a/source/blender/editors/armature/armature_add.c +++ b/source/blender/editors/armature/armature_add.c @@ -667,7 +667,7 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op) if (axis_delta == 0.0f) { /* both mirrored bones exist and point to eachother and overlap exactly. * - * in this case theres no well defined solution, so de-select both and skip. + * in this case there's no well defined solution, so de-select both and skip. */ ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); ebone_iter->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c index 0f382f07671..a66764be731 100644 --- a/source/blender/editors/armature/armature_edit.c +++ b/source/blender/editors/armature/armature_edit.c @@ -242,7 +242,7 @@ float ED_armature_ebone_roll_to_vector(const EditBone *bone, const float align_a return roll; } -/* note, ranges arithmatic is used below */ +/* note, ranges arithmetic is used below */ typedef enum eCalcRollTypes { /* pos */ CALC_ROLL_POS_X = 0, @@ -936,7 +936,7 @@ static int armature_merge_exec(bContext *C, wmOperator *op) bstart = ebo; } else { - /* chain is broken... merge any continous segments then clear */ + /* chain is broken... merge any continuous segments then clear */ if (bstart && bend) bones_merge(obedit, bstart, bend, bchild, &chains); diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c index fb314fd4ac0..b0614c84d14 100644 --- a/source/blender/editors/armature/armature_naming.c +++ b/source/blender/editors/armature/armature_naming.c @@ -135,7 +135,7 @@ static void constraint_bone_name_fix(Object *ob, ListBase *conlist, const char * /* called by UI for renaming a bone */ /* warning: make sure the original bone was not renamed yet! */ -/* seems messy, but thats what you get with not using pointers but channel names :) */ +/* seems messy, but that's what you get with not using pointers but channel names :) */ void ED_armature_bone_rename(Main *bmain, bArmature *arm, const char *oldnamep, const char *newnamep) { Object *ob; diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index 3f2eefced7d..d0b87545798 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -201,7 +201,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf) wmKeyMapItem *kmi; /* Armature ------------------------ */ - keymap = WM_keymap_find(keyconf, "Armature", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Armature", 0, 0); keymap->poll = ED_operator_editarmature; /* Armature -> Etch-A-Ton ------------------------ */ @@ -309,7 +309,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf) /* Pose ------------------------ */ /* only set in posemode, by space_view3d listener */ - keymap = WM_keymap_find(keyconf, "Pose", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Pose", 0, 0); keymap->poll = ED_operator_posemode; /* set parent and add object are object-based operators, but we make them diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index c211f9154ef..7a5e0563dd5 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -776,8 +776,8 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op) * - the context iterator contains both selected bones and their mirrored copies, * so we assume that unselected bones are mirrored copies of some selected bone * - since the active one (and/or its mirror) will also be selected, we also need - * to check that we are not trying to operate on them, since such an operation - * would cause errors + * to check that we are not trying to operate on them, since such an operation + * would cause errors */ /* parent selected bones to the active one */ diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index b74b515b37f..89e510e6f3e 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -665,7 +665,7 @@ static int RIG_parentControl(RigControl *ctrl, EditBone *link) } /* if there's already a link - * overwrite only if new link is higher in the chain */ + * overwrite only if new link is higher in the chain */ if (ctrl->link && flag == ctrl->flag) { EditBone *bone = NULL; diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 691da4cbd2b..f789cd0e80a 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -157,7 +157,7 @@ void BIF_makeListTemplates(const bContext *C) if (ob != obedit && ob->type == OB_ARMATURE) { index++; - BLI_ghash_insert(TEMPLATES_HASH, SET_INT_IN_POINTER(index), ob); + BLI_ghash_insert(TEMPLATES_HASH, POINTER_FROM_INT(index), ob); if (ob == ts->skgen_template) { TEMPLATES_CURRENT = index; @@ -187,7 +187,7 @@ const char *BIF_listTemplates(const bContext *UNUSED(C)) while (!BLI_ghashIterator_done(&ghi)) { Object *ob = BLI_ghashIterator_getValue(&ghi); - int key = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&ghi)); + int key = POINTER_AS_INT(BLI_ghashIterator_getKey(&ghi)); p += sprintf(p, "|%s %%x%i", ob->id.name + 2, key); @@ -208,7 +208,7 @@ int BIF_currentTemplate(const bContext *C) while (!BLI_ghashIterator_done(&ghi)) { Object *ob = BLI_ghashIterator_getValue(&ghi); - int key = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&ghi)); + int key = POINTER_AS_INT(BLI_ghashIterator_getKey(&ghi)); if (ob == ts->skgen_template) { TEMPLATES_CURRENT = key; @@ -302,7 +302,7 @@ void BIF_setTemplate(bContext *C, int index) { ToolSettings *ts = CTX_data_tool_settings(C); if (index > 0) { - ts->skgen_template = BLI_ghash_lookup(TEMPLATES_HASH, SET_INT_IN_POINTER(index)); + ts->skgen_template = BLI_ghash_lookup(TEMPLATES_HASH, POINTER_FROM_INT(index)); } else { ts->skgen_template = NULL; @@ -905,7 +905,7 @@ static void sk_interpolateDepth(bContext *C, SK_Stroke *stk, int start, int end, float pval[2] = {0, 0}; ED_view3d_project_float_global(ar, stk->points[i].p, pval, V3D_PROJ_TEST_NOP); - ED_view3d_win_to_ray(ar, v3d, pval, ray_start, ray_normal, false); + ED_view3d_win_to_ray_clipped(ar, v3d, pval, ray_start, ray_normal, false); mul_v3_fl(ray_normal, distance * progress / length); add_v3_v3(stk->points[i].p, ray_normal); @@ -1502,7 +1502,7 @@ static int sk_getIntersections(bContext *C, ListBase *list, SK_Sketch *sketch, S mval[0] = vi[0]; mval[1] = vi[1]; - ED_view3d_win_to_segment(ar, v3d, mval, ray_start, ray_end, true); + ED_view3d_win_to_segment_clipped(ar, v3d, mval, ray_start, ray_end, true); isect_line_line_v3(stk->points[s_i].p, stk->points[s_i + 1].p, @@ -2051,7 +2051,7 @@ static void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch, for (p = sketch->depth_peels.first; p; p = p->next) { - int index = GET_INT_FROM_POINTER(p->ob); + int index = POINTER_AS_INT(p->ob); index = (index >> 5) & 7; glColor3fv(colors[index]); diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 389a8423f23..f04106dac3a 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -801,8 +801,8 @@ static int pose_armature_layers_showall_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; /* use RNA to set the layers - * although it would be faster to just set directly using bitflags, we still - * need to setup a RNA pointer so that we get the "update" callbacks for free... + * although it would be faster to just set directly using bitflags, we still + * need to setup a RNA pointer so that we get the "update" callbacks for free... */ RNA_id_pointer_create(&arm->id, &ptr); @@ -1124,7 +1124,7 @@ void POSE_OT_hide(wmOperatorType *ot) static int show_pose_bone_cb(Object *ob, Bone *bone, void *data) { - const bool select = GET_INT_FROM_POINTER(data); + const bool select = POINTER_AS_INT(data); bArmature *arm = ob->data; @@ -1147,7 +1147,7 @@ static int pose_reveal_exec(bContext *C, wmOperator *op) bArmature *arm = ob->data; const bool select = RNA_boolean_get(op->ptr, "select"); - bone_looper(ob, arm->bonebase.first, SET_INT_IN_POINTER(select), show_pose_bone_cb); + bone_looper(ob, arm->bonebase.first, POINTER_FROM_INT(select), show_pose_bone_cb); /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob); diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index ecfaa41b0b5..c4a7ecd25c7 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -63,8 +63,8 @@ #include "armature_intern.h" /* utility macros for storing a temp int in the bone (selection flag) */ -#define PBONE_PREV_FLAG_GET(pchan) ((void)0, (GET_INT_FROM_POINTER((pchan)->temp))) -#define PBONE_PREV_FLAG_SET(pchan, val) ((pchan)->temp = SET_INT_IN_POINTER(val)) +#define PBONE_PREV_FLAG_GET(pchan) ((void)0, (POINTER_AS_INT((pchan)->temp))) +#define PBONE_PREV_FLAG_SET(pchan, val) ((pchan)->temp = POINTER_FROM_INT(val)) /* ***************** Pose Select Utilities ********************* */ diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index 5d27e13ed17..4a801d9de64 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -169,7 +169,7 @@ void ED_keymap_curve(wmKeyConfig *keyconf) wmKeyMap *keymap; wmKeyMapItem *kmi; - keymap = WM_keymap_find(keyconf, "Font", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Font", 0, 0); keymap->poll = ED_operator_editfont; /* only set in editmode font, by space_view3d listener */ @@ -229,7 +229,7 @@ void ED_keymap_curve(wmKeyConfig *keyconf) RNA_boolean_set(kmi->ptr, "accent", true); /* accented characters */ /* only set in editmode curve, by space_view3d listener */ - keymap = WM_keymap_find(keyconf, "Curve", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Curve", 0, 0); keymap->poll = ED_operator_editsurfcurve; WM_keymap_add_menu(keymap, "INFO_MT_edit_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0); diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index 325c39d7f38..7bdf17e9344 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -98,7 +98,7 @@ struct CurveDrawData { bool use_plane; float plane[4]; - /* use 'rv3d->depths', note that this will become 'damaged' while drawing, but thats OK. */ + /* use 'rv3d->depths', note that this will become 'damaged' while drawing, but that's OK. */ bool use_depth; /* offset projection by this value */ @@ -186,7 +186,6 @@ static bool stroke_elem_project( float surface_offset, const float radius, float r_location_world[3], float r_normal_world[3]) { - View3D *v3d = cdd->vc.v3d; ARegion *ar = cdd->vc.ar; RegionView3D *rv3d = cdd->vc.rv3d; @@ -195,12 +194,7 @@ static bool stroke_elem_project( /* project to 'location_world' */ if (cdd->project.use_plane) { /* get the view vector to 'location' */ - float ray_origin[3], ray_direction[3]; - ED_view3d_win_to_ray(cdd->vc.ar, v3d, mval_fl, ray_origin, ray_direction, false); - - float lambda; - if (isect_ray_plane_v3(ray_origin, ray_direction, cdd->project.plane, &lambda, true)) { - madd_v3_v3v3fl(r_location_world, ray_origin, ray_direction, lambda); + if (ED_view3d_win_to_3d_on_plane(ar, cdd->project.plane, mval_fl, true, r_location_world)) { if (r_normal_world) { zero_v3(r_normal_world); } diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index 5e62a87caf3..9d9ec51119b 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -55,9 +55,9 @@ /* ***************************************** */ /* NOTE ABOUT THIS FILE: - * This file contains code for editing Grease Pencil data in the Action Editor - * as a 'keyframes', so that a user can adjust the timing of Grease Pencil drawings. - * Therefore, this file mostly contains functions for selecting Grease-Pencil frames. + * This file contains code for editing Grease Pencil data in the Action Editor + * as a 'keyframes', so that a user can adjust the timing of Grease Pencil drawings. + * Therefore, this file mostly contains functions for selecting Grease-Pencil frames. */ /* ***************************************** */ /* Generics - Loopers */ diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index 0f51f12793a..228a2afeb83 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -956,7 +956,7 @@ static bool gpsculpt_brush_apply_clone(bContext *C, tGP_BrushEditData *gso) gp_brush_clone_add(C, gso); } else { - /* Stamp or Continous Mode */ + /* Stamp or Continuous Mode */ if (1 /*gso->brush->mode == GP_EDITBRUSH_CLONE_MODE_STAMP*/) { /* Stamp - Proceed to translate the newly added strokes */ gp_brush_clone_adjust(gso); diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index c28fea0fc41..1bdeeefe223 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -670,13 +670,13 @@ static int gp_merge_layer_exec(bContext *C, wmOperator *op) /* Collect frames of gpl_current in hash table to avoid O(n^2) lookups */ GHash *gh_frames_cur = BLI_ghash_int_new_ex(__func__, 64); for (bGPDframe *gpf = gpl_current->frames.first; gpf; gpf = gpf->next) { - BLI_ghash_insert(gh_frames_cur, SET_INT_IN_POINTER(gpf->framenum), gpf); + BLI_ghash_insert(gh_frames_cur, POINTER_FROM_INT(gpf->framenum), gpf); } /* read all frames from next layer */ for (bGPDframe *gpf = gpl_next->frames.first; gpf; gpf = gpf->next) { /* try to find frame in active layer */ - bGPDframe *frame = BLI_ghash_lookup(gh_frames_cur, SET_INT_IN_POINTER(gpf->framenum)); + bGPDframe *frame = BLI_ghash_lookup(gh_frames_cur, POINTER_FROM_INT(gpf->framenum)); if (!frame) { /* nothing found, create new */ frame = BKE_gpencil_frame_addnew(gpl_current, gpf->framenum); diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index d7e60d2a0ce..f48736a15e1 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -319,15 +319,15 @@ typedef enum ACTCONT_TYPES { /* Stroke Iteration Utilities */ /** -* Iterate over all editable strokes in the current context, -* stopping on each usable layer + stroke pair (i.e. gpl and gps) -* to perform some operations on the stroke. -* -* \param gpl The identifier to use for the layer of the stroke being processed. -* Choose a suitable value to avoid name clashes. -* \param gps The identifier to use for current stroke being processed. -* Choose a suitable value to avoid name clashes. -*/ + * Iterate over all editable strokes in the current context, + * stopping on each usable layer + stroke pair (i.e. gpl and gps) + * to perform some operations on the stroke. + * + * \param gpl The identifier to use for the layer of the stroke being processed. + * Choose a suitable value to avoid name clashes. + * \param gps The identifier to use for current stroke being processed. + * Choose a suitable value to avoid name clashes. + */ #define GP_EDITABLE_STROKES_BEGIN(C, gpl, gps) \ { \ CTX_DATA_BEGIN(C, bGPDlayer*, gpl, editable_gpencil_layers) \ diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c index 2a575c02046..e209b7f46e7 100644 --- a/source/blender/editors/gpencil/gpencil_ops.c +++ b/source/blender/editors/gpencil/gpencil_ops.c @@ -55,7 +55,7 @@ /* Generic Drawing Keymap */ static void ed_keymap_gpencil_general(wmKeyConfig *keyconf) { - wmKeyMap *keymap = WM_keymap_find(keyconf, "Grease Pencil", 0, 0); + wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil", 0, 0); wmKeyMapItem *kmi; /* Draw --------------------------------------- */ @@ -123,7 +123,7 @@ static bool gp_stroke_editmode_poll(bContext *C) /* Stroke Editing Keymap - Only when editmode is enabled */ static void ed_keymap_gpencil_editing(wmKeyConfig *keyconf) { - wmKeyMap *keymap = WM_keymap_find(keyconf, "Grease Pencil Stroke Edit Mode", 0, 0); + wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Edit Mode", 0, 0); wmKeyMapItem *kmi; /* set poll callback - so that this keymap only gets enabled when stroke editmode is enabled */ diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index fd1ff857317..0eb74f137ca 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -2138,10 +2138,10 @@ static void gpencil_draw_apply_event(wmOperator *op, const wmEvent *event) p->pressure = wmtab->Pressure; /* Hack for pressure sensitive eraser on D+RMB when using a tablet: - * The pen has to float over the tablet surface, resulting in - * zero pressure (T47101). Ignore pressure values if floating - * (i.e. "effectively zero" pressure), and only when the "active" - * end is the stylus (i.e. the default when not eraser) + * The pen has to float over the tablet surface, resulting in + * zero pressure (T47101). Ignore pressure values if floating + * (i.e. "effectively zero" pressure), and only when the "active" + * end is the stylus (i.e. the default when not eraser) */ if (p->paintmode == GP_PAINTMODE_ERASER) { if ((wmtab->Active != EVT_TABLET_ERASER) && (p->pressure < 0.001f)) { @@ -2166,7 +2166,7 @@ static void gpencil_draw_apply_event(wmOperator *op, const wmEvent *event) p->straight[1] = 0; /* special exception here for too high pressure values on first touch in - * windows for some tablets, then we just skip first touch... + * windows for some tablets, then we just skip first touch... */ if (tablet && (p->pressure >= 0.99f)) return; diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index dd556e99264..a21c5618877 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -735,7 +735,7 @@ static bool gp_stroke_do_circle_sel( if (gp_stroke_inside_circle(mval, mvalo, radius, x0, y0, x1, y1)) { /* change selection of stroke, and then of both points * (as the last point otherwise wouldn't get selected - * as we only do n-1 loops through) + * as we only do n-1 loops through). */ if (select) { pt1->flag |= GP_SPOINT_SELECT; diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index 06b8197de97..eb77ee8f552 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -327,11 +327,11 @@ bool ANIM_driver_vars_paste(struct ReportList *reports, struct FCurve *fcu, bool /* ************ Auto-Keyframing ********************** */ /* Notes: * - All the defines for this (User-Pref settings and Per-Scene settings) - * are defined in DNA_userdef_types.h + * are defined in DNA_userdef_types.h * - Scene settings take precedence over those for userprefs, with old files - * inheriting userpref settings for the scene settings + * inheriting userpref settings for the scene settings * - "On/Off + Mode" are stored per Scene, but "settings" are currently stored - * as userprefs + * as userprefs */ /* Auto-Keying macros for use by various tools */ diff --git a/source/blender/editors/include/ED_types.h b/source/blender/editors/include/ED_types.h index a478278da4c..9188fca2422 100644 --- a/source/blender/editors/include/ED_types.h +++ b/source/blender/editors/include/ED_types.h @@ -33,7 +33,7 @@ /* **************** GENERAL EDITOR-WIDE TYPES AND DEFINES ************************** */ -/* old blender defines... should be depricated? */ +/* old blender defines... should be deprecated? */ #define DESELECT 0 #define SELECT 1 #define ACTIVE 2 diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 82411ba7401..c21a6cccb2e 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -221,12 +221,15 @@ float ED_view3d_pixel_size_no_ui_scale(const struct RegionView3D *rv3d, const fl float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3], bool *r_flip); bool ED_view3d_clip_segment(const struct RegionView3D *rv3d, float ray_start[3], float ray_end[3]); -bool ED_view3d_win_to_ray( +bool ED_view3d_win_to_ray_clipped( const struct ARegion *ar, const struct View3D *v3d, const float mval[2], float ray_start[3], float ray_normal[3], const bool do_clip); -bool ED_view3d_win_to_ray_ex( +bool ED_view3d_win_to_ray_clipped_ex( const struct ARegion *ar, const struct View3D *v3d, const float mval[2], float r_ray_co[3], float r_ray_normal[3], float r_ray_start[3], bool do_clip); +void ED_view3d_win_to_ray( + const struct ARegion *ar, const float mval[2], + float r_ray_start[3], float r_ray_normal[3]); void ED_view3d_global_to_vector(const struct RegionView3D *rv3d, const float coord[3], float vec[3]); void ED_view3d_win_to_3d( const struct View3D *v3d, const struct ARegion *ar, @@ -236,11 +239,20 @@ void ED_view3d_win_to_3d_int( const struct View3D *v3d, const struct ARegion *ar, const float depth_pt[3], const int mval[2], float r_out[3]); +bool ED_view3d_win_to_3d_on_plane( + const struct ARegion *ar, + const float plane[4], const float mval[2], const bool do_clip, + float r_out[3]); +bool ED_view3d_win_to_3d_on_plane_int( + const struct ARegion *ar, + const float plane[4], const int mval[2], const bool do_clip, + float r_out[3]); void ED_view3d_win_to_delta(const struct ARegion *ar, const float mval[2], float out[3], const float zfac); void ED_view3d_win_to_origin(const struct ARegion *ar, const float mval[2], float out[3]); void ED_view3d_win_to_vector(const struct ARegion *ar, const float mval[2], float out[3]); -bool ED_view3d_win_to_segment(const struct ARegion *ar, struct View3D *v3d, const float mval[2], - float r_ray_start[3], float r_ray_end[3], const bool do_clip); +bool ED_view3d_win_to_segment_clipped( + const struct ARegion *ar, struct View3D *v3d, const float mval[2], + float r_ray_start[3], float r_ray_end[3], const bool do_clip); void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]); void ED_view3d_ob_project_mat_get_from_obmat(const struct RegionView3D *rv3d, float obmat[4][4], float pmat[4][4]); void ED_view3d_unproject(struct bglMats *mats, float out[3], const float x, const float y, const float z); diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index a38f82bc5fc..0db6e2c122c 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -462,6 +462,11 @@ void UI_block_update_from_old(const struct bContext *C, struct uiBlock *block); uiBlock *UI_block_find_in_region(const char *name, struct ARegion *ar); +enum { + UI_BLOCK_THEME_STYLE_REGULAR = 0, + UI_BLOCK_THEME_STYLE_POPUP = 1, +}; +void UI_block_theme_style_set(uiBlock *block, char theme_style); void UI_block_emboss_set(uiBlock *block, char dt); void UI_block_free(const struct bContext *C, uiBlock *block); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 82ae4de07af..3188829bf31 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2369,7 +2369,7 @@ static bool ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char str_unit_convert, sizeof(str_unit_convert), but->drawstr, ui_get_but_scale_unit(but, 1.0), but->block->unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type)); - return BPY_execute_string_as_number(C, str_unit_convert, true, r_value); + return BPY_execute_string_as_number(C, NULL, str_unit_convert, true, r_value); } #endif /* WITH_PYTHON */ @@ -2384,7 +2384,7 @@ bool ui_but_string_set_eval_num(bContext *C, uiBut *but, const char *str, double if (str[0] != '\0') { bool is_unit_but = (ui_but_is_float(but) && ui_but_is_unit(but)); /* only enable verbose if we won't run again with units */ - if (BPY_execute_string_as_number(C, str, is_unit_but == false, r_value)) { + if (BPY_execute_string_as_number(C, NULL, str, is_unit_but == false, r_value)) { /* if the value parsed ok without unit conversion this button may still need a unit multiplier */ if (is_unit_but) { char str_new[128]; @@ -2879,6 +2879,11 @@ void UI_block_emboss_set(uiBlock *block, char dt) block->dt = dt; } +void UI_block_theme_style_set(uiBlock *block, char theme_style) +{ + block->theme_style = theme_style; +} + /** * \param but: Button to update. * \param validate: When set, this function may change the button value. @@ -4159,7 +4164,7 @@ void UI_but_drag_set_value(uiBut *but) void UI_but_drag_set_image(uiBut *but, const char *path, int icon, struct ImBuf *imb, float scale, const bool use_free) { but->dragtype = WM_DRAG_PATH; - ui_def_but_icon(but, icon, 0); /* no flag UI_HAS_ICON, so icon doesnt draw in button */ + ui_def_but_icon(but, icon, 0); /* no flag UI_HAS_ICON, so icon doesn't draw in button */ if ((but->dragflag & UI_BUT_DRAGPOIN_FREE)) { MEM_SAFE_FREE(but->dragpoin); but->dragflag &= ~UI_BUT_DRAGPOIN_FREE; @@ -4479,7 +4484,7 @@ static void operator_enum_search_cb(const struct bContext *C, void *but, const c for (item = item_array; item->identifier; item++) { /* note: need to give the index rather than the identifier because the enum can be freed */ if (BLI_strcasestr(item->name, str)) { - if (false == UI_search_item_add(items, item->name, SET_INT_IN_POINTER(item->value), 0)) + if (false == UI_search_item_add(items, item->name, POINTER_FROM_INT(item->value), 0)) break; } } @@ -4497,7 +4502,7 @@ static void operator_enum_call_cb(struct bContext *UNUSED(C), void *but, void *a if (ot) { if (ot->prop) { - RNA_property_enum_set(opptr, ot->prop, GET_INT_FROM_POINTER(arg2)); + RNA_property_enum_set(opptr, ot->prop, POINTER_AS_INT(arg2)); /* We do not call op from here, will be called by button code. * ui_apply_but_funcs_after() (in interface_handlers.c) called this func before checking operators, * because one of its parameters is the button itself! diff --git a/source/blender/editors/interface/interface_eyedropper_color.c b/source/blender/editors/interface/interface_eyedropper_color.c index 5eb4359607a..34f33f1d970 100644 --- a/source/blender/editors/interface/interface_eyedropper_color.c +++ b/source/blender/editors/interface/interface_eyedropper_color.c @@ -103,7 +103,7 @@ static bool eyedropper_init(bContext *C, wmOperator *op) display_device = scene->display_settings.display_device; eye->display = IMB_colormanagement_display_get_named(display_device); - /* store inital color */ + /* store initial color */ RNA_property_float_get_array(&eye->ptr, eye->prop, col); if (eye->display) { IMB_colormanagement_display_to_scene_linear_v3(col, eye->display); diff --git a/source/blender/editors/interface/interface_eyedropper_datablock.c b/source/blender/editors/interface/interface_eyedropper_datablock.c index 2bb575558fc..43ccd65ddf2 100644 --- a/source/blender/editors/interface/interface_eyedropper_datablock.c +++ b/source/blender/editors/interface/interface_eyedropper_datablock.c @@ -190,7 +190,10 @@ static void datadropper_id_sample_pt(bContext *C, DataDropper *ddr, int mx, int } } - if (id) { + PointerRNA idptr; + RNA_id_pointer_create(id, &idptr); + + if (id && RNA_property_pointer_poll(&ddr->ptr, ddr->prop, &idptr)) { BLI_snprintf(ddr->name, sizeof(ddr->name), "%s: %s", ddr->idcode_name, id->name + 2); *r_id = id; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 06b6099cec7..64c3ae32eaa 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -160,7 +160,7 @@ typedef enum uiHandleButtonState { #ifdef USE_ALLSELECT -/* Unfortunately theres no good way handle more generally: +/* Unfortunately there's no good way handle more generally: * (propagate single clicks on layer buttons to other objects) */ #define USE_ALLSELECT_LAYER_HACK @@ -2529,7 +2529,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, * It converts every UTF-8 character to an asterisk, and also remaps * the cursor position and selection start/end. * - * \note: remaping is used, because password could contain UTF-8 characters. + * \note: remapping is used, because password could contain UTF-8 characters. * */ @@ -2793,7 +2793,7 @@ static bool ui_textedit_insert_buf( if ((len + step >= data->maxlen) && (data->maxlen - (len + 1) > 0)) { if (ui_but_is_utf8(but)) { - /* shorten 'step' to a utf8 algined size that fits */ + /* shorten 'step' to a utf8 aligned size that fits */ BLI_strnlen_utf8_ex(buf, data->maxlen - (len + 1), &step); } else { @@ -3859,7 +3859,7 @@ static int ui_do_but_HOTKEYEVT( if (event->type == LEFTMOUSE && event->val == KM_PRESS) { /* only cancel if click outside the button */ if (ui_but_contains_point_px(but->active->region, but, event->x, event->y) == 0) { - /* data->cancel doesnt work, this button opens immediate */ + /* data->cancel doesn't work, this button opens immediate */ if (but->flag & UI_BUT_IMMEDIATE) ui_but_value_set(but, 0); else @@ -4444,7 +4444,7 @@ static int ui_do_but_NUM( else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { if (data->dragchange) { #ifdef USE_DRAG_MULTINUM - /* if we started multibutton but didnt drag, then edit */ + /* if we started multibutton but didn't drag, then edit */ if (data->multi_data.init == BUTTON_MULTI_INIT_SETUP) { click = 1; } @@ -4755,7 +4755,7 @@ static int ui_do_but_SLI( else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { if (data->dragchange) { #ifdef USE_DRAG_MULTINUM - /* if we started multibutton but didnt drag, then edit */ + /* if we started multibutton but didn't drag, then edit */ if (data->multi_data.init == BUTTON_MULTI_INIT_SETUP) { click = 1; } @@ -8327,7 +8327,7 @@ static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, u /* ************************* menu handling *******************************/ /** - * Function used to prevent loosing the open menu when using nested pulldowns, + * Function used to prevent losing the open menu when using nested pulldowns, * when moving mouse towards the pulldown menu over other buttons that could * steal the highlight from the current button, only checks: * @@ -8547,7 +8547,7 @@ static int ui_menu_scroll(ARegion *ar, uiBlock *block, int my, uiBut *to_bt) * let the parent menu get the event. * * This allows a menu to be open, - * but send key events to the parent if theres no active buttons. + * but send key events to the parent if there's no active buttons. * * Without this keyboard navigation from menu's wont work. */ diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 75f2efdf3aa..11691fd8365 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -404,9 +404,10 @@ struct uiBlock { short alignnr; char direction; + char theme_style; /* UI_BLOCK_THEME_STYLE_* */ char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied to buttons */ bool auto_open; - char _pad[7]; + char _pad[6]; double auto_open_last; const char *lockstr; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index edd568e4fea..6550115e50b 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -370,7 +370,7 @@ static void ui_layer_but_cb(bContext *C, void *arg_but, void *arg_index) uiBut *but = arg_but, *cbut; PointerRNA *ptr = &but->rnapoin; PropertyRNA *prop = but->rnaprop; - int i, index = GET_INT_FROM_POINTER(arg_index); + int i, index = POINTER_AS_INT(arg_index); int shift = win->eventstate->shift; int len = RNA_property_array_length(ptr, prop); @@ -463,7 +463,7 @@ static void ui_item_array( but = uiDefAutoButR(block, ptr, prop, layer_num, "", icon, x + butw * a, y + buth, butw, buth); if (subtype == PROP_LAYER_MEMBER) - UI_but_func_set(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(layer_num)); + UI_but_func_set(but, ui_layer_but_cb, but, POINTER_FROM_INT(layer_num)); } for (a = 0; a < colbuts; a++) { const int layer_num = a + len / 2 + b * colbuts; @@ -481,7 +481,7 @@ static void ui_item_array( but = uiDefAutoButR(block, ptr, prop, layer_num, "", icon, x + butw * a, y, butw, buth); if (subtype == PROP_LAYER_MEMBER) - UI_but_func_set(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(layer_num)); + UI_but_func_set(but, ui_layer_but_cb, but, POINTER_FROM_INT(layer_num)); } UI_block_align_end(block); @@ -567,7 +567,7 @@ static void ui_item_enum_expand_handle(bContext *C, void *arg1, void *arg2) if (!win->eventstate->shift) { uiBut *but = (uiBut *)arg1; - int enum_value = GET_INT_FROM_POINTER(arg2); + int enum_value = POINTER_AS_INT(arg2); int current_value = RNA_property_enum_get(&but->rnapoin, but->rnaprop); if (!(current_value & enum_value)) { @@ -645,7 +645,7 @@ static void ui_item_enum_expand( but = uiDefButR_prop(block, UI_BTYPE_ROW, 0, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL); if (RNA_property_flag(prop) & PROP_ENUM_FLAG) { - UI_but_func_set(but, ui_item_enum_expand_handle, but, SET_INT_IN_POINTER(value)); + UI_but_func_set(but, ui_item_enum_expand_handle, but, POINTER_FROM_INT(value)); } if (ui_layout_local_dir(layout) != UI_LAYOUT_HORIZONTAL) @@ -1099,7 +1099,7 @@ void uiItemsFullEnumO_items( uiItemS(target); } else { - /* XXX bug here, colums draw bottom item badly */ + /* XXX bug here, columns draw bottom item badly */ uiItemS(target); } } @@ -1741,7 +1741,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s /* add search items from temporary list */ for (cis = items_list->first; cis; cis = cis->next) { - if (false == UI_search_item_add(items, cis->name, SET_INT_IN_POINTER(cis->index), cis->iconid)) { + if (false == UI_search_item_add(items, cis->name, POINTER_FROM_INT(cis->index), cis->iconid)) { break; } } diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 1e67ecdfc90..d941f429339 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1151,7 +1151,7 @@ void ED_operatortypes_ui(void) */ void ED_keymap_ui(wmKeyConfig *keyconf) { - wmKeyMap *keymap = WM_keymap_find(keyconf, "User Interface", 0, 0); + wmKeyMap *keymap = WM_keymap_ensure(keyconf, "User Interface", 0, 0); wmKeyMapItem *kmi; /* eyedroppers - notice they all have the same shortcut, but pass the event diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 744f6b3c4d0..1e8a80bb308 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1247,7 +1247,7 @@ static void ui_panel_drag_collapse(bContext *C, uiPanelDragCollapseHandle *dragc /** * Panel drag-collapse (modal handler) * Clicking and dragging over panels toggles their collapse state based on the panel that was first - * dragged over. If it was open all affected panels incl the initial one are closed and vise versa. + * dragged over. If it was open all affected panels incl the initial one are closed and vice versa. */ static int ui_panel_drag_collapse_handler(bContext *C, const wmEvent *event, void *userdata) { @@ -1619,7 +1619,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) const int px = max_ii(1, round_fl_to_int(U.pixelsize)); const int category_tabs_width = round_fl_to_int(UI_PANEL_CATEGORY_MARGIN_WIDTH * zoom); const float dpi_fac = UI_DPI_FAC; - const int tab_v_pad_text = round_fl_to_int((2 + ((px * 3) * dpi_fac)) * zoom); /* pading of tabs around text */ + const int tab_v_pad_text = round_fl_to_int((2 + ((px * 3) * dpi_fac)) * zoom); /* padding of tabs around text */ const int tab_v_pad = round_fl_to_int((4 + (2 * px * dpi_fac)) * zoom); /* padding between tabs */ const float tab_curve_radius = ((px * 3) * dpi_fac) * zoom; const int roundboxtype = UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT; diff --git a/source/blender/editors/interface/interface_region_color_picker.c b/source/blender/editors/interface/interface_region_color_picker.c index 00462b456ea..afa3486cf6c 100644 --- a/source/blender/editors/interface/interface_region_color_picker.c +++ b/source/blender/editors/interface/interface_region_color_picker.c @@ -629,6 +629,7 @@ uiBlock *ui_block_func_COLOR(bContext *C, uiPopupBlockHandle *handle, void *arg_ ui_block_colorpicker(block, handle->retvec, &but->rnapoin, but->rnaprop, show_picker); block->flag = UI_BLOCK_LOOP | UI_BLOCK_KEEP_OPEN | UI_BLOCK_OUT_1 | UI_BLOCK_MOVEMOUSE_QUIT; + UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); UI_block_bounds_set_normal(block, 0.5 * UI_UNIT_X); block->block_event_func = ui_colorpicker_small_wheel_cb; diff --git a/source/blender/editors/interface/interface_region_menu_pie.c b/source/blender/editors/interface/interface_region_menu_pie.c index 41001d65d82..ef2d273bab6 100644 --- a/source/blender/editors/interface/interface_region_menu_pie.c +++ b/source/blender/editors/interface/interface_region_menu_pie.c @@ -87,6 +87,7 @@ static uiBlock *ui_block_func_PIE(bContext *UNUSED(C), uiPopupBlockHandle *handl UI_block_layout_resolve(block, &width, &height); UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_NUMSELECT); + UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); block->minbounds = minwidth; block->bounds = 1; diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c index fa7113f195e..fac96fc2154 100644 --- a/source/blender/editors/interface/interface_region_menu_popup.c +++ b/source/blender/editors/interface/interface_region_menu_popup.c @@ -235,6 +235,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi uiBut *but_activate = NULL; UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_NUMSELECT); + UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); UI_block_direction_set(block, direction); /* offset the mouse position, possibly based on earlier selection */ diff --git a/source/blender/editors/interface/interface_region_popup.c b/source/blender/editors/interface/interface_region_popup.c index 656c59055af..93fd62b5c66 100644 --- a/source/blender/editors/interface/interface_region_popup.c +++ b/source/blender/editors/interface/interface_region_popup.c @@ -502,6 +502,7 @@ uiBlock *ui_popup_block_refresh( } block->flag |= UI_BLOCK_LOOP; + UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); /* defer this until blocks are translated (below) */ block->oldblock = NULL; diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c index 1eec3737215..7bb0a02bbf6 100644 --- a/source/blender/editors/interface/interface_region_tooltip.c +++ b/source/blender/editors/interface/interface_region_tooltip.c @@ -573,12 +573,12 @@ static ARegion *ui_tooltip_create_with_data( const float pad_px = UI_TIP_PADDING; wmWindow *win = CTX_wm_window(C); const int winx = WM_window_pixels_x(win); + const int winy = WM_window_pixels_y(win); uiStyle *style = UI_style_get(); static ARegionType type; ARegion *ar; int fonth, fontw; int h, i; - rctf rect_fl; rcti rect_i; int font_flag = 0; @@ -658,35 +658,32 @@ static ARegion *ui_tooltip_create_with_data( data->toth = fonth; data->lineh = h; - /* compute position */ - - rect_fl.xmin = init_position[0] - TIP_BORDER_X; - rect_fl.xmax = rect_fl.xmin + fontw + pad_px; - rect_fl.ymax = init_position[1] - TIP_BORDER_Y; - rect_fl.ymin = rect_fl.ymax - fonth - TIP_BORDER_Y; - - BLI_rcti_rctf_copy(&rect_i, &rect_fl); + /* Compute position. */ + { + rctf rect_fl; + rect_fl.xmin = init_position[0] - TIP_BORDER_X; + rect_fl.xmax = rect_fl.xmin + fontw + pad_px; + rect_fl.ymax = init_position[1] - TIP_BORDER_Y; + rect_fl.ymin = rect_fl.ymax - fonth - TIP_BORDER_Y; + BLI_rcti_rctf_copy(&rect_i, &rect_fl); + } #undef TIP_BORDER_X #undef TIP_BORDER_Y - /* clip with window boundaries */ - if (rect_i.xmax > winx) { - /* super size */ - if (rect_i.xmax > winx + rect_i.xmin) { - rect_i.xmax = winx; - rect_i.xmin = 0; - } - else { - rect_i.xmin -= rect_i.xmax - winx; - rect_i.xmax = winx; - } - } - /* ensure at least 5 px above screen bounds - * 25 is just a guess to be above the menu item */ - if (rect_i.ymin < 5) { - rect_i.ymax += (-rect_i.ymin) + 30; - rect_i.ymin = 30; + /* Clamp to window bounds. */ + { + /* Ensure at least 5 px above screen bounds + * UI_UNIT_Y is just a guess to be above the menu item */ + const int pad = max_ff(1.0f, U.pixelsize) * 5; + const rcti rect_clamp = { + .xmin = pad, + .xmax = winx - pad, + .ymin = pad + (UI_UNIT_Y * 2), + .ymax = winy - pad, + }; + int offset_dummy[2]; + BLI_rcti_clamp(&rect_i, &rect_clamp, offset_dummy); } /* add padding */ diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 9d05819dd6a..86f9ba40f16 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -267,6 +267,7 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem) block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_SEARCH_MENU); + UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); /* preview thumbnails */ if (template_ui.prv_rows > 0 && template_ui.prv_cols > 0) { @@ -348,7 +349,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) TemplateID *template_ui = (TemplateID *)arg_litem; PointerRNA idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop); ID *id = idptr.data; - int event = GET_INT_FROM_POINTER(arg_event); + int event = POINTER_AS_INT(arg_event); switch (event) { case UI_ID_BROWSE: @@ -534,7 +535,7 @@ static void template_ID( but = uiDefButR( block, UI_BTYPE_TEXT, 0, name, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y, &idptr, "name", -1, 0, 0, -1, -1, RNA_struct_ui_description(type)); - UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_RENAME)); + UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_RENAME)); if (user_alert) UI_but_flag_enable(but, UI_BUT_REDALERT); if (id->lib) { @@ -552,7 +553,7 @@ static void template_ID( UI_but_flag_enable(but, UI_BUT_DISABLED); } - UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_LOCAL)); + UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_LOCAL)); } if (id->us > 1) { @@ -567,7 +568,7 @@ static void template_ID( TIP_("Display number of users of this data (click to make a single-user copy)")); but->flag |= UI_BUT_UNDO; - UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ALONE)); + UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_ALONE)); if (/* test only */ (id_copy(CTX_data_main(C), id, NULL, true) == false) || (idfrom && idfrom->lib) || @@ -625,13 +626,13 @@ static void template_ID( but = uiDefIconTextButO( block, UI_BTYPE_BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(template_id_context(type), "New"), 0, 0, w, UI_UNIT_Y, NULL); - UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ADD_NEW)); + UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_ADD_NEW)); } else { but = uiDefIconTextBut( block, UI_BTYPE_BUT, 0, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(template_id_context(type), "New"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); - UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ADD_NEW)); + UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_ADD_NEW)); } if ((idfrom && idfrom->lib) || !editable) @@ -657,13 +658,13 @@ static void template_ID( but = uiDefIconTextButO( block, UI_BTYPE_BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y, NULL); - UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_OPEN)); + UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_OPEN)); } else { but = uiDefIconTextBut( block, UI_BTYPE_BUT, 0, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); - UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_OPEN)); + UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_OPEN)); } if ((idfrom && idfrom->lib) || !editable) @@ -687,7 +688,7 @@ static void template_ID( block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Unlink data-block " "(Shift + Click to set users to zero, data will then not be saved)")); - UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_DELETE)); + UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_DELETE)); if (RNA_property_flag(template_ui->prop) & PROP_NEVER_NULL) { UI_but_flag_enable(but, UI_BUT_DISABLED); @@ -1143,7 +1144,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr) /* find modifier and draw it */ cageIndex = modifiers_getCageIndex(scene, ob, &lastCageIndex, 0); - /* XXX virtual modifiers are not accesible for python */ + /* XXX virtual modifiers are not accessible for python */ vmd = modifiers_getVirtualModifierList(ob, &virtualModifierData); for (i = 0; vmd; i++, vmd = vmd->next) { @@ -1283,11 +1284,11 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) short prev_proxylock, show_upbut, show_downbut; /* Up/Down buttons: - * Proxy-constraints are not allowed to occur after local (non-proxy) constraints - * as that poses problems when restoring them, so disable the "up" button where - * it may cause this situation. + * Proxy-constraints are not allowed to occur after local (non-proxy) constraints + * as that poses problems when restoring them, so disable the "up" button where + * it may cause this situation. * - * Up/Down buttons should only be shown (or not grayed - todo) if they serve some purpose. + * Up/Down buttons should only be shown (or not grayed - todo) if they serve some purpose. */ if (BKE_constraints_proxylocked_owner(ob, pchan)) { if (con->prev) { @@ -1774,6 +1775,7 @@ static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *ar, void *arg_litem) block = UI_block_begin(C, ar, "_popup", UI_EMBOSS_PULLDOWN); UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_NO_FLIP); + UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); RNA_property_enum_items(C, &args.ptr, args.prop, &item, NULL, &free); @@ -2037,7 +2039,7 @@ static uiBlock *curvemap_clipping_func(bContext *C, ARegion *ar, void *cumap_v) block = UI_block_begin(C, ar, __func__, UI_EMBOSS); - /* use this for a fake extra empy space around the buttons */ + /* use this for a fake extra empty space around the buttons */ uiDefBut(block, UI_BTYPE_LABEL, 0, "", -4, 16, width + 8, 6 * UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); bt = uiDefButBitI( @@ -2596,7 +2598,7 @@ void uiTemplateCryptoPicker(uiLayout *layout, PointerRNA *ptr, const char *propn static void handle_layer_buttons(bContext *C, void *arg1, void *arg2) { uiBut *but = arg1; - int cur = GET_INT_FROM_POINTER(arg2); + int cur = POINTER_AS_INT(arg2); wmWindow *win = CTX_wm_window(C); int i, tot, shift = win->eventstate->shift; @@ -2680,7 +2682,7 @@ void uiTemplateLayers( icon = ICON_LAYER_USED; but = uiDefAutoButR(block, ptr, prop, layer, "", icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2); - UI_but_func_set(but, handle_layer_buttons, but, SET_INT_IN_POINTER(layer)); + UI_but_func_set(but, handle_layer_buttons, but, POINTER_FROM_INT(layer)); but->type = UI_BTYPE_TOGGLE; } } @@ -2751,7 +2753,7 @@ void uiTemplateGameStates( but = uiDefIconButR_prop( block, UI_BTYPE_ICON_TOGGLE, 0, icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2, ptr, prop, state, 0, 0, -1, -1, sca_state_name_get(ob, state)); - UI_but_func_set(but, handle_layer_buttons, but, SET_INT_IN_POINTER(state)); + UI_but_func_set(but, handle_layer_buttons, but, POINTER_FROM_INT(state)); but->type = UI_BTYPE_TOGGLE; } } @@ -3874,9 +3876,11 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C) UI_but_func_tooltip_set(but_progress, progress_tooltip_func, tip_arg); } - uiDefIconTextBut(block, UI_BTYPE_BUT, handle_event, ICON_PANEL_CLOSE, - "", 0, 0, UI_UNIT_X, UI_UNIT_Y, - NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop this job")); + if (!wm->is_interface_locked) { + uiDefIconTextBut(block, UI_BTYPE_BUT, handle_event, ICON_PANEL_CLOSE, + "", 0, 0, UI_UNIT_X, UI_UNIT_Y, + NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop this job")); + } } if (screen->animtimer) diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 2059fc1c849..2b9c6265eeb 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -120,7 +120,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind but = uiDefButR_prop(block, UI_BTYPE_TEXT, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); if (RNA_property_flag(prop) & PROP_TEXTEDIT_UPDATE) { - /* TEXTEDIT_UPDATE is usally used for search buttons. For these we also want + /* TEXTEDIT_UPDATE is usually used for search buttons. For these we also want * the 'x' icon to clear search string, so setting VALUE_CLEAR flag, too. */ UI_but_flag_enable(but, UI_BUT_TEXTEDIT_UPDATE | UI_BUT_VALUE_CLEAR); } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index a7de70629d1..a655dea9215 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -680,7 +680,9 @@ static void widgetbase_outline(uiWidgetBase *wtb) glDisableClientState(GL_VERTEX_ARRAY); } -static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) +static void widgetbase_draw_ex( + uiWidgetBase *wtb, uiWidgetColors *wcol, + const bool show_alpha_checkers) { int j, a; @@ -690,7 +692,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) if (wtb->draw_inner) { BLI_assert(wtb->totvert != 0); if (wcol->shaded == 0) { - if (wcol->alpha_check) { + if (show_alpha_checkers) { float inner_v_half[WIDGET_SIZE_MAX][2]; float x_mid = 0.0f; /* used for dumb clamping of values */ @@ -841,6 +843,11 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) glDisable(GL_BLEND); } +static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) +{ + widgetbase_draw_ex(wtb, wcol, false); +} + /* *********************** text/icon ************************************** */ #define UI_TEXT_CLIP_MARGIN (0.25f * U.widget_unit / but->block->aspect) @@ -1473,7 +1480,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b #endif /* cut string in 2 parts - only for menu entries */ - if ((but->block->flag & UI_BLOCK_LOOP) && + if ((but->block->theme_style == UI_BLOCK_THEME_STYLE_POPUP) && (but->editstr == NULL)) { if (but->flag & UI_BUT_HAS_SEP_CHAR) { @@ -3100,9 +3107,9 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat ui_block_cm_to_display_space_v3(but->block, col); rgba_float_to_uchar((unsigned char *)wcol->inner, col); + const bool show_alpha_checkers = (wcol->inner[3] < 255); wcol->shaded = 0; - wcol->alpha_check = (wcol->inner[3] < 255); if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE)) { /* Now we reduce alpha of the inner color (i.e. the color shown) @@ -3113,7 +3120,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat wcol->inner[3] /= 2; } - widgetbase_draw(&wtb, wcol); + widgetbase_draw_ex(&wtb, wcol, show_alpha_checkers); if (but->a1 == UI_PALETTE_COLOR && ((Palette *)but->rnapoin.id.data)->active_color == (int)but->a2) { float width = rect->xmax - rect->xmin; @@ -3749,7 +3756,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct wt->wcol_theme = &tui->wcol_box; wt->state = widget_state; } - else if (but->block->flag & UI_BLOCK_LOOP) { + else if (but->block->theme_style == UI_BLOCK_THEME_STYLE_POPUP) { wt->wcol_theme = &tui->wcol_menu_back; wt->state = widget_state; } @@ -3785,8 +3792,9 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct case UI_BTYPE_SEARCH_MENU: wt = widget_type(UI_WTYPE_NAME); - if (but->block->flag & UI_BLOCK_LOOP) + if (but->block->theme_style == UI_BLOCK_THEME_STYLE_POPUP) { wt->wcol_theme = &btheme->tui.wcol_menu_back; + } break; case UI_BTYPE_BUT_TOGGLE: @@ -3805,9 +3813,9 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct wt = widget_type(UI_WTYPE_TOGGLE); /* option buttons have strings outside, on menus use different colors */ - if (but->block->flag & UI_BLOCK_LOOP) + if (but->block->theme_style == UI_BLOCK_THEME_STYLE_POPUP) { wt->state = widget_state_option_menu; - + } break; case UI_BTYPE_MENU: diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 299001d4e45..c60371a0bbf 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -215,8 +215,8 @@ 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 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... + * that should be used new views as basis for their + * own unique View2D settings, which should be used instead of this in most cases... */ case V2D_COMMONVIEW_STANDARD: { @@ -226,9 +226,9 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) v2d->maxzoom = 1000.0f; /* tot rect and cur should be same size, and aligned using 'standard' OpenGL coordinates for now - * - region can resize 'tot' later to fit other data - * - keeptot is only within bounds, as strict locking is not that critical - * - view is aligned for (0,0) -> (winx-1, winy-1) setup + * - region can resize 'tot' later to fit other data + * - keeptot is only within bounds, as strict locking is not that critical + * - view is aligned for (0,0) -> (winx-1, winy-1) setup */ v2d->align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y); v2d->keeptot = V2D_KEEPTOT_BOUNDS; @@ -260,7 +260,7 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) break; } /* 'stack view' - practically the same as list/channel view, except is located in the pos y half instead. - * zoom, aspect ratio, and alignment restrictions are set here */ + * zoom, aspect ratio, and alignment restrictions are set here */ case V2D_COMMONVIEW_STACK: { /* zoom + aspect ratio are locked */ @@ -478,7 +478,7 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas float curRatio, winRatio; /* when a window edge changes, the aspect ratio can't be used to - * find which is the best new 'cur' rect. thats why it stores 'old' + * find which is the best new 'cur' rect. that's why it stores 'old' */ if (winx != v2d->oldwinx) do_x = true; if (winy != v2d->oldwiny) do_y = true; @@ -628,7 +628,7 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas } else if (cur->xmax > tot->xmax) { /* - only offset by difference of cur-xmax and tot-xmax if that would not move - * cur-xmin to lie past tot-xmin + * cur-xmin to lie past tot-xmin * - otherwise, simply shift to tot-xmin??? */ temp = cur->xmax - tot->xmax; @@ -672,7 +672,7 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas } else if (cur->xmax > tot->xmax) { /* - only offset by difference of cur-xmax and tot-xmax if that would not move - * cur-xmin to lie past tot-xmin + * cur-xmin to lie past tot-xmin * - otherwise, simply shift to tot-xmin??? */ temp = cur->xmax - tot->xmax; @@ -1189,7 +1189,7 @@ static void step_to_grid(float *step, int *power, int unit) /* for frames, we want 1.0 frame intervals only */ if (unit == V2D_UNIT_FRAMES) { rem = 1.0f; - *step = 2.0f; /* use 2 since there are grid lines drawn in between, this way to get 1 line per frane */ + *step = 2.0f; /* use 2 since there are grid lines drawn in between, this way to get 1 line per frame */ } /* prevents printing 1.0 2.0 3.0 etc */ diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 3cad2167cfa..b9ea5d96057 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -2098,7 +2098,7 @@ void ED_operatortypes_view2d(void) void ED_keymap_view2d(wmKeyConfig *keyconf) { - wmKeyMap *keymap = WM_keymap_find(keyconf, "View2D", 0, 0); + wmKeyMap *keymap = WM_keymap_ensure(keyconf, "View2D", 0, 0); wmKeyMapItem *kmi; /* scrollers */ @@ -2158,7 +2158,7 @@ void ED_keymap_view2d(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "VIEW2D_OT_zoom_border", BKEY, KM_PRESS, KM_SHIFT, 0); /* Alternative keymap for buttons listview */ - keymap = WM_keymap_find(keyconf, "View2D Buttons List", 0, 0); + keymap = WM_keymap_ensure(keyconf, "View2D Buttons List", 0, 0); WM_keymap_add_item(keymap, "VIEW2D_OT_scroller_activate", LEFTMOUSE, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "VIEW2D_OT_scroller_activate", MIDDLEMOUSE, KM_PRESS, 0, 0); diff --git a/source/blender/editors/lattice/lattice_ops.c b/source/blender/editors/lattice/lattice_ops.c index 4f2e87c11c1..561397d71ff 100644 --- a/source/blender/editors/lattice/lattice_ops.c +++ b/source/blender/editors/lattice/lattice_ops.c @@ -58,7 +58,7 @@ void ED_keymap_lattice(wmKeyConfig *keyconf) wmKeyMap *keymap; wmKeyMapItem *kmi; - keymap = WM_keymap_find(keyconf, "Lattice", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Lattice", 0, 0); keymap->poll = ED_operator_editlattice; kmi = WM_keymap_add_item(keymap, "LATTICE_OT_select_all", AKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c index 192ada40b5d..540101ba401 100644 --- a/source/blender/editors/mask/mask_edit.c +++ b/source/blender/editors/mask/mask_edit.c @@ -525,7 +525,7 @@ void ED_keymap_mask(wmKeyConfig *keyconf) wmKeyMap *keymap; wmKeyMapItem *kmi; - keymap = WM_keymap_find(keyconf, "Mask Editing", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Mask Editing", 0, 0); keymap->poll = ED_maskedit_poll; WM_keymap_add_item(keymap, "MASK_OT_new", NKEY, KM_PRESS, KM_ALT, 0); diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c index 771deca69b6..21f406c7657 100644 --- a/source/blender/editors/mask/mask_editaction.c +++ b/source/blender/editors/mask/mask_editaction.c @@ -51,9 +51,9 @@ /* ***************************************** */ /* NOTE ABOUT THIS FILE: - * This file contains code for editing Mask data in the Action Editor - * as a 'keyframes', so that a user can adjust the timing of Mask shapekeys. - * Therefore, this file mostly contains functions for selecting Mask frames (shapekeys). + * This file contains code for editing Mask data in the Action Editor + * as a 'keyframes', so that a user can adjust the timing of Mask shapekeys. + * Therefore, this file mostly contains functions for selecting Mask frames (shapekeys). */ /* ***************************************** */ /* Generics - Loopers */ diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c index 7ea89c56432..1e5e279ef35 100644 --- a/source/blender/editors/mesh/editmesh_extrude.c +++ b/source/blender/editors/mesh/editmesh_extrude.c @@ -161,15 +161,15 @@ static bool edbm_extrude_discrete_faces(BMEditMesh *em, wmOperator *op, const ch } /* extrudes individual edges */ -static bool edbm_extrude_edges_indiv(BMEditMesh *em, wmOperator *op, const char hflag) +static bool edbm_extrude_edges_indiv(BMEditMesh *em, wmOperator *op, const char hflag, const bool use_normal_flip) { BMesh *bm = em->bm; BMOperator bmop; EDBM_op_init( em, &bmop, op, - "extrude_edge_only edges=%he use_select_history=%b", - hflag, true); + "extrude_edge_only edges=%he use_normal_flip=%b use_select_history=%b", + hflag, use_normal_flip, true); /* deselect original verts */ BM_SELECT_HISTORY_BACKUP(bm); @@ -236,6 +236,7 @@ static char edbm_extrude_htype_from_em_select(BMEditMesh *em) static bool edbm_extrude_ex( Object *obedit, BMEditMesh *em, char htype, const char hflag, + const bool use_normal_flip, const bool use_mirror, const bool use_select_history) { @@ -250,6 +251,7 @@ static bool edbm_extrude_ex( } BMO_op_init(bm, &extop, BMO_FLAG_DEFAULTS, "extrude_face_region"); + BMO_slot_bool_set(extop.slots_in, "use_normal_flip", use_normal_flip); BMO_slot_bool_set(extop.slots_in, "use_select_history", use_select_history); BMO_slot_buffer_from_enabled_hflag(bm, &extop, extop.slots_in, "geom", htype, hflag); @@ -302,7 +304,7 @@ static int edbm_extrude_repeat_exec(bContext *C, wmOperator *op) mul_m3_v3(tmat, dvec); for (a = 0; a < steps; a++) { - edbm_extrude_ex(obedit, em, BM_ALL_NOLOOP, BM_ELEM_SELECT, false, false); + edbm_extrude_ex(obedit, em, BM_ALL_NOLOOP, BM_ELEM_SELECT, false, false, false); BMO_op_callf( em->bm, BMO_FLAG_DEFAULTS, @@ -345,9 +347,10 @@ void MESH_OT_extrude_repeat(wmOperatorType *ot) /* generic extern called extruder */ static bool edbm_extrude_mesh(Object *obedit, BMEditMesh *em, wmOperator *op) { - bool changed = false; + const bool use_normal_flip = RNA_boolean_get(op->ptr, "use_normal_flip"); const char htype = edbm_extrude_htype_from_em_select(em); enum {NONE = 0, ELEM_FLAG, VERT_ONLY, EDGE_ONLY} nr; + bool changed = false; if (em->selectmode & SCE_SELECT_VERTEX) { if (em->bm->totvertsel == 0) nr = NONE; @@ -369,13 +372,13 @@ static bool edbm_extrude_mesh(Object *obedit, BMEditMesh *em, wmOperator *op) case NONE: return false; case ELEM_FLAG: - changed = edbm_extrude_ex(obedit, em, htype, BM_ELEM_SELECT, true, true); + changed = edbm_extrude_ex(obedit, em, htype, BM_ELEM_SELECT, use_normal_flip, true, true); break; case VERT_ONLY: changed = edbm_extrude_verts_indiv(em, op, BM_ELEM_SELECT); break; case EDGE_ONLY: - changed = edbm_extrude_edges_indiv(em, op, BM_ELEM_SELECT); + changed = edbm_extrude_edges_indiv(em, op, BM_ELEM_SELECT, use_normal_flip); break; } @@ -421,6 +424,7 @@ void MESH_OT_extrude_region(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + RNA_def_boolean(ot->srna, "use_normal_flip", false, "Flip Normals", ""); Transform_Properties(ot, P_NO_DEFAULTS | P_MIRROR_DUMMY); } @@ -470,8 +474,9 @@ static int edbm_extrude_edges_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); + const bool use_normal_flip = RNA_boolean_get(op->ptr, "use_normal_flip"); - edbm_extrude_edges_indiv(em, op, BM_ELEM_SELECT); + edbm_extrude_edges_indiv(em, op, BM_ELEM_SELECT, use_normal_flip); EDBM_update_generic(em, true, true); @@ -493,6 +498,7 @@ void MESH_OT_extrude_edges_indiv(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* to give to transform */ + RNA_def_boolean(ot->srna, "use_normal_flip", false, "Flip Normals", ""); Transform_Properties(ot, P_NO_DEFAULTS | P_MIRROR_DUMMY); } @@ -664,7 +670,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w EDBM_project_snap_verts(C, vc.ar, vc.em); } - edbm_extrude_ex(vc.obedit, vc.em, extrude_htype, BM_ELEM_SELECT, true, true); + edbm_extrude_ex(vc.obedit, vc.em, extrude_htype, BM_ELEM_SELECT, false, true, true); EDBM_op_callf(vc.em, op, "rotate verts=%hv cent=%v matrix=%m3", BM_ELEM_SELECT, center, mat); EDBM_op_callf(vc.em, op, "translate verts=%hv vec=%v", diff --git a/source/blender/editors/mesh/editmesh_extrude_spin.c b/source/blender/editors/mesh/editmesh_extrude_spin.c index 5f1670bf57d..a9e78f74012 100644 --- a/source/blender/editors/mesh/editmesh_extrude_spin.c +++ b/source/blender/editors/mesh/editmesh_extrude_spin.c @@ -61,16 +61,18 @@ static int edbm_spin_exec(bContext *C, wmOperator *op) BMOperator spinop; float cent[3], axis[3]; float d[3] = {0.0f, 0.0f, 0.0f}; - int steps, dupli; - float angle; RNA_float_get_array(op->ptr, "center", cent); RNA_float_get_array(op->ptr, "axis", axis); - steps = RNA_int_get(op->ptr, "steps"); - angle = RNA_float_get(op->ptr, "angle"); - //if (ts->editbutflag & B_CLOCKWISE) - angle = -angle; - dupli = RNA_boolean_get(op->ptr, "dupli"); + const int steps = RNA_int_get(op->ptr, "steps"); + const float angle = RNA_float_get(op->ptr, "angle"); + const bool use_normal_flip = RNA_boolean_get(op->ptr, "use_normal_flip") ^ (angle < 0.0f); + const bool dupli = RNA_boolean_get(op->ptr, "dupli"); + const bool use_auto_merge = ( + RNA_boolean_get(op->ptr, "use_auto_merge") && + (dupli == false) && + (steps >= 3) && + fabsf((fabsf(angle) - (M_PI * 2))) <= 1e-6f); if (is_zero_v3(axis)) { BKE_report(op->reports, RPT_ERROR, "Invalid/unset axis"); @@ -78,15 +80,20 @@ static int edbm_spin_exec(bContext *C, wmOperator *op) } /* keep the values in worldspace since we're passing the obmat */ - if (!EDBM_op_init(em, &spinop, op, - "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f space=%m4 use_duplicate=%b", - BM_ELEM_SELECT, cent, axis, d, steps, angle, obedit->obmat, dupli)) + if (!EDBM_op_init( + em, &spinop, op, + "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f space=%m4 " + "use_normal_flip=%b use_duplicate=%b use_merge=%b", + BM_ELEM_SELECT, cent, axis, d, steps, -angle, obedit->obmat, + use_normal_flip, dupli, use_auto_merge)) { return OPERATOR_CANCELLED; } BMO_op_exec(bm, &spinop); - EDBM_flag_disable_all(em, BM_ELEM_SELECT); - BMO_slot_buffer_hflag_enable(bm, spinop.slots_out, "geom_last.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, true); + if (use_auto_merge == false) { + EDBM_flag_disable_all(em, BM_ELEM_SELECT); + BMO_slot_buffer_hflag_enable(bm, spinop.slots_out, "geom_last.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, true); + } if (!EDBM_op_finish(em, &spinop, op, true)) { return OPERATOR_CANCELLED; } @@ -118,6 +125,21 @@ static int edbm_spin_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e return edbm_spin_exec(C, op); } +static bool edbm_spin_poll_property(const bContext *UNUSED(C), wmOperator *op, const PropertyRNA *prop) +{ + const char *prop_id = RNA_property_identifier(prop); + const bool dupli = RNA_boolean_get(op->ptr, "dupli"); + + if (dupli) { + if (STREQ(prop_id, "use_auto_merge") || + STREQ(prop_id, "use_normal_flip")) + { + return false; + } + } + return true; +} + void MESH_OT_spin(wmOperatorType *ot) { PropertyRNA *prop; @@ -131,6 +153,7 @@ void MESH_OT_spin(wmOperatorType *ot) ot->invoke = edbm_spin_invoke; ot->exec = edbm_spin_exec; ot->poll = ED_operator_editmesh; + ot->poll_property = edbm_spin_poll_property; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -141,6 +164,8 @@ void MESH_OT_spin(wmOperatorType *ot) prop = RNA_def_float(ot->srna, "angle", DEG2RADF(90.0f), -1e12f, 1e12f, "Angle", "Rotation for each step", DEG2RADF(-360.0f), DEG2RADF(360.0f)); RNA_def_property_subtype(prop, PROP_ANGLE); + RNA_def_boolean(ot->srna, "use_auto_merge", true, "Auto Merge", "Merge first/last when the angle is a full revolution"); + RNA_def_boolean(ot->srna, "use_normal_flip", 0, "Flip Normals", ""); RNA_def_float_vector(ot->srna, "center", 3, NULL, -1e12f, 1e12f, "Center", "Center in global view space", -1e4f, 1e4f); diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 8eb3ad84919..9cc19d5194e 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -479,7 +479,7 @@ static KnifeEdge *get_bm_knife_edge(KnifeTool_OpData *kcd, BMEdge *e) /* Record the index in kcd->em->looptris of first looptri triple for a given face, * given an index for some triple in that array. * This assumes that all of the triangles for a given face are contiguous - * in that array (as they are by the current tesselation routines). + * in that array (as they are by the current tessellation routines). * Actually store index + 1 in the hash, because 0 looks like "no entry" * to hash lookup routine; will reverse this in the get routine. * Doing this lazily rather than all at once for all faces. @@ -502,7 +502,7 @@ static void set_lowest_face_tri(KnifeTool_OpData *kcd, BMFace *f, int index) if (i == -1) i++; - BLI_ghash_insert(kcd->facetrimap, f, SET_INT_IN_POINTER(i + 1)); + BLI_ghash_insert(kcd->facetrimap, f, POINTER_FROM_INT(i + 1)); } /* This should only be called for faces that have had a lowest face tri set by previous function */ @@ -510,7 +510,7 @@ static int get_lowest_face_tri(KnifeTool_OpData *kcd, BMFace *f) { int ans; - ans = GET_INT_FROM_POINTER(BLI_ghash_lookup(kcd->facetrimap, f)); + ans = POINTER_AS_INT(BLI_ghash_lookup(kcd->facetrimap, f)); BLI_assert(ans != 0); return ans - 1; } @@ -1217,7 +1217,7 @@ static bool knife_ray_intersect_face( lv2 = kcd->cagecos[BM_elem_index_get(tri[1]->v)]; lv3 = kcd->cagecos[BM_elem_index_get(tri[2]->v)]; /* using epsilon test in case ray is directly through an internal - * tesselation edge and might not hit either tesselation tri with + * tessellation edge and might not hit either tessellation tri with * an exact test; * we will exclude hits near real edges by a later test */ if (isect_ray_tri_epsilon_v3(v1, raydir, lv1, lv2, lv3, &lambda, ray_tri_uv, KNIFE_FLT_EPS)) { @@ -1542,8 +1542,8 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd) } /* unproject screen line */ - ED_view3d_win_to_segment(kcd->ar, kcd->vc.v3d, s1, v1, v3, true); - ED_view3d_win_to_segment(kcd->ar, kcd->vc.v3d, s2, v2, v4, true); + ED_view3d_win_to_segment_clipped(kcd->ar, kcd->vc.v3d, s1, v1, v3, true); + ED_view3d_win_to_segment_clipped(kcd->ar, kcd->vc.v3d, s2, v2, v4, true); mul_m4_v3(kcd->ob->imat, v1); mul_m4_v3(kcd->ob->imat, v2); @@ -1551,7 +1551,7 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd) mul_m4_v3(kcd->ob->imat, v4); /* numeric error, 'v1' -> 'v2', 'v2' -> 'v4' can end up being ~2000 units apart in otho mode - * (from ED_view3d_win_to_segment_clip() above) + * (from ED_view3d_win_to_segment_clipped() above) * this gives precision error; rather then solving properly * (which may involve using doubles everywhere!), * limit the distance between these points */ @@ -2194,7 +2194,7 @@ static int knife_update_active(KnifeTool_OpData *kcd) /* if no hits are found this would normally default to (0, 0, 0) so instead * get a point at the mouse ray closest to the previous point. * Note that drawing lines in `free-space` isn't properly supported - * but theres no guarantee (0, 0, 0) has any geometry either - campbell */ + * but there's no guarantee (0, 0, 0) has any geometry either - campbell */ if (kcd->curr.vert == NULL && kcd->curr.edge == NULL && kcd->curr.bmface == NULL) { float origin[3]; float origin_ofs[3]; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 313dd28e806..7b687f7f045 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2898,7 +2898,7 @@ static float bm_edge_seg_isect( b2 = ((x22 * y21) - (x21 * y22)) / xdiff2; } else { - m2 = MAXSLOPE; /* Verticle slope */ + m2 = MAXSLOPE; /* Vertical slope */ b2 = x22; } diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 7a344be8e5a..65b42571bbc 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -433,14 +433,14 @@ void EDBM_selectmode_flush(BMEditMesh *em) void EDBM_deselect_flush(BMEditMesh *em) { - /* function below doesnt use. just do this to keep the values in sync */ + /* function below doesn't use. just do this to keep the values in sync */ em->bm->selectmode = em->selectmode; BM_mesh_deselect_flush(em->bm); } void EDBM_select_flush(BMEditMesh *em) { - /* function below doesnt use. just do this to keep the values in sync */ + /* function below doesn't use. just do this to keep the values in sync */ em->bm->selectmode = em->selectmode; BM_mesh_select_flush(em->bm); } @@ -1499,7 +1499,7 @@ bool BMBVH_EdgeVisible(struct BMBVHTree *tree, BMEdge *e, ARegion *ar, View3D *v ar->winy / 2.0f, }; - ED_view3d_win_to_segment(ar, v3d, mval_f, origin, end, false); + ED_view3d_win_to_segment_clipped(ar, v3d, mval_f, origin, end, false); invert_m4_m4(invmat, obedit->obmat); mul_m4_v3(invmat, origin); diff --git a/source/blender/editors/mesh/mesh_mirror.c b/source/blender/editors/mesh/mesh_mirror.c index 20ece9c3336..1615ec75565 100644 --- a/source/blender/editors/mesh/mesh_mirror.c +++ b/source/blender/editors/mesh/mesh_mirror.c @@ -262,7 +262,7 @@ void ED_mesh_mirrtopo_init(Mesh *me, DerivedMesh *dm, const int ob_mode, MirrTop /* sort so we can count unique values */ qsort(topo_hash_prev, totvert, sizeof(MirrTopoHash_t), mirrtopo_hash_sort); - tot_unique = 1; /* account for skiping the first value */ + tot_unique = 1; /* account for skipping the first value */ for (a = 1; a < totvert; a++) { if (topo_hash_prev[a - 1] != topo_hash_prev[a]) { tot_unique++; diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 658bc5996a8..f3f7338716c 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -262,7 +262,7 @@ void ED_operatormacros_mesh(void) RNA_boolean_set(otmacro->ptr, "mirror", false); ot = WM_operatortype_append_macro("MESH_OT_extrude_region_shrink_fatten", "Extrude Region and Shrink/Fatten", - "Extrude region and move result", OPTYPE_UNDO | OPTYPE_REGISTER); + "Extrude along normals and move result", OPTYPE_UNDO | OPTYPE_REGISTER); otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_region"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten"); RNA_enum_set(otmacro->ptr, "proportional", 0); @@ -297,7 +297,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) wmKeyMapItem *kmi; int i; - keymap = WM_keymap_find(keyconf, "Mesh", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Mesh", 0, 0); keymap->poll = ED_operator_editmesh; WM_keymap_add_item(keymap, "MESH_OT_loopcut_slide", RKEY, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 8980e1830cf..3e9025baf40 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -349,9 +349,9 @@ int join_mesh_exec(bContext *C, wmOperator *op) } /* - if destination mesh had shapekeys, move them somewhere safe, and set up placeholders - * with arrays that are large enough to hold shapekey data for all meshes - * - if destination mesh didn't have shapekeys, but we encountered some in the meshes we're - * joining, set up a new keyblock and assign to the mesh + * with arrays that are large enough to hold shapekey data for all meshes + * - if destination mesh didn't have shapekeys, but we encountered some in the meshes we're + * joining, set up a new keyblock and assign to the mesh */ if (key) { /* make a duplicate copy that will only be used here... (must remember to free it!) */ diff --git a/source/blender/editors/metaball/mball_ops.c b/source/blender/editors/metaball/mball_ops.c index 3ea5f891f5f..b277584ab9e 100644 --- a/source/blender/editors/metaball/mball_ops.c +++ b/source/blender/editors/metaball/mball_ops.c @@ -72,7 +72,7 @@ void ED_keymap_metaball(wmKeyConfig *keyconf) wmKeyMap *keymap; wmKeyMapItem *kmi; - keymap = WM_keymap_find(keyconf, "Metaball", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Metaball", 0, 0); keymap->poll = ED_operator_editmball; WM_keymap_add_item(keymap, "OBJECT_OT_metaball_add", AKEY, KM_PRESS, KM_SHIFT, 0); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 214c995a26e..c343175c075 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -499,7 +499,7 @@ static int constraint_type_get(Object *owner, bPoseChannel *pchan) } /* checks validity of object pointers, and NULLs, - * if Bone doesnt exist it sets the CONSTRAINT_DISABLE flag. + * if Bone doesn't exist it sets the CONSTRAINT_DISABLE flag. */ static void test_constraints(Main *bmain, Object *owner, bPoseChannel *pchan) { @@ -787,10 +787,10 @@ static void child_get_inverse_matrix(Scene *scene, Object *ob, bConstraint *con, if (ob && ob->pose && (pchan = BKE_pose_channel_active(ob))) { bConstraint *con_last; /* calculate/set inverse matrix: - * We just calculate all transform-stack eval up to but not including this constraint. - * This is because inverse should just inverse correct for just the constraint's influence - * when it gets applied; that is, at the time of application, we don't know anything about - * what follows. + * We just calculate all transform-stack eval up to but not including this constraint. + * This is because inverse should just inverse correct for just the constraint's influence + * when it gets applied; that is, at the time of application, we don't know anything about + * what follows. */ float imat[4][4], tmat[4][4]; float pmat[4][4]; @@ -1760,7 +1760,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase return OPERATOR_CANCELLED; } - /* create a new constraint of the type requried, and add it to the active/given constraints list */ + /* create a new constraint of the type required, and add it to the active/given constraints list */ if (pchan) con = BKE_constraint_add_for_pose(ob, pchan, NULL, type); else @@ -1995,7 +1995,7 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED return OPERATOR_CANCELLED; } - /* prepare popup menu to choose targetting options */ + /* prepare popup menu to choose targeting options */ pup = UI_popup_menu_begin(C, IFACE_("Add IK"), ICON_NONE); layout = UI_popup_menu_layout(pup); @@ -2062,7 +2062,7 @@ static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op)) { bConstraint *con, *next; - /* TODO: should we be checking if these contraints were local before we try and remove them? */ + /* TODO: should we be checking if these constraints were local before we try and remove them? */ for (con = pchan->constraints.first; con; con = next) { next = con->next; if (con->type == CONSTRAINT_TYPE_KINEMATIC) { diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 407cddedbb0..f6db6d1f5fc 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -287,7 +287,7 @@ void ED_keymap_object(wmKeyConfig *keyconf) int i; /* Objects, Regardless of Mode -------------------------------------------------- */ - keymap = WM_keymap_find(keyconf, "Object Non-modal", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Object Non-modal", 0, 0); /* Note: this keymap works disregarding mode */ kmi = WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", TABKEY, KM_PRESS, 0, 0); @@ -310,7 +310,7 @@ void ED_keymap_object(wmKeyConfig *keyconf) /* Object Mode ---------------------------------------------------------------- */ /* Note: this keymap gets disabled in non-objectmode, */ - keymap = WM_keymap_find(keyconf, "Object Mode", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Object Mode", 0, 0); keymap->poll = object_mode_poll; /* object mode supports PET now */ diff --git a/source/blender/editors/object/object_random.c b/source/blender/editors/object/object_random.c index a293f7a950e..05726e5be2d 100644 --- a/source/blender/editors/object/object_random.c +++ b/source/blender/editors/object/object_random.c @@ -45,7 +45,7 @@ /** - * Generic randomize vertices function + * Generic randomize vertices function */ static bool object_rand_transverts( diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 6c5076ef563..e11782cd4b3 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -491,7 +491,7 @@ static void mesh_defvert_mirror_update_internal( const int def_nr) { if (def_nr == -1) { - /* all vgroups, add groups where neded */ + /* all vgroups, add groups where needed */ int flip_map_len; int *flip_map = defgroup_flip_map(ob, &flip_map_len, true); defvert_sync_mapped(dvert_dst, dvert_src, flip_map, flip_map_len, true); diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index 480d17bbf85..dc94cab0733 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -316,7 +316,7 @@ static void dpaint_bake_endjob(void *customdata) WM_set_locked_interface(G_MAIN->wm.first, false); /* Bake was successful: - * Report for ended bake and how long it took */ + * Report for ended bake and how long it took */ if (job->success) { /* Show bake info */ WM_reportf(RPT_INFO, "DynamicPaint: Bake complete! (%.2f)", PIL_check_seconds_timer() - job->start); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index a03892a26d1..181c42a4072 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3212,7 +3212,7 @@ static void brush_puff(PEData *data, int point_index) #else /* translate (not rotate) the rest of the hair if its not selected */ { -#if 0 /* kindof works but looks worse then whats below */ +#if 0 /* kindof works but looks worse then what's below */ /* Move the unselected point on a vector based on the * hair direction and the offset */ @@ -3522,7 +3522,7 @@ static int brush_add(PEData *data, short number) mco[0] = data->mval[0] + dmx; mco[1] = data->mval[1] + dmy; - ED_view3d_win_to_segment(data->vc.ar, data->vc.v3d, mco, co1, co2, true); + ED_view3d_win_to_segment_clipped(data->vc.ar, data->vc.v3d, mco, co1, co2, true); mul_m4_v3(imat, co1); mul_m4_v3(imat, co2); diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 1cd2528b3ca..f960d6ed97b 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -42,6 +42,7 @@ #include "DNA_object_fluidsim_types.h" #include "BLI_blenlib.h" +#include "BLI_path_util.h" #include "BLI_math.h" #include "BLI_utildefines.h" @@ -868,8 +869,8 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor fb= MEM_callocN(sizeof(FluidBakeJob), "fluid bake job"); - if (getenv(strEnvName)) { - int dlevel = atoi(getenv(strEnvName)); + if (BLI_getenv(strEnvName)) { + int dlevel = atoi(BLI_getenv(strEnvName)); elbeemSetDebugLevel(dlevel); BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer), "fluidsimBake::msg: Debug messages activated due to envvar '%s'\n", strEnvName); elbeemDebugOut(debugStrBuffer); diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c index de2ee73ab26..910e461435c 100644 --- a/source/blender/editors/physics/physics_ops.c +++ b/source/blender/editors/physics/physics_ops.c @@ -112,7 +112,7 @@ static void keymap_particle(wmKeyConfig *keyconf) wmKeyMapItem *kmi; wmKeyMap *keymap; - keymap = WM_keymap_find(keyconf, "Particle", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Particle", 0, 0); keymap->poll = PE_poll; kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_select_all", AKEY, KM_PRESS, 0, 0); @@ -221,7 +221,7 @@ static void operatortypes_dynamicpaint(void) //static void keymap_pointcache(wmWindowManager *wm) //{ -// wmKeyMap *keymap = WM_keymap_find(wm, "Pointcache", 0, 0); +// wmKeyMap *keymap = WM_keymap_ensure(wm, "Pointcache", 0, 0); // // WM_keymap_add_item(keymap, "PHYSICS_OT_bake_all", AKEY, KM_PRESS, 0, 0); // WM_keymap_add_item(keymap, "PHYSICS_OT_free_all", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 59538df7a05..d94776d126f 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -759,7 +759,7 @@ static int render_break(void *UNUSED(rjv)) } /* runs in thread, no cursor setting here works. careful with notifiers too (malloc conflicts) */ -/* maybe need a way to get job send notifer? */ +/* maybe need a way to get job send notifier? */ static void render_drawlock(void *rjv, int lock) { RenderJob *rj = rjv; diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 6e4cbf27e28..3ca989c92fe 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -633,7 +633,7 @@ void ED_area_headerprint(ScrArea *sa, const char *str) { ARegion *ar; - /* happens when running transform operators in backround mode */ + /* happens when running transform operators in background mode */ if (sa == NULL) return; @@ -660,7 +660,7 @@ static void area_azone_initialize(wmWindow *win, bScreen *screen, ScrArea *sa) { AZone *az; - /* reinitalize entirely, regions and fullscreen add azones too */ + /* reinitialize entirely, regions and fullscreen add azones too */ BLI_freelistN(&sa->actionzones); if (screen->state != SCREENNORMAL) { @@ -1375,7 +1375,7 @@ static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ListBase *hand /* XXX it would be good to have boundbox checks for some of these... */ if (flag & ED_KEYMAP_UI) { - wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "User Interface", 0, 0); + wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "User Interface", 0, 0); WM_event_add_keymap_handler(handlers, keymap); /* user interface widgets */ @@ -1383,12 +1383,12 @@ static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ListBase *hand } if (flag & ED_KEYMAP_VIEW2D) { /* 2d-viewport handling+manipulation */ - wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "View2D", 0, 0); + wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "View2D", 0, 0); WM_event_add_keymap_handler(handlers, keymap); } if (flag & ED_KEYMAP_MARKERS) { /* time-markers */ - wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Markers", 0, 0); + wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "Markers", 0, 0); /* time space only has this keymap, the others get a boundbox restricted map */ if (sa->spacetype != SPACE_TIME) { @@ -1406,12 +1406,12 @@ static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ListBase *hand } if (flag & ED_KEYMAP_ANIMATION) { /* frame changing and timeline operators (for time spaces) */ - wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Animation", 0, 0); + wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "Animation", 0, 0); WM_event_add_keymap_handler(handlers, keymap); } if (flag & ED_KEYMAP_FRAMES) { /* frame changing/jumping (for all spaces) */ - wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Frames", 0, 0); + wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "Frames", 0, 0); WM_event_add_keymap_handler(handlers, keymap); } if (flag & ED_KEYMAP_GPENCIL) { @@ -1423,15 +1423,15 @@ static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ListBase *hand * For now, it's easier to just include both, * since you hardly want one without the other. */ - wmKeyMap *keymap_general = WM_keymap_find(wm->defaultconf, "Grease Pencil", 0, 0); - wmKeyMap *keymap_edit = WM_keymap_find(wm->defaultconf, "Grease Pencil Stroke Edit Mode", 0, 0); + wmKeyMap *keymap_general = WM_keymap_ensure(wm->defaultconf, "Grease Pencil", 0, 0); + wmKeyMap *keymap_edit = WM_keymap_ensure(wm->defaultconf, "Grease Pencil Stroke Edit Mode", 0, 0); WM_event_add_keymap_handler(handlers, keymap_general); WM_event_add_keymap_handler(handlers, keymap_edit); } if (flag & ED_KEYMAP_HEADER) { /* standard keymap for headers regions */ - wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Header", 0, 0); + wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "Header", 0, 0); WM_event_add_keymap_handler(handlers, keymap); } } @@ -2024,7 +2024,7 @@ void ED_region_panels_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_PANELS_UI, ar->winx, ar->winy); - keymap = WM_keymap_find(wm->defaultconf, "View2D Buttons List", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "View2D Buttons List", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index e4d748afecf..2e8c5204b3d 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -572,7 +572,7 @@ int area_getorientation(ScrArea *sa, ScrArea *sb) } /* Helper function to join 2 areas, it has a return value, 0=failed 1=success - * used by the split, join operators + * used by the split, join operators */ int screen_area_join(bContext *C, bScreen *scr, ScrArea *sa1, ScrArea *sa2) { diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 44467b6a994..4f9cd7a42b6 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -4259,7 +4259,7 @@ static void SCENE_OT_delete(wmOperatorType *ot) /* implementation note: a disappearing region needs at least 1 last draw with 100% backbuffer * texture over it- then triple buffer will clear it entirely. - * This because flag RGN_HIDDEN is set in end - region doesnt draw at all then */ + * This because flag RGN_HIDDEN is set in end - region doesn't draw at all then */ typedef struct RegionAlphaInfo { ScrArea *sa; @@ -4604,7 +4604,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf) wmKeyMapItem *kmi; /* Screen Editing ------------------------------------------------ */ - keymap = WM_keymap_find(keyconf, "Screen Editing", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Screen Editing", 0, 0); RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_actionzone", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "modifier", 0); RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_actionzone", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "modifier", 1); @@ -4627,12 +4627,12 @@ void ED_keymap_screen(wmKeyConfig *keyconf) /* Header Editing ------------------------------------------------ */ /* note: this is only used when the cursor is inside the header */ - keymap = WM_keymap_find(keyconf, "Header", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Header", 0, 0); WM_keymap_add_item(keymap, "SCREEN_OT_header_toolbox", RIGHTMOUSE, KM_PRESS, 0, 0); /* Screen General ------------------------------------------------ */ - keymap = WM_keymap_find(keyconf, "Screen", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Screen", 0, 0); /* standard timers */ WM_keymap_add_item(keymap, "SCREEN_OT_animation_step", TIMER0, KM_ANY, KM_ANY, 0); @@ -4696,7 +4696,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf) /* Anim Playback ------------------------------------------------ */ - keymap = WM_keymap_find(keyconf, "Frames", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Frames", 0, 0); /* frame offsets */ RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", UPARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "delta", 10); @@ -4735,7 +4735,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf) /* Alternative keys for animation and sequencer playing */ #if 0 /* XXX: disabled for restoring later... bad implementation */ - keymap = WM_keymap_find(keyconf, "Frames", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Frames", 0, 0); kmi = WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0); RNA_boolean_set(kmi->ptr, "cycle_speed", true); diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 76190b13b61..ddfee5de4d7 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -700,7 +700,7 @@ static void brush_painter_2d_refresh_cache(ImagePaintState *s, BrushPainter *pai do_partial_update_mask = true; renew_maxmask = true; } - /* explicilty disable partial update even if it has been enabled above */ + /* explicitly disable partial update even if it has been enabled above */ if (brush->mask_pressure) { do_partial_update_mask = false; renew_maxmask = true; diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 6b13decd41b..81a44317735 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -183,7 +183,7 @@ BLI_INLINE unsigned char f_to_char(const float val) #define PROJ_VERT_CULL 1 /* to avoid locking in tile initialization */ -#define TILE_PENDING SET_INT_IN_POINTER(-1) +#define TILE_PENDING POINTER_FROM_INT(-1) /* This is mainly a convenience struct used so we can keep an array of images we use - * their imbufs, etc, in 1 array, When using threads this array is copied for each thread @@ -566,7 +566,7 @@ static float VecZDepthPersp( } else /* dummy values for zero area face */ w_tmp[0] = w_tmp[1] = w_tmp[2] = 1.0f / 3.0f; - /* done mimicing barycentric_weights_v2() */ + /* done mimicking barycentric_weights_v2() */ return (v1[2] * w_tmp[0]) + (v2[2] * w_tmp[1]) + (v3[2] * w_tmp[2]); } @@ -593,7 +593,7 @@ static int project_paint_PickFace( * that the point its testing is only every originated from an existing face */ for (node = ps->bucketFaces[bucket_index]; node; node = node->next) { - const int tri_index = GET_INT_FROM_POINTER(node->link); + const int tri_index = POINTER_AS_INT(node->link); const MLoopTri *lt = &ps->dm_mlooptri[tri_index]; const float *vtri_ss[3] = { ps->screenCoords[ps->dm_mloop[lt->tri[0]].v], @@ -807,7 +807,7 @@ static bool project_bucket_point_occluded( * that the point its testing is only every originated from an existing face */ for (; bucketFace; bucketFace = bucketFace->next) { - const int tri_index = GET_INT_FROM_POINTER(bucketFace->link); + const int tri_index = POINTER_AS_INT(bucketFace->link); if (orig_face != tri_index) { const MLoopTri *lt = &ps->dm_mlooptri[tri_index]; @@ -1028,7 +1028,7 @@ static bool check_seam( int i1_fidx = -1, i2_fidx = -1; /* index in face */ for (node = ps->vertFaces[i1]; node; node = node->next) { - const int tri_index = GET_INT_FROM_POINTER(node->link); + const int tri_index = POINTER_AS_INT(node->link); if (tri_index != orig_face) { const MLoopTri *lt = &ps->dm_mlooptri[tri_index]; @@ -1690,7 +1690,7 @@ static ProjPixel *project_paint_uvpixel_init( if (ibuf->rect_float) projPixel->pixel.f_pt[0] = 0; else projPixel->pixel.ch_pt[0] = 0; #endif - /* pointer arithmetics */ + /* pointer arithmetic */ projPixel->image_index = projima - ps->projImages; return projPixel; @@ -2582,7 +2582,7 @@ static void project_paint_face_init( v2coSS = ps->screenCoords[lt_vtri[1]]; v3coSS = ps->screenCoords[lt_vtri[2]]; - /* This funtion gives is a concave polyline in UV space from the clipped tri*/ + /* This function gives is a concave polyline in UV space from the clipped tri*/ project_bucket_clip_face( is_ortho, is_flip_object, clip_rect, bucket_bounds, @@ -2627,7 +2627,7 @@ static void project_paint_face_init( //uv[0] = (((float)x) + 0.5f) / ibuf->x; uv[0] = (float)x / ibuf_xf; /* use pixel offset UV coords instead */ - /* Note about IsectPoly2Df_twoside, checking the face or uv flipping doesnt work, + /* Note about IsectPoly2Df_twoside, checking the face or uv flipping doesn't work, * could check the poly direction but better to do this */ if ((do_backfacecull == true && IsectPoly2Df(uv, uv_clip, uv_clip_tot)) || (do_backfacecull == false && IsectPoly2Df_twoside(uv, uv_clip, uv_clip_tot))) @@ -2720,7 +2720,7 @@ static void project_paint_face_init( /* Now create new UV's for the seam face */ float (*outset_uv)[2] = ps->faceSeamUVs[tri_index]; - float insetCos[3][3]; /* inset face coords. NOTE!!! ScreenSace for ortho, Worldspace in prespective view */ + float insetCos[3][3]; /* inset face coords. NOTE!!! ScreenSace for ortho, Worldspace in perspective view */ const float *vCoSS[3]; /* vertex screenspace coords */ @@ -2937,7 +2937,7 @@ static void project_bucket_init( for (node = ps->bucketFaces[bucket_index]; node; node = node->next) { project_paint_face_init( - ps, thread_index, bucket_index, GET_INT_FROM_POINTER(node->link), 0, + ps, thread_index, bucket_index, POINTER_AS_INT(node->link), 0, clip_rect, bucket_bounds, ibuf, &tmpibuf, (ima->tpageflag & IMA_CLAMP_U) != 0, (ima->tpageflag & IMA_CLAMP_V) != 0); } @@ -2946,7 +2946,7 @@ static void project_bucket_init( /* More complicated loop, switch between images */ for (node = ps->bucketFaces[bucket_index]; node; node = node->next) { - tri_index = GET_INT_FROM_POINTER(node->link); + tri_index = POINTER_AS_INT(node->link); /* Image context switching */ tpage = project_paint_face_paint_image(ps, tri_index); @@ -3057,7 +3057,7 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MLoopTri * int bucket_index = bucket_x + (bucket_y * ps->buckets_x); BLI_linklist_prepend_arena( &ps->bucketFaces[bucket_index], - SET_INT_IN_POINTER(tri_index), /* cast to a pointer to shut up the compiler */ + POINTER_FROM_INT(tri_index), /* cast to a pointer to shut up the compiler */ arena ); @@ -3415,7 +3415,7 @@ static void project_paint_bleed_add_face_user( /* annoying but we need to add all faces even ones we never use elsewhere */ if (ps->seam_bleed_px > 0.0f) { const int lt_vtri[3] = { PS_LOOPTRI_AS_VERT_INDEX_3(ps, lt) }; - void *tri_index_p = SET_INT_IN_POINTER(tri_index); + void *tri_index_p = POINTER_FROM_INT(tri_index); BLI_linklist_prepend_arena(&ps->vertFaces[lt_vtri[0]], tri_index_p, arena); BLI_linklist_prepend_arena(&ps->vertFaces[lt_vtri[1]], tri_index_p, arena); BLI_linklist_prepend_arena(&ps->vertFaces[lt_vtri[2]], tri_index_p, arena); diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index b42a825ad7c..74984d090f8 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -1255,13 +1255,13 @@ void ED_keymap_paint(wmKeyConfig *keyconf) wmKeyMapItem *kmi; int i; - keymap = WM_keymap_find(keyconf, "Paint Curve", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Paint Curve", 0, 0); keymap->poll = paint_curve_poll; paint_keymap_curve(keymap); /* Sculpt mode */ - keymap = WM_keymap_find(keyconf, "Sculpt", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Sculpt", 0, 0); keymap->poll = sculpt_mode_poll; RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "mode", BRUSH_STROKE_NORMAL); @@ -1337,7 +1337,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) WM_keymap_add_menu(keymap, "VIEW3D_MT_angle_control", RKEY, KM_PRESS, 0, 0); /* Vertex Paint mode */ - keymap = WM_keymap_find(keyconf, "Vertex Paint", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Vertex Paint", 0, 0); keymap->poll = vertex_paint_mode_poll; WM_keymap_verify_item(keymap, "PAINT_OT_vertex_paint", LEFTMOUSE, KM_PRESS, 0, 0); @@ -1364,7 +1364,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) RNA_string_set(kmi->ptr, "data_path", "tool_settings.vertex_paint.brush.stroke_method"); /* Weight Paint mode */ - keymap = WM_keymap_find(keyconf, "Weight Paint", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Weight Paint", 0, 0); keymap->poll = weight_paint_mode_poll; WM_keymap_verify_item(keymap, "PAINT_OT_weight_paint", LEFTMOUSE, KM_PRESS, 0, 0); @@ -1396,7 +1396,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) RNA_string_set(kmi->ptr, "data_path", "tool_settings.weight_paint.brush.use_smooth_stroke"); /*Weight paint's Vertex Selection Mode */ - keymap = WM_keymap_find(keyconf, "Weight Paint Vertex Selection", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Weight Paint Vertex Selection", 0, 0); keymap->poll = vert_paint_poll; kmi = WM_keymap_add_item(keymap, "PAINT_OT_vert_select_all", AKEY, KM_PRESS, 0, 0); RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE); @@ -1410,7 +1410,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "VIEW3D_OT_select_circle", CKEY, KM_PRESS, 0, 0); /* Image/Texture Paint mode */ - keymap = WM_keymap_find(keyconf, "Image Paint", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Image Paint", 0, 0); keymap->poll = image_texture_paint_poll; RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_image_paint", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "mode", BRUSH_STROKE_NORMAL); @@ -1439,7 +1439,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) RNA_string_set(kmi->ptr, "data_path", "tool_settings.image_paint.brush.stroke_method"); /* face-mask mode */ - keymap = WM_keymap_find(keyconf, "Face Mask", 0, 0); + keymap = WM_keymap_ensure(keyconf, "Face Mask", 0, 0); keymap->poll = facemask_paint_poll; kmi = WM_keymap_add_item(keymap, "PAINT_OT_face_select_all", AKEY, KM_PRESS, 0, 0); @@ -1458,7 +1458,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) kmi = WM_keymap_add_item(keymap, "PAINT_OT_face_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "deselect", true); - keymap = WM_keymap_find(keyconf, "UV Sculpt", 0, 0); + keymap = WM_keymap_ensure(keyconf, "UV Sculpt", 0, 0); keymap->poll = uv_sculpt_keymap_poll; kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", QKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 0fa5df4ad33..a98a246363a 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1351,7 +1351,7 @@ static void vwpaint_update_cache_variants(bContext *C, VPaint *vp, Object *ob, P Brush *brush = BKE_paint_brush(&vp->paint); /* This effects the actual brush radius, so things farther away - * are compared with a larger radius and vise versa. */ + * are compared with a larger radius and vice versa. */ if (cache->first_time) { RNA_float_get_array(ptr, "location", cache->true_location); } @@ -1600,7 +1600,8 @@ static void do_wpaint_brush_blur_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh); + const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh); + const bool has_grids = (pbvh_type == PBVH_GRIDS); const struct SculptVertexPaintGeomMap *gmap = &ss->mode.wpaint.gmap; const Brush *brush = data->brush; @@ -1627,8 +1628,8 @@ static void do_wpaint_brush_blur_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { /* For grid based pbvh, take the vert whose loop coopresponds to the current grid. * Otherwise, take the current vert. */ - const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; - const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f; + const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; + const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f; const char v_flag = data->me->mvert[v_index].flag; /* If the vertex is selected */ if (!(use_face_sel || use_vert_sel) || v_flag & SELECT) { @@ -1672,7 +1673,7 @@ static void do_wpaint_brush_blur_task_cb_ex( } weight_final /= total_hit_loops; - /* Only paint visable verts */ + /* Only paint visible verts */ do_weight_paint_vertex( data->vp, data->ob, data->wpi, v_index, final_alpha, weight_final); @@ -1691,7 +1692,8 @@ static void do_wpaint_brush_smear_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh); + const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh); + const bool has_grids = (pbvh_type == PBVH_GRIDS); const struct SculptVertexPaintGeomMap *gmap = &ss->mode.wpaint.gmap; const Brush *brush = data->brush; @@ -1723,8 +1725,8 @@ static void do_wpaint_brush_smear_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { /* For grid based pbvh, take the vert whose loop cooresponds to the current grid. * Otherwise, take the current vert. */ - const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; - const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f; + const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; + const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f; const MVert *mv_curr = &data->me->mvert[v_index]; /* If the vertex is selected */ @@ -1800,7 +1802,8 @@ static void do_wpaint_brush_draw_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh); + const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh); + const bool has_grids = (pbvh_type == PBVH_GRIDS); const Scene *scene = CTX_data_scene(data->C); const Brush *brush = data->brush; @@ -1829,8 +1832,8 @@ static void do_wpaint_brush_draw_task_cb_ex( /* Note: grids are 1:1 with corners (aka loops). * For multires, take the vert whose loop cooresponds to the current grid. * Otherwise, take the current vert. */ - const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; - const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f; + const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; + const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f; const char v_flag = data->me->mvert[v_index].flag; /* If the vertex is selected */ @@ -1873,7 +1876,8 @@ static void do_wpaint_brush_calc_average_weight_cb_ex( SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; StrokeCache *cache = ss->cache; - CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh); + const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh); + const bool has_grids = (pbvh_type == PBVH_GRIDS); const bool use_normal = vwpaint_use_normal(data->vp); const bool use_face_sel = (data->me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0; @@ -1898,8 +1902,8 @@ static void do_wpaint_brush_calc_average_weight_cb_ex( const float angle_cos = (use_normal && vd.no) ? dot_vf3vs3(sculpt_normal_frontface, vd.no) : 1.0f; if (angle_cos > 0.0 && BKE_brush_curve_strength(data->brush, sqrtf(test.dist), cache->radius) > 0.0) { - const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; - // const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f; + const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; + // const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f; const char v_flag = data->me->mvert[v_index].flag; /* If the vertex is selected. */ @@ -2390,7 +2394,7 @@ void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot) * (return OPERATOR_FINISHED also removes handler and operator) * * For future: - * - implement a stroke event (or mousemove with past positons) + * - implement a stroke event (or mousemove with past positions) * - revise whether op->customdata should be added in object, in set_vpaint */ @@ -2506,7 +2510,8 @@ static void do_vpaint_brush_calc_average_color_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh); + const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh); + const bool has_grids = (pbvh_type == PBVH_GRIDS); const struct SculptVertexPaintGeomMap *gmap = &ss->mode.vpaint.gmap; StrokeCache *cache = ss->cache; @@ -2528,7 +2533,7 @@ static void do_vpaint_brush_calc_average_color_cb_ex( { /* Test to see if the vertex coordinates are within the spherical brush region. */ if (sculpt_brush_test_sq_fn(&test, vd.co)) { - const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; + const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; if (BKE_brush_curve_strength(data->brush, 0.0, cache->radius) > 0.0) { /* If the vertex is selected for painting. */ const MVert *mv = &data->me->mvert[v_index]; @@ -2570,7 +2575,8 @@ static void do_vpaint_brush_draw_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh); + const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh); + const bool has_grids = (pbvh_type == PBVH_GRIDS); const struct SculptVertexPaintGeomMap *gmap = &ss->mode.vpaint.gmap; const Brush *brush = data->brush; @@ -2598,8 +2604,8 @@ static void do_vpaint_brush_draw_task_cb_ex( /* Note: Grids are 1:1 with corners (aka loops). * For grid based pbvh, take the vert whose loop cooresponds to the current grid. * Otherwise, take the current vert. */ - const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; - const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f; + const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; + const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f; const MVert *mv = &data->me->mvert[v_index]; /* If the vertex is selected for painting. */ @@ -2664,7 +2670,8 @@ static void do_vpaint_brush_blur_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh); + const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh); + const bool has_grids = (pbvh_type == PBVH_GRIDS); Scene *scene = CTX_data_scene(data->C); const struct SculptVertexPaintGeomMap *gmap = &ss->mode.vpaint.gmap; @@ -2691,8 +2698,8 @@ static void do_vpaint_brush_blur_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { /* For grid based pbvh, take the vert whose loop cooresponds to the current grid. * Otherwise, take the current vert. */ - const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; - const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f; + const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; + const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f; const MVert *mv = &data->me->mvert[v_index]; /* If the vertex is selected for painting. */ @@ -2775,7 +2782,8 @@ static void do_vpaint_brush_smear_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh); + const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh); + const bool has_grids = (pbvh_type == PBVH_GRIDS); Scene *scene = CTX_data_scene(data->C); const struct SculptVertexPaintGeomMap *gmap = &ss->mode.vpaint.gmap; @@ -2808,8 +2816,8 @@ static void do_vpaint_brush_smear_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { /* For grid based pbvh, take the vert whose loop cooresponds to the current grid. * Otherwise, take the current vert. */ - const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; - const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f; + const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; + const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f; const MVert *mv_curr = &data->me->mvert[v_index]; /* if the vertex is selected for painting. */ diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c index 1a37973cd7d..21965bb30d8 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c @@ -238,7 +238,7 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *even } if (changed) { - /* not really correct since the brush didnt change, but redraws the toolbar */ + /* not really correct since the brush didn't change, but redraws the toolbar */ WM_main_add_notifier(NC_BRUSH | NA_EDITED, NULL); /* ts->wpaint->paint.brush */ return OPERATOR_FINISHED; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 74baa267b69..3895b8ed44b 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4688,7 +4688,7 @@ static float sculpt_raycast_init( RegionView3D *rv3d = vc->ar->regiondata; /* TODO: what if the segment is totally clipped? (return == 0) */ - ED_view3d_win_to_segment(vc->ar, vc->v3d, mouse, ray_start, ray_end, true); + ED_view3d_win_to_segment_clipped(vc->ar, vc->v3d, mouse, ray_start, ray_end, true); invert_m4_m4(obimat, ob->obmat); mul_m4_v3(obimat, ray_start); diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index bf5ddeb71ff..62e548f661c 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -589,10 +589,9 @@ static void sculpt_undo_restore_list(bContext *C, ListBase *lb) static void sculpt_undo_free_list(ListBase *lb) { - SculptUndoNode *unode; - int i; - - for (unode = lb->first; unode; unode = unode->next) { + SculptUndoNode *unode = lb->first; + while (unode != NULL) { + SculptUndoNode *unode_next = unode->next; if (unode->co) MEM_freeN(unode->co); if (unode->no) @@ -606,7 +605,7 @@ static void sculpt_undo_free_list(ListBase *lb) if (unode->vert_hidden) MEM_freeN(unode->vert_hidden); if (unode->grid_hidden) { - for (i = 0; i < unode->totgrid; i++) { + for (int i = 0; i < unode->totgrid; i++) { if (unode->grid_hidden[i]) MEM_freeN(unode->grid_hidden[i]); } @@ -627,6 +626,10 @@ static void sculpt_undo_free_list(ListBase *lb) CustomData_free(&unode->bm_enter_ldata, unode->bm_enter_totloop); if (unode->bm_enter_totpoly) CustomData_free(&unode->bm_enter_pdata, unode->bm_enter_totpoly); + + MEM_freeN(unode); + + unode = unode_next; } } diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c index 32407286258..ea7591c36c0 100644 --- a/source/blender/editors/space_action/action_ops.c +++ b/source/blender/editors/space_action/action_ops.c @@ -275,7 +275,7 @@ void action_keymap(wmKeyConfig *keyconf) wmKeyMap *keymap; /* keymap for all regions */ - keymap = WM_keymap_find(keyconf, "Dopesheet Generic", SPACE_ACTION, 0); + keymap = WM_keymap_ensure(keyconf, "Dopesheet Generic", SPACE_ACTION, 0); /* region management... */ WM_keymap_add_item(keymap, "ACTION_OT_properties", NKEY, KM_PRESS, 0, 0); @@ -288,6 +288,6 @@ void action_keymap(wmKeyConfig *keyconf) */ /* keyframes */ - keymap = WM_keymap_find(keyconf, "Dopesheet", SPACE_ACTION, 0); + keymap = WM_keymap_ensure(keyconf, "Dopesheet", SPACE_ACTION, 0); action_keymap_keyframes(keyconf, keymap); } diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 83bda4d63a5..ee2fbbfbb30 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -1367,7 +1367,7 @@ static void mouse_action_keys(bAnimContext *ac, const int mval[2], short select_ * on either side of mouse click (size of keyframe icon) */ key_hsize = ACHANNEL_HEIGHT(ac) * 0.8f; /* standard channel height (to allow for some slop) */ - key_hsize = roundf(key_hsize / 2.0f); /* half-size (for either side), but rounded up to nearest int (for easier targetting) */ + key_hsize = roundf(key_hsize / 2.0f); /* half-size (for either side), but rounded up to nearest int (for easier targeting) */ UI_view2d_region_to_view(v2d, mval[0] - (int)key_hsize, mval[1], &rectf.xmin, &rectf.ymin); UI_view2d_region_to_view(v2d, mval[0] + (int)key_hsize, mval[1], &rectf.xmax, &rectf.ymax); diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 9082abc0575..a2fe129c819 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -192,9 +192,9 @@ static void action_main_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); /* own keymap */ - keymap = WM_keymap_find(wm->defaultconf, "Dopesheet", SPACE_ACTION, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Dopesheet", SPACE_ACTION, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); - keymap = WM_keymap_find(wm->defaultconf, "Dopesheet Generic", SPACE_ACTION, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Dopesheet Generic", SPACE_ACTION, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } @@ -266,10 +266,10 @@ static void action_channel_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy); /* own keymap */ - keymap = WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Animation Channels", 0, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); - keymap = WM_keymap_find(wm->defaultconf, "Dopesheet Generic", SPACE_ACTION, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Dopesheet Generic", SPACE_ACTION, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } @@ -550,7 +550,7 @@ static void action_buttons_area_init(wmWindowManager *wm, ARegion *ar) ED_region_panels_init(wm, ar); - keymap = WM_keymap_find(wm->defaultconf, "Dopesheet Generic", SPACE_ACTION, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Dopesheet Generic", SPACE_ACTION, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 7bcad841bca..1ff0cb53f6a 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -131,7 +131,7 @@ static void buttons_main_region_init(wmWindowManager *wm, ARegion *ar) ED_region_panels_init(wm, ar); - keymap = WM_keymap_find(wm->defaultconf, "Property Editor", SPACE_BUTS, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Property Editor", SPACE_BUTS, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } @@ -185,7 +185,7 @@ static void buttons_operatortypes(void) static void buttons_keymap(struct wmKeyConfig *keyconf) { - wmKeyMap *keymap = WM_keymap_find(keyconf, "Property Editor", SPACE_BUTS, 0); + wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Property Editor", SPACE_BUTS, 0); WM_keymap_add_item(keymap, "BUTTONS_OT_toolbox", RIGHTMOUSE, KM_PRESS, 0, 0); } diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 4754d45a0d1..1d9669e3e97 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -113,12 +113,16 @@ static void sclip_zoom_set(const bContext *C, float zoom, float location[2]) } if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) && location) { - float dx, dy; + float aspx, aspy, w, h, dx, dy; ED_space_clip_get_size(sc, &width, &height); + ED_space_clip_get_aspect(sc, &aspx, &aspy); - dx = ((location[0] - 0.5f) * width - sc->xof) * (sc->zoom - oldzoom) / sc->zoom; - dy = ((location[1] - 0.5f) * height - sc->yof) * (sc->zoom - oldzoom) / sc->zoom; + w = width * aspx; + h = height * aspy; + + dx = ((location[0] - 0.5f) * w - sc->xof) * (sc->zoom - oldzoom) / sc->zoom; + dy = ((location[1] - 0.5f) * h - sc->yof) * (sc->zoom - oldzoom) / sc->zoom; if (sc->flag & SC_LOCK_SELECTION) { sc->xlockof += dx; @@ -1585,7 +1589,7 @@ void CLIP_OT_cursor_set(wmOperatorType *ot) "Cursor location in normalized clip coordinates", -10.0f, 10.0f); } -/********************** macroses *********************/ +/********************** macros *********************/ void ED_operatormacros_clip(void) { diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 2d17460318e..35aa9896d12 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -548,7 +548,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf) /* ******** Global hotkeys avalaible for all regions ******** */ - keymap = WM_keymap_find(keyconf, "Clip", SPACE_CLIP, 0); + keymap = WM_keymap_ensure(keyconf, "Clip", SPACE_CLIP, 0); WM_keymap_add_item(keymap, "CLIP_OT_open", OKEY, KM_PRESS, KM_ALT, 0); @@ -588,7 +588,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf) /* ******** Hotkeys avalaible for main region only ******** */ - keymap = WM_keymap_find(keyconf, "Clip Editor", SPACE_CLIP, 0); + keymap = WM_keymap_ensure(keyconf, "Clip Editor", SPACE_CLIP, 0); // keymap->poll = ED_space_clip_tracking_poll; /* ** View/navigation ** */ @@ -756,7 +756,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf) /* ******** Hotkeys avalaible for preview region only ******** */ - keymap = WM_keymap_find(keyconf, "Clip Graph Editor", SPACE_CLIP, 0); + keymap = WM_keymap_ensure(keyconf, "Clip Graph Editor", SPACE_CLIP, 0); /* "timeline" */ WM_keymap_add_item(keymap, "CLIP_OT_change_frame", ACTIONMOUSE, KM_PRESS, 0, 0); @@ -810,7 +810,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf) /* ******** Hotkeys avalaible for channels region only ******** */ - keymap = WM_keymap_find(keyconf, "Clip Dopesheet Editor", SPACE_CLIP, 0); + keymap = WM_keymap_ensure(keyconf, "Clip Dopesheet Editor", SPACE_CLIP, 0); kmi = WM_keymap_add_item(keymap, "CLIP_OT_dopesheet_select_channel", LEFTMOUSE, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "extend", true); /* toggle */ @@ -1137,14 +1137,14 @@ static void clip_main_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy); /* mask polls mode */ - keymap = WM_keymap_find(wm->defaultconf, "Mask Editing", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Mask Editing", 0, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); /* own keymap */ - keymap = WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Clip", SPACE_CLIP, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); - keymap = WM_keymap_find(wm->defaultconf, "Clip Editor", SPACE_CLIP, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Clip Editor", SPACE_CLIP, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } @@ -1261,13 +1261,13 @@ static void clip_preview_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); /* own keymap */ - keymap = WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Clip", SPACE_CLIP, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); - keymap = WM_keymap_find(wm->defaultconf, "Clip Graph Editor", SPACE_CLIP, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Clip Graph Editor", SPACE_CLIP, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); - keymap = WM_keymap_find(wm->defaultconf, "Clip Dopesheet Editor", SPACE_CLIP, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Clip Dopesheet Editor", SPACE_CLIP, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } @@ -1365,7 +1365,7 @@ static void clip_channels_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy); - keymap = WM_keymap_find(wm->defaultconf, "Clip Dopesheet Editor", SPACE_CLIP, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Clip Dopesheet Editor", SPACE_CLIP, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } @@ -1437,7 +1437,7 @@ static void clip_tools_region_init(wmWindowManager *wm, ARegion *ar) ED_region_panels_init(wm, ar); - keymap = WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Clip", SPACE_CLIP, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } @@ -1480,7 +1480,7 @@ static void clip_properties_region_init(wmWindowManager *wm, ARegion *ar) ED_region_panels_init(wm, ar); - keymap = WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Clip", SPACE_CLIP, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 3f5adf6c1c5..919602f7bb5 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -145,7 +145,7 @@ static void console_main_region_init(wmWindowManager *wm, ARegion *ar) } /* own keymap */ - keymap = WM_keymap_find(wm->defaultconf, "Console", SPACE_CONSOLE, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Console", SPACE_CONSOLE, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); /* add drop boxes */ @@ -271,7 +271,7 @@ static void console_operatortypes(void) static void console_keymap(struct wmKeyConfig *keyconf) { - wmKeyMap *keymap = WM_keymap_find(keyconf, "Console", SPACE_CONSOLE, 0); + wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Console", SPACE_CONSOLE, 0); wmKeyMapItem *kmi; #ifdef __APPLE__ diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index fd9a9ff9ab1..f407d82aa5e 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -560,7 +560,7 @@ void file_draw_list(const bContext *C, ARegion *ar) filelist_cache_previews_update(files); /* Handle preview timer here, since it's filelist_file_cache_block() and filelist_cache_previews_update() - * which controlls previews task. */ + * which controls previews task. */ { const bool previews_running = filelist_cache_previews_running(files); // printf("%s: preview task: %d\n", __func__, previews_running); diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 81bc585db82..c9de18d9ca8 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1301,7 +1301,7 @@ void file_operator_to_sfile(bContext *C, SpaceFile *sfile, wmOperator *op) } /* we could check for relative_path property which is used when converting - * in the other direction but doesnt hurt to do this every time */ + * in the other direction but doesn't hurt to do this every time */ BLI_path_abs(sfile->params->dir, BKE_main_blendfile_path(bmain)); /* XXX, files and dirs updates missing, not really so important though */ diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 09e2660a762..368fc8be35c 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -215,7 +215,7 @@ typedef struct FileListInternEntry { int blentype; /* ID type, in case typeflag has FILE_TYPE_BLENDERLIB set. */ char *relpath; - char *name; /* not striclty needed, but used during sorting, avoids to have to recompute it there... */ + char *name; /* not strictly needed, but used during sorting, avoids to have to recompute it there... */ BLI_stat_t st; } FileListInternEntry; @@ -236,7 +236,7 @@ typedef struct FileListEntryCache { /* This one gathers all entries from both block and misc caches. Used for easy bulk-freing. */ ListBase cached_entries; - /* Block cache: all entries between start and end index. used for part of the list on diplay. */ + /* Block cache: all entries between start and end index. used for part of the list on display. */ FileDirEntry **block_entries; int block_start_index, block_end_index, block_center_index, block_cursor; @@ -1516,7 +1516,7 @@ static FileDirEntry *filelist_file_ex(struct FileList *filelist, const int index return cache->block_entries[idx]; } - if ((ret = BLI_ghash_lookup(cache->misc_entries, SET_INT_IN_POINTER(index)))) { + if ((ret = BLI_ghash_lookup(cache->misc_entries, POINTER_FROM_INT(index)))) { return ret; } @@ -1529,11 +1529,11 @@ static FileDirEntry *filelist_file_ex(struct FileList *filelist, const int index /* Else, we have to add new entry to 'misc' cache - and possibly make room for it first! */ ret = filelist_file_create_entry(filelist, index); old_index = cache->misc_entries_indices[cache->misc_cursor]; - if ((old = BLI_ghash_popkey(cache->misc_entries, SET_INT_IN_POINTER(old_index), NULL))) { + if ((old = BLI_ghash_popkey(cache->misc_entries, POINTER_FROM_INT(old_index), NULL))) { BLI_ghash_remove(cache->uuids, old->uuid, NULL, NULL); filelist_file_release_entry(filelist, old); } - BLI_ghash_insert(cache->misc_entries, SET_INT_IN_POINTER(index), ret); + BLI_ghash_insert(cache->misc_entries, POINTER_FROM_INT(index), ret); BLI_ghash_insert(cache->uuids, ret->uuid, ret); cache->misc_entries_indices[cache->misc_cursor] = index; @@ -1628,7 +1628,7 @@ static bool filelist_file_cache_block_create(FileList *filelist, const int start FileDirEntry *entry; /* That entry might have already been requested and stored in misc cache... */ - if ((entry = BLI_ghash_popkey(cache->misc_entries, SET_INT_IN_POINTER(idx), NULL)) == NULL) { + if ((entry = BLI_ghash_popkey(cache->misc_entries, POINTER_FROM_INT(idx), NULL)) == NULL) { entry = filelist_file_create_entry(filelist, idx); BLI_ghash_insert(cache->uuids, entry->uuid, entry); } @@ -2064,7 +2064,7 @@ unsigned int filelist_entry_select_set( { /* Default NULL pointer if not found is fine here! */ void **es_p = BLI_ghash_lookup_p(filelist->selection_state, entry->uuid); - unsigned int entry_flag = es_p ? GET_UINT_FROM_POINTER(*es_p) : 0; + unsigned int entry_flag = es_p ? POINTER_AS_UINT(*es_p) : 0; const unsigned int org_entry_flag = entry_flag; BLI_assert(entry); @@ -2090,7 +2090,7 @@ unsigned int filelist_entry_select_set( if (entry_flag != org_entry_flag) { if (es_p) { if (entry_flag) { - *es_p = SET_UINT_IN_POINTER(entry_flag); + *es_p = POINTER_FROM_UINT(entry_flag); } else { BLI_ghash_remove(filelist->selection_state, entry->uuid, MEM_freeN, NULL); @@ -2099,7 +2099,7 @@ unsigned int filelist_entry_select_set( else if (entry_flag) { void *key = MEM_mallocN(sizeof(entry->uuid), __func__); memcpy(key, entry->uuid, sizeof(entry->uuid)); - BLI_ghash_insert(filelist->selection_state, key, SET_UINT_IN_POINTER(entry_flag)); + BLI_ghash_insert(filelist->selection_state, key, POINTER_FROM_UINT(entry_flag)); } } @@ -2139,7 +2139,7 @@ unsigned int filelist_entry_select_get(FileList *filelist, FileDirEntry *entry, ((check == CHECK_FILES) && !(entry->typeflag & FILE_TYPE_DIR))) { /* Default NULL pointer if not found is fine here! */ - return GET_UINT_FROM_POINTER(BLI_ghash_lookup(filelist->selection_state, entry->uuid)); + return POINTER_AS_UINT(BLI_ghash_lookup(filelist->selection_state, entry->uuid)); } return 0; diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h index 76845c44226..6d898ee2fe9 100644 --- a/source/blender/editors/space_file/filelist.h +++ b/source/blender/editors/space_file/filelist.h @@ -56,12 +56,12 @@ typedef enum FileCheckType { CHECK_ALL = 3 } FileCheckType; -struct ListBase * folderlist_new(void); +struct ListBase *folderlist_new(void); void folderlist_free(struct ListBase *folderlist); -struct ListBase * folderlist_duplicate(ListBase *folderlist); +struct ListBase *folderlist_duplicate(ListBase *folderlist); void folderlist_popdir(struct ListBase *folderlist, char *dir); void folderlist_pushdir(struct ListBase *folderlist, const char *dir); -const char * folderlist_peeklastdir(struct ListBase *folderdist); +const char *folderlist_peeklastdir(struct ListBase *folderdist); int folderlist_clear_next(struct SpaceFile *sfile); @@ -77,24 +77,24 @@ void filelist_filter(struct FileList *filelist); void filelist_init_icons(void); void filelist_free_icons(void); void filelist_imgsize(struct FileList *filelist, short w, short h); -struct ImBuf * filelist_getimage(struct FileList *filelist, const int index); -struct ImBuf * filelist_geticon_image(struct FileList *filelist, const int index); +struct ImBuf *filelist_getimage(struct FileList *filelist, const int index); +struct ImBuf *filelist_geticon_image(struct FileList *filelist, const int index); int filelist_geticon(struct FileList *filelist, const int index, const bool is_main); -struct FileList * filelist_new(short type); +struct FileList *filelist_new(short type); void filelist_clear(struct FileList *filelist); void filelist_clear_ex(struct FileList *filelist, const bool do_cache, const bool do_selection); void filelist_free(struct FileList *filelist); -const char * filelist_dir(struct FileList *filelist); +const char *filelist_dir(struct FileList *filelist); bool filelist_is_dir(struct FileList *filelist, const char *path); void filelist_setdir(struct FileList *filelist, char *r_dir); int filelist_files_ensure(struct FileList *filelist); int filelist_empty(struct FileList *filelist); -FileDirEntry * filelist_file(struct FileList *filelist, int index); +FileDirEntry *filelist_file(struct FileList *filelist, int index); int filelist_file_findpath(struct FileList *filelist, const char *file); -FileDirEntry * filelist_entry_find_uuid(struct FileList *filelist, const int uuid[4]); +FileDirEntry *filelist_entry_find_uuid(struct FileList *filelist, const int uuid[4]); void filelist_file_cache_slidingwindow_set(struct FileList *filelist, size_t window_size); bool filelist_file_cache_block(struct FileList *filelist, const int index); diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index baa8e78572a..38b8dd37d46 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -439,7 +439,7 @@ void fsmenu_read_bookmarks(struct FSMenu *fsmenu, const char *filename) line[len - 1] = '\0'; } /* don't do this because it can be slow on network drives, - * having a bookmark from a drive thats ejected or so isn't + * having a bookmark from a drive that's ejected or so isn't * all _that_ bad */ #if 0 if (BLI_exists(line)) @@ -577,7 +577,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) #else /* unix */ { - const char *home = getenv("HOME"); + const char *home = BLI_getenv("HOME"); if (read_bookmarks && home) { BLI_snprintf(line, sizeof(line), "%s/", home); diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 94f47d5a6aa..b0dea1eb31b 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -330,10 +330,10 @@ static void file_main_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy); /* own keymaps */ - keymap = WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); - keymap = WM_keymap_find(wm->defaultconf, "File Browser Main", SPACE_FILE, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "File Browser Main", SPACE_FILE, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } @@ -386,7 +386,7 @@ static void file_main_region_draw(const bContext *C, ARegion *ar) v2d->keepofs |= V2D_LOCKOFS_Y; /* XXX this happens on scaling down Screen (like from startup.blend) */ - /* view2d has no type specific for filewindow case, which doesnt scroll vertically */ + /* view2d has no type specific for filewindow case, which doesn't scroll vertically */ if (v2d->cur.ymax < 0) { v2d->cur.ymin -= v2d->cur.ymax; v2d->cur.ymax = 0; @@ -453,7 +453,7 @@ static void file_keymap(struct wmKeyConfig *keyconf) { wmKeyMapItem *kmi; /* keys for all regions */ - wmKeyMap *keymap = WM_keymap_find(keyconf, "File Browser", SPACE_FILE, 0); + wmKeyMap *keymap = WM_keymap_ensure(keyconf, "File Browser", SPACE_FILE, 0); /* More common 'fliebrowser-like navigation' shortcuts. */ WM_keymap_add_item(keymap, "FILE_OT_parent", UPARROWKEY, KM_PRESS, KM_ALT, 0); @@ -476,7 +476,7 @@ static void file_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "FILE_OT_bookmark_add", BKEY, KM_PRESS, KM_CTRL, 0); /* keys for main region */ - keymap = WM_keymap_find(keyconf, "File Browser Main", SPACE_FILE, 0); + keymap = WM_keymap_ensure(keyconf, "File Browser Main", SPACE_FILE, 0); kmi = WM_keymap_add_item(keymap, "FILE_OT_execute", LEFTMOUSE, KM_DBL_CLICK, 0, 0); RNA_boolean_set(kmi->ptr, "need_active", true); @@ -568,7 +568,7 @@ static void file_keymap(struct wmKeyConfig *keyconf) /* keys for button region (top) */ - keymap = WM_keymap_find(keyconf, "File Browser Buttons", SPACE_FILE, 0); + keymap = WM_keymap_ensure(keyconf, "File Browser Buttons", SPACE_FILE, 0); kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADPLUSKEY, KM_PRESS, 0, 0); RNA_int_set(kmi->ptr, "increment", 1); kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADPLUSKEY, KM_PRESS, KM_SHIFT, 0); @@ -592,7 +592,7 @@ static void file_tools_region_init(wmWindowManager *wm, ARegion *ar) ED_region_panels_init(wm, ar); /* own keymaps */ - keymap = WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } @@ -618,7 +618,7 @@ static void file_header_region_init(wmWindowManager *wm, ARegion *ar) ED_region_header_init(ar); - keymap = WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } @@ -635,10 +635,10 @@ static void file_ui_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy); /* own keymap */ - keymap = WM_keymap_find(wm->defaultconf, "File Browser", SPACE_FILE, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); - keymap = WM_keymap_find(wm->defaultconf, "File Browser Buttons", SPACE_FILE, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "File Browser Buttons", SPACE_FILE, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index c5d6093dc4a..0bb46ca6fb8 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -686,7 +686,7 @@ void graphedit_keymap(wmKeyConfig *keyconf) wmKeyMapItem *kmi; /* keymap for all regions */ - keymap = WM_keymap_find(keyconf, "Graph Editor Generic", SPACE_IPO, 0); + keymap = WM_keymap_ensure(keyconf, "Graph Editor Generic", SPACE_IPO, 0); WM_keymap_add_item(keymap, "GRAPH_OT_properties", NKEY, KM_PRESS, 0, 0); /* extrapolation works on channels, not keys */ @@ -712,6 +712,6 @@ void graphedit_keymap(wmKeyConfig *keyconf) */ /* keyframes */ - keymap = WM_keymap_find(keyconf, "Graph Editor", SPACE_IPO, 0); + keymap = WM_keymap_ensure(keyconf, "Graph Editor", SPACE_IPO, 0); graphedit_keymap_keyframes(keyconf, keymap); } diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 5eec0b05e41..4e39c741b9b 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -216,9 +216,9 @@ static void graph_main_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); /* own keymap */ - keymap = WM_keymap_find(wm->defaultconf, "Graph Editor", SPACE_IPO, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor", SPACE_IPO, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); - keymap = WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } @@ -343,9 +343,9 @@ static void graph_channel_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy); /* own keymap */ - keymap = WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Animation Channels", 0, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); - keymap = WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } @@ -395,7 +395,7 @@ static void graph_buttons_region_init(wmWindowManager *wm, ARegion *ar) ED_region_panels_init(wm, ar); - keymap = WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 3fb1d6dd2d0..26bd560b31f 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -963,7 +963,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char uiItemR(col, &imaptr, "use_view_as_render", 0, NULL, ICON_NONE); if (ima->source != IMA_SRC_GENERATED) { - if (compact == 0) { /* background image view doesnt need these */ + if (compact == 0) { /* background image view doesn't need these */ ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL); bool has_alpha = true; diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 2a015177dac..561b7b99d59 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1855,6 +1855,8 @@ static bool save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI rr = BKE_image_acquire_renderresult(scene, ima); bool is_mono = rr ? BLI_listbase_count_at_most(&rr->views, 2) < 2 : BLI_listbase_count_at_most(&ima->views, 2) < 2; bool is_exr_rr = rr && ELEM(imf->imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER) && RE_HasFloatPixels(rr); + bool is_multilayer = is_exr_rr && (imf->imtype == R_IMF_IMTYPE_MULTILAYER); + int layer = (is_multilayer) ? -1 : sima->iuser.layer; /* error handling */ if (!rr) { @@ -1886,14 +1888,14 @@ static bool save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI /* fancy multiview OpenEXR */ if (imf->views_format == R_IMF_VIEWS_MULTIVIEW && is_exr_rr) { /* save render result */ - ok = RE_WriteRenderResult(op->reports, rr, simopts->filepath, imf, NULL, sima->iuser.layer); + ok = RE_WriteRenderResult(op->reports, rr, simopts->filepath, imf, NULL, layer); save_image_post(bmain, op, ibuf, ima, ok, true, relbase, relative, do_newpath, simopts->filepath); ED_space_image_release_buffer(sima, ibuf, lock); } /* regular mono pipeline */ else if (is_mono) { if (is_exr_rr) { - ok = RE_WriteRenderResult(op->reports, rr, simopts->filepath, imf, NULL, -1); + ok = RE_WriteRenderResult(op->reports, rr, simopts->filepath, imf, NULL, layer); } else { colormanaged_ibuf = IMB_colormanagement_imbuf_for_write(ibuf, save_as_render, true, &imf->view_settings, &imf->display_settings, imf); @@ -1921,7 +1923,7 @@ static bool save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI if (is_exr_rr) { BKE_scene_multiview_view_filepath_get(&scene->r, simopts->filepath, view, filepath); - ok_view = RE_WriteRenderResult(op->reports, rr, filepath, imf, view, -1); + ok_view = RE_WriteRenderResult(op->reports, rr, filepath, imf, view, layer); save_image_post(bmain, op, ibuf, ima, ok_view, true, relbase, relative, do_newpath, filepath); } else { @@ -1956,7 +1958,7 @@ static bool save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI /* stereo (multiview) images */ else if (simopts->im_format.views_format == R_IMF_VIEWS_STEREO_3D) { if (imf->imtype == R_IMF_IMTYPE_MULTILAYER) { - ok = RE_WriteRenderResult(op->reports, rr, simopts->filepath, imf, NULL, -1); + ok = RE_WriteRenderResult(op->reports, rr, simopts->filepath, imf, NULL, layer); save_image_post(bmain, op, ibuf, ima, ok, true, relbase, relative, do_newpath, simopts->filepath); ED_space_image_release_buffer(sima, ibuf, lock); } diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index b9c0ca66778..fd661883f79 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -282,7 +282,7 @@ static void image_operatortypes(void) static void image_keymap(struct wmKeyConfig *keyconf) { - wmKeyMap *keymap = WM_keymap_find(keyconf, "Image Generic", SPACE_IMAGE, 0); + wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Image Generic", SPACE_IMAGE, 0); wmKeyMapItem *kmi; int i; @@ -298,7 +298,7 @@ static void image_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "IMAGE_OT_cycle_render_slot", JKEY, KM_PRESS, 0, 0); RNA_boolean_set(WM_keymap_add_item(keymap, "IMAGE_OT_cycle_render_slot", JKEY, KM_PRESS, KM_ALT, 0)->ptr, "reverse", true); - keymap = WM_keymap_find(keyconf, "Image", SPACE_IMAGE, 0); + keymap = WM_keymap_ensure(keyconf, "Image", SPACE_IMAGE, 0); WM_keymap_add_item(keymap, "IMAGE_OT_view_all", HOMEKEY, KM_PRESS, 0, 0); @@ -660,29 +660,29 @@ static void image_main_region_init(wmWindowManager *wm, ARegion *ar) // UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy); /* mask polls mode */ - keymap = WM_keymap_find(wm->defaultconf, "Mask Editing", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Mask Editing", 0, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); /* image paint polls for mode */ - keymap = WM_keymap_find(wm->defaultconf, "Curve", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Curve", 0, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); - keymap = WM_keymap_find(wm->defaultconf, "Paint Curve", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Paint Curve", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Image Paint", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Image Paint", 0, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); - keymap = WM_keymap_find(wm->defaultconf, "UV Editor", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "UV Editor", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "UV Sculpt", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "UV Sculpt", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); /* own keymaps */ - keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Image", SPACE_IMAGE, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Image", SPACE_IMAGE, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } @@ -835,7 +835,7 @@ static void image_buttons_region_init(wmWindowManager *wm, ARegion *ar) ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE; ED_region_panels_init(wm, ar); - keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } @@ -887,7 +887,7 @@ static void image_tools_region_init(wmWindowManager *wm, ARegion *ar) ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE; ED_region_panels_init(wm, ar); - keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index acd0a856f1a..793b1a79b55 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -70,7 +70,7 @@ #include "info_intern.h" -/********************* pack blend file libaries operator *********************/ +/********************* pack blend file libraries operator *********************/ static int pack_libraries_exec(bContext *C, wmOperator *op) { @@ -124,7 +124,7 @@ void FILE_OT_unpack_libraries(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/********************* toogle auto-pack operator *********************/ +/********************* toggle auto-pack operator *********************/ static int autopack_toggle_exec(bContext *C, wmOperator *op) { diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 9ffa73af52b..7e3d57f95ed 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -133,7 +133,7 @@ static void info_main_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); /* own keymap */ - keymap = WM_keymap_find(wm->defaultconf, "Info", SPACE_INFO, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Info", SPACE_INFO, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } @@ -203,12 +203,12 @@ static void info_operatortypes(void) static void info_keymap(struct wmKeyConfig *keyconf) { - wmKeyMap *keymap = WM_keymap_find(keyconf, "Window", 0, 0); + wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Window", 0, 0); WM_keymap_verify_item(keymap, "INFO_OT_reports_display_update", TIMERREPORT, KM_ANY, KM_ANY, 0); /* info space */ - keymap = WM_keymap_find(keyconf, "Info", SPACE_INFO, 0); + keymap = WM_keymap_ensure(keyconf, "Info", SPACE_INFO, 0); /* report selection */ diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index c8385dfcbe3..a88d82fa05a 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -964,7 +964,7 @@ static void draw_sensor_collision(uiLayout *layout, PointerRNA *ptr, bContext *C uiItemR(row, ptr, "use_pulse", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); uiItemR(row, ptr, "use_material", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - switch (RNA_boolean_get(ptr, "use_material")) { + switch (RNA_enum_get(ptr, "use_material")) { case SENS_COLLISION_PROPERTY: uiItemR(split, ptr, "property", 0, NULL, ICON_NONE); break; diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index 339139b7e9e..6d484b4cb4c 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -179,7 +179,7 @@ static void logic_operatortypes(void) static void logic_keymap(struct wmKeyConfig *keyconf) { - wmKeyMap *keymap = WM_keymap_find(keyconf, "Logic Editor", SPACE_LOGIC, 0); + wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Logic Editor", SPACE_LOGIC, 0); WM_keymap_add_item(keymap, "LOGIC_OT_properties", NKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "LOGIC_OT_links_cut", LEFTMOUSE, KM_PRESS, KM_CTRL, 0); @@ -242,7 +242,7 @@ static void logic_main_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); /* own keymaps */ - keymap = WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } @@ -281,7 +281,7 @@ static void logic_buttons_region_init(wmWindowManager *wm, ARegion *ar) ED_region_panels_init(wm, ar); - keymap = WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index 9bb25724daf..c1e4a5de0ed 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -274,7 +274,8 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, float x, int channe if (nlaedit_is_tweakmode_on(ac) == 0) { /* 'push-down' action - only usable when not in TweakMode */ /* TODO: make this use the operator instead of calling the function directly - * however, calling the operator requires that we supply the args, and that works with proper buttons only */ + * however, calling the operator requires that we supply the args, + * and that works with proper buttons only */ BKE_nla_action_pushdown(adt); } else { diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c index 5bfd73b8163..78e70b76564 100644 --- a/source/blender/editors/space_nla/nla_ops.c +++ b/source/blender/editors/space_nla/nla_ops.c @@ -313,7 +313,7 @@ void nla_keymap(wmKeyConfig *keyconf) wmKeyMapItem *kmi; /* keymap for all regions ------------------------------------------- */ - keymap = WM_keymap_find(keyconf, "NLA Generic", SPACE_NLA, 0); + keymap = WM_keymap_ensure(keyconf, "NLA Generic", SPACE_NLA, 0); /* region management */ WM_keymap_add_item(keymap, "NLA_OT_properties", NKEY, KM_PRESS, 0, 0); @@ -345,10 +345,10 @@ void nla_keymap(wmKeyConfig *keyconf) * * However, those operations which involve clicking on channels and/or the placement of them in the view are implemented here instead */ - keymap = WM_keymap_find(keyconf, "NLA Channels", SPACE_NLA, 0); + keymap = WM_keymap_ensure(keyconf, "NLA Channels", SPACE_NLA, 0); nla_keymap_channels(keymap); /* data ------------------------------------------------------------- */ - keymap = WM_keymap_find(keyconf, "NLA Editor", SPACE_NLA, 0); + keymap = WM_keymap_ensure(keyconf, "NLA Editor", SPACE_NLA, 0); nla_keymap_main(keyconf, keymap); } diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index 8c9372f0612..04739f0fb64 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -545,7 +545,7 @@ static void mouse_nla_strips(bContext *C, bAnimContext *ac, const int mval[2], s return; } else { - /* found some channel - we only really should do somethign when its an Nla-Track */ + /* found some channel - we only really should do something when its an Nla-Track */ if (ale->type == ANIMTYPE_NLATRACK) { NlaTrack *nlt = (NlaTrack *)ale->data; diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index 88ef4a18142..1f9ff9aaabd 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -212,13 +212,13 @@ static void nla_channel_region_init(wmWindowManager *wm, ARegion *ar) /* own keymap */ /* own channels map first to override some channel keymaps */ - keymap = WM_keymap_find(wm->defaultconf, "NLA Channels", SPACE_NLA, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "NLA Channels", SPACE_NLA, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); /* now generic channels map for everything else that can apply */ - keymap = WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Animation Channels", 0, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); - keymap = WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "NLA Generic", SPACE_NLA, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } @@ -258,9 +258,9 @@ static void nla_main_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); /* own keymap */ - keymap = WM_keymap_find(wm->defaultconf, "NLA Editor", SPACE_NLA, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "NLA Editor", SPACE_NLA, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); - keymap = WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "NLA Generic", SPACE_NLA, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } @@ -344,7 +344,7 @@ static void nla_buttons_region_init(wmWindowManager *wm, ARegion *ar) ED_region_panels_init(wm, ar); - keymap = WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "NLA Generic", SPACE_NLA, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 6e52af2898e..46172da6b04 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -2411,7 +2411,6 @@ static void node_composit_buts_mask(uiLayout *layout, bContext *C, PointerRNA *p bNode *node = ptr->data; uiTemplateID(layout, C, ptr, "mask", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL); - uiItemR(layout, ptr, "use_antialiasing", 0, NULL, ICON_NONE); uiItemR(layout, ptr, "use_feather", 0, NULL, ICON_NONE); uiItemR(layout, ptr, "size_source", 0, "", ICON_NONE); diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index ea07341beb9..d4585c0835d 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -231,13 +231,13 @@ void node_keymap(struct wmKeyConfig *keyconf) wmKeyMapItem *kmi; /* Entire Editor only ----------------- */ - keymap = WM_keymap_find(keyconf, "Node Generic", SPACE_NODE, 0); + keymap = WM_keymap_ensure(keyconf, "Node Generic", SPACE_NODE, 0); WM_keymap_add_item(keymap, "NODE_OT_properties", NKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "NODE_OT_toolbar", TKEY, KM_PRESS, 0, 0); /* Main Region only ----------------- */ - keymap = WM_keymap_find(keyconf, "Node Editor", SPACE_NODE, 0); + keymap = WM_keymap_ensure(keyconf, "Node Editor", SPACE_NODE, 0); /* mouse select in nodes used to be both keys, but perhaps this should be reduced? * NOTE: mouse-clicks on left-mouse will fall through to allow transform-tweak, but also link/resize diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index e4c59bc9508..efdec512cf7 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -1161,7 +1161,7 @@ static void node_join_attach_recursive(bNode *node, bNode *frame) if (node->parent->done & NODE_JOIN_IS_DESCENDANT) node->done |= NODE_JOIN_IS_DESCENDANT; else if (node->flag & NODE_TEST) { - /* if parent is not an decendant of the frame, reattach the node */ + /* if parent is not an descendant of the frame, reattach the node */ nodeDetachNode(node); nodeAttachNode(node, frame); node->done |= NODE_JOIN_IS_DESCENDANT; @@ -1327,7 +1327,7 @@ static void node_detach_recursive(bNode *node) if (node->parent->done & NODE_DETACH_IS_DESCENDANT) node->done |= NODE_DETACH_IS_DESCENDANT; else if (node->flag & NODE_SELECT) { - /* if parent is not a decendant of a selected node, detach */ + /* if parent is not a descendant of a selected node, detach */ nodeDetachNode(node); node->done |= NODE_DETACH_IS_DESCENDANT; } @@ -1590,7 +1590,7 @@ static void node_link_insert_offset_frame_chains( /** * Callback that applies NodeInsertOfsData.offset_x to a node or its parent, - * considering the logic needed for offseting nodes after link insert + * considering the logic needed for offsetting nodes after link insert */ static bool node_link_insert_offset_chain_cb( bNode *fromnode, bNode *tonode, @@ -1648,7 +1648,7 @@ static void node_link_insert_offset_ntree( /* insert->totr isn't updated yet, so totr_insert is used to get the correct worldspace coords */ node_to_updated_rect(insert, &totr_insert); - /* frame attachement was't handled yet so we search the frame that the node will be attached to later */ + /* frame attachment wasn't handled yet so we search the frame that the node will be attached to later */ insert->parent = node_find_frame_to_attach(ar, ntree, mouse_xy); /* this makes sure nodes are also correctly offset when inserting a node on top of a frame diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index 636ed755cb1..e84d38a58ad 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -1019,6 +1019,7 @@ static uiBlock *node_find_menu(bContext *C, ARegion *ar, void *arg_op) block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU); + UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9 * UI_UNIT_X, UI_UNIT_Y, 0, 0, ""); UI_but_func_search_set(but, NULL, node_find_cb, op->type, node_find_call_cb, NULL); diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c index ef9ead3407c..c45a5c650ee 100644 --- a/source/blender/editors/space_node/node_templates.c +++ b/source/blender/editors/space_node/node_templates.c @@ -375,7 +375,7 @@ static void ui_node_link(bContext *C, void *arg_p, void *event_p) bNode *node_to = arg->node; bNodeSocket *sock_to = arg->sock; bNodeTree *ntree = arg->ntree; - int event = GET_INT_FROM_POINTER(event_p); + int event = POINTER_AS_INT(event_p); if (event == UI_NODE_LINK_DISCONNECT) node_socket_disconnect(bmain, ntree, node_to, sock_to); @@ -581,11 +581,11 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_ but = uiDefBut(block, UI_BTYPE_BUT, 0, IFACE_("Remove"), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Remove nodes connected to the input")); - UI_but_funcN_set(but, ui_node_link, MEM_dupallocN(arg), SET_INT_IN_POINTER(UI_NODE_LINK_REMOVE)); + UI_but_funcN_set(but, ui_node_link, MEM_dupallocN(arg), POINTER_FROM_INT(UI_NODE_LINK_REMOVE)); but = uiDefBut(block, UI_BTYPE_BUT, 0, IFACE_("Disconnect"), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Disconnect nodes connected to the input")); - UI_but_funcN_set(but, ui_node_link, MEM_dupallocN(arg), SET_INT_IN_POINTER(UI_NODE_LINK_DISCONNECT)); + UI_but_funcN_set(but, ui_node_link, MEM_dupallocN(arg), POINTER_FROM_INT(UI_NODE_LINK_DISCONNECT)); } ui_node_menu_column(arg, NODE_CLASS_GROUP, N_("Group")); diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c index 00eab0c69c1..22df2586a7b 100644 --- a/source/blender/editors/space_node/node_view.c +++ b/source/blender/editors/space_node/node_view.c @@ -193,7 +193,7 @@ void NODE_OT_view_selected(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/* **************** Backround Image Operators ************** */ +/* **************** Background Image Operators ************** */ typedef struct NodeViewMove { int mvalo[2]; diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 33f4847c90f..ed228cdaf74 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -593,7 +593,7 @@ static void node_buttons_region_init(wmWindowManager *wm, ARegion *ar) ED_region_panels_init(wm, ar); - keymap = WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Node Generic", SPACE_NODE, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } @@ -609,7 +609,7 @@ static void node_toolbar_region_init(wmWindowManager *wm, ARegion *ar) ED_region_panels_init(wm, ar); - keymap = WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Node Generic", SPACE_NODE, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } @@ -644,10 +644,10 @@ static void node_main_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); /* own keymaps */ - keymap = WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Node Generic", SPACE_NODE, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Node Editor", SPACE_NODE, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Node Editor", SPACE_NODE, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); /* add drop boxes */ diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index a35dffc0fcc..fcbed9b8b3c 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -967,7 +967,7 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Tre if (false == UI_but_active_only(C, ar, block, bt)) { tselem->flag &= ~TSE_TEXTBUT; - /* bad! (notifier within draw) without this, we don't get a refesh */ + /* bad! (notifier within draw) without this, we don't get a refresh */ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, NULL); } } diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 49647a0d838..dabb95e9d2b 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -122,7 +122,7 @@ typedef enum { #define SEARCHING_OUTLINER(sov) (sov->search_flags & SO_SEARCH_RECURSIVE) -/* is the currrent element open? if so we also show children */ +/* is the current element open? if so we also show children */ #define TSELEM_OPEN(telm, sv) ( (telm->flag & TSE_CLOSED) == 0 || (SEARCHING_OUTLINER(sv) && (telm->flag & TSE_CHILDSEARCH)) ) /* outliner_tree.c ----------------------------------------------- */ diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c index 9574e82505f..16cd383b5c2 100644 --- a/source/blender/editors/space_outliner/outliner_ops.c +++ b/source/blender/editors/space_outliner/outliner_ops.c @@ -91,7 +91,7 @@ void outliner_operatortypes(void) void outliner_keymap(wmKeyConfig *keyconf) { - wmKeyMap *keymap = WM_keymap_find(keyconf, "Outliner", SPACE_OUTLINER, 0); + wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Outliner", SPACE_OUTLINER, 0); wmKeyMapItem *kmi; WM_keymap_add_item(keymap, "OUTLINER_OT_item_rename", LEFTMOUSE, KM_DBL_CLICK, 0, 0); diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 173b48cc731..7bee4c3afc5 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -930,7 +930,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i tselem->flag |= TSE_CHILDSEARCH; te->parent = parent; - te->index = index; // for data arays + te->index = index; // for data arrays if (ELEM(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) { /* pass */ } @@ -1090,7 +1090,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i int a, tot; - /* we do lazy build, for speed and to avoid infinite recusion */ + /* we do lazy build, for speed and to avoid infinite recursion */ if (ptr->data == NULL) { te->name = IFACE_("(empty)"); @@ -1458,7 +1458,7 @@ static int treesort_alpha(const void *v1, const void *v2) } -/* this is nice option for later? doesnt look too useful... */ +/* this is nice option for later? doesn't look too useful... */ #if 0 static int treesort_obtype_alpha(const void *v1, const void *v2) { diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index 413ea8cc3a7..c1039927810 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -81,7 +81,7 @@ static void outliner_main_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy); /* own keymap */ - keymap = WM_keymap_find(wm->defaultconf, "Outliner", SPACE_OUTLINER, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Outliner", SPACE_OUTLINER, 0); /* don't pass on view2d mask, it's always set with scrollbar space, hide fails */ WM_event_add_keymap_handler_bb(&ar->handlers, keymap, NULL, &ar->winrct); diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c index 6f72c1d0159..2adfcc521f5 100644 --- a/source/blender/editors/space_script/space_script.c +++ b/source/blender/editors/space_script/space_script.c @@ -132,7 +132,7 @@ static void script_main_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy); /* own keymap */ - keymap = WM_keymap_find(wm->defaultconf, "Script", SPACE_SCRIPT, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Script", SPACE_SCRIPT, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index b3e1d3be42a..9ff6530f1e5 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -166,7 +166,7 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, i RNA_int_set(op->ptr, "frame_start", cfra); if ((flag & SEQPROP_ENDFRAME) && RNA_struct_property_is_set(op->ptr, "frame_end") == 0) - RNA_int_set(op->ptr, "frame_end", cfra + 25); // XXX arbitary but ok for now. + RNA_int_set(op->ptr, "frame_end", cfra + 25); // XXX arbitrary but ok for now. if (!(flag & SEQPROP_NOPATHS)) { sequencer_generic_invoke_path__internal(C, op, "filepath"); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 5b8f2ae7067..c2a1079c349 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -101,8 +101,11 @@ EnumPropertyItem sequencer_prop_effect_types[] = { /* mute operator */ +#define SEQ_SIDE_MOUSE -1 + EnumPropertyItem prop_side_types[] = { - {SEQ_SIDE_LEFT, "LEFT", 0, "Left", ""}, + {SEQ_SIDE_MOUSE, "MOUSE", 0, "Mouse position", "" }, + {SEQ_SIDE_LEFT, "LEFT", 0, "Left", "" }, {SEQ_SIDE_RIGHT, "RIGHT", 0, "Right", ""}, {SEQ_SIDE_BOTH, "BOTH", 0, "Both", ""}, {0, NULL, 0, NULL, NULL} @@ -555,7 +558,7 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen switch (BKE_sequence_effect_get_num_inputs(type)) { case 0: *selseq1 = *selseq2 = *selseq3 = NULL; - return 1; /* succsess */ + return 1; /* success */ case 1: if (seq2 == NULL) { *error_str = N_("At least one selected sequence strip is needed"); @@ -1391,7 +1394,7 @@ static int sequencer_slip_invoke(bContext *C, wmOperator *op, const wmEvent *eve int num_seq, i; View2D *v2d = UI_view2d_fromcontext(C); - /* first recursively cound the trimmed elements */ + /* first recursively count the trimmed elements */ num_seq = slip_count_sequences_rec(ed->seqbasep, true); if (num_seq == 0) @@ -1501,7 +1504,7 @@ static int sequencer_slip_exec(bContext *C, wmOperator *op) int offset = RNA_int_get(op->ptr, "offset"); bool success = false; - /* first recursively cound the trimmed elements */ + /* first recursively count the trimmed elements */ num_seq = slip_count_sequences_rec(ed->seqbasep, true); if (num_seq == 0) @@ -2138,16 +2141,20 @@ static int sequencer_cut_invoke(bContext *C, wmOperator *op, const wmEvent *even Scene *scene = CTX_data_scene(C); View2D *v2d = UI_view2d_fromcontext(C); - int cut_side = SEQ_SIDE_BOTH; + int cut_side = RNA_enum_get(op->ptr, "side"); int cut_frame = CFRA; - if (ED_operator_sequencer_active(C) && v2d) - cut_side = mouse_frame_side(v2d, event->mval[0], cut_frame); - + if (cut_side == SEQ_SIDE_MOUSE) { + if (ED_operator_sequencer_active(C) && v2d) { + cut_side = mouse_frame_side(v2d, event->mval[0], cut_frame); + } + else { + cut_side = SEQ_SIDE_BOTH; + } + } RNA_int_set(op->ptr, "frame", cut_frame); RNA_enum_set(op->ptr, "side", cut_side); /*RNA_enum_set(op->ptr, "type", cut_hard); */ /*This type is set from the key shortcut */ - return sequencer_cut_exec(C, op); } @@ -2167,11 +2174,15 @@ void SEQUENCER_OT_cut(struct wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + PropertyRNA *prop; RNA_def_int(ot->srna, "frame", 0, INT_MIN, INT_MAX, "Frame", "Frame where selected strips will be cut", INT_MIN, INT_MAX); RNA_def_enum(ot->srna, "type", prop_cut_types, SEQ_CUT_SOFT, "Type", "The type of cut operation to perform on strips"); - RNA_def_enum(ot->srna, "side", prop_side_types, SEQ_SIDE_BOTH, "Side", "The side that remains selected after cutting"); + prop = RNA_def_enum(ot->srna, "side", prop_side_types, SEQ_SIDE_MOUSE, "Side", "The side that remains selected after cutting"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); } +#undef SEQ_SIDE_MOUSE + /* duplicate operator */ static int apply_unique_name_cb(Sequence *seq, void *arg_pt) { @@ -2662,7 +2673,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) BLI_remlink(ed->seqbasep, last_seq); BKE_sequence_free(scene, last_seq); - /* emtpy meta strip, delete all effects depending on it */ + /* empty meta strip, delete all effects depending on it */ for (seq = ed->seqbasep->first; seq; seq = seq->next) if ((seq->type & SEQ_TYPE_EFFECT) && seq_depends_on_meta(seq, last_seq)) seq->flag |= SEQ_FLAG_DELETE; diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 234989ef244..408dc551382 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -137,7 +137,7 @@ void sequencer_keymap(wmKeyConfig *keyconf) wmKeyMapItem *kmi; /* Common items ------------------------------------------------------------------ */ - keymap = WM_keymap_find(keyconf, "SequencerCommon", SPACE_SEQ, 0); + keymap = WM_keymap_ensure(keyconf, "SequencerCommon", SPACE_SEQ, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_properties", NKEY, KM_PRESS, 0, 0); @@ -148,7 +148,7 @@ void sequencer_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SEQUENCER_OT_view_toggle", TABKEY, KM_PRESS, KM_CTRL, 0); /* Strips Region --------------------------------------------------------------- */ - keymap = WM_keymap_find(keyconf, "Sequencer", SPACE_SEQ, 0); + keymap = WM_keymap_ensure(keyconf, "Sequencer", SPACE_SEQ, 0); kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all", AKEY, KM_PRESS, 0, 0); RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE); @@ -340,7 +340,7 @@ void sequencer_keymap(wmKeyConfig *keyconf) /* Preview Region ----------------------------------------------------------- */ - keymap = WM_keymap_find(keyconf, "SequencerPreview", SPACE_SEQ, 0); + keymap = WM_keymap_ensure(keyconf, "SequencerPreview", SPACE_SEQ, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_view_all_preview", HOMEKEY, KM_PRESS, 0, 0); #ifdef WITH_INPUT_NDOF WM_keymap_add_item(keymap, "SEQUENCER_OT_view_all_preview", NDOF_BUTTON_FIT, KM_PRESS, 0, 0); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 88ad2cad3e9..e01c7994329 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -1150,7 +1150,7 @@ static bool select_grouped_effect_link(Editing *ed, Sequence *actseq, const int } SEQ_END; - actseq->tmp = SET_INT_IN_POINTER(true); + actseq->tmp = POINTER_FROM_INT(true); for (BKE_sequence_iterator_begin(ed, &iter, true); iter.valid; BKE_sequence_iterator_next(&iter)) { seq = iter.seq; @@ -1166,7 +1166,7 @@ static bool select_grouped_effect_link(Editing *ed, Sequence *actseq, const int continue; } - /* If the seq is an effect one, we need extra cheking! */ + /* If the seq is an effect one, we need extra checking! */ if (SEQ_IS_EFFECT(seq) && ((seq->seq1 && seq->seq1->tmp) || (seq->seq2 && seq->seq2->tmp) || (seq->seq3 && seq->seq3->tmp))) @@ -1175,7 +1175,7 @@ static bool select_grouped_effect_link(Editing *ed, Sequence *actseq, const int if (enddisp < seq->enddisp) enddisp = seq->enddisp; if (machine < seq->machine) machine = seq->machine; - seq->tmp = SET_INT_IN_POINTER(true); + seq->tmp = POINTER_FROM_INT(true); seq->flag |= SELECT; changed = true; @@ -1185,7 +1185,7 @@ static bool select_grouped_effect_link(Editing *ed, Sequence *actseq, const int BKE_sequence_iterator_begin(ed, &iter, true); } - /* Video strips bellow active one, or any strip for audio (order do no matters here!). */ + /* Video strips below active one, or any strip for audio (order do no matters here!). */ else if (seq->machine < machine || is_audio) { seq->flag |= SELECT; changed = true; diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 281dafe32c9..b87d878e057 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -475,15 +475,15 @@ static void sequencer_main_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); #if 0 - keymap = WM_keymap_find(wm->defaultconf, "Mask Editing", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Mask Editing", 0, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); #endif - keymap = WM_keymap_find(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); /* own keymap */ - keymap = WM_keymap_find(wm->defaultconf, "Sequencer", SPACE_SEQ, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Sequencer", SPACE_SEQ, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); /* add drop boxes */ @@ -556,15 +556,15 @@ static void sequencer_preview_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); #if 0 - keymap = WM_keymap_find(wm->defaultconf, "Mask Editing", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Mask Editing", 0, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); #endif - keymap = WM_keymap_find(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); /* own keymap */ - keymap = WM_keymap_find(wm->defaultconf, "SequencerPreview", SPACE_SEQ, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "SequencerPreview", SPACE_SEQ, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } @@ -627,7 +627,7 @@ static void sequencer_preview_region_listener(bScreen *UNUSED(sc), ScrArea *UNUS case NC_ANIMATION: switch (wmn->data) { case ND_KEYFRAME: - /* Otherwise, often prevents seing immediately effects of keyframe editing... */ + /* Otherwise, often prevents seeing immediately effects of keyframe editing... */ BKE_sequencer_cache_cleanup(); ED_region_tag_redraw(ar); break; @@ -659,7 +659,7 @@ static void sequencer_buttons_region_init(wmWindowManager *wm, ARegion *ar) { wmKeyMap *keymap; - keymap = WM_keymap_find(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); ED_region_panels_init(wm, ar); diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 3bc859dcf17..fc05fb51c1a 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -243,7 +243,7 @@ static void text_keymap(struct wmKeyConfig *keyconf) wmKeyMap *keymap; wmKeyMapItem *kmi; - keymap = WM_keymap_find(keyconf, "Text Generic", SPACE_TEXT, 0); + keymap = WM_keymap_ensure(keyconf, "Text Generic", SPACE_TEXT, 0); WM_keymap_add_item(keymap, "TEXT_OT_start_find", FKEY, KM_PRESS, KM_CTRL, 0); #ifdef __APPLE__ WM_keymap_add_item(keymap, "TEXT_OT_start_find", FKEY, KM_PRESS, KM_OSKEY, 0); @@ -253,7 +253,7 @@ static void text_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "TEXT_OT_replace", HKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "TEXT_OT_properties", TKEY, KM_PRESS, KM_CTRL, 0); - keymap = WM_keymap_find(keyconf, "Text", SPACE_TEXT, 0); + keymap = WM_keymap_ensure(keyconf, "Text", SPACE_TEXT, 0); #ifdef __APPLE__ RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", LEFTARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", LINE_BEGIN); @@ -421,9 +421,9 @@ static void text_main_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy); /* own keymap */ - keymap = WM_keymap_find(wm->defaultconf, "Text Generic", SPACE_TEXT, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Text Generic", SPACE_TEXT, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); - keymap = WM_keymap_find(wm->defaultconf, "Text", SPACE_TEXT, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Text", SPACE_TEXT, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); /* add drop boxes */ @@ -541,7 +541,7 @@ static void text_properties_region_init(wmWindowManager *wm, ARegion *ar) ED_region_panels_init(wm, ar); /* own keymaps */ - keymap = WM_keymap_find(wm->defaultconf, "Text Generic", SPACE_TEXT, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Text Generic", SPACE_TEXT, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } diff --git a/source/blender/editors/space_text/text_format_lua.c b/source/blender/editors/space_text/text_format_lua.c index 8b6ec2d804b..2a92f9a4d7d 100644 --- a/source/blender/editors/space_text/text_format_lua.c +++ b/source/blender/editors/space_text/text_format_lua.c @@ -69,7 +69,7 @@ static int txtfmt_lua_find_keyword(const char *string) else if (STR_LITERAL_STARTSWITH(string, "while", len)) i = len; else i = 0; - /* If next source char is an identifier (eg. 'i' in "definate") no match */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ if (i == 0 || text_check_identifier(string[i])) return -1; return i; @@ -120,7 +120,7 @@ static int txtfmt_lua_find_specialvar(const char *string) else if (STR_LITERAL_STARTSWITH(string, "xpcall", len)) i = len; else i = 0; - /* If next source char is an identifier (eg. 'i' in "definate") no match */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ if (i == 0 || text_check_identifier(string[i])) return -1; return i; diff --git a/source/blender/editors/space_text/text_format_osl.c b/source/blender/editors/space_text/text_format_osl.c index 2daaaa348e6..2b2dfef72d3 100644 --- a/source/blender/editors/space_text/text_format_osl.c +++ b/source/blender/editors/space_text/text_format_osl.c @@ -66,7 +66,7 @@ static int txtfmt_osl_find_builtinfunc(const char *string) else if (STR_LITERAL_STARTSWITH(string, "while", len)) i = len; else i = 0; - /* If next source char is an identifier (eg. 'i' in "definate") no match */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ if (i == 0 || text_check_identifier(string[i])) return -1; return i; @@ -116,7 +116,7 @@ static int txtfmt_osl_find_reserved(const char *string) else if (STR_LITERAL_STARTSWITH(string, "volatile", len)) i = len; else i = 0; - /* If next source char is an identifier (eg. 'i' in "definate") no match */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ if (i == 0 || text_check_identifier(string[i])) return -1; return i; @@ -140,7 +140,7 @@ static int txtfmt_osl_find_specialvar(const char *string) else if (STR_LITERAL_STARTSWITH(string, "displacement", len)) i = len; else i = 0; - /* If next source char is an identifier (eg. 'i' in "definate") no match */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ if (i == 0 || text_check_identifier(string[i])) return -1; return i; diff --git a/source/blender/editors/space_text/text_format_pov.c b/source/blender/editors/space_text/text_format_pov.c index 4c9abecedd6..f6b6d4f8d42 100644 --- a/source/blender/editors/space_text/text_format_pov.c +++ b/source/blender/editors/space_text/text_format_pov.c @@ -83,7 +83,7 @@ static int txtfmt_pov_find_keyword(const char *string) else if (STR_LITERAL_STARTSWITH(string, "if", len)) i = len; else i = 0; - /* If next source char is an identifier (eg. 'i' in "definate") no match */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ return (i == 0 || text_check_identifier(string[i])) ? -1 : i; } @@ -236,7 +236,7 @@ static int txtfmt_pov_find_reserved_keywords(const char *string) else if (STR_LITERAL_STARTSWITH(string, "str", len)) i = len; else i = 0; - /* If next source char is an identifier (eg. 'i' in "definate") no match */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ return (i == 0 || text_check_identifier(string[i])) ? -1 : i; } @@ -466,7 +466,7 @@ static int txtfmt_pov_find_reserved_builtins(const char *string) else if (STR_LITERAL_STARTSWITH(string, "z", len)) i = len; else i = 0; - /* If next source char is an identifier (eg. 'i' in "definate") no match */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ return (i == 0 || text_check_identifier(string[i])) ? -1 : i; } @@ -683,7 +683,7 @@ static int txtfmt_pov_find_specialvar(const char *string) else if (STR_LITERAL_STARTSWITH(string, "gall", len)) i = len; else i = 0; - /* If next source char is an identifier (eg. 'i' in "definate") no match */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ return (i == 0 || text_check_identifier(string[i])) ? -1 : i; } diff --git a/source/blender/editors/space_text/text_format_pov_ini.c b/source/blender/editors/space_text/text_format_pov_ini.c index 453dd1d748c..ae7d784dffc 100644 --- a/source/blender/editors/space_text/text_format_pov_ini.c +++ b/source/blender/editors/space_text/text_format_pov_ini.c @@ -93,7 +93,7 @@ static int txtfmt_ini_find_keyword(const char *string) else i = 0; - /* If next source char is an identifier (eg. 'i' in "definate") no match */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ return (i == 0 || text_check_identifier(string[i])) ? -1 : i; } @@ -299,7 +299,7 @@ static int txtfmt_ini_find_reserved(const char *string) else i = 0; - /* If next source char is an identifier (eg. 'i' in "definate") no match */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ return (i == 0 || text_check_identifier(string[i])) ? -1 : i; } diff --git a/source/blender/editors/space_text/text_format_py.c b/source/blender/editors/space_text/text_format_py.c index 2f6962f0493..3576d12998f 100644 --- a/source/blender/editors/space_text/text_format_py.c +++ b/source/blender/editors/space_text/text_format_py.c @@ -89,7 +89,7 @@ static int txtfmt_py_find_builtinfunc(const char *string) else if (STR_LITERAL_STARTSWITH(string, "yield", len)) i = len; else i = 0; - /* If next source char is an identifier (eg. 'i' in "definate") no match */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ if (i == 0 || text_check_identifier(string[i])) return -1; return i; @@ -110,7 +110,7 @@ static int txtfmt_py_find_specialvar(const char *string) else if (STR_LITERAL_STARTSWITH(string, "class", len)) i = len; else i = 0; - /* If next source char is an identifier (eg. 'i' in "definate") no match */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ if (i == 0 || text_check_identifier(string[i])) return -1; return i; diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index c8e9167edf9..30137f70a76 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -3194,7 +3194,7 @@ static int text_resolve_conflict_invoke(bContext *C, wmOperator *op, const wmEve switch (BKE_text_file_modified_check(text)) { case 1: if (text->flags & TXT_ISDIRTY) { - /* modified locally and externally, ahhh. offer more possibilites. */ + /* modified locally and externally, ahhh. offer more possibilities. */ pup = UI_popup_menu_begin(C, IFACE_("File Modified Outside and Inside Blender"), ICON_NONE); layout = UI_popup_menu_layout(pup); uiItemEnumO_ptr(layout, op->type, IFACE_("Reload from disk (ignore local changes)"), diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 97daed53e24..e3fe124a5c4 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -562,7 +562,7 @@ static void time_main_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); /* own keymap */ - keymap = WM_keymap_find(wm->defaultconf, "Timeline", SPACE_TIME, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Timeline", SPACE_TIME, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c index d88e2fdae91..a68bd2a9fbb 100644 --- a/source/blender/editors/space_time/time_ops.c +++ b/source/blender/editors/space_time/time_ops.c @@ -214,7 +214,7 @@ void time_operatortypes(void) void time_keymap(wmKeyConfig *keyconf) { - wmKeyMap *keymap = WM_keymap_find(keyconf, "Timeline", SPACE_TIME, 0); + wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Timeline", SPACE_TIME, 0); WM_keymap_add_item(keymap, "TIME_OT_start_frame_set", SKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "TIME_OT_end_frame_set", EKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index cf118404183..b230a5e193c 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -297,7 +297,7 @@ static int create_view_aligned_slices(VolumeSlicer *slicer, float plane_dist = min_dist; float plane_dist_inc = (max_dist - min_dist) / (float)num_slices; - /* for all egdes */ + /* for all edges */ for (int i = 0; i < 12; i++) { copy_v3_v3(vec_start[i], vertices[edges[edge_list[max_index][i]][0]]); copy_v3_v3(vec_dir[i], vertices[edges[edge_list[max_index][i]][1]]); diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 7f3a36c7ba6..fed056333c0 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -485,74 +485,74 @@ static void view3d_main_region_init(wmWindowManager *wm, ARegion *ar) /* object ops. */ /* important to be before Pose keymap since they can both be enabled at once */ - keymap = WM_keymap_find(wm->defaultconf, "Face Mask", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Face Mask", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Weight Paint Vertex Selection", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Weight Paint Vertex Selection", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); /* pose is not modal, operator poll checks for this */ - keymap = WM_keymap_find(wm->defaultconf, "Pose", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Pose", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Object Mode", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Object Mode", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Paint Curve", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Paint Curve", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Curve", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Curve", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Image Paint", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Image Paint", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Vertex Paint", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Vertex Paint", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Weight Paint", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Weight Paint", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Sculpt", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Sculpt", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Mesh", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Mesh", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Curve", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Curve", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Armature", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Armature", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Pose", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Pose", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Metaball", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Metaball", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Lattice", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Lattice", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Particle", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Particle", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); /* editfont keymap swallows all... */ - keymap = WM_keymap_find(wm->defaultconf, "Font", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Font", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Object Non-modal", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Object Non-modal", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "Frames", 0, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "Frames", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); /* own keymap, last so modes can override it */ - keymap = WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - keymap = WM_keymap_find(wm->defaultconf, "3D View", SPACE_VIEW3D, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "3D View", SPACE_VIEW3D, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); /* add drop boxes */ @@ -1036,7 +1036,7 @@ static void view3d_main_region_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegio /* add handlers, stuff you only do once or on area/region changes */ static void view3d_header_region_init(wmWindowManager *wm, ARegion *ar) { - wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0); + wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); @@ -1085,7 +1085,7 @@ static void view3d_buttons_region_init(wmWindowManager *wm, ARegion *ar) ED_region_panels_init(wm, ar); - keymap = WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } @@ -1191,7 +1191,7 @@ static void view3d_tools_region_init(wmWindowManager *wm, ARegion *ar) ED_region_panels_init(wm, ar); - keymap = WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0); + keymap = WM_keymap_ensure(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } diff --git a/source/blender/editors/space_view3d/view3d_camera_control.c b/source/blender/editors/space_view3d/view3d_camera_control.c index e27b3fe13f9..31956ee5f86 100644 --- a/source/blender/editors/space_view3d/view3d_camera_control.c +++ b/source/blender/editors/space_view3d/view3d_camera_control.c @@ -87,7 +87,7 @@ typedef struct View3DCameraControl { /* -------------------------------------------------------------------- */ - /* intial values */ + /* initial values */ /* root most parent */ Object *root_parent; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index b02e4ad9764..679498ab16d 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -790,7 +790,7 @@ static void viewrotate_apply(ViewOpsData *vod, const int event_xy[2]) /* avoid precision loss over time */ normalize_qt(vod->curr.viewquat); - /* use a working copy so view rotation locking doesnt overwrite the locked + /* use a working copy so view rotation locking doesn't overwrite the locked * rotation back into the view we calculate with */ copy_qt_qt(rv3d->viewquat, vod->curr.viewquat); @@ -1033,7 +1033,7 @@ static float view3d_ndof_pan_speed_calc(RegionView3D *rv3d) /** * Zoom and pan in the same function since sometimes zoom is interpreted as dolly (pan forward). * - * \param has_zoom zoom, otherwise dolly, often `!rv3d->is_persp` since it doesnt make sense to dolly in ortho. + * \param has_zoom zoom, otherwise dolly, often `!rv3d->is_persp` since it doesn't make sense to dolly in ortho. */ static void view3d_ndof_pan_zoom( const struct wmNDOFMotionData *ndof, ScrArea *sa, ARegion *ar, diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index c68b5e97414..320c00240c1 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -28,7 +28,7 @@ #ifdef WITH_INPUT_NDOF //# define NDOF_FLY_DEBUG -//# define NDOF_FLY_DRAW_TOOMUCH /* is this needed for ndof? - commented so redraw doesnt thrash - campbell */ +//# define NDOF_FLY_DRAW_TOOMUCH /* is this needed for ndof? - commented so redraw doesn't thrash - campbell */ #endif /* WITH_INPUT_NDOF */ #include "DNA_object_types.h" @@ -150,7 +150,7 @@ void fly_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, MOUSEPAN, 0, 0, 0, FLY_MODAL_SPEED); WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_PAN_ENABLE); - /* XXX - Bug in the event system, middle mouse release doesnt work */ + /* XXX - Bug in the event system, middle mouse release doesn't work */ WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, FLY_MODAL_PAN_DISABLE); /* WASD */ @@ -730,7 +730,7 @@ static int flyApply(bContext *C, FlyInfo *fly) RegionView3D *rv3d = fly->rv3d; float mat[3][3]; /* 3x3 copy of the view matrix so we can move along the view axis */ - float dvec[3] = {0, 0, 0}; /* this is the direction thast added to the view offset per redraw */ + float dvec[3] = {0, 0, 0}; /* this is the direction that's added to the view offset per redraw */ /* Camera Uprighting variables */ float moffset[2]; /* mouse offset from the views center */ diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index a1441d74af4..5d662282e56 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -232,13 +232,13 @@ void view3d_keymap(wmKeyConfig *keyconf) wmKeyMap *keymap; wmKeyMapItem *kmi; - keymap = WM_keymap_find(keyconf, "3D View Generic", SPACE_VIEW3D, 0); + keymap = WM_keymap_ensure(keyconf, "3D View Generic", SPACE_VIEW3D, 0); WM_keymap_add_item(keymap, "VIEW3D_OT_properties", NKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "VIEW3D_OT_toolshelf", TKEY, KM_PRESS, 0, 0); /* only for region 3D window */ - keymap = WM_keymap_find(keyconf, "3D View", SPACE_VIEW3D, 0); + keymap = WM_keymap_ensure(keyconf, "3D View", SPACE_VIEW3D, 0); /* Shift+LMB behavior first, so it has priority over KM_ANY item below. */ kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0); diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c index 767df04c0b0..3cc0857c8a7 100644 --- a/source/blender/editors/space_view3d/view3d_project.c +++ b/source/blender/editors/space_view3d/view3d_project.c @@ -367,19 +367,19 @@ bool ED_view3d_clip_segment(const RegionView3D *rv3d, float ray_start[3], float * \param r_ray_co The world-space point where the ray intersects the window plane. * \param r_ray_normal The normalized world-space direction of towards mval. * \param r_ray_start The world-space starting point of the ray. - * \param do_clip Optionally clip the start of the ray by the view clipping planes. + * \param do_clip_planes Optionally clip the start of the ray by the view clipping planes. * \return success, false if the ray is totally clipped. */ -bool ED_view3d_win_to_ray_ex( +bool ED_view3d_win_to_ray_clipped_ex( const ARegion *ar, const View3D *v3d, const float mval[2], - float r_ray_co[3], float r_ray_normal[3], float r_ray_start[3], bool do_clip) + float r_ray_co[3], float r_ray_normal[3], float r_ray_start[3], bool do_clip_planes) { float ray_end[3]; view3d_win_to_ray_segment(ar, v3d, mval, r_ray_co, r_ray_normal, r_ray_start, ray_end); /* bounds clipping */ - if (do_clip) { + if (do_clip_planes) { return ED_view3d_clip_segment(ar->regiondata, r_ray_start, ray_end); } @@ -396,14 +396,32 @@ bool ED_view3d_win_to_ray_ex( * \param mval The area relative 2d location (such as event->mval, converted into float[2]). * \param r_ray_start The world-space point where the ray intersects the window plane. * \param r_ray_normal The normalized world-space direction of towards mval. - * \param do_clip Optionally clip the start of the ray by the view clipping planes. + * \param do_clip_planes Optionally clip the start of the ray by the view clipping planes. * \return success, false if the ray is totally clipped. */ -bool ED_view3d_win_to_ray( +bool ED_view3d_win_to_ray_clipped( const ARegion *ar, const View3D *v3d, const float mval[2], - float r_ray_start[3], float r_ray_normal[3], const bool do_clip) + float r_ray_start[3], float r_ray_normal[3], const bool do_clip_planes) { - return ED_view3d_win_to_ray_ex(ar, v3d, mval, NULL, r_ray_normal, r_ray_start, do_clip); + return ED_view3d_win_to_ray_clipped_ex(ar, v3d, mval, NULL, r_ray_normal, r_ray_start, do_clip_planes); +} + +/** + * Calculate a 3d viewpoint and direction vector from 2d window coordinates. + * This ray_start is located at the viewpoint, ray_normal is the direction towards mval. + * \param ar The region (used for the window width and height). + * \param mval The area relative 2d location (such as event->mval, converted into float[2]). + * \param r_ray_start The world-space point where the ray intersects the window plane. + * \param r_ray_normal The normalized world-space direction of towards mval. + * + * \note Ignores view near/far clipping, to take this into account use #ED_view3d_win_to_ray_clipped. + */ +void ED_view3d_win_to_ray( + const ARegion *ar, const float mval[2], + float r_ray_start[3], float r_ray_normal[3]) +{ + ED_view3d_win_to_origin(ar, mval, r_ray_start); + ED_view3d_win_to_vector(ar, mval, r_ray_normal); } /** @@ -537,6 +555,31 @@ void ED_view3d_win_to_3d_int( ED_view3d_win_to_3d(v3d, ar, depth_pt, mval_fl, r_out); } +bool ED_view3d_win_to_3d_on_plane( + const ARegion *ar, + const float plane[4], const float mval[2], const bool do_clip, + float r_out[3]) +{ + float ray_co[3], ray_no[3]; + ED_view3d_win_to_origin(ar, mval, ray_co); + ED_view3d_win_to_vector(ar, mval, ray_no); + float lambda; + if (isect_ray_plane_v3(ray_co, ray_no, plane, &lambda, do_clip)) { + madd_v3_v3v3fl(r_out, ray_co, ray_no, lambda); + return true; + } + return false; +} + +bool ED_view3d_win_to_3d_on_plane_int( + const ARegion *ar, + const float plane[4], const int mval[2], const bool do_clip, + float r_out[3]) +{ + const float mval_fl[2] = {mval[0], mval[1]}; + return ED_view3d_win_to_3d_on_plane(ar, plane, mval_fl, do_clip, r_out); +} + /** * Calculate a 3d difference vector from 2d window offset. * note that ED_view3d_calc_zfac() must be called first to determine @@ -630,16 +673,17 @@ void ED_view3d_win_to_vector(const ARegion *ar, const float mval[2], float out[3 * \param mval The area relative 2d location (such as event->mval, converted into float[2]). * \param r_ray_start The world-space starting point of the segment. * \param r_ray_end The world-space end point of the segment. - * \param do_clip Optionally clip the ray by the view clipping planes. + * \param do_clip_planes Optionally clip the ray by the view clipping planes. * \return success, false if the segment is totally clipped. */ -bool ED_view3d_win_to_segment(const ARegion *ar, View3D *v3d, const float mval[2], - float r_ray_start[3], float r_ray_end[3], const bool do_clip) +bool ED_view3d_win_to_segment_clipped( + const ARegion *ar, View3D *v3d, const float mval[2], + float r_ray_start[3], float r_ray_end[3], const bool do_clip_planes) { view3d_win_to_ray_segment(ar, v3d, mval, NULL, NULL, r_ray_start, r_ray_end); /* bounds clipping */ - if (do_clip) { + if (do_clip_planes) { return ED_view3d_clip_segment((RegionView3D *)ar->regiondata, r_ray_start, r_ray_end); } diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index 012f71c10ba..f51b47032aa 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -485,7 +485,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a float quat[4]; float axis[3]; float angle; - const float px_scale = (ED_view3d_pixel_size(rv3d, ruler_item->co[1]) * + const float px_scale = (ED_view3d_pixel_size_no_ui_scale(rv3d, ruler_item->co[1]) * min_fff(arc_size, len_v2v2(co_ss[0], co_ss[1]) / 2.0f, len_v2v2(co_ss[2], co_ss[1]) / 2.0f)); diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 02136af958b..76697a02270 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -180,6 +180,7 @@ static uiBlock *tool_search_menu(bContext *C, ARegion *ar, void *arg_listbase) block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_SEARCH_MENU); + UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); /* fake button, it holds space for search items */ uiDefBut(block, UI_BTYPE_LABEL, 0, "", 10, 15, UI_searchbox_size_x(), UI_searchbox_size_y(), NULL, 0, 0, 0, 0, NULL); diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 97c00f1be37..33173ad3fd6 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -60,7 +60,7 @@ #ifdef WITH_INPUT_NDOF //# define NDOF_WALK_DEBUG -//# define NDOF_WALK_DRAW_TOOMUCH /* is this needed for ndof? - commented so redraw doesnt thrash - campbell */ +//# define NDOF_WALK_DRAW_TOOMUCH /* is this needed for ndof? - commented so redraw doesn't thrash - campbell */ #endif #define USE_TABLET_SUPPORT @@ -435,7 +435,7 @@ static bool walk_floor_distance_get( ray_start, ray_normal, r_distance, r_location, r_normal_dummy); - /* artifically scale the distance to the scene size */ + /* artificially scale the distance to the scene size */ *r_distance /= walk->grid; return ret; } @@ -474,7 +474,7 @@ static bool walk_ray_cast( negate_v3(r_normal); } - /* artifically scale the distance to the scene size */ + /* artificially scale the distance to the scene size */ *ray_distance /= walk->grid; return ret; @@ -1052,7 +1052,7 @@ static int walkApply(bContext *C, wmOperator *op, WalkInfo *walk) /* speed factor */ y *= WALK_ROTATE_FAC; - /* user adjustement factor */ + /* user adjustment factor */ y *= walk->mouse_speed; /* clamp the angle limits */ @@ -1090,7 +1090,7 @@ static int walkApply(bContext *C, wmOperator *op, WalkInfo *walk) /* speed factor */ x *= WALK_ROTATE_FAC; - /* user adjustement factor */ + /* user adjustment factor */ x *= walk->mouse_speed; /* Rotate about the relative up vec */ diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 79d06de8b41..cfe52197ca2 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1852,7 +1852,7 @@ static void drawTransformPixel(const struct bContext *UNUSED(C), ARegion *ar, vo /* draw autokeyframing hint in the corner * - only draw if enabled (advanced users may be distracted/annoyed), - * for objects that will be autokeyframed (no point ohterwise), + * for objects that will be autokeyframed (no point otherwise), * AND only for the active region (as showing all is too overwhelming) */ if ((U.autokey_flag & AUTOKEY_FLAG_NOWARNING) == 0) { @@ -2599,7 +2599,7 @@ static void constraintTransLim(TransInfo *t, TransData *td) mul_m4_m3m4(cob.matrix, td->mtx, cob.matrix); } else if (con->ownspace != CONSTRAINT_SPACE_LOCAL) { - /* skip... incompatable spacetype */ + /* skip... incompatible spacetype */ continue; } @@ -2675,7 +2675,7 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td) if ((data->flag2 & LIMIT_TRANSFORM) == 0) continue; - /* skip incompatable spacetypes */ + /* skip incompatible spacetypes */ if (!ELEM(con->ownspace, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL)) continue; @@ -5713,7 +5713,7 @@ static void calcEdgeSlideCustomPoints(struct TransInfo *t) setCustomPoints(t, &t->mouse, sld->mval_end, sld->mval_start); /* setCustomPoints isn't normally changing as the mouse moves, - * in this case apply mouse input immediatly so we don't refresh + * in this case apply mouse input immediately so we don't refresh * with the value from the previous points */ applyMouseInput(t, &t->mouse, t->mval, t->values); } @@ -7081,7 +7081,7 @@ static void calcVertSlideCustomPoints(struct TransInfo *t) } /* setCustomPoints isn't normally changing as the mouse moves, - * in this case apply mouse input immediatly so we don't refresh + * in this case apply mouse input immediately so we don't refresh * with the value from the previous points */ applyMouseInput(t, &t->mouse, t->mval, t->values); } diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 5f738804579..5369fc05005 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -150,7 +150,7 @@ typedef struct TransDataExtension { float r_mtx[3][3]; /* The rotscale matrix of pose bone, to allow using snap-align in translation mode, * when td->mtx is the loc pose bone matrix (and hence can't be used to apply rotation in some cases, * namely when a bone is in "NoLocal" or "Hinge" mode)... */ - float r_smtx[3][3]; /* Invers of previous one. */ + float r_smtx[3][3]; /* Inverse of previous one. */ int rotOrder; /* rotation mode, as defined in eRotationModes (DNA_action_types.h) */ float oloc[3], orot[3], oquat[4], orotAxis[3], orotAngle; /* Original object transformation used for rigid bodies */ } TransDataExtension; @@ -163,7 +163,7 @@ typedef struct TransData2D { float ih1[2], ih2[2]; } TransData2D; -/* we need to store 2 handles for each transdata in case the other handle wasnt selected */ +/* we need to store 2 handles for each transdata in case the other handle wasn't selected */ typedef struct TransDataCurveHandleFlags { char ih1, ih2; char *h1, *h2; @@ -522,7 +522,7 @@ typedef struct TransInfo { #define T_AUTOVALUES (1 << 20) - /* to specificy if we save back settings at the end */ + /* to specify if we save back settings at the end */ #define T_MODAL (1 << 21) /* no retopo */ @@ -796,6 +796,8 @@ bool applyTransformOrientation(const struct bContext *C, float mat[3][3], char r #define ORIENTATION_VERT 2 #define ORIENTATION_EDGE 3 #define ORIENTATION_FACE 4 +#define ORIENTATION_USE_PLANE(ty) \ + ELEM(ty, ORIENTATION_NORMAL, ORIENTATION_EDGE, ORIENTATION_FACE) int getTransformOrientation_ex(const struct bContext *C, float normal[3], float plane[3], const short around); int getTransformOrientation(const struct bContext *C, float normal[3], float plane[3]); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 2836ed0699d..6c67aef2884 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2291,7 +2291,7 @@ static struct TransIslandData *editmesh_islands_info_calc( vert_map = MEM_mallocN(sizeof(*vert_map) * bm->totvert, __func__); /* we shouldn't need this, but with incorrect selection flushing - * its possible we have a selected vertex thats not in a face, for now best not crash in that case. */ + * its possible we have a selected vertex that's not in a face, for now best not crash in that case. */ copy_vn_i(vert_map, bm->totvert, -1); BM_mesh_elem_table_ensure(bm, htype); @@ -2895,7 +2895,7 @@ void flushTransSeq(TransInfo *t) if (seq != seq_prev) { if (seq->depth == 0) { - /* test overlap, displayes red outline */ + /* test overlap, displays red outline */ seq->flag &= ~SEQ_OVERLAP; if (BKE_sequence_test_overlap(seqbasep, seq)) { seq->flag |= SEQ_OVERLAP; @@ -5784,7 +5784,7 @@ static void clear_trans_object_base_flags(TransInfo *t) } /* auto-keyframing feature - for objects - * tmode: should be a transform mode + * tmode: should be a transform mode */ // NOTE: context may not always be available, so must check before using it as it's a luxury for a few cases void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, int tmode) @@ -5900,8 +5900,8 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, } /* auto-keyframing feature - for poses/pose-channels - * tmode: should be a transform mode - * targetless_ik: has targetless ik been done on any channels? + * tmode: should be a transform mode + * targetless_ik: has targetless ik been done on any channels? */ // NOTE: context may not always be available, so must check before using it as it's a luxury for a few cases void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, int tmode, short targetless_ik) diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 9a2c3674d2a..fa3bf6c81e2 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -303,7 +303,7 @@ static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer) * NOTE: An alternative way would have been to instead hack the influence * to not get always get reset to full strength if NLASTRIP_FLAG_USR_INFLUENCE * is disabled but auto-blending isn't being used. However, that approach - * is a bit hacky/hard to discover, and may cause backwards compatability issues, + * is a bit hacky/hard to discover, and may cause backwards compatibility issues, * so it's better to just do it this way. */ strip->flag |= NLASTRIP_FLAG_USR_INFLUENCE; diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index c38fb15fc89..8cd31c32911 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -662,7 +662,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 } if (em->bm->totedgesel >= 1) { - /* find an edge thats apart of v_tri (no need to search all edges) */ + /* find an edge that's apart of v_tri (no need to search all edges) */ float e_length; int j; @@ -796,12 +796,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 } } - if (is_zero_v3(plane)) { - result = ORIENTATION_VERT; - } - else { - result = ORIENTATION_EDGE; - } + result = is_zero_v3(plane) ? ORIENTATION_VERT : ORIENTATION_EDGE; } else if (em->bm->totvertsel > 3) { BMIter iter; @@ -1104,6 +1099,11 @@ void ED_getTransformOrientationMatrix(const bContext *C, float orientation_mat[3 type = getTransformOrientation_ex(C, normal, plane, around); + /* Fallback, when the plane can't be calculated. */ + if (ORIENTATION_USE_PLANE(type) && is_zero_v3(plane)) { + type = ORIENTATION_VERT; + } + switch (type) { case ORIENTATION_NORMAL: if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0) { diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 8bc53127b4c..b06f22f50cc 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -611,7 +611,7 @@ static void initSnappingMode(TransInfo *t) (bool (*)(BMVert *, void *))BM_elem_cb_check_hflag_disabled, bm_edge_is_snap_target, bm_face_is_snap_target, - SET_UINT_IN_POINTER((BM_ELEM_SELECT | BM_ELEM_HIDDEN))); + POINTER_FROM_UINT((BM_ELEM_SELECT | BM_ELEM_HIDDEN))); } } } diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index f9c628877c1..1c6ad1fe752 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -2425,7 +2425,7 @@ bool ED_transform_snap_object_project_all_view3d_ex( { float ray_start[3], ray_normal[3]; - if (!ED_view3d_win_to_ray_ex( + if (!ED_view3d_win_to_ray_clipped_ex( sctx->v3d_data.ar, sctx->v3d_data.v3d, mval, NULL, ray_normal, ray_start, true)) { diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c index 621c5d73d5a..e0a1faf04b8 100644 --- a/source/blender/editors/undo/ed_undo.c +++ b/source/blender/editors/undo/ed_undo.c @@ -105,8 +105,6 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) { CLOG_INFO(&LOG, 1, "name='%s', step=%d", undoname, step); wmWindowManager *wm = CTX_wm_manager(C); - wmWindow *win = CTX_wm_window(C); - // Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); /* undo during jobs are running can easily lead to freeing data using by jobs, @@ -166,10 +164,6 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) WM_event_add_notifier(C, NC_WINDOW, NULL); WM_event_add_notifier(C, NC_WM | ND_UNDO, NULL); - if (win) { - win->addmousemove = true; - } - return OPERATOR_FINISHED; } @@ -247,7 +241,12 @@ static int ed_undo_exec(bContext *C, wmOperator *UNUSED(op)) { /* "last operator" should disappear, later we can tie this with undo stack nicer */ WM_operator_stack_clear(CTX_wm_manager(C)); - return ed_undo_step(C, 1, NULL); + int ret = ed_undo_step(C, 1, NULL); + if (ret & OPERATOR_FINISHED) { + /* Keep button under the cursor active. */ + WM_event_add_mousemove(C); + } + return ret; } static int ed_undo_push_exec(bContext *C, wmOperator *op) @@ -260,14 +259,24 @@ static int ed_undo_push_exec(bContext *C, wmOperator *op) static int ed_redo_exec(bContext *C, wmOperator *UNUSED(op)) { - return ed_undo_step(C, -1, NULL); + int ret = ed_undo_step(C, -1, NULL); + if (ret & OPERATOR_FINISHED) { + /* Keep button under the cursor active. */ + WM_event_add_mousemove(C); + } + return ret; } static int ed_undo_redo_exec(bContext *C, wmOperator *UNUSED(op)) { wmOperator *last_op = WM_operator_last_redo(C); - const int ret = ED_undo_operator_repeat(C, last_op); - return ret ? OPERATOR_FINISHED : OPERATOR_CANCELLED; + int ret = ED_undo_operator_repeat(C, last_op); + ret = ret ? OPERATOR_FINISHED : OPERATOR_CANCELLED; + if (ret & OPERATOR_FINISHED) { + /* Keep button under the cursor active. */ + WM_event_add_mousemove(C); + } + return ret; } static bool ed_undo_redo_poll(bContext *C) diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c index a139f0e3c87..f25bc6350c1 100644 --- a/source/blender/editors/util/numinput.c +++ b/source/blender/editors/util/numinput.c @@ -498,7 +498,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event) n->unit_sys, n->unit_type[idx]); /* Note: with angles, we always get values as radians here... */ - if (BPY_execute_string_as_number(C, str_unit_convert, false, &val)) { + if (BPY_execute_string_as_number(C, NULL, str_unit_convert, false, &val)) { n->val[idx] = (float)val; n->val_flag[idx] &= ~NUM_INVALID; } diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 375dda7dd6a..c0378f967ad 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -4458,7 +4458,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf) wmKeyMap *keymap; wmKeyMapItem *kmi; - keymap = WM_keymap_find(keyconf, "UV Editor", 0, 0); + keymap = WM_keymap_ensure(keyconf, "UV Editor", 0, 0); keymap->poll = ED_operator_uvedit_can_uv_sculpt; /* Uv sculpt toggle */ diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 0b768350942..869009d1bdf 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -955,9 +955,9 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final) /* store indices to editVerts and Faces. May be unneeded but ensuring anyway */ BM_mesh_elem_index_ensure(bm, BM_VERT | BM_FACE); - /***************************************** - * First determine stitchability of uvs * - *****************************************/ + /**************************************** + * First determine stitchability of uvs * + ****************************************/ for (i = 0; i < state->selection_size; i++) { if (state->mode == STITCH_VERT) { @@ -2002,6 +2002,7 @@ static void stitch_exit(bContext *C, wmOperator *op, int finished) RNA_enum_set(op->ptr, "stored_mode", state->mode); /* Store selection for re-execution of stitch */ + RNA_collection_clear(op->ptr, "selection"); for (i = 0; i < state->selection_size; i++) { UvElement *element; PointerRNA itemptr; diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 06eae0ee63d..582ba989997 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -1241,7 +1241,7 @@ static int unwrap_exec(bContext *C, wmOperator *op) else RNA_enum_set(op->ptr, "method", scene->toolsettings->unwrapper); - /* remember packing marging */ + /* remember packing margin */ if (RNA_struct_property_is_set(op->ptr, "margin")) scene->toolsettings->uvcalc_margin = RNA_float_get(op->ptr, "margin"); else |