From 8ebd5ddd0e9c3be35a5da1b9b5e06ea2e0393761 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 6 Mar 2013 01:44:12 +0000 Subject: Experimental Feature: Ctrl-Click on the "name" of a broken F-Curve now allows you to fix the RNA Path in-place For F-Curves that are disabled or marked as having errors because their paths are invalid (indicated with a red line underneath their names), it is now possible to use the Ctrl-Click renaming functionality to bring up a textbox for fixing the offending RNA Path "in place" (i.e. in the channels list) without having to bring up the properties region first. This makes it easier to fix the paths if you know what you're doing. However, caution is still advised for most people. In particular, be aware that this uses a separate "RNA Array Index" for indexing into array properties (i.e. location, rotation, color) which will not be shown here, and can only be edited from the panel (or datablocks editor/scripts). --- .../blender/editors/animation/anim_channels_defines.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index ad6098010f8..2d154ec7273 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -893,6 +893,23 @@ static void acf_fcurve_name(bAnimListElem *ale, char *name) getname_anim_fcurve(name, ale->id, ale->data); } +/* "name" property for fcurve entries */ +static short acf_fcurve_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop) +{ + FCurve *fcu = (FCurve *)ale->data; + + /* Ctrl-Click Usability Convenience Hack: + * For disabled F-Curves, allow access to the RNA Path + * as our "name" so that user can perform quick fixes + */ + if (fcu->flag & FCURVE_DISABLED) { + RNA_pointer_create(ale->id, &RNA_FCurve, ale->data, ptr); + *prop = RNA_struct_find_property(ptr, "data_path"); + } + + return (*prop != NULL); +} + /* check if some setting exists for this channel */ static short acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) { @@ -964,7 +981,7 @@ static bAnimChannelType ACF_FCURVE = acf_generic_group_offset, /* offset */ acf_fcurve_name, /* name */ - NULL, /* name prop */ + acf_fcurve_name_prop, /* name prop */ NULL, /* icon */ acf_fcurve_setting_valid, /* has setting */ -- cgit v1.2.3 From c27010582e25968a2c4e87d6090a1d1ba763b714 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 6 Mar 2013 01:59:09 +0000 Subject: Bugfix [#32492] - Part 3: Error filter now includes drivers where there are errors with the variables/targets, even if those errors are for variables which aren't used (and are hence "harmless" errors) This means that the filter can be truly useful for helping locate things that need "cleaning up". For example, previously, there could still have been drivers where there were some of these "harmless" errors would emit warnings, but would otherwise appear perfectly functional. The implementation here uses a slightly slower method of checking any errors in these driver vars. However, it's no slower than what's done when these are evaluated, and should be less error prone than introducing yet another type of error tagging for this one case. The problem here is that the "driver invalid" flag, which is usually set when a target has errors, gets cleared by the pydrivers code if nothing went wrong when evaluating the expression. Removing this clearing step will probably open a can of worms, so unless this method proves to be far too slow, this simpler fix will do. --- source/blender/editors/animation/anim_filter.c | 31 ++++++++++++++++++++------ 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index ec6172d5041..e1ac5fa605b 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -983,22 +983,39 @@ static short skip_fcurve_with_name(bDopeSheet *ads, FCurve *fcu, ID *owner_id) /* Check if F-Curve has errors and/or is disabled * > returns: (bool) True if F-Curve has errors/is disabled */ -static short fcurve_has_errors(FCurve *fcu) +static bool fcurve_has_errors(FCurve *fcu) { /* F-Curve disabled - path eval error */ if (fcu->flag & FCURVE_DISABLED) { - return 1; + return true; } /* driver? */ if (fcu->driver) { - /* for now, just check if the entire thing got disabled... */ - if (fcu->driver->flag & DRIVER_FLAG_INVALID) - return 1; + ChannelDriver *driver = fcu->driver; + DriverVar *dvar; + + /* error flag on driver usually means that there is an error + * BUT this may not hold with PyDrivers as this flag gets cleared + * if no critical errors prevent the driver from working... + */ + if (driver->flag & DRIVER_FLAG_INVALID) + return true; + + /* check variables for other things that need linting... */ + // TODO: maybe it would be more efficient just to have a quick flag for this? + for (dvar = driver->variables.first; dvar; dvar = dvar->next) { + DRIVER_TARGETS_USED_LOOPER(dvar) + { + if (dtar->flag & DTAR_FLAG_INVALID) + return true; + } + DRIVER_TARGETS_LOOPER_END + } } /* no errors found */ - return 0; + return false; } /* find the next F-Curve that is usable for inclusion */ @@ -1042,7 +1059,7 @@ static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, bActionGro /* error-based filtering... */ if ((ads) && (ads->filterflag & ADS_FILTER_ONLY_ERRORS)) { /* skip if no errors... */ - if (fcurve_has_errors(fcu) == 0) + if (fcurve_has_errors(fcu) == false) continue; } -- cgit v1.2.3 From bf5eccc7281e1329ba0350bcb1b8c85cb452e8ff Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 6 Mar 2013 03:53:56 +0000 Subject: Woops! Fix for previous F-Curve path fix commit Trying to rename a valid F-Curve would crash as no RNA property was set, but *prop still had an uninitialised value. --- source/blender/editors/animation/anim_channels_defines.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 2d154ec7273..3ae8ae8a777 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -906,6 +906,10 @@ static short acf_fcurve_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyR RNA_pointer_create(ale->id, &RNA_FCurve, ale->data, ptr); *prop = RNA_struct_find_property(ptr, "data_path"); } + else { + /* for "normal" F-Curves - no editable name, but *prop may not be set properly yet... */ + *prop = NULL; + } return (*prop != NULL); } @@ -3422,10 +3426,13 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale /* if rename index matches, add widget for this */ if (ac->ads->renameIndex == channel_index + 1) { - PointerRNA ptr; - PropertyRNA *prop; + PointerRNA ptr = {{NULL}}; + PropertyRNA *prop = NULL; - /* draw renaming widget if we can get RNA pointer for it */ + /* draw renaming widget if we can get RNA pointer for it + * NOTE: property may only be available in some cases, even if we have + * a callback available (e.g. broken F-Curve rename) + */ if (acf->name_prop(ale, &ptr, &prop)) { uiBut *but; -- cgit v1.2.3 From dfa8540cdfac0d8071faa8be80d82349962c566d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 7 Mar 2013 02:44:55 +0000 Subject: use bool for rna funcs. --- source/blender/editors/animation/anim_markers.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 62725cb6c70..85a80a7cc78 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -28,7 +28,6 @@ * \ingroup edanimation */ - #include #include "MEM_guardedalloc.h" @@ -36,10 +35,6 @@ #include "DNA_scene_types.h" #include "DNA_object_types.h" -#include "RNA_access.h" -#include "RNA_define.h" -#include "RNA_enum_types.h" - #include "BLI_blenlib.h" #include "BLI_math_base.h" #include "BLI_utildefines.h" @@ -51,6 +46,10 @@ #include "BKE_scene.h" #include "BKE_screen.h" +#include "RNA_access.h" +#include "RNA_define.h" +#include "RNA_enum_types.h" + #include "WM_api.h" #include "WM_types.h" -- cgit v1.2.3 From 7f7f32d768d0486621a3832487dd569b8245c05a Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 7 Mar 2013 23:28:23 +0000 Subject: Bugfixes: [#34394] and [#31843] Visual Keying not working for bones Big thanks to Josef Meier (jomeier) for finding the fix! It turns out that this was a case of variable shadowing that had been overlooked and compilers were not warning about. --- source/blender/editors/animation/keyframing.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 6d1e6eab26b..532c711d3ab 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -714,7 +714,6 @@ static float visualkey_get_value(PointerRNA *ptr, PropertyRNA *prop, int array_i else if (ptr->type == &RNA_PoseBone) { Object *ob = (Object *)ptr->id.data; /* we assume that this is always set, and is an object */ bPoseChannel *pchan = (bPoseChannel *)ptr->data; - float tmat[4][4]; /* Although it is not strictly required for this particular space conversion, * arg1 must not be null, as there is a null check for the other conversions to -- cgit v1.2.3 From bed8efb8e8893427fdb02e23c10bf0c631e7ff86 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 8 Mar 2013 02:15:08 +0000 Subject: Improving warnings when keyframing fails for IKEY over a button Now, instead of silently failing, an error message saying that the property cannot be animated is displayed --- source/blender/editors/animation/keyframing.c | 22 +++++++++++++--------- source/blender/editors/animation/keyingsets.c | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 532c711d3ab..45082e4235e 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1623,17 +1623,21 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) success += insert_keyframe_direct(op->reports, ptr, prop, fcu, cfra, 0); } else { - if (G.debug & G_DEBUG) - printf("Button Insert-Key: no path to property\n"); - BKE_report(op->reports, RPT_WARNING, "Failed to resolve path to property, try using a keying set instead"); + BKE_report(op->reports, RPT_WARNING, + "Failed to resolve path to property, try manually specifying this using a Keying Set instead"); } } - else if (G.debug & G_DEBUG) { - printf("ptr.data = %p, prop = %p,", (void *)ptr.data, (void *)prop); - if (prop) - printf("animatable = %d\n", RNA_property_animateable(&ptr, prop)); - else - printf("animatable = NULL\n"); + else { + if (prop && !RNA_property_animateable(&ptr, prop)) { + BKE_reportf(op->reports, RPT_WARNING, + "\"%s\" property cannot be animated", + RNA_property_identifier(prop)); + } + else { + BKE_reportf(op->reports, RPT_WARNING, + "Button doesn't appear to have any property information attached (ptr.data = %p, prop = %p)", + (void *)ptr.data, (void *)prop); + } } if (success) { diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 4e8d7bdafe5..24b1ade7599 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -879,7 +879,7 @@ short ANIM_validate_keyingset(bContext *C, ListBase *dsources, KeyingSet *ks) if (ksi == NULL) return MODIFYKEY_MISSING_TYPEINFO; /* TODO: check for missing callbacks! */ - + /* check if it can be used in the current context */ if (ksi->poll(ksi, C)) { /* if a list of data sources are provided, run a special iterator over them, -- cgit v1.2.3 From ddddb7bab173b040342ef99270ee71ae076d45e8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 9 Mar 2013 03:46:30 +0000 Subject: code cleanup: favor braces when blocks have mixed brace use. --- source/blender/editors/animation/anim_markers.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 85a80a7cc78..5cb458d36e5 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -276,7 +276,9 @@ static void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only ce->sel = marker->flag; return; } - else if (ce->cfra > marker->frame) break; + else if (ce->cfra > marker->frame) { + break; + } } cen = MEM_callocN(sizeof(CfraElem), "add_to_cfra_elem"); -- cgit v1.2.3 From 74857241607cd828acbb7b8b4e2f425beea802c8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 10 Mar 2013 05:19:29 +0000 Subject: style cleanup: whitespace --- source/blender/editors/animation/keyframing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 45082e4235e..f68ff90105d 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1636,7 +1636,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) else { BKE_reportf(op->reports, RPT_WARNING, "Button doesn't appear to have any property information attached (ptr.data = %p, prop = %p)", - (void *)ptr.data, (void *)prop); + (void *)ptr.data, (void *)prop); } } -- cgit v1.2.3 From f57398568a326dcbc69900d2c21b96abca14429b Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 10 Mar 2013 14:57:19 +0000 Subject: More UI message i18n fixes and improvements... --- source/blender/editors/animation/anim_channels_defines.c | 6 +++--- source/blender/editors/animation/anim_ipo_utils.c | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 3ae8ae8a777..235cfd3b23b 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -422,7 +422,7 @@ static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float ymi static void acf_summary_name(bAnimListElem *UNUSED(ale), char *name) { if (name) - BLI_strncpy(name, "DopeSheet Summary", ANIM_CHAN_NAME_SIZE); + BLI_strncpy(name, IFACE_("DopeSheet Summary"), ANIM_CHAN_NAME_SIZE); } // FIXME: this is really a temp icon I think @@ -1088,7 +1088,7 @@ static int acf_filldrivers_icon(bAnimListElem *UNUSED(ale)) static void acf_filldrivers_name(bAnimListElem *UNUSED(ale), char *name) { - BLI_strncpy(name, "Drivers", ANIM_CHAN_NAME_SIZE); + BLI_strncpy(name, IFACE_("Drivers"), ANIM_CHAN_NAME_SIZE); } /* check if some setting exists for this channel */ @@ -2277,7 +2277,7 @@ static void acf_shapekey_name(bAnimListElem *ale, char *name) if (kb->name[0]) BLI_strncpy(name, kb->name, ANIM_CHAN_NAME_SIZE); else - BLI_snprintf(name, ANIM_CHAN_NAME_SIZE, "Key %d", ale->index); + BLI_snprintf(name, ANIM_CHAN_NAME_SIZE, IFACE_("Key %d"), ale->index); } } diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c index b6d24e21057..2352cad0cbc 100644 --- a/source/blender/editors/animation/anim_ipo_utils.c +++ b/source/blender/editors/animation/anim_ipo_utils.c @@ -42,6 +42,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "DNA_anim_types.h" #include "RNA_access.h" @@ -63,9 +65,9 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu) return icon; else if (ELEM3(NULL, id, fcu, fcu->rna_path)) { if (fcu == NULL) - strcpy(name, ""); + strcpy(name, IFACE_("")); else if (fcu->rna_path == NULL) - strcpy(name, ""); + strcpy(name, IFACE_("")); else /* id == NULL */ BLI_snprintf(name, 256, "%s[%d]", fcu->rna_path, fcu->array_index); } -- cgit v1.2.3 From 6da449b86c5debb0be1f203090a3b75903a50a54 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 10 Mar 2013 17:42:08 +0000 Subject: More UI message i18n fixes and improvements... Fix for keyingsets tips, and make them (and a few others) findable by i18n messages extracting code (for some reasons, their bl_rna.description are void???). --- source/blender/editors/animation/keyframing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index f68ff90105d..0867f7f76ff 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1307,7 +1307,7 @@ static int insert_key_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e uiLayout *layout; /* call the menu, which will call this operator again, hence the canceled */ - pup = uiPupMenuBegin(C, op->type->name, ICON_NONE); + pup = uiPupMenuBegin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); layout = uiPupMenuLayout(pup); uiItemsEnumO(layout, "ANIM_OT_keyframe_insert_menu", "type"); uiPupMenuEnd(C, pup); -- cgit v1.2.3 From aaa8a13c493a09b2db9ddd4421737c612a3634c8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Mar 2013 09:03:46 +0000 Subject: code cleanup: use const events for modal and invoke operators. --- .../blender/editors/animation/anim_channels_edit.c | 6 +- source/blender/editors/animation/anim_markers.c | 82 +++++++++++----------- source/blender/editors/animation/anim_ops.c | 6 +- source/blender/editors/animation/keyframing.c | 2 +- source/blender/editors/animation/keyingsets.c | 2 +- 5 files changed, 49 insertions(+), 49 deletions(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index d218cc537da..96dc1010e2c 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2260,7 +2260,7 @@ static void rename_anim_channels(bAnimContext *ac, int channel_index) ED_region_tag_redraw(ac->ar); } -static int animchannels_rename_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *evt) +static int animchannels_rename_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) { bAnimContext ac; ARegion *ar; @@ -2281,7 +2281,7 @@ static int animchannels_rename_invoke(bContext *C, wmOperator *UNUSED(op), wmEve * 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, evt->mval[0], evt->mval[1], &x, &y); + UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y); if (ac.datatype == ANIMCONT_NLA) { SpaceNla *snla = (SpaceNla *)ac.sl; @@ -2594,7 +2594,7 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in /* ------------------- */ /* handle clicking */ -static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmEvent *event) { bAnimContext ac; ARegion *ar; diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 5cb458d36e5..7a3fc3a8d9b 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -514,8 +514,8 @@ static int ed_markers_poll_markers_exist(bContext *C) * that operator would otherwise have used. If NULL, the operator's standard * exec() callback will be called instead in the appropriate places. */ -static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, wmEvent *evt, - int (*invoke_func)(bContext *, wmOperator *, wmEvent *)) +static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, const wmEvent *event, + int (*invoke_func)(bContext *, wmOperator *, const wmEvent *)) { ScrArea *sa = CTX_wm_area(C); int retval = OPERATOR_PASS_THROUGH; @@ -524,7 +524,7 @@ static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, wmEvent /* allow operator to run now */ if (invoke_func) - retval = invoke_func(C, op, evt); + retval = invoke_func(C, op, event); else if (op->type->exec) retval = op->type->exec(C, op); else @@ -545,9 +545,9 @@ static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, wmEvent * though will need to implement their own wrapper which calls the second-tier callback themselves * (passing through the custom invoke function they use) */ -static int ed_markers_opwrap_invoke(bContext *C, wmOperator *op, wmEvent *evt) +static int ed_markers_opwrap_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - return ed_markers_opwrap_invoke_custom(C, op, evt, NULL); + return ed_markers_opwrap_invoke_custom(C, op, event, NULL); } /* ************************** add markers *************************** */ @@ -685,14 +685,14 @@ static void ed_marker_move_exit(bContext *C, wmOperator *op) ED_area_headerprint(CTX_wm_area(C), NULL); } -static int ed_marker_move_invoke(bContext *C, wmOperator *op, wmEvent *evt) +static int ed_marker_move_invoke(bContext *C, wmOperator *op, const wmEvent *event) { if (ed_marker_move_init(C, op)) { MarkerMove *mm = op->customdata; - mm->evtx = evt->x; - mm->firstx = evt->x; - mm->event_type = evt->type; + mm->evtx = event->x; + mm->firstx = event->x; + mm->event_type = event->type; /* add temp handler */ WM_event_add_modal_handler(C, op); @@ -706,9 +706,9 @@ static int ed_marker_move_invoke(bContext *C, wmOperator *op, wmEvent *evt) return OPERATOR_CANCELLED; } -static int ed_marker_move_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt) +static int ed_marker_move_invoke_wrapper(bContext *C, wmOperator *op, const wmEvent *event) { - return ed_markers_opwrap_invoke_custom(C, op, evt, ed_marker_move_invoke); + return ed_markers_opwrap_invoke_custom(C, op, event, ed_marker_move_invoke); } /* note, init has to be called succesfully */ @@ -757,7 +757,7 @@ static int ed_marker_move_cancel(bContext *C, wmOperator *op) -static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) +static int ed_marker_move_modal(bContext *C, wmOperator *op, const wmEvent *event) { Scene *scene = CTX_data_scene(C); MarkerMove *mm = op->customdata; @@ -766,14 +766,14 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) float dx, fac; char str[256]; - switch (evt->type) { + switch (event->type) { case ESCKEY: ed_marker_move_cancel(C, op); return OPERATOR_CANCELLED; case RIGHTMOUSE: /* press = user manually demands transform to be canceled */ - if (evt->val == KM_PRESS) { + if (event->val == KM_PRESS) { ed_marker_move_cancel(C, op); return OPERATOR_CANCELLED; } @@ -783,7 +783,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) case PADENTER: case LEFTMOUSE: case MIDDLEMOUSE: - if (WM_modal_tweak_exit(evt, mm->event_type)) { + if (WM_modal_tweak_exit(event, mm->event_type)) { ed_marker_move_exit(C, op); WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL); WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL); @@ -796,17 +796,17 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) dx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask); - if (evt->x != mm->evtx) { /* XXX maybe init for first time */ + if (event->x != mm->evtx) { /* XXX maybe init for first time */ int a, offs, totmark = 0; - mm->evtx = evt->x; + mm->evtx = event->x; - fac = ((float)(evt->x - mm->firstx) * dx); + fac = ((float)(event->x - mm->firstx) * dx); if (mm->slink->spacetype == SPACE_TIME) - apply_keyb_grid(evt->shift, evt->ctrl, &fac, 0.0, FPS, 0.1 * FPS, 0); + apply_keyb_grid(event->shift, event->ctrl, &fac, 0.0, FPS, 0.1 * FPS, 0); else - apply_keyb_grid(evt->shift, evt->ctrl, &fac, 0.0, 1.0, 0.1, 0 /*was: U.flag & USER_AUTOGRABGRID*/); + apply_keyb_grid(event->shift, event->ctrl, &fac, 0.0, 1.0, 0.1, 0 /*was: U.flag & USER_AUTOGRABGRID*/); offs = (int)fac; RNA_int_set(op->ptr, "frames", offs); @@ -865,8 +865,8 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) } } - if (evt->val == KM_PRESS) { - if (handleNumInput(&mm->num, evt)) { + if (event->val == KM_PRESS) { + if (handleNumInput(&mm->num, event)) { char str_tx[NUM_STR_REP_LEN]; float value = RNA_int_get(op->ptr, "frames"); applyNumInput(&mm->num, &value); @@ -982,15 +982,15 @@ static int ed_marker_duplicate_exec(bContext *C, wmOperator *op) } -static int ed_marker_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *evt) +static int ed_marker_duplicate_invoke(bContext *C, wmOperator *op, const wmEvent *event) { ed_marker_duplicate_apply(C); - return ed_marker_move_invoke(C, op, evt); + return ed_marker_move_invoke(C, op, event); } -static int ed_marker_duplicate_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt) +static int ed_marker_duplicate_invoke_wrapper(bContext *C, wmOperator *op, const wmEvent *event) { - return ed_markers_opwrap_invoke_custom(C, op, evt, ed_marker_duplicate_invoke); + return ed_markers_opwrap_invoke_custom(C, op, event, ed_marker_duplicate_invoke); } static void MARKER_OT_duplicate(wmOperatorType *ot) @@ -1037,7 +1037,7 @@ static void select_timeline_marker_frame(ListBase *markers, int frame, unsigned } } -static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera) +static int ed_marker_select(bContext *C, const wmEvent *event, int extend, int camera) { ListBase *markers = ED_context_get_markers(C); ARegion *ar = CTX_wm_region(C); @@ -1048,8 +1048,8 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera) if (markers == NULL) return OPERATOR_PASS_THROUGH; - x = evt->x - ar->winrct.xmin; - y = evt->y - ar->winrct.ymin; + x = event->x - ar->winrct.xmin; + y = event->y - ar->winrct.ymin; UI_view2d_region_to_view(v2d, x, y, &viewx, NULL); @@ -1104,19 +1104,19 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera) return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH; } -static int ed_marker_select_invoke(bContext *C, wmOperator *op, wmEvent *evt) +static int ed_marker_select_invoke(bContext *C, wmOperator *op, const wmEvent *event) { short extend = RNA_boolean_get(op->ptr, "extend"); short camera = 0; #ifdef DURIAN_CAMERA_SWITCH camera = RNA_boolean_get(op->ptr, "camera"); #endif - return ed_marker_select(C, evt, extend, camera); + return ed_marker_select(C, event, extend, camera); } -static int ed_marker_select_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt) +static int ed_marker_select_invoke_wrapper(bContext *C, wmOperator *op, const wmEvent *event) { - return ed_markers_opwrap_invoke_custom(C, op, evt, ed_marker_select_invoke); + return ed_markers_opwrap_invoke_custom(C, op, event, ed_marker_select_invoke); } static void MARKER_OT_select(wmOperatorType *ot) @@ -1201,9 +1201,9 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op) return 1; } -static int ed_marker_select_border_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt) +static int ed_marker_select_border_invoke_wrapper(bContext *C, wmOperator *op, const wmEvent *event) { - return ed_markers_opwrap_invoke_custom(C, op, evt, WM_border_select_invoke); + return ed_markers_opwrap_invoke_custom(C, op, event, WM_border_select_invoke); } static void MARKER_OT_select_border(wmOperatorType *ot) @@ -1310,10 +1310,10 @@ static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -static int ed_marker_delete_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt) +static int ed_marker_delete_invoke_wrapper(bContext *C, wmOperator *op, const wmEvent *event) { // XXX: must we keep these confirmations? - return ed_markers_opwrap_invoke_custom(C, op, evt, WM_operator_confirm); + return ed_markers_opwrap_invoke_custom(C, op, event, WM_operator_confirm); } static void MARKER_OT_delete(wmOperatorType *ot) @@ -1353,7 +1353,7 @@ static int ed_marker_rename_exec(bContext *C, wmOperator *op) } } -static int ed_marker_rename_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt) +static int ed_marker_rename_invoke_wrapper(bContext *C, wmOperator *op, const wmEvent *event) { /* must initialize the marker name first if there is a marker selected */ TimeMarker *marker = ED_markers_get_first_selected(ED_context_get_markers(C)); @@ -1361,7 +1361,7 @@ static int ed_marker_rename_invoke_wrapper(bContext *C, wmOperator *op, wmEvent RNA_string_set(op->ptr, "name", marker->name); /* now see if the operator is usable */ - return ed_markers_opwrap_invoke_custom(C, op, evt, WM_operator_props_popup); + return ed_markers_opwrap_invoke_custom(C, op, event, WM_operator_props_popup); } static void MARKER_OT_rename(wmOperatorType *ot) @@ -1415,9 +1415,9 @@ static int ed_marker_make_links_scene_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int ed_marker_make_links_scene_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt) +static int ed_marker_make_links_scene_invoke_wrapper(bContext *C, wmOperator *op, const wmEvent *event) { - return ed_markers_opwrap_invoke_custom(C, op, evt, WM_menu_invoke); + return ed_markers_opwrap_invoke_custom(C, op, event, WM_menu_invoke); } static void MARKER_OT_make_links_scene(wmOperatorType *ot) diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 6687cce88cd..b9a3daa4e51 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -115,7 +115,7 @@ static int change_frame_exec(bContext *C, wmOperator *op) /* ---- */ /* Get frame from mouse coordinates */ -static int frame_from_event(bContext *C, wmEvent *event) +static int frame_from_event(bContext *C, const wmEvent *event) { ARegion *region = CTX_wm_region(C); float viewx; @@ -128,7 +128,7 @@ static int frame_from_event(bContext *C, wmEvent *event) } /* Modal Operator init */ -static int change_frame_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event) { /* Change to frame that mouse is over before adding modal handler, * as user could click on a single frame (jump to frame) as well as @@ -145,7 +145,7 @@ static int change_frame_invoke(bContext *C, wmOperator *op, wmEvent *event) } /* Modal event handling of frame changing */ -static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event) +static int change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event) { /* execute the events */ switch (event->type) { diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 0867f7f76ff..ed8398b7c8b 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1297,7 +1297,7 @@ void ANIM_OT_keyframe_insert(wmOperatorType *ot) * then calls the menu if necessary before */ -static int insert_key_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +static int insert_key_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { Scene *scene = CTX_data_scene(C); diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 24b1ade7599..ad09fcb5966 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -468,7 +468,7 @@ void ANIM_OT_keyingset_button_remove(wmOperatorType *ot) /* Change Active KeyingSet Operator ------------------------ */ /* This operator checks if a menu should be shown for choosing the KeyingSet to make the active one */ -static int keyingset_active_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +static int keyingset_active_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { uiPopupMenu *pup; uiLayout *layout; -- cgit v1.2.3 From daf3fc02ada12592a7dd3f010b4daa3ac546e987 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 14 Mar 2013 05:01:51 +0000 Subject: Bugfix: Selecting AnimData "expanders" in AnimEditors works again Somewhere along the line, this functionality broke, even though the code to handle these settings was still in place for many of these. The main implication of this fix is that it should now be possible to select a particular AnimData block, which makes it possible to do things such as changing the action associated with that AnimData block (i.e. via the "Animation Data" panel in the NLA Editor), as well as other operations which I've had on the todolist for a while. Stay tuned! --- source/blender/editors/animation/anim_channels_defines.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 235cfd3b23b..5080645ecd5 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -381,6 +381,10 @@ static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListEle case ACHANNEL_SETTING_MUTE: return ((ac) && (ac->spacetype == SPACE_NLA)); + /* select is ok for most "ds*" channels (e.g. dsmat) */ + case ACHANNEL_SETTING_SELECT: + return 1; + /* other flags are never supported */ default: return 0; -- cgit v1.2.3 From 0fa006cba1f8f67d91adea0ea9a1c5669ae21b72 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 14 Mar 2013 05:58:13 +0000 Subject: Remove OPTYPE_REGISTER flag from click handler operator for anim editors 1) It made no sense to show this as the last operator which was used, since these can only be used from the anim editors (and not the 3D View where this panel appears most of the time) 2) Mouse select operators in other places didn't do this 3) There aren't really any editable parameters for this operator anyway 4) It's highly dependent on valid mouse coordinates as input. Apart from that, undo still works fine, so no need to really keep this here. --- source/blender/editors/animation/anim_channels_edit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 96dc1010e2c..49276202517 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2652,7 +2652,7 @@ static void ANIM_OT_channels_click(wmOperatorType *ot) ot->poll = animedit_poll_channels_active; /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + ot->flag = OPTYPE_UNDO; /* properties */ /* NOTE: don't save settings, otherwise, can end up with some weird behaviour (sticky extend) */ -- cgit v1.2.3 From 396758757b4be84918366b436a42cb311f616518 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 14 Mar 2013 06:30:18 +0000 Subject: Bugfix: Filtering option in NLA Editor to include AnimData blocks with no actions or NLA data attached was broken Looks like a typo whcih somehow slipped in at some stage, as I remember that this used to work at some point 2 years ago! --- source/blender/editors/animation/anim_filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index e1ac5fa605b..b3b0b09bac0 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -446,7 +446,7 @@ short ANIM_animdata_get_context(const bContext *C, bAnimContext *ac) if (ANIMDATA_HAS_NLA(id)) { \ nlaOk \ } \ - else if (!(ads->filterflag & ADS_FILTER_NLA_NOACT) && ANIMDATA_HAS_KEYS(id)) { \ + else if (!(ads->filterflag & ADS_FILTER_NLA_NOACT) || ANIMDATA_HAS_KEYS(id)) { \ nlaOk \ } \ } \ -- cgit v1.2.3 From 150891605f3f098070b2bb0cd6ef37ae930698d7 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 16 Mar 2013 05:09:32 +0000 Subject: NLA "Add Track" can now be used to add tracks to previously empty AnimData blocks, provided the blocks in question are in fact selected. --- source/blender/editors/animation/anim_filter.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index b3b0b09bac0..7416c559522 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -1296,7 +1296,9 @@ static size_t animfilter_block_data(bAnimContext *ac, ListBase *anim_data, bDope ANIMDATA_FILTER_CASES(iat, { /* AnimData */ /* specifically filter animdata block */ - ANIMCHANNEL_NEW_CHANNEL(adt, ANIMTYPE_ANIMDATA, id); + if (ANIMCHANNEL_SELOK(SEL_ANIMDATA(adt)) ) { + ANIMCHANNEL_NEW_CHANNEL(adt, ANIMTYPE_ANIMDATA, id); + } }, { /* NLA */ items += animfilter_nla(ac, anim_data, ads, adt, filter_mode, id); @@ -1346,7 +1348,9 @@ static size_t animdata_filter_shapekey(bAnimContext *ac, ListBase *anim_data, Ke // TODO: somehow manage to pass dopesheet info down here too? if (key->adt) { if (filter_mode & ANIMFILTER_ANIMDATA) { - ANIMCHANNEL_NEW_CHANNEL(key->adt, ANIMTYPE_ANIMDATA, key); + if (ANIMCHANNEL_SELOK(SEL_ANIMDATA(key->adt)) ) { + ANIMCHANNEL_NEW_CHANNEL(key->adt, ANIMTYPE_ANIMDATA, key); + } } else if (key->adt->action) { items = animfilter_action(ac, anim_data, NULL, key->adt->action, filter_mode, (ID *)key); -- cgit v1.2.3