diff options
author | William Reynish <william@reynish.com> | 2009-08-07 23:14:49 +0400 |
---|---|---|
committer | William Reynish <william@reynish.com> | 2009-08-07 23:14:49 +0400 |
commit | 0ce86b0a763e9669a15aa0c07242e6ab2aa8dacd (patch) | |
tree | 10a8e0f5aff75988cf1817ad9c6a2c67cf549e13 /source | |
parent | 70f011bbcea9aee222e43895fea503b26d3d566a (diff) |
Added material game physics options in RNA and layout.
Thanks to the new render API system these options don't clutter up the layout when you're not doing games.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesdna/DNA_material_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 51 |
2 files changed, 52 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index 5b566a244b4..8428e750025 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -224,7 +224,7 @@ typedef struct Material { #define MA_SPEC_WARDISO 4 /* dynamode */ -#define MA_DRAW_DYNABUTS 1 +#define MA_DRAW_DYNABUTS 1 /* deprecated */ #define MA_FH_NOR 2 /* ramps */ diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 87efe6c39c0..bf4f9734770 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -66,6 +66,11 @@ static PointerRNA rna_Material_strand_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_MaterialStrand, ptr->id.data); } +static PointerRNA rna_Material_physics_get(PointerRNA *ptr) +{ + return rna_pointer_inherit_refine(ptr, &RNA_MaterialPhysics, ptr->id.data); +} + static void rna_Material_type_set(PointerRNA *ptr, int value) { Material *ma= (Material*)ptr->data; @@ -1123,6 +1128,46 @@ void rna_def_material_strand(BlenderRNA *brna) RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); } +void rna_def_material_physics(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "MaterialPhysics", NULL); + RNA_def_struct_sdna(srna, "Material"); + RNA_def_struct_nested(brna, srna, "Material"); + RNA_def_struct_ui_text(srna, "Material Physics", "Physics settings for a Material datablock."); + + prop= RNA_def_property(srna, "align_to_normal", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FH_NOR); + RNA_def_property_ui_text(prop, "Align to Normal", "Align dynamic game objects along the surface normal, when inside the physics distance area"); + + prop= RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "friction"); + RNA_def_property_range(prop, 0, 100); + RNA_def_property_ui_text(prop, "Friction", "Coulomb friction coeffecient, when inside the physics distance area"); + + prop= RNA_def_property(srna, "force", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "fh"); + RNA_def_property_range(prop, 0, 1); + RNA_def_property_ui_text(prop, "Force", "Upward spring force, when inside the physics distance area"); + + prop= RNA_def_property(srna, "elasticity", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "reflect"); + RNA_def_property_range(prop, 0, 1); + RNA_def_property_ui_text(prop, "Elasticity", "Elasticity of collisions"); + + prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "fhdist"); + RNA_def_property_range(prop, 0, 20); + RNA_def_property_ui_text(prop, "Distance", "Distance of the physics area"); + + prop= RNA_def_property(srna, "damp", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "xyfrict"); + RNA_def_property_range(prop, 0, 1); + RNA_def_property_ui_text(prop, "Damping", "Damping of the spring force, when inside the physics distance area"); +} + void RNA_def_material(BlenderRNA *brna) { StructRNA *srna; @@ -1322,6 +1367,11 @@ void RNA_def_material(BlenderRNA *brna) RNA_def_property_struct_type(prop, "MaterialStrand"); RNA_def_property_pointer_funcs(prop, "rna_Material_strand_get", NULL, NULL); RNA_def_property_ui_text(prop, "Strand", "Strand settings for the material."); + + prop= RNA_def_property(srna, "physics", PROP_POINTER, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "MaterialPhysics"); + RNA_def_property_pointer_funcs(prop, "rna_Material_physics_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Physics", "Game physics settings."); /* nodetree */ prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); @@ -1344,6 +1394,7 @@ void RNA_def_material(BlenderRNA *brna) rna_def_material_sss(brna); rna_def_material_mtex(brna); rna_def_material_strand(brna); + rna_def_material_physics(brna); } void rna_def_mtex_common(StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname) |