diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-07 11:01:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-07 11:01:24 +0400 |
commit | 7508540c53222c289a665cb0528e2a5c984b9b99 (patch) | |
tree | 1fd3f92c4fd7ea74d23288468a1ce494350c33a7 /source/blender/editors | |
parent | 261c1679b484884973d485c3f21bed9e87fa5260 (diff) | |
parent | 4b3cc63f73cfe519689bdbd8482e655b72423038 (diff) |
svn merge -r41575:41602 ^/trunk/blender
Diffstat (limited to 'source/blender/editors')
36 files changed, 435 insertions, 352 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index e8af5a8f290..f0f3b8f4123 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -176,13 +176,13 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa unsigned char cp[3]; if (indent == 2) { - VECCOPY(cp, grp->cs.solid); + copy_v3_v3_char((char *)cp, grp->cs.solid); } else if (indent == 1) { - VECCOPY(cp, grp->cs.select); + copy_v3_v3_char((char *)cp, grp->cs.select); } else { - VECCOPY(cp, grp->cs.active); + copy_v3_v3_char((char *)cp, grp->cs.active); } /* copy the colors over, transforming from bytes to floats */ diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index 6f1da5757c6..b1651886620 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -157,14 +157,14 @@ static void getEditBoneRollUpAxis(EditBone *bone, float roll, float up_axis[3]) sub_v3_v3v3(nor, bone->tail, bone->head); vec_roll_to_mat3(nor, roll, mat); - VECCOPY(up_axis, mat[2]); + copy_v3_v3(up_axis, mat[2]); } static float rollBoneByQuatAligned(EditBone *bone, float old_up_axis[3], float qrot[4], float qroll[4], float aligned_axis[3]) { float nor[3], new_up_axis[3], x_axis[3], z_axis[3]; - VECCOPY(new_up_axis, old_up_axis); + copy_v3_v3(new_up_axis, old_up_axis); mul_qt_v3(qrot, new_up_axis); sub_v3_v3v3(nor, bone->tail, bone->head); @@ -236,7 +236,7 @@ static float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4] mul_qt_v3(qroll, normal); - VECCOPY(new_up_axis, edge->up_axis); + copy_v3_v3(new_up_axis, edge->up_axis); mul_qt_v3(qrot, new_up_axis); normalize_v3(new_up_axis); @@ -252,7 +252,7 @@ float rollBoneByQuat(EditBone *bone, float old_up_axis[3], float qrot[4]) { float new_up_axis[3]; - VECCOPY(new_up_axis, old_up_axis); + copy_v3_v3(new_up_axis, old_up_axis); mul_qt_v3(qrot, new_up_axis); return ED_rollBoneToVector(bone, new_up_axis, FALSE); @@ -367,7 +367,7 @@ static RigNode *newRigNodeHead(RigGraph *rg, RigArc *arc, float p[3]) node = MEM_callocN(sizeof(RigNode), "rig node"); BLI_addtail(&rg->nodes, node); - VECCOPY(node->p, p); + copy_v3_v3(node->p, p); node->degree = 1; node->arcs = NULL; @@ -389,7 +389,7 @@ static RigNode *newRigNode(RigGraph *rg, float p[3]) node = MEM_callocN(sizeof(RigNode), "rig node"); BLI_addtail(&rg->nodes, node); - VECCOPY(node->p, p); + copy_v3_v3(node->p, p); node->degree = 0; node->arcs = NULL; @@ -412,12 +412,12 @@ static void RIG_appendEdgeToArc(RigArc *arc, RigEdge *edge) if (edge->prev == NULL) { - VECCOPY(edge->head, arc->head->p); + copy_v3_v3(edge->head, arc->head->p); } else { RigEdge *last_edge = edge->prev; - VECCOPY(edge->head, last_edge->tail); + copy_v3_v3(edge->head, last_edge->tail); RIG_calculateEdgeAngles(last_edge, edge); } @@ -434,7 +434,7 @@ static void RIG_addEdgeToArc(RigArc *arc, float tail[3], EditBone *bone) edge = MEM_callocN(sizeof(RigEdge), "rig edge"); - VECCOPY(edge->tail, tail); + copy_v3_v3(edge->tail, tail); edge->bone = bone; if (bone) @@ -489,10 +489,10 @@ static RigControl *cloneControl(RigGraph *rg, RigGraph *src_rg, RigControl *src_ ctrl = newRigControl(rg); - VECCOPY(ctrl->head, src_ctrl->head); - VECCOPY(ctrl->tail, src_ctrl->tail); - VECCOPY(ctrl->up_axis, src_ctrl->up_axis); - VECCOPY(ctrl->offset, src_ctrl->offset); + copy_v3_v3(ctrl->head, src_ctrl->head); + copy_v3_v3(ctrl->tail, src_ctrl->tail); + copy_v3_v3(ctrl->up_axis, src_ctrl->up_axis); + copy_v3_v3(ctrl->offset, src_ctrl->offset); ctrl->tail_mode = src_ctrl->tail_mode; ctrl->flag = src_ctrl->flag; @@ -531,9 +531,9 @@ static RigArc *cloneArc(RigGraph *rg, RigGraph *src_rg, RigArc *src_arc, GHash * edge = MEM_callocN(sizeof(RigEdge), "rig edge"); - VECCOPY(edge->head, src_edge->head); - VECCOPY(edge->tail, src_edge->tail); - VECCOPY(edge->up_axis, src_edge->up_axis); + copy_v3_v3(edge->head, src_edge->head); + copy_v3_v3(edge->tail, src_edge->tail); + copy_v3_v3(edge->up_axis, src_edge->up_axis); edge->length = src_edge->length; edge->angle = src_edge->angle; @@ -690,8 +690,8 @@ static void RIG_addControlBone(RigGraph *rg, EditBone *bone) { RigControl *ctrl = newRigControl(rg); ctrl->bone = bone; - VECCOPY(ctrl->head, bone->head); - VECCOPY(ctrl->tail, bone->tail); + copy_v3_v3(ctrl->head, bone->head); + copy_v3_v3(ctrl->tail, bone->tail); getEditBoneRollUpAxis(bone, bone->roll, ctrl->up_axis); ctrl->tail_mode = TL_NONE; @@ -765,7 +765,7 @@ static int RIG_parentControl(RigControl *ctrl, EditBone *link) ctrl->link = link; ctrl->flag = flag; - VECCOPY(ctrl->offset, offset); + copy_v3_v3(ctrl->offset, offset); return 1; } @@ -1146,7 +1146,7 @@ static void RIG_removeUneededOffsets(RigGraph *rg) BLI_remlink(&arc->edges, first_edge); MEM_freeN(first_edge); - VECCOPY(arc->head->p, next_edge->head); + copy_v3_v3(arc->head->p, next_edge->head); } } } @@ -1222,7 +1222,7 @@ static void RIG_removeUneededOffsets(RigGraph *rg) BLI_remlink(&arc->edges, first_edge); MEM_freeN(first_edge); - VECCOPY(arc->head->p, next_edge->head); + copy_v3_v3(arc->head->p, next_edge->head); /* remove null edge in other arcs too */ for (other_arc = rg->arcs.first; other_arc; other_arc = other_arc->next) @@ -1284,7 +1284,7 @@ static void RIG_removeUneededOffsets(RigGraph *rg) BLI_remlink(&arc->edges, last_edge); MEM_freeN(last_edge); - VECCOPY(arc->tail->p, previous_edge->tail); + copy_v3_v3(arc->tail->p, previous_edge->tail); previous_edge->angle = 0; } } @@ -1755,7 +1755,7 @@ static void finalizeControl(RigGraph *rigg, RigControl *ctrl, float resize) sub_v3_v3v3(v1, ctrl->bone->tail, ctrl->bone->head); sub_v3_v3v3(v2, tail_vec, ctrl->bone->head); - VECCOPY(ctrl->bone->tail, tail_vec); + copy_v3_v3(ctrl->bone->tail, tail_vec); rotation_between_vecs_to_quat(qtail, v1, v2); mul_qt_qtqt(ctrl->qrot, qtail, ctrl->qrot); @@ -1791,7 +1791,7 @@ static void repositionControl(RigGraph *rigg, RigControl *ctrl, float head[3], f { float parent_offset[3], tail_offset[3]; - VECCOPY(parent_offset, ctrl->offset); + copy_v3_v3(parent_offset, ctrl->offset); mul_v3_fl(parent_offset, resize); mul_qt_v3(qrot, parent_offset); @@ -1799,7 +1799,7 @@ static void repositionControl(RigGraph *rigg, RigControl *ctrl, float head[3], f ctrl->flag |= RIG_CTRL_HEAD_DONE; - QUATCOPY(ctrl->qrot, qrot); + copy_qt_qt(ctrl->qrot, qrot); if (ctrl->tail_mode == TL_NONE) { @@ -1836,8 +1836,8 @@ static void repositionBone(bContext *C, RigGraph *rigg, RigEdge *edge, float vec rotation_between_vecs_to_quat(qrot, v1, v2); - VECCOPY(bone->head, vec0); - VECCOPY(bone->tail, vec1); + copy_v3_v3(bone->head, vec0); + copy_v3_v3(bone->tail, vec1); if (!is_zero_v3(up_axis)) { diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index d228d4d3772..b97e843529a 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -624,7 +624,7 @@ static void drawSubdividedStrokeBy(ToolSettings *toolsettings, BArcIterator *ite gluQuadricNormals(quad, GLU_SMOOTH); iter->head(iter); - VECCOPY(head, iter->p); + copy_v3_v3(head, iter->p); index = next_subdividion(toolsettings, iter, bone_start, end, head, tail); while (index != -1) @@ -640,7 +640,7 @@ static void drawSubdividedStrokeBy(ToolSettings *toolsettings, BArcIterator *ite glPopMatrix(); - VECCOPY(head, tail); + copy_v3_v3(head, tail); bone_start = index; // start next bone from current index index = next_subdividion(toolsettings, iter, bone_start, end, head, tail); @@ -748,7 +748,7 @@ static SK_Point *sk_snapPointArmature(bContext *C, Object *ob, ListBase *ebones, if ((bone->flag & BONE_CONNECTED) == 0) { - VECCOPY(vec, bone->head); + copy_v3_v3(vec, bone->head); mul_m4_v3(ob->obmat, vec); project_short_noclip(ar, vec, pval); @@ -758,13 +758,13 @@ static SK_Point *sk_snapPointArmature(bContext *C, Object *ob, ListBase *ebones, { *dist = pdist; pt = &boneSnap; - VECCOPY(pt->p, vec); + copy_v3_v3(pt->p, vec); pt->type = PT_EXACT; } } - VECCOPY(vec, bone->tail); + copy_v3_v3(vec, bone->tail); mul_m4_v3(ob->obmat, vec); project_short_noclip(ar, vec, pval); @@ -774,7 +774,7 @@ static SK_Point *sk_snapPointArmature(bContext *C, Object *ob, ListBase *ebones, { *dist = pdist; pt = &boneSnap; - VECCOPY(pt->p, vec); + copy_v3_v3(pt->p, vec); pt->type = PT_EXACT; } } @@ -1024,7 +1024,7 @@ static void sk_projectDrawPoint(bContext *C, float vec[3], SK_Stroke *stk, SK_Dr if (last != NULL) { - VECCOPY(fp, last->p); + copy_v3_v3(fp, last->p); } initgrabz(ar->regiondata, fp[0], fp[1], fp[2]); @@ -1134,12 +1134,12 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S } else { - VECCOPY(vec, p1->p); + copy_v3_v3(vec, p1->p); } if (last_p == NULL) { - VECCOPY(p, vec); + copy_v3_v3(p, vec); size = new_size; dist = 0; break; @@ -1149,7 +1149,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S if (new_dist < dist) { - VECCOPY(p, vec); + copy_v3_v3(p, vec); dist = new_dist; size = new_size; } @@ -1161,7 +1161,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S pt->type = dd->type; pt->mode = PT_SNAP; pt->size = size / 2; - VECCOPY(pt->p, p); + copy_v3_v3(pt->p, p); point_added = 1; } @@ -1193,7 +1193,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S if (spt != NULL) { - VECCOPY(pt->p, spt->p); + copy_v3_v3(pt->p, spt->p); point_added = 1; } } @@ -1207,7 +1207,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S { pt->type = dd->type; pt->mode = PT_SNAP; - VECCOPY(pt->p, vec); + copy_v3_v3(pt->p, vec); point_added = 1; } @@ -1234,7 +1234,7 @@ static int sk_addStrokeSnapPoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, int total; int i; - VECCOPY(final_p, pt.p); + copy_v3_v3(final_p, pt.p); sk_projectDrawPoint(C, pt.p, stk, dd); sk_appendStrokePoint(stk, &pt); @@ -1259,7 +1259,7 @@ static int sk_addStrokeSnapPoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, sk_interpolateDepth(C, stk, i + 1, stk->nb_points - 2, length, distance); } - VECCOPY(stk->points[stk->nb_points - 1].p, final_p); + copy_v3_v3(stk->points[stk->nb_points - 1].p, final_p); point_added = 1; } @@ -1296,7 +1296,7 @@ static void sk_getStrokePoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_S { point_added = sk_getStrokeSnapPoint(C, pt, sketch, stk, dd); LAST_SNAP_POINT_VALID = 1; - VECCOPY(LAST_SNAP_POINT, pt->p); + copy_v3_v3(LAST_SNAP_POINT, pt->p); } else { @@ -1536,8 +1536,8 @@ static void sk_convertStroke(bContext *C, SK_Stroke *stk) { bone = ED_armature_edit_bone_add(arm, "Bone"); - VECCOPY(bone->head, head->p); - VECCOPY(bone->tail, pt->p); + copy_v3_v3(bone->head, head->p); + copy_v3_v3(bone->tail, pt->p); mul_m4_v3(invmat, bone->head); mul_m4_v3(invmat, bone->tail); diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 86720a9bbf4..ed37f2056ad 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -1245,8 +1245,8 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float memset(&isec, 0, sizeof(isec)); isec.labda= 1e10f; - VECADD(isec.start, co1, epsilon); - VECADD(end, co2, epsilon); + add_v3_v3v3(isec.start, co1, epsilon); + add_v3_v3v3(end, co2, epsilon); sub_v3_v3v3(isec.vec, end, isec.start); if(meshdeform_intersect(mdb, &isec)) { diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index c010ce7fbf7..07f365b2294 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -816,7 +816,7 @@ static void calc_shapeKeys(Object *obedit) if (oldbezt) { int j; for (j= 0; j < 3; ++j) { - VECSUB(ofs[i], bezt->vec[j], oldbezt->vec[j]); + sub_v3_v3v3(ofs[i], bezt->vec[j], oldbezt->vec[j]); i++; } ofs[i++][0]= bezt->alfa - oldbezt->alfa; @@ -832,7 +832,7 @@ static void calc_shapeKeys(Object *obedit) while(a--) { oldbp= getKeyIndexOrig_bp(editnurb, bp); if (oldbp) { - VECSUB(ofs[i], bp->vec, oldbp->vec); + sub_v3_v3v3(ofs[i], bp->vec, oldbp->vec); ofs[i+1][0]= bp->alfa - oldbp->alfa; } i += 2; @@ -866,10 +866,10 @@ static void calc_shapeKeys(Object *obedit) oldbezt= getKeyIndexOrig_bezt(editnurb, bezt); for (j= 0; j < 3; ++j, ++i) { - VECCOPY(fp, bezt->vec[j]); + copy_v3_v3(fp, bezt->vec[j]); if (restore && oldbezt) { - VECCOPY(bezt->vec[j], oldbezt->vec[j]); + copy_v3_v3(bezt->vec[j], oldbezt->vec[j]); } fp+= 3; @@ -890,12 +890,12 @@ static void calc_shapeKeys(Object *obedit) while(a--) { oldbp= getKeyIndexOrig_bp(editnurb, bp); - VECCOPY(fp, bp->vec); + copy_v3_v3(fp, bp->vec); fp[3]= bp->alfa; if(restore && oldbp) { - VECCOPY(bp->vec, oldbp->vec); + copy_v3_v3(bp->vec, oldbp->vec); bp->alfa= oldbp->alfa; } @@ -921,10 +921,10 @@ static void calc_shapeKeys(Object *obedit) curofp= ofp + index; for (j= 0; j < 3; ++j, ++i) { - VECCOPY(fp, curofp); + copy_v3_v3(fp, curofp); if(apply_offset) { - VECADD(fp, fp, ofs[i]); + add_v3_v3(fp, ofs[i]); } fp+= 3; curofp+= 3; @@ -933,7 +933,7 @@ static void calc_shapeKeys(Object *obedit) if(apply_offset) { /* apply alfa offsets */ - VECADD(fp, fp, ofs[i]); + add_v3_v3(fp, ofs[i]); ++i; } @@ -941,7 +941,7 @@ static void calc_shapeKeys(Object *obedit) } else { int j; for (j= 0; j < 3; ++j, ++i) { - VECCOPY(fp, bezt->vec[j]); + copy_v3_v3(fp, bezt->vec[j]); fp+= 3; } fp[0]= bezt->alfa; @@ -959,15 +959,15 @@ static void calc_shapeKeys(Object *obedit) if (index >= 0) { curofp= ofp + index; - VECCOPY(fp, curofp); + copy_v3_v3(fp, curofp); fp[3]= curofp[3]; if(apply_offset) { - VECADD(fp, fp, ofs[i]); + add_v3_v3(fp, ofs[i]); fp[3]+=ofs[i+1][0]; } } else { - VECCOPY(fp, bp->vec); + copy_v3_v3(fp, bp->vec); fp[3]= bp->alfa; } @@ -2890,14 +2890,14 @@ static void subdividenurb(Object *obedit, int number_cuts) interp_v3_v3v3(vec+12, vec+3, vec+6, factor); /* change handle of prev beztn */ - VECCOPY((beztn-1)->vec[2], vec); + copy_v3_v3((beztn-1)->vec[2], vec); /* new point */ - VECCOPY(beztn->vec[0], vec+9); + copy_v3_v3(beztn->vec[0], vec+9); interp_v3_v3v3(beztn->vec[1], vec+9, vec+12, factor); - VECCOPY(beztn->vec[2], vec+12); + copy_v3_v3(beztn->vec[2], vec+12); /* handle of next bezt */ - if(a==0 && i == number_cuts - 1 && (nu->flagu & CU_NURB_CYCLIC)) {VECCOPY(beztnew->vec[0], vec+6);} - else {VECCOPY(bezt->vec[0], vec+6);} + if(a==0 && i == number_cuts - 1 && (nu->flagu & CU_NURB_CYCLIC)) {copy_v3_v3(beztnew->vec[0], vec+6);} + else {copy_v3_v3(bezt->vec[0], vec+6);} beztn->radius = (prevbezt->radius + bezt->radius)/2; beztn->weight = (prevbezt->weight + bezt->weight)/2; @@ -3381,7 +3381,7 @@ static int convertspline(short type, Nurb *nu) a= nr; bp= nu->bp; while(a--) { - VECCOPY(bezt->vec[1], bp->vec); + copy_v3_v3(bezt->vec[1], bp->vec); bezt->f1=bezt->f2=bezt->f3= bp->f1; bezt->h1= bezt->h2= HD_VECT; bezt->weight= bp->weight; @@ -3418,7 +3418,7 @@ static int convertspline(short type, Nurb *nu) while(a--) { if(type==CU_POLY && bezt->h1==HD_VECT && bezt->h2==HD_VECT) { /* vector handle becomes 1 poly vertice */ - VECCOPY(bp->vec, bezt->vec[1]); + copy_v3_v3(bp->vec, bezt->vec[1]); bp->vec[3]= 1.0; bp->f1= bezt->f2; nr-= 2; @@ -3428,7 +3428,7 @@ static int convertspline(short type, Nurb *nu) } else { for(c=0;c<3;c++) { - VECCOPY(bp->vec, bezt->vec[c]); + copy_v3_v3(bp->vec, bezt->vec[c]); bp->vec[3]= 1.0; if(c==0) bp->f1= bezt->f1; else if(c==1) bp->f1= bezt->f2; @@ -3475,13 +3475,13 @@ static int convertspline(short type, Nurb *nu) a= nr; bp= nu->bp; while(a--) { - VECCOPY(bezt->vec[0], bp->vec); + copy_v3_v3(bezt->vec[0], bp->vec); bezt->f1= bp->f1; bp++; - VECCOPY(bezt->vec[1], bp->vec); + copy_v3_v3(bezt->vec[1], bp->vec); bezt->f2= bp->f1; bp++; - VECCOPY(bezt->vec[2], bp->vec); + copy_v3_v3(bezt->vec[2], bp->vec); bezt->f3= bp->f1; bezt->radius= bp->radius; bezt->weight= bp->weight; @@ -4472,7 +4472,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) (BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb"); ED_curve_beztcpy(editnurb, newbezt, nu->bezt, nu->pntsu); *(newbezt+nu->pntsu)= *bezt; - VECCOPY(temp, bezt->vec[1]); + copy_v3_v3(temp, bezt->vec[1]); MEM_freeN(nu->bezt); nu->bezt= newbezt; newbezt+= nu->pntsu; @@ -4491,7 +4491,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) BEZ_SEL(newbezt); cu->lastsel= newbezt; newbezt->h2= newbezt->h1; - VECCOPY(temp, bezt->vec[1]); + copy_v3_v3(temp, bezt->vec[1]); MEM_freeN(nu->bezt); nu->bezt= newbezt; bezt= newbezt+1; @@ -4503,7 +4503,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) *newbezt= *bezt; BEZ_SEL(newbezt); newbezt->h2= newbezt->h1; - VECCOPY(temp, bezt->vec[1]); + copy_v3_v3(temp, bezt->vec[1]); newnu= (Nurb*)MEM_mallocN(sizeof(Nurb), "addvert_Nurb newnu"); memcpy(newnu, nu, sizeof(Nurb)); @@ -6189,7 +6189,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) if(rv3d) { copy_m4_m4(viewmat, rv3d->viewmat); - VECCOPY(zvec, rv3d->viewinv[2]); + copy_v3_v3(zvec, rv3d->viewinv[2]); } setflagsNurb(editnurb, 0); diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index d481be94bcc..7b79384fbb4 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -555,8 +555,8 @@ static void gp_layer_to_curve (bContext *C, bGPdata *gpd, bGPDlayer *gpl, short * - must clear transforms set on object, as those skew our results */ ob= add_object(scene, OB_CURVE); - ob->loc[0]= ob->loc[1]= ob->loc[2]= 0; - ob->rot[0]= ob->rot[1]= ob->rot[2]= 0; + zero_v3(ob->loc); + zero_v3(ob->rot); cu= ob->data; cu->flag |= CU_3D; @@ -573,6 +573,9 @@ static void gp_layer_to_curve (bContext *C, bGPdata *gpd, bGPDlayer *gpl, short case GP_STROKECONVERT_CURVE: gp_stroke_to_bezier(C, gpl, gps, cu, subrect_ptr); break; + default: + BLI_assert(!"invalid mode"); + break; } } } @@ -602,17 +605,7 @@ static int gp_convert_layer_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - /* handle conversion modes */ - switch (mode) { - case GP_STROKECONVERT_PATH: - case GP_STROKECONVERT_CURVE: - gp_layer_to_curve(C, gpd, gpl, mode); - break; - - default: /* unsupoorted */ - BKE_report(op->reports, RPT_ERROR, "Unknown conversion option"); - return OPERATOR_CANCELLED; - } + gp_layer_to_curve(C, gpd, gpl, mode); /* notifiers */ WM_event_add_notifier(C, NC_OBJECT|NA_ADDED, NULL); diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index ff3b69c2bf6..12f03f7341c 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -658,7 +658,7 @@ static void gp_stroke_newfrombuffer (tGPsdata *p) found_depth= TRUE; } - VECCOPY2D(mval_prev, mval); + copy_v2_v2_int(mval_prev, mval); } if (found_depth == FALSE) { diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h index d1da9f308fb..3035aa44735 100644 --- a/source/blender/editors/include/ED_particle.h +++ b/source/blender/editors/include/ED_particle.h @@ -51,7 +51,7 @@ int PE_start_edit(struct PTCacheEdit *edit); struct PTCacheEdit *PE_get_current(struct Scene *scene, struct Object *ob); struct PTCacheEdit *PE_create_current(struct Scene *scene, struct Object *ob); void PE_current_changed(struct Scene *scene, struct Object *ob); -int PE_minmax(struct Scene *scene, float *min, float *max); +int PE_minmax(struct Scene *scene, float min[3], float max[3]); struct ParticleEditSettings *PE_settings(struct Scene *scene); /* update calls */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index dd75f506be8..e5092c82304 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1224,7 +1224,7 @@ void ui_get_but_vectorf(uiBut *but, float vec[3]) int a, tot; if(but->editvec) { - VECCOPY(vec, but->editvec); + copy_v3_v3(vec, but->editvec); } if(but->rnaprop) { @@ -1248,7 +1248,7 @@ void ui_get_but_vectorf(uiBut *but, float vec[3]) } else if(but->pointype == FLO) { float *fp= (float *)but->poin; - VECCOPY(vec, fp); + copy_v3_v3(vec, fp); } else { if (but->editvec==NULL) { diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 0ba141163b3..c34c10bf1a7 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -944,7 +944,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut data->origstr= NULL; data->value= data->origvalue; data->origvalue= 0.0; - VECCOPY(data->vec, data->origvec); + copy_v3_v3(data->vec, data->origvec); data->origvec[0]= data->origvec[1]= data->origvec[2]= 0.0f; } else { @@ -2121,7 +2121,7 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data break; case COL: ui_get_but_vectorf(but, data->origvec); - VECCOPY(data->vec, data->origvec); + copy_v3_v3(data->vec, data->origvec); but->editvec= data->vec; handlefunc= ui_block_func_COL; @@ -5727,7 +5727,7 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut * /* copy over return values from the closing menu */ if(menu->menuretval == UI_RETURN_OK || menu->menuretval == UI_RETURN_UPDATE) { if(but->type == COL) - VECCOPY(data->vec, menu->retvec) + copy_v3_v3(data->vec, menu->retvec); else if(ELEM3(but->type, MENU, ICONROW, ICONTEXTROW)) data->value= menu->retvalue; } diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 4791d2652dc..edbd5c5684e 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -2126,7 +2126,7 @@ uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_bu uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); - VECCOPY(handle->retvec, but->editvec); + copy_v3_v3(handle->retvec, but->editvec); uiBlockPicker(block, handle->retvec, &but->rnapoin, but->rnaprop); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index c5ac4f5aa88..878d1bc36a4 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1510,7 +1510,7 @@ static void widget_state(uiWidgetType *wt, int state) wt->wcol= *(wt->wcol_theme); if(state & UI_SELECT) { - QUATCOPY(wt->wcol.inner, wt->wcol.inner_sel) + copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel); if(state & UI_BUT_ANIMATED_KEY) widget_state_blend(wt->wcol.inner, wcol_state->inner_key_sel, wcol_state->blend); @@ -1519,7 +1519,7 @@ static void widget_state(uiWidgetType *wt, int state) else if(state & UI_BUT_DRIVEN) widget_state_blend(wt->wcol.inner, wcol_state->inner_driven_sel, wcol_state->blend); - VECCOPY(wt->wcol.text, wt->wcol.text_sel); + copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel); if(state & UI_SELECT) SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown); @@ -1604,7 +1604,7 @@ static void widget_state_option_menu(uiWidgetType *wt, int state) else { bTheme *btheme= U.themes.first; /* XXX */ - VECCOPY(wt->wcol.text, btheme->tui.wcol_menu_back.text); + copy_v3_v3_char(wt->wcol.text, btheme->tui.wcol_menu_back.text); } } @@ -1619,11 +1619,11 @@ static void widget_state_pulldown(uiWidgetType *wt, int state) { wt->wcol= *(wt->wcol_theme); - QUATCOPY(wt->wcol.inner, wt->wcol.inner_sel); - VECCOPY(wt->wcol.outline, wt->wcol.inner); + copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel); + copy_v3_v3_char(wt->wcol.outline, wt->wcol.inner); if(state & UI_ACTIVE) - VECCOPY(wt->wcol.text, wt->wcol.text_sel); + copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel); } /* special case, menu items */ @@ -1637,8 +1637,8 @@ static void widget_state_menu_item(uiWidgetType *wt, int state) wt->wcol.text[2]= 0.5f*(wt->wcol.text[2]+wt->wcol.text_sel[2]); } else if(state & UI_ACTIVE) { - QUATCOPY(wt->wcol.inner, wt->wcol.inner_sel); - VECCOPY(wt->wcol.text, wt->wcol.text_sel); + copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel); + copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel); } } @@ -1874,38 +1874,38 @@ void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha) break; case UI_GRAD_H: hsv_to_rgb(0.0, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]); - VECCOPY(col1[1], col1[0]); - VECCOPY(col1[2], col1[0]); - VECCOPY(col1[3], col1[0]); + copy_v3_v3(col1[1], col1[0]); + copy_v3_v3(col1[2], col1[0]); + copy_v3_v3(col1[3], col1[0]); break; case UI_GRAD_S: hsv_to_rgb(1.0, 0.0, 1.0, &col1[1][0], &col1[1][1], &col1[1][2]); - VECCOPY(col1[0], col1[1]); - VECCOPY(col1[2], col1[1]); - VECCOPY(col1[3], col1[1]); + copy_v3_v3(col1[0], col1[1]); + copy_v3_v3(col1[2], col1[1]); + copy_v3_v3(col1[3], col1[1]); break; case UI_GRAD_V: hsv_to_rgb(1.0, 1.0, 0.0, &col1[2][0], &col1[2][1], &col1[2][2]); - VECCOPY(col1[0], col1[2]); - VECCOPY(col1[1], col1[2]); - VECCOPY(col1[3], col1[2]); + copy_v3_v3(col1[0], col1[2]); + copy_v3_v3(col1[1], col1[2]); + copy_v3_v3(col1[3], col1[2]); break; default: assert(!"invalid 'type' argument"); hsv_to_rgb(1.0, 1.0, 1.0, &col1[2][0], &col1[2][1], &col1[2][2]); - VECCOPY(col1[0], col1[2]); - VECCOPY(col1[1], col1[2]); - VECCOPY(col1[3], col1[2]); + copy_v3_v3(col1[0], col1[2]); + copy_v3_v3(col1[1], col1[2]); + copy_v3_v3(col1[3], col1[2]); } /* old below */ for(dx=0.0f; dx<1.0f; dx+= 0.05f) { // previous color - VECCOPY(col0[0], col1[0]); - VECCOPY(col0[1], col1[1]); - VECCOPY(col0[2], col1[2]); - VECCOPY(col0[3], col1[3]); + copy_v3_v3(col0[0], col1[0]); + copy_v3_v3(col0[1], col1[1]); + copy_v3_v3(col0[2], col1[2]); + copy_v3_v3(col0[3], col1[3]); // new color switch(type) { @@ -1929,21 +1929,21 @@ void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha) break; case UI_GRAD_H: hsv_to_rgb(dx, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]); - VECCOPY(col1[1], col1[0]); - VECCOPY(col1[2], col1[0]); - VECCOPY(col1[3], col1[0]); + copy_v3_v3(col1[1], col1[0]); + copy_v3_v3(col1[2], col1[0]); + copy_v3_v3(col1[3], col1[0]); break; case UI_GRAD_S: hsv_to_rgb(h, dx, 1.0, &col1[1][0], &col1[1][1], &col1[1][2]); - VECCOPY(col1[0], col1[1]); - VECCOPY(col1[2], col1[1]); - VECCOPY(col1[3], col1[1]); + copy_v3_v3(col1[0], col1[1]); + copy_v3_v3(col1[2], col1[1]); + copy_v3_v3(col1[3], col1[1]); break; case UI_GRAD_V: hsv_to_rgb(h, 1.0, dx, &col1[2][0], &col1[2][1], &col1[2][2]); - VECCOPY(col1[0], col1[2]); - VECCOPY(col1[1], col1[2]); - VECCOPY(col1[3], col1[2]); + copy_v3_v3(col1[0], col1[2]); + copy_v3_v3(col1[1], col1[2]); + copy_v3_v3(col1[3], col1[2]); break; } @@ -2197,7 +2197,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat SWAP(short, wcol->shadetop, wcol->shadedown); - QUATCOPY(wcol->inner, wcol->item); + copy_v4_v4_char(wcol->inner, wcol->item); if(wcol->shadetop>wcol->shadedown) wcol->shadetop+= 20; /* XXX violates themes... */ @@ -2369,9 +2369,9 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s if(!(state & UI_TEXTINPUT)) { /* slider part */ - VECCOPY(outline, wcol->outline); - VECCOPY(wcol->outline, wcol->item); - VECCOPY(wcol->inner, wcol->item); + copy_v3_v3_char(outline, wcol->outline); + copy_v3_v3_char(wcol->outline, wcol->item); + copy_v3_v3_char(wcol->inner, wcol->item); if(!(state & UI_SELECT)) SWAP(short, wcol->shadetop, wcol->shadedown); @@ -2397,7 +2397,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s round_box_edges(&wtb1, roundboxalign & ~(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT), &rect1, offs); widgetbase_draw(&wtb1, wcol); - VECCOPY(wcol->outline, outline); + copy_v3_v3_char(wcol->outline, outline); if(!(state & UI_SELECT)) SWAP(short, wcol->shadetop, wcol->shadedown); @@ -2624,7 +2624,7 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED( widget_init(&wtb); - VECCOPY(old_col, wcol->inner); + copy_v3_v3_char(old_col, wcol->inner); /* abuse but->hsv - if it's non-zero, use this color as the box's background */ if (but->col[3]) { @@ -2643,7 +2643,7 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED( /* XXX, this doesnt work right since the color applies to buttons outside the box too. */ glClearColor(wcol->inner[0]/255.0, wcol->inner[1]/255.0, wcol->inner[2]/255.0, 1.0); - VECCOPY(wcol->inner, old_col); + copy_v3_v3_char(wcol->inner, old_col); } static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index b135aae30d5..2c4fdb61db5 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -48,6 +48,7 @@ #include "DNA_vfont_types.h" #include "BLI_math.h" +#include "BLI_string.h" #include "BLI_listbase.h" #include "BLI_utildefines.h" @@ -1012,23 +1013,21 @@ static void copy_object_set_idnew(bContext *C, int dupflag) /********************* Make Duplicates Real ************************/ -static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base) +static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, + const short use_base_parent, + const short use_hierarchy) { - Base *basen; - Object *ob; ListBase *lb; DupliObject *dob; - - if(!base && !(base = BASACT)) - return; - + if(!(base->object->transflag & OB_DUPLI)) return; lb= object_duplilist(scene, base->object); for(dob= lb->first; dob; dob= dob->next) { - ob= copy_object(dob->ob); + Base *basen; + Object *ob= copy_object(dob->ob); /* font duplis can have a totcol without material, we get them from parent * should be implemented better... */ @@ -1055,22 +1054,85 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base) object_apply_mat4(ob, ob->obmat, FALSE, FALSE); } + if (use_hierarchy) { + for(dob= lb->first; dob; dob= dob->next) { + /* original parents */ + Object *ob_src= dob->ob; + Object *ob_src_par= ob_src->parent; + + Object *ob_dst= (Object *)ob_src->id.newid; + + if (ob_src_par && ob_src_par->id.newid) { + /* the parent was also made real, parent newly real duplis */ + Object *ob_dst_par= (Object *)ob_src_par->id.newid; + + /* allow for all possible parent types */ + ob_dst->partype= ob_src->partype; + BLI_strncpy(ob_dst->parsubstr, ob_src->parsubstr, sizeof(ob_dst->parsubstr)); + ob_dst->par1= ob_src->par1; + ob_dst->par2= ob_src->par2; + ob_dst->par3= ob_src->par3; + + copy_m4_m4(ob_dst->parentinv, ob_src->parentinv); + + ob_dst->parent= ob_dst_par; + } + else if (use_base_parent) { + ob_dst->parent= base->object; + ob_dst->partype= PAROBJECT; + } + + if (ob_dst->parent) { + invert_m4_m4(ob_dst->parentinv, dob->mat); + + /* note, this may be the parent of other objects, but it should + * still work out ok */ + object_apply_mat4(ob_dst, dob->mat, FALSE, TRUE); + + /* to set ob_dst->orig and incase theres any other discrepicies */ + DAG_id_tag_update(&ob_dst->id, OB_RECALC_OB); + } + } + } + else if (use_base_parent) { + /* since we are ignoring the internal hierarchy - parent all to the + * base object */ + for(dob= lb->first; dob; dob= dob->next) { + /* original parents */ + Object *ob_src= dob->ob; + Object *ob_dst= (Object *)ob_src->id.newid; + + ob_dst->parent= base->object; + ob_dst->partype= PAROBJECT; + + /* similer to the code above, see comments */ + invert_m4_m4(ob_dst->parentinv, dob->mat); + object_apply_mat4(ob_dst, dob->mat, FALSE, TRUE); + DAG_id_tag_update(&ob_dst->id, OB_RECALC_OB); + + + } + } + copy_object_set_idnew(C, 0); free_object_duplilist(lb); - base->object->transflag &= ~OB_DUPLI; + base->object->transflag &= ~OB_DUPLI; } -static int object_duplicates_make_real_exec(bContext *C, wmOperator *UNUSED(op)) +static int object_duplicates_make_real_exec(bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); + + const short use_base_parent= RNA_boolean_get(op->ptr, "use_base_parent"); + const short use_hierarchy= RNA_boolean_get(op->ptr, "use_hierarchy"); clear_id_newpoins(); CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { - make_object_duplilist_real(C, scene, base); + make_object_duplilist_real(C, scene, base, use_base_parent, use_hierarchy); /* dependencies were changed */ WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, base->object); @@ -1100,6 +1162,9 @@ void OBJECT_OT_duplicates_make_real(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + RNA_def_boolean(ot->srna, "use_base_parent", 0, "Parent", "Parent newly created objects to the original duplicator"); + RNA_def_boolean(ot->srna, "use_hierarchy", 0, "Keep Hierarchy", "Maintain parent child relationships"); } /**************************** Convert **************************/ diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 1c94ba1afbb..28b9d9ba817 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1131,19 +1131,19 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) base->object->recalc |= OB_RECALC_OB; if(event==1) { /* loc */ - VECCOPY(base->object->loc, ob->loc); - VECCOPY(base->object->dloc, ob->dloc); + copy_v3_v3(base->object->loc, ob->loc); + copy_v3_v3(base->object->dloc, ob->dloc); } else if(event==2) { /* rot */ - VECCOPY(base->object->rot, ob->rot); - VECCOPY(base->object->drot, ob->drot); + copy_v3_v3(base->object->rot, ob->rot); + copy_v3_v3(base->object->drot, ob->drot); - QUATCOPY(base->object->quat, ob->quat); - QUATCOPY(base->object->dquat, ob->dquat); + copy_qt_qt(base->object->quat, ob->quat); + copy_qt_qt(base->object->dquat, ob->dquat); } else if(event==3) { /* size */ - VECCOPY(base->object->size, ob->size); - VECCOPY(base->object->dsize, ob->dsize); + copy_v3_v3(base->object->size, ob->size); + copy_v3_v3(base->object->dsize, ob->dsize); } else if(event==4) { /* drawtype */ base->object->dt= ob->dt; @@ -1332,7 +1332,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) base->object->index= ob->index; } else if(event==31) { /* object color */ - QUATCOPY(base->object->col, ob->col); + copy_v4_v4(base->object->col, ob->col); } } } diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index c1ba0b207cb..9f3bc9bbf37 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -35,6 +35,7 @@ #include "MEM_guardedalloc.h" #include "BLI_listbase.h" +#include "BLI_math.h" #include "BLI_utildefines.h" #include "DNA_curve_types.h" @@ -132,7 +133,7 @@ void load_editLatt(Object *obedit) bp= editlt->def; while(tot--) { - VECCOPY(fp, bp->vec); + copy_v3_v3(fp, bp->vec); fp+= 3; bp++; } diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 00faf86c866..d84d5ea6537 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -358,7 +358,7 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene * key= cache[a]; kmax= key->steps; for(k=0; k<=kmax; k++,key++,cvert++,mvert++) { - VECCOPY(mvert->co,key->co); + copy_v3_v3(mvert->co,key->co); if(k) { medge->v1= cvert-1; medge->v2= cvert; @@ -377,7 +377,7 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene * key=cache[a]; kmax=key->steps; for(k=0; k<=kmax; k++,key++,cvert++,mvert++) { - VECCOPY(mvert->co,key->co); + copy_v3_v3(mvert->co,key->co); if(k) { medge->v1=cvert-1; medge->v2=cvert; diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index d60b7b31bf4..b4fee991bb2 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -134,7 +134,7 @@ static void object_clear_rot(Object *ob) float eul[3], oldeul[3], quat1[4] = {0}; if (ob->rotmode == ROT_MODE_QUAT) { - QUATCOPY(quat1, ob->quat); + copy_qt_qt(quat1, ob->quat); quat_to_eul(oldeul, ob->quat); } else if (ob->rotmode == ROT_MODE_AXISANGLE) { diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 2852c57338a..b9e9005dd25 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -390,7 +390,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data) /*************************** selection utilities *******************************/ -static int key_test_depth(PEData *data, float co[3]) +static int key_test_depth(PEData *data, const float co[3]) { View3D *v3d= data->vc.v3d; double ux, uy, uz; @@ -407,7 +407,7 @@ static int key_test_depth(PEData *data, float co[3]) return 0; gluProject(co[0],co[1],co[2], data->mats.modelview, data->mats.projection, - (GLint *)data->mats.viewport, &ux, &uy, &uz); + (GLint *)data->mats.viewport, &ux, &uy, &uz); x=wco[0]; y=wco[1]; @@ -434,7 +434,7 @@ static int key_test_depth(PEData *data, float co[3]) return 1; } -static int key_inside_circle(PEData *data, float rad, float co[3], float *distance) +static int key_inside_circle(PEData *data, float rad, const float co[3], float *distance) { float dx, dy, dist; int sco[2]; @@ -461,7 +461,7 @@ static int key_inside_circle(PEData *data, float rad, float co[3], float *distan return 0; } -static int key_inside_rect(PEData *data, float co[3]) +static int key_inside_rect(PEData *data, const float co[3]) { int sco[2]; @@ -477,7 +477,7 @@ static int key_inside_rect(PEData *data, float co[3]) return 0; } -static int key_inside_test(PEData *data, float co[3]) +static int key_inside_test(PEData *data, const float co[3]) { if(data->mval) return key_inside_circle(data, data->rad, co, NULL); @@ -719,7 +719,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys) LOOP_PARTICLES { key = pa->hair; psys_mat_hair_to_orco(ob, psmd->dm, psys->part->from, pa, mat); - VECCOPY(co, key->co); + copy_v3_v3(co, key->co); mul_m4_v3(mat, co); BLI_kdtree_insert(tree, p, co, NULL); } @@ -733,7 +733,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys) LOOP_PARTICLES { key = pa->hair; psys_mat_hair_to_orco(ob, psmd->dm, psys->part->from, pa, mat); - VECCOPY(co, key->co); + copy_v3_v3(co, key->co); mul_m4_v3(mat, co); co[0]= -co[0]; @@ -818,7 +818,7 @@ static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys key= point->keys; mkey= mpoint->keys; for(k=0; k<pa->totkey; k++, hkey++, mhkey++, key++, mkey++) { - VECCOPY(mhkey->co, hkey->co); + copy_v3_v3(mhkey->co, hkey->co); mul_m4_v3(mat, mhkey->co); mhkey->co[0]= -mhkey->co[0]; mul_m4_v3(immat, mhkey->co); @@ -918,7 +918,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit) sub_v3_v3v3(dvec, key->co, vec); dot=dot_v3v3(dvec,nor); - VECCOPY(dvec,nor); + copy_v3_v3(dvec,nor); if(dot>0.0f) { if(dot<dist_1st) { @@ -1019,7 +1019,7 @@ static void pe_iterate_lengths(Scene *scene, PTCacheEdit *edit) add_v3_v3((key-1)->co, dv1); } - VECADD(dv1,dv0,dv2); + add_v3_v3v3(dv1, dv0, dv2); } } } @@ -1071,20 +1071,20 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys) MVert *mvert; mvert=dm->getVertData(dm,mface->v1,CD_MVERT); - VECCOPY(vec,mvert->co); + copy_v3_v3(vec,mvert->co); VECCOPY(nor,mvert->no); mvert=dm->getVertData(dm,mface->v2,CD_MVERT); - VECADD(vec,vec,mvert->co); + add_v3_v3v3(vec,vec,mvert->co); VECADD(nor,nor,mvert->no); mvert=dm->getVertData(dm,mface->v3,CD_MVERT); - VECADD(vec,vec,mvert->co); + add_v3_v3v3(vec,vec,mvert->co); VECADD(nor,nor,mvert->no); if(mface->v4) { mvert=dm->getVertData(dm,mface->v4,CD_MVERT); - VECADD(vec,vec,mvert->co); + add_v3_v3v3(vec,vec,mvert->co); VECADD(nor,nor,mvert->no); mul_v3_fl(vec,0.25); @@ -1144,7 +1144,7 @@ static void update_world_cos(Object *ob, PTCacheEdit *edit) psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles+p, hairmat); LOOP_KEYS { - VECCOPY(key->world_co,key->co); + copy_v3_v3(key->world_co,key->co); if(!(psys->flag & PSYS_GLOBAL_HAIR)) mul_m4_v3(hairmat, key->world_co); } @@ -1170,13 +1170,13 @@ static void update_velocities(PTCacheEdit *edit) if(dfra <= 0.0f) continue; - VECSUB(key->vel, (key+1)->co, key->co); + sub_v3_v3v3(key->vel, (key+1)->co, key->co); if(point->totkey>2) { - VECSUB(vec1, (key+1)->co, (key+2)->co); + sub_v3_v3v3(vec1, (key+1)->co, (key+2)->co); project_v3_v3v3(vec2, vec1, key->vel); - VECSUB(vec2, vec1, vec2); - VECADDFAC(key->vel, key->vel, vec2, 0.5f); + sub_v3_v3v3(vec2, vec1, vec2); + madd_v3_v3fl(key->vel, vec2, 0.5f); } } else if(k==point->totkey-1) { @@ -1185,13 +1185,13 @@ static void update_velocities(PTCacheEdit *edit) if(dfra <= 0.0f) continue; - VECSUB(key->vel, key->co, (key-1)->co); + sub_v3_v3v3(key->vel, key->co, (key-1)->co); if(point->totkey>2) { - VECSUB(vec1, (key-2)->co, (key-1)->co); + sub_v3_v3v3(vec1, (key-2)->co, (key-1)->co); project_v3_v3v3(vec2, vec1, key->vel); - VECSUB(vec2, vec1, vec2); - VECADDFAC(key->vel, key->vel, vec2, 0.5f); + sub_v3_v3v3(vec2, vec1, vec2); + madd_v3_v3fl(key->vel, vec2, 0.5f); } } else { @@ -1200,7 +1200,7 @@ static void update_velocities(PTCacheEdit *edit) if(dfra <= 0.0f) continue; - VECSUB(key->vel, (key+1)->co, (key-1)->co); + sub_v3_v3v3(key->vel, (key+1)->co, (key-1)->co); } mul_v3_fl(key->vel, frs_sec/dfra); } @@ -1623,7 +1623,7 @@ int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, sho if(pset->selectmode==SCE_SELECT_POINT) { LOOP_KEYS { - VECCOPY(co, key->co); + copy_v3_v3(co, key->co); mul_m4_v3(mat, co); project_int(ar, co, vertco); if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) { @@ -1641,7 +1641,7 @@ int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, sho else if(pset->selectmode==SCE_SELECT_END) { key= point->keys + point->totkey - 1; - VECCOPY(co, key->co); + copy_v3_v3(co, key->co); mul_m4_v3(mat, co); project_int(ar, co,vertco); if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) { @@ -1934,8 +1934,8 @@ static void rekey_particle(PEData *data, int pa_index) okey = pa->hair; /* root and tip stay the same */ - VECCOPY(key->co, okey->co); - VECCOPY((key + data->totrekey - 1)->co, (okey + pa->totkey - 1)->co); + copy_v3_v3(key->co, okey->co); + copy_v3_v3((key + data->totrekey - 1)->co, (okey + pa->totkey - 1)->co); sta= key->time= okey->time; end= (key + data->totrekey - 1)->time= (okey + pa->totkey - 1)->time; @@ -1945,7 +1945,7 @@ static void rekey_particle(PEData *data, int pa_index) for(k=1,key++; k<data->totrekey-1; k++,key++) { state.time= (float)k / (float)(data->totrekey-1); psys_get_particle_on_path(&sim, pa_index, &state, 0); - VECCOPY(key->co, state.co); + copy_v3_v3(key->co, state.co); key->time= sta + k * dval; } @@ -2038,7 +2038,7 @@ static void rekey_particle_to_time(Scene *scene, Object *ob, int pa_index, float for(k=1, key++; k < pa->totkey; k++, key++) { state.time= path_time * (float)k / (float)(pa->totkey-1); psys_get_particle_on_path(&sim, pa_index, &state, 0); - VECCOPY(key->co, state.co); + copy_v3_v3(key->co, state.co); } /* replace hair keys */ @@ -2188,7 +2188,7 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys) } if(hkey < pa->hair + pa->totkey) { - VECCOPY(nhkey->co, hkey->co); + copy_v3_v3(nhkey->co, hkey->co); nhkey->editflag = hkey->editflag; nhkey->time= hkey->time; nhkey->weight= hkey->weight; @@ -2199,7 +2199,7 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys) nkey->flag = key->flag; nkey->ftime = key->ftime; nkey->length = key->length; - VECCOPY(nkey->world_co, key->world_co); + copy_v3_v3(nkey->world_co, key->world_co); } nkey++; nhkey++; @@ -2275,7 +2275,7 @@ static void subdivide_particle(PEData *data, int pa_index) nkey->time= (key->time + (key+1)->time)*0.5f; state.time= (endtime != 0.0f)? nkey->time/endtime: 0.0f; psys_get_particle_on_path(&sim, pa_index, &state, 0); - VECCOPY(nkey->co, state.co); + copy_v3_v3(nkey->co, state.co); nekey->co= nkey->co; nekey->time= &nkey->time; @@ -2365,7 +2365,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op) /* insert particles into kd tree */ LOOP_SELECTED_POINTS { psys_mat_hair_to_object(ob, psmd->dm, psys->part->from, psys->particles+p, mat); - VECCOPY(co, point->keys->co); + copy_v3_v3(co, point->keys->co); mul_m4_v3(mat, co); BLI_kdtree_insert(tree, p, co, NULL); } @@ -2375,7 +2375,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op) /* tag particles to be removed */ LOOP_SELECTED_POINTS { psys_mat_hair_to_object(ob, psmd->dm, psys->part->from, psys->particles+p, mat); - VECCOPY(co, point->keys->co); + copy_v3_v3(co, point->keys->co); mul_m4_v3(mat, co); totn= BLI_kdtree_find_n_nearest(tree,10,co,NULL,nearest); @@ -2748,10 +2748,10 @@ static void brush_comb(PEData *data, float UNUSED(mat[][4]), float imat[][4], in fac= (float)pow((double)(1.0f - data->dist / data->rad), (double)data->combfac); - VECCOPY(cvec,data->dvec); + copy_v3_v3(cvec,data->dvec); mul_mat3_m4_v3(imat,cvec); mul_v3_fl(cvec, fac); - VECADD(key->co, key->co, cvec); + add_v3_v3(key->co, cvec); (data->edit->points + point_index)->flag |= PEP_EDIT_RECALC; } @@ -2862,13 +2862,13 @@ static void brush_length(PEData *data, int point_index) LOOP_KEYS { if(k==0) { - VECCOPY(pvec,key->co); + copy_v3_v3(pvec,key->co); } else { - VECSUB(dvec,key->co,pvec); - VECCOPY(pvec,key->co); + sub_v3_v3v3(dvec,key->co,pvec); + copy_v3_v3(pvec,key->co); mul_v3_fl(dvec,data->growfac); - VECADD(key->co,(key-1)->co,dvec); + add_v3_v3v3(key->co,(key-1)->co,dvec); } } @@ -2905,14 +2905,14 @@ static void brush_puff(PEData *data, int point_index) LOOP_KEYS { if(k==0) { /* find root coordinate and normal on emitter */ - VECCOPY(co, key->co); + copy_v3_v3(co, key->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 */ point_index= BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL, NULL); if(point_index == -1) return; - VECCOPY(rootco, co); + copy_v3_v3(rootco, co); copy_v3_v3(nor, &edit->emitter_cosnos[point_index*6+3]); mul_mat3_m4_v3(data->ob->obmat, nor); /* normal into worldspace */ @@ -2927,19 +2927,19 @@ static void brush_puff(PEData *data, int point_index) else { /* compute position as if hair was standing up straight. * */ - VECCOPY(lastco, co); - VECCOPY(co, key->co); + copy_v3_v3(lastco, co); + copy_v3_v3(co, key->co); mul_m4_v3(mat, co); length += len_v3v3(lastco, co); if((data->select==0 || (key->flag & PEK_SELECT)) && !(key->flag & PEK_HIDE)) { - VECADDFAC(kco, rootco, nor, length); + madd_v3_v3v3fl(kco, rootco, nor, length); /* blend between the current and straight position */ - VECSUB(dco, kco, co); - VECADDFAC(co, co, dco, fac); + sub_v3_v3v3(dco, kco, co); + madd_v3_v3fl(co, dco, fac); /* re-use dco to compare before and after translation and add to the offset */ - VECCOPY(dco, key->co); + copy_v3_v3(dco, key->co); mul_v3_m4v3(key->co, imat, co); @@ -2966,7 +2966,7 @@ static void brush_puff(PEData *data, int point_index) /* Move the unselected point on a vector based on the * hair direction and the offset */ float c1[3], c2[3]; - VECSUB(dco, lastco, co); + sub_v3_v3v3(dco, lastco, co); mul_mat3_m4_v3(imat, dco); /* into particle space */ /* move the point along a vector perpendicular to the @@ -2980,7 +2980,7 @@ static void brush_puff(PEData *data, int point_index) /* Move the unselected point on a vector based on the * the normal of the closest geometry */ float oco[3], onor[3]; - VECCOPY(oco, key->co); + copy_v3_v3(oco, key->co); 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 */ @@ -3029,7 +3029,7 @@ static void brush_smooth_get(PEData *data, float mat[][4], float UNUSED(imat[][4 sub_v3_v3v3(dvec,key->co,(key-1)->co); mul_mat3_m4_v3(mat,dvec); - VECADD(data->vec,data->vec,dvec); + add_v3_v3(data->vec, dvec); data->tot++; } } @@ -3039,57 +3039,61 @@ static void brush_smooth_do(PEData *data, float UNUSED(mat[][4]), float imat[][4 float vec[3], dvec[3]; if(key_index) { - VECCOPY(vec,data->vec); + copy_v3_v3(vec, data->vec); mul_mat3_m4_v3(imat,vec); sub_v3_v3v3(dvec,key->co,(key-1)->co); - VECSUB(dvec,vec,dvec); + sub_v3_v3v3(dvec,vec,dvec); mul_v3_fl(dvec,data->smoothfac); - VECADD(key->co,key->co,dvec); + add_v3_v3(key->co, dvec); } (data->edit->points + point_index)->flag |= PEP_EDIT_RECALC; } /* convert from triangle barycentric weights to quad mean value weights */ -static void intersect_dm_quad_weights(float *v1, float *v2, float *v3, float *v4, float *w) +static void intersect_dm_quad_weights(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float w[4]) { float co[3], vert[4][3]; - VECCOPY(vert[0], v1); - VECCOPY(vert[1], v2); - VECCOPY(vert[2], v3); - VECCOPY(vert[3], v4); + copy_v3_v3(vert[0], v1); + copy_v3_v3(vert[1], v2); + copy_v3_v3(vert[2], v3); + copy_v3_v3(vert[3], v4); co[0]= v1[0]*w[0] + v2[0]*w[1] + v3[0]*w[2] + v4[0]*w[3]; co[1]= v1[1]*w[0] + v2[1]*w[1] + v3[1]*w[2] + v4[1]*w[3]; co[2]= v1[2]*w[0] + v2[2]*w[1] + v3[2]*w[2] + v4[2]*w[3]; - interp_weights_poly_v3( w,vert, 4, co); + interp_weights_poly_v3(w, vert, 4, co); } /* check intersection with a derivedmesh */ -static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, float *vert_cos, float *co1, float* co2, float *min_d, int *min_face, float *min_w, - float *face_minmax, float *pa_minmax, float radius, float *ipoint) +static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, + float *vert_cos, + const float co1[3], const float co2[3], + float *min_d, int *min_face, float *min_w, + float *face_minmax, float *pa_minmax, + float radius, float *ipoint) { - MFace *mface=0; - MVert *mvert=0; + MFace *mface= NULL; + MVert *mvert= NULL; int i, totface, intersect=0; float cur_d, cur_uv[2], v1[3], v2[3], v3[3], v4[3], min[3], max[3], p_min[3],p_max[3]; float cur_ipoint[3]; - if(dm==0){ + if(dm == NULL){ psys_disable_all(ob); dm=mesh_get_derived_final(scene, ob, 0); - if(dm==0) + if(dm == NULL) dm=mesh_get_derived_deform(scene, ob, 0); psys_enable_all(ob); - if(dm==0) + if(dm == NULL) return 0; } @@ -3101,8 +3105,8 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa DO_MINMAX(co2,p_min,p_max); } else{ - VECCOPY(p_min,pa_minmax); - VECCOPY(p_max,pa_minmax+3); + copy_v3_v3(p_min,pa_minmax); + copy_v3_v3(p_max,pa_minmax+3); } totface=dm->getNumTessFaces(dm); @@ -3112,18 +3116,18 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa /* lets intersect the faces */ for(i=0; i<totface; i++,mface++){ if(vert_cos){ - VECCOPY(v1,vert_cos+3*mface->v1); - VECCOPY(v2,vert_cos+3*mface->v2); - VECCOPY(v3,vert_cos+3*mface->v3); + copy_v3_v3(v1,vert_cos+3*mface->v1); + copy_v3_v3(v2,vert_cos+3*mface->v2); + copy_v3_v3(v3,vert_cos+3*mface->v3); if(mface->v4) - VECCOPY(v4,vert_cos+3*mface->v4) + copy_v3_v3(v4,vert_cos+3*mface->v4); } else{ - VECCOPY(v1,mvert[mface->v1].co); - VECCOPY(v2,mvert[mface->v2].co); - VECCOPY(v3,mvert[mface->v3].co); + copy_v3_v3(v1,mvert[mface->v1].co); + copy_v3_v3(v2,mvert[mface->v2].co); + copy_v3_v3(v3,mvert[mface->v3].co); if(mface->v4) - VECCOPY(v4,mvert[mface->v4].co) + copy_v3_v3(v4,mvert[mface->v4].co); } if(face_minmax==0){ @@ -3137,8 +3141,8 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa continue; } else{ - VECCOPY(min, face_minmax+6*i); - VECCOPY(max, face_minmax+6*i+3); + copy_v3_v3(min, face_minmax+6*i); + copy_v3_v3(max, face_minmax+6*i+3); if(isect_aabb_aabb_v3(min,max,p_min,p_max)==0) continue; } @@ -3147,7 +3151,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa if(isect_sweeping_sphere_tri_v3(co1, co2, radius, v2, v3, v1, &cur_d, cur_ipoint)){ if(cur_d<*min_d){ *min_d=cur_d; - VECCOPY(ipoint,cur_ipoint); + copy_v3_v3(ipoint,cur_ipoint); *min_face=i; intersect=1; } @@ -3156,7 +3160,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa if(isect_sweeping_sphere_tri_v3(co1, co2, radius, v4, v1, v3, &cur_d, cur_ipoint)){ if(cur_d<*min_d){ *min_d=cur_d; - VECCOPY(ipoint,cur_ipoint); + copy_v3_v3(ipoint,cur_ipoint); *min_face=i; intersect=1; } @@ -3364,27 +3368,27 @@ static int brush_add(PEData *data, short number) key3[1].time= key3[0].time; psys_get_particle_on_path(&sim, ptn[1].index, &key3[1], 0); mul_v3_fl(key3[1].co, weight[1]); - VECADD(key3[0].co, key3[0].co, key3[1].co); + add_v3_v3(key3[0].co, key3[1].co); if(maxw>2) { key3[2].time= key3[0].time; psys_get_particle_on_path(&sim, ptn[2].index, &key3[2], 0); mul_v3_fl(key3[2].co, weight[2]); - VECADD(key3[0].co, key3[0].co, key3[2].co); + add_v3_v3(key3[0].co, key3[2].co); } } if(k==0) - VECSUB(co1, pa->state.co, key3[0].co); + sub_v3_v3v3(co1, pa->state.co, key3[0].co); - VECADD(thkey->co, key3[0].co, co1); + add_v3_v3v3(thkey->co, key3[0].co, co1); thkey->time= key3[0].time; } } else { for(k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) { - VECADDFAC(hkey->co, pa->state.co, pa->state.vel, k * framestep * timestep); + madd_v3_v3v3fl(hkey->co, pa->state.co, pa->state.vel, k * framestep * timestep); hkey->time += k * framestep; hkey->weight = 1.f - (float)k/(float)(pset->totaddkey-1); } @@ -4044,7 +4048,7 @@ const char *PE_undo_get_name(Scene *scene, int nr, int *active) /************************ utilities ******************************/ -int PE_minmax(Scene *scene, float *min, float *max) +int PE_minmax(Scene *scene, float min[3], float max[3]) { Object *ob= OBACT; PTCacheEdit *edit= PE_get_current(scene, ob); @@ -4066,7 +4070,7 @@ int PE_minmax(Scene *scene, float *min, float *max) psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles+p, mat); LOOP_SELECTED_KEYS { - VECCOPY(co, key->co); + copy_v3_v3(co, key->co); mul_m4_v3(mat, co); DO_MINMAX(co, min, max); ok= 1; diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 7071e5d3720..dd46910fbc1 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -688,7 +688,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys) psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat); invert_m4_m4(imat,hairmat); - VECSUB(vec, nearest.co, key->co); + sub_v3_v3v3(vec, nearest.co, key->co); if(point) { ekey = point->keys; @@ -696,7 +696,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys) } for(k=0,key=pa->hair; k<pa->totkey; k++,key++) { - VECADD(key->co, key->co, vec); + add_v3_v3(key->co, vec); mul_m4_v3(imat,key->co); if(ekey) { diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index bf4d081508f..85d46d9e627 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -105,12 +105,30 @@ #define IMAPAINT_CHAR_TO_FLOAT(c) ((c)/255.0f) -#define IMAPAINT_FLOAT_RGB_TO_CHAR(c, f) { (c)[0]=FTOCHAR((f)[0]); (c)[1]=FTOCHAR((f)[1]); (c)[2]=FTOCHAR((f)[2]); } -#define IMAPAINT_FLOAT_RGBA_TO_CHAR(c, f) { (c)[0]=FTOCHAR((f)[0]); (c)[1]=FTOCHAR((f)[1]); (c)[2]=FTOCHAR((f)[2]); (c)[3]=FTOCHAR((f)[3]); } +#define IMAPAINT_FLOAT_RGB_TO_CHAR(c, f) { \ + (c)[0]= FTOCHAR((f)[0]); \ + (c)[1]= FTOCHAR((f)[1]); \ + (c)[2]= FTOCHAR((f)[2]); \ +} +#define IMAPAINT_FLOAT_RGBA_TO_CHAR(c, f) { \ + (c)[0]= FTOCHAR((f)[0]); \ + (c)[1]= FTOCHAR((f)[1]); \ + (c)[2]= FTOCHAR((f)[2]); \ + (c)[3]= FTOCHAR((f)[3]); \ +} +#define IMAPAINT_CHAR_RGB_TO_FLOAT(f, c) { \ + (f)[0]= IMAPAINT_CHAR_TO_FLOAT((c)[0]); \ + (f)[1]= IMAPAINT_CHAR_TO_FLOAT((c)[1]); \ + (f)[2]= IMAPAINT_CHAR_TO_FLOAT((c)[2]); \ +} +#define IMAPAINT_CHAR_RGBA_TO_FLOAT(f, c) { \ + (f)[0]= IMAPAINT_CHAR_TO_FLOAT((c)[0]); \ + (f)[1]= IMAPAINT_CHAR_TO_FLOAT((c)[1]); \ + (f)[2]= IMAPAINT_CHAR_TO_FLOAT((c)[2]); \ + (f)[3]= IMAPAINT_CHAR_TO_FLOAT((c)[3]); \ +} -#define IMAPAINT_CHAR_RGB_TO_FLOAT(f, c) { (f)[0]=IMAPAINT_CHAR_TO_FLOAT((c)[0]); (f)[1]=IMAPAINT_CHAR_TO_FLOAT((c)[1]); (f)[2]=IMAPAINT_CHAR_TO_FLOAT((c)[2]); } -#define IMAPAINT_CHAR_RGBA_TO_FLOAT(f, c) { (f)[0]=IMAPAINT_CHAR_TO_FLOAT((c)[0]); (f)[1]=IMAPAINT_CHAR_TO_FLOAT((c)[1]); (f)[2]=IMAPAINT_CHAR_TO_FLOAT((c)[2]); (f)[3]=IMAPAINT_CHAR_TO_FLOAT((c)[3]); } -#define IMAPAINT_FLOAT_RGB_COPY(a, b) VECCOPY(a, b) +#define IMAPAINT_FLOAT_RGB_COPY(a, b) copy_v3_v3(a, b) #define IMAPAINT_TILE_BITS 6 #define IMAPAINT_TILE_SIZE (1 << IMAPAINT_TILE_BITS) @@ -607,7 +625,7 @@ static int project_paint_PickFace(const ProjPaintState *ps, float pt[2], float w best_face_index = face_index; best_side = 0; z_depth_best = z_depth; - VECCOPY(w, w_tmp); + copy_v3_v3(w, w_tmp); } } else if (mf->v4) { @@ -621,7 +639,7 @@ static int project_paint_PickFace(const ProjPaintState *ps, float pt[2], float w best_face_index = face_index; best_side= 1; z_depth_best = z_depth; - VECCOPY(w, w_tmp); + copy_v3_v3(w, w_tmp); } } } @@ -722,7 +740,7 @@ static int project_paint_PickColor(const ProjPaintState *ps, float pt[2], float if (rgba_fp) { if (ibuf->rect_float) { - QUATCOPY(rgba_fp, ((float *)ibuf->rect_float + ((xi + yi * ibuf->x) * 4))); + copy_v4_v4(rgba_fp, ((float *)ibuf->rect_float + ((xi + yi * ibuf->x) * 4))); } else { char *tmp_ch= ((char *)ibuf->rect) + ((xi + yi * ibuf->x) * 4); @@ -1431,7 +1449,7 @@ static ProjPixel *project_paint_uvpixel_init( } /* screenspace unclamped, we could keep its z and w values but dont need them at the moment */ - VECCOPY2D(projPixel->projCoSS, pixelScreenCo); + copy_v2_v2(projPixel->projCoSS, pixelScreenCo); projPixel->x_px = x_px; projPixel->y_px = y_px; @@ -1530,8 +1548,8 @@ static int line_clip_rect2f( if (fabsf(l1[0]-l2[0]) < PROJ_GEOM_TOLERANCE) { /* this is a single point (or close to)*/ if (BLI_in_rctf(rect, l1[0], l1[1])) { - VECCOPY2D(l1_clip, l1); - VECCOPY2D(l2_clip, l2); + copy_v2_v2(l1_clip, l1); + copy_v2_v2(l2_clip, l2); return 1; } else { @@ -1539,8 +1557,8 @@ static int line_clip_rect2f( } } - VECCOPY2D(l1_clip, l1); - VECCOPY2D(l2_clip, l2); + copy_v2_v2(l1_clip, l1); + copy_v2_v2(l2_clip, l2); CLAMP(l1_clip[0], rect->xmin, rect->xmax); CLAMP(l2_clip[0], rect->xmin, rect->xmax); return 1; @@ -1558,8 +1576,8 @@ static int line_clip_rect2f( if (fabsf(l1[1]-l2[1]) < PROJ_GEOM_TOLERANCE) { /* this is a single point (or close to)*/ if (BLI_in_rctf(rect, l1[0], l1[1])) { - VECCOPY2D(l1_clip, l1); - VECCOPY2D(l2_clip, l2); + copy_v2_v2(l1_clip, l1); + copy_v2_v2(l2_clip, l2); return 1; } else { @@ -1567,8 +1585,8 @@ static int line_clip_rect2f( } } - VECCOPY2D(l1_clip, l1); - VECCOPY2D(l2_clip, l2); + copy_v2_v2(l1_clip, l1); + copy_v2_v2(l2_clip, l2); CLAMP(l1_clip[1], rect->ymin, rect->ymax); CLAMP(l2_clip[1], rect->ymin, rect->ymax); return 1; @@ -1582,12 +1600,12 @@ static int line_clip_rect2f( /* are either of the points inside the rectangle ? */ if (BLI_in_rctf(rect, l1[0], l1[1])) { - VECCOPY2D(l1_clip, l1); + copy_v2_v2(l1_clip, l1); ok1 = 1; } if (BLI_in_rctf(rect, l2[0], l2[1])) { - VECCOPY2D(l2_clip, l2); + copy_v2_v2(l2_clip, l2); ok2 = 1; } @@ -1912,14 +1930,14 @@ static void project_bucket_clip_face( if (inside_bucket_flag == ISECT_ALL3) { /* all screenspace points are inside the bucket bounding box, this means we dont need to clip and can simply return the UVs */ if (flip) { /* facing the back? */ - VECCOPY2D(bucket_bounds_uv[0], uv3co); - VECCOPY2D(bucket_bounds_uv[1], uv2co); - VECCOPY2D(bucket_bounds_uv[2], uv1co); + copy_v2_v2(bucket_bounds_uv[0], uv3co); + copy_v2_v2(bucket_bounds_uv[1], uv2co); + copy_v2_v2(bucket_bounds_uv[2], uv1co); } else { - VECCOPY2D(bucket_bounds_uv[0], uv1co); - VECCOPY2D(bucket_bounds_uv[1], uv2co); - VECCOPY2D(bucket_bounds_uv[2], uv3co); + copy_v2_v2(bucket_bounds_uv[0], uv1co); + copy_v2_v2(bucket_bounds_uv[1], uv2co); + copy_v2_v2(bucket_bounds_uv[2], uv3co); } *tot = 3; @@ -1983,33 +2001,33 @@ static void project_bucket_clip_face( (*tot) = 0; - if (inside_face_flag & ISECT_1) { VECCOPY2D(isectVCosSS[*tot], bucket_bounds_ss[0]); (*tot)++; } - if (inside_face_flag & ISECT_2) { VECCOPY2D(isectVCosSS[*tot], bucket_bounds_ss[1]); (*tot)++; } - if (inside_face_flag & ISECT_3) { VECCOPY2D(isectVCosSS[*tot], bucket_bounds_ss[2]); (*tot)++; } - if (inside_face_flag & ISECT_4) { VECCOPY2D(isectVCosSS[*tot], bucket_bounds_ss[3]); (*tot)++; } + if (inside_face_flag & ISECT_1) { copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[0]); (*tot)++; } + if (inside_face_flag & ISECT_2) { copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[1]); (*tot)++; } + if (inside_face_flag & ISECT_3) { copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[2]); (*tot)++; } + if (inside_face_flag & ISECT_4) { copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[3]); (*tot)++; } - if (inside_bucket_flag & ISECT_1) { VECCOPY2D(isectVCosSS[*tot], v1coSS); (*tot)++; } - if (inside_bucket_flag & ISECT_2) { VECCOPY2D(isectVCosSS[*tot], v2coSS); (*tot)++; } - if (inside_bucket_flag & ISECT_3) { VECCOPY2D(isectVCosSS[*tot], v3coSS); (*tot)++; } + if (inside_bucket_flag & ISECT_1) { copy_v2_v2(isectVCosSS[*tot], v1coSS); (*tot)++; } + if (inside_bucket_flag & ISECT_2) { copy_v2_v2(isectVCosSS[*tot], v2coSS); (*tot)++; } + if (inside_bucket_flag & ISECT_3) { copy_v2_v2(isectVCosSS[*tot], v3coSS); (*tot)++; } if ((inside_bucket_flag & (ISECT_1|ISECT_2)) != (ISECT_1|ISECT_2)) { if (line_clip_rect2f(bucket_bounds, v1coSS, v2coSS, v1_clipSS, v2_clipSS)) { - if ((inside_bucket_flag & ISECT_1)==0) { VECCOPY2D(isectVCosSS[*tot], v1_clipSS); (*tot)++; } - if ((inside_bucket_flag & ISECT_2)==0) { VECCOPY2D(isectVCosSS[*tot], v2_clipSS); (*tot)++; } + if ((inside_bucket_flag & ISECT_1)==0) { copy_v2_v2(isectVCosSS[*tot], v1_clipSS); (*tot)++; } + if ((inside_bucket_flag & ISECT_2)==0) { copy_v2_v2(isectVCosSS[*tot], v2_clipSS); (*tot)++; } } } if ((inside_bucket_flag & (ISECT_2|ISECT_3)) != (ISECT_2|ISECT_3)) { if (line_clip_rect2f(bucket_bounds, v2coSS, v3coSS, v1_clipSS, v2_clipSS)) { - if ((inside_bucket_flag & ISECT_2)==0) { VECCOPY2D(isectVCosSS[*tot], v1_clipSS); (*tot)++; } - if ((inside_bucket_flag & ISECT_3)==0) { VECCOPY2D(isectVCosSS[*tot], v2_clipSS); (*tot)++; } + if ((inside_bucket_flag & ISECT_2)==0) { copy_v2_v2(isectVCosSS[*tot], v1_clipSS); (*tot)++; } + if ((inside_bucket_flag & ISECT_3)==0) { copy_v2_v2(isectVCosSS[*tot], v2_clipSS); (*tot)++; } } } if ((inside_bucket_flag & (ISECT_3|ISECT_1)) != (ISECT_3|ISECT_1)) { if (line_clip_rect2f(bucket_bounds, v3coSS, v1coSS, v1_clipSS, v2_clipSS)) { - if ((inside_bucket_flag & ISECT_3)==0) { VECCOPY2D(isectVCosSS[*tot], v1_clipSS); (*tot)++; } - if ((inside_bucket_flag & ISECT_1)==0) { VECCOPY2D(isectVCosSS[*tot], v2_clipSS); (*tot)++; } + if ((inside_bucket_flag & ISECT_3)==0) { copy_v2_v2(isectVCosSS[*tot], v1_clipSS); (*tot)++; } + if ((inside_bucket_flag & ISECT_1)==0) { copy_v2_v2(isectVCosSS[*tot], v2_clipSS); (*tot)++; } } } @@ -2538,8 +2556,8 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i //fac = line_point_factor_v2(uv, uv_seam_quad[0], uv_seam_quad[1]); fac = line_point_factor_v2(uv, seam_subsection[0], seam_subsection[1]); - if (fac < 0.0f) { VECCOPY(pixelScreenCo, edge_verts_inset_clip[0]); } - else if (fac > 1.0f) { VECCOPY(pixelScreenCo, edge_verts_inset_clip[1]); } + if (fac < 0.0f) { copy_v3_v3(pixelScreenCo, edge_verts_inset_clip[0]); } + else if (fac > 1.0f) { copy_v3_v3(pixelScreenCo, edge_verts_inset_clip[1]); } else { interp_v3_v3v3(pixelScreenCo, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac); } if (!is_ortho) { @@ -3038,7 +3056,7 @@ static void project_paint_begin(ProjPaintState *ps) normalize_v3(ps->viewDir); /* viewPos - object relative */ - VECCOPY(ps->viewPos, viewinv[3]); + copy_v3_v3(ps->viewPos, viewinv[3]); copy_m3_m4(mat, ps->ob->imat); mul_m3_v3(mat, ps->viewPos); add_v3_v3(ps->viewPos, ps->ob->imat[3]); @@ -3396,7 +3414,7 @@ static void project_paint_end(ProjPaintState *ps) if (is_float) { float *rgba_fp = (float *)tilerect + (((projPixel->x_px - x_round) + (projPixel->y_px - y_round) * IMAPAINT_TILE_SIZE)) * 4; - QUATCOPY(rgba_fp, projPixel->origColor.f); + copy_v4_v4(rgba_fp, projPixel->origColor.f); } else { ((unsigned int *)tilerect)[ (projPixel->x_px - x_round) + (projPixel->y_px - y_round) * IMAPAINT_TILE_SIZE ] = projPixel->origColor.uint; @@ -3732,7 +3750,7 @@ static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, flo srgb_to_linearrgb_v3_v3(rgba, ps->brush->rgb); } else { - VECCOPY(rgba, ps->brush->rgb); + copy_v3_v3(rgba, ps->brush->rgb); } rgba[3] = 1.0; } diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 5ac72d71109..f79ccbb9a55 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -124,7 +124,7 @@ float paint_get_tex_pixel(Brush* br, float u, float v) static void imapaint_project(Object *ob, float *model, float *proj, float *co, float *pco) { - VECCOPY(pco, co); + copy_v3_v3(pco, co); pco[3]= 1.0f; mul_m4_v3(ob->obmat, pco); @@ -166,7 +166,7 @@ static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, fl invert_m3_m3(invwmat, wmat); mul_m3_v3(invwmat, h); - VECCOPY(w, h); + copy_v3_v3(w, h); /* w is still divided by perspdiv, make it sum to one */ divw= w[0] + w[1] + w[2]; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index c682e42c35b..d6b3d6809d5 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -2315,8 +2315,9 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3]) ofs= key_to_vertcos(ob, kb); /* calculate key coord offsets (from previous location) */ - for (a= 0; a < me->totvert; a++) - VECSUB(ofs[a], vertCos[a], ofs[a]); + for (a= 0; a < me->totvert; a++) { + sub_v3_v3v3(ofs[a], vertCos[a], ofs[a]); + } /* apply offsets on other keys */ currkey = me->key->block.first; @@ -2337,7 +2338,7 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3]) MVert *mvert= me->mvert; for (a= 0; a < me->totvert; a++, mvert++) - VECCOPY(mvert->co, vertCos[a]); + copy_v3_v3(mvert->co, vertCos[a]); mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL); } diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index 70c4ebd445a..177b72567e5 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -33,6 +33,7 @@ #include "BLF_api.h" +#include "BLI_math.h" #include "BLI_utildefines.h" @@ -131,7 +132,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str const char *line_stride= str + initial_offset; /* advance to the last line and draw it first */ int sel_orig[2]; - VECCOPY2D(sel_orig, cdc->sel); + copy_v2_v2_int(sel_orig, cdc->sel); /* invert and swap for wrapping */ cdc->sel[0] = str_len - sel_orig[1]; @@ -178,7 +179,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str return 0; } - VECCOPY2D(cdc->sel, sel_orig); + copy_v2_v2_int(cdc->sel, sel_orig); STEP_SEL(-(str_len + 1)); } else { /* simple, no wrap */ diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index a7bb1fb3ee6..c0046b089af 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -153,17 +153,17 @@ static short set_pchan_glColor (short colCode, int boneflag, short constflag) unsigned char cp[3]; if (boneflag & BONE_DRAW_ACTIVE) { - VECCOPY(cp, bcolor->active); + copy_v3_v3_char((char *)cp, bcolor->active); if(!(boneflag & BONE_SELECTED)) { cp_shade_color3ub(cp, -80); } } else if (boneflag & BONE_SELECTED) { - VECCOPY(cp, bcolor->select); + copy_v3_v3_char((char *)cp, bcolor->select); } else { /* a bit darker than solid */ - VECCOPY(cp, bcolor->solid); + copy_v3_v3_char((char *)cp, bcolor->solid); cp_shade_color3ub(cp, -50); } @@ -213,13 +213,13 @@ static short set_pchan_glColor (short colCode, int boneflag, short constflag) unsigned char cp[3]; if (boneflag & BONE_DRAW_ACTIVE) { - VECCOPY(cp, bcolor->active); + copy_v3_v3_char((char *)cp, bcolor->active); } else if (boneflag & BONE_SELECTED) { - VECCOPY(cp, bcolor->select); + copy_v3_v3_char((char *)cp, bcolor->select); } else { - VECCOPY(cp, bcolor->solid); + copy_v3_v3_char((char *)cp, bcolor->solid); } glColor3ubv(cp); @@ -239,15 +239,15 @@ static short set_pchan_glColor (short colCode, int boneflag, short constflag) unsigned char cp[3]; if (boneflag & BONE_DRAW_ACTIVE) { - VECCOPY(cp, bcolor->active); + copy_v3_v3_char((char *)cp, bcolor->active); cp_shade_color3ub(cp, 10); } else if (boneflag & BONE_SELECTED) { - VECCOPY(cp, bcolor->select); + copy_v3_v3_char((char *)cp, bcolor->select); cp_shade_color3ub(cp, -30); } else { - VECCOPY(cp, bcolor->solid); + copy_v3_v3_char((char *)cp, bcolor->solid); cp_shade_color3ub(cp, -30); } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 920494dcec2..6f40f28ea5c 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -5005,7 +5005,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int skip= nu->resolu/16; while (nr-->0) { /* accounts for empty bevel lists */ - float fac= bevp->radius * ts->normalsize; + const float fac= bevp->radius * ts->normalsize; float vec_a[3]; // Offset perpendicular to the curve float vec_b[3]; // Delta along the curve @@ -5021,9 +5021,9 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, mul_qt_v3(bevp->quat, vec_b); add_v3_v3(vec_a, bevp->vec); add_v3_v3(vec_b, bevp->vec); - - VECSUBFAC(vec_a, vec_a, bevp->dir, fac); - VECSUBFAC(vec_b, vec_b, bevp->dir, fac); + + madd_v3_v3fl(vec_a, bevp->dir, -fac); + madd_v3_v3fl(vec_b, bevp->dir, -fac); glBegin(GL_LINE_STRIP); glVertex3fv(vec_a); diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 97311035939..df3e83fed15 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -243,7 +243,7 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3 tstart(); - VECSUB(size, max, min); + sub_v3_v3v3(size, max, min); // maxx, maxy, maxz cv[0][0] = max[0]; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index e7fbdaf1deb..b677a8fd7cf 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -3462,8 +3462,8 @@ int ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], cons data.margin= margin; data.depth= FLT_MAX; - VECCOPY2D(p1, mval_sta); - VECCOPY2D(p2, mval_end); + copy_v2_v2_int(p1, mval_sta); + copy_v2_v2_int(p2, mval_end); plot_line_v2v2i(p1, p2, depth_segment_cb, &data); diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index e9db9fe1d7e..0cdb7a19995 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -314,7 +314,7 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even fly->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f); - VECCOPY2D(fly->mval, event->mval) + copy_v2_v2_int(fly->mval, event->mval); fly->ndof = NULL; fly->time_lastdraw= fly->time_lastwheel= PIL_check_seconds_timer(); @@ -475,7 +475,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) fly->redraw = 1; } else if (event->type == MOUSEMOVE) { - VECCOPY2D(fly->mval, event->mval); + copy_v2_v2_int(fly->mval, event->mval); } else if (event->type == NDOF_MOTION) { // do these automagically get delivered? yes. diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 345172a1c00..99d7017258f 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -552,7 +552,7 @@ int transformEvent(TransInfo *t, wmEvent *event) if (t->modifiers & MOD_CONSTRAINT_SELECT) t->con.mode |= CON_SELECT; - VECCOPY2D(t->mval, event->mval); + copy_v2_v2_int(t->mval, event->mval); // t->redraw |= TREDRAW_SOFT; /* Use this for soft redraw. Might cause flicker in object mode */ t->redraw |= TREDRAW_HARD; @@ -3887,7 +3887,7 @@ int Bevel(TransInfo *t, const int UNUSED(mval[2])) else { d = distance; } - VECADDFAC(td->loc,td->center,td->axismtx[0],(*td->val)*d); + madd_v3_v3v3fl(td->loc, td->center, td->axismtx[0], (*td->val) * d); } recalcData(t); @@ -4439,9 +4439,9 @@ static int createSlideVerts(TransInfo *t) sv->v = v; sv->origvert = *v; - VECCOPY(sv->upvec, vec); + copy_v3_v3(sv->upvec, vec); if (l2) - VECCOPY(sv->downvec, vec2); + copy_v3_v3(sv->downvec, vec2); l = BM_OtherFaceLoop(l1->e, l1->f, v); sv->up = BM_OtherEdgeVert(l->e, v); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 5b8b1ada1dd..d391289df15 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -3097,8 +3097,8 @@ static TransData *ActionFCurveToTransData(TransData *td, TransData2D **td2dv, FC td2d->h1 = bezt->vec[0]; td2d->h2 = bezt->vec[2]; - VECCOPY2D(td2d->ih1, td2d->h1); - VECCOPY2D(td2d->ih2, td2d->h2); + copy_v2_v2(td2d->ih1, td2d->h1); + copy_v2_v2(td2d->ih2, td2d->h2); td++; td2d++; @@ -3354,14 +3354,14 @@ static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt, if (td->flag & TD_MOVEHANDLE1) { td2d->h1 = bezt->vec[0]; - VECCOPY2D(td2d->ih1, td2d->h1); + copy_v2_v2(td2d->ih1, td2d->h1); } else td2d->h1 = NULL; if (td->flag & TD_MOVEHANDLE2) { td2d->h2 = bezt->vec[2]; - VECCOPY2D(td2d->ih2, td2d->h2); + copy_v2_v2(td2d->ih2, td2d->h2); } else td2d->h2 = NULL; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 5a90d9866d1..09a4e366611 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -943,7 +943,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) if (event) { - VECCOPY2D(t->imval, event->mval); + copy_v2_v2_int(t->imval, event->mval); t->event_type = event->type; } else diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index cc3ffe086f1..3de68a6e312 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -409,7 +409,7 @@ int handleMouseInput(TransInfo *t, MouseInput *mi, wmEvent *event) t->modifiers |= MOD_PRECISION; /* shift is modifier for higher precision transform * store the mouse position where the normal movement ended */ - VECCOPY2D(mi->precision_mval, event->mval); + copy_v2_v2_int(mi->precision_mval, event->mval); mi->precision = 1; } else diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index d532d7d350b..69753032f42 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -606,11 +606,11 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) { if(BM_TestHFlag(efa, BM_SELECT)) { - VECADD(normal, normal, efa->no); + add_v3_v3(normal, efa->no); sub_v3_v3v3(vec, ((BMLoopList*)efa->loops.first)->first->v->co, (((BMLoopList*)efa->loops.first)->first->next)->v->co); - VECADD(plane, plane, vec); + add_v3_v3(plane, vec); } } @@ -666,7 +666,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], if(BM_TestHFlag(eed, BM_SELECT)) { /* use average vert normals as plane and edge vector as normal */ copy_v3_v3(plane, eed->v1->no); - VECADD(plane, plane, eed->v2->no); + add_v3_v3(plane, eed->v2->no); sub_v3_v3v3(normal, eed->v2->co, eed->v1->co); break; } @@ -687,7 +687,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], v2 = eve; copy_v3_v3(plane, v1->no); - VECADD(plane, plane, v2->no); + add_v3_v3(plane, v2->no); sub_v3_v3v3(normal, v2->co, v1->co); break; } diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c index f4e1773db49..8c5d7d6990b 100644 --- a/source/blender/editors/util/crazyspace.c +++ b/source/blender/editors/util/crazyspace.c @@ -81,7 +81,7 @@ static void make_vertexcos__mapFunc(void *userData, int index, float *co, float if(!mappedData->flags[index]) { /* we need coord from prototype vertex, not it clones or images, suppose they stored in the beginning of vertex array stored in DM */ - VECCOPY(vec, co); + copy_v3_v3(vec, co); mappedData->flags[index]= 1; } } diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 048bb17b183..04eb940393f 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -312,10 +312,10 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe #endif /* uv angles */ - VECSUB2D(av1, tf_uv[3], tf_uv[0]); normalize_v2(av1); - VECSUB2D(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2); - VECSUB2D(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3); - VECSUB2D(av4, tf_uv[2], tf_uv[3]); normalize_v2(av4); + sub_v2_v2v2(av1, tf_uv[3], tf_uv[0]); normalize_v2(av1); + sub_v2_v2v2(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2); + sub_v2_v2v2(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3); + sub_v2_v2v2(av4, tf_uv[2], tf_uv[3]); normalize_v2(av4); /* This is the correct angle however we are only comparing angles * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * RAD2DEGF(1.0f))-90);*/ @@ -325,10 +325,10 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe uvang4 = angle_normalized_v2v2(av4, av1); /* 3d angles */ - VECSUB(av1, efa->v4->co, efa->v1->co); normalize_v3(av1); - VECSUB(av2, efa->v1->co, efa->v2->co); normalize_v3(av2); - VECSUB(av3, efa->v2->co, efa->v3->co); normalize_v3(av3); - VECSUB(av4, efa->v3->co, efa->v4->co); normalize_v3(av4); + sub_v3_v3v3(av1, efa->v4->co, efa->v1->co); normalize_v3(av1); + sub_v3_v3v3(av2, efa->v1->co, efa->v2->co); normalize_v3(av2); + sub_v3_v3v3(av3, efa->v2->co, efa->v3->co); normalize_v3(av3); + sub_v3_v3v3(av4, efa->v3->co, efa->v4->co); normalize_v3(av4); /* This is the correct angle however we are only comparing angles * ang1 = 90-((angle_normalized_v3v3(av1, av2) * RAD2DEGF(1.0f))-90);*/ @@ -373,9 +373,9 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe #endif /* uv angles */ - VECSUB2D(av1, tf_uv[2], tf_uv[0]); normalize_v2(av1); - VECSUB2D(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2); - VECSUB2D(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3); + sub_v2_v2v2(av1, tf_uv[2], tf_uv[0]); normalize_v2(av1); + sub_v2_v2v2(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2); + sub_v2_v2v2(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3); /* This is the correct angle however we are only comparing angles * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * 180.0/M_PI)-90); */ @@ -384,9 +384,9 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe uvang3 = angle_normalized_v2v2(av3, av1); /* 3d angles */ - VECSUB(av1, efa->v3->co, efa->v1->co); normalize_v3(av1); - VECSUB(av2, efa->v1->co, efa->v2->co); normalize_v3(av2); - VECSUB(av3, efa->v2->co, efa->v3->co); normalize_v3(av3); + sub_v3_v3v3(av1, efa->v3->co, efa->v1->co); normalize_v3(av1); + sub_v3_v3v3(av2, efa->v1->co, efa->v2->co); normalize_v3(av2); + sub_v3_v3v3(av3, efa->v2->co, efa->v3->co); normalize_v3(av3); /* This is the correct angle however we are only comparing angles * ang1 = 90-((angle_normalized_v3v3(av1, av2) * 180.0/M_PI)-90); */ ang1 = angle_normalized_v3v3(av1, av2); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 72f49ebabe8..a5ab889417a 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -2799,7 +2799,7 @@ static int snap_uvs_to_cursor(Scene *scene, Image *ima, Object *obedit, SpaceIma BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) { if(uvedit_uv_selected(em, scene, l)) { luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); - VECCOPY2D(luv->uv, sima->cursor); + copy_v2_v2(luv->uv, sima->cursor); change= 1; } } |