diff options
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_simulation.cc | 65 |
1 files changed, 16 insertions, 49 deletions
diff --git a/source/blender/modifiers/intern/MOD_simulation.cc b/source/blender/modifiers/intern/MOD_simulation.cc index f851bf3fe9b..28b4c329730 100644 --- a/source/blender/modifiers/intern/MOD_simulation.cc +++ b/source/blender/modifiers/intern/MOD_simulation.cc @@ -74,18 +74,19 @@ static void initData(ModifierData *md) MEMCPY_STRUCT_AFTER(smd, DNA_struct_default_get(SimulationModifierData), modifier); } -static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx) +static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *UNUSED(ctx)) { SimulationModifierData *smd = reinterpret_cast<SimulationModifierData *>(md); - if (smd->simulation) { - DEG_add_simulation_relation(ctx->node, smd->simulation, "Accessed Simulation"); - } + UNUSED_VARS(smd); } -static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData) +static void foreachIDLink(ModifierData *md, + Object *UNUSED(ob), + IDWalkFunc UNUSED(walk), + void *UNUSED(userData)) { SimulationModifierData *smd = reinterpret_cast<SimulationModifierData *>(md); - walk(userData, ob, (ID **)&smd->simulation, IDWALK_CB_USER); + UNUSED_VARS(smd); } static bool isDisabled(const struct Scene *UNUSED(scene), @@ -93,45 +94,16 @@ static bool isDisabled(const struct Scene *UNUSED(scene), bool UNUSED(useRenderParams)) { SimulationModifierData *smd = reinterpret_cast<SimulationModifierData *>(md); - return smd->simulation == nullptr; -} - -static const ParticleSimulationState *find_particle_state(SimulationModifierData *smd) -{ - return reinterpret_cast<const ParticleSimulationState *>( - BKE_simulation_state_try_find_by_name_and_type( - smd->simulation, smd->data_path, SIM_TYPE_NAME_PARTICLE_SIMULATION)); + UNUSED_VARS(smd); + return false; } static PointCloud *modifyPointCloud(ModifierData *md, const ModifierEvalContext *UNUSED(ctx), - PointCloud *input_pointcloud) + PointCloud *pointcloud) { SimulationModifierData *smd = reinterpret_cast<SimulationModifierData *>(md); - const ParticleSimulationState *state = find_particle_state(smd); - if (state == nullptr) { - return input_pointcloud; - } - - PointCloud *pointcloud = BKE_pointcloud_new_for_eval(input_pointcloud, state->tot_particles); - if (state->tot_particles == 0) { - return pointcloud; - } - - const float3 *positions = static_cast<const float3 *>( - CustomData_get_layer_named(&state->attributes, CD_PROP_FLOAT3, "Position")); - const float *radii = static_cast<const float *>( - CustomData_get_layer_named(&state->attributes, CD_PROP_FLOAT, "Radius")); - memcpy(pointcloud->co, positions, sizeof(float3) * state->tot_particles); - - CustomData_add_layer_named( - &pointcloud->pdata, CD_PROP_FLOAT, CD_CALLOC, NULL, state->tot_particles, "Radius"); - BKE_pointcloud_update_customdata_pointers(pointcloud); - - for (int i = 0; i < state->tot_particles; i++) { - pointcloud->radius[i] = radii[i]; - } - + UNUSED_VARS(smd); return pointcloud; } @@ -145,8 +117,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) uiLayoutSetPropSep(layout, true); uiLayoutSetPropDecorate(layout, false); - uiItemR(layout, ptr, "simulation", 0, NULL, ICON_NONE); - uiItemR(layout, ptr, "data_path", 0, NULL, ICON_NONE); + uiItemL(layout, "This modifier does nothing currently", ICON_INFO); modifier_panel_end(layout, ptr); } @@ -159,32 +130,28 @@ static void panelRegister(ARegionType *region_type) static void blendWrite(BlendWriter *writer, const ModifierData *md) { const SimulationModifierData *smd = reinterpret_cast<const SimulationModifierData *>(md); - BLO_write_string(writer, smd->data_path); + UNUSED_VARS(smd, writer); } static void blendRead(BlendDataReader *reader, ModifierData *md) { SimulationModifierData *smd = reinterpret_cast<SimulationModifierData *>(md); - BLO_read_data_address(reader, &smd->data_path); + UNUSED_VARS(smd, reader); } static void copyData(const ModifierData *md, ModifierData *target, const int flag) { const SimulationModifierData *smd = reinterpret_cast<const SimulationModifierData *>(md); SimulationModifierData *tsmd = reinterpret_cast<SimulationModifierData *>(target); + UNUSED_VARS(smd, tsmd); BKE_modifier_copydata_generic(md, target, flag); - if (smd->data_path != nullptr) { - tsmd->data_path = BLI_strdup(smd->data_path); - } } static void freeData(ModifierData *md) { SimulationModifierData *smd = reinterpret_cast<SimulationModifierData *>(md); - if (smd->data_path) { - MEM_freeN(smd->data_path); - } + UNUSED_VARS(smd); } ModifierTypeInfo modifierType_Simulation = { |