Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_select.c
| Show First 20 Lines • Show All 1,228 Lines • ▼ Show 20 Lines | static short mixed_bones_object_selectbuffer( | ||||
| } | } | ||||
| if (r_do_nearest) { | if (r_do_nearest) { | ||||
| *r_do_nearest = do_nearest; | *r_do_nearest = do_nearest; | ||||
| } | } | ||||
| do_nearest = do_nearest && !enumerate; | do_nearest = do_nearest && !enumerate; | ||||
| const int select_mode = (do_nearest ? VIEW3D_SELECT_DEPTH_SORT_NEAREST : VIEW3D_SELECT_DEPTH_SORT_ALL); | |||||
| BLI_rcti_init(&rect, mval[0] - 14, mval[0] + 14, mval[1] - 14, mval[1] + 14); | BLI_rcti_init(&rect, mval[0] - 14, mval[0] + 14, mval[1] - 14, mval[1] + 14); | ||||
| hits15 = view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect, do_nearest); | hits15 = view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect, select_mode); | ||||
| if (hits15 == 1) { | if (hits15 == 1) { | ||||
| return selectbuffer_ret_hits_15(buffer, hits15); | return selectbuffer_ret_hits_15(buffer, hits15); | ||||
| } | } | ||||
| else if (hits15 > 0) { | else if (hits15 > 0) { | ||||
| has_bones15 = selectbuffer_has_bones(buffer, hits15); | has_bones15 = selectbuffer_has_bones(buffer, hits15); | ||||
| offs = 4 * hits15; | offs = 4 * hits15; | ||||
| BLI_rcti_init(&rect, mval[0] - 9, mval[0] + 9, mval[1] - 9, mval[1] + 9); | BLI_rcti_init(&rect, mval[0] - 9, mval[0] + 9, mval[1] - 9, mval[1] + 9); | ||||
| hits9 = view3d_opengl_select(vc, buffer + offs, MAXPICKBUF - offs, &rect, do_nearest); | hits9 = view3d_opengl_select(vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode); | ||||
| if (hits9 == 1) { | if (hits9 == 1) { | ||||
| return selectbuffer_ret_hits_9(buffer, hits15, hits9); | return selectbuffer_ret_hits_9(buffer, hits15, hits9); | ||||
| } | } | ||||
| else if (hits9 > 0) { | else if (hits9 > 0) { | ||||
| has_bones9 = selectbuffer_has_bones(buffer + offs, hits9); | has_bones9 = selectbuffer_has_bones(buffer + offs, hits9); | ||||
| offs += 4 * hits9; | offs += 4 * hits9; | ||||
| BLI_rcti_init(&rect, mval[0] - 5, mval[0] + 5, mval[1] - 5, mval[1] + 5); | BLI_rcti_init(&rect, mval[0] - 5, mval[0] + 5, mval[1] - 5, mval[1] + 5); | ||||
| hits5 = view3d_opengl_select(vc, buffer + offs, MAXPICKBUF - offs, &rect, do_nearest); | hits5 = view3d_opengl_select(vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode); | ||||
| if (hits5 == 1) { | if (hits5 == 1) { | ||||
| return selectbuffer_ret_hits_5(buffer, hits15, hits9, hits5); | return selectbuffer_ret_hits_5(buffer, hits15, hits9, hits5); | ||||
| } | } | ||||
| else if (hits5 > 0) { | else if (hits5 > 0) { | ||||
| has_bones5 = selectbuffer_has_bones(buffer + offs, hits5); | has_bones5 = selectbuffer_has_bones(buffer + offs, hits5); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 636 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| MetaBall *mb = (MetaBall *)vc->obedit->data; | MetaBall *mb = (MetaBall *)vc->obedit->data; | ||||
| MetaElem *ml; | MetaElem *ml; | ||||
| int a; | int a; | ||||
| unsigned int buffer[MAXPICKBUF]; | unsigned int buffer[MAXPICKBUF]; | ||||
| short hits; | short hits; | ||||
| hits = view3d_opengl_select(vc, buffer, MAXPICKBUF, rect, false); | hits = view3d_opengl_select(vc, buffer, MAXPICKBUF, rect, VIEW3D_SELECT_ALL); | ||||
| if (extend == false && select) | if (extend == false && select) | ||||
| BKE_mball_deselect_all(mb); | BKE_mball_deselect_all(mb); | ||||
| for (ml = mb->editelems->first; ml; ml = ml->next) { | for (ml = mb->editelems->first; ml; ml = ml->next) { | ||||
| for (a = 0; a < hits; a++) { | for (a = 0; a < hits; a++) { | ||||
| if (ml->selcol1 == buffer[(4 * a) + 3]) { | if (ml->selcol1 == buffer[(4 * a) + 3]) { | ||||
| ml->flag |= MB_SCALE_RAD; | ml->flag |= MB_SCALE_RAD; | ||||
| Show All 17 Lines | |||||
| { | { | ||||
| bArmature *arm = vc->obedit->data; | bArmature *arm = vc->obedit->data; | ||||
| EditBone *ebone; | EditBone *ebone; | ||||
| int a; | int a; | ||||
| unsigned int buffer[MAXPICKBUF]; | unsigned int buffer[MAXPICKBUF]; | ||||
| short hits; | short hits; | ||||
| hits = view3d_opengl_select(vc, buffer, MAXPICKBUF, rect, false); | hits = view3d_opengl_select(vc, buffer, MAXPICKBUF, rect, VIEW3D_SELECT_ALL); | ||||
| /* clear flag we use to detect point was affected */ | /* clear flag we use to detect point was affected */ | ||||
| for (ebone = arm->edbo->first; ebone; ebone = ebone->next) | for (ebone = arm->edbo->first; ebone; ebone = ebone->next) | ||||
| ebone->flag &= ~BONE_DONE; | ebone->flag &= ~BONE_DONE; | ||||
| if (extend == false && select) | if (extend == false && select) | ||||
| ED_armature_deselect_all_visible(vc->obedit); | ED_armature_deselect_all_visible(vc->obedit); | ||||
| ▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | if (extend == false && select) { | ||||
| } | } | ||||
| else { | else { | ||||
| object_deselect_all_visible(vc->scene, vc->v3d); | object_deselect_all_visible(vc->scene, vc->v3d); | ||||
| } | } | ||||
| } | } | ||||
| /* selection buffer now has bones potentially too, so we add MAXPICKBUF */ | /* selection buffer now has bones potentially too, so we add MAXPICKBUF */ | ||||
| vbuffer = MEM_mallocN(4 * (totobj + MAXPICKELEMS) * sizeof(unsigned int), "selection buffer"); | vbuffer = MEM_mallocN(4 * (totobj + MAXPICKELEMS) * sizeof(unsigned int), "selection buffer"); | ||||
| hits = view3d_opengl_select(vc, vbuffer, 4 * (totobj + MAXPICKELEMS), rect, false); | hits = view3d_opengl_select(vc, vbuffer, 4 * (totobj + MAXPICKELEMS), rect, VIEW3D_SELECT_ALL); | ||||
| /* | /* | ||||
| * LOGIC NOTES (theeth): | * LOGIC NOTES (theeth): | ||||
| * The buffer and ListBase have the same relative order, which makes the selection | * The buffer and ListBase have the same relative order, which makes the selection | ||||
| * very simple. Loop through both data sets at the same time, if the color | * very simple. Loop through both data sets at the same time, if the color | ||||
| * is the same as the object, we have a hit and can move to the next color | * is the same as the object, we have a hit and can move to the next color | ||||
| * and object pair, if not, just move to the next object, | * and object pair, if not, just move to the next object, | ||||
| * keeping the same color until we have a hit. | * keeping the same color until we have a hit. | ||||
| * | * | ||||
| ▲ Show 20 Lines • Show All 837 Lines • Show Last 20 Lines | |||||