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:
authorSybren A. Stüvel <sybren@stuvel.eu>2018-07-05 17:23:35 +0300
committerSybren A. Stüvel <sybren@stuvel.eu>2018-07-10 13:00:58 +0300
commitde55ae56ae5d871b5bc7fa6383c90ef89d66fcd1 (patch)
tree212fc7b15f9523bcc7a1a54906f1ba6bb6006a4f /source/blender/editors/object/object_modifier.c
parentb9bef10d1953bda4e1eb882bdc525815c2e32e01 (diff)
Ocean Modifier: refactored the delayed-refresh approach
The approach of setting 'refresh' flags on the modifier, and performing the associated actions when the modifier is being evaluated, is a bad one. Instead, we use the separation of the original and the evaluated copy to 'refresh' certain things (because they simply aren't set at all on the original). Other actions are now done directly with BKE_ocean_xxx functions on the original data, intead of during evaluation.
Diffstat (limited to 'source/blender/editors/object/object_modifier.c')
-rw-r--r--source/blender/editors/object/object_modifier.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 31a53bed201..e50efcf20ee 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -2083,7 +2083,7 @@ static void init_ocean_modifier_bake(struct Ocean *oc, struct OceanModifierData
typedef struct OceanBakeJob {
/* from wmJob */
- void *owner;
+ struct Object *owner;
short *stop, *do_update;
float *progress;
int current_frame;
@@ -2149,6 +2149,9 @@ static void oceanbake_endjob(void *customdata)
oj->omd->oceancache = oj->och;
oj->omd->cached = true;
+
+ Object *ob = oj->owner;
+ DEG_id_tag_update(&ob->id, DEG_TAG_COPY_ON_WRITE);
}
static int ocean_bake_exec(bContext *C, wmOperator *op)
@@ -2169,8 +2172,8 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
if (free) {
- omd->refresh |= MOD_OCEAN_REFRESH_CLEAR_CACHE;
- DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ BKE_ocean_free_modifier_cache(omd);
+ DEG_id_tag_update(&ob->id, OB_RECALC_DATA | DEG_TAG_COPY_ON_WRITE);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -2232,6 +2235,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Ocean Simulation",
WM_JOB_PROGRESS, WM_JOB_TYPE_OBJECT_SIM_OCEAN);
oj = MEM_callocN(sizeof(OceanBakeJob), "ocean bake job");
+ oj->owner = ob;
oj->ocean = ocean;
oj->och = och;
oj->omd = omd;