diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-07-03 05:57:38 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-07-03 05:57:38 +0400 |
commit | 5e92ddece3a7367ca7687e762226d639389e5517 (patch) | |
tree | ba8437a82874057138ff5e9f07b446fa6d2ff044 /source/blender/makesrna | |
parent | 28d371d1178642e17f5dfc300f1500a132ce7149 (diff) | |
parent | fb5f9273eba4b30e1aa0573388367592b18bdbba (diff) |
NLA SoC: Merge from 2.5
21301 to 21329
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/CMakeLists.txt | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fluidsim.c | 107 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 48 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 29 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_force.c | 222 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_screen.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 4 |
9 files changed, 373 insertions, 48 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 0673521505f..55084d7537c 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -364,7 +364,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; @@ -388,6 +388,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; diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 963e4f9aeff..3400b69ee38 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -62,6 +62,10 @@ IF(WITH_FFMPEG) ADD_DEFINITIONS(-DWITH_FFMPEG) ENDIF(WITH_FFMPEG) +IF(NOT WITH_ELBEEM) + ADD_DEFINITIONS(-DDISABLE_ELBEEM) +ENDIF(NOT WITH_ELBEEM) + # Build makesrna executable ADD_EXECUTABLE(makesrna ${SRC} ${INC_FILES}) TARGET_LINK_LIBRARIES(makesrna bf_dna) diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index 4e047ff7772..44a50fbae25 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -31,8 +31,23 @@ #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,79 @@ 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) +{ +#ifdef DISABLE_ELBEEM + value[0]= '\0'; +#else + Object *ob= (Object*)ptr->id.data; + FluidsimSettings *fss= (FluidsimSettings*)ptr->data; + + fluid_estimate_memory(ob, fss, value); +#endif +} + +static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *ptr) +{ + return 32; +} + #else static void rna_def_fluidsim_slip(StructRNA *srna) @@ -128,6 +216,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 +231,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 +431,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 +489,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 +505,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."); diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 5b8e7c76636..6a5d5ccfdc3 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -186,6 +186,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); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 9b3ff6e74a0..48bfdf70171 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -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 diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 2be0d115dc9..ca2c9d072fb 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -48,17 +48,18 @@ #include "BKE_context.h" #include "BKE_curve.h" #include "BKE_depsgraph.h" +#include "BKE_effect.h" #include "BKE_key.h" #include "BKE_material.h" #include "BKE_mesh.h" #include "BKE_particle.h" -static void rna_Object_update(bContext *C, PointerRNA *ptr) +void rna_Object_update(bContext *C, PointerRNA *ptr) { DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB); } -static void rna_Object_update_data(bContext *C, PointerRNA *ptr) +void rna_Object_update_data(bContext *C, PointerRNA *ptr) { DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_DATA); } @@ -456,6 +457,28 @@ static void rna_Object_shape_key_lock_set(PointerRNA *ptr, int value) ob->shapeflag &= ~OB_SHAPE_TEMPLOCK; } +static PointerRNA rna_Object_field_get(PointerRNA *ptr) +{ + Object *ob= (Object*)ptr->id.data; + + /* weak */ + if(!ob->pd) + ob->pd= object_add_collision_fields(); + + return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, ob->pd); +} + +static PointerRNA rna_Object_collision_get(PointerRNA *ptr) +{ + Object *ob= (Object*)ptr->id.data; + + /* weak */ + if(!ob->pd) + ob->pd= object_add_collision_fields(); + + return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd); +} + #else static void rna_def_vertex_group(BlenderRNA *brna) @@ -1006,11 +1029,13 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "field", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "pd"); RNA_def_property_struct_type(prop, "FieldSettings"); + RNA_def_property_pointer_funcs(prop, "rna_Object_field_get", NULL, NULL); RNA_def_property_ui_text(prop, "Field Settings", "Settings for using the objects as a field in physics simulation."); prop= RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "pd"); RNA_def_property_struct_type(prop, "CollisionSettings"); + RNA_def_property_pointer_funcs(prop, "rna_Object_collision_get", NULL, NULL); RNA_def_property_ui_text(prop, "Collision Settings", "Settings for using the objects as a collider in physics simulation."); prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 4d8c728db12..45a9dc44875 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -33,18 +33,25 @@ #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) diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index a4ba6ec172b..fb836a98a52 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -36,6 +36,7 @@ EnumPropertyItem region_type_items[] = { {RGN_TYPE_WINDOW, "WINDOW", 0, "Window", ""}, {RGN_TYPE_HEADER, "HEADER", 0, "Header", ""}, {RGN_TYPE_CHANNELS, "CHANNELS", 0, "Channels", ""}, + {RGN_TYPE_TOOLS, "TOOLS", 0, "Tools", ""}, {RGN_TYPE_TEMPORARY, "TEMPORARY", 0, "Temporary", ""}, {RGN_TYPE_UI, "UI", 0, "UI", ""}, {0, NULL, 0, NULL, NULL}}; diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 3df3fad3f15..363891e0f24 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -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); |