Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 14 Jun 2017 10:02:58 +0000 (12:02 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 14 Jun 2017 10:02:58 +0000 (12:02 +0200)
1  2 
source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc

index e1420834786ae98c7f2f04288448febb2f2f0050,55f1f93be6a4d8a7a389eccd2efb7b4dfb615dad..5ec541612f5fe39597809dc34d51486477524dca
@@@ -62,7 -62,6 +62,7 @@@ extern "C" 
  #include "DNA_node_types.h"
  #include "DNA_particle_types.h"
  #include "DNA_object_types.h"
 +#include "DNA_lightprobe_types.h"
  #include "DNA_rigidbody_types.h"
  #include "DNA_scene_types.h"
  #include "DNA_texture_types.h"
@@@ -73,6 -72,7 +73,6 @@@
  #include "BKE_animsys.h"
  #include "BKE_constraint.h"
  #include "BKE_curve.h"
 -#include "BKE_depsgraph.h"
  #include "BKE_effect.h"
  #include "BKE_fcurve.h"
  #include "BKE_idcode.h"
@@@ -125,7 -125,7 +125,7 @@@ static void modifier_walk(void *user_da
  {
        BuilderWalkUserData *data = (BuilderWalkUserData *)user_data;
        if (*obpoin) {
 -              data->builder->build_object(data->scene, NULL, *obpoin);
 +              data->builder->build_object(data->scene, *obpoin);
        }
  }
  
@@@ -138,7 -138,7 +138,7 @@@ void constraint_walk(bConstraint * /*co
        if (*idpoin) {
                ID *id = *idpoin;
                if (GS(id->name) == ID_OB) {
 -                      data->builder->build_object(data->scene, NULL, (Object *)id);
 +                      data->builder->build_object(data->scene, (Object *)id);
                }
        }
  }
@@@ -292,7 -292,9 +292,7 @@@ void DepsgraphNodeBuilder::begin_build(
        } FOREACH_NODETREE_END
  }
  
 -void DepsgraphNodeBuilder::build_group(Scene *scene,
 -                                       Base *base,
 -                                       Group *group)
 +void DepsgraphNodeBuilder::build_group(Scene *scene, Group *group)
  {
        ID *group_id = &group->id;
        if (group_id->tag & LIB_TAG_DOIT) {
        group_id->tag |= LIB_TAG_DOIT;
  
        LINKLIST_FOREACH (GroupObject *, go, &group->gobject) {
 -              build_object(scene, base, go->ob);
 +              build_object(scene, go->ob);
        }
  }
  
 -void DepsgraphNodeBuilder::build_object(Scene *scene, Base *base, Object *ob)
 +void DepsgraphNodeBuilder::build_object(Scene *scene, Object *ob)
  {
 -      const bool has_object = (ob->id.tag & LIB_TAG_DOIT);
 -      IDDepsNode *id_node = (has_object)
 -              ? m_graph->find_id_node(&ob->id)
 -              : add_id_node(&ob->id);
 -      /* Update node layers.
 -       * Do it for both new and existing ID nodes. This is so because several
 -       * bases might be sharing same object.
 -       */
 -      if (base != NULL) {
 -              id_node->layers |= base->lay;
 -      }
 -      if (ob == scene->camera) {
 -              /* Camera should always be updated, it used directly by viewport. */
 -              id_node->layers |= (unsigned int)(-1);
 -      }
        /* Skip rest of components if the ID node was already there. */
 -      if (has_object) {
 +      if (ob->id.tag & LIB_TAG_DOIT) {
                return;
        }
        ob->id.tag |= LIB_TAG_DOIT;
 +
 +      /* Create ID node for obejct and begin init. */
 +      IDDepsNode *id_node = add_id_node(&ob->id);
        ob->customdata_mask = 0;
  
        /* Standard components. */
        build_object_transform(scene, ob);
  
        if (ob->parent != NULL) {
 -              build_object(scene, NULL, ob->parent);
 +              build_object(scene, ob->parent);
        }
        if (ob->modifiers.first != NULL) {
                BuilderWalkUserData data;
                                build_camera(ob);
                                break;
  
 +                      case OB_LIGHTPROBE:
 +                              build_lightprobe(ob);
 +                              break;
 +
                        default:
                        {
                                ID *obdata = (ID *)ob->data;
        /* Object that this is a proxy for. */
        if (ob->proxy) {
                ob->proxy->proxy_from = ob;
 -              build_object(scene, base, ob->proxy);
 +              build_object(scene, ob->proxy);
        }
  
        /* Object dupligroup. */
        if (ob->dup_group != NULL) {
 -              build_group(scene, base, ob->dup_group);
 +              build_group(scene, ob->dup_group);
        }
  }
  
@@@ -426,8 -436,8 +426,8 @@@ void DepsgraphNodeBuilder::build_object
  
        /* local transforms (from transform channels - loc/rot/scale + deltas) */
        op_node = add_operation_node(&ob->id, DEG_NODE_TYPE_TRANSFORM,
-                          function_bind(BKE_object_eval_local_transform, _1, scene, ob),
-                          DEG_OPCODE_TRANSFORM_LOCAL);
+                                    function_bind(BKE_object_eval_local_transform, _1, scene, ob),
+                                    DEG_OPCODE_TRANSFORM_LOCAL);
        op_node->set_as_entry();
  
        /* object parent */
@@@ -720,10 -730,10 +720,10 @@@ void DepsgraphNodeBuilder::build_obdata
         * Does this depend on other nodes?
         */
        op_node = add_operation_node(&ob->id,
-                          DEG_NODE_TYPE_PARAMETERS,
-                          NULL,
-                          DEG_OPCODE_PLACEHOLDER,
-                          "Parameters Eval");
+                                    DEG_NODE_TYPE_PARAMETERS,
+                                    NULL,
+                                    DEG_OPCODE_PLACEHOLDER,
+                                    "Parameters Eval");
        op_node->set_as_exit();
  
        /* Temporary uber-update node, which does everything.
         * TODO(sergey): Get rid of this node.
         */
        op_node = add_operation_node(&ob->id,
-                          DEG_NODE_TYPE_GEOMETRY,
-                          function_bind(BKE_object_eval_uber_data, _1, scene, ob),
-                          DEG_OPCODE_GEOMETRY_UBEREVAL);
+                                    DEG_NODE_TYPE_GEOMETRY,
+                                    function_bind(BKE_object_eval_uber_data, _1, scene, ob),
+                                    DEG_OPCODE_GEOMETRY_UBEREVAL);
        op_node->set_as_exit();
  
        op_node = add_operation_node(&ob->id,
-                          DEG_NODE_TYPE_GEOMETRY,
-                          NULL,
-                          DEG_OPCODE_PLACEHOLDER,
-                          "Eval Init");
+                                    DEG_NODE_TYPE_GEOMETRY,
+                                    NULL,
+                                    DEG_OPCODE_PLACEHOLDER,
+                                    "Eval Init");
        op_node->set_as_entry();
  
        // TODO: "Done" operation
  
                        /* evaluation operations */
                        op_node = add_operation_node(obdata,
-                                          DEG_NODE_TYPE_GEOMETRY,
-                                          function_bind(BKE_mesh_eval_geometry,
-                                                        _1,
-                                                        (Mesh *)obdata),
-                                          DEG_OPCODE_PLACEHOLDER,
-                                          "Geometry Eval");
+                                                    DEG_NODE_TYPE_GEOMETRY,
+                                                    function_bind(BKE_mesh_eval_geometry,
+                                                                  _1,
+                                                                  (Mesh *)obdata),
+                                                    DEG_OPCODE_PLACEHOLDER,
+                                                    "Geometry Eval");
                        op_node->set_as_entry();
                        break;
                }
                                /* metaball evaluation operations */
                                /* NOTE: only the motherball gets evaluated! */
                                op_node = add_operation_node(obdata,
-                                                  DEG_NODE_TYPE_GEOMETRY,
-                                                  function_bind(BKE_mball_eval_geometry,
-                                                                _1,
-                                                                (MetaBall *)obdata),
-                                                  DEG_OPCODE_PLACEHOLDER,
-                                                  "Geometry Eval");
+                                                            DEG_NODE_TYPE_GEOMETRY,
+                                                            function_bind(BKE_mball_eval_geometry,
+                                                                          _1,
+                                                                          (MetaBall *)obdata),
+                                                            DEG_OPCODE_PLACEHOLDER,
+                                                            "Geometry Eval");
                                op_node->set_as_entry();
                        }
                        break;
                        /* Curve/nurms evaluation operations. */
                        /* - calculate curve geometry (including path) */
                        op_node = add_operation_node(obdata,
-                                          DEG_NODE_TYPE_GEOMETRY,
-                                          function_bind(BKE_curve_eval_geometry,
-                                                        _1,
-                                                        (Curve *)obdata),
-                                          DEG_OPCODE_PLACEHOLDER,
-                                          "Geometry Eval");
+                                                    DEG_NODE_TYPE_GEOMETRY,
+                                                    function_bind(BKE_curve_eval_geometry,
+                                                                  _1,
+                                                                  (Curve *)obdata),
+                                                                  DEG_OPCODE_PLACEHOLDER,
+                                                                  "Geometry Eval");
                        op_node->set_as_entry();
  
                        /* Calculate curve path - this is used by constraints, etc. */
                         */
                        Curve *cu = (Curve *)obdata;
                        if (cu->bevobj != NULL) {
 -                              build_object(scene, NULL, cu->bevobj);
 +                              build_object(scene, cu->bevobj);
                        }
                        if (cu->taperobj != NULL) {
 -                              build_object(scene, NULL, cu->taperobj);
 +                              build_object(scene, cu->taperobj);
                        }
                        if (ob->type == OB_FONT && cu->textoncurve != NULL) {
 -                              build_object(scene, NULL, cu->textoncurve);
 +                              build_object(scene, cu->textoncurve);
                        }
                        break;
                }
                {
                        /* Lattice evaluation operations. */
                        op_node = add_operation_node(obdata,
-                                          DEG_NODE_TYPE_GEOMETRY,
-                                          function_bind(BKE_lattice_eval_geometry,
-                                                        _1,
-                                                        (Lattice *)obdata),
-                                          DEG_OPCODE_PLACEHOLDER,
-                                          "Geometry Eval");
+                                                    DEG_NODE_TYPE_GEOMETRY,
+                                                    function_bind(BKE_lattice_eval_geometry,
+                                                                  _1,
+                                                                  (Lattice *)obdata),
+                                                                  DEG_OPCODE_PLACEHOLDER,
+                                                                  "Geometry Eval");
                        op_node->set_as_entry();
                        break;
                }
