Commit: ac78fde8488ca080b4a5f4a6d75dfd6682ed9678
Author: Roman Pogribnyi
Date:   Fri May 30 14:03:33 2014 +0200
https://developer.blender.org/rBac78fde8488ca080b4a5f4a6d75dfd6682ed9678

operator to generate setup file added

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

M       intern/smoke/extern/smoke_API.h
M       intern/smoke/intern/smoke_API.cpp
M       source/blender/editors/physics/physics_fluid.c
M       source/blender/editors/physics/physics_intern.h
M       source/blender/editors/physics/physics_ops.c

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

diff --git a/intern/smoke/extern/smoke_API.h b/intern/smoke/extern/smoke_API.h
index b748734..c4a62c3 100644
--- a/intern/smoke/extern/smoke_API.h
+++ b/intern/smoke/extern/smoke_API.h
@@ -115,7 +115,7 @@ void smoke_ensure_colors(struct FLUID_3D *fluid, struct 
WTURBULENCE *wt, float i
 
 /*Mantaflow functions*/
 void smoke_mantaflow_read(struct FLUID_3D *fluid, char* name);
-       
+void smoke_mantaflow_write_scene_file(struct Scene *s, struct 
SmokeModifierData *smd); 
 #ifdef __cplusplus
 }
 #endif
diff --git a/intern/smoke/intern/smoke_API.cpp 
b/intern/smoke/intern/smoke_API.cpp
index 9de4d5b..3909c5a 100644
--- a/intern/smoke/intern/smoke_API.cpp
+++ b/intern/smoke/intern/smoke_API.cpp
@@ -506,3 +506,8 @@ extern "C" void smoke_mantaflow_read(struct FLUID_3D 
*fluid, char* name)
        read_mantaflow_sim(fluid, name);
 }
 
+extern "C" void smoke_mantaflow_write_scene_file(struct Scene *s, struct 
SmokeModifierData *smd)
+{
+       generate_manta_sim_file(s, smd);        
+}
+
diff --git a/source/blender/editors/physics/physics_fluid.c 
b/source/blender/editors/physics/physics_fluid.c
index 3972ed1..2381461 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -65,6 +65,10 @@
 #include "physics_intern.h" // own include
 
 /* enable/disable overall compilation */
+/*mantaflow include*/
+#include "../../../../intern/smoke/extern/smoke_API.h"
+#include "DNA_smoke_types.h"
+
 #ifdef WITH_MOD_FLUID
 
 #include "WM_api.h"
@@ -1129,3 +1133,44 @@ void FLUID_OT_bake(wmOperatorType *ot)
        ot->poll = ED_operator_object_active_editable;
 }
 
+
+
+static int manta_make_file_invoke(bContext *C, wmOperator *op, const wmEvent 
*UNUSED(event))
+{
+       Scene *scene= CTX_data_scene(C);
+       SmokeModifierData *smd;
+       Object * smokeDomain = CTX_data_active_object(C);
+       smd = (SmokeModifierData *)modifiers_findByType(smokeDomain, 
eModifierType_Smoke);
+       smoke_mantaflow_write_scene_file(scene, smd);
+       /*      return OPERATOR_CANCELLED;*/
+       
+       return OPERATOR_FINISHED;
+}
+
+static int manta_make_file_exec(bContext *C, wmOperator *op)
+{
+       Scene *scene= CTX_data_scene(C);
+       SmokeModifierData *smd;
+       Object * smokeDomain = CTX_data_active_object(C);
+       smd = (SmokeModifierData *)modifiers_findByType(smokeDomain, 
eModifierType_Smoke);
+       smoke_mantaflow_write_scene_file(scene, smd);
+
+       /*      return OPERATOR_CANCELLED;*/
+       
+       return OPERATOR_FINISHED;
+}
+
+
+void MANTA_OT_make_file(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name = "Create Mantaflow File";
+       ot->description = "Create Python Script for Simulation";
+       ot->idname = "MANTA_OT_make_file";
+       
+       /* api callbacks */
+       ot->invoke = manta_make_file_invoke;
+       ot->exec = manta_make_file_exec;
+       ot->poll = ED_operator_object_active_editable;
+}
+
diff --git a/source/blender/editors/physics/physics_intern.h 
b/source/blender/editors/physics/physics_intern.h
index 77ce5a3..065a6f1 100644
--- a/source/blender/editors/physics/physics_intern.h
+++ b/source/blender/editors/physics/physics_intern.h
@@ -88,6 +88,7 @@ void BOID_OT_state_move_down(struct wmOperatorType *ot);
 
 /* physics_fluid.c */
 void FLUID_OT_bake(struct wmOperatorType *ot);
+void MANTA_OT_make_file(struct wmOperatorType *ot);
 
 /* dynamicpaint.c */
 void DPAINT_OT_bake(struct wmOperatorType *ot);
diff --git a/source/blender/editors/physics/physics_ops.c 
b/source/blender/editors/physics/physics_ops.c
index 48cc51f..eeb6e88 100644
--- a/source/blender/editors/physics/physics_ops.c
+++ b/source/blender/editors/physics/physics_ops.c
@@ -178,6 +178,14 @@ static void operatortypes_fluid(void)
        WM_operatortype_append(FLUID_OT_bake);
 }
 
+/********************************* manta ***********************************/
+
+static void operatortypes_manta(void)
+{
+       WM_operatortype_append(MANTA_OT_make_file);
+}
+
+
 /**************************** point cache **********************************/
 
 static void operatortypes_pointcache(void)
@@ -219,6 +227,7 @@ void ED_operatortypes_physics(void)
        operatortypes_particle();
        operatortypes_boids();
        operatortypes_fluid();
+       operatortypes_manta();
        operatortypes_pointcache();
        operatortypes_dynamicpaint();
 }

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

Reply via email to