Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/particle.c
| Show First 20 Lines • Show All 3,325 Lines • ▼ Show 20 Lines | void BKE_particlesettings_rough_curve_init(ParticleSettings *part) | ||||
| cumap->cm[0].curve[0].x = 0.0f; | cumap->cm[0].curve[0].x = 0.0f; | ||||
| cumap->cm[0].curve[0].y = 1.0f; | cumap->cm[0].curve[0].y = 1.0f; | ||||
| cumap->cm[0].curve[1].x = 1.0f; | cumap->cm[0].curve[1].x = 1.0f; | ||||
| cumap->cm[0].curve[1].y = 1.0f; | cumap->cm[0].curve[1].y = 1.0f; | ||||
| part->roughcurve = cumap; | part->roughcurve = cumap; | ||||
| } | } | ||||
| ParticleSettings *BKE_particlesettings_copy(Main *bmain, const ParticleSettings *part) | /** | ||||
| * Only copy internal data of ParticleSettings ID from source to already allocated/initialized destination. | |||||
| * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs. | |||||
| * | |||||
| * WARNING! This function will not handle ID user count! | |||||
| * | |||||
| * \param flag Copying options (see BKE_library.h's LIB_ID_COPY_... flags for more). | |||||
| */ | |||||
| void BKE_particlesettings_copy_data( | |||||
| Main *UNUSED(bmain), ParticleSettings *part_dst, const ParticleSettings *part_src, const int UNUSED(flag)) | |||||
| { | { | ||||
| ParticleSettings *partn; | part_dst->pd = MEM_dupallocN(part_src->pd); | ||||
| int a; | part_dst->pd2 = MEM_dupallocN(part_src->pd2); | ||||
| part_dst->effector_weights = MEM_dupallocN(part_src->effector_weights); | |||||
| partn = BKE_libblock_copy(bmain, &part->id); | part_dst->fluid = MEM_dupallocN(part_src->fluid); | ||||
| partn->pd = MEM_dupallocN(part->pd); | if (part_src->clumpcurve) { | ||||
| partn->pd2 = MEM_dupallocN(part->pd2); | part_dst->clumpcurve = curvemapping_copy(part_src->clumpcurve); | ||||
| partn->effector_weights = MEM_dupallocN(part->effector_weights); | } | ||||
| partn->fluid = MEM_dupallocN(part->fluid); | if (part_src->roughcurve) { | ||||
| part_dst->roughcurve = curvemapping_copy(part_src->roughcurve); | |||||
| if (part->clumpcurve) | } | ||||
| partn->clumpcurve = curvemapping_copy(part->clumpcurve); | |||||
| if (part->roughcurve) | |||||
| partn->roughcurve = curvemapping_copy(part->roughcurve); | |||||
| partn->boids = boid_copy_settings(part->boids); | part_dst->boids = boid_copy_settings(part_src->boids); | ||||
| for (a = 0; a < MAX_MTEX; a++) { | for (int a = 0; a < MAX_MTEX; a++) { | ||||
| if (part->mtex[a]) { | if (part_src->mtex[a]) { | ||||
| partn->mtex[a] = MEM_mallocN(sizeof(MTex), "psys_copy_tex"); | part_dst->mtex[a] = MEM_dupallocN(part_src->mtex[a]); | ||||
| memcpy(partn->mtex[a], part->mtex[a], sizeof(MTex)); | |||||
| id_us_plus((ID *)partn->mtex[a]->tex); | |||||
| } | } | ||||
| } | } | ||||
| BLI_duplicatelist(&partn->dupliweights, &part->dupliweights); | BLI_duplicatelist(&part_dst->dupliweights, &part_src->dupliweights); | ||||
| } | |||||
| BKE_id_copy_ensure_local(bmain, &part->id, &partn->id); | |||||
| return partn; | ParticleSettings *BKE_particlesettings_copy(Main *bmain, const ParticleSettings *part) | ||||
| { | |||||
| ParticleSettings *part_copy; | |||||
| BKE_id_copy_ex(bmain, &part->id, (ID **)&part_copy, 0, false); | |||||
| return part_copy; | |||||
| } | } | ||||
| void BKE_particlesettings_make_local(Main *bmain, ParticleSettings *part, const bool lib_local) | void BKE_particlesettings_make_local(Main *bmain, ParticleSettings *part, const bool lib_local) | ||||
| { | { | ||||
| BKE_id_make_local_generic(bmain, &part->id, true, lib_local); | BKE_id_make_local_generic(bmain, &part->id, true, lib_local); | ||||
| } | } | ||||
| /************************************************/ | /************************************************/ | ||||
| ▲ Show 20 Lines • Show All 965 Lines • Show Last 20 Lines | |||||