@@@ -948,7 -958,7 +948,7 @@@ void DepsgraphNodeBuilder::build_nodetr
  
        /* Parameters for drivers. */
        op_node = add_operation_node(ntree_id, DEG_NODE_TYPE_PARAMETERS, NULL,
-                          DEG_OPCODE_PLACEHOLDER, "Parameters Eval");
+                                    DEG_OPCODE_PLACEHOLDER, "Parameters Eval");
        op_node->set_as_exit();
  
        /* nodetree's nodes... */
@@@ -1095,35 -1105,10 +1095,35 @@@ void DepsgraphNodeBuilder::build_mask(M
        build_animdata(mask_id);
  }
  
 -void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip) {
 +void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip)
 +{
        ID *clip_id = &clip->id;
        add_id_node(clip_id);
        build_animdata(clip_id);
  }
  
 +void DepsgraphNodeBuilder::build_lightprobe(Object *object)
 +{
 +      LightProbe *probe = (LightProbe *)object->data;
 +      ID *probe_id = &probe->id;
 +      if (probe_id->tag & LIB_TAG_DOIT) {
 +              return;
 +      }
 +      probe_id->tag |= LIB_TAG_DOIT;
 +      /* Placeholder so we can add relations and tag ID node for update. */
 +      add_operation_node(probe_id,
 +                         DEG_NODE_TYPE_PARAMETERS,
 +                         NULL,
 +                         DEG_OPCODE_PLACEHOLDER,
 +                         "LightProbe Eval");
 +
 +      add_operation_node(&object->id,
 +                         DEG_NODE_TYPE_PARAMETERS,
 +                         NULL,
 +                         DEG_OPCODE_PLACEHOLDER,
 +                         "LightProbe Eval");
 +
 +      build_animdata(probe_id);
 +}
 +
  }  // namespace DEG
