2.5: Physics Buttons
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 2 Jul 2009 19:41:31 +0000 (19:41 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 2 Jul 2009 19:41:31 +0000 (19:41 +0000)
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?

37 files changed:
release/ui/buttons_data_modifier.py
release/ui/buttons_physic_cloth.py
release/ui/buttons_physics_field.py [new file with mode: 0644]
release/ui/buttons_physics_fluid.py [new file with mode: 0644]
release/ui/buttons_physics_softbody.py [new file with mode: 0644]
source/blender/blenkernel/BKE_effect.h
source/blender/blenkernel/BKE_fluidsim.h
source/blender/blenkernel/BKE_modifier.h
source/blender/blenkernel/intern/context.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/fluidsim.c
source/blender/blenkernel/intern/modifier.c
source/blender/editors/animation/anim_markers.c
source/blender/editors/include/ED_fluidsim.h
source/blender/editors/include/ED_markers.h
source/blender/editors/include/ED_object.h
source/blender/editors/include/ED_physics.h [moved from source/blender/editors/include/ED_pointcache.h with 97% similarity]
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/object/object_intern.h
source/blender/editors/object/object_modifier.c
source/blender/editors/object/object_ops.c
source/blender/editors/physics/ed_fluidsim.c
source/blender/editors/physics/ed_pointcache.c
source/blender/editors/space_api/spacetypes.c
source/blender/editors/space_buttons/buttons_context.c
source/blender/editors/space_buttons/buttons_ops.c
source/blender/makesdna/DNA_object_fluidsim.h
source/blender/makesdna/DNA_object_force.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_fluidsim.c
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_object_force.c
source/blender/makesrna/intern/rna_ui_api.c

index 953fc1f09742c704d401320d9c6e6bff4b003252..2400461b6233d054af2b0d0b6c3aa49498870851 100644 (file)
@@ -24,61 +24,63 @@ class DATA_PT_modifiers(DataButtonsPanel):
                        if box:
                                if md.type == 'ARMATURE':
                                        self.armature(box, ob, md)
-                               if md.type == 'ARRAY':
+                               elif md.type == 'ARRAY':
                                        self.array(box, ob, md)
-                               if md.type == 'BEVEL':
+                               elif md.type == 'BEVEL':
                                        self.bevel(box, ob, md)
-                               if md.type == 'BOOLEAN':
+                               elif md.type == 'BOOLEAN':
                                        self.boolean(box, ob, md)
-                               if md.type == 'BUILD':
+                               elif md.type == 'BUILD':
                                        self.build(box, ob, md)
-                               if md.type == 'CAST':
+                               elif md.type == 'CAST':
                                        self.cast(box, ob, md)
-                               if md.type == 'CLOTH':
+                               elif md.type == 'CLOTH':
                                        self.cloth(box, ob, md)
-                               if md.type == 'COLLISION':
+                               elif md.type == 'COLLISION':
                                        self.collision(box, ob, md)
-                               if md.type == 'CURVE':
+                               elif md.type == 'CURVE':
                                        self.curve(box, ob, md)
-                               if md.type == 'DECIMATE':
+                               elif md.type == 'DECIMATE':
                                        self.decimate(box, ob, md)
-                               if md.type == 'DISPLACE':
+                               elif md.type == 'DISPLACE':
                                        self.displace(box, ob, md)
-                               if md.type == 'EDGE_SPLIT':
+                               elif md.type == 'EDGE_SPLIT':
                                        self.edgesplit(box, ob, md)
-                               if md.type == 'EXPLODE':
+                               elif md.type == 'EXPLODE':
                                        self.explode(box, ob, md)
-                               if md.type == 'FLUID_SIMULATION':
+                               elif md.type == 'FLUID_SIMULATION':
                                        self.fluid(box, ob, md)
-                               if md.type == 'HOOK':
+                               elif md.type == 'HOOK':
                                        self.hook(box, ob, md)
-                               if md.type == 'LATTICE':
+                               elif md.type == 'LATTICE':
                                        self.lattice(box, ob, md)
-                               if md.type == 'MASK':
+                               elif md.type == 'MASK':
                                        self.mask(box, ob, md)
-                               if md.type == 'MESH_DEFORM':
+                               elif md.type == 'MESH_DEFORM':
                                        self.mesh_deform(box, ob, md)
-                               if md.type == 'MIRROR':
+                               elif md.type == 'MIRROR':
                                        self.mirror(box, ob, md)
-                               if md.type == 'MULTIRES':
+                               elif md.type == 'MULTIRES':
                                        self.multires(box, ob, md)
-                               if md.type == 'PARTICLE_INSTANCE':
+                               elif md.type == 'PARTICLE_INSTANCE':
                                        self.particleinstance(box, ob, md)
-                               if md.type == 'PARTICLE_SYSTEM':
+                               elif md.type == 'PARTICLE_SYSTEM':
                                        self.particlesystem(box, ob, md)
-                               if md.type == 'SHRINKWRAP':
+                               elif md.type == 'SHRINKWRAP':
                                        self.shrinkwrap(box, ob, md)
-                               if md.type == 'SIMPLE_DEFORM':
+                               elif md.type == 'SIMPLE_DEFORM':
                                        self.simpledeform(box, ob, md)
-                               if md.type == 'SMOOTH':
+                               elif md.type == 'SMOOTH':
                                        self.smooth(box, ob, md)
-                               if md.type == 'SOFTBODY':
+                               elif md.type == 'SOFTBODY':
                                        self.softbody(box, ob, md)
-                               if md.type == 'SUBSURF':
+                               elif md.type == 'SUBSURF':
                                        self.subsurf(box, ob, md)
-                               if md.type == 'UV_PROJECT':
+                               elif md.type == 'SURFACE':
+                                       self.surface(box, ob, md)
+                               elif md.type == 'UV_PROJECT':
                                        self.uvproject(box, ob, md)
-                               if md.type == 'WAVE':
+                               elif md.type == 'WAVE':
                                        self.wave(box, ob, md)
                                                        
        def armature(self, layout, ob, md):
@@ -96,9 +98,9 @@ class DATA_PT_modifiers(DataButtonsPanel):
                layout.itemR(md, "fit_type")
                if md.fit_type == 'FIXED_COUNT':
                        layout.itemR(md, "count")
-               if md.fit_type == 'FIT_LENGTH':
+               elif md.fit_type == 'FIT_LENGTH':
                        layout.itemR(md, "length")
-               if md.fit_type == 'FIT_CURVE':
+               elif md.fit_type == 'FIT_CURVE':
                        layout.itemR(md, "curve")
 
                layout.itemS()
@@ -152,7 +154,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
                if md.limit_method == 'ANGLE':
                        row = layout.row()
                        row.itemR(md, "angle")
-               if md.limit_method == 'WEIGHT':
+               elif md.limit_method == 'WEIGHT':
                        row = layout.row()
                        row.itemR(md, "edge_weight_method", expand=True)
                        
@@ -211,7 +213,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
                layout.itemR(md, "texture_coordinates")
                if md.texture_coordinates == 'OBJECT':
                        layout.itemR(md, "texture_coordinate_object", text="Object")
-               if md.texture_coordinates == 'UV' and ob.type == 'MESH':
+               elif md.texture_coordinates == 'UV' and ob.type == 'MESH':
                        layout.item_pointerR(md, "uv_layer", ob.data, "uv_layers")
        
        def edgesplit(self, layout, ob, md):
@@ -235,7 +237,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
                # Missing: "Refresh" and "Clear Vertex Group" ?
                
        def fluid(self, layout, ob, md):
-               layout.itemL(text="See Fluidsim panel.")
+               layout.itemL(text="See Fluid panel.")
                
        def hook(self, layout, ob, md):
                layout.itemR(md, "falloff")
@@ -252,7 +254,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
                layout.itemR(md, "mode")
                if md.mode == 'ARMATURE':
                        layout.itemR(md, "armature")
-               if md.mode == 'VERTEX_GROUP':
+               elif md.mode == 'VERTEX_GROUP':
                        layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
                layout.itemR(md, "inverse")
                
@@ -325,7 +327,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
                        col.itemR(md, "positive")
                        col.itemR(md, "cull_front_faces")
                        col.itemR(md, "cull_back_faces")
-               if md.mode == 'NEAREST_SURFACEPOINT':
+               elif md.mode == 'NEAREST_SURFACEPOINT':
                        layout.itemR(md, "keep_above_surface")
                # To-Do: Validate if structs
                
@@ -353,7 +355,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
                layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
                
        def softbody(self, layout, ob, md):
-               layout.itemL(text="See Softbody panel.")
+               layout.itemL(text="See Soft Body panel.")
        
        def subsurf(self, layout, ob, md):
                layout.itemR(md, "subdivision_type")
@@ -362,6 +364,9 @@ class DATA_PT_modifiers(DataButtonsPanel):
                col.itemR(md, "render_levels", text="Render")
                col.itemR(md, "optimal_draw", text="Optimal Display")
                col.itemR(md, "subsurf_uv")
+
+       def surface(self, layout, ob, md):
+               layout.itemL(text="See Fields panel.")
        
        def uvproject(self, layout, ob, md):
                if ob.type == 'MESH':
@@ -404,7 +409,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
                layout.itemR(md, "texture_coordinates")
                if md.texture_coordinates == 'MAP_UV' and ob.type == 'MESH':
                        layout.item_pointerR(md, "uv_layer", ob.data, "uv_layers")
-               if md.texture_coordinates == 'OBJECT':
+               elif md.texture_coordinates == 'OBJECT':
                        layout.itemR(md, "texture_coordinates_object")
                
                col = layout.column_flow()
index a06c644322ad8f26e52072b356d29009108da80d..ecb5e48569aebdb243342f6d733809f86805c0ed 100644 (file)
@@ -7,48 +7,73 @@ class PhysicButtonsPanel(bpy.types.Panel):
        __context__ = "physics"
 
        def poll(self, context):
-               return (context.cloth != None)
+               return (context.object != None)
                
-class Physic_PT_cloth(PhysicButtonsPanel):
-       __idname__ = "Physic_PT_cloth"
+class PHYSICS_PT_cloth(PhysicButtonsPanel):
+       __idname__ = "PHYSICS_PT_cloth"
        __label__ = "Cloth"
 
        def draw(self, context):
                layout = self.layout
-               cloth = context.cloth.settings
-               
+               md = context.cloth
+               ob = context.object
+
                split = layout.split()
-               
-               col = split.column()
-               col.itemR(cloth, "quality", slider=True)
-               col.itemR(cloth, "gravity")
-               col.itemR(cloth, "mass")
-               col.itemR(cloth, "mass_vertex_group", text="Vertex Group")
-
-               col = split.column()
-               col.itemL(text="Stiffness:")
-               col.itemR(cloth, "structural_stiffness", text="Structural")
-               col.itemR(cloth, "bending_stiffness", text="Bending")
-               col.itemL(text="Damping:")
-               col.itemR(cloth, "spring_damping", text="Spring")
-               col.itemR(cloth, "air_damping", text="Air")
-               
-               # Disabled for now
-               """
-               if cloth.mass_vertex_group:
-                       layout.itemL(text="Goal:")
-               
-                       col = layout.column_flow()
-                       col.itemR(cloth, "goal_default", text="Default")
-                       col.itemR(cloth, "goal_spring", text="Stiffness")
-                       col.itemR(cloth, "goal_friction", text="Friction")
-               """
+               split.operator_context = "EXEC_DEFAULT"
+
+               if md:
+                       # remove modifier + settings
+                       split.set_context_pointer("modifier", md)
+                       split.itemO("OBJECT_OT_modifier_remove", text="Remove")
+
+                       row = split.row(align=True)
+                       row.itemR(md, "render", text="")
+                       row.itemR(md, "realtime", text="")
+               else:
+                       # add modifier
+                       split.item_enumO("OBJECT_OT_modifier_add", "type", "CLOTH", text="Add")
+                       split.itemL()
+
+               if md:
+                       cloth = md.settings
+
+                       split = layout.split()
+                       
+                       col = split.column()
+                       col.itemR(cloth, "quality", slider=True)
+                       col.itemR(cloth, "gravity")
+
+                       subcol = col.column(align=True)
+                       subcol.itemR(cloth, "mass")
+                       subcol.item_pointerR(cloth, "mass_vertex_group", ob, "vertex_groups", text="")
+
+                       col = split.column()
+                       col.itemL(text="Stiffness:")
+                       col.itemR(cloth, "structural_stiffness", text="Structural")
+                       col.itemR(cloth, "bending_stiffness", text="Bending")
+                       col.itemL(text="Damping:")
+                       col.itemR(cloth, "spring_damping", text="Spring")
+                       col.itemR(cloth, "air_damping", text="Air")
+                       
+                       # Disabled for now
+                       """
+                       if cloth.mass_vertex_group:
+                               layout.itemL(text="Goal:")
+                       
+                               col = layout.column_flow()
+                               col.itemR(cloth, "goal_default", text="Default")
+                               col.itemR(cloth, "goal_spring", text="Stiffness")
+                               col.itemR(cloth, "goal_friction", text="Friction")
+                       """
 
 class PHYSICS_PT_cloth_cache(PhysicButtonsPanel):
        __idname__= "PHYSICS_PT_cloth_cache"
-       __label__ = "Cache"
+       __label__ = "Cloth Cache"
        __default_closed__ = True
 
+       def poll(self, context):
+               return (context.cloth != None)
+
        def draw(self, context):
                layout = self.layout
 
@@ -91,9 +116,12 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel):
                row.itemO("PTCACHE_OT_free_bake_all", text="Free All Bakes")
                layout.itemO("PTCACHE_OT_bake_all", text="Update All Dynamics to current frame")
                
-class Physic_PT_cloth_collision(PhysicButtonsPanel):
-       __idname__ = "Physic_PT_clothcollision"
+class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
+       __idname__ = "PHYSICS_PT_clothcollision"
        __label__ = "Cloth Collision"
+
+       def poll(self, context):
+               return (context.cloth != None)
        
        def draw_header(self, context):
                layout = self.layout
@@ -120,9 +148,12 @@ class Physic_PT_cloth_collision(PhysicButtonsPanel):
                col.itemR(cloth, "self_collision_quality", slider=True)
                col.itemR(cloth, "self_min_distance", text="MinDistance")
 
-class Physic_PT_cloth_stiffness(PhysicButtonsPanel):
-       __idname__ = "Physic_PT_stiffness"
+class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel):
+       __idname__ = "PHYSICS_PT_stiffness"
        __label__ = "Cloth Stiffness Scaling"
+
+       def poll(self, context):
+               return (context.cloth != None)
        
        def draw_header(self, context):
                layout = self.layout
@@ -132,23 +163,25 @@ class Physic_PT_cloth_stiffness(PhysicButtonsPanel):
 
        def draw(self, context):
                layout = self.layout
+               ob = context.object
                cloth = context.cloth.settings
                
                layout.active = cloth.stiffness_scaling 
                
                split = layout.split()
                
