Fixed [#19506] Missing buttons : Curve Guide.
authorThomas Dinges <blender@dingto.org>
Fri, 2 Oct 2009 20:15:25 +0000 (20:15 +0000)
committerThomas Dinges <blender@dingto.org>
Fri, 2 Oct 2009 20:15:25 +0000 (20:15 +0000)
Jahka: please check on the Kink type and axis RNA Wrapping.
Todo: Make Curve Guide Field only available for Curve Objects.

release/scripts/ui/buttons_physics_field.py
source/blender/makesrna/intern/rna_object_force.c

index 24740acc68f58bb5dfcf043a92030bef77bf9405..9aec0404ab136f3ee89cfdb6af1b0da619344e25 100644 (file)
@@ -21,8 +21,6 @@ class PHYSICS_PT_field(PhysicButtonsPanel):
                
                ob = context.object
                field = ob.field
-
-               #layout.active = field.enabled
                
                split = layout.split(percentage=0.2)
                split.itemL(text="Type:")
@@ -39,7 +37,33 @@ class PHYSICS_PT_field(PhysicButtonsPanel):
                if field.type == 'NONE':
                        return # nothing to draw
                elif field.type == 'GUIDE':
-                       layout.itemR(field, "guide_path_add")
+                       col = split.column()
+                       col.itemR(field, "guide_minimum")
+                       col.itemR(field, "guide_free")
+                       col.itemR(field, "falloff_power")
+                       col.itemR(field, "guide_path_add")
+                       
+                       col = split.column()
+                       col.itemL(text="Clumping:")
+                       col.itemR(field, "guide_clump_amount")
+                       col.itemR(field, "guide_clump_shape")
+                       
+                       row = layout.row()                      
+                       row.itemR(field, "use_max_distance")
+                       sub = row.row()
+                       sub.active = field.use_max_distance
+                       sub.itemR(field, "maximum_distance")
+                       
+                       layout.itemS()
+
+                       layout.itemR(field, "guide_kink_type")
+                       if (field.guide_kink_type != "NONE"):
+                               layout.itemR(field, "guide_kink_axis")
+                               
+                               flow = layout.column_flow()
+                               flow.itemR(field, "guide_kink_frequency")
+                               flow.itemR(field, "guide_kink_shape")
+                               flow.itemR(field, "guide_kink_amplitude")
                elif field.type == 'TEXTURE':
                        col = split.column()
                        col.itemR(field, "strength")
@@ -102,17 +126,6 @@ class PHYSICS_PT_field(PhysicButtonsPanel):
                                sub = col.column()
                                sub.active = field.use_radial_max
                                sub.itemR(field, "radial_maximum", text="Distance")
-                               
-               #if ob.type in 'CURVE':
-                       #if field.type == 'GUIDE':
-                               #colsub = col.column(align=True)
-                       
-               #if field.type != 'NONE':
-                       #layout.itemR(field, "strength")
-
-               #if field.type in ('HARMONIC', 'SPHERICAL', 'CHARGE', "LENNARDj"):
-                       #if ob.type in ('MESH', 'SURFACE', 'FONT', 'CURVE'):
-                               #layout.itemR(field, "surface")
 
 class PHYSICS_PT_collision(PhysicButtonsPanel):
        __label__ = "Collision"
index 652a80a24eba3d0de5cca030849a2a61d555dae7..022c04240af2d8de98a10469223c8c02ecb81649 100644 (file)
@@ -906,6 +906,22 @@ static void rna_def_field(BlenderRNA *brna)
                {PFIELD_Z_POS, "POSITIVE", 0, "+Z", ""},
                {PFIELD_Z_NEG, "NEGATIVE", 0, "-Z", ""},
                {0, NULL, 0, NULL, NULL}};
