Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 10 Apr 2018 09:59:23 +0000 (11:59 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 10 Apr 2018 10:00:10 +0000 (12:00 +0200)
1  2 
source/blender/blenkernel/intern/rigidbody.c
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.h
source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
source/blender/depsgraph/intern/depsgraph.cc
source/blender/editors/interface/interface_region_popup.c
source/blender/editors/screen/area.c
source/blender/editors/space_graph/space_graph.c
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_rigidbody.c

@@@ -2007,115 -1841,43 +1962,154 @@@ void DepsgraphRelationBuilder::build_mo
        build_animdata(&clip->id);
  }
  
 -                      data->builder->build_object((Object *)id);
 +void DepsgraphRelationBuilder::build_lightprobe(Object *object)
 +{
 +      LightProbe *probe = (LightProbe *)object->data;
 +      if (built_map_.checkIsBuiltAndTag(probe)) {
 +              return;
 +      }
 +      build_animdata(&probe->id);
 +
 +      OperationKey probe_key(&probe->id,
 +                             DEG_NODE_TYPE_PARAMETERS,
 +                             DEG_OPCODE_PLACEHOLDER,
 +                             "LightProbe Eval");
 +      OperationKey object_key(&object->id,
 +                              DEG_NODE_TYPE_PARAMETERS,
 +                              DEG_OPCODE_PLACEHOLDER,
 +                              "LightProbe Eval");
 +      add_relation(probe_key, object_key, "LightProbe Update");
 +}
 +
 +void DepsgraphRelationBuilder::build_copy_on_write_relations()
 +{
 +      foreach (IDDepsNode *id_node, graph_->id_nodes) {
 +              build_copy_on_write_relations(id_node);
 +      }
 +}
 +
 +void DepsgraphRelationBuilder::build_copy_on_write_relations(IDDepsNode *id_node)
 +{
 +      ID *id_orig = id_node->id_orig;
 +
 +      TimeSourceKey time_source_key;
 +      OperationKey copy_on_write_key(id_orig,
 +                                     DEG_NODE_TYPE_COPY_ON_WRITE,
 +                                     DEG_OPCODE_COPY_ON_WRITE);
 +      /* XXX: This is a quick hack to make Alt-A to work. */
 +      // add_relation(time_source_key, copy_on_write_key, "Fluxgate capacitor hack");
 +      /* Resat of code is using rather low level trickery, so need to get some
 +       * explicit pointers.
 +       */
 +      DepsNode *node_cow = find_node(copy_on_write_key);
 +      OperationDepsNode *op_cow = node_cow->get_exit_operation();
 +      /* Plug any other components to this one. */
 +      GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
 +      {
 +              if (comp_node->type == DEG_NODE_TYPE_COPY_ON_WRITE) {
 +                      /* Copy-on-write component never depends on itself. */
 +                      continue;
 +              }
 +              if (!comp_node->depends_on_cow()) {
 +                      /* Component explicitly requests to not add relation. */
 +                      continue;
 +              }
 +              /* All entry operations of each component should wait for a proper
 +               * copy of ID.
 +               */
 +              OperationDepsNode *op_entry = comp_node->get_entry_operation();
 +              if (op_entry != NULL) {
 +                      graph_->add_new_relation(op_cow, op_entry, "CoW Dependency");
 +              }
 +              /* All dangling operations should also be executed after copy-on-write. */
 +              GHASH_FOREACH_BEGIN(OperationDepsNode *, op_node, comp_node->operations_map)
 +              {
 +                      if (op_node->inlinks.size() == 0) {
 +                              graph_->add_new_relation(op_cow, op_node, "CoW Dependency");
 +                      }
 +                      else {
 +                              bool has_same_comp_dependency = false;
 +                              foreach (DepsRelation *rel, op_node->inlinks) {
 +                                      if (rel->from->type != DEG_NODE_TYPE_OPERATION) {
 +                                              continue;
 +                                      }
 +                                      OperationDepsNode *op_node_from = (OperationDepsNode *)rel->from;
 +                                      if (op_node_from->owner == op_node->owner) {
 +                                              has_same_comp_dependency = true;
 +                                              break;
 +                                      }
 +                              }
 +                              if (!has_same_comp_dependency) {
 +                                      graph_->add_new_relation(op_cow, op_node, "CoW Dependency");
 +                              }
 +                      }
 +              }
 +              GHASH_FOREACH_END();
 +              /* NOTE: We currently ignore implicit relations to an external
 +               * datablocks for copy-on-write operations. This means, for example,
 +               * copy-on-write component of Object will not wait for copy-on-write
 +               * component of it's Mesh. This is because pointers are all known
 +               * already so remapping will happen all correct. And then If some object
 +               * evaluation step needs geometry, it will have transitive dependency
 +               * to Mesh copy-on-write already.
 +               */
 +      }
 +      GHASH_FOREACH_END();
 +      /* TODO(sergey): This solves crash for now, but causes too many
 +       * updates potentially.
 +       */
 +      if (GS(id_orig->name) == ID_OB) {
 +              Object *object = (Object *)id_orig;
 +              ID *object_data_id = (ID *)object->data;
 +              if (object_data_id != NULL) {
 +                      OperationKey data_copy_on_write_key(object_data_id,
 +                                                          DEG_NODE_TYPE_COPY_ON_WRITE,
 +                                                          DEG_OPCODE_COPY_ON_WRITE);
 +                      add_relation(data_copy_on_write_key, copy_on_write_key, "Eval Order");
 +              }
 +              else {
 +                      BLI_assert(object->type == OB_EMPTY);
 +              }
 +      }
 +}
 +
