diff options
author | Jacques Lucke <jacques@blender.org> | 2020-07-09 16:40:27 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-07-09 16:40:27 +0300 |
commit | 580d50091cfb0467cbde165058a6e78ef4898045 (patch) | |
tree | f123808f3397df3a273f991e9e3239e603d68ce0 /source/blender/makesrna | |
parent | 31ad43a3c7dde771cb6d92b6d20bf7b2e3f2bed6 (diff) |
Particles: Create a simulation state for every Particle Simulation node
Every Particle Simulation node has a name (or a path when it is in a node group).
This name has to be used in the Simulation modifier on a point cloud to see
the particles.
Caching has been disabled for now, because it was holding back development
a bit. To reset the simulation, go back to frame 1.
Currently, there is no way to influence the simulation. There are just some
randomly moving points. Changing that is the next step.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index eab7326868b..20648970bd1 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -1639,6 +1639,40 @@ static void rna_SimulationModifier_simulation_update(Main *bmain, Scene *scene, rna_Modifier_dependency_update(bmain, scene, ptr); } +static void rna_SimulationModifier_data_path_get(PointerRNA *ptr, char *value) +{ + SimulationModifierData *smd = ptr->data; + + if (smd->data_path) { + strcpy(value, smd->data_path); + } + else { + value[0] = '\0'; + } +} + +static int rna_SimulationModifier_data_path_length(PointerRNA *ptr) +{ + SimulationModifierData *smd = ptr->data; + return smd->data_path ? strlen(smd->data_path) : 0; +} + +static void rna_SimulationModifier_data_path_set(PointerRNA *ptr, const char *value) +{ + SimulationModifierData *smd = ptr->data; + + if (smd->data_path) { + MEM_freeN(smd->data_path); + } + + if (value[0]) { + smd->data_path = BLI_strdup(value); + } + else { + smd->data_path = NULL; + } +} + /** * Special set callback that just changes the first bit of the expansion flag. * This way the expansion state of all the sub-panels is not changed by RNA. @@ -6859,6 +6893,10 @@ static void rna_def_modifier_simulation(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_SimulationModifier_simulation_update"); prop = RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE); + RNA_def_property_string_funcs(prop, + "rna_SimulationModifier_data_path_get", + "rna_SimulationModifier_data_path_length", + "rna_SimulationModifier_data_path_set"); 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"); |