Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_select.c
| Show All 24 Lines | |||||
| * ***** END GPL LICENSE BLOCK ***** | * ***** END GPL LICENSE BLOCK ***** | ||||
| */ | */ | ||||
| /** \file blender/editors/space_outliner/outliner_select.c | /** \file blender/editors/space_outliner/outliner_select.c | ||||
| * \ingroup spoutliner | * \ingroup spoutliner | ||||
| */ | */ | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <string.h> | |||||
| #include "DNA_armature_types.h" | #include "DNA_armature_types.h" | ||||
| #include "DNA_group_types.h" | #include "DNA_group_types.h" | ||||
| #include "DNA_lamp_types.h" | #include "DNA_lamp_types.h" | ||||
| #include "DNA_material_types.h" | #include "DNA_material_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_sequence_types.h" | #include "DNA_sequence_types.h" | ||||
| #include "DNA_world_types.h" | #include "DNA_world_types.h" | ||||
| #include "DNA_anim_types.h" | |||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_depsgraph.h" | #include "BKE_depsgraph.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "BKE_sequencer.h" | #include "BKE_sequencer.h" | ||||
| #include "BKE_armature.h" | #include "BKE_armature.h" | ||||
| #include "ED_armature.h" | #include "ED_armature.h" | ||||
| #include "ED_object.h" | #include "ED_object.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "ED_sequencer.h" | #include "ED_sequencer.h" | ||||
| #include "ED_util.h" | #include "ED_util.h" | ||||
| #include "ED_anim_api.h" | |||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_view2d.h" | #include "UI_view2d.h" | ||||
| ▲ Show 20 Lines • Show All 924 Lines • ▼ Show 20 Lines | |||||
| int outliner_item_do_activate(bContext *C, int x, int y, bool extend, bool recursive) | int outliner_item_do_activate(bContext *C, int x, int y, bool extend, bool recursive) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ARegion *ar = CTX_wm_region(C); | ARegion *ar = CTX_wm_region(C); | ||||
| SpaceOops *soops = CTX_wm_space_outliner(C); | SpaceOops *soops = CTX_wm_space_outliner(C); | ||||
| TreeElement *te; | TreeElement *te; | ||||
| float fmval[2]; | float fmval[2]; | ||||
| Object *obact = CTX_data_active_object(C); | |||||
| bPoseChannel *in_pose = CTX_data_active_pose_bone(C); | |||||
| UI_view2d_region_to_view(&ar->v2d, x, y, &fmval[0], &fmval[1]); | UI_view2d_region_to_view(&ar->v2d, x, y, &fmval[0], &fmval[1]); | ||||
| if (!ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF) && | if (!ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF) && | ||||
| !(soops->flag & SO_HIDE_RESTRICTCOLS) && | !(soops->flag & SO_HIDE_RESTRICTCOLS) && | ||||
| (fmval[0] > ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX)) | (fmval[0] > ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX)) | ||||
| { | { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| Show All 21 Lines | if (outliner_select(soops, &soops->tree, &row, &selecting)) { | ||||
| /* no need for undo push here, only changing outliner data which is | /* no need for undo push here, only changing outliner data which is | ||||
| * scene level - campbell */ | * scene level - campbell */ | ||||
| /* ED_undo_push(C, "Outliner selection event"); */ | /* ED_undo_push(C, "Outliner selection event"); */ | ||||
| } | } | ||||
| } | } | ||||
| ED_region_tag_redraw(ar); | ED_region_tag_redraw(ar); | ||||
| /* Allows for a context switch so that if the SIPO_AUTODESELECT_KEYS is on then | |||||
| * the keyframes will be deselected. | |||||
| */ | |||||
| bPoseChannel *fin_pose = CTX_data_active_pose_bone(C); | |||||
| Object *new_obact = CTX_data_active_object(C); | |||||
| if ((obact && new_obact) && (strcmp(obact->id.name, new_obact->id.name) != 0 || ((in_pose && fin_pose) && (strcmp(in_pose->name, fin_pose->name) != 0)))) { | |||||
| int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS); | |||||
| bAnimContext ac; | |||||
| ListBase anim_data = { NULL, NULL }; | |||||
| CTX_wm_switch_area(C, "Graph"); | |||||
| ANIM_animdata_get_context(C, &ac); | |||||
| ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); | |||||
| SpaceIpo *sipo = (SpaceIpo *)ac.sl; | |||||
| bAnimListElem *ale; | |||||
| if (sipo->flag & SIPO_AUTODESELECT_KEYS) { | |||||
| for (ale = anim_data.first; ale; ale = ale->next) | |||||
| { | |||||
| FCurve *fcu = (FCurve *)ale->key_data; | |||||
| for (int i = 0; i < fcu->totvert; i++) | |||||
aligorith: Instead of manually looping here (and risking running into a F-Curve full of FSamples, when fcu… | |||||
| { | |||||
| if (fcu->bezt[i].f1 || fcu->bezt[i].f2 || fcu->bezt[i].f3) | |||||
Not Done Inline ActionsUse the BEZT_ISSEL_ANY macro instead for this sort of test. aligorith: Use the BEZT_ISSEL_ANY macro instead for this sort of test. | |||||
| { | |||||
| fcu->bezt[i].f1 = 0; | |||||
| fcu->bezt[i].f2 = 0; | |||||
| fcu->bezt[i].f3 = 0; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| CTX_wm_switch_area(C, "Outliner"); | |||||
| } | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| /* event can enterkey, then it opens/closes */ | /* event can enterkey, then it opens/closes */ | ||||
| static int outliner_item_activate(bContext *C, wmOperator *op, const wmEvent *event) | static int outliner_item_activate(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| { | { | ||||
| bool extend = RNA_boolean_get(op->ptr, "extend"); | bool extend = RNA_boolean_get(op->ptr, "extend"); | ||||
| bool recursive = RNA_boolean_get(op->ptr, "recursive"); | bool recursive = RNA_boolean_get(op->ptr, "recursive"); | ||||
| ▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines | |||||
Instead of manually looping here (and risking running into a F-Curve full of FSamples, when fcu->bezt = NULL and fcu->fpt != NULL), it'ld be better to just use: ANIM_fcurve_keyframes_loop(ked, fcu, key_ob_cb, key_edit_cb, fcu_update_cb)
For example, you could just do: