[Bf-blender-cvs] [d52f17abb05] soc-2020-info-editor: Merge branch 'master' into soc-2020-info-editor

Mateusz Grzeliński noreply at git.blender.org
Fri Jul 24 11:48:56 CEST 2020


Commit: d52f17abb05865b52e7f72f13a3509000cdb0927
Author: Mateusz Grzeliński
Date:   Fri Jul 24 08:28:05 2020 +0200
Branches: soc-2020-info-editor
https://developer.blender.org/rBd52f17abb05865b52e7f72f13a3509000cdb0927

Merge branch 'master' into soc-2020-info-editor

# Conflicts:
#	source/blender/blenkernel/intern/fcurve_driver.c
#	source/blender/windowmanager/intern/wm_files_link.c

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



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

diff --cc source/blender/blenkernel/intern/fcurve_driver.c
index 8ea8fc0dd3e,87cb77930f5..c6f21181cae
--- a/source/blender/blenkernel/intern/fcurve_driver.c
+++ b/source/blender/blenkernel/intern/fcurve_driver.c
@@@ -114,25 -114,29 +114,25 @@@ static float dtar_get_prop_val(ChannelD
  
    id = dtar_id_ensure_proxy_from(dtar->id);
  
-   /* error check for missing pointer... */
+   /* Error check for missing pointer. */
    if (id == NULL) {
 -    if (G.debug & G_DEBUG) {
 -      CLOG_ERROR(&LOG, "driver has an invalid target to use (path = %s)", dtar->rna_path);
 -    }
 +    CLOG_ERROR(&LOG, "driver has an invalid target to use (path = %s)", dtar->rna_path);
  
      driver->flag |= DRIVER_FLAG_INVALID;
      dtar->flag |= DTAR_FLAG_INVALID;
      return 0.0f;
    }
  
-   /* get RNA-pointer for the ID-block given in target */
+   /* Get RNA-pointer for the ID-block given in target. */
    RNA_id_pointer_create(id, &id_ptr);
  
-   /* get property to read from, and get value as appropriate */
+   /* Get property to read from, and get value as appropriate. */
    if (!RNA_path_resolve_property_full(&id_ptr, dtar->rna_path, &ptr, &prop, &index)) {
-     /* path couldn't be resolved */
+     /* Path couldn't be resolved. */
 -    if (G.debug & G_DEBUG) {
 -      CLOG_ERROR(&LOG,
 -                 "Driver Evaluation Error: cannot resolve target for %s -> %s",
 -                 id->name,
 -                 dtar->rna_path);
 -    }
 +    CLOG_ERROR(&LOG,
 +               "Driver Evaluation Error: cannot resolve target for %s -> %s",
 +               id->name,
 +               dtar->rna_path);
  
      driver->flag |= DRIVER_FLAG_INVALID;
      dtar->flag |= DTAR_FLAG_INVALID;
@@@ -140,14 -144,16 +140,14 @@@
    }
  
    if (RNA_property_array_check(prop)) {
-     /* array */
+     /* Array. */
      if (index < 0 || index >= RNA_property_array_length(&ptr, prop)) {
-       /* out of bounds */
+       /* Out of bounds. */
 -      if (G.debug & G_DEBUG) {
 -        CLOG_ERROR(&LOG,
 -                   "Driver Evaluation Error: array index is out of bounds for %s -> %s (%d)",
 -                   id->name,
 -                   dtar->rna_path,
 -                   index);
 -      }
 +      CLOG_ERROR(&LOG,
 +                 "Driver Evaluation Error: array index is out of bounds for %s -> %s (%d)",
 +                 id->name,
 +                 dtar->rna_path,
 +                 index);
  
        driver->flag |= DRIVER_FLAG_INVALID;
        dtar->flag |= DTAR_FLAG_INVALID;
@@@ -215,32 -221,36 +215,32 @@@ bool driver_get_variable_property(Chann
  
    id = dtar_id_ensure_proxy_from(dtar->id);
  
-   /* error check for missing pointer... */
+   /* Error check for missing pointer. */
    if (id == NULL) {
 -    if (G.debug & G_DEBUG) {
 -      CLOG_ERROR(&LOG, "driver has an invalid target to use (path = %s)", dtar->rna_path);
 -    }
 +    CLOG_ERROR(&LOG, "driver has an invalid target to use (path = %s)", dtar->rna_path);
  
      driver->flag |= DRIVER_FLAG_INVALID;
      dtar->flag |= DTAR_FLAG_INVALID;
      return false;
    }
  
-   /* get RNA-pointer for the ID-block given in target */
+   /* Get RNA-pointer for the ID-block given in target. */
    RNA_id_pointer_create(id, &id_ptr);
  
-   /* get property to read from, and get value as appropriate */
+   /* Get property to read from, and get value as appropriate. */
    if (dtar->rna_path == NULL || dtar->rna_path[0] == '\0') {
      ptr = PointerRNA_NULL;
-     prop = NULL; /* ok */
+     prop = NULL; /* OK. */
    }
    else if (RNA_path_resolve_property_full(&id_ptr, dtar->rna_path, &ptr, &prop, &index)) {
-     /* ok */
+     /* OK. */
    }
    else {
-     /* path couldn't be resolved */
 -    /* Path couldn't be resolved. */
 -    if (G.debug & G_DEBUG) {
 -      CLOG_ERROR(&LOG,
 -                 "Driver Evaluation Error: cannot resolve target for %s -> %s",
 -                 id->name,
 -                 dtar->rna_path);
 -    }
++    /* Path couldn't be resolved */
 +    CLOG_ERROR(&LOG,
 +               "Driver Evaluation Error: cannot resolve target for %s -> %s",
 +               id->name,
 +               dtar->rna_path);
  
      ptr = PointerRNA_NULL;
      *r_prop = NULL;
@@@ -298,13 -312,15 +302,13 @@@ static float dvar_eval_rotDiff(ChannelD
  {
    short valid_targets = driver_check_valid_targets(driver, dvar);
  
-   /* make sure we have enough valid targets to use - all or nothing for now... */
+   /* Make sure we have enough valid targets to use - all or nothing for now. */
    if (driver_check_valid_targets(driver, dvar) != 2) {
 -    if (G.debug & G_DEBUG) {
 -      CLOG_WARN(&LOG,
 -                "RotDiff DVar: not enough valid targets (n = %d) (a = %p, b = %p)",
 -                valid_targets,
 -                dvar->targets[0].id,
 -                dvar->targets[1].id);
 -    }
 +    CLOG_WARN(&LOG,
 +              "RotDiff DVar: not enough valid targets (n = %d) (a = %p, b = %p)",
 +              valid_targets,
 +              dvar->targets[0].id,
 +              dvar->targets[1].id);
      return 0.0f;
    }
  
@@@ -356,13 -375,15 +363,13 @@@ static float dvar_eval_locDiff(ChannelD
    float loc2[3] = {0.0f, 0.0f, 0.0f};
    short valid_targets = driver_check_valid_targets(driver, dvar);
  
-   /* make sure we have enough valid targets to use - all or nothing for now... */
+   /* Make sure we have enough valid targets to use - all or nothing for now. */
    if (valid_targets < dvar->num_targets) {
 -    if (G.debug & G_DEBUG) {
 -      CLOG_WARN(&LOG,
 -                "LocDiff DVar: not enough valid targets (n = %d) (a = %p, b = %p)",
 -                valid_targets,
 -                dvar->targets[0].id,
 -                dvar->targets[1].id);
 -    }
 +    CLOG_WARN(&LOG,
 +              "LocDiff DVar: not enough valid targets (n = %d) (a = %p, b = %p)",
 +              valid_targets,
 +              dvar->targets[0].id,
 +              dvar->targets[1].id);
      return 0.0f;
    }
  
diff --cc source/blender/windowmanager/intern/wm_files_link.c
index 3dd55f9e41b,31d36603505..6568ae51adc
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@@ -698,6 -697,92 +701,92 @@@ static int wm_lib_relocate_invoke(bCont
    return OPERATOR_CANCELLED;
  }
  
+ static void lib_relocate_do_remap(Main *bmain,
+                                   ID *old_id,
+                                   ID *new_id,
+                                   ReportList *reports,
+                                   const bool do_reload,
+                                   const short remap_flags)
+ {
+   BLI_assert(old_id);
+   if (do_reload) {
+     /* Since we asked for placeholders in case of missing IDs,
+      * we expect to always get a valid one. */
+     BLI_assert(new_id);
+   }
+   if (new_id) {
 -#ifdef PRINT_DEBUG
 -    printf("before remap of %s, old_id users: %d, new_id users: %d\n",
 -           old_id->name,
 -           old_id->us,
 -           new_id->us);
 -#endif
++    CLOG_VERBOSE(WM_LOG_OPERATORS,
++                 3,
++                 "before remap of %s, old_id users: %d, new_id users: %d",
++                 old_id->name,
++                 old_id->us,
++                 new_id->us);
+     BKE_libblock_remap_locked(bmain, old_id, new_id, remap_flags);
+ 
+     if (old_id->flag & LIB_FAKEUSER) {
+       id_fake_user_clear(old_id);
+       id_fake_user_set(new_id);
+     }
+ 
 -#ifdef PRINT_DEBUG
 -    printf("after remap of %s, old_id users: %d, new_id users: %d\n",
 -           old_id->name,
 -           old_id->us,
 -           new_id->us);
 -#endif
++    CLOG_VERBOSE(WM_LOG_OPERATORS,
++                 4,
++                 "after remap of %s, old_id users: %d, new_id users: %d",
++                 old_id->name,
++                 old_id->us,
++                 new_id->us);
+ 
+     /* In some cases, new_id might become direct link, remove parent of library in this case. */
+     if (new_id->lib->parent && (new_id->tag & LIB_TAG_INDIRECT) == 0) {
+       if (do_reload) {
+         BLI_assert(0); /* Should not happen in 'pure' reload case... */
+       }
+       new_id->lib->parent = NULL;
+     }
+   }
+ 
+   if (old_id->us > 0 && new_id && old_id->lib == new_id->lib) {
+     /* Note that this *should* not happen - but better be safe than sorry in this area,
+      * at least until we are 100% sure this cannot ever happen.
+      * Also, we can safely assume names were unique so far,
+      * so just replacing '.' by '~' should work,
+      * but this does not totally rules out the possibility of name collision. */
+     size_t len = strlen(old_id->name);
+     size_t dot_pos;
+     bool has_num = false;
+ 
+     for (dot_pos = len; dot_pos--;) {
+       char c = old_id->name[dot_pos];
+       if (c == '.') {
+         break;
+       }
+       else if (c < '0' || c > '9') {
+         has_num = false;
+         break;
+       }
+       has_num = true;
+     }
+ 
+     if (has_num) {
+       old_id->name[dot_pos] = '~';
+     }
+     else {
+       len = MIN2(len, MAX_ID_NAME - 7);
+       BLI_strncpy(&old_id->name[len], "~000", 7);
+     }
+ 
+     id_sort_by_name(which_libbase(bmain, GS(old_id->name)), old_id, NULL);
+ 
+     BKE_reportf(
+         reports,
+         RPT_WARNING,
+         "Lib Reload: Replacing all references to old data-block '%s' by reloaded one failed, "
+         "old one (%d remaining users) had to be kept and was renamed to '%s'",
+         new_id->name,
+         old_id->us,
+         old_id->name);
+   }
+ }
+ 
  static void lib_relocate_do(Main *bmain,
                              Library *library,
                              WMLinkAppendData *lapp_data,
@@@ -732,7 -823,9 +827,7 @@@
          item = wm_link_append_data_item_add(lapp_data, id->name + 2, idcode, id);
          BLI_bitmap_set_all(item->libraries, true, lapp_data->num_libraries);
  
-         CLOG_VERBOSE(WM_LOG_OPERATORS, 2, "\tdatablock to seek for: %s", id->name);
 -#ifdef PRINT_DEBUG
 -        printf("\tdatablock to seek for: %s\n", id->name);
 -#endif
++        CLOG_VERBOSE(WM_LOG_OPERATORS, 5, "\tdatablock to seek for: %s", id->name);
        }
      }
    }



More information about the Bf-blender-cvs mailing list