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:
-rw-r--r--source/blender/bmesh/intern/bmesh_marking.c9
-rw-r--r--source/blender/bmesh/intern/bmesh_marking.h2
-rw-r--r--source/blender/editors/include/ED_mesh.h2
-rw-r--r--source/blender/editors/mesh/editmesh_select.c2
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c6
-rw-r--r--source/blender/editors/mesh/mesh_navmesh.c2
-rw-r--r--source/blender/editors/space_image/space_image.c9
-rw-r--r--source/blender/editors/space_view3d/drawobject.c2
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c4
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c5
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c14
11 files changed, 35 insertions, 22 deletions
diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c
index 58ccfa79a02..c0439311104 100644
--- a/source/blender/bmesh/intern/bmesh_marking.c
+++ b/source/blender/bmesh/intern/bmesh_marking.c
@@ -527,9 +527,9 @@ void BM_active_face_set(BMesh *bm, BMFace *efa)
bm->act_face = efa;
}
-BMFace *BM_active_face_get(BMesh *bm, int sloppy)
+BMFace *BM_active_face_get(BMesh *bm, int sloppy, int selected)
{
- if (bm->act_face) {
+ if (bm->act_face && (!selected || BM_elem_flag_test(bm->act_face, BM_ELEM_SELECT))) {
return bm->act_face;
}
else if (sloppy) {
@@ -546,6 +546,9 @@ BMFace *BM_active_face_get(BMesh *bm, int sloppy)
if (BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
f = NULL;
}
+ else if (selected && !BM_elem_flag_test(f, BM_ELEM_SELECT)) {
+ f = NULL;
+ }
else {
break;
}
@@ -768,7 +771,7 @@ void BM_select_history_validate(BMesh *bm)
int BM_select_history_active_get(BMesh *bm, BMEditSelection *ese)
{
BMEditSelection *ese_last = bm->selected.last;
- BMFace *efa = BM_active_face_get(bm, FALSE);
+ BMFace *efa = BM_active_face_get(bm, FALSE, FALSE);
ese->next = ese->prev = NULL;
diff --git a/source/blender/bmesh/intern/bmesh_marking.h b/source/blender/bmesh/intern/bmesh_marking.h
index 9b73ed2c390..8d4397794d5 100644
--- a/source/blender/bmesh/intern/bmesh_marking.h
+++ b/source/blender/bmesh/intern/bmesh_marking.h
@@ -71,7 +71,7 @@ int BM_mesh_elem_hflag_count_disabled(BMesh *bm, const char htype, const char hf
/* edit selection stuff */
void BM_active_face_set(BMesh *bm, BMFace *f);
-BMFace *BM_active_face_get(BMesh *bm, int sloppy);
+BMFace *BM_active_face_get(BMesh *bm, int sloppy, int selected);
void BM_editselection_center(BMEditSelection *ese, float r_center[3]);
void BM_editselection_normal(BMEditSelection *ese, float r_normal[3]);
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 35284b26d29..da440063552 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -135,7 +135,7 @@ struct UvElementMap *EDBM_uv_element_map_create(struct BMEditMesh *em, int selec
void EDBM_uv_element_map_free(struct UvElementMap *vmap);
int EDBM_mtexpoly_check(struct BMEditMesh *em);
-struct MTexPoly *EDBM_mtexpoly_active_get(struct BMEditMesh *em, struct BMFace **r_act_efa, int sloppy);
+struct MTexPoly *EDBM_mtexpoly_active_get(struct BMEditMesh *em, struct BMFace **r_act_efa, int sloppy, int selected);
void EDBM_uv_vert_map_free(struct UvVertMap *vmap);
struct UvMapVert *EDBM_uv_vert_map_at_index(struct UvVertMap *vmap, unsigned int v);
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 765091a3d1d..a9e8c253c82 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -2221,7 +2221,7 @@ static void deselect_nth_active(BMEditMesh *em, BMVert **r_eve, BMEdge **r_eed,
}
}
else if (em->selectmode & SCE_SELECT_FACE) {
- f = BM_active_face_get(em->bm, TRUE);
+ f = BM_active_face_get(em->bm, TRUE, FALSE);
if (f) {
*r_efa = f;
return;
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index aaf1701d723..a111c2ffafb 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -992,15 +992,15 @@ void EDBM_uv_element_map_free(UvElementMap *element_map)
/* last_sel, use em->act_face otherwise get the last selected face in the editselections
* at the moment, last_sel is mainly useful for making sure the space image dosnt flicker */
-MTexPoly *EDBM_mtexpoly_active_get(BMEditMesh *em, BMFace **r_act_efa, int sloppy)
+MTexPoly *EDBM_mtexpoly_active_get(BMEditMesh *em, BMFace **r_act_efa, int sloppy, int selected)
{
BMFace *efa = NULL;
if (!EDBM_mtexpoly_check(em))
return NULL;
- efa = BM_active_face_get(em->bm, sloppy);
-
+ efa = BM_active_face_get(em->bm, sloppy, selected);
+
if (efa) {
if (r_act_efa) *r_act_efa = efa;
return CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c
index 14d20d68455..88b1f191e3a 100644
--- a/source/blender/editors/mesh/mesh_navmesh.c
+++ b/source/blender/editors/mesh/mesh_navmesh.c
@@ -491,7 +491,7 @@ static int navmesh_face_copy_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BMEdit_FromObject(obedit);
/* do work here */
- BMFace *efa_act = BM_active_face_get(em->bm, FALSE);
+ BMFace *efa_act = BM_active_face_get(em->bm, FALSE, FALSE);
if (efa_act) {
if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) {
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index d2639edb276..9cceaf0aa8e 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -392,11 +392,12 @@ static void image_refresh(const bContext *C, ScrArea *sa)
else if (obedit && obedit->type == OB_MESH) {
Mesh *me = (Mesh *)obedit->data;
struct BMEditMesh *em = me->edit_btmesh;
- int sloppy = 1; /* partially selected face is ok */
+ int sloppy = TRUE; /* partially selected face is ok */
+ int selected = !(scene->toolsettings->uv_flag & UV_SYNC_SELECTION); /* only selected active face? */
if (BKE_scene_use_new_shading_nodes(scene)) {
/* new shading system, get image from material */
- BMFace *efa = BM_active_face_get(em->bm, sloppy);
+ BMFace *efa = BM_active_face_get(em->bm, sloppy, selected);
if (efa) {
Image *node_ima;
@@ -413,8 +414,8 @@ static void image_refresh(const bContext *C, ScrArea *sa)
if (em && EDBM_mtexpoly_check(em)) {
sima->image = NULL;
- tf = EDBM_mtexpoly_active_get(em, NULL, TRUE); /* partially selected face is ok */
-
+ tf = EDBM_mtexpoly_active_get(em, NULL, sloppy, selected);
+
if (tf) {
/* don't need to check for pin here, see above */
sima->image = tf->tpage;
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 8e9776e0e17..26fe908f034 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -3164,7 +3164,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
{
Mesh *me = ob->data;
- BMFace *efa_act = BM_active_face_get(em->bm, FALSE); /* annoying but active faces is stored differently */
+ BMFace *efa_act = BM_active_face_get(em->bm, FALSE, FALSE); /* annoying but active faces is stored differently */
BMEdge *eed_act = NULL;
BMVert *eve_act = NULL;
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index 1f78bc6bddf..e5888a1b508 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -455,8 +455,8 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
StitchPreviewer *stitch_preview = uv_get_stitch_previewer();
- activetf = EDBM_mtexpoly_active_get(em, &efa_act, FALSE); /* will be set to NULL if hidden */
- activef = BM_active_face_get(bm, FALSE);
+ activetf = EDBM_mtexpoly_active_get(em, &efa_act, FALSE, FALSE); /* will be set to NULL if hidden */
+ activef = BM_active_face_get(bm, FALSE, FALSE);
ts = scene->toolsettings;
drawfaces = draw_uvs_face_check(scene);
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index b922647f3e6..5008c35e46a 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -174,6 +174,8 @@ void ED_uvedit_assign_image(Main *bmain, Scene *scene, Object *obedit, Image *im
BMIter iter;
MTexPoly *tf;
int update = 0;
+ int sloppy = TRUE;
+ int selected = !(scene->toolsettings->uv_flag & UV_SYNC_SELECTION);
/* skip assigning these procedural images... */
if (ima && (ima->type == IMA_TYPE_R_RESULT || ima->type == IMA_TYPE_COMPOSITE))
@@ -190,8 +192,7 @@ void ED_uvedit_assign_image(Main *bmain, Scene *scene, Object *obedit, Image *im
if (BKE_scene_use_new_shading_nodes(scene)) {
/* new shading system, assign image in material */
- int sloppy = 1;
- BMFace *efa = BM_active_face_get(em->bm, sloppy);
+ BMFace *efa = BM_active_face_get(em->bm, sloppy, selected);
if (efa)
ED_object_assign_active_image(bmain, obedit, efa->mat_nr + 1, ima);
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index b4903390408..c1fb3ee3807 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -192,7 +192,10 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em,
handle = param_construct_begin();
if (correct_aspect) {
- efa = BM_active_face_get(em->bm, TRUE);
+ int sloppy = TRUE;
+ int selected = FALSE;
+
+ efa = BM_active_face_get(em->bm, sloppy, selected);
if (efa) {
float aspx, aspy;
@@ -380,7 +383,10 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e
handle = param_construct_begin();
if (correct_aspect) {
- editFace = BM_active_face_get(em->bm, TRUE);
+ int sloppy = TRUE;
+ int selected = FALSE;
+
+ editFace = BM_active_face_get(em->bm, sloppy, selected);
if (editFace) {
MTexPoly *tf;
@@ -1003,7 +1009,9 @@ static void uv_transform_properties(wmOperatorType *ot, int radius)
static void correct_uv_aspect(BMEditMesh *em)
{
- BMFace *efa = BM_active_face_get(em->bm, TRUE);
+ int sloppy = TRUE;
+ int selected = FALSE;
+ BMFace *efa = BM_active_face_get(em->bm, sloppy, selected);
BMLoop *l;
BMIter iter, liter;
MLoopUV *luv;