Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_cache_impl_mesh.c
| Context not available. | |||||
| *((uint32_t *)a) = 0; | *((uint32_t *)a) = 0; | ||||
| } | } | ||||
| static void mesh_cd_calc_edit_uv_layer(const Mesh *UNUSED(me), DRW_MeshCDMask *cd_used) | |||||
| { | |||||
| cd_used->edit_uv = 1; | |||||
| } | |||||
| static void mesh_cd_calc_active_uv_layer(const Mesh *me, DRW_MeshCDMask *cd_used) | static void mesh_cd_calc_active_uv_layer(const Mesh *me, DRW_MeshCDMask *cd_used) | ||||
| { | { | ||||
| const Mesh *me_final = (me->edit_mesh) ? me->edit_mesh->mesh_eval_final : me; | const CustomData *cd_ldata = (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata; | ||||
| const CustomData *cd_ldata = &me_final->ldata; | |||||
| int layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPUV); | int layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPUV); | ||||
| if (layer != -1) { | if (layer != -1) { | ||||
| Context not available. | |||||
| static void mesh_cd_calc_active_mask_uv_layer(const Mesh *me, DRW_MeshCDMask *cd_used) | static void mesh_cd_calc_active_mask_uv_layer(const Mesh *me, DRW_MeshCDMask *cd_used) | ||||
| { | { | ||||
| const Mesh *me_final = (me->edit_mesh) ? me->edit_mesh->mesh_eval_final : me; | const CustomData *cd_ldata = (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata; | ||||
| const CustomData *cd_ldata = &me_final->ldata; | |||||
| int layer = CustomData_get_stencil_layer(cd_ldata, CD_MLOOPUV); | int layer = CustomData_get_stencil_layer(cd_ldata, CD_MLOOPUV); | ||||
| if (layer != -1) { | if (layer != -1) { | ||||
| Context not available. | |||||
| static void mesh_cd_calc_active_vcol_layer(const Mesh *me, DRW_MeshCDMask *cd_used) | static void mesh_cd_calc_active_vcol_layer(const Mesh *me, DRW_MeshCDMask *cd_used) | ||||
| { | { | ||||
| const Mesh *me_final = (me->edit_mesh) ? me->edit_mesh->mesh_eval_final : me; | const CustomData *cd_ldata = (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata; | ||||
| const CustomData *cd_ldata = &me_final->ldata; | |||||
| int layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPCOL); | int layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPCOL); | ||||
| if (layer != -1) { | if (layer != -1) { | ||||
| Context not available. | |||||
| struct GPUMaterial **gpumat_array, | struct GPUMaterial **gpumat_array, | ||||
| int gpumat_array_len) | int gpumat_array_len) | ||||
| { | { | ||||
| const Mesh *me_final = (me->edit_mesh) ? me->edit_mesh->mesh_eval_final : me; | const CustomData *cd_ldata = (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata; | ||||
| const CustomData *cd_ldata = &me_final->ldata; | |||||
| /* See: DM_vertex_attributes_from_gpu for similar logic */ | /* See: DM_vertex_attributes_from_gpu for similar logic */ | ||||
| DRW_MeshCDMask cd_used; | DRW_MeshCDMask cd_used; | ||||
| Context not available. | |||||
| int **r_auto_layers_srgb, | int **r_auto_layers_srgb, | ||||
| int *r_auto_layers_len) | int *r_auto_layers_len) | ||||
| { | { | ||||
| const Mesh *me_final = (me->edit_mesh) ? me->edit_mesh->mesh_eval_final : me; | const CustomData *cd_ldata = (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata; | ||||
| const CustomData *cd_ldata = &me_final->ldata; | |||||
| int uv_len_used = count_bits_i(cd_used.uv); | int uv_len_used = count_bits_i(cd_used.uv); | ||||
| int vcol_len_used = count_bits_i(cd_used.vcol); | int vcol_len_used = count_bits_i(cd_used.vcol); | ||||
| Context not available. | |||||
| /** \name UV Image editor API | /** \name UV Image editor API | ||||
| * \{ */ | * \{ */ | ||||
| static void edituv_request_active_uv(MeshBatchCache *cache, Mesh *me) | |||||
| { | |||||
| DRW_MeshCDMask cd_needed; | |||||
| mesh_cd_layers_type_clear(&cd_needed); | |||||
| mesh_cd_calc_edit_uv_layer(me, &cd_needed); | |||||
| BLI_assert(cd_needed.uv != 0 && | |||||
| "No uv layer available in edituv, but batches requested anyway!"); | |||||
| mesh_cd_calc_active_mask_uv_layer(me, &cd_needed); | |||||
| mesh_cd_layers_type_merge(&cache->cd_needed, cd_needed); | |||||
| } | |||||
| /* Creates the GPUBatch for drawing the UV Stretching Area Overlay. | /* Creates the GPUBatch for drawing the UV Stretching Area Overlay. | ||||
| * Optional retrieves the total area or total uv area of the mesh. | * Optional retrieves the total area or total uv area of the mesh. | ||||
| * | * | ||||
| Context not available. | |||||
| float **tot_uv_area) | float **tot_uv_area) | ||||
| { | { | ||||
| MeshBatchCache *cache = mesh_batch_cache_get(me); | MeshBatchCache *cache = mesh_batch_cache_get(me); | ||||
| edituv_request_active_uv(cache, me); | texpaint_request_active_uv(cache, me); | ||||
| mesh_batch_cache_add_request(cache, MBC_EDITUV_FACES_STRETCH_AREA); | mesh_batch_cache_add_request(cache, MBC_EDITUV_FACES_STRETCH_AREA); | ||||
| if (tot_area != NULL) { | if (tot_area != NULL) { | ||||
| Context not available. | |||||
| GPUBatch *DRW_mesh_batch_cache_get_edituv_faces_stretch_angle(Mesh *me) | GPUBatch *DRW_mesh_batch_cache_get_edituv_faces_stretch_angle(Mesh *me) | ||||
| { | { | ||||
| MeshBatchCache *cache = mesh_batch_cache_get(me); | MeshBatchCache *cache = mesh_batch_cache_get(me); | ||||
| edituv_request_active_uv(cache, me); | texpaint_request_active_uv(cache, me); | ||||
| mesh_batch_cache_add_request(cache, MBC_EDITUV_FACES_STRETCH_ANGLE); | mesh_batch_cache_add_request(cache, MBC_EDITUV_FACES_STRETCH_ANGLE); | ||||
| return DRW_batch_request(&cache->batch.edituv_faces_stretch_angle); | return DRW_batch_request(&cache->batch.edituv_faces_stretch_angle); | ||||
| } | } | ||||
| Context not available. | |||||
| GPUBatch *DRW_mesh_batch_cache_get_edituv_faces(Mesh *me) | GPUBatch *DRW_mesh_batch_cache_get_edituv_faces(Mesh *me) | ||||
| { | { | ||||
| MeshBatchCache *cache = mesh_batch_cache_get(me); | MeshBatchCache *cache = mesh_batch_cache_get(me); | ||||
| edituv_request_active_uv(cache, me); | texpaint_request_active_uv(cache, me); | ||||
| mesh_batch_cache_add_request(cache, MBC_EDITUV_FACES); | mesh_batch_cache_add_request(cache, MBC_EDITUV_FACES); | ||||
| return DRW_batch_request(&cache->batch.edituv_faces); | return DRW_batch_request(&cache->batch.edituv_faces); | ||||
| } | } | ||||
| Context not available. | |||||
| GPUBatch *DRW_mesh_batch_cache_get_edituv_edges(Mesh *me) | GPUBatch *DRW_mesh_batch_cache_get_edituv_edges(Mesh *me) | ||||
| { | { | ||||
| MeshBatchCache *cache = mesh_batch_cache_get(me); | MeshBatchCache *cache = mesh_batch_cache_get(me); | ||||
| edituv_request_active_uv(cache, me); | texpaint_request_active_uv(cache, me); | ||||
| mesh_batch_cache_add_request(cache, MBC_EDITUV_EDGES); | mesh_batch_cache_add_request(cache, MBC_EDITUV_EDGES); | ||||
| return DRW_batch_request(&cache->batch.edituv_edges); | return DRW_batch_request(&cache->batch.edituv_edges); | ||||
| } | } | ||||
| Context not available. | |||||
| GPUBatch *DRW_mesh_batch_cache_get_edituv_verts(Mesh *me) | GPUBatch *DRW_mesh_batch_cache_get_edituv_verts(Mesh *me) | ||||
| { | { | ||||
| MeshBatchCache *cache = mesh_batch_cache_get(me); | MeshBatchCache *cache = mesh_batch_cache_get(me); | ||||
| edituv_request_active_uv(cache, me); | texpaint_request_active_uv(cache, me); | ||||
| mesh_batch_cache_add_request(cache, MBC_EDITUV_VERTS); | mesh_batch_cache_add_request(cache, MBC_EDITUV_VERTS); | ||||
| return DRW_batch_request(&cache->batch.edituv_verts); | return DRW_batch_request(&cache->batch.edituv_verts); | ||||
| } | } | ||||
| Context not available. | |||||
| GPUBatch *DRW_mesh_batch_cache_get_edituv_facedots(Mesh *me) | GPUBatch *DRW_mesh_batch_cache_get_edituv_facedots(Mesh *me) | ||||
| { | { | ||||
| MeshBatchCache *cache = mesh_batch_cache_get(me); | MeshBatchCache *cache = mesh_batch_cache_get(me); | ||||
| edituv_request_active_uv(cache, me); | texpaint_request_active_uv(cache, me); | ||||
| mesh_batch_cache_add_request(cache, MBC_EDITUV_FACEDOTS); | mesh_batch_cache_add_request(cache, MBC_EDITUV_FACEDOTS); | ||||
| return DRW_batch_request(&cache->batch.edituv_fdots); | return DRW_batch_request(&cache->batch.edituv_fdots); | ||||
| } | } | ||||
| Context not available. | |||||
| GPUBatch *DRW_mesh_batch_cache_get_uv_edges(Mesh *me) | GPUBatch *DRW_mesh_batch_cache_get_uv_edges(Mesh *me) | ||||
| { | { | ||||
| MeshBatchCache *cache = mesh_batch_cache_get(me); | MeshBatchCache *cache = mesh_batch_cache_get(me); | ||||
| edituv_request_active_uv(cache, me); | texpaint_request_active_uv(cache, me); | ||||
| mesh_batch_cache_add_request(cache, MBC_WIRE_LOOPS_UVS); | mesh_batch_cache_add_request(cache, MBC_WIRE_LOOPS_UVS); | ||||
| return DRW_batch_request(&cache->batch.wire_loops_uvs); | return DRW_batch_request(&cache->batch.wire_loops_uvs); | ||||
| } | } | ||||
| Context not available. | |||||