diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-07 05:38:32 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-07 05:38:32 +0400 |
commit | 96d73bfdcfd74bfccd58bf02ae25b64577fce904 (patch) | |
tree | 76f1423cdb1fe3079bd6b17c071c3c4a496c6550 /source/blender/editors | |
parent | 85540d5aa7abb487e546b5483fffeef2e6075af5 (diff) |
replace VECCOPY with copy_v3_v3, same for 2d copy, also added vec copy functions for int & char.
Diffstat (limited to 'source/blender/editors')
18 files changed, 118 insertions, 98 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/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/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_widgets.c b/source/blender/editors/interface/interface_widgets.c index ed018830a0a..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); } } @@ -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_lattice.c b/source/blender/editors/object/object_lattice.c index 25c1e32f4ae..cac167ad84f 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 129d9df86a5..ad2280baba2 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -357,7 +357,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; @@ -376,7 +376,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/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 3c9edb2fcfe..ce603ce80b6 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_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_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_FLOAT_RGB_COPY(a, b) copy_v3_v3(a, b) #define IMAPAINT_TILE_BITS 6 #define IMAPAINT_TILE_SIZE (1 << IMAPAINT_TILE_BITS) 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 9f98a6c6b48..6ebb7cf4a48 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -4922,7 +4922,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 @@ -4938,9 +4938,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/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 b5f0a4a071e..591bb99ae22 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -548,7 +548,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; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 2c69cc85214..0c3e045d5ce 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -941,7 +941,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/util/crazyspace.c b/source/blender/editors/util/crazyspace.c index 9ca990c4193..9ee4a875e24 100644 --- a/source/blender/editors/util/crazyspace.c +++ b/source/blender/editors/util/crazyspace.c @@ -80,7 +80,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; } } |