Merge branch 'master' into blender2.8
authorBastien Montagne <montagne29@wanadoo.fr>
Mon, 11 Jul 2016 22:01:38 +0000 (00:01 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Mon, 11 Jul 2016 22:07:44 +0000 (00:07 +0200)
Conflicts:
intern/cycles/blender/addon/ui.py
source/blender/blenkernel/BKE_particle.h
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_distribute.c
source/blender/blenkernel/intern/texture.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_relations.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/physics/particle_object.c
source/blender/editors/transform/transform_snap_object.c

67 files changed:
1  2 
intern/cycles/blender/addon/ui.py
release/scripts/startup/bl_ui/space_dopesheet.py
release/scripts/startup/bl_ui/space_view3d.py
release/scripts/startup/bl_ui/space_view3d_toolbar.py
source/blender/blenkernel/BKE_library.h
source/blender/blenkernel/BKE_object.h
source/blender/blenkernel/BKE_texture.h
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/bpath.c
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/group.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/library_query.c
source/blender/blenkernel/intern/library_remap.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/object_update.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/softbody.c
source/blender/blenkernel/intern/texture.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/versioning_250.c
source/blender/blenloader/intern/writefile.c
source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
source/blender/editors/animation/anim_channels_edit.c
source/blender/editors/animation/anim_filter.c
source/blender/editors/include/ED_anim_api.h
source/blender/editors/interface/interface_icons.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_modifier.c
source/blender/editors/object/object_ops.c
source/blender/editors/object/object_relations.c
source/blender/editors/render/render_shading.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_outliner/outliner_draw.c
source/blender/editors/space_outliner/outliner_intern.h
source/blender/editors/space_outliner/outliner_tree.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_manipulator.c
source/blender/editors/transform/transform_snap_object.c
source/blender/gpu/GPU_material.h
source/blender/gpu/intern/gpu_material.c
source/blender/makesdna/DNA_ID.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_space_types.h
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/intern/rna_ID.c
source/blender/makesrna/intern/rna_action.c
source/blender/makesrna/intern/rna_main_api.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/modifiers/intern/MOD_solidify.c
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/pipeline.c

Simple merge
@@@ -323,17 -333,20 +332,17 @@@ bool id_make_local(Main *bmain, ID *id
                case ID_GR:
                        return false; /* not implemented */
                case ID_AR:
-                       if (!test) BKE_armature_make_local((bArmature *)id);
+                       if (!test) BKE_armature_make_local(bmain, (bArmature *)id);
                        return true;
                case ID_AC:
-                       if (!test) BKE_action_make_local((bAction *)id);
+                       if (!test) BKE_action_make_local(bmain, (bAction *)id);
                        return true;
                case ID_NT:
-                       if (!test) ntreeMakeLocal((bNodeTree *)id, true);
+                       if (!test) ntreeMakeLocal(bmain, (bNodeTree *)id, true);
                        return true;
                case ID_BR:
-                       if (!test) BKE_brush_make_local((Brush *)id);
+                       if (!test) BKE_brush_make_local(bmain, (Brush *)id);
                        return true;
 -              case ID_PA:
 -                      if (!test) BKE_particlesettings_make_local(bmain, (ParticleSettings *)id);
 -                      return true;
                case ID_WM:
                        return false; /* can't be linked */
                case ID_GD:
@@@ -412,20 -427,23 +423,20 @@@ bool id_copy(Main *bmain, ID *id, ID **
                case ID_SO:
                        return false;  /* not implemented */
                case ID_GR:
-                       if (!test) *newid = (ID *)BKE_group_copy((Group *)id);
+                       if (!test) *newid = (ID *)BKE_group_copy(bmain, (Group *)id);
                        return true;
                case ID_AR:
-                       if (!test) *newid = (ID *)BKE_armature_copy((bArmature *)id);
+                       if (!test) *newid = (ID *)BKE_armature_copy(bmain, (bArmature *)id);
                        return true;
                case ID_AC:
-                       if (!test) *newid = (ID *)BKE_action_copy((bAction *)id);
+                       if (!test) *newid = (ID *)BKE_action_copy(bmain, (bAction *)id);
                        return true;
                case ID_NT:
-                       if (!test) *newid = (ID *)ntreeCopyTree((bNodeTree *)id);
+                       if (!test) *newid = (ID *)ntreeCopyTree(bmain, (bNodeTree *)id);
                        return true;
                case ID_BR:
-                       if (!test) *newid = (ID *)BKE_brush_copy((Brush *)id);
+                       if (!test) *newid = (ID *)BKE_brush_copy(bmain, (Brush *)id);
                        return true;
 -              case ID_PA:
 -                      if (!test) *newid = (ID *)BKE_particlesettings_copy(bmain, (ParticleSettings *)id);
 -                      return true;
                case ID_WM:
                        return false;  /* can't be copied from here */
                case ID_GD:
@@@ -71,7 -72,9 +72,8 @@@
  #include "BKE_fcurve.h"
  #include "BKE_library.h"
  #include "BKE_library_query.h"
+ #include "BKE_main.h"
  #include "BKE_modifier.h"
 -#include "BKE_particle.h"
  #include "BKE_rigidbody.h"
  #include "BKE_sca.h"
  #include "BKE_sequencer.h"
@@@ -399,8 -417,14 +403,13 @@@ void BKE_library_foreach_ID_link(ID *id
                        case ID_OB:
                        {
                                Object *object = (Object *) id;
 -                              ParticleSystem *psys;
  
+                               /* Object is special, proxies make things hard... */
+                               const int data_cd_flag = data.cd_flag;
+                               const int proxy_cd_flag = (object->proxy || object->proxy_group) ? IDWALK_INDIRECT_USAGE : 0;
                                /* object data special case */
+                               data.cd_flag |= proxy_cd_flag;
                                if (object->type == OB_EMPTY) {
                                        /* empty can have NULL or Image */
                                        CALLBACK_INVOKE_ID(object->data, IDWALK_USER);
@@@ -743,6 -854,82 +785,80 @@@ void BKE_library_update_ID_link_user(I
        }
  }
  
 -                                                ID_OB, ID_MA, ID_GD, ID_GR, ID_TE, ID_PA, ID_TXT, ID_SO, ID_MC, ID_IM, ID_AC
+ /**
+  * Say whether given \a id_type_owner can use (in any way) a datablock of \a id_type_used.
+  */
+ /* This is a 'simplified' abstract version of BKE_library_foreach_ID_link() above, quite useful to reduce
+  * useless ietrations in some cases. */
+ bool BKE_library_idtype_can_use_idtype(const short id_type_owner, const short id_type_used)
+ {
+       if (id_type_used == ID_AC) {
+               return id_type_can_have_animdata(id_type_owner);
+       }
+       switch (id_type_owner) {
+               case ID_LI:
+                       return ELEM(id_type_used, ID_LI);
+               case ID_SCE:
+                       return (ELEM(id_type_used, ID_OB, ID_WO, ID_SCE, ID_MC, ID_MA, ID_GR, ID_TXT,
+                                                  ID_LS, ID_MSK, ID_SO, ID_GD, ID_BR, ID_PAL, ID_IM, ID_NT) ||
+                               BKE_library_idtype_can_use_idtype(ID_NT, id_type_used));
+               case ID_OB:
+                       /* Could be the following, but simpler to just always say 'yes' here. */
+ #if 0
+                       return ELEM(id_type_used, ID_ME, ID_CU, ID_MB, ID_LT, ID_SPK, ID_AR, ID_LA, ID_CA,  /* obdata */
 -              case ID_PA:
 -                      return ELEM(id_type_used, ID_OB, ID_GR, ID_TE);
++                                                ID_OB, ID_MA, ID_GD, ID_GR, ID_TE, ID_TXT, ID_SO, ID_MC, ID_IM, ID_AC
+                                                 /* + constraints, modifiers and game logic ID types... */);
+ #else
+                       return true;
+ #endif
+               case ID_ME:
+                       return ELEM(id_type_used, ID_ME, ID_KE, ID_MA);
+               case ID_CU:
+                       return ELEM(id_type_used, ID_OB, ID_KE, ID_MA, ID_VF);
+               case ID_MB:
+                       return ELEM(id_type_used, ID_MA);
+               case ID_MA:
+                       return (ELEM(id_type_used, ID_TE, ID_GR) || BKE_library_idtype_can_use_idtype(ID_NT, id_type_used));
+               case ID_TE:
+                       return (ELEM(id_type_used, ID_IM, ID_OB) || BKE_library_idtype_can_use_idtype(ID_NT, id_type_used));
+               case ID_LT:
+                       return ELEM(id_type_used, ID_KE);
+               case ID_LA:
+                       return (ELEM(id_type_used, ID_TE) || BKE_library_idtype_can_use_idtype(ID_NT, id_type_used));
+               case ID_CA:
+                       return ELEM(id_type_used, ID_OB);
+               case ID_KE:
+                       return ELEM(id_type_used, ID_ME, ID_CU, ID_LT);  /* Warning! key->from, could be more types in future? */
+               case ID_SCR:
+                       return ELEM(id_type_used, ID_SCE);
+               case ID_WO:
+                       return (ELEM(id_type_used, ID_TE) || BKE_library_idtype_can_use_idtype(ID_NT, id_type_used));
+               case ID_SPK:
+                       return ELEM(id_type_used, ID_SO);
+               case ID_GR:
+                       return ELEM(id_type_used, ID_OB);
+               case ID_NT:
+                       /* Could be the following, but node.id has no type restriction... */
+ #if 0
+                       return ELEM(id_type_used, ID_GD /* + node.id types... */);
+ #else
+                       return true;
+ #endif
+               case ID_BR:
+                       return ELEM(id_type_used, ID_BR, ID_IM, ID_PC, ID_TE);
+               case ID_MC:
+                       return ELEM(id_type_used, ID_GD, ID_IM);
+               case ID_MSK:
+                       return ELEM(id_type_used, ID_MC);  /* WARNING! mask->parent.id, not typed. */
+               case ID_LS:
+                       return (ELEM(id_type_used, ID_TE, ID_OB) || BKE_library_idtype_can_use_idtype(ID_NT, id_type_used));
+               default:
+                       return false;
+       }
+ }
  /* ***** ID users iterator. ***** */
  typedef struct IDUsersIter {
        ID *id;
@@@ -939,9 -974,9 +939,9 @@@ static uiLayout *draw_modifier
                        }
                        
                        UI_block_lock_clear(block);
-                       UI_block_lock_set(block, ob && ob->id.lib, ERROR_LIBDATA_MESSAGE);
+                       UI_block_lock_set(block, ob && ID_IS_LINKED_DATABLOCK(ob), ERROR_LIBDATA_MESSAGE);
                        
 -                      if (!ELEM(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem,
 +                      if (!ELEM(md->type, eModifierType_Fluidsim, eModifierType_Softbody,
                                   eModifierType_Cloth, eModifierType_Smoke))
                        {
                                uiItemO(row, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy"), ICON_NONE,
@@@ -1324,9 -1450,34 +1450,18 @@@ static bool snapObjectsRay
          ListBase *r_hit_list)
  {
        bool retval = false;
+       float dvec[3];
+       sub_v3_v3v3(dvec, ray_start, ray_origin);
+       const float ray_depth_range[2] = {
+               dot_v3v3(dvec, ray_normal),
+               *ray_depth,
+       };
        unsigned int ob_index = 0;
        Object *obedit = use_object_edit_cage ? sctx->scene->obedit : NULL;
 -
 -      /* Need an exception for particle edit because the base is flagged with BA_HAS_RECALC_DATA
 -       * which makes the loop skip it, even the derived mesh will never change
 -       *
 -       * To solve that problem, we do it first as an exception.
 -       * */
        Base *base_act = sctx->scene->basact;
 -      if (base_act && base_act->object && base_act->object->mode & OB_MODE_PARTICLE_EDIT) {
 -              Object *ob = base_act->object;
 -
 -              retval |= snapObject(
 -                      sctx, ob, ob->obmat, ob_index++,
 -                      false, snap_to,
 -                      ray_origin, ray_start, ray_normal, ray_depth_range,
 -                      ray_depth, dist_to_ray_sq,
 -                      r_loc, r_no, r_index, r_ob, r_obmat, r_hit_list);
 -      }
  
        bool ignore_object_selected = false, ignore_object_active = false;
        switch (snap_select) {
@@@ -332,7 -337,16 +332,8 @@@ void GPU_mist_update_enable(short enabl
  void GPU_mist_update_values(int type, float start, float dist, float inten, float color[3]);
  void GPU_horizon_update_color(float color[3]);
  void GPU_ambient_update_color(float color[3]);
+ void GPU_zenith_update_color(float color[3]);
  
 -struct GPUParticleInfo
 -{
 -      float scalprops[4];
 -      float location[3];
 -      float velocity[3];
 -      float angular_velocity[3];
 -};
 -
  #ifdef WITH_OPENSUBDIV
  struct DerivedMesh;
  void GPU_material_update_fvar_offset(GPUMaterial *gpu_material,
Simple merge