index 8dd01fe9551cdbbcf47d8432d970dbfdc35dbdf0,fe7ccaa7fc02ae837b1c7eb5fea52366b05d1a3f..51b27912298b3aca39e6baf5294684a621300e60
@@@ -133,7 -133,7 +133,7 @@@ void DepsgraphNodeBuilder::build_rig(Sc
  
        /* Rebuild pose if not up to date. */
        if (ob->pose == NULL || (ob->pose->flag & POSE_RECALC)) {
 -              BKE_pose_rebuild_ex(ob, arm, false);
 +              BKE_pose_rebuild(ob, arm);
                /* XXX: Without this animation gets lost in certain circumstances
                 * after loading file. Need to investigate further since it does
                 * not happen with simple scenes..
@@@ -255,9 -255,9 +255,9 @@@ void DepsgraphNodeBuilder::build_proxy_
        }
  
        op_node = add_operation_node(&ob->id,
-                          DEG_NODE_TYPE_EVAL_POSE,
-                          function_bind(BKE_pose_eval_proxy_copy, _1, ob),
-                          DEG_OPCODE_POSE_INIT);
+                                    DEG_NODE_TYPE_EVAL_POSE,
+                                    function_bind(BKE_pose_eval_proxy_copy, _1, ob),
+                                    DEG_OPCODE_POSE_INIT);
        op_node->set_as_entry();
  
        LINKLIST_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {