Commit: e8b6bcd65c946f5eb9623638eebcd93ed74d9358
Author: Bastien Montagne
Date:   Tue Aug 8 16:43:25 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBe8b6bcd65c946f5eb9623638eebcd93ed74d9358

Merge branch 'master' into blender2.8

Conflicts:
        source/blender/depsgraph/intern/builder/deg_builder_relations.cc
        source/blender/editors/object/object_add.c
        source/blender/python/intern/bpy_app_handlers.c

===================================================================



===================================================================

diff --cc source/blender/blenkernel/intern/screen.c
index a07abe166f0,df47b89fadc..6bd88099792
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@@ -183,8 -180,8 +183,9 @@@ ARegion *BKE_area_region_copy(SpaceTyp
        BLI_listbase_clear(&newar->panels_category_active);
        BLI_listbase_clear(&newar->ui_lists);
        newar->swinid = 0;
 +      newar->manipulator_map = NULL;
        newar->regiontimer = NULL;
+       newar->headerstr = NULL;
        
        /* use optional regiondata callback */
        if (ar->regiondata) {
diff --cc source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 861aa9521c0,bb8e2a710ef..d3304109673
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@@ -929,23 -924,30 +929,27 @@@ void DepsgraphRelationBuilder::build_dr
                                fcu->rna_path ? fcu->rna_path : "",
                                fcu->array_index);
        bPoseChannel *pchan = NULL;
 -
        const char *rna_path = fcu->rna_path ? fcu->rna_path : "";
 +      const short id_type = GS(id->name);
  
-       /* create dependency between driver and data affected by it */
+       /* Create dependency between driver and data affected by it. */
        /* - direct property relationship... */
        //RNAPathKey affected_key(id, fcu->rna_path);
        //add_relation(driver_key, affected_key, "[Driver -> Data] DepsRel");
  
-       /* driver -> data components (for interleaved evaluation - 
bones/constraints/modifiers) */
-       // XXX: this probably should probably be moved out into a separate 
function
+       /* Driver -> data components (for interleaved evaluation
+        * bones/constraints/modifiers).
+        */
+       // XXX: this probably should probably be moved out into a separate 
function.
        if (strstr(rna_path, "pose.bones[") != NULL) {
                /* interleaved drivers during bone eval */
-               // TODO: ideally, if this is for a constraint, it goes to said 
constraint
+               /* TODO: ideally, if this is for a constraint, it goes to said
+                * constraint.
+                */
                Object *ob = (Object *)id;
 -              char *bone_name;
 -
 -              bone_name = BLI_str_quoted_substrN(rna_path, "pose.bones[");
 +              char *bone_name = BLI_str_quoted_substrN(rna_path, 
"pose.bones[");
                pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
 -
 -              if (bone_name) {
 +              if (bone_name != NULL) {
                        MEM_freeN(bone_name);
                        bone_name = NULL;
                }
@@@ -1024,57 -1029,46 +1028,62 @@@
                add_relation(driver_key, geometry_key, "[Driver -> ShapeKey 
Geom]");
        }
        else {
 -              if (GS(id->name) == ID_OB) {
 -                      /* assume that driver affects a transform... */
 -                      OperationKey local_transform_key(id,
 -                                                       
DEG_NODE_TYPE_TRANSFORM,
 -                                                       
DEG_OPCODE_TRANSFORM_LOCAL);
 -                      add_relation(driver_key,
 -                                   local_transform_key,
 -                                   "[Driver -> Transform]");
 -              }
 -              else if (GS(id->name) == ID_KE) {
 -                      ComponentKey geometry_key(id, DEG_NODE_TYPE_GEOMETRY);
 -                      add_relation(driver_key,
 -                                   geometry_key,
 -                                   "[Driver -> Shapekey Geometry]");
 +              switch (id_type) {
 +                      case ID_OB:
 +                      {
 +                              /* Assume that driver affects a transform. */
 +                              OperationKey local_transform_key(id,
 +                                                               
DEG_NODE_TYPE_TRANSFORM,
 +                                                               
DEG_OPCODE_TRANSFORM_LOCAL);
 +                              add_relation(driver_key,
 +                                           local_transform_key,
 +                                           "[Driver -> Transform]");
 +                              break;
 +                      }
 +                      case ID_KE:
 +                      {
 +                              ComponentKey geometry_key(id, 
DEG_NODE_TYPE_GEOMETRY);
 +                              add_relation(driver_key,
 +                                           geometry_key,
 +                                           "[Driver -> Shapekey Geometry]");
 +                              break;
 +                      }
 +                      case ID_NT:
 +                      {
 +                              OperationKey ntree_key(id,
 +                                                     DEG_NODE_TYPE_PARAMETERS,
 +                                                     
DEG_OPCODE_PARAMETERS_EVAL);
 +                              add_relation(driver_key,
 +                                           ntree_key,
 +                                           "[Driver -> NTree Shading 
Update]");
 +                              break;
 +                      }
                }
        }
- 
-       /* ensure that affected prop's update callbacks will be triggered once 
done */
-       // TODO: implement this once the functionality to add these links 
exists in RNA
-       // XXX: the data itself could also set this, if it were to be truly 
initialised later?
- 
-       /* loop over variables to get the target relationships */
+       /* Ensure that affected prop's update callbacks will be triggered once
+        * done.
+        */
+       /* TODO: Implement this once the functionality to add these links exists
+        * RNA.
+        */
+       /* XXX: the data itself could also set this, if it were to be truly
+        * initialised later?
+        */
+       /* Loop over variables to get the target relationships. */
        LINKLIST_FOREACH (DriverVar *, dvar, &driver->variables) {
-               /* only used targets */
+               /* Only used targets. */
                DRIVER_TARGETS_USED_LOOPER(dvar)
                {
-                       if (dtar->id == NULL)
+                       if (dtar->id == NULL) {
                                continue;
- 
-                       /* special handling for directly-named bones */
+                       }
+                       /* Special handling for directly-named bones. */
                        if ((dtar->flag & DTAR_FLAG_STRUCT_REF) && 
(dtar->pchan_name[0])) {
                                Object *ob = (Object *)dtar->id;
-                               bPoseChannel *target_pchan = 
BKE_pose_channel_find_name(ob->pose, dtar->pchan_name);
+                               bPoseChannel *target_pchan =
+                                       BKE_pose_channel_find_name(ob->pose, 
dtar->pchan_name);
                                if (target_pchan != NULL) {
-                                       /* get node associated with bone */
+                                       /* Get node associated with bone. */
                                        // XXX: watch the space!
                                        /* Some cases can't use final bone 
transform, for example:
                                         * - Driving the bone with itself 
(addressed here)
diff --cc source/blender/editors/object/object_add.c
index a7cc8e44443,e4f6d0da38f..839e5f415e2
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@@ -1426,26 -1344,23 +1426,24 @@@ static void make_object_duplilist_real(
                                         const bool use_hierarchy)
  {
        Main *bmain = CTX_data_main(C);
 +      SceneLayer *sl = CTX_data_scene_layer(C);
-       ListBase *lb;
+       ListBase *lb_duplis;
        DupliObject *dob;
-       GHash *dupli_gh = NULL, *parent_gh = NULL;
-       Object *object;
+       GHash *dupli_gh, *parent_gh = NULL;
  
-       if (!(base->object->transflag & OB_DUPLI))
+       if (!(base->object->transflag & OB_DUPLI)) {
                return;
+       }
  
-       lb = object_duplilist(bmain->eval_ctx, scene, base->object);
+       lb_duplis = object_duplilist(bmain->eval_ctx, scene, base->object);
  
-       if (use_hierarchy || use_base_parent) {
-               dupli_gh = BLI_ghash_ptr_new(__func__);
-               if (use_hierarchy) {
-                       if (base->object->transflag & OB_DUPLIGROUP) {
-                               parent_gh = 
BLI_ghash_new(dupliobject_group_hash, dupliobject_group_cmp, __func__);
-                       }
-                       else {
-                               parent_gh = BLI_ghash_new(dupliobject_hash, 
dupliobject_cmp, __func__);
-                       }
+       dupli_gh = BLI_ghash_ptr_new(__func__);
+       if (use_hierarchy) {
+               if (base->object->transflag & OB_DUPLIGROUP) {
+                       parent_gh = BLI_ghash_new(dupliobject_group_hash, 
dupliobject_group_cmp, __func__);
+               }
+               else {
+                       parent_gh = BLI_ghash_new(dupliobject_hash, 
dupliobject_cmp, __func__);
                }
        }
  
@@@ -1456,57 -1372,59 +1455,56 @@@
                /* font duplis can have a totcol without material, we get them 
from parent
                 * should be implemented better...
                 */
-               if (ob->mat == NULL) ob->totcol = 0;
+               if (ob_dst->mat == NULL) {
+                       ob_dst->totcol = 0;
+               }
  
-               BKE_collection_object_add_from(scene, dob->ob, ob);
-               basen = BKE_scene_layer_base_find(sl, ob);
 -              base_dst = MEM_dupallocN(base);
 -              base_dst->flag &= ~(OB_FROMDUPLI | OB_FROMGROUP);
 -              ob_dst->flag = base_dst->flag;
 -              base_dst->lay = base->lay;
 -              BLI_addhead(&scene->base, base_dst);   /* addhead: othwise 
eternal loop */
 -              base_dst->object = ob_dst;
++              BKE_collection_object_add_from(scene, ob_src, ob_dst);
++              base_dst = BKE_scene_layer_base_find(sl, ob_dst);
 +
-               BKE_scene_object_base_flag_sync_from_base(basen);
++              BKE_scene_object_base_flag_sync_from_base(base_dst);
  
                /* make sure apply works */
-               BKE_animdata_free(&ob->id, true);
-               ob->adt = NULL;
+               BKE_animdata_free(&ob_dst->id, true);
+               ob_dst->adt = NULL;
  
                /* Proxies are not to be copied. */
-               ob->proxy_from = NULL;
-               ob->proxy_group = NULL;
-               ob->proxy = NULL;
+               ob_dst->proxy_from = NULL;
+               ob_dst->proxy_group = NULL;
+               ob_dst->proxy = NULL;
  
-               ob->parent = NULL;
-               BKE_constraints_free(&ob->constraints);
-               ob->curve_cache = NULL;
-               ob->transflag &= ~OB_DUPLI;
+               ob_dst->parent = NULL;
+               BKE_constraints_free(&ob_dst->constraints);
+               ob_dst->curve_cache = NULL;
+               ob_dst->transflag &= ~OB_DUPLI;
 -              ob_dst->lay = base->lay;
  
-               copy_m4_m4(ob->obmat, dob->mat);
-               BKE_object_apply_mat4(ob, ob->obmat, false, false);
+               copy_m4_m4(ob_dst->obmat, dob->mat);
+               BKE_object_apply_mat4(ob_dst, ob_dst->obmat, false, false);
  
-               if (dupli_gh) {
-                       BLI_ghash_insert(dupli_gh, dob, ob);
-               }
+               BLI_ghash_insert(dupli_gh, dob, ob_dst);
                if (parent_gh) {
                        void **val;
                        /* Due to nature of hash/comparison of this ghash, a 
lot of duplis may be considered as 'the same',
                         * this avoids trying to insert same key several time 
and raise asserts in debug builds... */
                        if (!BLI_ghash_ensure_p(parent_gh, dob, &val)) {
-                               *val = ob;
+                               *val = ob_dst;
                        }
                }
+       }
+ 
+       for (dob = lb_duplis->first; dob; dob = dob->next) {
+               Object *ob_src = dob->ob;
+               Object *ob_dst = BLI_ghash_lookup(dupli_gh, dob);
  
                /* Remap new object to itself, and clear again newid pointer of 
orig object. */
-               BKE_libblock_relink_to_newid(&ob->id);
-               set_sca_new_poins_ob(ob);
-               BKE_id_clear_newpoin(&dob->ob->id);
+               BKE_libblock_relink_to_newid(&ob_dst->id);
+               set_sca_new_poins_ob(ob_dst);
  
-               DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
-       }
 -              DAG_id_tag_update(&ob_dst->id, OB_RECALC_DATA);
++              DEG_id_tag_update(&ob_dst->id, OB_RECALC_DATA);
  
-       if (use_hierarchy) {
-               for (dob = lb->first; dob; dob = dob->next) {
+               if (use_hierarchy) {
                        /* original parents */
-                       Object *ob_src =     dob->ob;
                        Object *ob_src_par = ob_src->parent;
- 
-                       Object *ob_dst =     BLI_ghash_lookup(dupli_gh,

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to