bugfix [#22859] Multi-user images cant be made into single user in texure panel.

turns out this isnt exactly a bug since support was never written for this but may as well support it.
now rna/py can do image.copy() too.
This commit is contained in:
2010-07-30 06:09:23 +00:00
parent 1b7d264f1e
commit 449f8ce4fe
6 changed files with 23 additions and 13 deletions

View File

@@ -159,7 +159,7 @@ void BKE_image_memorypack(struct Image *ima);
void BKE_image_print_memlist(void);
/* empty image block, of similar type and filename */
struct Image *BKE_image_copy(struct Image *ima);
struct Image *copy_image(struct Image *ima);
/* merge source into dest, and free source */
void BKE_image_merge(struct Image *dest, struct Image *source);

View File

@@ -471,6 +471,7 @@ void flip_side_name (char *name, const char *from_name, int strip_number)
#undef IS_SEPARATOR
sprintf (name, "%s%s%s%s", prefix, replace, suffix, number);
printf("'%s' --> '%s'\n", from_name, name);
}
float defvert_find_weight(const struct MDeformVert *dvert, int group_num)

View File

@@ -287,17 +287,25 @@ static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int frame)
}
/* empty image block, of similar type and filename */
Image *BKE_image_copy(Image *ima)
Image *copy_image(Image *ima)
{
Image *new= image_alloc(ima->id.name+2, ima->source, ima->type);
Image *nima= image_alloc(ima->id.name+2, ima->source, ima->type);
BLI_strncpy(new->name, ima->name, sizeof(ima->name));
BLI_strncpy(nima->name, ima->name, sizeof(ima->name));
nima->flag= ima->flag;
nima->tpageflag= ima->tpageflag;
new->gen_x= ima->gen_x;
new->gen_y= ima->gen_y;
new->gen_type= ima->gen_type;
return new;
nima->gen_x= ima->gen_x;
nima->gen_y= ima->gen_y;
nima->gen_type= ima->gen_type;
nima->animspeed= ima->animspeed;
nima->aspx= ima->aspx;
nima->aspy= ima->aspy;
return nima;
}
void BKE_image_merge(Image *dest, Image *source)

View File

@@ -262,7 +262,8 @@ int id_copy(ID *id, ID **newid, int test)
if(!test) *newid= (ID*)copy_texture((Tex*)id);
return 1;
case ID_IM:
return 0; /* not implemented */
if(!test) *newid= (ID*)copy_image((Image*)id);
return 1;
case ID_WV:
return 0; /* deprecated */
case ID_LT:

View File

@@ -2565,7 +2565,7 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
if(ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
if(node->id) {
if(node->flag & NODE_DO_OUTPUT)
node->new_node->id= (ID *)BKE_image_copy((Image *)node->id);
node->new_node->id= (ID *)copy_image((Image *)node->id);
else
node->new_node->id= NULL;
}

View File

@@ -105,7 +105,7 @@ typedef struct Image {
/* **************** IMAGE ********************* */
/* flag */
/* Image.flag */
#define IMA_FIELDS 1
#define IMA_STD_FIELD 2
#define IMA_DO_PREMUL 4
@@ -115,7 +115,7 @@ typedef struct Image {
#define IMA_DEPRECATED 64
#define IMA_OLD_PREMUL 128
/* tpageflag */
/* Image.tpageflag */
#define IMA_TILES 1
#define IMA_TWINANIM 2
#define IMA_COLCYCLE 4 /* Depreciated */