Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 16 Jan 2018 15:40:05 +0000 (16:40 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 16 Jan 2018 15:40:05 +0000 (16:40 +0100)
1  2 
source/blender/blenkernel/intern/anim_sys.c
source/blender/makesrna/intern/rna_depsgraph.c

index 706fb23ab56a4dc087de2cf4947ecba3a297c6ca,c6b18d8d387c23298a2c70d2d95e105a3c12bb43..e6e1c714008ef9e06bf20aab93003da41ca52c29
  
  #ifdef RNA_RUNTIME
  
 +#include "BLI_iterator.h"
 +
  #include "DEG_depsgraph_build.h"
  #include "DEG_depsgraph_debug.h"
 +#include "DEG_depsgraph_query.h"
 +
 +#include "MEM_guardedalloc.h"
 +
 +/* **************** Depsgraph **************** */
 +
 +static PointerRNA rna_DepsgraphIter_object_get(PointerRNA *ptr)
 +{
 +      BLI_Iterator *iterator = ptr->data;
 +      return rna_pointer_inherit_refine(ptr, &RNA_Object, iterator->current);
 +}
 +
 +static PointerRNA rna_DepsgraphIter_instance_object_get(PointerRNA *ptr)
 +{
 +      BLI_Iterator *iterator = ptr->data;
 +      DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
 +      Object *instance_object = NULL;
 +      if (deg_iter->dupli_object_current != NULL) {
 +              instance_object = deg_iter->dupli_object_current->ob;
 +      }
 +      return rna_pointer_inherit_refine(ptr, &RNA_Object, instance_object);
 +}
 +
 +static PointerRNA rna_DepsgraphIter_parent_get(PointerRNA *ptr)
 +{
 +      BLI_Iterator *iterator = ptr->data;
 +      DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
 +      Object *dupli_parent = NULL;
 +      if (deg_iter->dupli_object_current != NULL) {
 +              dupli_parent = deg_iter->dupli_parent;
 +      }
 +      return rna_pointer_inherit_refine(ptr, &RNA_Object, dupli_parent);
 +}
 +
 +static void rna_DepsgraphIter_persistent_id_get(PointerRNA *ptr, int *persistent_id)
 +{
 +      BLI_Iterator *iterator = ptr->data;
 +      DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
 +      memcpy(persistent_id, deg_iter->dupli_object_current->persistent_id,
 +             sizeof(deg_iter->dupli_object_current->persistent_id));
 +}
 +
 +static void rna_DepsgraphIter_orco_get(PointerRNA *ptr, float *orco)
 +{
 +      BLI_Iterator *iterator = ptr->data;
 +      DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
 +      memcpy(orco, deg_iter->dupli_object_current->orco,
 +             sizeof(deg_iter->dupli_object_current->orco));
 +}
 +
 +static unsigned int rna_DepsgraphIter_random_id_get(PointerRNA *ptr)
 +{
 +      BLI_Iterator *iterator = ptr->data;
 +      DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
 +      return deg_iter->dupli_object_current->random_id;
 +}
 +
 +static void rna_DepsgraphIter_uv_get(PointerRNA *ptr, float *uv)
 +{
 +      BLI_Iterator *iterator = ptr->data;
 +      DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
 +      memcpy(uv, deg_iter->dupli_object_current->uv,
 +             sizeof(deg_iter->dupli_object_current->uv));
 +}
 +
 +static int rna_DepsgraphIter_is_instance_get(PointerRNA *ptr)
 +{
 +      BLI_Iterator *iterator = ptr->data;
 +      DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
 +      return (deg_iter->dupli_object_current != NULL);
 +}
 +
 +/* **************** Depsgraph **************** */
  
- static void rna_Depsgraph_debug_relations_graphviz(Depsgraph *graph,
+ static void rna_Depsgraph_debug_relations_graphviz(Depsgraph *depsgraph,
                                                     const char *filename)
  {
        FILE *f = fopen(filename, "w");
@@@ -143,101 -68,18 +143,101 @@@ static void rna_Depsgraph_debug_stats_g
        fclose(f);
  }
  
- static void rna_Depsgraph_debug_tag_update(Depsgraph *graph)
+ static void rna_Depsgraph_debug_tag_update(Depsgraph *depsgraph)
  {
-       DEG_graph_tag_relations_update(graph);
+       DEG_graph_tag_relations_update(depsgraph);
  }
  
- static void rna_Depsgraph_debug_stats(Depsgraph *graph, char *result)
+ static void rna_Depsgraph_debug_stats(Depsgraph *depsgraph, char *result)
  {
        size_t outer, ops, rels;
-       DEG_stats_simple(graph, &outer, &ops, &rels);
+       DEG_stats_simple(depsgraph, &outer, &ops, &rels);
        BLI_snprintf(result, STATS_MAX_SIZE,
                    "Approx %lu Operations, %lu Relations, %lu Outer Nodes",
 -                  ops, rels, outer);
 +                   ops, rels, outer);
 +}
 +
 +/* Iteration over objects, simple version */
 +
 +static void rna_Depsgraph_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 +{
 +      iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
 +      DEGObjectIterData *data = MEM_callocN(sizeof(DEGObjectIterData), __func__);
 +
 +      data->graph = (Depsgraph *)ptr->data;
 +      data->flag = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
 +                   DEG_ITER_OBJECT_FLAG_VISIBLE |
 +                   DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET;
 +      data->mode = DEG_ITER_OBJECT_MODE_RENDER;
 +
 +      ((BLI_Iterator *)iter->internal.custom)->valid = true;
 +      DEG_iterator_objects_begin(iter->internal.custom, data);
 +      iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
 +}
 +
 +static void rna_Depsgraph_objects_next(CollectionPropertyIterator *iter)
 +{
 +      DEG_iterator_objects_next(iter->internal.custom);
 +      iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
 +}
 +
 +static void rna_Depsgraph_objects_end(CollectionPropertyIterator *iter)
 +{
 +      DEG_iterator_objects_end(iter->internal.custom);
 +      MEM_freeN(((BLI_Iterator *)iter->internal.custom)->data);
 +      MEM_freeN(iter->internal.custom);
 +}
 +
 +static PointerRNA rna_Depsgraph_objects_get(CollectionPropertyIterator *iter)
 +{
 +      Object *ob = ((BLI_Iterator *)iter->internal.custom)->current;
 +      return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ob);
 +}
 +
 +/* Iteration over objects, extended version
 + *
 + * Contains extra information about duplicator and persistent ID.
 + */
 +
 +static void rna_Depsgraph_duplis_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 +{
 +      iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
 +      DEGObjectIterData *data = MEM_callocN(sizeof(DEGObjectIterData), __func__);
 +
 +      data->graph = (Depsgraph *)ptr->data;
 +      data->flag = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
 +                   DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET |
 +                   DEG_ITER_OBJECT_FLAG_VISIBLE |
 +                   DEG_ITER_OBJECT_FLAG_DUPLI;
 +      data->mode = DEG_ITER_OBJECT_MODE_RENDER;
 +
 +      ((BLI_Iterator *)iter->internal.custom)->valid = true;
 +      DEG_iterator_objects_begin(iter->internal.custom, data);
 +      iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
 +}
 +
 +static void rna_Depsgraph_duplis_next(CollectionPropertyIterator *iter)
 +{
 +      DEG_iterator_objects_next(iter->internal.custom);
 +      iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
 +}
 +
 +static void rna_Depsgraph_duplis_end(CollectionPropertyIterator *iter)
 +{
 +      DEG_iterator_objects_end(iter->internal.custom);
 +      MEM_freeN(((BLI_Iterator *)iter->internal.custom)->data);
 +      MEM_freeN(iter->internal.custom);
 +}
 +
 +static PointerRNA rna_Depsgraph_duplis_get(CollectionPropertyIterator *iter)
 +{
 +      BLI_Iterator *iterator = (BLI_Iterator *)iter->internal.custom;
 +      return rna_pointer_inherit_refine(&iter->parent, &RNA_DepsgraphIter, iterator);
 +}
 +
 +static ID *rna_Depsgraph_evaluated_id_get(Depsgraph *depsgraph, ID *id_orig)
 +{
 +      return DEG_get_evaluated_id(depsgraph, id_orig);
  }
  
  #else