Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/effect.c
| Show First 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | static void precalculate_effector(struct Depsgraph *depsgraph, EffectorCache *eff) | ||||
| } | } | ||||
| else if (eff->pd->shape == PFIELD_SHAPE_SURFACE) { | else if (eff->pd->shape == PFIELD_SHAPE_SURFACE) { | ||||
| eff->surmd = (SurfaceModifierData *)modifiers_findByType(eff->ob, eModifierType_Surface); | eff->surmd = (SurfaceModifierData *)modifiers_findByType(eff->ob, eModifierType_Surface); | ||||
| if (eff->ob->type == OB_CURVE) | if (eff->ob->type == OB_CURVE) | ||||
| eff->flag |= PE_USE_NORMAL_DATA; | eff->flag |= PE_USE_NORMAL_DATA; | ||||
| } | } | ||||
| else if (eff->psys) | else if (eff->psys) | ||||
| psys_update_particle_tree(eff->psys, ctime); | psys_update_particle_tree(eff->psys, ctime); | ||||
| /* Store object velocity */ | |||||
| if (eff->ob) { | |||||
| float old_vel[3]; | |||||
| BKE_object_where_is_calc_time(depsgraph, eff->scene, eff->ob, cfra - 1.0f); | |||||
| copy_v3_v3(old_vel, eff->ob->obmat[3]); | |||||
| BKE_object_where_is_calc_time(depsgraph, eff->scene, eff->ob, cfra); | |||||
| sub_v3_v3v3(eff->velocity, eff->ob->obmat[3], old_vel); | |||||
| } | |||||
| } | } | ||||
| static void add_effector_relation(ListBase *relations, Object *ob, ParticleSystem *psys, PartDeflect *pd) | static void add_effector_relation(ListBase *relations, Object *ob, ParticleSystem *psys, PartDeflect *pd) | ||||
| { | { | ||||
| EffectorRelation *relation = MEM_callocN(sizeof(EffectorRelation), "EffectorRelation"); | EffectorRelation *relation = MEM_callocN(sizeof(EffectorRelation), "EffectorRelation"); | ||||
| relation->ob = ob; | relation->ob = ob; | ||||
| relation->psys = psys; | relation->psys = psys; | ||||
| relation->pd = pd; | relation->pd = pd; | ||||
| ▲ Show 20 Lines • Show All 481 Lines • ▼ Show 20 Lines | if (eff->pd && ELEM(eff->pd->shape, PFIELD_SHAPE_PLANE, PFIELD_SHAPE_LINE)) { | ||||
| else { /* normally efd->loc is closest point on effector xy-plane */ | else { /* normally efd->loc is closest point on effector xy-plane */ | ||||
| sub_v3_v3v3(efd->loc, point->loc, translate); | sub_v3_v3v3(efd->loc, point->loc, translate); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| copy_v3_v3(efd->loc, ob->obmat[3]); | copy_v3_v3(efd->loc, ob->obmat[3]); | ||||
| } | } | ||||
| if (real_velocity) { | zero_v3(efd->vel); | ||||
| copy_v3_v3(efd->vel, eff->velocity); | |||||
| } | |||||
| efd->size = 0.0f; | efd->size = 0.0f; | ||||
| ret = 1; | ret = 1; | ||||
| } | } | ||||
| if (ret) { | if (ret) { | ||||
| sub_v3_v3v3(efd->vec_to_point, point->loc, efd->loc); | sub_v3_v3v3(efd->vec_to_point, point->loc, efd->loc); | ||||
| efd->distance = len_v3(efd->vec_to_point); | efd->distance = len_v3(efd->vec_to_point); | ||||
| ▲ Show 20 Lines • Show All 558 Lines • Show Last 20 Lines | |||||