From b55c78a289c600696282f97191d6e800a1c1ac34 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Wed, 13 May 2020 12:39:17 +0200 Subject: Simulation: Add modifier to access simulation data For now the "Simulation" modifier only exists for point cloud objects, because we need this for the particle system. Right now, the modifier is doing nothing. There is a new `DEG_add_simulation_relation` function that is used by the modifier to make sure that the simulation is evaluated before the modifier is executed. Reviewers: brecht, sergey Differential Revision: https://developer.blender.org/D7549 --- source/blender/makesrna/intern/rna_modifier.c | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'source/blender/makesrna/intern/rna_modifier.c') diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 638268adff7..48e3c47208f 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -289,6 +289,13 @@ const EnumPropertyItem rna_enum_object_modifier_type_items[] = { "Spawn particles from the shape"}, {eModifierType_Softbody, "SOFT_BODY", ICON_MOD_SOFT, "Soft Body", ""}, {eModifierType_Surface, "SURFACE", ICON_MODIFIER, "Surface", ""}, +#ifdef WITH_NEW_SIMULATION_TYPE + {eModifierType_Simulation, + "SIMULATION", + ICON_PHYSICS, + "Simulation", + ""}, /* TODO: Use correct icon. */ +#endif {0, NULL, 0, NULL, NULL}, }; @@ -716,6 +723,8 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr) return &RNA_SurfaceDeformModifier; case eModifierType_WeightedNormal: return &RNA_WeightedNormalModifier; + case eModifierType_Simulation: + return &RNA_SimulationModifier; /* Default */ case eModifierType_Fluidsim: /* deprecated */ case eModifierType_None: @@ -6552,6 +6561,29 @@ static void rna_def_modifier_weightednormal(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Modifier_update"); } +static void rna_def_modifier_simulation_access(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "SimulationModifier", "Modifier"); + RNA_def_struct_ui_text(srna, "Simulation Modifier", ""); + RNA_def_struct_sdna(srna, "SimulationModifierData"); + RNA_def_struct_ui_icon(srna, ICON_PHYSICS); /* TODO: Use correct icon. */ + +# ifdef WITH_NEW_SIMULATION_TYPE + prop = RNA_def_property(srna, "simulation", PROP_POINTER, PROP_NONE); + RNA_def_property_ui_text(prop, "Simulation", "Simulation to access"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update"); +# endif + + prop = RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE); + RNA_def_property_ui_text( + prop, "Data Path", "Identifier of the simulation component that should be accessed"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); +} + void RNA_def_modifier(BlenderRNA *brna) { StructRNA *srna; @@ -6677,6 +6709,7 @@ void RNA_def_modifier(BlenderRNA *brna) rna_def_modifier_meshseqcache(brna); rna_def_modifier_surfacedeform(brna); rna_def_modifier_weightednormal(brna); + rna_def_modifier_simulation_access(brna); } #endif -- cgit v1.2.3