bugfix [#24264] toggle UV selection fails.
was using the 4th selection flag on tri's. also some minor changes, removed unused args and corrected some comments.
This commit is contained in:
@@ -2237,7 +2237,7 @@ static void mesh_build_data(Scene *scene, Object *ob, CustomDataMask dataMask)
|
|||||||
Object *obact = scene->basact?scene->basact->object:NULL;
|
Object *obact = scene->basact?scene->basact->object:NULL;
|
||||||
int editing = paint_facesel_test(ob);
|
int editing = paint_facesel_test(ob);
|
||||||
/* weight paint and face select need original indicies because of selection buffer drawing */
|
/* weight paint and face select need original indicies because of selection buffer drawing */
|
||||||
int needMapping = (ob==obact) && (editing || (ob->mode & (OB_MODE_WEIGHT_PAINT|OB_MODE_VERTEX_PAINT)) || editing);
|
int needMapping = (ob==obact) && (editing || (ob->mode & (OB_MODE_WEIGHT_PAINT|OB_MODE_VERTEX_PAINT)));
|
||||||
|
|
||||||
clear_mesh_caches(ob);
|
clear_mesh_caches(ob);
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ void ED_operatortypes_uvedit(void);
|
|||||||
void ED_keymap_uvedit(struct wmKeyConfig *keyconf);
|
void ED_keymap_uvedit(struct wmKeyConfig *keyconf);
|
||||||
|
|
||||||
void ED_uvedit_assign_image(struct Scene *scene, struct Object *obedit, struct Image *ima, struct Image *previma);
|
void ED_uvedit_assign_image(struct Scene *scene, struct Object *obedit, struct Image *ima, struct Image *previma);
|
||||||
void ED_uvedit_set_tile(struct bContext *C, struct Scene *scene, struct Object *obedit, struct Image *ima, int curtile, int dotile);
|
|
||||||
int ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float *min, float *max);
|
int ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float *min, float *max);
|
||||||
|
|
||||||
int ED_uvedit_test_silent(struct Object *obedit);
|
int ED_uvedit_test_silent(struct Object *obedit);
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
project_float_noclip(vc.ar, co1, co1);
|
project_float_noclip(vc.ar, co1, co1);
|
||||||
project_float_noclip(vc.ar, co2, co2);
|
project_float_noclip(vc.ar, co2, co2);
|
||||||
|
|
||||||
/* 2D rotate by 90d while subtracting
|
/* 2D rotate by 90d while adding.
|
||||||
* (x, y) = (y, -x)
|
* (x, y) = (y, -x)
|
||||||
*
|
*
|
||||||
* accumulate the screenspace normal in 2D,
|
* accumulate the screenspace normal in 2D,
|
||||||
@@ -181,14 +181,11 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
cross_v3_v3v3(cross, nor, view_vec);
|
cross_v3_v3v3(cross, nor, view_vec);
|
||||||
cross_v3_v3v3(nor, view_vec, cross);
|
cross_v3_v3v3(nor, view_vec, cross);
|
||||||
normalize_v3(nor);
|
normalize_v3(nor);
|
||||||
|
|
||||||
/* correct for flipping */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* center */
|
/* center */
|
||||||
add_v3_v3v3(cent, min, max);
|
mid_v3_v3v3(cent, min, max);
|
||||||
mul_v3_fl(cent, 0.5f);
|
copy_v3_v3(min, cent);
|
||||||
VECCOPY(min, cent);
|
|
||||||
|
|
||||||
mul_m4_v3(vc.obedit->obmat, min); // view space
|
mul_m4_v3(vc.obedit->obmat, min); // view space
|
||||||
view3d_get_view_aligned_coordinate(&vc, min, event->mval);
|
view3d_get_view_aligned_coordinate(&vc, min, event->mval);
|
||||||
@@ -201,7 +198,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
if(done) {
|
if(done) {
|
||||||
float dot;
|
float dot;
|
||||||
|
|
||||||
VECCOPY(vec, min);
|
copy_v3_v3(vec, min);
|
||||||
normalize_v3(vec);
|
normalize_v3(vec);
|
||||||
dot= INPR(vec, nor);
|
dot= INPR(vec, nor);
|
||||||
|
|
||||||
@@ -241,7 +238,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
float mat[3][3],imat[3][3];
|
float mat[3][3],imat[3][3];
|
||||||
float *curs= give_cursor(vc.scene, vc.v3d);
|
float *curs= give_cursor(vc.scene, vc.v3d);
|
||||||
|
|
||||||
VECCOPY(min, curs);
|
copy_v3_v3(min, curs);
|
||||||
view3d_get_view_aligned_coordinate(&vc, min, event->mval);
|
view3d_get_view_aligned_coordinate(&vc, min, event->mval);
|
||||||
|
|
||||||
eve= addvertlist(vc.em, 0, NULL);
|
eve= addvertlist(vc.em, 0, NULL);
|
||||||
@@ -249,7 +246,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
copy_m3_m4(mat, vc.obedit->obmat);
|
copy_m3_m4(mat, vc.obedit->obmat);
|
||||||
invert_m3_m3(imat, mat);
|
invert_m3_m3(imat, mat);
|
||||||
|
|
||||||
VECCOPY(eve->co, min);
|
copy_v3_v3(eve->co, min);
|
||||||
mul_m3_v3(imat, eve->co);
|
mul_m3_v3(imat, eve->co);
|
||||||
sub_v3_v3v3(eve->co, eve->co, vc.obedit->obmat[3]);
|
sub_v3_v3v3(eve->co, eve->co, vc.obedit->obmat[3]);
|
||||||
|
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ static void node_menu_add(const bContext *C, Menu *menu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void node_menus_register(ARegionType *art)
|
void node_menus_register(void)
|
||||||
{
|
{
|
||||||
MenuType *mt;
|
MenuType *mt;
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ ARegion *node_has_buttons_region(ScrArea *sa);
|
|||||||
|
|
||||||
/* node_header.c */
|
/* node_header.c */
|
||||||
void node_header_buttons(const bContext *C, ARegion *ar);
|
void node_header_buttons(const bContext *C, ARegion *ar);
|
||||||
void node_menus_register(struct ARegionType *art);
|
void node_menus_register(void);
|
||||||
|
|
||||||
/* node_draw.c */
|
/* node_draw.c */
|
||||||
void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d);
|
void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d);
|
||||||
|
|||||||
@@ -452,7 +452,7 @@ void ED_spacetype_node(void)
|
|||||||
|
|
||||||
BLI_addhead(&st->regiontypes, art);
|
BLI_addhead(&st->regiontypes, art);
|
||||||
|
|
||||||
node_menus_register(art);
|
node_menus_register();
|
||||||
|
|
||||||
/* regions: listview/buttons */
|
/* regions: listview/buttons */
|
||||||
art= MEM_callocN(sizeof(ARegionType), "spacetype node region");
|
art= MEM_callocN(sizeof(ARegionType), "spacetype node region");
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ void ED_uvedit_assign_image(Scene *scene, Object *obedit, Image *ima, Image *pre
|
|||||||
|
|
||||||
/* dotile - 1, set the tile flag (from the space image)
|
/* dotile - 1, set the tile flag (from the space image)
|
||||||
* 2, set the tile index for the faces. */
|
* 2, set the tile index for the faces. */
|
||||||
void ED_uvedit_set_tile(bContext *C, Scene *scene, Object *obedit, Image *ima, int curtile)
|
static int uvedit_set_tile(Object *obedit, Image *ima, int curtile)
|
||||||
{
|
{
|
||||||
EditMesh *em;
|
EditMesh *em;
|
||||||
EditFace *efa;
|
EditFace *efa;
|
||||||
@@ -149,11 +149,14 @@ void ED_uvedit_set_tile(bContext *C, Scene *scene, Object *obedit, Image *ima, i
|
|||||||
|
|
||||||
/* verify if we have something to do */
|
/* verify if we have something to do */
|
||||||
if(!ima || !ED_uvedit_test(obedit))
|
if(!ima || !ED_uvedit_test(obedit))
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
|
if((ima->tpageflag & IMA_TILES) == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* skip assigning these procedural images... */
|
/* skip assigning these procedural images... */
|
||||||
if(ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE)
|
if(ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE)
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
|
em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
|
||||||
|
|
||||||
@@ -165,8 +168,9 @@ void ED_uvedit_set_tile(bContext *C, Scene *scene, Object *obedit, Image *ima, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
|
DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
|
||||||
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
|
|
||||||
BKE_mesh_end_editmesh(obedit->data, em);
|
BKE_mesh_end_editmesh(obedit->data, em);
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************** space conversion *********************/
|
/*********************** space conversion *********************/
|
||||||
@@ -845,7 +849,8 @@ static void select_linked(Scene *scene, Image *ima, EditMesh *em, float limit[2]
|
|||||||
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
|
|
||||||
if(uvedit_face_visible(scene, ima, efa, tf)) {
|
if(uvedit_face_visible(scene, ima, efa, tf)) {
|
||||||
if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)) {
|
const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
|
||||||
|
if(tf->flag & select_flag) {
|
||||||
stack[stacksize]= a;
|
stack[stacksize]= a;
|
||||||
stacksize++;
|
stacksize++;
|
||||||
flag[a]= 1;
|
flag[a]= 1;
|
||||||
@@ -909,12 +914,9 @@ static void select_linked(Scene *scene, Image *ima, EditMesh *em, float limit[2]
|
|||||||
else {
|
else {
|
||||||
for(a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
|
for(a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
|
||||||
if(flag[a]) {
|
if(flag[a]) {
|
||||||
|
const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
|
||||||
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
if(efa->v4) {
|
if((tf->flag & select_flag))
|
||||||
if((tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3))
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1355,10 +1357,11 @@ static int select_all_exec(bContext *C, wmOperator *op)
|
|||||||
if (action == SEL_TOGGLE) {
|
if (action == SEL_TOGGLE) {
|
||||||
action = SEL_SELECT;
|
action = SEL_SELECT;
|
||||||
for(efa= em->faces.first; efa; efa= efa->next) {
|
for(efa= em->faces.first; efa; efa= efa->next) {
|
||||||
|
const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
|
||||||
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
|
|
||||||
if(uvedit_face_visible(scene, ima, efa, tf)) {
|
if(uvedit_face_visible(scene, ima, efa, tf)) {
|
||||||
if(tf->flag & (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4)) {
|
if(tf->flag & select_flag) {
|
||||||
action = SEL_DESELECT;
|
action = SEL_DESELECT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1370,12 +1373,7 @@ static int select_all_exec(bContext *C, wmOperator *op)
|
|||||||
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
|
|
||||||
if(uvedit_face_visible(scene, ima, efa, tf)) {
|
if(uvedit_face_visible(scene, ima, efa, tf)) {
|
||||||
char select_flag;
|
const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
|
||||||
|
|
||||||
if(efa->v4)
|
|
||||||
select_flag = (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
|
|
||||||
else
|
|
||||||
select_flag = (TF_SEL1+TF_SEL2+TF_SEL3);
|
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case SEL_SELECT:
|
case SEL_SELECT:
|
||||||
@@ -1937,14 +1935,10 @@ static int unlink_selection_exec(bContext *C, wmOperator *op)
|
|||||||
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
|
|
||||||
if(uvedit_face_visible(scene, ima, efa, tf)) {
|
if(uvedit_face_visible(scene, ima, efa, tf)) {
|
||||||
if(efa->v4) {
|
const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
|
||||||
if(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4))
|
if(~tf->flag & select_flag)
|
||||||
tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
|
tf->flag &= ~select_flag;
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3))
|
|
||||||
tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2260,7 +2254,7 @@ void UV_OT_select_border(wmOperatorType *ot)
|
|||||||
|
|
||||||
/* ******************** circle select operator **************** */
|
/* ******************** circle select operator **************** */
|
||||||
|
|
||||||
static void select_uv_inside_ellipse(SpaceImage *sima, Scene *scene, int select, EditFace *efa, MTFace *tface, int index, float *offset, float *ell, int select_index)
|
static void select_uv_inside_ellipse(Scene *scene, int select, EditFace *efa, MTFace *tface, int index, float *offset, float *ell, int select_index)
|
||||||
{
|
{
|
||||||
/* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */
|
/* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */
|
||||||
float x, y, r2, *uv;
|
float x, y, r2, *uv;
|
||||||
@@ -2309,11 +2303,11 @@ int circle_select_exec(bContext *C, wmOperator *op)
|
|||||||
/* do selection */
|
/* do selection */
|
||||||
for(efa= em->faces.first; efa; efa= efa->next) {
|
for(efa= em->faces.first; efa; efa= efa->next) {
|
||||||
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
select_uv_inside_ellipse(sima, scene, select, efa, tface, 0, offset, ellipse, 0);
|
select_uv_inside_ellipse(scene, select, efa, tface, 0, offset, ellipse, 0);
|
||||||
select_uv_inside_ellipse(sima, scene, select, efa, tface, 1, offset, ellipse, 1);
|
select_uv_inside_ellipse(scene, select, efa, tface, 1, offset, ellipse, 1);
|
||||||
select_uv_inside_ellipse(sima, scene, select, efa, tface, 2, offset, ellipse, 2);
|
select_uv_inside_ellipse(scene, select, efa, tface, 2, offset, ellipse, 2);
|
||||||
if(efa->v4)
|
if(efa->v4)
|
||||||
select_uv_inside_ellipse(sima, scene, select, efa, tface, 3, offset, ellipse, 3);
|
select_uv_inside_ellipse(scene, select, efa, tface, 3, offset, ellipse, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(select) EM_select_flush(em);
|
if(select) EM_select_flush(em);
|
||||||
@@ -2800,11 +2794,9 @@ static int hide_exec(bContext *C, wmOperator *op)
|
|||||||
tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
|
tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
|
||||||
}
|
}
|
||||||
else if(em->selectmode == SCE_SELECT_FACE) {
|
else if(em->selectmode == SCE_SELECT_FACE) {
|
||||||
if((tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3))==0) {
|
const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
|
||||||
if(!efa->v4)
|
if((tf->flag & select_flag)==0) {
|
||||||
EM_select_face(efa, 0);
|
EM_select_face(efa, 0);
|
||||||
else if(!(tf->flag & TF_SEL4))
|
|
||||||
EM_select_face(efa, 0);
|
|
||||||
tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
|
tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2845,9 +2837,8 @@ static int hide_exec(bContext *C, wmOperator *op)
|
|||||||
tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
|
tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
|
||||||
}
|
}
|
||||||
else if(em->selectmode == SCE_SELECT_FACE) {
|
else if(em->selectmode == SCE_SELECT_FACE) {
|
||||||
if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3))
|
const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
|
||||||
EM_select_face(efa, 0);
|
if(tf->flag & select_flag)
|
||||||
else if(efa->v4 && tf->flag & TF_SEL4)
|
|
||||||
EM_select_face(efa, 0);
|
EM_select_face(efa, 0);
|
||||||
|
|
||||||
tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
|
tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
|
||||||
@@ -3086,16 +3077,18 @@ static int set_tile_exec(bContext *C, wmOperator *op)
|
|||||||
{
|
{
|
||||||
Image *ima= CTX_data_edit_image(C);
|
Image *ima= CTX_data_edit_image(C);
|
||||||
int tile[2];
|
int tile[2];
|
||||||
|
Object *obedit= CTX_data_edit_object(C);
|
||||||
if(!ima || !(ima->tpageflag & IMA_TILES))
|
|
||||||
return OPERATOR_CANCELLED;
|
|
||||||
|
|
||||||
RNA_int_get_array(op->ptr, "tile", tile);
|
RNA_int_get_array(op->ptr, "tile", tile);
|
||||||
ED_uvedit_set_tile(C, CTX_data_scene(C), CTX_data_edit_object(C), ima, tile[0] + ima->xrep*tile[1]);
|
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_IMAGE, NULL);
|
if(uvedit_set_tile(obedit, ima, tile[0] + ima->xrep*tile[1])) {
|
||||||
|
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
|
||||||
|
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_IMAGE, NULL);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_tile_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
static int set_tile_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||||
|
|||||||
Reference in New Issue
Block a user