Commit: 2e2174e9e6b70c9fc3f8d824dc71fa61fd1bb7b6
Author: Lukas Tönne
Date:   Thu Jan 8 14:25:52 2015 +0100
Branches: temp_hair_flow
https://developer.blender.org/rB2e2174e9e6b70c9fc3f8d824dc71fa61fd1bb7b6

Use a particle system flag to toggle hair flow calculation.

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

M       release/scripts/startup/bl_ui/properties_particle.py
M       source/blender/editors/hair/hair_edit.c
M       source/blender/editors/hair/hair_flow.c
M       source/blender/editors/hair/hair_intern.h
M       source/blender/makesdna/DNA_particle_types.h
M       source/blender/makesrna/intern/rna_particle.c

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

diff --git a/release/scripts/startup/bl_ui/properties_particle.py 
b/release/scripts/startup/bl_ui/properties_particle.py
index 6d4f4b8..e7e4bc2 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -272,9 +272,9 @@ class PARTICLE_PT_hair_flow(ParticleButtonsPanel, Panel):
             return False
         return psys.settings.type == 'HAIR'
 
-#    def draw_header(self, context):
-#        psys = context.particle_system
-#        self.layout.prop(psys, "use_hair_flow", text="")
+    def draw_header(self, context):
+        psys = context.particle_system
+        self.layout.prop(psys, "use_hair_flow", text="")
 
     def draw(self, context):
         layout = self.layout
diff --git a/source/blender/editors/hair/hair_edit.c 
b/source/blender/editors/hair/hair_edit.c
index 0824449..5c1aff0 100644
--- a/source/blender/editors/hair/hair_edit.c
+++ b/source/blender/editors/hair/hair_edit.c
@@ -130,6 +130,25 @@ int hair_edit_poll(bContext *C)
        return false;
 }
 
+int hair_flow_poll(bContext *C)
+{
+       Object *ob = CTX_data_active_object(C);
+       ParticleSystem *psys;
+       
+       if (ob == NULL)
+               return false;
+       if (!ob->data || ((ID *)ob->data)->lib)
+               return false;
+       if (CTX_data_edit_object(C))
+               return false;
+       
+       psys = psys_get_current(ob);
+       if (!(psys && psys->part->type == PART_HAIR))
+               return false;
+       
+       return (bool)(psys->flag & PSYS_HAIR_FLOW);
+}
+
 
 /* ==== BMesh utilities ==== */
 
diff --git a/source/blender/editors/hair/hair_flow.c 
b/source/blender/editors/hair/hair_flow.c
index e9586fc..316275c 100644
--- a/source/blender/editors/hair/hair_flow.c
+++ b/source/blender/editors/hair/hair_flow.c
@@ -58,11 +58,6 @@
 
 #include "hair_intern.h"
 
-static int hair_flow_solve_poll(bContext *C)
-{
-       return hair_edit_toggle_poll(C);
-}
-
 static int hair_solve_flow_exec(bContext *C, wmOperator *op)
 {
        Scene *scene = CTX_data_scene(C);
@@ -113,7 +108,7 @@ void HAIR_OT_solve_flow(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = hair_solve_flow_exec;
-       ot->poll = hair_flow_solve_poll; /* uses temporary edit data */
+       ot->poll = hair_flow_poll; /* uses temporary edit data */
 
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
diff --git a/source/blender/editors/hair/hair_intern.h 
b/source/blender/editors/hair/hair_intern.h
index 42abe6f..63f1595 100644
--- a/source/blender/editors/hair/hair_intern.h
+++ b/source/blender/editors/hair/hair_intern.h
@@ -44,6 +44,7 @@ struct rcti;
 /* hair_edit.c */
 int hair_edit_toggle_poll(struct bContext *C);
 int hair_edit_poll(struct bContext *C);
+int hair_flow_poll(struct bContext *C);
 
 void HAIR_OT_hair_edit_toggle(struct wmOperatorType *ot);
 
diff --git a/source/blender/makesdna/DNA_particle_types.h 
b/source/blender/makesdna/DNA_particle_types.h
index c4765a4..0714d9d 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -536,6 +536,7 @@ typedef enum eParticleDrawFlag {
 //#define PSYS_PROTECT_CACHE   4096 /* deprecated */
 #define PSYS_DISABLED                  8192
 #define PSYS_OB_ANIM_RESTORE   16384 /* runtime flag */
+#define PSYS_HAIR_FLOW         32768
 
 typedef enum eParticleDataFlag {
        PARS_UNEXIST        = 1,
diff --git a/source/blender/makesrna/intern/rna_particle.c 
b/source/blender/makesrna/intern/rna_particle.c
index a034e96..db2458b 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -3238,6 +3238,11 @@ static void rna_def_particle_system(BlenderRNA *brna)
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Global Hair", "Hair keys are in global 
coordinate space");
 
+       prop = RNA_def_property(srna, "use_hair_flow", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_HAIR_FLOW);
+       RNA_def_property_ui_text(prop, "Hair Flow", "Enable hair flow 
calculation");
+       RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
        prop = RNA_def_property(srna, "use_hair_dynamics", PROP_BOOLEAN, 
PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_HAIR_DYNAMICS);
        RNA_def_property_ui_text(prop, "Hair Dynamics", "Enable hair dynamics 
using cloth simulation");

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

Reply via email to