+ /* **** ID traversal callbacks functions **** */
+ void DepsgraphRelationBuilder::modifier_walk(void *user_data,
+                                              struct Object * /*object*/,
+                                              struct ID **idpoin,
+                                              int /*cb_flag*/)
+ {
+       BuilderWalkUserData *data = (BuilderWalkUserData *)user_data;
+       ID *id = *idpoin;
+       if (id == NULL) {
+               return;
+       }
+       switch (GS(id->name)) {
+               case ID_OB:
 -                      data->builder->build_object((Object *)id);
++                      data->builder->build_object(NULL, (Object *)id);
+                       break;
+               case ID_TE:
+                       data->builder->build_texture((Tex *)id);
+                       break;
+               default:
+                       /* pass */
+                       break;
+       }
+ }
+ void DepsgraphRelationBuilder::constraint_walk(bConstraint * /*con*/,
+                                                ID **idpoin,
+                                                bool /*is_reference*/,
+                                                void *user_data)
+ {
+       BuilderWalkUserData *data = (BuilderWalkUserData *)user_data;
+       if (*idpoin) {
+               ID *id = *idpoin;
+               if (GS(id->name) == ID_OB) {
++                      data->builder->build_object(NULL, (Object *)id);
+               }
+       }
+ }
  }  // namespace DEG
@@@ -404,8 -409,14 +405,13 @@@ void DepsgraphRelationBuilder::build_ri
                        OperationKey parent_key(&object->id, DEG_NODE_TYPE_BONE, pchan->parent->name, parent_key_opcode);
                        add_relation(parent_key, bone_pose_key, "Parent Bone -> Child Bone");
                }
 -
 -              /* constraints */
 +              /* Buil constraints. */
                if (pchan->constraints.first != NULL) {
+                       /* Build relations for indirectly linked objects. */
+                       BuilderWalkUserData data;
+                       data.builder = this;
+                       BKE_constraints_id_loop(&pchan->constraints, constraint_walk, &data);
                        /* constraints stack and constraint dependencies */
                        build_constraints(&object->id, DEG_NODE_TYPE_BONE, pchan->name, &pchan->constraints, &root_map);
  
Simple merge
@@@ -1869,19 -1847,11 +1869,19 @@@ bool RNA_property_editable_info(Pointer
        }
  
        /* property from linked data-block */
 -      if (id && ID_IS_LINKED(id) && (prop->flag & PROP_LIB_EXCEPTION) == 0) {
 -              if (!(*r_info)[0]) {
 -                      *r_info = N_("Can't edit this property from a linked data-block");
 +      if (id) {
 +              if (ID_IS_LINKED(id) && (prop->flag & PROP_LIB_EXCEPTION) == 0) {
 +                      if (!(*r_info)[0]) {
-                               *r_info = "Can't edit this property from a linked data-block.";
++                              *r_info = N_("Can't edit this property from a linked data-block.");
 +                      }
 +                      return false;
 +              }
 +              if (id->override_static != NULL && !RNA_property_overridable(ptr, prop)) {
 +                      if (!(*r_info)[0]) {
-                               *r_info = "Can't edit this property from an override data-block.";
++                              *r_info = N_("Can't edit this property from an override data-block.");
 +                      }
 +                      return false;
                }
 -              return false;
        }
  
        return ((flag & PROP_EDITABLE) && (flag & PROP_REGISTER) == 0);