[Bf-blender-cvs] [2e392a0fdc0] blender2.8: Merge branch 'master' into blender2.8
Campbell Barton
noreply at git.blender.org
Sun Dec 2 04:20:15 CET 2018
Commit: 2e392a0fdc0975e500d7ea07bfbfc781f5ddd190
Author: Campbell Barton
Date: Sun Dec 2 14:15:43 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB2e392a0fdc0975e500d7ea07bfbfc781f5ddd190
Merge branch 'master' into blender2.8
===================================================================
===================================================================
diff --cc source/blender/blenkernel/BKE_effect.h
index 3d4154c572b,f12c55e762c..9ba1bbdee07
--- a/source/blender/blenkernel/BKE_effect.h
+++ b/source/blender/blenkernel/BKE_effect.h
@@@ -44,11 -44,8 +44,10 @@@ struct Collection
struct ParticleSimulationData;
struct ParticleData;
struct ParticleKey;
+struct Depsgraph;
+struct ViewLayer;
- struct EffectorWeights *BKE_add_effector_weights(struct Collection *collection);
- struct PartDeflect *object_add_collision_fields(int type);
-struct EffectorWeights *BKE_effector_add_weights(struct Group *group);
++struct EffectorWeights *BKE_effector_add_weights(struct Collection *collection);
/* Input to effector code */
typedef struct EffectedPoint {
@@@ -112,35 -108,13 +111,37 @@@ typedef struct EffectorCache
int flag;
} EffectorCache;
+typedef struct EffectorRelation {
+ struct EffectorRelation *next, *prev;
+
+ struct Object *ob;
+ struct ParticleSystem *psys;
+ struct PartDeflect *pd;
+} EffectorRelation;
+
- void free_partdeflect(struct PartDeflect *pd);
++
+ struct PartDeflect *BKE_partdeflect_new(int type);
+ void BKE_partdeflect_free(struct PartDeflect *pd);
-struct ListBase *pdInitEffectors(struct Scene *scene, struct Object *ob_src, struct ParticleSystem *psys_src, struct EffectorWeights *weights, bool for_simulation);
-void pdEndEffectors(struct ListBase **effectors);
-void pdPrecalculateEffectors(struct ListBase *effectors);
-void pdDoEffectors(struct ListBase *effectors, struct ListBase *colliders, struct EffectorWeights *weights, struct EffectedPoint *point, float *force, float *impulse);
+struct ListBase *BKE_effector_relations_create(
+ struct Depsgraph *depsgraph,
+ struct ViewLayer *view_layer,
+ struct Collection *collection);
+void BKE_effector_relations_free(struct ListBase *lb);
+
+struct ListBase *BKE_effectors_create(
+ struct Depsgraph *depsgraph,
+ struct Object *ob_src,
+ struct ParticleSystem *psys_src,
+ struct EffectorWeights *weights);
+void BKE_effectors_apply(
+ struct ListBase *effectors,
+ struct ListBase *colliders,
+ struct EffectorWeights *weights,
+ struct EffectedPoint *point,
+ float *force,
+ float *impulse);
+void BKE_effectors_free(struct ListBase *lb);
void pd_point_from_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleKey *state, struct EffectedPoint *point);
void pd_point_from_loc(struct Scene *scene, float *loc, float *vel, int index, struct EffectedPoint *point);
diff --cc source/blender/blenkernel/intern/cloth.c
index e10cfc38164,9666b1ef68f..cf5b3d3a51b
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@@ -143,10 -129,8 +143,10 @@@ void cloth_init(ClothModifierData *clm
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_add_effector_weights(NULL);
+ clmd->sim_parms->effector_weights = BKE_effector_add_weights(NULL);
if (clmd->point_cache)
clmd->point_cache->step = 1;
diff --cc source/blender/blenkernel/intern/effect.c
index f54082de153,0a2d3fff073..0c8a47be4b4
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@@ -87,7 -82,7 +87,7 @@@
#include <string.h>
#endif // WITH_MOD_FLUID
- EffectorWeights *BKE_add_effector_weights(Collection *collection)
-EffectorWeights *BKE_effector_add_weights(Group *group)
++EffectorWeights *BKE_effector_add_weights(Collection *collection)
{
EffectorWeights *weights = MEM_callocN(sizeof(EffectorWeights), "EffectorWeights");
int i;
@@@ -138,9 -132,10 +138,9 @@@ PartDeflect *BKE_partdeflect_new(int ty
return pd;
}
-/* ***************** PARTICLES ***************** */
+/************************ PARTICLES ***************************/
- void free_partdeflect(PartDeflect *pd)
-/* -------------------------- Effectors ------------------ */
+ void BKE_partdeflect_free(PartDeflect *pd)
{
if (!pd) {
return;
diff --cc source/blender/blenkernel/intern/object.c
index 67edcff49a6,5a9ecaa7232..3e2e890f542
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@@ -582,11 -430,24 +582,11 @@@ void BKE_object_free(Object *ob
BKE_constraints_free_ex(&ob->constraints, false);
- free_partdeflect(ob->pd);
+ BKE_partdeflect_free(ob->pd);
- BKE_rigidbody_free_object(ob);
+ BKE_rigidbody_free_object(ob, NULL);
BKE_rigidbody_free_constraint(ob);
- if (ob->soft) {
- sbFree(ob->soft);
- ob->soft = NULL;
- }
- if (ob->bsoft) {
- bsbFree(ob->bsoft);
- ob->bsoft = NULL;
- }
- GPU_lamp_free(ob);
+ sbFree(ob);
BKE_sculptsession_free(ob);
diff --cc source/blender/blenkernel/intern/particle.c
index 6ceae2fdc2d,e24602050ef..5a9722a867c
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@@ -3211,8 -3308,13 +3211,8 @@@ static void default_particle_settings(P
part->color_vec_max = 1.f;
part->draw_col = PART_DRAW_COL_MAT;
- part->simplify_refsize = 1920;
- part->simplify_rate = 1.0f;
- part->simplify_transition = 0.1f;
- part->simplify_viewport = 0.8;
-
if (!part->effector_weights)
- part->effector_weights = BKE_add_effector_weights(NULL);
+ part->effector_weights = BKE_effector_add_weights(NULL);
part->omat = 1;
part->use_modifier_stack = false;
diff --cc source/blender/blenkernel/intern/rigidbody.c
index 919a0c5fa02,f485233fe3c..9ca8c834bb9
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@@ -952,10 -947,9 +952,10 @@@ RigidBodyWorld *BKE_rigidbody_create_wo
/* create a new sim world */
rbw = MEM_callocN(sizeof(RigidBodyWorld), "RigidBodyWorld");
+ rbw->shared = MEM_callocN(sizeof(*rbw->shared), "RigidBodyWorld_Shared");
/* set default settings */
- rbw->effector_weights = BKE_add_effector_weights(NULL);
+ rbw->effector_weights = BKE_effector_add_weights(NULL);
rbw->ltime = PSFRA;
diff --cc source/blender/blenkernel/intern/softbody.c
index 4c1555e9451,9bcff23e134..2707e4eebd7
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@@ -3276,11 -3321,10 +3276,11 @@@ SoftBody *sbNew(Scene *scene
sb->shearstiff = 1.0f;
sb->solverflags |= SBSO_OLDERR;
- sb->pointcache = BKE_ptcache_add(&sb->ptcaches);
+ sb->shared = MEM_callocN(sizeof(*sb->shared), "SoftBody_Shared");
+ sb->shared->pointcache = BKE_ptcache_add(&sb->shared->ptcaches);
if (!sb->effector_weights)
- sb->effector_weights = BKE_add_effector_weights(NULL);
+ sb->effector_weights = BKE_effector_add_weights(NULL);
sb->last_frame= MINFRAME-1;
diff --cc source/blender/blenloader/intern/readfile.c
index acf6ead7d96,36221b7c60f..076370c8877
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -5625,21 -5581,11 +5625,21 @@@ static void direct_link_object(FileDat
sb->effector_weights = newdataadr(fd, sb->effector_weights);
if (!sb->effector_weights)
- sb->effector_weights = BKE_add_effector_weights(NULL);
+ sb->effector_weights = BKE_effector_add_weights(NULL);
- direct_link_pointcache_list(fd, &sb->ptcaches, &sb->pointcache, 0);
+ sb->shared = newdataadr(fd, sb->shared);
+ if (sb->shared == NULL) {
+ /* Link deprecated caches if they exist, so we can use them for versioning.
+ * We should only do this when sb->shared == NULL, because those pointers
+ * are always set (for compatibility with older Blenders). We mustn't link
+ * the same pointcache twice. */
+ direct_link_pointcache_list(fd, &sb->ptcaches, &sb->pointcache, false);
+ }
+ else {
+ /* link caches */
+ direct_link_pointcache_list(fd, &sb->shared->ptcaches, &sb->shared->pointcache, false);
+ }
}
- ob->bsoft = newdataadr(fd, ob->bsoft);
ob->fluidsimSettings = newdataadr(fd, ob->fluidsimSettings); /* NT */
ob->rigidbody_object = newdataadr(fd, ob->rigidbody_object);
@@@ -6516,7 -6257,14 +6516,7 @@@ static void direct_link_scene(FileData
/* set effector weights */
rbw->effector_weights = newdataadr(fd, rbw->effector_weights);
if (!rbw->effector_weights)
- rbw->effector_weights = BKE_add_effector_weights(NULL);
+ rbw->effector_weights = BKE_effector_add_weights(NULL);
-
- /* link cache */
- direct_link_pointcache_list(fd, &rbw->ptcaches, &rbw->pointcache, false);
- /* make sure simulation starts from the beginning after loading file */
- if (rbw->pointcache) {
- rbw->ltime = (float)rbw->pointcache->startframe;
- }
}
sce->preview = direct_link_preview_image(fd, sce->preview);
diff --cc source/blender/editors/object/object_add.c
index 8abef6f6793,a05f40765fa..09948d719f0
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@@ -587,9 -534,9 +587,9 @@@ static int effector_add_exec(bContext *
ob->empty_drawtype = OB_SINGLE_ARROW;
}
- ob->pd = object_add_collision_fields(type);
+ ob->pd = BKE_partdeflect_new(type);
- DAG_relations_tag_update(CTX_data_main(C));
+ DEG_relations_tag_update(CTX_data_main(C));
return OPERATOR_FINISHED;
}
More information about the Bf-blender-cvs
mailing list