Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 12 Jun 2017 13:09:33 +0000 (15:09 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 12 Jun 2017 13:12:36 +0000 (15:12 +0200)
35 files changed:
1  2 
intern/cycles/blender/addon/engine.py
intern/cycles/blender/addon/properties.py
intern/cycles/blender/addon/ui.py
intern/cycles/blender/blender_session.cpp
intern/cycles/blender/blender_sync.cpp
intern/cycles/blender/blender_sync.h
intern/cycles/device/device.cpp
intern/cycles/device/device.h
release/scripts/startup/bl_ui/properties_material.py
release/scripts/startup/bl_ui/space_userpref.py
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/pbvh.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenkernel/intern/softbody.c
source/blender/blenloader/intern/readfile.c
source/blender/depsgraph/DEG_depsgraph_build.h
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.h
source/blender/depsgraph/intern/depsgraph_build.cc
source/blender/editors/animation/keyframes_edit.c
source/blender/editors/object/object_relations.c
source/blender/editors/physics/dynamicpaint_ops.c
source/blender/editors/physics/physics_pointcache.c
source/blender/editors/transform/transform_generics.c
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_particle.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/modifiers/intern/MOD_array.c
source/blender/modifiers/intern/MOD_curve.c
source/blender/windowmanager/intern/wm_files.c
tests/python/bl_alembic_import_test.py

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -1263,10 -1253,9 +1263,10 @@@ class INFO_MT_add(Menu)
              INFO_MT_camera_add.draw(self, context)
  
          layout.menu("INFO_MT_lamp_add", icon='OUTLINER_OB_LAMP')
 +        layout.menu("INFO_MT_lightprobe_add")
          layout.separator()
  
-         layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_EMPTY')
+         layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_FORCE_FIELD')
          layout.separator()
  
          if len(bpy.data.groups) > 10:
@@@ -2233,11 -2233,11 +2233,11 @@@ static void sb_cf_threads_run(Scene *sc
        MEM_freeN(sb_threads);
  }
  
 -static void softbody_calc_forcesEx(Scene *scene, Object *ob, float forcetime, float timenow)
 +static void softbody_calc_forcesEx(Scene *scene, SceneLayer *sl, Object *ob, float forcetime, float timenow)
  {
- /* rule we never alter free variables :bp->vec bp->pos in here !
-  * this will ruin adaptive stepsize AKA heun! (BM)
-  */
      /* rule we never alter free variables :bp->vec bp->pos in here !
+        * this will ruin adaptive stepsize AKA heun! (BM)
+        */
        SoftBody *sb= ob->soft; /* is supposed to be there */
        /*BodyPoint *bproot;*/ /* UNUSED */
        ListBase *do_effector = NULL;
@@@ -10374,7 -10159,7 +10374,7 @@@ void BLO_library_link_copypaste(Main *m
  
  static ID *link_named_part_ex(
          Main *mainl, FileData *fd, const short idcode, const char *name, const short flag,
-               Scene *scene, SceneLayer *sl, const bool use_placeholders, const bool force_indirect)
 -        Scene *scene, View3D *v3d, const bool use_placeholders, const bool force_indirect)
++        Scene *scene, SceneLayer *sl, const bool use_placeholders, const bool force_indirect)
  {
        ID *id = link_named_part(mainl, fd, idcode, name, use_placeholders, force_indirect);
  
@@@ -2159,89 -2234,89 +2141,92 @@@ static bool make_local_all__instance_in
        return changed;
  }
  
- static int make_local_exec(bContext *C, wmOperator *op)
+ static void make_local_animdata_tag_strips(ListBase *strips)
  {
-       Main *bmain = CTX_data_main(C);
-       Scene *scene = CTX_data_scene(C);
-       SceneLayer *sl = CTX_data_scene_layer(C);
-       SceneCollection *sc = CTX_data_scene_collection(C);
-       AnimData *adt;
-       ParticleSystem *psys;
-       Material *ma, ***matarar;
-       Lamp *la;
-       ID *id;
-       const int mode = RNA_enum_get(op->ptr, "type");
-       int a, b;
-       if (mode == MAKE_LOCAL_ALL) {
-               /* de-select so the user can differentiate newly instanced from existing objects */
-               BKE_scene_base_deselect_all(scene);
+       NlaStrip *strip;
  
-               if (make_local_all__instance_indirect_unused(bmain, scene, sl, sc)) {
-                       BKE_report(op->reports, RPT_INFO,
-                                  "Orphan library objects added to the current scene to avoid loss");
+       for (strip = strips->first; strip; strip = strip->next) {
+               if (strip->act) {
+                       strip->act->id.tag &= ~LIB_TAG_PRE_EXISTING;
+               }
+               if (strip->remap && strip->remap->target) {
+                       strip->remap->target->id.tag &= ~LIB_TAG_PRE_EXISTING;
                }
  
-               BKE_library_make_local(bmain, NULL, NULL, false, false); /* NULL is all libs */
-               WM_event_add_notifier(C, NC_WINDOW, NULL);
-               return OPERATOR_FINISHED;
+               make_local_animdata_tag_strips(&strip->strips);
        }
+ }
  
-       tag_localizable_objects(C, mode);
-       CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
-       {
-               if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
-                       continue;
+ /* Tag all actions used by given animdata to be made local. */
+ static void make_local_animdata_tag(AnimData *adt)
+ {
+       if (adt) {
+               /* Actions - Active and Temp */
+               if (adt->action) {
+                       adt->action->id.tag &= ~LIB_TAG_PRE_EXISTING;
+               }
+               if (adt->tmpact) {
+                       adt->tmpact->id.tag &= ~LIB_TAG_PRE_EXISTING;
+               }
+               /* Remaps */
+               if (adt->remap && adt->remap->target) {
+                       adt->remap->target->id.tag &= ~LIB_TAG_PRE_EXISTING;
                }
  
-               if (ob->id.lib)
-                       id_make_local(bmain, &ob->id, false, false);
-       }
-       CTX_DATA_END;
+               /* Drivers */
+               /* TODO: need to handle the ID-targets too? */
  
-       /* maybe object pointers */
-       CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
-       {
-               if (ob->id.lib == NULL) {
-                       ID_NEW_REMAP(ob->parent);
+               /* NLA Data */
+               for (NlaTrack *nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
+                       make_local_animdata_tag_strips(&nlt->strips);
                }
        }
-       CTX_DATA_END;
-       CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
-       {
-               if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
-                       continue;
-               }
+ }
  
-               id = ob->data;
+ static void make_local_material_tag(Material *ma)
+ {
+       if (ma) {
+               ma->id.tag &= ~LIB_TAG_PRE_EXISTING;
+               make_local_animdata_tag(BKE_animdata_from_id(&ma->id));
  
-               if (id && (ELEM(mode, MAKE_LOCAL_SELECT_OBDATA, MAKE_LOCAL_SELECT_OBDATA_MATERIAL))) {
-                       id_make_local(bmain, id, false, false);
-                       adt = BKE_animdata_from_id(id);
-                       if (adt) BKE_animdata_make_local(adt);
+               /* About nodetrees: root one is made local together with material, others we keep linked for now... */
  
-                       /* tag indirect data direct */
-                       matarar = give_matarar(ob);
-                       if (matarar) {
-                               for (a = 0; a < ob->totcol; a++) {
-                                       ma = (*matarar)[a];
-                                       if (ma)
-                                               id_lib_extern(&ma->id);
-                               }
+               for (int a = 0; a < MAX_MTEX; a++) {
+                       if (ma->mtex[a] && ma->mtex[a]->tex) {
+                               ma->mtex[a]->tex->id.tag &= ~LIB_TAG_PRE_EXISTING;
                        }
                }
+       }
+ }
  
-               for (psys = ob->particlesystem.first; psys; psys = psys->next)
-                       id_make_local(bmain, &psys->part->id, false, false);
+ static int make_local_exec(bContext *C, wmOperator *op)
+ {
+       Main *bmain = CTX_data_main(C);
+       Scene *scene = CTX_data_scene(C);
+       ParticleSystem *psys;
+       Material *ma, ***matarar;
+       Lamp *la;
+       const int mode = RNA_enum_get(op->ptr, "type");
+       int a;
+       /* Note: we (ab)use LIB_TAG_PRE_EXISTING to cherry pick which ID to make local... */
+       if (mode == MAKE_LOCAL_ALL) {
++              SceneLayer *sl = CTX_data_scene_layer(C);
++              SceneCollection *sc = CTX_data_scene_collection(C);
++
+               BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, false);
+               /* de-select so the user can differentiate newly instanced from existing objects */
+               BKE_scene_base_deselect_all(scene);
  
-               adt = BKE_animdata_from_id(&ob->id);
-               if (adt) BKE_animdata_make_local(adt);
 -              if (make_local_all__instance_indirect_unused(bmain, scene)) {
++              if (make_local_all__instance_indirect_unused(bmain, scene, sl, sc)) {
+                       BKE_report(op->reports, RPT_INFO, "Orphan library objects added to the current scene to avoid loss");
+               }
        }
-       CTX_DATA_END;
+       else {
+               BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, true);
+               tag_localizable_objects(C, mode);
  
-       if (mode == MAKE_LOCAL_SELECT_OBDATA_MATERIAL) {
                CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
                {
                        if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
@@@ -102,9 -102,43 +102,9 @@@ static void foreachObjectLink
        walk(userData, ob, &amd->offset_ob, IDWALK_CB_NOP);
  }
  
 -static void updateDepgraph(ModifierData *md, DagForest *forest,
 -                           struct Main *UNUSED(bmain),
 -                           struct Scene *UNUSED(scene),
 -                           Object *UNUSED(ob), DagNode *obNode)
 -{
 -      ArrayModifierData *amd = (ArrayModifierData *) md;
 -
 -      if (amd->start_cap) {
 -              DagNode *curNode = dag_get_node(forest, amd->start_cap);
 -
 -              dag_add_relation(forest, curNode, obNode,
 -                               DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Array Modifier");
 -      }
 -      if (amd->end_cap) {
 -              DagNode *curNode = dag_get_node(forest, amd->end_cap);
 -
 -              dag_add_relation(forest, curNode, obNode,
 -                               DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Array Modifier");
 -      }
 -      if (amd->curve_ob) {
 -              DagNode *curNode = dag_get_node(forest, amd->curve_ob);
 -              curNode->eval_flags |= DAG_EVAL_NEED_CURVE_PATH;
 -
 -              dag_add_relation(forest, curNode, obNode,
 -                               DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Array Modifier");
 -      }
 -      if (amd->offset_ob) {
 -              DagNode *curNode = dag_get_node(forest, amd->offset_ob);
 -
 -              dag_add_relation(forest, curNode, obNode,
 -                               DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Array Modifier");
 -      }
 -}
 -
  static void updateDepsgraph(ModifierData *md,
                              struct Main *UNUSED(bmain),
-                             struct Scene *scene,
+                             struct Scene *UNUSED(scene),
                              Object *UNUSED(ob),
                              struct DepsNodeHandle *node)
  {
@@@ -91,9 -92,26 +91,9 @@@ static void foreachObjectLink
        walk(userData, ob, &cmd->object, IDWALK_CB_NOP);
  }
  
 -static void updateDepgraph(ModifierData *md, DagForest *forest,
 -                           struct Main *UNUSED(bmain),
 -                           Scene *UNUSED(scene),
 -                           Object *UNUSED(ob),
 -                           DagNode *obNode)
 -{
 -      CurveModifierData *cmd = (CurveModifierData *) md;
 -
 -      if (cmd->object) {
 -              DagNode *curNode = dag_get_node(forest, cmd->object);
 -              curNode->eval_flags |= DAG_EVAL_NEED_CURVE_PATH;
 -
 -              dag_add_relation(forest, curNode, obNode,
 -                               DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Curve Modifier");
 -      }
 -}
 -
  static void updateDepsgraph(ModifierData *md,
                              struct Main *UNUSED(bmain),
-                             struct Scene *scene,
+                             struct Scene *UNUSED(scene),
                              Object *object,
                              struct DepsNodeHandle *node)
  {