-               sub = split.column()
+               sub = split.column(align=True)
                sub.itemL(text="Structural Stiffness:")
-               sub.column().itemR(cloth, "structural_stiffness_vertex_group", text="VGroup")
+               sub.item_pointerR(cloth, "structural_stiffness_vertex_group", ob, "vertex_groups", text="")
                sub.itemR(cloth, "structural_stiffness_max", text="Max")
                
-               sub = split.column()
+               sub = split.column(align=True)
                sub.itemL(text="Bending Stiffness:")
-               sub.column().itemR(cloth, "bending_vertex_group", text="VGroup")
+               sub.item_pointerR(cloth, "bending_vertex_group", ob, "vertex_groups", text="")
                sub.itemR(cloth, "bending_stiffness_max", text="Max")
                
-bpy.types.register(Physic_PT_cloth)
+bpy.types.register(PHYSICS_PT_cloth)
 bpy.types.register(PHYSICS_PT_cloth_cache)
-bpy.types.register(Physic_PT_cloth_collision)
-bpy.types.register(Physic_PT_cloth_stiffness)
+bpy.types.register(PHYSICS_PT_cloth_collision)
+bpy.types.register(PHYSICS_PT_cloth_stiffness)
+
diff --git a/release/ui/buttons_physics_field.py b/release/ui/buttons_physics_field.py
new file mode 100644 (file)
index 0000000..3204ab4
--- /dev/null
@@ -0,0 +1,48 @@
+
+import bpy
+
+class PhysicButtonsPanel(bpy.types.Panel):
+       __space_type__ = "BUTTONS_WINDOW"
+       __region_type__ = "WINDOW"
+       __context__ = "physics"
+
+       def poll(self, context):
+               return (context.object != None)
+               
+class PHYSICS_PT_field(PhysicButtonsPanel):
+       __idname__ = "PHYSICS_PT_field"
+       __label__ = "Field"
+
+       def draw(self, context):
+               layout = self.layout
+               ob = context.object
+               field = ob.field
+
+               layout.itemR(field, "type")
+
+               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):
+       __idname__ = "PHYSICS_PT_collision"
+       __label__ = "Collision"
+
+       def draw_header(self, context):
+               settings = context.object.collision
+               self.layout.itemR(settings, "enabled", text="")
+
+       def draw(self, context):
+               layout = self.layout
+               md = context.collision
+               settings = context.object.collision
+
+               if settings.enabled:
+                       pass
+
+bpy.types.register(PHYSICS_PT_field)
+bpy.types.register(PHYSICS_PT_collision)
+
diff --git a/release/ui/buttons_physics_fluid.py b/release/ui/buttons_physics_fluid.py
new file mode 100644 (file)
index 0000000..57e3d91
--- /dev/null
@@ -0,0 +1,62 @@
+
+import bpy
+
+class PhysicButtonsPanel(bpy.types.Panel):
+       __space_type__ = "BUTTONS_WINDOW"
+       __region_type__ = "WINDOW"
+       __context__ = "physics"
+
+       def poll(self, context):
+               ob = context.object
+               return (ob and ob.type == 'MESH')
+               
+class PHYSICS_PT_fluid(PhysicButtonsPanel):
+       __idname__ = "PHYSICS_PT_fluid"
+       __label__ = "Fluid"
+
+       def draw(self, context):
+               layout = self.layout
+               md = context.fluid
+               ob = context.object
+
+               split = layout.split()
+               split.operator_context = "EXEC_DEFAULT"
+
+               if md:
+                       # remove modifier + settings
+                       split.set_context_pointer("modifier", md)
+                       split.itemO("OBJECT_OT_modifier_remove", text="Remove")
+
+                       row = split.row(align=True)
+                       row.itemR(md, "render", text="")
+                       row.itemR(md, "realtime", text="")
+               else:
+                       # add modifier
+                       split.item_enumO("OBJECT_OT_modifier_add", "type", "FLUID_SIMULATION", text="Add")
+                       split.itemL()
+
+               if md:
+                       fluid = md.settings
+
+                       col = layout.column(align=True)
+                       row = col.row()
+                       row.item_enumR(fluid, "type", "DOMAIN")
+                       row.item_enumR(fluid, "type", "FLUID")
+                       row.item_enumR(fluid, "type", "OBSTACLE")
+                       row = col.row()
+                       row.item_enumR(fluid, "type", "INFLOW")
+                       row.item_enumR(fluid, "type", "OUTFLOW")
+                       row.item_enumR(fluid, "type", "PARTICLE")
+                       row.item_enumR(fluid, "type", "CONTROL")
+
+                       if fluid.type == "DOMAIN":
+                               layout.itemO("FLUID_OT_bake", text="BAKE")
+
+                               col = layout.column(align=True)
+
+                               col.itemL(text="Req. Mem.: " + fluid.memory_estimate)
+                               col.itemR(fluid, "resolution")
+                               col.itemR(fluid, "preview_resolution")
+                       
+bpy.types.register(PHYSICS_PT_fluid)
+
diff --git a/release/ui/buttons_physics_softbody.py b/release/ui/buttons_physics_softbody.py
new file mode 100644 (file)
index 0000000..389d91b
--- /dev/null
@@ -0,0 +1,43 @@
+
+import bpy
+
+class PhysicButtonsPanel(bpy.types.Panel):
+       __space_type__ = "BUTTONS_WINDOW"
+       __region_type__ = "WINDOW"
+       __context__ = "physics"
+
+       def poll(self, context):
+               return (context.object != None)
+               
+class PHYSICS_PT_softbody(PhysicButtonsPanel):
+       __idname__ = "PHYSICS_PT_softbody"
+       __label__ = "Soft Body"
+
+       def draw(self, context):
+               layout = self.layout
+               md = context.soft_body
+               ob = context.object
+
+               split = layout.split()
+               split.operator_context = "EXEC_DEFAULT"
+
+               if md:
+                       # remove modifier + settings
+                       split.set_context_pointer("modifier", md)
+                       split.itemO("OBJECT_OT_modifier_remove", text="Remove")
+
+                       row = split.row(align=True)
+                       row.itemR(md, "render", text="")
+                       row.itemR(md, "realtime", text="")
+               else:
+                       # add modifier
+                       split.item_enumO("OBJECT_OT_modifier_add", "type", "SOFTBODY", text="Add")
+                       split.itemL()
+
+               if md:
+                       softbody = md.settings
+
+                       split = layout.split()
+                       
+bpy.types.register(PHYSICS_PT_softbody)
+
index fd065978800fe03ed404f28d3b1637b9978a0694..e21e83bf5cf3aa63311d0b9964019a48f479b954 100644 (file)
@@ -41,6 +41,8 @@ struct Particle;
 struct Group;
 struct RNG;
 
+struct PartDeflect *object_add_collision_fields(void);
+
 typedef struct pEffectorCache {
        struct pEffectorCache *next, *prev;
        Object *ob;
index 93358fcf7e89f189530acaf880a3cbdd8ec410ec..145ae48e7324697c4b11a8c4331ed8391d1fa988 100644 (file)
@@ -1,6 +1,5 @@
 /**
- * BKE_fluidsim.h
- * 
+ * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#include "DNA_modifier_types.h"
-#include "DNA_object_fluidsim.h" // N_T
-#include "DNA_object_types.h"
+#ifndef BKE_FLUIDSIM_H
+#define BKE_FLUIDSIM_H
 
-#include "BKE_DerivedMesh.h"
+struct Object;
+struct Scene;
+struct FluidsimModifierData;
+struct DerivedMesh;
+struct MVert;
 
 /* old interface */
-FluidsimSettings *fluidsimSettingsNew(Object *srcob);
-
-void initElbeemMesh(Scene *scene, Object *ob, int *numVertices, float **vertices, int *numTriangles, int **triangles, int useGlobalCoords, int modifierIndex);
+struct FluidsimSettings *fluidsimSettingsNew(struct Object *srcob);
 
+void initElbeemMesh(struct Scene *scene, struct Object *ob,
+       int *numVertices, float **vertices,
+       int *numTriangles, int **triangles,
+       int useGlobalCoords, int modifierIndex);
 
 /* new fluid-modifier interface */
-void fluidsim_init(FluidsimModifierData *fluidmd);
-void fluidsim_free(FluidsimModifierData *fluidmd);
+void fluidsim_init(struct FluidsimModifierData *fluidmd);
+void fluidsim_free(struct FluidsimModifierData *fluidmd);
 
-DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams);
-void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *dm, char *filename);
-DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Object *ob, DerivedMesh *dm, int useRenderParams, int isFinalCalc);
+struct DerivedMesh *fluidsim_read_cache(struct Object *ob, struct DerivedMesh *orgdm,
+       struct FluidsimModifierData *fluidmd, int framenr, int useRenderParams);
+void fluidsim_read_vel_cache(struct FluidsimModifierData *fluidmd, struct DerivedMesh *dm,
+       char *filename);
+struct DerivedMesh *fluidsimModifier_do(struct FluidsimModifierData *fluidmd,
+       struct Scene *scene, struct Object *ob, struct DerivedMesh *dm,
+       int useRenderParams, int isFinalCalc);
 
-// get bounding box of mesh
-void fluid_get_bb(MVert *mvert, int totvert, float obmat[][4],
-                /*RET*/ float start[3], /*RET*/ float size[3] );
+/* bounding box & memory estimate */
+void fluid_get_bb(struct MVert *mvert, int totvert, float obmat[][4],
+                float start[3], float size[3]);
 
+void fluid_estimate_memory(struct Object *ob, struct FluidsimSettings *fss, char *value);
 
+#endif
 