+               
+       static EnumPropertyItem guide_kink_items[] = {
+               {0, "NONE", 0, "Nothing", ""},
+               {1, "CURL", 0, "Curl", ""},
+               {2, "RADIAL", 0, "Radial", ""},
+               {3, "WAVE", 0, "Wave", ""},
+               {4, "BRAID", 0, "Braid", ""},
+               {5, "ROTATION", 0, "Rotation", ""},
+               {6, "ROLL", 0, "Roll", ""},
+               {0, NULL, 0, NULL, NULL}};
+               
+       static EnumPropertyItem guide_kink_axis_items[] = {
+               {0, "X", 0, "X", ""},
+               {1, "Y", 0, "Y", ""},
+               {2, "Z", 0, "Z", ""},
+               {0, NULL, 0, NULL, NULL}};
 
        srna= RNA_def_struct(brna, "FieldSettings", NULL);
        RNA_def_struct_sdna(srna, "PartDeflect");
@@ -1067,11 +1083,6 @@ static void rna_def_field(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Use Max", "Use a maximum radial distance for the field to work");
        // "Use a maximum angle for the field to work"
        RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-       
-       prop= RNA_def_property(srna, "guide_path_add", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GUIDE_PATH_ADD);
-       RNA_def_property_ui_text(prop, "Additive", "Based on distance/falloff it adds a portion of the entire path");
-       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
        prop= RNA_def_property(srna, "use_coordinates", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_OBJECT);
@@ -1110,6 +1121,74 @@ static void rna_def_field(BlenderRNA *brna)
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Texture", "Texture to use as force");
        RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+       
+       /********** Curve Guide Field Settings **********/
+       
+       prop= RNA_def_property(srna, "guide_minimum", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "f_strength");
+       RNA_def_property_range(prop, 0.0f, 1000.0f);
+       RNA_def_property_ui_text(prop, "Minimum Distance", "The distance from which particles are affected fully.");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+       prop= RNA_def_property(srna, "guide_free", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "free_end");
+       RNA_def_property_range(prop, 0.0f, 0.99f);
+       RNA_def_property_ui_text(prop, "Free", "Guide-free time from particle life's end");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+       prop= RNA_def_property(srna, "guide_path_add", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GUIDE_PATH_ADD);
+       RNA_def_property_ui_text(prop, "Additive", "Based on distance/falloff it adds a portion of the entire path");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+       
+       /* Clump Settings */
+       
+       prop= RNA_def_property(srna, "guide_clump_amount", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "clump_fac");
+       RNA_def_property_range(prop, -1.0f, 1.0f);
+       RNA_def_property_ui_text(prop, "Amount", "Amount of clumpimg");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+       
+       prop= RNA_def_property(srna, "guide_clump_shape", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "clump_pow");
+       RNA_def_property_range(prop, -0.999f, 0.999f);
+       RNA_def_property_ui_text(prop, "Shape", "Shape of clumpimg");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+       
+       /* Kink Settings */
+       
+       prop= RNA_def_property(srna, "guide_kink_type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "kink");
+       RNA_def_property_enum_items(prop, guide_kink_items);
+       RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the curve");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+       
+       prop= RNA_def_property(srna, "guide_kink_axis", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "kink_axis");
+       RNA_def_property_enum_items(prop, guide_kink_axis_items);
+       RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+       prop= RNA_def_property(srna, "guide_kink_frequency", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "kink_freq");
+       RNA_def_property_range(prop, 0.0f, 10.0f);
+       RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+       
+       prop= RNA_def_property(srna, "guide_kink_shape", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "kink_shape");
+       RNA_def_property_range(prop, -0.999f, 0.999f);
+       RNA_def_property_ui_text(prop, "Shape", "djust the offset to the beginning/end");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+       
+       prop= RNA_def_property(srna, "guide_kink_amplitude", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "kink_amp");
+       RNA_def_property_range(prop, 0.0f, 10.0f);
+       RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+       /* Variables used for Curve Guide, allready wrapped, used for other fields too */
+       // falloff_power, use_max_distance, maximum_distance
 }
 
 static void rna_def_game_softbody(BlenderRNA *brna)