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:
authorAntonioya <blendergit@gmail.com>2019-07-23 10:46:29 +0300
committerAntonioya <blendergit@gmail.com>2019-07-23 10:46:29 +0300
commit2204bfcf9e1c3a38e60830bd97775dd72158f4d6 (patch)
tree4f9c827389a23a431f8771b4ca02f410860c0242 /source/blender/depsgraph/intern/builder/deg_builder_relations.cc
parentf64db794ee690f05905ace0a66d81d2e75549b90 (diff)
parent34ad6da4a06ef46cd19945f61cc5f968538546a8 (diff)
Merge branch 'master' into temp-gpencil-drw-engine
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_relations.cc')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc74
1 files changed, 62 insertions, 12 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index c7f6116e81d..86cbb330170 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -200,6 +200,11 @@ static OperationCode bone_target_opcode(ID *target,
return OperationCode::BONE_DONE;
}
+static bool object_have_geometry_component(const Object *object)
+{
+ return ELEM(object->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_MBALL, OB_LATTICE, OB_GPENCIL);
+}
+
/* **** General purpose functions **** */
DepsgraphRelationBuilder::DepsgraphRelationBuilder(Main *bmain,
@@ -374,6 +379,14 @@ void DepsgraphRelationBuilder::add_particle_forcefield_relations(const Operation
{
ListBase *relations = build_effector_relations(graph_, eff->group);
+ /* Make sure physics effects like wind are properly re-evaluating the modifier stack. */
+ if (!BLI_listbase_is_empty(relations)) {
+ TimeSourceKey time_src_key;
+ ComponentKey geometry_key(&object->id, NodeType::GEOMETRY);
+ add_relation(
+ time_src_key, geometry_key, "Effector Time -> Particle", RELATION_CHECK_BEFORE_ADD);
+ }
+
LISTBASE_FOREACH (EffectorRelation *, relation, relations) {
if (relation->ob != object) {
/* Relation to forcefield object, optionally including geometry. */
@@ -746,6 +759,12 @@ void DepsgraphRelationBuilder::build_object_data(Object *object)
add_relation(key_key, geometry_key, "Shapekeys");
build_nested_shapekey(&object->id, key);
}
+ /* Materials. */
+ Material ***materials_ptr = give_matarar(object);
+ if (materials_ptr != NULL) {
+ short *num_materials_ptr = give_totcolp(object);
+ build_materials(*materials_ptr, *num_materials_ptr);
+ }
}
void DepsgraphRelationBuilder::build_object_data_camera(Object *object)
@@ -1929,14 +1948,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
}
}
/* Materials. */
- if (object->totcol) {
- for (int a = 1; a <= object->totcol; a++) {
- Material *ma = give_current_material(object, a);
- if (ma != NULL) {
- build_material(ma);
- }
- }
- }
+ build_materials(object->mat, object->totcol);
/* Geometry collision. */
if (ELEM(object->type, OB_MESH, OB_CURVE, OB_LATTICE)) {
// add geometry collider relations
@@ -1988,10 +2000,18 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
}
}
/* Syncronization back to original object. */
- ComponentKey final_geometry_jey(&object->id, NodeType::GEOMETRY);
+ ComponentKey final_geometry_key(&object->id, NodeType::GEOMETRY);
OperationKey synchronize_key(
&object->id, NodeType::SYNCHRONIZATION, OperationCode::SYNCHRONIZE_TO_ORIGINAL);
- add_relation(final_geometry_jey, synchronize_key, "Synchronize to Original");
+ add_relation(final_geometry_key, synchronize_key, "Synchronize to Original");
+ /* Batch cache. */
+ OperationKey object_data_select_key(
+ obdata, NodeType::BATCH_CACHE, OperationCode::GEOMETRY_SELECT_UPDATE);
+ OperationKey object_select_key(
+ &object->id, NodeType::BATCH_CACHE, OperationCode::GEOMETRY_SELECT_UPDATE);
+ add_relation(object_data_select_key, object_select_key, "Data Selection -> Object Selection");
+ add_relation(
+ geom_key, object_select_key, "Object Geometry -> Select Update", RELATION_FLAG_NO_FLUSH);
}
void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata)
@@ -2149,9 +2169,11 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree)
else if (id_type == ID_OB) {
build_object(NULL, (Object *)id);
ComponentKey object_transform_key(id, NodeType::TRANSFORM);
- ComponentKey object_geometry_key(id, NodeType::GEOMETRY);
add_relation(object_transform_key, shading_key, "Object Transform -> Node");
- add_relation(object_geometry_key, shading_key, "Object Geometry -> Node");
+ if (object_have_geometry_component(reinterpret_cast<Object *>(id))) {
+ ComponentKey object_geometry_key(id, NodeType::GEOMETRY);
+ add_relation(object_geometry_key, shading_key, "Object Geometry -> Node");
+ }
}
else if (id_type == ID_SCE) {
Scene *node_scene = (Scene *)id;
@@ -2221,6 +2243,16 @@ void DepsgraphRelationBuilder::build_material(Material *material)
}
}
+void DepsgraphRelationBuilder::build_materials(Material **materials, int num_materials)
+{
+ for (int i = 0; i < num_materials; ++i) {
+ if (materials[i] == NULL) {
+ continue;
+ }
+ build_material(materials[i]);
+ }
+}
+
/* Recursively build graph for texture */
void DepsgraphRelationBuilder::build_texture(Tex *texture)
{
@@ -2305,6 +2337,24 @@ void DepsgraphRelationBuilder::build_mask(Mask *mask)
/* Final mask evaluation. */
OperationKey mask_eval_key(mask_id, NodeType::PARAMETERS, OperationCode::MASK_EVAL);
add_relation(mask_animation_key, mask_eval_key, "Mask Animation -> Mask Eval");
+ /* Build parents. */
+ LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
+ LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) {
+ for (int i = 0; i < spline->tot_point; i++) {
+ MaskSplinePoint *point = &spline->points[i];
+ MaskParent *parent = &point->parent;
+ if (parent == NULL || parent->id == NULL) {
+ continue;
+ }
+ build_id(parent->id);
+ if (parent->id_type == ID_MC) {
+ OperationKey movieclip_eval_key(
+ parent->id, NodeType::PARAMETERS, OperationCode::MOVIECLIP_EVAL);
+ add_relation(movieclip_eval_key, mask_eval_key, "Movie Clip -> Mask Eval");
+ }
+ }
+ }
+ }
}
void DepsgraphRelationBuilder::build_movieclip(MovieClip *clip)