diff options
author | Brecht Van Lommel <brecht> | 2020-02-27 13:23:15 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-02-27 17:25:35 +0300 |
commit | f2b95b9eae2ee913c99cff7595527b18d8b49d0a (patch) | |
tree | 4bbd1a009cd5ace8bd9bb3efe8e5882a459b5f98 /source/blender/draw | |
parent | 57b7833d1eff5e11bbdec654ff09fb24263cc055 (diff) |
Objects: make evaluated data runtime storage usable for types other than mesh
This is in preparation of new object types. This only changes mesh_eval, we
may do the same for mesh_deform_eval and other areas in the future if there is
a need for it.
Differential Revision: https://developer.blender.org/D6695
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/intern/draw_cache.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index 8057d167e2f..f37e5b14d83 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -836,12 +836,12 @@ GPUBatch *DRW_cache_object_surface_get(Object *ob) int DRW_cache_object_material_count_get(struct Object *ob) { - Mesh *me = (ob->runtime.mesh_eval != NULL) ? ob->runtime.mesh_eval : (Mesh *)ob->data; - short type = (ob->runtime.mesh_eval != NULL) ? OB_MESH : ob->type; + Mesh *me = BKE_object_get_evaluated_mesh(ob); + short type = (me != NULL) ? OB_MESH : ob->type; switch (type) { case OB_MESH: - return DRW_mesh_material_count_get(me); + return DRW_mesh_material_count_get((me != NULL) ? me : ob->data); case OB_CURVE: case OB_SURF: case OB_FONT: @@ -2807,7 +2807,7 @@ GPUBatch *DRW_cache_curve_edge_wire_get(Object *ob) BLI_assert(ob->type == OB_CURVE); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (mesh_eval != NULL) { return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); } @@ -2845,7 +2845,7 @@ GPUBatch *DRW_cache_curve_surface_get(Object *ob) BLI_assert(ob->type == OB_CURVE); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (mesh_eval != NULL) { return DRW_mesh_batch_cache_get_surface(mesh_eval); } @@ -2859,7 +2859,7 @@ GPUBatch *DRW_cache_curve_loose_edges_get(Object *ob) BLI_assert(ob->type == OB_CURVE); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (mesh_eval != NULL) { return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); } @@ -2875,7 +2875,7 @@ GPUBatch *DRW_cache_curve_face_wireframe_get(Object *ob) BLI_assert(ob->type == OB_CURVE); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (mesh_eval != NULL) { return DRW_mesh_batch_cache_get_wireframes_face(mesh_eval); } @@ -2888,7 +2888,7 @@ GPUBatch *DRW_cache_curve_edge_detection_get(Object *ob, bool *r_is_manifold) { BLI_assert(ob->type == OB_CURVE); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (mesh_eval != NULL) { return DRW_mesh_batch_cache_get_edge_detection(mesh_eval, r_is_manifold); } @@ -2905,7 +2905,7 @@ GPUBatch **DRW_cache_curve_surface_shaded_get(Object *ob, BLI_assert(ob->type == OB_CURVE); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (mesh_eval != NULL) { return DRW_mesh_batch_cache_get_surface_shaded(mesh_eval, gpumat_array, gpumat_array_len); } @@ -2957,7 +2957,7 @@ GPUBatch *DRW_cache_text_edge_wire_get(Object *ob) { BLI_assert(ob->type == OB_FONT); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); const bool has_surface = (cu->flag & (CU_FRONT | CU_BACK)) || cu->ext1 != 0.0f || cu->ext2 != 0.0f; if (!has_surface) { @@ -2975,7 +2975,7 @@ GPUBatch *DRW_cache_text_surface_get(Object *ob) { BLI_assert(ob->type == OB_FONT); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (cu->editfont && (cu->flag & CU_FAST)) { return NULL; } @@ -2991,7 +2991,7 @@ GPUBatch *DRW_cache_text_edge_detection_get(Object *ob, bool *r_is_manifold) { BLI_assert(ob->type == OB_FONT); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (cu->editfont && (cu->flag & CU_FAST)) { return NULL; } @@ -3007,7 +3007,7 @@ GPUBatch *DRW_cache_text_loose_edges_get(Object *ob) { BLI_assert(ob->type == OB_FONT); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (cu->editfont && (cu->flag & CU_FAST)) { return NULL; } @@ -3024,7 +3024,7 @@ GPUBatch *DRW_cache_text_face_wireframe_get(Object *ob) { BLI_assert(ob->type == OB_FONT); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (cu->editfont && (cu->flag & CU_FAST)) { return NULL; } @@ -3042,7 +3042,7 @@ GPUBatch **DRW_cache_text_surface_shaded_get(Object *ob, { BLI_assert(ob->type == OB_FONT); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (cu->editfont && (cu->flag & CU_FAST)) { return NULL; } @@ -3065,7 +3065,7 @@ GPUBatch *DRW_cache_surf_surface_get(Object *ob) BLI_assert(ob->type == OB_SURF); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (mesh_eval != NULL) { return DRW_mesh_batch_cache_get_surface(mesh_eval); } @@ -3079,7 +3079,7 @@ GPUBatch *DRW_cache_surf_edge_wire_get(Object *ob) BLI_assert(ob->type == OB_SURF); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (mesh_eval != NULL) { return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); } @@ -3093,7 +3093,7 @@ GPUBatch *DRW_cache_surf_face_wireframe_get(Object *ob) BLI_assert(ob->type == OB_SURF); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (mesh_eval != NULL) { return DRW_mesh_batch_cache_get_wireframes_face(mesh_eval); } @@ -3106,7 +3106,7 @@ GPUBatch *DRW_cache_surf_edge_detection_get(Object *ob, bool *r_is_manifold) { BLI_assert(ob->type == OB_SURF); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (mesh_eval != NULL) { return DRW_mesh_batch_cache_get_edge_detection(mesh_eval, r_is_manifold); } @@ -3120,7 +3120,7 @@ GPUBatch *DRW_cache_surf_loose_edges_get(Object *ob) BLI_assert(ob->type == OB_SURF); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (mesh_eval != NULL) { return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); } @@ -3139,7 +3139,7 @@ GPUBatch **DRW_cache_surf_surface_shaded_get(Object *ob, BLI_assert(ob->type == OB_SURF); struct Curve *cu = ob->data; - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (mesh_eval != NULL) { return DRW_mesh_batch_cache_get_surface_shaded(mesh_eval, gpumat_array, gpumat_array_len); } @@ -3398,7 +3398,7 @@ GPUBatch *DRW_cache_cursor_get(bool crosshair_lines) void drw_batch_cache_validate(Object *ob) { - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); switch (ob->type) { case OB_MESH: DRW_mesh_batch_cache_validate((Mesh *)ob->data); @@ -3436,7 +3436,7 @@ void drw_batch_cache_generate_requested(Object *ob) DRW_object_use_hide_faces(ob)) || ((mode == CTX_MODE_EDIT_MESH) && DRW_object_is_in_edit_mode(ob)))); - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); switch (ob->type) { case OB_MESH: DRW_mesh_batch_cache_create_requested(ob, (Mesh *)ob->data, scene, is_paint_mode, use_hide); @@ -3457,7 +3457,7 @@ void drw_batch_cache_generate_requested(Object *ob) void DRW_batch_cache_free_old(Object *ob, int ctime) { - struct Mesh *mesh_eval = ob->runtime.mesh_eval; + struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); switch (ob->type) { case OB_MESH: |