Commit: 89dc5469d5396180622e54720f8678c484517670
Author: Kévin Dietrich
Date:   Mon Aug 3 17:47:40 2015 +0200
Branches: openvdb
https://developer.blender.org/rB89dc5469d5396180622e54720f8678c484517670

Cleanup: make API a bit more consistent.

===================================================================

M       release/scripts/startup/bl_ui/properties_physics_smoke.py
M       source/blender/blenkernel/intern/smoke.c
M       source/blender/editors/object/object_intern.h
M       source/blender/editors/object/object_modifier.c
M       source/blender/editors/object/object_ops.c
M       source/blender/makesdna/DNA_smoke_types.h
M       source/blender/makesrna/intern/rna_smoke.c
M       source/blender/windowmanager/WM_api.h

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py 
b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index 6ff216e..2d7994f 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -363,8 +363,9 @@ class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, Panel):
                 row.prop(cache, "frame_end")
                 row = layout.row()
                 row.prop(cache, "save_as_half")
-                layout.operator("object.smoke_vdb_export", text="Bake")
-                layout.operator("object.openvdb_cache_free")
+                row = layout.row()
+                row.operator("object.openvdb_cache_bake")
+                row.operator("object.openvdb_cache_free")
 
 
 class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel, Panel):
diff --git a/source/blender/blenkernel/intern/smoke.c 
b/source/blender/blenkernel/intern/smoke.c
index 90c17aa..57ea523 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -3427,14 +3427,14 @@ void smokeModifier_OpenVDB_export(SmokeModifierData 
*smd, Scene *scene, Object *
                cache->writer = OpenVDBWriter_create();
        }
 
-       save_as_half = ((cache->flags & VDB_CACHE_SAVE_AS_HALF) != 0);
+       save_as_half = ((cache->flags & OPENVDB_CACHE_SAVE_AS_HALF) != 0);
 
        OpenVDBWriter_set_flags(cache->writer, cache->compression, 
save_as_half);
 
        /* Unset exported flag if overwriting a cache, the operator should have
         * received confirmation from the user */
