Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 14 Sep 2017 11:16:14 +0000 (16:16 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 14 Sep 2017 11:17:22 +0000 (16:17 +0500)
1  2 
source/blender/blenkernel/intern/mask_evaluate.c
source/blender/blenkernel/intern/scene.c
source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
source/blender/depsgraph/intern/depsgraph_type_defines.cc
source/blender/depsgraph/intern/depsgraph_types.h
source/blender/editors/interface/interface_layout.c
source/blender/editors/mesh/mesh_data.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/modifiers/intern/MOD_boolean.c

index 1b275f455f4fd5bb954503b4f8e819c52d6de449,0d71cc548c77f3da770367a0fd59853b7ea25582..f60d87f2464264dd4c22745e6b4090361c107199
  #include "DNA_mask_types.h"
  
  #include "BKE_curve.h"
 -#include "BKE_depsgraph.h"
+ #include "BKE_global.h"
  #include "BKE_mask.h"
  
++#include "DEG_depsgraph.h"
++
  
  unsigned int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height)
  {
index 5d9741922415bf3b2bebd5c3225b44494578249e,e8613d9ab9c62ab29998b4f2b77a8e6fad27141c..151d47b031674aab21c3690ba55071e45ccd2238
@@@ -1657,9 -1932,15 +1657,7 @@@ void BKE_scene_update_tagged(Evaluation
         *
         * in the future this should handle updates for all datablocks, not
         * only objects and scenes. - brecht */
 -#ifdef WITH_LEGACY_DEPSGRAPH
 -      if (!use_new_eval) {
 -              scene_update_tagged_recursive(eval_ctx, bmain, scene, scene);
 -      }
 -      else
 -#endif
 -      {
 -              DEG_evaluate_on_refresh(eval_ctx, scene->depsgraph, scene);
 -      }
 +      DEG_evaluate_on_refresh(eval_ctx, scene->depsgraph_legacy, scene);
-       /* TODO(sergey): This is to beocme a node in new depsgraph. */
-       BKE_mask_update_scene(bmain, scene);
  
        /* update sound system animation (TODO, move to depsgraph) */
        BKE_sound_update_scene(bmain, scene);
@@@ -1701,10 -2044,22 +1699,8 @@@ void BKE_scene_update_for_newframe(Eval
        /* XXX TODO... */
  
        for (sce_iter = sce; sce_iter; sce_iter = sce_iter->set)
 -              DAG_scene_relations_update(bmain, sce_iter);
 -
 -#ifdef WITH_LEGACY_DEPSGRAPH
 -      if (!use_new_eval) {
 -              /* flush recalc flags to dependencies, if we were only changing a frame
 -               * this would not be necessary, but if a user or a script has modified
 -               * some datablock before BKE_scene_update_tagged was called, we need the flush */
 -              DAG_ids_flush_tagged(bmain);
 -
 -              /* Following 2 functions are recursive
 -               * so don't call within 'scene_update_tagged_recursive' */
 -              DAG_scene_update_flags(bmain, sce, lay, true, do_invisible_flush);   // only stuff that moves or needs display still
 -              BKE_mask_evaluate_all_masks(bmain, ctime, true);
 -      }
 -#endif
 +              DEG_scene_relations_update(bmain, sce_iter);
  
-       BKE_mask_evaluate_all_masks(bmain, ctime, true);
        /* Update animated cache files for modifiers. */
        BKE_cachefile_update_frame(bmain, sce, ctime, (((double)sce->r.frs_sec) / (double)sce->r.frs_sec_base));
  
index 068122b4928d9dcc13a8389fe67e34731fe1e695,17f0c030bd0b1cc16f65e0ab667a4903063a62aa..02d20913177fa03fb0fe3613969faf7c73edfb80
@@@ -1262,11 -1098,21 +1263,22 @@@ void DepsgraphNodeBuilder::build_mask(M
  {
        ID *mask_id = &mask->id;
        add_id_node(mask_id);
+       /* F-Curve based animation/ */
        build_animdata(mask_id);
+       /* Animation based on mask's shapes. */
+       add_operation_node(mask_id,
+                          DEG_NODE_TYPE_ANIMATION,
+                          function_bind(BKE_mask_eval_animation, _1, mask),
+                          DEG_OPCODE_MASK_ANIMATION);
+       /* Final mask evaluation. */
+       add_operation_node(mask_id,
+                          DEG_NODE_TYPE_PARAMETERS,
+                          function_bind(BKE_mask_eval_update, _1, mask),
+                          DEG_OPCODE_MASK_EVAL);
  }
  
 -void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip) {
 +void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip)
 +{
        ID *clip_id = &clip->id;
        add_id_node(clip_id);
        build_animdata(clip_id);
index 969cc21d2c10fda92931c48cf849620cd2c9328c,f4f071cd611b70c58f35a79abe61b19ef9583713..0c9ab8da9107a008982ec4e31b077e5eb488109d
@@@ -128,21 -117,10 +128,24 @@@ static const char *stringify_opcode(eDe
                STRINGIFY_OPCODE(BONE_CONSTRAINTS);
                STRINGIFY_OPCODE(BONE_READY);
                STRINGIFY_OPCODE(BONE_DONE);
 -              STRINGIFY_OPCODE(PSYS_EVAL);
 -              STRINGIFY_OPCODE(PSYS_EVAL_INIT);
 +              /* Particles. */
 +              STRINGIFY_OPCODE(PARTICLE_SYSTEM_EVAL_INIT);
 +              STRINGIFY_OPCODE(PARTICLE_SYSTEM_EVAL);
 +              STRINGIFY_OPCODE(PARTICLE_SETTINGS_EVAL);
 +              STRINGIFY_OPCODE(PARTICLE_SETTINGS_RECALC_CLEAR);
++              /* Masks. */
+               STRINGIFY_OPCODE(MASK_ANIMATION);
+               STRINGIFY_OPCODE(MASK_EVAL);
 +              /* Collections. */
 +              STRINGIFY_OPCODE(SCENE_LAYER_INIT);
 +              STRINGIFY_OPCODE(SCENE_LAYER_EVAL);
 +              STRINGIFY_OPCODE(SCENE_LAYER_DONE);
 +              /* Copy on write. */
 +              STRINGIFY_OPCODE(COPY_ON_WRITE);
 +              /* Shading. */
 +              STRINGIFY_OPCODE(SHADING);
 +              STRINGIFY_OPCODE(MATERIAL_UPDATE);
 +              STRINGIFY_OPCODE(WORLD_UPDATE);
  
                case DEG_NUM_OPCODES: return "SpecialCase";
  #undef STRINGIFY_OPCODE
index 9ea6dfedefeadd88da08f00b2e75b04d1db0433a,1c461423e035b4af4f3ec1fb79cd60ed419f3a62..0dd7e85476cdaba3846a761be9133adb8850d67f
@@@ -207,26 -213,16 +207,30 @@@ typedef enum eDepsOperation_Code 
        DEG_OPCODE_BONE_READY,
        DEG_OPCODE_BONE_DONE,
  
 -      /* Particles --------------------------------------- */
 -
 -      /* XXX: placeholder - Particle System eval */
 -      DEG_OPCODE_PSYS_EVAL_INIT,
 -      DEG_OPCODE_PSYS_EVAL,
 +      /* Particles. --------------------------------------- */
 +      /* Particle System evaluation. */
 +      DEG_OPCODE_PARTICLE_SYSTEM_EVAL_INIT,
 +      DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
 +      DEG_OPCODE_PARTICLE_SETTINGS_EVAL,
 +      DEG_OPCODE_PARTICLE_SETTINGS_RECALC_CLEAR,
 +
 +      /* Collections. ------------------------------------- */
 +      DEG_OPCODE_SCENE_LAYER_INIT,
 +      DEG_OPCODE_SCENE_LAYER_EVAL,
 +      DEG_OPCODE_SCENE_LAYER_DONE,
 +
 +      /* Copy on Write. ------------------------------------ */
 +      DEG_OPCODE_COPY_ON_WRITE,
 +
 +      /* Shading. ------------------------------------------- */
 +      DEG_OPCODE_SHADING,
 +      DEG_OPCODE_MATERIAL_UPDATE,
 +      DEG_OPCODE_WORLD_UPDATE,
  
+       /* Masks ------------------------------------------- */
+       DEG_OPCODE_MASK_ANIMATION,
+       DEG_OPCODE_MASK_EVAL,
        DEG_NUM_OPCODES,
  } eDepsOperation_Code;
  
index 393692e51c140517648700671950e8214619c50d,c21a76918e8afb7a832ba4c1c305fcaede77fcf5..d2e4cdf5453d9204b3fc11fac96e8ba0da4f621d
@@@ -1643,11 -1724,12 +1643,15 @@@ void ui_but_add_search(uiBut *but, Poin
                        but->str[0] = 0;
                }
  
 -              UI_but_func_search_set(but, ui_searchbox_create_generic, rna_search_cb, but, NULL, NULL);
 +              UI_but_func_search_set(
 +                          but, ui_searchbox_create_generic, ui_rna_collection_search_cb,
 +                          coll_search, NULL, NULL);
 +              but->free_search_arg = true;
        }
+       else if (but->type == UI_BTYPE_SEARCH_MENU) {
+               /* In case we fail to find proper searchprop, so other code might have already set but->type to search menu... */
+               but->type = UI_BTYPE_LABEL;
+       }
  }
  
  void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *searchptr, const char *searchpropname, const char *name, int icon)
index 49755c75480095863a9e59bb6f2a8374e13b7887,3294490d5b14ece159af7c4bdd3c4180a762c366..2767ce75a5fac5013549fc4f86372d57f7dec28d
@@@ -252,8 -251,8 +252,8 @@@ void ED_mesh_uv_loop_reset_ex(struct Me
  void ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me)
  {
        /* could be ldata or pdata */
 -      CustomData *pdata = GET_CD_DATA(me, pdata);
 -      const int layernum = CustomData_get_active_layer(pdata, CD_MTEXPOLY);
 +      CustomData *ldata = GET_CD_DATA(me, ldata);
-       const int layernum = CustomData_get_active_layer_index(ldata, CD_MLOOPUV);
++      const int layernum = CustomData_get_active_layer(ldata, CD_MLOOPUV);
        ED_mesh_uv_loop_reset_ex(me, layernum);
        
        WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
index 5ee05273a5d281db0a43bdbc57c4726d184c2954,75294af08f9df06fb92e574e14b19ff1624cddce..2a0eed6f438e7cd95bcea1e8c92084dbb212c0ad
@@@ -219,10 -221,11 +219,10 @@@ void ED_uvedit_assign_image(Main *UNUSE
  #endif
  
                /* ensure we have a uv map */
 -              if (!CustomData_has_layer(&em->bm->pdata, CD_MTEXPOLY)) {
 -                      BM_data_layer_add(em->bm, &em->bm->pdata, CD_MTEXPOLY);
 +              if (!CustomData_has_layer(&em->bm->ldata, CD_MLOOPUV)) {
                        BM_data_layer_add(em->bm, &em->bm->ldata, CD_MLOOPUV);
                        /* make UVs all nice 0-1 */
-                       ED_mesh_uv_loop_reset_ex(obedit->data, CustomData_get_active_layer_index(&em->bm->ldata, CD_MLOOPUV));
 -                      ED_mesh_uv_loop_reset_ex(obedit->data, CustomData_get_active_layer(&em->bm->pdata, CD_MTEXPOLY));
++                      ED_mesh_uv_loop_reset_ex(obedit->data, CustomData_get_active_layer(&em->bm->ldata, CD_MLOOPUV));
                        update = true;
                }