Fix wrong user counter in world node trees
World is being localized without increasing ID users, so no need to decrease ID users on localized world free.
This commit is contained in:
@@ -35,7 +35,8 @@
|
||||
|
||||
struct World;
|
||||
|
||||
void BKE_world_free(struct World *sc);
|
||||
void BKE_world_free(struct World *sc);
|
||||
void BKE_world_free_ex(struct World *sc, int do_id_user);
|
||||
struct World *add_world(const char *name);
|
||||
struct World *BKE_world_copy(struct World *wrld);
|
||||
struct World *localize_world(struct World *wrld);
|
||||
|
@@ -51,14 +51,14 @@
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_world.h"
|
||||
|
||||
void BKE_world_free(World *wrld)
|
||||
void BKE_world_free_ex(World *wrld, int do_id_user)
|
||||
{
|
||||
MTex *mtex;
|
||||
int a;
|
||||
|
||||
for (a = 0; a < MAX_MTEX; a++) {
|
||||
mtex = wrld->mtex[a];
|
||||
if (mtex && mtex->tex) mtex->tex->id.us--;
|
||||
if (do_id_user && mtex && mtex->tex) mtex->tex->id.us--;
|
||||
if (mtex) MEM_freeN(mtex);
|
||||
}
|
||||
BKE_previewimg_free(&wrld->preview);
|
||||
@@ -67,7 +67,7 @@ void BKE_world_free(World *wrld)
|
||||
|
||||
/* is no lib link block, but world extension */
|
||||
if (wrld->nodetree) {
|
||||
ntreeFreeTree(wrld->nodetree);
|
||||
ntreeFreeTree_ex(wrld->nodetree, do_id_user);
|
||||
MEM_freeN(wrld->nodetree);
|
||||
}
|
||||
|
||||
@@ -75,6 +75,10 @@ void BKE_world_free(World *wrld)
|
||||
wrld->id.icon_id = 0;
|
||||
}
|
||||
|
||||
void BKE_world_free(World *wrld)
|
||||
{
|
||||
BKE_world_free_ex(wrld, TRUE);
|
||||
}
|
||||
|
||||
World *add_world(const char *name)
|
||||
{
|
||||
|
@@ -788,7 +788,7 @@ static void shader_preview_free(void *customdata)
|
||||
|
||||
/* get rid of copied world */
|
||||
BLI_remlink(&pr_main->world, sp->worldcopy);
|
||||
BKE_world_free(sp->worldcopy);
|
||||
BKE_world_free_ex(sp->worldcopy, FALSE);
|
||||
|
||||
properties = IDP_GetProperties((ID *)sp->worldcopy, FALSE);
|
||||
if (properties) {
|
||||
|
Reference in New Issue
Block a user