Commit: ce20c8d8762dda455298203f54f6457729f002be
Author: Roman Pogribnyi
Date:   Thu Jul 31 19:52:50 2014 +0200
Branches: soc-2014-fluid
https://developer.blender.org/rBce20c8d8762dda455298203f54f6457729f002be

step, stop sim manta operations 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 c4a62c3..e57ac43 100644
--- a/intern/smoke/extern/smoke_API.h
+++ b/intern/smoke/extern/smoke_API.h
@@ -115,7 +115,9 @@ 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); 
+void smoke_mantaflow_write_scene_file(struct Scene *s, struct 
SmokeModifierData *smd);
+void smoke_mantaflow_sim_step(struct SmokeModifierData *smd);
+void smoke_mantaflow_stop_sim();
 #ifdef __cplusplus
 }
 #endif
diff --git a/intern/smoke/intern/smoke_API.cpp 
b/intern/smoke/intern/smoke_API.cpp
index 7e41ac9..572861a 100644
--- a/intern/smoke/intern/smoke_API.cpp
+++ b/intern/smoke/intern/smoke_API.cpp
@@ -509,4 +509,14 @@ extern "C" void smoke_mantaflow_read(struct FLUID_3D 
*fluid, char* name)
 extern "C" void smoke_mantaflow_write_scene_file(struct Scene *s, struct 
SmokeModifierData *smd)
 {
        generate_manta_sim_file(s, smd);        
+}
+
+extern "C" void smoke_mantaflow_sim_step(SmokeModifierData *smd)
+{
+       run_manta_scene(smd);
+}
+
+extern "C" void smoke_mantaflow_stop_sim()
+{
+       stop_manta_sim();
 }
\ No newline at end of file
diff --git a/source/blender/editors/physics/physics_fluid.c 
b/source/blender/editors/physics/physics_fluid.c
index 2381461..76d7faf 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -1174,3 +1174,80 @@ void MANTA_OT_make_file(wmOperatorType *ot)
        ot->poll = ED_operator_object_active_editable;
 }
 
+static int manta_sim_step_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_sim_step(smd);
+       /*      return OPERATOR_CANCELLED;*/
+       
+       return OPERATOR_FINISHED;
+}
+
+static int manta_sim_step_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_sim_step(smd);
+       
+       /*      return OPERATOR_CANCELLED;*/
+       
+       return OPERATOR_FINISHED;
+}
+
+
+void MANTA_OT_sim_step(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name = "Run Mantaflow Step";
+       ot->description = "Run One Step of Mantaflow Simulation";
+       ot->idname = "MANTA_OT_sim_step";
+       
+       /* api callbacks */
+       ot->invoke = manta_sim_step_invoke;
+       ot->exec = manta_sim_step_exec;
+       ot->poll = ED_operator_object_active_editable;
+}
+
+static int manta_stop_sim_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_stop_sim();
+       /*      return OPERATOR_CANCELLED;*/
+       
+       return OPERATOR_FINISHED;
+}
+
+static int manta_stop_sim_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_stop_sim();
+       
+       /*      return OPERATOR_CANCELLED;*/
+       
+       return OPERATOR_FINISHED;
+}
+
+
+void MANTA_OT_stop_sim(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name = "Stop Mantaflow Sim";
+       ot->description = "Stop Mantaflow Sim";
+       ot->idname = "MANTA_OT_stop_sim";
+       
+       /* api callbacks */
+       ot->invoke = manta_stop_sim_invoke;
+       ot->exec = manta_stop_sim_exec;
+       ot->poll = ED_operator_object_active_editable;
+}
\ No newline at end of file
diff --git a/source/blender/editors/physics/physics_intern.h 
b/source/blender/editors/physics/physics_intern.h
index 065a6f1..2826782 100644
--- a/source/blender/editors/physics/physics_intern.h
+++ b/source/blender/editors/physics/physics_intern.h
@@ -89,7 +89,8 @@ 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);
-
+void MANTA_OT_sim_step(struct wmOperatorType *ot);
+void MANTA_OT_stop_sim(struct wmOperatorType *ot);
 /* dynamicpaint.c */
 void DPAINT_OT_bake(struct wmOperatorType *ot);
 void DPAINT_OT_surface_slot_add(struct wmOperatorType *ot);
diff --git a/source/blender/editors/physics/physics_ops.c 
b/source/blender/editors/physics/physics_ops.c
index eeb6e88..cb4bd5e 100644
--- a/source/blender/editors/physics/physics_ops.c
+++ b/source/blender/editors/physics/physics_ops.c
@@ -183,6 +183,8 @@ static void operatortypes_fluid(void)
 static void operatortypes_manta(void)
 {
        WM_operatortype_append(MANTA_OT_make_file);
+       WM_operatortype_append(MANTA_OT_sim_step);
+       WM_operatortype_append(MANTA_OT_stop_sim);
 }

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

Reply via email to