Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-09-13 14:05:30 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-09-13 14:05:30 +0400
commit7d02e66256ea2866b121bd958f83d55866381412 (patch)
treedf5c675d1351aab20bd4f10e51effaae7a19b39e /source/blender/editors
parent92089e3c4d89c2689dbd4452fb21cbbd9a0ecc71 (diff)
parentee32d36a599ccda9c3d5543cb631bb07da06958b (diff)
svn merge -r40000:40179 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c6
-rw-r--r--source/blender/editors/animation/keyframing.c18
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c16
-rw-r--r--source/blender/editors/armature/meshlaplacian.c14
-rw-r--r--source/blender/editors/include/ED_object.h4
-rw-r--r--source/blender/editors/include/UI_interface.h19
-rw-r--r--source/blender/editors/include/UI_resources.h3
-rw-r--r--source/blender/editors/interface/interface_draw.c44
-rw-r--r--source/blender/editors/interface/interface_layout.c42
-rw-r--r--source/blender/editors/interface/interface_panel.c4
-rw-r--r--source/blender/editors/interface/interface_templates.c42
-rw-r--r--source/blender/editors/interface/interface_widgets.c380
-rw-r--r--source/blender/editors/interface/resources.c17
-rw-r--r--source/blender/editors/mesh/editmesh.c6
-rw-r--r--source/blender/editors/mesh/editmesh_add.c18
-rw-r--r--source/blender/editors/mesh/editmesh_lib.c22
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c14
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c20
-rw-r--r--source/blender/editors/object/CMakeLists.txt14
-rw-r--r--source/blender/editors/object/SConscript6
-rw-r--r--source/blender/editors/object/object_intern.h5
-rw-r--r--source/blender/editors/object/object_navmesh.cpp628
-rw-r--r--source/blender/editors/object/object_ops.c7
-rw-r--r--source/blender/editors/object/object_select.c34
-rw-r--r--source/blender/editors/render/render_shading.c22
-rw-r--r--source/blender/editors/screen/area.c8
-rw-r--r--source/blender/editors/screen/screen_ops.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c2
-rw-r--r--source/blender/editors/sound/sound_ops.c2
-rw-r--r--source/blender/editors/space_file/file_draw.c4
-rw-r--r--source/blender/editors/space_file/filelist.c4
-rw-r--r--source/blender/editors/space_logic/logic_window.c46
-rw-r--r--source/blender/editors/space_nla/nla_draw.c4
-rw-r--r--source/blender/editors/space_nla/nla_select.c2
-rw-r--r--source/blender/editors/space_node/drawnode.c19
-rw-r--r--source/blender/editors/space_node/node_draw.c12
-rw-r--r--source/blender/editors/space_node/node_edit.c32
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c50
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c8
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h21
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c2
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c10
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c38
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c26
-rw-r--r--source/blender/editors/space_text/text_draw.c2
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c154
-rw-r--r--source/blender/editors/space_view3d/drawobject.c106
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c46
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c337
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c46
-rw-r--r--source/blender/editors/transform/transform.c70
-rw-r--r--source/blender/editors/transform/transform_constraints.c40
-rw-r--r--source/blender/editors/transform/transform_conversions.c146
-rw-r--r--source/blender/editors/transform/transform_generics.c50
-rw-r--r--source/blender/editors/transform/transform_manipulator.c8
-rw-r--r--source/blender/editors/transform/transform_orientations.c16
-rw-r--r--source/blender/editors/transform/transform_snap.c88
-rw-r--r--source/blender/editors/util/SConscript2
60 files changed, 1856 insertions, 960 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index bdc654ff25a..276765bf96e 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -121,7 +121,7 @@ static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, floa
glColor3fv(color);
/* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
- uiSetRoundBox((expanded)? (1):(1|8));
+ uiSetRoundBox(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
uiDrawBox(GL_POLYGON, offset, yminc, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc, 8);
}
@@ -401,7 +401,7 @@ static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float ymi
* - top and bottom
* - special hack: make the top a bit higher, since we are first...
*/
- uiSetRoundBox((1|8));
+ uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT);
uiDrawBox(GL_POLYGON, 0, yminc-2, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc, 8);
}
@@ -756,7 +756,7 @@ static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc
glColor3fv(color);
/* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
- uiSetRoundBox((expanded)? (1):(1|8));
+ uiSetRoundBox(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
uiDrawBox(GL_POLYGON, offset, yminc, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc, 8);
}
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 53c9fc4d82c..1e7c18dc6ac 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -531,7 +531,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
bConstraint *con= NULL;
short searchtype= VISUALKEY_NONE;
short has_parent = FALSE;
- char *identifier= NULL;
+ const char *identifier= NULL;
/* validate data */
// TODO: this check is probably not needed, but it won't hurt
@@ -548,7 +548,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
Object *ob= (Object *)ptr->data;
con= ob->constraints.first;
- identifier= (char *)RNA_property_identifier(prop);
+ identifier= RNA_property_identifier(prop);
has_parent= (ob->parent != NULL);
}
else if (ptr->type == &RNA_PoseBone) {
@@ -556,7 +556,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
bPoseChannel *pchan= (bPoseChannel *)ptr->data;
con= pchan->constraints.first;
- identifier= (char *)RNA_property_identifier(prop);
+ identifier= RNA_property_identifier(prop);
has_parent= (pchan->parent != NULL);
}
@@ -565,12 +565,18 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
return 0;
/* location or rotation identifiers only... */
- if (strstr(identifier, "location"))
+ if(identifier == NULL) {
+ printf("%s failed: NULL identifier\n", __func__);
+ return 0;
+ }
+ else if (strstr(identifier, "location")) {
searchtype= VISUALKEY_LOC;
- else if (strstr(identifier, "rotation"))
+ }
+ else if (strstr(identifier, "rotation")) {
searchtype= VISUALKEY_ROT;
+ }
else {
- printf("visualkey_can_use() failed: identifier - '%s' \n", identifier);
+ printf("%s failed: identifier - '%s' \n", __func__, identifier);
return 0;
}
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 97f85b92b32..bcd9d746a44 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -409,10 +409,10 @@ static ReebNode *sk_pointToNode(SK_Point *pt, float imat[][4], float tmat[][3])
ReebNode *node;
node = MEM_callocN(sizeof(ReebNode), "reeb node");
- VECCOPY(node->p, pt->p);
+ copy_v3_v3(node->p, pt->p);
mul_m4_v3(imat, node->p);
- VECCOPY(node->no, pt->no);
+ copy_v3_v3(node->no, pt->no);
mul_m3_v3(tmat, node->no);
return node;
@@ -432,10 +432,10 @@ static ReebArc *sk_strokeToArc(SK_Stroke *stk, float imat[][4], float tmat[][3])
for (i = 0; i < arc->bcount; i++)
{
- VECCOPY(arc->buckets[i].p, stk->points[i + 1].p);
+ copy_v3_v3(arc->buckets[i].p, stk->points[i + 1].p);
mul_m4_v3(imat, arc->buckets[i].p);
- VECCOPY(arc->buckets[i].no, stk->points[i + 1].no);
+ copy_v3_v3(arc->buckets[i].no, stk->points[i + 1].no);
mul_m3_v3(tmat, arc->buckets[i].no);
}
@@ -1802,8 +1802,8 @@ void sk_applyCutGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED
pt.type = PT_EXACT;
pt.mode = PT_PROJECT; /* take mode from neighbouring points */
- VECCOPY(pt.p, isect->p);
- VECCOPY(pt.no, isect->stroke->points[isect->before].no);
+ copy_v3_v3(pt.p, isect->p);
+ copy_v3_v3(pt.no, isect->stroke->points[isect->before].no);
sk_insertStrokePoint(isect->stroke, &pt, isect->after);
}
@@ -1844,8 +1844,8 @@ void sk_applyTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSE
pt.type = PT_EXACT;
pt.mode = PT_PROJECT; /* take mode from neighbouring points */
- VECCOPY(pt.p, isect->p);
- VECCOPY(pt.no, isect->stroke->points[isect->before].no);
+ copy_v3_v3(pt.p, isect->p);
+ copy_v3_v3(pt.no, isect->stroke->points[isect->before].no);
sub_v3_v3v3(stroke_dir, isect->stroke->points[isect->after].p, isect->stroke->points[isect->before].p);
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 0c2f8ca2ed4..127b2f4e663 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -518,7 +518,7 @@ static float heat_source_distance(LaplacianSystem *sys, int vertex, int source)
dist= normalize_v3(d);
/* if the vertex normal does not point along the bone, increase distance */
- cosine= INPR(d, sys->heat.vnors[vertex]);
+ cosine= dot_v3v3(d, sys->heat.vnors[vertex]);
return dist/(0.5f*(cosine + 1.001f));
}
@@ -1124,7 +1124,7 @@ static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3],
cross_v3_v3v3(pvec, dir, edge2);
/* if determinant is near zero, ray lies in plane of triangle */
- det = INPR(edge1, pvec);
+ det = dot_v3v3(edge1, pvec);
if (det == 0.0f)
return 0;
@@ -1134,7 +1134,7 @@ static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3],
sub_v3_v3v3(tvec, orig, vert0);
/* calculate U parameter and test bounds */
- u = INPR(tvec, pvec) * inv_det;
+ u = dot_v3v3(tvec, pvec) * inv_det;
if (u < -EPSILON || u > 1.0f+EPSILON)
return 0;
@@ -1142,7 +1142,7 @@ static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3],
cross_v3_v3v3(qvec, tvec, edge1);
/* calculate V parameter and test bounds */
- v = INPR(dir, qvec) * inv_det;
+ v = dot_v3v3(dir, qvec) * inv_det;
if (v < -EPSILON || u + v > 1.0f+EPSILON)
return 0;
@@ -1157,10 +1157,10 @@ static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3],
/* check if it is within the length of the line segment */
sub_v3_v3v3(isectdir, isectco, orig);
- if(INPR(dir, isectdir) < -EPSILON)
+ if(dot_v3v3(dir, isectdir) < -EPSILON)
return 0;
- if(INPR(dir, dir) + EPSILON < INPR(isectdir, isectdir))
+ if(dot_v3v3(dir, dir) + EPSILON < dot_v3v3(isectdir, isectdir))
return 0;
return 1;
@@ -1206,7 +1206,7 @@ static int meshdeform_intersect(MeshDeformBind *mdb, MeshDeformIsect *isec)
if(len < isec->labda) {
isec->labda= len;
isec->face = mface;
- isec->isect= (INPR(isec->vec, nor) <= 0.0f);
+ isec->isect= (dot_v3v3(isec->vec, nor) <= 0.0f);
is= 1;
}
}
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index c646ec55506..b451e278d47 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -136,8 +136,8 @@ void ED_setflagsLatt(struct Object *obedit, int flag);
/* object_modifier.c */
enum {
MODIFIER_APPLY_DATA=1,
- MODIFIER_APPLY_SHAPE,
-} eModifier_Apply_Mode;
+ MODIFIER_APPLY_SHAPE
+};
struct ModifierData *ED_object_modifier_add(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, const char *name, int type);
int ED_object_modifier_remove(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, struct ModifierData *md);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 3fe012ea73e..637940f59a6 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -653,6 +653,25 @@ void UI_exit(void);
#define UI_LAYOUT_OP_SHOW_TITLE 1
#define UI_LAYOUT_OP_SHOW_EMPTY 2
+/* flags to set which corners will become rounded:
+ *
+ * 1------2
+ * | |
+ * 8------4 */
+
+enum {
+ UI_CNR_TOP_LEFT= 1,
+ UI_CNR_TOP_RIGHT= 2,
+ UI_CNR_BOTTOM_RIGHT= 4,
+ UI_CNR_BOTTOM_LEFT= 8,
+ /* just for convenience */
+ UI_CNR_NONE= 0,
+ UI_CNR_ALL= (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)
+};
+
+/* not apart of the corner flags but mixed in some functions */
+#define UI_RB_ALPHA (UI_CNR_ALL + 1)
+
uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int size, int em, struct uiStyle *style);
void uiBlockSetCurLayout(uiBlock *block, uiLayout *layout);
void uiBlockLayoutResolve(uiBlock *block, int *x, int *y);
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index d383bc0ab78..ab5b8e8aff3 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -296,6 +296,9 @@ void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4]);
// blends and shades between two color pointers
void UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], float fac, int offset);
+// shade a 3 byte color (same as UI_GetColorPtrBlendShade3ubv with 0.0 factor)
+void UI_GetColorPtrShade3ubv(const unsigned char cp1[3], unsigned char col[3], int offset);
+
// get a 3 byte color, blended and shaded between two other char color pointers
void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 2267f04aab4..33aeb2df926 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -58,10 +58,9 @@
/* own include */
#include "interface_intern.h"
-#define UI_RB_ALPHA 16
#define UI_DISABLED_ALPHA_OFFS -160
-static int roundboxtype= 15;
+static int roundboxtype= UI_CNR_ALL;
void uiSetRoundBox(int type)
{
@@ -69,13 +68,6 @@ void uiSetRoundBox(int type)
* if this is undone, its not that big a deal, only makes curves edges
* square for the */
roundboxtype= type;
-
- /* flags to set which corners will become rounded:
-
- 1------2
- | |
- 8------4
- */
}
@@ -98,7 +90,7 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r
glBegin(mode);
/* start with corner right-bottom */
- if(roundboxtype & 4) {
+ if(roundboxtype & UI_CNR_BOTTOM_RIGHT) {
glVertex2f(maxx-rad, miny);
for(a=0; a<7; a++) {
glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]);
@@ -108,7 +100,7 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r
else glVertex2f(maxx, miny);
/* corner right-top */
- if(roundboxtype & 2) {
+ if(roundboxtype & UI_CNR_TOP_RIGHT) {
glVertex2f(maxx, maxy-rad);
for(a=0; a<7; a++) {
glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]);
@@ -118,7 +110,7 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r
else glVertex2f(maxx, maxy);
/* corner left-top */
- if(roundboxtype & 1) {
+ if(roundboxtype & UI_CNR_TOP_LEFT) {
glVertex2f(minx+rad, maxy);
for(a=0; a<7; a++) {
glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]);
@@ -128,7 +120,7 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r
else glVertex2f(minx, maxy);
/* corner left-bottom */
- if(roundboxtype & 8) {
+ if(roundboxtype & UI_CNR_BOTTOM_LEFT) {
glVertex2f(minx, miny+rad);
for(a=0; a<7; a++) {
glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]);
@@ -180,7 +172,7 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
glBegin(mode);
/* start with corner right-bottom */
- if(roundboxtype & 4) {
+ if(roundboxtype & UI_CNR_BOTTOM_RIGHT) {
round_box_shade_col(coltop, coldown, 0.0);
glVertex2f(maxx-rad, miny);
@@ -199,7 +191,7 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
}
/* corner right-top */
- if(roundboxtype & 2) {
+ if(roundboxtype & UI_CNR_TOP_RIGHT) {
round_box_shade_col(coltop, coldown, (div-rad)*idiv);
glVertex2f(maxx, maxy-rad);
@@ -217,7 +209,7 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
}
/* corner left-top */
- if(roundboxtype & 1) {
+ if(roundboxtype & UI_CNR_TOP_LEFT) {
round_box_shade_col(coltop, coldown, 1.0);
glVertex2f(minx+rad, maxy);
@@ -236,7 +228,7 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
}
/* corner left-bottom */
- if(roundboxtype & 8) {
+ if(roundboxtype & UI_CNR_BOTTOM_LEFT) {
round_box_shade_col(coltop, coldown, rad*idiv);
glVertex2f(minx, miny+rad);
@@ -288,7 +280,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
glBegin(mode);
/* start with corner right-bottom */
- if(roundboxtype & 4) {
+ if(roundboxtype & UI_CNR_BOTTOM_RIGHT) {
round_box_shade_col(colLeft, colRight, 0.0);
glVertex2f(maxx-rad, miny);
@@ -306,7 +298,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
}
/* corner right-top */
- if(roundboxtype & 2) {
+ if(roundboxtype & UI_CNR_TOP_RIGHT) {
round_box_shade_col(colLeft, colRight, 0.0);
glVertex2f(maxx, maxy-rad);
@@ -324,7 +316,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
}
/* corner left-top */
- if(roundboxtype & 1) {
+ if(roundboxtype & UI_CNR_TOP_LEFT) {
round_box_shade_col(colLeft, colRight, (div-rad)*idiv);
glVertex2f(minx+rad, maxy);
@@ -342,7 +334,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
}
/* corner left-bottom */
- if(roundboxtype & 8) {
+ if(roundboxtype & UI_CNR_BOTTOM_LEFT) {
round_box_shade_col(colLeft, colRight, 1.0);
glVertex2f(minx, miny+rad);
@@ -709,7 +701,7 @@ static void draw_scope_end(rctf *rect, GLint *scissor)
/* outline */
glColor4f(0.f, 0.f, 0.f, 0.5f);
- uiSetRoundBox(15);
+ uiSetRoundBox(UI_CNR_ALL);
uiDrawBox(GL_LINE_LOOP, rect->xmin-1, rect->ymin, rect->xmax+1, rect->ymax+1, 3.0f);
}
@@ -768,7 +760,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol)
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glColor4f(0.f, 0.f, 0.f, 0.3f);
- uiSetRoundBox(15);
+ uiSetRoundBox(UI_CNR_ALL);
uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f);
/* need scissor test, histogram can draw outside of boundary */
@@ -837,7 +829,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glColor4f(0.f, 0.f, 0.f, 0.3f);
- uiSetRoundBox(15);
+ uiSetRoundBox(UI_CNR_ALL);
uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f);
@@ -1048,7 +1040,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glColor4f(0.f, 0.f, 0.f, 0.3f);
- uiSetRoundBox(15);
+ uiSetRoundBox(UI_CNR_ALL);
uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f);
/* need scissor test, hvectorscope can draw outside of boundary */
@@ -1233,7 +1225,7 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
/* backdrop */
glColor3ubv((unsigned char*)wcol->inner);
- uiSetRoundBox(15);
+ uiSetRoundBox(UI_CNR_ALL);
uiDrawBox(GL_POLYGON, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f);
/* sphere color */
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 803da55cea6..59bbe67a8e2 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -334,7 +334,7 @@ static void ui_layer_but_cb(bContext *C, void *arg_but, void *arg_index)
}
/* create buttons for an item with an RNA array */
-static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int len, int x, int y, int w, int h, int expand, int slider, int toggle, int icon_only)
+static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int len, int x, int y, int w, int UNUSED(h), int expand, int slider, int toggle, int icon_only)
{
uiStyle *style= layout->root->style;
uiBut *but;
@@ -407,7 +407,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
if (totdim != 2) return; /* only 2D matrices supported in UI so far */
w /= dim_size[0];
- h /= dim_size[1];
+ /* h /= dim_size[1]; */ /* UNUSED */
for(a=0; a<len; a++) {
col= a % dim_size[0];
@@ -630,7 +630,7 @@ PointerRNA uiItemFullO(uiLayout *layout, const char *opname, const char *name, i
if(!ot) {
ui_item_disabled(layout, opname);
- RNA_warning("uiItemFullO: unknown operator '%s'\n", opname);
+ RNA_warning("unknown operator '%s'", opname);
return PointerRNA_NULL;
}
@@ -737,7 +737,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
if(!ot || !ot->srna) {
ui_item_disabled(layout, opname);
- RNA_warning("uiItemsFullEnumO: %s '%s'\n", ot ? "unknown operator" : "operator missing srna", opname);
+ RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
return;
}
@@ -815,7 +815,7 @@ void uiItemEnumO_value(uiLayout *layout, const char *name, int icon, const char
/* pass */
}
else {
- RNA_warning("uiItemEnumO_value: %s.%s not found.\n", RNA_struct_identifier(ptr.type), propname);
+ RNA_warning("%s.%s not found.", RNA_struct_identifier(ptr.type), propname);
return;
}
@@ -844,7 +844,7 @@ void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char
RNA_property_enum_items(layout->root->block->evil_C, &ptr, prop, &item, NULL, &free);
if(item==NULL || RNA_enum_value_from_id(item, value_str, &value)==0) {
if(free) MEM_freeN(item);
- RNA_warning("uiItemEnumO_string: %s.%s, enum %s not found.\n", RNA_struct_identifier(ptr.type), propname, value_str);
+ RNA_warning("%s.%s, enum %s not found.", RNA_struct_identifier(ptr.type), propname, value_str);
return;
}
@@ -852,7 +852,7 @@ void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char
MEM_freeN(item);
}
else {
- RNA_warning("uiItemEnumO_string: %s.%s not found.\n", RNA_struct_identifier(ptr.type), propname);
+ RNA_warning("%s.%s not found.", RNA_struct_identifier(ptr.type), propname);
return;
}
@@ -1059,7 +1059,7 @@ void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, int flag,
if(!prop) {
ui_item_disabled(layout, propname);
- RNA_warning("uiItemR: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
@@ -1072,7 +1072,7 @@ void uiItemEnumR(uiLayout *layout, const char *name, int icon, struct PointerRNA
if(!prop || RNA_property_type(prop) != PROP_ENUM) {
ui_item_disabled(layout, propname);
- RNA_warning("uiItemEnumR: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
@@ -1087,7 +1087,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr
if(!prop || RNA_property_type(prop) != PROP_ENUM) {
ui_item_disabled(layout, propname);
- RNA_warning("uiItemEnumR_string: enum property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+ RNA_warning("enum property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
@@ -1096,7 +1096,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr
if(!RNA_enum_value_from_id(item, value, &ivalue)) {
if(free) MEM_freeN(item);
ui_item_disabled(layout, propname);
- RNA_warning("uiItemEnumR: enum property value not found: %s\n", value);
+ RNA_warning("enum property value not found: %s", value);
return;
}
@@ -1121,12 +1121,12 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
if(!prop) {
ui_item_disabled(layout, propname);
- RNA_warning("uiItemsEnumR: enum property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+ RNA_warning("enum property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
if(RNA_property_type(prop) != PROP_ENUM) {
- RNA_warning("uiItemsEnumR: not an enum property: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+ RNA_warning("not an enum property: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
else {
@@ -1314,13 +1314,13 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
prop= RNA_struct_find_property(ptr, propname);
if(!prop) {
- RNA_warning("uiItemPointerR: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
type= RNA_property_type(prop);
if(!ELEM(type, PROP_POINTER, PROP_STRING)) {
- RNA_warning("uiItemPointerR: property %s must be a pointer or string.\n", propname);
+ RNA_warning("property %s must be a pointer or string.", propname);
return;
}
@@ -1328,11 +1328,11 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
if(!searchprop) {
- RNA_warning("uiItemPointerR: search collection property not found: %s.%s\n", RNA_struct_identifier(ptr->type), searchpropname);
+ RNA_warning("search collection property not found: %s.%s", RNA_struct_identifier(ptr->type), searchpropname);
return;
}
else if (RNA_property_type(searchprop) != PROP_COLLECTION) {
- RNA_warning("uiItemPointerR: search collection property is not a collection type: %s.%s\n", RNA_struct_identifier(ptr->type), searchpropname);
+ RNA_warning("search collection property is not a collection type: %s.%s", RNA_struct_identifier(ptr->type), searchpropname);
return;
}
@@ -1417,7 +1417,7 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const
mt= WM_menutype_find(menuname, FALSE);
if(mt==NULL) {
- RNA_warning("uiItemM: not found %s\n", menuname);
+ RNA_warning("not found %s", menuname);
return;
}
@@ -1537,12 +1537,12 @@ void uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname,
if(!ot) {
ui_item_disabled(layout, opname);
- RNA_warning("uiItemMenuEnumO: unknown operator '%s'\n", opname);
+ RNA_warning("unknown operator '%s'", opname);
return;
}
if(!ot->srna) {
ui_item_disabled(layout, opname);
- RNA_warning("uiItemMenuEnumO: operator missing srna '%s'\n", opname);
+ RNA_warning("operator missing srna '%s'", opname);
return;
}
@@ -1575,7 +1575,7 @@ void uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propn
prop= RNA_struct_find_property(ptr, propname);
if(!prop) {
ui_item_disabled(layout, propname);
- RNA_warning("uiItemMenuEnumR: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 3b20533dcd4..cd1d250d6a4 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -537,8 +537,8 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
/* in some occasions, draw a border */
if(panel->flag & PNL_SELECT) {
- if(panel->control & UI_PNL_SOLID) uiSetRoundBox(15);
- else uiSetRoundBox(3);
+ if(panel->control & UI_PNL_SOLID) uiSetRoundBox(UI_CNR_ALL);
+ else uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
UI_ThemeColorShade(TH_BACK, -120);
uiRoundRect(0.5f + rect->xmin, 0.5f + rect->ymin, 0.5f + rect->xmax, 0.5f + headrect.ymax+1, 8);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index d2cee11c755..8c151712f95 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -245,7 +245,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
switch(event) {
case UI_ID_BROWSE:
case UI_ID_PIN:
- RNA_warning("warning, id event %d shouldnt come here\n", event);
+ RNA_warning("warning, id event %d shouldnt come here", event);
break;
case UI_ID_OPEN:
case UI_ID_ADD_NEW:
@@ -488,7 +488,7 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const
prop= RNA_struct_find_property(ptr, propname);
if(!prop || RNA_property_type(prop) != PROP_POINTER) {
- RNA_warning("uiTemplateID: pointer property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+ RNA_warning("pointer property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
@@ -549,11 +549,11 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co
propType= RNA_struct_find_property(ptr, proptypename);
if (!propID || RNA_property_type(propID) != PROP_POINTER) {
- RNA_warning("uiTemplateAnyID: pointer property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+ RNA_warning("pointer property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
if (!propType || RNA_property_type(propType) != PROP_ENUM) {
- RNA_warning("uiTemplateAnyID: pointer-type property not found: %s.%s\n", RNA_struct_identifier(ptr->type), proptypename);
+ RNA_warning("pointer-type property not found: %s.%s", RNA_struct_identifier(ptr->type), proptypename);
return;
}
@@ -592,7 +592,7 @@ void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propna
/* check that properties are valid */
propPath= RNA_struct_find_property(ptr, propname);
if (!propPath || RNA_property_type(propPath) != PROP_STRING) {
- RNA_warning("uiTemplatePathBuilder: path property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+ RNA_warning("path property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
@@ -855,7 +855,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
/* verify we have valid data */
if(!RNA_struct_is_a(ptr->type, &RNA_Modifier)) {
- RNA_warning("uiTemplateModifier: Expected modifier on object.\n");
+ RNA_warning("Expected modifier on object.");
return NULL;
}
@@ -863,7 +863,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
md= ptr->data;
if(!ob || !(GS(ob->id.name) == ID_OB)) {
- RNA_warning("uiTemplateModifier: Expected modifier on object.\n");
+ RNA_warning("expected modifier on object.");
return NULL;
}
@@ -1084,7 +1084,7 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
/* verify we have valid data */
if(!RNA_struct_is_a(ptr->type, &RNA_Constraint)) {
- RNA_warning("uiTemplateConstraint: Expected constraint on object.\n");
+ RNA_warning("Expected constraint on object.");
return NULL;
}
@@ -1092,7 +1092,7 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
con= ptr->data;
if(!ob || !(GS(ob->id.name) == ID_OB)) {
- RNA_warning("uiTemplateConstraint: Expected constraint on object.\n");
+ RNA_warning("Expected constraint on object.");
return NULL;
}
@@ -1138,7 +1138,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
PointerRNA texture_ptr;
if(id && !ELEM4(GS(id->name), ID_MA, ID_TE, ID_WO, ID_LA)) {
- RNA_warning("uiTemplatePreview: Expected ID of type material, texture, lamp or world.\n");
+ RNA_warning("expected ID of type material, texture, lamp or world.");
return;
}
@@ -1844,12 +1844,14 @@ void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propn
PointerRNA cptr;
if(!prop) {
- RNA_warning("uiTemplateCurveMapping: curve property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+ RNA_warning("curve property not found: %s.%s",
+ RNA_struct_identifier(ptr->type), propname);
return;
}
if(RNA_property_type(prop) != PROP_POINTER) {
- RNA_warning("uiTemplateCurveMapping: curve is not a pointer: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+ RNA_warning("curve is not a pointer: %s.%s",
+ RNA_struct_identifier(ptr->type), propname);
return;
}
@@ -1879,7 +1881,7 @@ void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, const char *propnam
float softmin, softmax, step, precision;
if (!prop) {
- RNA_warning("uiTemplateColorWheel: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
@@ -1949,7 +1951,7 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname,
prop= RNA_struct_find_property(ptr, propname);
if (!prop) {
- RNA_warning("uiTemplateLayer: layers property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+ RNA_warning("layers property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
@@ -1966,7 +1968,7 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname,
if(used_ptr && used_propname) {
used_prop= RNA_struct_find_property(used_ptr, used_propname);
if (!used_prop) {
- RNA_warning("uiTemplateLayer: used layers property not found: %s.%s\n", RNA_struct_identifier(ptr->type), used_propname);
+ RNA_warning("used layers property not found: %s.%s", RNA_struct_identifier(ptr->type), used_propname);
return;
}
@@ -2157,7 +2159,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
pa= block->panel;
if(!pa) {
- RNA_warning("uiTemplateList: only works inside a panel.\n");
+ RNA_warning("only works inside a panel.");
return;
}
@@ -2167,28 +2169,28 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
if(ptr->data) {
prop= RNA_struct_find_property(ptr, propname);
if(!prop) {
- RNA_warning("uiTemplateList: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
}
activeprop= RNA_struct_find_property(activeptr, activepropname);
if(!activeprop) {
- RNA_warning("uiTemplateList: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), activepropname);
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), activepropname);
return;
}
if(prop) {
type= RNA_property_type(prop);
if(type != PROP_COLLECTION) {
- RNA_warning("uiTemplateList: Expected collection property.\n");
+ RNA_warning("uiExpected collection property.");
return;
}
}
activetype= RNA_property_type(activeprop);
if(activetype != PROP_INT) {
- RNA_warning("uiTemplateList: Expected integer property.\n");
+ RNA_warning("expected integer property.");
return;
}
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 5da875356ea..c36742f7c4d 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -79,19 +79,23 @@
/* it has outline, back, and two optional tria meshes */
typedef struct uiWidgetTrias {
- int tot;
+ unsigned int tot;
float vec[32][2];
- int (*index)[3];
+ unsigned int (*index)[3];
} uiWidgetTrias;
+/* max as used by round_box__edges */
+#define WIDGET_CURVE_RESOLU 9
+#define WIDGET_SIZE_MAX (WIDGET_CURVE_RESOLU*4)
+
typedef struct uiWidgetBase {
int totvert, halfwayvert;
- float outer_v[64][2];
- float inner_v[64][2];
- float inner_uv[64][2];
+ float outer_v[WIDGET_SIZE_MAX][2];
+ float inner_v[WIDGET_SIZE_MAX][2];
+ float inner_uv[WIDGET_SIZE_MAX][2];
short inner, outline, emboss; /* set on/off */
short shadedir;
@@ -123,7 +127,7 @@ typedef struct uiWidgetType {
/* *********************** draw data ************************** */
-static float cornervec[9][2]= {{0.0, 0.0}, {0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169},
+static float cornervec[WIDGET_CURVE_RESOLU][2]= {{0.0, 0.0}, {0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169},
{0.707, 0.293}, {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}, {1.0, 1.0}};
static float jit[8][2]= {{0.468813 , -0.481430}, {-0.155755 , -0.352820},
@@ -133,7 +137,7 @@ static float jit[8][2]= {{0.468813 , -0.481430}, {-0.155755 , -0.352820},
static float num_tria_vert[3][2]= {
{-0.352077, 0.532607}, {-0.352077, -0.549313}, {0.330000, -0.008353}};
-static int num_tria_face[1][3]= {
+static unsigned int num_tria_face[1][3]= {
{0, 1, 2}};
static float scroll_circle_vert[16][2]= {
@@ -142,7 +146,7 @@ static float scroll_circle_vert[16][2]= {
{-0.382683, -0.923880}, {0.000000, -1.000000}, {0.382684, -0.923880}, {0.707107, -0.707107},
{0.923880, -0.382684}, {1.000000, -0.000000}, {0.923880, 0.382683}, {0.707107, 0.707107}};
-static int scroll_circle_face[14][3]= {
+static unsigned int scroll_circle_face[14][3]= {
{0, 1, 2}, {2, 0, 3}, {3, 0, 15}, {3, 15, 4}, {4, 15, 14}, {4, 14, 5}, {5, 14, 13}, {5, 13, 6},
{6, 13, 12}, {6, 12, 7}, {7, 12, 11}, {7, 11, 8}, {8, 11, 10}, {8, 10, 9}};
@@ -150,13 +154,13 @@ static float menu_tria_vert[6][2]= {
{-0.41, 0.16}, {0.41, 0.16}, {0, 0.82},
{0, -0.82}, {-0.41, -0.16}, {0.41, -0.16}};
-static int menu_tria_face[2][3]= {{2, 0, 1}, {3, 5, 4}};
+static unsigned int menu_tria_face[2][3]= {{2, 0, 1}, {3, 5, 4}};
static float check_tria_vert[6][2]= {
{-0.578579, 0.253369}, {-0.392773, 0.412794}, {-0.004241, -0.328551},
{-0.003001, 0.034320}, {1.055313, 0.864744}, {0.866408, 1.026895}};
-static int check_tria_face[4][3]= {
+static unsigned int check_tria_face[4][3]= {
{3, 2, 4}, {3, 4, 5}, {1, 0, 3}, {0, 2, 3}};
GLubyte checker_stipple_sml[32*32/8] =
@@ -175,6 +179,7 @@ GLubyte checker_stipple_sml[32*32/8] =
void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3)
{
+ float tri_arr[3][2]= {{x1, y1}, {x2, y2}, {x3, y3}};
float color[4];
int j;
@@ -182,20 +187,18 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y
glGetFloatv(GL_CURRENT_COLOR, color);
color[3] *= 0.125f;
glColor4fv(color);
-
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(2, GL_FLOAT, 0, tri_arr);
+
/* for each AA step */
for(j=0; j<8; j++) {
glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
-
- glBegin(GL_POLYGON);
- glVertex2f(x1, y1);
- glVertex2f(x2, y2);
- glVertex2f(x3, y3);
- glEnd();
-
+ glDrawArrays(GL_TRIANGLES, 0, 3);
glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f);
}
+ glDisableClientState(GL_VERTEX_ARRAY);
glDisable(GL_BLEND);
}
@@ -216,7 +219,7 @@ static void widget_init(uiWidgetBase *wtb)
/* return tot */
static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int roundboxalign, float step)
{
- float vec[9][2];
+ float vec[WIDGET_CURVE_RESOLU][2];
float minx, miny, maxx, maxy;
int a, tot= 0;
@@ -231,59 +234,59 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r
maxy= rect->ymax+step;
/* mult */
- for(a=0; a<9; a++) {
+ for(a=0; a < WIDGET_CURVE_RESOLU; a++) {
vec[a][0]= rad*cornervec[a][0];
vec[a][1]= rad*cornervec[a][1];
}
/* start with left-top, anti clockwise */
- if(roundboxalign & 1) {
- for(a=0; a<9; a++, tot++) {
+ if(roundboxalign & UI_CNR_TOP_LEFT) {
+ for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= minx+rad-vec[a][0];
vert[tot][1]= maxy-vec[a][1];
}
}
else {
- for(a=0; a<9; a++, tot++) {
+ for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= minx;
vert[tot][1]= maxy;
}
}
- if(roundboxalign & 8) {
- for(a=0; a<9; a++, tot++) {
+ if(roundboxalign & UI_CNR_BOTTOM_LEFT) {
+ for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= minx+vec[a][1];
vert[tot][1]= miny+rad-vec[a][0];
}
}
else {
- for(a=0; a<9; a++, tot++) {
+ for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= minx;
vert[tot][1]= miny;
}
}
- if(roundboxalign & 4) {
- for(a=0; a<9; a++, tot++) {
+ if(roundboxalign & UI_CNR_BOTTOM_RIGHT) {
+ for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= maxx-rad+vec[a][0];
vert[tot][1]= miny+vec[a][1];
}
}
else {
- for(a=0; a<9; a++, tot++) {
+ for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= maxx;
vert[tot][1]= miny;
}
}
- if(roundboxalign & 2) {
- for(a=0; a<9; a++, tot++) {
+ if(roundboxalign & UI_CNR_TOP_RIGHT) {
+ for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= maxx-vec[a][1];
vert[tot][1]= maxy-rad+vec[a][0];
}
}
else {
- for(a=0; a<9; a++, tot++) {
+ for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= maxx;
vert[tot][1]= maxy;
}
@@ -294,7 +297,7 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r
/* this call has 1 extra arg to allow mask outline */
static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, float rad, float radi)
{
- float vec[9][2], veci[9][2];
+ float vec[WIDGET_CURVE_RESOLU][2], veci[WIDGET_CURVE_RESOLU][2];
float minx= rect->xmin, miny= rect->ymin, maxx= rect->xmax, maxy= rect->ymax;
float minxi= minx + 1.0f; /* boundbox inner */
float maxxi= maxx - 1.0f;
@@ -303,8 +306,10 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
float facxi= (maxxi!=minxi) ? 1.0f/(maxxi-minxi) : 0.0f; /* for uv, can divide by zero */
float facyi= (maxyi!=minyi) ? 1.0f/(maxyi-minyi) : 0.0f;
int a, tot= 0, minsize;
- const int hnum= ((roundboxalign & (1|2))==(1|2) || (roundboxalign & (4|8))==(4|8)) ? 1 : 2;
- const int vnum= ((roundboxalign & (1|8))==(1|8) || (roundboxalign & (2|4))==(2|4)) ? 1 : 2;
+ const int hnum= ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT))==(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT) ||
+ (roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT))==(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) ? 1 : 2;
+ const int vnum= ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT))==(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT) ||
+ (roundboxalign & (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT))==(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) ? 1 : 2;
minsize= MIN2((rect->xmax-rect->xmin)*hnum, (rect->ymax-rect->ymin)*vnum);
@@ -315,7 +320,7 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
radi= 0.5f*minsize - 1.0f;
/* mult */
- for(a=0; a<9; a++) {
+ for(a=0; a < WIDGET_CURVE_RESOLU; a++) {
veci[a][0]= radi*cornervec[a][0];
veci[a][1]= radi*cornervec[a][1];
vec[a][0]= rad*cornervec[a][0];
@@ -323,9 +328,9 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
}
/* corner left-bottom */
- if(roundboxalign & 8) {
+ if(roundboxalign & UI_CNR_BOTTOM_LEFT) {
- for(a=0; a<9; a++, tot++) {
+ for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
wt->inner_v[tot][0]= minxi+veci[a][1];
wt->inner_v[tot][1]= minyi+radi-veci[a][0];
@@ -350,9 +355,9 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
}
/* corner right-bottom */
- if(roundboxalign & 4) {
+ if(roundboxalign & UI_CNR_BOTTOM_RIGHT) {
- for(a=0; a<9; a++, tot++) {
+ for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
wt->inner_v[tot][0]= maxxi-radi+veci[a][0];
wt->inner_v[tot][1]= minyi+veci[a][1];
@@ -379,9 +384,9 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
wt->halfwayvert= tot;
/* corner right-top */
- if(roundboxalign & 2) {
+ if(roundboxalign & UI_CNR_TOP_RIGHT) {
- for(a=0; a<9; a++, tot++) {
+ for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
wt->inner_v[tot][0]= maxxi-veci[a][1];
wt->inner_v[tot][1]= maxyi-radi+veci[a][0];
@@ -406,9 +411,9 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
}
/* corner left-top */
- if(roundboxalign & 1) {
+ if(roundboxalign & UI_CNR_TOP_LEFT) {
- for(a=0; a<9; a++, tot++) {
+ for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
wt->inner_v[tot][0]= minxi+radi-veci[a][0];
wt->inner_v[tot][1]= maxyi-veci[a][1];
@@ -433,7 +438,9 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
tot++;
}
-
+
+ BLI_assert(tot <= WIDGET_SIZE_MAX);
+
wt->totvert= tot;
}
@@ -516,16 +523,10 @@ static void widget_scroll_circle(uiWidgetTrias *tria, rcti *rect, float triasize
static void widget_trias_draw(uiWidgetTrias *tria)
{
- int a;
-
- glBegin(GL_TRIANGLES);
- for(a=0; a<tria->tot; a++) {
- glVertex2fv(tria->vec[ tria->index[a][0] ]);
- glVertex2fv(tria->vec[ tria->index[a][1] ]);
- glVertex2fv(tria->vec[ tria->index[a][2] ]);
- }
- glEnd();
-
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(2, GL_FLOAT, 0, tria->vec);
+ glDrawElements(GL_TRIANGLES, tria->tot*3, GL_UNSIGNED_INT, tria->index);
+ glDisableClientState(GL_VERTEX_ARRAY);
}
static void widget_menu_trias(uiWidgetTrias *tria, rcti *rect)
@@ -601,19 +602,48 @@ static void round_box_shade_col4(const char col1[4], const char col2[4], const f
glColor4ubv(col);
}
-static void widgetbase_outline(uiWidgetBase *wtb)
+static void round_box_shade_col4_r(unsigned char col_r[4], const char col1[4], const char col2[4], const float fac)
+{
+ const int faci= FTOCHAR(fac);
+ const int facm= 255-faci;
+
+ col_r[0]= (faci*col1[0] + facm*col2[0])>>8;
+ col_r[1]= (faci*col1[1] + facm*col2[1])>>8;
+ col_r[2]= (faci*col1[2] + facm*col2[2])>>8;
+ col_r[3]= (faci*col1[3] + facm*col2[3])>>8;
+}
+
+static void widget_verts_to_quad_strip(uiWidgetBase *wtb, const int totvert, float quad_strip[WIDGET_SIZE_MAX*2+2][2])
{
int a;
-
- /* outline */
- glBegin(GL_QUAD_STRIP);
- for(a=0; a<wtb->totvert; a++) {
- glVertex2fv(wtb->outer_v[a]);
- glVertex2fv(wtb->inner_v[a]);
+ for(a=0; a<totvert; a++) {
+ copy_v2_v2(quad_strip[a*2], wtb->outer_v[a]);
+ copy_v2_v2(quad_strip[a*2+1], wtb->inner_v[a]);
}
- glVertex2fv(wtb->outer_v[0]);
- glVertex2fv(wtb->inner_v[0]);
- glEnd();
+ copy_v2_v2(quad_strip[a*2], wtb->outer_v[0]);
+ copy_v2_v2(quad_strip[a*2+1], wtb->inner_v[0]);
+}
+
+static void widget_verts_to_quad_strip_open(uiWidgetBase *wtb, const int totvert, float quad_strip[WIDGET_SIZE_MAX*2][2])
+{
+ int a;
+ for(a=0; a<totvert; a++) {
+ quad_strip[a*2][0]= wtb->outer_v[a][0];
+ quad_strip[a*2][1]= wtb->outer_v[a][1];
+ quad_strip[a*2+1][0]= wtb->outer_v[a][0];
+ quad_strip[a*2+1][1]= wtb->outer_v[a][1] - 1.0f;
+ }
+}
+
+static void widgetbase_outline(uiWidgetBase *wtb)
+{
+ float quad_strip[WIDGET_SIZE_MAX*2+2][2]; /* + 2 because the last pair is wrapped */
+ widget_verts_to_quad_strip(wtb, wtb->totvert, quad_strip);
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(2, GL_FLOAT, 0, quad_strip);
+ glDrawArrays(GL_QUAD_STRIP, 0, wtb->totvert*2 + 2);
+ glDisableClientState(GL_VERTEX_ARRAY);
}
static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
@@ -626,100 +656,124 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
if(wtb->inner) {
if(wcol->shaded==0) {
if (wcol->alpha_check) {
+ float inner_v_half[WIDGET_SIZE_MAX][2];
float x_mid= 0.0f; /* used for dumb clamping of values */
/* dark checkers */
glColor4ub(UI_TRANSP_DARK, UI_TRANSP_DARK, UI_TRANSP_DARK, 255);
- glBegin(GL_POLYGON);
- for(a=0; a<wtb->totvert; a++) {
- glVertex2fv(wtb->inner_v[a]);
- }
- glEnd();
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(2, GL_FLOAT, 0, wtb->inner_v);
+ glDrawArrays(GL_POLYGON, 0, wtb->totvert);
+ glDisableClientState(GL_VERTEX_ARRAY);
/* light checkers */
glEnable(GL_POLYGON_STIPPLE);
glColor4ub(UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, 255);
glPolygonStipple(checker_stipple_sml);
- glBegin(GL_POLYGON);
- for(a=0; a<wtb->totvert; a++) {
- glVertex2fv(wtb->inner_v[a]);
- }
- glEnd();
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(2, GL_FLOAT, 0, wtb->inner_v);
+ glDrawArrays(GL_POLYGON, 0, wtb->totvert);
+ glDisableClientState(GL_VERTEX_ARRAY);
+
glDisable(GL_POLYGON_STIPPLE);
/* alpha fill */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4ubv((unsigned char*)wcol->inner);
- glBegin(GL_POLYGON);
+ glEnableClientState(GL_VERTEX_ARRAY);
+
for(a=0; a<wtb->totvert; a++) {
- glVertex2fv(wtb->inner_v[a]);
x_mid += wtb->inner_v[a][0];
}
x_mid /= wtb->totvert;
- glEnd();
+
+ glVertexPointer(2, GL_FLOAT, 0, wtb->inner_v);
+ glDrawArrays(GL_POLYGON, 0, wtb->totvert);
+ glDisableClientState(GL_VERTEX_ARRAY);
/* 1/2 solid color */
glColor4ub(wcol->inner[0], wcol->inner[1], wcol->inner[2], 255);
- glBegin(GL_POLYGON);
- for(a=0; a<wtb->totvert; a++)
- glVertex2f(MIN2(wtb->inner_v[a][0], x_mid), wtb->inner_v[a][1]);
- glEnd();
+
+ for(a=0; a<wtb->totvert; a++) {
+ inner_v_half[a][0]= MIN2(wtb->inner_v[a][0], x_mid);
+ inner_v_half[a][1]= wtb->inner_v[a][1];
+ }
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(2, GL_FLOAT, 0, inner_v_half);
+ glDrawArrays(GL_POLYGON, 0, wtb->totvert);
+ glDisableClientState(GL_VERTEX_ARRAY);
}
else {
/* simple fill */
glColor4ubv((unsigned char*)wcol->inner);
- glBegin(GL_POLYGON);
- for(a=0; a<wtb->totvert; a++)
- glVertex2fv(wtb->inner_v[a]);
- glEnd();
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(2, GL_FLOAT, 0, wtb->inner_v);
+ glDrawArrays(GL_POLYGON, 0, wtb->totvert);
+ glDisableClientState(GL_VERTEX_ARRAY);
}
}
else {
char col1[4], col2[4];
+ unsigned char col_array[WIDGET_SIZE_MAX * 4];
+ unsigned char *col_pt= col_array;
shadecolors4(col1, col2, wcol->inner, wcol->shadetop, wcol->shadedown);
glShadeModel(GL_SMOOTH);
- glBegin(GL_POLYGON);
- for(a=0; a<wtb->totvert; a++) {
- round_box_shade_col4(col1, col2, wtb->inner_uv[a][wtb->shadedir]);
- glVertex2fv(wtb->inner_v[a]);
+ for(a=0; a<wtb->totvert; a++, col_pt += 4) {
+ round_box_shade_col4_r(col_pt, col1, col2, wtb->inner_uv[a][wtb->shadedir]);
}
- glEnd();
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_COLOR_ARRAY);
+ glVertexPointer(2, GL_FLOAT, 0, wtb->inner_v);
+ glColorPointer(4, GL_UNSIGNED_BYTE, 0, col_array);
+ glDrawArrays(GL_POLYGON, 0, wtb->totvert);
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_COLOR_ARRAY);
+
glShadeModel(GL_FLAT);
}
}
/* for each AA step */
if(wtb->outline) {
+ float quad_strip[WIDGET_SIZE_MAX*2+2][2]; /* + 2 because the last pair is wrapped */
+ float quad_strip_emboss[WIDGET_SIZE_MAX*2][2]; /* only for emboss */
+
+ widget_verts_to_quad_strip(wtb, wtb->totvert, quad_strip);
+
+ if(wtb->emboss) {
+ widget_verts_to_quad_strip_open(wtb, wtb->halfwayvert, quad_strip_emboss);
+ }
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+
for(j=0; j<8; j++) {
glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
/* outline */
glColor4ub(wcol->outline[0], wcol->outline[1], wcol->outline[2], 32);
- glBegin(GL_QUAD_STRIP);
- for(a=0; a<wtb->totvert; a++) {
- glVertex2fv(wtb->outer_v[a]);
- glVertex2fv(wtb->inner_v[a]);
- }
- glVertex2fv(wtb->outer_v[0]);
- glVertex2fv(wtb->inner_v[0]);
- glEnd();
+
+ glVertexPointer(2, GL_FLOAT, 0, quad_strip);
+ glDrawArrays(GL_QUAD_STRIP, 0, wtb->totvert*2 + 2);
/* emboss bottom shadow */
if(wtb->emboss) {
glColor4f(1.0f, 1.0f, 1.0f, 0.02f);
- glBegin(GL_QUAD_STRIP);
- for(a=0; a<wtb->halfwayvert; a++) {
- glVertex2fv(wtb->outer_v[a]);
- glVertex2f(wtb->outer_v[a][0], wtb->outer_v[a][1]-1.0f);
- }
- glEnd();
+
+ glVertexPointer(2, GL_FLOAT, 0, quad_strip_emboss);
+ glDrawArrays(GL_QUAD_STRIP, 0, wtb->halfwayvert*2);
}
glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f);
}
+
+ glDisableClientState(GL_VERTEX_ARRAY);
}
/* decoration */
@@ -1611,7 +1665,8 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float
uiWidgetBase wtb;
rcti rect1= *rect;
float alpha, alphastep;
- int step, tot, a;
+ int step, totvert;
+ float quad_strip[WIDGET_SIZE_MAX*2][2];
/* prevent tooltips to not show round shadow */
if( 2.0f*radout > 0.2f*(rect1.ymax-rect1.ymin) )
@@ -1620,31 +1675,32 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float
rect1.ymax -= 2.0f*radout;
/* inner part */
- tot= round_box_shadow_edges(wtb.inner_v, &rect1, radin, roundboxalign & 12, 0.0f);
-
+ totvert= round_box_shadow_edges(wtb.inner_v, &rect1, radin, roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT), 0.0f);
+
/* inverse linear shadow alpha */
alpha= 0.15;
alphastep= 0.67;
+ glEnableClientState(GL_VERTEX_ARRAY);
+
for(step= 1; step<=radout; step++, alpha*=alphastep) {
- round_box_shadow_edges(wtb.outer_v, &rect1, radin, 15, (float)step);
+ round_box_shadow_edges(wtb.outer_v, &rect1, radin, UI_CNR_ALL, (float)step);
glColor4f(0.0f, 0.0f, 0.0f, alpha);
-
- glBegin(GL_QUAD_STRIP);
- for(a=0; a<tot; a++) {
- glVertex2fv(wtb.outer_v[a]);
- glVertex2fv(wtb.inner_v[a]);
- }
- glEnd();
+
+ widget_verts_to_quad_strip_open(&wtb, totvert, quad_strip);
+
+ glVertexPointer(2, GL_FLOAT, 0, quad_strip);
+ glDrawArrays(GL_QUAD_STRIP, 0, totvert*2);
}
-
+
+ glDisableClientState(GL_VERTEX_ARRAY);
}
static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int direction)
{
uiWidgetBase wtb;
- int roundboxalign= 15;
+ int roundboxalign= UI_CNR_ALL;
widget_init(&wtb);
@@ -1654,11 +1710,11 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir
//rect->ymax += 4.0;
}
else if (direction == UI_DOWN) {
- roundboxalign= 12;
+ roundboxalign= (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT);
rect->ymin -= 4.0;
}
else if (direction == UI_TOP) {
- roundboxalign= 3;
+ roundboxalign= UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT;
rect->ymax += 4.0;
}
@@ -2008,7 +2064,7 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
widget_init(&wtb);
/* fully rounded */
- round_box_edges(&wtb, 15, rect, rad);
+ round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
/* setup temp colors */
wcol_tmp.outline[0]= wcol_tmp.outline[1]= wcol_tmp.outline[2]= 0;
@@ -2107,17 +2163,15 @@ void ui_draw_link_bezier(rcti *rect)
if(ui_link_bezier_points(rect, coord_array, LINK_RESOL)) {
/* we can reuse the dist variable here to increment the GL curve eval amount*/
// const float dist= 1.0f/(float)LINK_RESOL; // UNUSED
- int i;
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
-
- glBegin(GL_LINE_STRIP);
- for(i=0; i<=LINK_RESOL; i++) {
- glVertex2fv(coord_array[i]);
- }
- glEnd();
-
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(2, GL_FLOAT, 0, coord_array);
+ glDrawArrays(GL_LINE_STRIP, 0, LINK_RESOL);
+ glDisableClientState(GL_VERTEX_ARRAY);
+
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
@@ -2148,7 +2202,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
if(horizontal)
SWAP(short, wcol->shadetop, wcol->shadedown);
- round_box_edges(&wtb, 15, rect, rad);
+ round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
widgetbase_draw(&wtb, wcol);
/* slider */
@@ -2176,7 +2230,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
if (state & UI_SCROLL_NO_OUTLINE)
SWAP(short, outline, wtb.outline);
- round_box_edges(&wtb, 15, slider, rad);
+ round_box_edges(&wtb, UI_CNR_ALL, slider, rad);
if(state & UI_SCROLL_ARROWS) {
if(wcol->item[0] > 48) wcol->item[0]-= 48;
@@ -2343,7 +2397,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
/* left part of slider, always rounded */
rect1.xmax= rect1.xmin + ceil(offs+1.0f);
- round_box_edges(&wtb1, roundboxalign & ~6, &rect1, offs);
+ round_box_edges(&wtb1, roundboxalign & ~(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT), &rect1, offs);
wtb1.outline= 0;
widgetbase_draw(&wtb1, wcol);
@@ -2354,7 +2408,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
offs*= (rect1.xmax + offs - rect->xmax)/offs;
else
offs= 0.0f;
- round_box_edges(&wtb1, roundboxalign & ~9, &rect1, offs);
+ round_box_edges(&wtb1, roundboxalign & ~(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT), &rect1, offs);
widgetbase_draw(&wtb1, wcol);
VECCOPY(wcol->outline, outline);
@@ -2436,7 +2490,7 @@ static void widget_icon_has_anim(uiBut *UNUSED(but), uiWidgetColors *wcol, rcti
wtb.outline= 0;
/* rounded */
- round_box_edges(&wtb, 15, rect, 10.0f);
+ round_box_edges(&wtb, UI_CNR_ALL, rect, 10.0f);
widgetbase_draw(&wtb, wcol);
}
}
@@ -2499,7 +2553,7 @@ static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int
widget_init(&wtb);
/* half rounded */
- round_box_edges(&wtb, 15, rect, rad);
+ round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
widgetbase_draw(&wtb, wcol);
}
@@ -2526,7 +2580,7 @@ static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(sta
/* rounded, but no outline */
wtb.outline= 0;
- round_box_edges(&wtb, 15, rect, 4.0f);
+ round_box_edges(&wtb, UI_CNR_ALL, rect, 4.0f);
widgetbase_draw(&wtb, wcol);
}
@@ -2550,7 +2604,7 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN
recttemp.ymax-= delta;
/* half rounded */
- round_box_edges(&wtb, 15, &recttemp, 4.0f);
+ round_box_edges(&wtb, UI_CNR_ALL, &recttemp, 4.0f);
/* decoration */
if(state & UI_SELECT) {
@@ -2650,12 +2704,12 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType *
UI_GetThemeColor3ubv(TH_BACK, col);
glColor3ubv(col);
- round_box__edges(&wtb, 15, rect, 0.0f, 4.0);
+ round_box__edges(&wtb, UI_CNR_ALL, rect, 0.0f, 4.0);
widgetbase_outline(&wtb);
}
/* outline */
- round_box_edges(&wtb, 15, rect, 5.0f);
+ round_box_edges(&wtb, UI_CNR_ALL, rect, 5.0f);
wtb.outline= 1;
wtb.inner= 0;
widgetbase_draw(&wtb, &wt->wcol);
@@ -2836,37 +2890,27 @@ static int widget_roundbox_set(uiBut *but, rcti *rect)
switch(but->flag & UI_BUT_ALIGN) {
case UI_BUT_ALIGN_TOP:
- return (12);
- break;
+ return UI_CNR_BOTTOM_LEFT | UI_CNR_BOTTOM_RIGHT;
case UI_BUT_ALIGN_DOWN:
- return (3);
- break;
+ return UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT;
case UI_BUT_ALIGN_LEFT:
- return (6);
- break;
+ return UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT;
case UI_BUT_ALIGN_RIGHT:
- return (9);
- break;
-
- case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT:
- return (1);
- break;
- case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT:
- return (2);
- break;
- case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_RIGHT:
- return (8);
- break;
- case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT:
- return (4);
- break;
-
+ return UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT;
+ case UI_BUT_ALIGN_DOWN | UI_BUT_ALIGN_RIGHT:
+ return UI_CNR_TOP_LEFT;
+ case UI_BUT_ALIGN_DOWN | UI_BUT_ALIGN_LEFT:
+ return UI_CNR_TOP_RIGHT;
+ case UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_RIGHT:
+ return UI_CNR_BOTTOM_LEFT;
+ case UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT:
+ return UI_CNR_BOTTOM_RIGHT;
default:
- return (0);
- break;
+ return 0;
}
- }
- return 15;
+ }
+
+ return UI_CNR_ALL;
}
/* conversion from old to new buttons, so still messy */
@@ -3104,14 +3148,14 @@ void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
uiWidgetType *wt= widget_type(UI_WTYPE_BOX);
glEnable(GL_BLEND);
- widget_softshadow(rect, 15, 5.0f, 8.0f);
+ widget_softshadow(rect, UI_CNR_ALL, 5.0f, 8.0f);
glDisable(GL_BLEND);
wt->state(wt, 0);
if(block)
- wt->draw(&wt->wcol, rect, block->flag, 15);
+ wt->draw(&wt->wcol, rect, block->flag, UI_CNR_ALL);
else
- wt->draw(&wt->wcol, rect, 0, 15);
+ wt->draw(&wt->wcol, rect, 0, UI_CNR_ALL);
}
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 692c8940a21..9b9237f70cf 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1039,6 +1039,23 @@ void UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char c
glColor3ub(r, g, b);
}
+void UI_GetColorPtrShade3ubv(const unsigned char cp[3], unsigned char col[3], int offset)
+{
+ int r, g, b;
+
+ r= offset+(int)cp[0];
+ g= offset+(int)cp[1];
+ b= offset+(int)cp[2];
+
+ CLAMP(r, 0, 255);
+ CLAMP(g, 0, 255);
+ CLAMP(b, 0, 255);
+
+ col[0] = r;
+ col[1] = g;
+ col[2] = b;
+}
+
// get a 3 byte color, blended and shaded between two other char color pointers
void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset)
{
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c
index 7673bd8f31c..1634b464dfd 100644
--- a/source/blender/editors/mesh/editmesh.c
+++ b/source/blender/editors/mesh/editmesh.c
@@ -1659,8 +1659,8 @@ static void *editMesh_to_undoMesh(void *emv)
/* now copy vertices */
a = 0;
for(eve=em->verts.first; eve; eve= eve->next, evec++, a++) {
- VECCOPY(evec->co, eve->co);
- VECCOPY(evec->no, eve->no);
+ copy_v3_v3(evec->co, eve->co);
+ copy_v3_v3(evec->no, eve->no);
evec->f= eve->f;
evec->h= eve->h;
@@ -1761,7 +1761,7 @@ static void undoMesh_to_editMesh(void *umv, void *emv)
eve= addvertlist(em, evec->co, NULL);
evar[a]= eve;
- VECCOPY(eve->no, evec->no);
+ copy_v3_v3(eve->no, evec->no);
eve->f= evec->f;
eve->h= evec->h;
eve->keyindex= evec->keyindex;
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index fa3619883f4..0c819cd7649 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -210,7 +210,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
copy_v3_v3(vec, min);
normalize_v3(vec);
- dot= INPR(vec, nor);
+ dot= dot_v3v3(vec, nor);
if( fabs(dot)<0.999) {
float cross[3], si, q1[4];
@@ -1486,7 +1486,7 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- RNA_def_int(ot->srna, "vertices", 32, INT_MIN, INT_MAX, "Vertices", "", 3, 500);
+ RNA_def_int(ot->srna, "vertices", 32, 3, INT_MAX, "Vertices", "", 3, 500);
RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00);
RNA_def_boolean(ot->srna, "fill", 0, "Fill", "");
@@ -1527,7 +1527,7 @@ void MESH_OT_primitive_cylinder_add(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- RNA_def_int(ot->srna, "vertices", 32, INT_MIN, INT_MAX, "Vertices", "", 2, 500);
+ RNA_def_int(ot->srna, "vertices", 32, 2, INT_MAX, "Vertices", "", 2, 500);
RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00);
RNA_def_float(ot->srna, "depth", 2.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00);
RNA_def_boolean(ot->srna, "cap_ends", 1, "Cap Ends", "");
@@ -1568,7 +1568,7 @@ void MESH_OT_primitive_cone_add(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- RNA_def_int(ot->srna, "vertices", 32, INT_MIN, INT_MAX, "Vertices", "", 2, 500);
+ RNA_def_int(ot->srna, "vertices", 32, 2, INT_MAX, "Vertices", "", 2, 500);
RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00);
RNA_def_float(ot->srna, "depth", 2.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00);
RNA_def_boolean(ot->srna, "cap_end", 1, "Cap End", "");
@@ -1609,8 +1609,8 @@ void MESH_OT_primitive_grid_add(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- RNA_def_int(ot->srna, "x_subdivisions", 10, INT_MIN, INT_MAX, "X Subdivisions", "", 3, 1000);
- RNA_def_int(ot->srna, "y_subdivisions", 10, INT_MIN, INT_MAX, "Y Subdivisions", "", 3, 1000);
+ RNA_def_int(ot->srna, "x_subdivisions", 10, 3, INT_MAX, "X Subdivisions", "", 3, 1000);
+ RNA_def_int(ot->srna, "y_subdivisions", 10, 3, INT_MAX, "Y Subdivisions", "", 3, 1000);
RNA_def_float(ot->srna, "size", 1.0f, 0.0, FLT_MAX, "Size", "", 0.001, FLT_MAX);
ED_object_add_generic_props(ot, TRUE);
@@ -1682,8 +1682,8 @@ void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- RNA_def_int(ot->srna, "segments", 32, INT_MIN, INT_MAX, "Segments", "", 3, 500);
- RNA_def_int(ot->srna, "ring_count", 16, INT_MIN, INT_MAX, "Rings", "", 3, 500);
+ RNA_def_int(ot->srna, "segments", 32, 3, INT_MAX, "Segments", "", 3, 500);
+ RNA_def_int(ot->srna, "ring_count", 16, 3, INT_MAX, "Rings", "", 3, 500);
RNA_def_float(ot->srna, "size", 1.0f, 0.0, FLT_MAX, "Size", "", 0.001, 100.00);
ED_object_add_generic_props(ot, TRUE);
@@ -1721,7 +1721,7 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- RNA_def_int(ot->srna, "subdivisions", 2, 0, INT_MAX, "Subdivisions", "", 0, 8);
+ RNA_def_int(ot->srna, "subdivisions", 2, 1, INT_MAX, "Subdivisions", "", 1, 8);
RNA_def_float(ot->srna, "size", 1.0f, 0.0f, FLT_MAX, "Size", "", 0.001f, 100.00);
ED_object_add_generic_props(ot, TRUE);
diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c
index 0afa2d01702..02b5250f67a 100644
--- a/source/blender/editors/mesh/editmesh_lib.c
+++ b/source/blender/editors/mesh/editmesh_lib.c
@@ -1002,7 +1002,7 @@ void EM_free_data_layer(EditMesh *em, CustomData *data, int type)
static void add_normal_aligned(float *nor, float *add)
{
- if( INPR(nor, add) < -0.9999f)
+ if(dot_v3v3(nor, add) < -0.9999f)
sub_v3_v3(nor, add);
else
add_v3_v3(nor, add);
@@ -1096,13 +1096,13 @@ short extrudeflag_face_indiv(EditMesh *em, short UNUSED(flag), float *UNUSED(nor
v3= addvertlist(em, efa->v3->co, efa->v3);
v1->f1= v2->f1= v3->f1= 1;
- VECCOPY(v1->no, efa->n);
- VECCOPY(v2->no, efa->n);
- VECCOPY(v3->no, efa->n);
+ copy_v3_v3(v1->no, efa->n);
+ copy_v3_v3(v2->no, efa->n);
+ copy_v3_v3(v3->no, efa->n);
if(efa->v4) {
v4= addvertlist(em, efa->v4->co, efa->v4);
v4->f1= 1;
- VECCOPY(v4->no, efa->n);
+ copy_v3_v3(v4->no, efa->n);
}
else v4= NULL;
@@ -1310,7 +1310,7 @@ static short extrudeflag_edge(Object *obedit, EditMesh *em, short UNUSED(flag),
* of the cases above to handle edges on the line of symmetry.
*/
for (; md; md=md->next) {
- if (md->type==eModifierType_Mirror) {
+ if ((md->type==eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
MirrorModifierData *mmd = (MirrorModifierData*) md;
if(mmd->flag & MOD_MIR_CLIPPING) {
@@ -1597,7 +1597,7 @@ short extrudeflag_vert(Object *obedit, EditMesh *em, short flag, float *nor, int
* of the cases above to handle edges on the line of symmetry.
*/
for (; md; md=md->next) {
- if (md->type==eModifierType_Mirror) {
+ if ((md->type==eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
MirrorModifierData *mmd = (MirrorModifierData*) md;
if(mmd->flag & MOD_MIR_CLIPPING) {
@@ -1648,8 +1648,8 @@ short extrudeflag_vert(Object *obedit, EditMesh *em, short flag, float *nor, int
sel= 1;
v1= addvertlist(em, 0, NULL);
- VECCOPY(v1->co, eve->co);
- VECCOPY(v1->no, eve->no);
+ copy_v3_v3(v1->co, eve->co);
+ copy_v3_v3(v1->no, eve->no);
v1->f= eve->f;
eve->f &= ~flag;
eve->tmp.v = v1;
@@ -2482,7 +2482,7 @@ void EM_make_hq_normals(EditMesh *em)
/* only one face attached to that edge */
/* an edge without another attached- the weight on this is
* undefined, M_PI/2 is 90d in radians and that seems good enough */
- VECCOPY(edge_normal, EM_get_face_for_index(edge_ref->f1)->n)
+ copy_v3_v3(edge_normal, EM_get_face_for_index(edge_ref->f1)->n);
mul_v3_fl(edge_normal, M_PI/2);
}
add_v3_v3(EM_get_vert_for_index(ed_v1)->no, edge_normal );
@@ -2499,7 +2499,7 @@ void EM_make_hq_normals(EditMesh *em)
if(normalize_v3(eve->no) == 0.0f && eve->tmp.l < 0) {
/* exceptional case, totally flat */
efa= EM_get_face_for_index(-(eve->tmp.l) - 1);
- VECCOPY(eve->no, efa->n);
+ copy_v3_v3(eve->no, efa->n);
}
}
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index 7f82cf0ff3b..27cc2b755e6 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -829,7 +829,7 @@ static int similar_face_select__internal(EditMesh *em, int mode, float thresh)
float angle;
for(efa= em->faces.first; efa; efa= efa->next) {
if (!(efa->f & SELECT) && !efa->h) {
- angle= RAD2DEGF(angle_v2v2(base_efa->n, efa->n));
+ angle= RAD2DEGF(angle_v3v3(base_efa->n, efa->n));
if (angle/180.0f<=thresh) {
EM_select_face(efa, 1);
selcount++;
@@ -844,7 +844,7 @@ static int similar_face_select__internal(EditMesh *em, int mode, float thresh)
base_dot= dot_v3v3(base_efa->cent, base_efa->n);
for(efa= em->faces.first; efa; efa= efa->next) {
if (!(efa->f & SELECT) && !efa->h) {
- angle= RAD2DEGF(angle_v2v2(base_efa->n, efa->n));
+ angle= RAD2DEGF(angle_v3v3(base_efa->n, efa->n));
if (angle/180.0f<=thresh) {
dot=dot_v3v3(efa->cent, base_efa->n);
if (fabsf(base_dot-dot) <= thresh) {
@@ -961,7 +961,7 @@ static int similar_edge_select__internal(EditMesh *em, int mode, float thresh)
else if (eed->f2==0) /* first access, assign the face */
eed->tmp.f= efa;
else if (eed->f2==1) /* second, we assign the angle*/
- eed->tmp.fp= RAD2DEGF(angle_v2v2(eed->tmp.f->n, efa->n))/180;
+ eed->tmp.fp= RAD2DEGF(angle_v3v3(eed->tmp.f->n, efa->n))/180;
eed->f2++; /* f2==0 no face assigned. f2==1 one face found. f2==2 angle calculated.*/
}
j++;
@@ -991,7 +991,7 @@ static int similar_edge_select__internal(EditMesh *em, int mode, float thresh)
for(eed= em->edges.first; eed; eed= eed->next) {
if (!(eed->f & SELECT) && !eed->h) {
sub_v3_v3v3(dir, eed->v1->co, eed->v2->co);
- angle= RAD2DEGF(angle_v2v2(base_dir, dir));
+ angle= RAD2DEGF(angle_v3v3(base_dir, dir));
if (angle>90.0f) /* use the smallest angle between the edges */
angle= fabsf(angle-180.0f);
@@ -1088,7 +1088,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
Mesh *me= obedit->data;
EditMesh *em= BKE_mesh_get_editmesh(me);
- int selcount = similar_edge_select__internal(em, RNA_int_get(op->ptr, "type"), RNA_float_get(op->ptr, "threshold"));
+ int selcount = similar_edge_select__internal(em, RNA_enum_get(op->ptr, "type"), RNA_float_get(op->ptr, "threshold"));
if (selcount) {
/* here was an edge-mode only select flush case, has to be generalized */
@@ -1161,7 +1161,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
float angle;
for(eve= em->verts.first; eve; eve= eve->next) {
if (!(eve->f & SELECT) && !eve->h) {
- angle= RAD2DEGF(angle_v2v2(base_eve->no, eve->no));
+ angle= RAD2DEGF(angle_v3v3(base_eve->no, eve->no));
if (angle/180.0f<=thresh) {
eve->f |= SELECT;
selcount++;
@@ -4150,7 +4150,7 @@ static int smooth_vertex(bContext *C, wmOperator *op)
* are within tolerance of the plane(s) of reflection
*/
for(md=obedit->modifiers.first; md; md=md->next) {
- if(md->type==eModifierType_Mirror) {
+ if((md->type==eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
MirrorModifierData *mmd = (MirrorModifierData*) md;
if(mmd->flag & MOD_MIR_CLIPPING) {
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 9ff2923f733..2dc82ae89fb 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -1466,8 +1466,8 @@ static void alter_co(float *co, EditEdge *edge, float smooth, float fractal, int
sub_v3_v3v3(nor, edge->v1->co, edge->v2->co);
len= 0.5f*normalize_v3(nor);
- VECCOPY(nor1, edge->v1->no);
- VECCOPY(nor2, edge->v2->no);
+ copy_v3_v3(nor1, edge->v1->no);
+ copy_v3_v3(nor2, edge->v2->no);
/* cosine angle */
fac= nor[0]*nor1[0] + nor[1]*nor1[1] + nor[2]*nor1[2] ;
@@ -2675,7 +2675,7 @@ void esubdivideflag(Object *obedit, EditMesh *em, int flag, float smooth, float
}
for (; md; md=md->next) {
- if (md->type==eModifierType_Mirror) {
+ if ((md->type==eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
MirrorModifierData *mmd = (MirrorModifierData*) md;
if(mmd->flag & MOD_MIR_CLIPPING) {
@@ -3234,13 +3234,13 @@ static float measure_facepair(EditVert *v1, EditVert *v2, EditVert *v3, EditVert
normal_tri_v3( noA2,v1->co, v3->co, v4->co);
if(noA1[0] == noA2[0] && noA1[1] == noA2[1] && noA1[2] == noA2[2]) normalADiff = 0.0;
- else normalADiff = RAD2DEGF(angle_v2v2(noA1, noA2));
+ else normalADiff = RAD2DEGF(angle_v3v3(noA1, noA2));
//if(!normalADiff) normalADiff = 179;
normal_tri_v3( noB1,v2->co, v3->co, v4->co);
normal_tri_v3( noB2,v4->co, v1->co, v2->co);
if(noB1[0] == noB2[0] && noB1[1] == noB2[1] && noB1[2] == noB2[2]) normalBDiff = 0.0;
- else normalBDiff = RAD2DEGF(angle_v2v2(noB1, noB2));
+ else normalBDiff = RAD2DEGF(angle_v3v3(noB1, noB2));
//if(!normalBDiff) normalBDiff = 179;
measure += (normalADiff/360) + (normalBDiff/360);
@@ -3255,10 +3255,10 @@ static float measure_facepair(EditVert *v1, EditVert *v2, EditVert *v3, EditVert
diff = 0.0;
diff = (
- fabsf(RAD2DEGF(angle_v2v2(edgeVec1, edgeVec2)) - 90) +
- fabsf(RAD2DEGF(angle_v2v2(edgeVec2, edgeVec3)) - 90) +
- fabsf(RAD2DEGF(angle_v2v2(edgeVec3, edgeVec4)) - 90) +
- fabsf(RAD2DEGF(angle_v2v2(edgeVec4, edgeVec1)) - 90)) / 360;
+ fabsf(RAD2DEGF(angle_v3v3(edgeVec1, edgeVec2)) - 90) +
+ fabsf(RAD2DEGF(angle_v3v3(edgeVec2, edgeVec3)) - 90) +
+ fabsf(RAD2DEGF(angle_v3v3(edgeVec3, edgeVec4)) - 90) +
+ fabsf(RAD2DEGF(angle_v3v3(edgeVec4, edgeVec1)) - 90)) / 360;
if(!diff) return 0.0;
measure += diff;
@@ -4869,7 +4869,7 @@ void mesh_set_face_flags(EditMesh *em, short mode)
/* helper to find edge for edge_rip */
static float mesh_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *co2, const int mval[2])
{
- float vec1[3], vec2[3], mvalf[2];
+ float vec1[2], vec2[2], mvalf[2];
ED_view3d_project_float(ar, co1, vec1, mat);
ED_view3d_project_float(ar, co2, vec2, mat);
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt
index 14b40d55f11..b9b8ddc6305 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -58,8 +58,22 @@ set(SRC
object_intern.h
)
+if(WITH_GAMEENGINE)
+ list(APPEND INC
+ ../../../../extern/recastnavigation/Recast/Include
+ )
+
+ list(APPEND SRC
+ object_navmesh.cpp
+ )
+endif()
+
if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
+if(WITH_GAMEENGINE)
+ add_definitions(-DWITH_GAMEENGINE)
+endif()
+
blender_add_lib(bf_editor_object "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/object/SConscript b/source/blender/editors/object/SConscript
index ca048cb59f9..cdda16582ef 100644
--- a/source/blender/editors/object/SConscript
+++ b/source/blender/editors/object/SConscript
@@ -1,12 +1,13 @@
#!/usr/bin/python
Import ('env')
-sources = env.Glob('*.c')
+sources = env.Glob('*.c') + env.Glob('*.cpp')
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc ../../blenloader'
incs += ' ../../makesrna ../../python ../../ikplugin'
incs += ' ../../render/extern/include ../../gpu' # for object_bake.c
+incs += ' #extern/recastnavigation/Recast/Include'
defs = []
@@ -19,5 +20,8 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
if env['WITH_BF_PYTHON']:
defs.append('WITH_PYTHON')
+
+if env['WITH_BF_GAMEENGINE']:
+ defs.append('WITH_GAMEENGINE')
env.BlenderLib ( 'bf_editors_object', sources, Split(incs), defs, libtype=['core'], priority=[35] )
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 0a4c6b638a3..fb119b1d264 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -229,5 +229,10 @@ void OBJECT_OT_group_remove(struct wmOperatorType *ot);
/* object_bake.c */
void OBJECT_OT_bake_image(wmOperatorType *ot);
+/* object_navmesh.cpp */
+void OBJECT_OT_create_navmesh(struct wmOperatorType *ot);
+void OBJECT_OT_assign_navpolygon(struct wmOperatorType *ot);
+void OBJECT_OT_assign_new_navpolygon(struct wmOperatorType *ot);
+
#endif /* ED_OBJECT_INTERN_H */
diff --git a/source/blender/editors/object/object_navmesh.cpp b/source/blender/editors/object/object_navmesh.cpp
new file mode 100644
index 00000000000..d0768d30236
--- /dev/null
+++ b/source/blender/editors/object/object_navmesh.cpp
@@ -0,0 +1,628 @@
+/**
+* $Id$
+*
+* ***** BEGIN GPL LICENSE BLOCK *****
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+* The Original Code is Copyright (C) 2004 by Blender Foundation
+* All rights reserved.
+*
+* The Original Code is: all of this file.
+*
+* Contributor(s): none yet.
+*
+* ***** END GPL LICENSE BLOCK *****
+*/
+
+#include <math.h>
+#include "Recast.h"
+
+extern "C"
+{
+#include "MEM_guardedalloc.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_modifier_types.h"
+#include "DNA_ID.h"
+
+#include "BKE_library.h"
+#include "BKE_depsgraph.h"
+#include "BKE_context.h"
+#include "BKE_mesh.h"
+#include "BKE_modifier.h"
+#include "BKE_scene.h"
+#include "BKE_DerivedMesh.h"
+#include "BKE_cdderivedmesh.h"
+#include "BLI_editVert.h"
+#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
+#include "ED_object.h"
+#include "BLI_math_vector.h"
+
+#include "RNA_access.h"
+
+#include "ED_mesh.h"
+
+/*mesh/mesh_intern.h */
+extern struct EditVert *addvertlist(EditMesh *em, float *vec, struct EditVert *example);
+extern struct EditFace *addfacelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2, struct EditVert *v3, struct EditVert *v4, struct EditFace *example, struct EditFace *exampleEdges);
+extern void free_vertlist(EditMesh *em, ListBase *edve);
+extern void free_edgelist(EditMesh *em, ListBase *lb);
+extern void free_facelist(EditMesh *em, ListBase *lb);
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+static void createVertsTrisData(bContext *C, LinkNode* obs, int& nverts, float*& verts, int &ntris, int*& tris)
+{
+ MVert *mvert;
+ int nfaces = 0, *tri, i, curnverts, basenverts, curnfaces;
+ MFace *mface;
+ float co[3], wco[3];
+ Object *ob;
+ LinkNode *oblink, *dmlink;
+ DerivedMesh *dm;
+ Scene* scene = CTX_data_scene(C);
+ LinkNode* dms = NULL;
+
+ nverts = 0;
+ ntris = 0;
+ //calculate number of verts and tris
+ for (oblink = obs; oblink; oblink = oblink->next)
+ {
+ ob = (Object*) oblink->link;
+ DerivedMesh *dm = mesh_create_derived_no_virtual(scene, ob, NULL, CD_MASK_MESH);
+ BLI_linklist_append(&dms, (void*)dm);
+
+ nverts += dm->getNumVerts(dm);
+ nfaces = dm->getNumFaces(dm);
+ ntris += nfaces;
+
+ //resolve quad faces
+ mface = dm->getFaceArray(dm);
+ for (i=0; i<nfaces; i++)
+ {
+ MFace* mf = &mface[i];
+ if (mf->v4)
+ ntris+=1;
+ }
+ }
+
+ //create data
+ verts = (float*) MEM_mallocN(sizeof(float)*3*nverts, "verts");
+ tris = (int*) MEM_mallocN(sizeof(int)*3*ntris, "faces");
+
+ basenverts = 0;
+ tri = tris;
+ for (oblink = obs, dmlink = dms; oblink && dmlink;
+ oblink = oblink->next, dmlink = dmlink->next)
+ {
+ ob = (Object*) oblink->link;
+ dm = (DerivedMesh*) dmlink->link;
+
+ curnverts = dm->getNumVerts(dm);
+ mvert = dm->getVertArray(dm);
+ //copy verts
+ for (i=0; i<curnverts; i++)
+ {
+ MVert *v = &mvert[i];
+ copy_v3_v3(co, v->co);
+ mul_v3_m4v3(wco, ob->obmat, co);
+ verts[3*(basenverts+i)+0] = wco[0];
+ verts[3*(basenverts+i)+1] = wco[2];
+ verts[3*(basenverts+i)+2] = wco[1];
+ }
+
+ //create tris
+ curnfaces = dm->getNumFaces(dm);
+ mface = dm->getFaceArray(dm);
+ for (i=0; i<curnfaces; i++)
+ {
+ MFace* mf = &mface[i];
+ tri[0]= basenverts + mf->v1; tri[1]= basenverts + mf->v3; tri[2]= basenverts + mf->v2;
+ tri += 3;
+ if (mf->v4)
+ {
+ tri[0]= basenverts + mf->v1; tri[1]= basenverts + mf->v4; tri[2]= basenverts + mf->v3;
+ tri += 3;
+ }
+ }
+ basenverts += curnverts;
+ }
+
+ //release derived mesh
+ for (dmlink = dms; dmlink; dmlink = dmlink->next)
+ {
+ dm = (DerivedMesh*) dmlink->link;
+ dm->release(dm);
+ }
+ BLI_linklist_free(dms, NULL);
+}
+
+static bool buildNavMesh(const RecastData& recastParams, int nverts, float* verts, int ntris, int* tris,
+ rcPolyMesh*& pmesh, rcPolyMeshDetail*& dmesh)
+{
+ float bmin[3], bmax[3];
+ rcHeightfield* solid;
+ unsigned char *triflags;
+ rcCompactHeightfield* chf;
+ rcContourSet *cset;
+
+ rcCalcBounds(verts, nverts, bmin, bmax);
+
+ //
+ // Step 1. Initialize build config.
+ //
+ rcConfig cfg;
+ memset(&cfg, 0, sizeof(cfg));
+ {
+/*
+ float cellsize = 0.3f;
+ float cellheight = 0.2f;
+ float agentmaxslope = M_PI/4;
+ float agentmaxclimb = 0.9f;
+ float agentheight = 2.0f;
+ float agentradius = 0.6f;
+ float edgemaxlen = 12.0f;
+ float edgemaxerror = 1.3f;
+ float regionminsize = 50.f;
+ float regionmergesize = 20.f;
+ int vertsperpoly = 6;
+ float detailsampledist = 6.0f;
+ float detailsamplemaxerror = 1.0f;
+ cfg.cs = cellsize;
+ cfg.ch = cellheight;
+ cfg.walkableSlopeAngle = agentmaxslope/M_PI*180.f;
+ cfg.walkableHeight = (int)ceilf(agentheight/ cfg.ch);
+ cfg.walkableClimb = (int)floorf(agentmaxclimb / cfg.ch);
+ cfg.walkableRadius = (int)ceilf(agentradius / cfg.cs);
+ cfg.maxEdgeLen = (int)(edgemaxlen/cellsize);
+ cfg.maxSimplificationError = edgemaxerror;
+ cfg.minRegionSize = (int)rcSqr(regionminsize);
+ cfg.mergeRegionSize = (int)rcSqr(regionmergesize);
+ cfg.maxVertsPerPoly = vertsperpoly;
+ cfg.detailSampleDist = detailsampledist< 0.9f ? 0 : cellsize * detailsampledist;
+ cfg.detailSampleMaxError = cellheight * detailsamplemaxerror;
+*/
+ cfg.cs = recastParams.cellsize;
+ cfg.ch = recastParams.cellheight;
+ cfg.walkableSlopeAngle = recastParams.agentmaxslope/((float)M_PI)*180.f;
+ cfg.walkableHeight = (int)ceilf(recastParams.agentheight/ cfg.ch);
+ cfg.walkableClimb = (int)floorf(recastParams.agentmaxclimb / cfg.ch);
+ cfg.walkableRadius = (int)ceilf(recastParams.agentradius / cfg.cs);
+ cfg.maxEdgeLen = (int)(recastParams.edgemaxlen/recastParams.cellsize);
+ cfg.maxSimplificationError = recastParams.edgemaxerror;
+ cfg.minRegionSize = (int)rcSqr(recastParams.regionminsize);
+ cfg.mergeRegionSize = (int)rcSqr(recastParams.regionmergesize);
+ cfg.maxVertsPerPoly = recastParams.vertsperpoly;
+ cfg.detailSampleDist = recastParams.detailsampledist< 0.9f ? 0 :
+ recastParams.cellsize * recastParams.detailsampledist;
+ cfg.detailSampleMaxError = recastParams.cellheight * recastParams.detailsamplemaxerror;
+
+ }
+
+ // Set the area where the navigation will be build.
+ vcopy(cfg.bmin, bmin);
+ vcopy(cfg.bmax, bmax);
+ rcCalcGridSize(cfg.bmin, cfg.bmax, cfg.cs, &cfg.width, &cfg.height);
+
+ //
+ // Step 2. Rasterize input polygon soup.
+ //
+ // Allocate voxel heightfield where we rasterize our input data to.
+ solid = new rcHeightfield;
+ if (!solid)
+ return false;
+
+ if (!rcCreateHeightfield(*solid, cfg.width, cfg.height, cfg.bmin, cfg.bmax, cfg.cs, cfg.ch))
+ return false;
+
+ // Allocate array that can hold triangle flags.
+ triflags = (unsigned char*) MEM_mallocN(sizeof(unsigned char)*ntris, "triflags");
+ if (!triflags)
+ return false;
+ // Find triangles which are walkable based on their slope and rasterize them.
+ memset(triflags, 0, ntris*sizeof(unsigned char));
+ rcMarkWalkableTriangles(cfg.walkableSlopeAngle, verts, nverts, tris, ntris, triflags);
+ rcRasterizeTriangles(verts, nverts, tris, triflags, ntris, *solid);
+ MEM_freeN(triflags);
+ MEM_freeN(verts);
+ MEM_freeN(tris);
+
+ //
+ // Step 3. Filter walkables surfaces.
+ //
+ rcFilterLedgeSpans(cfg.walkableHeight, cfg.walkableClimb, *solid);
+ rcFilterWalkableLowHeightSpans(cfg.walkableHeight, *solid);
+
+ //
+ // Step 4. Partition walkable surface to simple regions.
+ //
+
+ chf = new rcCompactHeightfield;
+ if (!chf)
+ return false;
+ if (!rcBuildCompactHeightfield(cfg.walkableHeight, cfg.walkableClimb, RC_WALKABLE, *solid, *chf))
+ return false;
+
+ delete solid;
+
+ // Prepare for region partitioning, by calculating distance field along the walkable surface.
+ if (!rcBuildDistanceField(*chf))
+ return false;
+
+ // Partition the walkable surface into simple regions without holes.
+ if (!rcBuildRegions(*chf, cfg.walkableRadius, cfg.borderSize, cfg.minRegionSize, cfg.mergeRegionSize))
+ return false;
+
+ //
+ // Step 5. Trace and simplify region contours.
+ //
+ // Create contours.
+ cset = new rcContourSet;
+ if (!cset)
+ return false;
+
+ if (!rcBuildContours(*chf, cfg.maxSimplificationError, cfg.maxEdgeLen, *cset))
+ return false;
+
+ //
+ // Step 6. Build polygons mesh from contours.
+ //
+ pmesh = new rcPolyMesh;
+ if (!pmesh)
+ return false;
+ if (!rcBuildPolyMesh(*cset, cfg.maxVertsPerPoly, *pmesh))
+ return false;
+
+
+ //
+ // Step 7. Create detail mesh which allows to access approximate height on each polygon.
+ //
+
+ dmesh = new rcPolyMeshDetail;
+ if (!dmesh)
+ return false;
+
+ if (!rcBuildPolyMeshDetail(*pmesh, *chf, cfg.detailSampleDist, cfg.detailSampleMaxError, *dmesh))
+ return false;
+
+ delete chf;
+ delete cset;
+
+ return true;
+}
+
+static Object* createRepresentation(bContext *C, rcPolyMesh*& pmesh, rcPolyMeshDetail*& dmesh, Base* base)
+{
+ float co[3], rot[3];
+ EditMesh *em;
+ int i,j, k;
+ unsigned short* v;
+ int face[3];
+ Main *bmain = CTX_data_main(C);
+ Scene *scene= CTX_data_scene(C);
+ Object* obedit;
+ int createob = base==NULL;
+ zero_v3(co);
+ zero_v3(rot);
+ if (createob)
+ {
+ //create new object
+ obedit = ED_object_add_type(C, OB_MESH, co, rot, FALSE, 1);
+ }
+ else
+ {
+ obedit = base->object;
+ scene_select_base(scene, base);
+ copy_v3_v3(obedit->loc, co);
+ copy_v3_v3(obedit->rot, rot);
+ }
+
+ ED_object_enter_editmode(C, EM_DO_UNDO|EM_IGNORE_LAYER);
+ em = BKE_mesh_get_editmesh(((Mesh *)obedit->data));
+
+ if (!createob)
+ {
+ //clear
+ if(em->verts.first) free_vertlist(em, &em->verts);
+ if(em->edges.first) free_edgelist(em, &em->edges);
+ if(em->faces.first) free_facelist(em, &em->faces);
+ if(em->selected.first) BLI_freelistN(&(em->selected));
+ }
+
+ //create verts for polygon mesh
+ for(i = 0; i < pmesh->nverts; i++) {
+ v = &pmesh->verts[3*i];
+ co[0] = pmesh->bmin[0] + v[0]*pmesh->cs;
+ co[1] = pmesh->bmin[1] + v[1]*pmesh->ch;
+ co[2] = pmesh->bmin[2] + v[2]*pmesh->cs;
+ SWAP(float, co[1], co[2]);
+ addvertlist(em, co, NULL);
+ }
+
+ //create custom data layer to save polygon idx
+ CustomData_add_layer_named(&em->fdata, CD_RECAST, CD_CALLOC, NULL, 0, "recastData");
+
+ //create verts and faces for detailed mesh
+ for (i=0; i<dmesh->nmeshes; i++)
+ {
+ int uniquevbase = em->totvert;
+ unsigned short vbase = dmesh->meshes[4*i+0];
+ unsigned short ndv = dmesh->meshes[4*i+1];
+ unsigned short tribase = dmesh->meshes[4*i+2];
+ unsigned short trinum = dmesh->meshes[4*i+3];
+ const unsigned short* p = &pmesh->polys[i*pmesh->nvp*2];
+ int nv = 0;
+ for (j = 0; j < pmesh->nvp; ++j)
+ {
+ if (p[j] == 0xffff) break;
+ nv++;
+ }
+ //create unique verts
+ for (j=nv; j<ndv; j++)
+ {
+ copy_v3_v3(co, &dmesh->verts[3*(vbase + j)]);
+ SWAP(float, co[1], co[2]);
+ addvertlist(em, co, NULL);
+ }
+
+ EM_init_index_arrays(em, 1, 0, 0);
+
+ //create faces
+ for (j=0; j<trinum; j++)
+ {
+ unsigned char* tri = &dmesh->tris[4*(tribase+j)];
+ EditFace* newFace;
+ for (k=0; k<3; k++)
+ {
+ if (tri[k]<nv)
+ face[k] = p[tri[k]]; //shared vertex
+ else
+ face[k] = uniquevbase+tri[k]-nv; //unique vertex
+ }
+ newFace = addfacelist(em, EM_get_vert_for_index(face[0]), EM_get_vert_for_index(face[2]),
+ EM_get_vert_for_index(face[1]), NULL, NULL, NULL);
+
+ //set navigation polygon idx to the custom layer
+ int* polygonIdx = (int*)CustomData_em_get(&em->fdata, newFace->data, CD_RECAST);
+ *polygonIdx = i+1; //add 1 to avoid zero idx
+ }
+
+ EM_free_index_arrays();
+ }
+
+ delete pmesh; pmesh = NULL;
+ delete dmesh; dmesh = NULL;
+
+ BKE_mesh_end_editmesh((Mesh*)obedit->data, em);
+
+ DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+
+
+ ED_object_exit_editmode(C, EM_FREEDATA);
+ WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
+
+ if (createob)
+ {
+ obedit->gameflag &= ~OB_COLLISION;
+ obedit->gameflag |= OB_NAVMESH;
+ obedit->body_type = OB_BODY_TYPE_NAVMESH;
+ rename_id((ID *)obedit, "Navmesh");
+ }
+
+ ModifierData *md= modifiers_findByType(obedit, eModifierType_NavMesh);
+ if (!md)
+ {
+ ED_object_modifier_add(NULL, bmain, scene, obedit, NULL, eModifierType_NavMesh);
+ }
+
+ return obedit;
+}
+
+static int create_navmesh_exec(bContext *C, wmOperator *op)
+{
+ Scene* scene = CTX_data_scene(C);
+ int nverts, ntris;
+ float* verts;
+ int* tris;
+ rcPolyMesh* pmesh;
+ rcPolyMeshDetail* dmesh;
+ LinkNode* obs = NULL;
+ Base* navmeshBase = NULL;
+ //CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) //expand macros to avoid error in convertion from void*
+ {
+ ListBase ctx_data_list;
+ CollectionPointerLink *ctx_link;
+ CTX_data_selected_editable_bases(C, &ctx_data_list);
+ for(ctx_link = (CollectionPointerLink *)ctx_data_list.first;
+ ctx_link; ctx_link = (CollectionPointerLink *)ctx_link->next) {
+ Base* base= (Base*)ctx_link->ptr.data;
+ {
+ if (base->object->body_type==OB_BODY_TYPE_NAVMESH)
+ {
+ if (!navmeshBase || base==CTX_data_active_base(C))
+ navmeshBase = base;
+ }
+ else
+ BLI_linklist_append(&obs, (void*)base->object);
+ }
+ CTX_DATA_END;
+ createVertsTrisData(C, obs, nverts, verts, ntris, tris);
+ BLI_linklist_free(obs, NULL);
+ buildNavMesh(scene->gm.recastData, nverts, verts, ntris, tris, pmesh, dmesh);
+ createRepresentation(C, pmesh, dmesh, navmeshBase);
+
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_create_navmesh(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Create navigation mesh";
+ ot->description= "Create navigation mesh for selected objects";
+ ot->idname= "OBJECT_OT_create_navmesh";
+
+ /* api callbacks */
+ ot->exec= create_navmesh_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int assign_navpolygon_poll(bContext *C)
+{
+ Object *ob= (Object *)CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
+ if (!ob || !ob->data)
+ return 0;
+ return (((Mesh*)ob->data)->edit_mesh != NULL);
+}
+
+static int assign_navpolygon_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit= CTX_data_edit_object(C);
+ EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+
+ //do work here
+ int targetPolyIdx = -1;
+ EditFace *ef, *efa;
+ efa = EM_get_actFace(em, 0);
+ if (efa)
+ {
+ if (CustomData_has_layer(&em->fdata, CD_RECAST))
+ {
+ targetPolyIdx = *(int*)CustomData_em_get(&em->fdata, efa->data, CD_RECAST);
+ targetPolyIdx = targetPolyIdx>=0? targetPolyIdx : -targetPolyIdx;
+ if (targetPolyIdx>0)
+ {
+ //set target poly idx to other selected faces
+ ef = (EditFace*)em->faces.last;
+ while(ef)
+ {
+ if((ef->f & SELECT )&& ef!=efa)
+ {
+ int* recastDataBlock = (int*)CustomData_em_get(&em->fdata, ef->data, CD_RECAST);
+ *recastDataBlock = targetPolyIdx;
+ }
+ ef = ef->prev;
+ }
+ }
+ }
+ }
+
+ DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+
+ BKE_mesh_end_editmesh((Mesh*)obedit->data, em);
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_assign_navpolygon(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Assign polygon index";
+ ot->description= "Assign polygon index to face by active face";
+ ot->idname= "OBJECT_OT_assign_navpolygon";
+
+ /* api callbacks */
+ ot->poll = assign_navpolygon_poll;
+ ot->exec= assign_navpolygon_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int compare(const void * a, const void * b){
+ return ( *(int*)a - *(int*)b );
+}
+static int findFreeNavPolyIndex(EditMesh* em)
+{
+ //construct vector of indices
+ int numfaces = em->totface;
+ int* indices = new int[numfaces];
+ EditFace* ef = (EditFace*)em->faces.last;
+ int idx = 0;
+ while(ef)
+ {
+ int polyIdx = *(int*)CustomData_em_get(&em->fdata, ef->data, CD_RECAST);
+ indices[idx] = polyIdx;
+ idx++;
+ ef = ef->prev;
+ }
+ qsort(indices, numfaces, sizeof(int), compare);
+ //search first free index
+ int freeIdx = 1;
+ for (int i=0; i<numfaces; i++)
+ {
+ if (indices[i]==freeIdx)
+ freeIdx++;
+ else if (indices[i]>freeIdx)
+ break;
+ }
+ delete indices;
+ return freeIdx;
+}
+
+static int assign_new_navpolygon_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit= CTX_data_edit_object(C);
+ EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+
+ EditFace *ef;
+ if (CustomData_has_layer(&em->fdata, CD_RECAST))
+ {
+ int targetPolyIdx = findFreeNavPolyIndex(em);
+ if (targetPolyIdx>0)
+ {
+ //set target poly idx to selected faces
+ ef = (EditFace*)em->faces.last;
+ while(ef)
+ {
+ if(ef->f & SELECT )
+ {
+ int* recastDataBlock = (int*)CustomData_em_get(&em->fdata, ef->data, CD_RECAST);
+ *recastDataBlock = targetPolyIdx;
+ }
+ ef = ef->prev;
+ }
+ }
+ }
+
+ DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+
+ BKE_mesh_end_editmesh((Mesh*)obedit->data, em);
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_assign_new_navpolygon(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Assign new polygon index";
+ ot->description= "Assign new polygon index to face";
+ ot->idname= "OBJECT_OT_assign_new_navpolygon";
+
+ /* api callbacks */
+ ot->poll = assign_navpolygon_poll;
+ ot->exec= assign_new_navpolygon_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+}
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 3e8c34b7395..b36357facb1 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -218,8 +218,15 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_bake_image);
WM_operatortype_append(OBJECT_OT_drop_named_material);
+
+#ifdef WITH_GAMEENGINE
+ WM_operatortype_append(OBJECT_OT_create_navmesh);
+ WM_operatortype_append(OBJECT_OT_assign_navpolygon);
+ WM_operatortype_append(OBJECT_OT_assign_new_navpolygon);
+#endif
}
+
void ED_operatormacros_object(void)
{
wmOperatorType *ot;
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index cb1fc7541d0..8fdd7a53e91 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -121,6 +121,20 @@ void ED_base_object_activate(bContext *C, Base *base)
/********************** Selection Operators **********************/
+static int objects_selectable_poll(bContext *C)
+{
+ /* we don't check for linked scenes here, selection is
+ still allowed then for inspection of scene */
+ Object *obact= CTX_data_active_object(C);
+
+ if(CTX_data_edit_object(C))
+ return 0;
+ if(obact && obact->mode)
+ return 0;
+
+ return 1;
+}
+
/************************ Select by Type *************************/
static int object_select_by_type_exec(bContext *C, wmOperator *op)
@@ -159,7 +173,7 @@ void OBJECT_OT_select_by_type(wmOperatorType *ot)
/* api callbacks */
ot->invoke= WM_menu_invoke;
ot->exec= object_select_by_type_exec;
- ot->poll= ED_operator_objectmode;
+ ot->poll= objects_selectable_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -341,7 +355,7 @@ void OBJECT_OT_select_linked(wmOperatorType *ot)
/* api callbacks */
ot->invoke= WM_menu_invoke;
ot->exec= object_select_linked_exec;
- ot->poll= ED_operator_objectmode;
+ ot->poll= objects_selectable_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -667,7 +681,7 @@ void OBJECT_OT_select_grouped(wmOperatorType *ot)
/* api callbacks */
ot->invoke= WM_menu_invoke;
ot->exec= object_select_grouped_exec;
- ot->poll= ED_operator_objectmode;
+ ot->poll= objects_selectable_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -716,7 +730,7 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot)
/* api callbacks */
/*ot->invoke = XXX - need a int grid popup*/
ot->exec= object_select_by_layer_exec;
- ot->poll= ED_operator_objectmode;
+ ot->poll= objects_selectable_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -754,7 +768,7 @@ void OBJECT_OT_select_inverse(wmOperatorType *ot)
/* api callbacks */
ot->exec= object_select_inverse_exec;
- ot->poll= ED_operator_objectmode;
+ ot->poll= objects_selectable_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -815,7 +829,7 @@ void OBJECT_OT_select_all(wmOperatorType *ot)
/* api callbacks */
ot->exec= object_select_all_exec;
- ot->poll= ED_operator_objectmode;
+ ot->poll= objects_selectable_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -864,7 +878,7 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot)
/* api callbacks */
ot->exec= object_select_same_group_exec;
- ot->poll= ED_operator_objectmode;
+ ot->poll= objects_selectable_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -917,7 +931,7 @@ void OBJECT_OT_select_mirror(wmOperatorType *ot)
/* api callbacks */
ot->exec= object_select_mirror_exec;
- ot->poll= ED_operator_objectmode;
+ ot->poll= objects_selectable_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -974,7 +988,7 @@ void OBJECT_OT_select_name(wmOperatorType *ot)
/* api callbacks */
ot->exec= object_select_name_exec;
- ot->poll= ED_operator_objectmode;
+ ot->poll= objects_selectable_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1022,7 +1036,7 @@ void OBJECT_OT_select_random(wmOperatorType *ot)
/* api callbacks */
/*ot->invoke= object_select_random_invoke XXX - need a number popup ;*/
ot->exec = object_select_random_exec;
- ot->poll= ED_operator_objectmode;
+ ot->poll= objects_selectable_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 1b24d660411..75c2054091c 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -529,7 +529,7 @@ void SCENE_OT_render_layer_add(wmOperatorType *ot)
static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C), *sce;
SceneRenderLayer *rl;
int act= scene->r.actlay;
@@ -541,15 +541,17 @@ static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
MEM_freeN(rl);
scene->r.actlay= 0;
-
- if(scene->nodetree) {
- bNode *node;
- for(node= scene->nodetree->nodes.first; node; node= node->next) {
- if(node->type==CMP_NODE_R_LAYERS && node->id==NULL) {
- if(node->custom1==act)
- node->custom1= 0;
- else if(node->custom1>act)
- node->custom1--;
+
+ for(sce = CTX_data_main(C)->scene.first; sce; sce = sce->id.next) {
+ if(sce->nodetree) {
+ bNode *node;
+ for(node = sce->nodetree->nodes.first; node; node = node->next) {
+ if(node->type==CMP_NODE_R_LAYERS && (Scene*)node->id==scene) {
+ if(node->custom1==act)
+ node->custom1= 0;
+ else if(node->custom1>act)
+ node->custom1--;
+ }
}
}
}
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index bc97cd9d3ff..d41d3245623 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -233,28 +233,28 @@ static void region_draw_azone_tab(AZone *az)
/* add code to draw region hidden as 'too small' */
switch(az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
- uiSetRoundBox(3 + 16);
+ uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_RB_ALPHA);
uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
glColor4ub(0, 0, 0, 255);
uiRoundRect((float)az->x1, 0.3f+(float)az->y1, (float)az->x2, 0.3f+(float)az->y2, 4.0f);
break;
case AE_BOTTOM_TO_TOPLEFT:
- uiSetRoundBox(12 + 16);
+ uiSetRoundBox(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA);
uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
glColor4ub(0, 0, 0, 255);
uiRoundRect((float)az->x1, 0.3f+(float)az->y1, (float)az->x2, 0.3f+(float)az->y2, 4.0f);
break;
case AE_LEFT_TO_TOPRIGHT:
- uiSetRoundBox(9 + 16);
+ uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA);
uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
glColor4ub(0, 0, 0, 255);
uiRoundRect((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f);
break;
case AE_RIGHT_TO_TOPLEFT:
- uiSetRoundBox(6 + 16);
+ uiSetRoundBox(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_RB_ALPHA);
uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
glColor4ub(0, 0, 0, 255);
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index b199f54cde1..62fdfc140df 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -3485,8 +3485,8 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", UPARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "end", 1);
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", DOWNARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "end", 0);
- RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "end", 1);
- RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "end", 0);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", 1);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", 0);
WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", UPARROWKEY, KM_PRESS, 0, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", DOWNARROWKEY, KM_PRESS, 0, 0)->ptr, "next", 0);
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 09873566d4a..9500c7f663c 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -322,8 +322,8 @@ static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if (br->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
}
return 1;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index ced3dd00a9c..669a9c6fdcb 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -3330,7 +3330,7 @@ static void sculpt_restore_mesh(Sculpt *sd, SculptSession *ss)
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
copy_v3_v3(vd.co, unode->co[vd.i]);
- if(vd.no) VECCOPY(vd.no, unode->no[vd.i])
+ if(vd.no) copy_v3_v3_short(vd.no, unode->no[vd.i]);
else normal_short_to_float_v3(vd.fno, unode->no[vd.i]);
if(vd.mvert) vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index c4ea5c9478c..a13b874e504 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -300,7 +300,7 @@ SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node)
BLI_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_ALL) {
copy_v3_v3(unode->co[vd.i], vd.co);
- if(vd.no) VECCOPY(unode->no[vd.i], vd.no)
+ if(vd.no) copy_v3_v3_short(unode->no[vd.i], vd.no);
else normal_float_to_short_v3(unode->no[vd.i], vd.fno);
if(vd.vert_indices) unode->index[vd.i]= vd.vert_indices[vd.i];
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index 72dbbd9da9a..19cae6aa67d 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -691,7 +691,7 @@ static int bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
update_animation_flags_exec(C, NULL);
- for(cfra = scene->r.sfra; cfra <= scene->r.efra; cfra++)
+ for(cfra = scene->r.sfra > 0 ? scene->r.sfra - 1 : 0; cfra <= scene->r.efra + 1; cfra++)
{
scene->r.cfra = cfra;
scene_update_for_newframe(bmain, scene, scene->lay);
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 9fecfda7764..0080317aece 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -239,7 +239,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
static void draw_tile(int sx, int sy, int width, int height, int colorid, int shade)
{
UI_ThemeColorShade(colorid, shade);
- uiSetRoundBox(15);
+ uiSetRoundBox(UI_CNR_ALL);
uiRoundBox((float)sx, (float)(sy - height), (float)(sx + width), (float)sy, 5.0f);
}
@@ -507,7 +507,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
draw_tile(sx, sy-1, layout->tile_w+4, sfile->layout->tile_h+layout->tile_border_y, colorid, shade);
}
}
- uiSetRoundBox(0);
+ uiSetRoundBox(UI_CNR_NONE);
if ( FILE_IMGDISPLAY == params->display ) {
is_icon = 0;
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 7382188d62a..c7ada4a5801 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1158,8 +1158,8 @@ void filelist_from_main(struct FileList *filelist)
/* XXXXX TODO: if databrowse F4 or append/link filelist->hide_parent has to be set */
if (!filelist->hide_parent) filelist->numfiles+= 1;
- filelist->filelist= (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry));
-
+ filelist->filelist= filelist->numfiles > 0 ? (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry)) : NULL;
+
files = filelist->filelist;
if (!filelist->hide_parent) {
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index 20b001965aa..43a8747e942 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -718,6 +718,8 @@ static const char *actuator_name(int type)
return "State";
case ACT_ARMATURE:
return "Armature";
+ case ACT_STEERING:
+ return "Steering";
}
return "unknown";
}
@@ -4345,6 +4347,48 @@ static void draw_actuator_visibility(uiLayout *layout, PointerRNA *ptr)
uiItemR(row, ptr, "apply_to_children", 0, NULL, ICON_NONE);
}
+static void draw_actuator_steering(uiLayout *layout, PointerRNA *ptr)
+{
+ uiLayout *row;
+ uiLayout *col;
+
+ uiItemR(layout, ptr, "mode", 0, NULL, 0);
+ uiItemR(layout, ptr, "target", 0, NULL, 0);
+ uiItemR(layout, ptr, "navmesh", 0, NULL, 0);
+
+ row = uiLayoutRow(layout, 0);
+ uiItemR(row, ptr, "distance", 0, NULL, 0);
+ uiItemR(row, ptr, "velocity", 0, NULL, 0);
+ row = uiLayoutRow(layout, 0);
+ uiItemR(row, ptr, "acceleration", 0, NULL, 0);
+ uiItemR(row, ptr, "turn_speed", 0, NULL, 0);
+
+ row = uiLayoutRow(layout, 0);
+ col = uiLayoutColumn(row, 0);
+ uiItemR(col, ptr, "facing", 0, NULL, 0);
+ col = uiLayoutColumn(row, 0);
+ uiItemR(col, ptr, "facing_axis", 0, NULL, 0);
+ if (!RNA_boolean_get(ptr, "facing"))
+ {
+ uiLayoutSetActive(col, 0);
+ }
+ col = uiLayoutColumn(row, 0);
+ uiItemR(col, ptr, "normal_up", 0, NULL, 0);
+ if (!RNA_pointer_get(ptr, "navmesh").data)
+ {
+ uiLayoutSetActive(col, 0);
+ }
+
+ row = uiLayoutRow(layout, 0);
+ uiItemR(row, ptr, "self_terminated", 0, NULL, 0);
+ if (RNA_enum_get(ptr, "mode")==ACT_STEERING_PATHFOLLOWING)
+ {
+ uiItemR(row, ptr, "update_period", 0, NULL, 0);
+ row = uiLayoutRow(layout, 0);
+ }
+ uiItemR(row, ptr, "show_visualization", 0, NULL, 0);
+}
+
static void draw_brick_actuator(uiLayout *layout, PointerRNA *ptr, bContext *C)
{
uiLayout *box;
@@ -4406,6 +4450,8 @@ static void draw_brick_actuator(uiLayout *layout, PointerRNA *ptr, bContext *C)
case ACT_VISIBILITY:
draw_actuator_visibility(box, ptr);
break;
+ case ACT_STEERING:
+ draw_actuator_steering(box, ptr);
}
}
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 0c9c7877ddc..6af43e7618d 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -376,7 +376,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStr
if (nonSolo == 0) {
/* strip is in normal track */
glColor3fv(color);
- uiSetRoundBox(15); /* all corners rounded */
+ uiSetRoundBox(UI_CNR_ALL); /* all corners rounded */
uiDrawBoxShade(GL_POLYGON, strip->start, yminc, strip->end, ymaxc, 0.0, 0.5, 0.1);
}
@@ -811,7 +811,7 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
offset += 7 * indent;
/* only on top two corners, to show that this channel sits on top of the preceding ones */
- uiSetRoundBox((1|2));
+ uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
/* draw slightly shifted up vertically to look like it has more separtion from other channels,
* but we then need to slightly shorten it so that it doesn't look like it overlaps
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index c33316620eb..e9b45da6bce 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -226,7 +226,7 @@ static void borderselect_nla_strips (bAnimContext *ac, rcti rect, short mode, sh
SpaceNla *snla = (SpaceNla *)ac->sl;
View2D *v2d= &ac->ar->v2d;
rctf rectf;
- float ymin=(float)(-NLACHANNEL_HEIGHT(snla)), ymax=0;
+ float ymin /* =(float)(-NLACHANNEL_HEIGHT(snla)) */ /* UNUSED */, ymax=0;
/* convert border-region to view coordinates */
UI_view2d_region_to_view(v2d, rect.xmin, rect.ymin+2, &rectf.xmin, &rectf.ymin);
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 0d2ec7c646f..9ea1e8ee877 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -305,7 +305,7 @@ static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA
if(_sample_col) {
cumap->flag |= CUMA_DRAW_SAMPLE;
- VECCOPY(cumap->sample, _sample_col);
+ copy_v3_v3(cumap->sample, _sample_col);
}
else
cumap->flag &= ~CUMA_DRAW_SAMPLE;
@@ -639,7 +639,7 @@ static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *nt
float colw= 0.6f*node_group_frame;
float col1= 6 - node_group_frame;
float col2= col1 + colw+6;
- float col3= node_group_frame - arrowbutw - 6;
+ float col3= - arrowbutw - 6;
/* layout stuff for buttons on group right frame */
float cor1= 6;
float cor2= cor1 + arrowbutw + 6;
@@ -660,6 +660,7 @@ static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *nt
* 1) input: not internal
* 2) output: (node type uses const outputs) and (group output is unlinked)
*/
+ draw_value = 0;
switch (in_out) {
case SOCK_IN:
draw_value = !(gsock && (gsock->flag & SOCK_INTERNAL));
@@ -667,8 +668,6 @@ static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *nt
case SOCK_OUT:
if (gnode->typeinfo->flag & NODE_CONST_OUTPUT)
draw_value = !(gsock && gsock->link);
- else
- draw_value = 0;
break;
}
if (draw_value) {
@@ -713,7 +712,7 @@ static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *nt
uiBlockSetDirection(gnode->block, 0);
/* remove button */
- offset = (in_out==SOCK_IN ? col3 : col1);
+ offset = (in_out==SOCK_IN ? col3 : cor1);
uiBlockSetEmboss(gnode->block, UI_EMBOSSN);
bt = uiDefIconButO(gnode->block, BUT, "NODE_OT_group_socket_remove", 0, ICON_X,
gsock->locx+offset, gsock->locy-0.5f*arrowbutw, arrowbutw, arrowbutw, "");
@@ -742,23 +741,23 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
/* backdrop header */
glEnable(GL_BLEND);
- uiSetRoundBox(3);
+ uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
UI_ThemeColorShadeAlpha(TH_NODE_GROUP, 0, -70);
uiDrawBox(GL_POLYGON, rect.xmin-node_group_frame, rect.ymax, rect.xmax+node_group_frame, rect.ymax+group_header, BASIS_RAD);
/* backdrop body */
UI_ThemeColorShadeAlpha(TH_BACK, -8, -70);
- uiSetRoundBox(0);
+ uiSetRoundBox(UI_CNR_NONE);
uiDrawBox(GL_POLYGON, rect.xmin, rect.ymin, rect.xmax, rect.ymax, BASIS_RAD);
/* input column */
UI_ThemeColorShadeAlpha(TH_BACK, 10, -50);
- uiSetRoundBox(8);
+ uiSetRoundBox(UI_CNR_BOTTOM_LEFT);
uiDrawBox(GL_POLYGON, rect.xmin-node_group_frame, rect.ymin, rect.xmin, rect.ymax, BASIS_RAD);
/* output column */
UI_ThemeColorShadeAlpha(TH_BACK, 10, -50);
- uiSetRoundBox(4);
+ uiSetRoundBox(UI_CNR_BOTTOM_RIGHT);
uiDrawBox(GL_POLYGON, rect.xmax, rect.ymin, rect.xmax+node_group_frame, rect.ymax, BASIS_RAD);
/* input column separator */
@@ -776,7 +775,7 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
glEnd();
/* group node outline */
- uiSetRoundBox(15);
+ uiSetRoundBox(UI_CNR_ALL);
glColor4ub(200, 200, 200, 140);
glEnable( GL_LINE_SMOOTH );
uiDrawBox(GL_LINE_LOOP, rect.xmin-node_group_frame, rect.ymin, rect.xmax+node_group_frame, rect.ymax+group_header, BASIS_RAD);
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 6be8978cb5b..c1b114d5436 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -220,7 +220,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
PointerRNA ptr;
bNodeSocket *nsock;
float locx, locy;
- float dy= locy;
+ float dy;
int buty;
/* get "global" coords */
@@ -568,7 +568,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
return;
}
- uiSetRoundBox(15-4);
+ uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_LEFT);
ui_dropshadow(rct, BASIS_RAD, snode->aspect, node->flag & SELECT);
/* header */
@@ -580,7 +580,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
if(node->flag & NODE_MUTED)
UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f);
- uiSetRoundBox(3);
+ uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
uiRoundBox(rct->xmin, rct->ymax-NODE_DY, rct->xmax, rct->ymax, BASIS_RAD);
/* show/hide icons, note this sequence is copied in do_header_node() node_state.c */
@@ -648,7 +648,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
/* body */
UI_ThemeColor4(TH_NODE);
glEnable(GL_BLEND);
- uiSetRoundBox(8);
+ uiSetRoundBox(UI_CNR_BOTTOM_LEFT);
uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax-NODE_DY, BASIS_RAD);
glDisable(GL_BLEND);
@@ -664,7 +664,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, -40);
else
UI_ThemeColorShadeAlpha(TH_TEXT_HI, -20, -120);
- uiSetRoundBox(15-4); // round all corners except lower right
+ uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_LEFT); // round all corners except lower right
uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD);
glDisable( GL_LINE_SMOOTH );
@@ -745,7 +745,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
char showname[128]; /* 128 is used below */
/* shadow */
- uiSetRoundBox(15);
+ uiSetRoundBox(UI_CNR_ALL);
ui_dropshadow(rct, hiddenrad, snode->aspect, node->flag & SELECT);
/* body */
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index b5633d50997..5f58f540aae 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -447,9 +447,8 @@ void snode_set_context(SpaceNode *snode, Scene *scene)
else if(snode->treetype==NTREE_COMPOSIT) {
snode->id= &scene->id;
- /* bit clumsy but reliable way to see if we draw first time */
- if(snode->nodetree==NULL)
- ntreeCompositForceHidden(scene->nodetree, scene);
+ /* update output sockets based on available layers */
+ ntreeCompositForceHidden(scene->nodetree, scene);
}
else if(snode->treetype==NTREE_TEXTURE) {
Tex *tx= NULL;
@@ -608,28 +607,45 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
static int compare_nodes(bNode *a, bNode *b)
{
bNode *parent;
+ /* These tell if either the node or any of the parent nodes is selected.
+ * A selected parent means an unselected node is also in foreground!
+ */
+ int a_select=(a->flag & NODE_SELECT), b_select=(b->flag & NODE_SELECT);
+ int a_active=(a->flag & NODE_ACTIVE), b_active=(b->flag & NODE_ACTIVE);
/* if one is an ancestor of the other */
/* XXX there might be a better sorting algorithm for stable topological sort, this is O(n^2) worst case */
for (parent = a->parent; parent; parent=parent->parent) {
+ /* if b is an ancestor, it is always behind a */
if (parent==b)
return 1;
+ /* any selected ancestor moves the node forward */
+ if (parent->flag & NODE_ACTIVE)
+ a_active = 1;
+ if (parent->flag & NODE_SELECT)
+ a_select = 1;
}
for (parent = b->parent; parent; parent=parent->parent) {
+ /* if a is an ancestor, it is always behind b */
if (parent==a)
return 0;
+ /* any selected ancestor moves the node forward */
+ if (parent->flag & NODE_ACTIVE)
+ b_active = 1;
+ if (parent->flag & NODE_SELECT)
+ b_select = 1;
}
/* if one of the nodes is in the background and the other not */
- if ((a->flag & NODE_BACKGROUND) && !(b->typeinfo->flag & NODE_BACKGROUND))
+ if ((a->flag & NODE_BACKGROUND) && !(b->flag & NODE_BACKGROUND))
return 0;
- else if (!(a->flag & NODE_BACKGROUND) && (b->typeinfo->flag & NODE_BACKGROUND))
+ else if (!(a->flag & NODE_BACKGROUND) && (b->flag & NODE_BACKGROUND))
return 1;
/* if one has a higher selection state (active > selected > nothing) */
- if (!(b->flag & NODE_ACTIVE) && (a->flag & NODE_ACTIVE))
+ if (!b_active && a_active)
return 1;
- else if (!(b->flag & NODE_SELECT) && ((a->flag & NODE_ACTIVE) || (a->flag & NODE_SELECT)))
+ else if (!b_select && (a_active || a_select))
return 1;
return 0;
@@ -776,7 +792,7 @@ static int edit_node_invoke_properties(bContext *C, wmOperator *op)
static void edit_node_properties_get(wmOperator *op, bNodeTree *ntree, bNode **rnode, bNodeSocket **rsock, int *rin_out)
{
bNode *node;
- bNodeSocket *sock;
+ bNodeSocket *sock=NULL;
char nodename[32];
int sockindex;
int in_out;
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 95a315272b9..357730aff39 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -97,7 +97,7 @@ static void outliner_height(SpaceOops *soops, ListBase *lb, int *h)
TreeElement *te= lb->first;
while(te) {
TreeStoreElem *tselem= TREESTORE(te);
- if((tselem->flag & TSE_CLOSED)==0)
+ if(TSELEM_OPEN(tselem,soops))
outliner_height(soops, &te->subtree, h);
(*h) += UI_UNIT_Y;
te= te->next;
@@ -112,7 +112,7 @@ static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
// TreeStoreElem *tselem= TREESTORE(te);
// XXX fixme... te->xend is not set yet
- if(tselem->flag & TSE_CLOSED) {
+ if(!TSELEM_OPEN(tselem,soops)) {
if (te->xend > *w)
*w = te->xend;
}
@@ -135,7 +135,7 @@ static void outliner_rna_width(SpaceOops *soops, ListBase *lb, int *w, int start
if(startx+100 > *w)
*w = startx+100;
- if((tselem->flag & TSE_CLOSED)==0)
+ if(TSELEM_OPEN(tselem,soops))
outliner_rna_width(soops, &te->subtree, w, startx+UI_UNIT_X);
te= te->next;
}
@@ -519,7 +519,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
}
}
- if((tselem->flag & TSE_CLOSED)==0) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree);
+ if(TSELEM_OPEN(tselem,soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree);
}
}
@@ -560,7 +560,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
ptr= &te->rnaptr;
prop= te->directdata;
- if(!(RNA_property_type(prop) == PROP_POINTER && (tselem->flag & TSE_CLOSED)==0))
+ if(!(RNA_property_type(prop) == PROP_POINTER && (TSELEM_OPEN(tselem,soops))) )
uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, (int)te->ys, OL_RNA_COL_SIZEX, UI_UNIT_Y-1);
}
else if(tselem->type == TSE_RNA_ARRAY_ELEM) {
@@ -571,7 +571,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
}
}
- if((tselem->flag & TSE_CLOSED)==0) outliner_draw_rnabuts(block, scene, ar, soops, sizex, &te->subtree);
+ if(TSELEM_OPEN(tselem,soops)) outliner_draw_rnabuts(block, scene, ar, soops, sizex, &te->subtree);
}
}
@@ -828,7 +828,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
}
}
- if((tselem->flag & TSE_CLOSED)==0) outliner_draw_keymapbuts(block, ar, soops, &te->subtree);
+ if(TSELEM_OPEN(tselem,soops)) outliner_draw_keymapbuts(block, ar, soops, &te->subtree);
}
}
@@ -871,7 +871,7 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa
}
}
- if((tselem->flag & TSE_CLOSED)==0) outliner_buttons(C, block, ar, soops, &te->subtree);
+ if(TSELEM_OPEN(tselem,soops)) outliner_buttons(C, block, ar, soops, &te->subtree);
}
}
@@ -1182,7 +1182,7 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa
if(active) {
float ufac= UI_UNIT_X/20.0f;
- uiSetRoundBox(15);
+ uiSetRoundBox(UI_CNR_ALL);
glColor4ub(255, 255, 255, 100);
uiRoundBox( (float)*offsx-0.5f*ufac, (float)ys-1.0f*ufac, (float)*offsx+UI_UNIT_Y-3.0f*ufac, (float)ys+UI_UNIT_Y-3.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac);
glEnable(GL_BLEND); /* roundbox disables */
@@ -1237,6 +1237,18 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
glEnable(GL_BLEND);
+ /* start by highlighting search matches
+ * we don't expand items when searching in the datablocks but we
+ * still want to highlight any filter matches.
+ */
+ if ( (SEARCHING_OUTLINER(soops) || (soops->outlinevis==SO_DATABLOCKS && soops->search_string[0]!=0)) &&
+ (tselem->flag & TSE_SEARCHMATCH))
+ {
+ /* TODO - add search highlight colour to theme? */
+ glColor4f(0.2f, 0.5f, 0.2f, 0.3f);
+ glRecti(startx, *starty+1, ar->v2d.cur.xmax, *starty+UI_UNIT_Y-1);
+ }
+
/* colors for active/selected data */
if(tselem->type==0) {
if(te->idcode==ID_SCE) {
@@ -1301,7 +1313,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
/* active circle */
if(active) {
- uiSetRoundBox(15);
+ uiSetRoundBox(UI_CNR_ALL);
uiRoundBox( (float)startx+UI_UNIT_Y-1.5f*ufac, (float)*starty+2.0f*ufac, (float)startx+2.0f*UI_UNIT_Y-4.0f*ufac, (float)*starty+UI_UNIT_Y-1.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac);
glEnable(GL_BLEND); /* roundbox disables it */
@@ -1317,10 +1329,10 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
icon_x = startx+5*ufac;
// icons a bit higher
- if(tselem->flag & TSE_CLOSED)
- UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_RIGHT);
- else
+ if(TSELEM_OPEN(tselem,soops))
UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_DOWN);
+ else
+ UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_RIGHT);
}
offsx+= UI_UNIT_X;
@@ -1356,7 +1368,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
offsx+= (int)(UI_UNIT_X + UI_GetStringWidth(te->name));
/* closed item, we draw the icons, not when it's a scene, or master-server list though */
- if(tselem->flag & TSE_CLOSED) {
+ if(!TSELEM_OPEN(tselem,soops)) {
if(te->subtree.first) {
if(tselem->type==0 && te->idcode==ID_SCE);
else if(tselem->type!=TSE_R_LAYER) { /* this tree element always has same amount of branches, so dont draw */
@@ -1382,7 +1394,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
te->ys= (float)*starty;
te->xend= startx+offsx;
- if((tselem->flag & TSE_CLOSED)==0) {
+ if(TSELEM_OPEN(tselem,soops)) {
*starty-= UI_UNIT_Y;
for(ten= te->subtree.first; ten; ten= ten->next)
@@ -1415,7 +1427,7 @@ static void outliner_draw_hierarchy(SpaceOops *soops, ListBase *lb, int startx,
*starty-= UI_UNIT_Y;
- if((tselem->flag & TSE_CLOSED)==0)
+ if(TSELEM_OPEN(tselem,soops))
outliner_draw_hierarchy(soops, &te->subtree, startx+UI_UNIT_X, starty);
}
@@ -1439,12 +1451,12 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase *
tselem= TREESTORE(te);
/* selection status */
- if((tselem->flag & TSE_CLOSED)==0)
+ if(TSELEM_OPEN(tselem,soops))
if(tselem->type == TSE_RNA_STRUCT)
glRecti(0, *starty+1, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, *starty+UI_UNIT_Y-1);
*starty-= UI_UNIT_Y;
- if((tselem->flag & TSE_CLOSED)==0) {
+ if(TSELEM_OPEN(tselem,soops)) {
outliner_draw_struct_marks(ar, soops, &te->subtree, starty);
if(tselem->type == TSE_RNA_STRUCT)
fdrawline(0, (float)*starty+UI_UNIT_Y, ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, (float)*starty+UI_UNIT_Y);
@@ -1465,7 +1477,7 @@ static void outliner_draw_selection(ARegion *ar, SpaceOops *soops, ListBase *lb,
glRecti(0, *starty+1, (int)ar->v2d.cur.xmax, *starty+UI_UNIT_Y-1);
}
*starty-= UI_UNIT_Y;
- if((tselem->flag & TSE_CLOSED)==0) outliner_draw_selection(ar, soops, &te->subtree, starty);
+ if(TSELEM_OPEN(tselem,soops)) outliner_draw_selection(ar, soops, &te->subtree, starty);
}
}
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 2b451a48748..05eace0d4ef 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -687,7 +687,7 @@ static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te,
te->ys= (float)(*starty);
*starty-= UI_UNIT_Y;
- if((tselem->flag & TSE_CLOSED)==0) {
+ if(TSELEM_OPEN(tselem,soops)) {
TreeElement *ten;
for(ten= te->subtree.first; ten; ten= ten->next) {
outliner_set_coordinates_element(soops, ten, startx+UI_UNIT_X, starty);
@@ -910,7 +910,7 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase
}
else tselem->flag |= TSE_CLOSED;
- if(tselem->flag & TSE_CLOSED); else tree_element_show_hierarchy(scene, soops, &te->subtree);
+ if(TSELEM_OPEN(tselem,soops)) tree_element_show_hierarchy(scene, soops, &te->subtree);
}
}
@@ -1175,7 +1175,7 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportL
}
/* go over sub-tree */
- if ((tselem->flag & TSE_CLOSED)==0)
+ if (TSELEM_OPEN(tselem,soops))
do_outliner_drivers_editop(soops, &te->subtree, reports, mode);
}
}
@@ -1343,7 +1343,7 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
}
/* go over sub-tree */
- if ((tselem->flag & TSE_CLOSED)==0)
+ if (TSELEM_OPEN(tselem,soops))
do_outliner_keyingset_editop(soops, ks, &te->subtree, mode);
}
}
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 61507d1ffe5..215ab508ab6 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -126,6 +126,27 @@ typedef struct TreeElement {
#define OL_RNA_COL_SPACEX (UI_UNIT_X*2.5f)
+/* Outliner Searching --
+
+ Are we looking for something in the outliner?
+ If so finding matches in child items makes it more useful
+
+ - We want to flag parents to act as being open to filter child matches
+ - and also flag matches so we can highlight them
+ - Flags are stored in TreeStoreElem->flag
+ - Flag options defined in DNA_outliner_types.h
+ - SO_SEARCH_RECURSIVE defined in DNA_space_types.h
+
+ - NOT in datablocks view - searching all datablocks takes way too long
+ to be useful
+ - not searching into RNA items helps but isn't the complete solution
+ */
+
+#define SEARCHING_OUTLINER(sov) (sov->search_flags & SO_SEARCH_RECURSIVE)
+
+/* is the currrent element open? if so we also show children */
+#define TSELEM_OPEN(telm,sv) ( (telm->flag & TSE_CLOSED)==0 || (SEARCHING_OUTLINER(sv) && (telm->flag & TSE_CHILDSEARCH)) )
+
/* outliner_tree.c ----------------------------------------------- */
void outliner_free_tree(ListBase *lb);
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 2c0a8c34747..a88625aad0d 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -134,7 +134,7 @@ static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *se
change |= 1;
}
}
- else if ((tselem->flag & TSE_CLOSED)==0) {
+ else if (TSELEM_OPEN(tselem,soops)) {
/* Only try selecting sub-elements if we haven't hit the right element yet
*
* Hack warning:
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index b3170f9cd1e..b2fdd34aab2 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -145,7 +145,7 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb,
}
}
}
- if((tselem->flag & TSE_CLOSED)==0) {
+ if(TSELEM_OPEN(tselem,soops)) {
set_operation_types(soops, &te->subtree,
scenelevel, objectlevel, idlevel, datalevel);
}
@@ -250,7 +250,7 @@ static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops *
operation_cb(C, scene, te, tsep, tselem);
}
}
- if((tselem->flag & TSE_CLOSED)==0) {
+ if(TSELEM_OPEN(tselem,soops)) {
outliner_do_libdata_operation(C, scene, soops, &te->subtree, operation_cb);
}
}
@@ -397,7 +397,7 @@ void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOops *soop
operation_cb(C, scene_owner ? scene_owner : scene_act, te, NULL, tselem);
}
}
- if((tselem->flag & TSE_CLOSED)==0) {
+ if(TSELEM_OPEN(tselem,soops)) {
outliner_do_object_operation(C, scene_act, soops, &te->subtree, operation_cb);
}
}
@@ -504,7 +504,7 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li
operation_cb(event, te, tselem);
}
}
- if((tselem->flag & TSE_CLOSED)==0) {
+ if(TSELEM_OPEN(tselem,soops)) {
outliner_do_data_operation(soops, type, event, &te->subtree, operation_cb);
}
}
@@ -857,7 +857,7 @@ static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *l
operation_cb(te, tselem, tsep, newid);
}
}
- if ((tselem->flag & TSE_CLOSED)==0) {
+ if (TSELEM_OPEN(tselem,soops)) {
outliner_do_id_set_operation(soops, type, &te->subtree, newid, operation_cb);
}
}
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 8904dcc360f..7e9eabc08db 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -827,6 +827,10 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
check_persistant(soops, te, id, type, index);
tselem= TREESTORE(te);
+ /* if we are searching for something expand to see child elements */
+ if(SEARCHING_OUTLINER(soops))
+ tselem->flag |= TSE_CHILDSEARCH;
+
te->parent= parent;
te->index= index; // for data arays
if(ELEM3(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP));
@@ -981,6 +985,9 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
else
te->name= (char*)RNA_struct_ui_name(ptr->type);
+ /* If searching don't expand RNA entries */
+ if(SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
+
iterprop= RNA_struct_iterator_property(ptr->type);
tot= RNA_property_collection_length(ptr, iterprop);
@@ -989,7 +996,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
if(!tselem->used)
tselem->flag &= ~TSE_CLOSED;
- if(!(tselem->flag & TSE_CLOSED)) {
+ if(TSELEM_OPEN(tselem,soops)) {
for(a=0; a<tot; a++)
outliner_add_element(soops, &te->subtree, (void*)ptr, te, TSE_RNA_PROPERTY, a);
}
@@ -1010,11 +1017,14 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
te->directdata= prop;
te->rnaptr= *ptr;
+ /* If searching don't expand RNA entries */
+ if(SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
+
if(proptype == PROP_POINTER) {
pptr= RNA_property_pointer_get(ptr, prop);
if(pptr.data) {
- if(!(tselem->flag & TSE_CLOSED))
+ if(TSELEM_OPEN(tselem,soops))
outliner_add_element(soops, &te->subtree, (void*)&pptr, te, TSE_RNA_STRUCT, -1);
else
te->flag |= TE_LAZY_CLOSED;
@@ -1023,7 +1033,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
else if(proptype == PROP_COLLECTION) {
tot= RNA_property_collection_length(ptr, prop);
- if(!(tselem->flag & TSE_CLOSED)) {
+ if(TSELEM_OPEN(tselem,soops)) {
for(a=0; a<tot; a++) {
RNA_property_collection_lookup_int(ptr, prop, a, &pptr);
outliner_add_element(soops, &te->subtree, (void*)&pptr, te, TSE_RNA_STRUCT, a);
@@ -1035,7 +1045,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
else if(ELEM3(proptype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
tot= RNA_property_array_length(ptr, prop);
- if(!(tselem->flag & TSE_CLOSED)) {
+ if(TSELEM_OPEN(tselem,soops)) {
for(a=0; a<tot; a++)
outliner_add_element(soops, &te->subtree, (void*)ptr, te, TSE_RNA_ARRAY_ELEM, a);
}
@@ -1068,7 +1078,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
te->directdata= idv;
te->name= km->idname;
- if(!(tselem->flag & TSE_CLOSED)) {
+ if(TSELEM_OPEN(tselem,soops)) {
a= 0;
for (kmi= km->items.first; kmi; kmi= kmi->next, a++) {
@@ -1368,7 +1378,10 @@ static int outliner_filter_tree(SpaceOops *soops, ListBase *lb)
*/
tselem= TREESTORE(te);
- if ((tselem->flag & TSE_CLOSED) || outliner_filter_tree(soops, &te->subtree)==0) {
+ /* flag as not a found item */
+ tselem->flag &= ~TSE_SEARCHMATCH;
+
+ if ((!TSELEM_OPEN(tselem,soops)) || outliner_filter_tree(soops, &te->subtree)==0) {
outliner_free_tree(&te->subtree);
BLI_remlink(lb, te);
@@ -1377,6 +1390,11 @@ static int outliner_filter_tree(SpaceOops *soops, ListBase *lb)
}
}
else {
+ tselem= TREESTORE(te);
+
+ /* flag as a found item - we can then highlight it */
+ tselem->flag |= TSE_SEARCHMATCH;
+
/* filter subtree too */
outliner_filter_tree(soops, &te->subtree);
}
@@ -1399,6 +1417,14 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
TreeStoreElem *tselem;
int show_opened= (soops->treestore==NULL); /* on first view, we open scenes */
+ /* Are we looking for something - we want to tag parents to filter child matches
+ - NOT in datablocks view - searching all datablocks takes way too long to be useful
+ - this variable is only set once per tree build */
+ if(soops->search_string[0]!=0 && soops->outlinevis!=SO_DATABLOCKS)
+ soops->search_flags |= SO_SEARCH_RECURSIVE;
+ else
+ soops->search_flags &= ~SO_SEARCH_RECURSIVE;
+
if(soops->tree.first && (soops->storeflag & SO_TREESTORE_REDRAW))
return;
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 299fe9df460..0f5398f24a7 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -99,7 +99,7 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[
UI_GetThemeColor3ubv(TH_SEQ_SCENE, col);
if(seq->scene==curscene) {
- UI_GetColorPtrBlendShade3ubv(col, col, col, 1.0, 20);
+ UI_GetColorPtrShade3ubv(col, col, 20);
}
break;
@@ -299,7 +299,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
glRectf(x1_chan, y1_chan, x2_chan, y2_chan);
- UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -30);
+ UI_GetColorPtrShade3ubv(col, col, -30);
glColor4ubv(col);
fdrawbox(x1_chan, y1_chan, x2_chan, y2_chan);
@@ -473,7 +473,7 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
/* feint pinstripes, helps see exactly which is extended and which isn't,
* especially when the extension is very small */
if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 24);
- else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -16);
+ else UI_GetColorPtrShade3ubv(col, col, -16);
glColor3ubv((GLubyte *)col);
@@ -490,8 +490,8 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
/* feint pinstripes, helps see exactly which is extended and which isn't,
* especially when the extension is very small */
- if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 24);
- else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -16);
+ if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, 24);
+ else UI_GetColorPtrShade3ubv(col, col, -16);
glColor3ubv((GLubyte *)col);
@@ -584,8 +584,8 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa
glBegin(GL_QUADS);
if(seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; }
- else if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -50);
- else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 0);
+ else if(seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -50);
+ /* else UI_GetColorPtrShade3ubv(col, col, 0); */ /* DO NOTHING */
glColor3ubv(col);
@@ -594,7 +594,7 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa
if(seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; }
else if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 5);
- else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -5);
+ else UI_GetColorPtrShade3ubv(col, col, -5);
glColor3ubv((GLubyte *)col);
@@ -610,8 +610,8 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa
glVertex2f(x1,ymid2);
glVertex2f(x2,ymid2);
- if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -15);
- else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 25);
+ if(seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -15);
+ else UI_GetColorPtrShade3ubv(col, col, 25);
glColor3ubv((GLubyte *)col);
@@ -697,10 +697,10 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
col[0]= 255; col[1]= col[2]= 40;
}
else
- UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 120+outline_tint);
+ UI_GetColorPtrShade3ubv(col, col, 120+outline_tint);
}
else
- UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, outline_tint);
+ UI_GetColorPtrShade3ubv(col, col, outline_tint);
glColor3ubv((GLubyte *)col);
@@ -914,7 +914,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- uiSetRoundBox(15);
+ uiSetRoundBox(UI_CNR_ALL);
uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 066404f23ba..3d49bc7ffa0 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -1190,7 +1190,7 @@ static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back)
uiWidgetScrollDraw(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT)?UI_SCROLL_PRESSED:0);
- uiSetRoundBox(15);
+ uiSetRoundBox(UI_CNR_ALL);
rad= 0.4f*MIN2(st->txtscroll.xmax - st->txtscroll.xmin, st->txtscroll.ymax - st->txtscroll.ymin);
UI_GetThemeColor3ubv(TH_HILITE, col);
col[3]= 48;
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index ecf5df4af7c..fc35ab93f70 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -85,7 +85,7 @@ enum {
PCHAN_COLOR_SPHEREBONE_BASE, /* for the 'stick' of sphere (envelope) bones */
PCHAN_COLOR_SPHEREBONE_END, /* for the ends of sphere (envelope) bones */
PCHAN_COLOR_LINEBONE /* for the middle of line-bones */
-};
+};
/* This function sets the color-set for coloring a certain bone */
static void set_pchan_colorset (Object *ob, bPoseChannel *pchan)
@@ -437,43 +437,64 @@ static void draw_bonevert_solid(void)
glCallList(displist);
}
+static float bone_octahedral_verts[6][3]= {
+ { 0.0f, 0.0f, 0.0f},
+ { 0.1f, 0.1f, 0.1f},
+ { 0.1f, 0.1f, -0.1f},
+ {-0.1f, 0.1f, -0.1f},
+ {-0.1f, 0.1f, 0.1f},
+ { 0.0f, 1.0f, 0.0f}
+};
+
+static unsigned int bone_octahedral_wire_sides[8]= {0, 1, 5, 3, 0, 4, 5, 2};
+static unsigned int bone_octahedral_wire_square[8]= {1, 2, 3, 4, 1};
+
+static unsigned int bone_octahedral_solid_tris[8][3]= {
+ {2, 1, 0}, /* bottom */
+ {3, 2, 0},
+ {4, 3, 0},
+ {1, 4, 0},
+
+ {5, 1, 2}, /* top */
+ {5, 2, 3},
+ {5, 3, 4},
+ {5, 4, 1}
+};
+
+/* aligned with bone_octahedral_solid_tris */
+static float bone_octahedral_solid_normals[8][3]= {
+ { 0.70710683f, -0.70710683f, 0.00000000f},
+ {-0.00000000f, -0.70710683f, -0.70710683f},
+ {-0.70710683f, -0.70710683f, 0.00000000f},
+ { 0.00000000f, -0.70710683f, 0.70710683f},
+ { 0.99388373f, 0.11043154f, -0.00000000f},
+ { 0.00000000f, 0.11043154f, -0.99388373f},
+ {-0.99388373f, 0.11043154f, 0.00000000f},
+ { 0.00000000f, 0.11043154f, 0.99388373f}
+};
+
static void draw_bone_octahedral(void)
{
static GLuint displist=0;
if (displist == 0) {
- float vec[6][3];
-
displist= glGenLists(1);
glNewList(displist, GL_COMPILE);
-
- vec[0][0]= vec[0][1]= vec[0][2]= 0.0f;
- vec[5][0]= vec[5][2]= 0.0f; vec[5][1]= 1.0f;
-
- vec[1][0]= 0.1f; vec[1][2]= 0.1f; vec[1][1]= 0.1f;
- vec[2][0]= 0.1f; vec[2][2]= -0.1f; vec[2][1]= 0.1f;
- vec[3][0]= -0.1f; vec[3][2]= -0.1f; vec[3][1]= 0.1f;
- vec[4][0]= -0.1f; vec[4][2]= 0.1f; vec[4][1]= 0.1f;
-
+
/* Section 1, sides */
- glBegin(GL_LINE_LOOP);
- glVertex3fv(vec[0]);
- glVertex3fv(vec[1]);
- glVertex3fv(vec[5]);
- glVertex3fv(vec[3]);
- glVertex3fv(vec[0]);
- glVertex3fv(vec[4]);
- glVertex3fv(vec[5]);
- glVertex3fv(vec[2]);
- glEnd();
-
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(3, GL_FLOAT, 0, bone_octahedral_verts);
+ glDrawElements(GL_LINE_LOOP,
+ sizeof(bone_octahedral_wire_sides)/sizeof(*bone_octahedral_wire_sides),
+ GL_UNSIGNED_INT,
+ bone_octahedral_wire_sides);
+
/* Section 1, square */
- glBegin(GL_LINE_LOOP);
- glVertex3fv(vec[1]);
- glVertex3fv(vec[2]);
- glVertex3fv(vec[3]);
- glVertex3fv(vec[4]);
- glEnd();
+ glDrawElements(GL_LINE_LOOP,
+ sizeof(bone_octahedral_wire_square)/sizeof(*bone_octahedral_wire_square),
+ GL_UNSIGNED_INT,
+ bone_octahedral_wire_square);
+ glDisableClientState(GL_VERTEX_ARRAY);
glEndList();
}
@@ -484,59 +505,34 @@ static void draw_bone_octahedral(void)
static void draw_bone_solid_octahedral(void)
{
static GLuint displist=0;
-
+
if (displist == 0) {
- float vec[6][3], nor[3];
-
+ int i;
+
displist= glGenLists(1);
glNewList(displist, GL_COMPILE);
-
- vec[0][0]= vec[0][1]= vec[0][2]= 0.0f;
- vec[5][0]= vec[5][2]= 0.0f; vec[5][1]= 1.0f;
-
- vec[1][0]= 0.1f; vec[1][2]= 0.1f; vec[1][1]= 0.1f;
- vec[2][0]= 0.1f; vec[2][2]= -0.1f; vec[2][1]= 0.1f;
- vec[3][0]= -0.1f; vec[3][2]= -0.1f; vec[3][1]= 0.1f;
- vec[4][0]= -0.1f; vec[4][2]= 0.1f; vec[4][1]= 0.1f;
-
-
- glBegin(GL_TRIANGLES);
- /* bottom */
- normal_tri_v3( nor,vec[2], vec[1], vec[0]);
- glNormal3fv(nor);
- glVertex3fv(vec[2]); glVertex3fv(vec[1]); glVertex3fv(vec[0]);
-
- normal_tri_v3( nor,vec[3], vec[2], vec[0]);
- glNormal3fv(nor);
- glVertex3fv(vec[3]); glVertex3fv(vec[2]); glVertex3fv(vec[0]);
-
- normal_tri_v3( nor,vec[4], vec[3], vec[0]);
- glNormal3fv(nor);
- glVertex3fv(vec[4]); glVertex3fv(vec[3]); glVertex3fv(vec[0]);
- normal_tri_v3( nor,vec[1], vec[4], vec[0]);
- glNormal3fv(nor);
- glVertex3fv(vec[1]); glVertex3fv(vec[4]); glVertex3fv(vec[0]);
+#if 1
+ glBegin(GL_TRIANGLES);
+ for(i= 0; i < 8; i++) {
+ glNormal3fv(bone_octahedral_solid_normals[i]);
+ glVertex3fv(bone_octahedral_verts[bone_octahedral_solid_tris[i][0]]);
+ glVertex3fv(bone_octahedral_verts[bone_octahedral_solid_tris[i][1]]);
+ glVertex3fv(bone_octahedral_verts[bone_octahedral_solid_tris[i][2]]);
+ }
- /* top */
- normal_tri_v3( nor,vec[5], vec[1], vec[2]);
- glNormal3fv(nor);
- glVertex3fv(vec[5]); glVertex3fv(vec[1]); glVertex3fv(vec[2]);
-
- normal_tri_v3( nor,vec[5], vec[2], vec[3]);
- glNormal3fv(nor);
- glVertex3fv(vec[5]); glVertex3fv(vec[2]); glVertex3fv(vec[3]);
-
- normal_tri_v3( nor,vec[5], vec[3], vec[4]);
- glNormal3fv(nor);
- glVertex3fv(vec[5]); glVertex3fv(vec[3]); glVertex3fv(vec[4]);
-
- normal_tri_v3( nor,vec[5], vec[4], vec[1]);
- glNormal3fv(nor);
- glVertex3fv(vec[5]); glVertex3fv(vec[4]); glVertex3fv(vec[1]);
-
glEnd();
-
+
+#else /* not working because each vert needs a different normal */
+ glEnableClientState(GL_NORMAL_ARRAY);
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glNormalPointer(GL_FLOAT, 0, bone_octahedral_solid_normals);
+ glVertexPointer(3, GL_FLOAT, 0, bone_octahedral_verts);
+ glDrawElements(GL_TRIANGLES, sizeof(bone_octahedral_solid_tris)/sizeof(unsigned int), GL_UNSIGNED_INT, bone_octahedral_solid_tris);
+ glDisableClientState(GL_NORMAL_ARRAY);
+ glDisableClientState(GL_VERTEX_ARRAY);
+#endif
+
glEndList();
}
@@ -831,7 +827,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag,
if (0.0f != normalize_v3(dirvec)) {
float norvech[3], norvect[3], vec[3];
- VECCOPY(vec, dirvec);
+ copy_v3_v3(vec, dirvec);
mul_v3_fl(dirvec, head);
cross_v3_v3v3(norvech, dirvec, imat[2]);
@@ -1548,7 +1544,7 @@ static void draw_pose_dofs(Object *ob)
/* in parent-bone pose, but own restspace */
glPushMatrix();
- VECCOPY(posetrans, pchan->pose_mat[3]);
+ copy_v3_v3(posetrans, pchan->pose_mat[3]);
glTranslatef(posetrans[0], posetrans[1], posetrans[2]);
if (pchan->parent) {
@@ -1646,7 +1642,7 @@ static void bone_matrix_translate_y(float mat[][4], float y)
{
float trans[3];
- VECCOPY(trans, mat[1]);
+ copy_v3_v3(trans, mat[1]);
mul_v3_fl(trans, y);
add_v3_v3(mat[3], trans);
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 459a07d03a4..81848b2f0d9 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -139,7 +139,7 @@ static int check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
/* ************* only use while object drawing **************
* or after running ED_view3d_init_mats_rv3d
* */
-static void view3d_project_short_clip(ARegion *ar, float *vec, short *adr, int local)
+static void view3d_project_short_clip(ARegion *ar, const float vec[3], short *adr, int local)
{
RegionView3D *rv3d= ar->regiondata;
float fx, fy, vec4[4];
@@ -174,7 +174,7 @@ static void view3d_project_short_clip(ARegion *ar, float *vec, short *adr, int l
}
/* only use while object drawing */
-static void view3d_project_short_noclip(ARegion *ar, float *vec, short *adr)
+static void view3d_project_short_noclip(ARegion *ar, const float vec[3], short *adr)
{
RegionView3D *rv3d= ar->regiondata;
float fx, fy, vec4[4];
@@ -837,7 +837,7 @@ static void drawcube_size(float size)
/* this is an unused (old) cube-drawing function based on a given size */
#if 0
-static void drawcube_size(float *size)
+static void drawcube_size(const float size[3])
{
glPushMatrix();
@@ -891,7 +891,7 @@ static void drawshadbuflimits(Lamp *la, float mat[][4])
-static void spotvolume(float *lvec, float *vvec, float inp)
+static void spotvolume(float lvec[3], float vvec[3], const float inp)
{
/* camera is at 0,0,0 */
float temp[3],plane[3],mat1[3][3],mat2[3][3],mat3[3][3],mat4[3][3],q[4],co,si,angle;
@@ -920,8 +920,8 @@ static void spotvolume(float *lvec, float *vvec, float inp)
normalize_v3(&q[1]);
angle = saacos(plane[2])/2.0f;
- co = cos(angle);
- si = sqrt(1-co*co);
+ co = cosf(angle);
+ si = sqrtf(1-co*co);
q[0] = co;
q[1] *= si;
@@ -935,7 +935,7 @@ static void spotvolume(float *lvec, float *vvec, float inp)
unit_m3(mat2);
co = inp;
- si = sqrt(1-inp*inp);
+ si = sqrtf(1.0f-inp*inp);
mat2[0][0] = co;
mat2[1][0] = -si;
@@ -5079,7 +5079,7 @@ static void draw_textcurs(float textcurs[][2])
set_inverted_drawing(0);
}
-static void drawspiral(float *cent, float rad, float tmat[][4], int start)
+static void drawspiral(const float cent[3], float rad, float tmat[][4], int start)
{
float vec[3], vx[3], vy[3];
int a, tot=32;
@@ -5150,7 +5150,7 @@ static void drawcircle_size(float size)
}
/* needs fixing if non-identity matrice used */
-static void drawtube(float *vec, float radius, float height, float tmat[][4])
+static void drawtube(const float vec[3], float radius, float height, float tmat[][4])
{
float cur[3];
drawcircball(GL_LINE_LOOP, vec, radius, tmat);
@@ -5172,7 +5172,7 @@ static void drawtube(float *vec, float radius, float height, float tmat[][4])
glEnd();
}
/* needs fixing if non-identity matrice used */
-static void drawcone(float *vec, float radius, float height, float tmat[][4])
+static void drawcone(const float vec[3], float radius, float height, float tmat[][4])
{
float cur[3];
@@ -5448,7 +5448,7 @@ static void draw_box(float vec[8][3])
/* uses boundbox, function used by Ketsji */
#if 0
-static void get_local_bounds(Object *ob, float *center, float *size)
+static void get_local_bounds(Object *ob, float center[3], float size[3])
{
BoundBox *bb= object_get_boundbox(ob);
@@ -5885,46 +5885,68 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
/* which wire color */
if((flag & DRAW_CONSTCOLOR) == 0) {
+ /* confusing logic here, there are 2 methods of setting the color
+ * 'colortab[colindex]' and 'theme_id', colindex overrides theme_id.
+ *
+ * note: no theme yet for 'colindex' */
+ int theme_id= TH_WIRE;
+ int theme_shade= 0;
+
project_short(ar, ob->obmat[3], &base->sx);
- if( (!scene->obedit) && (G.moving & G_TRANSFORM_OBJ) && (base->flag & (SELECT+BA_WAS_SEL))) UI_ThemeColor(TH_TRANSFORM);
+ if( (scene->obedit == NULL) &&
+ (G.moving & G_TRANSFORM_OBJ) &&
+ (base->flag & (SELECT+BA_WAS_SEL)))
+ {
+ theme_id= TH_TRANSFORM;
+ }
else {
-
- if(ob->type==OB_LAMP) UI_ThemeColor(TH_LAMP);
- else if(ob->type==OB_SPEAKER) UI_ThemeColor(TH_SPEAKER);
- else UI_ThemeColor(TH_WIRE);
-
- if((scene->basact)==base) {
- if(base->flag & (SELECT+BA_WAS_SEL)) UI_ThemeColor(TH_ACTIVE);
- }
- else {
- if(base->flag & (SELECT+BA_WAS_SEL)) UI_ThemeColor(TH_SELECT);
- }
-
- // no theme yet
+ /* Sets the 'colindex' */
if(ob->id.lib) {
- if(base->flag & (SELECT+BA_WAS_SEL)) colindex = 4;
- else colindex = 3;
+ colindex= (base->flag & (SELECT+BA_WAS_SEL)) ? 4 : 3;
}
else if(warning_recursive==1) {
if(base->flag & (SELECT+BA_WAS_SEL)) {
- if(scene->basact==base) colindex = 8;
- else colindex= 7;
+ colindex= (scene->basact==base) ? 8 : 7;
}
- else colindex = 6;
- }
- else if(ob->flag & OB_FROMGROUP) {
- if(base->flag & (SELECT+BA_WAS_SEL)) {
- if(scene->basact==base) UI_ThemeColor(TH_GROUP_ACTIVE);
- else UI_ThemeColorShade(TH_GROUP_ACTIVE, -16);
+ else {
+ colindex = 6;
}
- else UI_ThemeColor(TH_GROUP);
- colindex= 0;
}
+ /* Sets the 'theme_id' or fallback to wire */
+ else {
+ if(ob->flag & OB_FROMGROUP) {
+ if(base->flag & (SELECT+BA_WAS_SEL)) {
+ /* uses darker active color for non-active + selected*/
+ theme_id= TH_GROUP_ACTIVE;
- }
+ if(scene->basact != base) {
+ theme_shade= -16;
+ }
+ }
+ else {
+ theme_id= TH_GROUP;
+ }
+ }
+ else {
+ if(base->flag & (SELECT+BA_WAS_SEL)) {
+ theme_id= scene->basact == base ? TH_ACTIVE : TH_SELECT;
+ }
+ else {
+ if(ob->type==OB_LAMP) theme_id= TH_LAMP;
+ else if(ob->type==OB_SPEAKER) theme_id= TH_SPEAKER;
+ /* fallback to TH_WIRE */
+ }
+ }
+ }
+ }
- if(colindex) {
+ /* finally set the color */
+ if(colindex == 0) {
+ if(theme_shade == 0) UI_ThemeColor(theme_id);
+ else UI_ThemeColorShade(theme_id, theme_shade);
+ }
+ else {
col= colortab[colindex];
cpack(col);
}
@@ -6009,7 +6031,6 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
if (cu->linewidth != 0.0f) {
- cpack(0xff44ff);
UI_ThemeColor(TH_WIRE);
copy_v3_v3(vec1, ob->orig);
copy_v3_v3(vec2, ob->orig);
@@ -6028,10 +6049,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
setlinestyle(3);
for (i=0; i<cu->totbox; i++) {
if (cu->tb[i].w != 0.0f) {
- if (i == (cu->actbox-1))
- UI_ThemeColor(TH_ACTIVE);
- else
- UI_ThemeColor(TH_WIRE);
+ UI_ThemeColor(i == (cu->actbox-1) ? TH_ACTIVE : TH_WIRE);
vec1[0] = (cu->xof * cu->fsize) + cu->tb[i].x;
vec1[1] = (cu->yof * cu->fsize) + cu->tb[i].y + cu->fsize;
vec1[2] = 0.001;
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index acdbcb0d06d..8da6f49e089 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -154,10 +154,10 @@ static int convex(float *p0, float *up, float *a, float *b)
{
// Vec3 va = a-p0, vb = b-p0;
float va[3], vb[3], tmp[3];
- VECSUB(va, a, p0);
- VECSUB(vb, b, p0);
+ sub_v3_v3v3(va, a, p0);
+ sub_v3_v3v3(vb, b, p0);
cross_v3_v3v3(tmp, va, vb);
- return INPR(up, tmp) >= 0;
+ return dot_v3v3(up, tmp) >= 0;
}
// copied from gpu_extension.c
@@ -280,20 +280,20 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
cv[7][1] = min[1];
cv[7][2] = min[2];
- VECCOPY(edges[0][0], cv[4]); // maxx, maxy, minz
- VECCOPY(edges[1][0], cv[5]); // minx, maxy, minz
- VECCOPY(edges[2][0], cv[6]); // minx, miny, minz
- VECCOPY(edges[3][0], cv[7]); // maxx, miny, minz
+ copy_v3_v3(edges[0][0], cv[4]); // maxx, maxy, minz
+ copy_v3_v3(edges[1][0], cv[5]); // minx, maxy, minz
+ copy_v3_v3(edges[2][0], cv[6]); // minx, miny, minz
+ copy_v3_v3(edges[3][0], cv[7]); // maxx, miny, minz
- VECCOPY(edges[4][0], cv[3]); // maxx, miny, maxz
- VECCOPY(edges[5][0], cv[2]); // minx, miny, maxz
- VECCOPY(edges[6][0], cv[6]); // minx, miny, minz
- VECCOPY(edges[7][0], cv[7]); // maxx, miny, minz
+ copy_v3_v3(edges[4][0], cv[3]); // maxx, miny, maxz
+ copy_v3_v3(edges[5][0], cv[2]); // minx, miny, maxz
+ copy_v3_v3(edges[6][0], cv[6]); // minx, miny, minz
+ copy_v3_v3(edges[7][0], cv[7]); // maxx, miny, minz
- VECCOPY(edges[8][0], cv[1]); // minx, maxy, maxz
- VECCOPY(edges[9][0], cv[2]); // minx, miny, maxz
- VECCOPY(edges[10][0], cv[6]); // minx, miny, minz
- VECCOPY(edges[11][0], cv[5]); // minx, maxy, minz
+ copy_v3_v3(edges[8][0], cv[1]); // minx, maxy, maxz
+ copy_v3_v3(edges[9][0], cv[2]); // minx, miny, maxz
+ copy_v3_v3(edges[10][0], cv[6]); // minx, miny, minz
+ copy_v3_v3(edges[11][0], cv[5]); // minx, maxy, minz
// printf("size x: %f, y: %f, z: %f\n", size[0], size[1], size[2]);
// printf("min[2]: %f, max[2]: %f\n", min[2], max[2]);
@@ -332,7 +332,7 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
*/
// get view vector
- VECCOPY(viewnormal, rv3d->viewinv[2]);
+ copy_v3_v3(viewnormal, rv3d->viewinv[2]);
normalize_v3(viewnormal);
// find cube vertex that is closest to the viewer
@@ -407,10 +407,10 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
if(dd*(float)n > ds)
break;
- VECCOPY(tmp_point, viewnormal);
+ copy_v3_v3(tmp_point, viewnormal);
mul_v3_fl(tmp_point, -dd*((ds/dd)-(float)n));
- VECADD(tmp_point2, cv[good_index], tmp_point);
- d = INPR(tmp_point2, viewnormal);
+ add_v3_v3v3(tmp_point2, cv[good_index], tmp_point);
+ d = dot_v3v3(tmp_point2, viewnormal);
// printf("my d: %f\n", d);
@@ -421,7 +421,7 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
// printf("points: %d\n", numpoints);
if (numpoints > 2) {
- VECCOPY(p0, points);
+ copy_v3_v3(p0, points);
// sort points to get a convex polygon
for(i = 1; i < numpoints - 1; i++)
@@ -431,9 +431,9 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
if(!convex(p0, viewnormal, &points[j * 3], &points[i * 3]))
{
float tmp2[3];
- VECCOPY(tmp2, &points[j * 3]);
- VECCOPY(&points[j * 3], &points[i * 3]);
- VECCOPY(&points[i * 3], tmp2);
+ copy_v3_v3(tmp2, &points[j * 3]);
+ copy_v3_v3(&points[j * 3], &points[i * 3]);
+ copy_v3_v3(&points[i * 3], tmp2);
}
}
}
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 98768e369cb..ba9faf7682e 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -150,20 +150,22 @@ void circ(float x, float y, float rad)
static void view3d_draw_clipping(RegionView3D *rv3d)
{
BoundBox *bb= rv3d->clipbb;
-
+
if(bb) {
+ static unsigned int clipping_index[6][4]= {{0, 1, 2, 3},
+ {0, 4, 5, 1},
+ {4, 7, 6, 5},
+ {7, 3, 2, 6},
+ {1, 5, 6, 2},
+ {7, 4, 0, 3}};
+
UI_ThemeColorShade(TH_BACK, -8);
-
- glBegin(GL_QUADS);
-
- glVertex3fv(bb->vec[0]); glVertex3fv(bb->vec[1]); glVertex3fv(bb->vec[2]); glVertex3fv(bb->vec[3]);
- glVertex3fv(bb->vec[0]); glVertex3fv(bb->vec[4]); glVertex3fv(bb->vec[5]); glVertex3fv(bb->vec[1]);
- glVertex3fv(bb->vec[4]); glVertex3fv(bb->vec[7]); glVertex3fv(bb->vec[6]); glVertex3fv(bb->vec[5]);
- glVertex3fv(bb->vec[7]); glVertex3fv(bb->vec[3]); glVertex3fv(bb->vec[2]); glVertex3fv(bb->vec[6]);
- glVertex3fv(bb->vec[1]); glVertex3fv(bb->vec[5]); glVertex3fv(bb->vec[6]); glVertex3fv(bb->vec[2]);
- glVertex3fv(bb->vec[7]); glVertex3fv(bb->vec[4]); glVertex3fv(bb->vec[0]); glVertex3fv(bb->vec[3]);
-
- glEnd();
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(3, GL_FLOAT, 0, bb->vec);
+ glDrawElements(GL_QUADS, sizeof(clipping_index)/sizeof(unsigned int), GL_UNSIGNED_INT, clipping_index);
+ glDisableClientState(GL_VERTEX_ARRAY);
+
}
}
@@ -194,11 +196,11 @@ static int test_clipping(const float vec[3], float clip[][4])
{
float view[3];
copy_v3_v3(view, vec);
-
- if(0.0f < clip[0][3] + INPR(view, clip[0]))
- if(0.0f < clip[1][3] + INPR(view, clip[1]))
- if(0.0f < clip[2][3] + INPR(view, clip[2]))
- if(0.0f < clip[3][3] + INPR(view, clip[3]))
+
+ if(0.0f < clip[0][3] + dot_v3v3(view, clip[0]))
+ if(0.0f < clip[1][3] + dot_v3v3(view, clip[1]))
+ if(0.0f < clip[2][3] + dot_v3v3(view, clip[2]))
+ if(0.0f < clip[3][3] + dot_v3v3(view, clip[3]))
return 0;
return 1;
@@ -216,36 +218,37 @@ int ED_view3d_test_clipping(RegionView3D *rv3d, const float vec[3], const int lo
static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, float dx)
{
- float v1[2], v2[2];
+ float verts[2][2];
x+= (wx);
y+= (wy);
- v1[1]= 0.0f;
- v2[1]= (float)ar->winy;
+ /* set fixed 'Y' */
+ verts[0][1]= 0.0f;
+ verts[1][1]= (float)ar->winy;
- v1[0] = v2[0] = x-dx*floorf(x/dx);
-
- glBegin(GL_LINES);
-
- while(v1[0] < ar->winx) {
- glVertex2fv(v1);
- glVertex2fv(v2);
- v1[0] = v2[0] = v1[0] + dx;
- }
+ /* iter over 'X' */
+ verts[0][0] = verts[1][0] = x-dx*floorf(x/dx);
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(2, GL_FLOAT, 0, verts);
- v1[0]= 0.0f;
- v2[0]= (float)ar->winx;
+ while(verts[0][0] < ar->winx) {
+ glDrawArrays(GL_LINES, 0, 2);
+ verts[0][0] = verts[1][0] = verts[0][0] + dx;
+ }
- v1[1]= v2[1]= y-dx*floorf(y/dx);
+ /* set fixed 'X' */
+ verts[0][0]= 0.0f;
+ verts[1][0]= (float)ar->winx;
- while(v1[1] < ar->winy) {
- glVertex2fv(v1);
- glVertex2fv(v2);
- v1[1] = v2[1] = v1[1] + dx;
+ /* iter over 'Y' */
+ verts[0][1]= verts[1][1]= y-dx*floorf(y/dx);
+ while(verts[0][1] < ar->winy) {
+ glDrawArrays(GL_LINES, 0, 2);
+ verts[0][1] = verts[1][1] = verts[0][1] + dx;
}
- glEnd();
+ glDisableClientState(GL_VERTEX_ARRAY);
}
#define GRID_MIN_PX 6.0f
@@ -425,13 +428,10 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
{
- float vert[3], grid, grid_scale;
- int a, gridlines, emphasise;
- unsigned char col[3], col2[3];
- short draw_line = 0;
-
- vert[2]= 0.0;
-
+ float grid, grid_scale;
+ unsigned char col_grid[3];
+ const int gridlines= v3d->gridlines/2;
+
if(v3d->gridlines<3) return;
grid_scale= v3d->grid;
@@ -450,115 +450,81 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
grid_scale = (grid_scale * (float)bUnit_GetScaler(usys, i)) / scene->unit.scale_length;
}
}
-
- if(v3d->zbuf && scene->obedit) glDepthMask(0); // for zbuffer-select
-
- gridlines= v3d->gridlines/2;
+
grid= gridlines * grid_scale;
- UI_GetThemeColor3ubv(TH_GRID, col);
- UI_GetThemeColor3ubv(TH_BACK, col2);
-
- /* emphasise division lines lighter instead of darker, if background is darker than grid */
- if ( ((col[0]+col[1]+col[2])/3+10) > (col2[0]+col2[1]+col2[2])/3 )
- emphasise = 20;
- else
- emphasise = -10;
-
+ if(v3d->zbuf && scene->obedit) glDepthMask(0); // for zbuffer-select
+
+ UI_GetThemeColor3ubv(TH_GRID, col_grid);
+
/* draw the Y axis and/or grid lines */
- for(a= -gridlines;a<=gridlines;a++) {
- if(a==0) {
- /* check for the 'show Y axis' preference */
- if (v3d->gridflag & V3D_SHOW_Y) {
- UI_make_axis_color(col, col2, 'Y');
- glColor3ubv(col2);
-
- draw_line = 1;
- } else if (v3d->gridflag & V3D_SHOW_FLOOR) {
- UI_ThemeColorShade(TH_GRID, emphasise);
- } else {
- draw_line = 0;
+ if(v3d->gridflag & V3D_SHOW_FLOOR) {
+ float vert[4][3]= {{0.0f}};
+ unsigned char col_bg[3];
+ unsigned char col_grid_emphasise[3], col_grid_light[3];
+ int a;
+ int prev_emphasise= -1;
+
+ UI_GetThemeColor3ubv(TH_BACK, col_bg);
+
+ /* emphasise division lines lighter instead of darker, if background is darker than grid */
+ UI_GetColorPtrShade3ubv(col_grid, col_grid_light, 10);
+ UI_GetColorPtrShade3ubv(col_grid, col_grid_emphasise,
+ (((col_grid[0]+col_grid[1]+col_grid[2])+30) > (col_bg[0]+col_bg[1]+col_bg[2])) ? 20 : -10);
+
+ /* set fixed axis */
+ vert[0][0]= vert[2][1]= grid;
+ vert[1][0]= vert[3][1]= -grid;
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(3, GL_FLOAT, 0, vert);
+
+ for(a= -gridlines;a<=gridlines;a++) {
+ const float line= a * grid_scale;
+ const int is_emphasise= (a % 10) == 0;
+
+ if(is_emphasise != prev_emphasise) {
+ glColor3ubv(is_emphasise ? col_grid_emphasise : col_grid_light);
+ prev_emphasise= is_emphasise;
}
- } else {
- /* check for the 'show grid floor' preference */
- if (v3d->gridflag & V3D_SHOW_FLOOR) {
- if( (a % 10)==0) {
- UI_ThemeColorShade(TH_GRID, emphasise);
- }
- else UI_ThemeColorShade(TH_GRID, 10);
-
- draw_line = 1;
- } else {
- draw_line = 0;
- }
- }
-
- if (draw_line) {
- glBegin(GL_LINE_STRIP);
- vert[0]= a * grid_scale;
- vert[1]= grid;
- glVertex3fv(vert);
- vert[1]= -grid;
- glVertex3fv(vert);
- glEnd();
+
+ /* set variable axis */
+ vert[0][1]= vert[1][1]=
+ vert[2][0]= vert[3][0]= line;
+
+ glDrawArrays(GL_LINES, 0, 4);
}
+
+ glDisableClientState(GL_VERTEX_ARRAY);
+
+ GPU_print_error("sdsd");
}
- /* draw the X axis and/or grid lines */
- for(a= -gridlines;a<=gridlines;a++) {
- if(a==0) {
- /* check for the 'show X axis' preference */
- if (v3d->gridflag & V3D_SHOW_X) {
- UI_make_axis_color(col, col2, 'X');
- glColor3ubv(col2);
-
- draw_line = 1;
- } else if (v3d->gridflag & V3D_SHOW_FLOOR) {
- UI_ThemeColorShade(TH_GRID, emphasise);
- } else {
- draw_line = 0;
- }
- } else {
- /* check for the 'show grid floor' preference */
- if (v3d->gridflag & V3D_SHOW_FLOOR) {
- if( (a % 10)==0) {
- UI_ThemeColorShade(TH_GRID, emphasise);
- }
- else UI_ThemeColorShade(TH_GRID, 10);
-
- draw_line = 1;
- } else {
- draw_line = 0;
- }
- }
-
- if (draw_line) {
+ /* draw the Z axis line */
+ /* check for the 'show Z axis' preference */
+ if (v3d->gridflag & (V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_Z)) {
+ int axis;
+ for(axis= 0; axis < 3; axis++)
+ if (v3d->gridflag & (V3D_SHOW_X << axis)) {
+ float vert[3];
+ unsigned char tcol[3];
+
+ UI_make_axis_color(col_grid, tcol, 'X' + axis);
+ glColor3ubv(tcol);
+
glBegin(GL_LINE_STRIP);
- vert[1]= a * grid_scale;
- vert[0]= grid;
+ zero_v3(vert);
+ vert[axis]= grid;
glVertex3fv(vert );
- vert[0]= -grid;
+ vert[axis]= -grid;
glVertex3fv(vert);
glEnd();
}
}
-
- /* draw the Z axis line */
- /* check for the 'show Z axis' preference */
- if (v3d->gridflag & V3D_SHOW_Z) {
- UI_make_axis_color(col, col2, 'Z');
- glColor3ubv(col2);
-
- glBegin(GL_LINE_STRIP);
- vert[0]= 0;
- vert[1]= 0;
- vert[2]= grid;
- glVertex3fv(vert );
- vert[2]= -grid;
- glVertex3fv(vert);
- glEnd();
- }
-
+
+
+
+
if(v3d->zbuf && scene->obedit) glDepthMask(1);
}
@@ -697,60 +663,63 @@ static void draw_rotation_guide(RegionView3D *rv3d)
float scaled_axis[3];
const float scale = rv3d->dist;
mul_v3_v3fl(scaled_axis, rv3d->rot_axis, scale);
-
+
+
glBegin(GL_LINE_STRIP);
- color[3] = 0.f; // more transparent toward the ends
- glColor4fv(color);
- add_v3_v3v3(end, o, scaled_axis);
- glVertex3fv(end);
-
- // color[3] = 0.2f + fabsf(rv3d->rot_angle); // modulate opacity with angle
- // ^^ neat idea, but angle is frame-rate dependent, so it's usually close to 0.2
+ color[3] = 0.f; // more transparent toward the ends
+ glColor4fv(color);
+ add_v3_v3v3(end, o, scaled_axis);
+ glVertex3fv(end);
- color[3] = 0.5f; // more opaque toward the center
- glColor4fv(color);
- glVertex3fv(o);
-
- color[3] = 0.f;
- glColor4fv(color);
- sub_v3_v3v3(end, o, scaled_axis);
- glVertex3fv(end);
+ // color[3] = 0.2f + fabsf(rv3d->rot_angle); // modulate opacity with angle
+ // ^^ neat idea, but angle is frame-rate dependent, so it's usually close to 0.2
+
+ color[3] = 0.5f; // more opaque toward the center
+ glColor4fv(color);
+ glVertex3fv(o);
+
+ color[3] = 0.f;
+ glColor4fv(color);
+ sub_v3_v3v3(end, o, scaled_axis);
+ glVertex3fv(end);
glEnd();
// -- draw ring around rotation center --
{
- #define ROT_AXIS_DETAIL 13
- const float s = 0.05f * scale;
- const float step = 2.f * (float)(M_PI / ROT_AXIS_DETAIL);
- float angle;
- int i;
-
- float q[4]; // rotate ring so it's perpendicular to axis
- const int upright = fabsf(rv3d->rot_axis[2]) >= 0.95f;
- if (!upright)
- {
- const float up[3] = {0.f, 0.f, 1.f};
- float vis_angle, vis_axis[3];
-
- cross_v3_v3v3(vis_axis, up, rv3d->rot_axis);
- vis_angle = acosf(dot_v3v3(up, rv3d->rot_axis));
- axis_angle_to_quat(q, vis_axis, vis_angle);
+#define ROT_AXIS_DETAIL 13
+
+ const float s = 0.05f * scale;
+ const float step = 2.f * (float)(M_PI / ROT_AXIS_DETAIL);
+ float angle;
+ int i;
+
+ float q[4]; // rotate ring so it's perpendicular to axis
+ const int upright = fabsf(rv3d->rot_axis[2]) >= 0.95f;
+ if (!upright) {
+ const float up[3] = {0.f, 0.f, 1.f};
+ float vis_angle, vis_axis[3];
+
+ cross_v3_v3v3(vis_axis, up, rv3d->rot_axis);
+ vis_angle = acosf(dot_v3v3(up, rv3d->rot_axis));
+ axis_angle_to_quat(q, vis_axis, vis_angle);
}
- color[3] = 0.25f; // somewhat faint
- glColor4fv(color);
- glBegin(GL_LINE_LOOP);
- for (i = 0, angle = 0.f; i < ROT_AXIS_DETAIL; ++i, angle += step)
- {
- float p[3] = { s * cosf(angle), s * sinf(angle), 0.f };
+ color[3] = 0.25f; // somewhat faint
+ glColor4fv(color);
+ glBegin(GL_LINE_LOOP);
+ for (i = 0, angle = 0.f; i < ROT_AXIS_DETAIL; ++i, angle += step) {
+ float p[3] = {s * cosf(angle), s * sinf(angle), 0.0f};
- if (!upright)
- mul_qt_v3(q, p);
+ if (!upright) {
+ mul_qt_v3(q, p);
+ }
- add_v3_v3(p, o);
- glVertex3fv(p);
+ add_v3_v3(p, o);
+ glVertex3fv(p);
}
- glEnd();
+ glEnd();
+
+#undef ROT_AXIS_DETAIL
}
color[3] = 1.f; // solid dot
@@ -1237,7 +1206,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0);
- uiSetRoundBox(15);
+ uiSetRoundBox(UI_CNR_ALL);
uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0);
}
}
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 19e8d42db2d..761de836cfb 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -1017,18 +1017,26 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
if (has_rotation) {
- const int invert = U.ndof_flag & NDOF_ORBIT_INVERT_AXES;
-
rv3d->view = RV3D_VIEW_USER;
if (U.flag & USER_TRACKBALL) {
+ const int invert_roll = U.ndof_flag & NDOF_ROLL_INVERT_AXIS;
+ const int invert_tilt = U.ndof_flag & NDOF_TILT_INVERT_AXIS;
+ const int invert_rot = U.ndof_flag & NDOF_ROTATE_INVERT_AXIS;
+
float rot[4];
float axis[3];
float angle = rot_sensitivity * ndof_to_axis_angle(ndof, axis);
-
- if (invert)
- angle = -angle;
-
+
+ if (invert_roll)
+ axis[2] = -axis[2];
+
+ if (invert_tilt)
+ axis[0] = -axis[0];
+
+ if (invert_rot)
+ axis[1] = -axis[1];
+
// transform rotation axis from view to world coordinates
mul_qt_v3(view_inv, axis);
@@ -1042,6 +1050,8 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
} else {
/* turntable view code by John Aughey, adapted for 3D mouse by [mce] */
+ const int invert = U.ndof_flag & NDOF_ORBIT_INVERT_AXES;
+
float angle, rot[4];
float xvec[3] = {1,0,0};
@@ -1143,10 +1153,26 @@ static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
const float vertical_sensitivity = 0.4f;
const float lateral_sensitivity = 0.6f;
- float pan_vec[3] = {lateral_sensitivity * ndof->tvec[0],
- vertical_sensitivity * ndof->tvec[1],
- forward_sensitivity * ndof->tvec[2]
- };
+ const int invert_panx = U.ndof_flag & NDOF_PANX_INVERT_AXIS;
+ const int invert_pany = U.ndof_flag & NDOF_PANY_INVERT_AXIS;
+ const int invert_panz = U.ndof_flag & NDOF_PANZ_INVERT_AXIS;
+
+ float pan_vec[3];
+
+ if (invert_panx)
+ pan_vec[0] = -lateral_sensitivity * ndof->tvec[0];
+ else
+ pan_vec[0] = lateral_sensitivity * ndof->tvec[0];
+
+ if (invert_panz)
+ pan_vec[1] = -vertical_sensitivity * ndof->tvec[1];
+ else
+ pan_vec[1] = vertical_sensitivity * ndof->tvec[1];
+
+ if (invert_pany)
+ pan_vec[2] = -forward_sensitivity * ndof->tvec[2];
+ else
+ pan_vec[2] = forward_sensitivity * ndof->tvec[2];
mul_v3_fl(pan_vec, speed * dt);
#endif
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 1796bd4e928..82598e0b5c6 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1091,7 +1091,7 @@ int calculateTransformCenter(bContext *C, int centerMode, float *vec)
calculateCenter(t);
// Copy center from constraint center. Transform center can be local
- VECCOPY(vec, t->con.center);
+ copy_v3_v3(vec, t->con.center);
}
@@ -1210,7 +1210,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
mval[0]= x;
mval[1]= y;
- VECCOPY(vecrot, t->center);
+ copy_v3_v3(vecrot, t->center);
if(t->flag & T_EDIT) {
Object *ob= t->obedit;
if(ob) mul_m4_v3(ob->obmat, vecrot);
@@ -1963,7 +1963,7 @@ static void constraintTransLim(TransInfo *t, TransData *td)
* - current space should be local
*/
unit_m4(cob.matrix);
- VECCOPY(cob.matrix[3], td->loc);
+ copy_v3_v3(cob.matrix[3], td->loc);
/* Evaluate valid constraints */
for (con= td->con; con; con= con->next) {
@@ -2022,7 +2022,7 @@ static void constraintTransLim(TransInfo *t, TransData *td)
}
/* copy results from cob->matrix */
- VECCOPY(td->loc, cob.matrix[3]);
+ copy_v3_v3(td->loc, cob.matrix[3]);
}
}
@@ -2292,8 +2292,8 @@ int Warp(TransInfo *t, const int UNUSED(mval[2]))
* It needs to be in view space, but we need to take object's offset
* into account if in Edit mode.
*/
- VECCOPY(cursor, curs);
- VECCOPY(gcursor, cursor);
+ copy_v3_v3(cursor, curs);
+ copy_v3_v3(gcursor, cursor);
if (t->flag & T_EDIT) {
sub_v3_v3(cursor, t->obedit->obmat[3]);
sub_v3_v3(gcursor, t->obedit->obmat[3]);
@@ -2336,7 +2336,7 @@ int Warp(TransInfo *t, const int UNUSED(mval[2]))
continue;
/* translate point to center, rotate in such a way that outline==distance */
- VECCOPY(vec, td->iloc);
+ copy_v3_v3(vec, td->iloc);
mul_m3_v3(td->mtx, vec);
mul_m4_v3(t->viewmat, vec);
sub_v3_v3(vec, t->viewmat[3]);
@@ -2603,23 +2603,23 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) {
/* local constraint shouldn't alter center */
if (t->around == V3D_LOCAL) {
if (t->flag & T_OBJECT) {
- VECCOPY(center, td->center);
+ copy_v3_v3(center, td->center);
}
else if (t->flag & T_EDIT) {
if(t->around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) {
- VECCOPY(center, td->center);
+ copy_v3_v3(center, td->center);
}
else {
- VECCOPY(center, t->center);
+ copy_v3_v3(center, t->center);
}
}
else {
- VECCOPY(center, t->center);
+ copy_v3_v3(center, t->center);
}
}
else {
- VECCOPY(center, t->center);
+ copy_v3_v3(center, t->center);
}
if (td->ext) {
@@ -2719,10 +2719,10 @@ int Resize(TransInfo *t, const int mval[2])
if (t->flag & T_AUTOVALUES)
{
- VECCOPY(size, t->auto_values);
+ copy_v3_v3(size, t->auto_values);
}
- VECCOPY(t->values, size);
+ copy_v3_v3(t->values, size);
size_to_mat3( mat,size);
@@ -3020,7 +3020,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
mul_m3_m3m3(smat, td->smtx, totmat);
/* calculate the total rotatation in eulers */
- VECCOPY(eul, td->ext->irot);
+ copy_v3_v3(eul, td->ext->irot);
eulO_to_mat3( eulmat,eul, td->ext->rotOrder);
/* mat = transform, obmat = bone rotation */
@@ -3030,7 +3030,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
/* and apply (to end result only) */
protectedRotateBits(td->protectflag, eul, td->ext->irot);
- VECCOPY(td->ext->rot, eul);
+ copy_v3_v3(td->ext->rot, eul);
}
constraintRotLim(t, td);
@@ -3100,7 +3100,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
/* and apply */
protectedRotateBits(td->protectflag, eul, td->ext->irot);
- VECCOPY(td->ext->rot, eul);
+ copy_v3_v3(td->ext->rot, eul);
}
constraintRotLim(t, td);
@@ -3244,8 +3244,8 @@ int Trackball(TransInfo *t, const int UNUSED(mval[2]))
float mat[3][3], totmat[3][3], smat[3][3];
float phi[2];
- VECCOPY(axis1, t->persinv[0]);
- VECCOPY(axis2, t->persinv[1]);
+ copy_v3_v3(axis1, t->persinv[0]);
+ copy_v3_v3(axis2, t->persinv[1]);
normalize_v3(axis1);
normalize_v3(axis2);
@@ -3341,7 +3341,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) {
else {
float dvec[3];
- VECCOPY(dvec, vec);
+ copy_v3_v3(dvec, vec);
applyAspectRatio(t, dvec);
dist = len_v3(vec);
@@ -3448,7 +3448,7 @@ static void applyTranslation(TransInfo *t, float vec[3]) {
t->con.applyVec(t, td, vec, tvec, pvec);
}
else {
- VECCOPY(tvec, vec);
+ copy_v3_v3(tvec, vec);
}
mul_m3_v3(td->smtx, tvec);
@@ -3475,7 +3475,7 @@ int Translation(TransInfo *t, const int UNUSED(mval[2]))
}
applySnapping(t, t->values);
t->con.applyVec(t, NULL, t->values, tvec, pvec);
- VECCOPY(t->values, tvec);
+ copy_v3_v3(t->values, tvec);
headerTranslation(t, pvec, str);
}
else {
@@ -3564,7 +3564,7 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
if (td->flag & TD_SKIP)
continue;
- VECCOPY(vec, td->axismtx[2]);
+ copy_v3_v3(vec, td->axismtx[2]);
mul_v3_fl(vec, distance);
mul_v3_fl(vec, td->factor);
@@ -4608,7 +4608,7 @@ static int createSlideVerts(TransInfo *t)
add_v3_v3(start, end);
mul_v3_fl(start, 0.5f*(1.0f/totvec));
- VECCOPY(vec, start);
+ copy_v3_v3(vec, start);
start[0] = t->mval[0];
start[1] = t->mval[1];
add_v3_v3v3(end, start, vec);
@@ -5215,7 +5215,7 @@ int Align(TransInfo *t, const int UNUSED(mval[2]))
int i;
/* saving original center */
- VECCOPY(center, t->center);
+ copy_v3_v3(center, t->center);
for(i = 0 ; i < t->total; i++, td++)
{
@@ -5229,11 +5229,11 @@ int Align(TransInfo *t, const int UNUSED(mval[2]))
/* around local centers */
if (t->flag & (T_OBJECT|T_POSE)) {
- VECCOPY(t->center, td->center);
+ copy_v3_v3(t->center, td->center);
}
else {
if(t->settings->selectmode & SCE_SELECT_FACE) {
- VECCOPY(t->center, td->center);
+ copy_v3_v3(t->center, td->center);
}
}
@@ -5245,7 +5245,7 @@ int Align(TransInfo *t, const int UNUSED(mval[2]))
}
/* restoring original center */
- VECCOPY(t->center, center);
+ copy_v3_v3(t->center, center);
recalcData(t);
@@ -5317,7 +5317,7 @@ int SeqSlide(TransInfo *t, const int UNUSED(mval[2]))
float pvec[3] = {0.0f, 0.0f, 0.0f};
float tvec[3];
t->con.applyVec(t, NULL, t->values, tvec, pvec);
- VECCOPY(t->values, tvec);
+ copy_v3_v3(t->values, tvec);
}
else {
snapGrid(t, t->values);
@@ -5423,9 +5423,13 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d,
{
/* snap key to nearest frame? */
if (autosnap == SACTSNAP_FRAME) {
+
+#if 0 /* 'doTime' disabled for now */
+
const Scene *scene= t->scene;
const short doTime= 0; //getAnimEdit_DrawTime(t); // NOTE: this works, but may be confusing behaviour given the option's label, hence disabled
const double secf= FPS;
+#endif
double val;
/* convert frame to nla-action time (if needed) */
@@ -5434,11 +5438,17 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d,
else
val= *(td->val);
+#if 0 /* 'doTime' disabled for now */
+
/* do the snapping to nearest frame/second */
- if (doTime)
+ if (doTime) {
val= (float)( floor((val/secf) + 0.5f) * secf );
+ }
else
+#endif
+ {
val= (float)( floor(val+0.5f) );
+ }
/* convert frame out of nla-action time */
if (adt)
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index be5f539431f..a06de9fa1ce 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -239,7 +239,7 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
if(factor<0.0f) factor*= -factor;
else factor*= factor;
- VECCOPY(out, axis);
+ copy_v3_v3(out, axis);
normalize_v3(out);
mul_v3_fl(out, -factor); /* -factor makes move down going backwards */
}
@@ -261,7 +261,7 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
/* give arbitrary large value if projection is impossible */
factor = dot_v3v3(axis, norm);
if (1.0f - fabsf(factor) < 0.0002f) {
- VECCOPY(out, axis);
+ copy_v3_v3(out, axis);
if (factor > 0) {
mul_v3_fl(out, 1000000000.0f);
} else {
@@ -300,7 +300,7 @@ static void planeProjection(TransInfo *t, float in[3], float out[3]) {
}
factor = dot_v3v3(vec, vec) / factor;
- VECCOPY(vec, norm);
+ copy_v3_v3(vec, norm);
mul_v3_fl(vec, factor);
add_v3_v3v3(out, in, vec);
@@ -317,7 +317,7 @@ static void planeProjection(TransInfo *t, float in[3], float out[3]) {
static void applyAxisConstraintVec(TransInfo *t, TransData *td, float in[3], float out[3], float pvec[3])
{
- VECCOPY(out, in);
+ copy_v3_v3(out, in);
if (!td && t->con.mode & CON_APPLY) {
mul_m3_v3(t->con.pmtx, out);
@@ -332,13 +332,13 @@ static void applyAxisConstraintVec(TransInfo *t, TransData *td, float in[3], flo
float c[3];
if (t->con.mode & CON_AXIS0) {
- VECCOPY(c, t->con.mtx[0]);
+ copy_v3_v3(c, t->con.mtx[0]);
}
else if (t->con.mode & CON_AXIS1) {
- VECCOPY(c, t->con.mtx[1]);
+ copy_v3_v3(c, t->con.mtx[1]);
}
else if (t->con.mode & CON_AXIS2) {
- VECCOPY(c, t->con.mtx[2]);
+ copy_v3_v3(c, t->con.mtx[2]);
}
axisProjection(t, c, in, out);
}
@@ -360,7 +360,7 @@ static void applyAxisConstraintVec(TransInfo *t, TransData *td, float in[3], flo
static void applyObjectConstraintVec(TransInfo *t, TransData *td, float in[3], float out[3], float pvec[3])
{
- VECCOPY(out, in);
+ copy_v3_v3(out, in);
if (t->con.mode & CON_APPLY) {
if (!td) {
mul_m3_v3(t->con.pmtx, out);
@@ -373,18 +373,18 @@ static void applyObjectConstraintVec(TransInfo *t, TransData *td, float in[3], f
float c[3];
if (t->con.mode & CON_AXIS0) {
- VECCOPY(c, t->con.mtx[0]);
+ copy_v3_v3(c, t->con.mtx[0]);
}
else if (t->con.mode & CON_AXIS1) {
- VECCOPY(c, t->con.mtx[1]);
+ copy_v3_v3(c, t->con.mtx[1]);
}
else if (t->con.mode & CON_AXIS2) {
- VECCOPY(c, t->con.mtx[2]);
+ copy_v3_v3(c, t->con.mtx[2]);
}
axisProjection(t, c, in, out);
}
postConstraintChecks(t, out, pvec);
- VECCOPY(out, pvec);
+ copy_v3_v3(out, pvec);
}
else {
int i=0;
@@ -481,15 +481,15 @@ static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3], fl
switch(mode) {
case CON_AXIS0:
case (CON_AXIS1|CON_AXIS2):
- VECCOPY(vec, t->con.mtx[0]);
+ copy_v3_v3(vec, t->con.mtx[0]);
break;
case CON_AXIS1:
case (CON_AXIS0|CON_AXIS2):
- VECCOPY(vec, t->con.mtx[1]);
+ copy_v3_v3(vec, t->con.mtx[1]);
break;
case CON_AXIS2:
case (CON_AXIS0|CON_AXIS1):
- VECCOPY(vec, t->con.mtx[2]);
+ copy_v3_v3(vec, t->con.mtx[2]);
break;
}
/* don't flip axis if asked to or if num input */
@@ -528,15 +528,15 @@ static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3],
switch(mode) {
case CON_AXIS0:
case (CON_AXIS1|CON_AXIS2):
- VECCOPY(vec, td->axismtx[0]);
+ copy_v3_v3(vec, td->axismtx[0]);
break;
case CON_AXIS1:
case (CON_AXIS0|CON_AXIS2):
- VECCOPY(vec, td->axismtx[1]);
+ copy_v3_v3(vec, td->axismtx[1]);
break;
case CON_AXIS2:
case (CON_AXIS0|CON_AXIS1):
- VECCOPY(vec, td->axismtx[2]);
+ copy_v3_v3(vec, td->axismtx[2]);
break;
}
if (angle && (mode & CON_NOFLIP) == 0 && hasNumInput(&t->num) == 0) {
@@ -724,7 +724,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
glPushMatrix();
- VECCOPY(center, t->center);
+ copy_v3_v3(center, t->center);
if((t->spacetype == SPACE_VIEW3D) && t->obedit)
{
@@ -897,7 +897,7 @@ static void setNearestAxis3d(TransInfo *t)
zfac = len_v3(t->persinv[0]) * 2.0f/t->ar->winx * zfac * 30.0f;
for (i = 0; i<3; i++) {
- VECCOPY(axis, t->con.mtx[i]);
+ copy_v3_v3(axis, t->con.mtx[i]);
mul_v3_fl(axis, zfac);
/* now we can project to get window coordinate */
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index cae64899aeb..b98cd277f80 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -269,7 +269,7 @@ static void createTransTexspace(TransInfo *t)
td->ext= t->ext= MEM_callocN(sizeof(TransDataExtension), "TransTexspace");
td->flag= TD_SELECTED;
- VECCOPY(td->center, ob->obmat[3]);
+ copy_v3_v3(td->center, ob->obmat[3]);
td->ob = ob;
copy_m3_m4(td->mtx, ob->obmat);
@@ -282,9 +282,9 @@ static void createTransTexspace(TransInfo *t)
*texflag &= ~AUTOSPACE;
}
- VECCOPY(td->iloc, td->loc);
- VECCOPY(td->ext->irot, td->ext->rot);
- VECCOPY(td->ext->isize, td->ext->size);
+ copy_v3_v3(td->iloc, td->loc);
+ copy_v3_v3(td->ext->irot, td->ext->rot);
+ copy_v3_v3(td->ext->isize, td->ext->size);
}
/* ********************* edge (for crease) ***** */
@@ -420,7 +420,7 @@ static short apply_targetless_ik(Object *ob)
copy_m4_m3(offs_bone, bone->bone_mat);
/* The bone's root offset (is in the parent's coordinate system) */
- VECCOPY(offs_bone[3], bone->head);
+ copy_v3_v3(offs_bone[3], bone->head);
/* Get the length translation of parent (length along y axis) */
offs_bone[3][1]+= parbone->length;
@@ -431,7 +431,7 @@ static short apply_targetless_ik(Object *ob)
copy_m4_m4(rmat, parbone->arm_mat); /* rmat used as temp */
/* the location of actual parent transform */
- VECCOPY(rmat[3], offs_bone[3]);
+ copy_v3_v3(rmat[3], offs_bone[3]);
offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f;
mul_m4_v3(parchan->parent->pose_mat, rmat[3]);
@@ -449,7 +449,7 @@ static short apply_targetless_ik(Object *ob)
else {
copy_m4_m3(tmat, bone->bone_mat);
- VECCOPY(tmat[3], bone->head);
+ copy_v3_v3(tmat[3], bone->head);
invert_m4_m4(imat, tmat);
}
/* result matrix */
@@ -491,7 +491,7 @@ static short apply_targetless_ik(Object *ob)
/* causes problems with some constraints (e.g. childof), so disable this */
/* as it is IK shouldn't affect location directly */
- /* VECCOPY(parchan->loc, rmat[3]); */
+ /* copy_v3_v3(parchan->loc, rmat[3]); */
}
}
@@ -511,8 +511,8 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
float cmat[3][3], tmat[3][3];
float vec[3];
- VECCOPY(vec, pchan->pose_mat[3]);
- VECCOPY(td->center, vec);
+ copy_v3_v3(vec, pchan->pose_mat[3]);
+ copy_v3_v3(td->center, vec);
td->ob = ob;
td->flag = TD_SELECTED;
@@ -530,10 +530,10 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
td->protectflag= pchan->protectflag;
td->loc = pchan->loc;
- VECCOPY(td->iloc, pchan->loc);
+ copy_v3_v3(td->iloc, pchan->loc);
td->ext->size= pchan->size;
- VECCOPY(td->ext->isize, pchan->size);
+ copy_v3_v3(td->ext->isize, pchan->size);
if (pchan->rotmode > 0) {
td->ext->rot= pchan->eul;
@@ -541,7 +541,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
td->ext->rotAngle= NULL;
td->ext->quat= NULL;
- VECCOPY(td->ext->irot, pchan->eul);
+ copy_v3_v3(td->ext->irot, pchan->eul);
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
td->ext->rot= NULL;
@@ -550,7 +550,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
td->ext->quat= NULL;
td->ext->irotAngle= pchan->rotAngle;
- VECCOPY(td->ext->irotAxis, pchan->rotAxis);
+ copy_v3_v3(td->ext->irotAxis, pchan->rotAxis);
}
else {
td->ext->rot= NULL;
@@ -626,7 +626,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
else {
// abusive storage of scale in the loc pointer :)
td->loc= &bone->xwidth;
- VECCOPY (td->iloc, td->loc);
+ copy_v3_v3(td->iloc, td->loc);
td->val= NULL;
}
}
@@ -636,13 +636,13 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
bKinematicConstraint *data= has_targetless_ik(pchan);
if(data) {
if(data->flag & CONSTRAINT_IK_TIP) {
- VECCOPY(data->grabtarget, pchan->pose_tail);
+ copy_v3_v3(data->grabtarget, pchan->pose_tail);
}
else {
- VECCOPY(data->grabtarget, pchan->pose_head);
+ copy_v3_v3(data->grabtarget, pchan->pose_head);
}
td->loc = data->grabtarget;
- VECCOPY(td->iloc, td->loc);
+ copy_v3_v3(td->iloc, td->loc);
data->flag |= CONSTRAINT_IK_AUTO;
/* only object matrix correction */
@@ -885,7 +885,7 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
else
data->flag= CONSTRAINT_IK_TIP;
data->flag |= CONSTRAINT_IK_TEMP|CONSTRAINT_IK_AUTO;
- VECCOPY(data->grabtarget, pchan->pose_tail);
+ copy_v3_v3(data->grabtarget, pchan->pose_tail);
data->rootbone= 0; /* watch-it! has to be 0 here, since we're still on the same bone for the first time through the loop [#25885] */
/* we only include bones that are part of a continual connected chain */
@@ -1109,7 +1109,7 @@ static void createTransArmatureVerts(TransInfo *t)
td->val= &ebo->rad_head;
td->ival= *td->val;
- VECCOPY (td->center, ebo->head);
+ copy_v3_v3(td->center, ebo->head);
td->flag= TD_SELECTED;
copy_m3_m3(td->smtx, smtx);
@@ -1125,7 +1125,7 @@ static void createTransArmatureVerts(TransInfo *t)
{
td->val= &ebo->rad_tail;
td->ival= *td->val;
- VECCOPY (td->center, ebo->tail);
+ copy_v3_v3(td->center, ebo->tail);
td->flag= TD_SELECTED;
copy_m3_m3(td->smtx, smtx);
@@ -1152,10 +1152,10 @@ static void createTransArmatureVerts(TransInfo *t)
{
// abusive storage of scale in the loc pointer :)
td->loc= &ebo->xwidth;
- VECCOPY (td->iloc, td->loc);
+ copy_v3_v3(td->iloc, td->loc);
td->val= NULL;
}
- VECCOPY (td->center, ebo->head);
+ copy_v3_v3(td->center, ebo->head);
td->flag= TD_SELECTED;
/* use local bone matrix */
@@ -1181,7 +1181,7 @@ static void createTransArmatureVerts(TransInfo *t)
td->val= &(ebo->roll);
td->ival= ebo->roll;
- VECCOPY (td->center, ebo->head);
+ copy_v3_v3(td->center, ebo->head);
td->flag= TD_SELECTED;
td->ext = NULL;
@@ -1194,8 +1194,8 @@ static void createTransArmatureVerts(TransInfo *t)
{
if (ebo->flag & BONE_TIPSEL)
{
- VECCOPY (td->iloc, ebo->tail);
- VECCOPY (td->center, td->iloc);
+ copy_v3_v3(td->iloc, ebo->tail);
+ copy_v3_v3(td->center, td->iloc);
td->loc= ebo->tail;
td->flag= TD_SELECTED;
if (ebo->flag & BONE_EDITMODE_LOCKED)
@@ -1220,8 +1220,8 @@ static void createTransArmatureVerts(TransInfo *t)
}
if (ebo->flag & BONE_ROOTSEL)
{
- VECCOPY (td->iloc, ebo->head);
- VECCOPY (td->center, td->iloc);
+ copy_v3_v3(td->iloc, ebo->head);
+ copy_v3_v3(td->center, td->iloc);
td->loc= ebo->head;
td->flag= TD_SELECTED;
if (ebo->flag & BONE_EDITMODE_LOCKED)
@@ -1279,8 +1279,8 @@ static void createTransMBallVerts(TransInfo *t)
for(ml= mb->editelems->first; ml; ml= ml->next) {
if(propmode || (ml->flag & SELECT)) {
td->loc= &ml->x;
- VECCOPY(td->iloc, td->loc);
- VECCOPY(td->center, td->loc);
+ copy_v3_v3(td->iloc, td->loc);
+ copy_v3_v3(td->center, td->loc);
if(ml->flag & SELECT) td->flag= TD_SELECTED | TD_USEQUAT | TD_SINGLESIZE;
else td->flag= TD_USEQUAT;
@@ -1444,9 +1444,9 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
((bezt->f2 & SELECT) && hide_handles) ||
((bezt->f1 & SELECT) && hide_handles == 0)
) {
- VECCOPY(td->iloc, bezt->vec[0]);
+ copy_v3_v3(td->iloc, bezt->vec[0]);
td->loc= bezt->vec[0];
- VECCOPY(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1:0]);
+ copy_v3_v3(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1:0]);
if (hide_handles) {
if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
@@ -1469,9 +1469,9 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
/* This is the Curve Point, the other two are handles */
if(propmode || (bezt->f2 & SELECT)) {
- VECCOPY(td->iloc, bezt->vec[1]);
+ copy_v3_v3(td->iloc, bezt->vec[1]);
td->loc= bezt->vec[1];
- VECCOPY(td->center, td->loc);
+ copy_v3_v3(td->center, td->loc);
if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
td->ext = NULL;
@@ -1503,9 +1503,9 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
((bezt->f2 & SELECT) && hide_handles) ||
((bezt->f3 & SELECT) && hide_handles == 0)
) {
- VECCOPY(td->iloc, bezt->vec[2]);
+ copy_v3_v3(td->iloc, bezt->vec[2]);
td->loc= bezt->vec[2];
- VECCOPY(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1:2]);
+ copy_v3_v3(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1:2]);
if (hide_handles) {
if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
@@ -1547,9 +1547,9 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
for(a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) {
if(bp->hide==0) {
if(propmode || (bp->f1 & SELECT)) {
- VECCOPY(td->iloc, bp->vec);
+ copy_v3_v3(td->iloc, bp->vec);
td->loc= bp->vec;
- VECCOPY(td->center, td->loc);
+ copy_v3_v3(td->center, td->loc);
if(bp->f1 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
td->ext = NULL;
@@ -1619,9 +1619,9 @@ static void createTransLatticeVerts(TransInfo *t)
while(a--) {
if(propmode || (bp->f1 & SELECT)) {
if(bp->hide==0) {
- VECCOPY(td->iloc, bp->vec);
+ copy_v3_v3(td->iloc, bp->vec);
td->loc= bp->vec;
- VECCOPY(td->center, td->loc);
+ copy_v3_v3(td->center, td->loc);
if(bp->f1 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
copy_m3_m3(td->smtx, smtx);
@@ -1714,15 +1714,15 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
for(k=0, key=point->keys; k<point->totkey; k++, key++) {
if(key->flag & PEK_USE_WCO) {
- VECCOPY(key->world_co, key->co);
+ copy_v3_v3(key->world_co, key->co);
mul_m4_v3(mat, key->world_co);
td->loc = key->world_co;
}
else
td->loc = key->co;
- VECCOPY(td->iloc, td->loc);
- VECCOPY(td->center, td->loc);
+ copy_v3_v3(td->iloc, td->loc);
+ copy_v3_v3(td->center, td->loc);
if(key->flag & PEK_SELECT)
td->flag |= TD_SELECTED;
@@ -1787,13 +1787,13 @@ void flushTransParticles(TransInfo *t)
invert_m4_m4(imat,mat);
for(k=0, key=point->keys; k<point->totkey; k++, key++) {
- VECCOPY(co, key->world_co);
+ copy_v3_v3(co, key->world_co);
mul_m4_v3(imat, co);
/* optimization for proportional edit */
if(!propmode || !compare_v3v3(key->co, co, 0.0001f)) {
- VECCOPY(key->co, co);
+ copy_v3_v3(key->co, co);
point->flag |= PEP_EDIT_RECALC;
}
}
@@ -1910,7 +1910,7 @@ static void get_face_center(float *cent, EditMesh *em, EditVert *eve)
if(efa->v1==eve || efa->v2==eve || efa->v3==eve || efa->v4==eve)
break;
if(efa) {
- VECCOPY(cent, efa->cent);
+ copy_v3_v3(cent, efa->cent);
}
}
@@ -1924,13 +1924,13 @@ static void VertsToTransData(TransInfo *t, TransData *td, EditMesh *em, EditVert
//else
td->loc = eve->co;
- VECCOPY(td->center, td->loc);
+ copy_v3_v3(td->center, td->loc);
if(t->around==V3D_LOCAL && (em->selectmode & SCE_SELECT_FACE))
get_face_center(td->center, em, eve);
- VECCOPY(td->iloc, td->loc);
+ copy_v3_v3(td->iloc, td->loc);
// Setting normals
- VECCOPY(td->axismtx[2], eve->no);
+ copy_v3_v3(td->axismtx[2], eve->no);
td->axismtx[0][0] =
td->axismtx[0][1] =
td->axismtx[0][2] =
@@ -1960,9 +1960,9 @@ static void createTransBMeshVerts(TransInfo *t, BME_Mesh *bm, BME_TransData_Head
if ( (vtd = BME_get_transdata(td,v)) ) {
tob->loc = vtd->loc;
tob->val = &vtd->factor;
- VECCOPY(tob->iloc,vtd->co);
- VECCOPY(tob->center,vtd->org);
- VECCOPY(tob->axismtx[0],vtd->vec);
+ copy_v3_v3(tob->iloc,vtd->co);
+ copy_v3_v3(tob->center,vtd->org);
+ copy_v3_v3(tob->axismtx[0],vtd->vec);
tob->axismtx[1][0] = vtd->max ? *vtd->max : 0;
tob++;
i++;
@@ -2305,8 +2305,8 @@ static void UVsToTransData(SpaceImage *sima, TransData *td, TransData2D *td2d, f
td->flag = 0;
td->loc = td2d->loc;
- VECCOPY(td->center, td->loc);
- VECCOPY(td->iloc, td->loc);
+ copy_v3_v3(td->center, td->loc);
+ copy_v3_v3(td->iloc, td->loc);
memset(td->axismtx, 0, sizeof(td->axismtx));
td->axismtx[2][2] = 1.0f;
@@ -2606,10 +2606,10 @@ static void createTransNlaData(bContext *C, TransInfo *t)
/* now, link the transform data up to this data */
if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) {
td->loc= tdn->h1;
- VECCOPY(td->iloc, tdn->h1);
+ copy_v3_v3(td->iloc, tdn->h1);
/* store all the other gunk that is required by transform */
- VECCOPY(td->center, center);
+ copy_v3_v3(td->center, center);
memset(td->axismtx, 0, sizeof(td->axismtx));
td->axismtx[2][2] = 1.0f;
@@ -2638,10 +2638,10 @@ static void createTransNlaData(bContext *C, TransInfo *t)
/* now, link the transform data up to this data */
if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) {
td->loc= tdn->h2;
- VECCOPY(td->iloc, tdn->h2);
+ copy_v3_v3(td->iloc, tdn->h2);
/* store all the other gunk that is required by transform */
- VECCOPY(td->center, center);
+ copy_v3_v3(td->center, center);
memset(td->axismtx, 0, sizeof(td->axismtx));
td->axismtx[2][2] = 1.0f;
@@ -3194,7 +3194,7 @@ static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt,
td->center[1] = cent[1];
td->center[2] = 0.0f;
- VECCOPY(td->iloc, td->loc);
+ copy_v3_v3(td->iloc, td->loc);
}
else {
td2d->loc[0] = loc[0];
@@ -3203,8 +3203,8 @@ static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt,
td2d->loc2d = loc;
td->loc = td2d->loc;
- VECCOPY(td->center, cent);
- VECCOPY(td->iloc, td->loc);
+ copy_v3_v3(td->center, cent);
+ copy_v3_v3(td->iloc, td->loc);
}
if (td->flag & TD_MOVEHANDLE1) {
@@ -3903,8 +3903,8 @@ static TransData *SeqToTransData(TransData *td, TransData2D *td2d, TransDataSeq
td->flag = 0;
td->loc = td2d->loc;
- VECCOPY(td->center, td->loc);
- VECCOPY(td->iloc, td->loc);
+ copy_v3_v3(td->center, td->loc);
+ copy_v3_v3(td->iloc, td->loc);
memset(td->axismtx, 0, sizeof(td->axismtx));
td->axismtx[2][2] = 1.0f;
@@ -4255,7 +4255,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
td->ob = ob;
td->loc = ob->loc;
- VECCOPY(td->iloc, td->loc);
+ copy_v3_v3(td->iloc, td->loc);
if (ob->rotmode > 0) {
td->ext->rot= ob->rot;
@@ -4263,8 +4263,8 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
td->ext->rotAngle= NULL;
td->ext->quat= NULL;
- VECCOPY(td->ext->irot, ob->rot);
- VECCOPY(td->ext->drot, ob->drot);
+ copy_v3_v3(td->ext->irot, ob->rot);
+ copy_v3_v3(td->ext->drot, ob->drot);
}
else if (ob->rotmode == ROT_MODE_AXISANGLE) {
td->ext->rot= NULL;
@@ -4273,9 +4273,9 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
td->ext->quat= NULL;
td->ext->irotAngle= ob->rotAngle;
- VECCOPY(td->ext->irotAxis, ob->rotAxis);
+ copy_v3_v3(td->ext->irotAxis, ob->rotAxis);
// td->ext->drotAngle= ob->drotAngle; // XXX, not implimented
- // VECCOPY(td->ext->drotAxis, ob->drotAxis); // XXX, not implimented
+ // copy_v3_v3(td->ext->drotAxis, ob->drotAxis); // XXX, not implimented
}
else {
td->ext->rot= NULL;
@@ -4289,10 +4289,10 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
td->ext->rotOrder=ob->rotmode;
td->ext->size = ob->size;
- VECCOPY(td->ext->isize, ob->size);
- VECCOPY(td->ext->dsize, ob->dsize);
+ copy_v3_v3(td->ext->isize, ob->size);
+ copy_v3_v3(td->ext->dsize, ob->dsize);
- VECCOPY(td->center, ob->obmat[3]);
+ copy_v3_v3(td->center, ob->obmat[3]);
copy_m4_m4(td->ext->obmat, ob->obmat);
@@ -5202,8 +5202,8 @@ static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node)
}
td->loc = td2d->loc;
- VECCOPY(td->center, td->loc);
- VECCOPY(td->iloc, td->loc);
+ copy_v3_v3(td->center, td->loc);
+ copy_v3_v3(td->iloc, td->loc);
memset(td->axismtx, 0, sizeof(td->axismtx));
td->axismtx[2][2] = 1.0f;
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index ec76bb3ac35..76c81662ce8 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -115,9 +115,9 @@ void getViewVector(TransInfo *t, float coord[3], float vec[3])
{
float p1[4], p2[4];
- VECCOPY(p1, coord);
+ copy_v3_v3(p1, coord);
p1[3] = 1.0f;
- VECCOPY(p2, p1);
+ copy_v3_v3(p2, p1);
p2[3] = 1.0f;
mul_m4_v4(t->viewmat, p2);
@@ -130,7 +130,7 @@ void getViewVector(TransInfo *t, float coord[3], float vec[3])
sub_v3_v3v3(vec, p1, p2);
}
else {
- VECCOPY(vec, t->viewinv[2]);
+ copy_v3_v3(vec, t->viewinv[2]);
}
normalize_v3(vec);
}
@@ -144,7 +144,7 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
int axis = 0;
for (; md; md=md->next) {
- if (md->type==eModifierType_Mirror) {
+ if ((md->type==eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
MirrorModifierData *mmd = (MirrorModifierData*) md;
if(mmd->flag & MOD_MIR_CLIPPING) {
@@ -694,12 +694,12 @@ static void recalcData_view3d(TransInfo *t)
if ((ebo->flag & BONE_CONNECTED) && ebo->parent){
/* If this bone has a parent tip that has been moved */
if (ebo->parent->flag & BONE_TIPSEL){
- VECCOPY (ebo->head, ebo->parent->tail);
+ copy_v3_v3 (ebo->head, ebo->parent->tail);
if(t->mode==TFM_BONE_ENVELOPE) ebo->rad_head= ebo->parent->rad_tail;
}
/* If this bone has a parent tip that has NOT been moved */
else{
- VECCOPY (ebo->parent->tail, ebo->head);
+ copy_v3_v3 (ebo->parent->tail, ebo->head);
if(t->mode==TFM_BONE_ENVELOPE) ebo->parent->rad_tail= ebo->rad_head;
}
}
@@ -736,7 +736,7 @@ static void recalcData_view3d(TransInfo *t)
float qrot[4];
ebo = td->extra;
- VECCOPY(up_axis, td->axismtx[2]);
+ copy_v3_v3(up_axis, td->axismtx[2]);
if (t->mode != TFM_ROTATION)
{
@@ -1259,12 +1259,12 @@ void applyTransObjects(TransInfo *t)
TransData *td;
for (td = t->data; td < t->data + t->total; td++) {
- VECCOPY(td->iloc, td->loc);
+ copy_v3_v3(td->iloc, td->loc);
if (td->ext->rot) {
- VECCOPY(td->ext->irot, td->ext->rot);
+ copy_v3_v3(td->ext->irot, td->ext->rot);
}
if (td->ext->size) {
- VECCOPY(td->ext->isize, td->ext->size);
+ copy_v3_v3(td->ext->isize, td->ext->size);
}
}
recalcData(t);
@@ -1273,7 +1273,7 @@ void applyTransObjects(TransInfo *t)
static void restoreElement(TransData *td) {
/* TransData for crease has no loc */
if (td->loc) {
- VECCOPY(td->loc, td->iloc);
+ copy_v3_v3(td->loc, td->iloc);
}
if (td->val) {
*td->val = td->ival;
@@ -1281,17 +1281,17 @@ static void restoreElement(TransData *td) {
if (td->ext && (td->flag&TD_NO_EXT)==0) {
if (td->ext->rot) {
- VECCOPY(td->ext->rot, td->ext->irot);
+ copy_v3_v3(td->ext->rot, td->ext->irot);
}
if(td->ext->rotAngle) {
*td->ext->rotAngle= td->ext->irotAngle;
}
if(td->ext->rotAxis) {
- VECCOPY(td->ext->rotAxis, td->ext->irotAxis);
+ copy_v3_v3(td->ext->rotAxis, td->ext->irotAxis);
}
/* XXX, drotAngle & drotAxis not used yet */
if (td->ext->size) {
- VECCOPY(td->ext->size, td->ext->isize);
+ copy_v3_v3(td->ext->size, td->ext->isize);
}
if (td->ext->quat) {
QUATCOPY(td->ext->quat, td->ext->iquat);
@@ -1335,7 +1335,7 @@ void calculateCenter2D(TransInfo *t)
Object *ob= t->obedit?t->obedit:t->poseobj;
float vec[3];
- VECCOPY(vec, t->center);
+ copy_v3_v3(vec, t->center);
mul_m4_v3(ob->obmat, vec);
projectIntView(t, vec, t->center2d);
}
@@ -1349,7 +1349,7 @@ void calculateCenterCursor(TransInfo *t)
float *cursor;
cursor = give_cursor(t->scene, t->view);
- VECCOPY(t->center, cursor);
+ copy_v3_v3(t->center, cursor);
/* If edit or pose mode, move cursor in local space */
if (t->flag & (T_EDIT|T_POSE)) {
@@ -1421,7 +1421,7 @@ void calculateCenterMedian(TransInfo *t)
}
if(i)
mul_v3_fl(partial, 1.0f / total);
- VECCOPY(t->center, partial);
+ copy_v3_v3(t->center, partial);
calculateCenter2D(t);
}
@@ -1446,8 +1446,8 @@ void calculateCenterBound(TransInfo *t)
}
}
else {
- VECCOPY(max, t->data[i].center);
- VECCOPY(min, t->data[i].center);
+ copy_v3_v3(max, t->data[i].center);
+ copy_v3_v3(min, t->data[i].center);
}
}
add_v3_v3v3(t->center, min, max);
@@ -1501,7 +1501,7 @@ void calculateCenter(TransInfo *t)
Object *ob= OBACT;
if(ob)
{
- VECCOPY(t->center, ob->obmat[3]);
+ copy_v3_v3(t->center, ob->obmat[3]);
projectIntView(t, t->center, t->center2d);
}
}
@@ -1510,7 +1510,7 @@ void calculateCenter(TransInfo *t)
}
/* setting constraint center */
- VECCOPY(t->con.center, t->center);
+ copy_v3_v3(t->con.center, t->center);
if(t->flag & (T_EDIT|T_POSE))
{
Object *ob= t->obedit?t->obedit:t->poseobj;
@@ -1530,7 +1530,7 @@ void calculateCenter(TransInfo *t)
{
float axis[3];
/* persinv is nasty, use viewinv instead, always right */
- VECCOPY(axis, t->viewinv[2]);
+ copy_v3_v3(axis, t->viewinv[2]);
normalize_v3(axis);
/* 6.0 = 6 grid units */
@@ -1543,8 +1543,8 @@ void calculateCenter(TransInfo *t)
/* rotate only needs correct 2d center, grab needs initgrabz() value */
if(t->mode==TFM_TRANSLATION)
{
- VECCOPY(t->center, axis);
- VECCOPY(t->con.center, t->center);
+ copy_v3_v3(t->center, axis);
+ copy_v3_v3(t->con.center, t->center);
}
}
}
@@ -1557,7 +1557,7 @@ void calculateCenter(TransInfo *t)
Object *ob= t->obedit?t->obedit:t->poseobj;
float vec[3];
- VECCOPY(vec, t->center);
+ copy_v3_v3(vec, t->center);
mul_m4_v3(ob->obmat, vec);
initgrabz(t->ar->regiondata, vec[0], vec[1], vec[2]);
}
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index d62227a122d..491666c4ac9 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -884,7 +884,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
if(arcs) {
/* clipplane makes nice handles, calc here because of multmatrix but with translate! */
- VECCOPY(plane, rv3d->viewinv[2]);
+ VECCOPY(plane, rv3d->viewinv[2]); /* float -> double */
plane[3]= -0.02f*size; // clip just a bit more
glClipPlane(GL_CLIP_PLANE0, plane);
}
@@ -1498,15 +1498,15 @@ void BIF_draw_manipulator(const bContext *C)
if(v3d->around==V3D_ACTIVE && scene->obedit==NULL) {
Object *ob= OBACT;
if(ob && !(ob->mode & OB_MODE_POSE))
- VECCOPY(rv3d->twmat[3], ob->obmat[3]);
+ copy_v3_v3(rv3d->twmat[3], ob->obmat[3]);
}
break;
case V3D_LOCAL:
case V3D_CENTROID:
- VECCOPY(rv3d->twmat[3], scene->twcent);
+ copy_v3_v3(rv3d->twmat[3], scene->twcent);
break;
case V3D_CURSOR:
- VECCOPY(rv3d->twmat[3], give_cursor(scene, v3d));
+ copy_v3_v3(rv3d->twmat[3], give_cursor(scene, v3d));
break;
}
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 2d539055db3..847fd951bcc 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -222,7 +222,7 @@ int createSpaceNormal(float mat[3][3], float normal[3])
{
float tangent[3] = {0.0f, 0.0f, 1.0f};
- VECCOPY(mat[2], normal);
+ copy_v3_v3(mat[2], normal);
if (normalize_v3(mat[2]) == 0.0f) {
return 0; /* error return */
}
@@ -243,7 +243,7 @@ int createSpaceNormal(float mat[3][3], float normal[3])
int createSpaceNormalTangent(float mat[3][3], float normal[3], float tangent[3])
{
- VECCOPY(mat[2], normal);
+ copy_v3_v3(mat[2], normal);
if (normalize_v3(mat[2]) == 0.0f) {
return 0; /* error return */
}
@@ -659,7 +659,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
for(eed= em->edges.first; eed; eed= eed->next) {
if(eed->f & SELECT) {
/* use average vert normals as plane and edge vector as normal */
- VECCOPY(plane, eed->v1->no);
+ copy_v3_v3(plane, eed->v1->no);
VECADD(plane, plane, eed->v2->no);
sub_v3_v3v3(normal, eed->v2->co, eed->v1->co);
break;
@@ -680,7 +680,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
else {
v2 = eve;
- VECCOPY(plane, v1->no);
+ copy_v3_v3(plane, v1->no);
VECADD(plane, plane, v2->no);
sub_v3_v3v3(normal, v2->co, v1->co);
break;
@@ -694,7 +694,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
for (eve = em->verts.first; eve; eve = eve->next)
{
if ( eve->f & SELECT ) {
- VECCOPY(normal, eve->no);
+ copy_v3_v3(normal, eve->no);
break;
}
}
@@ -792,7 +792,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
/* Rotation of MetaElem is stored in quat */
quat_to_mat4( mat,ml_sel->quat);
- VECCOPY(normal, mat[2]);
+ copy_v3_v3(normal, mat[2]);
negate_v3_v3(plane, mat[1]);
@@ -893,8 +893,8 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
}
if (ob) {
- VECCOPY(normal, ob->obmat[2]);
- VECCOPY(plane, ob->obmat[1]);
+ copy_v3_v3(normal, ob->obmat[2]);
+ copy_v3_v3(plane, ob->obmat[1]);
}
result = ORIENTATION_NORMAL;
}
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index ca89670dedb..17fd7517d71 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -264,7 +264,7 @@ void applyProject(TransInfo *t)
if (td->flag & TD_SKIP)
continue;
- VECCOPY(iloc, td->loc);
+ copy_v3_v3(iloc, td->loc);
if (t->flag & (T_EDIT|T_POSE))
{
Object *ob = t->obedit?t->obedit:t->poseobj;
@@ -274,7 +274,7 @@ void applyProject(TransInfo *t)
{
td->ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
object_handle_update(t->scene, td->ob);
- VECCOPY(iloc, td->ob->obmat[3]);
+ copy_v3_v3(iloc, td->ob->obmat[3]);
}
project_float(t->ar, iloc, mval);
@@ -543,7 +543,7 @@ void addSnapPoint(TransInfo *t)
if (t->tsnap.status & POINT_INIT) {
TransSnapPoint *p = MEM_callocN(sizeof(TransSnapPoint), "SnapPoint");
- VECCOPY(p->co, t->tsnap.snapPoint);
+ copy_v3_v3(p->co, t->tsnap.snapPoint);
BLI_addtail(&t->tsnap.points, p);
@@ -580,7 +580,7 @@ void getSnapPoint(TransInfo *t, float vec[3])
mul_v3_fl(vec, 1.0f / total);
} else {
- VECCOPY(vec, t->tsnap.snapPoint)
+ copy_v3_v3(vec, t->tsnap.snapPoint);
}
}
@@ -628,7 +628,7 @@ float RotationBetween(TransInfo *t, float p1[3], float p2[3])
{
float angle, start[3], end[3], center[3];
- VECCOPY(center, t->center);
+ copy_v3_v3(center, t->center);
if(t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
mul_m4_v3(ob->obmat, center);
@@ -684,7 +684,7 @@ float ResizeBetween(TransInfo *t, float p1[3], float p2[3])
{
float d1[3], d2[3], center[3];
- VECCOPY(center, t->center);
+ copy_v3_v3(center, t->center);
if(t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
mul_m4_v3(ob->obmat, center);
@@ -784,12 +784,12 @@ void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
}
else
{
- VECCOPY(vec, p1->p);
+ copy_v3_v3(vec, p1->p);
}
if (last_p == NULL)
{
- VECCOPY(p, vec);
+ copy_v3_v3(p, vec);
max_dist = 0;
break;
}
@@ -798,7 +798,7 @@ void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
if (new_dist < max_dist)
{
- VECCOPY(p, vec);
+ copy_v3_v3(p, vec);
max_dist = new_dist;
}
}
@@ -806,7 +806,7 @@ void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
if (max_dist != FLT_MAX)
{
- VECCOPY(loc, p);
+ copy_v3_v3(loc, p);
/* XXX, is there a correct normal in this case ???, for now just z up */
no[0]= 0.0;
no[1]= 0.0;
@@ -830,11 +830,11 @@ void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
if (dot_v3v3(tangent, tangent) > 0)
{
- VECCOPY(t->tsnap.snapTangent, tangent);
+ copy_v3_v3(t->tsnap.snapTangent, tangent);
}
- VECCOPY(t->tsnap.snapPoint, loc);
- VECCOPY(t->tsnap.snapNormal, no);
+ copy_v3_v3(t->tsnap.snapPoint, loc);
+ copy_v3_v3(t->tsnap.snapNormal, no);
t->tsnap.status |= POINT_INIT;
}
@@ -873,7 +873,7 @@ void TargetSnapCenter(TransInfo *t)
// Only need to calculate once
if ((t->tsnap.status & TARGET_INIT) == 0)
{
- VECCOPY(t->tsnap.snapTarget, t->center);
+ copy_v3_v3(t->tsnap.snapTarget, t->center);
if(t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
mul_m4_v3(ob->obmat, t->tsnap.snapTarget);
@@ -903,7 +903,7 @@ void TargetSnapActive(TransInfo *t)
if (active_td)
{
- VECCOPY(t->tsnap.snapTarget, active_td->center);
+ copy_v3_v3(t->tsnap.snapTarget, active_td->center);
if(t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
@@ -974,14 +974,14 @@ void TargetSnapClosest(TransInfo *t)
float loc[3];
float dist;
- VECCOPY(loc, bb->vec[j]);
+ copy_v3_v3(loc, bb->vec[j]);
mul_m4_v3(td->ext->obmat, loc);
dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist))
{
- VECCOPY(t->tsnap.snapTarget, loc);
+ copy_v3_v3(t->tsnap.snapTarget, loc);
closest = td;
t->tsnap.dist = dist;
}
@@ -993,13 +993,13 @@ void TargetSnapClosest(TransInfo *t)
float loc[3];
float dist;
- VECCOPY(loc, td->center);
+ copy_v3_v3(loc, td->center);
dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist))
{
- VECCOPY(t->tsnap.snapTarget, loc);
+ copy_v3_v3(t->tsnap.snapTarget, loc);
closest = td;
t->tsnap.dist = dist;
}
@@ -1014,7 +1014,7 @@ void TargetSnapClosest(TransInfo *t)
float loc[3];
float dist;
- VECCOPY(loc, td->center);
+ copy_v3_v3(loc, td->center);
if(t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
@@ -1025,7 +1025,7 @@ void TargetSnapClosest(TransInfo *t)
if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist))
{
- VECCOPY(t->tsnap.snapTarget, loc);
+ copy_v3_v3(t->tsnap.snapTarget, loc);
closest = td;
t->tsnap.dist = dist;
}
@@ -1052,11 +1052,11 @@ static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], fl
int screen_loc[2];
int new_dist;
- VECCOPY(intersect, ray_normal_local);
+ copy_v3_v3(intersect, ray_normal_local);
mul_v3_fl(intersect, lambda);
add_v3_v3(intersect, ray_start_local);
- VECCOPY(location, intersect);
+ copy_v3_v3(location, intersect);
if (v4co)
normal_quad_v3( normal,v1co, v2co, v3co, v4co);
@@ -1075,8 +1075,8 @@ static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], fl
*depth = new_depth;
retval = 1;
- VECCOPY(loc, location);
- VECCOPY(no, normal);
+ copy_v3_v3(loc, location);
+ copy_v3_v3(no, normal);
mul_m3_v3(timat, no);
normalize_v3(no);
@@ -1095,7 +1095,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
int result;
int retval = 0;
- VECCOPY(ray_end, ray_normal_local);
+ copy_v3_v3(ray_end, ray_normal_local);
mul_v3_fl(ray_end, 2000);
add_v3_v3v3(ray_end, ray_start_local, ray_end);
@@ -1116,11 +1116,11 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
if (mul > 1) {
mul = 1;
- VECCOPY(intersect, v1co);
+ copy_v3_v3(intersect, v1co);
}
else if (mul < 0) {
mul = 0;
- VECCOPY(intersect, v2co);
+ copy_v3_v3(intersect, v2co);
}
if (dot_v3v3(ray_normal_local, dvec) > 0)
@@ -1130,7 +1130,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
int screen_loc[2];
int new_dist;
- VECCOPY(location, intersect);
+ copy_v3_v3(location, intersect);
mul_m4_v3(obmat, location);
@@ -1164,7 +1164,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
normalize_v3(no);
}
- VECCOPY(loc, location);
+ copy_v3_v3(loc, location);
*dist = new_dist;
}
@@ -1188,7 +1188,7 @@ static int snapVertex(ARegion *ar, float vco[3], short vno[3], float mval[2], fl
int screen_loc[2];
int new_dist;
- VECCOPY(location, vco);
+ copy_v3_v3(location, vco);
mul_m4_v3(obmat, location);
@@ -1202,7 +1202,7 @@ static int snapVertex(ARegion *ar, float vco[3], short vno[3], float mval[2], fl
*depth = new_depth;
retval = 1;
- VECCOPY(loc, location);
+ copy_v3_v3(loc, location);
if (no)
{
@@ -1226,8 +1226,8 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm
invert_m4_m4(imat, obmat);
- VECCOPY(ray_start_local, ray_start);
- VECCOPY(ray_normal_local, ray_normal);
+ copy_v3_v3(ray_start_local, ray_start);
+ copy_v3_v3(ray_normal_local, ray_normal);
mul_m4_v3(imat, ray_start_local);
mul_mat3_m4_v3(imat, ray_normal_local);
@@ -1300,8 +1300,8 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
copy_m3_m4(timat, imat);
transpose_m3(timat);
- VECCOPY(ray_start_local, ray_start);
- VECCOPY(ray_normal_local, ray_normal);
+ copy_v3_v3(ray_start_local, ray_start);
+ copy_v3_v3(ray_normal_local, ray_normal);
mul_m4_v3(imat, ray_start_local);
mul_mat3_m4_v3(imat, ray_normal_local);
@@ -1699,8 +1699,8 @@ static void addDepthPeel(ListBase *depth_peels, float depth, float p[3], float n
peel->depth = depth;
peel->ob = ob;
- VECCOPY(peel->p, p);
- VECCOPY(peel->no, no);
+ copy_v3_v3(peel->p, p);
+ copy_v3_v3(peel->no, no);
BLI_addtail(depth_peels, peel);
@@ -1724,8 +1724,8 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float
copy_m3_m4(timat, imat);
transpose_m3(timat);
- VECCOPY(ray_start_local, ray_start);
- VECCOPY(ray_normal_local, ray_normal);
+ copy_v3_v3(ray_start_local, ray_start);
+ copy_v3_v3(ray_normal_local, ray_normal);
mul_m4_v3(imat, ray_start_local);
mul_mat3_m4_v3(imat, ray_normal_local);
@@ -1757,11 +1757,11 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float
float intersect[3];
float new_depth;
- VECCOPY(intersect, ray_normal_local);
+ copy_v3_v3(intersect, ray_normal_local);
mul_v3_fl(intersect, lambda);
add_v3_v3(intersect, ray_start_local);
- VECCOPY(location, intersect);
+ copy_v3_v3(location, intersect);
if (f->v4)
normal_quad_v3( normal,verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, verts[f->v4].co);
@@ -1787,11 +1787,11 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float
float intersect[3];
float new_depth;
- VECCOPY(intersect, ray_normal_local);
+ copy_v3_v3(intersect, ray_normal_local);
mul_v3_fl(intersect, lambda);
add_v3_v3(intersect, ray_start_local);
- VECCOPY(location, intersect);
+ copy_v3_v3(location, intersect);
if (f->v4)
normal_quad_v3( normal,verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, verts[f->v4].co);
diff --git a/source/blender/editors/util/SConscript b/source/blender/editors/util/SConscript
index a694b211ca4..cfbc735eb5c 100644
--- a/source/blender/editors/util/SConscript
+++ b/source/blender/editors/util/SConscript
@@ -8,4 +8,4 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../makesrna'
incs += ' ../../blenloader'
-env.BlenderLib ( 'bf_editors_util', sources, Split(incs), [], libtype=['core'], priority=[130] )
+env.BlenderLib ( 'bf_editors_util', sources, Split(incs), [], libtype=['core','player'], priority=[330,210] )