index 4065cbb70075f18b45d3f6eedd12c52772053bc5..144ed3bc624ecaf67ccc90656aae0aee3da15736 100644 (file)
@@ -62,7 +62,7 @@ typedef enum {
         * used for particles modifier that doesn't actually modify the object
         * unless it's a mesh and can be exploded -> curve can also emit particles
         */
-       eModifierTypeType_DeformOrConstruct
+       eModifierTypeType_DeformOrConstruct,
 } ModifierTypeType;
 
 typedef enum {
@@ -87,6 +87,9 @@ typedef enum {
        /* For modifiers that support pointcache, so we can check to see if it has files we need to deal with
        */
        eModifierTypeFlag_UsesPointCache = (1<<6),
+
+       /* For physics modifiers, max one per type */
+       eModifierTypeFlag_Single = (1<<7)
 } ModifierTypeFlag;
 
 typedef void (*ObjectWalkFunc)(void *userData, struct Object *ob, struct Object **obpoin);
index fbad585d9b7409171d0ff1971f2d7da4939db64c..4a68d90a4ed8e093f9248ecacb4280ad73ba95db 100644 (file)
@@ -378,7 +378,7 @@ PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, Stru
 {
        PointerRNA ptr = CTX_data_pointer_get(C, member);
 
-       if(ptr.data && ptr.type == type)
+       if(ptr.data && RNA_struct_is_a(ptr.type, type))
                return ptr;
        
        return PointerRNA_NULL;
index eaa2d541638a87d4ee9c2b9e4b18444f0e5897b4..553fdfe530e3375afe0e8e964c5d1c7f16097c4e 100644 (file)
@@ -56,6 +56,8 @@
 #include "BLI_jitter.h"
 #include "BLI_rand.h"
 
+#include "PIL_time.h"
+
 #include "BKE_action.h"
 #include "BKE_anim.h"          /* needed for where_on_path */
 #include "BKE_armature.h"
 
 //XXX #include "BIF_screen.h"
 
+PartDeflect *object_add_collision_fields(void)
+{
+       PartDeflect *pd;
+
+       pd= MEM_callocN(sizeof(PartDeflect), "PartDeflect");
+
+       pd->pdef_sbdamp = 0.1f;
+       pd->pdef_sbift  = 0.2f;
+       pd->pdef_sboft  = 0.02f;
+       pd->seed = ((unsigned int)(ceil(PIL_check_seconds_timer()))+1) % 128;
+
+       return pd;
+}
+
 /* temporal struct, used for reading return of mesh_get_mapped_verts_nors() */
 
 typedef struct VeNoCo {
index 54008185f724046050901e57330c97e3b92185e0..6eba64cf33d09219e322e1244e94ede8e563cc0e 100644 (file)
@@ -34,7 +34,9 @@
 
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
+#include "DNA_object_fluidsim.h"
 #include "DNA_object_force.h" // for pointcache 
+#include "DNA_object_types.h"
 #include "DNA_particle_types.h"
 #include "DNA_scene_types.h" // N_T
 
@@ -78,7 +80,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
                if(!fss)
                        return;
                
-               fss->type = OB_FSBND_NOSLIP;
+               fss->type = OB_FLUIDSIM_ENABLE;
                fss->show_advancedoptions = 0;
 
                fss->resolutionxyz = 50;
@@ -657,5 +659,20 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob,
        dm->release(dm);
 }
 
+void fluid_estimate_memory(Object *ob, FluidsimSettings *fss, char *value)
+{
+       Mesh *mesh;
+
+       value[0]= '\0';
+
+       if(ob->type == OB_MESH) {
+               /* use mesh bounding box and object scaling */
+               mesh= ob->data;
+
+               fluid_get_bb(mesh->mvert, mesh->totvert, ob->obmat, fss->bbStart, fss->bbSize);
+               elbeemEstimateMemreq(fss->resolutionxyz, fss->bbSize[0],fss->bbSize[1],fss->bbSize[2], fss->maxRefine, value);
+       }
+}
+
 #endif // DISABLE_ELBEEM
 
index 80a9f173d6ac119b23c9d0918fc9e670f5d41e90..9ecf3a32c2be8e21f188a23e2858b834120c0196 100644 (file)
@@ -63,6 +63,7 @@
 #include "DNA_meshdata_types.h"
 #include "DNA_modifier_types.h"
 #include "DNA_object_types.h"
+#include "DNA_object_fluidsim.h"
 #include "DNA_object_force.h"
 #include "DNA_particle_types.h"
 #include "DNA_scene_types.h"
@@ -8387,7 +8388,8 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
                mti = INIT_TYPE(Softbody);
                mti->type = eModifierTypeType_OnlyDeform;
                mti->flags = eModifierTypeFlag_AcceptsCVs
-                               | eModifierTypeFlag_RequiresOriginalData;
+                               | eModifierTypeFlag_RequiresOriginalData
+                               | eModifierTypeFlag_Single;
                mti->deformVerts = softbodyModifier_deformVerts;
                mti->dependsOnTime = softbodyModifier_dependsOnTime;
        
@@ -8395,7 +8397,8 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
                mti->type = eModifierTypeType_Nonconstructive;
                mti->initData = clothModifier_initData;
                mti->flags = eModifierTypeFlag_AcceptsMesh
-                               | eModifierTypeFlag_UsesPointCache;
+                               | eModifierTypeFlag_UsesPointCache
+                               | eModifierTypeFlag_Single;
                mti->dependsOnTime = clothModifier_dependsOnTime;
                mti->freeData = clothModifier_freeData; 
                mti->requiredDataMask = clothModifier_requiredDataMask;
@@ -8406,7 +8409,8 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
                mti = INIT_TYPE(Collision);
                mti->type = eModifierTypeType_OnlyDeform;
                mti->initData = collisionModifier_initData;
-               mti->flags = eModifierTypeFlag_AcceptsMesh;
+               mti->flags = eModifierTypeFlag_AcceptsMesh
+                               | eModifierTypeFlag_Single;
                mti->dependsOnTime = collisionModifier_dependsOnTime;
                mti->freeData = collisionModifier_freeData; 
                mti->deformVerts = collisionModifier_deformVerts;
@@ -8489,7 +8493,8 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
                
                mti = INIT_TYPE(Fluidsim);
                mti->type = eModifierTypeType_Nonconstructive
-                               | eModifierTypeFlag_RequiresOriginalData;
+                               | eModifierTypeFlag_RequiresOriginalData
+                               | eModifierTypeFlag_Single;
                mti->flags = eModifierTypeFlag_AcceptsMesh;
                mti->initData = fluidsimModifier_initData;
                mti->freeData = fluidsimModifier_freeData;
index 2abec6b831ca12380e506ce8c8150dbfed52ad91..d6543b41f473567cf439e2e050af465799ad7a75 100644 (file)
@@ -976,7 +976,7 @@ static void MARKER_OT_delete(wmOperatorType *ot)
 /* ************************** registration **********************************/
 
 /* called in screen_ops.c:ED_operatortypes_screen() */
-void ED_marker_operatortypes(void)
+void ED_operatortypes_marker(void)
 {
        WM_operatortype_append(MARKER_OT_add);
        WM_operatortype_append(MARKER_OT_move);
index 586f16f42aab0e21377ad48e33e046f718363e14..2859ec897bf5eef8338c476b721974d0a6933c5b 100644 (file)
@@ -46,6 +46,8 @@ void fluidsimSettingsFree(struct FluidsimSettings* sb);
 /* duplicate internal data */
 struct FluidsimSettings* fluidsimSettingsCopy(struct FluidsimSettings* sb);
 
+/* memory estimate */
+void fluidsimEstimateMemory(struct Object *ob, struct FluidsimSettings *fs, char *value);
 
 #endif /* ED_FLUIDSIM_H */
 
index 048bbbd746371a8f6162114dcda4050b4961195f..4b7a295420629734737307f476fe7a3b23fc16fe 100644 (file)
@@ -54,7 +54,7 @@ void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short sel);
 /* Operators ------------------------------ */
 
 /* called in screen_ops.c:ED_operatortypes_screen() */
-void ED_marker_operatortypes(void); 
+void ED_operatortypes_marker(void); 
 /* called in screen_ops.c:ED_keymap_screen() */
 void ED_marker_keymap(struct wmWindowManager *wm);
 
index e4e4b1d048699376ba1efcfdd605fe472b6fcc71..9dcdc30a691d5c8b52c341f63cbc08c21177b9b5 100644 (file)
@@ -103,7 +103,8 @@ void key_to_curve(struct KeyBlock *kb, struct Curve  *cu, struct ListBase *nurb)
 void curve_to_key(struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb);
 
 /* object_modifier.c */
-int ED_object_modifier_delete(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
+int ED_object_modifier_add(struct ReportList *reports, struct Scene *scene, struct Object *ob, int type);
+int ED_object_modifier_remove(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct ModifierData *md);
 int ED_object_modifier_move_down(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
 int ED_object_modifier_move_up(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
 int ED_object_modifier_convert(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct ModifierData *md);
similarity index 97%
rename from source/blender/editors/include/ED_pointcache.h
rename to source/blender/editors/include/ED_physics.h
index dc50e274fa9a112c4ae4294be2bcd2b858fa6439..b04bfb992dc4488fa3b0c9c9ce18a57a58a9ad48 100644 (file)
@@ -31,7 +31,9 @@
 #define ED_PHYSICS_H
 
 /* operators */
+
 void ED_operatortypes_pointcache(void);
+void ED_operatortypes_fluid(void);
 //void ED_keymap_pointcache(struct wmWindowManager *wm);
 
 #endif /* ED_PHYSICS_H */
index cc8b936b04f2d15626dc8a4bc84f79f13142c67c..c0612c3524e64c0c6a96c590ba9da748c8ca8011 100644 (file)
@@ -635,6 +635,7 @@ void uiItemFullO(uiLayout *layout, char *name, int icon, char *idname, struct ID
 void uiItemR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, int expand, int slider, int toggle);
 void uiItemFullR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int expand, int slider, int toggle);
 void uiItemEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, int value);
+void uiItemEnumR_string(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, char *value);
 void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, char *propname);
 void uiItemPointerR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, struct PointerRNA *searchptr, char *searchpropname);
 
index f9816235b88e993cd866ba0086dc018c37f64d61..2e30c5f1cb74dc0da25d65c211e595f0f1171609 100644 (file)
@@ -615,14 +615,13 @@ void uiItemEnumO_string(uiLayout *layout, char *name, int icon, char *opname, ch
        /* for getting the enum */
        PropertyRNA *prop;
        const EnumPropertyItem *item;
-       int totitem;
        int value;
 
        WM_operator_properties_create(&ptr, opname);
        
        /* enum lookup */
        if((prop= RNA_struct_find_property(&ptr, propname))) {
-               RNA_property_enum_items(&ptr, prop, &item, &totitem);
+               RNA_property_enum_items(&ptr, prop, &item, NULL);
                if(RNA_enum_value_from_id(item, value_str, &value)==0) {
                        printf("uiItemEnumO_string: %s.%s, enum %s not found.\n", RNA_struct_identifier(ptr.type), propname, value_str);
                        return;
@@ -695,14 +694,17 @@ static void ui_item_rna_size(uiLayout *layout, char *name, int icon, PropertyRNA
        PropertySubType subtype;
        int len, w, h;
 
-       w= ui_text_icon_width(layout, name, icon);
-       h= UI_UNIT_Y;
-
        /* arbitrary extended width by type */
        type= RNA_property_type(prop);
        subtype= RNA_property_subtype(prop);
        len= RNA_property_array_length(prop);
 
+       if(type == PROP_STRING && strcmp(name, "") == 0)
+               name= "non-empty";
+
+       w= ui_text_icon_width(layout, name, icon);
+       h= UI_UNIT_Y;
+
        /* increase height for arrays */
        if(index == RNA_NO_INDEX && len > 0) {
                if(strcmp(name, "") == 0 && icon == 0)
@@ -827,15 +829,48 @@ void uiItemEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr,
 
        prop= RNA_struct_find_property(ptr, propname);
 
-       if(!prop) {
+       if(!prop || RNA_property_type(prop) != PROP_ENUM) {
                ui_item_disabled(layout, propname);
-               printf("uiItemEnumR: property not found: %s\n", propname);
+               printf("uiItemEnumR: enum property not found: %s\n", propname);
                return;
        }
 
        uiItemFullR(layout, name, icon, ptr, prop, RNA_ENUM_VALUE, value, 0, 0, 0);
 }
 
+void uiItemEnumR_string(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, char *value)
+{
+       PropertyRNA *prop;
+       const EnumPropertyItem *item;
+       int ivalue, a;
+
+       if(!ptr->data || !propname)
+               return;
+
+       prop= RNA_struct_find_property(ptr, propname);
+
+       if(!prop || RNA_property_type(prop) != PROP_ENUM) {
+               ui_item_disabled(layout, propname);
+               printf("uiItemEnumR: enum property not found: %s\n", propname);
+               return;
+       }
+
+       RNA_property_enum_items(ptr, prop, &item, NULL);
+
+       if(!RNA_enum_value_from_id(item, value, &ivalue)) {
+               ui_item_disabled(layout, propname);
+               printf("uiItemEnumR: enum property value not found: %s\n", value);
+               return;
+       }
+
+       for(a=0; item[a].identifier; a++) {
+               if(item[a].value == ivalue) {
+                       uiItemFullR(layout, (char*)item[a].name, item[a].icon, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, 0, 0);
+                       break;
+               }
+       }
+}
+
 void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, char *propname)
 {
        PropertyRNA *prop;
index 8f1d57b28ed3cbcf0ca4ab2c880890970ebfa173..d9bc2d4d426b53ddd0f275500255f248489fcd5b 100644 (file)
@@ -320,134 +320,6 @@ void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname
 
 #include "ED_object.h"
 
-static void modifiers_del(bContext *C, void *ob_v, void *md_v)
-{
-       Scene *scene= CTX_data_scene(C);
-       Object *ob= ob_v;
-       ReportList reports;
-
-       BKE_reports_init(&reports, RPT_STORE);
-
-       if(ED_object_modifier_delete(&reports, ob_v, md_v)) {
-               WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
-               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-
-               ED_undo_push(C, "Delete modifier");
-       }
-       else
-               uiPupMenuReports(C, &reports);
-
-       BKE_reports_clear(&reports);
-}
-
-static void modifiers_activate(bContext *C, void *ob_v, void *md_v)
-{
-       Scene *scene= CTX_data_scene(C);
-       Object *ob= ob_v;
-
-       WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-}
-
-static void modifiers_moveUp(bContext *C, void *ob_v, void *md_v)
-{
-       Scene *scene= CTX_data_scene(C);
-       Object *ob= ob_v;
-       ReportList reports;
-
-       BKE_reports_init(&reports, RPT_STORE);
-
-       if(ED_object_modifier_move_up(&reports, ob_v, md_v)) {
-               WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
-               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-
-               ED_undo_push(C, "Move modifier");
-       }
-       else
-               uiPupMenuReports(C, &reports);
-
-       BKE_reports_clear(&reports);
-}
-
-static void modifiers_moveDown(bContext *C, void *ob_v, void *md_v)
-{
-       Scene *scene= CTX_data_scene(C);
-       Object *ob= ob_v;
-       ReportList reports;
-
-       BKE_reports_init(&reports, RPT_STORE);
-
-       if(ED_object_modifier_move_down(&reports, ob_v, md_v)) {
-               WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
-               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-
-               ED_undo_push(C, "Move modifier");
-       }
-       else
-               uiPupMenuReports(C, &reports);
-
-       BKE_reports_clear(&reports);
-}
-
-static void modifiers_convertParticles(bContext *C, void *obv, void *mdv)
-{
-       Scene *scene= CTX_data_scene(C);
-       Object *ob= obv;
-       ReportList reports;
-
-       BKE_reports_init(&reports, RPT_STORE);
-
-       if(ED_object_modifier_convert(&reports, scene, obv, mdv)) {
-               WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
-               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-
-               ED_undo_push(C, "Convert particles to mesh object(s).");
-       }
-       else
-               uiPupMenuReports(C, &reports);
-
-       BKE_reports_clear(&reports);
-}
-
-static void modifiers_applyModifier(bContext *C, void *obv, void *mdv)
-{
-       Scene *scene= CTX_data_scene(C);
-       Object *ob= obv;
-       ReportList reports;
-
-       BKE_reports_init(&reports, RPT_STORE);
-
-       if(ED_object_modifier_apply(&reports, scene, obv, mdv)) {
-               WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
-               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-
-               ED_undo_push(C, "Apply modifier");
-       }
-       else
-               uiPupMenuReports(C, &reports);
-
-       BKE_reports_clear(&reports);
-}
-
-static void modifiers_copyModifier(bContext *C, void *ob_v, void *md_v)
-{
-       Scene *scene= CTX_data_scene(C);
-       Object *ob= ob_v;
-       ReportList reports;
-
-       BKE_reports_init(&reports, RPT_STORE);
-
-       if(ED_object_modifier_copy(&reports, ob_v, md_v)) {
-               WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
-               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-               ED_undo_push(C, "Copy modifier");
-       }
-       else
-               uiPupMenuReports(C, &reports);
-
-       BKE_reports_clear(&reports);
-}
-
 static void modifiers_setOnCage(bContext *C, void *ob_v, void *md_v)
 {
        Scene *scene= CTX_data_scene(C);
@@ -490,15 +362,7 @@ static void modifiers_convertToReal(bContext *C, void *ob_v, void *md_v)
 
 static int modifier_can_delete(ModifierData *md)
 {
-       // deletion over the deflection panel
        // fluid particle modifier can't be deleted here
-
-       if(md->type==eModifierType_Fluidsim)
-               return 0;
-       if(md->type==eModifierType_Collision)
-               return 0;
-       if(md->type==eModifierType_Surface)
-               return 0;
        if(md->type == eModifierType_ParticleSystem)
                if(((ParticleSystemModifierData *)md)->psys->part->type == PART_FLUID)
                        return 0;
@@ -512,12 +376,12 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i
        PointerRNA ptr;
        uiBut *but;
        uiBlock *block;
-       uiLayout *column, *row, *subrow, *result= NULL;
-       int isVirtual = md->mode&eModifierMode_Virtual;
+       uiLayout *column, *row, *result= NULL;
+       int isVirtual = md->mode & eModifierMode_Virtual;
        // XXX short color = md->error?TH_REDALERT:TH_BUT_NEUTRAL;
-       short width = 295, buttonWidth = width-120-10;
        char str[128];
 
+       /* create RNA pointer */
        RNA_pointer_create(&ob->id, &RNA_Modifier, md, &ptr);
 
        column= uiLayoutColumn(layout, 1);
@@ -528,57 +392,57 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i
                /* roundbox 4 free variables: corner-rounding, nop, roundbox type, shade */
 
        row= uiLayoutRow(uiLayoutBox(column), 0);
-       block= uiLayoutGetBlock(row);
+       uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_EXPAND);
 
-       subrow= uiLayoutRow(row, 0);
-       uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_LEFT);
+       block= uiLayoutGetBlock(row);
 
        //uiDefBut(block, ROUNDBOX, 0, "", x-10, y-4, width, 25, NULL, 7.0, 0.0, 
-       //               (!isVirtual && (md->mode&eModifierMode_Expanded))?3:15, 20, ""); 
+       //               (!isVirtual && (md->mode & eModifierMode_Expanded))?3:15, 20, ""); 
        /* XXX uiBlockSetCol(block, TH_AUTO); */
        
        /* open/close icon */
-       if (!isVirtual) {
+       if(!isVirtual) {
                uiBlockSetEmboss(block, UI_EMBOSSN);
                uiDefIconButBitI(block, ICONTOG, eModifierMode_Expanded, 0, ICON_TRIA_RIGHT, 0, 0, UI_UNIT_X, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, "Collapse/Expand Modifier");
        }
        
        /* modifier-type icon */
-       uiDefIconBut(block, BUT, 0, RNA_struct_ui_icon(ptr.type), 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Current Modifier Type");
+       uiItemL(row, "", RNA_struct_ui_icon(ptr.type));
        
        uiBlockSetEmboss(block, UI_EMBOSS);
        
-       if (isVirtual) {
+       if(isVirtual) {
+               /* virtual modifier */
                sprintf(str, "%s parent deform", md->name);
                uiDefBut(block, LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Modifier name"); 
 
                but = uiDefBut(block, BUT, 0, "Make Real", 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Convert virtual modifier to a real modifier");
                uiButSetFunc(but, modifiers_convertToReal, ob, md);
-       } else {
+       }
+       else {
+               /* real modifier */
                uiBlockBeginAlign(block);
-               uiDefBut(block, TEX, 0, "", 0, 0, buttonWidth-40, UI_UNIT_Y, md->name, 0.0, sizeof(md->name)-1, 0.0, 0.0, "Modifier name"); 
+               uiItemR(row, "", 0, &ptr, "name", 0, 0, 0);
 
                /* Softbody not allowed in this situation, enforce! */
-               if (((md->type!=eModifierType_Softbody && md->type!=eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) && (md->type!=eModifierType_Surface)) {
-                       uiDefIconButBitI(block, TOG, eModifierMode_Render, 0, ICON_SCENE, 0, 0, 19, UI_UNIT_Y,&md->mode, 0, 0, 1, 0, "Enable modifier during rendering");
-                       but= uiDefIconButBitI(block, TOG, eModifierMode_Realtime, 0, ICON_VIEW3D, 0, 0, 19, UI_UNIT_Y,&md->mode, 0, 0, 1, 0, "Enable modifier during interactive display");
-                       uiButSetFunc(but, modifiers_activate, ob, md);
-                       if (mti->flags&eModifierTypeFlag_SupportsEditmode) {
-                               but= uiDefIconButBitI(block, TOG, eModifierMode_Editmode, 0, ICON_EDITMODE_HLT, 0, 0, 19, UI_UNIT_Y,&md->mode, 0, 0, 1, 0, "Enable modifier during Editmode (only if enabled for display)");
-                               uiButSetFunc(but, modifiers_activate, ob, md);
-                       }
+               if(((md->type!=eModifierType_Softbody && md->type!=eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) && (md->type!=eModifierType_Surface)) {
+                       uiItemR(row, "", ICON_SCENE, &ptr, "render", 0, 0, 0);
+                       uiItemR(row, "", ICON_VIEW3D, &ptr, "realtime", 0, 0, 0);
+
+                       if(mti->flags & eModifierTypeFlag_SupportsEditmode)
+                               uiItemR(row, "", ICON_VIEW3D, &ptr, "editmode", 0, 0, 0);
                }
                uiBlockEndAlign(block);
 
                /* XXX uiBlockSetEmboss(block, UI_EMBOSSR); */
 
-               if (ob->type==OB_MESH && modifier_couldBeCage(md) && index<=lastCageIndex) {
+               if(ob->type==OB_MESH && modifier_couldBeCage(md) && index<=lastCageIndex) {
                        int icon; //, color;
 
-                       if (index==cageIndex) {
+                       if(index==cageIndex) {
                                // XXX color = TH_BUT_SETTING;
                                icon = VICON_EDITMODE_HLT;
-                       } else if (index<cageIndex) {
+                       } else if(index<cageIndex) {
                                // XXX color = TH_BUT_NEUTRAL;
                                icon = VICON_EDITMODE_DEHLT;
                        } else {
@@ -592,67 +456,55 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i
                }
        }
 
-       subrow= uiLayoutRow(row, 0);
-       uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT);
-
+       /* up/down/delete */
        if(!isVirtual) {
                /* XXX uiBlockSetCol(block, TH_BUT_ACTION); */
-
-               but = uiDefIconBut(block, BUT, 0, VICON_MOVE_UP, 0, 0, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Move modifier up in stack");
-               uiButSetFunc(but, modifiers_moveUp, ob, md);
-
-               but = uiDefIconBut(block, BUT, 0, VICON_MOVE_DOWN, 0, 0, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Move modifier down in stack");
-               uiButSetFunc(but, modifiers_moveDown, ob, md);
+               uiItemO(row, "", VICON_MOVE_UP, "OBJECT_OT_modifier_move_up");
+               uiItemO(row, "", VICON_MOVE_DOWN, "OBJECT_OT_modifier_move_down");
                
                uiBlockSetEmboss(block, UI_EMBOSSN);
-               
-               if(modifier_can_delete(md)) {
-                       but = uiDefIconBut(block, BUT, 0, VICON_X, 0, 0, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Delete modifier");
-                       uiButSetFunc(but, modifiers_del, ob, md);
-               }
+
+               if(modifier_can_delete(md))
+                       uiItemO(row, "", VICON_X, "OBJECT_OT_modifier_remove");
+
                /* XXX uiBlockSetCol(block, TH_AUTO); */
        }
 
        uiBlockSetEmboss(block, UI_EMBOSS);
 
-       if(!isVirtual && (md->mode&eModifierMode_Expanded)) {
+       if(!isVirtual && (md->mode & eModifierMode_Expanded)) {
+               /* apply/convert/copy */
                uiLayout *box;
 
                box= uiLayoutBox(column);
                row= uiLayoutRow(box, 1);
 
-               if (!isVirtual && (md->type!=eModifierType_Collision) && (md->type!=eModifierType_Surface)) {
-                       uiBlockSetButLock(block, object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE); /* only here obdata, the rest of modifiers is ob level */
+               if(!isVirtual && (md->type!=eModifierType_Collision) && (md->type!=eModifierType_Surface)) {
+                       /* only here obdata, the rest of modifiers is ob level */
+                       uiBlockSetButLock(block, object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
 
-                                               if (md->type==eModifierType_ParticleSystem) {
+                       if(md->type==eModifierType_ParticleSystem) {
                        ParticleSystem *psys= ((ParticleSystemModifierData *)md)->psys;
 
-                       if(!(G.f & G_PARTICLEEDIT)) {
-                                       if(ELEM3(psys->part->draw_as, PART_DRAW_PATH, PART_DRAW_GR, PART_DRAW_OB) && psys->pathcache) {
-                                               but = uiDefBut(block, BUT, 0, "Convert",        0,0,60,19, 0, 0, 0, 0, 0, "Convert the current particles to a mesh object");
-                                               uiButSetFunc(but, modifiers_convertParticles, ob, md);
-                                       }
-                               }
-                       }
-                       else{
-                               but = uiDefBut(block, BUT, 0, "Apply",  0,0,60,19, 0, 0, 0, 0, 0, "Apply the current modifier and remove from the stack");
-                               uiButSetFunc(but, modifiers_applyModifier, ob, md);
+                       if(!(G.f & G_PARTICLEEDIT))
+                                       if(ELEM3(psys->part->draw_as, PART_DRAW_PATH, PART_DRAW_GR, PART_DRAW_OB) && psys->pathcache)
+                                               uiItemO(row, "Convert", 0, "OBJECT_OT_modifier_convert");
                        }
+                       else
+                               uiItemO(row, "Apply", 0, "OBJECT_OT_modifier_apply");
                        
                        uiBlockClearButLock(block);
                        uiBlockSetButLock(block, ob && ob->id.lib, ERROR_LIBDATA_MESSAGE);
 
-                       if (md->type!=eModifierType_Fluidsim && md->type!=eModifierType_Softbody && md->type!=eModifierType_ParticleSystem && (md->type!=eModifierType_Cloth)) {
-                               but = uiDefBut(block, BUT, 0, "Copy",   0,0,60,19, 0, 0, 0, 0, 0, "Duplicate the current modifier at the same position in the stack");
-                               uiButSetFunc(but, modifiers_copyModifier, ob, md);
-                       }
+                       if(!ELEM4(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem, eModifierType_Cloth))
+                               uiItemO(row, "Copy", 0, "OBJECT_OT_modifier_copy");
                }
 
                result= uiLayoutColumn(box, 0);
                block= uiLayoutFreeBlock(box);
        }
 
-       if (md->error) {
+       if(md->error) {
                row = uiLayoutRow(uiLayoutBox(column), 0);
 
                /* XXX uiBlockSetCol(block, color); */
@@ -694,7 +546,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, PointerRNA *ptr)
        for(i=0; vmd; i++, vmd=vmd->next) {
                if(md == vmd)
                        return draw_modifier(layout, ob, md, i, cageIndex, lastCageIndex);
-               else if(vmd->mode&eModifierMode_Virtual)
+               else if(vmd->mode & eModifierMode_Virtual)
                        i--;
        }
 
index a52acdd4e1e89780f1ef23e819b097a6dca2ece2..6ec5f029148ce0437c319121deba03654dec30d7 100644 (file)
@@ -86,6 +86,12 @@ void GROUP_OT_objects_remove_active(struct wmOperatorType *ot);
 
 /* object_modifier.c */
 void OBJECT_OT_modifier_add(struct wmOperatorType *ot);
+void OBJECT_OT_modifier_remove(struct wmOperatorType *ot);
+void OBJECT_OT_modifier_move_up(struct wmOperatorType *ot);
+void OBJECT_OT_modifier_move_down(struct wmOperatorType *ot);
+void OBJECT_OT_modifier_apply(struct wmOperatorType *ot);
+void OBJECT_OT_modifier_convert(struct wmOperatorType *ot);
+void OBJECT_OT_modifier_copy(struct wmOperatorType *ot);
 void OBJECT_OT_multires_subdivide(struct wmOperatorType *ot);
 void OBJECT_OT_modifier_mdef_bind(struct wmOperatorType *ot);
 
index 4bcfcc4d5ab46dfcfe613ffab16ded77892e1787..bda3e4e8f79573f8e8d3860a23bc04d35b56e34b 100644 (file)
@@ -25,6 +25,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
+#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -35,6 +36,7 @@
 #include "DNA_meshdata_types.h"
 #include "DNA_modifier_types.h"
 #include "DNA_object_types.h"
+#include "DNA_object_force.h"
 #include "DNA_scene_types.h"
 
 #include "BLI_listbase.h"
@@ -44,6 +46,7 @@
 #include "BKE_depsgraph.h"
 #include "BKE_displist.h"
 #include "BKE_DerivedMesh.h"
+#include "BKE_effect.h"
 #include "BKE_global.h"
 #include "BKE_lattice.h"
 #include "BKE_mesh.h"
@@ -52,6 +55,7 @@
 #include "BKE_report.h"
 #include "BKE_object.h"
 #include "BKE_particle.h"
+#include "BKE_softbody.h"
 #include "BKE_utildefines.h"
 
 #include "RNA_access.h"
 
 /******************************** API ****************************/
 
-int ED_object_modifier_delete(ReportList *reports, Object *ob, ModifierData *md)
+int ED_object_modifier_add(ReportList *reports, Scene *scene, Object *ob, int type)
+{
+       ModifierData *md;
+       ModifierTypeInfo *mti = modifierType_getInfo(type);
+
+       if(mti->flags&eModifierTypeFlag_Single) {
+               if(modifiers_findByType(ob, type)) {
+                       BKE_report(reports, RPT_WARNING, "Only one modifier of this type allowed.");
+                       return 0;
+               }
+       }
+
+       if(mti->flags&eModifierTypeFlag_RequiresOriginalData) {
+               md = ob->modifiers.first;
+
+               while(md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform)
+                       md = md->next;
+
+               BLI_insertlinkbefore(&ob->modifiers, md, modifier_new(type));
+       }
+       else
+               BLI_addtail(&ob->modifiers, modifier_new(type));
+       
+       /* special cases */
+       if(type == eModifierType_Softbody) {
+               if(!ob->soft) {
+                       ob->soft= sbNew(scene);
+                       ob->softflag |= OB_SB_GOAL|OB_SB_EDGES;
+               }
+       }
+       else if(type == eModifierType_Collision) {
+               if(!ob->pd)
+                       ob->pd= object_add_collision_fields();
+
+               ob->pd->deflect= 1;
+        DAG_scene_sort(scene);
+       }
+       else if(type == eModifierType_Surface)
+        DAG_scene_sort(scene);
+
+       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+
+       return 1;
+}
+
+int ED_object_modifier_remove(ReportList *reports, Scene *scene, Object *ob, ModifierData *md)
 {
        ModifierData *obmd;
 
        /* It seems on rapid delete it is possible to
         * get called twice on same modifier, so make
         * sure it is in list. */
-       for (obmd=ob->modifiers.first; obmd; obmd=obmd->next)
-               if (obmd==md)
+       for(obmd=ob->modifiers.first; obmd; obmd=obmd->next)
+               if(obmd==md)
                        break;
        
-       if (!obmd)
+       if(!obmd)
                return 0;
 
+       /* special cases */
        if(md->type == eModifierType_ParticleSystem) {
                ParticleSystemModifierData *psmd=(ParticleSystemModifierData*)md;
 
                BLI_remlink(&ob->particlesystem, psmd->psys);
                psys_free(ob, psmd->psys);
        }
+       else if(md->type == eModifierType_Softbody) {
+               if(ob->soft) {
+                       sbFree(ob->soft);
+                       ob->soft= NULL;
+                       ob->softflag= 0;
+               }
+       }
+       else if(md->type == eModifierType_Collision) {
+               if(ob->pd)
+                       ob->pd->deflect= 0;
 
-       BLI_remlink(&ob->modifiers, md);
+        DAG_scene_sort(scene);
+       }
+       else if(md->type == eModifierType_Surface) {
+               if(ob->pd)
+                       ob->pd->flag &= ~PFIELD_SURFACE;
 
+        DAG_scene_sort(scene);
+       }
+
+       BLI_remlink(&ob->modifiers, md);
        modifier_free(md);
 
+       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+
        return 1;
 }
 
@@ -103,9 +173,10 @@ int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md
                if(mti->type!=eModifierTypeType_OnlyDeform) {
                        ModifierTypeInfo *nmti = modifierType_getInfo(md->prev->type);
 
-                       if(nmti->flags&eModifierTypeFlag_RequiresOriginalData)
+                       if(nmti->flags&eModifierTypeFlag_RequiresOriginalData) {
                                BKE_report(reports, RPT_WARNING, "Cannot move above a modifier requiring original data.");
                                return 0;
+                       }
                }
 
                BLI_remlink(&ob->modifiers, md);
@@ -329,22 +400,11 @@ static int modifier_add_exec(bContext *C, wmOperator *op)
 {
        Scene *scene= CTX_data_scene(C);
     Object *ob = CTX_data_active_object(C);
-       ModifierData *md;
        int type= RNA_enum_get(op->ptr, "type");
-       ModifierTypeInfo *mti = modifierType_getInfo(type);
 
-       if(mti->flags&eModifierTypeFlag_RequiresOriginalData) {
-               md = ob->modifiers.first;
+       if(!ED_object_modifier_add(op->reports, scene, ob, type))
+               return OPERATOR_CANCELLED;
 
-               while(md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform)
-                       md = md->next;
-
-               BLI_insertlinkbefore(&ob->modifiers, md, modifier_new(type));
-       }
-       else
-               BLI_addtail(&ob->modifiers, modifier_new(type));
-
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
        
        return OPERATOR_FINISHED;
@@ -370,13 +430,198 @@ void OBJECT_OT_modifier_add(wmOperatorType *ot)
        RNA_def_enum(ot->srna, "type", modifier_type_items, 0, "Type", "");
 }
 
+/************************ remove modifier operator *********************/
+
+static int modifier_remove_exec(bContext *C, wmOperator *op)
+{
+       Scene *scene= CTX_data_scene(C);
+       PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
+       Object *ob= ptr.id.data;
+       ModifierData *md= ptr.data;
+
+       if(!ob || !md || !ED_object_modifier_remove(op->reports, scene, ob, md))
+               return OPERATOR_CANCELLED;
+
+       WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+       
+       return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_modifier_remove(wmOperatorType *ot)
+{
+       ot->name= "Remove Modifier";
+       ot->description= "Remove a modifier from the active object.";
+       ot->idname= "OBJECT_OT_modifier_remove";
+       ot->poll= ED_operator_object_active;
+
+       ot->exec= modifier_remove_exec;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+/************************ move up modifier operator *********************/
+
+static int modifier_move_up_exec(bContext *C, wmOperator *op)
+{
+       Scene *scene= CTX_data_scene(C);
+       PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
+       Object *ob= ptr.id.data;
+       ModifierData *md= ptr.data;
+
+       if(!ob || !md || !ED_object_modifier_move_up(op->reports, ob, md))
+               return OPERATOR_CANCELLED;
+
+       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+       
+       return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_modifier_move_up(wmOperatorType *ot)
+{
+       ot->name= "Move Up Modifier";
+       ot->description= "Move modifier up in the stack.";
+       ot->idname= "OBJECT_OT_modifier_move_up";
+       ot->poll= ED_operator_object_active;
+
+       ot->exec= modifier_move_up_exec;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+/************************ move down modifier operator *********************/
+
+static int modifier_move_down_exec(bContext *C, wmOperator *op)
+{
+       Scene *scene= CTX_data_scene(C);
+       PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
+       Object *ob= ptr.id.data;
+       ModifierData *md= ptr.data;
+
+       if(!ob || !md || !ED_object_modifier_move_down(op->reports, ob, md))
+               return OPERATOR_CANCELLED;
+
+       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+       
+       return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_modifier_move_down(wmOperatorType *ot)
+{
+       ot->name= "Move Down Modifier";
+       ot->description= "Move modifier down in the stack.";
+       ot->idname= "OBJECT_OT_modifier_move_down";
+       ot->poll= ED_operator_object_active;
+
+       ot->exec= modifier_move_down_exec;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+/************************ apply modifier operator *********************/
+
+static int modifier_apply_exec(bContext *C, wmOperator *op)
+{
+       Scene *scene= CTX_data_scene(C);
+       PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
+       Object *ob= ptr.id.data;
+       ModifierData *md= ptr.data;
+
+       if(!ob || !md || !ED_object_modifier_apply(op->reports, scene, ob, md))
+               return OPERATOR_CANCELLED;
+
+       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+       
+       return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_modifier_apply(wmOperatorType *ot)
+{
+       ot->name= "Apply Modifier";
+       ot->description= "Apply modifier and remove from the stack.";
+       ot->idname= "OBJECT_OT_modifier_apply";
+       ot->poll= ED_operator_object_active;
+
+       ot->exec= modifier_apply_exec;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+/************************ convert modifier operator *********************/
+
+static int modifier_convert_exec(bContext *C, wmOperator *op)
+{
+       Scene *scene= CTX_data_scene(C);
+       PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
+       Object *ob= ptr.id.data;
+       ModifierData *md= ptr.data;
+
+       if(!ob || !md || !ED_object_modifier_convert(op->reports, scene, ob, md))
+               return OPERATOR_CANCELLED;
+
+       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+       
+       return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_modifier_convert(wmOperatorType *ot)
+{
+       ot->name= "Convert Modifier";
+       ot->description= "Convert particles to a mesh object.";
+       ot->idname= "OBJECT_OT_modifier_convert";
+       ot->poll= ED_operator_object_active;
+
+       ot->exec= modifier_convert_exec;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+/************************ copy modifier operator *********************/
+
+static int modifier_copy_exec(bContext *C, wmOperator *op)
+{
+       Scene *scene= CTX_data_scene(C);
+       PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
+       Object *ob= ptr.id.data;
+       ModifierData *md= ptr.data;
+
+       if(!ob || !md || !ED_object_modifier_copy(op->reports, ob, md))
+               return OPERATOR_CANCELLED;
+
+       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+       
+       return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_modifier_copy(wmOperatorType *ot)
+{
+       ot->name= "Copy Modifier";
+       ot->description= "Duplicate modifier at the same position in the stack.";
+       ot->idname= "OBJECT_OT_modifier_copy";
+       ot->poll= ED_operator_object_active;
+
+       ot->exec= modifier_copy_exec;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
 /****************** multires subdivide operator *********************/
 
 static int multires_subdivide_exec(bContext *C, wmOperator *op)
 {
-       Object *ob = CTX_data_active_object(C);
-       PointerRNA ptr = CTX_data_pointer_get(C, "modifier");
-       MultiresModifierData *mmd = (RNA_struct_is_a(ptr.type, &RNA_Modifier))? ptr.data: NULL;
+       PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_MultiresModifier);
+       Object *ob= ptr.id.data;
+       MultiresModifierData *mmd= ptr.data;
 
        if(mmd) {
                multiresModifier_subdivide(mmd, ob, 1, 0, mmd->simple);
@@ -403,8 +648,7 @@ void OBJECT_OT_multires_subdivide(wmOperatorType *ot)
 
 static int modifier_mdef_bind_poll(bContext *C)
 {
-       PointerRNA ptr= CTX_data_pointer_get(C, "modifier");
-       return RNA_struct_is_a(ptr.type, &RNA_MeshDeformModifier);
+       return CTX_data_pointer_get_type(C, "modifier", &RNA_MeshDeformModifier).data != NULL;
 }
 
 static int modifier_mdef_bind_exec(bContext *C, wmOperator *op)
index 6fa78a538401b5311416e012e4030778dc7581ab..6248d826ad47a22f27e78e8ad215be3b8db0e7e4 100644 (file)
@@ -100,6 +100,12 @@ void ED_operatortypes_object(void)
        WM_operatortype_append(OBJECT_OT_primitive_add);
 
        WM_operatortype_append(OBJECT_OT_modifier_add);
+       WM_operatortype_append(OBJECT_OT_modifier_remove);
+       WM_operatortype_append(OBJECT_OT_modifier_move_up);
+       WM_operatortype_append(OBJECT_OT_modifier_move_down);
+       WM_operatortype_append(OBJECT_OT_modifier_apply);
+       WM_operatortype_append(OBJECT_OT_modifier_convert);
+       WM_operatortype_append(OBJECT_OT_modifier_copy);
        WM_operatortype_append(OBJECT_OT_multires_subdivide);
        WM_operatortype_append(OBJECT_OT_modifier_mdef_bind);
 
index 215a72d6927276fe113a23642c1fe54ffd1108aa..3990521bd1ba14a195cf807dee1b04db8dcbdd5d 100644 (file)
 #include "BKE_blender.h"
 #include "BKE_context.h"
 #include "BKE_customdata.h"
+#include "BKE_DerivedMesh.h"
 #include "BKE_displist.h"
 #include "BKE_effect.h"
 #include "BKE_fluidsim.h"
 #include "BKE_global.h"
-#include "BKE_modifier.h"
-#include "BKE_main.h"
+#include "BKE_ipo.h"
 #include "BKE_key.h"
-#include "BKE_scene.h"
+#include "BKE_main.h"
+#include "BKE_modifier.h"
 #include "BKE_object.h"
+#include "BKE_report.h"
+#include "BKE_scene.h"
 #include "BKE_softbody.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_ipo.h"
 
 #include "PIL_time.h"
 
@@ -89,6 +90,9 @@
 #include "ED_fluidsim.h"
 #include "ED_screen.h"
 
+#include "WM_api.h"
+#include "WM_types.h"
+
 /* XXX */
 /* from header info.c */
 static int start_progress_bar(void) {return 0;};
@@ -124,7 +128,7 @@ char* fluidsimViscosityPresetString[6] = {
 /* ********************** fluid sim settings struct functions ********************** */
 
 /* helper function */
-void fluidsimGetGeometryObjFilename(struct Object *ob, char *dst) { //, char *srcname) {
+void fluidsimGetGeometryObjFilename(Object *ob, char *dst) { //, char *srcname) {
        //snprintf(dst,FILE_MAXFILE, "%s_cfgdata_%s.bobj.gz", srcname, ob->id.name);
        snprintf(dst,FILE_MAXFILE, "fluidcfgdata_%s.bobj.gz", ob->id.name);
 }
@@ -337,14 +341,14 @@ int runSimulationCallback(void *data, int status, int frame) {
 /* ********************** write fluidsim config to file ************************* */
 /* ******************************************************************************** */
 
-void fluidsimBake(bContext *C, struct Object *ob)
+int fluidsimBake(bContext *C, ReportList *reports, Object *ob)
 {
        Scene *scene= CTX_data_scene(C);
        FILE *fileCfg;
        int i;
-       struct Object *fsDomain = NULL;
+       Object *fsDomain = NULL;
        FluidsimSettings *domainSettings;
-       struct Object *obit = NULL; /* object iterator */
+       Object *obit = NULL; /* object iterator */
        Base *base;
        int origFrame = scene->r.cfra;
        char debugStrBuffer[256];
@@ -412,8 +416,8 @@ void fluidsimBake(bContext *C, struct Object *ob)
        // old: noFrames = scene->r.efra - scene->r.sfra +1;
        noFrames = scene->r.efra - 0;
        if(noFrames<=0) {
-               pupmenu("Fluidsim Bake Error%t|No frames to export - check your animation range settings. Aborted%x0");
-               return;
+               BKE_report(reports, RPT_ERROR, "No frames to export - check your animation range settings.");
+               return 0;
        }
 
        /* no object pointer, find in selected ones.. */
@@ -434,7 +438,7 @@ void fluidsimBake(bContext *C, struct Object *ob)
                        }
                }
                // no domains found?
-               if(!ob) return;
+               if(!ob) return 0;
        }
        
        channelObjCount = 0;
@@ -452,8 +456,8 @@ void fluidsimBake(bContext *C, struct Object *ob)
        }
        
        if (channelObjCount>=255) {
-               pupmenu("Fluidsim Bake Error%t|Cannot bake with more then 256 objects");
-               return;
+               BKE_report(reports, RPT_ERROR, "Cannot bake with more then 256 objects.");
+               return 0;
        }
 
        /* check if there's another domain... */
@@ -467,8 +471,8 @@ void fluidsimBake(bContext *C, struct Object *ob)
                        {
                                if(obit != ob) 
                                {
-                                       pupmenu("Fluidsim Bake Error%t|There should be only one domain object! Aborted%x0");
-                                       return;
+                                       BKE_report(reports, RPT_ERROR, "There should be only one domain object.");
+                                       return 0;
                                }
                        }
                }
@@ -490,8 +494,8 @@ void fluidsimBake(bContext *C, struct Object *ob)
                }
        }
        if(!haveSomeFluid) {
-               pupmenu("Fluidsim Bake Error%t|No fluid objects in scene... Aborted%x0");
-               return;
+               BKE_report(reports, RPT_ERROR, "No fluid objects in scene.");
+               return 0;
        }
        
        /* these both have to be valid, otherwise we wouldnt be here */
@@ -585,7 +589,7 @@ void fluidsimBake(bContext *C, struct Object *ob)
 
                // ask user if thats what he/she wants...
                selection = pupmenu(dispmsg);
-               if(selection<1) return; // 0 from menu, or -1 aborted
+               if(selection<1) return 0; // 0 from menu, or -1 aborted
                strcpy(targetDir, newSurfdataPath);
                strncpy(domainSettings->surfdataPath, newSurfdataPath, FILE_MAXDIR);
                BLI_convertstringcode(targetDir, G.sce); // fixed #frame-no 
@@ -710,6 +714,10 @@ void fluidsimBake(bContext *C, struct Object *ob)
                        // check & init loc,rot,size
                        for(j=0; j<3; j++) {
                                for(k=0; k<3; k++) {
+                                       // XXX prevent invalid memory access until this works
+                                       icuex[j][k]= NULL;
+                                       icudex[j][k]= NULL;
+
                                        // XXX icuex[j][k]  = find_ipocurve(obit->ipo, icuIds[j][k] );
                                        // XXX icudex[j][k] = find_ipocurve(obit->ipo, icudIds[j][k] );
                                        // XXX lines below were already disabled!
@@ -812,12 +820,12 @@ void fluidsimBake(bContext *C, struct Object *ob)
        if(!Mat4Invert(invDomMat, domainMat)) {
                snprintf(debugStrBuffer,256,"fluidsimBake::error - Invalid obj matrix?\n"); 
                elbeemDebugOut(debugStrBuffer);
+               BKE_report(reports, RPT_ERROR, "Invalid object matrix."); 
                // FIXME add fatal msg
                FS_FREE_CHANNELS;
-               return;
+               return 0;
        }
 
-
        // --------------------------------------------------------------------------------------------
        // start writing / exporting
        strcpy(targetFile, targetDir);
@@ -1001,7 +1009,6 @@ void fluidsimBake(bContext *C, struct Object *ob)
                        } // valid mesh
                } // objects
                //domainSettings->type = OB_FLUIDSIM_DOMAIN; // enable for bake display again
-               //fsDomain->fluidsimFlag = OB_FLUIDSIM_ENABLE; // disable during bake
                
                // set to neutral, -1 means user abort, -2 means init error
                globalBakeState = 0;
@@ -1080,7 +1087,7 @@ void fluidsimBake(bContext *C, struct Object *ob)
        // --------------------------------------------------------------------------------------------
        else
        { // write config file to be run with command line simulator
-               pupmenu("Fluidsim Bake Message%t|Config file export not supported.%x0");
+               BKE_report(reports, RPT_WARNING, "Config file export not supported.");
        } // config file export done!
 
        // --------------------------------------------------------------------------------------------
@@ -1099,51 +1106,81 @@ void fluidsimBake(bContext *C, struct Object *ob)
        ED_update_for_newframe(C, 1);
 
        if(!simAborted) {
-               char fsmessage[512];
                char elbeemerr[256];
-               strcpy(fsmessage,"Fluidsim Bake Error: ");
+
                // check if some error occurred
                if(globalBakeState==-2) {
-                       strcat(fsmessage,"Failed to initialize [Msg: ");
-
                        elbeemGetErrorString(elbeemerr);
-                       strcat(fsmessage,elbeemerr);
-
-                       strcat(fsmessage,"] |OK%x0");
-                       pupmenu(fsmessage);
+                       BKE_reportf(reports, RPT_ERROR, "Failed to initialize [Msg: %s]", elbeemerr);
+                       return 0;
                } // init error
        }
        
        // elbeemFree();
+       return 1;
 }
 
-void fluidsimFreeBake(struct Object *ob)
+void fluidsimFreeBake(Object *ob)
 {
        /* not implemented yet */
 }
 
-
 #else /* DISABLE_ELBEEM */
 
 /* compile dummy functions for disabled fluid sim */
 
-FluidsimSettings *fluidsimSettingsNew(struct Object *srcob) {
+FluidsimSettings *fluidsimSettingsNew(Object *srcob)
+{
        return NULL;
 }
 
-void fluidsimSettingsFree(FluidsimSettings *fss) {
+void fluidsimSettingsFree(FluidsimSettings *fss)
+{
 }
 
-FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *fss) {
+FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *fss)
+{
        return NULL;
 }
 
 /* only compile dummy functions */
-void fluidsimBake(bContext *C, struct Object *ob) {
+int fluidsimBake(bContext *C, ReportList *reports, Object *ob)
+{
+       return 0;
 }
 
-void fluidsimFreeBake(struct Object *ob) {
+void fluidsimFreeBake(Object *ob)
+{
 }
 
 #endif /* DISABLE_ELBEEM */
 
+/***************************** Operators ******************************/
+
+static int fluid_bake_exec(bContext *C, wmOperator *op)
+{
+       Object *ob= CTX_data_active_object(C);
+
+       // XXX TODO redraw, escape, non-blocking, ..
+       if(!fluidsimBake(C, op->reports, ob))
+               return OPERATOR_CANCELLED;
+
+       return OPERATOR_FINISHED;
+}
+
+void FLUID_OT_bake(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Fluid Simulation Bake";
+       ot->idname= "FLUID_OT_bake";
+       
+       /* api callbacks */
+       ot->exec= fluid_bake_exec;
+       ot->poll= ED_operator_object_active;
+}
+
+void ED_operatortypes_fluid(void)
+{
+       WM_operatortype_append(FLUID_OT_bake);
+}
+
index 893c59a521ded680d240a22b705c195786124ea8..edd668b46bbfca5353f91aa981d7faa3073a0f02 100644 (file)
@@ -45,7 +45,7 @@
 #include "BLI_blenlib.h"
 
 #include "ED_screen.h"
-#include "ED_pointcache.h"
+#include "ED_physics.h"
 
 #include "UI_interface.h"
 #include "UI_resources.h"
index 510103895f4103a338b56dfc8085446765d6ca3a..c8df9bb9741304408296e80061f7ed8c6bc64f68 100644 (file)
 #include "ED_anim_api.h"
 #include "ED_armature.h"
 #include "ED_curve.h"
-#include "ED_mesh.h"
 #include "ED_markers.h"
+#include "ED_mesh.h"
 #include "ED_object.h"
 #include "ED_particle.h"
-#include "ED_sculpt.h"
+#include "ED_physics.h"
 #include "ED_screen.h"
+#include "ED_sculpt.h"
 #include "ED_space_api.h"
 #include "ED_uvedit.h"
-#include "ED_pointcache.h"
 
 /* only call once on startup, storage is global in BKE kernel listbase */
 void ED_spacetypes_init(void)
@@ -89,8 +89,9 @@ void ED_spacetypes_init(void)
        ED_operatortypes_particle();
        ED_operatortypes_curve();
        ED_operatortypes_armature();
-       ED_marker_operatortypes();
+       ED_operatortypes_marker();
        ED_operatortypes_pointcache();
+       ED_operatortypes_fluid();
        
        ui_view2d_operatortypes();
        
index 01794d1bba805f0988470f4e43797aaff9179142..02179f347f51f1fa1656e145ad8795da3949326c 100644 (file)
@@ -497,7 +497,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
                        "world", "object", "meshe", "armature", "lattice", "curve",
                        "meta_ball", "lamp", "camera", "material", "material_slot",
                        "texture", "texture_slot", "bone", "edit_bone", "particle_system",
-                       "cloth", "soft_body", "fluid", NULL};
+                       "cloth", "soft_body", "fluid", "collision", NULL};
 
                CTX_data_dir_set(result, dir);
                return 1;
@@ -615,7 +615,8 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
 
                if(ptr && ptr->data) {
                        Object *ob= ptr->data;
-                       CTX_data_pointer_set(result, &ob->id, &RNA_SoftBodySettings, ob->soft);
+                       ModifierData *md= modifiers_findByType(ob, eModifierType_Softbody);
+                       CTX_data_pointer_set(result, &ob->id, &RNA_SoftBodyModifier, md);
                        return 1;
                }
        }
@@ -629,6 +630,16 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
                        return 1;
                }
        }
+       else if(CTX_data_equals(member, "collision")) {
+               PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
+
+               if(ptr && ptr->data) {
+                       Object *ob= ptr->data;
+                       ModifierData *md= modifiers_findByType(ob, eModifierType_Collision);
+                       CTX_data_pointer_set(result, &ob->id, &RNA_CollisionModifier, md);
+                       return 1;
+               }
+       }
 
        return 0;
 }
index df3e8c62d37087bb96faa2036599bb8adbd28d69..2bc3bdaa6133ef018bcfb18d98d9b8d6542606c8 100644 (file)
@@ -41,6 +41,7 @@
 #include "BKE_depsgraph.h"
 #include "BKE_font.h"
 #include "BKE_library.h"
+#include "BKE_main.h"
 #include "BKE_material.h"
 #include "BKE_particle.h"
 #include "BKE_texture.h"
@@ -471,6 +472,7 @@ void OBJECT_OT_particle_system_remove(wmOperatorType *ot)
 static int new_particle_settings_exec(bContext *C, wmOperator *op)
 {
        Scene *scene = CTX_data_scene(C);
+       Main *bmain= CTX_data_main(C);
        ParticleSettings *part= CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings).data;
        Object *ob;
        PointerRNA ptr;
@@ -479,7 +481,7 @@ static int new_particle_settings_exec(bContext *C, wmOperator *op)
        if(part)
                part= psys_copy_settings(part);
        else
-               part= psys_new_settings("PSys", NULL);
+               part= psys_new_settings("PSys", bmain);
 
        /* attempt to assign to material slot */
        ptr= CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
index 66c5baab84bc8da34e3b74c759e32be22e1efcca..09288b24c201c703e2cd84cd371c5a9f6192c061 100644 (file)
@@ -135,12 +135,12 @@ typedef struct FluidsimSettings {
 /* ob->fluidsimSettings defines */
 #define OB_FLUIDSIM_ENABLE                     1
 #define OB_FLUIDSIM_DOMAIN                     2
-#define OB_FLUIDSIM_FLUID                              4
+#define OB_FLUIDSIM_FLUID                      4
 #define OB_FLUIDSIM_OBSTACLE           8
-#define OB_FLUIDSIM_INFLOW      16
-#define OB_FLUIDSIM_OUTFLOW     32
-#define OB_FLUIDSIM_PARTICLE    64
-#define OB_FLUIDSIM_CONTROL    128
+#define OB_FLUIDSIM_INFLOW                     16
+#define OB_FLUIDSIM_OUTFLOW                    32
+#define OB_FLUIDSIM_PARTICLE           64
+#define OB_FLUIDSIM_CONTROL                    128
 
 #define OB_TYPEFLAG_START       7
 #define OB_FSGEO_THIN           (1<<(OB_TYPEFLAG_START+1))
index 88d9894cf7a16208ec749733a8437157b55cd887..32bfc58f56c7c97c89419b8d92ff08cde3194a79 100644 (file)
@@ -271,7 +271,7 @@ typedef struct SoftBody {
 #define PTCACHE_REDO_NEEDED                    258
 
 /* ob->softflag */
-#define OB_SB_ENABLE   1
+#define OB_SB_ENABLE   1               /* deprecated, use modifier */
 #define OB_SB_GOAL             2
 #define OB_SB_EDGES            4
 #define OB_SB_QUADS            8
index d69439e25bcb7bcb32b0d6e015dd833680f548bf..e145722428cc10ebe01530a4f7dbf636f8115a33 100644 (file)
@@ -360,7 +360,7 @@ extern StructRNA RNA_ShrinkwrapModifier;
 extern StructRNA RNA_SimpleDeformModifier;
 extern StructRNA RNA_SmoothModifier;
 extern StructRNA RNA_SoftBodySettings;
-extern StructRNA RNA_SoftbodyModifier;
+extern StructRNA RNA_SoftBodyModifier;
 extern StructRNA RNA_Sound;
 extern StructRNA RNA_SoundSequence;
 extern StructRNA RNA_Space;
@@ -381,6 +381,7 @@ extern StructRNA RNA_StucciTexture;
 extern StructRNA RNA_SubsurfModifier;
 extern StructRNA RNA_SunLamp;
 extern StructRNA RNA_SurfaceCurve;
+extern StructRNA RNA_SurfaceModifier;
 extern StructRNA RNA_TexMapping;
 extern StructRNA RNA_Text;
 extern StructRNA RNA_TextBox;
index 4e047ff77720ffaef5d32e794ace7b11a59d34c0..4316666700f0de5c78381c13c7a2d60989fb77b8 100644 (file)
 
 #include "DNA_object_fluidsim.h"
 
+#include "WM_api.h"
+#include "WM_types.h"
+
 #ifdef RNA_RUNTIME
 
+#include "MEM_guardedalloc.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_particle_types.h"
+
+#include "BKE_depsgraph.h"
+#include "BKE_fluidsim.h"
+#include "BKE_main.h"
+#include "BKE_modifier.h"
+#include "BKE_particle.h"
+#include "BKE_pointcache.h"
+
 static StructRNA* rna_FluidSettings_refine(struct PointerRNA *ptr)
 {
        FluidsimSettings *fss= (FluidsimSettings*)ptr->data;
@@ -57,6 +72,75 @@ static StructRNA* rna_FluidSettings_refine(struct PointerRNA *ptr)
        }
 }
 
+static void rna_FluidSettings_update_type(bContext *C, PointerRNA *ptr)
+{
+       Main *bmain= CTX_data_main(C);
+       Scene *scene= CTX_data_scene(C);
+       Object *ob= (Object*)ptr->id.data;
+       FluidsimModifierData *fluidmd;
+       ParticleSystemModifierData *psmd;
+       ParticleSystem *psys;
+       ParticleSettings *part;
+       
+       fluidmd= (FluidsimModifierData*)modifiers_findByType(ob, eModifierType_Fluidsim);
+       fluidmd->fss->flag &= ~OB_FLUIDSIM_REVERSE; // clear flag
+
+       /* remove fluidsim particle system */
+       if(fluidmd->fss->type & OB_FLUIDSIM_PARTICLE) {
+               for(psys=ob->particlesystem.first; psys; psys=psys->next)
+                       if(psys->part->type == PART_FLUID)
+                               break;
+
+               if(ob->type == OB_MESH && !psys) {
+                       /* add particle system */
+                       part= psys_new_settings("PSys", bmain);
+                       psys= MEM_callocN(sizeof(ParticleSystem), "particle_system");
+
+                       part->type= PART_FLUID;
+                       psys->part= part;
+                       psys->pointcache= BKE_ptcache_add();
+                       psys->flag |= PSYS_ENABLED;
+                       BLI_addtail(&ob->particlesystem,psys);
+
+                       /* add modifier */
+                       psmd= (ParticleSystemModifierData*)modifier_new(eModifierType_ParticleSystem);
+                       sprintf(psmd->modifier.name, "FluidParticleSystem" );
+                       psmd->psys= psys;
+                       BLI_addtail(&ob->modifiers, psmd);
+               }
+       }
+       else {
+               for(psys=ob->particlesystem.first; psys; psys=psys->next) {
+                       if(psys->part->type == PART_FLUID) {
+                               /* clear modifier */
+                               psmd= psys_get_modifier(ob, psys);
+                               BLI_remlink(&ob->modifiers, psmd);
+                               modifier_free((ModifierData *)psmd);
+
+                               /* clear particle system */
+                               BLI_remlink(&ob->particlesystem, psys);
+                               psys_free(ob, psys);
+                       }
+               }
+       }
+
+       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+}
+
+static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *value)
+{
+       Object *ob= (Object*)ptr->id.data;
+       FluidsimSettings *fss= (FluidsimSettings*)ptr->data;
+
+       fluid_estimate_memory(ob, fss, value);
+}
+
+static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *ptr)
+{
+       return 32;
+}
+
 #else
 
 static void rna_def_fluidsim_slip(StructRNA *srna)
@@ -128,6 +212,7 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna)
        RNA_def_property_enum_sdna(prop, NULL, "guiDisplayMode");
        RNA_def_property_enum_items(prop, quality_items);
        RNA_def_property_ui_text(prop, "Viewport Display Mode", "How to display the mesh in the viewport.");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
 
        prop= RNA_def_property(srna, "render_display_mode", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "renderDisplayMode");
@@ -142,6 +227,12 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna)
        RNA_def_property_string_maxlength(prop, 240);
        RNA_def_property_string_sdna(prop, NULL, "surfdataPath");
        RNA_def_property_ui_text(prop, "Path", "Directory (and/or filename prefix) to store baked fluid simulation files in.");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
+
+       prop= RNA_def_property(srna, "memory_estimate", PROP_STRING, PROP_NONE);
+       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+       RNA_def_property_string_funcs(prop, "rna_DomainFluidSettings_memory_estimate_get", "rna_DomainFluidSettings_memory_estimate_length", NULL);
+       RNA_def_property_ui_text(prop, "Memory Estimate", "Estimated amount of memory needed for baking the domain.");
 
        /* advanced settings */
 
@@ -336,6 +427,7 @@ static void rna_def_fluidsim_particle(BlenderRNA *brna)
        RNA_def_property_string_maxlength(prop, 240);
        RNA_def_property_string_sdna(prop, NULL, "surfdataPath");
        RNA_def_property_ui_text(prop, "Path", "Directory (and/or filename prefix) to store and load particles from.");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
 }
 
 static void rna_def_fluidsim_control(BlenderRNA *brna)
@@ -393,7 +485,7 @@ void RNA_def_fluidsim(BlenderRNA *brna)
        PropertyRNA *prop;
 
        static EnumPropertyItem prop_fluid_type_items[] = {
-               {0, "NONE", 0, "None", ""},
+               {OB_FLUIDSIM_ENABLE, "NONE", 0, "None", ""},
                {OB_FLUIDSIM_DOMAIN, "DOMAIN", 0, "Domain", "Bounding box of this object represents the computational domain of the fluid simulation."},
                {OB_FLUIDSIM_FLUID, "FLUID", 0, "Fluid", "Object represents a volume of fluid in the simulation."},
                {OB_FLUIDSIM_OBSTACLE, "OBSTACLE", 0, "Obstacle", "Object is a fixed obstacle."},
@@ -409,18 +501,11 @@ void RNA_def_fluidsim(BlenderRNA *brna)
        RNA_def_struct_refine_func(srna, "rna_FluidSettings_refine");
        RNA_def_struct_ui_text(srna, "Fluid Simulation Settings", "Fluid simulation settings for an object taking part in the simulation.");
 
-       /* enable and type */
-
-       prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "type", OB_FLUIDSIM_ENABLE);
-       RNA_def_property_clear_flag(prop, PROP_EDITABLE); // needs to create modifier
-       RNA_def_property_ui_text(prop, "Enabled", "Sets object to participate in fluid simulation.");
-
        prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_bitflag_sdna(prop, NULL, "type");
        RNA_def_property_enum_items(prop, prop_fluid_type_items);
-       RNA_def_property_clear_flag(prop, PROP_EDITABLE); // needs to update variables
        RNA_def_property_ui_text(prop, "Type", "Type of participation in the fluid simulation.");
+       RNA_def_property_update(prop, 0, "rna_FluidSettings_update_type");
 
        //prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE);
        //RNA_def_property_ui_text(prop, "Ipo Curves", "Ipo curves used by fluid simulation settings.");
index 3d66682771dd7b3616dcbc947f1689c87244722b..084d05db51ed975499a5ba9fdfc4717e0bec529c 100644 (file)
@@ -185,6 +185,9 @@ void rna_object_vgroup_name_set(struct PointerRNA *ptr, const char *value, char
 void rna_object_uvlayer_name_set(struct PointerRNA *ptr, const char *value, char *result, int maxlen);
 void rna_object_vcollayer_name_set(struct PointerRNA *ptr, const char *value, char *result, int maxlen);
 
+void rna_Object_update(struct bContext *C, struct PointerRNA *ptr);
+void rna_Object_update_data(struct bContext *C, struct PointerRNA *ptr);
+
 /* API functions */
 
 void RNA_api_main(struct StructRNA *srna);
index 9b3ff6e74a0de88867948393d96fc82884d3ccb7..48bfdf70171a69421d691e86b2dc28f32d1f9743 100644 (file)
@@ -66,8 +66,9 @@ EnumPropertyItem modifier_type_items[] ={
        {eModifierType_Shrinkwrap, "SHRINKWRAP", ICON_MOD_SHRINKWRAP, "Shrinkwrap", ""},
        {eModifierType_SimpleDeform, "SIMPLE_DEFORM", ICON_MOD_SIMPLEDEFORM, "Simple Deform", ""},
        {eModifierType_Smooth, "SMOOTH", ICON_MOD_SMOOTH, "Smooth", ""},
-       {eModifierType_Softbody, "SOFTBODY", ICON_MOD_SOFT, "Softbody", ""},
+       {eModifierType_Softbody, "SOFTBODY", ICON_MOD_SOFT, "Soft Body", ""},
        {eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subsurf", ""},
+       {eModifierType_Surface, "SURFACE", ICON_MOD_PHYSICS, "Surface", ""},
        {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""},
        {eModifierType_Wave, "WAVE", ICON_MOD_WAVE, "Wave", ""},
        {0, NULL, 0, NULL, NULL}};
@@ -109,7 +110,7 @@ static StructRNA* rna_Modifier_refine(struct PointerRNA *ptr)
                case eModifierType_Hook:
                        return &RNA_HookModifier;
                case eModifierType_Softbody:
-                       return &RNA_SoftbodyModifier;
+                       return &RNA_SoftBodyModifier;
                case eModifierType_Boolean:
                        return &RNA_BooleanModifier;
                case eModifierType_Array:
@@ -148,6 +149,8 @@ static StructRNA* rna_Modifier_refine(struct PointerRNA *ptr)
                        return &RNA_SimpleDeformModifier;
                case eModifierType_Multires:
                        return &RNA_MultiresModifier;
+               case eModifierType_Surface:
+                       return &RNA_SurfaceModifier;
                default:
                        return &RNA_Modifier;
        }
@@ -348,6 +351,18 @@ static void rna_ArrayModifier_curve_set(PointerRNA *ptr, PointerRNA value)
        modifier_object_set(&((ArrayModifierData*)ptr->data)->curve_ob, OB_CURVE, value);
 }
 
+static PointerRNA rna_SoftBodyModifier_settings_get(PointerRNA *ptr)
+{
+       Object *ob= (Object*)ptr->id.data;
+       return rna_pointer_inherit_refine(ptr, &RNA_SoftBodySettings, ob->soft);
+}
+
+static PointerRNA rna_CollisionModifier_settings_get(PointerRNA *ptr)
+{
+       Object *ob= (Object*)ptr->id.data;
+       return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd);
+}
+
 #else
 
 static void rna_def_property_subdivision_common(StructRNA *srna, const char type[])
@@ -831,11 +846,17 @@ static void rna_def_modifier_hook(BlenderRNA *brna)
 static void rna_def_modifier_softbody(BlenderRNA *brna)
 {
        StructRNA *srna;
+       PropertyRNA *prop;
 
-       srna= RNA_def_struct(brna, "SoftbodyModifier", "Modifier");
-       RNA_def_struct_ui_text(srna, "Softbody Modifier", "Softbody simulation modifier.");
+       srna= RNA_def_struct(brna, "SoftBodyModifier", "Modifier");
+       RNA_def_struct_ui_text(srna, "Soft Body Modifier", "Soft body simulation modifier.");
        RNA_def_struct_sdna(srna, "SoftbodyModifierData");
        RNA_def_struct_ui_icon(srna, ICON_MOD_SOFT);
+
+       prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NEVER_NULL);
+       RNA_def_property_struct_type(prop, "SoftBodySettings");
+       RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_settings_get", NULL, NULL);
+       RNA_def_property_ui_text(prop, "Soft Body Settings", "");
 }
 
 static void rna_def_modifier_boolean(BlenderRNA *brna)
@@ -1398,6 +1419,11 @@ static void rna_def_modifier_collision(BlenderRNA *brna)
        RNA_def_struct_ui_text(srna, "Collision Modifier", "Collision modifier defining modifier stack position used for collision.");
        RNA_def_struct_sdna(srna, "CollisionModifierData");
        RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
+
+       prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NEVER_NULL);
+       RNA_def_property_struct_type(prop, "CollisionSettings");
+       RNA_def_property_pointer_funcs(prop, "rna_CollisionModifier_settings_get", NULL, NULL);
+       RNA_def_property_ui_text(prop, "Settings", "");
        
        prop= RNA_def_property(srna, "absorption", PROP_INT, PROP_PERCENTAGE);
        RNA_def_property_int_sdna(prop, NULL, "absorption");
@@ -1672,6 +1698,16 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna)
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
 }
 
+static void rna_def_modifier_surface(BlenderRNA *brna)
+{
+       StructRNA *srna;
+
+       srna= RNA_def_struct(brna, "SurfaceModifier", "Modifier");
+       RNA_def_struct_ui_text(srna, "Surface Modifier", "Surface modifier defining modifier stack position used for surface fields.");
+       RNA_def_struct_sdna(srna, "SurfaceModifierData");
+       RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
+}
+
 void RNA_def_modifier(BlenderRNA *brna)
 {
        StructRNA *srna;
@@ -1701,15 +1737,18 @@ void RNA_def_modifier(BlenderRNA *brna)
        RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Realtime);
        RNA_def_property_ui_text(prop, "Realtime", "Realtime display of a modifier.");
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
+       RNA_def_property_ui_icon(prop, ICON_VIEW3D, 0);
        
        prop= RNA_def_property(srna, "render", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Render);
        RNA_def_property_ui_text(prop, "Render", "Use modifier during rendering.");
+       RNA_def_property_ui_icon(prop, ICON_SCENE, 0);
        
        prop= RNA_def_property(srna, "editmode", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Editmode);
        RNA_def_property_ui_text(prop, "Editmode", "Use modifier while in the edit mode.");
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
+       RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
        
        prop= RNA_def_property(srna, "on_cage", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_OnCage);
@@ -1751,6 +1790,7 @@ void RNA_def_modifier(BlenderRNA *brna)
        rna_def_modifier_mask(brna);
        rna_def_modifier_simpledeform(brna);
        rna_def_modifier_multires(brna);
+       rna_def_modifier_surface(brna);
 }
 
 #endif
index 947846f8d8d409727c7ba64a8f60abf6e80e5643..bf2a2c0ba404b83d3e67ceecee0e0d0d8cd29d19 100644 (file)
 #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);
index 4d8c728db1218099aa6dc6a821320463c6f6d16d..45a9dc448750d0dbdffbdf5025956f9e54e95473 100644 (file)
 #include "DNA_object_force.h"
 #include "DNA_scene_types.h"
 
+#include "WM_api.h"
 #include "WM_types.h"
 
 #ifdef RNA_RUNTIME
 
 #include "MEM_guardedalloc.h"
 
+#include "DNA_modifier_types.h"
+#include "DNA_texture_types.h"
+
 #include "BKE_context.h"
+#include "BKE_modifier.h"
 #include "BKE_pointcache.h"
 #include "BKE_depsgraph.h"
 
 #include "BLI_blenlib.h"
 
+#include "ED_object.h"
+
 static void rna_Cache_change(bContext *C, PointerRNA *ptr)
 {
        Scene *scene = CTX_data_scene(C);
@@ -209,21 +216,6 @@ static void rna_SoftBodySettings_new_aero_set(PointerRNA *ptr, int value)
        else data->softflag &= ~OB_SB_AERO_ANGLE;
 }
 
-static int rna_SoftBodySettings_enabled_get(PointerRNA *ptr)
-{
-       Object *data= (Object*)(ptr->data);
-       return (((data->softflag) & OB_SB_ENABLE) != 0);
-}
-
-#if 0
-static void rna_SoftBodySettings_enabled_set(PointerRNA *ptr, int value)
-{
-       Object *data= (Object*)(ptr->data);
-       if(value) data->softflag |= OB_SB_ENABLE;
-       else data->softflag &= ~OB_SB_ENABLE;
-}
-#endif
-
 static int rna_SoftBodySettings_face_collision_get(PointerRNA *ptr)
 {
        Object *data= (Object*)(ptr->data);
@@ -250,6 +242,108 @@ static void rna_SoftBodySettings_edge_collision_set(PointerRNA *ptr, int value)
        else data->softflag &= ~OB_SB_EDGECOLL;
 }
 
+static void rna_SoftBodySettings_goal_vgroup_get(PointerRNA *ptr, char *value)
+{
+       SoftBody *sb= (SoftBody*)ptr->data;
+       rna_object_vgroup_name_index_get(ptr, value, sb->vertgroup);
+}
+
+static int rna_SoftBodySettings_goal_vgroup_length(PointerRNA *ptr)
+{
+       SoftBody *sb= (SoftBody*)ptr->data;
+       return rna_object_vgroup_name_index_length(ptr, sb->vertgroup);
+}
+
+static void rna_SoftBodySettings_goal_vgroup_set(PointerRNA *ptr, const char *value)
+{
+       SoftBody *sb= (SoftBody*)ptr->data;
+       rna_object_vgroup_name_index_set(ptr, value, &sb->vertgroup);
+}
+
+static void rna_FieldSettings_update(bContext *C, PointerRNA *ptr)
+{
+       Scene *scene= CTX_data_scene(C);
+       Object *ob= (Object*)ptr->id.data;
+
+       if(ob->pd->forcefield != PFIELD_TEXTURE && ob->pd->tex) {
+               ob->pd->tex->id.us--;
+               ob->pd->tex= 0;
+       }
+
+       DAG_object_flush_update(scene, ob, OB_RECALC_OB);
+       WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+}
+
+static void rna_FieldSettings_surface_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(ELEM5(pd->forcefield,PFIELD_HARMONIC,PFIELD_FORCE,PFIELD_HARMONIC,PFIELD_CHARGE,PFIELD_LENNARDJ))
+                               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);
+       }
+
+       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
+       }*/
+
+       rna_FieldSettings_surface_update(C, ptr);
+
+       DAG_scene_sort(scene);
+
+       if(ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE)
+               DAG_object_flush_update(scene, ob, OB_RECALC);
+       else
+               DAG_object_flush_update(scene, ob, OB_RECALC_OB);
+
+       WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+}
+
+static void rna_CollisionSettings_dependency_update(bContext *C, PointerRNA *ptr)
+{
+       Scene *scene= CTX_data_scene(C);
+       Object *ob= (Object*)ptr->id.data;
+       ModifierData *md= modifiers_findByType(ob, eModifierType_Collision);
+
+       /* add/remove modifier as needed */
+       if(ob->pd->deflect && !md)
+               ED_object_modifier_add(NULL, scene, ob, eModifierType_Collision);
+       else if(!ob->pd->deflect && md)
+               ED_object_modifier_remove(NULL, scene, ob, md);
+
+       WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+}
+
+static void rna_CollisionSettings_update(bContext *C, PointerRNA *ptr)
+{
+       Scene *scene= CTX_data_scene(C);
+       Object *ob= (Object*)ptr->id.data;
+
+       DAG_object_flush_update(scene, ob, OB_RECALC);
+       WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+}
+
 #else
 
 static void rna_def_pointcache(BlenderRNA *brna)
@@ -279,9 +373,11 @@ static void rna_def_pointcache(BlenderRNA *brna)
        /* flags */
        prop= RNA_def_property(srna, "baked", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKED);
+       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop= RNA_def_property(srna, "baking", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKING);
+       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop= RNA_def_property(srna, "disk_cache", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_DISK_CACHE);
@@ -325,6 +421,7 @@ static void rna_def_collision(BlenderRNA *brna)
        prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "deflect", 1);
        RNA_def_property_ui_text(prop, "Enabled", "Enable this objects as a collider for physics systems");
+       RNA_def_property_update(prop, 0, "rna_CollisionSettings_dependency_update");
        
        /* Particle Interaction */
        
@@ -332,30 +429,36 @@ static void rna_def_collision(BlenderRNA *brna)
        RNA_def_property_float_sdna(prop, NULL, "pdef_damp");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Damping Factor", "Amount of damping during particle collision");
+       RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
        
        prop= RNA_def_property(srna, "random_damping", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "pdef_rdamp");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Random Damping", "Random variation of damping");
+       RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
        
        prop= RNA_def_property(srna, "friction_factor", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "pdef_frict");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Friction Factor", "Amount of friction during particle collision");
+       RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
        
        prop= RNA_def_property(srna, "random_friction", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "pdef_rfrict");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Random Friction", "Random variation of friction");
+       RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
                
        prop= RNA_def_property(srna, "permeability", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "pdef_perm");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Permeability", "Chance that the particle will pass through the mesh");
+       RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
        
        prop= RNA_def_property(srna, "kill_particles", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", PDEFLE_KILL_PART);
        RNA_def_property_ui_text(prop, "Kill Particles", "Kill collided particles");
+       RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
        
        /* Soft Body and Cloth Interaction */
        
@@ -363,21 +466,25 @@ static void rna_def_collision(BlenderRNA *brna)
        RNA_def_property_float_sdna(prop, NULL, "pdef_sbift");
        RNA_def_property_range(prop, 0.001f, 1.0f);
        RNA_def_property_ui_text(prop, "Inner Thickness", "Inner face thickness");
+       RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
        
        prop= RNA_def_property(srna, "outer_thickness", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "pdef_sboft");
        RNA_def_property_range(prop, 0.001f, 1.0f);
        RNA_def_property_ui_text(prop, "Outer Thickness", "Outer face thickness");
+       RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
        
        prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "pdef_sbdamp");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Damping", "Amount of damping during collision");
+       RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
        
        /* Does this belong here?
        prop= RNA_def_property(srna, "collision_stack", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "softflag", OB_SB_COLLFINAL);
        RNA_def_property_ui_text(prop, "Collision from Stack", "Pick collision object from modifier stack (softbody only)");
+       RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
        */
 }
 
@@ -418,20 +525,23 @@ static void rna_def_field(BlenderRNA *brna)
        
        /* Enums */
        
-       prop= RNA_def_property(srna, "field_type", PROP_ENUM, PROP_NONE);
+       prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "forcefield");
        RNA_def_property_enum_items(prop, field_type_items);
-       RNA_def_property_ui_text(prop, "Field Type", "Choose Field Type");
+       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, "falloff_type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "falloff");
        RNA_def_property_enum_items(prop, falloff_items);
-       RNA_def_property_ui_text(prop, "Fall-Off", "Fall-Off Shape");
+       RNA_def_property_ui_text(prop, "Fall-Off", "Fall-off shape.");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
        
        prop= RNA_def_property(srna, "texture_mode", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "tex_mode");
        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");
        
        /* Float */
        
@@ -439,103 +549,125 @@ static void rna_def_field(BlenderRNA *brna)
        RNA_def_property_float_sdna(prop, NULL, "f_strength");
        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)");
+       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");
        
        prop= RNA_def_property(srna, "minimum_distance", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "mindist");
        RNA_def_property_range(prop, 0.0f, 1000.0f);
        RNA_def_property_ui_text(prop, "Minimum Distance", "Minimum distance for the field's fall-off");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
        
        prop= RNA_def_property(srna, "maximum_distance", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "maxdist");
        RNA_def_property_range(prop, 0.0f, 1000.0f);
        RNA_def_property_ui_text(prop, "Maximum Distance", "Maximum distance for the field to work");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
        
        prop= RNA_def_property(srna, "radial_minimum", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "minrad");
        RNA_def_property_range(prop, 0.0f, 1000.0f);
        RNA_def_property_ui_text(prop, "Minimum Radial Distance", "Minimum radial distance for the field's fall-off");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
        
        prop= RNA_def_property(srna, "radial_maximum", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "maxrad");
        RNA_def_property_range(prop, 0.0f, 1000.0f);
        RNA_def_property_ui_text(prop, "Maximum Radial Distance", "Maximum radial distance for the field to work");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
        
        prop= RNA_def_property(srna, "radial_falloff", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "f_power_r");
        RNA_def_property_range(prop, 0.0f, 10.0f);
        RNA_def_property_ui_text(prop, "Radial Falloff Power", "Radial falloff power (real gravitational falloff = 2)");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
        prop= RNA_def_property(srna, "texture_nabla", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "tex_nabla");
        RNA_def_property_range(prop, 0.0001f, 1.0f);
        RNA_def_property_ui_text(prop, "Nabla", "Defines size of derivative offset used for calculating gradient and curl");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
        
        prop= RNA_def_property(srna, "noise", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "f_noise");
        RNA_def_property_range(prop, 0.0f, 10.0f);
        RNA_def_property_ui_text(prop, "Noise", "Noise of the wind force");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
        prop= RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
        RNA_def_property_range(prop, 1, 128);
        RNA_def_property_ui_text(prop, "Seed", "Seed of the wind noise");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
        /* Boolean */
        
        prop= RNA_def_property(srna, "use_min_distance", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMIN);
        RNA_def_property_ui_text(prop, "Use Min", "Use a minimum distance for the field's fall-off");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
        
        prop= RNA_def_property(srna, "use_max_distance", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMAX);
        RNA_def_property_ui_text(prop, "Use Max", "Use a maximum distance for the field to work");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
        
        prop= RNA_def_property(srna, "use_radial_min", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMINR);
        RNA_def_property_ui_text(prop, "Use Min", "Use a minimum radial distance for the field's fall-off");
        // "Use a minimum angle for the field's fall-off"
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
        
        prop= RNA_def_property(srna, "use_radial_max", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMAXR);
        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, "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, "force_2d", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_2D);
        RNA_def_property_ui_text(prop, "2D", "Apply force only in 2d");
+       RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
        
        prop= RNA_def_property(srna, "root_coordinates", PROP_BOOLEAN, PROP_NONE);
        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");
        
        /* Pointer */
        
@@ -543,6 +675,7 @@ static void rna_def_field(BlenderRNA *brna)
        RNA_def_property_pointer_sdna(prop, NULL, "tex");
        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");
 }
 
 static void rna_def_game_softbody(BlenderRNA *brna)
@@ -561,9 +694,9 @@ static void rna_def_softbody(BlenderRNA *brna)
        
        static EnumPropertyItem collision_type_items[] = {
                {SBC_MODE_MANUAL, "MANUAL", 0, "Manual", "Manual adjust"},
-               {SBC_MODE_AVG, "AVERAGE", 0, "Average", "Average Spring lenght * Ball Size"},
-               {SBC_MODE_MIN, "MINIMAL", 0, "Minimal", "Minimal Spring lenght * Ball Size"},
-               {SBC_MODE_MAX, "MAXIMAL", 0, "Maximal", "Maximal Spring lenght * Ball Size"},
+               {SBC_MODE_AVG, "AVERAGE", 0, "Average", "Average Spring length * Ball Size"},
+               {SBC_MODE_MIN, "MINIMAL", 0, "Minimal", "Minimal Spring length * Ball Size"},
+               {SBC_MODE_MAX, "MAXIMAL", 0, "Maximal", "Maximal Spring length * Ball Size"},
                {SBC_MODE_AVGMINMAX, "MINMAX", 0, "AvMinMax", "(Min+Max)/2 * Ball Size"},
                {0, NULL, 0, NULL, NULL}};
 
@@ -577,52 +710,62 @@ static void rna_def_softbody(BlenderRNA *brna)
        RNA_def_property_float_sdna(prop, NULL, "mediafrict");
        RNA_def_property_range(prop, 0.0f, 50.0f);
        RNA_def_property_ui_text(prop, "Friction", "General media friction for point movements");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "nodemass");
        RNA_def_property_range(prop, 0.0f, 50000.0f);
        RNA_def_property_ui_text(prop, "Mass", "");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "grav");
        RNA_def_property_range(prop, -10.0f, 10.0f);
        RNA_def_property_ui_text(prop, "Gravitation", "Apply gravitation to point movement");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "physics_speed");
        RNA_def_property_range(prop, 0.01f, 100.0f);
        RNA_def_property_ui_text(prop, "Speed", "Tweak timing for physics to control frequency and speed");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        /* Goal */
        
-       /*prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+       prop= RNA_def_property(srna, "goal_vertex_group", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "vertgroup");
-       RNA_def_property_ui_text(prop, "Vertex Group", "Use control point weight values");*/
+       RNA_def_property_string_funcs(prop, "rna_SoftBodySettings_goal_vgroup_get", "rna_SoftBodySettings_goal_vgroup_length", "rna_SoftBodySettings_goal_vgroup_set");
+       RNA_def_property_ui_text(prop, "Goal Vertex Group", "Control point weight values.");
        
        prop= RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "mingoal");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Goal Minimum", "Goal minimum, vertex group weights are scaled to match this range.");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
 
        prop= RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "maxgoal");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Goal Maximum", "Goal maximum, vertex group weights are scaled to match this range.");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
 
        prop= RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "defgoal");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Goal Default", "Default Goal (vertex target position) value, when no Vertex Group used.");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "goalspring");
        RNA_def_property_range(prop, 0.0f, 0.999f);
        RNA_def_property_ui_text(prop, "Goal Stiffness", "Goal (vertex target position) spring stiffness.");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "goal_friction", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "goalfrict");
        RNA_def_property_range(prop, 0.0f, 50.0f);
        RNA_def_property_ui_text(prop, "Goal Damping", "Goal (vertex target position) friction.");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        /* Edge Spring Settings */
        
@@ -630,36 +773,43 @@ static void rna_def_softbody(BlenderRNA *brna)
        RNA_def_property_float_sdna(prop, NULL, "inspring");
        RNA_def_property_range(prop, 0.0f, 0.999f);
        RNA_def_property_ui_text(prop, "Pull", "Edge spring stiffness when longer than rest length");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "push", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "inpush");
        RNA_def_property_range(prop, 0.0f, 0.999f);
        RNA_def_property_ui_text(prop, "Push", "Edge spring stiffness when shorter than rest length");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "damp", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "infrict");
        RNA_def_property_range(prop, 0.0f, 50.0f);
        RNA_def_property_ui_text(prop, "Damp", "Edge spring friction");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
-       prop= RNA_def_property(srna, "spring_lenght", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "spring_length", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "springpreload");
        RNA_def_property_range(prop, 0.0f, 200.0f);
-       RNA_def_property_ui_text(prop, "SL", "Alter spring lenght to shrink/blow up (unit %) 0 to disable");
+       RNA_def_property_ui_text(prop, "SL", "Alter spring length to shrink/blow up (unit %) 0 to disable");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "aero", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "aeroedge");
        RNA_def_property_range(prop, 0.0f, 30000.0f);
        RNA_def_property_ui_text(prop, "Aero", "Make edges 'sail'");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "plastic", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "plastic");
        RNA_def_property_range(prop, 0.0f, 100.0f);
        RNA_def_property_ui_text(prop, "Plastic", "Permanent deform");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "bending", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "secondspring");
        RNA_def_property_range(prop, 0.0f, 10.0f);
        RNA_def_property_ui_text(prop, "Bending", "Bending Stiffness");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "shear", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "shearstiff");
