Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 18 Sep 2017 10:54:56 +0000 (15:54 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 18 Sep 2017 10:54:56 +0000 (15:54 +0500)
1  2 
source/blender/depsgraph/intern/eval/deg_eval_flush.cc
source/blender/editors/interface/interface.c
source/blender/modifiers/intern/MOD_boolean.c

index 4cd316678a82f684955f0eec0002cbd254f4b3fc,40f6901de33d1a2dfcaad596d4ccce76a54194ba..676df7d633596e71146e02fcdd299870fa28b1c9
@@@ -55,6 -54,29 +55,12 @@@ extern "C" 
  
  namespace DEG {
  
 -namespace {
 -
 -// TODO(sergey): De-duplicate with depsgraph_tag,cc
 -void lib_id_recalc_tag(Main *bmain, ID *id)
 -{
 -      id->tag |= LIB_TAG_ID_RECALC;
 -      DEG_id_type_tag(bmain, GS(id->name));
 -}
 -
 -void lib_id_recalc_data_tag(Main *bmain, ID *id)
 -{
 -      id->tag |= LIB_TAG_ID_RECALC_DATA;
 -      DEG_id_type_tag(bmain, GS(id->name));
 -}
 -
 -}  /* namespace */
 -
+ enum {
+       COMPONENT_STATE_NONE      = 0,
+       COMPONENT_STATE_SCHEDULED = 1,
+       COMPONENT_STATE_DONE      = 2,
+ };
  typedef std::deque<OperationDepsNode *> FlushQueue;
  
  static void flush_init_func(void *data_v, int i)
@@@ -122,39 -144,18 +128,39 @@@ void deg_graph_flush_updates(Main *bmai
                        ComponentDepsNode *comp_node = node->owner;
                        IDDepsNode *id_node = comp_node->owner;
  
 -                      ID *id = id_node->id;
 +                      /* TODO(sergey): Do we need to pass original or evaluated ID here? */
 +                      ID *id_orig = id_node->id_orig;
 +                      ID *id_cow = id_node->id_cow;
                        if (id_node->done == 0) {
 -                              deg_editors_id_update(bmain, id);
 -                              lib_id_recalc_tag(bmain, id);
 +                              /* Copy tag from original data to CoW storage.
 +                               * This is because DEG_id_tag_update() sets tags on original
 +                               * data.
 +                               */
 +                              id_cow->tag |= (id_orig->tag & LIB_TAG_ID_RECALC_ALL);
 +                              if (deg_copy_on_write_is_expanded(id_cow)) {
 +                                      deg_editors_id_update(bmain, id_cow);
 +                              }
 +                              lib_id_recalc_tag(bmain, id_orig);
                                /* TODO(sergey): For until we've got proper data nodes in the graph. */
 -                              lib_id_recalc_data_tag(bmain, id);
 +                              lib_id_recalc_data_tag(bmain, id_orig);
                        }
  
-                       if (comp_node->done == 0) {
 -                      if (comp_node->done != COMPONENT_STATE_DONE) {
++                      if (comp_node->done == COMPONENT_STATE_DONE) {
 +#ifdef WITH_COPY_ON_WRITE
 +                              /* Currently this is needed to get ob->mesh to be replaced with
 +                               * original mesh (rather than being evaluated_mesh).
 +                               *
 +                               * TODO(sergey): This is something we need to avoid.
 +                               */
 +                              if (comp_node->depends_on_cow()) {
 +                                      ComponentDepsNode *cow_comp =
 +                                              id_node->find_component(DEG_NODE_TYPE_COPY_ON_WRITE);
 +                                      cow_comp->tag_update(graph);
 +                              }
 +#endif
                                Object *object = NULL;
 -                              if (GS(id->name) == ID_OB) {
 -                                      object = (Object *)id;
 +                              if (GS(id_orig->name) == ID_OB) {
 +                                      object = (Object *)id_orig;
                                        if (id_node->done == 0) {
                                                ++num_flushed_objects;
                                        }
                                                case DEG_NODE_TYPE_PROXY:
                                                        object->recalc |= OB_RECALC_DATA;
                                                        break;
 +                                              case DEG_NODE_TYPE_SHADING_PARAMETERS:
 +                                                      break;
                                        }
 +
 +                                      /* TODO : replace with more granular flags */
 +                                      object->deg_update_flag |= DEG_RUNTIME_DATA_UPDATE;
                                }
+                               /* When some target changes bone, we might need to re-run the
+                                * whole IK solver, otherwise result might be unpredictable.
+                                */
+                               if (comp_node->type == DEG_NODE_TYPE_BONE) {
+                                       ComponentDepsNode *pose_comp =
+                                               id_node->find_component(DEG_NODE_TYPE_EVAL_POSE);
+                                       BLI_assert(pose_comp != NULL);
+                                       if (pose_comp->done == COMPONENT_STATE_NONE) {
+                                               queue.push_front(pose_comp->get_entry_operation());
+                                               pose_comp->done = COMPONENT_STATE_SCHEDULED;
+                                       }
+                               }
                        }
  
-                       id_node->done = 1;
+                       id_node->done = COMPONENT_STATE_DONE;
                        comp_node->done = 1;
  
                        /* Flush to nodes along links... */