optimized blenloader for loops #106573

Closed
glitchy-virophage wants to merge 31 commits from (deleted):main into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 10 additions and 10 deletions
Showing only changes of commit 62a388b1cd - Show all commits

View File

@ -809,12 +809,12 @@ 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;
int change
for (a = MAX_MTEX; --a) {
int change;
for (a = MAX_MTEX; --a; ) {
/*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 = (MAX_MTEX - a)
change = (MAX_MTEX - a);
MTex *mtex = part->mtex[change];
if (mtex) {
mtex->kinkampfac = 1.0f;
@ -1169,12 +1169,12 @@ 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) {
/*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*/
if (pset->brush[change].strength > 1.0f) {
pset->brush[change].strength *= 0.01f;
if (pset->brush[a].strength > 1.0f) {
pset->brush[a].strength *= 0.01f;
}
}
}
@ -1383,7 +1383,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* set alpha strength to 1 */
int change;
for (int i = gps->totpoints; --i) {
for (int i = gps->totpoints; --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*/
@ -1477,11 +1477,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
ToolSettings *ts = scene->toolsettings;
ParticleEditSettings *pset = &ts->particle;
int change;
for (int a = ARRAY_SIZE(pset->brush); --a) {
for (int a = ARRAY_SIZE(pset->brush); --a; ) {
/*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(pset->brush) - a)
change = (ARRAY_SIZE(pset->brush) - a);
if (pset->brush[change].count == 0) {
pset->brush[change].count = 10;
}
@ -1665,7 +1665,7 @@ 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;
int change;
for (int i = 2; --i) {
for (int i = 2; --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*/