Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 21 Jul 2017 09:16:37 +0000 (11:16 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 21 Jul 2017 09:18:02 +0000 (11:18 +0200)
16 files changed:
1  2 
intern/cycles/blender/blender_mesh.cpp
intern/cycles/blender/blender_session.cpp
intern/cycles/blender/blender_session.h
source/blender/blenkernel/BKE_particle.h
source/blender/blenkernel/intern/particle_system.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/include/UI_interface.h
source/blender/editors/interface/interface_utils.c
source/blender/editors/object/object_add.c
source/blender/editors/sculpt_paint/paint_image_2d.c
source/blender/editors/sculpt_paint/paint_image_proj.c
source/blender/editors/sculpt_paint/paint_utils.c
source/blender/editors/space_image/image_ops.c

index f318787d954e8c9ef831fee26cf649f134ed0c8c,470e2e468f0219025d52bf27d395c469fe1b8a4e..22a0290f364a6ffe414767e1149207b21f20d9ff
@@@ -473,21 -473,8 +473,20 @@@ typedef struct ParticleRenderData 
  
  struct EvaluationContext;
  
- void BKE_particle_system_eval(struct EvaluationContext *eval_ctx,
-                               struct Scene *scene,
-                               struct Object *ob,
-                               struct ParticleSystem *psys);
 +void BKE_particle_system_settings_eval(struct EvaluationContext *eval_ctx,
 +                                       struct ParticleSystem *psys);
 +void BKE_particle_system_settings_recalc_clear(struct EvaluationContext *UNUSED(eval_ctx),
 +                                               struct ParticleSettings *particle_settings);
 +
+ void BKE_particle_system_eval_init(struct EvaluationContext *eval_ctx,
+                                    struct Scene *scene,
+                                    struct Object *ob);
  
  #endif
 +
 +/* Draw Cache */
 +enum {
 +      BKE_PARTICLE_BATCH_DIRTY_ALL = 0,
 +};
 +void BKE_particle_batch_cache_dirty(struct ParticleSystem *psys, int mode);
 +void BKE_particle_batch_cache_free(struct ParticleSystem *psys);
index 3a7ca2caaa4a1b3bd7c610e1eb887c081a2d36c7,b61f6792c890537a157d137ea144a3559e9883b7..79440b79d5c3c78c9d9ccb3c77f430f6113b1f97
@@@ -4353,31 -4350,12 +4353,30 @@@ void BKE_particlesystem_id_loop(Particl
  
  /* **** Depsgraph evaluation **** */
  
 -void BKE_particle_system_eval_init(EvaluationContext *UNUSED(eval_ctx),
 +void BKE_particle_system_settings_eval(struct EvaluationContext *UNUSED(eval_ctx),
 +                                       ParticleSystem *psys)
 +{
 +      if (G.debug & G_DEBUG_DEPSGRAPH) {
 +              printf("%s on %s (%p)\n", __func__, psys->name, psys);
 +      }
 +      psys->recalc |= psys->part->recalc;
 +}
 +
 +void BKE_particle_system_settings_recalc_clear(struct EvaluationContext *UNUSED(eval_ctx),
 +                                               ParticleSettings *particle_settings)
 +{
 +      if (G.debug & G_DEBUG_DEPSGRAPH) {
 +              printf("%s on %s (%p)\n", __func__, particle_settings->id.name, particle_settings);
 +      }
 +      particle_settings->recalc = 0;
 +}
 +
- void BKE_particle_system_eval(struct EvaluationContext *UNUSED(eval_ctx),
-                               Scene *scene,
-                               Object *ob,
-                               ParticleSystem *psys)
++void BKE_particle_system_eval_init(struct EvaluationContext *UNUSED(eval_ctx),
+                                    Scene *scene,
+                                    Object *ob)
  {
        if (G.debug & G_DEBUG_DEPSGRAPH) {
-               printf("%s on %s:%s (%p)\n", __func__, ob->id.name, psys->name, psys);
 -              printf("%s on %s\n", __func__, ob->id.name);
++              printf("%s on %s (%p)\n", __func__, ob->id.name, ob);
        }
        BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH);
  }
index 5a552414cd321c1aadcc6cff1588d922b2a958f6,a90f8ff02b63c0fd238d92903563612c003b6228..93db8724dcee38e6d4617b782ed3f7e393104812
@@@ -707,36 -671,26 +707,39 @@@ void DepsgraphNodeBuilder::build_partic
        ComponentDepsNode *psys_comp =
                add_component_node(&ob->id, DEG_NODE_TYPE_EVAL_PARTICLES);
  
 -                                       scene,
 -                                       ob),
 -                         DEG_OPCODE_PSYS_EVAL_INIT);
 +      /* TODO(sergey): Need to get COW of PSYS. */
 +      Scene *scene_cow = get_cow_datablock(scene);
 +      Object *ob_cow = get_cow_datablock(ob);
 +