-       if (cache->flags & VDB_CACHE_SMOKE_EXPORTED)
-               cache->flags &= ~VDB_CACHE_SMOKE_EXPORTED;
+       if (cache->flags & OPENVDB_CACHE_BAKED)
+               cache->flags &= ~OPENVDB_CACHE_BAKED;
 
        for (fr = cache->startframe; fr <= cache->endframe; fr++) {
                /* smd->time is overwritten with scene->r.cfra in 
smokeModifier_process,
@@ -3473,7 +3473,7 @@ void smokeModifier_OpenVDB_export(SmokeModifierData *smd, 
Scene *scene, Object *
                }
        }
 
-       cache->flags |= VDB_CACHE_SMOKE_EXPORTED;
+       cache->flags |= OPENVDB_CACHE_BAKED;
 
        scene->r.cfra = orig_frame;
 }
@@ -3486,7 +3486,7 @@ bool smokeModifier_OpenVDB_import(SmokeModifierData *smd, 
Scene *scene, Object *
 
        cache = BKE_openvdb_get_current_cache(sds);
 
-       if (!(cache->flags & VDB_CACHE_SMOKE_EXPORTED)) {
+       if (!(cache->flags & OPENVDB_CACHE_BAKED)) {
                return false;
        }
 
@@ -3543,7 +3543,7 @@ OpenVDBCache 
*BKE_openvdb_get_current_cache(SmokeDomainSettings *sds)
        OpenVDBCache *cache = sds->vdb_caches.first;
 
        for (; cache; cache = cache->next) {
-               if (cache->flags & VDB_CACHE_CURRENT) {
+               if (cache->flags & OPENVDB_CACHE_CURRENT) {
                        break;
                }
        }
diff --git a/source/blender/editors/object/object_intern.h 
b/source/blender/editors/object/object_intern.h
index c883699..dd3c526 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -184,7 +184,7 @@ void OBJECT_OT_skin_loose_mark_clear(struct wmOperatorType 
*ot);
 void OBJECT_OT_skin_radii_equalize(struct wmOperatorType *ot);
 void OBJECT_OT_skin_armature_create(struct wmOperatorType *ot);
 void OBJECT_OT_laplaciandeform_bind(struct wmOperatorType *ot);
-void OBJECT_OT_smoke_vdb_export(struct wmOperatorType *ot);
+void OBJECT_OT_openvdb_cache_bake(struct wmOperatorType *ot);
 void OBJECT_OT_openvdb_cache_add(struct wmOperatorType *ot);
 void OBJECT_OT_openvdb_cache_remove(struct wmOperatorType *ot);
 void OBJECT_OT_openvdb_cache_move(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_modifier.c 
b/source/blender/editors/object/object_modifier.c
index d2752b0..1af8fb3 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -2305,7 +2305,7 @@ void OBJECT_OT_laplaciandeform_bind(wmOperatorType *ot)
        edit_modifier_properties(ot);
 }
 
-/************************ OpenVDB smoke convertor operator 
*********************/
+/* ************************* OpenVDB cache operators ************************* 
*/
 
 static int openvdb_cache_poll(bContext *C)
 {
@@ -2325,7 +2325,7 @@ static int openvdb_cache_poll(bContext *C)
        return true;
 }
 
-typedef struct SmokeExportJob {
+typedef struct OpenVDBCacheJob {
        /* from wmJob */
        void *owner;
        short *stop, *do_update;
@@ -2334,41 +2334,41 @@ typedef struct SmokeExportJob {
        struct Scene *scene;
        struct Object *ob;
        struct DerivedMesh *dm;
-} SmokeExportJob;
+} OpenVDBCacheJob;
 
-static void smoke_export_free(void *customdata)
+static void openvdb_cache_bake_free(void *customdata)
 {
-       SmokeExportJob *sej = customdata;
-       MEM_freeN(sej);
+       OpenVDBCacheJob *ocj = customdata;
+       MEM_freeN(ocj);
 }
 
 /* called by smoke export, only to check job 'stop' value */
-static int smoke_export_breakjob(void *customdata)
+static int openvdb_cache_bake_breakjob(void *customdata)
 {
        UNUSED_VARS(customdata);
        return G.is_break;
 }
 
 /* called by smokeModifier_OpenVDB_export, wmJob sends notifier */
-static void smoke_export_update(void *customdata, float progress, int *cancel)
+static void openvdb_cache_bake_update(void *customdata, float progress, int 
*cancel)
 {
-       SmokeExportJob *sej = customdata;
+       OpenVDBCacheJob *ocj = customdata;
 
-       if (smoke_export_breakjob(sej)) {
+       if (openvdb_cache_bake_breakjob(ocj)) {
                *cancel = 1;
        }
 
-       *(sej->do_update) = true;
-       *(sej->progress) = progress;
+       *(ocj->do_update) = true;
+       *(ocj->progress) = progress;
 }
 
-static void smoke_export_startjob(void *customdata, short *stop, short 
*do_update, float *progress)
+static void openvdb_cache_bake_startjob(void *customdata, short *stop, short 
*do_update, float *progress)
 {
-       SmokeExportJob *sej = customdata;
+       OpenVDBCacheJob *ocj = customdata;
 
-       sej->stop = stop;
-       sej->do_update = do_update;
-       sej->progress = progress;
+       ocj->stop = stop;
+       ocj->do_update = do_update;
+       ocj->progress = progress;
 
        G.is_break = false;
 
@@ -2378,17 +2378,17 @@ static void smoke_export_startjob(void *customdata, 
short *stop, short *do_updat
        G.is_rendering = true;
        BKE_spacedata_draw_locks(true);
 
-       smokeModifier_OpenVDB_export(sej->smd, sej->scene, sej->ob, sej->dm,
-                                    smoke_export_update, (void *)sej);
+       smokeModifier_OpenVDB_export(ocj->smd, ocj->scene, ocj->ob, ocj->dm,
+                                    openvdb_cache_bake_update, (void *)ocj);
 
        *do_update = true;
        *stop = 0;
 }
 
-static void smoke_export_endjob(void *customdata)
+static void openvdb_cache_bake_endjob(void *customdata)
 {
-       SmokeExportJob *sej = customdata;
-       Object *ob = sej->ob;
+       OpenVDBCacheJob *ocj = customdata;
+       Object *ob = ocj->ob;
 
        G.is_rendering = false;
        BKE_spacedata_draw_locks(false);
@@ -2397,31 +2397,31 @@ static void smoke_export_endjob(void *customdata)
        WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
 }
 
-static int smoke_vdb_export_exec(bContext *C, wmOperator *op)
+static int openvdb_cache_bake_exec(bContext *C, wmOperator *op)
 {
        Object *ob = CTX_data_active_object(C);
        SmokeModifierData *smd = (SmokeModifierData *)modifiers_findByType(ob, 
eModifierType_Smoke);
        Scene *scene = CTX_data_scene(C);
        wmJob *wm_job;
-       SmokeExportJob *sej;
+       OpenVDBCacheJob *ocj;
 
        if (!smd) {
                return OPERATOR_CANCELLED;
        }
 
        /* setup job */
-       wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, 
"OpenVDB Export",
-                            WM_JOB_PROGRESS, WM_JOB_TYPE_SMOKE_EXPORT);
+       wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, 
"OpenVDB Cache",
+                            WM_JOB_PROGRESS, WM_JOB_TYPE_OPENVDB_CACHE);
 
-       sej = MEM_callocN(sizeof(SmokeExportJob), "smoke export job");
-       sej->smd = smd;
-       sej->scene = scene;
-       sej->ob = ob;
-       sej->dm = ob->derivedDeform;
+       ocj = MEM_callocN(sizeof(OpenVDBCacheJob), "openvdb cache job");
+       ocj->smd = smd;
+       ocj->scene = scene;
+       ocj->ob = ob;
+       ocj->dm = ob->derivedDeform;
 
-       WM_jobs_customdata_set(wm_job, sej, smoke_export_free);
+       WM_jobs_customdata_set(wm_job, ocj, openvdb_cache_bake_free);
        WM_jobs_timer(wm_job, 0.1, NC_OBJECT | ND_MODIFIER, NC_OBJECT | 
ND_MODIFIER);
-       WM_jobs_callbacks(wm_job, smoke_export_startjob, NULL, NULL, 
smoke_export_endjob);
+       WM_jobs_callbacks(wm_job, openvdb_cache_bake_startjob, NULL, NULL, 
openvdb_cache_bake_endjob);
 
        WM_jobs_start(CTX_wm_manager(C), wm_job);
 
@@ -2430,7 +2430,7 @@ static int smoke_vdb_export_exec(bContext *C, wmOperator 
*op)
        UNUSED_VARS(op);
 }
 
-static int smoke_vdb_export_invoke(bContext *C, wmOperator *op, const wmEvent 
*event)
+static int openvdb_cache_bake_invoke(bContext *C, wmOperator *op, const 
wmEvent *event)
 {
        Object *ob = CTX_data_active_object(C);
        SmokeModifierData *smd = (SmokeModifierData *)modifiers_findByType(ob, 
eModifierType_Smoke);
@@ -2460,28 +2460,26 @@ static int smoke_vdb_export_invoke(bContext *C, 
wmOperator *op, const wmEvent *e
                }
        }
        else {
-               return smoke_vdb_export_exec(C, op);
+               return openvdb_cache_bake_exec(C, op);
        }
 
        UNUSED_VARS(event);
 }
 
-void OBJECT_OT_smoke_vdb_export(wmOperatorType *ot)
+void OBJECT_OT_openvdb_cache_bake(wmOperatorType *ot)
 {
-       ot->name = "Export to OpenVDB";
-       ot->description = "Export simulation to the OpenVDB representation";
-       ot->idname = "OBJECT_OT_smoke_vdb_export";
+       ot->name = "Bake Cache";
+       ot->description = "Cache the smoke simulation";
+       ot->idname = "OBJECT_OT_openvdb_cache_bake";
 
-       ot->invoke = smoke_vdb_export_invoke;
+       ot->invoke = openvdb_cache_bake_invoke;
        ot->poll = openvdb_cache_poll;
-       ot->exec = smoke_vdb_export_exec;
+       ot->exec = openvdb_cache_bake_exec;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
 }
 
-/* ************************* OpenVDB cache operators ************************* 
*/
-
 static OpenVDBCache *openvdb_cache_new(void)
 {
        OpenVDBCache *cache = NULL;
@@ -2493,7 +2491,7 @@ static OpenVDBCache *openvdb_cache_new(void)
        cache->endframe = 250;
        cache->compression = VDB_COMPRESSION_ZIP;
 
-       BLI_strncpy(cache->name, "openvdb_smoke_export", sizeof(cache->name));
+       BLI_strncpy(cache->name, "openvdb_cache", sizeof(cache->name));
 
        return cache;
 }
@@ -2512,11 +2510,11 @@ static int openvdb_cache_add_exec(bContext *C, 
wmOperator *op)
        cache = BKE_openvdb_get_current_cache(sds);
 
        i

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to