Cleanup: comment line length (editors)

Prevents clang-format wrapping text before comments.
This commit is contained in:
Campbell Barton 2019-01-15 23:24:20 +11:00
parent ee789ccd46
commit d4c851b976
169 changed files with 1761 additions and 902 deletions

@ -3522,7 +3522,8 @@ static bAnimChannelType ACF_NLAACTION =
"NLA Active Action", /* type name */ "NLA Active Action", /* type name */
ACHANNEL_ROLE_CHANNEL, /* role */ ACHANNEL_ROLE_CHANNEL, /* role */
acf_nlaaction_color, /* backdrop color (NOTE: the backdrop handles this too, since it needs special hacks) */ acf_nlaaction_color, /* backdrop color (NOTE: the backdrop handles this too,
* since it needs special hacks) */
acf_nlaaction_backdrop, /* backdrop */ acf_nlaaction_backdrop, /* backdrop */
acf_generic_indention_flexible, /* indent level */ acf_generic_indention_flexible, /* indent level */
acf_generic_group_offset, /* offset */ // XXX? acf_generic_group_offset, /* offset */ // XXX?
@ -4348,7 +4349,8 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAni
break; break;
/* no flushing */ /* no flushing */
case ACHANNEL_SETTING_EXPAND: /* expanding - cannot flush, otherwise all would open/close at once */ case ACHANNEL_SETTING_EXPAND: /* expanding - cannot flush,
* otherwise all would open/close at once */
default: default:
UI_but_func_set(but, achannel_setting_widget_cb, NULL, NULL); UI_but_func_set(but, achannel_setting_widget_cb, NULL, NULL);
break; break;
@ -4536,7 +4538,8 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
/* modifiers disable */ /* modifiers disable */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MOD_OFF)) { if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MOD_OFF)) {
offset += ICON_WIDTH * 1.2f; /* hack: extra spacing, to avoid touching the mute toggle */ /* hack: extra spacing, to avoid touching the mute toggle */
offset += ICON_WIDTH * 1.2f;
draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax - offset, ymid, ACHANNEL_SETTING_MOD_OFF); draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax - offset, ymid, ACHANNEL_SETTING_MOD_OFF);
} }

@ -877,7 +877,8 @@ static void rearrange_animchannel_add_to_islands(ListBase *islands, ListBase *sr
Link *channel, eAnim_ChannelType type, Link *channel, eAnim_ChannelType type,
const bool is_hidden) const bool is_hidden)
{ {
tReorderChannelIsland *island = islands->last; /* always try to add to last island if possible */ /* always try to add to last island if possible */
tReorderChannelIsland *island = islands->last;
bool is_sel = false, is_untouchable = false; bool is_sel = false, is_untouchable = false;
/* get flags - selected and untouchable from the channel */ /* get flags - selected and untouchable from the channel */
@ -1556,7 +1557,8 @@ static void ANIM_OT_channels_group(wmOperatorType *ot)
ot->prop = RNA_def_string(ot->srna, "name", "New Group", ot->prop = RNA_def_string(ot->srna, "name", "New Group",
sizeof(((bActionGroup *)NULL)->name), sizeof(((bActionGroup *)NULL)->name),
"Name", "Name of newly created group"); "Name", "Name of newly created group");
/* RNA_def_property_flag(ot->prop, PROP_SKIP_SAVE); */ /* XXX: still not too sure about this - keeping same text is confusing... */ /* XXX: still not too sure about this - keeping same text is confusing... */
// RNA_def_property_flag(ot->prop, PROP_SKIP_SAVE);
} }
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
@ -2997,17 +2999,24 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmE
v2d = &ar->v2d; v2d = &ar->v2d;
/* select mode is either replace (deselect all, then add) or add/extend */ /* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend")) if (RNA_boolean_get(op->ptr, "extend")) {
selectmode = SELECT_INVERT; selectmode = SELECT_INVERT;
else if (RNA_boolean_get(op->ptr, "children_only")) }
selectmode = -1; /* this is a bit of a special case for ActionGroups only... should it be removed or extended to all instead? */ else if (RNA_boolean_get(op->ptr, "children_only")) {
else /* this is a bit of a special case for ActionGroups only...
* should it be removed or extended to all instead? */
selectmode = -1;
}
else {
selectmode = SELECT_REPLACE; selectmode = SELECT_REPLACE;
}
/* figure out which channel user clicked in /* figure out which channel user clicked in
* Note: although channels technically start at (y = ACHANNEL_FIRST), we need to adjust by half a channel's height *
* so that the tops of channels get caught ok. Since ACHANNEL_FIRST is really ACHANNEL_HEIGHT, we simply use * Note:
* ACHANNEL_HEIGHT_HALF. * although channels technically start at (y = ACHANNEL_FIRST),
* we need to adjust by half a channel's height so that the tops of channels get caught ok.
* Since ACHANNEL_FIRST is really ACHANNEL_HEIGHT, we simply use ACHANNEL_HEIGHT_HALF.
*/ */
UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y); UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y);
UI_view2d_listview_view_to_cell(v2d, ACHANNEL_NAMEWIDTH, ACHANNEL_STEP(&ac), 0, (float)ACHANNEL_HEIGHT_HALF(&ac), x, y, NULL, &channel_index); UI_view2d_listview_view_to_cell(v2d, ACHANNEL_NAMEWIDTH, ACHANNEL_STEP(&ac), 0, (float)ACHANNEL_HEIGHT_HALF(&ac), x, y, NULL, &channel_index);

