Merge branch 'master' into blender2.8
authorBastien Montagne <montagne29@wanadoo.fr>
Fri, 14 Apr 2017 10:36:56 +0000 (12:36 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Fri, 14 Apr 2017 10:39:54 +0000 (12:39 +0200)
Conflicts:
source/blender/alembic/intern/abc_exporter.cc

1  2 
source/blender/alembic/intern/abc_exporter.cc
source/blender/alembic/intern/alembic_capi.cc
source/blender/blenfont/intern/blf_glyph.c
source/blender/editors/object/object_modifier.c
source/blender/editors/render/render_shading.c
source/blender/editors/sound/sound_ops.c
source/blender/modifiers/intern/MOD_surfacedeform.c

index 1b218b98f21b1781d960f0b854bda6cc2f7aba37,a8d1587abdb3286757767ab201023950f055f16a..ddbbf27392d94664a5d7e7620c1eddd12fbd7203
@@@ -124,19 -124,37 +124,37 @@@ static bool object_is_shape(Object *ob
        }
  }
  
- static bool export_object(const ExportSettings * const settings, const Base * const ob_base)
+ /**
+  * Returns whether this object should be exported into the Alembic file.
+  *
+  * @param settings export settings, used for options like 'selected only'.
 - * @param ob the object in question.
++ * @param ob the object's base in question.
+  * @param is_duplicated normally false; true when the object is instanced
+  *                      into the scene by a dupli-object (e.g. part of a
+  *                      dupligroup). This ignores selection and layer
+  *                      visibility, and assumes that the dupli-object itself
+  *                      (e.g. the group-instantiating empty) is exported.
+  */
 -static bool export_object(const ExportSettings * const settings, Object *ob,
++static bool export_object(const ExportSettings * const settings, const Base * const ob_base,
+                           bool is_duplicated)
  {
-       if (settings->selected_only && !object_selected(ob_base)) {
-               return false;
-       }
-       // FIXME Sybren: handle these cleanly (maybe just remove code), now using active scene layer instead.
-       if (settings->visible_layers_only && (ob_base->flag & BASE_VISIBLED) == 0) {
-               return false;
+       if (!is_duplicated) {
+               /* These two tests only make sense when the object isn't being instanced
+                * into the scene. When it is, its exportability is determined by
+                * its dupli-object and the DupliObject::no_draw property. */
 -              if (settings->selected_only && !parent_selected(ob)) {
++              if (settings->selected_only && !object_selected(ob_base)) {
+                       return false;
+               }
 -
 -              if (settings->visible_layers_only && !(settings->scene->lay & ob->lay)) {
++              // FIXME Sybren: handle these cleanly (maybe just remove code), now using active scene layer instead.
++              if (settings->visible_layers_only && (ob_base->flag & BASE_VISIBLED) == 0) {
+                       return false;
+               }
        }
  
 -      if (settings->renderable_only && (ob->restrictflag & OB_RESTRICT_RENDER)) {
 -              return false;
 -      }
 +      //      if (settings->renderable_only && (ob->restrictflag & OB_RESTRICT_RENDER)) {
 +      //              return false;
 +      //      }
  
        return true;
  }
@@@ -344,31 -362,35 +362,31 @@@ void AbcExporter::operator()(Main *bmai
  
  void AbcExporter::createTransformWritersHierarchy(EvaluationContext *eval_ctx)
  {
 -      Base *base = static_cast<Base *>(m_scene->base.first);
 -
 -      while (base) {
 +      for (Base *base = static_cast<Base *>(m_settings.sl->object_bases.first); base; base = base->next) {
                Object *ob = base->object;
  
-               if (export_object(&m_settings, base)) {
 -              switch (ob->type) {
 -                      case OB_LAMP:
 -                      case OB_LATTICE:
 -                      case OB_MBALL:
 -                      case OB_SPEAKER:
 -                              /* We do not export transforms for objects of these classes. */
 -                              break;
 -
 -                      default:
 -                              exploreTransform(eval_ctx, ob, ob->parent);
++              if (export_object(&m_settings, base, false)) {
 +                      switch (ob->type) {
 +                              case OB_LAMP:
 +                              case OB_LATTICE:
 +                              case OB_MBALL:
 +                              case OB_SPEAKER:
 +                                      /* We do not export transforms for objects of these classes. */
 +                                      break;
 +
 +                              default:
 +                                      exploreTransform(eval_ctx, base, ob->parent, NULL);
 +                      }
                }
 -
 -              base = base->next;
        }
  }
  
  void AbcExporter::createTransformWritersFlat()
  {
 -      Base *base = static_cast<Base *>(m_scene->base.first);
 -
 -      while (base) {
 +      for (Base *base = static_cast<Base *>(m_settings.sl->object_bases.first); base; base = base->next) {
                Object *ob = base->object;
  
-               if (!export_object(&m_settings, base)) {
 -              if (export_object(&m_settings, ob, false) && object_is_shape(ob)) {
++              if (export_object(&m_settings, base, false) && object_is_shape(ob)) {
                        std::string name = get_id_name(ob);
                        m_xforms[name] = new AbcTransformWriter(
                                             ob, m_writer->archive().getTop(), NULL,
        }
  }
  
 -void AbcExporter::exploreTransform(EvaluationContext *eval_ctx, Object *ob, Object *parent, Object *dupliObParent)
 +void AbcExporter::exploreTransform(EvaluationContext *eval_ctx, Base *ob_base, Object *parent, Object *dupliObParent)
  {
-       if (export_object(&m_settings, ob_base) && object_is_shape(ob)) {
 +      Object *ob = ob_base->object;
 +
 -      if (!export_object(&m_settings, ob, dupliObParent != NULL)) {
+       /* If an object isn't exported itself, its duplilist shouldn't be
+        * exported either. */
++      if (!export_object(&m_settings, ob_base, dupliObParent != NULL)) {
+               return;
+       }
+       if (object_is_shape(ob)) {
                createTransformWriter(ob, parent, dupliObParent);
        }
  
        ListBase *lb = object_duplilist(eval_ctx, m_scene, ob);
  
        if (lb) {
-               for (DupliObject *link = static_cast<DupliObject *>(lb->first); link; link = link->next) {
-                       Object *dupli_ob = NULL;
-                       Object *dupli_parent = NULL;
 +              Base fake_base = *ob_base;  // copy flags (like selection state) from the real object.
 +              fake_base.next = fake_base.prev = NULL;
 +
+               DupliObject *link = static_cast<DupliObject *>(lb->first);
+               Object *dupli_ob = NULL;
+               Object *dupli_parent = NULL;
+               
+               for (; link; link = link->next) {
+                       /* This skips things like custom bone shapes. */
+                       if (m_settings.renderable_only && link->no_draw) {
+                               continue;
+                       }
  
                        if (link->type == OB_DUPLIGROUP) {
                                dupli_ob = link->ob;
@@@ -467,21 -502,29 +497,33 @@@ void AbcExporter::createShapeWriters(Ev
        }
  }
  
 -void AbcExporter::exploreObject(EvaluationContext *eval_ctx, Object *ob, Object *dupliObParent)
 +void AbcExporter::exploreObject(EvaluationContext *eval_ctx, Base *ob_base, Object *dupliObParent)
  {
-       Object *ob = ob_base->object;
-       ListBase *lb = object_duplilist(eval_ctx, m_scene, ob);
-       
+       /* If an object isn't exported itself, its duplilist shouldn't be
+        * exported either. */
 -      if (!export_object(&m_settings, ob, dupliObParent != NULL)) {
++      if (!export_object(&m_settings, ob_base, dupliObParent != NULL)) {
+               return;
+       }
 -      createShapeWriter(ob, dupliObParent);
 +      createShapeWriter(ob_base, dupliObParent);
        
++      Object *ob = ob_base->object;
+       ListBase *lb = object_duplilist(eval_ctx, m_scene, ob);
        if (lb) {
-               for (DupliObject *dupliob = static_cast<DupliObject *>(lb->first); dupliob; dupliob = dupliob->next) {
-                       if (dupliob->type == OB_DUPLIGROUP) {
-                               fake_base.object = dupliob->ob;
 +              Base fake_base = *ob_base;  // copy flags (like selection state) from the real object.
 +              fake_base.next = fake_base.prev = NULL;
 +
 -
+               DupliObject *link = static_cast<DupliObject *>(lb->first);
+               for (; link; link = link->next) {
+                       /* This skips things like custom bone shapes. */
+                       if (m_settings.renderable_only && link->no_draw) {
+                               continue;
+                       }
 -                              exploreObject(eval_ctx, link->ob, ob);
+                       if (link->type == OB_DUPLIGROUP) {
++                              fake_base.object = link->ob;
 +                              exploreObject(eval_ctx, &fake_base, ob);
                        }
                }
        }