Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/overlay/overlay_edit_uv.c
| Show First 20 Lines • Show All 395 Lines • ▼ Show 20 Lines | if (pd->edit_uv.do_mask_overlay) { | ||||
| DRW_shgroup_uniform_texture(grp, "imgTexture", mask_texture); | DRW_shgroup_uniform_texture(grp, "imgTexture", mask_texture); | ||||
| DRW_shgroup_uniform_vec4_copy(grp, "color", (float[4]){1.0f, 1.0f, 1.0f, 1.0f}); | DRW_shgroup_uniform_vec4_copy(grp, "color", (float[4]){1.0f, 1.0f, 1.0f, 1.0f}); | ||||
| DRW_shgroup_call_obmat(grp, geom, NULL); | DRW_shgroup_call_obmat(grp, geom, NULL); | ||||
| } | } | ||||
| /* HACK: When editing objects that share the same mesh we should only draw the | /* HACK: When editing objects that share the same mesh we should only draw the | ||||
| * first one in the order that is used during uv editing. We can only trust that the first object | * first one in the order that is used during uv editing. We can only trust that the first object | ||||
| * has the correct batches with the correct selection state. See T83187. */ | * has the correct batches with the correct selection state. See T83187. */ | ||||
| if (pd->edit_uv.do_uv_overlay || pd->edit_uv.do_uv_shadow_overlay) { | if ((pd->edit_uv.do_uv_overlay || pd->edit_uv.do_uv_shadow_overlay) && | ||||
| draw_ctx->obact->type == OB_MESH) { | |||||
| uint objects_len = 0; | uint objects_len = 0; | ||||
| Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data( | Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data( | ||||
| draw_ctx->view_layer, NULL, &objects_len, draw_ctx->object_mode); | draw_ctx->view_layer, NULL, &objects_len, draw_ctx->object_mode); | ||||
| for (uint ob_index = 0; ob_index < objects_len; ob_index++) { | for (uint ob_index = 0; ob_index < objects_len; ob_index++) { | ||||
| Object *object_eval = DEG_get_evaluated_object(draw_ctx->depsgraph, objects[ob_index]); | Object *object_eval = DEG_get_evaluated_object(draw_ctx->depsgraph, objects[ob_index]); | ||||
jbakker: I would move this one line up and check against `objects[ob_index]` so the depsgraph call is… | |||||
| DRW_mesh_batch_cache_validate((Mesh *)object_eval->data); | DRW_mesh_batch_cache_validate((Mesh *)object_eval->data); | ||||
| overlay_edit_uv_cache_populate(vedata, object_eval); | overlay_edit_uv_cache_populate(vedata, object_eval); | ||||
| } | } | ||||
| MEM_freeN(objects); | MEM_freeN(objects); | ||||
| } | } | ||||
| } | } | ||||
| static void overlay_edit_uv_cache_populate(OVERLAY_Data *vedata, Object *ob) | static void overlay_edit_uv_cache_populate(OVERLAY_Data *vedata, Object *ob) | ||||
| ▲ Show 20 Lines • Show All 160 Lines • Show Last 20 Lines | |||||
I would move this one line up and check against objects[ob_index] so the depsgraph call is also skipped.