Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_select.c
| Show All 38 Lines | |||||
| #include "DNA_armature_types.h" | #include "DNA_armature_types.h" | ||||
| #include "DNA_curve_types.h" | #include "DNA_curve_types.h" | ||||
| #include "DNA_meta_types.h" | #include "DNA_meta_types.h" | ||||
| #include "DNA_mesh_types.h" | #include "DNA_mesh_types.h" | ||||
| #include "DNA_meshdata_types.h" | #include "DNA_meshdata_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_tracking_types.h" | #include "DNA_tracking_types.h" | ||||
| #include "DNA_windowmanager_types.h" | |||||
| #include "DNA_space_types.h" | |||||
| #include "DNA_anim_types.h" | |||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_lasso.h" | #include "BLI_lasso.h" | ||||
| #include "BLI_rect.h" | #include "BLI_rect.h" | ||||
| #include "BLI_linklist.h" | #include "BLI_linklist.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| Show All 31 Lines | |||||
| #include "ED_armature.h" | #include "ED_armature.h" | ||||
| #include "ED_curve.h" | #include "ED_curve.h" | ||||
| #include "ED_particle.h" | #include "ED_particle.h" | ||||
| #include "ED_mesh.h" | #include "ED_mesh.h" | ||||
| #include "ED_object.h" | #include "ED_object.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "ED_sculpt.h" | #include "ED_sculpt.h" | ||||
| #include "ED_mball.h" | #include "ED_mball.h" | ||||
| #include "ED_anim_api.h" | |||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "GPU_draw.h" | #include "GPU_draw.h" | ||||
| #include "view3d_intern.h" /* own include */ | #include "view3d_intern.h" /* own include */ | ||||
| // #include "PIL_time_utildefines.h" | // #include "PIL_time_utildefines.h" | ||||
| ▲ Show 20 Lines • Show All 2,173 Lines • ▼ Show 20 Lines | |||||
| /* ****** Mouse Select ****** */ | /* ****** Mouse Select ****** */ | ||||
| static int view3d_select_exec(bContext *C, wmOperator *op) | static int view3d_select_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Object *obedit = CTX_data_edit_object(C); | Object *obedit = CTX_data_edit_object(C); | ||||
| Object *obact = CTX_data_active_object(C); | Object *obact = CTX_data_active_object(C); | ||||
| bPoseChannel *in_pose = CTX_data_active_pose_bone(C); | |||||
| bool extend = RNA_boolean_get(op->ptr, "extend"); | bool extend = RNA_boolean_get(op->ptr, "extend"); | ||||
| bool deselect = RNA_boolean_get(op->ptr, "deselect"); | bool deselect = RNA_boolean_get(op->ptr, "deselect"); | ||||
| bool toggle = RNA_boolean_get(op->ptr, "toggle"); | bool toggle = RNA_boolean_get(op->ptr, "toggle"); | ||||
| bool center = RNA_boolean_get(op->ptr, "center"); | bool center = RNA_boolean_get(op->ptr, "center"); | ||||
| bool enumerate = RNA_boolean_get(op->ptr, "enumerate"); | bool enumerate = RNA_boolean_get(op->ptr, "enumerate"); | ||||
| /* only force object select for editmode to support vertex parenting, | /* only force object select for editmode to support vertex parenting, | ||||
| * or paint-select to allow pose bone select with vert/face select */ | * or paint-select to allow pose bone select with vert/face select */ | ||||
| bool object = (RNA_boolean_get(op->ptr, "object") && | bool object = (RNA_boolean_get(op->ptr, "object") && | ||||
| Show All 38 Lines | else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) | ||||
| return PE_mouse_particles(C, location, extend, deselect, toggle); | return PE_mouse_particles(C, location, extend, deselect, toggle); | ||||
| else if (obact && BKE_paint_select_face_test(obact)) | else if (obact && BKE_paint_select_face_test(obact)) | ||||
| retval = paintface_mouse_select(C, obact, location, extend, deselect, toggle); | retval = paintface_mouse_select(C, obact, location, extend, deselect, toggle); | ||||
| else if (BKE_paint_select_vert_test(obact)) | else if (BKE_paint_select_vert_test(obact)) | ||||
| retval = ed_wpaint_vertex_select_pick(C, location, extend, deselect, toggle, obact); | retval = ed_wpaint_vertex_select_pick(C, location, extend, deselect, toggle, obact); | ||||
| else | else | ||||
| retval = ed_object_select_pick(C, location, extend, deselect, toggle, center, enumerate, object); | retval = ed_object_select_pick(C, location, extend, deselect, toggle, center, enumerate, object); | ||||
| /* Allows for a context switch so that if the SIPO_AUTODESELECT_KEYS is on then | |||||
smellslikedonkey: Is this a duplicate of the code above? Maybe it should be a separate function if it is. | |||||
| * 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++) | |||||
| { | |||||
| if (fcu->bezt[i].f1 || fcu->bezt[i].f2 || fcu->bezt[i].f3) | |||||
| { | |||||
| fcu->bezt[i].f1 = 0; | |||||
| fcu->bezt[i].f2 = 0; | |||||
| fcu->bezt[i].f3 = 0; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| CTX_wm_switch_area(C, "View3D"); | |||||
| } | |||||
| /* passthrough allows tweaks | /* passthrough allows tweaks | ||||
| * FINISHED to signal one operator worked | * FINISHED to signal one operator worked | ||||
| * */ | * */ | ||||
| if (retval) | if (retval) | ||||
| return OPERATOR_PASS_THROUGH | OPERATOR_FINISHED; | return OPERATOR_PASS_THROUGH | OPERATOR_FINISHED; | ||||
| else | else | ||||
| return OPERATOR_PASS_THROUGH; /* nothing selected, just passthrough */ | return OPERATOR_PASS_THROUGH; /* nothing selected, just passthrough */ | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 560 Lines • Show Last 20 Lines | |||||
Is this a duplicate of the code above? Maybe it should be a separate function if it is.