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:
authorBrecht Van Lommel <brecht>2020-02-27 13:23:15 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-02-28 15:49:35 +0300
commit318112379d6d251334b8f3d2a20b935210446b4f (patch)
tree5fc125ebf73805d209ca071d4118fcede4920c2b /source/blender/editors
parentc60be37f3ebf20ab9b4563d03c0acb97ecf047cc (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. This previously caused a bug in T74283, that should be fixed now. Differential Revision: https://developer.blender.org/D6695
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/mesh/editface.c7
-rw-r--r--source/blender/editors/mesh/editmesh_knife_project.c5
-rw-r--r--source/blender/editors/physics/particle_edit.c3
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c2
-rw-r--r--source/blender/editors/space_info/info_stats.c5
-rw-r--r--source/blender/editors/space_view3d/drawobject.c9
-rw-r--r--source/blender/editors/transform/transform_snap_object.c10
7 files changed, 23 insertions, 18 deletions
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 5c9fb866df7..5f948595a22 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -35,6 +35,7 @@
#include "BKE_customdata.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
+#include "BKE_object.h"
#include "ED_mesh.h"
#include "ED_screen.h"
@@ -80,8 +81,8 @@ void paintface_flush_flags(struct bContext *C, Object *ob, short flag)
return;
}
- Mesh *me_orig = ob_eval->runtime.mesh_orig;
- Mesh *me_eval = ob_eval->runtime.mesh_eval;
+ Mesh *me_orig = (Mesh *)ob_eval->runtime.data_orig;
+ Mesh *me_eval = (Mesh *)ob_eval->runtime.data_eval;
bool updated = false;
if (me_orig != NULL && me_eval != NULL && me_orig->totpoly == me->totpoly) {
@@ -443,7 +444,7 @@ bool paintface_mouse_select(
void paintvert_flush_flags(Object *ob)
{
Mesh *me = BKE_mesh_from_object(ob);
- Mesh *me_eval = ob->runtime.mesh_eval;
+ Mesh *me_eval = BKE_object_get_evaluated_mesh(ob);
MVert *mvert_eval, *mv;
const int *index_array = NULL;
int totvert;
diff --git a/source/blender/editors/mesh/editmesh_knife_project.c b/source/blender/editors/mesh/editmesh_knife_project.c
index 8d5c1469694..21de89d33dd 100644
--- a/source/blender/editors/mesh/editmesh_knife_project.c
+++ b/source/blender/editors/mesh/editmesh_knife_project.c
@@ -33,6 +33,7 @@
#include "BKE_curve.h"
#include "BKE_editmesh.h"
#include "BKE_mesh_runtime.h"
+#include "BKE_object.h"
#include "BKE_report.h"
#include "DEG_depsgraph.h"
@@ -61,9 +62,9 @@ static LinkNode *knifeproject_poly_from_object(const bContext *C,
struct Mesh *me_eval;
bool me_eval_needs_free;
- if (ob->type == OB_MESH || ob->runtime.mesh_eval) {
+ if (ob->type == OB_MESH || ob->runtime.data_eval) {
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
- me_eval = ob_eval->runtime.mesh_eval;
+ me_eval = BKE_object_get_evaluated_mesh(ob_eval);
if (me_eval == NULL) {
Scene *scene_eval = (Scene *)DEG_get_evaluated_id(depsgraph, &scene->id);
me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &CD_MASK_BAREMESH);
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 92e76ab31fa..49b6acc9003 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -488,7 +488,8 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
static bool PE_create_shape_tree(PEData *data, Object *shapeob)
{
- Mesh *mesh = BKE_object_get_evaluated_mesh(data->depsgraph, shapeob);
+ Object *shapeob_eval = DEG_get_evaluated_object(data->depsgraph, shapeob);
+ Mesh *mesh = BKE_object_get_evaluated_mesh(shapeob_eval);
memset(&data->shape_bvh, 0, sizeof(data->shape_bvh));
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 7372ea6d44a..6971182e5b8 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -181,7 +181,7 @@ static MDeformVert *defweight_prev_init(MDeformVert *dvert_prev,
* (without evaluating modifiers) */
static bool vertex_paint_use_fast_update_check(Object *ob)
{
- Mesh *me_eval = ob->runtime.mesh_eval;
+ Mesh *me_eval = BKE_object_get_evaluated_mesh(ob);
if (me_eval != NULL) {
Mesh *me = BKE_mesh_from_object(ob);
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index 225ca72a7d0..d00083d343b 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -137,7 +137,7 @@ static void stats_object(Object *ob, SceneStats *stats, GSet *objects_gset)
switch (ob->type) {
case OB_MESH: {
/* we assume evaluated mesh is already built, this strictly does stats now. */
- Mesh *me_eval = ob->runtime.mesh_eval;
+ Mesh *me_eval = BKE_object_get_evaluated_mesh(ob);
if (!BLI_gset_add(objects_gset, me_eval)) {
break;
}
@@ -153,8 +153,7 @@ static void stats_object(Object *ob, SceneStats *stats, GSet *objects_gset)
case OB_SURF:
case OB_CURVE:
case OB_FONT: {
- Mesh *me_eval = ob->runtime.mesh_eval;
-
+ Mesh *me_eval = BKE_object_get_evaluated_mesh(ob);
if ((me_eval != NULL) && !BLI_gset_add(objects_gset, me_eval)) {
break;
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 0daa5aa53ae..00f61a4d0aa 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -28,9 +28,9 @@
#include "BLI_math.h"
#include "BKE_DerivedMesh.h"
-#include "BKE_global.h"
-
#include "BKE_editmesh.h"
+#include "BKE_global.h"
+#include "BKE_object.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
@@ -120,8 +120,9 @@ void ED_draw_object_facemap(Depsgraph *depsgraph,
Mesh *me = ob->data;
{
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
- if (ob_eval->runtime.mesh_eval) {
- me = ob_eval->runtime.mesh_eval;
+ Mesh *me_eval = BKE_object_get_evaluated_mesh(ob_eval);
+ if (me_eval != NULL) {
+ me = me_eval;
}
}
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index 2ad3de1528f..ecd267d6f2a 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -936,12 +936,13 @@ static bool raycastObj(SnapObjectContext *sctx,
case OB_CURVE:
case OB_SURF:
case OB_FONT: {
- if (ob->runtime.mesh_eval) {
+ Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob);
+ if (mesh_eval) {
retval = raycastMesh(sctx,
ray_start,
ray_dir,
ob,
- ob->runtime.mesh_eval,
+ mesh_eval,
obmat,
ob_index,
false,
@@ -2654,11 +2655,12 @@ static short snapObject(SnapObjectContext *sctx,
break; /* Use ATTR_FALLTHROUGH if we want to snap to the generated mesh. */
case OB_SURF:
case OB_FONT: {
- if (ob->runtime.mesh_eval) {
+ Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob);
+ if (mesh_eval) {
retval |= snapMesh(sctx,
snapdata,
ob,
- ob->runtime.mesh_eval,
+ mesh_eval,
obmat,
use_backface_culling,
dist_px,