optimized blenloader for loops #106573
|
@ -44,7 +44,7 @@ bool BLO_main_validate_libraries(Main *bmain, ReportList *reports)
|
|||
|
||||
ListBase *lbarray[INDEX_ID_MAX];
|
||||
int i = set_listbasepointers(bmain, lbarray);
|
||||
while (i--) {
|
||||
while (--i) {
|
||||
for (ID *id = static_cast<ID *>(lbarray[i]->first); id != nullptr;
|
||||
id = static_cast<ID *>(id->next)) {
|
||||
if (ID_IS_LINKED(id)) {
|
||||
|
@ -80,7 +80,7 @@ bool BLO_main_validate_libraries(Main *bmain, ReportList *reports)
|
|||
}
|
||||
|
||||
i = set_listbasepointers(curmain, lbarray);
|
||||
while (i--) {
|
||||
while (--i) {
|
||||
ID *id = static_cast<ID *>(lbarray[i]->first);
|
||||
if (id == nullptr) {
|
||||
continue;
|
||||
|
|
|
@ -135,7 +135,7 @@ LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh,
|
|||
}
|
||||
|
||||
BLI_linklist_prepend(&names, BLI_strdup(idname + 2));
|
||||
tot++;
|
||||
++tot;
|
||||
}
|
||||
else if (bhead->code == ENDB) {
|
||||
break;
|
||||
|
@ -200,7 +200,7 @@ LinkNode *BLO_blendhandle_get_datablock_info(BlendHandle *bh,
|
|||
info->no_preview_found = !has_preview;
|
||||
|
||||
BLI_linklist_prepend(&infos, info);
|
||||
tot++;
|
||||
++tot;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,25 +227,28 @@ static BHead *blo_blendhandle_read_preview_rects(FileData *fd,
|
|||
PreviewImage *result,
|
||||
const PreviewImage *preview_from_file)
|
||||
{
|
||||
for (int preview_index = 0; preview_index < NUM_ICON_SIZES; preview_index++) {
|
||||
if (preview_from_file->rect[preview_index] && preview_from_file->w[preview_index] &&
|
||||
preview_from_file->h[preview_index]) {
|
||||
int change = 0;
|
||||
for (int preview_index = NUM_ICON_SIZES; --preview_index; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (NUM_ICON_SIZES - preview_index);
|
||||
if (preview_from_file->rect[change] && preview_from_file->w[change] &&
|
||||
preview_from_file->h[change]) {
|
||||
bhead = blo_bhead_next(fd, bhead);
|
||||
BLI_assert((preview_from_file->w[preview_index] * preview_from_file->h[preview_index] *
|
||||
BLI_assert((preview_from_file->w[change] * preview_from_file->h[change] *
|
||||
sizeof(uint)) == bhead->len);
|
||||
result->rect[preview_index] = static_cast<uint *>(
|
||||
result->rect[change] = static_cast<uint *>(
|
||||
BLO_library_read_struct(fd, bhead, "PreviewImage Icon Rect"));
|
||||
}
|
||||
else {
|
||||
/* This should not be needed, but can happen in 'broken' .blend files,
|
||||
* better handle this gracefully than crashing. */
|
||||
BLI_assert(preview_from_file->rect[preview_index] == nullptr &&
|
||||
preview_from_file->w[preview_index] == 0 &&
|
||||
preview_from_file->h[preview_index] == 0);
|
||||
result->rect[preview_index] = nullptr;
|
||||
result->w[preview_index] = result->h[preview_index] = 0;
|
||||
BLI_assert(preview_from_file->rect[change] == nullptr &&
|
||||
preview_from_file->w[change] == 0 &&
|
||||
preview_from_file->h[change] == 0);
|
||||
result->rect[change] = nullptr;
|
||||
result->w[change] = result->h[change] = 0;
|
||||
}
|
||||
BKE_previewimg_finish(result, preview_index);
|
||||
BKE_previewimg_finish(result, change);
|
||||
}
|
||||
|
||||
return bhead;
|
||||
|
@ -317,7 +320,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *r_
|
|||
case ID_NT: /* fall through */
|
||||
new_prv = static_cast<PreviewImage *>(MEM_callocN(sizeof(PreviewImage), "newpreview"));
|
||||
BLI_linklist_prepend(&previews, new_prv);
|
||||
tot++;
|
||||
++tot;
|
||||
looking = 1;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -322,7 +322,7 @@ static void add_main_to_main(Main *mainvar, Main *from)
|
|||
|
||||
set_listbasepointers(mainvar, lbarray);
|
||||
a = set_listbasepointers(from, fromarray);
|
||||
while (a--) {
|
||||
while (--a) {
|
||||
BLI_movelisttolist(lbarray[a], fromarray[a]);
|
||||
}
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ void blo_split_main(ListBase *mainlist, Main *main)
|
|||
|
||||
int i = 0;
|
||||
for (Library *lib = static_cast<Library *>(main->libraries.first); lib;
|
||||
lib = static_cast<Library *>(lib->id.next), i++) {
|
||||
lib = static_cast<Library *>(lib->id.next), ++i) {
|
||||
Main *libmain = BKE_main_new();
|
||||
libmain->curlib = lib;
|
||||
libmain->versionfile = lib->versionfile;
|
||||
|
@ -401,7 +401,7 @@ void blo_split_main(ListBase *mainlist, Main *main)
|
|||
|
||||
ListBase *lbarray[INDEX_ID_MAX];
|
||||
i = set_listbasepointers(main, lbarray);
|
||||
while (i--) {
|
||||
while (--i) {
|
||||
ID *id = static_cast<ID *>(lbarray[i]->first);
|
||||
if (id == nullptr || GS(id->name) == ID_LI) {
|
||||
/* No ID_LI data-block should ever be linked anyway, but just in case, better be explicit. */
|
||||
|
@ -1556,7 +1556,7 @@ void blo_add_library_pointer_map(ListBase *old_mainlist, FileData *fd)
|
|||
|
||||
LISTBASE_FOREACH (Main *, ptr, old_mainlist) {
|
||||
int i = set_listbasepointers(ptr, lbarray);
|
||||
while (i--) {
|
||||
while (--i) {
|
||||
LISTBASE_FOREACH (ID *, id, lbarray[i]) {
|
||||
oldnewmap_lib_insert(fd, id, id, GS(id->name));
|
||||
}
|
||||
|
@ -1750,7 +1750,7 @@ static void switch_endian_structs(const SDNA *filesdna, BHead *bhead)
|
|||
blocksize = filesdna->types_size[filesdna->structs[bhead->SDNAnr]->type];
|
||||
|
||||
nblocks = bhead->nr;
|
||||
while (nblocks--) {
|
||||
while (--nblocks) {
|
||||
DNA_struct_switch_endian(filesdna, bhead->SDNAnr, data);
|
||||
|
||||
data += blocksize;
|
||||
|
@ -2167,8 +2167,8 @@ static bool scene_validate_setscene__liblink(Scene *sce, const int totscene)
|
|||
return true;
|
||||
}
|
||||
|
||||
for (a = 0, sce_iter = sce; sce_iter->set; sce_iter = sce_iter->set, a++) {
|
||||
/* This runs per library (before each libraries #Main has been joined),
|
||||
for (a = 0, sce_iter = sce; sce_iter->set; sce_iter = sce_iter->set, ++a) {
|
||||
/* This runs per library (before each libraries #Main has been joined),
|
||||
* so we can't step into other libraries since `totscene` is only for this library.
|
||||
*
|
||||
* Also, other libraries may not have been linked yet,
|
||||
|
@ -2782,7 +2782,7 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
641cb77f593052607838e282
|
||||
/* Make sure we have full path in lib->filepath_abs */
|
||||
BLI_strncpy(lib->filepath_abs, lib->filepath, sizeof(lib->filepath));
|
||||
BLI_path_normalize(fd->relabase, lib->filepath_abs);
|
||||
|
@ -4042,7 +4042,7 @@ static void sort_bhead_old_map(FileData *fd)
|
|||
int tot = 0;
|
||||
|
||||
for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
|
||||
tot++;
|
||||
++tot;
|
||||
}
|
||||
|
||||
fd->tot_bheadmap = tot;
|
||||
|
@ -4347,7 +4347,7 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
|
|||
do_it = false;
|
||||
|
||||
a = set_listbasepointers(mainvar, lbarray);
|
||||
while (a--) {
|
||||
while (--a) {
|
||||
id = static_cast<ID *>(lbarray[a]->first);
|
||||
while (id) {
|
||||
if (id->tag & LIB_TAG_NEED_EXPAND) {
|
||||
|
@ -4517,7 +4517,7 @@ static void split_main_newid(Main *mainptr, Main *main_newid)
|
|||
ListBase *lbarray_newid[INDEX_ID_MAX];
|
||||
int i = set_listbasepointers(mainptr, lbarray);
|
||||
set_listbasepointers(main_newid, lbarray_newid);
|
||||
while (i--) {
|
||||
while (--i) {
|
||||
BLI_listbase_clear(lbarray_newid[i]);
|
||||
|
||||
LISTBASE_FOREACH_MUTABLE (ID *, id, lbarray[i]) {
|
||||
|
@ -4652,7 +4652,7 @@ static int has_linked_ids_to_read(Main *mainvar)
|
|||
ListBase *lbarray[INDEX_ID_MAX];
|
||||
int a = set_listbasepointers(mainvar, lbarray);
|
||||
|
||||
while (a--) {
|
||||
while (--a) {
|
||||
LISTBASE_FOREACH (ID *, id, lbarray[a]) {
|
||||
if ((id->tag & LIB_TAG_ID_LINK_PLACEHOLDER) && !(id->flag & LIB_INDIRECT_WEAK_LINK)) {
|
||||
return true;
|
||||
|
@ -4721,7 +4721,7 @@ static void read_library_linked_ids(FileData *basefd,
|
|||
ListBase *lbarray[INDEX_ID_MAX];
|
||||
int a = set_listbasepointers(mainvar, lbarray);
|
||||
|
||||
while (a--) {
|
||||
while (--a) {
|
||||
ID *id = static_cast<ID *>(lbarray[a]->first);
|
||||
ListBase pending_free_ids = {nullptr};
|
||||
|
||||
|
@ -4773,7 +4773,7 @@ static void read_library_clear_weak_links(FileData *basefd, ListBase *mainlist,
|
|||
ListBase *lbarray[INDEX_ID_MAX];
|
||||
int a = set_listbasepointers(mainvar, lbarray);
|
||||
|
||||
while (a--) {
|
||||
while (--a) {
|
||||
ID *id = static_cast<ID *>(lbarray[a]->first);
|
||||
|
||||
while (id) {
|
||||
|
@ -5072,15 +5072,21 @@ static void convert_pointer_array_64_to_32(BlendDataReader *reader,
|
|||
{
|
||||
/* Match pointer conversion rules from bh4_from_bh8 and cast_pointer. */
|
||||
if (BLO_read_requires_endian_switch(reader)) {
|
||||
for (int i = 0; i < array_size; i++) {
|
||||
uint64_t ptr = src[i];
|
||||
int change = 0;
|
||||
for (int i = array_size; --i; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (array_size - i);
|
||||
uint64_t ptr = src[change];
|
||||
BLI_endian_switch_uint64(&ptr);
|
||||
dst[i] = uint32_t(ptr >> 3);
|
||||
dst[change] = uint32_t(ptr >> 3);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < array_size; i++) {
|
||||
dst[i] = uint32_t(src[i] >> 3);
|
||||
int change = 0;
|
||||
for (int i = array_size; --i; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (array_size - i);
|
||||
dst[change] = uint32_t(src[change] >> 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5091,8 +5097,11 @@ static void convert_pointer_array_32_to_64(BlendDataReader * /*reader*/,
|
|||
uint64_t *dst)
|
||||
{
|
||||
/* Match pointer conversion rules from bh8_from_bh4 and cast_pointer_32_to_64. */
|
||||
for (int i = 0; i < array_size; i++) {
|
||||
dst[i] = src[i];
|
||||
int change = 0;
|
||||
for (int i = array_size; --i; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (array_size - i);
|
||||
dst[change] = src[change];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -823,10 +823,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
|||
|
||||
if (ob->totcol && ob->matbits == NULL) {
|
||||
int a;
|
||||
int change;
|
||||
|
||||
ob->matbits = MEM_calloc_arrayN(ob->totcol, sizeof(char), "ob->matbits");
|
||||
for (a = 0; a < ob->totcol; a++) {
|
||||
ob->matbits[a] = (ob->colbits & (1 << a)) != 0;
|
||||
for (a = ob->totcol; --a; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (ob->totcol - a);
|
||||
ob->matbits[change] = (ob->colbits & (1 << change)) != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -987,7 +990,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
|||
Curve *cu;
|
||||
Key *key;
|
||||
const float *data;
|
||||
int a, tot;
|
||||
int a, tot, change;
|
||||
|
||||
/* shape keys are no longer applied to the mesh itself, but rather
|
||||
* to the evaluated #Mesh, so here we ensure that the basis
|
||||
|
@ -997,8 +1000,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
|||
data = key->refkey->data;
|
||||
tot = MIN2(me->totvert, key->refkey->totelem);
|
||||
MVert *verts = (MVert *)CustomData_get_layer_for_write(&me->vdata, CD_MVERT, me->totvert);
|
||||
for (a = 0; a < tot; a++, data += 3) {
|
||||
copy_v3_v3(verts[a].co_legacy, data);
|
||||
for (a = tot; --a, data += 3; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (tot - a);
|
||||
copy_v3_v3(verts[change].co_legacy, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1008,8 +1013,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
|||
data = key->refkey->data;
|
||||
tot = MIN2(lt->pntsu * lt->pntsv * lt->pntsw, key->refkey->totelem);
|
||||
|
||||
for (a = 0; a < tot; a++, data += 3) {
|
||||
copy_v3_v3(lt->def[a].vec, data);
|
||||
for (a = tot; --a, data += 3; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (tot - a);
|
||||
copy_v3_v3(lt->def[change].vec, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1022,7 +1029,8 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
|||
if (nu->bezt) {
|
||||
BezTriple *bezt = nu->bezt;
|
||||
|
||||
for (a = 0; a < nu->pntsu; a++, bezt++) {
|
||||
for (a = nu->pntsu; --a, ++bezt; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
copy_v3_v3(bezt->vec[0], data);
|
||||
data += 3;
|
||||
copy_v3_v3(bezt->vec[1], data);
|
||||
|
@ -1030,17 +1038,18 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
|||
copy_v3_v3(bezt->vec[2], data);
|
||||
data += 3;
|
||||
bezt->tilt = *data;
|
||||
data++;
|
||||
++data;
|
||||
}
|
||||
}
|
||||
else if (nu->bp) {
|
||||
BPoint *bp = nu->bp;
|
||||
|
||||
for (a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) {
|
||||
for (a = nu->pntsu * nu->pntsv; --a, ++bp; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
copy_v3_v3(bp->vec, data);
|
||||
data += 3;
|
||||
bp->tilt = *data;
|
||||
data++;
|
||||
++data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1422,10 +1431,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
|||
/* particle brush strength factor was changed from int to float */
|
||||
for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
|
||||
ParticleEditSettings *pset = &sce->toolsettings->particle;
|
||||
int a;
|
||||
int a, change;
|
||||
|
||||
for (a = 0; a < ARRAY_SIZE(pset->brush); a++) {
|
||||
pset->brush[a].strength /= 100.0f;
|
||||
for (a = ARRAY_SIZE(pset->brush); --a; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (ARRAY_SIZE(pset->brush) - a);
|
||||
pset->brush[change].strength /= 100.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1659,10 +1670,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
|||
|
||||
/* initialize scene active layer */
|
||||
for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
|
||||
int i;
|
||||
for (i = 0; i < 20; i++) {
|
||||
if (scene->lay & (1 << i)) {
|
||||
scene->layact = 1 << i;
|
||||
int i, change;
|
||||
for (i = 20; --i; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (20 - i);
|
||||
if (scene->lay & (1 << change)) {
|
||||
scene->layact = 1 << change;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2223,6 +2236,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
|||
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
|
||||
BezTriple *bezt;
|
||||
uint i = 0;
|
||||
uint change = 0;
|
||||
|
||||
/* only need to touch curves that had this flag set */
|
||||
if ((fcu->flag & FCURVE_AUTO_HANDLES) == 0) {
|
||||
|
@ -2233,7 +2247,8 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
|||
}
|
||||
|
||||
/* only change auto-handles to auto-clamped */
|
||||
for (bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
|
||||
for (bezt = fcu->bezt; i = fcu->totvert; --i, ++bezt) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
if (bezt->h1 == HD_AUTO) {
|
||||
bezt->h1 = HD_AUTO_ANIM;
|
||||
}
|
||||
|
|
|
@ -353,13 +353,19 @@ static void do_versions_mesh_mloopcol_swap_2_62_1(Mesh *me)
|
|||
MLoopCol *mloopcol;
|
||||
int a;
|
||||
int i;
|
||||
int change1;
|
||||
int change2;
|
||||
|
||||
for (a = 0; a < me->ldata.totlayer; a++) {
|
||||
for (a = me->ldata.totlayer; --a; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change1 = (me->ldata.totlayer - a);
|
||||
layer = &me->ldata.layers[a];
|
||||
|
||||
if (layer->type == CD_PROP_BYTE_COLOR) {
|
||||
mloopcol = (MLoopCol *)layer->data;
|
||||
for (i = 0; i < me->totloop; i++, mloopcol++) {
|
||||
for (i = me->totloop; --i, ++mloopcol; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change2 = (me->totloop - i);
|
||||
SWAP(uchar, mloopcol->r, mloopcol->b);
|
||||
}
|
||||
}
|
||||
|
@ -450,9 +456,12 @@ static void do_versions_nodetree_frame_2_64_6(bNodeTree *ntree)
|
|||
static void do_versions_affine_tracker_track(MovieTrackingTrack *track)
|
||||
{
|
||||
int i;
|
||||
int change;
|
||||
|
||||
for (i = 0; i < track->markersnr; i++) {
|
||||
MovieTrackingMarker *marker = &track->markers[i];
|
||||
for (i = track->markersnr; --i; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (track->markersnr - i);
|
||||
MovieTrackingMarker *marker = &track->markers[change];
|
||||
|
||||
if (is_zero_v2(marker->pattern_corners[0]) && is_zero_v2(marker->pattern_corners[1]) &&
|
||||
is_zero_v2(marker->pattern_corners[2]) && is_zero_v2(marker->pattern_corners[3])) {
|
||||
|
@ -892,15 +901,18 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
for (ob = bmain->objects.first; ob; ob = ob->id.next) {
|
||||
/* convert delta addition into delta scale */
|
||||
int i;
|
||||
for (i = 0; i < 3; i++) {
|
||||
if ((ob->dsize[i] == 0.0f) || /* simple case, user never touched dsize */
|
||||
(ob->scale[i] == 0.0f)) /* can't scale the dsize to give a non zero result,
|
||||
int change;
|
||||
for (i = 3; --i; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (3 - i);
|
||||
if ((ob->dsize[change] == 0.0f) || /* simple case, user never touched dsize */
|
||||
(ob->scale[change] == 0.0f)) /* can't scale the dsize to give a non zero result,
|
||||
* so fallback to 1.0f */
|
||||
{
|
||||
ob->dscale[i] = 1.0f;
|
||||
ob->dscale[change] = 1.0f;
|
||||
}
|
||||
else {
|
||||
ob->dscale[i] = (ob->scale[i] + ob->dsize[i]) / ob->scale[i];
|
||||
ob->dscale[change] = (ob->scale[change] + ob->dsize[change]) / ob->scale[change];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1863,18 +1875,18 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
BezTriple *bezt = nu->bezt;
|
||||
a = nu->pntsu;
|
||||
|
||||
while (a--) {
|
||||
while (--a) {
|
||||
bezt->radius = 1.0f;
|
||||
bezt++;
|
||||
++bezt;
|
||||
}
|
||||
}
|
||||
else if (nu->bp) {
|
||||
BPoint *bp = nu->bp;
|
||||
a = nu->pntsu * nu->pntsv;
|
||||
|
||||
while (a--) {
|
||||
while (--a) {
|
||||
bp->radius = 1.0f;
|
||||
bp++;
|
||||
++bp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2606,7 +2618,7 @@ void do_versions_after_linking_260(Main *bmain)
|
|||
if (input_node) {
|
||||
link->fromnode = input_node;
|
||||
link->fromsock = node_group_input_find_socket(input_node, link->fromsock->identifier);
|
||||
num_inputs++;
|
||||
++num_inputs;
|
||||
|
||||
if (link->tonode) {
|
||||
if (input_locx > link->tonode->locx - offsetx) {
|
||||
|
@ -2624,7 +2636,7 @@ void do_versions_after_linking_260(Main *bmain)
|
|||
if (output_node) {
|
||||
link->tonode = output_node;
|
||||
link->tosock = node_group_output_find_socket(output_node, link->tosock->identifier);
|
||||
num_outputs++;
|
||||
++num_outputs;
|
||||
|
||||
if (link->fromnode) {
|
||||
if (output_locx < link->fromnode->locx + offsetx) {
|
||||
|
|
|
@ -809,8 +809,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
ParticleSettings *part;
|
||||
for (part = bmain->particles.first; part; part = part->id.next) {
|
||||
int a;
|
||||
for (a = 0; a < MAX_MTEX; a++) {
|
||||
MTex *mtex = part->mtex[a];
|
||||
int change;
|
||||
for (a = MAX_MTEX; --a; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (MAX_MTEX - a);
|
||||
MTex *mtex = part->mtex[change];
|
||||
if (mtex) {
|
||||
mtex->kinkampfac = 1.0f;
|
||||
}
|
||||
|
@ -1147,7 +1150,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
/* Important to clear all non-persistent flags from older versions here,
|
||||
* otherwise they could collide with any new persistent flag we may add in the future. */
|
||||
a = set_listbasepointers(bmain, lbarray);
|
||||
while (a--) {
|
||||
while (--a) {
|
||||
LISTBASE_FOREACH (ID *, id, lbarray[a]) {
|
||||
id->flag &= LIB_FAKEUSER;
|
||||
}
|
||||
|
@ -1164,7 +1167,8 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
if (!MAIN_VERSION_ATLEAST(bmain, 277, 1)) {
|
||||
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
|
||||
ParticleEditSettings *pset = &scene->toolsettings->particle;
|
||||
for (int a = 0; a < ARRAY_SIZE(pset->brush); a++) {
|
||||
for (int a = 0; a < ARRAY_SIZE(pset->brush); ++a) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
if (pset->brush[a].strength > 1.0f) {
|
||||
pset->brush[a].strength *= 0.01f;
|
||||
}
|
||||
|
@ -1374,8 +1378,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
gps->thickness = gpl->thickness;
|
||||
|
||||
/* set alpha strength to 1 */
|
||||
for (int i = 0; i < gps->totpoints; i++) {
|
||||
gps->points[i].strength = 1.0f;
|
||||
int change;
|
||||
for (int i = gps->totpoints; --i; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (gps->totpoints - i);
|
||||
gps->points[change].strength = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1463,9 +1470,12 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
if (scene->toolsettings != NULL) {
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
ParticleEditSettings *pset = &ts->particle;
|
||||
for (int a = 0; a < ARRAY_SIZE(pset->brush); a++) {
|
||||
if (pset->brush[a].count == 0) {
|
||||
pset->brush[a].count = 10;
|
||||
int change;
|
||||
for (int a = ARRAY_SIZE(pset->brush); --a; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (ARRAY_SIZE(pset->brush) - a);
|
||||
if (pset->brush[change].count == 0) {
|
||||
pset->brush[change].count = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1646,8 +1656,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
|
||||
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
VPaint *vp = i ? ts->vpaint : ts->wpaint;
|
||||
int change;
|
||||
for (int i = 2; --i; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (2 - i);
|
||||
VPaint *vp = change ? ts->vpaint : ts->wpaint;
|
||||
if (vp != NULL) {
|
||||
/* remove all other flags */
|
||||
vp->flag &= (VP_FLAG_VGROUP_RESTRICT);
|
||||
|
|
|
@ -423,31 +423,34 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene)
|
|||
Collection *collection_master = scene->master_collection;
|
||||
Collection *collections[20] = {NULL};
|
||||
|
||||
for (int layer = 0; layer < 20; layer++) {
|
||||
int change;
|
||||
for (int layer = 20; --layer; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (20 - layer);
|
||||
LISTBASE_FOREACH (Base *, base, &scene->base) {
|
||||
if (base->lay & (1 << layer)) {
|
||||
if (base->lay & (1 << change)) {
|
||||
/* Create collections when needed only. */
|
||||
if (collections[layer] == NULL) {
|
||||
if (collections[change] == NULL) {
|
||||
char name[MAX_NAME];
|
||||
|
||||
BLI_snprintf(
|
||||
name, sizeof(collection_master->id.name), DATA_("Collection %d"), layer + 1);
|
||||
name, sizeof(collection_master->id.name), DATA_("Collection %d"), change + 1);
|
||||
|
||||
Collection *collection = BKE_collection_add(bmain, collection_master, name);
|
||||
collection->id.lib = scene->id.lib;
|
||||
if (ID_IS_LINKED(collection)) {
|
||||
collection->id.tag |= LIB_TAG_INDIRECT;
|
||||
}
|
||||
collections[layer] = collection;
|
||||
collections[change] = collection;
|
||||
|
||||
if (!(scene->lay & (1 << layer))) {
|
||||
if (!(scene->lay & (1 << change))) {
|
||||
collection->flag |= COLLECTION_HIDE_VIEWPORT | COLLECTION_HIDE_RENDER;
|
||||
}
|
||||
}
|
||||
|
||||
/* Note usually this would do slow collection syncing for view layers,
|
||||
* but since no view layers exists yet at this point it's fast. */
|
||||
BKE_collection_object_add_notest(bmain, collections[layer], base->object);
|
||||
BKE_collection_object_add_notest(bmain, collections[change], base->object);
|
||||
}
|
||||
|
||||
if (base->flag & SELECT) {
|
||||
|
@ -485,13 +488,16 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene)
|
|||
view_layer->id_properties = srl->prop;
|
||||
|
||||
/* Set exclusion and overrides. */
|
||||
for (int layer = 0; layer < 20; layer++) {
|
||||
Collection *collection = collections[layer];
|
||||
int change;
|
||||
for (int layer = 20; --layer; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (20 - layer);
|
||||
Collection *collection = collections[change];
|
||||
if (collection) {
|
||||
LayerCollection *lc = BKE_layer_collection_first_from_scene_collection(view_layer,
|
||||
collection);
|
||||
|
||||
if (srl->lay_exclude & (1 << layer)) {
|
||||
if (srl->lay_exclude & (1 << change)) {
|
||||
/* Disable excluded layer. */
|
||||
have_override = true;
|
||||
lc->flag |= LAYER_COLLECTION_EXCLUDE;
|
||||
|
@ -500,12 +506,12 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene)
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (srl->lay_zmask & (1 << layer)) {
|
||||
if (srl->lay_zmask & (1 << change)) {
|
||||
have_override = true;
|
||||
lc->flag |= LAYER_COLLECTION_HOLDOUT;
|
||||
}
|
||||
|
||||
if ((srl->lay & (1 << layer)) == 0) {
|
||||
if ((srl->lay & (1 << change)) == 0) {
|
||||
have_override = true;
|
||||
lc->flag |= LAYER_COLLECTION_INDIRECT_ONLY;
|
||||
}
|
||||
|
@ -901,8 +907,11 @@ static void do_version_curvemapping_flag_extend_extrapolate(CurveMapping *cumap)
|
|||
}
|
||||
|
||||
#define CUMA_EXTEND_EXTRAPOLATE_OLD 1
|
||||
for (int curve_map_index = 0; curve_map_index < 4; curve_map_index++) {
|
||||
CurveMap *cuma = &cumap->cm[curve_map_index];
|
||||
int change;
|
||||
for (int curve_map_index = 4; --curve_map_index; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (4 - curve_map_index);
|
||||
CurveMap *cuma = &cumap->cm[change];
|
||||
if (cuma->flag & CUMA_EXTEND_EXTRAPOLATE_OLD) {
|
||||
cumap->flag |= CUMA_EXTEND_EXTRAPOLATE;
|
||||
return;
|
||||
|
@ -1198,9 +1207,12 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports))
|
|||
/* Find or create hidden collection matching object's first layer. */
|
||||
Collection **collection_hidden = NULL;
|
||||
int coll_idx = 0;
|
||||
for (; coll_idx < 20; coll_idx++) {
|
||||
if (ob->lay & (1 << coll_idx)) {
|
||||
collection_hidden = &hidden_collection_array[coll_idx];
|
||||
int change = 0;
|
||||
for (coll_idx= 20; --coll_idx; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (20 - coll_idx);
|
||||
if (ob->lay & (1 << change)) {
|
||||
collection_hidden = &hidden_collection_array[change];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1433,7 +1445,8 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports))
|
|||
if (nu->bezt) {
|
||||
BezTriple *bezt = nu->bezt;
|
||||
|
||||
for (int a = 0; a < nu->pntsu; a++, bezt++) {
|
||||
for (int a = nu->pntsu; --a, ++bezt; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
if ((old_count -= 3) < 0) {
|
||||
memcpy(newptr, bezt->vec, sizeof(float[3][3]));
|
||||
newptr[3][0] = bezt->tilt;
|
||||
|
@ -1451,7 +1464,8 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports))
|
|||
else if (nu->bp) {
|
||||
BPoint *bp = nu->bp;
|
||||
|
||||
for (int a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) {
|
||||
for (int a = nu->pntsu * nu->pntsv; --a, ++bp; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
if (--old_count < 0) {
|
||||
copy_v3_v3(newptr[0], bp->vec);
|
||||
newptr[1][0] = bp->tilt;
|
||||
|
@ -2558,9 +2572,12 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
if (!DNA_struct_elem_find(fd->filesdna, "Image", "ListBase", "renderslot")) {
|
||||
for (Image *ima = bmain->images.first; ima; ima = ima->id.next) {
|
||||
if (ima->type == IMA_TYPE_R_RESULT) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
int change;
|
||||
for (int i = 8; --i; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (8 - i);
|
||||
RenderSlot *slot = MEM_callocN(sizeof(RenderSlot), "Image Render Slot Init");
|
||||
BLI_snprintf(slot->name, sizeof(slot->name), "Slot %d", i + 1);
|
||||
BLI_snprintf(slot->name, sizeof(slot->name), "Slot %d", change + 1);
|
||||
BLI_addtail(&ima->renderslots, slot);
|
||||
}
|
||||
}
|
||||
|
@ -3498,8 +3515,11 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
|
||||
if (!DNA_struct_find(fd->filesdna, "TransformOrientationSlot")) {
|
||||
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
|
||||
for (int i = 0; i < ARRAY_SIZE(scene->orientation_slots); i++) {
|
||||
scene->orientation_slots[i].index_custom = -1;
|
||||
int change;
|
||||
for (int i = ARRAY_SIZE(scene->orientation_slots); --i; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (ARRAY_SIZE(scene->orientation_slots) - i);
|
||||
scene->orientation_slots[change].index_custom = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4837,7 +4857,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
srgb_to_linearrgb_v4(gps->vert_color_fill, gps->vert_color_fill);
|
||||
int i;
|
||||
bGPDspoint *pt;
|
||||
for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
|
||||
for (i = gps->totpoints, pt = gps->points;--i, ++pt; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
srgb_to_linearrgb_v4(pt->vert_color, pt->vert_color);
|
||||
}
|
||||
}
|
||||
|
@ -5087,4 +5108,4 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
{
|
||||
/* Keep this block, even when empty. */
|
||||
}
|
||||
}
|
||||
}
|
|
@ -122,7 +122,9 @@ static void seq_convert_transform_animation(const Sequence *seq,
|
|||
FCurve *fcu = BKE_fcurve_find(&scene->adt->action->curves, path, 0);
|
||||
if (fcu != nullptr && !BKE_fcurve_is_empty(fcu)) {
|
||||
BezTriple *bezt = fcu->bezt;
|
||||
for (int i = 0; i < fcu->totvert; i++, bezt++) {
|
||||
int change;
|
||||
for (int i = fcu->totvert; --i, ++bezt; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
/* Same math as with old_image_center_*, but simplified. */
|
||||
bezt->vec[0][1] = (image_size - scene_size) / 2 + bezt->vec[0][1];
|
||||
bezt->vec[1][1] = (image_size - scene_size) / 2 + bezt->vec[1][1];
|
||||
|
@ -271,7 +273,9 @@ static void seq_convert_transform_animation_2(const Scene *scene,
|
|||
FCurve *fcu = BKE_fcurve_find(&scene->adt->action->curves, path, 0);
|
||||
if (fcu != nullptr && !BKE_fcurve_is_empty(fcu)) {
|
||||
BezTriple *bezt = fcu->bezt;
|
||||
for (int i = 0; i < fcu->totvert; i++, bezt++) {
|
||||
int change;
|
||||
for (int i = fcu->totvert; --i, ++bezt; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
/* Same math as with old_image_center_*, but simplified. */
|
||||
bezt->vec[0][1] *= scale_to_fit_factor;
|
||||
bezt->vec[1][1] *= scale_to_fit_factor;
|
||||
|
@ -706,8 +710,13 @@ static void do_versions_point_attributes(CustomData *pdata)
|
|||
CD_RADIUS = 44,
|
||||
};
|
||||
|
||||
for (int i = 0; i < pdata->totlayer; i++) {
|
||||
CustomDataLayer *layer = &pdata->layers[i];
|
||||
int change;
|
||||
for (int i = pdata->totlayer; --i; ) {
|
||||
/*optimized loop to use deincrement instead to use less resources
|
||||
because now it automatically stops when a reaches 0 and it loops
|
||||
the same number of times*/
|
||||
change = (pdata->totlayer - i);
|
||||
CustomDataLayer *layer = &pdata->layers[change];
|
||||
if (layer->type == CD_LOCATION) {
|
||||
STRNCPY(layer->name, "Position");
|
||||
layer->type = CD_PROP_FLOAT3;
|
||||
|
@ -722,8 +731,11 @@ static void do_versions_point_attributes(CustomData *pdata)
|
|||
static void do_versions_point_attribute_names(CustomData *pdata)
|
||||
{
|
||||
/* Change from capital initial letter to lower case (#82693). */
|
||||
for (int i = 0; i < pdata->totlayer; i++) {
|
||||
CustomDataLayer *layer = &pdata->layers[i];
|
||||
int change;
|
||||
for (int i = pdata->totlayer; --i; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (pdata->totlayer - i);
|
||||
CustomDataLayer *layer = &pdata->layers[change];
|
||||
if (layer->type == CD_PROP_FLOAT3 && STREQ(layer->name, "Position")) {
|
||||
STRNCPY(layer->name, "position");
|
||||
}
|
||||
|
@ -739,8 +751,9 @@ static void do_versions_point_attribute_names(CustomData *pdata)
|
|||
* This function applies the old correction to the actual animation data instead. */
|
||||
static void do_versions_291_fcurve_handles_limit(FCurve *fcu)
|
||||
{
|
||||
uint i = 1;
|
||||
for (BezTriple *bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
|
||||
uint i = (fcu->totvert - 1);
|
||||
for (BezTriple *bezt = fcu->bezt; --i, ++bezt; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
/* Only adjust bezier key-frames. */
|
||||
if (bezt->ipo != BEZT_IPO_BEZ) {
|
||||
continue;
|
||||
|
@ -845,8 +858,13 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
if (!MAIN_VERSION_ATLEAST(bmain, 290, 2)) {
|
||||
{
|
||||
short id_codes[] = {ID_BR, ID_PAL};
|
||||
for (int i = 0; i < ARRAY_SIZE(id_codes); i++) {
|
||||
ListBase *lb = which_libbase(bmain, id_codes[i]);
|
||||
int change;
|
||||
for (int i = ARRAY_SIZE(id_codes); --i; ) {
|
||||
/*optimized loop to use deincrement instead to use less resources
|
||||
because now it automatically stops when a reaches 0 and it loops
|
||||
the same number of times*/
|
||||
change = (ARRAY_SIZE(id_codes) - i);
|
||||
ListBase *lb = which_libbase(bmain, id_codes[change]);
|
||||
BKE_main_id_repair_duplicate_names_listbase(bmain, lb);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,8 +173,11 @@ static void version_idproperty_move_data_float(IDPropertyUIDataFloat *ui_data,
|
|||
ui_data->default_array = static_cast<double *>(
|
||||
MEM_malloc_arrayN(array_len, sizeof(double), __func__));
|
||||
const float *old_default_array = static_cast<const float *>(IDP_Array(default_value));
|
||||
for (int i = 0; i < ui_data->default_array_len; i++) {
|
||||
ui_data->default_array[i] = double(old_default_array[i]);
|
||||
int change;
|
||||
for (int i = ui_data->default_array_len; --i; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (ui_data->default_array_len - i);
|
||||
ui_data->default_array[change] = double(old_default_array[change]);
|
||||
}
|
||||
}
|
||||
else if (default_value->subtype == IDP_DOUBLE) {
|
||||
|
@ -483,7 +486,8 @@ static bool do_versions_sequencer_color_balance_sop(Sequence *seq, void * /*user
|
|||
if (smd->type == seqModifierType_ColorBalance) {
|
||||
StripColorBalance *cb = &((ColorBalanceModifierData *)smd)->color_balance;
|
||||
cb->method = SEQ_COLOR_BALANCE_METHOD_LIFTGAMMAGAIN;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int i = 3; --i; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
copy_v3_fl(cb->slope, 1.0f);
|
||||
copy_v3_fl(cb->offset, 1.0f);
|
||||
copy_v3_fl(cb->power, 1.0f);
|
||||
|
@ -2300,8 +2304,11 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
if (smd->bind_verts_num && smd->verts) {
|
||||
smd->mesh_verts_num = smd->bind_verts_num;
|
||||
|
||||
for (uint i = 0; i < smd->bind_verts_num; i++) {
|
||||
smd->verts[i].vertex_idx = i;
|
||||
uint change;
|
||||
for (uint i = smd->bind_verts_num; --i; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (smd->bind_verts_num - i);
|
||||
smd->verts[change].vertex_idx = change;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3183,12 +3190,16 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
}
|
||||
|
||||
LISTBASE_FOREACH (Mesh *, me, &bmain->meshes) {
|
||||
for (int step = 0; step < 2; step++) {
|
||||
int change;
|
||||
for (int step = 2; --step; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (2 - step);
|
||||
|
||||
CustomDataLayer *actlayer = nullptr;
|
||||
|
||||
int vact1, vact2;
|
||||
|
||||
if (step) {
|
||||
if (change) {
|
||||
vact1 = CustomData_get_render_layer_index(&me->vdata, CD_PROP_COLOR);
|
||||
vact2 = CustomData_get_render_layer_index(&me->ldata, CD_PROP_BYTE_COLOR);
|
||||
}
|
||||
|
@ -3205,7 +3216,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
}
|
||||
|
||||
if (actlayer) {
|
||||
if (step) {
|
||||
if (change) {
|
||||
BKE_id_attributes_default_color_set(&me->id, actlayer->name);
|
||||
}
|
||||
else {
|
||||
|
@ -3348,12 +3359,16 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
|
||||
/* Rebuild active/render color attribute references. */
|
||||
LISTBASE_FOREACH (Mesh *, me, &bmain->meshes) {
|
||||
for (int step = 0; step < 2; step++) {
|
||||
int change;
|
||||
for (int step = 2; --step; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (2 - step);
|
||||
|
||||
CustomDataLayer *actlayer = nullptr;
|
||||
|
||||
int vact1, vact2;
|
||||
|
||||
if (step) {
|
||||
if (change) {
|
||||
vact1 = CustomData_get_render_layer_index(&me->vdata, CD_PROP_COLOR);
|
||||
vact2 = CustomData_get_render_layer_index(&me->ldata, CD_PROP_BYTE_COLOR);
|
||||
}
|
||||
|
@ -3370,7 +3385,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
}
|
||||
|
||||
if (actlayer) {
|
||||
if (step) {
|
||||
if (change) {
|
||||
BKE_id_attributes_default_color_set(&me->id, actlayer->name);
|
||||
}
|
||||
else {
|
||||
|
@ -3386,13 +3401,16 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
if (md->type == eModifierType_DataTransfer) {
|
||||
DataTransferModifierData *dtmd = (DataTransferModifierData *)md;
|
||||
|
||||
for (int i = 0; i < DT_MULTILAYER_INDEX_MAX; i++) {
|
||||
if (dtmd->layers_select_src[i] == 0) {
|
||||
dtmd->layers_select_src[i] = DT_LAYERS_ALL_SRC;
|
||||
int change;
|
||||
for (int i = DT_MULTILAYER_INDEX_MAX; --i; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (DT_MULTILAYER_INDEX_MAX - i);
|
||||
if (dtmd->layers_select_src[change] == 0) {
|
||||
dtmd->layers_select_src[change] = DT_LAYERS_ALL_SRC;
|
||||
}
|
||||
|
||||
if (dtmd->layers_select_dst[i] == 0) {
|
||||
dtmd->layers_select_dst[i] = DT_LAYERS_NAME_DST;
|
||||
if (dtmd->layers_select_dst[change] == 0) {
|
||||
dtmd->layers_select_dst[change] = DT_LAYERS_NAME_DST;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3677,8 +3695,11 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
LISTBASE_FOREACH (Mesh *, mesh, &bmain->meshes) {
|
||||
int *face_sets = (int *)CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS);
|
||||
if (face_sets) {
|
||||
for (int i = 0; i < mesh->totpoly; i++) {
|
||||
face_sets[i] = abs(face_sets[i]);
|
||||
int change;
|
||||
for (int i = mesh->totpoly; --i; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change = (mesh->totpoly - i);
|
||||
face_sets[change] = abs(face_sets[change]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -255,12 +255,17 @@ static void vector_curve_node_remap(bNode *node)
|
|||
CurveMapping *mapping = node->storage;
|
||||
mapping->flag &= ~CUMA_DO_CLIP;
|
||||
|
||||
for (int curve_index = 0; curve_index < CM_TOT; curve_index++) {
|
||||
CurveMap *cm = &mapping->cm[curve_index];
|
||||
int change1;
|
||||
for (int curve_index = CM_TOT; --curve_index; ) {
|
||||
change1 = (CM_TOT - curve_index);
|
||||
CurveMap *cm = &mapping->cm[change1];
|
||||
if (cm->curve) {
|
||||
for (int i = 0; i < cm->totpoint; i++) {
|
||||
cm->curve[i].x = (cm->curve[i].x * 2.0f) - 1.0f;
|
||||
cm->curve[i].y = (cm->curve[i].y - 0.5f) * 2.0f;
|
||||
int change2;
|
||||
for (int i = cm->totpoint; --i; ) {
|
||||
//changed it to use decrement instead of increment to use less resources
|
||||
change2 = (cm->totpoint - i);
|
||||
cm->curve[change2].x = (cm->curve[change2].x * 2.0f) - 1.0f;
|
||||
cm->curve[change2].y = (cm->curve[change2].y - 0.5f) * 2.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -953,7 +953,7 @@ static void write_libraries(WriteData *wd, Main *main)
|
|||
}
|
||||
else {
|
||||
found_one = false;
|
||||
while (!found_one && tot--) {
|
||||
while (!found_one && --tot) {
|
||||
for (id = static_cast<ID *>(lbarray[tot]->first); id; id = static_cast<ID *>(id->next)) {
|
||||
if (id->us > 0 &&
|
||||
((id->tag & LIB_TAG_EXTERN) ||
|
||||
|
@ -989,7 +989,7 @@ static void write_libraries(WriteData *wd, Main *main)
|
|||
}
|
||||
|
||||
/* Write link placeholders for all direct linked IDs. */
|
||||
while (a--) {
|
||||
while (--a) {
|
||||
for (id = static_cast<ID *>(lbarray[a]->first); id; id = static_cast<ID *>(id->next)) {
|
||||
if (id->us > 0 &&
|
||||
((id->tag & LIB_TAG_EXTERN) ||
|
||||
|
@ -1181,7 +1181,7 @@ static bool write_file_handle(Main *mainvar,
|
|||
do {
|
||||
ListBase *lbarray[INDEX_ID_MAX];
|
||||
int a = set_listbasepointers(bmain, lbarray);
|
||||
while (a--) {
|
||||
while (--a) {
|
||||
ID *id = static_cast<ID *>(lbarray[a]->first);
|
||||
|
||||
if (id == nullptr || GS(id->name) == ID_LI) {
|
||||
|
|
Loading…
Reference in New Issue