@@ -672,21 +822,25 @@ static void rna_def_softbody(BlenderRNA *brna)
        RNA_def_property_enum_sdna(prop, NULL, "sbc_mode");
        RNA_def_property_enum_items(prop, collision_type_items);
        RNA_def_property_ui_text(prop, "Collision Type", "Choose Collision Type");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "ball_size", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "colball");
        RNA_def_property_range(prop, -10.0f, 10.0f);
        RNA_def_property_ui_text(prop, "Ball Size", "Absolute ball size or factor if not manual adjusted");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "ball_stiff", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "ballstiff");
        RNA_def_property_range(prop, 0.001f, 100.0f);
        RNA_def_property_ui_text(prop, "Ball Size", "Ball inflating presure");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "ball_damp", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "balldamp");
        RNA_def_property_range(prop, 0.001f, 1.0f);
        RNA_def_property_ui_text(prop, "Ball Size", "Blending to inelastic collision");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        /* Solver */
        
@@ -694,30 +848,36 @@ static void rna_def_softbody(BlenderRNA *brna)
        RNA_def_property_float_sdna(prop, NULL, "rklimit");
        RNA_def_property_range(prop, 0.001f, 10.0f);
        RNA_def_property_ui_text(prop, "Error Limit", "The Runge-Kutta ODE solver error limit, low value gives more precision, high values speed");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "minstep", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "minloops");
        RNA_def_property_range(prop, 0, 30000);
        RNA_def_property_ui_text(prop, "Min Step", "Minimal # solver steps/frame");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "maxstep", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "maxloops");
        RNA_def_property_range(prop, 0, 30000);
        RNA_def_property_ui_text(prop, "Max Step", "Maximal # solver steps/frame");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "choke", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "choke");
        RNA_def_property_range(prop, 0, 100);
        RNA_def_property_ui_text(prop, "Choke", "'Viscosity' inside collision target");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "fuzzy", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "fuzzyness");
        RNA_def_property_range(prop, 1, 100);
        RNA_def_property_ui_text(prop, "Fuzzy", "Fuzzyness while on collision, high values make collsion handling faster but less stable");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "auto_step", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_OLDERR);
        RNA_def_property_ui_text(prop, "V", "Use velocities for automagic step sizes");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "diagnose", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_MONITOR);
