Page MenuHome

Linked meshes: Unselected UVs stay orange instead of gray, cannot deselect all UVs
Closed, ResolvedPublicBUG


System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: Quadro P2000/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 451.48

Blender Version
Broken: version: 2.91.0, branch: master, commit date: 2020-11-25 08:34, hash: rB0f45cab862b8
Worked: version 2.90
Caused by rB4212b6528afb: Image Editor: Enable New Drawing

Short description of error
Unselected vertices stay orange instead of gray.

Exact steps for others to reproduce the error
open Blender in Default setting
duplicate the default cube with Alt+D and move the new cube a little
go to UV Editing tab
enter to edit mode in the 3D View window
select all, now in the UV window you can see that every thing is selected.
try to unselect all in the UV window, it will be orange but darker a little instead of gray.
now, that the UV is unselected (but still in orange) unselect and select all vertex in the 3D View window, now it will show in the UV window in gray as should be.
it only occur when something is already selected in the UV and you select something (or All) in the 3D View and try to unselect in the UV window.

  • Open file
  • A in the UV Editor
  • A in the 3D View
  • back in the UV Editor, not all UVs can be deselected

Event Timeline

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Confirmed.Nov 30 2020, 10:20 AM
Philipp Oeser (lichtwerk) renamed this task from Unselected vertices stay orange instead of gray. to Unselected UVs stay orange instead of gray. .Nov 30 2020, 10:23 AM
Philipp Oeser (lichtwerk) triaged this task as High priority.
Philipp Oeser (lichtwerk) updated the task description. (Show Details)
Philipp Oeser (lichtwerk) changed the subtype of this task from "Report" to "Bug".

Issue appears in commit 4212b6528afb07d9b2962566ae9c4251282d387f

Philipp Oeser (lichtwerk) added a project: Restricted Project.Dec 9 2020, 11:31 AM
Philipp Oeser (lichtwerk) updated the task description. (Show Details)

For linked meshes, UV batches are drawn multiple times (they are owned by the object, not the mesh it seems).
This wasnt the case prior to rBd6525e8d133b: Use DrawManager for Image/UV Editor,
ED_uvedit_draw_main would at that time only draw once for unique data see BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs

Now in contrast selecting (amongst other UV operations) is done only once (see BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs again), resulting in tagging BKE_MESH_BATCH_DIRTY_UVEDIT_SELECT only for one of the participating objects batches.

Now trying my guesswork on how this could be solved:

One thing would be to do the roundtrip through mesh flags [we'd be after MLOOPUV_VERTSEL] by tagging ID_RECALC_SELECT.
(In a way you can see this works by using operators that actually do this under the hood: transforming UVs will properly refresh, snapping also does this, select more/less would also do this)
Not sure though if this is desired, this is a bit like having Sync Selection enabled (and would probably make the whole BKE_MESH_BATCH_DIRTY_UVEDIT_SELECT obsolete)

3diff --git a/source/blender/editors/uvedit/uvedit_select.c b/source/blender/editors/uvedit/uvedit_select.c
4index a6b5aff4a44..748eb7c5268 100644
5--- a/source/blender/editors/uvedit/uvedit_select.c
6+++ b/source/blender/editors/uvedit/uvedit_select.c
7@@ -2612,16 +2612,8 @@ static void uv_select_tag_update_for_object(Depsgraph *depsgraph,
8 const ToolSettings *ts,
9 Object *obedit)
10 {
11- if (ts->uv_flag & UV_SYNC_SELECTION) {
12- DEG_id_tag_update(obedit->data, ID_RECALC_SELECT);
13- WM_main_add_notifier(NC_GEOM | ND_SELECT, obedit->data);
14- }
15- else {
16- Object *obedit_eval = DEG_get_evaluated_object(depsgraph, obedit);
17- BKE_mesh_batch_cache_dirty_tag(obedit_eval->data, BKE_MESH_BATCH_DIRTY_UVEDIT_SELECT);
18- /* Only for region redraw. */
19- WM_main_add_notifier(NC_GEOM | ND_SELECT, obedit->data);
20- }
21+ DEG_id_tag_update(obedit->data, ID_RECALC_SELECT);
22+ WM_main_add_notifier(NC_GEOM | ND_SELECT, obedit->data);
23 }
25 /** \} */

Or, we could try to not include linked meshes here in the first place?
This way we would not draw batches which are not up-to-date, we'd only draw the ones that would have been properly invalidated through BKE_MESH_BATCH_DIRTY_UVEDIT_SELECT.

3diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
4index 988975bd399..720c5d6fd43 100644
5--- a/source/blender/draw/intern/draw_manager.c
6+++ b/source/blender/draw/intern/draw_manager.c
7@@ -2101,10 +2101,14 @@ void DRW_draw_render_loop_2d_ex(struct Depsgraph *depsgraph,
9 /* Only iterate over objects when overlay uses object data. */
10 if (do_populate_loop) {
12- drw_engines_cache_populate(ob);
13+ uint objects_len = 0;
14+ Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
15+ view_layer, NULL, &objects_len);
16+ for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
17+ Object *obedit = objects[ob_index];
18+ drw_engines_cache_populate(obedit);
19 }
21+ MEM_freeN(objects);
22 }
24 drw_engines_cache_finish();

@Jeroen Bakker (jbakker): what do you think?

I need to look into this. But -1 for the second solution as it doesn't use the render depsgraph.

I need to look into this. But -1 for the second solution as it doesn't use the render depsgraph.

Thx having a look. Would strictly sticking to the render depsgraph mean there is no way to exclude duplis/linked meshes? (this sounds like waste -- drawing potentionally very often without real benefit?)