@ -213,7 +213,8 @@ static short bezt_nlamapping_restore(KeyframeEditData *ked, BezTriple *bezt)
return 0; return 0;
} }
/* helper function for ANIM_nla_mapping_apply_fcurve() -> "apply", i.e. mapping points to NLA-mapped global time */ /* helper function for ANIM_nla_mapping_apply_fcurve() -> "apply",
* i.e. mapping points to NLA-mapped global time */
static short bezt_nlamapping_apply(KeyframeEditData *ked, BezTriple *bezt) static short bezt_nlamapping_apply(KeyframeEditData *ked, BezTriple *bezt)
{ {
/* AnimData block providing scaling is stored in 'data', only_keys option is stored in i1 */ /* AnimData block providing scaling is stored in 'data', only_keys option is stored in i1 */

@ -879,7 +879,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
break; break;
} }
case ANIMTYPE_FCURVE: case ANIMTYPE_FCURVE:
case ANIMTYPE_NLACURVE: /* practically the same as ANIMTYPE_FCURVE. Differences are applied post-creation */ case ANIMTYPE_NLACURVE: /* practically the same as ANIMTYPE_FCURVE.
* Differences are applied post-creation */
{ {
FCurve *fcu = (FCurve *)data; FCurve *fcu = (FCurve *)data;
@ -972,7 +973,8 @@ static bool skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_id
if (fcu->grp != NULL && fcu->grp->flag & ADT_CURVES_ALWAYS_VISIBLE) { if (fcu->grp != NULL && fcu->grp->flag & ADT_CURVES_ALWAYS_VISIBLE) {
return false; return false;
} }
/* hidden items should be skipped if we only care about visible data, but we aren't interested in hidden stuff */ /* hidden items should be skipped if we only care about visible data,
* but we aren't interested in hidden stuff */
const bool skip_hidden = (filter_mode & ANIMFILTER_DATA_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN); const bool skip_hidden = (filter_mode & ANIMFILTER_DATA_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN);
if (GS(owner_id->name) == ID_OB) { if (GS(owner_id->name) == ID_OB) {
@ -1266,8 +1268,11 @@ static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeS
* - Hierarchy matters: this hack should be applied * - Hierarchy matters: this hack should be applied
* - Hierarchy ignored: cases like [#21276] won't work properly, unless we skip this hack * - Hierarchy ignored: cases like [#21276] won't work properly, unless we skip this hack
*/ */
if ( ((filter_mode & ANIMFILTER_LIST_VISIBLE) && EXPANDED_AGRP(ac, agrp) == 0) && /* care about hierarchy but group isn't expanded */ if (
(filter_mode & (ANIMFILTER_SEL | ANIMFILTER_UNSEL)) ) /* care about selection status */ /* care about hierarchy but group isn't expanded */
((filter_mode & ANIMFILTER_LIST_VISIBLE) && EXPANDED_AGRP(ac, agrp) == 0) &&
/* care about selection status */
(filter_mode & (ANIMFILTER_SEL | ANIMFILTER_UNSEL)) )
{ {
/* if the group itself isn't selected appropriately, we shouldn't consider it's children either */ /* if the group itself isn't selected appropriately, we shouldn't consider it's children either */
if (ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) == 0) if (ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) == 0)
@ -1289,9 +1294,9 @@ static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeS
{ {
/* special filter so that we can get just the F-Curves within the active group */ /* special filter so that we can get just the F-Curves within the active group */
if (!(filter_mode & ANIMFILTER_ACTGROUPED) || (agrp->flag & AGRP_ACTIVE)) { if (!(filter_mode & ANIMFILTER_ACTGROUPED) || (agrp->flag & AGRP_ACTIVE)) {
/* for the Graph Editor, curves may be set to not be visible in the view to lessen clutter, /* for the Graph Editor, curves may be set to not be visible in the view to lessen
* but to do this, we need to check that the group doesn't have it's not-visible flag set preventing * clutter, but to do this, we need to check that the group doesn't have it's
* all its sub-curves to be shown * not-visible flag set preventing all its sub-curves to be shown
*/ */
if (!(filter_mode & ANIMFILTER_CURVE_VISIBLE) || !(agrp->flag & AGRP_NOTVISIBLE)) { if (!(filter_mode & ANIMFILTER_CURVE_VISIBLE) || !(agrp->flag & AGRP_NOTVISIBLE)) {
/* group must be editable for its children to be editable (if we care about this) */ /* group must be editable for its children to be editable (if we care about this) */
@ -1314,7 +1319,8 @@ static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeS
/* restore original filter mode so that this next step works ok... */ /* restore original filter mode so that this next step works ok... */
//filter_mode = ofilter; //filter_mode = ofilter;
/* filter selection of channel specially here again, since may be open and not subject to previous test */ /* filter selection of channel specially here again,
* since may be open and not subject to previous test */
if (ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) ) { if (ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) ) {
ANIMCHANNEL_NEW_CHANNEL(agrp, ANIMTYPE_GROUP, owner_id); ANIMCHANNEL_NEW_CHANNEL(agrp, ANIMTYPE_GROUP, owner_id);
} }
@ -1727,7 +1733,8 @@ static size_t animdata_filter_gpencil(bAnimContext *ac, ListBase *anim_data, voi
else { else {
bGPdata *gpd; bGPdata *gpd;
/* Grab all Grease Pencil datablocks directly from main, but only those that seem to be useful somewhere */ /* Grab all Grease Pencil datablocks directly from main,
* but only those that seem to be useful somewhere */
for (gpd = ac->bmain->gpencil.first; gpd; gpd = gpd->id.next) { for (gpd = ac->bmain->gpencil.first; gpd; gpd = gpd->id.next) {
/* only show if gpd is used by something... */ /* only show if gpd is used by something... */
if (ID_REAL_USERS(gpd) < 1) if (ID_REAL_USERS(gpd) < 1)
@ -3252,7 +3259,8 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_F
case ANIMCONT_DRIVERS: /* Graph Editor -> Drivers Editing */ case ANIMCONT_DRIVERS: /* Graph Editor -> Drivers Editing */
case ANIMCONT_NLA: /* NLA Editor */ case ANIMCONT_NLA: /* NLA Editor */
{ {
/* all of these editors use the basic DopeSheet data for filtering options, but don't have all the same features */ /* all of these editors use the basic DopeSheet data for filtering options,
* but don't have all the same features */
items = animdata_filter_dopesheet(ac, anim_data, data, filter_mode); items = animdata_filter_dopesheet(ac, anim_data, data, filter_mode);
break; break;
} }

@ -327,7 +327,8 @@ int ANIM_add_driver_with_target(
/* handle curve-property mappings based on mapping_type */ /* handle curve-property mappings based on mapping_type */
switch (mapping_type) { switch (mapping_type) {
case CREATEDRIVER_MAPPING_N_N: /* N-N - Try to match as much as possible, then use the first one */ case CREATEDRIVER_MAPPING_N_N: /* N-N - Try to match as much as possible,
* then use the first one */
{ {
/* Use the shorter of the two (to avoid out of bounds access) */ /* Use the shorter of the two (to avoid out of bounds access) */
int dst_len = (RNA_property_array_check(prop)) ? RNA_property_array_length(&ptr, prop) : 1; int dst_len = (RNA_property_array_check(prop)) ? RNA_property_array_length(&ptr, prop) : 1;

@ -349,9 +349,11 @@ static void fmod_envelope_addpoint_cb(bContext *C, void *fcm_dv, void *UNUSED(ar
bool exists; bool exists;
int i = BKE_fcm_envelope_find_index(env->data, (float)(scene->r.cfra), env->totvert, &exists); int i = BKE_fcm_envelope_find_index(env->data, (float)(scene->r.cfra), env->totvert, &exists);
/* binarysearch_...() will set exists by default to 0, so if it is non-zero, that means that the point exists already */ /* binarysearch_...() will set exists by default to 0,
if (exists) * so if it is non-zero, that means that the point exists already */
if (exists) {
return; return;
}
/* add new */ /* add new */
fedn = MEM_callocN((env->totvert + 1) * sizeof(FCM_EnvelopeData), "FCM_EnvelopeData"); fedn = MEM_callocN((env->totvert + 1) * sizeof(FCM_EnvelopeData), "FCM_EnvelopeData");

@ -873,9 +873,10 @@ void summary_to_keylist(bAnimContext *ac, DLRBT_Tree *keys, DLRBT_Tree *blocks)
/* loop through each F-Curve, grabbing the keyframes */ /* loop through each F-Curve, grabbing the keyframes */
for (ale = anim_data.first; ale; ale = ale->next) { for (ale = anim_data.first; ale; ale = ale->next) {
/* Why not use all #eAnim_KeyType here? /* Why not use all #eAnim_KeyType here?
* All of the other key types are actually "summaries" themselves, and will just end up duplicating stuff * All of the other key types are actually "summaries" themselves,
* that comes up through standard filtering of just F-Curves. * and will just end up duplicating stuff that comes up through
* Given the way that these work, there isn't really any benefit at all from including them. - Aligorith */ * standard filtering of just F-Curves. Given the way that these work,
* there isn't really any benefit at all from including them. - Aligorith */
switch (ale->datatype) { switch (ale->datatype) {
case ALE_FCURVE: case ALE_FCURVE:

@ -369,7 +369,8 @@ short ANIM_animchannel_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, bA
return 0; return 0;
} }
/* This function is used to apply operation to all keyframes, regardless of the type without needed an AnimListElem wrapper */ /* This function is used to apply operation to all keyframes,
* regardless of the type without needed an AnimListElem wrapper */
short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, void *data, int keytype, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb) short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, void *data, int keytype, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb)
{ {
/* sanity checks */ /* sanity checks */
@ -672,25 +673,35 @@ KeyframeEditFunc ANIM_editkeyframes_ok(short mode)
{ {
/* eEditKeyframes_Validate */ /* eEditKeyframes_Validate */
switch (mode) { switch (mode) {
case BEZT_OK_FRAME: /* only if bezt falls on the right frame (float) */ case BEZT_OK_FRAME:
/* only if bezt falls on the right frame (float) */
return ok_bezier_frame; return ok_bezier_frame;
case BEZT_OK_FRAMERANGE: /* only if bezt falls within the specified frame range (floats) */ case BEZT_OK_FRAMERANGE:
/* only if bezt falls within the specified frame range (floats) */
return ok_bezier_framerange; return ok_bezier_framerange;
case BEZT_OK_SELECTED: /* only if bezt is selected (self) */ case BEZT_OK_SELECTED:
/* only if bezt is selected (self) */
return ok_bezier_selected; return ok_bezier_selected;
case BEZT_OK_VALUE: /* only if bezt value matches (float) */ case BEZT_OK_VALUE:
/* only if bezt value matches (float) */
return ok_bezier_value; return ok_bezier_value;
case BEZT_OK_VALUERANGE: /* only if bezier falls within the specified value range (floats) */ case BEZT_OK_VALUERANGE:
/* only if bezier falls within the specified value range (floats) */
return ok_bezier_valuerange; return ok_bezier_valuerange;
case BEZT_OK_REGION: /* only if bezier falls within the specified rect (data -> rectf) */ case BEZT_OK_REGION:
/* only if bezier falls within the specified rect (data -> rectf) */
return ok_bezier_region; return ok_bezier_region;
case BEZT_OK_REGION_LASSO: /* only if the point falls within KeyframeEdit_LassoData defined data */ case BEZT_OK_REGION_LASSO:
/* only if the point falls within KeyframeEdit_LassoData defined data */
return ok_bezier_region_lasso; return ok_bezier_region_lasso;
case BEZT_OK_REGION_CIRCLE: /* only if the point falls within KeyframeEdit_CircleData defined data */ case BEZT_OK_REGION_CIRCLE:
/* only if the point falls within KeyframeEdit_CircleData defined data */
return ok_bezier_region_circle; return ok_bezier_region_circle;
case BEZT_OK_CHANNEL_LASSO: /* same as BEZT_OK_REGION_LASSO, but we're only using the x-value of the points */ case BEZT_OK_CHANNEL_LASSO:
/* same as BEZT_OK_REGION_LASSO, but we're only using the x-value of the points */
return ok_bezier_channel_lasso; return ok_bezier_channel_lasso;
case BEZT_OK_CHANNEL_CIRCLE: /* same as BEZT_OK_REGION_CIRCLE, but we're only using the x-value of the points */ case BEZT_OK_CHANNEL_CIRCLE:
/* same as BEZT_OK_REGION_CIRCLE, but we're only using the x-value of the points */
return ok_bezier_channel_circle; return ok_bezier_channel_circle;
default: /* nothing was ok */ default: /* nothing was ok */
return NULL; return NULL;
@ -700,7 +711,10 @@ KeyframeEditFunc ANIM_editkeyframes_ok(short mode)
/* ******************************************* */ /* ******************************************* */
/* Assorted Utility Functions */ /* Assorted Utility Functions */
/* helper callback for <animeditor>_cfrasnap_exec() -> used to help get the average time of all selected beztriples */ /**
* Helper callback for <animeditor>_cfrasnap_exec() ->
* used to help get the average time of all selected beztriples
*/
short bezt_calc_average(KeyframeEditData *ked, BezTriple *bezt) short bezt_calc_average(KeyframeEditData *ked, BezTriple *bezt)
{ {
/* only if selected */ /* only if selected */
@ -720,7 +734,8 @@ short bezt_calc_average(KeyframeEditData *ked, BezTriple *bezt)
return 0; return 0;
} }
/* helper callback for columnselect_<animeditor>_keys() -> populate list CfraElems with frame numbers from selected beztriples */ /* helper callback for columnselect_<animeditor>_keys() -> populate
* list CfraElems with frame numbers from selected beztriples */
short bezt_to_cfraelem(KeyframeEditData *ked, BezTriple *bezt) short bezt_to_cfraelem(KeyframeEditData *ked, BezTriple *bezt)
{ {
/* only if selected */ /* only if selected */

@ -443,11 +443,15 @@ int insert_vert_fcurve(FCurve *fcu, float x, float y, eBezTriple_KeyframeType ke
* to these later, we want these to work in a sane way out of * to these later, we want these to work in a sane way out of
* the box. * the box.
*/ */
beztr.back = 1.70158f; /* "back" easing - this value used to be used when overshoot=0, but that */
/* introduced discontinuities in how the param worked */
beztr.amplitude = 0.8f; /* "elastic" easing - values here were hand-optimised for a default duration of */ /* "back" easing - this value used to be used when overshoot=0, but that
beztr.period = 4.1f; /* ~10 frames (typical mograph motion length) */ * introduced discontinuities in how the param worked. */
beztr.back = 1.70158f;
/* "elastic" easing - values here were hand-optimised for a default duration of
* ~10 frames (typical mograph motion length) */
beztr.amplitude = 0.8f;
beztr.period = 4.1f;
/* add temp beztriple to keyframes */ /* add temp beztriple to keyframes */
a = insert_bezt_fcurve(fcu, &beztr, flag); a = insert_bezt_fcurve(fcu, &beztr, flag);

@ -1024,7 +1024,8 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe
RNA_id_pointer_create(ksp->id, &id_ptr); RNA_id_pointer_create(ksp->id, &id_ptr);
if (RNA_path_resolve_property(&id_ptr, ksp->rna_path, &ptr, &prop)) { if (RNA_path_resolve_property(&id_ptr, ksp->rna_path, &ptr, &prop)) {
arraylen = RNA_property_array_length(&ptr, prop); arraylen = RNA_property_array_length(&ptr, prop);
i = 0; /* start from start of array, instead of the previously specified index - T48020 */ /* start from start of array, instead of the previously specified index - T48020 */
i = 0;
} }
} }

@ -85,7 +85,7 @@ void ED_armature_transform_apply(Main *bmain, Object *ob, float mat[4][4], const
void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4], const bool do_props) void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4], const bool do_props)
{ {
EditBone *ebone; EditBone *ebone;
float scale = mat4_to_scale(mat); /* store the scale of the matrix here to use on envelopes */ float scale = mat4_to_scale(mat); /* store the scale of the matrix here to use on envelopes */
float mat3[3][3]; float mat3[3][3];
copy_m3_m4(mat3, mat); copy_m3_m4(mat3, mat);

@ -141,7 +141,8 @@ static void joined_armature_fix_animdata_cb(ID *id, FCurve *fcu, void *user_data
const char *old_name = BLI_ghashIterator_getKey(&gh_iter); const char *old_name = BLI_ghashIterator_getKey(&gh_iter);
const char *new_name = BLI_ghashIterator_getValue(&gh_iter); const char *new_name = BLI_ghashIterator_getValue(&gh_iter);
/* only remap if changed; this still means there will be some waste if there aren't many drivers/keys */ /* only remap if changed; this still means there will be some
* waste if there aren't many drivers/keys */
if (!STREQ(old_name, new_name) && strstr(fcu->rna_path, old_name)) { if (!STREQ(old_name, new_name) && strstr(fcu->rna_path, old_name)) {
fcu->rna_path = BKE_animsys_fix_rna_path_rename(id, fcu->rna_path, "pose.bones", fcu->rna_path = BKE_animsys_fix_rna_path_rename(id, fcu->rna_path, "pose.bones",
old_name, new_name, 0, 0, false); old_name, new_name, 0, 0, false);
@ -538,7 +539,8 @@ static void separate_armature_bones(Main *bmain, Object *ob, short sel)
for (ebo = arm->edbo->first; ebo; ebo = ebo->next) { for (ebo = arm->edbo->first; ebo; ebo = ebo->next) {
if (ebo->parent == curbone) { if (ebo->parent == curbone) {
ebo->parent = NULL; ebo->parent = NULL;
ebo->temp.p = NULL; /* this is needed to prevent random crashes with in ED_armature_from_edit */ /* this is needed to prevent random crashes with in ED_armature_from_edit */
ebo->temp.p = NULL;
ebo->flag &= ~BONE_CONNECTED; ebo->flag &= ~BONE_CONNECTED;
} }
} }

@ -627,7 +627,9 @@ void ED_armature_from_edit(Main *bmain, bArmature *arm)
if (eBone == arm->act_edbone) { if (eBone == arm->act_edbone) {
/* don't change active selection, this messes up separate which uses /* don't change active selection, this messes up separate which uses
* editmode toggle and can separate active bone which is de-selected originally */ * editmode toggle and can separate active bone which is de-selected originally */
/* newBone->flag |= BONE_SELECTED; */ /* important, editbones can be active with only 1 point selected */
/* important, editbones can be active with only 1 point selected */
/* newBone->flag |= BONE_SELECTED; */
arm->act_bone = newBone; arm->act_bone = newBone;
} }
newBone->roll = 0.0f; newBone->roll = 0.0f;
@ -660,8 +662,9 @@ void ED_armature_from_edit(Main *bmain, bArmature *arm)
} }
/* Fix parenting in a separate pass to ensure ebone->bone connections are valid at this point. /* Fix parenting in a separate pass to ensure ebone->bone connections are valid at this point.
* Do not set bone->head/tail here anymore, using EditBone data for that is not OK since our later fiddling * Do not set bone->head/tail here anymore,
* with parent's arm_mat (for roll conversion) may have some small but visible impact on locations (T46010). */ * using EditBone data for that is not OK since our later fiddling with parent's arm_mat
* (for roll conversion) may have some small but visible impact on locations (T46010). */
for (eBone = arm->edbo->first; eBone; eBone = eBone->next) { for (eBone = arm->edbo->first; eBone; eBone = eBone->next) {
newBone = eBone->temp.bone; newBone = eBone->temp.bone;
if (eBone->parent) { if (eBone->parent) {

@ -498,7 +498,10 @@ static int poselib_add_exec(bContext *C, wmOperator *op)
BLI_uniquename(&act->markers, marker, DATA_("Pose"), '.', offsetof(TimeMarker, name), sizeof(marker->name)); BLI_uniquename(&act->markers, marker, DATA_("Pose"), '.', offsetof(TimeMarker, name), sizeof(marker->name));
/* use Keying Set to determine what to store for the pose */ /* use Keying Set to determine what to store for the pose */
ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_WHOLE_CHARACTER_SELECTED_ID); /* this includes custom props :)*/
/* this includes custom props :)*/
ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_WHOLE_CHARACTER_SELECTED_ID);
ANIM_apply_keyingset(C, NULL, act, ks, MODIFYKEY_MODE_INSERT, (float)frame); ANIM_apply_keyingset(C, NULL, act, ks, MODIFYKEY_MODE_INSERT, (float)frame);
/* store new 'active' pose number */ /* store new 'active' pose number */
@ -728,7 +731,8 @@ void POSELIB_OT_pose_rename(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */ /* properties */
/* NOTE: name not pose is the operator's "main" property, so that it will get activated in the popup for easy renaming */ /* NOTE: name not pose is the operator's "main" property,
* so that it will get activated in the popup for easy renaming */
ot->prop = RNA_def_string(ot->srna, "name", "RenamedPose", 64, "New Pose Name", "New name for pose"); ot->prop = RNA_def_string(ot->srna, "name", "RenamedPose", 64, "New Pose Name", "New name for pose");
prop = RNA_def_enum(ot->srna, "pose", DummyRNA_NULL_items, 0, "Pose", "The pose to rename"); prop = RNA_def_enum(ot->srna, "pose", DummyRNA_NULL_items, 0, "Pose", "The pose to rename");
RNA_def_enum_funcs(prop, poselib_stored_pose_itemf); RNA_def_enum_funcs(prop, poselib_stored_pose_itemf);
@ -942,7 +946,8 @@ static void poselib_backup_restore(tPoseLib_PreviewData *pld)
if (plb->oldprops) if (plb->oldprops)
IDP_SyncGroupValues(plb->pchan->prop, plb->oldprops); IDP_SyncGroupValues(plb->pchan->prop, plb->oldprops);
/* TODO: constraints settings aren't restored yet, even though these could change (though not that likely) */ /* TODO: constraints settings aren't restored yet,
* even though these could change (though not that likely) */
} }
} }
@ -1765,7 +1770,11 @@ void POSELIB_OT_browse_interactive(wmOperatorType *ot)
// XXX: percentage vs factor? // XXX: percentage vs factor?
/* not used yet */ /* not used yet */
/* RNA_def_float_factor(ot->srna, "blend_factor", 1.0f, 0.0f, 1.0f, "Blend Factor", "Amount that the pose is applied on top of the existing poses", 0.0f, 1.0f); */ #if 0
RNA_def_float_factor(
ot->srna, "blend_factor", 1.0f, 0.0f, 1.0f, "Blend Factor",
"Amount that the pose is applied on top of the existing poses", 0.0f, 1.0f);
#endif
} }
void POSELIB_OT_apply_pose(wmOperatorType *ot) void POSELIB_OT_apply_pose(wmOperatorType *ot)

@ -95,10 +95,13 @@ typedef struct tPoseSlideOp {
ListBase pfLinks; /* links between posechannels and f-curves */ ListBase pfLinks; /* links between posechannels and f-curves */
DLRBT_Tree keys; /* binary tree for quicker searching for keyframes (when applicable) */ DLRBT_Tree keys; /* binary tree for quicker searching for keyframes (when applicable) */
int cframe; /* current frame number - global time */ /** current frame number - global time */
int cframe;
int prevFrame; /* frame before current frame (blend-from) - global time */ /** frame before current frame (blend-from) - global time */
int nextFrame; /* frame after current frame (blend-to) - global time */ int prevFrame;
/** frame after current frame (blend-to) - global time */
int nextFrame;
float prevFrameF; /* prevFrame, but in local action time (for F-Curve lookups to work) */ float prevFrameF; /* prevFrame, but in local action time (for F-Curve lookups to work) */
float nextFrameF; /* nextFrame, but in local action time (for F-Curve lookups to work) */ float nextFrameF; /* nextFrame, but in local action time (for F-Curve lookups to work) */
@ -106,10 +109,13 @@ typedef struct tPoseSlideOp {
short mode; /* sliding mode (ePoseSlide_Modes) */ short mode; /* sliding mode (ePoseSlide_Modes) */
short flag; /* unused for now, but can later get used for storing runtime settings.... */ short flag; /* unused for now, but can later get used for storing runtime settings.... */
short channels; /* which transforms/channels are affected (ePoseSlide_Channels) */ /** which transforms/channels are affected (ePoseSlide_Channels) */
short axislock; /* axis-limits for transforms (ePoseSlide_AxisLock) */ short channels;
/** axis-limits for transforms (ePoseSlide_AxisLock) */
short axislock;
float percentage; /* 0-1 value for determining the influence of whatever is relevant */ /** 0-1 value for determining the influence of whatever is relevant */
float percentage;
NumInput num; /* numeric input */ NumInput num; /* numeric input */
} tPoseSlideOp; } tPoseSlideOp;
@ -310,7 +316,8 @@ static void pose_slide_apply_val(tPoseSlideOp *pso, FCurve *fcu, float *val)
* - numerator should be larger than denominator to 'expand' the result * - numerator should be larger than denominator to 'expand' the result
* - perform this weighting a number of times given by the percentage... * - perform this weighting a number of times given by the percentage...
*/ */
int iters = (int)ceil(10.0f * pso->percentage); /* TODO: maybe a sensitivity ctrl on top of this is needed */ /* TODO: maybe a sensitivity ctrl on top of this is needed */
int iters = (int)ceil(10.0f * pso->percentage);
while (iters-- > 0) { while (iters-- > 0) {
(*val) = (-((sVal * w2) + (eVal * w1)) + ((*val) * 6.0f) ) / 5.0f; (*val) = (-((sVal * w2) + (eVal * w1)) + ((*val) * 6.0f) ) / 5.0f;
@ -323,7 +330,8 @@ static void pose_slide_apply_val(tPoseSlideOp *pso, FCurve *fcu, float *val)
* - numerator should be smaller than denominator to 'relax' the result * - numerator should be smaller than denominator to 'relax' the result
* - perform this weighting a number of times given by the percentage... * - perform this weighting a number of times given by the percentage...
*/ */
int iters = (int)ceil(10.0f * pso->percentage); /* TODO: maybe a sensitivity ctrl on top of this is needed */ /* TODO: maybe a sensitivity ctrl on top of this is needed */
int iters = (int)ceil(10.0f * pso->percentage);
while (iters-- > 0) { while (iters-- > 0) {
(*val) = ( ((sVal * w2) + (eVal * w1)) + ((*val) * 5.0f) ) / 6.0f; (*val) = ( ((sVal * w2) + (eVal * w1)) + ((*val) * 5.0f) ) / 6.0f;
@ -522,7 +530,8 @@ static void pose_slide_apply_quat(tPoseSlideOp *pso, tPChanFCurveLink *pfl)
} }
else { else {
float quat_interp[4], quat_orig[4]; float quat_interp[4], quat_orig[4];
int iters = (int)ceil(10.0f * pso->percentage); /* TODO: maybe a sensitivity ctrl on top of this is needed */ /* TODO: maybe a sensitivity ctrl on top of this is needed */
int iters = (int)ceil(10.0f * pso->percentage);
/* perform this blending several times until a satisfactory result is reached */ /* perform this blending several times until a satisfactory result is reached */
while (iters-- > 0) { while (iters-- > 0) {

@ -104,7 +104,7 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
if (ob->type != OB_ARMATURE) if (ob->type != OB_ARMATURE)
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
if (BKE_object_obdata_is_libdata(ob)) { if (BKE_object_obdata_is_libdata(ob)) {
BKE_report(op->reports, RPT_ERROR, "Cannot apply pose to lib-linked armature"); /* error_libdata(); */ BKE_report(op->reports, RPT_ERROR, "Cannot apply pose to lib-linked armature");
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
} }
@ -731,7 +731,8 @@ static void pchan_clear_rot(bPoseChannel *pchan)
} }
} }
/* Clear also Bendy Bone stuff - Roll is obvious, but Curve X/Y stuff is also kindof rotational in nature... */ /* Clear also Bendy Bone stuff - Roll is obvious,
* but Curve X/Y stuff is also kindof rotational in nature... */
pchan->roll1 = 0.0f; pchan->roll1 = 0.0f;
pchan->roll2 = 0.0f; pchan->roll2 = 0.0f;

@ -156,8 +156,9 @@ static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
pt_index = 0; pt_index = 0;
while (a--) { while (a--) {
/* We cannot keep *any* reference to curve obdata, /* We cannot keep *any* reference to curve obdata,
* it might be replaced and freed while editcurve remain in use (in viewport render case e.g.). * it might be replaced and freed while editcurve remain in use
* Note that we could use a pool to avoid lots of malloc's here, but... not really a problem for now. */ * (in viewport render case e.g.). Note that we could use a pool to avoid
* lots of malloc's here, but... not really a problem for now. */
BezTriple *origbezt_cpy = MEM_mallocN(sizeof(*origbezt), __func__); BezTriple *origbezt_cpy = MEM_mallocN(sizeof(*origbezt), __func__);
*origbezt_cpy = *origbezt; *origbezt_cpy = *origbezt;
keyIndex = init_cvKeyIndex(origbezt_cpy, key_index, nu_index, pt_index, vertex_index); keyIndex = init_cvKeyIndex(origbezt_cpy, key_index, nu_index, pt_index, vertex_index);
@ -176,8 +177,9 @@ static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
pt_index = 0; pt_index = 0;
while (a--) { while (a--) {
/* We cannot keep *any* reference to curve obdata, /* We cannot keep *any* reference to curve obdata,
* it might be replaced and freed while editcurve remain in use (in viewport render case e.g.). * it might be replaced and freed while editcurve remain in use
* Note that we could use a pool to avoid lots of malloc's here, but... not really a problem for now. */ * (in viewport render case e.g.). Note that we could use a pool to avoid
* lots of malloc's here, but... not really a problem for now. */
BPoint *origbp_cpy = MEM_mallocN(sizeof(*origbp_cpy), __func__); BPoint *origbp_cpy = MEM_mallocN(sizeof(*origbp_cpy), __func__);
*origbp_cpy = *origbp; *origbp_cpy = *origbp;
keyIndex = init_cvKeyIndex(origbp_cpy, key_index, nu_index, pt_index, vertex_index); keyIndex = init_cvKeyIndex(origbp_cpy, key_index, nu_index, pt_index, vertex_index);
@ -1259,8 +1261,9 @@ void ED_curve_editnurb_make(Object *obedit)
if (actkey) { if (actkey) {
editnurb->shapenr = obedit->shapenr; editnurb->shapenr = obedit->shapenr;
/* Apply shapekey to new nurbs of editnurb, not those of original curve (and *after* we generated keyIndex), /* Apply shapekey to new nurbs of editnurb, not those of original curve
* else we do not have valid 'original' data to properly restore curve when leaving editmode. */ * (and *after* we generated keyIndex), else we do not have valid 'original' data
* to properly restore curve when leaving editmode. */
BKE_keyblock_convert_to_curve(actkey, cu, &editnurb->nurbs); BKE_keyblock_convert_to_curve(actkey, cu, &editnurb->nurbs);
} }
} }
@ -2137,7 +2140,8 @@ static void adduplicateflagNurb(Object *obedit, ListBase *newnurb,
newu++; newu++;
for (c = a / nu->pntsu, bp3 = bp2; c < nu->pntsv; c++, bp3 += nu->pntsu) { for (c = a / nu->pntsu, bp3 = bp2; c < nu->pntsv; c++, bp3 += nu->pntsu) {
if (bp3->f1 & flag) { if (bp3->f1 & flag) {
bp3->f1 |= SURF_SEEN; /* flag as seen so skipped on future iterations */ /* flag as seen so skipped on future iterations */
bp3->f1 |= SURF_SEEN;
if (newu == 1) newv++; if (newu == 1) newv++;
} }
else { else {
@ -2621,7 +2625,8 @@ static void curve_smooth_value(ListBase *editnurb,
for (last_sel = 0; last_sel < nu->pntsu; last_sel++) { for (last_sel = 0; last_sel < nu->pntsu; last_sel++) {
/* loop over selection segments of a curve, smooth each */ /* loop over selection segments of a curve, smooth each */
/* Start BezTriple code, this is duplicated below for points, make sure these functions stay in sync */ /* Start BezTriple code,
* this is duplicated below for points, make sure these functions stay in sync */
start_sel = -1; start_sel = -1;
for (bezt = &nu->bezt[last_sel], a = last_sel; a < nu->pntsu; a++, bezt++) { for (bezt = &nu->bezt[last_sel], a = last_sel; a < nu->pntsu; a++, bezt++) {
if (bezt->f2 & SELECT) { if (bezt->f2 & SELECT) {
@ -2691,7 +2696,8 @@ static void curve_smooth_value(ListBase *editnurb,
for (last_sel = 0; last_sel < nu->pntsu; last_sel++) { for (last_sel = 0; last_sel < nu->pntsu; last_sel++) {
/* loop over selection segments of a curve, smooth each */ /* loop over selection segments of a curve, smooth each */
/* Start BezTriple code, this is duplicated below for points, make sure these functions stay in sync */ /* Start BezTriple code,
* this is duplicated below for points, make sure these functions stay in sync */
start_sel = -1; start_sel = -1;
for (bp = &nu->bp[last_sel], a = last_sel; a < nu->pntsu; a++, bp++) { for (bp = &nu->bp[last_sel], a = last_sel; a < nu->pntsu; a++, bp++) {
if (bp->f1 & SELECT) { if (bp->f1 & SELECT) {

@ -343,7 +343,7 @@ Nurb *ED_curve_add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4],
break; break;
case CU_PRIM_TUBE: /* Cylinder */ case CU_PRIM_TUBE: /* Cylinder */
if (cutype == CU_NURBS) { if (cutype == CU_NURBS) {
nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0); /* circle */ nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0);
nu->resolu = cu->resolu; nu->resolu = cu->resolu;
nu->flag = CU_SMOOTH; nu->flag = CU_SMOOTH;
BLI_addtail(editnurb, nu); /* temporal for extrude and translate */ BLI_addtail(editnurb, nu); /* temporal for extrude and translate */
@ -420,7 +420,7 @@ Nurb *ED_curve_add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4],
float tmp_vec[3] = {0.f, 0.f, 1.f}; float tmp_vec[3] = {0.f, 0.f, 1.f};
xzproj = 1; xzproj = 1;
nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0); /* circle */ nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0);
xzproj = 0; xzproj = 0;
nu->resolu = cu->resolu; nu->resolu = cu->resolu;
nu->resolv = cu->resolv; nu->resolv = cu->resolv;

@ -607,7 +607,8 @@ static bool gp_brush_twist_apply(tGP_BrushEditData *gso, bGPDstroke *gps, int i,
axis_angle_normalized_to_mat3(rmat, axis, angle); axis_angle_normalized_to_mat3(rmat, axis, angle);
/* Rotate point (no matrix-space transforms needed, as GP points are in world space) */ /* Rotate point (no matrix-space transforms needed, as GP points are in world space) */
sub_v3_v3v3(vec, &pt->x, gso->dvec); /* make relative to center (center is stored in dvec) */ sub_v3_v3v3(vec, &pt->x, gso->dvec); /* make relative to center
* (center is stored in dvec) */
mul_m3_v3(rmat, vec); mul_m3_v3(rmat, vec);
add_v3_v3v3(&pt->x, vec, gso->dvec); /* restore */ add_v3_v3v3(&pt->x, vec, gso->dvec); /* restore */
} }

@ -1165,7 +1165,8 @@ static void gp_layer_to_curve(bContext *C, ReportList *reports, bGPdata *gpd, bG
const bool add_start_point = (link_strokes && !(prev_gps)); const bool add_start_point = (link_strokes && !(prev_gps));
const bool add_end_point = (link_strokes && !(gps->next)); const bool add_end_point = (link_strokes && !(gps->next));
/* Detect new strokes created because of GP_STROKE_BUFFER_MAX reached, and stitch them to previous one. */ /* Detect new strokes created because of GP_STROKE_BUFFER_MAX reached,
* and stitch them to previous one. */
bool stitch = false; bool stitch = false;
if (prev_gps) { if (prev_gps) {
bGPDspoint *pt1 = &prev_gps->points[prev_gps->totpoints - 1]; bGPDspoint *pt1 = &prev_gps->points[prev_gps->totpoints - 1];

@ -2156,13 +2156,15 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op)
} }
else { else {
/* Geometry - Snap to surfaces of visible geometry */ /* Geometry - Snap to surfaces of visible geometry */
/* XXX: There will be precision loss (possible stairstep artifacts) from this conversion to satisfy the API's */ /* XXX: There will be precision loss (possible stairstep artifacts)
* from this conversion to satisfy the API's */
const int screen_co[2] = {(int)xy[0], (int)xy[1]}; const int screen_co[2] = {(int)xy[0], (int)xy[1]};
int depth_margin = 0; // XXX: 4 for strokes, 0 for normal int depth_margin = 0; // XXX: 4 for strokes, 0 for normal
float depth; float depth;
/* XXX: The proper procedure computes the depths into an array, to have smooth transitions when all else fails... */ /* XXX: The proper procedure computes the depths into an array,
* to have smooth transitions when all else fails... */
if (ED_view3d_autodist_depth(gsc.ar, screen_co, depth_margin, &depth)) { if (ED_view3d_autodist_depth(gsc.ar, screen_co, depth_margin, &depth)) {
ED_view3d_autodist_simple(gsc.ar, screen_co, &pt->x, 0, &depth); ED_view3d_autodist_simple(gsc.ar, screen_co, &pt->x, 0, &depth);
} }

@ -1073,7 +1073,8 @@ static int gpencil_interpolate_reverse_exec(bContext *C, wmOperator *UNUSED(op))
gpf = gpf->prev; gpf = gpf->prev;
} }
else { else {
/* Not a breakdown (may be a key, or an extreme, or something else that wasn't generated)... stop */ /* Not a breakdown (may be a key, or an extreme,
* or something else that wasn't generated)... stop */
break; break;
} }
} }

@ -2199,7 +2199,8 @@ static void gpencil_draw_apply_event(wmOperator *op, const wmEvent *event)
gpencil_draw_apply(op, p); gpencil_draw_apply(op, p);
/* force refresh */ /* force refresh */
ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */ /* just active area for now, since doing whole screen is too slow */
ED_region_tag_redraw(p->ar);
} }
/* ------------------------------- */ /* ------------------------------- */
@ -2771,7 +2772,8 @@ void GPENCIL_OT_draw(wmOperatorType *ot)
prop = RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); prop = RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
/* NOTE: wait for input is enabled by default, so that all UI code can work properly without needing users to know about this */ /* NOTE: wait for input is enabled by default,
* so that all UI code can work properly without needing users to know about this */
prop = RNA_def_boolean(ot->srna, "wait_for_input", true, "Wait for Input", "Wait for first click instead of painting immediately"); prop = RNA_def_boolean(ot->srna, "wait_for_input", true, "Wait for Input", "Wait for first click instead of painting immediately");
RNA_def_property_flag(prop, PROP_SKIP_SAVE); RNA_def_property_flag(prop, PROP_SKIP_SAVE);
} }

@ -772,7 +772,8 @@ static int gpencil_circle_select_exec(bContext *C, wmOperator *op)
bool select = !RNA_boolean_get(op->ptr, "deselect"); bool select = !RNA_boolean_get(op->ptr, "deselect");
GP_SpaceConversion gsc = {NULL}; GP_SpaceConversion gsc = {NULL};
rcti rect = {0}; /* for bounding rect around circle (for quicky intersection testing) */ /* for bounding rect around circle (for quicky intersection testing) */
rcti rect = {0};
bool changed = false; bool changed = false;

@ -114,37 +114,51 @@ typedef enum eAnimCont_Types {
typedef struct bAnimListElem { typedef struct bAnimListElem {
struct bAnimListElem *next, *prev; struct bAnimListElem *next, *prev;
void *data; /* source data this elem represents */ /** source data this elem represents */
int type; /* (eAnim_ChannelType) one of the ANIMTYPE_* values */ void *data;
int flag; /* copy of elem's flags for quick access */ /** (eAnim_ChannelType) one of the ANIMTYPE_* values */
int index; /* for un-named data, the index of the data in its collection */ int type;
/** copy of elem's flags for quick access */
int flag;
/** for un-named data, the index of the data in its collection */
int index;
char update; /* (eAnim_Update_Flags) tag the element for updating */ /** (eAnim_Update_Flags) tag the element for updating */
char tag; /* tag the included data. Temporary always */ char update;
/** tag the included data. Temporary always */
char tag;
short datatype; /* (eAnim_KeyType) type of motion data to expect */ /** (eAnim_KeyType) type of motion data to expect */
void *key_data; /* motion data - mostly F-Curves, but can be other types too */ short datatype;
/** motion data - mostly F-Curves, but can be other types too */
void *key_data;
/* NOTE: id here is the "IdAdtTemplate"-style datablock (e.g. Object, Material, Texture, NodeTree) /**
* from which evaluation of the RNA-paths takes place. It's used to figure out how deep * \note
* channels should be nested (e.g. for Textures/NodeTrees) in the tree, and allows property * id here is the "IdAdtTemplate"-style datablock (e.g. Object, Material, Texture, NodeTree)
* lookups (e.g. for sliders and for inserting keyframes) to work. If we had instead used * from which evaluation of the RNA-paths takes place. It's used to figure out how deep
* bAction or something similar, none of this would be possible: although it's trivial * channels should be nested (e.g. for Textures/NodeTrees) in the tree, and allows property
* to use an IdAdtTemplate type to find the source action a channel (e.g. F-Curve) comes from * lookups (e.g. for sliders and for inserting keyframes) to work. If we had instead used
* (i.e. in the AnimEditors, it *must* be the active action, as only that can be edited), * bAction or something similar, none of this would be possible: although it's trivial
* it's impossible to go the other way (i.e. one action may be used in multiple places). * to use an IdAdtTemplate type to find the source action a channel (e.g. F-Curve) comes from
* (i.e. in the AnimEditors, it *must* be the active action, as only that can be edited),
* it's impossible to go the other way (i.e. one action may be used in multiple places).
*/ */
struct ID *id; /* ID block that channel is attached to */ /** ID block that channel is attached to */
struct AnimData *adt; /* source of the animation data attached to ID block (for convenience) */ struct ID *id;
/** source of the animation data attached to ID block (for convenience) */
struct AnimData *adt;
void *owner; /* for per-element F-Curves (e.g. NLA Control Curves), the element that this represents (e.g. NlaStrip) */ void *owner; /* for per-element F-Curves (e.g. NLA Control Curves), the element that this represents (e.g. NlaStrip) */
} bAnimListElem; } bAnimListElem;
/* Some types for easier type-testing /**
* NOTE: need to keep the order of these synchronized with the channels define code * Some types for easier type-testing
* which is used for drawing and handling channel lists for *
* \note need to keep the order of these synchronized with the channels define code
* which is used for drawing and handling channel lists for.
*/ */
typedef enum eAnim_ChannelType { typedef enum eAnim_ChannelType {
ANIMTYPE_NONE = 0, ANIMTYPE_NONE = 0,
@ -231,42 +245,46 @@ typedef enum eAnim_Update_Flags {
/* filtering flags - under what circumstances should a channel be returned */ /* filtering flags - under what circumstances should a channel be returned */
typedef enum eAnimFilter_Flags { typedef enum eAnimFilter_Flags {
/* data which channel represents is fits the dopesheet filters (i.e. scene visibility criteria) */ /** data which channel represents is fits the dopesheet filters
* (i.e. scene visibility criteria) */
// XXX: it's hard to think of any examples where this *ISN'T* the case... perhaps becomes implicit? // XXX: it's hard to think of any examples where this *ISN'T* the case... perhaps becomes implicit?
ANIMFILTER_DATA_VISIBLE = (1 << 0), ANIMFILTER_DATA_VISIBLE = (1 << 0),
/* channel is visible within the channel-list hierarchy (i.e. F-Curves within Groups in ActEdit) */ /** channel is visible within the channel-list hierarchy
* (i.e. F-Curves within Groups in ActEdit) */
ANIMFILTER_LIST_VISIBLE = (1 << 1), ANIMFILTER_LIST_VISIBLE = (1 << 1),
/* channel has specifically been tagged as visible in Graph Editor (* Graph Editor Only) */ /** channel has specifically been tagged as visible in Graph Editor (* Graph Editor Only) */
ANIMFILTER_CURVE_VISIBLE = (1 << 2), ANIMFILTER_CURVE_VISIBLE = (1 << 2),
/* include summary channels and "expanders" (for drawing/mouse-selection in channel list) */ /** include summary channels and "expanders" (for drawing/mouse-selection in channel list) */
ANIMFILTER_LIST_CHANNELS = (1 << 3), ANIMFILTER_LIST_CHANNELS = (1 << 3),
/* for its type, channel should be "active" one */ /** for its type, channel should be "active" one */
ANIMFILTER_ACTIVE = (1 << 4), ANIMFILTER_ACTIVE = (1 << 4),
/* channel is a child of the active group (* Actions speciality) */ /** channel is a child of the active group (* Actions speciality) */
ANIMFILTER_ACTGROUPED = (1 << 5), ANIMFILTER_ACTGROUPED = (1 << 5),
/* channel must be selected/not-selected, but both must not be set together */ /** channel must be selected/not-selected, but both must not be set together */
ANIMFILTER_SEL = (1 << 6), ANIMFILTER_SEL = (1 << 6),
ANIMFILTER_UNSEL = (1 << 7), ANIMFILTER_UNSEL = (1 << 7),
/* editability status - must be editable to be included */ /** editability status - must be editable to be included */
ANIMFILTER_FOREDIT = (1 << 8), ANIMFILTER_FOREDIT = (1 << 8),
/* only selected animchannels should be considerable as editable - mainly for Graph Editor's option for keys on select curves only */ /** only selected animchannels should be considerable as editable - mainly
* for Graph Editor's option for keys on select curves only */
ANIMFILTER_SELEDIT = (1 << 9), ANIMFILTER_SELEDIT = (1 << 9),
/* flags used to enforce certain data types */ /** flags used to enforce certain data types
// NOTE: the ones for curves and NLA tracks were redundant and have been removed for now... * \node the ones for curves and NLA tracks were redundant and have been removed for now...
*/
ANIMFILTER_ANIMDATA = (1 << 10), ANIMFILTER_ANIMDATA = (1 << 10),
/* duplicate entries for animation data attached to multi-user blocks must not occur */ /** duplicate entries for animation data attached to multi-user blocks must not occur */
ANIMFILTER_NODUPLIS = (1 << 11), ANIMFILTER_NODUPLIS = (1 << 11),
/* for checking if we should keep some collapsed channel around (internal use only!) */ /** for checking if we should keep some collapsed channel around (internal use only!) */
ANIMFILTER_TMP_PEEK = (1 << 30), ANIMFILTER_TMP_PEEK = (1 << 30),
/* ignore ONLYSEL flag from filterflag, (internal use only!) */ /** ignore ONLYSEL flag from filterflag, (internal use only!) */
ANIMFILTER_TMP_IGNORE_ONLYSEL = (1u << 31) ANIMFILTER_TMP_IGNORE_ONLYSEL = (1u << 31)
} eAnimFilter_Flags; } eAnimFilter_Flags;
@ -409,30 +427,42 @@ void ANIM_animdata_freelist(ListBase *anim_data);
/* role or level of animchannel in the hierarchy */ /* role or level of animchannel in the hierarchy */
typedef enum eAnimChannel_Role { typedef enum eAnimChannel_Role {
ACHANNEL_ROLE_EXPANDER = -1, /* datablock expander - a "composite" channel type */ /** datablock expander - a "composite" channel type */
ACHANNEL_ROLE_SPECIAL = 0, /* special purposes - not generally for hierarchy processing */ ACHANNEL_ROLE_EXPANDER = -1,
ACHANNEL_ROLE_CHANNEL = 1 /* data channel - a channel representing one of the actual building blocks of channels */ /** special purposes - not generally for hierarchy processing */
ACHANNEL_ROLE_SPECIAL = 0,
/** data channel - a channel representing one of the actual building blocks of channels */
ACHANNEL_ROLE_CHANNEL = 1
} eAnimChannel_Role; } eAnimChannel_Role;
/* flag-setting behavior */ /* flag-setting behavior */
typedef enum eAnimChannels_SetFlag { typedef enum eAnimChannels_SetFlag {
ACHANNEL_SETFLAG_CLEAR = 0, /* turn off */ /** turn off */
ACHANNEL_SETFLAG_ADD = 1, /* turn on */ ACHANNEL_SETFLAG_CLEAR = 0,
ACHANNEL_SETFLAG_INVERT = 2, /* on->off, off->on */ /** turn on */
ACHANNEL_SETFLAG_TOGGLE = 3 /* some on -> all off // all on */ ACHANNEL_SETFLAG_ADD = 1,
/** on->off, off->on */
ACHANNEL_SETFLAG_INVERT = 2,
/** some on -> all off // all on */
ACHANNEL_SETFLAG_TOGGLE = 3
} eAnimChannels_SetFlag; } eAnimChannels_SetFlag;
/* types of settings for AnimChannels */ /* types of settings for AnimChannels */
typedef enum eAnimChannel_Settings { typedef enum eAnimChannel_Settings {
ACHANNEL_SETTING_SELECT = 0, ACHANNEL_SETTING_SELECT = 0,
ACHANNEL_SETTING_PROTECT = 1, /* warning: for drawing UI's, need to check if this is off (maybe inverse this later) */ /** warning: for drawing UI's, need to check if this is off (maybe inverse this later) */
ACHANNEL_SETTING_PROTECT = 1,
ACHANNEL_SETTING_MUTE = 2, ACHANNEL_SETTING_MUTE = 2,
ACHANNEL_SETTING_EXPAND = 3, ACHANNEL_SETTING_EXPAND = 3,
ACHANNEL_SETTING_VISIBLE = 4, /* only for Graph Editor */ /** only for Graph Editor */
ACHANNEL_SETTING_SOLO = 5, /* only for NLA Tracks */ ACHANNEL_SETTING_VISIBLE = 4,
ACHANNEL_SETTING_PINNED = 6, /* only for NLA Actions */ /** only for NLA Tracks */
ACHANNEL_SETTING_SOLO = 5,
/** only for NLA Actions */
ACHANNEL_SETTING_PINNED = 6,
ACHANNEL_SETTING_MOD_OFF = 7, ACHANNEL_SETTING_MOD_OFF = 7,
ACHANNEL_SETTING_ALWAYS_VISIBLE = 8, /* channel is pinned and always visible */ /** channel is pinned and always visible */
ACHANNEL_SETTING_ALWAYS_VISIBLE = 8,
} eAnimChannel_Settings; } eAnimChannel_Settings;
@ -522,7 +552,8 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, eAnimCont_Types d
void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datatype, eAnimFilter_Flags filter, void *channel_data, eAnim_ChannelType channel_type); void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datatype, eAnimFilter_Flags filter, void *channel_data, eAnim_ChannelType channel_type);
/* Delete the F-Curve from the given AnimData block (if possible), as appropriate according to animation context */ /* Delete the F-Curve from the given AnimData block (if possible),
* as appropriate according to animation context */
void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, struct AnimData *adt, struct FCurve *fcu); void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, struct AnimData *adt, struct FCurve *fcu);
/* ************************************************ */ /* ************************************************ */

@ -54,26 +54,32 @@ struct UndoType;
typedef struct EditBone { typedef struct EditBone {
struct EditBone *next, *prev; struct EditBone *next, *prev;
struct IDProperty *prop; /* User-Defined Properties on this Bone */ /** User-Defined Properties on this Bone */
struct EditBone *parent; /* Editbones have a one-way link (i.e. children refer struct IDProperty *prop;
* to parents. This is converted to a two-way link for /** Editbones have a one-way link (i.e. children refer
* normal bones when leaving editmode. */ * to parents. This is converted to a two-way link for
char name[64]; /* MAXBONENAME */ * normal bones when leaving editmode. */
float roll; /* Roll along axis. We'll ultimately use the axis/angle method struct EditBone *parent;
* for determining the transformation matrix of the bone. The axis /** (64 == MAXBONENAME) */
* is tail-head while roll provides the angle. Refer to Graphics char name[64];
* Gems 1 p. 466 (section IX.6) if it's not already in here somewhere*/ /** Roll along axis. We'll ultimately use the axis/angle method
* for determining the transformation matrix of the bone. The axis
* is tail-head while roll provides the angle. Refer to Graphics
* Gems 1 p. 466 (section IX.6) if it's not already in here somewhere*/
float roll;
float head[3]; /* Orientation and length is implicit during editing */ /** Orientation and length is implicit during editing */
float head[3];
float tail[3]; float tail[3];
/* All joints are considered to have zero rotation with respect to /** All joints are considered to have zero rotation with respect to
* their parents. Therefore any rotations specified during the * their parents. Therefore any rotations specified during the
* animation are automatically relative to the bones' rest positions*/ * animation are automatically relative to the bones' rest positions*/
int flag; int flag;
int layer; int layer;
float dist, weight; float dist, weight;
float xwidth, length, zwidth; /* put them in order! transform uses this as scale */ /** put them in order! transform uses this as scale */
float xwidth, length, zwidth;
float rad_head, rad_tail; float rad_head, rad_tail;
/* Bendy-Bone parameters */ /* Bendy-Bone parameters */
@ -83,7 +89,8 @@ typedef struct EditBone {
float ease1, ease2; float ease1, ease2;
float scaleIn, scaleOut; float scaleIn, scaleOut;
float oldlength; /* for envelope scaling */ /** for envelope scaling */
float oldlength;
short segments; short segments;

@ -123,8 +123,10 @@ typedef enum FSMenuCategory {
typedef enum FSMenuInsert { typedef enum FSMenuInsert {
FS_INSERT_SORTED = (1 << 0), FS_INSERT_SORTED = (1 << 0),
FS_INSERT_SAVE = (1 << 1), FS_INSERT_SAVE = (1 << 1),
FS_INSERT_FIRST = (1 << 2), /* moves the item to the front of the list when its not already there */ /** moves the item to the front of the list when its not already there */
FS_INSERT_LAST = (1 << 3), /* just append to preseve delivered order */ FS_INSERT_FIRST = (1 << 2),
/** just append to preseve delivered order */
FS_INSERT_LAST = (1 << 3),
} FSMenuInsert; } FSMenuInsert;
struct FSMenu; struct FSMenu;

@ -55,9 +55,12 @@ typedef struct ActKeyColumn {
struct ActKeyColumn *next, *prev; struct ActKeyColumn *next, *prev;
/* sorting-tree linkage */ /* sorting-tree linkage */
struct ActKeyColumn *left, *right; /* 'children' of this node, less than and greater than it (respectively) */ /** 'children' of this node, less than and greater than it (respectively) */
struct ActKeyColumn *parent; /* parent of this node in the tree */ struct ActKeyColumn *left, *right;
char tree_col; /* DLRB_BLACK or DLRB_RED */ /** parent of this node in the tree */
struct ActKeyColumn *parent;
/** DLRB_BLACK or DLRB_RED */
char tree_col;
/* keyframe info */ /* keyframe info */
char key_type; /* eBezTripe_KeyframeType */ char key_type; /* eBezTripe_KeyframeType */

@ -155,20 +155,30 @@ typedef enum eKeyframeIterFlags {
typedef struct KeyframeEditData { typedef struct KeyframeEditData {
/* generic properties/data access */ /* generic properties/data access */
ListBase list; /* temp list for storing custom list of data to check */ /** temp list for storing custom list of data to check */
struct Scene *scene; /* pointer to current scene - many tools need access to cfra/etc. */ ListBase list;
void *data; /* pointer to custom data - usually 'Object' but also 'rectf', but could be other types too */ /** pointer to current scene - many tools need access to cfra/etc. */
float f1, f2; /* storage of times/values as 'decimals' */ struct Scene *scene;
int i1, i2; /* storage of times/values/flags as 'whole' numbers */ /** pointer to custom data - usually 'Object' but also 'rectf', but could be other types too */
void *data;
/** storage of times/values as 'decimals' */
float f1, f2;
/** storage of times/values/flags as 'whole' numbers */
int i1, i2;
/* current iteration data */ /* current iteration data */
struct FCurve *fcu; /* F-Curve that is being iterated over */ /** F-Curve that is being iterated over */
int curIndex; /* index of current keyframe being iterated over */ struct FCurve *fcu;
float channel_y; /* y-position of midpoint of the channel (for the dopesheet) */ /** index of current keyframe being iterated over */
int curIndex;
/** y-position of midpoint of the channel (for the dopesheet) */
float channel_y;
/* flags */ /* flags */
eKeyframeVertOk curflags; /* current flags for the keyframe we're reached in the iteration process */ /** current flags for the keyframe we're reached in the iteration process */
eKeyframeIterFlags iterflags; /* settings for iteration process */ eKeyframeVertOk curflags;
/** settings for iteration process */
eKeyframeIterFlags iterflags;
} KeyframeEditData; } KeyframeEditData;
/* ------- Function Pointer Typedefs ---------------- */ /* ------- Function Pointer Typedefs ---------------- */
@ -213,7 +223,8 @@ typedef enum eKeyMergeMode {
/* ---------------- Looping API --------------------- */ /* ---------------- Looping API --------------------- */
/* functions for looping over keyframes */ /* functions for looping over keyframes */
/* function for working with F-Curve data only (i.e. when filters have been chosen to explicitly use this) */ /* function for working with F-Curve data only
* (i.e. when filters have been chosen to explicitly use this) */
short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, struct FCurve *fcu, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb); short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, struct FCurve *fcu, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb);
/* function for working with any type (i.e. one of the known types) of animation channel /* function for working with any type (i.e. one of the known types) of animation channel
* - filterflag is bDopeSheet->flag (DOPESHEET_FILTERFLAG) * - filterflag is bDopeSheet->flag (DOPESHEET_FILTERFLAG)
@ -267,7 +278,8 @@ short bezt_to_cfraelem(KeyframeEditData *ked, struct BezTriple *bezt);
void bezt_remap_times(KeyframeEditData *ked, struct BezTriple *bezt); void bezt_remap_times(KeyframeEditData *ked, struct BezTriple *bezt);
/* ------ 1.5-D Region Testing Uitls (Lasso/Circle Select) ------- */ /* ------ 1.5-D Region Testing Uitls (Lasso/Circle Select) ------- */
/* XXX: These are temporary, until we can unify GP/Mask Keyframe handling and standard FCurve Keyframe handling */ /* XXX: These are temporary,
* until we can unify GP/Mask Keyframe handling and standard FCurve Keyframe handling */
bool keyframe_region_lasso_test( bool keyframe_region_lasso_test(
const KeyframeEdit_LassoData *data_lasso, const KeyframeEdit_LassoData *data_lasso,

@ -189,7 +189,8 @@ typedef enum eModifyKey_Returns {
MODIFYKEY_MISSING_TYPEINFO = -2, MODIFYKEY_MISSING_TYPEINFO = -2,
} eModifyKey_Returns; } eModifyKey_Returns;
/* poll the current KeyingSet, updating it's set of paths (if "builtin"/"relative") for context changes */ /* poll the current KeyingSet, updating it's set of paths
* (if "builtin"/"relative") for context changes */
short ANIM_validate_keyingset(struct bContext *C, ListBase *dsources, struct KeyingSet *ks); short ANIM_validate_keyingset(struct bContext *C, ListBase *dsources, struct KeyingSet *ks);
/* use the specified KeyingSet to add/remove various Keyframes on the specified frame */ /* use the specified KeyingSet to add/remove various Keyframes on the specified frame */
@ -197,7 +198,8 @@ int ANIM_apply_keyingset(struct bContext *C, ListBase *dsources, struct bAction
/* -------- */ /* -------- */
/* Get the first builtin KeyingSet with the given name, which occurs after the given one (or start of list if none given) */ /* Get the first builtin KeyingSet with the given name, which occurs after the given one
* (or start of list if none given) */
struct KeyingSet *ANIM_builtin_keyingset_get_named(struct KeyingSet *prevKS, const char name[]); struct KeyingSet *ANIM_builtin_keyingset_get_named(struct KeyingSet *prevKS, const char name[]);
/* Find KeyingSet type info given a name */ /* Find KeyingSet type info given a name */
@ -234,18 +236,27 @@ bool ANIM_keyingset_context_ok_poll(struct bContext *C, struct KeyingSet *ks);
/* Flags for use by driver creation calls */ /* Flags for use by driver creation calls */
typedef enum eCreateDriverFlags { typedef enum eCreateDriverFlags {
CREATEDRIVER_WITH_DEFAULT_DVAR = (1 << 0), /* create drivers with a default variable for nicer UI */ /** create drivers with a default variable for nicer UI */
CREATEDRIVER_WITH_FMODIFIER = (1 << 1), /* create drivers with Generator FModifier (for backwards compat) */ CREATEDRIVER_WITH_DEFAULT_DVAR = (1 << 0),
/** create drivers with Generator FModifier (for backwards compat) */
CREATEDRIVER_WITH_FMODIFIER = (1 << 1),
} eCreateDriverFlags; } eCreateDriverFlags;
/* Heuristic to use for connecting target properties to driven ones */ /* Heuristic to use for connecting target properties to driven ones */
typedef enum eCreateDriver_MappingTypes { typedef enum eCreateDriver_MappingTypes {
CREATEDRIVER_MAPPING_1_N = 0, /* 1 to Many - Use the specified index, and drive all elements with it */ /** 1 to Many - Use the specified index, and drive all elements with it */
CREATEDRIVER_MAPPING_1_1 = 1, /* 1 to 1 - Only for the specified index on each side */ CREATEDRIVER_MAPPING_1_N = 0,
CREATEDRIVER_MAPPING_N_N = 2, /* Many to Many - Match up the indices one by one (only for drivers on vectors/arrays) */ /** 1 to 1 - Only for the specified index on each side */
CREATEDRIVER_MAPPING_1_1 = 1,
/** Many to Many - Match up the indices one by one (only for drivers on vectors/arrays) */
CREATEDRIVER_MAPPING_N_N = 2,
CREATEDRIVER_MAPPING_NONE = 3, /* None (Single Prop) - Do not create driver with any targets; these will get added later instead */ /** None (Single Prop):
CREATEDRIVER_MAPPING_NONE_ALL = 4, /* None (All Properties) - Do not create driver with any targets; these will get added later instead */ * Do not create driver with any targets; these will get added later instead */
CREATEDRIVER_MAPPING_NONE = 3,
/** None (All Properties):
* Do not create driver with any targets; these will get added later instead */
CREATEDRIVER_MAPPING_NONE_ALL = 4,
} eCreateDriver_MappingTypes; } eCreateDriver_MappingTypes;
/* RNA Enum of eCreateDriver_MappingTypes, for use by the appropriate operators */ /* RNA Enum of eCreateDriver_MappingTypes, for use by the appropriate operators */

@ -33,20 +33,30 @@
struct wmEvent; struct wmEvent;
typedef struct NumInput { typedef struct NumInput {
short idx_max; /* idx_max < NUM_MAX_ELEMENTS */ /** idx_max < NUM_MAX_ELEMENTS */
short idx_max;
int unit_sys; int unit_sys;
int unit_type[NUM_MAX_ELEMENTS]; /* Each value can have a different type */ /** Each value can have a different type */
int unit_type[NUM_MAX_ELEMENTS];
bool unit_use_radians; bool unit_use_radians;
short flag; /* Flags affecting all values' behavior */ /** Flags affecting all values' behavior */
short val_flag[NUM_MAX_ELEMENTS]; /* Per-value flags */ short flag;
float val[NUM_MAX_ELEMENTS]; /* Direct value of the input */ /** Per-value flags */
float val_org[NUM_MAX_ELEMENTS]; /* Original value of the input, for reset */ short val_flag[NUM_MAX_ELEMENTS];
float val_inc[NUM_MAX_ELEMENTS]; /* Increment steps */ /** Direct value of the input */
float val[NUM_MAX_ELEMENTS];
/** Original value of the input, for reset */
float val_org[NUM_MAX_ELEMENTS];
/** Increment steps */
float val_inc[NUM_MAX_ELEMENTS];
short idx; /* Active element/value */ /** Active element/value */
char str[NUM_STR_REP_LEN]; /* String as typed by user for edited value (we assume ASCII world!) */ short idx;
/* Current position of cursor in edited value str (first byte of "current" letter, so 0 for an empty str) */ /** String as typed by user for edited value (we assume ASCII world!) */
char str[NUM_STR_REP_LEN];
/** Current position of cursor in edited value str
* (first byte of "current" letter, so 0 for an empty str) */
int str_cur; int str_cur;
} NumInput; } NumInput;

@ -158,7 +158,8 @@ float ED_object_new_primitive_matrix(
const float loc[3], const float rot[3], float primmat[4][4]); const float loc[3], const float rot[3], float primmat[4][4]);
/* Avoid allowing too much insane values even by typing (typos can hang/crash Blender otherwise). */ /* Avoid allowing too much insane values even by typing
* (typos can hang/crash Blender otherwise). */
#define OBJECT_ADD_SIZE_MAXF 1.0e12f #define OBJECT_ADD_SIZE_MAXF 1.0e12f
void ED_object_add_unit_props(struct wmOperatorType *ot); void ED_object_add_unit_props(struct wmOperatorType *ot);

@ -77,10 +77,18 @@ typedef struct ScreenFrameRateInfo {
/* Enum for Action Zone Edges. Which edge of area is action zone. */ /* Enum for Action Zone Edges. Which edge of area is action zone. */
typedef enum { typedef enum {
AE_RIGHT_TO_TOPLEFT, /* Region located on the left, _right_ edge is action zone. Region minimized to the top left */ /** Region located on the left, _right_ edge is action zone.
AE_LEFT_TO_TOPRIGHT, /* Region located on the right, _left_ edge is action zone. Region minimized to the top right */ * Region minimized to the top left */
AE_TOP_TO_BOTTOMRIGHT, /* Region located at the bottom, _top_ edge is action zone. Region minimized to the bottom right */ AE_RIGHT_TO_TOPLEFT,
AE_BOTTOM_TO_TOPLEFT /* Region located at the top, _bottom_ edge is action zone. Region minimized to the top left */ /** Region located on the right, _left_ edge is action zone.
* Region minimized to the top right */
AE_LEFT_TO_TOPRIGHT,
/** Region located at the bottom, _top_ edge is action zone.
* Region minimized to the bottom right */
AE_TOP_TO_BOTTOMRIGHT,
/** Region located at the top, _bottom_ edge is action zone.
* Region minimized to the top left */
AE_BOTTOM_TO_TOPLEFT
} AZEdge; } AZEdge;
/* for editing areas/regions */ /* for editing areas/regions */

@ -61,9 +61,12 @@ enum {
/* mode flags: */ /* mode flags: */
enum { enum {
TM_ALL_JOINTS = (1 << 0), /* all joints (for bones only) */ /** all joints (for bones only) */
TM_SKIP_HANDLES = (1 << 1), /* skip handles when control point is selected (for curves only) */ TM_ALL_JOINTS = (1 << 0),
TM_CALC_NORMALS = (1 << 2), /* fill in normals when available */ /** skip handles when control point is selected (for curves only) */
TM_SKIP_HANDLES = (1 << 1),
/** fill in normals when available */
TM_CALC_NORMALS = (1 << 2),
}; };
enum { enum {

@ -123,11 +123,16 @@ void ED_view3d_depth_tag_update(struct RegionView3D *rv3d);
/* return values for ED_view3d_project_...() */ /* return values for ED_view3d_project_...() */
typedef enum { typedef enum {
V3D_PROJ_RET_OK = 0, V3D_PROJ_RET_OK = 0,
V3D_PROJ_RET_CLIP_NEAR = 1, /* can't avoid this when in perspective mode, (can't avoid) */ /** can't avoid this when in perspective mode, (can't avoid) */
V3D_PROJ_RET_CLIP_ZERO = 2, /* so close to zero we can't apply a perspective matrix usefully */ V3D_PROJ_RET_CLIP_NEAR = 1,
V3D_PROJ_RET_CLIP_BB = 3, /* bounding box clip - RV3D_CLIPPING */ /** so close to zero we can't apply a perspective matrix usefully */
V3D_PROJ_RET_CLIP_WIN = 4, /* outside window bounds */ V3D_PROJ_RET_CLIP_ZERO = 2,
V3D_PROJ_RET_OVERFLOW = 5 /* outside range (mainly for short), (can't avoid) */ /** bounding box clip - RV3D_CLIPPING */
V3D_PROJ_RET_CLIP_BB = 3,
/** outside window bounds */
V3D_PROJ_RET_CLIP_WIN = 4,
/** outside range (mainly for short), (can't avoid) */
V3D_PROJ_RET_OVERFLOW = 5
} eV3DProjStatus; } eV3DProjStatus;
/* some clipping tests are optional */ /* some clipping tests are optional */

@ -439,7 +439,9 @@ typedef void (*uiBlockCancelFunc)(struct bContext *C, void *arg1);
void UI_popup_block_invoke(struct bContext *C, uiBlockCreateFunc func, void *arg); void UI_popup_block_invoke(struct bContext *C, uiBlockCreateFunc func, void *arg);
void UI_popup_block_invoke_ex(struct bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext); void UI_popup_block_invoke_ex(struct bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext);
void UI_popup_block_ex(struct bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg, struct wmOperator *op); void UI_popup_block_ex(struct bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg, struct wmOperator *op);
/* void uiPupBlockOperator(struct bContext *C, uiBlockCreateFunc func, struct wmOperator *op, int opcontext); */ /* UNUSED */ #if 0 /* UNUSED */
void uiPupBlockOperator(struct bContext *C, uiBlockCreateFunc func, struct wmOperator *op, int opcontext);
#endif
void UI_popup_block_close(struct bContext *C, struct wmWindow *win, uiBlock *block); void UI_popup_block_close(struct bContext *C, struct wmWindow *win, uiBlock *block);

@ -150,7 +150,8 @@ void ui_block_to_window_rctf(const ARegion *ar, uiBlock *block, rctf *rct_dst, c
ui_block_to_window_fl(ar, block, &rct_dst->xmax, &rct_dst->ymax); ui_block_to_window_fl(ar, block, &rct_dst->xmax, &rct_dst->ymax);
} }
void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y) /* for mouse cursor */ /* for mouse cursor */
void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y)
{ {
float a, b, c, d, e, f, px, py; float a, b, c, d, e, f, px, py;
int sx, sy, getsizex, getsizey; int sx, sy, getsizex, getsizey;
@ -413,7 +414,8 @@ static void ui_block_bounds_calc_popup(
ui_block_bounds_calc(block); ui_block_bounds_calc(block);
/* If given, adjust input coordinates such that they would generate real final popup position. /* If given, adjust input coordinates such that they would generate real final popup position.
* Needed to handle correctly floating panels once they have been dragged around, see T52999. */ * Needed to handle correctly floating panels once they have been dragged around,
* see T52999. */
if (r_xy) { if (r_xy) {
r_xy[0] = xy[0] + block->rect.xmin - raw_x; r_xy[0] = xy[0] + block->rect.xmin - raw_x;
r_xy[1] = xy[1] + block->rect.ymin - raw_y; r_xy[1] = xy[1] + block->rect.ymin - raw_y;
@ -1950,7 +1952,8 @@ void ui_but_value_set(uiBut *but, double value)
case PROP_ENUM: case PROP_ENUM:
if (RNA_property_flag(prop) & PROP_ENUM_FLAG) { if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
int ivalue = (int)value; int ivalue = (int)value;
ivalue ^= RNA_property_enum_get(&but->rnapoin, prop); /* toggle for enum/flag buttons */ /* toggle for enum/flag buttons */
ivalue ^= RNA_property_enum_get(&but->rnapoin, prop);
RNA_property_enum_set(&but->rnapoin, prop, ivalue); RNA_property_enum_set(&but->rnapoin, prop, ivalue);
} }
else { else {
@ -2155,7 +2158,8 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
{ {
int unit_type = RNA_SUBTYPE_UNIT_VALUE(UI_but_unit_type_get(but)); int unit_type = RNA_SUBTYPE_UNIT_VALUE(UI_but_unit_type_get(but));
const double step_orig = step_default * UI_PRECISION_FLOAT_SCALE; const double step_orig = step_default * UI_PRECISION_FLOAT_SCALE;
/* Scaling up 'step_origg ' here is a bit arbitrary, its just giving better scales from user POV */ /* Scaling up 'step_origg ' here is a bit arbitrary,
* its just giving better scales from user POV */
const double scale_step = ui_get_but_scale_unit(but, step_orig * 10); const double scale_step = ui_get_but_scale_unit(but, step_orig * 10);
const double step = bUnit_ClosestScalar(scale_step, but->block->unit->system, unit_type); const double step = bUnit_ClosestScalar(scale_step, but->block->unit->system, unit_type);
@ -2385,7 +2389,8 @@ bool ui_but_string_set_eval_num(bContext *C, uiBut *but, const char *str, double
bool is_unit_but = (ui_but_is_float(but) && ui_but_is_unit(but)); 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 */ /* only enable verbose if we won't run again with units */
if (BPY_execute_string_as_number(C, NULL, 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 the value parsed ok without unit conversion
* this button may still need a unit multiplier */
if (is_unit_but) { if (is_unit_but) {
char str_new[128]; char str_new[128];
@ -3415,7 +3420,8 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
uiItemL(column, item->name, item->icon); uiItemL(column, item->name, item->icon);
} }
else { else {
/* Do not use uiItemL here, as our root layout is a menu one, it will add a fake blank icon! */ /* Do not use uiItemL here, as our root layout is a menu one,
* it will add a fake blank icon! */
uiDefBut(block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); uiDefBut(block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
} }
} }
@ -4441,7 +4447,8 @@ void UI_but_func_search_set(
uiButSearchFunc search_func, void *arg, uiButSearchFunc search_func, void *arg,
uiButHandleFunc bfunc, void *active) uiButHandleFunc bfunc, void *active)
{ {
/* needed since callers don't have access to internal functions (as an alternative we could expose it) */ /* needed since callers don't have access to internal functions
* (as an alternative we could expose it) */
if (search_create_func == NULL) { if (search_create_func == NULL) {
search_create_func = ui_searchbox_create_generic; search_create_func = ui_searchbox_create_generic;
} }
@ -4490,7 +4497,8 @@ static void operator_enum_search_cb(const struct bContext *C, void *but, const c
RNA_property_enum_items_gettexted((bContext *)C, ptr, prop, &item_array, NULL, &do_free); RNA_property_enum_items_gettexted((bContext *)C, ptr, prop, &item_array, NULL, &do_free);
for (item = item_array; item->identifier; item++) { for (item = item_array; item->identifier; item++) {
/* note: need to give the index rather than the identifier because the enum can be freed */ /* note: need to give the index rather than the
* identifier because the enum can be freed */
if (BLI_strcasestr(item->name, str)) { if (BLI_strcasestr(item->name, str)) {
if (false == UI_search_item_add(items, item->name, POINTER_FROM_INT(item->value), 0)) if (false == UI_search_item_add(items, item->name, POINTER_FROM_INT(item->value), 0))
break; break;

@ -42,22 +42,25 @@
#ifdef USE_UIBUT_SPATIAL_ALIGN #ifdef USE_UIBUT_SPATIAL_ALIGN
/** /**
* This struct stores a (simplified) 2D representation of all buttons of a same align group, with their * This struct stores a (simplified) 2D representation of all buttons of a same align group,
* immediate neighbors (if found), and needed value to compute 'stitching' of aligned buttons. * with their immediate neighbors (if found),
* and needed value to compute 'stitching' of aligned buttons.
* *
* \note This simplistic struct cannot fully represent complex layouts where buttons share some 'align space' with * \note This simplistic struct cannot fully represent complex layouts where buttons share some
* several others (see schema below), we'd need linked list and more complex code to handle that. * 'align space' with several others (see schema below), we'd need linked list and more
* However, looks like we can do without that for now, which is rather lucky! * complex code to handle that. However, looks like we can do without that for now,
* which is rather lucky!
* *
* <pre> * <pre>
* +-----------+-----------+ * +--------+-------+
* | BUT 1 | BUT 2 | BUT 3 has two 'top' neighbors... * | BUT 1 | BUT 2 | BUT 3 has two 'top' neighbors...
* |-----------------------| => In practice, we only store one of BUT 1 or 2 (which ones is not * |----------------| => In practice, we only store one of BUT 1 or 2 (which ones is not
* | BUT 3 | really deterministic), and assume the other stores a ref to BUT 3. * | BUT 3 | really deterministic), and assume the other stores a ref to BUT 3.
* +-----------------------+ * +----------------+
* </pre> * </pre>
* *
* This will probably not work in all possible cases, but not sure we want to support such exotic cases anyway. * This will probably not work in all possible cases,
* but not sure we want to support such exotic cases anyway.
*/ */
typedef struct ButAlign { typedef struct ButAlign {
uiBut *but; uiBut *but;
@ -71,13 +74,15 @@ typedef struct ButAlign {
/* Distances to the neighbors. */ /* Distances to the neighbors. */
float dists[4]; float dists[4];
/* Flags, used to mark whether we should 'stitch' the corners of this button with its neighbors' ones. */ /* Flags, used to mark whether we should 'stitch'
* the corners of this button with its neighbors' ones. */
char flags[4]; char flags[4];
} ButAlign; } ButAlign;
/* Side-related enums and flags. */ /* Side-related enums and flags. */
enum { enum {
/* Sides (used as indices, order is **crucial**, this allows us to factorize code in a loop over the four sides). */ /* Sides (used as indices, order is **crucial**,
* this allows us to factorize code in a loop over the four sides). */
LEFT = 0, LEFT = 0,
TOP = 1, TOP = 1,
RIGHT = 2, RIGHT = 2,
@ -146,14 +151,17 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
} }
for (side = 0; side < RIGHT; side++) { for (side = 0; side < RIGHT; side++) {
/* We are only interested in buttons which share a same line (LEFT/RIGHT sides) or column (TOP/DOWN sides). */ /* We are only interested in buttons which share a same line
* (LEFT/RIGHT sides) or column (TOP/DOWN sides). */
if (buts_share[IS_COLUMN(side)]) { if (buts_share[IS_COLUMN(side)]) {
side_opp = OPPOSITE(side); side_opp = OPPOSITE(side);
/* We check both opposite sides at once, because with very small buttons, delta could be below max_delta for /* We check both opposite sides at once, because with very small buttons,
* the wrong side (that is, in horizontal case, the total width of two buttons can be below max_delta). * delta could be below max_delta for the wrong side
* We rely on exact zero value here as an 'already processed' flag, so ensure we never actually * (that is, in horizontal case, the total width of two buttons can be below max_delta).
* set a zero value at this stage. FLT_MIN is zero-enough for UI position computing. ;) */ * We rely on exact zero value here as an 'already processed' flag,
* so ensure we never actually set a zero value at this stage.
* FLT_MIN is zero-enough for UI position computing. ;) */
delta = max_ff(fabsf(*butal->borders[side] - *butal_other->borders[side_opp]), FLT_MIN); delta = max_ff(fabsf(*butal->borders[side] - *butal_other->borders[side_opp]), FLT_MIN);
delta_side_opp = max_ff(fabsf(*butal->borders[side_opp] - *butal_other->borders[side]), FLT_MIN); delta_side_opp = max_ff(fabsf(*butal->borders[side_opp] - *butal_other->borders[side]), FLT_MIN);
if (delta_side_opp < delta) { if (delta_side_opp < delta) {
@ -162,18 +170,21 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
} }
if (delta < max_delta) { if (delta < max_delta) {
/* We are only interested in neighbors that are at least as close as already found ones. */ /* We are only interested in neighbors that are
* at least as close as already found ones. */
if (delta <= butal->dists[side]) { if (delta <= butal->dists[side]) {
{ {
/* We found an as close or closer neighbor. /* We found an as close or closer neighbor.
* If both buttons are alignable, we set them as each other neighbors. * If both buttons are alignable, we set them as each other neighbors.
* Else, we have an unalignable one, we need to reset the others matching neighbor to NULL * Else, we have an unalignable one, we need to reset the others matching
* if its 'proximity distance' is really lower with current one. * neighbor to NULL if its 'proximity distance'
* is really lower with current one.
* *
* NOTE: We cannot only execute that piece of code in case we found a **closer** neighbor, * NOTE: We cannot only execute that piece of code in case we found a
* due to the limited way we represent neighbors (buttons only know **one** neighbor * **closer** neighbor, due to the limited way we represent neighbors
* on each side, when they can actually have several ones), it would prevent * (buttons only know **one** neighbor on each side, when they can
* some buttons to be properly 'neighborly-initialized'. */ * actually have several ones), it would prevent some buttons to be
* properly 'neighborly-initialized'. */
if (butal_can_align && butal_other_can_align) { if (butal_can_align && butal_other_can_align) {
butal->neighbors[side] = butal_other; butal->neighbors[side] = butal_other;
butal_other->neighbors[side_opp] = butal; butal_other->neighbors[side_opp] = butal;
@ -201,10 +212,12 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
butal_other->neighbors[side_opp] = butal; butal_other->neighbors[side_opp] = butal;
} }
/* We have a pair of neighbors, we have to check whether we can stitch their matching corners. /* We have a pair of neighbors, we have to check whether we
* can stitch their matching corners.
* E.g. if butal_other is on the left of butal (that is, side == LEFT), * E.g. if butal_other is on the left of butal (that is, side == LEFT),
* if both TOP (side_s1) coordinates of buttons are close enough, we can stitch * if both TOP (side_s1) coordinates of buttons are close enough,
* their upper matching corners, and same for DOWN (side_s2) side. */ * we can stitch their upper matching corners,
* and same for DOWN (side_s2) side. */
delta = fabsf(*butal->borders[side_s1] - *butal_other->borders[side_s1]); delta = fabsf(*butal->borders[side_s1] - *butal_other->borders[side_s1]);
if (delta < max_delta) { if (delta < max_delta) {
butal->flags[side_s1] |= stitch; butal->flags[side_s1] |= stitch;
@ -217,7 +230,8 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
} }
} }
} }
/* We assume two buttons can only share one side at most - for until we have sperical UI... */ /* We assume two buttons can only share one side at most - for until
* we have sperical UI... */
return; return;
} }
} }
@ -313,9 +327,10 @@ static int ui_block_align_butal_cmp(const void *a, const void *b)
return (*butal->borders[LEFT] > *butal_other->borders[LEFT]) ? 1 : -1; return (*butal->borders[LEFT] > *butal_other->borders[LEFT]) ? 1 : -1;
} }
/* XXX We cannot actually assert here, since in some very compressed space cases, stupid UI code produces /* XXX We cannot actually assert here, since in some very compressed space cases,
* widgets which have the same TOP and LEFT positions... * stupid UI code produces widgets which have the same TOP and LEFT positions...
* We do not care really, because this happens when UI is way too small to be usable anyway. */ * We do not care really,
* because this happens when UI is way too small to be usable anyway. */
/* BLI_assert(0); */ /* BLI_assert(0); */
return 0; return 0;
} }
@ -370,27 +385,29 @@ void ui_block_align_calc(uiBlock *block)
} }
/* This will give us ButAlign items regrouped by align group, vertical and horizontal location. /* This will give us ButAlign items regrouped by align group, vertical and horizontal location.
* Note that, given how buttons are defined in UI code, butal_array shall already be "nearly sorted"... */ * Note that, given how buttons are defined in UI code,
* butal_array shall already be "nearly sorted"... */
qsort(butal_array, (size_t)num_buttons, sizeof(*butal_array), ui_block_align_butal_cmp); qsort(butal_array, (size_t)num_buttons, sizeof(*butal_array), ui_block_align_butal_cmp);
/* Third loop: for each pair of buttons in the same align group, we compute their potential proximity. /* Third loop: for each pair of buttons in the same align group,
* Note that each pair is checked only once, and that we break early in case we know all remaining pairs will * we compute their potential proximity. Note that each pair is checked only once, and that we
* always be too far away. */ * break early in case we know all remaining pairs will always be too far away. */
for (i = 0, butal = butal_array; i < num_buttons; i++, butal++) { for (i = 0, butal = butal_array; i < num_buttons; i++, butal++) {
const short alignnr = butal->but->alignnr; const short alignnr = butal->but->alignnr;
for (j = i + 1, butal_other = &butal_array[i + 1]; j < num_buttons; j++, butal_other++) { for (j = i + 1, butal_other = &butal_array[i + 1]; j < num_buttons; j++, butal_other++) {
const float max_delta = MAX_DELTA; const float max_delta = MAX_DELTA;
/* Since they are sorted, buttons after current butal can only be of same or higher group, and once /* Since they are sorted, buttons after current butal can only be of same or higher
* they are not of same group, we know we can break this sub-loop and start checking with next butal. */ * group, and once they are not of same group, we know we can break this sub-loop and
* start checking with next butal. */
if (butal_other->but->alignnr != alignnr) { if (butal_other->but->alignnr != alignnr) {
break; break;
} }
/* Since they are sorted vertically first, buttons after current butal can only be at same or lower height, /* Since they are sorted vertically first, buttons after current butal can only be at
* and once they are lower than a given threshold, we know we can break this sub-loop and * same or lower height, and once they are lower than a given threshold, we know we can
* start checking with next butal. */ * break this sub-loop and start checking with next butal. */
if ((*butal->borders[DOWN] - *butal_other->borders[TOP]) > max_delta) { if ((*butal->borders[DOWN] - *butal_other->borders[TOP]) > max_delta) {
break; break;
} }

@ -183,7 +183,8 @@ bool ui_but_anim_expression_create(uiBut *but, const char *str)
} }
/* make sure we have animdata for this */ /* make sure we have animdata for this */
/* FIXME: until materials can be handled by depsgraph, don't allow drivers to be created for them */ /* FIXME: until materials can be handled by depsgraph,
* don't allow drivers to be created for them */
id = (ID *)but->rnapoin.id.data; id = (ID *)but->rnapoin.id.data;
if ((id == NULL) || (GS(id->name) == ID_MA) || (GS(id->name) == ID_TE)) { if ((id == NULL) || (GS(id->name) == ID_MA) || (GS(id->name) == ID_TE)) {
if (G.debug & G_DEBUG) if (G.debug & G_DEBUG)

@ -52,7 +52,8 @@
#include "WM_api.h" #include "WM_api.h"
#include "WM_types.h" #include "WM_types.h"
/* This hack is needed because we don't have a good way to re-reference keymap items once added: T42944 */ /* This hack is needed because we don't have a good way to
* re-reference keymap items once added: T42944 */
#define USE_KEYMAP_ADD_HACK #define USE_KEYMAP_ADD_HACK
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
@ -130,7 +131,8 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
IDProperty *prop = (but->opptr) ? but->opptr->data : NULL; IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
int kmi_id; int kmi_id;
/* XXX this guess_opname can potentially return a different keymap than being found on adding later... */ /* XXX this guess_opname can potentially return a different keymap
* than being found on adding later... */
km = WM_keymap_guess_opname(C, but->optype->idname); km = WM_keymap_guess_opname(C, but->optype->idname);
kmi = WM_keymap_add_item(km, but->optype->idname, AKEY, KM_PRESS, 0, 0); kmi = WM_keymap_add_item(km, but->optype->idname, AKEY, KM_PRESS, 0, 0);
kmi_id = kmi->id; kmi_id = kmi->id;
@ -277,7 +279,8 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
/*bool is_idprop = RNA_property_is_idprop(prop);*/ /* XXX does not work as expected, not strictly needed */ /*bool is_idprop = RNA_property_is_idprop(prop);*/ /* XXX does not work as expected, not strictly needed */
bool is_set = RNA_property_is_set(ptr, prop); bool is_set = RNA_property_is_set(ptr, prop);
/* second slower test, saved people finding keyframe items in menus when its not possible */ /* second slower test,
* saved people finding keyframe items in menus when its not possible */
if (is_anim) if (is_anim)
is_anim = RNA_property_path_from_ID_check(&but->rnapoin, but->rnaprop); is_anim = RNA_property_path_from_ID_check(&but->rnapoin, but->rnaprop);

@ -630,7 +630,8 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
GLint scissor[4]; GLint scissor[4];
float colors[3][3]; float colors[3][3];
float colorsycc[3][3] = {{1, 0, 1}, {1, 1, 0}, {0, 1, 1}}; float colorsycc[3][3] = {{1, 0, 1}, {1, 1, 0}, {0, 1, 1}};
float colors_alpha[3][3], colorsycc_alpha[3][3]; /* colors pre multiplied by alpha for speed up */ /* colors pre multiplied by alpha for speed up */
float colors_alpha[3][3], colorsycc_alpha[3][3];
float min, max; float min, max;
if (scopes == NULL) return; if (scopes == NULL) return;

@ -114,7 +114,8 @@ static int datadropper_init(bContext *C, wmOperator *op)
type = RNA_property_pointer_type(&ddr->ptr, ddr->prop); type = RNA_property_pointer_type(&ddr->ptr, ddr->prop);
ddr->idcode = RNA_type_to_ID_code(type); ddr->idcode = RNA_type_to_ID_code(type);
BLI_assert(ddr->idcode != 0); BLI_assert(ddr->idcode != 0);
/* Note we can translate here (instead of on draw time), because this struct has very short lifetime. */ /* Note we can translate here (instead of on draw time),
* because this struct has very short lifetime. */
ddr->idcode_name = TIP_(BKE_idcode_to_name(ddr->idcode)); ddr->idcode_name = TIP_(BKE_idcode_to_name(ddr->idcode));
PointerRNA ptr = RNA_property_pointer_get(&ddr->ptr, ddr->prop); PointerRNA ptr = RNA_property_pointer_get(&ddr->ptr, ddr->prop);

@ -232,10 +232,14 @@ typedef struct uiButMultiState {
typedef struct uiHandleButtonMulti { typedef struct uiHandleButtonMulti {
enum { enum {
BUTTON_MULTI_INIT_UNSET = 0, /* gesture direction unknown, wait until mouse has moved enough... */ /** gesture direction unknown, wait until mouse has moved enough... */
BUTTON_MULTI_INIT_SETUP, /* vertical gesture detected, flag buttons interactively (UI_BUT_DRAG_MULTI) */ BUTTON_MULTI_INIT_UNSET = 0,
BUTTON_MULTI_INIT_ENABLE, /* flag buttons finished, apply horizontal motion to active and flagged */ /** vertical gesture detected, flag buttons interactively (UI_BUT_DRAG_MULTI) */
BUTTON_MULTI_INIT_DISABLE, /* vertical gesture _not_ detected, take no further action */ BUTTON_MULTI_INIT_SETUP,
/** flag buttons finished, apply horizontal motion to active and flagged */
BUTTON_MULTI_INIT_ENABLE,
/** vertical gesture _not_ detected, take no further action */
BUTTON_MULTI_INIT_DISABLE,
} init; } init;
bool has_mbuts; /* any buttons flagged UI_BUT_DRAG_MULTI */ bool has_mbuts; /* any buttons flagged UI_BUT_DRAG_MULTI */
@ -244,11 +248,12 @@ typedef struct uiHandleButtonMulti {
bool is_proportional; bool is_proportional;
/* In some cases we directly apply the changes to multiple buttons, so we don't want to do it twice. */ /* In some cases we directly apply the changes to multiple buttons,
* so we don't want to do it twice. */
bool skip; bool skip;
/* before activating, we need to check gesture direction /* before activating, we need to check gesture direction accumulate signed cursor movement
* accumulate signed cursor movement here so we can tell if this is a vertical motion or not. */ * here so we can tell if this is a vertical motion or not. */
float drag_dir[2]; float drag_dir[2];
/* values copied direct from event->x,y /* values copied direct from event->x,y
@ -325,8 +330,10 @@ typedef struct uiHandleButtonData {
CBData *dragcbd; CBData *dragcbd;
#ifdef USE_CONT_MOUSE_CORRECT #ifdef USE_CONT_MOUSE_CORRECT
/* when ungrabbing buttons which are #ui_but_is_cursor_warp(), we may want to position them /* when ungrabbing buttons which are #ui_but_is_cursor_warp(),
* FLT_MAX signifies do-nothing, use #ui_block_to_window_fl() to get this into a usable space */ * we may want to position them.
* FLT_MAX signifies do-nothing, use #ui_block_to_window_fl()
* to get this into a usable space. */
float ungrab_mval[2]; float ungrab_mval[2];
#endif #endif
@ -1319,7 +1326,8 @@ static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const
BLI_rctf_cent_y(&but->rect), BLI_rctf_cent_y(&but->rect),
}; };
/* check if this is a different button, chances are high the button wont move about :) */ /* check if this is a different button,
* chances are high the button wont move about :) */
if (len_manhattan_v2v2(drag_info->but_cent_start, but_cent_new) > 1.0f) { if (len_manhattan_v2v2(drag_info->but_cent_start, but_cent_new) > 1.0f) {
if (fabsf(drag_info->but_cent_start[0] - but_cent_new[0]) < if (fabsf(drag_info->but_cent_start[0] - but_cent_new[0]) <
fabsf(drag_info->but_cent_start[1] - but_cent_new[1])) fabsf(drag_info->but_cent_start[1] - but_cent_new[1]))
@ -1580,18 +1588,22 @@ static void ui_selectcontext_apply(
RNA_property_int_range(&but->rnapoin, prop, &min.i, &max.i); RNA_property_int_range(&but->rnapoin, prop, &min.i, &max.i);
} }
else if (rna_type == PROP_ENUM) { else if (rna_type == PROP_ENUM) {
delta.i = RNA_property_enum_get(&but->rnapoin, prop); /* not a delta infact */ /* not a delta infact */
delta.i = RNA_property_enum_get(&but->rnapoin, prop);
} }
else if (rna_type == PROP_BOOLEAN) { else if (rna_type == PROP_BOOLEAN) {
if (is_array) { if (is_array) {
delta.b = RNA_property_boolean_get_index(&but->rnapoin, prop, index); /* not a delta infact */ /* not a delta infact */
delta.b = RNA_property_boolean_get_index(&but->rnapoin, prop, index);
} }
else { else {
delta.b = RNA_property_boolean_get(&but->rnapoin, prop); /* not a delta infact */ /* not a delta infact */
delta.b = RNA_property_boolean_get(&but->rnapoin, prop);
} }
} }
else if (rna_type == PROP_POINTER) { else if (rna_type == PROP_POINTER) {
delta.p = RNA_property_pointer_get(&but->rnapoin, prop); /* not a delta infact */ /* not a delta infact */
delta.p = RNA_property_pointer_get(&but->rnapoin, prop);
} }
#ifdef USE_ALLSELECT_LAYER_HACK #ifdef USE_ALLSELECT_LAYER_HACK
@ -3302,7 +3314,8 @@ static void ui_do_but_textedit(
{ {
bool had_selection = but->selsta != but->selend; bool had_selection = but->selsta != but->selend;
/* exit on LMB only on RELEASE for searchbox, to mimic other popups, and allow multiple menu levels */ /* exit on LMB only on RELEASE for searchbox, to mimic other popups,
* and allow multiple menu levels */
if (data->searchbox) if (data->searchbox)
inbox = ui_searchbox_inside(data->searchbox, event->x, event->y); inbox = ui_searchbox_inside(data->searchbox, event->x, event->y);
@ -3340,7 +3353,8 @@ static void ui_do_but_textedit(
changed = true; changed = true;
} }
else if (inbox) { else if (inbox) {
/* if we allow activation on key press, it gives problems launching operators [#35713] */ /* if we allow activation on key press,
* it gives problems launching operators T35713. */
if (event->val == KM_RELEASE) { if (event->val == KM_RELEASE) {
button_activate_state(C, but, BUTTON_STATE_EXIT); button_activate_state(C, but, BUTTON_STATE_EXIT);
retval = WM_UI_HANDLER_BREAK; retval = WM_UI_HANDLER_BREAK;
@ -3788,7 +3802,8 @@ static bool ui_do_but_ANY_drag_toggle(
} }
} }
else if (data->state == BUTTON_STATE_WAIT_DRAG) { else if (data->state == BUTTON_STATE_WAIT_DRAG) {
/* note: the 'BUTTON_STATE_WAIT_DRAG' part of 'ui_do_but_EXIT' could be refactored into its own function */ /* note: the 'BUTTON_STATE_WAIT_DRAG' part of 'ui_do_but_EXIT' could be refactored into
* its own function */
data->applied = false; data->applied = false;
*r_retval = ui_do_but_EXIT(C, but, data, event); *r_retval = ui_do_but_EXIT(C, but, data, event);
return true; return true;
@ -4304,7 +4319,8 @@ static bool ui_numedit_but_NUM(
float non_linear_pixel_map; float non_linear_pixel_map;
float non_linear_scale; float non_linear_scale;
/* Use a non-linear mapping of the mouse drag especially for large floats (normal behavior) */ /* Use a non-linear mapping of the mouse drag especially for large floats
* (normal behavior) */
deler = 500; deler = 500;
if (is_float) { if (is_float) {
/* not needed for smaller float buttons */ /* not needed for smaller float buttons */
@ -4397,8 +4413,10 @@ static int ui_do_but_NUM(
} }
/* XXX hardcoded keymap check.... */ /* XXX hardcoded keymap check.... */
if (type == MOUSEPAN && event->alt) if (type == MOUSEPAN && event->alt) {
retval = WM_UI_HANDLER_BREAK; /* allow accumulating values, otherwise scrolling gets preference */ /* allow accumulating values, otherwise scrolling gets preference */
retval = WM_UI_HANDLER_BREAK;
}
else if (type == WHEELDOWNMOUSE && event->ctrl) { else if (type == WHEELDOWNMOUSE && event->ctrl) {
mx = but->rect.xmin; mx = but->rect.xmin;
click = 1; click = 1;
@ -4698,8 +4716,10 @@ static int ui_do_but_SLI(
} }
/* XXX hardcoded keymap check.... */ /* XXX hardcoded keymap check.... */
if (type == MOUSEPAN && event->alt) if (type == MOUSEPAN && event->alt) {
retval = WM_UI_HANDLER_BREAK; /* allow accumulating values, otherwise scrolling gets preference */ /* allow accumulating values, otherwise scrolling gets preference */
retval = WM_UI_HANDLER_BREAK;
}
else if (type == WHEELDOWNMOUSE && event->ctrl) { else if (type == WHEELDOWNMOUSE && event->ctrl) {
mx = but->rect.xmin; mx = but->rect.xmin;
click = 2; click = 2;
@ -4714,7 +4734,8 @@ static int ui_do_but_SLI(
retval = WM_UI_HANDLER_BREAK; retval = WM_UI_HANDLER_BREAK;
} }
#ifndef USE_ALLSELECT #ifndef USE_ALLSELECT
/* alt-click on sides to get "arrows" like in UI_BTYPE_NUM buttons, and match wheel usage above */ /* alt-click on sides to get "arrows" like in UI_BTYPE_NUM buttons,
* and match wheel usage above */
else if (event->type == LEFTMOUSE && event->alt) { else if (event->type == LEFTMOUSE && event->alt) {
int halfpos = BLI_rctf_cent_x(&but->rect); int halfpos = BLI_rctf_cent_x(&but->rect);
click = 2; click = 2;
@ -4819,7 +4840,8 @@ static int ui_do_but_SLI(
#if 0 #if 0
if (but->type == SLI) { if (but->type == SLI) {
f = (float)(mx - but->rect.xmin) / (BLI_rctf_size_x(&but->rect)); /* same as below */ /* same as below */
f = (float)(mx - but->rect.xmin) / (BLI_rctf_size_x(&but->rect));
} }
else else
#endif #endif
@ -6075,7 +6097,8 @@ static bool ui_numedit_but_CURVE(
int a; int a;
bool changed = false; bool changed = false;
/* evtx evty and drag coords are absolute mousecoords, prevents errors when editing when layout changes */ /* evtx evty and drag coords are absolute mousecoords,
* prevents errors when editing when layout changes */
mx = evtx; mx = evtx;
my = evty; my = evty;
ui_window_to_block(data->region, block, &mx, &my); ui_window_to_block(data->region, block, &mx, &my);
@ -6243,7 +6266,8 @@ static int ui_do_but_CURVE(
changed = true; changed = true;
/* reset cmp back to the curve points again, rather than drawing segments */ /* reset cmp back to the curve points again,
* rather than drawing segments */
cmp = cuma->curve; cmp = cuma->curve;
/* find newly added point and make it 'sel' */ /* find newly added point and make it 'sel' */
@ -7173,7 +7197,8 @@ void UI_but_tooltip_refresh(bContext *C, uiBut *but)
} }
} }
/* removes tooltip timer from active but (meaning tooltip is disabled until it's reenabled again) */ /* removes tooltip timer from active but
* (meaning tooltip is disabled until it's reenabled again) */
void UI_but_tooltip_timer_remove(bContext *C, uiBut *but) void UI_but_tooltip_timer_remove(bContext *C, uiBut *but)
{ {
uiHandleButtonData *data; uiHandleButtonData *data;
@ -7916,7 +7941,8 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
uiBut *but_other = ui_but_find_mouse_over(ar, event); uiBut *but_other = ui_but_find_mouse_over(ar, event);
bool exit = false; bool exit = false;
/* always deactivate button for pie menus, else moving to blank space will leave activated */ /* always deactivate button for pie menus,
* else moving to blank space will leave activated */
if ((!ui_block_is_menu(block) || ui_block_is_pie_menu(block)) && if ((!ui_block_is_menu(block) || ui_block_is_pie_menu(block)) &&
!ui_but_contains_point_px(ar, but, event->x, event->y)) !ui_but_contains_point_px(ar, but, event->x, event->y))
{ {
@ -7952,7 +7978,8 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
retval = WM_UI_HANDLER_CONTINUE; retval = WM_UI_HANDLER_CONTINUE;
break; break;
} }
/* XXX hardcoded keymap check... but anyway, while view changes, tooltips should be removed */ /* XXX hardcoded keymap check... but anyway,
* while view changes, tooltips should be removed */
case WHEELUPMOUSE: case WHEELUPMOUSE:
case WHEELDOWNMOUSE: case WHEELDOWNMOUSE:
case MIDDLEMOUSE: case MIDDLEMOUSE:
@ -8182,7 +8209,8 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar,
} }
if (dyn_data->items_filter_neworder || dyn_data->items_filter_flags) { if (dyn_data->items_filter_neworder || dyn_data->items_filter_flags) {
/* If we have a display order different from collection order, we have some work! */ /* If we have a display order different from
* collection order, we have some work! */
int *org_order = MEM_mallocN(dyn_data->items_shown * sizeof(int), __func__); int *org_order = MEM_mallocN(dyn_data->items_shown * sizeof(int), __func__);
const int *new_order = dyn_data->items_filter_neworder; const int *new_order = dyn_data->items_filter_neworder;
int i, org_idx = -1, len = dyn_data->items_len; int i, org_idx = -1, len = dyn_data->items_len;
@ -8970,7 +8998,8 @@ static int ui_handle_menu_event(
} }
} }
else if (ELEM(event->val, KM_RELEASE, KM_CLICK)) { else if (ELEM(event->val, KM_RELEASE, KM_CLICK)) {
/* For buttons that use a hold function, exit when mouse-up outside the menu. */ /* For buttons that use a hold function,
* exit when mouse-up outside the menu. */
if (block->flag & UI_BLOCK_POPUP_HOLD) { if (block->flag & UI_BLOCK_POPUP_HOLD) {
/* Note, we could check the cursor is over the parent button. */ /* Note, we could check the cursor is over the parent button. */
menu->menuretval = UI_RETURN_CANCEL; menu->menuretval = UI_RETURN_CANCEL;
@ -9214,7 +9243,8 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
bool is_click_style; bool is_click_style;
float dist; float dist;
/* we block all events, this is modal interaction, except for drop events which is described below */ /* we block all events, this is modal interaction,
* except for drop events which is described below */
int retval = WM_UI_HANDLER_BREAK; int retval = WM_UI_HANDLER_BREAK;
if (event->type == EVT_DROP) { if (event->type == EVT_DROP) {
@ -9361,7 +9391,8 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
block->pie_data.flags |= UI_PIE_DRAG_STYLE; block->pie_data.flags |= UI_PIE_DRAG_STYLE;
} }
/* here instead, we use the offset location to account for the initial direction timeout */ /* here instead, we use the offset location to account for the initial
* direction timeout */
if ((U.pie_menu_confirm > 0) && if ((U.pie_menu_confirm > 0) &&
(dist >= U.pie_menu_threshold + U.pie_menu_confirm)) (dist >= U.pie_menu_threshold + U.pie_menu_confirm))
{ {
@ -9479,7 +9510,8 @@ static int ui_handle_menus_recursive(
uiBlock *block = menu->region->uiblocks.first; uiBlock *block = menu->region->uiblocks.first;
const bool is_menu = ui_block_is_menu(block); const bool is_menu = ui_block_is_menu(block);
bool inside = false; bool inside = false;
/* root pie menus accept the key that spawned them as double click to improve responsiveness */ /* root pie menus accept the key that spawned
* them as double click to improve responsiveness */
bool do_recursion = (!(block->flag & UI_BLOCK_RADIAL) || event->type != block->pie_data.event); bool do_recursion = (!(block->flag & UI_BLOCK_RADIAL) || event->type != block->pie_data.event);
if (do_recursion) { if (do_recursion) {
@ -9743,7 +9775,8 @@ static int ui_popup_handler(bContext *C, const wmEvent *event, void *userdata)
{ {
uiPopupBlockHandle *menu = userdata; uiPopupBlockHandle *menu = userdata;
struct ARegion *menu_region; struct ARegion *menu_region;
/* we block all events, this is modal interaction, except for drop events which is described below */ /* we block all events, this is modal interaction,
* except for drop events which is described below */
int retval = WM_UI_HANDLER_BREAK; int retval = WM_UI_HANDLER_BREAK;
bool reset_pie = false; bool reset_pie = false;

@ -473,7 +473,10 @@ static void init_internal_icons(void)
if (icondir) { if (icondir) {
BLI_join_dirfile(iconfilestr, sizeof(iconfilestr), icondir, btheme->tui.iconfile); BLI_join_dirfile(iconfilestr, sizeof(iconfilestr), icondir, btheme->tui.iconfile);
bbuf = IMB_loadiffname(iconfilestr, IB_rect, NULL); /* if the image is missing bbuf will just be NULL */
/* if the image is missing bbuf will just be NULL */
bbuf = IMB_loadiffname(iconfilestr, IB_rect, NULL);
if (bbuf && (bbuf->x < ICON_IMAGE_W || bbuf->y < ICON_IMAGE_H)) { if (bbuf && (bbuf->x < ICON_IMAGE_W || bbuf->y < ICON_IMAGE_H)) {
printf("\n***WARNING***\nIcons file %s too small.\nUsing built-in Icons instead\n", iconfilestr); printf("\n***WARNING***\nIcons file %s too small.\nUsing built-in Icons instead\n", iconfilestr);
IMB_freeImBuf(bbuf); IMB_freeImBuf(bbuf);
@ -1142,7 +1145,8 @@ static void icon_draw_size(
static void ui_id_preview_image_render_size( static void ui_id_preview_image_render_size(
const bContext *C, Scene *scene, ID *id, PreviewImage *pi, int size, const bool use_job) const bContext *C, Scene *scene, ID *id, PreviewImage *pi, int size, const bool use_job)
{ {
if (((pi->flag[size] & PRV_CHANGED) || !pi->rect[size])) { /* changed only ever set by dynamic icons */ /* changed only ever set by dynamic icons */
if (((pi->flag[size] & PRV_CHANGED) || !pi->rect[size])) {
/* create the rect if necessary */ /* create the rect if necessary */
icon_set_image(C, scene, id, pi, size, use_job); icon_set_image(C, scene, id, pi, size, use_job);
@ -1155,10 +1159,14 @@ void UI_id_icon_render(const bContext *C, Scene *scene, ID *id, const bool big,
PreviewImage *pi = BKE_previewimg_id_ensure(id); PreviewImage *pi = BKE_previewimg_id_ensure(id);
if (pi) { if (pi) {
if (big) if (big) {
ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_PREVIEW, use_job); /* bigger preview size */ /* bigger preview size */
else ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_PREVIEW, use_job);
ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_ICON, use_job); /* icon size */ }
else {
/* icon size */
ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_ICON, use_job);
}
} }
} }

@ -173,13 +173,20 @@ extern const short ui_radial_dir_to_angle[8];
/* PieMenuData->flags */ /* PieMenuData->flags */
enum { enum {
UI_PIE_DEGREES_RANGE_LARGE = (1 << 0), /* pie menu item collision is detected at 90 degrees */ /** pie menu item collision is detected at 90 degrees */
UI_PIE_INITIAL_DIRECTION = (1 << 1), /* use initial center of pie menu to calculate direction */ UI_PIE_DEGREES_RANGE_LARGE = (1 << 0),
UI_PIE_DRAG_STYLE = (1 << 2), /* pie menu is drag style */ /** use initial center of pie menu to calculate direction */
UI_PIE_INVALID_DIR = (1 << 3), /* mouse not far enough from center position */ UI_PIE_INITIAL_DIRECTION = (1 << 1),
UI_PIE_CLICK_STYLE = (1 << 4), /* pie menu changed to click style, click to confirm */ /** pie menu is drag style */
UI_PIE_ANIMATION_FINISHED = (1 << 5), /* pie animation finished, do not calculate any more motion */ UI_PIE_DRAG_STYLE = (1 << 2),
UI_PIE_GESTURE_END_WAIT = (1 << 6), /* pie gesture selection has been done, now wait for mouse motion to end */ /** mouse not far enough from center position */
UI_PIE_INVALID_DIR = (1 << 3),
/** pie menu changed to click style, click to confirm */
UI_PIE_CLICK_STYLE = (1 << 4),
/** pie animation finished, do not calculate any more motion */
UI_PIE_ANIMATION_FINISHED = (1 << 5),
/** pie gesture selection has been done, now wait for mouse motion to end */
UI_PIE_GESTURE_END_WAIT = (1 << 6),
}; };
#define PIE_CLICK_THRESHOLD_SQ 50.0f #define PIE_CLICK_THRESHOLD_SQ 50.0f
@ -264,7 +271,7 @@ struct uiBut {
void *rename_arg1; void *rename_arg1;
void *rename_orig; void *rename_orig;
/* Run an action when holding the button down. */ /** Run an action when holding the button down. */
uiButHandleHoldFunc hold_func; uiButHandleHoldFunc hold_func;
void *hold_argN; void *hold_argN;
@ -275,7 +282,7 @@ struct uiBut {
uiButToolTipFunc tip_func; uiButToolTipFunc tip_func;
void *tip_argN; void *tip_argN;
/* info on why button is disabled, displayed in tooltip */ /** info on why button is disabled, displayed in tooltip */
const char *disabled_info; const char *disabled_info;
BIFIconID icon; BIFIconID icon;
@ -342,7 +349,7 @@ typedef struct ColorPickerData {
} ColorPickerData; } ColorPickerData;
struct PieMenuData { struct PieMenuData {
/* store title and icon to allow access when pie levels are created */ /** store title and icon to allow access when pie levels are created */
const char *title; const char *title;
int icon; int icon;
@ -352,7 +359,8 @@ struct PieMenuData {
float last_pos[2]; float last_pos[2];
double duration_gesture; double duration_gesture;
int flags; int flags;
int event; /* initial event used to fire the pie menu, store here so we can query for release */ /** initial event used to fire the pie menu, store here so we can query for release */
int event;
float alphafac; float alphafac;
}; };
@ -404,8 +412,10 @@ struct uiBlock {
short alignnr; short alignnr;
char direction; char direction;
char theme_style; /* UI_BLOCK_THEME_STYLE_* */ /** UI_BLOCK_THEME_STYLE_* */
char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied to buttons */ char theme_style;
/** drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied to buttons */
char dt;
bool auto_open; bool auto_open;
char _pad[6]; char _pad[6];
double auto_open_last; double auto_open_last;
@ -413,32 +423,46 @@ struct uiBlock {
const char *lockstr; const char *lockstr;
char lock; char lock;
char active; /* to keep blocks while drawing and free them afterwards */ /** to keep blocks while drawing and free them afterwards */
char tooltipdisabled; /* to avoid tooltip after click */ char active;
char endblock; /* UI_block_end done? */ /** to avoid tooltip after click */
char tooltipdisabled;
/** UI_block_end done? */
char endblock;
eBlockBoundsCalc bounds_type; /* for doing delayed */ /** for doing delayed */
eBlockBoundsCalc bounds_type;
int mx, my; int mx, my;
int bounds, minbounds; /* for doing delayed */ /** for doing delayed */
int bounds, minbounds;
rctf safety; /* pulldowns, to detect outside, can differ per case how it is created */ /** pulldowns, to detect outside, can differ per case how it is created */
ListBase saferct; /* uiSafetyRct list */ rctf safety;
/** uiSafetyRct list */
ListBase saferct;
uiPopupBlockHandle *handle; /* handle */ uiPopupBlockHandle *handle; /* handle */
struct wmOperator *ui_operator; /* use so presets can find the operator, */ /** use so presets can find the operator,
/* across menus and from nested popups which fail for operator context. */ * across menus and from nested popups which fail for operator context. */
struct wmOperator *ui_operator;
void *evil_C; /* XXX hack for dynamic operator enums */ /** XXX hack for dynamic operator enums */
void *evil_C;
struct UnitSettings *unit; /* unit system, used a lot for numeric buttons so include here rather then fetching through the scene every time. */ /** unit system, used a lot for numeric buttons so include here
ColorPickerData color_pickers; /* XXX, only accessed by color picker templates */ * rather then fetching through the scene every time. */
struct UnitSettings *unit;
/** \note only accessed by color picker templates. */
ColorPickerData color_pickers;
bool color_profile; /* color profile for correcting linear colors for display */ bool color_profile; /* color profile for correcting linear colors for display */
char display_device[64]; /* display device name used to display this block, /** display device name used to display this block,
* used by color widgets to transform colors from/to scene linear * used by color widgets to transform colors from/to scene linear
*/ */
char display_device[64];
struct PieMenuData pie_data; struct PieMenuData pie_data;
}; };

@ -1086,7 +1086,8 @@ void uiItemsFullEnumO_items(
but = block->buttons.last; but = block->buttons.last;
} }
else { else {
/* Do not use uiItemL here, as our root layout is a menu one, it will add a fake blank icon! */ /* Do not use uiItemL here, as our root layout is a menu one,
* it will add a fake blank icon! */
but = uiDefBut( but = uiDefBut(
block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL,
0.0, 0.0, 0, 0, ""); 0.0, 0.0, 0, 0, "");
@ -1095,7 +1096,8 @@ void uiItemsFullEnumO_items(
} }
else { else {
if (radial) { if (radial) {
/* invisible dummy button to ensure all items are always at the same position */ /* invisible dummy button to ensure all items are
* always at the same position */
uiItemS(target); uiItemS(target);
} }
else { else {
@ -1812,7 +1814,8 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN
UI_but_func_search_set(but, ui_searchbox_create_generic, rna_search_cb, but, NULL, NULL); UI_but_func_search_set(but, ui_searchbox_create_generic, rna_search_cb, but, NULL, NULL);
} }
else if (but->type == UI_BTYPE_SEARCH_MENU) { else if (but->type == UI_BTYPE_SEARCH_MENU) {
/* In case we fail to find proper searchprop, so other code might have already set but->type to search menu... */ /* In case we fail to find proper searchprop,
* so other code might have already set but->type to search menu... */
but->flag |= UI_BUT_DISABLED; but->flag |= UI_BUT_DISABLED;
} }
} }
@ -1953,7 +1956,8 @@ static uiBut *ui_item_menu(
UI_block_emboss_set(block, UI_EMBOSS); UI_block_emboss_set(block, UI_EMBOSS);
} }
if (ELEM(layout->root->type, UI_LAYOUT_PANEL, UI_LAYOUT_TOOLBAR) || if (ELEM(layout->root->type, UI_LAYOUT_PANEL, UI_LAYOUT_TOOLBAR) ||
(force_menu && layout->root->type != UI_LAYOUT_MENU)) /* We never want a dropdown in menu! */ /* We never want a dropdown in menu! */
(force_menu && layout->root->type != UI_LAYOUT_MENU))
{ {
UI_but_type_set_menu_from_pulldown(but); UI_but_type_set_menu_from_pulldown(but);
} }

@ -461,7 +461,8 @@ bool UI_context_copy_to_selected_list(
} }
else if (GS(id->name) == ID_SCE) { else if (GS(id->name) == ID_SCE) {
/* Sequencer's ID is scene :/ */ /* Sequencer's ID is scene :/ */
/* Try to recursively find an RNA_Sequence ancestor, to handle situations like T41062... */ /* Try to recursively find an RNA_Sequence ancestor,
* to handle situations like T41062... */
if ((*r_path = RNA_path_resolve_from_type_to_property(ptr, prop, &RNA_Sequence)) != NULL) { if ((*r_path = RNA_path_resolve_from_type_to_property(ptr, prop, &RNA_Sequence)) != NULL) {
*r_lb = CTX_data_collection_get(C, "selected_editable_sequences"); *r_lb = CTX_data_collection_get(C, "selected_editable_sequences");
} }

@ -28,7 +28,8 @@
*/ */
/* a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt */ /* a full doc with API notes can be found in
* bf-blender/trunk/blender/doc/guides/interface_API.txt */
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
@ -1619,8 +1620,10 @@ 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 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 int category_tabs_width = round_fl_to_int(UI_PANEL_CATEGORY_MARGIN_WIDTH * zoom);
const float dpi_fac = UI_DPI_FAC; const float dpi_fac = UI_DPI_FAC;
const int tab_v_pad_text = round_fl_to_int((2 + ((px * 3) * dpi_fac)) * zoom); /* padding of tabs around text */ /* padding of tabs around text */
const int tab_v_pad = round_fl_to_int((4 + (2 * px * dpi_fac)) * zoom); /* padding between tabs */ const int tab_v_pad_text = round_fl_to_int((2 + ((px * 3) * dpi_fac)) * zoom);
/* padding between tabs */
const int tab_v_pad = round_fl_to_int((4 + (2 * px * dpi_fac)) * zoom);
const float tab_curve_radius = ((px * 3) * dpi_fac) * zoom; const float tab_curve_radius = ((px * 3) * dpi_fac) * zoom;
const int roundboxtype = UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT; const int roundboxtype = UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT;
bool is_alpha; bool is_alpha;
@ -1873,7 +1876,8 @@ static int ui_handle_panel_category_cycling(const wmEvent *event, ARegion *ar, c
const bool backwards = event->shift; const bool backwards = event->shift;
pc_dyn = backwards ? pc_dyn->prev : pc_dyn->next; pc_dyn = backwards ? pc_dyn->prev : pc_dyn->next;
if (!pc_dyn) { if (!pc_dyn) {
/* proper cyclic behavior, back to first/last category (only used for ctrl+tab) */ /* proper cyclic behavior,
* back to first/last category (only used for ctrl+tab) */
pc_dyn = backwards ? ar->panels_category.last : ar->panels_category.first; pc_dyn = backwards ? ar->panels_category.last : ar->panels_category.first;
} }
} }
@ -1940,10 +1944,13 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar, cons
/* checks for mouse position inside */ /* checks for mouse position inside */
pa = block->panel; pa = block->panel;
if (!pa || pa->paneltab != NULL) if (!pa || pa->paneltab != NULL) {
continue; continue;
if (pa->type && pa->type->flag & PNL_NO_HEADER) /* XXX - accessed freed panels when scripts reload, need to fix. */ }
/* XXX - accessed freed panels when scripts reload, need to fix. */
if (pa->type && pa->type->flag & PNL_NO_HEADER) {
continue; continue;
}
mouse_state = ui_panel_mouse_state_get(block, pa, mx, my); mouse_state = ui_panel_mouse_state_get(block, pa, mx, my);

@ -155,7 +155,8 @@ static void ui_update_color_picker_buts_rgb(
if (block->color_profile) if (block->color_profile)
display = ui_block_cm_display_get(block); display = ui_block_cm_display_get(block);
/* this updates button strings, is hackish... but button pointers are on stack of caller function */ /* this updates button strings,
* is hackish... but button pointers are on stack of caller function */
for (bt = block->buttons.first; bt; bt = bt->next) { for (bt = block->buttons.first; bt; bt = bt->next) {
if (bt->custom_data != cpicker) if (bt->custom_data != cpicker)
continue; continue;

@ -126,7 +126,8 @@ uiPieMenu *UI_pie_menu_begin(struct bContext *C, const char *title, int icon, co
pie->block_radial->puphash = ui_popup_menu_hash(title); pie->block_radial->puphash = ui_popup_menu_hash(title);
pie->block_radial->flag |= UI_BLOCK_RADIAL; pie->block_radial->flag |= UI_BLOCK_RADIAL;
/* if pie is spawned by a left click, release or click event, it is always assumed to be click style */ /* if pie is spawned by a left click, release or click event,
* it is always assumed to be click style */
if (event->type == LEFTMOUSE || ELEM(event->val, KM_RELEASE, KM_CLICK)) { if (event->type == LEFTMOUSE || ELEM(event->val, KM_RELEASE, KM_CLICK)) {
pie->block_radial->pie_data.flags |= UI_PIE_CLICK_STYLE; pie->block_radial->pie_data.flags |= UI_PIE_CLICK_STYLE;
pie->block_radial->pie_data.event = EVENT_NONE; pie->block_radial->pie_data.event = EVENT_NONE;

@ -388,7 +388,8 @@ uiPopupMenu *UI_popup_menu_begin_ex(bContext *C, const char *title, const char *
pup->layout = UI_block_layout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, MENU_PADDING, style); pup->layout = UI_block_layout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, MENU_PADDING, style);
/* note, this intentionally differs from the menu & submenu default because many operators /* note, this intentionally differs from the menu & submenu default because many operators
* use popups like this to select one of their options - where having invoke doesn't make sense */ * use popups like this to select one of their options -
* where having invoke doesn't make sense */
uiLayoutSetOperatorContext(pup->layout, WM_OP_EXEC_REGION_WIN); uiLayoutSetOperatorContext(pup->layout, WM_OP_EXEC_REGION_WIN);
/* create in advance so we can let buttons point to retval already */ /* create in advance so we can let buttons point to retval already */

@ -89,10 +89,14 @@ typedef struct uiSearchboxData {
rcti bbox; rcti bbox;
uiFontStyle fstyle; uiFontStyle fstyle;
uiSearchItems items; uiSearchItems items;
int active; /* index in items array */ /** index in items array */
bool noback; /* when menu opened with enough space for this */ int active;
bool preview; /* draw thumbnail previews, rather than list */ /** when menu opened with enough space for this */
bool use_sep; /* use the UI_SEP_CHAR char for splitting shortcuts (good for operators, bad for data) */ bool noback;
/** draw thumbnail previews, rather than list */
bool preview;
/** use the UI_SEP_CHAR char for splitting shortcuts (good for operators, bad for data) */
bool use_sep;
int prv_rows, prv_cols; int prv_rows, prv_cols;
} uiSearchboxData; } uiSearchboxData;
@ -261,7 +265,8 @@ bool ui_searchbox_apply(uiBut *but, ARegion *ar)
return true; return true;
} }
else if (but->flag & UI_BUT_VALUE_CLEAR) { else if (but->flag & UI_BUT_VALUE_CLEAR) {
/* It is valid for _VALUE_CLEAR flavor to have no active element (it's a valid way to unlink). */ /* It is valid for _VALUE_CLEAR flavor to have no active element
* (it's a valid way to unlink). */
but->editstr[0] = '\0'; but->editstr[0] = '\0';
return true; return true;

@ -510,7 +510,8 @@ void uiStyleInit(void)
} }
#endif #endif
/* XXX, this should be moved into a style, but for now best only load the monospaced font once. */ /* XXX, this should be moved into a style,
* but for now best only load the monospaced font once. */
BLI_assert(blf_mono_font == -1); BLI_assert(blf_mono_font == -1);
if (U.font_path_ui_mono[0]) { if (U.font_path_ui_mono[0]) {
blf_mono_font = BLF_load_unique(U.font_path_ui_mono); blf_mono_font = BLF_load_unique(U.font_path_ui_mono);

@ -813,7 +813,9 @@ void uiTemplateAnyID(
} }
/* Start drawing UI Elements using standard defines */ /* Start drawing UI Elements using standard defines */
split = uiLayoutSplit(layout, 0.33f, false); /* NOTE: split amount here needs to be synced with normal labels */
/* NOTE: split amount here needs to be synced with normal labels */
split = uiLayoutSplit(layout, 0.33f, false);
/* FIRST PART ................................................ */ /* FIRST PART ................................................ */
row = uiLayoutRow(split, false); row = uiLayoutRow(split, false);
@ -831,14 +833,20 @@ void uiTemplateAnyID(
row = uiLayoutRow(split, true); row = uiLayoutRow(split, true);
/* ID-Type Selector - just have a menu of icons */ /* ID-Type Selector - just have a menu of icons */
sub = uiLayoutRow(row, true); /* HACK: special group just for the enum, otherwise we */
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); /* we get ugly layout with text included too... */ /* HACK: special group just for the enum,
* otherwise we get ugly layout with text included too... */
sub = uiLayoutRow(row, true);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
uiItemFullR(sub, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", ICON_NONE); uiItemFullR(sub, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
/* ID-Block Selector - just use pointer widget... */ /* ID-Block Selector - just use pointer widget... */
sub = uiLayoutRow(row, true); /* HACK: special group to counteract the effects of the previous */
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND); /* enum, which now pushes everything too far right */ /* HACK: special group to counteract the effects of the previous enum,
* which now pushes everything too far right. */
sub = uiLayoutRow(row, true);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND);
uiItemFullR(sub, ptr, propID, 0, 0, 0, "", ICON_NONE); uiItemFullR(sub, ptr, propID, 0, 0, 0, "", ICON_NONE);
} }
@ -874,7 +882,8 @@ void uiTemplatePathBuilder(
/* Path (existing string) Widget */ /* Path (existing string) Widget */
uiItemR(row, ptr, propname, 0, text, ICON_RNA); uiItemR(row, ptr, propname, 0, text, ICON_RNA);
/* TODO: attach something to this to make allow searching of nested properties to 'build' the path */ /* TODO: attach something to this to make allow
* searching of nested properties to 'build' the path */
} }
/************************ Modifier Template *************************/ /************************ Modifier Template *************************/
@ -912,7 +921,8 @@ static int modifier_can_delete(ModifierData *md)
return 1; return 1;
} }
/* Check whether Modifier is a simulation or not, this is used for switching to the physics/particles context tab */ /* Check whether Modifier is a simulation or not,
* this is used for switching to the physics/particles context tab */
static int modifier_is_simulation(ModifierData *md) static int modifier_is_simulation(ModifierData *md)
{ {
/* Physic Tab */ /* Physic Tab */
@ -1040,7 +1050,8 @@ static uiLayout *draw_modifier(
UI_block_align_end(block); UI_block_align_end(block);
UI_block_emboss_set(block, UI_EMBOSS_NONE); UI_block_emboss_set(block, UI_EMBOSS_NONE);
/* When Modifier is a simulation, show button to switch to context rather than the delete button. */ /* When Modifier is a simulation,
* show button to switch to context rather than the delete button. */
if (modifier_can_delete(md) && if (modifier_can_delete(md) &&
(!modifier_is_simulation(md) || (!modifier_is_simulation(md) ||
STREQ(scene->r.engine, RE_engine_id_BLENDER_GAME))) STREQ(scene->r.engine, RE_engine_id_BLENDER_GAME)))
@ -2205,7 +2216,8 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v)
rna_update_cb(C, cb_v, NULL); rna_update_cb(C, cb_v, NULL);
} }
/* still unsure how this call evolves... we use labeltype for defining what curve-channels to show */ /* still unsure how this call evolves...
* we use labeltype for defining what curve-channels to show */
static void curvemap_buttons_layout( static void curvemap_buttons_layout(
uiLayout *layout, PointerRNA *ptr, char labeltype, bool levels, uiLayout *layout, PointerRNA *ptr, char labeltype, bool levels,
bool brush, bool neg_slope, RNAUpdateCb *cb) bool brush, bool neg_slope, RNAUpdateCb *cb)
@ -2969,7 +2981,8 @@ static void uilist_prepare(
rows = min_ii(dyn_data->height, maxrows); rows = min_ii(dyn_data->height, maxrows);
} }
/* If list length changes or list is tagged to check this, and active is out of view, scroll to it .*/ /* If list length changes or list is tagged to check this,
* and active is out of view, scroll to it .*/
if (ui_list->list_last_len != len || ui_list->flag & UILST_SCROLL_TO_ACTIVE_ITEM) { if (ui_list->list_last_len != len || ui_list->flag & UILST_SCROLL_TO_ACTIVE_ITEM) {
if (activei_row < ui_list->list_scroll) { if (activei_row < ui_list->list_scroll) {
ui_list->list_scroll = activei_row; ui_list->list_scroll = activei_row;
@ -3595,7 +3608,8 @@ void uiTemplateOperatorPropertyButs(
/* menu */ /* menu */
if (op->type->flag & OPTYPE_PRESET) { if (op->type->flag & OPTYPE_PRESET) {
/* XXX, no simple way to get WM_MT_operator_presets.bl_label from python! Label remains the same always! */ /* XXX, no simple way to get WM_MT_operator_presets.bl_label
* from python! Label remains the same always! */
PointerRNA op_ptr; PointerRNA op_ptr;
uiLayout *row; uiLayout *row;
@ -4024,7 +4038,8 @@ void uiTemplateKeymapItemProperties(uiLayout *layout, PointerRNA *ptr)
if (but->rnaprop) { if (but->rnaprop) {
UI_but_func_set(but, keymap_item_modified, ptr->data, NULL); UI_but_func_set(but, keymap_item_modified, ptr->data, NULL);
/* Otherwise the keymap will be re-generated which we're trying to edit, see: T47685 */ /* Otherwise the keymap will be re-generated which we're trying to edit,
* see: T47685 */
UI_but_flag_enable(but, UI_BUT_UPDATE_DELAY); UI_but_flag_enable(but, UI_BUT_UPDATE_DELAY);
} }
} }

@ -355,7 +355,8 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, const rcti *re
float maxxi = maxx - U.pixelsize; float maxxi = maxx - U.pixelsize;
float minyi = miny + U.pixelsize; float minyi = miny + U.pixelsize;
float maxyi = maxy - U.pixelsize; float maxyi = maxy - U.pixelsize;
float facxi = (maxxi != minxi) ? 1.0f / (maxxi - minxi) : 0.0f; /* for uv, can divide by zero */ /* for uv, can divide by zero */
float facxi = (maxxi != minxi) ? 1.0f / (maxxi - minxi) : 0.0f;
float facyi = (maxyi != minyi) ? 1.0f / (maxyi - minyi) : 0.0f; float facyi = (maxyi != minyi) ? 1.0f / (maxyi - minyi) : 0.0f;
int a, tot = 0, minsize; int a, tot = 0, minsize;
const int hnum = ( const int hnum = (
@ -1032,7 +1033,8 @@ float UI_text_clip_middle_ex(
float strwidth; float strwidth;
/* Add some epsilon to OK width, avoids 'ellipsing' text that nearly fits! /* Add some epsilon to OK width, avoids 'ellipsing' text that nearly fits!
* Better to have a small piece of the last char cut out, than two remaining chars replaced by an ellipsis... */ * Better to have a small piece of the last char cut out,
* than two remaining chars replaced by an ellipsis... */
okwidth += 1.0f + UI_DPI_FAC; okwidth += 1.0f + UI_DPI_FAC;
BLI_assert(str[0]); BLI_assert(str[0]);
@ -1261,7 +1263,8 @@ static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti
const char *prev_utf8 = BLI_str_find_prev_char_utf8(but->drawstr, cp2); const char *prev_utf8 = BLI_str_find_prev_char_utf8(but->drawstr, cp2);
int bytes = cp2 - prev_utf8; int bytes = cp2 - prev_utf8;
/* shift the text after and including cp2 back by 1 char, +1 to include null terminator */ /* shift the text after and including cp2 back by 1 char,
* +1 to include null terminator */
memmove(cp2 - bytes, cp2, drawstr_len + 1); memmove(cp2 - bytes, cp2, drawstr_len + 1);
cp2 -= bytes; cp2 -= bytes;
@ -2082,7 +2085,8 @@ static void widget_state(uiWidgetType *wt, int state)
static void widget_state_numslider(uiWidgetType *wt, int state) static void widget_state_numslider(uiWidgetType *wt, int state)
{ {
uiWidgetStateColors *wcol_state = wt->wcol_state; uiWidgetStateColors *wcol_state = wt->wcol_state;
float blend = wcol_state->blend - 0.2f; /* XXX special tweak to make sure that bar will still be visible */ /* XXX special tweak to make sure that bar will still be visible */
float blend = wcol_state->blend - 0.2f;
/* call this for option button */ /* call this for option button */
widget_state(wt, state); widget_state(wt, state);
@ -3871,7 +3875,8 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
break; break;
case UI_BTYPE_HSVCUBE: case UI_BTYPE_HSVCUBE:
if (ELEM(but->a1, UI_GRAD_V_ALT, UI_GRAD_L_ALT)) { /* vertical V slider, uses new widget draw now */ if (ELEM(but->a1, UI_GRAD_V_ALT, UI_GRAD_L_ALT)) {
/* vertical V slider, uses new widget draw now */
ui_draw_but_HSV_v(but, rect); ui_draw_but_HSV_v(but, rect);
} }
else { /* other HSV pickers... */ else { /* other HSV pickers... */

@ -226,7 +226,8 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
case TH_HEADER: case TH_HEADER:
cp = ts->header; break; cp = ts->header; break;
case TH_HEADERDESEL: case TH_HEADERDESEL:
/* we calculate a dynamic builtin header deselect color, also for pulldowns... */ /* we calculate a dynamic builtin header deselect color,
* also for pulldowns... */
cp = ts->header; cp = ts->header;
headerdesel[0] = cp[0] > 10 ? cp[0] - 10 : 0; headerdesel[0] = cp[0] > 10 ? cp[0] - 10 : 0;
headerdesel[1] = cp[1] > 10 ? cp[1] - 10 : 0; headerdesel[1] = cp[1] > 10 ? cp[1] - 10 : 0;

@ -220,7 +220,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
*/ */
case V2D_COMMONVIEW_STANDARD: case V2D_COMMONVIEW_STANDARD:
{ {
/* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */ /* for now, aspect ratio should be maintained,
* and zoom is clamped within sane default limits */
v2d->keepzoom = (V2D_KEEPASPECT | V2D_LIMITZOOM); v2d->keepzoom = (V2D_KEEPASPECT | V2D_LIMITZOOM);
v2d->minzoom = 0.01f; v2d->minzoom = 0.01f;
v2d->maxzoom = 1000.0f; v2d->maxzoom = 1000.0f;
@ -275,7 +276,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
/* scroller settings are currently not set here... that is left for regions... */ /* scroller settings are currently not set here... that is left for regions... */
break; break;
} }
/* 'header' regions - zoom, aspect ratio, alignment, and panning restrictions are set here */ /* 'header' regions - zoom, aspect ratio,
* alignment, and panning restrictions are set here */
case V2D_COMMONVIEW_HEADER: case V2D_COMMONVIEW_HEADER:
{ {
/* zoom + aspect ratio are locked */ /* zoom + aspect ratio are locked */
@ -308,7 +310,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
case V2D_COMMONVIEW_PANELS_UI: case V2D_COMMONVIEW_PANELS_UI:
{ {
/* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */ /* for now, aspect ratio should be maintained,
* and zoom is clamped within sane default limits */
v2d->keepzoom = (V2D_KEEPASPECT | V2D_LIMITZOOM | V2D_KEEPZOOM); v2d->keepzoom = (V2D_KEEPASPECT | V2D_LIMITZOOM | V2D_KEEPZOOM);
v2d->minzoom = 0.5f; v2d->minzoom = 0.5f;
v2d->maxzoom = 2.0f; v2d->maxzoom = 2.0f;
@ -343,7 +346,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
} }
/* other view types are completely defined using their own settings already */ /* other view types are completely defined using their own settings already */
default: default:
/* we don't do anything here, as settings should be fine, but just make sure that rect */ /* we don't do anything here,
* as settings should be fine, but just make sure that rect */
break; break;
} }
@ -358,7 +362,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
view2d_masks(v2d, 0); view2d_masks(v2d, 0);
/* set 'tot' rect before setting cur? */ /* set 'tot' rect before setting cur? */
/* XXX confusing stuff here still - I made this function not check scroller hide - that happens in totrect_set */ /* XXX confusing stuff here still -
* I made this function not check scroller hide - that happens in totrect_set */
if (tot_changed) if (tot_changed)
UI_view2d_totRect_set_resize(v2d, winx, winy, !do_init); UI_view2d_totRect_set_resize(v2d, winx, winy, !do_init);
else else
@ -467,7 +472,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas
} }
} }
else { else {
/* make sure sizes don't exceed that of the min/max sizes (even though we're not doing zoom clamping) */ /* make sure sizes don't exceed that of the min/max sizes
* (even though we're not doing zoom clamping) */
CLAMP(width, v2d->min[0], v2d->max[0]); CLAMP(width, v2d->min[0], v2d->max[0]);
CLAMP(height, v2d->min[1], v2d->max[1]); CLAMP(height, v2d->min[1], v2d->max[1]);
} }
@ -557,7 +563,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas
v2d->oldwiny = (short)winy; v2d->oldwiny = (short)winy;
} }
/* Step 2: apply new sizes to cur rect, but need to take into account alignment settings here... */ /* Step 2: apply new sizes to cur rect,
* but need to take into account alignment settings here... */
if ((width != curwidth) || (height != curheight)) { if ((width != curwidth) || (height != curheight)) {
float temp, dh; float temp, dh;
@ -656,7 +663,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas
* (XXX - in the past, max was favored... if there are bugs, swap!) * (XXX - in the past, max was favored... if there are bugs, swap!)
*/ */
if ((cur->xmin < tot->xmin) && (cur->xmax > tot->xmax)) { if ((cur->xmin < tot->xmin) && (cur->xmax > tot->xmax)) {
/* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */ /* outside boundaries on both sides,
* so take middle-point of tot, and place in balanced way */
temp = BLI_rctf_cent_x(tot); temp = BLI_rctf_cent_x(tot);
diff = curwidth * 0.5f; diff = curwidth * 0.5f;
@ -706,7 +714,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas
* We favour moving the 'minimum' across, as that's origin for most things * We favour moving the 'minimum' across, as that's origin for most things
*/ */
if ((cur->ymin < tot->ymin) && (cur->ymax > tot->ymax)) { if ((cur->ymin < tot->ymin) && (cur->ymax > tot->ymax)) {
/* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */ /* outside boundaries on both sides,
* so take middle-point of tot, and place in balanced way */
temp = BLI_rctf_cent_y(tot); temp = BLI_rctf_cent_y(tot);
diff = curheight * 0.5f; diff = curheight * 0.5f;
@ -784,7 +793,8 @@ void UI_view2d_curRect_validate(View2D *v2d)
/* ------------------ */ /* ------------------ */
/* Called by menus to activate it, or by view2d operators to make sure 'related' views stay in synchrony */ /* Called by menus to activate it, or by view2d operators
* to make sure 'related' views stay in synchrony */
void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag) void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
{ {
ScrArea *sa; ScrArea *sa;
@ -973,7 +983,8 @@ void UI_view2d_totRect_set(View2D *v2d, int width, int height)
UI_view2d_totRect_set_resize(v2d, width, height, 0); UI_view2d_totRect_set_resize(v2d, width, height, 0);
/* solve bad recursion... if scroller state changed, mask is different, so you get different rects */ /* solve bad recursion... if scroller state changed,
* mask is different, so you get different rects */
if (scroll != view2d_scroll_mapped(v2d->scroll)) { if (scroll != view2d_scroll_mapped(v2d->scroll)) {
UI_view2d_totRect_set_resize(v2d, width, height, 0); UI_view2d_totRect_set_resize(v2d, width, height, 0);
} }
@ -1053,7 +1064,8 @@ static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked)
float sizex = BLI_rcti_size_x(&v2d->mask); float sizex = BLI_rcti_size_x(&v2d->mask);
float sizey = BLI_rcti_size_y(&v2d->mask); float sizey = BLI_rcti_size_y(&v2d->mask);
/* prevent tiny or narrow regions to get invalid coordinates - mask can get negative even... */ /* prevent tiny or narrow regions to get
* invalid coordinates - mask can get negative even... */
if (sizex > 0.0f && sizey > 0.0f) { if (sizex > 0.0f && sizey > 0.0f) {
float dx = BLI_rctf_size_x(&v2d->cur) / (sizex + 1); float dx = BLI_rctf_size_x(&v2d->cur) / (sizex + 1);
float dy = BLI_rctf_size_y(&v2d->cur) / (sizey + 1); float dy = BLI_rctf_size_y(&v2d->cur) / (sizey + 1);
@ -1090,7 +1102,8 @@ void UI_view2d_view_ortho(View2D *v2d)
if (sizey > 0) if (sizey > 0)
yofs = eps * BLI_rctf_size_y(&v2d->cur) / sizey; yofs = eps * BLI_rctf_size_y(&v2d->cur) / sizey;
/* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */ /* apply mask-based adjustments to cur rect (due to scrollers),
* to eliminate scaling artifacts */
view2d_map_cur_using_mask(v2d, &curmasked); view2d_map_cur_using_mask(v2d, &curmasked);
BLI_rctf_translate(&curmasked, -xofs, -yofs); BLI_rctf_translate(&curmasked, -xofs, -yofs);
@ -1129,7 +1142,8 @@ void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, const bool xaxis)
xofs = 0.0f; // (v2d->flag & V2D_PIXELOFS_X) ? GLA_PIXEL_OFS : 0.0f; xofs = 0.0f; // (v2d->flag & V2D_PIXELOFS_X) ? GLA_PIXEL_OFS : 0.0f;
yofs = 0.0f; // (v2d->flag & V2D_PIXELOFS_Y) ? GLA_PIXEL_OFS : 0.0f; yofs = 0.0f; // (v2d->flag & V2D_PIXELOFS_Y) ? GLA_PIXEL_OFS : 0.0f;
/* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */ /* apply mask-based adjustments to cur rect (due to scrollers),
* to eliminate scaling artifacts */
view2d_map_cur_using_mask(v2d, &curmasked); view2d_map_cur_using_mask(v2d, &curmasked);
/* only set matrix with 'cur' coordinates on relevant axes */ /* only set matrix with 'cur' coordinates on relevant axes */
@ -1189,7 +1203,9 @@ static void step_to_grid(float *step, int *power, int unit)
/* for frames, we want 1.0 frame intervals only */ /* for frames, we want 1.0 frame intervals only */
if (unit == V2D_UNIT_FRAMES) { if (unit == V2D_UNIT_FRAMES) {
rem = 1.0f; rem = 1.0f;
*step = 2.0f; /* use 2 since there are grid lines drawn in between, this way to get 1 line per frame */ /* use 2 since there are grid lines drawn in between,
* this way to get 1 line per frame */
*step = 2.0f;
} }
/* prevents printing 1.0 2.0 3.0 etc */ /* prevents printing 1.0 2.0 3.0 etc */
@ -1675,7 +1691,8 @@ static void scroll_printstr(Scene *scene, float x, float y, float val, int power
BLI_timecode_string_from_time_seconds(timecode_str, sizeof(timecode_str), power, val); BLI_timecode_string_from_time_seconds(timecode_str, sizeof(timecode_str), power, val);
} }
/* get length of string, and adjust printing location to fit it into the horizontal scrollbar */ /* get length of string,
* and adjust printing location to fit it into the horizontal scrollbar */
len = strlen(timecode_str); len = strlen(timecode_str);
if (dir == 'h') { if (dir == 'h') {
/* seconds/timecode display has slightly longer strings... */ /* seconds/timecode display has slightly longer strings... */
@ -1798,7 +1815,8 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
break; break;
case V2D_UNIT_DEGREES: /* Graph Editor for rotation Drivers */ case V2D_UNIT_DEGREES: /* Graph Editor for rotation Drivers */
/* HACK: although we're drawing horizontal, we make this draw as 'vertical', just to get degree signs */ /* HACK: although we're drawing horizontal,
* we make this draw as 'vertical', just to get degree signs */
scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v'); scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v');
break; break;
} }
@ -1867,7 +1885,8 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
UI_ThemeColor(TH_TEXT); UI_ThemeColor(TH_TEXT);
val = grid->starty; val = grid->starty;
/* if vertical clamping (to whole numbers) is used (i.e. in Sequencer), apply correction */ /* if vertical clamping (to whole numbers) is used (i.e. in Sequencer),
* apply correction */
if (vs->yclamp == V2D_GRID_CLAMP) if (vs->yclamp == V2D_GRID_CLAMP)
fac += 0.5f * dfac; fac += 0.5f * dfac;

@ -76,19 +76,28 @@ static bool view2d_poll(bContext *C)
/* temp customdata for operator */ /* temp customdata for operator */
typedef struct v2dViewPanData { typedef struct v2dViewPanData {
bScreen *sc; /* screen where view pan was initiated */ /** screen where view pan was initiated */
ScrArea *sa; /* area where view pan was initiated */ bScreen *sc;
ARegion *ar; /* region where view pan was initiated */ /** area where view pan was initiated */
View2D *v2d; /* view2d we're operating in */ ScrArea *sa;
/** region where view pan was initiated */
ARegion *ar;
/** view2d we're operating in */
View2D *v2d;
float facx, facy; /* amount to move view relative to zoom */ /** amount to move view relative to zoom */
float facx, facy;
/* options for version 1 */ /* options for version 1 */
int startx, starty; /* mouse x/y values in window when operator was initiated */ /** mouse x/y values in window when operator was initiated */
int lastx, lasty; /* previous x/y values of mouse in window */ int startx, starty;
int invoke_event; /* event starting pan, for modal exit */ /** previous x/y values of mouse in window */
int lastx, lasty;
/** event starting pan, for modal exit */
int invoke_event;
short in_scroller; /* for MMB in scrollers (old feature in past, but now not that useful) */ /** for MMB in scrollers (old feature in past, but now not that useful) */
short in_scroller;
} v2dViewPanData; } v2dViewPanData;
/* initialize panning customdata */ /* initialize panning customdata */
@ -260,7 +269,8 @@ static int view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL; return OPERATOR_RUNNING_MODAL;
} }
/* handle user input - calculations of mouse-movement need to be done here, not in the apply callback! */ /* handle user input - calculations of mouse-movement
* need to be done here, not in the apply callback! */
static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event) static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
{ {
v2dViewPanData *vpd = op->customdata; v2dViewPanData *vpd = op->customdata;
@ -672,7 +682,8 @@ static void view_zoomstep_apply_ex(
v2d->cur.xmax -= dx; v2d->cur.xmax -= dx;
if (use_mousepos && (U.uiflag & USER_ZOOM_TO_MOUSEPOS)) { if (use_mousepos && (U.uiflag & USER_ZOOM_TO_MOUSEPOS)) {
/* get zoom fac the same way as in ui_view2d_curRect_validate_resize - better keep in sync! */ /* get zoom fac the same way as in
* ui_view2d_curRect_validate_resize - better keep in sync! */
const float zoomx = (float)(BLI_rcti_size_x(&v2d->mask) + 1) / BLI_rctf_size_x(&v2d->cur); const float zoomx = (float)(BLI_rcti_size_x(&v2d->mask) + 1) / BLI_rctf_size_x(&v2d->cur);
/* only move view to mouse if zoom fac is inside minzoom/maxzoom */ /* only move view to mouse if zoom fac is inside minzoom/maxzoom */
@ -705,7 +716,8 @@ static void view_zoomstep_apply_ex(
v2d->cur.ymax -= dy; v2d->cur.ymax -= dy;
if (use_mousepos && (U.uiflag & USER_ZOOM_TO_MOUSEPOS)) { if (use_mousepos && (U.uiflag & USER_ZOOM_TO_MOUSEPOS)) {
/* get zoom fac the same way as in ui_view2d_curRect_validate_resize - better keep in sync! */ /* get zoom fac the same way as in
* ui_view2d_curRect_validate_resize - better keep in sync! */
const float zoomy = (float)(BLI_rcti_size_y(&v2d->mask) + 1) / BLI_rctf_size_y(&v2d->cur); const float zoomy = (float)(BLI_rcti_size_y(&v2d->mask) + 1) / BLI_rctf_size_y(&v2d->cur);
/* only move view to mouse if zoom fac is inside minzoom/maxzoom */ /* only move view to mouse if zoom fac is inside minzoom/maxzoom */
@ -1032,7 +1044,8 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
fac = 0.01f * (event->prevy - event->y); fac = 0.01f * (event->prevy - event->y);
dy = fac * BLI_rctf_size_y(&v2d->cur) / 10.0f; dy = fac * BLI_rctf_size_y(&v2d->cur) / 10.0f;
/* support trackpad zoom to always zoom entirely - the v2d code uses portrait or landscape exceptions */ /* support trackpad zoom to always zoom entirely - the v2d code uses portrait or
* landscape exceptions */
if (v2d->keepzoom & V2D_KEEPASPECT) { if (v2d->keepzoom & V2D_KEEPASPECT) {
if (fabsf(dx) > fabsf(dy)) if (fabsf(dx) > fabsf(dy))
dy = dx; dy = dx;
@ -1085,7 +1098,8 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
return OPERATOR_RUNNING_MODAL; return OPERATOR_RUNNING_MODAL;
} }
/* handle user input - calculations of mouse-movement need to be done here, not in the apply callback! */ /* handle user input - calculations of mouse-movement need to be done here,
* not in the apply callback! */
static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event) static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event)
{ {
v2dViewZoomData *vzd = op->customdata; v2dViewZoomData *vzd = op->customdata;
@ -1131,7 +1145,8 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event
} }
/* support zoom to always zoom entirely - the v2d code uses portrait or landscape exceptions */ /* support zoom to always zoom entirely - the v2d code uses portrait or
* landscape exceptions */
if (v2d->keepzoom & V2D_KEEPASPECT) { if (v2d->keepzoom & V2D_KEEPASPECT) {
if (fabsf(dx) > fabsf(dy)) if (fabsf(dx) > fabsf(dy))
dy = dx; dy = dx;
@ -1260,7 +1275,8 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
*/ */
float zoom, center, size; float zoom, center, size;
/* TODO: is this zoom factor calculation valid? It seems to produce same results every time... */ /* TODO: is this zoom factor calculation valid?
* It seems to produce same results every time... */
if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) { if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
size = BLI_rctf_size_x(&cur_new); size = BLI_rctf_size_x(&cur_new);
zoom = size / BLI_rctf_size_x(&rect); zoom = size / BLI_rctf_size_x(&rect);
@ -1477,7 +1493,8 @@ void UI_view2d_smooth_view(
if (v2d->smooth_timer) if (v2d->smooth_timer)
WM_event_remove_timer(wm, win, v2d->smooth_timer); WM_event_remove_timer(wm, win, v2d->smooth_timer);
/* TIMER1 is hardcoded in keymap */ /* TIMER1 is hardcoded in keymap */
v2d->smooth_timer = WM_event_add_timer(wm, win, TIMER1, 1.0 / 100.0); /* max 30 frs/sec */ /* max 30 frs/sec */
v2d->smooth_timer = WM_event_add_timer(wm, win, TIMER1, 1.0 / 100.0);
ok = true; ok = true;
} }
@ -1573,20 +1590,31 @@ static void VIEW2D_OT_smoothview(wmOperatorType *ot)
/* customdata for scroller-invoke data */ /* customdata for scroller-invoke data */
typedef struct v2dScrollerMove { typedef struct v2dScrollerMove {
View2D *v2d; /* View2D data that this operation affects */ /** View2D data that this operation affects */
ARegion *ar; /* region that the scroller is in */ View2D *v2d;
/** region that the scroller is in */
ARegion *ar;
short scroller; /* scroller that mouse is in ('h' or 'v') */ /** scroller that mouse is in ('h' or 'v') */
short zone; /* -1 is min zoomer, 0 is bar, 1 is max zoomer */ // XXX find some way to provide visual feedback of this (active color?) short scroller;
/* XXX find some way to provide visual feedback of this (active color?) */
/** -1 is min zoomer, 0 is bar, 1 is max zoomer */
short zone;
float fac; /* view adjustment factor, based on size of region */ /** view adjustment factor, based on size of region */
float fac_round; /* for pixel rounding (avoid visible UI jitter) */ float fac;
float delta; /* amount moved by mouse on axis of interest */ /** for pixel rounding (avoid visible UI jitter) */
float fac_round;
/** amount moved by mouse on axis of interest */
float delta;
float scrollbarwidth; /* width of the scrollbar itself, used for page up/down clicks */ /** width of the scrollbar itself, used for page up/down clicks */
int scrollbar_orig; /* initial location of scrollbar x/y, mouse relative */ float scrollbarwidth;
/** initial location of scrollbar x/y, mouse relative */
int scrollbar_orig;
int lastx, lasty; /* previous mouse coordinates (in screen coordinates) for determining movement */ /** previous mouse coordinates (in screen coordinates) for determining movement */
int lastx, lasty;
} v2dScrollerMove; } v2dScrollerMove;
@ -1694,8 +1722,8 @@ static void scroller_activate_init(bContext *C, wmOperator *op, const wmEvent *e
*/ */
scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY); scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
/* use a union of 'cur' & 'tot' incase the current view is far outside 'tot'. /* use a union of 'cur' & 'tot' incase the current view is far outside 'tot'. In this cases
* In this cases moving the scroll bars has far too little effect and the view can get stuck [#31476] */ * moving the scroll bars has far too little effect and the view can get stuck T31476. */
tot_cur_union = v2d->tot; tot_cur_union = v2d->tot;
BLI_rctf_union(&tot_cur_union, &v2d->cur); BLI_rctf_union(&tot_cur_union, &v2d->cur);
@ -1841,10 +1869,12 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e
if (ELEM(vsm->zone, SCROLLHANDLE_BAR, SCROLLHANDLE_MAX)) { if (ELEM(vsm->zone, SCROLLHANDLE_BAR, SCROLLHANDLE_MAX)) {
/* if using bar (i.e. 'panning') or 'max' zoom widget */ /* if using bar (i.e. 'panning') or 'max' zoom widget */
switch (vsm->scroller) { switch (vsm->scroller) {
case 'h': /* horizontal scroller - so only horizontal movement ('cur' moves opposite to mouse) */ case 'h': /* horizontal scroller - so only horizontal movement
* ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->x - vsm->lastx); vsm->delta = (float)(event->x - vsm->lastx);
break; break;
case 'v': /* vertical scroller - so only vertical movement ('cur' moves opposite to mouse) */ case 'v': /* vertical scroller - so only vertical movement
* ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->y - vsm->lasty); vsm->delta = (float)(event->y - vsm->lasty);
break; break;
} }
@ -1852,10 +1882,12 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e
else if (vsm->zone == SCROLLHANDLE_MIN) { else if (vsm->zone == SCROLLHANDLE_MIN) {
/* using 'min' zoom widget */ /* using 'min' zoom widget */
switch (vsm->scroller) { switch (vsm->scroller) {
case 'h': /* horizontal scroller - so only horizontal movement ('cur' moves with mouse) */ case 'h': /* horizontal scroller - so only horizontal movement
* ('cur' moves with mouse) */
vsm->delta = (float)(vsm->lastx - event->x); vsm->delta = (float)(vsm->lastx - event->x);
break; break;
case 'v': /* vertical scroller - so only vertical movement ('cur' moves with to mouse) */ case 'v': /* vertical scroller - so only vertical movement
* ('cur' moves with to mouse) */
vsm->delta = (float)(vsm->lasty - event->y); vsm->delta = (float)(vsm->lasty - event->y);
break; break;
} }
@ -1897,7 +1929,8 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e
} }
/* a click (or click drag in progress) should have occurred, so check if it happened in scrollbar */ /* a click (or click drag in progress)
* should have occurred, so check if it happened in scrollbar */
static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *event) static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{ {
ARegion *ar = CTX_wm_region(C); ARegion *ar = CTX_wm_region(C);
@ -1907,7 +1940,8 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *
/* check if mouse in scrollbars, if they're enabled */ /* check if mouse in scrollbars, if they're enabled */
in_scroller = UI_view2d_mouse_in_scrollers(C, v2d, event->x, event->y); in_scroller = UI_view2d_mouse_in_scrollers(C, v2d, event->x, event->y);
/* if in a scroller, init customdata then set modal handler which will catch mousedown to start doing useful stuff */ /* if in a scroller, init customdata then set modal handler which will
* catch mousedown to start doing useful stuff */
if (in_scroller) { if (in_scroller) {
v2dScrollerMove *vsm; v2dScrollerMove *vsm;
@ -1918,10 +1952,12 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *
/* support for quick jump to location - gtk and qt do this on linux */ /* support for quick jump to location - gtk and qt do this on linux */
if (event->type == MIDDLEMOUSE) { if (event->type == MIDDLEMOUSE) {
switch (vsm->scroller) { switch (vsm->scroller) {
case 'h': /* horizontal scroller - so only horizontal movement ('cur' moves opposite to mouse) */ case 'h': /* horizontal scroller - so only horizontal movement
* ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->x - vsm->scrollbar_orig); vsm->delta = (float)(event->x - vsm->scrollbar_orig);
break; break;
case 'v': /* vertical scroller - so only vertical movement ('cur' moves opposite to mouse) */ case 'v': /* vertical scroller - so only vertical movement
* ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->y - vsm->scrollbar_orig); vsm->delta = (float)(event->y - vsm->scrollbar_orig);
break; break;
} }
@ -1978,7 +2014,8 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *
return OPERATOR_RUNNING_MODAL; return OPERATOR_RUNNING_MODAL;
} }
else { else {
/* not in scroller, so nothing happened... (pass through let's something else catch event) */ /* not in scroller, so nothing happened...
* (pass through let's something else catch event) */
return OPERATOR_PASS_THROUGH; return OPERATOR_PASS_THROUGH;
} }
} }

@ -677,14 +677,17 @@ static float *mask_rasterize(Mask *mask, const int width, const int height)
/* sets up the opengl context. /* sets up the opengl context.
* width, height are to match the values from ED_mask_get_size() */ * width, height are to match the values from ED_mask_get_size() */
void ED_mask_draw_region(Mask *mask, ARegion *ar, void ED_mask_draw_region(
const char draw_flag, const char draw_type, const char overlay_mode, Mask *mask, ARegion *ar,
const int width_i, const int height_i, /* convert directly into aspect corrected vars */ const char draw_flag, const char draw_type, const char overlay_mode,
const float aspx, const float aspy, /* convert directly into aspect corrected vars */
const bool do_scale_applied, const bool do_draw_cb, const int width_i, const int height_i,
float stabmat[4][4], /* optional - only used by clip */ const float aspx, const float aspy,
const bContext *C /* optional - only used when do_post_draw is set or called from clip editor */ const bool do_scale_applied, const bool do_draw_cb,
) /* optional - only used by clip */
float stabmat[4][4],
/* optional - only used when do_post_draw is set or called from clip editor */
const bContext *C)
{ {
struct View2D *v2d = &ar->v2d; struct View2D *v2d = &ar->v2d;

@ -2215,7 +2215,8 @@ static int mask_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
MaskSplinePoint *new_point; MaskSplinePoint *new_point;
int b; int b;
/* BKE_mask_spline_add might allocate the points, need to free them in this case. */ /* BKE_mask_spline_add might allocate the points,
* need to free them in this case. */
if (new_spline->points) { if (new_spline->points) {
MEM_freeN(new_spline->points); MEM_freeN(new_spline->points);
} }

@ -80,7 +80,8 @@ typedef struct {
float initial_length[NUM_VALUE_KINDS]; float initial_length[NUM_VALUE_KINDS];
float scale[NUM_VALUE_KINDS]; float scale[NUM_VALUE_KINDS];
NumInput num_input[NUM_VALUE_KINDS]; NumInput num_input[NUM_VALUE_KINDS];
float shift_value[NUM_VALUE_KINDS]; /* The current value when shift is pressed. Negative when shift not active. */ /** The current value when shift is pressed. Negative when shift not active. */
float shift_value[NUM_VALUE_KINDS];
bool is_modal; bool is_modal;
/* modal only */ /* modal only */
@ -166,7 +167,8 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
if (i == OFFSET_VALUE) { if (i == OFFSET_VALUE) {
opdata->num_input[i].unit_sys = scene->unit.system; opdata->num_input[i].unit_sys = scene->unit.system;
} }
opdata->num_input[i].unit_type[0] = B_UNIT_NONE; /* Not sure this is a factor or a unit? */ /* Not sure this is a factor or a unit? */
opdata->num_input[i].unit_type[0] = B_UNIT_NONE;
} }
/* avoid the cost of allocating a bm copy */ /* avoid the cost of allocating a bm copy */

@ -213,7 +213,8 @@ static bool edbm_inset_calc(wmOperator *op)
const float thickness = RNA_float_get(op->ptr, "thickness"); const float thickness = RNA_float_get(op->ptr, "thickness");
const float depth = RNA_float_get(op->ptr, "depth"); const float depth = RNA_float_get(op->ptr, "depth");
const bool use_outset = RNA_boolean_get(op->ptr, "use_outset"); const bool use_outset = RNA_boolean_get(op->ptr, "use_outset");
const bool use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset"); /* not passed onto the BMO */ /* not passed onto the BMO */
const bool use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset");
const bool use_individual = RNA_boolean_get(op->ptr, "use_individual"); const bool use_individual = RNA_boolean_get(op->ptr, "use_individual");
const bool use_interpolate = RNA_boolean_get(op->ptr, "use_interpolate"); const bool use_interpolate = RNA_boolean_get(op->ptr, "use_interpolate");

@ -610,8 +610,9 @@ static BMEdge *bm_face_split_edge_find(
ok = false; ok = false;
} }
else if (found_other_face) { else if (found_other_face) {
/* double check that _all_ the faces used by v_pivot's edges are attached to this edge /* double check that _all_ the faces used by v_pivot's edges are attached
* otherwise don't attempt the split since it will give non-deterministic results */ * to this edge otherwise don't attempt the split since it will give
* non-deterministic results */
BMLoop *l_radial_iter = l_iter->radial_next; BMLoop *l_radial_iter = l_iter->radial_next;
int other_face_shared = 0; int other_face_shared = 0;
if (l_radial_iter != l_iter) { if (l_radial_iter != l_iter) {

@ -2071,7 +2071,8 @@ static KnifeVert *knife_find_closest_vert(KnifeTool_OpData *kcd, float p[3], flo
knife_project_v2(kcd, kfv->cageco, kfv->sco); knife_project_v2(kcd, kfv->cageco, kfv->sco);
/* be strict about angle snapping, the vertex needs to be very close to the angle, or we ignore */ /* be strict about angle snapping, the vertex needs to be very close to the angle,
* or we ignore */
if (kcd->is_angle_snapping) { if (kcd->is_angle_snapping) {
if (dist_squared_to_line_segment_v2(kfv->sco, kcd->prev.mval, kcd->curr.mval) > KNIFE_FLT_EPSBIG) { if (dist_squared_to_line_segment_v2(kfv->sco, kcd->prev.mval, kcd->curr.mval) > KNIFE_FLT_EPSBIG) {
continue; continue;
@ -3116,7 +3117,8 @@ void EDBM_mesh_knife(bContext *C, LinkNode *polys, bool use_tag, bool cut_throug
keep_search = false; keep_search = false;
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(f, BM_ELEM_TAG) == false && (F_ISECT_IS_UNKNOWN(f))) { if (BM_elem_flag_test(f, BM_ELEM_TAG) == false && (F_ISECT_IS_UNKNOWN(f))) {
/* am I connected to a tagged face via an un-tagged edge (ie, not across a cut) */ /* am I connected to a tagged face via an un-tagged edge
* (ie, not across a cut) */
BMLoop *l_first = BM_FACE_FIRST_LOOP(f); BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
BMLoop *l_iter = l_first; BMLoop *l_iter = l_first;
bool found = false; bool found = false;

@ -461,10 +461,13 @@ static void ringsel_finish(bContext *C, wmOperator *op)
/* XXX Is this piece of code ever used now? Simple loop select is now /* XXX Is this piece of code ever used now? Simple loop select is now
* in editmesh_select.c (around line 1000)... */ * in editmesh_select.c (around line 1000)... */
/* sets as active, useful for other tools */ /* sets as active, useful for other tools */
if (em->selectmode & SCE_SELECT_VERTEX) if (em->selectmode & SCE_SELECT_VERTEX) {
BM_select_history_store(em->bm, lcd->eed->v1); /* low priority TODO, get vertrex close to mouse */ /* low priority TODO, get vertrex close to mouse */
if (em->selectmode & SCE_SELECT_EDGE) BM_select_history_store(em->bm, lcd->eed->v1);
}
if (em->selectmode & SCE_SELECT_EDGE) {
BM_select_history_store(em->bm, lcd->eed); BM_select_history_store(em->bm, lcd->eed);
}
EDBM_selectmode_flush(lcd->em); EDBM_selectmode_flush(lcd->em);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, lcd->ob->data); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, lcd->ob->data);
@ -848,7 +851,8 @@ void MESH_OT_loopcut(wmOperatorType *ot)
/* properties */ /* properties */
prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, 1000000, "Number of Cuts", "", 1, 100); prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, 1000000, "Number of Cuts", "", 1, 100);
/* avoid re-using last var because it can cause _very_ high poly meshes and annoy users (or worse crash) */ /* avoid re-using last var because it can cause
* _very_ high poly meshes and annoy users (or worse crash) */
RNA_def_property_flag(prop, PROP_SKIP_SAVE); RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_float(ot->srna, "smoothness", 0.0f, -1e3f, 1e3f, prop = RNA_def_float(ot->srna, "smoothness", 0.0f, -1e3f, 1e3f,

@ -66,7 +66,8 @@
* \{ */ * \{ */
struct PathSelectParams { struct PathSelectParams {
bool track_active; /* ensure the active element is the last selected item (handy for picking) */ /** ensure the active element is the last selected item (handy for picking) */
bool track_active;
bool use_topology_distance; bool use_topology_distance;
bool use_face_step; bool use_face_step;
bool use_fill; bool use_fill;

@ -312,7 +312,8 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm)
uid = uid_end + bm->totedge; uid = uid_end + bm->totedge;
lp = BLI_array_append_ret(eloop_pairs); lp = BLI_array_append_ret(eloop_pairs);
BM_edge_loop_pair(e_last, &lp->l_a, &lp->l_b); /* no need to check, we know this will be true */ /* no need to check, we know this will be true */
BM_edge_loop_pair(e_last, &lp->l_a, &lp->l_b);
BLI_assert(tot == uid_end - uid_start); BLI_assert(tot == uid_end - uid_start);
@ -798,7 +799,8 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, const wmEvent *eve
if (do_fill) { if (do_fill) {
/* Only needed when filling... /* Only needed when filling...
* Also, we never want to tag best edge, that one won't change during split. See T44618. */ * Also, we never want to tag best edge,
* that one won't change during split. See T44618. */
if (larr[larr_len]->e == e_best) { if (larr[larr_len]->e == e_best) {
BM_elem_flag_enable(larr[larr_len]->prev->e, BM_ELEM_TAG); BM_elem_flag_enable(larr[larr_len]->prev->e, BM_ELEM_TAG);
} }

@ -197,7 +197,8 @@ void EDBM_automerge(Scene *scene, Object *obedit, bool update, const char hflag)
/** \name Back-Buffer OpenGL Selection /** \name Back-Buffer OpenGL Selection
* \{ */ * \{ */
unsigned int bm_solidoffs = 0, bm_wireoffs = 0, bm_vertoffs = 0; /* set in drawobject.c ... for colorindices */ /* set in drawobject.c ... for colorindices */
unsigned int bm_solidoffs = 0, bm_wireoffs = 0, bm_vertoffs = 0;
/* facilities for border select and circle select */ /* facilities for border select and circle select */
static BLI_bitmap *selbuf = NULL; static BLI_bitmap *selbuf = NULL;
@ -2044,7 +2045,8 @@ void EDBM_selectmode_set(BMEditMesh *em)
em->bm->selectmode = em->selectmode; em->bm->selectmode = em->selectmode;
edbm_strip_selections(em); /* strip BMEditSelections from em->selected that are not relevant to new mode */ /* strip BMEditSelections from em->selected that are not relevant to new mode */
edbm_strip_selections(em);
if (em->bm->totvertsel == 0 && if (em->bm->totvertsel == 0 &&
em->bm->totedgesel == 0 && em->bm->totedgesel == 0 &&

@ -144,7 +144,8 @@ void MESH_OT_subdivide(wmOperatorType *ot)
/* properties */ /* properties */
prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, 100, "Number of Cuts", "", 1, 10); prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, 100, "Number of Cuts", "", 1, 10);
/* avoid re-using last var because it can cause _very_ high poly meshes and annoy users (or worse crash) */ /* avoid re-using last var because it can cause
* _very_ high poly meshes and annoy users (or worse crash) */
RNA_def_property_flag(prop, PROP_SKIP_SAVE); RNA_def_property_flag(prop, PROP_SKIP_SAVE);
RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, 1e3f, "Smoothness", "Smoothness factor", 0.0f, 1.0f); RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, 1e3f, "Smoothness", "Smoothness factor", 0.0f, 1.0f);
@ -2946,8 +2947,10 @@ static float bm_edge_seg_isect(
y12 = mouse_path[i][1]; y12 = mouse_path[i][1];
/* Perp. Distance from point to line */ /* Perp. Distance from point to line */
if (m2 != MAXSLOPE) dist = (y12 - m2 * x12 - b2); /* /sqrt(m2 * m2 + 1); Only looking for */ if (m2 != MAXSLOPE) {
/* change in sign. Skip extra math */ /* /sqrt(m2 * m2 + 1); Only looking for change in sign. Skip extra math .*/
dist = (y12 - m2 * x12 - b2);
}
else dist = x22 - x12; else dist = x22 - x12;
if (i == 0) lastdist = dist; if (i == 0) lastdist = dist;
@ -3074,7 +3077,8 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
/* TODO, investigate using index lookup for screen_vert_coords() rather then a hash table */ /* TODO, investigate using index lookup for screen_vert_coords() rather then a hash table */
/* the floating point coordinates of verts in screen space will be stored in a hash table according to the vertices pointer */ /* the floating point coordinates of verts in screen space will be
* stored in a hash table according to the vertices pointer */
screen_vert_coords = sco = MEM_mallocN(bm->totvert * sizeof(float) * 2, __func__); screen_vert_coords = sco = MEM_mallocN(bm->totvert * sizeof(float) * 2, __func__);
BM_ITER_MESH_INDEX (bv, &iter, bm, BM_VERTS_OF_MESH, i) { BM_ITER_MESH_INDEX (bv, &iter, bm, BM_VERTS_OF_MESH, i) {
@ -4933,7 +4937,8 @@ static void sort_bmelem_flag(
float fact = reverse ? -1.0 : 1.0; float fact = reverse ? -1.0 : 1.0;
int coidx = (action == SRT_VIEW_ZAXIS) ? 2 : 0; int coidx = (action == SRT_VIEW_ZAXIS) ? 2 : 0;
mul_m4_m4m4(mat, rv3d->viewmat, ob->obmat); /* Apply the view matrix to the object matrix. */ /* Apply the view matrix to the object matrix. */
mul_m4_m4m4(mat, rv3d->viewmat, ob->obmat);
if (totelem[0]) { if (totelem[0]) {
pb = pblock[0] = MEM_callocN(sizeof(char) * totelem[0], "sort_bmelem vert pblock"); pb = pblock[0] = MEM_callocN(sizeof(char) * totelem[0], "sort_bmelem vert pblock");
@ -5074,9 +5079,11 @@ static void sort_bmelem_flag(
float srt = reverse ? (float)(MAXMAT - fa->mat_nr) : (float)fa->mat_nr; float srt = reverse ? (float)(MAXMAT - fa->mat_nr) : (float)fa->mat_nr;
pb[i] = false; pb[i] = false;
sb[affected[2]].org_idx = i; sb[affected[2]].org_idx = i;
/* Multiplying with totface and adding i ensures us we keep current order for all faces of same mat. */ /* Multiplying with totface and adding i ensures us
* we keep current order for all faces of same mat. */
sb[affected[2]++].srt = srt * ((float)totelem[2]) + ((float)i); sb[affected[2]++].srt = srt * ((float)totelem[2]) + ((float)i);
/* printf("e: %d; srt: %f; final: %f\n", i, srt, srt * ((float)totface) + ((float)i));*/ // printf("e: %d; srt: %f; final: %f\n",
// i, srt, srt * ((float)totface) + ((float)i));
} }
else { else {
pb[i] = true; pb[i] = true;

@ -801,7 +801,8 @@ UvElementMap *BM_uv_element_map_create(
island_number = MEM_mallocN(sizeof(*island_number) * totfaces, "uv_island_number_face"); island_number = MEM_mallocN(sizeof(*island_number) * totfaces, "uv_island_number_face");
copy_vn_i(island_number, totfaces, INVALID_ISLAND); copy_vn_i(island_number, totfaces, INVALID_ISLAND);
/* at this point, every UvElement in vert points to a UvElement sharing the same vertex. Now we should sort uv's in islands. */ /* at this point, every UvElement in vert points to a UvElement sharing the same vertex.
* Now we should sort uv's in islands. */
for (i = 0; i < totuv; i++) { for (i = 0; i < totuv; i++) {
if (element_map->buf[i].island == INVALID_ISLAND) { if (element_map->buf[i].island == INVALID_ISLAND) {
element_map->buf[i].island = nislands; element_map->buf[i].island = nislands;
@ -820,7 +821,8 @@ UvElementMap *BM_uv_element_map_create(
initelement = element; initelement = element;
if (element->l->f == efa) { if (element->l->f == efa) {
/* found the uv corresponding to our face and vertex. Now fill it to the buffer */ /* found the uv corresponding to our face and vertex.
* Now fill it to the buffer */
element->island = nislands; element->island = nislands;
map[element - element_map->buf] = islandbufsize; map[element - element_map->buf] = islandbufsize;
islandbuf[islandbufsize].l = element->l; islandbuf[islandbufsize].l = element->l;
@ -1230,7 +1232,8 @@ void EDBM_mesh_hide(BMEditMesh *em, bool swap)
EDBM_selectmode_flush(em); EDBM_selectmode_flush(em);
/* original hide flushing comment (OUTDATED): /* original hide flushing comment (OUTDATED):
* hide happens on least dominant select mode, and flushes up, not down! (helps preventing errors in subsurf) */ * hide happens on least dominant select mode, and flushes up, not down!
* (helps preventing errors in subsurf) */
/* - vertex hidden, always means edge is hidden too /* - vertex hidden, always means edge is hidden too
* - edge hidden, always means face is hidden too * - edge hidden, always means face is hidden too
* - face hidden, only set face hide * - face hidden, only set face hide

@ -313,7 +313,8 @@ void ED_mesh_mirrtopo_init(Mesh *me, DerivedMesh *dm, const int ob_mode, MirrTop
if (em) { if (em) {
BMVert **vtable = em->bm->vtable; BMVert **vtable = em->bm->vtable;
for (a = 1; a <= totvert; a++) { for (a = 1; a <= totvert; a++) {
/* printf("I %d %ld %d\n", (a - last), MirrTopoPairs[a].hash, MirrTopoPairs[a].v_indexs); */ // printf("I %d %ld %d\n",
// (a - last), MirrTopoPairs[a].hash, MirrTopoPairs[a].v_indexs);
if ((a == totvert) || (topo_pairs[a - 1].hash != topo_pairs[a].hash)) { if ((a == totvert) || (topo_pairs[a - 1].hash != topo_pairs[a].hash)) {
const int match_count = a - last; const int match_count = a - last;
if (match_count == 2) { if (match_count == 2) {

@ -144,7 +144,8 @@ static void join_mesh_single(
/* check if this mesh has such a shapekey */ /* check if this mesh has such a shapekey */
KeyBlock *okb = me->key ? BKE_keyblock_find_name(me->key, kb->name) : NULL; KeyBlock *okb = me->key ? BKE_keyblock_find_name(me->key, kb->name) : NULL;
if (okb) { if (okb) {
/* copy this mesh's shapekey to the destination shapekey (need to transform first) */ /* copy this mesh's shapekey to the destination shapekey
* (need to transform first) */
float (*ocos)[3] = okb->data; float (*ocos)[3] = okb->data;
for (a = 0; a < me->totvert; a++, cos++, ocos++) { for (a = 0; a < me->totvert; a++, cos++, ocos++) {
copy_v3_v3(*cos, *ocos); copy_v3_v3(*cos, *ocos);
@ -391,7 +392,8 @@ int join_mesh_exec(bContext *C, wmOperator *op)
if (me->totvert) { if (me->totvert) {
/* Add this object's materials to the base one's if they don't exist already (but only if limits not exceeded yet) */ /* Add this object's materials to the base one's if they don't exist already
* (but only if limits not exceeded yet) */
if (totcol < MAXMAT) { if (totcol < MAXMAT) {
for (a = 1; a <= base->object->totcol; a++) { for (a = 1; a <= base->object->totcol; a++) {
ma = give_current_material(base->object, a); ma = give_current_material(base->object, a);
@ -414,7 +416,8 @@ int join_mesh_exec(bContext *C, wmOperator *op)
} }
} }
/* if this mesh has shapekeys, check if destination mesh already has matching entries too */ /* if this mesh has shapekeys,
* check if destination mesh already has matching entries too */
if (me->key && key) { if (me->key && key) {
/* for remapping KeyBlock.relative */ /* for remapping KeyBlock.relative */
int *index_map = MEM_mallocN(sizeof(int) * me->key->totkey, __func__); int *index_map = MEM_mallocN(sizeof(int) * me->key->totkey, __func__);
@ -445,7 +448,8 @@ int join_mesh_exec(bContext *C, wmOperator *op)
/* remap relative index values */ /* remap relative index values */
for (kb = me->key->block.first, i = 0; kb; kb = kb->next, i++) { for (kb = me->key->block.first, i = 0; kb; kb = kb->next, i++) {
if (LIKELY(kb->relative < me->key->totkey)) { /* sanity check, should always be true */ /* sanity check, should always be true */
if (LIKELY(kb->relative < me->key->totkey)) {
kb_map[i]->relative = index_map[kb->relative]; kb_map[i]->relative = index_map[kb->relative];
} }
} }
@ -479,8 +483,10 @@ int join_mesh_exec(bContext *C, wmOperator *op)
/* inverse transform for all selected meshes in this object */ /* inverse transform for all selected meshes in this object */
invert_m4_m4(imat, ob->obmat); invert_m4_m4(imat, ob->obmat);
/* Add back active mesh first. This allows to keep things similar as they were, as much as possible (i.e. data from /* Add back active mesh first.
* active mesh will remain first ones in new result of the merge, in same order for CD layers, etc. See also T50084. * This allows to keep things similar as they were, as much as possible
* (i.e. data from active mesh will remain first ones in new result of the merge,
* in same order for CD layers, etc). See also T50084.
*/ */
join_mesh_single( join_mesh_single(
bmain, scene, bmain, scene,

@ -1404,8 +1404,9 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
BLI_ghash_insert(dupli_gh, dob, ob_dst); BLI_ghash_insert(dupli_gh, dob, ob_dst);
if (parent_gh) { if (parent_gh) {
void **val; void **val;
/* Due to nature of hash/comparison of this ghash, a lot of duplis may be considered as 'the same', /* Due to nature of hash/comparison of this ghash, a lot of duplis may be considered as
* this avoids trying to insert same key several time and raise asserts in debug builds... */ * 'the same', this avoids trying to insert same key several time and
* raise asserts in debug builds... */
if (!BLI_ghash_ensure_p(parent_gh, dob, &val)) { if (!BLI_ghash_ensure_p(parent_gh, dob, &val)) {
*val = ob_dst; *val = ob_dst;
} }

@ -103,7 +103,8 @@ ListBase *get_active_constraints(Object *ob)
return NULL; return NULL;
} }
/* Find the list that a given constraint belongs to, and/or also get the posechannel this is from (if applicable) */ /* Find the list that a given constraint belongs to,
* and/or also get the posechannel this is from (if applicable) */
ListBase *get_constraint_lb(Object *ob, bConstraint *con, bPoseChannel **r_pchan) ListBase *get_constraint_lb(Object *ob, bConstraint *con, bPoseChannel **r_pchan)
{ {
if (r_pchan) if (r_pchan)
@ -1270,7 +1271,8 @@ static int constraint_delete_exec(bContext *C, wmOperator *UNUSED(op))
if (BKE_constraint_remove_ex(lb, ob, con, true)) { if (BKE_constraint_remove_ex(lb, ob, con, true)) {
/* there's no active constraint now, so make sure this is the case */ /* there's no active constraint now, so make sure this is the case */
BKE_constraints_active_set(&ob->constraints, NULL); BKE_constraints_active_set(&ob->constraints, NULL);
ED_object_constraint_update(bmain, ob); /* needed to set the flags on posebones correctly */ /* needed to set the flags on posebones correctly */
ED_object_constraint_update(bmain, ob);
/* relatiols */ /* relatiols */
DAG_relations_tag_update(CTX_data_main(C)); DAG_relations_tag_update(CTX_data_main(C));
@ -1599,7 +1601,8 @@ static bool get_new_constraint_target(bContext *C, int con_type, Object **tar_ob
return false; return false;
/* restricted target-type constraints -------------- */ /* restricted target-type constraints -------------- */
/* NOTE: for these, we cannot try to add a target object if no valid ones are found, since that doesn't work */ /* NOTE: for these, we cannot try to add a target object if no valid ones are found,
* since that doesn't work */
/* curve-based constraints - set the only_curve and only_ob flags */ /* curve-based constraints - set the only_curve and only_ob flags */
case CONSTRAINT_TYPE_CLAMPTO: case CONSTRAINT_TYPE_CLAMPTO:
case CONSTRAINT_TYPE_FOLLOWPATH: case CONSTRAINT_TYPE_FOLLOWPATH:

@ -69,7 +69,8 @@ static const EnumPropertyItem DT_layer_items[] = {
#if 0 /* XXX For now, would like to finish/merge work from 2014 gsoc first. */ #if 0 /* XXX For now, would like to finish/merge work from 2014 gsoc first. */
{DT_TYPE_SHAPEKEY, "SHAPEKEYS", 0, "Shapekey(s)", "Transfer active or all shape keys"}, {DT_TYPE_SHAPEKEY, "SHAPEKEYS", 0, "Shapekey(s)", "Transfer active or all shape keys"},
#endif #endif
#if 0 /* XXX When SkinModifier is enabled, it seems to erase its own CD_MVERT_SKIN layer from final DM :( */ #if 0 /* XXX When SkinModifier is enabled,
* it seems to erase its own CD_MVERT_SKIN layer from final DM :( */
{DT_TYPE_SKIN, "SKIN", 0, "Skin Weight", "Transfer skin weights"}, {DT_TYPE_SKIN, "SKIN", 0, "Skin Weight", "Transfer skin weights"},
#endif #endif
{DT_TYPE_BWEIGHT_VERT, "BEVEL_WEIGHT_VERT", 0, "Bevel Weight", "Transfer bevel weights"}, {DT_TYPE_BWEIGHT_VERT, "BEVEL_WEIGHT_VERT", 0, "Bevel Weight", "Transfer bevel weights"},

@ -473,8 +473,10 @@ bool ED_object_editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int f
/* flag object caches as outdated */ /* flag object caches as outdated */
BKE_ptcache_ids_from_object(bmain, &pidlist, obedit, scene, 0); BKE_ptcache_ids_from_object(bmain, &pidlist, obedit, scene, 0);
for (pid = pidlist.first; pid; pid = pid->next) { for (pid = pidlist.first; pid; pid = pid->next) {
if (pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */ /* particles don't need reset on geometry change */
if (pid->type != PTCACHE_TYPE_PARTICLES) {
pid->cache->flag |= PTCACHE_OUTDATED; pid->cache->flag |= PTCACHE_OUTDATED;
}
} }
BLI_freelistN(&pidlist); BLI_freelistN(&pidlist);

@ -499,7 +499,8 @@ void ED_object_parent_clear(Object *ob, const int type)
switch (type) { switch (type) {
case CLEAR_PARENT_ALL: case CLEAR_PARENT_ALL:
{ {
/* for deformers, remove corresponding modifiers to prevent a large number of modifiers building up */ /* for deformers, remove corresponding modifiers to prevent
* a large number of modifiers building up */
object_remove_parent_deform_modifiers(ob, ob->parent); object_remove_parent_deform_modifiers(ob, ob->parent);
/* clear parenting relationship completely */ /* clear parenting relationship completely */
@ -508,14 +509,16 @@ void ED_object_parent_clear(Object *ob, const int type)
} }
case CLEAR_PARENT_KEEP_TRANSFORM: case CLEAR_PARENT_KEEP_TRANSFORM:
{ {
/* remove parent, and apply the parented transform result as object's local transforms */ /* remove parent, and apply the parented transform
* result as object's local transforms */
ob->parent = NULL; ob->parent = NULL;
BKE_object_apply_mat4(ob, ob->obmat, true, false); BKE_object_apply_mat4(ob, ob->obmat, true, false);
break; break;
} }
case CLEAR_PARENT_INVERSE: case CLEAR_PARENT_INVERSE:
{ {
/* object stays parented, but the parent inverse (i.e. offset from parent to retain binding state) /* object stays parented, but the parent inverse
* (i.e. offset from parent to retain binding state)
* is cleared. In other words: nothing to do here! */ * is cleared. In other words: nothing to do here! */
break; break;
} }
@ -1567,7 +1570,8 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
/* new approach, using functions from kernel */ /* new approach, using functions from kernel */
for (a = 0; a < ob_src->totcol; a++) { for (a = 0; a < ob_src->totcol; a++) {
Material *ma = give_current_material(ob_src, a + 1); Material *ma = give_current_material(ob_src, a + 1);
assign_material(bmain, ob_dst, ma, a + 1, BKE_MAT_ASSIGN_USERPREF); /* also works with ma==NULL */ /* also works with `ma == NULL` */
assign_material(bmain, ob_dst, ma, a + 1, BKE_MAT_ASSIGN_USERPREF);
} }
DAG_id_tag_update(&ob_dst->id, OB_RECALC_DATA); DAG_id_tag_update(&ob_dst->id, OB_RECALC_DATA);
break; break;
@ -1960,7 +1964,8 @@ static void single_mat_users(Main *bmain, Scene *scene, const int flag, const bo
for (a = 1; a <= ob->totcol; a++) { for (a = 1; a <= ob->totcol; a++) {
ma = give_current_material(ob, a); ma = give_current_material(ob, a);
if (ma) { if (ma) {
/* do not test for LIB_TAG_NEW or use newid: this functions guaranteed delivers single_users! */ /* do not test for LIB_TAG_NEW or use newid:
* this functions guaranteed delivers single_users! */
if (ma->id.us > 1) { if (ma->id.us > 1) {
man = BKE_material_copy(bmain, ma); man = BKE_material_copy(bmain, ma);

@ -957,7 +957,9 @@ float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum)
} }
void ED_vgroup_select_by_name(Object *ob, const char *name) void ED_vgroup_select_by_name(Object *ob, const char *name)
{ /* note: ob->actdef==0 signals on painting to create a new one, if a bone in posemode is selected */ {
/* note: ob->actdef==0 signals on painting to create a new one,
* if a bone in posemode is selected */
ob->actdef = defgroup_name_index(ob, name) + 1; ob->actdef = defgroup_name_index(ob, name) + 1;
} }
@ -1960,20 +1962,22 @@ static int inv_cmp_mdef_vert_weights(const void *a1, const void *a2)
{ {
/* qsort sorts in ascending order. We want descending order to save a memcopy /* qsort sorts in ascending order. We want descending order to save a memcopy
* so this compare function is inverted from the standard greater than comparison qsort needs. * so this compare function is inverted from the standard greater than comparison qsort needs.
* A normal compare function is called with two pointer arguments and should return an integer less than, equal to, * A normal compare function is called with two pointer arguments and should return an integer
* or greater than zero corresponding to whether its first argument is considered less than, equal to, * less than, equal to, or greater than zero corresponding to whether its first argument is
* or greater than its second argument. This does the opposite. */ * considered less than, equal to, or greater than its second argument.
* This does the opposite. */
const struct MDeformWeight *dw1 = a1, *dw2 = a2; const struct MDeformWeight *dw1 = a1, *dw2 = a2;
if (dw1->weight < dw2->weight) return 1; if (dw1->weight < dw2->weight) return 1;
else if (dw1->weight > dw2->weight) return -1; else if (dw1->weight > dw2->weight) return -1;
else if (&dw1 < &dw2) return 1; /* compare addresses so we have a stable sort algorithm */ else if (&dw1 < &dw2) return 1; /* compare address for stable sort algorithm */
else return -1; else return -1;
} }
/* Used for limiting the number of influencing bones per vertex when exporting /* Used for limiting the number of influencing bones per vertex when exporting
* skinned meshes. if all_deform_weights is True, limit all deform modifiers * skinned meshes. if all_deform_weights is True, limit all deform modifiers
* to max_weights regardless of type, otherwise, only limit the number of influencing bones per vertex*/ * to max_weights regardless of type, otherwise,
* only limit the number of influencing bones per vertex. */
static int vgroup_limit_total_subset( static int vgroup_limit_total_subset(
Object *ob, Object *ob,
const bool *vgroup_validmap, const bool *vgroup_validmap,

@ -3149,7 +3149,10 @@ static void brush_puff(PEData *data, int point_index)
/* find root coordinate and normal on emitter */ /* find root coordinate and normal on emitter */
copy_v3_v3(co, key->co); copy_v3_v3(co, key->co);
mul_m4_v3(mat, co); mul_m4_v3(mat, co);
mul_v3_m4v3(kco, data->ob->imat, co); /* use 'kco' as the object space version of worldspace 'co', ob->imat is set before calling */
/* use 'kco' as the object space version of worldspace 'co',
* ob->imat is set before calling */
mul_v3_m4v3(kco, data->ob->imat, co);
point_index = BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL); point_index = BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL);
if (point_index == -1) return; if (point_index == -1) return;
@ -3233,7 +3236,10 @@ static void brush_puff(PEData *data, int point_index)
float oco[3], onor[3]; float oco[3], onor[3];
copy_v3_v3(oco, key->co); copy_v3_v3(oco, key->co);
mul_m4_v3(mat, oco); mul_m4_v3(mat, oco);
mul_v3_m4v3(kco, data->ob->imat, oco); /* use 'kco' as the object space version of worldspace 'co', ob->imat is set before calling */
/* use 'kco' as the object space version of worldspace 'co',
* ob->imat is set before calling */
mul_v3_m4v3(kco, data->ob->imat, oco);
point_index = BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL); point_index = BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL);
if (point_index != -1) { if (point_index != -1) {

@ -629,7 +629,8 @@ void PARTICLE_OT_disconnect_hair(wmOperatorType *ot)
ot->exec = disconnect_hair_exec; ot->exec = disconnect_hair_exec;
/* flags */ /* flags */
ot->flag = OPTYPE_UNDO; /* No REGISTER, redo does not work due to missing update, see T47750. */ /* No REGISTER, redo does not work due to missing update, see T47750. */
ot->flag = OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "all", 0, "All hair", "Disconnect all hair systems from the emitter mesh"); RNA_def_boolean(ot->srna, "all", 0, "All hair", "Disconnect all hair systems from the emitter mesh");
} }
@ -885,7 +886,8 @@ void PARTICLE_OT_connect_hair(wmOperatorType *ot)
ot->exec = connect_hair_exec; ot->exec = connect_hair_exec;
/* flags */ /* flags */
ot->flag = OPTYPE_UNDO; /* No REGISTER, redo does not work due to missing update, see T47750. */ /* No REGISTER, redo does not work due to missing update, see T47750. */
ot->flag = OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "all", 0, "All hair", "Connect all hair systems to the emitter mesh"); RNA_def_boolean(ot->srna, "all", 0, "All hair", "Connect all hair systems to the emitter mesh");
} }

@ -146,7 +146,8 @@ static void image_buffer_rect_update(RenderJob *rj, RenderResult *rr, ImBuf *ibu
/* if renrect argument, we only refresh scanlines */ /* if renrect argument, we only refresh scanlines */
if (renrect) { if (renrect) {
/* if (ymax == recty), rendering of layer is ready, we should not draw, other things happen... */ /* if (ymax == recty), rendering of layer is ready,
* we should not draw, other things happen... */
if (rr->renlay == NULL || renrect->ymax >= rr->recty) if (rr->renlay == NULL || renrect->ymax >= rr->recty)
return; return;
@ -649,8 +650,9 @@ static void render_endjob(void *rjv)
{ {
RenderJob *rj = rjv; RenderJob *rj = rjv;
/* this render may be used again by the sequencer without the active 'Render' where the callbacks /* this render may be used again by the sequencer without the active
* would be re-assigned. assign dummy callbacks to avoid referencing freed renderjobs bug [#24508] */ * 'Render' where the callbacks would be re-assigned. assign dummy callbacks
* to avoid referencing freed renderjobs bug T24508. */
RE_InitRenderCB(rj->re); RE_InitRenderCB(rj->re);
if (rj->main != G.main) if (rj->main != G.main)

@ -670,7 +670,9 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
oglrender->prevar = prevar; oglrender->prevar = prevar;
if (is_view_context) { if (is_view_context) {
ED_view3d_context_user_region(C, &oglrender->v3d, &oglrender->ar); /* so quad view renders camera */ /* so quad view renders camera */
ED_view3d_context_user_region(C, &oglrender->v3d, &oglrender->ar);
oglrender->rv3d = oglrender->ar->regiondata; oglrender->rv3d = oglrender->ar->regiondata;
/* MUST be cleared on exit */ /* MUST be cleared on exit */

@ -1732,7 +1732,8 @@ void MATERIAL_OT_copy(wmOperatorType *ot)
ot->exec = copy_material_exec; ot->exec = copy_material_exec;
/* flags */ /* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL; /* no undo needed since no changes are made to the material */ /* no undo needed since no changes are made to the material */
ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL;
} }
static int paste_material_exec(bContext *C, wmOperator *UNUSED(op)) static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
@ -1886,7 +1887,8 @@ void TEXTURE_OT_slot_copy(wmOperatorType *ot)
ot->poll = copy_mtex_poll; ot->poll = copy_mtex_poll;
/* flags */ /* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL; /* no undo needed since no changes are made to the mtex */ /* no undo needed since no changes are made to the mtex */
ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL;
} }
static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op)) static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))

@ -279,7 +279,8 @@ static bool screenshot_poll(bContext *C)
void SCREEN_OT_screenshot(wmOperatorType *ot) void SCREEN_OT_screenshot(wmOperatorType *ot)
{ {
ot->name = "Save Screenshot"; /* weak: opname starting with 'save' makes filewindow give save-over */ /* weak: opname starting with 'save' makes filewindow give save-over */
ot->name = "Save Screenshot";
ot->idname = "SCREEN_OT_screenshot"; ot->idname = "SCREEN_OT_screenshot";
ot->description = "Capture a picture of the active area or whole Blender window"; ot->description = "Capture a picture of the active area or whole Blender window";

@ -314,8 +314,10 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
pool = BKE_image_pool_new(); pool = BKE_image_pool_new();
if (mtex->tex && mtex->tex->nodetree) if (mtex->tex && mtex->tex->nodetree) {
ntreeTexBeginExecTree(mtex->tex->nodetree); /* has internal flag to detect it only does it once */ /* has internal flag to detect it only does it once */
ntreeTexBeginExecTree(mtex->tex->nodetree);
}
LoadTexData data = { LoadTexData data = {
.br = br, .vc = vc, .mtex = mtex, .buffer = buffer, .col = col, .br = br, .vc = vc, .mtex = mtex, .buffer = buffer, .col = col,
@ -787,7 +789,8 @@ static void paint_draw_alpha_overlay(
UnifiedPaintSettings *ups, Brush *brush, UnifiedPaintSettings *ups, Brush *brush,
ViewContext *vc, int x, int y, float zoom, ePaintMode mode) ViewContext *vc, int x, int y, float zoom, ePaintMode mode)
{ {
/* color means that primary brush texture is colured and secondary is used for alpha/mask control */ /* color means that primary brush texture is colured and
* secondary is used for alpha/mask control */
bool col = ELEM(mode, PAINT_MODE_TEXTURE_3D, PAINT_MODE_TEXTURE_2D, PAINT_MODE_VERTEX) ? true : false; bool col = ELEM(mode, PAINT_MODE_TEXTURE_3D, PAINT_MODE_TEXTURE_2D, PAINT_MODE_VERTEX) ? true : false;
eOverlayControlFlags flags = BKE_paint_get_overlay_flags(); eOverlayControlFlags flags = BKE_paint_get_overlay_flags();
/* save lots of GL state /* save lots of GL state
@ -1039,8 +1042,9 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
outline_col = brush->add_col; outline_col = brush->add_col;
final_radius = (BKE_brush_size_get(scene, brush) * zoomx); final_radius = (BKE_brush_size_get(scene, brush) * zoomx);
/* don't calculate rake angles while a stroke is active because the rake variables are global and /* don't calculate rake angles while a stroke is active because the rake variables are global
* we may get interference with the stroke itself. For line strokes, such interference is visible */ * and we may get interference with the stroke itself.
* For line strokes, such interference is visible */
if (!ups->stroke_active) { if (!ups->stroke_active) {
paint_calculate_rake_rotation(ups, brush, translation); paint_calculate_rake_rotation(ups, brush, translation);
} }

@ -375,11 +375,14 @@ void paint_brush_init_tex(Brush *brush)
/* init mtex nodes */ /* init mtex nodes */
if (brush) { if (brush) {
MTex *mtex = &brush->mtex; MTex *mtex = &brush->mtex;
if (mtex->tex && mtex->tex->nodetree) if (mtex->tex && mtex->tex->nodetree) {
ntreeTexBeginExecTree(mtex->tex->nodetree); /* has internal flag to detect it only does it once */ /* has internal flag to detect it only does it once */
mtex = &brush->mask_mtex;
if (mtex->tex && mtex->tex->nodetree)
ntreeTexBeginExecTree(mtex->tex->nodetree); ntreeTexBeginExecTree(mtex->tex->nodetree);
}
mtex = &brush->mask_mtex;
if (mtex->tex && mtex->tex->nodetree) {
ntreeTexBeginExecTree(mtex->tex->nodetree);
}
} }
} }
@ -1065,7 +1068,8 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
/* entering paint mode also sets image to editors */ /* entering paint mode also sets image to editors */
if (imapaint->mode == IMAGEPAINT_MODE_MATERIAL) { if (imapaint->mode == IMAGEPAINT_MODE_MATERIAL) {
Material *ma = give_current_material(ob, ob->actcol); /* set the current material active paint slot on image editor */ /* set the current material active paint slot on image editor */
Material *ma = give_current_material(ob, ob->actcol);
if (ma && ma->texpaintslot) if (ma && ma->texpaintslot)
ima = ma->texpaintslot[ma->paint_active_slot].ima; ima = ma->texpaintslot[ma->paint_active_slot].ima;

@ -1520,7 +1520,8 @@ void paint_2d_bucket_fill(
float image_init[2]; float image_init[2];
int minx = ibuf->x, miny = ibuf->y, maxx = 0, maxy = 0; int minx = ibuf->x, miny = ibuf->y, maxx = 0, maxy = 0;
float pixel_color[4]; float pixel_color[4];
/* We are comparing to sum of three squared values (assumed in range [0,1]), so need to multiply... */ /* We are comparing to sum of three squared values
* (assumed in range [0,1]), so need to multiply... */
float threshold_sq = br->fill_threshold * br->fill_threshold * 3; float threshold_sq = br->fill_threshold * br->fill_threshold * 3;
UI_view2d_region_to_view(s->v2d, mouse_init[0], mouse_init[1], &image_init[0], &image_init[1]); UI_view2d_region_to_view(s->v2d, mouse_init[0], mouse_init[1], &image_init[0], &image_init[1]);

@ -169,7 +169,8 @@ BLI_INLINE unsigned char f_to_char(const float val)
#define PROJ_SRC_VIEW_FILL 4 #define PROJ_SRC_VIEW_FILL 4
#define PROJ_VIEW_DATA_ID "view_data" #define PROJ_VIEW_DATA_ID "view_data"
#define PROJ_VIEW_DATA_SIZE (4 * 4 + 4 * 4 + 3) /* viewmat + winmat + clipsta + clipend + is_ortho */ /* viewmat + winmat + clipsta + clipend + is_ortho */
#define PROJ_VIEW_DATA_SIZE (4 * 4 + 4 * 4 + 3)
#define PROJ_BUCKET_NULL 0 #define PROJ_BUCKET_NULL 0
#define PROJ_BUCKET_INIT (1 << 0) #define PROJ_BUCKET_INIT (1 << 0)
@ -407,7 +408,8 @@ typedef struct ProjPixel {
* new mask value is lower then mask_accum */ * new mask value is lower then mask_accum */
unsigned short *mask_accum; unsigned short *mask_accum;
/* horrible hack, store tile valid flag pointer here to re-validate tiles used for anchored and drag-dot strokes */ /* horrible hack, store tile valid flag pointer here to re-validate tiles
* used for anchored and drag-dot strokes */
bool *valid; bool *valid;
PixelPointer origColor; PixelPointer origColor;
@ -635,7 +637,8 @@ static void uvco_to_wrapped_pxco(const float uv[2], int ibuf_x, int ibuf_y, floa
*y = *y * ibuf_y - 0.5f; *y = *y * ibuf_y - 0.5f;
} }
/* Set the top-most face color that the screen space coord 'pt' touches (or return 0 if none touch) */ /* Set the top-most face color that the screen space coord 'pt' touches
* (or return 0 if none touch) */
static bool project_paint_PickColor( static bool project_paint_PickColor(
const ProjPaintState *ps, const float pt[2], const ProjPaintState *ps, const float pt[2],
float *rgba_fp, unsigned char *rgba, const bool interp) float *rgba_fp, unsigned char *rgba, const bool interp)
@ -795,7 +798,8 @@ static int project_paint_occlude_ptv_clip(
/* Check if a screenspace location is occluded by any other faces /* Check if a screenspace location is occluded by any other faces
* check, pixelScreenCo must be in screenspace, its Z-Depth only needs to be used for comparison * check, pixelScreenCo must be in screenspace, its Z-Depth only needs to be used for comparison
* and doesn't need to be correct in relation to X and Y coords (this is the case in perspective view) */ * and doesn't need to be correct in relation to X and Y coords
* (this is the case in perspective view) */
static bool project_bucket_point_occluded( static bool project_bucket_point_occluded(
const ProjPaintState *ps, LinkNode *bucketFace, const ProjPaintState *ps, LinkNode *bucketFace,
const int orig_face, const float pixelScreenCo[4]) const int orig_face, const float pixelScreenCo[4])
@ -1366,8 +1370,10 @@ static float project_paint_uvpixel_mask(
BKE_image_release_ibuf(other_tpage, ibuf_other, NULL); BKE_image_release_ibuf(other_tpage, ibuf_other, NULL);
if (!ps->do_layer_stencil_inv) /* matching the gimps layer mask black/white rules, white==full opacity */ if (!ps->do_layer_stencil_inv) {
/* matching the gimps layer mask black/white rules, white==full opacity */
mask = (1.0f - mask); mask = (1.0f - mask);
}
if (mask == 0.0f) { if (mask == 0.0f) {
return 0.0f; return 0.0f;
@ -1715,7 +1721,8 @@ static bool line_clip_rect2f(
} }
if (fabsf(l1[0] - l2[0]) < PROJ_PIXEL_TOLERANCE) { /* this is a single point (or close to)*/ /* this is a single point (or close to)*/
if (fabsf(l1[0] - l2[0]) < PROJ_PIXEL_TOLERANCE) {
if (BLI_rctf_isect_pt_v(rect, l1)) { if (BLI_rctf_isect_pt_v(rect, l1)) {
copy_v2_v2(l1_clip, l1); copy_v2_v2(l1_clip, l1);
copy_v2_v2(l2_clip, l2); copy_v2_v2(l2_clip, l2);
@ -1743,7 +1750,8 @@ static bool line_clip_rect2f(
return 0; return 0;
} }
if (fabsf(l1[1] - l2[1]) < PROJ_PIXEL_TOLERANCE) { /* this is a single point (or close to)*/ /* this is a single point (or close to)*/
if (fabsf(l1[1] - l2[1]) < PROJ_PIXEL_TOLERANCE) {
if (BLI_rctf_isect_pt_v(rect, l1)) { if (BLI_rctf_isect_pt_v(rect, l1)) {
copy_v2_v2(l1_clip, l1); copy_v2_v2(l1_clip, l1);
copy_v2_v2(l2_clip, l2); copy_v2_v2(l2_clip, l2);
@ -2120,7 +2128,8 @@ static void project_bucket_clip_face(
float bucket_bounds_ss[4][2]; float bucket_bounds_ss[4][2];
/* detect pathological case where face the three vertices are almost collinear in screen space. /* detect pathological case where face the three vertices are almost collinear in screen space.
* mostly those will be culled but when flood filling or with smooth shading it's a possibility */ * mostly those will be culled but when flood filling or with
* smooth shading it's a possibility */
if (min_fff(dist_squared_to_line_v2(v1coSS, v2coSS, v3coSS), if (min_fff(dist_squared_to_line_v2(v1coSS, v2coSS, v3coSS),
dist_squared_to_line_v2(v2coSS, v3coSS, v1coSS), dist_squared_to_line_v2(v2coSS, v3coSS, v1coSS),
dist_squared_to_line_v2(v3coSS, v1coSS, v2coSS)) < PROJ_PIXEL_TOLERANCE) dist_squared_to_line_v2(v3coSS, v1coSS, v2coSS)) < PROJ_PIXEL_TOLERANCE)
@ -2154,7 +2163,8 @@ static void project_bucket_clip_face(
*tot = 3; *tot = 3;
return; return;
} }
/* handle pathological case here, no need for further intersections below since tringle area is almost zero */ /* handle pathological case here,
* no need for further intersections below since tringle area is almost zero */
if (collinear) { if (collinear) {
int flag; int flag;
@ -2202,7 +2212,8 @@ static void project_bucket_clip_face(
} }
/* get the UV space bounding box */ /* get the UV space bounding box */
/* use IsectPT2Df_limit here so we catch points are are touching the tri edge (or a small fraction over) */ /* use IsectPT2Df_limit here so we catch points are are touching the tri edge
* (or a small fraction over) */
bucket_bounds_ss[0][0] = bucket_bounds->xmax; bucket_bounds_ss[0][0] = bucket_bounds->xmax;
bucket_bounds_ss[0][1] = bucket_bounds->ymin; bucket_bounds_ss[0][1] = bucket_bounds->ymin;
inside_face_flag |= (IsectPT2Df_limit(bucket_bounds_ss[0], v1coSS, v2coSS, v3coSS, 1 + PROJ_GEOM_TOLERANCE) ? ISECT_1 : 0); inside_face_flag |= (IsectPT2Df_limit(bucket_bounds_ss[0], v1coSS, v2coSS, v3coSS, 1 + PROJ_GEOM_TOLERANCE) ? ISECT_1 : 0);
@ -2680,7 +2691,8 @@ static void project_paint_face_init(
#if 0 /* TODO - investigate why this dosnt work sometimes! it should! */ #if 0 /* TODO - investigate why this dosnt work sometimes! it should! */
/* no intersection for this entire row, after some intersection above means we can quit now */ /* no intersection for this entire row,
* after some intersection above means we can quit now */
if (has_x_isect == 0 && has_isect) { if (has_x_isect == 0 && has_isect) {
break; break;
} }
@ -2799,15 +2811,17 @@ static void project_paint_face_init(
float fac; float fac;
/* We need to find the closest point along the face edge, /* We need to find the closest point along the face edge,
* getting the screen_px_from_*** wont work because our actual location * getting the screen_px_from_*** wont work because our
* is not relevant, since we are outside the face, Use VecLerpf to find * actual location is not relevant, since we are outside
* our location on the side of the face's UV */ * the face, Use VecLerpf to find our location on the side
* of the face's UV */
#if 0 #if 0
if (is_ortho) screen_px_from_ortho(ps, uv, v1co, v2co, v3co, uv1co, uv2co, uv3co, pixelScreenCo); if (is_ortho) screen_px_from_ortho(ps, uv, v1co, v2co, v3co, uv1co, uv2co, uv3co, pixelScreenCo);
else screen_px_from_persp(ps, uv, v1co, v2co, v3co, uv1co, uv2co, uv3co, pixelScreenCo); else screen_px_from_persp(ps, uv, v1co, v2co, v3co, uv1co, uv2co, uv3co, pixelScreenCo);
#endif #endif
/* Since this is a seam we need to work out where on the line this pixel is */ /* Since this is a seam we need to work out where on
* the line this pixel is */
//fac = line_point_factor_v2(uv, uv_seam_quad[0], uv_seam_quad[1]); //fac = line_point_factor_v2(uv, uv_seam_quad[0], uv_seam_quad[1]);
fac = resolve_quad_u_v2(uv, UNPACK4(seam_subsection)); fac = resolve_quad_u_v2(uv, UNPACK4(seam_subsection));
interp_v3_v3v3(pixelScreenCo, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac); interp_v3_v3v3(pixelScreenCo, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac);
@ -2827,20 +2841,23 @@ static void project_paint_face_init(
if (ps->do_mask_normal || ps->dm_mloopuv_clone) { if (ps->do_mask_normal || ps->dm_mloopuv_clone) {
const float uv_fac = fac1 + (fac * (fac2 - fac1)); const float uv_fac = fac1 + (fac * (fac2 - fac1));
#if 0 #if 0
/* get the UV on the line since we want to copy the pixels from there for bleeding */ /* get the UV on the line since we want to copy the
* pixels from there for bleeding */
float uv_close[2]; float uv_close[2];
interp_v2_v2v2(uv_close, lt_uv_pxoffset[fidx1], lt_uv_pxoffset[fidx2], uv_fac); interp_v2_v2v2(uv_close, lt_uv_pxoffset[fidx1], lt_uv_pxoffset[fidx2], uv_fac);
barycentric_weights_v2(lt_uv_pxoffset[0], lt_uv_pxoffset[1], lt_uv_pxoffset[2], uv_close, w); barycentric_weights_v2(lt_uv_pxoffset[0], lt_uv_pxoffset[1], lt_uv_pxoffset[2], uv_close, w);
#else #else
/* Cheat, we know where we are along the edge so work out the weights from that */ /* Cheat, we know where we are along the edge
* so work out the weights from that */
w[0] = w[1] = w[2] = 0.0; w[0] = w[1] = w[2] = 0.0;
w[fidx1] = 1.0f - uv_fac; w[fidx1] = 1.0f - uv_fac;
w[fidx2] = uv_fac; w[fidx2] = uv_fac;
#endif #endif
} }
/* a pity we need to get the worldspace pixel location here */ /* a pity we need to get the worldspace
* pixel location here */
if (do_clip || do_3d_mapping) { if (do_clip || do_3d_mapping) {
interp_v3_v3v3v3(wco, vCo[0], vCo[1], vCo[2], w); interp_v3_v3v3v3(wco, vCo[0], vCo[1], vCo[2], w);
@ -2863,13 +2880,15 @@ static void project_paint_face_init(
} }
} }
else if (has_x_isect) { else if (has_x_isect) {
/* assuming the face is not a bow-tie - we know we cant intersect again on the X */ /* assuming the face is not a bow-tie - we know
* we cant intersect again on the X */
break; break;
} }
} }
#if 0 /* TODO - investigate why this dosnt work sometimes! it should! */ #if 0 /* TODO - investigate why this dosnt work sometimes! it should! */
/* no intersection for this entire row, after some intersection above means we can quit now */ /* no intersection for this entire row,
* after some intersection above means we can quit now */
if (has_x_isect == 0 && has_isect) { if (has_x_isect == 0 && has_isect) {
break; break;
} }
@ -2979,13 +2998,14 @@ static void project_bucket_init(
/* We want to know if a bucket and a face overlap in screen-space /* We want to know if a bucket and a face overlap in screen-space
* *
* Note, if this ever returns false positives its not that bad, since a face in the bounding area will have its pixels * Note, if this ever returns false positives its not that bad, since a face in the bounding area
* calculated when it might not be needed later, (at the moment at least) * will have its pixels calculated when it might not be needed later, (at the moment at least)
* obviously it shouldn't have bugs though */ * obviously it shouldn't have bugs though */
static bool project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucket_y, const MLoopTri *lt) static bool project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucket_y, const MLoopTri *lt)
{ {
/* TODO - replace this with a tricker method that uses sideofline for all screenCoords's edges against the closest bucket corner */ /* TODO - replace this with a tricker method that uses sideofline for all
* screenCoords's edges against the closest bucket corner */
const int lt_vtri[3] = { PS_LOOPTRI_AS_VERT_INDEX_3(ps, lt) }; const int lt_vtri[3] = { PS_LOOPTRI_AS_VERT_INDEX_3(ps, lt) };
rctf bucket_bounds; rctf bucket_bounds;
float p1[2], p2[2], p3[2], p4[2]; float p1[2], p2[2], p3[2], p4[2];
@ -3069,7 +3089,8 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MLoopTri *
} }
} }
/* no intersection for this entire row, after some intersection above means we can quit now */ /* no intersection for this entire row,
* after some intersection above means we can quit now */
if (has_x_isect == 0 && has_isect) { if (has_x_isect == 0 && has_isect) {
break; break;
} }
@ -3385,7 +3406,8 @@ static void proj_paint_state_vert_flags_init(ProjPaintState *ps)
} }
if (ps->is_ortho) { if (ps->is_ortho) {
if (dot_v3v3(ps->viewDir, no) <= ps->normal_angle__cos) { /* 1 vert of this face is towards us */ if (dot_v3v3(ps->viewDir, no) <= ps->normal_angle__cos) {
/* 1 vert of this face is towards us */
ps->vertFlags[a] |= PROJ_VERT_CULL; ps->vertFlags[a] |= PROJ_VERT_CULL;
} }
} }
@ -3395,7 +3417,8 @@ static void proj_paint_state_vert_flags_init(ProjPaintState *ps)
if (UNLIKELY(ps->is_flip_object)) { if (UNLIKELY(ps->is_flip_object)) {
negate_v3(viewDirPersp); negate_v3(viewDirPersp);
} }
if (dot_v3v3(viewDirPersp, no) <= ps->normal_angle__cos) { /* 1 vert of this face is towards us */ if (dot_v3v3(viewDirPersp, no) <= ps->normal_angle__cos) {
/* 1 vert of this face is towards us */
ps->vertFlags[a] |= PROJ_VERT_CULL; ps->vertFlags[a] |= PROJ_VERT_CULL;
} }
} }
@ -3786,7 +3809,8 @@ static void project_paint_prepare_all_faces(
image_index = BLI_linklist_index(image_LinkList.list, tpage); image_index = BLI_linklist_index(image_LinkList.list, tpage);
if (image_index == -1 && BKE_image_has_ibuf(tpage, NULL)) { /* MemArena dosnt have an append func */ if (image_index == -1 && BKE_image_has_ibuf(tpage, NULL)) {
/* MemArena dosnt have an append func */
BLI_linklist_append(&image_LinkList, tpage); BLI_linklist_append(&image_LinkList, tpage);
image_index = ps->image_tot; image_index = ps->image_tot;
ps->image_tot++; ps->image_tot++;
@ -4519,7 +4543,8 @@ static void *do_projectpaint_thread(void *ph_v)
softenArena = BLI_memarena_new(MEM_SIZE_OPTIMAL(1 << 16), "paint soften arena"); softenArena = BLI_memarena_new(MEM_SIZE_OPTIMAL(1 << 16), "paint soften arena");
} }
/* printf("brush bounds %d %d %d %d\n", bucketMin[0], bucketMin[1], bucketMax[0], bucketMax[1]); */ /* printf("brush bounds %d %d %d %d\n",
* bucketMin[0], bucketMin[1], bucketMax[0], bucketMax[1]); */
while (project_bucket_iter_next(ps, &bucket_index, &bucket_bounds, pos)) { while (project_bucket_iter_next(ps, &bucket_index, &bucket_bounds, pos)) {
@ -5069,7 +5094,8 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int
Brush *brush = ps->brush; Brush *brush = ps->brush;
ps->tool = brush->imagepaint_tool; ps->tool = brush->imagepaint_tool;
ps->blend = brush->blend; ps->blend = brush->blend;
/* only check for inversion for the soften tool, elsewhere, a resident brush inversion flag can cause issues */ /* only check for inversion for the soften tool, elsewhere,
* a resident brush inversion flag can cause issues */
if (brush->imagepaint_tool == PAINT_TOOL_SOFTEN) { if (brush->imagepaint_tool == PAINT_TOOL_SOFTEN) {
ps->mode = (((ps->mode == BRUSH_STROKE_INVERT) ^ ((brush->flag & BRUSH_DIR_IN) != 0)) ? ps->mode = (((ps->mode == BRUSH_STROKE_INVERT) ^ ((brush->flag & BRUSH_DIR_IN) != 0)) ?
BRUSH_STROKE_INVERT : BRUSH_STROKE_NORMAL); BRUSH_STROKE_INVERT : BRUSH_STROKE_NORMAL);
@ -5546,7 +5572,8 @@ void BKE_paint_data_warning(struct ReportList *reports, bool uvs, bool mat, bool
); );
} }
/* Make sure that active object has a material, and assign UVs and image layers if they do not exist */ /* Make sure that active object has a material,
* and assign UVs and image layers if they do not exist */
bool BKE_paint_proj_mesh_data_check(Scene *scene, Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil) bool BKE_paint_proj_mesh_data_check(Scene *scene, Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil)
{ {
Mesh *me; Mesh *me;

@ -486,7 +486,8 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
data.symmpass = symmpass; data.symmpass = symmpass;
/* gather nodes inside lasso's enclosing rectangle (should greatly help with bigger meshes) */ /* gather nodes inside lasso's enclosing rectangle
* (should greatly help with bigger meshes) */
BKE_pbvh_search_gather(pbvh, BKE_pbvh_node_planes_contain_AABB, clip_planes_final, &nodes, &totnode); BKE_pbvh_search_gather(pbvh, BKE_pbvh_node_planes_contain_AABB, clip_planes_final, &nodes, &totnode);
data.task_data.ob = ob; data.task_data.ob = ob;

@ -461,8 +461,11 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, const float
} }
/* This can be removed once fixed properly in /* This can be removed once fixed properly in
* BKE_brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user) * BKE_brush_painter_paint(
* at zero pressure we should do nothing 1/2^12 is 0.0002 which is the sensitivity of the most sensitive pen tablet available */ * BrushPainter *painter, BrushFunc func,
* float *pos, double time, float pressure, void *user);
* at zero pressure we should do nothing 1/2^12 is 0.0002
* which is the sensitivity of the most sensitive pen tablet available */
if (tablet && (pressure < 0.0002f) && if (tablet && (pressure < 0.0002f) &&
((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) ||
BKE_brush_use_alpha_pressure(scene, pop->s.brush) || BKE_brush_use_alpha_pressure(scene, pop->s.brush) ||
@ -947,7 +950,7 @@ static void paint_stroke_sample_average(
mul_v2_fl(average->mouse, 1.0f / stroke->num_samples); mul_v2_fl(average->mouse, 1.0f / stroke->num_samples);
average->pressure /= stroke->num_samples; average->pressure /= stroke->num_samples;
/*printf("avg=(%f, %f), num=%d\n", average->mouse[0], average->mouse[1], stroke->num_samples);*/ // printf("avg=(%f, %f), num=%d\n", average->mouse[0], average->mouse[1], stroke->num_samples);
} }
/** /**

@ -789,7 +789,8 @@ static void do_weight_paint_vertex_single(
dv, wpi->defbase_tot, wpi->vgroup_validmap, wpi->lock_flags, wpi->active.lock); dv, wpi->defbase_tot, wpi->vgroup_validmap, wpi->lock_flags, wpi->active.lock);
if (index_mirr != -1) { if (index_mirr != -1) {
/* only normalize if this is not a center vertex, else we get a conflict, normalizing twice */ /* only normalize if this is not a center vertex,
* else we get a conflict, normalizing twice */
if (index != index_mirr) { if (index != index_mirr) {
do_weight_paint_normalize_all_locked_try_active( do_weight_paint_normalize_all_locked_try_active(
dv_mirr, wpi->defbase_tot, wpi->vgroup_validmap, wpi->lock_flags, wpi->mirror.lock); dv_mirr, wpi->defbase_tot, wpi->vgroup_validmap, wpi->lock_flags, wpi->mirror.lock);
@ -2071,7 +2072,8 @@ static void wpaint_do_radial_symmetry(
} }
} }
/* near duplicate of: sculpt.c's, 'do_symmetrical_brush_actions' and 'vpaint_do_symmetrical_brush_actions'. */ /* near duplicate of: sculpt.c's,
* 'do_symmetrical_brush_actions' and 'vpaint_do_symmetrical_brush_actions'. */
static void wpaint_do_symmetrical_brush_actions( static void wpaint_do_symmetrical_brush_actions(
bContext *C, Object *ob, VPaint *wp, Sculpt *sd, struct WPaintData *wpd, WeightPaintInfo *wpi) bContext *C, Object *ob, VPaint *wp, Sculpt *sd, struct WPaintData *wpd, WeightPaintInfo *wpi)
{ {
@ -2090,7 +2092,8 @@ static void wpaint_do_symmetrical_brush_actions(
cache->symmetry = symm; cache->symmetry = symm;
/* symm is a bit combination of XYZ - 1 is mirror X; 2 is Y; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */ /* symm is a bit combination of XYZ - 1 is mirror
* X; 2 is Y; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */
for (i = 1; i <= symm; i++) { for (i = 1; i <= symm; i++) {
if ((symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5)))) { if ((symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5)))) {
cache->mirror_symmetry_pass = i; cache->mirror_symmetry_pass = i;
@ -2742,7 +2745,8 @@ static void do_vpaint_brush_blur_task_cb_ex(
col[2] = round_fl_to_uchar(sqrtf(divide_round_i(blend[2], total_hit_loops))); col[2] = round_fl_to_uchar(sqrtf(divide_round_i(blend[2], total_hit_loops)));
col[3] = round_fl_to_uchar(sqrtf(divide_round_i(blend[3], total_hit_loops))); col[3] = round_fl_to_uchar(sqrtf(divide_round_i(blend[3], total_hit_loops)));
/* For each poly owning this vert, paint each loop belonging to this vert. */ /* For each poly owning this vert,
* paint each loop belonging to this vert. */
for (int j = 0; j < gmap->vert_to_poly[v_index].count; j++) { for (int j = 0; j < gmap->vert_to_poly[v_index].count; j++) {
const int p_index = gmap->vert_to_poly[v_index].indices[j]; const int p_index = gmap->vert_to_poly[v_index].indices[j];
const int l_index = gmap->vert_to_loop[v_index].indices[j]; const int l_index = gmap->vert_to_loop[v_index].indices[j];
@ -2839,7 +2843,8 @@ static void do_vpaint_brush_smear_task_cb_ex(
* to neighbor direction is 0.0, meaning orthogonal. */ * to neighbor direction is 0.0, meaning orthogonal. */
float stroke_dot_max = 0.0f; float stroke_dot_max = 0.0f;
/* Get the color of the loop in the opposite direction of the brush movement */ /* Get the color of the loop in the opposite
* direction of the brush movement */
uint color_final = 0; uint color_final = 0;
for (int j = 0; j < gmap->vert_to_poly[v_index].count; j++) { for (int j = 0; j < gmap->vert_to_poly[v_index].count; j++) {
const int p_index = gmap->vert_to_poly[v_index].indices[j]; const int p_index = gmap->vert_to_poly[v_index].indices[j];
@ -2854,7 +2859,8 @@ static void do_vpaint_brush_smear_task_cb_ex(
if (v_other_index != v_index) { if (v_other_index != v_index) {
const MVert *mv_other = &data->me->mvert[v_other_index]; const MVert *mv_other = &data->me->mvert[v_other_index];
/* Get the direction from the selected vert to the neighbor. */ /* Get the direction from the
* selected vert to the neighbor. */
float other_dir[3]; float other_dir[3];
sub_v3_v3v3(other_dir, mv_curr->co, mv_other->co); sub_v3_v3v3(other_dir, mv_curr->co, mv_other->co);
project_plane_v3_v3v3(other_dir, other_dir, cache->view_normal); project_plane_v3_v3v3(other_dir, other_dir, cache->view_normal);
@ -2878,7 +2884,8 @@ static void do_vpaint_brush_smear_task_cb_ex(
255 * brush_fade * brush_strength * 255 * brush_fade * brush_strength *
brush_alpha_pressure * grid_alpha; brush_alpha_pressure * grid_alpha;
/* For each poly owning this vert, paint each loop belonging to this vert. */ /* For each poly owning this vert,
* paint each loop belonging to this vert. */
for (int j = 0; j < gmap->vert_to_poly[v_index].count; j++) { for (int j = 0; j < gmap->vert_to_poly[v_index].count; j++) {
const int p_index = gmap->vert_to_poly[v_index].indices[j]; const int p_index = gmap->vert_to_poly[v_index].indices[j];
const int l_index = gmap->vert_to_loop[v_index].indices[j]; const int l_index = gmap->vert_to_loop[v_index].indices[j];
@ -3019,7 +3026,8 @@ static void vpaint_do_radial_symmetry(
} }
} }
/* near duplicate of: sculpt.c's, 'do_symmetrical_brush_actions' and 'wpaint_do_symmetrical_brush_actions'. */ /* near duplicate of: sculpt.c's,
* 'do_symmetrical_brush_actions' and 'wpaint_do_symmetrical_brush_actions'. */
static void vpaint_do_symmetrical_brush_actions( static void vpaint_do_symmetrical_brush_actions(
bContext *C, Sculpt *sd, VPaint *vp, struct VPaintData *vpd, Object *ob) bContext *C, Sculpt *sd, VPaint *vp, struct VPaintData *vpd, Object *ob)
{ {
@ -3038,7 +3046,8 @@ static void vpaint_do_symmetrical_brush_actions(
cache->symmetry = symm; cache->symmetry = symm;
/* symm is a bit combination of XYZ - 1 is mirror X; 2 is Y; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */ /* symm is a bit combination of XYZ - 1 is mirror
* X; 2 is Y; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */
for (i = 1; i <= symm; i++) { for (i = 1; i <= symm; i++) {
if (symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5))) { if (symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5))) {
cache->mirror_symmetry_pass = i; cache->mirror_symmetry_pass = i;

@ -210,7 +210,8 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *even
const int vgroup_active = vc.obact->actdef - 1; const int vgroup_active = vc.obact->actdef - 1;
float vgroup_weight = defvert_find_weight(&me->dvert[v_idx_best], vgroup_active); float vgroup_weight = defvert_find_weight(&me->dvert[v_idx_best], vgroup_active);
/* use combined weight in multipaint mode, since that's what is displayed to the user in the colors */ /* use combined weight in multipaint mode,
* since that's what is displayed to the user in the colors */
if (ts->multipaint) { if (ts->multipaint) {
int defbase_tot_sel; int defbase_tot_sel;
const int defbase_tot = BLI_listbase_count(&vc.obact->defbase); const int defbase_tot = BLI_listbase_count(&vc.obact->defbase);
@ -225,7 +226,8 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *even
vgroup_weight = BKE_defvert_multipaint_collective_weight( vgroup_weight = BKE_defvert_multipaint_collective_weight(
&me->dvert[v_idx_best], defbase_tot, defbase_sel, defbase_tot_sel, ts->auto_normalize); &me->dvert[v_idx_best], defbase_tot, defbase_sel, defbase_tot_sel, ts->auto_normalize);
/* if autonormalize is enabled, but weights are not normalized, the value can exceed 1 */ /* if autonormalize is enabled, but weights are not normalized,
* the value can exceed 1 */
CLAMP(vgroup_weight, 0.0f, 1.0f); CLAMP(vgroup_weight, 0.0f, 1.0f);
} }
@ -372,7 +374,8 @@ static int weight_sample_group_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }
/* TODO, we could make this a menu into OBJECT_OT_vertex_group_set_active rather than its own operator */ /* TODO, we could make this a menu into OBJECT_OT_vertex_group_set_active
* rather than its own operator */
void PAINT_OT_weight_sample_group(wmOperatorType *ot) void PAINT_OT_weight_sample_group(wmOperatorType *ot)
{ {
PropertyRNA *prop = NULL; PropertyRNA *prop = NULL;

@ -106,7 +106,8 @@
* *
* \{ */ * \{ */
/* Check if there are any active modifiers in stack (used for flushing updates at enter/exit sculpt mode) */ /* Check if there are any active modifiers in stack
* (used for flushing updates at enter/exit sculpt mode) */
static bool sculpt_has_active_modifiers(Scene *scene, Object *ob) static bool sculpt_has_active_modifiers(Scene *scene, Object *ob)
{ {
ModifierData *md; ModifierData *md;
@ -2453,7 +2454,8 @@ static void do_snake_hook_brush_task_cb_ex(
project_plane_v3_v3v3(delta_pinch, delta_pinch, ss->cache->true_view_normal); project_plane_v3_v3v3(delta_pinch, delta_pinch, ss->cache->true_view_normal);
} }
/* important to calculate based on the grabbed location (intentionally ignore fade here). */ /* important to calculate based on the grabbed location
* (intentionally ignore fade here). */
add_v3_v3(delta_pinch, grab_delta); add_v3_v3(delta_pinch, grab_delta);
sculpt_project_v3(spvc, delta_pinch, delta_pinch); sculpt_project_v3(spvc, delta_pinch, delta_pinch);
@ -3951,7 +3953,8 @@ static void do_tiled(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings
const float *step = sd->paint.tile_offset; const float *step = sd->paint.tile_offset;
int dim; int dim;
/* These are integer locations, for real location: multiply with step and add orgLoc. So 0,0,0 is at orgLoc. */ /* These are integer locations, for real location: multiply with step and add orgLoc.
* So 0,0,0 is at orgLoc. */
int start[3]; int start[3];
int end[3]; int end[3];
int cur[3]; int cur[3];
@ -4343,7 +4346,8 @@ static void sculpt_update_cache_invariants(
if (ss->bm) { if (ss->bm) {
/* Free any remaining layer displacements from nodes. If not and topology changes /* Free any remaining layer displacements from nodes. If not and topology changes
* from using another tool, then next layer toolstroke can access past disp array bounds */ * from using another tool, then next layer toolstroke
* can access past disp array bounds */
BKE_pbvh_free_layer_disp(ss->pbvh); BKE_pbvh_free_layer_disp(ss->pbvh);
} }
} }
@ -4795,8 +4799,10 @@ static void sculpt_brush_init_tex(const Scene *scene, Sculpt *sd, SculptSession
MTex *mtex = &brush->mtex; MTex *mtex = &brush->mtex;
/* init mtex nodes */ /* init mtex nodes */
if (mtex->tex && mtex->tex->nodetree) if (mtex->tex && mtex->tex->nodetree) {
ntreeTexBeginExecTree(mtex->tex->nodetree); /* has internal flag to detect it only does it once */ /* has internal flag to detect it only does it once */
ntreeTexBeginExecTree(mtex->tex->nodetree);
}
/* TODO: Shouldn't really have to do this at the start of every /* TODO: Shouldn't really have to do this at the start of every
* stroke, but sculpt would need some sort of notification when * stroke, but sculpt would need some sort of notification when
@ -4914,7 +4920,8 @@ static bool sculpt_stroke_test_start(bContext *C, struct wmOperator *op,
{ {
/* Don't start the stroke until mouse goes over the mesh. /* Don't start the stroke until mouse goes over the mesh.
* note: mouse will only be null when re-executing the saved stroke. * note: mouse will only be null when re-executing the saved stroke.
* We have exception for 'exec' strokes since they may not set 'mouse', only 'location', see: T52195. */ * We have exception for 'exec' strokes since they may not set 'mouse',
* only 'location', see: T52195. */
if (((op->flag & OP_IS_INVOKE) == 0) || if (((op->flag & OP_IS_INVOKE) == 0) ||
(mouse == NULL) || over_mesh(C, op, mouse[0], mouse[1])) (mouse == NULL) || over_mesh(C, op, mouse[0], mouse[1]))
{ {
@ -5159,7 +5166,7 @@ static void SCULPT_OT_brush_stroke(wmOperatorType *ot)
"Clicks on the background do not start the stroke"); "Clicks on the background do not start the stroke");
} }
/**** Reset the copy of the mesh that is being sculpted on (currently just for the layer brush) ****/ /* Reset the copy of the mesh that is being sculpted on (currently just for the layer brush) */
static int sculpt_set_persistent_base_exec(bContext *C, wmOperator *UNUSED(op)) static int sculpt_set_persistent_base_exec(bContext *C, wmOperator *UNUSED(op))
{ {

@ -84,7 +84,8 @@ typedef struct UvAdjacencyElement {
typedef struct UvEdge { typedef struct UvEdge {
unsigned int uv1; unsigned int uv1;
unsigned int uv2; unsigned int uv2;
/* general use flag (Used to check if edge is boundary here, and propagates to adjacency elements) */ /* general use flag
* (Used to check if edge is boundary here, and propagates to adjacency elements) */
char flag; char flag;
} UvEdge; } UvEdge;
@ -745,7 +746,8 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm
edges[counter].uv1 = offset2; edges[counter].uv1 = offset2;
edges[counter].uv2 = offset1; edges[counter].uv2 = offset1;
} }
/* Hack! Set the value of the key to its flag. Now we can set the flag when an edge exists twice :) */ /* Hack! Set the value of the key to its flag.
* Now we can set the flag when an edge exists twice :) */
flag = BLI_ghash_lookup(edgeHash, &edges[counter]); flag = BLI_ghash_lookup(edgeHash, &edges[counter]);
if (flag) { if (flag) {
*flag = 1; *flag = 1;

@ -814,7 +814,8 @@ static void SOUND_OT_unpack(wmOperatorType *ot)
/* properties */ /* properties */
RNA_def_enum(ot->srna, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "Method", "How to unpack"); RNA_def_enum(ot->srna, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "Method", "How to unpack");
RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Sound Name", "Sound data-block name to unpack"); /* XXX, weark!, will fail with library, name collisions */ /* XXX, weark!, will fail with library, name collisions */
RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Sound Name", "Sound data-block name to unpack");
} }
/* ******************************************************* */ /* ******************************************************* */

@ -867,7 +867,8 @@ static bool action_layer_prev_poll(bContext *C)
AnimData *adt = ED_actedit_animdata_from_context(C); AnimData *adt = ED_actedit_animdata_from_context(C);
if (adt) { if (adt) {
if (adt->flag & ADT_NLA_EDIT_ON) { if (adt->flag & ADT_NLA_EDIT_ON) {
/* Tweak Mode: We need to check if there are any tracks below the active one that we can move to */ /* Tweak Mode: We need to check if there are any tracks below the active one
* that we can move to */
if (adt->nla_tracks.first) { if (adt->nla_tracks.first) {
NlaTrack *nlt = (NlaTrack *)adt->nla_tracks.first; NlaTrack *nlt = (NlaTrack *)adt->nla_tracks.first;

@ -325,7 +325,8 @@ static bool actkeys_channels_get_selected_extents(bAnimContext *ac, float *min,
bAnimListElem *ale; bAnimListElem *ale;
int filter; int filter;
short found = 0; /* NOTE: not bool, since we want prioritise individual channels over expanders */ /* NOTE: not bool, since we want prioritise individual channels over expanders */
short found = 0;
float y; float y;
/* get all items - we need to do it this way */ /* get all items - we need to do it this way */
@ -535,8 +536,9 @@ static short paste_action_keys(bAnimContext *ac,
*/ */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
if (ANIM_animdata_filter(ac, &anim_data, filter | ANIMFILTER_SEL, ac->data, ac->datatype) == 0) if (ANIM_animdata_filter(ac, &anim_data, filter | ANIMFILTER_SEL, ac->data, ac->datatype) == 0) {
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
}
/* paste keyframes */ /* paste keyframes */
ok = paste_animedit_keys(ac, &anim_data, offset_mode, merge_mode, flip); ok = paste_animedit_keys(ac, &anim_data, offset_mode, merge_mode, flip);
@ -681,8 +683,12 @@ static void insert_action_keys(bAnimContext *ac, short mode)
/* filter data */ /* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
if (mode == 2) filter |= ANIMFILTER_SEL; if (mode == 2) {
else if (mode == 3) filter |= ANIMFILTER_ACTGROUPED; filter |= ANIMFILTER_SEL;
}
else if (mode == 3) {
filter |= ANIMFILTER_ACTGROUPED;
}
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@ -819,10 +825,12 @@ static void duplicate_action_keys(bAnimContext *ac)
int filter; int filter;
/* filter data */ /* filter data */
if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
else }
else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
}
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and delete selected keys */ /* loop through filtered data and delete selected keys */
@ -887,10 +895,12 @@ static bool delete_action_keys(bAnimContext *ac)
bool changed_final = false; bool changed_final = false;
/* filter data */ /* filter data */
if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
else }
else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
}
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and delete selected keys */ /* loop through filtered data and delete selected keys */
@ -1574,10 +1584,12 @@ static void snap_action_keys(bAnimContext *ac, short mode)
KeyframeEditFunc edit_cb; KeyframeEditFunc edit_cb;
/* filter data */ /* filter data */
if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT); filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
else }
else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
}
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* get beztriple editing callbacks */ /* get beztriple editing callbacks */
@ -1697,10 +1709,12 @@ static void mirror_action_keys(bAnimContext *ac, short mode)
} }
/* filter data */ /* filter data */
if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
else }
else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
}
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* mirror keyframes */ /* mirror keyframes */

@ -94,10 +94,12 @@ static void deselect_action_keys(bAnimContext *ac, short test, short sel)
KeyframeEditFunc test_cb, sel_cb; KeyframeEditFunc test_cb, sel_cb;
/* determine type-based settings */ /* determine type-based settings */
if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS); filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
else }
else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
}
/* filter data */ /* filter data */
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@ -1053,10 +1055,12 @@ static void actkeys_select_leftright(bAnimContext *ac, short leftright, short se
} }
/* filter data */ /* filter data */
if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS); filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
else }
else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
}
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* select keys */ /* select keys */
@ -1245,7 +1249,8 @@ static void actkeys_mselect_single(bAnimContext *ac, bAnimListElem *ale, short s
} }
} }
/* Option 2) Selects all the keyframes on either side of the current frame (depends on which side the mouse is on) */ /* Option 2) Selects all the keyframes on either side of the current frame
* (depends on which side the mouse is on) */
/* (see actkeys_select_leftright) */ /* (see actkeys_select_leftright) */
/* Option 3) Selects all visible keyframes in the same frame as the mouse click */ /* Option 3) Selects all visible keyframes in the same frame as the mouse click */
@ -1265,10 +1270,12 @@ static void actkeys_mselect_column(bAnimContext *ac, short select_mode, float se
/* loop through all of the keys and select additional keyframes /* loop through all of the keys and select additional keyframes
* based on the keys found to be selected above * based on the keys found to be selected above
*/ */
if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS); filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS);
else }
else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS); filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
}
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
for (ale = anim_data.first; ale; ale = ale->next) { for (ale = anim_data.first; ale; ale = ale->next) {
@ -1366,8 +1373,11 @@ static void mouse_action_keys(bAnimContext *ac, const int mval[2], short select_
/* x-range to check is +/- 7px for standard keyframe under standard dpi/y-scale (in screen/region-space), /* x-range to check is +/- 7px for standard keyframe under standard dpi/y-scale (in screen/region-space),
* on either side of mouse click (size of keyframe icon) * 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 targeting) */ /* standard channel height (to allow for some slop) */
key_hsize = ACHANNEL_HEIGHT(ac) * 0.8f;
/* half-size (for either side), but rounded up to nearest int (for easier targeting) */
key_hsize = roundf(key_hsize / 2.0f);
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.xmin, &rectf.ymin);
UI_view2d_region_to_view(v2d, mval[0] + (int)key_hsize, mval[1], &rectf.xmax, &rectf.ymax); UI_view2d_region_to_view(v2d, mval[0] + (int)key_hsize, mval[1], &rectf.xmax, &rectf.ymax);
@ -1440,7 +1450,8 @@ static void mouse_action_keys(bAnimContext *ac, const int mval[2], short select_
mask_to_keylist(ads, masklay, &anim_keys); mask_to_keylist(ads, masklay, &anim_keys);
} }
/* start from keyframe at root of BST, traversing until we find one within the range that was clicked on */ /* start from keyframe at root of BST,
* traversing until we find one within the range that was clicked on */
for (ak = anim_keys.root; ak; ak = akn) { for (ak = anim_keys.root; ak; ak = akn) {
if (IN_RANGE(ak->cfra, rectf.xmin, rectf.xmax)) { if (IN_RANGE(ak->cfra, rectf.xmin, rectf.xmax)) {
/* set the frame to use, and apply inverse-correction for NLA-mapping /* set the frame to use, and apply inverse-correction for NLA-mapping

@ -424,7 +424,8 @@ static void action_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn)
saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC; saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC;
ED_area_tag_refresh(sa); ED_area_tag_refresh(sa);
} }
/* autocolor only really needs to change when channels are added/removed, or previously hidden stuff appears /* autocolor only really needs to change when channels are added/removed,
* or previously hidden stuff appears
* (assume for now that if just adding these works, that will be fine) * (assume for now that if just adding these works, that will be fine)
*/ */
else if (((wmn->data == ND_KEYFRAME) && ELEM(wmn->action, NA_ADDED, NA_REMOVED)) || else if (((wmn->data == ND_KEYFRAME) && ELEM(wmn->action, NA_ADDED, NA_REMOVED)) ||
@ -432,7 +433,8 @@ static void action_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn)
{ {
ED_area_tag_refresh(sa); ED_area_tag_refresh(sa);
} }
/* for simple edits to the curve data though (or just plain selections), a simple redraw should work /* for simple edits to the curve data though (or just plain selections),
* a simple redraw should work
* (see T39851 for an example of how this can go wrong) * (see T39851 for an example of how this can go wrong)
*/ */
else { else {
@ -454,7 +456,8 @@ static void action_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn)
break; break;
case NC_OBJECT: case NC_OBJECT:
switch (wmn->data) { switch (wmn->data) {
case ND_BONE_SELECT: /* selection changed, so force refresh to flush (needs flag set to do syncing) */ case ND_BONE_SELECT: /* selection changed, so force refresh to flush
* (needs flag set to do syncing) */
case ND_BONE_ACTIVE: case ND_BONE_ACTIVE:
saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC; saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC;
ED_area_tag_refresh(sa); ED_area_tag_refresh(sa);

@ -766,7 +766,8 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1; return 1;
} }
else if (CTX_data_equals(member, "scene")) { else if (CTX_data_equals(member, "scene")) {
/* Do not return one here if scene not found in path, in this case we want to get default context scene! */ /* Do not return one here if scene not found in path,
* in this case we want to get default context scene! */
return set_pointer_type(path, result, &RNA_Scene); return set_pointer_type(path, result, &RNA_Scene);
} }
else if (CTX_data_equals(member, "world")) { else if (CTX_data_equals(member, "world")) {
@ -1146,7 +1147,7 @@ void buttons_context_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype buttons panel context"); pt = MEM_callocN(sizeof(PanelType), "spacetype buttons panel context");
strcpy(pt->idname, "BUTTONS_PT_context"); strcpy(pt->idname, "BUTTONS_PT_context");
strcpy(pt->label, N_("Context")); /* XXX C panels are not available through RNA (bpy.types)! */ strcpy(pt->label, N_("Context")); /* XXX C panels unavailable through RNA bpy.types! */
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->draw = buttons_panel_context; pt->draw = buttons_panel_context;
pt->flag = PNL_NO_HEADER; pt->flag = PNL_NO_HEADER;

Some files were not shown because too many files have changed in this diff Show More