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
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2006-06-17 15:40:50 +0400
committerTon Roosendaal <ton@blender.org>2006-06-17 15:40:50 +0400
commit16bce562d0ecb045627239cdaf00d510b3b6935e (patch)
tree4fb45e3c549653583dcc747762daa9e21f6a6c24 /source
parent4e078c1a738ef6a9def38b8a7e08f771c91ee06d (diff)
Fix for Compositor, Image node: reads now from Movie files as well.
(support was there already halfway, needed to add button and an anim check)
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/node_composite.c59
-rw-r--r--source/blender/src/drawnode.c5
2 files changed, 47 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/node_composite.c b/source/blender/blenkernel/intern/node_composite.c
index 2d6ed137bf4..d1c36371eda 100644
--- a/source/blender/blenkernel/intern/node_composite.c
+++ b/source/blender/blenkernel/intern/node_composite.c
@@ -54,6 +54,7 @@
/* NOTE: no imbuf calls allowed in composit, we need threadsafe malloc! */
#include "IMB_imbuf_types.h"
+#include "IMB_imbuf.h"
#include "RE_pipeline.h"
#include "RE_shader_ext.h" /* <- TexResult */
@@ -729,30 +730,56 @@ static void animated_image(bNode *node, int cfra)
Image *ima;
NodeImageAnim *nia;
int imanr;
- unsigned short numlen;
- char name[FILE_MAXDIR+FILE_MAXFILE], head[FILE_MAXDIR+FILE_MAXFILE], tail[FILE_MAXDIR+FILE_MAXFILE];
ima= (Image *)node->id;
nia= node->storage;
- if(nia && nia->frames && ima && ima->name) { /* frames */
- strcpy(name, ima->name);
+ if(nia && nia->frames && ima && ima->name) { /* frames anim or movie */
imanr= calcimanr(cfra, nia);
- if(imanr!=ima->lastframe) {
- ima->lastframe= imanr;
-
- BLI_stringdec(name, head, tail, &numlen);
- BLI_stringenc(name, head, tail, numlen, imanr);
-
- ima= add_image(name);
+
+ if(nia->movie) {
+ if(ima->anim==NULL) ima->anim = openanim(ima->name, IB_cmap | IB_rect);
+ if (ima->anim) {
+ int dur = IMB_anim_get_duration(ima->anim);
+
+ if(imanr < 0) imanr = 0;
+ if(imanr > (dur-1)) imanr= dur-1;
+
+ BLI_lock_thread(LOCK_MALLOC);
+ if(ima->ibuf) IMB_freeImBuf(ima->ibuf);
+ ima->ibuf = IMB_anim_absolute(ima->anim, imanr);
+ BLI_unlock_thread(LOCK_MALLOC);
+
+ /* patch for textbutton with name ima (B_NAMEIMA) */
+ if(ima->ibuf) {
+ strcpy(ima->ibuf->name, ima->name);
+ ima->ok= 1;
+ }
+ }
+ }
+ else {
- if(ima) {
- ima->flag |= IMA_FROMANIM;
- if(node->id) node->id->us--;
- node->id= (ID *)ima;
+ if(imanr!=ima->lastframe) {
+ unsigned short numlen;
+ char name[FILE_MAXDIR+FILE_MAXFILE], head[FILE_MAXDIR+FILE_MAXFILE], tail[FILE_MAXDIR+FILE_MAXFILE];
+
+ strcpy(name, ima->name);
+
+ ima->lastframe= imanr;
- ima->ok= 1;
+ BLI_stringdec(name, head, tail, &numlen);
+ BLI_stringenc(name, head, tail, numlen, imanr);
+
+ ima= add_image(name);
+
+ if(ima) {
+ ima->flag |= IMA_FROMANIM;
+ if(node->id) node->id->us--;
+ node->id= (ID *)ima;
+
+ ima->ok= 1;
+ }
}
}
}
diff --git a/source/blender/src/drawnode.c b/source/blender/src/drawnode.c
index d20a14a2c30..db1ae3ac452 100644
--- a/source/blender/src/drawnode.c
+++ b/source/blender/src/drawnode.c
@@ -713,8 +713,11 @@ static int node_composit_buts_image(uiBlock *block, bNodeTree *ntree, bNode *nod
butr->xmin, dy, width, 19,
&nia->nr, 0.0, 10000.0, 0, 0, "Number in image name, used as first in animation");
uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Cycl",
- butr->xmin+width, dy, width, 19,
+ butr->xmin+width, dy, width-19, 19,
&nia->cyclic, 0.0, 0.0, 0, 0, "Make animation go cyclic");
+ bt= uiDefIconButC(block, TOG, B_NODE_EXEC+node->nr, ICON_SEQUENCE,
+ butr->xmax-19, dy, 19, 19,
+ &nia->movie, 0.0, 19.0, 0, 0, "Enable/Disable reading Image from Movie file");
}