diff options
author | Hans Goudey <h.goudey@me.com> | 2020-10-01 20:56:34 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-10-01 20:56:34 +0300 |
commit | c3238bd50010e43ad97edb07ca1b2fe04ddf7f45 (patch) | |
tree | fa43f6fba52cde9fad9c4931c970861b675e7ae9 /source/blender/blenkernel/intern | |
parent | 4c0ef4f788a1037888d5cb0a87ac23d6fe84573e (diff) |
Cleanup: Use DNA defaults for cloth modifier
Followup for rB8398050695
This requires moving a few enum definitions to DNA instead of BKE, and
adding default definitions for the two structs the cloth modifier where
the cloth modifier stores its settings. The defaults are also reordered
to be consistent with the order of each item in the struct.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/cloth.c | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 770a9379e2d..3d5451125d9 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -75,100 +75,6 @@ typedef struct BendSpringRef { * External interface called by modifier.c clothModifier functions. * ******************************************************************************/ -/** - * cloth_init - creates a new cloth simulation. - * - * 1. create object - * 2. fill object with standard values or with the GUI settings if given - */ -void cloth_init(ClothModifierData *clmd) -{ - /* Initialize our new data structure to reasonable values. */ - clmd->sim_parms->gravity[0] = 0.0; - clmd->sim_parms->gravity[1] = 0.0; - clmd->sim_parms->gravity[2] = -9.81; - clmd->sim_parms->tension = 15.0; - clmd->sim_parms->max_tension = 15.0; - clmd->sim_parms->compression = 15.0; - clmd->sim_parms->max_compression = 15.0; - clmd->sim_parms->shear = 5.0; - clmd->sim_parms->max_shear = 5.0; - clmd->sim_parms->bending = 0.5; - clmd->sim_parms->max_bend = 0.5; - clmd->sim_parms->tension_damp = 5.0; - clmd->sim_parms->compression_damp = 5.0; - clmd->sim_parms->shear_damp = 5.0; - clmd->sim_parms->bending_damping = 0.5; - clmd->sim_parms->Cvi = 1.0; - clmd->sim_parms->mass = 0.3f; - clmd->sim_parms->stepsPerFrame = 5; - clmd->sim_parms->flags = 0; - clmd->sim_parms->solver_type = 0; - clmd->sim_parms->maxspringlen = 10; - clmd->sim_parms->vgroup_mass = 0; - clmd->sim_parms->vgroup_shrink = 0; - - /* Min amount the fabric will shrink by 0.0 = no shrinking, 1.0 = shrink to nothing. */ - clmd->sim_parms->shrink_min = 0.0f; - - clmd->sim_parms->avg_spring_len = 0.0; - clmd->sim_parms->presets = 2; /* cotton as start setting */ - clmd->sim_parms->timescale = 1.0f; /* speed factor, describes how fast cloth moves */ - clmd->sim_parms->time_scale = 1.0f; /* multiplies cloth speed */ - clmd->sim_parms->reset = 0; - - clmd->coll_parms->self_friction = 5.0; - clmd->coll_parms->friction = 5.0; - clmd->coll_parms->loop_count = 2; - clmd->coll_parms->epsilon = 0.015f; - clmd->coll_parms->flags = CLOTH_COLLSETTINGS_FLAG_ENABLED; - clmd->coll_parms->collision_list = NULL; - clmd->coll_parms->selfepsilon = 0.015; - clmd->coll_parms->vgroup_selfcol = 0; - - /* These defaults are copied from softbody.c's - * softbody_calc_forces() function. - */ - clmd->sim_parms->eff_force_scale = 1000.0; - clmd->sim_parms->eff_wind_scale = 250.0; - - /* Internal spring settings */ - clmd->sim_parms->internal_spring_max_length = 0.0f; - clmd->sim_parms->internal_spring_max_diversion = M_PI / 4.0f; - clmd->sim_parms->internal_tension = 15.0f; - clmd->sim_parms->max_internal_tension = 15.0f; - clmd->sim_parms->internal_compression = 15.0f; - clmd->sim_parms->max_internal_compression = 15.0f; - clmd->sim_parms->vgroup_intern = 0; - clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_INTERNAL_SPRINGS_NORMAL; - - /* Pressure settings */ - clmd->sim_parms->uniform_pressure_force = 0.0f; - clmd->sim_parms->target_volume = 0.0f; - clmd->sim_parms->pressure_factor = 1.0f; - clmd->sim_parms->fluid_density = 0.0f; - clmd->sim_parms->vgroup_pressure = 0; - - // also from softbodies - clmd->sim_parms->maxgoal = 1.0f; - clmd->sim_parms->mingoal = 0.0f; - clmd->sim_parms->defgoal = 0.0f; - clmd->sim_parms->goalspring = 1.0f; - clmd->sim_parms->goalfrict = 0.0f; - clmd->sim_parms->velocity_smooth = 0.0f; - - clmd->sim_parms->voxel_cell_size = 0.1f; - - clmd->sim_parms->bending_model = CLOTH_BENDING_ANGULAR; - - if (!clmd->sim_parms->effector_weights) { - clmd->sim_parms->effector_weights = BKE_effector_add_weights(NULL); - } - - if (clmd->point_cache) { - clmd->point_cache->step = 1; - } -} static BVHTree *bvhtree_build_from_cloth(ClothModifierData *clmd, float epsilon) { |