From 093ff8202ced6391a2ef657abe42615672146954 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 2 Jul 2009 19:41:31 +0000 Subject: 2.5: Physics Buttons All kinds of changes to get it ready for UI layouts. This means RNA and operators should be working correct, but most buttons are still not actually there yet. * Added near empty soft body, fluid, field and collision panels, tweaks to cloth panels. * Fluid bake works, but without escape or showing any progress. * Fluid/Softbody/Cloth/Collision can now be both added as modifiers or in the physics panels. * Missing: fields & soft body for particles. * Missing: proper updating softbodies, guess this code still needs updates after pointcache refactor? --- source/blender/makesrna/intern/rna_object.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'source/blender/makesrna/intern/rna_object.c') diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 947846f8d8d..bf2a2c0ba40 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -48,17 +48,18 @@ #include "BKE_context.h" #include "BKE_curve.h" #include "BKE_depsgraph.h" +#include "BKE_effect.h" #include "BKE_key.h" #include "BKE_material.h" #include "BKE_mesh.h" #include "BKE_particle.h" -static void rna_Object_update(bContext *C, PointerRNA *ptr) +void rna_Object_update(bContext *C, PointerRNA *ptr) { DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB); } -static void rna_Object_update_data(bContext *C, PointerRNA *ptr) +void rna_Object_update_data(bContext *C, PointerRNA *ptr) { DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_DATA); } @@ -456,6 +457,28 @@ static void rna_Object_shape_key_lock_set(PointerRNA *ptr, int value) ob->shapeflag &= ~OB_SHAPE_TEMPLOCK; } +static PointerRNA rna_Object_field_get(PointerRNA *ptr) +{ + Object *ob= (Object*)ptr->id.data; + + /* weak */ + if(!ob->pd) + ob->pd= object_add_collision_fields(); + + return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, ob->pd); +} + +static PointerRNA rna_Object_collision_get(PointerRNA *ptr) +{ + Object *ob= (Object*)ptr->id.data; + + /* weak */ + if(!ob->pd) + ob->pd= object_add_collision_fields(); + + return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd); +} + #else static void rna_def_vertex_group(BlenderRNA *brna) @@ -1006,11 +1029,13 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "field", 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_Object_field_get", NULL, NULL); RNA_def_property_ui_text(prop, "Field Settings", "Settings for using the objects as a field in physics simulation."); prop= RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "pd"); RNA_def_property_struct_type(prop, "CollisionSettings"); + RNA_def_property_pointer_funcs(prop, "rna_Object_collision_get", NULL, NULL); RNA_def_property_ui_text(prop, "Collision Settings", "Settings for using the objects as a collider in physics simulation."); prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE); -- cgit v1.2.3