Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-12-10 17:09:46 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-12-10 17:11:57 +0300
commitc2b0d8b6d6c771da70b8fd9da5ac9cc53d04184d (patch)
treef8d0db99e875b9f56c067e894b6c5f130f50b816 /source/blender/depsgraph/intern/builder
parentfc52d51d73844397b4410ced48448b496403953e (diff)
Fix T57633: Particle texture update problem
Textures are now hooked up to the RESET operation of particle settings, which ensures particles being re-distributed when texture is changed. This is limited to a direct user modifications, which matches old behavior in 2.79.
Diffstat (limited to 'source/blender/depsgraph/intern/builder')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.cc71
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.h2
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc77
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.h8
4 files changed, 113 insertions, 45 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 3fcaa12f036..d65acbcad1d 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -640,7 +640,7 @@ void DepsgraphNodeBuilder::build_object(int base_index,
build_animdata(&object->id);
/* Particle systems. */
if (object->particlesystem.first != NULL) {
- build_particles(object, is_visible);
+ build_particle_systems(object, is_visible);
}
/* Proxy object to copy from. */
if (object->proxy_from != NULL) {
@@ -1109,8 +1109,8 @@ void DepsgraphNodeBuilder::build_rigidbody(Scene *scene)
}
}
-void DepsgraphNodeBuilder::build_particles(Object *object,
- bool is_object_visible)
+void DepsgraphNodeBuilder::build_particle_systems(Object *object,
+ bool is_object_visible)
{
/**
* Particle Systems Nodes
@@ -1128,25 +1128,22 @@ void DepsgraphNodeBuilder::build_particles(Object *object,
*/
/* Component for all particle systems. */
ComponentDepsNode *psys_comp =
- add_component_node(&object->id, DEG_NODE_TYPE_EVAL_PARTICLES);
+ add_component_node(&object->id, DEG_NODE_TYPE_PARTICLE_SYSTEM);
- /* TODO(sergey): Need to get COW of PSYS. */
- Scene *scene_cow = get_cow_datablock(scene_);
Object *ob_cow = get_cow_datablock(object);
-
- add_operation_node(psys_comp,
- function_bind(BKE_particle_system_eval_init,
- _1,
- scene_cow,
- ob_cow),
- DEG_OPCODE_PARTICLE_SYSTEM_EVAL_INIT);
+ OperationDepsNode *op_node;
+ op_node = add_operation_node(psys_comp,
+ function_bind(BKE_particle_system_eval_init,
+ _1,
+ ob_cow),
+ DEG_OPCODE_PARTICLE_SYSTEM_INIT);
+ op_node->set_as_entry();
/* Build all particle systems. */
LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) {
ParticleSettings *part = psys->part;
/* Build particle settings operations.
*
- * NOTE: The call itself ensures settings are only build once.
- */
+ * NOTE: The call itself ensures settings are only build once. */
build_particle_settings(part);
/* Particle system evaluation. */
add_operation_node(psys_comp,
@@ -1170,19 +1167,49 @@ void DepsgraphNodeBuilder::build_particles(Object *object,
break;
}
}
+ op_node = add_operation_node(psys_comp,
+ NULL,
+ DEG_OPCODE_PARTICLE_SYSTEM_DONE);
+ op_node->set_as_exit();
}
-void DepsgraphNodeBuilder::build_particle_settings(ParticleSettings *part) {
- if (built_map_.checkIsBuiltAndTag(part)) {
+void DepsgraphNodeBuilder::build_particle_settings(
+ ParticleSettings *particle_settings) {
+ if (built_map_.checkIsBuiltAndTag(particle_settings)) {
return;
}
+ /* Make sure we've got proper copied ID pointer. */
+ add_id_node(&particle_settings->id);
+ ParticleSettings *particle_settings_cow =
+ get_cow_datablock(particle_settings);
/* Animation data. */
- build_animdata(&part->id);
+ build_animdata(&particle_settings->id);
/* Parameters change. */
- add_operation_node(&part->id,
- DEG_NODE_TYPE_PARAMETERS,
- NULL,
- DEG_OPCODE_PARTICLE_SETTINGS_EVAL);
+ OperationDepsNode *op_node;
+ op_node = add_operation_node(&particle_settings->id,
+ DEG_NODE_TYPE_PARTICLE_SETTINGS,
+ NULL,
+ DEG_OPCODE_PARTICLE_SETTINGS_INIT);
+ op_node->set_as_entry();
+ add_operation_node(&particle_settings->id,
+ DEG_NODE_TYPE_PARTICLE_SETTINGS,
+ function_bind(BKE_particle_settings_eval_reset,
+ _1,
+ particle_settings_cow),
+ DEG_OPCODE_PARTICLE_SETTINGS_RESET);
+ op_node = add_operation_node(&particle_settings->id,
+ DEG_NODE_TYPE_PARTICLE_SETTINGS,
+ NULL,
+ DEG_OPCODE_PARTICLE_SETTINGS_EVAL);
+ op_node->set_as_exit();
+ /* Texture slots. */
+ for (int mtex_index = 0; mtex_index < MAX_MTEX; ++mtex_index) {
+ MTex *mtex = particle_settings->mtex[mtex_index];
+ if (mtex == NULL || mtex->tex == NULL) {
+ continue;
+ }
+ build_texture(mtex->tex);
+ }
}
/* Shapekeys */
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
index cdf1f6ed03d..3357f6cb0a2 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
@@ -190,7 +190,7 @@ struct DepsgraphNodeBuilder {
int pchan_index,
bool is_object_visible);
void build_rigidbody(Scene *scene);
- void build_particles(Object *object, bool is_object_visible);
+ void build_particle_systems(Object *object, bool is_object_visible);
void build_particle_settings(ParticleSettings *part);
void build_animdata(ID *id);
void build_animdata_nlastrip_targets(ListBase *strips);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index f66a0a8963a..1d5ff8cd3e5 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -410,7 +410,8 @@ void DepsgraphRelationBuilder::add_forcefield_relations(
}
if (relation->psys) {
if (relation->ob != object) {
- ComponentKey eff_key(&relation->ob->id, DEG_NODE_TYPE_EVAL_PARTICLES);
+ ComponentKey eff_key(&relation->ob->id,
+ DEG_NODE_TYPE_PARTICLE_SYSTEM);
add_relation(eff_key, key, name);
/* TODO: remove this when/if EVAL_PARTICLES is sufficient
* for up to date particles.
@@ -420,7 +421,7 @@ void DepsgraphRelationBuilder::add_forcefield_relations(
}
else if (relation->psys != psys) {
OperationKey eff_key(&relation->ob->id,
- DEG_NODE_TYPE_EVAL_PARTICLES,
+ DEG_NODE_TYPE_PARTICLE_SYSTEM,
DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
relation->psys->name);
add_relation(eff_key, key, name);
@@ -661,7 +662,7 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object)
build_object_data(object);
/* Particle systems. */
if (object->particlesystem.first != NULL) {
- build_particles(object);
+ build_particle_systems(object);
}
/* Proxy object to copy from. */
if (object->proxy_from != NULL) {
@@ -1692,16 +1693,21 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene)
}
}
-void DepsgraphRelationBuilder::build_particles(Object *object)
+void DepsgraphRelationBuilder::build_particle_systems(Object *object)
{
TimeSourceKey time_src_key;
OperationKey obdata_ubereval_key(&object->id,
DEG_NODE_TYPE_GEOMETRY,
DEG_OPCODE_GEOMETRY_UBEREVAL);
OperationKey eval_init_key(&object->id,
- DEG_NODE_TYPE_EVAL_PARTICLES,
- DEG_OPCODE_PARTICLE_SYSTEM_EVAL_INIT);
-
+ DEG_NODE_TYPE_PARTICLE_SYSTEM,
+ DEG_OPCODE_PARTICLE_SYSTEM_INIT);
+ OperationKey eval_done_key(&object->id,
+ DEG_NODE_TYPE_PARTICLE_SYSTEM,
+ DEG_OPCODE_PARTICLE_SYSTEM_DONE);
+ ComponentKey eval_key(&object->id, DEG_NODE_TYPE_PARTICLE_SYSTEM);
+ ComponentKey point_cache_key(&object->id, DEG_NODE_TYPE_POINT_CACHE);
+ add_relation(eval_key, point_cache_key, "Particle Point Cache");
/* Particle systems. */
LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) {
ParticleSettings *part = psys->part;
@@ -1714,16 +1720,17 @@ void DepsgraphRelationBuilder::build_particles(Object *object)
/* This particle system. */
OperationKey psys_key(&object->id,
- DEG_NODE_TYPE_EVAL_PARTICLES,
+ DEG_NODE_TYPE_PARTICLE_SYSTEM,
DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
psys->name);
/* Update particle system when settings changes. */
OperationKey particle_settings_key(&part->id,
- DEG_NODE_TYPE_PARAMETERS,
+ DEG_NODE_TYPE_PARTICLE_SETTINGS,
DEG_OPCODE_PARTICLE_SETTINGS_EVAL);
add_relation(particle_settings_key, eval_init_key, "Particle Settings Change");
add_relation(eval_init_key, psys_key, "Init -> PSys");
+ add_relation(psys_key, eval_done_key, "PSys -> Done");
/* TODO(sergey): Currently particle update is just a placeholder,
* hook it to the ubereval node so particle system is getting updated
* on playback.
@@ -1777,18 +1784,16 @@ void DepsgraphRelationBuilder::build_particles(Object *object)
/* Make sure object's relations are all built. */
build_object(NULL, part->dup_ob);
/* Build relation for the particle visualization. */
- build_particles_visualization_object(object,
- psys,
- part->dup_ob);
+ build_particle_system_visualization_object(
+ object, psys, part->dup_ob);
}
break;
case PART_DRAW_GR:
if (part->dup_group != NULL) {
build_collection(NULL, NULL, part->dup_group);
LISTBASE_FOREACH (CollectionObject *, go, &part->dup_group->gobject) {
- build_particles_visualization_object(object,
- psys,
- go->ob);
+ build_particle_system_visualization_object(
+ object, psys, go->ob);
}
}
break;
@@ -1802,7 +1807,7 @@ void DepsgraphRelationBuilder::build_particles(Object *object)
* is implemented.
*/
ComponentKey transform_key(&object->id, DEG_NODE_TYPE_TRANSFORM);
- add_relation(transform_key, obdata_ubereval_key, "Partcile Eval");
+ add_relation(transform_key, obdata_ubereval_key, "Particle Eval");
}
void DepsgraphRelationBuilder::build_particle_settings(ParticleSettings *part)
@@ -1812,15 +1817,45 @@ void DepsgraphRelationBuilder::build_particle_settings(ParticleSettings *part)
}
/* Animation data relations. */
build_animdata(&part->id);
+ OperationKey particle_settings_init_key(&part->id,
+ DEG_NODE_TYPE_PARTICLE_SETTINGS,
+ DEG_OPCODE_PARTICLE_SETTINGS_INIT);
+ OperationKey particle_settings_eval_key(&part->id,
+ DEG_NODE_TYPE_PARTICLE_SETTINGS,
+ DEG_OPCODE_PARTICLE_SETTINGS_EVAL);
+ OperationKey particle_settings_reset_key(
+ &part->id,
+ DEG_NODE_TYPE_PARTICLE_SETTINGS,
+ DEG_OPCODE_PARTICLE_SETTINGS_RESET);
+ add_relation(particle_settings_init_key,
+ particle_settings_eval_key,
+ "Particle Settings Init Order");
+ add_relation(particle_settings_reset_key,
+ particle_settings_eval_key,
+ "Particle Settings Reset");
+ /* Texture slots. */
+ for (int mtex_index = 0; mtex_index < MAX_MTEX; ++mtex_index) {
+ MTex *mtex = part->mtex[mtex_index];
+ if (mtex == NULL || mtex->tex == NULL) {
+ continue;
+ }
+ build_texture(mtex->tex);
+ ComponentKey texture_key(&mtex->tex->id,
+ DEG_NODE_TYPE_GENERIC_DATABLOCK);
+ add_relation(texture_key,
+ particle_settings_reset_key,
+ "Particle Texture",
+ DEPSREL_FLAG_FLUSH_USER_EDIT_ONLY);
+ }
}
-void DepsgraphRelationBuilder::build_particles_visualization_object(
+void DepsgraphRelationBuilder::build_particle_system_visualization_object(
Object *object,
ParticleSystem *psys,
Object *draw_object)
{
OperationKey psys_key(&object->id,
- DEG_NODE_TYPE_EVAL_PARTICLES,
+ DEG_NODE_TYPE_PARTICLE_SYSTEM,
DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
psys->name);
OperationKey obdata_ubereval_key(&object->id,
@@ -2285,6 +2320,12 @@ void DepsgraphRelationBuilder::build_texture(Tex *texture)
/* texture's nodetree */
build_nodetree(texture->nodetree);
build_nested_nodetree(&texture->id, texture->nodetree);
+ if (check_id_has_anim_component(&texture->id)) {
+ ComponentKey animation_key(&texture->id, DEG_NODE_TYPE_ANIMATION);
+ ComponentKey datablock_key(&texture->id,
+ DEG_NODE_TYPE_GENERIC_DATABLOCK);
+ add_relation(animation_key, datablock_key, "Datablock Animation");
+ }
}
void DepsgraphRelationBuilder::build_compositor(Scene *scene)
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index face2a1d43f..928834cbef7 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -252,11 +252,11 @@ struct DepsgraphRelationBuilder
void build_driver_variables(ID *id, FCurve *fcurve);
void build_world(World *world);
void build_rigidbody(Scene *scene);
- void build_particles(Object *object);
+ void build_particle_systems(Object *object);
void build_particle_settings(ParticleSettings *part);
- void build_particles_visualization_object(Object *object,
- ParticleSystem *psys,
- Object *draw_object);
+ void build_particle_system_visualization_object(Object *object,
+ ParticleSystem *psys,
+ Object *draw_object);
void build_ik_pose(Object *object,
bPoseChannel *pchan,
bConstraint *con,