@@ -725,38 +885,40 @@ static void rna_def_softbody(BlenderRNA *brna)
        
        /* Flags */
        
-       prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_enabled_get", "rna_SoftBodySettings_enabled_set");
-       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-       RNA_def_property_ui_text(prop, "Enable", "Sets object to become soft body.");
-       
        prop= RNA_def_property(srna, "use_goal", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_use_goal_get", "rna_SoftBodySettings_use_goal_set");
        RNA_def_property_ui_text(prop, "Use Goal", "Define forces for vertices to stick to animated position.");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "use_edges", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_use_edges_get", "rna_SoftBodySettings_use_edges_set");
        RNA_def_property_ui_text(prop, "Use Edges", "Use Edges as springs");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "stiff_quads", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_stiff_quads_get", "rna_SoftBodySettings_stiff_quads_set");
        RNA_def_property_ui_text(prop, "Stiff Quads", "Adds diagonal springs on 4-gons.");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "edge_collision", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_edge_collision_get", "rna_SoftBodySettings_edge_collision_set");
        RNA_def_property_ui_text(prop, "Edge Collision", "Edges collide too.");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "face_collision", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_face_collision_get", "rna_SoftBodySettings_face_collision_set");
        RNA_def_property_ui_text(prop, "Face Collision", "Faces collide too, SLOOOOOW warning.");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "new_aero", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_new_aero_get", "rna_SoftBodySettings_new_aero_set");
        RNA_def_property_ui_text(prop, "N", "New aero(uses angle and length).");
+       RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
        
        prop= RNA_def_property(srna, "self_collision", PROP_BOOLEAN, PROP_NONE);
        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, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
 }
 
 void RNA_def_object_force(BlenderRNA *brna)
index 3df3fad3f15c5bcf371531895c7ea790cf729693..363891e0f24537741ae572f2b5c938382b9ad3b9 100644 (file)
@@ -130,11 +130,11 @@ void RNA_api_ui_layout(StructRNA *srna)
        api_ui_item_common(func);
        api_ui_item_rna_common(func);
 
-       /*func= RNA_def_function(srna, "item_enumR", "uiItemEnumR");
+       func= RNA_def_function(srna, "item_enumR", "uiItemEnumR_string");
        api_ui_item_common(func);
        api_ui_item_rna_common(func);
        parm= RNA_def_string(func, "value", "", 0, "", "Enum property value.");
-       RNA_def_property_flag(parm, PROP_REQUIRED);*/
+       RNA_def_property_flag(parm, PROP_REQUIRED);
 
        func= RNA_def_function(srna, "item_pointerR", "uiItemPointerR");
        api_ui_item_common(func);