Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2006-10-26 14:13:16 +0400
committerTon Roosendaal <ton@blender.org>2006-10-26 14:13:16 +0400
commit9f77785d7c8362abfb1d712a403e687cbb3d8ac7 (patch)
treebc952e466000047bd8c379cff8697a44ccd1d05a
parentf0dcd2db75b488be000a8be310e1c8a65e85227e (diff)
Coding work while on the trip to london (based on Plumiferos wishlist);
- Icon previews for Images were created always for old files, which made browsing (menus) incredible slow. Added a minor change in the flow, so icons only get created when the user invokes loading images. Andrea; you might check this, probably not al cases are covered yet? - Compositor: the 'File Output' node now has a min/max frame for which it writes files - Compositor: fixed a very bad bug (even in 2.42a release) that made the depsgraph for nodes not work... while editing, only the nodes that change should be recalculated, but accidentally all of them were done each time.
-rw-r--r--source/blender/blenkernel/intern/image.c4
-rw-r--r--source/blender/blenkernel/intern/node.c7
-rw-r--r--source/blender/blenkernel/intern/node_composite.c45
-rw-r--r--source/blender/makesdna/DNA_node_types.h1
-rw-r--r--source/blender/src/drawnode.c24
-rw-r--r--source/blender/src/interface_icons.c13
6 files changed, 58 insertions, 36 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index ea52c34bb93..fc7f4b4cdf1 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -587,6 +587,10 @@ void load_image(Image * ima, int flags, char *relabase, int framenum)
if (ima->ibuf) {
detectBitmapFont(ima->ibuf);
+ /* preview is NULL when it has never been used as an icon before */
+ if(ima->preview==NULL)
+ BKE_icon_changed(BKE_icon_getid(&ima->id));
+
}
}
}
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 7dc1db2808e..7cd917b61b9 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -804,6 +804,8 @@ bNode *nodeAddNodeType(bNodeTree *ntree, int type, bNodeTree *ngroup)
nif->imtype= G.scene->r.imtype;
nif->subimtype= G.scene->r.subimtype;
nif->quality= G.scene->r.quality;
+ nif->sfra= G.scene->r.sfra;
+ nif->efra= G.scene->r.efra;
}
}
@@ -1438,6 +1440,9 @@ void NodeTagChanged(bNodeTree *ntree, bNode *node)
void NodeTagIDChanged(bNodeTree *ntree, ID *id)
{
+ if(id==NULL)
+ return;
+
if(ntree->type==NTREE_COMPOSIT) {
bNode *node;
@@ -1874,7 +1879,7 @@ static void *exec_composite_node(void *node_v)
bNodeStack *nsin[MAX_SOCKET]; /* arbitrary... watch this */
bNodeStack *nsout[MAX_SOCKET]; /* arbitrary... watch this */
bNode *node= node_v;
- ThreadData *thd= (ThreadData *)node->new_node;
+ ThreadData *thd= (ThreadData *)node->new_node; /* abuse */
node_get_stack(node, thd->stack, nsin, nsout);
diff --git a/source/blender/blenkernel/intern/node_composite.c b/source/blender/blenkernel/intern/node_composite.c
index 34096fe9082..61f62539cbc 100644
--- a/source/blender/blenkernel/intern/node_composite.c
+++ b/source/blender/blenkernel/intern/node_composite.c
@@ -687,26 +687,31 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack *
if(in[0]->data) {
RenderData *rd= data;
NodeImageFile *nif= node->storage;
- CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
- ImBuf *ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0);
- char string[256];
-
- ibuf->rect_float= cbuf->rect;
- ibuf->dither= rd->dither_intensity;
-
- BKE_makepicstring(string, nif->name, rd->cfra, nif->imtype);
-
- if(0 == BKE_write_ibuf(ibuf, string, nif->imtype, nif->subimtype, nif->imtype==R_OPENEXR?nif->codec:nif->quality))
- printf("Cannot save Node File Output to %s\n", string);
- else
- printf("Saved: %s\n", string);
-
- IMB_freeImBuf(ibuf);
-
- generate_preview(node, cbuf);
-
- if(in[0]->data != cbuf)
- free_compbuf(cbuf);
+ if(nif->sfra!=nif->efra && (rd->cfra<nif->sfra || rd->cfra>nif->efra)) {
+ return; /* BAIL OUT RETURN */
+ }
+ else {
+ CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
+ ImBuf *ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0);
+ char string[256];
+
+ ibuf->rect_float= cbuf->rect;
+ ibuf->dither= rd->dither_intensity;
+
+ BKE_makepicstring(string, nif->name, rd->cfra, nif->imtype);
+
+ if(0 == BKE_write_ibuf(ibuf, string, nif->imtype, nif->subimtype, nif->imtype==R_OPENEXR?nif->codec:nif->quality))
+ printf("Cannot save Node File Output to %s\n", string);
+ else
+ printf("Saved: %s\n", string);
+
+ IMB_freeImBuf(ibuf);
+
+ generate_preview(node, cbuf);
+
+ if(in[0]->data != cbuf)
+ free_compbuf(cbuf);
+ }
}
}
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index e81da44d033..c7db4a318ac 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -199,6 +199,7 @@ typedef struct NodeHueSat {
typedef struct NodeImageFile {
char name[256];
short imtype, subimtype, quality, codec;
+ int sfra, efra;
} NodeImageFile;
#endif
diff --git a/source/blender/src/drawnode.c b/source/blender/src/drawnode.c
index 96df8914a1a..f7df77c3640 100644
--- a/source/blender/src/drawnode.c
+++ b/source/blender/src/drawnode.c
@@ -1047,6 +1047,9 @@ static int node_composit_buts_file_output(uiBlock *block, bNodeTree *ntree, bNod
{
if(block) {
NodeImageFile *nif= node->storage;
+ short x= (short)butr->xmin;
+ short y= (short)butr->ymin;
+ short w= (short)butr->xmax-butr->xmin;
char str[320];
node_imagetype_string(str);
@@ -1054,29 +1057,38 @@ static int node_composit_buts_file_output(uiBlock *block, bNodeTree *ntree, bNod
uiBlockBeginAlign(block);
uiDefBut(block, TEX, B_NOP, "",
- butr->xmin, butr->ymin+40.0f, butr->xmax-butr->xmin, 20,
+ x, y+60, w, 20,
nif->name, 0.0f, 240.0f, 0, 0, "");
uiDefButS(block, MENU, B_NOP, str,
- butr->xmin, butr->ymin+20.0f, butr->xmax-butr->xmin, 20,
+ x, y+40, w, 20,
&nif->imtype, 0.0f, 1.0f, 0, 0, "");
if(nif->imtype==R_OPENEXR) {
uiDefButBitS(block, TOG, R_OPENEXR_HALF, B_NOP, "Half",
- butr->xmin, butr->ymin, (butr->xmax-butr->xmin)/2, 20,
+ x, y+20, w/2, 20,
&nif->subimtype, 0, 0, 0, 0, "");
uiDefButS(block, MENU,B_NOP, "Codec %t|None %x0|Pxr24 (lossy) %x1|ZIP (lossless) %x2|PIZ (lossless) %x3|RLE (lossless) %x4",
- butr->xmin+(butr->xmax-butr->xmin)/2, butr->ymin, (butr->xmax-butr->xmin)/2, 20,
+ x+w/2, y+20, w/2, 20,
&nif->codec, 0, 0, 0, 0, "");
}
else {
uiDefButS(block, NUM, B_NOP, "Quality: ",
- butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
+ x, y+20, w, 20,
&nif->quality, 10.0f, 100.0f, 10, 0, "");
}
+
+ /* start frame, end frame */
+ uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "SFra: ",
+ x, y, w/2, 20,
+ &nif->sfra, 1, MAXFRAMEF, 10, 0, "");
+ uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "EFra: ",
+ x+w/2, y, w/2, 20,
+ &nif->efra, 1, MAXFRAMEF, 10, 0, "");
+
}
- return 60;
+ return 80;
}
static void node_scale_cb(void *node_v, void *unused_v)
diff --git a/source/blender/src/interface_icons.c b/source/blender/src/interface_icons.c
index 36c0e766bc6..65930a53417 100644
--- a/source/blender/src/interface_icons.c
+++ b/source/blender/src/interface_icons.c
@@ -671,7 +671,6 @@ static void icon_copy_rect(ImBuf *ibuf, RenderInfo *ri)
static void icon_from_image(Image *img, RenderInfo *ri)
{
unsigned int pr_size = ri->pr_rectx*ri->pr_recty*sizeof(unsigned int);
- short image_loaded = 0;
/* img->ok is zero when Image cannot load */
if (img==NULL || img->ok==0)
@@ -684,27 +683,23 @@ static void icon_from_image(Image *img, RenderInfo *ri)
/* we only load image if there's no preview saved already ...
always loading and reducing images is too expensive */
+ /* new rule: never read images, so icons get created while user works,
+ not always on first use of a menu */
if(!img->preview) {
if(img->ibuf==NULL || img->ibuf->rect==NULL) {
- load_image(img, IB_rect, G.sce, G.scene->r.cfra);
- if(img->ok==0)
- return;
- image_loaded = 1;
+ return;
}
icon_copy_rect(img->ibuf, ri);
/* now copy the created preview to the DNA struct to be saved in file */
img->preview = MEM_callocN(sizeof(PreviewImage), "img_prv");
if (img->preview) {
+ printf("created image prv\n");
img->preview->w = ri->pr_rectx;
img->preview->h = ri->pr_recty;
img->preview->rect = MEM_callocN(pr_size, "prv_rect");
memcpy(img->preview->rect, ri->rect, pr_size);
}
-
- /* if we only loaded image for preview, we don't want to keep it in memory -
- important for huge image files */
- if (image_loaded) free_image_buffers(img);
}
else {
unsigned int img_prv_size = img->preview->w*img->preview->h*sizeof(unsigned int);