+       add_operation_node(psys_comp,
+                          function_bind(BKE_particle_system_eval_init,
+                                        _1,
++                                       scene_cow,
++                                       ob_cow),
++                         DEG_OPCODE_PARTICLE_SYSTEM_EVAL_INIT);
        /* particle systems */
        LINKLIST_FOREACH (ParticleSystem *, psys, &ob->particlesystem) {
                ParticleSettings *part = psys->part;
  
 -              /* particle settings */
 -              // XXX: what if this is used more than once!
 -              build_animdata(&part->id);
 +              /* Build particle settings operations.
 +               *
 +               * NOTE: The call itself ensures settings are only build once.
 +               */
 +              build_particle_settings(part);
  
 -              /* this particle system */
 -              // TODO: for now, this will just be a placeholder "ubereval" node
 +              /* Update on particle settings change. */
 +              add_operation_node(psys_comp,
 +                                 function_bind(BKE_particle_system_settings_eval,
 +                                               _1,
 +                                               psys),
 +                                 DEG_OPCODE_PARTICLE_SETTINGS_EVAL,
 +                                 psys->name);
 +
 +              /* Particle system evaluation. */
                add_operation_node(psys_comp,
-                                  function_bind(BKE_particle_system_eval,
-                                                _1,
-                                                scene_cow,
-                                                ob_cow,
-                                                psys),
+                                  NULL,
 -                                 DEG_OPCODE_PSYS_EVAL,
 +                                 DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
                                   psys->name);
        }
  
index 03cae598d245ee34da3a2153c8ac311094f393bf,a1abcb9641139af42025371883e036874dd276ee..93d9aab18987d8f5009ab8fc9b18391e2d6e01d8
@@@ -1244,6 -1239,13 +1244,13 @@@ void DepsgraphRelationBuilder::build_pa
        OperationKey obdata_ubereval_key(&ob->id,
                                         DEG_NODE_TYPE_GEOMETRY,
                                         DEG_OPCODE_GEOMETRY_UBEREVAL);
 -                                 DEG_OPCODE_PSYS_EVAL_INIT);
+       OperationKey eval_init_key(&ob->id,
+                                  DEG_NODE_TYPE_EVAL_PARTICLES,
++                                 DEG_OPCODE_PARTICLE_SYSTEM_EVAL_INIT);
+       /* TODO(sergey): Are all particle systems depends on time?
+        * Hair without dynamics i.e.
+        */
+       add_relation(time_src_key, eval_init_key, "TimeSrc -> PSys");
  
        /* particle systems */
        LINKLIST_FOREACH (ParticleSystem *, psys, &ob->particlesystem) {
index be2630384ea838f835708267f0d58d72aab10324,e5033affe2f6c11b345c462e2db34d0d7f7f226f..405c8e8733960a7dcfe5a97aae44ce7b69975542
@@@ -129,20 -118,8 +129,21 @@@ 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);
 +              /* 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 af18abdb6845838ad070c9d0d4483c7592b56f25,f05f82caa3d45bd610aa437c0e455c216071db00..ba776d5ebd51ba0d7c42ad6ed6cf71ec05c454af
@@@ -208,24 -216,11 +208,25 @@@ 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,
  
        DEG_NUM_OPCODES,
  } eDepsOperation_Code;