replace SIDE_OF_LINE macro with line_point_side_v2() inline function.
made a number of files build without unused warnings.
This commit is contained in:
@@ -979,7 +979,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
|
||||
dl= dl->next;
|
||||
}
|
||||
|
||||
if(totvert && BLI_edgefill(0, 0)) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
|
||||
if(totvert && BLI_edgefill(0)) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
|
||||
|
||||
/* count faces */
|
||||
tot= 0;
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_dynstr.h"
|
||||
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BKE_animsys.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_library.h"
|
||||
@@ -668,7 +669,7 @@ void *copy_libblock(void *rt)
|
||||
return idn;
|
||||
}
|
||||
|
||||
static void free_library(Library *lib)
|
||||
static void free_library(Library *UNUSED(lib))
|
||||
{
|
||||
/* no freeing needed for libraries yet */
|
||||
}
|
||||
@@ -680,7 +681,7 @@ void set_free_windowmanager_cb(void (*func)(bContext *C, wmWindowManager *) )
|
||||
free_windowmanager_cb= func;
|
||||
}
|
||||
|
||||
void animdata_dtar_clear_cb(ID *id, AnimData *adt, void *userdata)
|
||||
void animdata_dtar_clear_cb(ID *UNUSED(id), AnimData *adt, void *userdata)
|
||||
{
|
||||
ChannelDriver *driver;
|
||||
FCurve *fcu;
|
||||
|
||||
@@ -129,6 +129,8 @@ MINLINE int compare_len_v3v3(float a[3], float b[3], float limit);
|
||||
MINLINE int compare_v4v4(float a[4], float b[4], float limit);
|
||||
MINLINE int equals_v4v4(float a[4], float b[4]);
|
||||
|
||||
MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const float pt[2]);
|
||||
|
||||
/********************************** Angles ***********************************/
|
||||
/* - angle with 2 arguments is angle between vector */
|
||||
/* - angle with 3 arguments is angle between 3 points at the middle point */
|
||||
|
||||
@@ -50,7 +50,7 @@ extern "C" {
|
||||
/* scanfill.c: used in displist only... */
|
||||
struct EditVert *BLI_addfillvert(float *vec);
|
||||
struct EditEdge *BLI_addfilledge(struct EditVert *v1, struct EditVert *v2);
|
||||
int BLI_edgefill(int mode, int mat_nr);
|
||||
int BLI_edgefill(int mat_nr);
|
||||
void BLI_end_edgefill(void);
|
||||
|
||||
/* These callbacks are needed to make the lib finction properly */
|
||||
|
||||
@@ -336,20 +336,19 @@ static short IsectLLPt2Df(float x0,float y0,float x1,float y1,
|
||||
return 1;
|
||||
} // end Intersect_Lines
|
||||
|
||||
#define SIDE_OF_LINE(pa,pb,pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1]))
|
||||
/* point in tri */
|
||||
// XXX was called IsectPT2Df
|
||||
|
||||
int isect_point_tri_v2(float pt[2], float v1[2], float v2[2], float v3[2])
|
||||
{
|
||||
if (SIDE_OF_LINE(v1,v2,pt)>=0.0) {
|
||||
if (SIDE_OF_LINE(v2,v3,pt)>=0.0) {
|
||||
if (SIDE_OF_LINE(v3,v1,pt)>=0.0) {
|
||||
if (line_point_side_v2(v1,v2,pt)>=0.0) {
|
||||
if (line_point_side_v2(v2,v3,pt)>=0.0) {
|
||||
if (line_point_side_v2(v3,v1,pt)>=0.0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (! (SIDE_OF_LINE(v2,v3,pt)>=0.0)) {
|
||||
if (! (SIDE_OF_LINE(v3,v1,pt)>=0.0)) {
|
||||
if (! (line_point_side_v2(v2,v3,pt)>=0.0)) {
|
||||
if (! (line_point_side_v2(v3,v1,pt)>=0.0)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -360,18 +359,18 @@ int isect_point_tri_v2(float pt[2], float v1[2], float v2[2], float v3[2])
|
||||
/* point in quad - only convex quads */
|
||||
int isect_point_quad_v2(float pt[2], float v1[2], float v2[2], float v3[2], float v4[2])
|
||||
{
|
||||
if (SIDE_OF_LINE(v1,v2,pt)>=0.0) {
|
||||
if (SIDE_OF_LINE(v2,v3,pt)>=0.0) {
|
||||
if (SIDE_OF_LINE(v3,v4,pt)>=0.0) {
|
||||
if (SIDE_OF_LINE(v4,v1,pt)>=0.0) {
|
||||
if (line_point_side_v2(v1,v2,pt)>=0.0) {
|
||||
if (line_point_side_v2(v2,v3,pt)>=0.0) {
|
||||
if (line_point_side_v2(v3,v4,pt)>=0.0) {
|
||||
if (line_point_side_v2(v4,v1,pt)>=0.0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (! (SIDE_OF_LINE(v2,v3,pt)>=0.0)) {
|
||||
if (! (SIDE_OF_LINE(v3,v4,pt)>=0.0)) {
|
||||
if (! (SIDE_OF_LINE(v4,v1,pt)>=0.0)) {
|
||||
if (! (line_point_side_v2(v2,v3,pt)>=0.0)) {
|
||||
if (! (line_point_side_v2(v3,v4,pt)>=0.0)) {
|
||||
if (! (line_point_side_v2(v4,v1,pt)>=0.0)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -454,5 +454,11 @@ MINLINE int compare_v4v4(float *v1, float *v2, float limit)
|
||||
return 0;
|
||||
}
|
||||
|
||||
MINLINE float line_point_side_v2(const float *l1, const float *l2, const float *pt)
|
||||
{
|
||||
return ((l1[0]-pt[0]) * (l2[1]-pt[1])) -
|
||||
((l2[0]-pt[0]) * (l1[1]-pt[1]));
|
||||
}
|
||||
|
||||
#endif /* BLI_MATH_VECTOR_INLINE */
|
||||
|
||||
|
||||
@@ -747,7 +747,7 @@ static void scanfill(PolyFill *pf, int mat_nr)
|
||||
|
||||
|
||||
|
||||
int BLI_edgefill(int mode, int mat_nr)
|
||||
int BLI_edgefill(int mat_nr)
|
||||
{
|
||||
/*
|
||||
- fill works with its own lists, so create that first (no faces!)
|
||||
|
||||
@@ -113,7 +113,6 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
|
||||
EditVert *eve;
|
||||
float min[3], max[3];
|
||||
int done= 0;
|
||||
int rot_src= RNA_boolean_get(op->ptr, "rotate_source");
|
||||
|
||||
em_setup_viewcontext(C, &vc);
|
||||
|
||||
@@ -130,14 +129,13 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
|
||||
|
||||
/* call extrude? */
|
||||
if(done) {
|
||||
int rot_src= RNA_boolean_get(op->ptr, "rotate_source");
|
||||
EditEdge *eed;
|
||||
float vec[3], cent[3], mat[3][3];
|
||||
float nor[3]= {0.0, 0.0, 0.0};
|
||||
|
||||
/* 2D normal calc */
|
||||
float mval_f[2]= {(float)event->mval[0], (float)event->mval[1]};
|
||||
|
||||
#define SIDE_OF_LINE(pa,pb,pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1]))
|
||||
|
||||
done= 0;
|
||||
|
||||
@@ -155,7 +153,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
|
||||
*
|
||||
* accumulate the screenspace normal in 2D,
|
||||
* with screenspace edge length weighting the result. */
|
||||
if(SIDE_OF_LINE(co1, co2, mval_f) >= 0.0f) {
|
||||
if(line_point_side_v2(co1, co2, mval_f) >= 0.0f) {
|
||||
nor[0] += (co1[1] - co2[1]);
|
||||
nor[1] += -(co1[0] - co2[0]);
|
||||
}
|
||||
@@ -167,8 +165,6 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
#undef SIDE_OF_LINE
|
||||
|
||||
if(done) {
|
||||
float view_vec[3], cross[3];
|
||||
|
||||
|
||||
@@ -7003,7 +7003,7 @@ static void fill_mesh(EditMesh *em)
|
||||
}
|
||||
}
|
||||
|
||||
if(BLI_edgefill(0, em->mat_nr)) {
|
||||
if(BLI_edgefill(em->mat_nr)) {
|
||||
efa= fillfacebase.first;
|
||||
while(efa) {
|
||||
/* normals default pointing up */
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
/* ****************** render BAKING ********************** */
|
||||
|
||||
/* threaded break test */
|
||||
static int thread_break(void *unused)
|
||||
static int thread_break(void *UNUSED(arg))
|
||||
{
|
||||
return G.afbreek;
|
||||
}
|
||||
|
||||
@@ -511,7 +511,7 @@ static int edit_constraint_invoke_properties(bContext *C, wmOperator *op)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bConstraint *edit_constraint_property_get(bContext *C, wmOperator *op, Object *ob, int type)
|
||||
static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int type)
|
||||
{
|
||||
char constraint_name[32];
|
||||
int owner = RNA_enum_get(op->ptr, "owner");
|
||||
@@ -547,7 +547,7 @@ static bConstraint *edit_constraint_property_get(bContext *C, wmOperator *op, Ob
|
||||
static int stretchto_reset_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_active_context(C);
|
||||
bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_STRETCHTO);
|
||||
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_STRETCHTO);
|
||||
bStretchToConstraint *data= (con) ? (bStretchToConstraint *)con->data : NULL;
|
||||
|
||||
/* despite 3 layers of checks, we may still not be able to find a constraint */
|
||||
@@ -590,7 +590,7 @@ void CONSTRAINT_OT_stretchto_reset (wmOperatorType *ot)
|
||||
static int limitdistance_reset_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_active_context(C);
|
||||
bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_DISTLIMIT);
|
||||
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_DISTLIMIT);
|
||||
bDistLimitConstraint *data= (con) ? (bDistLimitConstraint *)con->data : NULL;
|
||||
|
||||
/* despite 3 layers of checks, we may still not be able to find a constraint */
|
||||
@@ -636,7 +636,7 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *ob = ED_object_active_context(C);
|
||||
bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_CHILDOF);
|
||||
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
|
||||
bChildOfConstraint *data= (con) ? (bChildOfConstraint *)con->data : NULL;
|
||||
bPoseChannel *pchan= NULL;
|
||||
|
||||
@@ -720,7 +720,7 @@ void CONSTRAINT_OT_childof_set_inverse (wmOperatorType *ot)
|
||||
static int childof_clear_inverse_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_active_context(C);
|
||||
bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_CHILDOF);
|
||||
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
|
||||
bChildOfConstraint *data= (con) ? (bChildOfConstraint *)con->data : NULL;
|
||||
|
||||
/* simply clear the matrix */
|
||||
@@ -837,7 +837,7 @@ void CONSTRAINT_OT_delete (wmOperatorType *ot)
|
||||
static int constraint_move_down_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_active_context(C);
|
||||
bConstraint *con = edit_constraint_property_get(C, op, ob, 0);
|
||||
bConstraint *con = edit_constraint_property_get(op, ob, 0);
|
||||
|
||||
if (con && con->next) {
|
||||
ListBase *conlist= get_constraint_lb(ob, con, NULL);
|
||||
@@ -885,7 +885,7 @@ void CONSTRAINT_OT_move_down (wmOperatorType *ot)
|
||||
static int constraint_move_up_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_active_context(C);
|
||||
bConstraint *con = edit_constraint_property_get(C, op, ob, 0);
|
||||
bConstraint *con = edit_constraint_property_get(op, ob, 0);
|
||||
|
||||
if (con && con->prev) {
|
||||
ListBase *conlist= get_constraint_lb(ob, con, NULL);
|
||||
|
||||
@@ -557,7 +557,7 @@ static int object_hook_remove_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *ptr, int *free)
|
||||
static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
|
||||
{
|
||||
Object *ob = CTX_data_edit_object(C);
|
||||
EnumPropertyItem tmp = {0, "", 0, "", ""};
|
||||
|
||||
@@ -161,7 +161,7 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ED_object_shape_key_mirror(bContext *C, Scene *scene, Object *ob)
|
||||
static int object_shape_key_mirror(bContext *C, Object *ob)
|
||||
{
|
||||
KeyBlock *kb;
|
||||
Key *key;
|
||||
@@ -327,10 +327,9 @@ void OBJECT_OT_shape_key_clear(wmOperatorType *ot)
|
||||
|
||||
static int shape_key_mirror_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
|
||||
if(!ED_object_shape_key_mirror(C, scene, ob))
|
||||
if(!object_shape_key_mirror(C, ob))
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
||||
@@ -1947,7 +1947,7 @@ static int set_active_group_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *ptr, int *free)
|
||||
static EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
|
||||
{
|
||||
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
EnumPropertyItem tmp = {0, "", 0, "", ""};
|
||||
|
||||
@@ -473,8 +473,6 @@ static int project_bucket_offset_safe(const ProjPaintState *ps, const float proj
|
||||
}
|
||||
}
|
||||
|
||||
#define SIDE_OF_LINE(pa, pb, pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1]))
|
||||
|
||||
/* still use 2D X,Y space but this works for verts transformed by a perspective matrix, using their 4th component as a weight */
|
||||
static void barycentric_weights_v2_persp(float v1[4], float v2[4], float v3[4], float co[2], float w[3])
|
||||
{
|
||||
@@ -1689,7 +1687,7 @@ static float Vec2Lenf_nosqrt_other(const float *v1, const float v2_1, const floa
|
||||
/* note, use a squared value so we can use Vec2Lenf_nosqrt
|
||||
* be sure that you have done a bounds check first or this may fail */
|
||||
/* only give bucket_bounds as an arg because we need it elsewhere */
|
||||
static int project_bucket_isect_circle(const int bucket_x, const int bucket_y, const float cent[2], const float radius_squared, rctf *bucket_bounds)
|
||||
static int project_bucket_isect_circle(const float cent[2], const float radius_squared, rctf *bucket_bounds)
|
||||
{
|
||||
|
||||
/* Would normally to a simple intersection test, however we know the bounds of these 2 already intersect
|
||||
@@ -1852,7 +1850,7 @@ static void project_bucket_clip_face(
|
||||
{
|
||||
int inside_bucket_flag = 0;
|
||||
int inside_face_flag = 0;
|
||||
const int flip = ((SIDE_OF_LINE(v1coSS, v2coSS, v3coSS) > 0.0f) != (SIDE_OF_LINE(uv1co, uv2co, uv3co) > 0.0f));
|
||||
const int flip = ((line_point_side_v2(v1coSS, v2coSS, v3coSS) > 0.0f) != (line_point_side_v2(uv1co, uv2co, uv3co) > 0.0f));
|
||||
|
||||
float bucket_bounds_ss[4][2];
|
||||
|
||||
@@ -2134,15 +2132,15 @@ if __name__ == '__main__':
|
||||
|
||||
|
||||
/* checks if pt is inside a convex 2D polyline, the polyline must be ordered rotating clockwise
|
||||
* otherwise it would have to test for mixed (SIDE_OF_LINE > 0.0f) cases */
|
||||
* otherwise it would have to test for mixed (line_point_side_v2 > 0.0f) cases */
|
||||
int IsectPoly2Df(const float pt[2], float uv[][2], const int tot)
|
||||
{
|
||||
int i;
|
||||
if (SIDE_OF_LINE(uv[tot-1], uv[0], pt) < 0.0f)
|
||||
if (line_point_side_v2(uv[tot-1], uv[0], pt) < 0.0f)
|
||||
return 0;
|
||||
|
||||
for (i=1; i<tot; i++) {
|
||||
if (SIDE_OF_LINE(uv[i-1], uv[i], pt) < 0.0f)
|
||||
if (line_point_side_v2(uv[i-1], uv[i], pt) < 0.0f)
|
||||
return 0;
|
||||
|
||||
}
|
||||
@@ -2152,10 +2150,10 @@ int IsectPoly2Df(const float pt[2], float uv[][2], const int tot)
|
||||
static int IsectPoly2Df_twoside(const float pt[2], float uv[][2], const int tot)
|
||||
{
|
||||
int i;
|
||||
int side = (SIDE_OF_LINE(uv[tot-1], uv[0], pt) > 0.0f);
|
||||
int side = (line_point_side_v2(uv[tot-1], uv[0], pt) > 0.0f);
|
||||
|
||||
for (i=1; i<tot; i++) {
|
||||
if ((SIDE_OF_LINE(uv[i-1], uv[i], pt) > 0.0f) != side)
|
||||
if ((line_point_side_v2(uv[i-1], uv[i], pt) > 0.0f) != side)
|
||||
return 0;
|
||||
|
||||
}
|
||||
@@ -2652,7 +2650,7 @@ static void project_bucket_init(const ProjPaintState *ps, const int thread_index
|
||||
* calculated when it might not be needed later, (at the moment at least)
|
||||
* obviously it shouldn't have bugs though */
|
||||
|
||||
static int project_bucket_face_isect(ProjPaintState *ps, float min[2], float max[2], int bucket_x, int bucket_y, int bucket_index, const MFace *mf)
|
||||
static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucket_y, const MFace *mf)
|
||||
{
|
||||
/* TODO - replace this with a tricker method that uses sideofline for all screenCoords's edges against the closest bucket corner */
|
||||
rctf bucket_bounds;
|
||||
@@ -2712,11 +2710,11 @@ static int project_bucket_face_isect(ProjPaintState *ps, float min[2], float max
|
||||
|
||||
/* Add faces to the bucket but dont initialize its pixels
|
||||
* TODO - when painting occluded, sort the faces on their min-Z and only add faces that faces that are not occluded */
|
||||
static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf, const MTFace *tf, const int face_index)
|
||||
static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf, const int face_index)
|
||||
{
|
||||
float min[2], max[2], *vCoSS;
|
||||
int bucketMin[2], bucketMax[2]; /* for ps->bucketRect indexing */
|
||||
int fidx, bucket_x, bucket_y, bucket_index;
|
||||
int fidx, bucket_x, bucket_y;
|
||||
int has_x_isect = -1, has_isect = 0; /* for early loop exit */
|
||||
MemArena *arena = ps->arena_mt[0]; /* just use the first thread arena since threading has not started yet */
|
||||
|
||||
@@ -2733,10 +2731,8 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf,
|
||||
for (bucket_y = bucketMin[1]; bucket_y < bucketMax[1]; bucket_y++) {
|
||||
has_x_isect = 0;
|
||||
for (bucket_x = bucketMin[0]; bucket_x < bucketMax[0]; bucket_x++) {
|
||||
|
||||
bucket_index = bucket_x + (bucket_y * ps->buckets_x);
|
||||
|
||||
if (project_bucket_face_isect(ps, min, max, bucket_x, bucket_y, bucket_index, mf)) {
|
||||
if (project_bucket_face_isect(ps, bucket_x, bucket_y, mf)) {
|
||||
int bucket_index= bucket_x + (bucket_y * ps->buckets_x);
|
||||
BLI_linklist_prepend_arena(
|
||||
&ps->bucketFaces[ bucket_index ],
|
||||
SET_INT_IN_POINTER(face_index), /* cast to a pointer to shut up the compiler */
|
||||
@@ -3194,7 +3190,7 @@ static void project_paint_begin(ProjPaintState *ps)
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (SIDE_OF_LINE(v1coSS, v2coSS, v3coSS) < 0.0f) {
|
||||
if (line_point_side_v2(v1coSS, v2coSS, v3coSS) < 0.0f) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3217,7 +3213,7 @@ static void project_paint_begin(ProjPaintState *ps)
|
||||
if (image_index != -1) {
|
||||
/* Initialize the faces screen pixels */
|
||||
/* Add this to a list to initialize later */
|
||||
project_paint_delayed_face_init(ps, mf, tf, face_index);
|
||||
project_paint_delayed_face_init(ps, mf, face_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3500,7 +3496,7 @@ static int project_bucket_iter_next(ProjPaintState *ps, int *bucket_index, rctf
|
||||
project_bucket_bounds(ps, ps->context_bucket_x, ps->context_bucket_y, bucket_bounds);
|
||||
|
||||
if ( (ps->source != PROJ_SRC_VIEW) ||
|
||||
project_bucket_isect_circle(ps->context_bucket_x, ps->context_bucket_y, mval, (float)(diameter*diameter), bucket_bounds)
|
||||
project_bucket_isect_circle(mval, (float)(diameter*diameter), bucket_bounds)
|
||||
) {
|
||||
*bucket_index = ps->context_bucket_x + (ps->context_bucket_y * ps->buckets_x);
|
||||
ps->context_bucket_x++;
|
||||
@@ -3569,7 +3565,7 @@ static void blend_color_mix_accum(unsigned char *cp, const unsigned char *cp1, c
|
||||
cp[3]= alpha > 255 ? 255 : alpha;
|
||||
}
|
||||
|
||||
static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask)
|
||||
static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask)
|
||||
{
|
||||
if (ps->is_airbrush==0 && mask < 1.0f) {
|
||||
projPixel->newColor.uint = IMB_blend_color(projPixel->newColor.uint, ((ProjPixelClone*)projPixel)->clonepx.uint, (int)(alpha*255), ps->blend);
|
||||
@@ -3580,7 +3576,7 @@ static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, floa
|
||||
}
|
||||
}
|
||||
|
||||
static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask)
|
||||
static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask)
|
||||
{
|
||||
if (ps->is_airbrush==0 && mask < 1.0f) {
|
||||
IMB_blend_color_float(projPixel->newColor.f, projPixel->newColor.f, ((ProjPixelClone *)projPixel)->clonepx.f, alpha, ps->blend);
|
||||
@@ -3597,7 +3593,7 @@ static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, fl
|
||||
* accumulation of color greater then 'projPixel->mask' however in the case of smear its not
|
||||
* really that important to be correct as it is with clone and painting
|
||||
*/
|
||||
static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels, float co[2])
|
||||
static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels, float co[2])
|
||||
{
|
||||
unsigned char rgba_ub[4];
|
||||
|
||||
@@ -3608,7 +3604,7 @@ static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, floa
|
||||
BLI_linklist_prepend_arena(smearPixels, (void *)projPixel, smearArena);
|
||||
}
|
||||
|
||||
static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels_f, float co[2])
|
||||
static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels_f, float co[2])
|
||||
{
|
||||
unsigned char rgba_ub[4];
|
||||
unsigned char rgba_smear[4];
|
||||
@@ -3757,6 +3753,7 @@ static void *do_projectpaint_thread(void *ph_v)
|
||||
|
||||
if (falloff > 0.0f) {
|
||||
if (ps->is_texbrush) {
|
||||
/* note, for clone and smear, we only use the alpha, could be a special function */
|
||||
brush_sample_tex(ps->brush, projPixel->projCoSS, rgba, thread_index);
|
||||
alpha = rgba[3];
|
||||
} else {
|
||||
@@ -3808,20 +3805,20 @@ static void *do_projectpaint_thread(void *ph_v)
|
||||
case PAINT_TOOL_CLONE:
|
||||
if (is_floatbuf) {
|
||||
if (((ProjPixelClone *)projPixel)->clonepx.f[3]) {
|
||||
do_projectpaint_clone_f(ps, projPixel, rgba, alpha, mask);
|
||||
do_projectpaint_clone_f(ps, projPixel, alpha, mask); /* rgba isnt used for cloning, only alpha */
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (((ProjPixelClone*)projPixel)->clonepx.ch[3]) {
|
||||
do_projectpaint_clone(ps, projPixel, rgba, alpha, mask);
|
||||
do_projectpaint_clone(ps, projPixel, alpha, mask); /* rgba isnt used for cloning, only alpha */
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PAINT_TOOL_SMEAR:
|
||||
sub_v2_v2v2(co, projPixel->projCoSS, pos_ofs);
|
||||
|
||||
if (is_floatbuf) do_projectpaint_smear_f(ps, projPixel, rgba, alpha, mask, smearArena, &smearPixels_f, co);
|
||||
else do_projectpaint_smear(ps, projPixel, rgba, alpha, mask, smearArena, &smearPixels, co);
|
||||
if (is_floatbuf) do_projectpaint_smear_f(ps, projPixel, alpha, mask, smearArena, &smearPixels_f, co);
|
||||
else do_projectpaint_smear(ps, projPixel, alpha, mask, smearArena, &smearPixels, co);
|
||||
break;
|
||||
default:
|
||||
if (is_floatbuf) do_projectpaint_draw_f(ps, projPixel, rgba, alpha, mask);
|
||||
@@ -3861,7 +3858,7 @@ static void *do_projectpaint_thread(void *ph_v)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int project_paint_op(void *state, ImBuf *ibufb, float *lastpos, float *pos)
|
||||
static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), float *lastpos, float *pos)
|
||||
{
|
||||
/* First unpack args from the struct */
|
||||
ProjPaintState *ps = (ProjPaintState *)state;
|
||||
@@ -3928,7 +3925,7 @@ static int project_paint_op(void *state, ImBuf *ibufb, float *lastpos, float *po
|
||||
}
|
||||
|
||||
|
||||
static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, int *prevmval_i, int *mval_i, double time, float pressure)
|
||||
static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, int *UNUSED(prevmval_i), int *mval_i, double time, float pressure)
|
||||
{
|
||||
|
||||
/* Use mouse coords as floats for projection painting */
|
||||
@@ -4387,7 +4384,7 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint
|
||||
ibuf= BKE_image_get_ibuf(newimage, s->sima? &s->sima->iuser: NULL);
|
||||
|
||||
if(ibuf && ibuf->rect)
|
||||
imapaint_pick_uv(s->scene, s->ob, s->me, newfaceindex, mval, newuv);
|
||||
imapaint_pick_uv(s->scene, s->ob, newfaceindex, mval, newuv);
|
||||
else {
|
||||
newimage = NULL;
|
||||
newuv[0] = newuv[1] = 0.0f;
|
||||
@@ -4398,8 +4395,8 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint
|
||||
|
||||
/* see if stroke is broken, and if so finish painting in old position */
|
||||
if (s->image) {
|
||||
imapaint_pick_uv(s->scene, s->ob, s->me, s->faceindex, mval, fwuv);
|
||||
imapaint_pick_uv(s->scene, s->ob, s->me, newfaceindex, prevmval, bkuv);
|
||||
imapaint_pick_uv(s->scene, s->ob, s->faceindex, mval, fwuv);
|
||||
imapaint_pick_uv(s->scene, s->ob, newfaceindex, prevmval, bkuv);
|
||||
|
||||
if (newimage == s->image)
|
||||
breakstroke= texpaint_break_stroke(s->uv, fwuv, bkuv, newuv);
|
||||
@@ -4410,7 +4407,7 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint
|
||||
fwuv[0]= fwuv[1]= 0.0f;
|
||||
|
||||
if (breakstroke) {
|
||||
imapaint_pick_uv(s->scene, s->ob, s->me, s->faceindex, mval, fwuv);
|
||||
imapaint_pick_uv(s->scene, s->ob, s->faceindex, mval, fwuv);
|
||||
redraw |= imapaint_paint_sub_stroke(s, painter, s->image, texpaint,
|
||||
fwuv, time, 1, pressure);
|
||||
imapaint_clear_partial_redraw();
|
||||
@@ -4923,7 +4920,7 @@ static int get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy)
|
||||
|
||||
/************************ cursor drawing *******************************/
|
||||
|
||||
static void brush_drawcursor(bContext *C, int x, int y, void *customdata)
|
||||
static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata))
|
||||
{
|
||||
Brush *brush= image_paint_brush(C);
|
||||
Paint *paint= paint_get_active(CTX_data_scene(C));
|
||||
|
||||
@@ -99,7 +99,7 @@ void PAINT_OT_image_from_view(struct wmOperatorType *ot);
|
||||
|
||||
/* paint_utils.c */
|
||||
int imapaint_pick_face(struct ViewContext *vc, struct Mesh *me, int *mval, unsigned int *index);
|
||||
void imapaint_pick_uv(struct Scene *scene, struct Object *ob, struct Mesh *mesh, unsigned int faceindex, int *xy, float *uv);
|
||||
void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, int *xy, float *uv);
|
||||
|
||||
void paint_sample_color(struct Scene *scene, struct ARegion *ar, int x, int y);
|
||||
void BRUSH_OT_curve_preset(struct wmOperatorType *ot);
|
||||
|
||||
@@ -253,7 +253,7 @@ static void make_snap(Snapshot* snap, Brush* brush, ViewContext* vc)
|
||||
snap->winy = vc->ar->winy;
|
||||
}
|
||||
|
||||
int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
|
||||
static int load_tex(Brush* br, ViewContext* vc)
|
||||
{
|
||||
static GLuint overlay_texture = 0;
|
||||
static int init = 0;
|
||||
@@ -611,7 +611,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *unused)
|
||||
GL_VIEWPORT_BIT|
|
||||
GL_TEXTURE_BIT);
|
||||
|
||||
if (load_tex(sd, brush, &vc)) {
|
||||
if (load_tex(brush, &vc)) {
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
|
||||
@@ -88,7 +88,7 @@ static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, fl
|
||||
}
|
||||
|
||||
/* compute uv coordinates of mouse in face */
|
||||
void imapaint_pick_uv(Scene *scene, Object *ob, Mesh *mesh, unsigned int faceindex, int *xy, float *uv)
|
||||
void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, int *xy, float *uv)
|
||||
{
|
||||
DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
|
||||
int *index = dm->getFaceDataArray(dm, CD_ORIGINDEX);
|
||||
|
||||
@@ -488,7 +488,7 @@ static void free_posetree(PoseTree *tree)
|
||||
///----------------------------------------
|
||||
/// Plugin API for legacy iksolver
|
||||
|
||||
void iksolver_initialize_tree(struct Scene *scene, struct Object *ob, float ctime)
|
||||
void iksolver_initialize_tree(struct Scene *UNUSED(scene), struct Object *ob, float UNUSED(ctime))
|
||||
{
|
||||
bPoseChannel *pchan;
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ static void draw_filled_lasso(wmGesture *gt)
|
||||
/* highly unlikely this will fail, but could crash if (gt->points == 0) */
|
||||
if(firstv) {
|
||||
BLI_addfilledge(firstv, v);
|
||||
BLI_edgefill(0, 0);
|
||||
BLI_edgefill(0);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glColor4f(1.0, 1.0, 1.0, 0.05);
|
||||
|
||||
Reference in New Issue
Block a user