diff options
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_boid.c | 27 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_cloth.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_force.c | 424 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 221 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 23 |
6 files changed, 461 insertions, 243 deletions
diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 8002aa89313..36a648c8a82 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -74,44 +74,33 @@ EnumPropertyItem boidruleset_type_items[] ={ static void rna_Boids_reset(bContext *C, PointerRNA *ptr) { - Scene *scene = CTX_data_scene(C); - ParticleSettings *part; - if(ptr->type==&RNA_ParticleSystem) { ParticleSystem *psys = (ParticleSystem*)ptr->data; - Object *ob = psys_find_object(scene, psys); psys->recalc = PSYS_RECALC_RESET; - if(ob) - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); - } - else { - part = ptr->id.data; - psys_flush_particle_settings(scene, part, PSYS_RECALC_RESET); + DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA); } + else + DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL); } static void rna_Boids_reset_deps(bContext *C, PointerRNA *ptr) { Scene *scene = CTX_data_scene(C); - ParticleSettings *part; if(ptr->type==&RNA_ParticleSystem) { ParticleSystem *psys = (ParticleSystem*)ptr->data; - Object *ob = psys_find_object(scene, psys); psys->recalc = PSYS_RECALC_RESET; - if(ob) - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); - } - else { - part = ptr->id.data; - psys_flush_particle_settings(scene, part, PSYS_RECALC_RESET); - DAG_scene_sort(scene); + DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA); } + else + DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET); + + DAG_scene_sort(scene); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL); } diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index 22cc2e2c9c3..d64e2c7119b 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -306,6 +306,11 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Bending Stiffness Vertex Group", "Vertex group for fine control over bending stiffness."); RNA_def_property_update(prop, 0, "rna_cloth_update"); + prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "EffectorWeights"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Effector Weights", ""); + /* unused */ /* unused still diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index a2b4d6d7335..afc82016502 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -741,7 +741,7 @@ static PointerRNA rna_Object_field_get(PointerRNA *ptr) /* weak */ if(!ob->pd) - ob->pd= object_add_collision_fields(); + ob->pd= object_add_collision_fields(0); return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, ob->pd); } @@ -752,7 +752,7 @@ static PointerRNA rna_Object_collision_get(PointerRNA *ptr) /* weak */ if(!ob->pd) - ob->pd= object_add_collision_fields(); + ob->pd= object_add_collision_fields(0); return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd); } diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 1f0d01ce784..652a80a24eb 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -31,11 +31,40 @@ #include "DNA_object_types.h" #include "DNA_object_force.h" +#include "DNA_particle_types.h" #include "DNA_scene_types.h" #include "WM_api.h" #include "WM_types.h" +EnumPropertyItem effector_shape_items[] = { + {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, + {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, + {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface", ""}, + {PFIELD_SHAPE_POINTS, "POINTS", 0, "Every Point", ""}, + {0, NULL, 0, NULL, NULL} +}; + +EnumPropertyItem empty_shape_items[] = { + {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, + {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, + {0, NULL, 0, NULL, NULL} +}; + +EnumPropertyItem vortex_shape_items[] = { + {PFIELD_SHAPE_POINT, "POINT", 0, "Old", ""}, + {PFIELD_SHAPE_PLANE, "PLANE", 0, "New", ""}, + {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface falloff (New)", ""}, + {PFIELD_SHAPE_POINTS, "POINTS", 0, "Every Point (New)", ""}, + {0, NULL, 0, NULL, NULL} +}; + +EnumPropertyItem empty_vortex_shape_items[] = { + {PFIELD_SHAPE_POINT, "POINT", 0, "Old", ""}, + {PFIELD_SHAPE_PLANE, "PLANE", 0, "New", ""}, + {0, NULL, 0, NULL, NULL} +}; + #ifdef RNA_RUNTIME #include "MEM_guardedalloc.h" @@ -358,65 +387,115 @@ static void rna_SoftBodySettings_goal_vgroup_set(PointerRNA *ptr, const char *va rna_object_vgroup_name_index_set(ptr, value, &sb->vertgroup); } +static int particle_field_check(PointerRNA *ptr) +{ + ID *id= ptr->id.data; + + return (GS(id->name) == ID_PA); +} static void rna_FieldSettings_update(bContext *C, PointerRNA *ptr) { - Object *ob= (Object*)ptr->id.data; + if(particle_field_check(ptr)) { + ParticleSettings *part = (ParticleSettings*)ptr->id.data; + + if(part->pd->forcefield != PFIELD_TEXTURE && part->pd->tex) { + part->pd->tex->id.us--; + part->pd->tex= 0; + } + + if(part->pd2->forcefield != PFIELD_TEXTURE && part->pd2->tex) { + part->pd2->tex->id.us--; + part->pd2->tex= 0; + } + + DAG_id_flush_update(&part->id, OB_RECALC|PSYS_RECALC_RESET); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL); - if(ob->pd->forcefield != PFIELD_TEXTURE && ob->pd->tex) { - ob->pd->tex->id.us--; - ob->pd->tex= 0; } + else { + Object *ob = (Object*)ptr->id.data; - DAG_id_flush_update(&ob->id, OB_RECALC_OB); - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + if(ob->pd->forcefield != PFIELD_TEXTURE && ob->pd->tex) { + ob->pd->tex->id.us--; + ob->pd->tex= 0; + } + + DAG_id_flush_update(&ob->id, OB_RECALC_OB); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + } } -static void rna_FieldSettings_surface_update(bContext *C, PointerRNA *ptr) +static void rna_FieldSettings_shape_update(bContext *C, PointerRNA *ptr) { Scene *scene= CTX_data_scene(C); - Object *ob= (Object*)ptr->id.data; - PartDeflect *pd= ob->pd; - ModifierData *md= modifiers_findByType(ob, eModifierType_Surface); - /* add/remove modifier as needed */ - if(!md) { - if(pd && (pd->flag & PFIELD_SURFACE)) - if(ELEM6(pd->forcefield,PFIELD_HARMONIC,PFIELD_FORCE,PFIELD_HARMONIC,PFIELD_CHARGE,PFIELD_LENNARDJ,PFIELD_BOID)) + if(!particle_field_check(ptr)) { + Object *ob= (Object*)ptr->id.data; + PartDeflect *pd= ob->pd; + ModifierData *md= modifiers_findByType(ob, eModifierType_Surface); + + /* add/remove modifier as needed */ + if(!md) { + if(pd && (pd->shape == PFIELD_SHAPE_SURFACE) && ELEM(pd->forcefield,PFIELD_GUIDE,PFIELD_TEXTURE)==0) if(ELEM4(ob->type, OB_MESH, OB_SURF, OB_FONT, OB_CURVE)) ED_object_modifier_add(NULL, scene, ob, eModifierType_Surface); - } - else { - if(!pd || !(pd->flag & PFIELD_SURFACE)) - ED_object_modifier_remove(NULL, scene, ob, md); - } + } + else { + if(!pd || pd->shape != PFIELD_SHAPE_SURFACE) + ED_object_modifier_remove(NULL, scene, ob, md); + } - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + } } static void rna_FieldSettings_dependency_update(bContext *C, PointerRNA *ptr) { Scene *scene= CTX_data_scene(C); - Object *ob= (Object*)ptr->id.data; - /* do this before scene sort, that one checks for CU_PATH */ - /* XXX if(ob->type==OB_CURVE && ob->pd->forcefield==PFIELD_GUIDE) { - Curve *cu= ob->data; - cu->flag |= (CU_PATH|CU_3D); - do_curvebuts(B_CU3D); // all curves too - }*/ + if(particle_field_check(ptr)) { + DAG_id_flush_update((ID*)ptr->id.data, OB_RECALC|PSYS_RECALC_RESET); + } + else { + Object *ob= (Object*)ptr->id.data; - rna_FieldSettings_surface_update(C, ptr); + /* do this before scene sort, that one checks for CU_PATH */ + /* XXX if(ob->type==OB_CURVE && ob->pd->forcefield==PFIELD_GUIDE) { + Curve *cu= ob->data; + cu->flag |= (CU_PATH|CU_3D); + do_curvebuts(B_CU3D); // all curves too + }*/ - DAG_scene_sort(scene); + rna_FieldSettings_shape_update(C, ptr); - if(ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE) - DAG_id_flush_update(&ob->id, OB_RECALC); - else - DAG_id_flush_update(&ob->id, OB_RECALC_OB); + DAG_scene_sort(scene); - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + if(ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE) + DAG_id_flush_update(&ob->id, OB_RECALC); + else + DAG_id_flush_update(&ob->id, OB_RECALC_OB); + + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + } +} + +static void rna_EffectorWeight_update(bContext *C, PointerRNA *ptr) +{ + DAG_id_flush_update((ID*)ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET); + + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL); } +static void rna_EffectorWeight_dependency_update(bContext *C, PointerRNA *ptr) +{ + Scene *scene= CTX_data_scene(C); + + DAG_scene_sort(scene); + + DAG_id_flush_update((ID*)ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET); + + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL); +} static void rna_CollisionSettings_dependency_update(bContext *C, PointerRNA *ptr) { Scene *scene= CTX_data_scene(C); @@ -448,6 +527,47 @@ static void rna_softbody_update(bContext *C, PointerRNA *ptr) WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); } + +static EnumPropertyItem *rna_Effector_shape_itemf(bContext *C, PointerRNA *ptr, int *free) +{ + Object *ob= NULL; + + if(C==NULL) { + EnumPropertyItem *item= NULL; + int totitem= 0; + + /* needed for doc generation */ + RNA_enum_items_add(&item, &totitem, effector_shape_items); + RNA_enum_items_add(&item, &totitem, empty_shape_items); + RNA_enum_items_add(&item, &totitem, vortex_shape_items); + RNA_enum_items_add(&item, &totitem, empty_shape_items); + RNA_enum_item_end(&item, &totitem); + + *free= 1; + + return item; + } + + if(particle_field_check(ptr)) + return empty_shape_items; + + ob= (Object*)ptr->id.data; + + if(ELEM4(ob->type, OB_MESH, OB_SURF, OB_FONT, OB_CURVE)) { + if(ob->pd->forcefield == PFIELD_VORTEX) + return vortex_shape_items; + + return effector_shape_items; + } + else { + if(ob->pd->forcefield == PFIELD_VORTEX) + return empty_vortex_shape_items; + + return empty_shape_items; + } +} + + #else static void rna_def_pointcache(BlenderRNA *brna) @@ -625,6 +745,129 @@ static void rna_def_collision(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); } +static void rna_def_effector_weight(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "EffectorWeights", NULL); + RNA_def_struct_ui_text(srna, "Effector Weights", "Effector weights for physics simulation."); + RNA_def_struct_ui_icon(srna, ICON_PHYSICS); + + /* Flags */ + prop= RNA_def_property(srna, "do_growing_hair", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", EFF_WEIGHT_DO_HAIR); + RNA_def_property_ui_text(prop, "Use For Growing Hair", "Use force fields when growing hair."); + RNA_def_property_update(prop, 0, "rna_EffectorWeight_update"); + + /* General */ + prop= RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "group"); + RNA_def_property_struct_type(prop, "Group"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Effector Group", "Limit effectors to this Group."); + RNA_def_property_update(prop, 0, "rna_EffectorWeight_dependency_update"); + + prop= RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "global_gravity"); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "Gravity", "Global gravity weight."); + RNA_def_property_update(prop, 0, "rna_EffectorWeight_update"); + + /* Effector weights */ + prop= RNA_def_property(srna, "all", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "weight[0]"); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "All", "All effector's weight."); + RNA_def_property_update(prop, 0, "rna_EffectorWeight_update"); + + prop= RNA_def_property(srna, "spherical", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "weight[1]"); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "Spherical", "Spherical effector weight."); + RNA_def_property_update(prop, 0, "rna_EffectorWeight_update"); + + prop= RNA_def_property(srna, "vortex", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "weight[2]"); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "Vortex", "Vortex effector weight."); + RNA_def_property_update(prop, 0, "rna_EffectorWeight_update"); + + prop= RNA_def_property(srna, "magnetic", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "weight[3]"); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "Magnetic", "Magnetic effector weight."); + RNA_def_property_update(prop, 0, "rna_EffectorWeight_update"); + + prop= RNA_def_property(srna, "wind", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "weight[4]"); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "Wind", "Wind effector weight."); + RNA_def_property_update(prop, 0, "rna_EffectorWeight_update"); + + prop= RNA_def_property(srna, "curveguide", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "weight[5]"); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "Curve Guide", "Curve guide effector weight."); + RNA_def_property_update(prop, 0, "rna_EffectorWeight_update"); + + prop= RNA_def_property(srna, "texture", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "weight[6]"); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "Texture", "Texture effector weight."); + RNA_def_property_update(prop, 0, "rna_EffectorWeight_update"); + + prop= RNA_def_property(srna, "harmonic", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "weight[7]"); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "Harmonic", "Harmonic effector weight."); + RNA_def_property_update(prop, 0, "rna_EffectorWeight_update"); + + prop= RNA_def_property(srna, "charge", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "weight[8]"); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "Charge", "Charge effector weight."); + RNA_def_property_update(prop, 0, "rna_EffectorWeight_update"); + + prop= RNA_def_property(srna, "lennardjones", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "weight[9]"); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "Lennard-Jones", "Lennard-Jones effector weight."); + RNA_def_property_update(prop, 0, "rna_EffectorWeight_update"); + + prop= RNA_def_property(srna, "boid", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "weight[10]"); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "Boid", "Boid effector weight."); + RNA_def_property_update(prop, 0, "rna_EffectorWeight_update"); + + prop= RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "weight[11]"); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "Turbulence", "Turbulence effector weight."); + RNA_def_property_update(prop, 0, "rna_EffectorWeight_update"); + + prop= RNA_def_property(srna, "drag", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "weight[12]"); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "Drag", "Drag effector weight."); + RNA_def_property_update(prop, 0, "rna_EffectorWeight_update"); +} + static void rna_def_field(BlenderRNA *brna) { StructRNA *srna; @@ -632,18 +875,20 @@ static void rna_def_field(BlenderRNA *brna) static EnumPropertyItem field_type_items[] = { {0, "NONE", 0, "None", ""}, - {PFIELD_FORCE, "SPHERICAL", 0, "Spherical", ""}, + {PFIELD_FORCE, "FORCE", 0, "Force", ""}, + {PFIELD_WIND, "WIND", 0, "Wind", ""}, {PFIELD_VORTEX, "VORTEX", 0, "Vortex", ""}, {PFIELD_MAGNET, "MAGNET", 0, "Magnetic", ""}, - {PFIELD_WIND, "WIND", 0, "Wind", ""}, - {PFIELD_GUIDE, "GUIDE", 0, "Curve Guide", ""}, - {PFIELD_TEXTURE, "TEXTURE", 0, "Texture", ""}, {PFIELD_HARMONIC, "HARMONIC", 0, "Harmonic", ""}, {PFIELD_CHARGE, "CHARGE", 0, "Charge", ""}, {PFIELD_LENNARDJ, "LENNARDJ", 0, "Lennard-Jones", ""}, + {PFIELD_TEXTURE, "TEXTURE", 0, "Texture", ""}, + {PFIELD_GUIDE, "GUIDE", 0, "Curve Guide", ""}, {PFIELD_BOID, "BOID", 0, "Boid", ""}, + {PFIELD_TURBULENCE, "TURBULENCE", 0, "Turbulence", ""}, + {PFIELD_DRAG, "DRAG", 0, "Drag", ""}, {0, NULL, 0, NULL, NULL}}; - + static EnumPropertyItem falloff_items[] = { {PFIELD_FALL_SPHERE, "SPHERE", 0, "Sphere", ""}, {PFIELD_FALL_TUBE, "TUBE", 0, "Tube", ""}, @@ -656,6 +901,12 @@ static void rna_def_field(BlenderRNA *brna) {PFIELD_TEX_CURL, "CURL", 0, "Curl", ""}, {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem zdirection_items[] = { + {PFIELD_Z_BOTH, "BOTH", 0, "Both Z", ""}, + {PFIELD_Z_POS, "POSITIVE", 0, "+Z", ""}, + {PFIELD_Z_NEG, "NEGATIVE", 0, "-Z", ""}, + {0, NULL, 0, NULL, NULL}}; + srna= RNA_def_struct(brna, "FieldSettings", NULL); RNA_def_struct_sdna(srna, "PartDeflect"); RNA_def_struct_ui_text(srna, "Field Settings", "Field settings for an object in physics simulation."); @@ -668,6 +919,12 @@ static void rna_def_field(BlenderRNA *brna) RNA_def_property_enum_items(prop, field_type_items); RNA_def_property_ui_text(prop, "Type", "Type of field."); RNA_def_property_update(prop, 0, "rna_FieldSettings_dependency_update"); + + prop= RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, effector_shape_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Effector_shape_itemf"); + RNA_def_property_ui_text(prop, "Shape", "Which direction is used to calculate the effector force."); + RNA_def_property_update(prop, 0, "rna_FieldSettings_shape_update"); prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "falloff"); @@ -680,6 +937,12 @@ static void rna_def_field(BlenderRNA *brna) RNA_def_property_enum_items(prop, texture_items); RNA_def_property_ui_text(prop, "Texture Mode", "How the texture effect is calculated (RGB & Curl need a RGB texture else Gradient will be used instead)"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); + + prop= RNA_def_property(srna, "z_direction", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "zdir"); + RNA_def_property_enum_items(prop, zdirection_items); + RNA_def_property_ui_text(prop, "Z Direction", "Effect in full or only positive/negative Z direction."); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); /* Float */ @@ -688,18 +951,51 @@ static void rna_def_field(BlenderRNA *brna) RNA_def_property_range(prop, -1000.0f, 1000.0f); RNA_def_property_ui_text(prop, "Strength", "Strength of force field"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); - - prop= RNA_def_property(srna, "falloff_power", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "f_power"); - RNA_def_property_range(prop, 0.0f, 10.0f); - RNA_def_property_ui_text(prop, "Falloff Power", "Falloff power (real gravitational falloff = 2)"); + + /* different ui range to above */ + prop= RNA_def_property(srna, "linear_drag", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "f_strength"); + RNA_def_property_range(prop, -2.0f, 2.0f); + RNA_def_property_ui_text(prop, "Linear Drag", "Drag component proportional to velocity."); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); - + prop= RNA_def_property(srna, "harmonic_damping", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "f_damp"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Harmonic Damping", "Damping of the harmonic force"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); + + /* different ui range to above */ + prop= RNA_def_property(srna, "quadratic_drag", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "f_damp"); + RNA_def_property_range(prop, -2.0f, 2.0f); + RNA_def_property_ui_text(prop, "Quadratic Drag", "Drag component proportional to the square of velocity."); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); + + prop= RNA_def_property(srna, "flow", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "f_flow"); + RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_ui_text(prop, "Flow", "Convert effector force into air flow velocity"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); + + /* different ui range to above */ + prop= RNA_def_property(srna, "inflow", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "f_flow"); + RNA_def_property_range(prop, -10.0f, 10.0f); + RNA_def_property_ui_text(prop, "Inflow", "Inwards component of the vortex force"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); + + prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "f_size"); + RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_ui_text(prop, "Size", "Size of the noise"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); + + prop= RNA_def_property(srna, "falloff_power", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "f_power"); + RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_ui_text(prop, "Falloff Power", "Falloff power (real gravitational falloff = 2)"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "minimum_distance", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "mindist"); @@ -776,26 +1072,16 @@ static void rna_def_field(BlenderRNA *brna) 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, "planar", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_PLANAR); - RNA_def_property_ui_text(prop, "Planar", "Create planar field"); - RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); - - prop= RNA_def_property(srna, "surface", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_SURFACE); - RNA_def_property_ui_text(prop, "Surface", "Use closest point on surface"); - RNA_def_property_update(prop, 0, "rna_FieldSettings_surface_update"); - - prop= RNA_def_property(srna, "positive_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_POSZ); - RNA_def_property_ui_text(prop, "Positive", "Effect only in direction of positive Z axis"); - 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); RNA_def_property_ui_text(prop, "Use Coordinates", "Use object/global coordinates for texture"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); + + prop= RNA_def_property(srna, "global_coordinates", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GLOBAL_CO); + RNA_def_property_ui_text(prop, "Use Global Coordinates", "Use effector/global coordinates for turbulence"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "force_2d", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_2D); @@ -806,6 +1092,16 @@ static void rna_def_field(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_ROOTCO); RNA_def_property_ui_text(prop, "Root Texture Coordinates", "Texture coordinates from root particle locations"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); + + prop= RNA_def_property(srna, "do_location", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_DO_LOCATION); + RNA_def_property_ui_text(prop, "Location", "Effect particles' location"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); + + prop= RNA_def_property(srna, "do_rotation", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_DO_ROTATION); + RNA_def_property_ui_text(prop, "Rotation", "Effect particles' dynamic rotation"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); /* Pointer */ @@ -1115,12 +1411,18 @@ static void rna_def_softbody(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_self_collision_get", "rna_SoftBodySettings_self_collision_set"); RNA_def_property_ui_text(prop, "Self Collision", "Enable naive vertex ball self collision."); RNA_def_property_update(prop, 0, "rna_softbody_update"); + + prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "EffectorWeights"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Effector Weights", ""); } void RNA_def_object_force(BlenderRNA *brna) { rna_def_pointcache(brna); rna_def_collision(brna); + rna_def_effector_weight(brna); rna_def_field(brna); rna_def_game_softbody(brna); rna_def_softbody(brna); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 04b4b1142be..453b5f9f91a 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -99,6 +99,7 @@ EnumPropertyItem part_hair_ren_as_items[] = { #include "BKE_context.h" #include "BKE_cloth.h" #include "BKE_depsgraph.h" +#include "BKE_effect.h" #include "BKE_modifier.h" #include "BKE_particle.h" #include "BKE_pointcache.h" @@ -106,48 +107,43 @@ EnumPropertyItem part_hair_ren_as_items[] = { #include "BLI_arithb.h" /* property update functions */ -static void rna_Particle_redo(bContext *C, PointerRNA *ptr) +static void particle_recalc(bContext *C, PointerRNA *ptr, short flag) { - Scene *scene = CTX_data_scene(C); - ParticleSettings *part; if(ptr->type==&RNA_ParticleSystem) { ParticleSystem *psys = (ParticleSystem*)ptr->data; - Object *ob = psys_find_object(scene, psys); - psys->recalc = PSYS_RECALC_REDO; + psys->recalc = flag; - if(ob) - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); - } - else { - part = ptr->id.data; - psys_flush_particle_settings(scene, part, PSYS_RECALC_REDO); + DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA); } + else + DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA|flag); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL); } +static void rna_Particle_redo(bContext *C, PointerRNA *ptr) +{ + particle_recalc(C, ptr, PSYS_RECALC_REDO); +} static void rna_Particle_reset(bContext *C, PointerRNA *ptr) { - Scene *scene = CTX_data_scene(C); - ParticleSettings *part; + particle_recalc(C, ptr, PSYS_RECALC_RESET); +} - if(ptr->type==&RNA_ParticleSystem) { - ParticleSystem *psys = (ParticleSystem*)ptr->data; - Object *ob = psys_find_object(scene, psys); - - psys->recalc = PSYS_RECALC_RESET; +static void rna_Particle_change_type(bContext *C, PointerRNA *ptr) +{ + particle_recalc(C, ptr, PSYS_RECALC_RESET|PSYS_RECALC_TYPE); +} - if(ob) { - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); - } - } - else { - part = ptr->id.data; - psys_flush_particle_settings(scene, part, PSYS_RECALC_RESET); - } +static void rna_Particle_change_physics(bContext *C, PointerRNA *ptr) +{ + particle_recalc(C, ptr, PSYS_RECALC_RESET|PSYS_RECALC_PHYS); +} - WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL); +static void rna_Particle_redo_child(bContext *C, PointerRNA *ptr) +{ + particle_recalc(C, ptr, PSYS_RECALC_CHILD); } static void rna_Particle_target_reset(bContext *C, PointerRNA *ptr) @@ -199,59 +195,6 @@ static void rna_Particle_target_redo(bContext *C, PointerRNA *ptr) } } -static void rna_Particle_change_type(bContext *C, PointerRNA *ptr) -{ - Scene *scene = CTX_data_scene(C); - ParticleSettings *part; - - if(ptr->type==&RNA_ParticleSystem) { - ParticleSystem *psys = (ParticleSystem*)ptr->data; - Object *ob = psys_find_object(scene, psys); - - psys->recalc = PSYS_RECALC_RESET|PSYS_RECALC_TYPE; - - if(ob) { - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); - } - } - else { - part = ptr->id.data; - psys_flush_particle_settings(scene, part, PSYS_RECALC_RESET|PSYS_RECALC_TYPE); - } - - WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL); -} - -static void rna_Particle_change_physics(bContext *C, PointerRNA *ptr) -{ - Scene *scene = CTX_data_scene(C); - ParticleSettings *part = ptr->id.data; - psys_flush_particle_settings(scene, part, PSYS_RECALC_RESET|PSYS_RECALC_PHYS); - WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL); -} - -static void rna_Particle_redo_child(bContext *C, PointerRNA *ptr) -{ - Scene *scene = CTX_data_scene(C); - ParticleSettings *part; - - if(ptr->type==&RNA_ParticleSystem) { - ParticleSystem *psys = (ParticleSystem*)ptr->data; - Object *ob = psys_find_object(scene, psys); - - psys->recalc = PSYS_RECALC_CHILD; - - if(ob) - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); - } - else { - part = ptr->id.data; - - psys_flush_particle_settings(scene, part, PSYS_RECALC_CHILD); - } - - WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL); -} static void rna_Particle_hair_dynamics(bContext *C, PointerRNA *ptr) { /* Scene *scene = CTX_data_scene(C); */ @@ -577,6 +520,28 @@ static EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *C, PointerRNA *ptr, return part_ren_as_items; } +static PointerRNA rna_Particle_field1_get(PointerRNA *ptr) +{ + ParticleSettings *part= (ParticleSettings*)ptr->id.data; + + /* weak */ + if(!part->pd) + part->pd= object_add_collision_fields(0); + + return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd); +} + +static PointerRNA rna_Particle_field2_get(PointerRNA *ptr) +{ + ParticleSettings *part= (ParticleSettings*)ptr->id.data; + + /* weak */ + if(!part->pd2) + part->pd2= object_add_collision_fields(0); + + return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd2); +} + #else @@ -650,7 +615,7 @@ static void rna_def_particle(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem alive_items[] = { - {PARS_KILLED, "KILLED", 0, "Killed", ""}, + //{PARS_KILLED, "KILLED", 0, "Killed", ""}, {PARS_DEAD, "DEAD", 0, "Dead", ""}, {PARS_UNBORN, "UNBORN", 0, "Unborn", ""}, {PARS_ALIVE, "ALIVE", 0, "Alive", ""}, @@ -1714,89 +1679,25 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Billboard Object", "Billboards face this object (default is active camera)"); RNA_def_property_update(prop, 0, "rna_Particle_redo"); - /* effectors */ - prop= RNA_def_property(srna, "effector_group", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "eff_group"); - RNA_def_property_struct_type(prop, "Group"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Effector Group", "Limit effectors to this Group."); - RNA_def_property_update(prop, 0, "rna_Particle_reset"); - - prop= RNA_def_property(srna, "eweight_all", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "effector_weight[0]"); - RNA_def_property_range(prop, -200.0f, 200.0f); - RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); - RNA_def_property_ui_text(prop, "All", "All effector's weight."); - RNA_def_property_update(prop, 0, "rna_Particle_reset"); - - prop= RNA_def_property(srna, "eweight_spherical", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "effector_weight[1]"); - RNA_def_property_range(prop, -200.0f, 200.0f); - RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); - RNA_def_property_ui_text(prop, "Spherical", "Spherical effector weight."); - RNA_def_property_update(prop, 0, "rna_Particle_reset"); - - prop= RNA_def_property(srna, "eweight_vortex", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "effector_weight[2]"); - RNA_def_property_range(prop, -200.0f, 200.0f); - RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); - RNA_def_property_ui_text(prop, "Vortex", "Vortex effector weight."); - RNA_def_property_update(prop, 0, "rna_Particle_reset"); - - prop= RNA_def_property(srna, "eweight_magnetic", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "effector_weight[3]"); - RNA_def_property_range(prop, -200.0f, 200.0f); - RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); - RNA_def_property_ui_text(prop, "Magnetic", "Magnetic effector weight."); - RNA_def_property_update(prop, 0, "rna_Particle_reset"); - - prop= RNA_def_property(srna, "eweight_wind", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "effector_weight[4]"); - RNA_def_property_range(prop, -200.0f, 200.0f); - RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); - RNA_def_property_ui_text(prop, "Wind", "Wind effector weight."); - RNA_def_property_update(prop, 0, "rna_Particle_reset"); - - prop= RNA_def_property(srna, "eweight_curveguide", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "effector_weight[5]"); - RNA_def_property_range(prop, -200.0f, 200.0f); - RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); - RNA_def_property_ui_text(prop, "Curve Guide", "Curve guide effector weight."); - RNA_def_property_update(prop, 0, "rna_Particle_reset"); - - prop= RNA_def_property(srna, "eweight_texture", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "effector_weight[6]"); - RNA_def_property_range(prop, -200.0f, 200.0f); - RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); - RNA_def_property_ui_text(prop, "Texture", "Texture effector weight."); - RNA_def_property_update(prop, 0, "rna_Particle_reset"); - - prop= RNA_def_property(srna, "eweight_harmonic", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "effector_weight[7]"); - RNA_def_property_range(prop, -200.0f, 200.0f); - RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); - RNA_def_property_ui_text(prop, "Harmonic", "Harmonic effector weight."); - RNA_def_property_update(prop, 0, "rna_Particle_reset"); - - prop= RNA_def_property(srna, "eweight_charge", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "effector_weight[8]"); - RNA_def_property_range(prop, -200.0f, 200.0f); - RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); - RNA_def_property_ui_text(prop, "Charge", "Charge effector weight."); - RNA_def_property_update(prop, 0, "rna_Particle_reset"); - - prop= RNA_def_property(srna, "eweight_lennardjones", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "effector_weight[9]"); - RNA_def_property_range(prop, -200.0f, 200.0f); - RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); - RNA_def_property_ui_text(prop, "Lennard-Jones", "Lennard-Jones effector weight."); - RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "EffectorWeights"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Effector Weights", ""); /* animation here? */ rna_def_animdata_common(srna); -// struct PartDeflect *pd; -// struct PartDeflect *pd2; + prop= RNA_def_property(srna, "force_field_1", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "pd"); + RNA_def_property_struct_type(prop, "FieldSettings"); + RNA_def_property_pointer_funcs(prop, "rna_Particle_field1_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Force Field 1", ""); + + prop= RNA_def_property(srna, "force_field_2", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "pd2"); + RNA_def_property_struct_type(prop, "FieldSettings"); + RNA_def_property_pointer_funcs(prop, "rna_Particle_field2_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Force Field 2", ""); } static void rna_def_particle_target(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 95678678569..d6cd81aced2 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -62,6 +62,7 @@ EnumPropertyItem prop_mode_items[] ={ #include "BKE_context.h" #include "BKE_global.h" #include "BKE_node.h" +#include "BKE_pointcache.h" #include "BLI_threads.h" @@ -415,6 +416,14 @@ static void rna_Scene_use_nodes_set(PointerRNA *ptr, int value) ED_node_composit_default(scene); } +static void rna_Physics_update(bContext *C, PointerRNA *ptr) +{ + Scene *scene= (Scene*)ptr->id.data; + Base *base; + + for(base = scene->base.first; base; base=base->next) + BKE_ptcache_object_reset(scene, base->object, PTCACHE_RESET_DEPSGRAPH); +} #else static void rna_def_tool_settings(BlenderRNA *brna) @@ -596,7 +605,6 @@ static void rna_def_unit_settings(BlenderRNA *brna) RNA_def_property_update(prop, NC_WINDOW, NULL); } - void rna_def_render_layer_common(StructRNA *srna, int scene) { PropertyRNA *prop; @@ -2131,6 +2139,19 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "unit"); RNA_def_property_struct_type(prop, "UnitSettings"); RNA_def_property_ui_text(prop, "Unit Settings", "Unit editing settings"); + + /* Physics Settings */ + prop= RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION); + RNA_def_property_float_sdna(prop, NULL, "physics_settings.gravity"); + RNA_def_property_array(prop, 3); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_text(prop, "Gravity", "Constant acceleration in a given direction"); + RNA_def_property_update(prop, 0, "rna_Physics_update"); + + prop= RNA_def_property(srna, "use_gravity", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "physics_settings.flag", PHYS_GLOBAL_GRAVITY); + RNA_def_property_ui_text(prop, "Global Gravity", "Use global gravity for all dynamics."); + RNA_def_property_update(prop, 0, "rna_Physics_update"); /* Render Data */ prop= RNA_def_property(srna, "render_data", PROP_POINTER, PROP_NONE); |