2003-04-26 11:56:44 +00:00
|
|
|
/* image.c
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
|
* $Id$
|
|
|
|
|
*
|
2006-12-20 17:57:56 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2006-12-20 17:57:56 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
|
*
|
2006-12-20 17:57:56 +00:00
|
|
|
* Contributor(s): Blender Foundation, 2006
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
2006-12-20 17:57:56 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#ifndef WIN32
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#else
|
|
|
|
|
#include <io.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
#include <time.h>
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
|
|
#include "IMB_imbuf_types.h"
|
|
|
|
|
#include "IMB_imbuf.h"
|
2006-12-21 01:16:25 +00:00
|
|
|
|
|
|
|
|
#ifdef WITH_OPENEXR
|
2006-12-20 17:57:56 +00:00
|
|
|
#include "intern/openexr/openexr_multi.h"
|
2006-12-21 01:16:25 +00:00
|
|
|
#endif
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
#include "DNA_image_types.h"
|
|
|
|
|
#include "DNA_packedFile_types.h"
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
#include "DNA_scene_types.h"
|
2007-10-20 16:17:27 +00:00
|
|
|
#include "DNA_camera_types.h"
|
2006-12-20 17:57:56 +00:00
|
|
|
#include "DNA_texture_types.h"
|
2007-12-24 18:38:03 +00:00
|
|
|
#include "DNA_sequence_types.h"
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
#include "DNA_userdef_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-11-27 16:21:25 +00:00
|
|
|
#include "BLI_arithb.h"
|
2006-12-20 17:57:56 +00:00
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
|
#include "BLI_threads.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
#include "BKE_bmfont.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_global.h"
|
2005-12-21 22:21:43 +00:00
|
|
|
#include "BKE_icons.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_image.h"
|
2006-12-20 17:57:56 +00:00
|
|
|
#include "BKE_library.h"
|
|
|
|
|
#include "BKE_main.h"
|
|
|
|
|
#include "BKE_packedFile.h"
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
#include "BKE_scene.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_texture.h"
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
#include "BKE_utildefines.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2007-11-08 13:02:59 +00:00
|
|
|
#include "BIF_editseq.h"
|
|
|
|
|
|
2005-07-27 07:43:48 +00:00
|
|
|
#include "PIL_time.h"
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
#include "RE_pipeline.h"
|
|
|
|
|
|
2007-10-20 16:17:27 +00:00
|
|
|
/* for stamp drawing to an image */
|
2007-10-21 15:48:09 +00:00
|
|
|
#include "BMF_Api.h"
|
2007-10-20 16:17:27 +00:00
|
|
|
|
2007-12-24 18:38:03 +00:00
|
|
|
#include "BDR_drawmesh.h"
|
2007-10-20 16:17:27 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* max int, to indicate we don't store sequences in ibuf */
|
|
|
|
|
#define IMA_NO_INDEX 0x7FEFEFEF
|
|
|
|
|
|
|
|
|
|
/* quick lookup: supports 1 million frames, thousand passes */
|
|
|
|
|
#define IMA_MAKE_INDEX(frame, index) ((frame)<<10)+index
|
|
|
|
|
#define IMA_INDEX_FRAME(index) (index>>10)
|
|
|
|
|
|
|
|
|
|
/* ******** IMAGE PROCESSING ************* */
|
|
|
|
|
|
2007-12-01 22:00:09 +00:00
|
|
|
/* used by sequencer and image premul option - IMA_DO_PREMUL */
|
2006-12-20 17:57:56 +00:00
|
|
|
void converttopremul(struct ImBuf *ibuf)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2006-12-20 17:57:56 +00:00
|
|
|
int x, y, val;
|
|
|
|
|
char *cp;
|
|
|
|
|
|
|
|
|
|
if(ibuf==0) return;
|
|
|
|
|
if(ibuf->depth==24) { /* put alpha at 255 */
|
|
|
|
|
|
|
|
|
|
cp= (char *)(ibuf->rect);
|
|
|
|
|
for(y=0; y<ibuf->y; y++) {
|
|
|
|
|
for(x=0; x<ibuf->x; x++, cp+=4) {
|
|
|
|
|
cp[3]= 255;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
cp= (char *)(ibuf->rect);
|
|
|
|
|
for(y=0; y<ibuf->y; y++) {
|
|
|
|
|
for(x=0; x<ibuf->x; x++, cp+=4) {
|
|
|
|
|
if(cp[3]==0) {
|
|
|
|
|
cp[0]= cp[1]= cp[2]= 0;
|
|
|
|
|
}
|
|
|
|
|
else if(cp[3]!=255) {
|
|
|
|
|
val= cp[3];
|
|
|
|
|
cp[0]= (cp[0]*val)>>8;
|
|
|
|
|
cp[1]= (cp[1]*val)>>8;
|
|
|
|
|
cp[2]= (cp[2]*val)>>8;
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void de_interlace_ng(struct ImBuf *ibuf) /* neogeo fields */
|
|
|
|
|
{
|
|
|
|
|
struct ImBuf * tbuf1, * tbuf2;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if (ibuf == 0) return;
|
|
|
|
|
if (ibuf->flags & IB_fields) return;
|
|
|
|
|
ibuf->flags |= IB_fields;
|
|
|
|
|
|
|
|
|
|
if (ibuf->rect) {
|
|
|
|
|
/* make copies */
|
|
|
|
|
tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect, (unsigned char)0);
|
|
|
|
|
tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect, (unsigned char)0);
|
|
|
|
|
|
|
|
|
|
ibuf->x *= 2;
|
|
|
|
|
|
|
|
|
|
IMB_rectcpy(tbuf1, ibuf, 0, 0, 0, 0, ibuf->x, ibuf->y);
|
|
|
|
|
IMB_rectcpy(tbuf2, ibuf, 0, 0, tbuf2->x, 0, ibuf->x, ibuf->y);
|
|
|
|
|
|
|
|
|
|
ibuf->x /= 2;
|
|
|
|
|
IMB_rectcpy(ibuf, tbuf1, 0, 0, 0, 0, tbuf1->x, tbuf1->y);
|
|
|
|
|
IMB_rectcpy(ibuf, tbuf2, 0, tbuf2->y, 0, 0, tbuf2->x, tbuf2->y);
|
|
|
|
|
|
|
|
|
|
IMB_freeImBuf(tbuf1);
|
|
|
|
|
IMB_freeImBuf(tbuf2);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
ibuf->y /= 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void de_interlace_st(struct ImBuf *ibuf) /* standard fields */
|
|
|
|
|
{
|
|
|
|
|
struct ImBuf * tbuf1, * tbuf2;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if (ibuf == 0) return;
|
|
|
|
|
if (ibuf->flags & IB_fields) return;
|
|
|
|
|
ibuf->flags |= IB_fields;
|
|
|
|
|
|
|
|
|
|
if (ibuf->rect) {
|
|
|
|
|
/* make copies */
|
|
|
|
|
tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect, 0);
|
|
|
|
|
tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect, 0);
|
|
|
|
|
|
|
|
|
|
ibuf->x *= 2;
|
|
|
|
|
|
|
|
|
|
IMB_rectcpy(tbuf1, ibuf, 0, 0, 0, 0, ibuf->x, ibuf->y);
|
|
|
|
|
IMB_rectcpy(tbuf2, ibuf, 0, 0, tbuf2->x, 0, ibuf->x, ibuf->y);
|
|
|
|
|
|
|
|
|
|
ibuf->x /= 2;
|
|
|
|
|
IMB_rectcpy(ibuf, tbuf2, 0, 0, 0, 0, tbuf2->x, tbuf2->y);
|
|
|
|
|
IMB_rectcpy(ibuf, tbuf1, 0, tbuf2->y, 0, 0, tbuf1->x, tbuf1->y);
|
|
|
|
|
|
|
|
|
|
IMB_freeImBuf(tbuf1);
|
|
|
|
|
IMB_freeImBuf(tbuf2);
|
|
|
|
|
}
|
|
|
|
|
ibuf->y /= 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void image_de_interlace(Image *ima, int odd)
|
|
|
|
|
{
|
|
|
|
|
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
|
|
|
|
|
if(ibuf) {
|
|
|
|
|
if(odd)
|
|
|
|
|
de_interlace_st(ibuf);
|
|
|
|
|
else
|
|
|
|
|
de_interlace_ng(ibuf);
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* ***************** ALLOC & FREE, DATA MANAGING *************** */
|
|
|
|
|
|
|
|
|
|
static void image_free_buffers(Image *ima)
|
2006-06-05 11:07:15 +00:00
|
|
|
{
|
2006-12-20 17:57:56 +00:00
|
|
|
ImBuf *ibuf;
|
|
|
|
|
|
|
|
|
|
while((ibuf = ima->ibufs.first)) {
|
|
|
|
|
BLI_remlink(&ima->ibufs, ibuf);
|
|
|
|
|
|
|
|
|
|
if (ibuf->userdata) {
|
|
|
|
|
MEM_freeN(ibuf->userdata);
|
|
|
|
|
ibuf->userdata = NULL;
|
|
|
|
|
}
|
|
|
|
|
IMB_freeImBuf(ibuf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(ima->anim) IMB_free_anim(ima->anim);
|
|
|
|
|
ima->anim= NULL;
|
|
|
|
|
|
|
|
|
|
if(ima->rr) {
|
|
|
|
|
RE_FreeRenderResult(ima->rr);
|
|
|
|
|
ima->rr= NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free_realtime_image(ima);
|
|
|
|
|
|
|
|
|
|
ima->ok= IMA_OK;
|
2006-06-05 11:07:15 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* called by library too, do not free ima itself */
|
2002-10-12 11:37:38 +00:00
|
|
|
void free_image(Image *ima)
|
|
|
|
|
{
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
image_free_buffers(ima);
|
2002-10-12 11:37:38 +00:00
|
|
|
if (ima->packedfile) {
|
|
|
|
|
freePackedFile(ima->packedfile);
|
|
|
|
|
ima->packedfile = NULL;
|
|
|
|
|
}
|
2005-12-21 23:39:20 +00:00
|
|
|
BKE_icon_delete(&ima->id);
|
2005-12-21 22:21:43 +00:00
|
|
|
ima->id.icon_id = 0;
|
2007-09-02 17:25:03 +00:00
|
|
|
if (ima->preview) {
|
|
|
|
|
BKE_previewimg_free(&ima->preview);
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* only image block itself */
|
|
|
|
|
static Image *image_alloc(const char *name, short source, short type)
|
|
|
|
|
{
|
|
|
|
|
Image *ima;
|
|
|
|
|
|
|
|
|
|
ima= alloc_libblock(&G.main->image, ID_IM, name);
|
|
|
|
|
if(ima) {
|
|
|
|
|
ima->ok= IMA_OK;
|
|
|
|
|
|
|
|
|
|
ima->xrep= ima->yrep= 1;
|
2007-09-22 17:54:13 +00:00
|
|
|
ima->aspx= ima->aspy= 1.0;
|
2006-12-20 17:57:56 +00:00
|
|
|
ima->gen_x= 256; ima->gen_y= 256;
|
|
|
|
|
ima->gen_type= 1; /* no defines yet? */
|
|
|
|
|
|
|
|
|
|
ima->source= source;
|
|
|
|
|
ima->type= type;
|
|
|
|
|
}
|
|
|
|
|
return ima;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* get the ibuf from an image cache, local use here only */
|
|
|
|
|
static ImBuf *image_get_ibuf(Image *ima, int index, int frame)
|
|
|
|
|
{
|
|
|
|
|
if(index==IMA_NO_INDEX)
|
|
|
|
|
return ima->ibufs.first;
|
|
|
|
|
else {
|
|
|
|
|
ImBuf *ibuf;
|
|
|
|
|
|
|
|
|
|
index= IMA_MAKE_INDEX(frame, index);
|
|
|
|
|
for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next)
|
|
|
|
|
if(ibuf->index==index)
|
|
|
|
|
return ibuf;
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* no ima->ibuf anymore, but listbase */
|
|
|
|
|
static void image_remove_ibuf(Image *ima, ImBuf *ibuf)
|
|
|
|
|
{
|
|
|
|
|
if(ibuf) {
|
|
|
|
|
BLI_remlink(&ima->ibufs, ibuf);
|
|
|
|
|
IMB_freeImBuf(ibuf);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* no ima->ibuf anymore, but listbase */
|
|
|
|
|
static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int frame)
|
|
|
|
|
{
|
|
|
|
|
if(ibuf) {
|
|
|
|
|
ImBuf *link;
|
|
|
|
|
|
|
|
|
|
if(index!=IMA_NO_INDEX)
|
|
|
|
|
index= IMA_MAKE_INDEX(frame, index);
|
|
|
|
|
|
|
|
|
|
/* insert based on index */
|
|
|
|
|
for(link= ima->ibufs.first; link; link= link->next)
|
|
|
|
|
if(link->index>=index)
|
|
|
|
|
break;
|
|
|
|
|
/* now we don't want copies? */
|
|
|
|
|
if(link && ibuf->index==link->index) {
|
|
|
|
|
ImBuf *prev= ibuf->prev;
|
|
|
|
|
image_remove_ibuf(ima, link);
|
|
|
|
|
link= prev;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* this function accepts link==NULL */
|
|
|
|
|
BLI_insertlinkbefore(&ima->ibufs, link, ibuf);
|
|
|
|
|
|
|
|
|
|
ibuf->index= index;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* checks if image was already loaded, then returns same image */
|
|
|
|
|
/* otherwise creates new. */
|
|
|
|
|
/* does not load ibuf itself */
|
|
|
|
|
Image *BKE_add_image_file(const char *name)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
Image *ima;
|
|
|
|
|
int file, len;
|
2006-12-20 17:57:56 +00:00
|
|
|
const char *libname;
|
|
|
|
|
char str[FILE_MAX], strtest[FILE_MAX];
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2007-03-29 12:42:30 +00:00
|
|
|
/* escape when name is directory */
|
|
|
|
|
len= strlen(name);
|
|
|
|
|
if(len) {
|
|
|
|
|
if(name[len-1]=='/' || name[len-1]=='\\')
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
BLI_strncpy(str, name, sizeof(str));
|
2002-10-12 11:37:38 +00:00
|
|
|
BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
|
|
|
|
|
|
2007-03-29 12:42:30 +00:00
|
|
|
/* exists? */
|
2002-10-12 11:37:38 +00:00
|
|
|
file= open(str, O_BINARY|O_RDONLY);
|
2007-03-29 12:42:30 +00:00
|
|
|
if(file== -1) return NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
close(file);
|
|
|
|
|
|
2003-04-26 11:56:44 +00:00
|
|
|
/* first search an identical image */
|
2006-12-20 17:57:56 +00:00
|
|
|
for(ima= G.main->image.first; ima; ima= ima->id.next) {
|
2007-11-10 19:56:06 +00:00
|
|
|
if(ima->source!=IMA_SRC_VIEWER && ima->source!=IMA_SRC_GENERATED) {
|
2006-12-20 17:57:56 +00:00
|
|
|
BLI_strncpy(strtest, ima->name, sizeof(ima->name));
|
|
|
|
|
BLI_convertstringcode(strtest, G.sce, G.scene->r.cfra);
|
|
|
|
|
|
|
|
|
|
if( strcmp(strtest, str)==0 ) {
|
|
|
|
|
if(ima->anim==NULL || ima->id.us==0) {
|
|
|
|
|
BLI_strncpy(ima->name, name, sizeof(ima->name)); /* for stringcode */
|
|
|
|
|
ima->id.us++; /* officially should not, it doesn't link here! */
|
|
|
|
|
if(ima->ok==0)
|
|
|
|
|
ima->ok= IMA_OK;
|
|
|
|
|
/* RETURN! */
|
|
|
|
|
return ima;
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
/* add new image */
|
|
|
|
|
|
|
|
|
|
/* create a short library name */
|
2002-10-12 11:37:38 +00:00
|
|
|
len= strlen(name);
|
|
|
|
|
|
|
|
|
|
while (len > 0 && name[len - 1] != '/' && name[len - 1] != '\\') len--;
|
|
|
|
|
libname= name+len;
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
ima= image_alloc(libname, IMA_SRC_FILE, IMA_TYPE_IMAGE);
|
|
|
|
|
BLI_strncpy(ima->name, name, sizeof(ima->name));
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* do a wild guess! */
|
|
|
|
|
if(BLI_testextensie(name, ".avi") || BLI_testextensie(name, ".mov")
|
|
|
|
|
|| BLI_testextensie(name, ".mpg") || BLI_testextensie(name, ".mp4"))
|
|
|
|
|
ima->source= IMA_SRC_MOVIE;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
return ima;
|
|
|
|
|
}
|
|
|
|
|
|
2007-05-03 15:10:44 +00:00
|
|
|
static ImBuf *add_ibuf_size(int width, int height, char *name, short uvtestgrid, float color[4])
|
2005-09-16 20:17:09 +00:00
|
|
|
{
|
2006-12-20 17:57:56 +00:00
|
|
|
ImBuf *ibuf;
|
|
|
|
|
float h=0.0, hoffs=0.0, hue=0.0, s=0.9, v=0.9, r, g, b;
|
|
|
|
|
unsigned char *rect;
|
|
|
|
|
int x, y;
|
|
|
|
|
int checkerwidth=21, dark=1;
|
2006-11-01 12:54:29 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
ibuf= IMB_allocImBuf(width, height, 24, IB_rect, 0);
|
|
|
|
|
strcpy(ibuf->name, "Untitled");
|
|
|
|
|
ibuf->userflags |= IB_BITMAPDIRTY;
|
|
|
|
|
|
|
|
|
|
rect= (unsigned char*)ibuf->rect;
|
|
|
|
|
|
|
|
|
|
if (uvtestgrid) {
|
|
|
|
|
/* these two passes could be combined into one, but it's more readable and
|
|
|
|
|
* easy to tweak like this, speed isn't really that much of an issue in this situation... */
|
2005-11-27 16:21:25 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* checkers */
|
|
|
|
|
for(y=0; y<ibuf->y; y++) {
|
|
|
|
|
dark = pow(-1, floor(y / checkerwidth));
|
|
|
|
|
|
|
|
|
|
for(x=0; x<ibuf->x; x++, rect+=4) {
|
|
|
|
|
if (x % checkerwidth == 0) dark *= -1;
|
2006-09-25 03:15:58 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if (dark > 0) {
|
|
|
|
|
rect[0] = rect[1] = rect[2] = 64;
|
|
|
|
|
rect[3] = 255;
|
|
|
|
|
} else {
|
|
|
|
|
rect[0] = rect[1] = rect[2] = 150;
|
|
|
|
|
rect[3] = 255;
|
2006-09-25 03:15:58 +00:00
|
|
|
}
|
|
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
|
|
|
|
|
2007-04-04 13:18:41 +00:00
|
|
|
/* 2nd pass, colored + */
|
2006-12-20 17:57:56 +00:00
|
|
|
rect= (unsigned char*)ibuf->rect;
|
|
|
|
|
|
|
|
|
|
for(y=0; y<ibuf->y; y++) {
|
|
|
|
|
hoffs = 0.125 * floor(y / checkerwidth);
|
2006-09-25 03:15:58 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
for(x=0; x<ibuf->x; x++, rect+=4) {
|
|
|
|
|
h = 0.125 * floor(x / checkerwidth);
|
2005-11-27 16:21:25 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if ((fabs((x % checkerwidth) - (checkerwidth / 2)) < 4) &&
|
|
|
|
|
(fabs((y % checkerwidth) - (checkerwidth / 2)) < 4)) {
|
|
|
|
|
|
|
|
|
|
if ((fabs((x % checkerwidth) - (checkerwidth / 2)) < 1) ||
|
|
|
|
|
(fabs((y % checkerwidth) - (checkerwidth / 2)) < 1)) {
|
2006-09-25 03:15:58 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
hue = fmod(fabs(h-hoffs), 1.0);
|
|
|
|
|
hsv_to_rgb(hue, s, v, &r, &g, &b);
|
2006-09-25 03:15:58 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
rect[0]= (char)(r * 255.0);
|
|
|
|
|
rect[1]= (char)(g * 255.0);
|
|
|
|
|
rect[2]= (char)(b * 255.0);
|
|
|
|
|
rect[3]= 255;
|
2006-09-25 03:15:58 +00:00
|
|
|
}
|
2005-11-27 16:21:25 +00:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
|
2005-11-27 16:21:25 +00:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
|
|
|
|
} else { /* blank image */
|
|
|
|
|
for(y=0; y<ibuf->y; y++) {
|
|
|
|
|
for(x=0; x<ibuf->x; x++, rect+=4) {
|
2007-05-03 15:10:44 +00:00
|
|
|
rect[0]= (char)(color[0] * 255.0);
|
|
|
|
|
rect[1]= (char)(color[1] * 255.0);
|
|
|
|
|
rect[2]= (char)(color[2] * 255.0);
|
|
|
|
|
rect[3]= (char)(color[3] * 255.0);
|
2005-09-16 20:17:09 +00:00
|
|
|
}
|
|
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
|
|
|
|
return ibuf;
|
|
|
|
|
}
|
2005-09-16 20:17:09 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* adds new image block, creates ImBuf and initializes color */
|
2007-05-03 15:10:44 +00:00
|
|
|
Image *BKE_add_image_size(int width, int height, char *name, short uvtestgrid, float color[4])
|
2006-12-20 17:57:56 +00:00
|
|
|
{
|
|
|
|
|
Image *ima;
|
|
|
|
|
|
|
|
|
|
/* on save, type is changed to FILE in editsima.c */
|
|
|
|
|
ima= image_alloc(name, IMA_SRC_GENERATED, IMA_TYPE_UV_TEST);
|
|
|
|
|
|
|
|
|
|
if (ima) {
|
|
|
|
|
ImBuf *ibuf;
|
|
|
|
|
|
|
|
|
|
BLI_strncpy(ima->name, name, FILE_MAX);
|
|
|
|
|
ima->gen_x= width;
|
|
|
|
|
ima->gen_y= height;
|
|
|
|
|
ima->gen_type= uvtestgrid;
|
|
|
|
|
|
2007-05-03 15:10:44 +00:00
|
|
|
ibuf= add_ibuf_size(width, height, name, uvtestgrid, color);
|
2006-12-20 17:57:56 +00:00
|
|
|
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
|
|
|
|
|
|
|
|
|
|
ima->ok= IMA_OK_LOADED;
|
2005-09-16 20:17:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ima;
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* packs rect from memory as PNG */
|
|
|
|
|
void BKE_image_memorypack(Image *ima)
|
|
|
|
|
{
|
|
|
|
|
ImBuf *ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
|
|
|
|
|
|
|
|
|
|
if(ibuf==NULL)
|
|
|
|
|
return;
|
|
|
|
|
if (ima->packedfile) {
|
|
|
|
|
freePackedFile(ima->packedfile);
|
|
|
|
|
ima->packedfile = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ibuf->ftype= PNG;
|
|
|
|
|
ibuf->depth= 32;
|
|
|
|
|
|
|
|
|
|
IMB_saveiff(ibuf, ibuf->name, IB_rect | IB_mem);
|
|
|
|
|
if(ibuf->encodedbuffer==NULL) {
|
|
|
|
|
printf("memory save for pack error\n");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
PackedFile *pf = MEM_callocN(sizeof(*pf), "PackedFile");
|
|
|
|
|
|
|
|
|
|
pf->data = ibuf->encodedbuffer;
|
|
|
|
|
pf->size = ibuf->encodedsize;
|
|
|
|
|
ima->packedfile= pf;
|
|
|
|
|
ibuf->encodedbuffer= NULL;
|
|
|
|
|
ibuf->encodedsize= 0;
|
|
|
|
|
ibuf->userflags &= ~IB_BITMAPDIRTY;
|
|
|
|
|
|
2006-12-21 13:39:02 +00:00
|
|
|
if(ima->source==IMA_SRC_GENERATED) {
|
2006-12-20 17:57:56 +00:00
|
|
|
ima->source= IMA_SRC_FILE;
|
2006-12-21 13:39:02 +00:00
|
|
|
ima->type= IMA_TYPE_IMAGE;
|
|
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
void tag_image_time(Image *ima)
|
|
|
|
|
{
|
|
|
|
|
if (ima)
|
2005-07-27 07:43:48 +00:00
|
|
|
ima->lastused = (int)PIL_check_seconds_timer();
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
}
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
void tag_all_images_time()
|
|
|
|
|
{
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
Image *ima;
|
2005-07-27 07:43:48 +00:00
|
|
|
int ctime = (int)PIL_check_seconds_timer();
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
|
|
|
|
|
ima= G.main->image.first;
|
|
|
|
|
while(ima) {
|
2006-12-20 17:57:56 +00:00
|
|
|
if(ima->bindcode || ima->repbind || ima->ibufs.first) {
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
ima->lastused = ctime;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void free_old_images()
|
|
|
|
|
{
|
|
|
|
|
Image *ima;
|
2005-07-27 07:43:48 +00:00
|
|
|
static int lasttime = 0;
|
|
|
|
|
int ctime = (int)PIL_check_seconds_timer();
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Run garbage collector once for every collecting period of time
|
|
|
|
|
if textimeout is 0, that's the option to NOT run the collector
|
|
|
|
|
*/
|
|
|
|
|
if (U.textimeout == 0 || ctime % U.texcollectrate || ctime == lasttime)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
lasttime = ctime;
|
|
|
|
|
|
|
|
|
|
ima= G.main->image.first;
|
|
|
|
|
while(ima) {
|
2005-07-27 06:21:50 +00:00
|
|
|
if((ima->flag & IMA_NOCOLLECT)==0 && ctime - ima->lastused > U.textimeout) {
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
/*
|
|
|
|
|
If it's in GL memory, deallocate and set time tag to current time
|
|
|
|
|
This gives textures a "second chance" to be used before dying.
|
|
|
|
|
*/
|
|
|
|
|
if(ima->bindcode || ima->repbind) {
|
|
|
|
|
free_realtime_image(ima);
|
|
|
|
|
ima->lastused = ctime;
|
|
|
|
|
}
|
|
|
|
|
/* Otherwise, just kill the buffers */
|
2006-12-20 17:57:56 +00:00
|
|
|
else if (ima->ibufs.first) {
|
|
|
|
|
image_free_buffers(ima);
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ima = ima->id.next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
void BKE_image_free_all_textures(void)
|
2006-02-11 23:17:41 +00:00
|
|
|
{
|
|
|
|
|
Tex *tex;
|
|
|
|
|
Image *ima;
|
|
|
|
|
unsigned int totsize= 0;
|
|
|
|
|
|
|
|
|
|
for(ima= G.main->image.first; ima; ima= ima->id.next)
|
|
|
|
|
ima->id.flag &= ~LIB_DOIT;
|
|
|
|
|
|
|
|
|
|
for(tex= G.main->tex.first; tex; tex= tex->id.next)
|
|
|
|
|
if(tex->ima)
|
|
|
|
|
tex->ima->id.flag |= LIB_DOIT;
|
|
|
|
|
|
|
|
|
|
for(ima= G.main->image.first; ima; ima= ima->id.next) {
|
2006-12-20 17:57:56 +00:00
|
|
|
if(ima->ibufs.first && (ima->id.flag & LIB_DOIT)) {
|
|
|
|
|
ImBuf *ibuf;
|
|
|
|
|
for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next) {
|
|
|
|
|
if(ibuf->mipmap[0])
|
|
|
|
|
totsize+= 1.33*ibuf->x*ibuf->y*4;
|
|
|
|
|
else
|
|
|
|
|
totsize+= ibuf->x*ibuf->y*4;
|
|
|
|
|
}
|
|
|
|
|
image_free_buffers(ima);
|
2006-02-11 23:17:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
/* printf("freed total %d MB\n", totsize/(1024*1024)); */
|
2006-02-11 23:17:41 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* except_frame is weak, only works for seqs without offset... */
|
|
|
|
|
void BKE_image_free_anim_ibufs(Image *ima, int except_frame)
|
|
|
|
|
{
|
|
|
|
|
ImBuf *ibuf, *nbuf;
|
|
|
|
|
|
|
|
|
|
for(ibuf= ima->ibufs.first; ibuf; ibuf= nbuf) {
|
|
|
|
|
nbuf= ibuf->next;
|
|
|
|
|
if(ibuf->userflags & IB_BITMAPDIRTY)
|
|
|
|
|
continue;
|
|
|
|
|
if(ibuf->index==IMA_NO_INDEX)
|
|
|
|
|
continue;
|
|
|
|
|
if(except_frame!=IMA_INDEX_FRAME(ibuf->index)) {
|
|
|
|
|
BLI_remlink(&ima->ibufs, ibuf);
|
|
|
|
|
|
|
|
|
|
if (ibuf->userdata) {
|
|
|
|
|
MEM_freeN(ibuf->userdata);
|
|
|
|
|
ibuf->userdata = NULL;
|
|
|
|
|
}
|
|
|
|
|
IMB_freeImBuf(ibuf);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_image_all_free_anim_ibufs(int cfra)
|
|
|
|
|
{
|
|
|
|
|
Image *ima;
|
|
|
|
|
|
|
|
|
|
for(ima= G.main->image.first; ima; ima= ima->id.next)
|
|
|
|
|
if(ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
|
|
|
|
|
BKE_image_free_anim_ibufs(ima, cfra);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-04-26 11:56:44 +00:00
|
|
|
/* *********** READ AND WRITE ************** */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
int BKE_imtype_to_ftype(int imtype)
|
|
|
|
|
{
|
|
|
|
|
if(imtype==0)
|
|
|
|
|
return TGA;
|
|
|
|
|
else if(imtype== R_IRIS)
|
|
|
|
|
return IMAGIC;
|
|
|
|
|
else if (imtype==R_RADHDR)
|
|
|
|
|
return RADHDR;
|
|
|
|
|
else if (imtype==R_PNG)
|
|
|
|
|
return PNG;
|
2007-06-25 19:50:25 +00:00
|
|
|
#ifdef WITH_DDS
|
|
|
|
|
else if (imtype==R_DDS)
|
|
|
|
|
return DDS;
|
|
|
|
|
#endif
|
2006-12-20 17:57:56 +00:00
|
|
|
else if (imtype==R_BMP)
|
|
|
|
|
return BMP;
|
|
|
|
|
else if (imtype==R_TIFF)
|
|
|
|
|
return TIF;
|
|
|
|
|
else if (imtype==R_OPENEXR || imtype==R_MULTILAYER)
|
|
|
|
|
return OPENEXR;
|
|
|
|
|
else if (imtype==R_CINEON)
|
|
|
|
|
return CINEON;
|
|
|
|
|
else if (imtype==R_DPX)
|
|
|
|
|
return DPX;
|
|
|
|
|
else if (imtype==R_TARGA)
|
|
|
|
|
return TGA;
|
|
|
|
|
else if(imtype==R_RAWTGA)
|
|
|
|
|
return RAWTGA;
|
|
|
|
|
else if(imtype==R_HAMX)
|
|
|
|
|
return AN_hamx;
|
|
|
|
|
else
|
|
|
|
|
return JPG|90;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int BKE_ftype_to_imtype(int ftype)
|
|
|
|
|
{
|
|
|
|
|
if(ftype==0)
|
|
|
|
|
return TGA;
|
|
|
|
|
else if(ftype == IMAGIC)
|
|
|
|
|
return R_IRIS;
|
|
|
|
|
else if (ftype & RADHDR)
|
|
|
|
|
return R_RADHDR;
|
|
|
|
|
else if (ftype & PNG)
|
|
|
|
|
return R_PNG;
|
2007-06-25 19:50:25 +00:00
|
|
|
#ifdef WITH_DDS
|
|
|
|
|
else if (ftype & DDS)
|
|
|
|
|
return R_DDS;
|
|
|
|
|
#endif
|
2006-12-20 17:57:56 +00:00
|
|
|
else if (ftype & BMP)
|
|
|
|
|
return R_BMP;
|
|
|
|
|
else if (ftype & TIF)
|
|
|
|
|
return R_TIFF;
|
|
|
|
|
else if (ftype & OPENEXR)
|
|
|
|
|
return R_OPENEXR;
|
|
|
|
|
else if (ftype & CINEON)
|
|
|
|
|
return R_CINEON;
|
|
|
|
|
else if (ftype & DPX)
|
|
|
|
|
return R_DPX;
|
|
|
|
|
else if (ftype & TGA)
|
|
|
|
|
return R_TARGA;
|
|
|
|
|
else if(ftype & RAWTGA)
|
|
|
|
|
return R_RAWTGA;
|
|
|
|
|
else if(ftype == AN_hamx)
|
|
|
|
|
return R_HAMX;
|
|
|
|
|
else
|
|
|
|
|
return R_JPEG90;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
int BKE_imtype_is_movie(int imtype)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
switch(imtype) {
|
2006-02-05 19:12:25 +00:00
|
|
|
case R_MOVIE:
|
|
|
|
|
case R_AVIRAW:
|
|
|
|
|
case R_AVIJPEG:
|
|
|
|
|
case R_AVICODEC:
|
|
|
|
|
case R_QUICKTIME:
|
|
|
|
|
case R_FFMPEG:
|
|
|
|
|
case R_FRAMESERVER:
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
return 1;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
return 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
void BKE_add_image_extension(char *string, int imtype)
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
{
|
2005-07-17 08:58:42 +00:00
|
|
|
char *extension="";
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
if(G.scene->r.imtype== R_IRIS) {
|
2005-11-20 14:32:07 +00:00
|
|
|
if(!BLI_testextensie(string, ".rgb"))
|
|
|
|
|
extension= ".rgb";
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
}
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
else if(imtype==R_IRIZ) {
|
2005-11-20 14:32:07 +00:00
|
|
|
if(!BLI_testextensie(string, ".rgb"))
|
|
|
|
|
extension= ".rgb";
|
|
|
|
|
}
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
else if(imtype==R_RADHDR) {
|
2005-11-20 14:32:07 +00:00
|
|
|
if(!BLI_testextensie(string, ".hdr"))
|
|
|
|
|
extension= ".hdr";
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
}
|
2007-12-04 05:53:32 +00:00
|
|
|
else if(imtype==R_PNG || imtype==R_FFMPEG) {
|
2005-11-20 14:32:07 +00:00
|
|
|
if(!BLI_testextensie(string, ".png"))
|
|
|
|
|
extension= ".png";
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
}
|
2007-06-25 19:50:25 +00:00
|
|
|
#ifdef WITH_DDS
|
|
|
|
|
else if(imtype==R_DDS) {
|
|
|
|
|
if(!BLI_testextensie(string, ".dds"))
|
|
|
|
|
extension= ".dds";
|
|
|
|
|
}
|
|
|
|
|
#endif
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
else if(imtype==R_RAWTGA) {
|
2005-11-20 14:32:07 +00:00
|
|
|
if(!BLI_testextensie(string, ".tga"))
|
|
|
|
|
extension= ".tga";
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
}
|
2007-12-04 05:53:32 +00:00
|
|
|
else if(ELEM5(imtype, R_MOVIE, R_AVICODEC, R_AVIRAW, R_AVIJPEG, R_JPEG90)) {
|
2007-12-03 23:37:33 +00:00
|
|
|
if(!( BLI_testextensie(string, ".jpg") || BLI_testextensie(string, ".jpeg")))
|
2005-11-20 14:32:07 +00:00
|
|
|
extension= ".jpg";
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
}
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
else if(imtype==R_BMP) {
|
2005-11-20 14:32:07 +00:00
|
|
|
if(!BLI_testextensie(string, ".bmp"))
|
|
|
|
|
extension= ".bmp";
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
}
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
else if(G.have_libtiff && (imtype==R_TIFF)) {
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 00:40:35 +00:00
|
|
|
if(!BLI_testextensie(string, ".tif"))
|
|
|
|
|
extension= ".tif";
|
2005-11-22 18:50:03 +00:00
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 00:40:35 +00:00
|
|
|
#ifdef WITH_OPENEXR
|
2006-12-20 17:57:56 +00:00
|
|
|
else if( ELEM(imtype, R_OPENEXR, R_MULTILAYER)) {
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 00:40:35 +00:00
|
|
|
if(!BLI_testextensie(string, ".exr"))
|
|
|
|
|
extension= ".exr";
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2006-03-12 14:11:23 +00:00
|
|
|
else if(imtype==R_CINEON){
|
|
|
|
|
if (!BLI_testextensie(string, ".cin"))
|
|
|
|
|
extension= ".cin";
|
|
|
|
|
}
|
|
|
|
|
else if(imtype==R_DPX){
|
|
|
|
|
if (!BLI_testextensie(string, ".dpx"))
|
|
|
|
|
extension= ".dpx";
|
|
|
|
|
}
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
else { /* targa default */
|
|
|
|
|
if(!BLI_testextensie(string, ".tga"))
|
|
|
|
|
extension= ".tga";
|
|
|
|
|
}
|
|
|
|
|
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
strcat(string, extension);
|
|
|
|
|
}
|
|
|
|
|
|
2007-11-08 13:02:59 +00:00
|
|
|
/* could allow access externally - 512 is for long names, 64 is for id names */
|
2007-10-28 22:27:07 +00:00
|
|
|
typedef struct StampData {
|
|
|
|
|
char file[512];
|
|
|
|
|
char note[512];
|
|
|
|
|
char date[512];
|
|
|
|
|
char marker[512];
|
|
|
|
|
char time[512];
|
|
|
|
|
char frame[512];
|
2007-11-08 13:02:59 +00:00
|
|
|
char camera[64];
|
|
|
|
|
char scene[64];
|
|
|
|
|
char strip[64];
|
2007-10-28 22:27:07 +00:00
|
|
|
} StampData;
|
|
|
|
|
|
|
|
|
|
static void stampdata(StampData *stamp_data, int do_prefix)
|
2007-10-20 16:17:27 +00:00
|
|
|
{
|
2007-10-28 22:27:07 +00:00
|
|
|
char text[256];
|
2007-10-20 16:17:27 +00:00
|
|
|
|
|
|
|
|
#ifndef WIN32
|
|
|
|
|
struct tm *tl;
|
|
|
|
|
time_t t;
|
|
|
|
|
#else
|
|
|
|
|
char sdate[9];
|
|
|
|
|
#endif /* WIN32 */
|
|
|
|
|
|
2007-11-08 13:02:59 +00:00
|
|
|
if (G.scene->r.stamp & R_STAMP_FILENAME) {
|
|
|
|
|
if (do_prefix) sprintf(stamp_data->file, "File %s", G.sce);
|
|
|
|
|
else sprintf(stamp_data->file, "%s", G.sce);
|
|
|
|
|
stamp_data->note[0] = '\0';
|
|
|
|
|
} else {
|
|
|
|
|
stamp_data->file[0] = '\0';
|
|
|
|
|
}
|
2007-10-20 16:17:27 +00:00
|
|
|
|
Patch by GSR #7628, I also added alpha for text background.
The list of changes (some are fixes):
- Properly horizontally centered tags in all fields (bug?).
- File area does not have trailing space and has leading "File " at
start instead (probably a bug).
- Small separation between to time related fields, space saving.
- Removed colons, for consistency and space saving again.
- Frame field is zero aligned for higher visual stability.
- Marker name shows a rarer name, "<none>" (using <> is typical for cases
in which there is nothing: <none>, <empty>, <blank>, etc).
- Top area for misc info that can be really long (file, note and render date).
- Bottom area for more constantly changing but short ones (marker, SMPTE,
frame, camera and scene).
- Only render date moves a line (when note field is not used), and frame one
moves if no SMPTE (still in same line, so no big jump), for extra visual
stability (marker is fixed, assuming most people would show frame and or
SMPTE).
- ISO 8601 date format for render date, localization independant.
Comparision images:
http://www.infernal-iceberg.com/blender/stamp-original.png
http://www.infernal-iceberg.com/blender/stamp-cleanup.png
2007-10-23 22:51:50 +00:00
|
|
|
if (G.scene->r.stamp & R_STAMP_NOTE) {
|
2007-12-24 18:38:03 +00:00
|
|
|
/* Never do prefix for Note */
|
|
|
|
|
sprintf(stamp_data->note, "%s", G.scene->r.stamp_udata);
|
2007-10-28 22:27:07 +00:00
|
|
|
} else {
|
|
|
|
|
stamp_data->note[0] = '\0';
|
Patch by GSR #7628, I also added alpha for text background.
The list of changes (some are fixes):
- Properly horizontally centered tags in all fields (bug?).
- File area does not have trailing space and has leading "File " at
start instead (probably a bug).
- Small separation between to time related fields, space saving.
- Removed colons, for consistency and space saving again.
- Frame field is zero aligned for higher visual stability.
- Marker name shows a rarer name, "<none>" (using <> is typical for cases
in which there is nothing: <none>, <empty>, <blank>, etc).
- Top area for misc info that can be really long (file, note and render date).
- Bottom area for more constantly changing but short ones (marker, SMPTE,
frame, camera and scene).
- Only render date moves a line (when note field is not used), and frame one
moves if no SMPTE (still in same line, so no big jump), for extra visual
stability (marker is fixed, assuming most people would show frame and or
SMPTE).
- ISO 8601 date format for render date, localization independant.
Comparision images:
http://www.infernal-iceberg.com/blender/stamp-original.png
http://www.infernal-iceberg.com/blender/stamp-cleanup.png
2007-10-23 22:51:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (G.scene->r.stamp & R_STAMP_DATE) {
|
|
|
|
|
#ifdef WIN32
|
|
|
|
|
_strdate (sdate);
|
2007-10-28 22:27:07 +00:00
|
|
|
sprintf (text, "%s", sdate);
|
Patch by GSR #7628, I also added alpha for text background.
The list of changes (some are fixes):
- Properly horizontally centered tags in all fields (bug?).
- File area does not have trailing space and has leading "File " at
start instead (probably a bug).
- Small separation between to time related fields, space saving.
- Removed colons, for consistency and space saving again.
- Frame field is zero aligned for higher visual stability.
- Marker name shows a rarer name, "<none>" (using <> is typical for cases
in which there is nothing: <none>, <empty>, <blank>, etc).
- Top area for misc info that can be really long (file, note and render date).
- Bottom area for more constantly changing but short ones (marker, SMPTE,
frame, camera and scene).
- Only render date moves a line (when note field is not used), and frame one
moves if no SMPTE (still in same line, so no big jump), for extra visual
stability (marker is fixed, assuming most people would show frame and or
SMPTE).
- ISO 8601 date format for render date, localization independant.
Comparision images:
http://www.infernal-iceberg.com/blender/stamp-original.png
http://www.infernal-iceberg.com/blender/stamp-cleanup.png
2007-10-23 22:51:50 +00:00
|
|
|
#else
|
|
|
|
|
t = time (NULL);
|
|
|
|
|
tl = localtime (&t);
|
2007-10-28 22:27:07 +00:00
|
|
|
sprintf (text, "%04d-%02d-%02d", tl->tm_year+1900, tl->tm_mon+1, tl->tm_mday);
|
Patch by GSR #7628, I also added alpha for text background.
The list of changes (some are fixes):
- Properly horizontally centered tags in all fields (bug?).
- File area does not have trailing space and has leading "File " at
start instead (probably a bug).
- Small separation between to time related fields, space saving.
- Removed colons, for consistency and space saving again.
- Frame field is zero aligned for higher visual stability.
- Marker name shows a rarer name, "<none>" (using <> is typical for cases
in which there is nothing: <none>, <empty>, <blank>, etc).
- Top area for misc info that can be really long (file, note and render date).
- Bottom area for more constantly changing but short ones (marker, SMPTE,
frame, camera and scene).
- Only render date moves a line (when note field is not used), and frame one
moves if no SMPTE (still in same line, so no big jump), for extra visual
stability (marker is fixed, assuming most people would show frame and or
SMPTE).
- ISO 8601 date format for render date, localization independant.
Comparision images:
http://www.infernal-iceberg.com/blender/stamp-original.png
http://www.infernal-iceberg.com/blender/stamp-cleanup.png
2007-10-23 22:51:50 +00:00
|
|
|
#endif /* WIN32 */
|
2007-10-28 22:27:07 +00:00
|
|
|
if (do_prefix) sprintf(stamp_data->date, "Date %s", text);
|
|
|
|
|
else sprintf(stamp_data->date, "%s", text);
|
|
|
|
|
} else {
|
|
|
|
|
stamp_data->date[0] = '\0';
|
Patch by GSR #7628, I also added alpha for text background.
The list of changes (some are fixes):
- Properly horizontally centered tags in all fields (bug?).
- File area does not have trailing space and has leading "File " at
start instead (probably a bug).
- Small separation between to time related fields, space saving.
- Removed colons, for consistency and space saving again.
- Frame field is zero aligned for higher visual stability.
- Marker name shows a rarer name, "<none>" (using <> is typical for cases
in which there is nothing: <none>, <empty>, <blank>, etc).
- Top area for misc info that can be really long (file, note and render date).
- Bottom area for more constantly changing but short ones (marker, SMPTE,
frame, camera and scene).
- Only render date moves a line (when note field is not used), and frame one
moves if no SMPTE (still in same line, so no big jump), for extra visual
stability (marker is fixed, assuming most people would show frame and or
SMPTE).
- ISO 8601 date format for render date, localization independant.
Comparision images:
http://www.infernal-iceberg.com/blender/stamp-original.png
http://www.infernal-iceberg.com/blender/stamp-cleanup.png
2007-10-23 22:51:50 +00:00
|
|
|
}
|
2007-10-28 22:27:07 +00:00
|
|
|
|
Patch by GSR #7628, I also added alpha for text background.
The list of changes (some are fixes):
- Properly horizontally centered tags in all fields (bug?).
- File area does not have trailing space and has leading "File " at
start instead (probably a bug).
- Small separation between to time related fields, space saving.
- Removed colons, for consistency and space saving again.
- Frame field is zero aligned for higher visual stability.
- Marker name shows a rarer name, "<none>" (using <> is typical for cases
in which there is nothing: <none>, <empty>, <blank>, etc).
- Top area for misc info that can be really long (file, note and render date).
- Bottom area for more constantly changing but short ones (marker, SMPTE,
frame, camera and scene).
- Only render date moves a line (when note field is not used), and frame one
moves if no SMPTE (still in same line, so no big jump), for extra visual
stability (marker is fixed, assuming most people would show frame and or
SMPTE).
- ISO 8601 date format for render date, localization independant.
Comparision images:
http://www.infernal-iceberg.com/blender/stamp-original.png
http://www.infernal-iceberg.com/blender/stamp-cleanup.png
2007-10-23 22:51:50 +00:00
|
|
|
if (G.scene->r.stamp & R_STAMP_MARKER) {
|
2007-12-29 16:12:35 +00:00
|
|
|
TimeMarker *marker = NULL; // XXX get_frame_marker(G.scene->r.cfra);
|
2007-10-28 22:27:07 +00:00
|
|
|
|
|
|
|
|
if (marker) strcpy(text, marker->name);
|
|
|
|
|
else strcpy(text, "<none>");
|
Patch by GSR #7628, I also added alpha for text background.
The list of changes (some are fixes):
- Properly horizontally centered tags in all fields (bug?).
- File area does not have trailing space and has leading "File " at
start instead (probably a bug).
- Small separation between to time related fields, space saving.
- Removed colons, for consistency and space saving again.
- Frame field is zero aligned for higher visual stability.
- Marker name shows a rarer name, "<none>" (using <> is typical for cases
in which there is nothing: <none>, <empty>, <blank>, etc).
- Top area for misc info that can be really long (file, note and render date).
- Bottom area for more constantly changing but short ones (marker, SMPTE,
frame, camera and scene).
- Only render date moves a line (when note field is not used), and frame one
moves if no SMPTE (still in same line, so no big jump), for extra visual
stability (marker is fixed, assuming most people would show frame and or
SMPTE).
- ISO 8601 date format for render date, localization independant.
Comparision images:
http://www.infernal-iceberg.com/blender/stamp-original.png
http://www.infernal-iceberg.com/blender/stamp-cleanup.png
2007-10-23 22:51:50 +00:00
|
|
|
|
2007-10-28 22:27:07 +00:00
|
|
|
if (do_prefix) sprintf(stamp_data->marker, "Marker %s", text);
|
|
|
|
|
else sprintf(stamp_data->marker, "%s", text);
|
|
|
|
|
} else {
|
|
|
|
|
stamp_data->marker[0] = '\0';
|
Patch by GSR #7628, I also added alpha for text background.
The list of changes (some are fixes):
- Properly horizontally centered tags in all fields (bug?).
- File area does not have trailing space and has leading "File " at
start instead (probably a bug).
- Small separation between to time related fields, space saving.
- Removed colons, for consistency and space saving again.
- Frame field is zero aligned for higher visual stability.
- Marker name shows a rarer name, "<none>" (using <> is typical for cases
in which there is nothing: <none>, <empty>, <blank>, etc).
- Top area for misc info that can be really long (file, note and render date).
- Bottom area for more constantly changing but short ones (marker, SMPTE,
frame, camera and scene).
- Only render date moves a line (when note field is not used), and frame one
moves if no SMPTE (still in same line, so no big jump), for extra visual
stability (marker is fixed, assuming most people would show frame and or
SMPTE).
- ISO 8601 date format for render date, localization independant.
Comparision images:
http://www.infernal-iceberg.com/blender/stamp-original.png
http://www.infernal-iceberg.com/blender/stamp-cleanup.png
2007-10-23 22:51:50 +00:00
|
|
|
}
|
2007-10-28 22:27:07 +00:00
|
|
|
|
2007-10-20 16:17:27 +00:00
|
|
|
if (G.scene->r.stamp & R_STAMP_TIME) {
|
2007-10-28 22:27:07 +00:00
|
|
|
int h, m, s, f;
|
2007-10-20 16:17:27 +00:00
|
|
|
h= m= s= f= 0;
|
|
|
|
|
f = (int)(G.scene->r.cfra % G.scene->r.frs_sec);
|
|
|
|
|
s = (int)(G.scene->r.cfra / G.scene->r.frs_sec);
|
|
|
|
|
|
|
|
|
|
if (s) {
|
|
|
|
|
m = (int)(s / 60);
|
|
|
|
|
s %= 60;
|
|
|
|
|
|
|
|
|
|
if (m) {
|
|
|
|
|
h = (int)(m / 60);
|
|
|
|
|
m %= 60;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (G.scene->r.frs_sec < 100)
|
2007-10-28 22:27:07 +00:00
|
|
|
sprintf (text, "%02d:%02d:%02d.%02d", h, m, s, f);
|
2007-10-20 16:17:27 +00:00
|
|
|
else
|
2007-10-28 22:27:07 +00:00
|
|
|
sprintf (text, "%02d:%02d:%02d.%03d", h, m, s, f);
|
2007-10-20 16:17:27 +00:00
|
|
|
|
2007-10-28 22:27:07 +00:00
|
|
|
if (do_prefix) sprintf(stamp_data->time, "Time %s", text);
|
|
|
|
|
else sprintf(stamp_data->time, "%s", text);
|
|
|
|
|
} else {
|
|
|
|
|
stamp_data->time[0] = '\0';
|
2007-10-20 16:17:27 +00:00
|
|
|
}
|
2007-10-28 22:27:07 +00:00
|
|
|
|
2007-10-20 16:17:27 +00:00
|
|
|
if (G.scene->r.stamp & R_STAMP_FRAME) {
|
2007-10-28 22:27:07 +00:00
|
|
|
char format[32];
|
|
|
|
|
if (do_prefix) sprintf(format, "Frame %%0%di\n", 1 + (int) log10(G.scene->r.efra));
|
|
|
|
|
else sprintf(format, "%%0%di\n", 1 + (int) log10(G.scene->r.efra));
|
|
|
|
|
sprintf (stamp_data->frame, format, G.scene->r.cfra);
|
|
|
|
|
} else {
|
|
|
|
|
stamp_data->frame[0] = '\0';
|
2007-10-20 16:17:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (G.scene->r.stamp & R_STAMP_CAMERA) {
|
2007-10-28 22:27:07 +00:00
|
|
|
if (do_prefix) sprintf(stamp_data->camera, "Camera %s", ((Camera *) G.scene->camera)->id.name+2);
|
|
|
|
|
else sprintf(stamp_data->camera, "%s", ((Camera *) G.scene->camera)->id.name+2);
|
|
|
|
|
} else {
|
|
|
|
|
stamp_data->camera[0] = '\0';
|
2007-10-20 16:17:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (G.scene->r.stamp & R_STAMP_SCENE) {
|
2007-10-30 05:58:25 +00:00
|
|
|
if (do_prefix) sprintf(stamp_data->scene, "Scene %s", G.scene->id.name+2);
|
2007-10-28 22:27:07 +00:00
|
|
|
else sprintf(stamp_data->scene, "%s", G.scene->id.name+2);
|
|
|
|
|
} else {
|
|
|
|
|
stamp_data->scene[0] = '\0';
|
|
|
|
|
}
|
2007-11-08 13:02:59 +00:00
|
|
|
|
|
|
|
|
if (G.scene->r.stamp & R_STAMP_SEQSTRIP) {
|
2007-12-29 16:12:35 +00:00
|
|
|
Sequence *seq = get_forground_frame_seq(G.scene->r.cfra);
|
2007-11-08 13:02:59 +00:00
|
|
|
|
|
|
|
|
if (seq) strcpy(text, seq->name+2);
|
|
|
|
|
else strcpy(text, "<none>");
|
|
|
|
|
|
|
|
|
|
if (do_prefix) sprintf(stamp_data->strip, "Strip %s", text);
|
|
|
|
|
else sprintf(stamp_data->strip, "%s", text);
|
|
|
|
|
} else {
|
|
|
|
|
stamp_data->strip[0] = '\0';
|
|
|
|
|
}
|
2007-10-28 22:27:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_stamp_buf(unsigned char *rect, float *rectf, int width, int height)
|
|
|
|
|
{
|
|
|
|
|
struct StampData stamp_data;
|
|
|
|
|
|
2007-10-29 05:59:26 +00:00
|
|
|
int x=1,y=1;
|
2007-10-28 22:27:07 +00:00
|
|
|
int font_height;
|
|
|
|
|
int text_width;
|
|
|
|
|
int text_pad;
|
|
|
|
|
struct BMF_Font *font;
|
|
|
|
|
|
|
|
|
|
if (!rect && !rectf)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
stampdata(&stamp_data, 1);
|
|
|
|
|
|
|
|
|
|
switch (G.scene->r.stamp_font_id) {
|
|
|
|
|
case 1: /* tiny */
|
|
|
|
|
font = BMF_GetFont(BMF_kHelveticaBold8);
|
|
|
|
|
break;
|
|
|
|
|
case 2: /* small */
|
|
|
|
|
font = BMF_GetFont(BMF_kHelveticaBold10);
|
|
|
|
|
break;
|
|
|
|
|
case 3: /* medium */
|
|
|
|
|
font = BMF_GetFont(BMF_kScreen12);
|
|
|
|
|
break;
|
|
|
|
|
case 0: /* large - default */
|
|
|
|
|
font = BMF_GetFont(BMF_kScreen15);
|
|
|
|
|
break;
|
|
|
|
|
case 4: /* huge */
|
|
|
|
|
font = BMF_GetFont(BMF_kHelveticaBold14);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
font = NULL;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
font_height = BMF_GetFontHeight(font);
|
|
|
|
|
/* All texts get halfspace+1 pixel on each side and 1 pix
|
|
|
|
|
above and below as padding against their backing rectangles */
|
|
|
|
|
text_pad = BMF_GetStringWidth(font, " ");
|
|
|
|
|
|
2007-11-08 13:02:59 +00:00
|
|
|
x = 1; /* Inits for everyone, text position, so 1 for padding, not 0 */
|
|
|
|
|
y = height - font_height - 1; /* Also inits for everyone, notice padding pixel */
|
|
|
|
|
|
2007-10-28 22:27:07 +00:00
|
|
|
if (stamp_data.file[0]) {
|
|
|
|
|
/* Top left corner */
|
|
|
|
|
text_width = BMF_GetStringWidth(font, stamp_data.file);
|
|
|
|
|
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
|
|
|
|
BMF_DrawStringBuf(font, stamp_data.file, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
|
|
|
|
y -= font_height+2; /* Top and bottom 1 pix padding each */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Top left corner, below File */
|
|
|
|
|
if (stamp_data.note[0]) {
|
|
|
|
|
text_width = BMF_GetStringWidth(font, stamp_data.note);
|
|
|
|
|
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
|
|
|
|
BMF_DrawStringBuf(font, stamp_data.note, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
|
|
|
|
y -= font_height+2; /* Top and bottom 1 pix padding each */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Top left corner, below File (or Note) */
|
|
|
|
|
if (stamp_data.date[0]) {
|
|
|
|
|
text_width = BMF_GetStringWidth(font, stamp_data.date);
|
|
|
|
|
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
|
|
|
|
BMF_DrawStringBuf(font, stamp_data.date, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Bottom left corner, leaving space for timing */
|
|
|
|
|
if (stamp_data.marker[0]) {
|
|
|
|
|
x = 1;
|
|
|
|
|
y = font_height+2+1; /* 2 for padding in TIME|FRAME fields below and 1 for padding in this one */
|
|
|
|
|
text_width = BMF_GetStringWidth(font, stamp_data.marker);
|
|
|
|
|
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
|
|
|
|
BMF_DrawStringBuf(font, stamp_data.marker, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Left bottom corner */
|
|
|
|
|
if (stamp_data.time[0]) {
|
|
|
|
|
x = 1;
|
|
|
|
|
y = 1;
|
|
|
|
|
text_width = BMF_GetStringWidth(font, stamp_data.time);
|
|
|
|
|
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
|
|
|
|
BMF_DrawStringBuf(font, stamp_data.time, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
|
|
|
|
x += text_width+text_pad+2; /* Both sides have 1 pix additional padding each */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (stamp_data.frame[0]) {
|
|
|
|
|
text_width = BMF_GetStringWidth(font, stamp_data.frame);
|
|
|
|
|
/* Left bottom corner (after SMPTE if exists) */
|
|
|
|
|
if (!stamp_data.time[0]) x = 1;
|
|
|
|
|
y = 1;
|
|
|
|
|
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
|
|
|
|
BMF_DrawStringBuf(font, stamp_data.frame, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (stamp_data.camera[0]) {
|
|
|
|
|
text_width = BMF_GetStringWidth(font, stamp_data.camera);
|
|
|
|
|
/* Center of bottom edge */
|
|
|
|
|
x = (width/2) - (BMF_GetStringWidth(font, stamp_data.camera)/2);
|
|
|
|
|
y = 1;
|
|
|
|
|
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
|
|
|
|
BMF_DrawStringBuf(font, stamp_data.camera, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (stamp_data.scene[0]) {
|
|
|
|
|
text_width = BMF_GetStringWidth(font, stamp_data.scene);
|
|
|
|
|
/* Bottom right corner */
|
|
|
|
|
x = width - (text_width+1+text_pad);
|
|
|
|
|
y = 1;
|
|
|
|
|
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
|
|
|
|
BMF_DrawStringBuf(font, stamp_data.scene, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
2007-10-20 16:17:27 +00:00
|
|
|
}
|
2007-11-08 13:02:59 +00:00
|
|
|
|
|
|
|
|
if (stamp_data.strip[0]) {
|
|
|
|
|
text_width = BMF_GetStringWidth(font, stamp_data.strip);
|
|
|
|
|
/* Top right corner */
|
|
|
|
|
x = width - (text_width+1+text_pad);
|
|
|
|
|
y = height - font_height - 1;
|
|
|
|
|
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
|
|
|
|
BMF_DrawStringBuf(font, stamp_data.strip, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-20 16:17:27 +00:00
|
|
|
}
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
|
2007-10-28 22:27:07 +00:00
|
|
|
void BKE_stamp_info(struct ImBuf *ibuf)
|
|
|
|
|
{
|
|
|
|
|
struct StampData stamp_data;
|
|
|
|
|
|
|
|
|
|
if (!ibuf) return;
|
|
|
|
|
|
|
|
|
|
/* fill all the data values, no prefix */
|
|
|
|
|
stampdata(&stamp_data, 0);
|
|
|
|
|
|
|
|
|
|
if (stamp_data.file[0]) IMB_imginfo_change_field (ibuf, "File", stamp_data.file);
|
|
|
|
|
if (stamp_data.note[0]) IMB_imginfo_change_field (ibuf, "Note", stamp_data.note);
|
|
|
|
|
if (stamp_data.date[0]) IMB_imginfo_change_field (ibuf, "Date", stamp_data.date);
|
|
|
|
|
if (stamp_data.marker[0]) IMB_imginfo_change_field (ibuf, "Marker", stamp_data.marker);
|
|
|
|
|
if (stamp_data.time[0]) IMB_imginfo_change_field (ibuf, "Time", stamp_data.time);
|
|
|
|
|
if (stamp_data.frame[0]) IMB_imginfo_change_field (ibuf, "Frame", stamp_data.frame);
|
|
|
|
|
if (stamp_data.camera[0]) IMB_imginfo_change_field (ibuf, "Camera", stamp_data.camera);
|
|
|
|
|
if (stamp_data.scene[0]) IMB_imginfo_change_field (ibuf, "Scene", stamp_data.scene);
|
2007-11-08 13:02:59 +00:00
|
|
|
if (stamp_data.strip[0]) IMB_imginfo_change_field (ibuf, "Strip", stamp_data.strip);
|
2007-10-28 22:27:07 +00:00
|
|
|
}
|
|
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
int BKE_write_ibuf(ImBuf *ibuf, char *name, int imtype, int subimtype, int quality)
|
|
|
|
|
{
|
|
|
|
|
int ok;
|
|
|
|
|
|
|
|
|
|
if(imtype==0);
|
2006-11-01 12:54:29 +00:00
|
|
|
else if(imtype== R_IRIS)
|
|
|
|
|
ibuf->ftype= IMAGIC;
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
else if ((imtype==R_RADHDR)) {
|
|
|
|
|
ibuf->ftype= RADHDR;
|
|
|
|
|
}
|
2007-12-04 05:53:32 +00:00
|
|
|
else if (imtype==R_PNG || imtype==R_FFMPEG) {
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
ibuf->ftype= PNG;
|
|
|
|
|
}
|
2007-06-25 19:50:25 +00:00
|
|
|
#ifdef WITH_DDS
|
|
|
|
|
else if ((imtype==R_DDS)) {
|
|
|
|
|
ibuf->ftype= DDS;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
else if ((imtype==R_BMP)) {
|
|
|
|
|
ibuf->ftype= BMP;
|
|
|
|
|
}
|
|
|
|
|
else if ((G.have_libtiff) && (imtype==R_TIFF)) {
|
|
|
|
|
ibuf->ftype= TIF;
|
|
|
|
|
}
|
|
|
|
|
#ifdef WITH_OPENEXR
|
2006-12-20 17:57:56 +00:00
|
|
|
else if (imtype==R_OPENEXR || imtype==R_MULTILAYER) {
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
ibuf->ftype= OPENEXR;
|
|
|
|
|
if(subimtype & R_OPENEXR_HALF)
|
|
|
|
|
ibuf->ftype |= OPENEXR_HALF;
|
|
|
|
|
ibuf->ftype |= (quality & OPENEXR_COMPRESS);
|
|
|
|
|
|
|
|
|
|
if(!(subimtype & R_OPENEXR_ZBUF))
|
|
|
|
|
ibuf->zbuf_float = NULL; /* signal for exr saving */
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2006-03-12 14:11:23 +00:00
|
|
|
else if (imtype==R_CINEON) {
|
|
|
|
|
ibuf->ftype = CINEON;
|
|
|
|
|
}
|
|
|
|
|
else if (imtype==R_DPX) {
|
|
|
|
|
ibuf->ftype = DPX;
|
|
|
|
|
}
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
else if (imtype==R_TARGA) {
|
|
|
|
|
ibuf->ftype= TGA;
|
|
|
|
|
}
|
|
|
|
|
else if(imtype==R_RAWTGA) {
|
|
|
|
|
ibuf->ftype= RAWTGA;
|
|
|
|
|
}
|
|
|
|
|
else if(imtype==R_HAMX) {
|
|
|
|
|
ibuf->ftype= AN_hamx;
|
|
|
|
|
}
|
2006-07-08 13:18:57 +00:00
|
|
|
else {
|
|
|
|
|
/* R_JPEG90, R_MOVIE, etc. default we save jpegs */
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
if(quality < 10) quality= 90;
|
|
|
|
|
ibuf->ftype= JPG|quality;
|
2006-06-13 18:51:52 +00:00
|
|
|
if(ibuf->depth==32) ibuf->depth= 24; /* unsupported feature only confuses other s/w */
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLI_make_existing_file(name);
|
2007-10-20 16:17:27 +00:00
|
|
|
|
|
|
|
|
if(G.scene->r.scemode & R_STAMP_INFO)
|
2007-10-28 22:27:07 +00:00
|
|
|
BKE_stamp_info(ibuf);
|
|
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
ok = IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat);
|
|
|
|
|
if (ok == 0) {
|
|
|
|
|
perror(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return(ok);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-08-10 10:38:50 +00:00
|
|
|
void BKE_makepicstring(char *string, char *base, int frame, int imtype)
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
{
|
2006-08-10 10:38:50 +00:00
|
|
|
short i, len, digits= 4; /* digits in G.scene? */
|
|
|
|
|
char num[10];
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
2006-08-10 10:38:50 +00:00
|
|
|
if (string==NULL) return;
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
BLI_strncpy(string, base, FILE_MAX - 10); /* weak assumption */
|
2006-08-10 10:38:50 +00:00
|
|
|
BLI_convertstringcode(string, G.sce, frame);
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
|
|
|
|
len= strlen(string);
|
|
|
|
|
|
2006-08-10 10:38:50 +00:00
|
|
|
i= digits - sprintf(num, "%d", frame);
|
|
|
|
|
for(; i>0; i--){
|
|
|
|
|
string[len]= '0';
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
len++;
|
|
|
|
|
}
|
2006-08-10 10:38:50 +00:00
|
|
|
string[len]= 0;
|
|
|
|
|
strcat(string, num);
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
|
|
|
|
if(G.scene->r.scemode & R_EXTENSION)
|
2006-08-10 10:38:50 +00:00
|
|
|
BKE_add_image_extension(string, imtype);
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* used by sequencer too */
|
2006-08-20 10:18:01 +00:00
|
|
|
struct anim *openanim(char *name, int flags)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2006-08-20 10:18:01 +00:00
|
|
|
struct anim *anim;
|
|
|
|
|
struct ImBuf *ibuf;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
anim = IMB_open_anim(name, flags);
|
2006-08-20 10:18:01 +00:00
|
|
|
if (anim == NULL) return(0);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
ibuf = IMB_anim_absolute(anim, 0);
|
2006-02-11 23:17:41 +00:00
|
|
|
if (ibuf == NULL) {
|
|
|
|
|
printf("not an anim; %s\n", name);
|
2002-10-12 11:37:38 +00:00
|
|
|
IMB_free_anim(anim);
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
IMB_freeImBuf(ibuf);
|
|
|
|
|
|
|
|
|
|
return(anim);
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* ************************* New Image API *************** */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Notes about Image storage
|
|
|
|
|
- packedfile
|
|
|
|
|
-> written in .blend
|
|
|
|
|
- filename
|
|
|
|
|
-> written in .blend
|
|
|
|
|
- movie
|
|
|
|
|
-> comes from packedfile or filename
|
|
|
|
|
- renderresult
|
|
|
|
|
-> comes from packedfile or filename
|
|
|
|
|
- listbase
|
|
|
|
|
-> ibufs from exrhandle
|
|
|
|
|
- flipbook array
|
|
|
|
|
-> ibufs come from movie, temporary renderresult or sequence
|
|
|
|
|
- ibuf
|
|
|
|
|
-> comes from packedfile or filename or generated
|
2002-10-12 11:37:38 +00:00
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
*/
|
2004-01-26 12:37:34 +00:00
|
|
|
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* forces existance of 1 Image for renderout or nodes, returns Image */
|
|
|
|
|
/* name is only for default, when making new one */
|
|
|
|
|
Image *BKE_image_verify_viewer(int type, const char *name)
|
|
|
|
|
{
|
|
|
|
|
Image *ima;
|
2006-02-02 18:28:01 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
for(ima=G.main->image.first; ima; ima= ima->id.next)
|
|
|
|
|
if(ima->source==IMA_SRC_VIEWER)
|
|
|
|
|
if(ima->type==type)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if(ima==NULL)
|
|
|
|
|
ima= image_alloc(name, IMA_SRC_VIEWER, type);
|
|
|
|
|
|
|
|
|
|
/* happens on reload, imagewindow cannot be image user when hidden*/
|
|
|
|
|
if(ima->id.us==0)
|
|
|
|
|
id_us_plus(&ima->id);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
return ima;
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
void BKE_image_assign_ibuf(Image *ima, ImBuf *ibuf)
|
|
|
|
|
{
|
|
|
|
|
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
|
|
|
|
|
}
|
2006-10-26 10:13:16 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
|
|
|
|
|
{
|
|
|
|
|
if(ima==NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
switch(signal) {
|
|
|
|
|
case IMA_SIGNAL_FREE:
|
|
|
|
|
image_free_buffers(ima);
|
|
|
|
|
if(iuser)
|
|
|
|
|
iuser->ok= 1;
|
|
|
|
|
break;
|
|
|
|
|
case IMA_SIGNAL_SRC_CHANGE:
|
|
|
|
|
if(ima->type==IMA_TYPE_MULTILAYER)
|
|
|
|
|
image_free_buffers(ima);
|
|
|
|
|
else if(ima->source==IMA_SRC_GENERATED) {
|
|
|
|
|
if(ima->gen_x==0 || ima->gen_y==0) {
|
|
|
|
|
ImBuf *ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
|
|
|
|
|
if(ibuf) {
|
|
|
|
|
ima->gen_x= ibuf->x;
|
|
|
|
|
ima->gen_y= ibuf->y;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ima->ok= 1;
|
|
|
|
|
if(iuser)
|
|
|
|
|
iuser->ok= 1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IMA_SIGNAL_RELOAD:
|
|
|
|
|
/* try to repack file */
|
|
|
|
|
if(ima->packedfile) {
|
|
|
|
|
PackedFile *pf;
|
|
|
|
|
pf = newPackedFile(ima->name);
|
|
|
|
|
if (pf) {
|
|
|
|
|
freePackedFile(ima->packedfile);
|
|
|
|
|
ima->packedfile = pf;
|
|
|
|
|
image_free_buffers(ima);
|
|
|
|
|
} else {
|
|
|
|
|
printf("ERROR: Image not available. Keeping packed image\n");
|
|
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
else
|
|
|
|
|
image_free_buffers(ima);
|
|
|
|
|
|
|
|
|
|
if(iuser)
|
|
|
|
|
iuser->ok= 1;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case IMA_SIGNAL_USER_NEW_IMAGE:
|
|
|
|
|
if(iuser) {
|
|
|
|
|
iuser->ok= 1;
|
|
|
|
|
if(ima->source==IMA_SRC_FILE || ima->source==IMA_SRC_SEQUENCE) {
|
|
|
|
|
if(ima->type==IMA_TYPE_MULTILAYER) {
|
|
|
|
|
iuser->multi_index= 0;
|
|
|
|
|
iuser->layer= iuser->pass= 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* if layer or pass changes, we need an index for the imbufs list */
|
|
|
|
|
/* note it is called for rendered results, but it doesnt use the index! */
|
|
|
|
|
/* and because rendered results use fake layer/passes, don't correct for wrong indices here */
|
|
|
|
|
RenderPass *BKE_image_multilayer_index(RenderResult *rr, ImageUser *iuser)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2006-12-20 17:57:56 +00:00
|
|
|
RenderLayer *rl;
|
|
|
|
|
RenderPass *rpass= NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if(rr==NULL)
|
|
|
|
|
return NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if(iuser) {
|
|
|
|
|
short index= 0, rl_index= 0, rp_index;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
for(rl= rr->layers.first; rl; rl= rl->next, rl_index++) {
|
|
|
|
|
rp_index= 0;
|
|
|
|
|
for(rpass= rl->passes.first; rpass; rpass= rpass->next, index++, rp_index++)
|
|
|
|
|
if(iuser->layer==rl_index && iuser->pass==rp_index)
|
|
|
|
|
break;
|
|
|
|
|
if(rpass)
|
|
|
|
|
break;
|
|
|
|
|
}
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 00:40:35 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if(rpass)
|
|
|
|
|
iuser->multi_index= index;
|
|
|
|
|
else
|
|
|
|
|
iuser->multi_index= 0;
|
|
|
|
|
}
|
|
|
|
|
if(rpass==NULL) {
|
|
|
|
|
rl= rr->layers.first;
|
|
|
|
|
if(rl)
|
|
|
|
|
rpass= rl->passes.first;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return rpass;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RenderResult *BKE_image_get_renderresult(Image *ima)
|
|
|
|
|
{
|
|
|
|
|
if(ima->rr)
|
|
|
|
|
return ima->rr;
|
|
|
|
|
if(ima->type==IMA_TYPE_R_RESULT)
|
|
|
|
|
return RE_GetResult(RE_GetRender(G.scene->id.name));
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* after imbuf load, openexr type can return with a exrhandle open */
|
|
|
|
|
/* in that case we have to build a render-result */
|
|
|
|
|
static void image_create_multilayer(Image *ima, ImBuf *ibuf, int framenr)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ima->rr= RE_MultilayerConvert(ibuf->userdata, ibuf->x, ibuf->y);
|
2006-12-24 16:03:31 +00:00
|
|
|
|
|
|
|
|
#ifdef WITH_OPENEXR
|
2006-12-20 17:57:56 +00:00
|
|
|
IMB_exr_close(ibuf->userdata);
|
2006-12-24 16:03:31 +00:00
|
|
|
#endif
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
ibuf->userdata= NULL;
|
|
|
|
|
if(ima->rr)
|
|
|
|
|
ima->rr->framenr= framenr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* common stuff to do with images after loading */
|
|
|
|
|
static void image_initialize_after_load(Image *ima, ImBuf *ibuf)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* preview is NULL when it has never been used as an icon before */
|
|
|
|
|
if(G.background==0 && ima->preview==NULL)
|
|
|
|
|
BKE_icon_changed(BKE_icon_getid(&ima->id));
|
|
|
|
|
|
|
|
|
|
/* stringcodes also in ibuf, ibuf->name is used to retrieve original (buttons) */
|
|
|
|
|
BLI_strncpy(ibuf->name, ima->name, FILE_MAX);
|
|
|
|
|
|
|
|
|
|
/* fields */
|
|
|
|
|
if (ima->flag & IMA_FIELDS) {
|
|
|
|
|
if(ima->flag & IMA_STD_FIELD) de_interlace_st(ibuf);
|
|
|
|
|
else de_interlace_ng(ibuf);
|
|
|
|
|
}
|
|
|
|
|
/* timer */
|
|
|
|
|
ima->lastused = clock() / CLOCKS_PER_SEC;
|
|
|
|
|
|
|
|
|
|
ima->ok= IMA_OK_LOADED;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
|
|
|
|
|
{
|
|
|
|
|
struct ImBuf *ibuf;
|
|
|
|
|
unsigned short numlen;
|
|
|
|
|
char name[FILE_MAX], head[FILE_MAX], tail[FILE_MAX];
|
|
|
|
|
|
|
|
|
|
ima->lastframe= frame;
|
|
|
|
|
|
|
|
|
|
BLI_stringdec(ima->name, head, tail, &numlen);
|
|
|
|
|
BLI_stringenc(ima->name, head, tail, numlen, frame);
|
|
|
|
|
BLI_strncpy(name, ima->name, sizeof(name));
|
|
|
|
|
|
|
|
|
|
if(ima->id.lib)
|
|
|
|
|
BLI_convertstringcode(name, ima->id.lib->filename, frame);
|
|
|
|
|
else
|
|
|
|
|
BLI_convertstringcode(name, G.sce, frame);
|
|
|
|
|
|
|
|
|
|
/* read ibuf */
|
|
|
|
|
ibuf = IMB_loadiffname(name, IB_rect|IB_multilayer);
|
2007-01-15 12:44:45 +00:00
|
|
|
if(G.f & G_DEBUG) printf("loaded %s\n", name);
|
2006-12-20 17:57:56 +00:00
|
|
|
|
|
|
|
|
if (ibuf) {
|
2006-12-24 20:19:56 +00:00
|
|
|
#ifdef WITH_OPENEXR
|
2006-12-20 17:57:56 +00:00
|
|
|
/* handle multilayer case, don't assign ibuf. will be handled in BKE_image_get_ibuf */
|
|
|
|
|
if (ibuf->ftype==OPENEXR && ibuf->userdata) {
|
|
|
|
|
image_create_multilayer(ima, ibuf, frame);
|
|
|
|
|
ima->type= IMA_TYPE_MULTILAYER;
|
|
|
|
|
IMB_freeImBuf(ibuf);
|
|
|
|
|
ibuf= NULL;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
image_assign_ibuf(ima, ibuf, 0, frame);
|
|
|
|
|
image_initialize_after_load(ima, ibuf);
|
|
|
|
|
}
|
2006-12-24 20:19:56 +00:00
|
|
|
#else
|
|
|
|
|
image_assign_ibuf(ima, ibuf, 0, frame);
|
|
|
|
|
image_initialize_after_load(ima, ibuf);
|
|
|
|
|
#endif
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
ima->ok= 0;
|
|
|
|
|
|
|
|
|
|
if(iuser)
|
|
|
|
|
iuser->ok= ima->ok;
|
|
|
|
|
|
|
|
|
|
return ibuf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int frame)
|
|
|
|
|
{
|
|
|
|
|
struct ImBuf *ibuf= NULL;
|
|
|
|
|
|
|
|
|
|
/* either we load from RenderResult, or we have to load a new one */
|
|
|
|
|
|
|
|
|
|
/* check for new RenderResult */
|
|
|
|
|
if(ima->rr==NULL || frame!=ima->rr->framenr) {
|
|
|
|
|
/* copy to survive not found multilayer image */
|
|
|
|
|
RenderResult *oldrr= ima->rr;
|
|
|
|
|
|
|
|
|
|
ima->rr= NULL;
|
|
|
|
|
ibuf = image_load_sequence_file(ima, iuser, frame);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if(ibuf) { /* actually an error */
|
|
|
|
|
ima->type= IMA_TYPE_IMAGE;
|
|
|
|
|
printf("error, multi is normal image\n");
|
|
|
|
|
}
|
|
|
|
|
// printf("loaded new result %p\n", ima->rr);
|
|
|
|
|
/* free result if new one found */
|
|
|
|
|
if(ima->rr) {
|
|
|
|
|
// if(oldrr) printf("freed previous result %p\n", oldrr);
|
|
|
|
|
if(oldrr) RE_FreeRenderResult(oldrr);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
ima->rr= oldrr;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if(ima->rr) {
|
|
|
|
|
RenderPass *rpass= BKE_image_multilayer_index(ima->rr, iuser);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if(rpass) {
|
|
|
|
|
// printf("load from pass %s\n", rpass->name);
|
|
|
|
|
/* since we free render results, we copy the rect */
|
|
|
|
|
ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0, 0);
|
|
|
|
|
ibuf->rect_float= MEM_dupallocN(rpass->rect);
|
|
|
|
|
ibuf->flags |= IB_rectfloat;
|
|
|
|
|
ibuf->mall= IB_rectfloat;
|
|
|
|
|
ibuf->channels= rpass->channels;
|
|
|
|
|
|
|
|
|
|
image_assign_ibuf(ima, ibuf, iuser->multi_index, frame);
|
|
|
|
|
image_initialize_after_load(ima, ibuf);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// else printf("pass not found\n");
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
else
|
|
|
|
|
ima->ok= 0;
|
|
|
|
|
|
|
|
|
|
if(iuser)
|
|
|
|
|
iuser->ok= ima->ok;
|
|
|
|
|
|
|
|
|
|
return ibuf;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
|
|
|
|
|
static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2006-12-20 17:57:56 +00:00
|
|
|
struct ImBuf *ibuf= NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
ima->lastframe= frame;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if(ima->anim==NULL) {
|
|
|
|
|
char str[FILE_MAX];
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
BLI_strncpy(str, ima->name, FILE_MAX);
|
|
|
|
|
if(ima->id.lib)
|
|
|
|
|
BLI_convertstringcode(str, ima->id.lib->filename, 0);
|
|
|
|
|
else
|
|
|
|
|
BLI_convertstringcode(str, G.sce, 0);
|
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to
Austin Benesh for bringing it further. Kent Mein provided a lot of code
for integrating float buffers in Blender imbuf and ImBuf API cleanup,
and provided Make and Scons and static linking.
At this moment; the EXR libraries are a *dependency*, so you cannot get
the Orange branch compiled without having OpenEXR installed. Get the
(precompiled or sources) stuff from www.openexr.com. Current default is
that the headers and lib resides in /user/local/
Several changes/additions/fixes were added:
- EXR code only supported 'half' format (16 bits per channel). I've added
float writing, but for reading it I need tomorrow. :)
- Quite some clumsy copying of data happened in EXR code.
- cleaned up the api calls already a bit, preparing for more advanced
support
- Zbuffers were saved 16 bits, now 32 bits
- automatic adding of .exr extensions went wrong
Imbuf:
- added proper imbuf->flags and imbuf->mall support for float buffers, it
was created for *each* imbuf. :)
- found bugs for float buffers in scaling and flipping. Code there will
need more checks still
- imbuf also needs to be verified to behave properly when no 32 bits
rect exists (for saving for example)
TODO:
- support internal float images for textures, backbuf, AO probes, and
display in Image window
Hope this commit won't screwup syncing with bf-blender... :/
2006-01-09 00:40:35 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
ima->anim = openanim(str, IB_cmap | IB_rect);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* let's initialize this user */
|
|
|
|
|
if(ima->anim && iuser && iuser->frames==0)
|
|
|
|
|
iuser->frames= IMB_anim_get_duration(ima->anim);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(ima->anim) {
|
|
|
|
|
int dur = IMB_anim_get_duration(ima->anim);
|
|
|
|
|
int fra= frame-1;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if(fra<0) fra = 0;
|
|
|
|
|
if(fra>(dur-1)) fra= dur-1;
|
|
|
|
|
ibuf = IMB_anim_absolute(ima->anim, fra);
|
|
|
|
|
|
|
|
|
|
if(ibuf) {
|
|
|
|
|
image_assign_ibuf(ima, ibuf, 0, frame);
|
|
|
|
|
image_initialize_after_load(ima, ibuf);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
ima->ok= 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
else
|
|
|
|
|
ima->ok= 0;
|
|
|
|
|
|
|
|
|
|
if(iuser)
|
|
|
|
|
iuser->ok= ima->ok;
|
|
|
|
|
|
|
|
|
|
return ibuf;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* cfra used for # code, Image can only have this # for all its users */
|
|
|
|
|
static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
|
2006-07-05 17:32:49 +00:00
|
|
|
{
|
2006-12-20 17:57:56 +00:00
|
|
|
struct ImBuf *ibuf;
|
|
|
|
|
char str[FILE_MAX];
|
|
|
|
|
|
|
|
|
|
/* always ensure clean ima */
|
|
|
|
|
image_free_buffers(ima);
|
|
|
|
|
|
|
|
|
|
/* is there a PackedFile with this image ? */
|
|
|
|
|
if (ima->packedfile) {
|
|
|
|
|
ibuf = IMB_ibImageFromMemory((int *) ima->packedfile->data, ima->packedfile->size, IB_rect|IB_multilayer);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
/* get the right string */
|
|
|
|
|
BLI_strncpy(str, ima->name, sizeof(str));
|
|
|
|
|
if(ima->id.lib)
|
|
|
|
|
BLI_convertstringcode(str, ima->id.lib->filename, cfra);
|
|
|
|
|
else
|
|
|
|
|
BLI_convertstringcode(str, G.sce, cfra);
|
|
|
|
|
|
|
|
|
|
/* read ibuf */
|
2007-10-20 16:17:27 +00:00
|
|
|
ibuf = IMB_loadiffname(str, IB_rect|IB_multilayer|IB_imginfo);
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ibuf) {
|
|
|
|
|
/* handle multilayer case, don't assign ibuf. will be handled in BKE_image_get_ibuf */
|
|
|
|
|
if (ibuf->ftype==OPENEXR && ibuf->userdata) {
|
|
|
|
|
image_create_multilayer(ima, ibuf, cfra);
|
|
|
|
|
ima->type= IMA_TYPE_MULTILAYER;
|
|
|
|
|
IMB_freeImBuf(ibuf);
|
|
|
|
|
ibuf= NULL;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
|
|
|
|
|
image_initialize_after_load(ima, ibuf);
|
|
|
|
|
|
|
|
|
|
/* check if the image is a font image... */
|
|
|
|
|
detectBitmapFont(ibuf);
|
|
|
|
|
|
|
|
|
|
/* make packed file for autopack */
|
|
|
|
|
if ((ima->packedfile == NULL) && (G.fileflags & G_AUTOPACK))
|
|
|
|
|
ima->packedfile = newPackedFile(str);
|
|
|
|
|
}
|
2007-11-28 12:32:25 +00:00
|
|
|
|
|
|
|
|
if(ima->flag & IMA_DO_PREMUL)
|
|
|
|
|
converttopremul(ibuf);
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
2006-07-05 17:32:49 +00:00
|
|
|
else
|
2006-12-20 17:57:56 +00:00
|
|
|
ima->ok= 0;
|
|
|
|
|
|
|
|
|
|
if(iuser)
|
|
|
|
|
iuser->ok= ima->ok;
|
|
|
|
|
|
|
|
|
|
return ibuf;
|
2006-07-05 17:32:49 +00:00
|
|
|
}
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
static ImBuf *image_get_ibuf_multilayer(Image *ima, ImageUser *iuser)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2006-12-20 17:57:56 +00:00
|
|
|
ImBuf *ibuf= NULL;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if(ima->rr==NULL) {
|
|
|
|
|
ibuf = image_load_image_file(ima, iuser, 0);
|
|
|
|
|
if(ibuf) { /* actually an error */
|
|
|
|
|
ima->type= IMA_TYPE_IMAGE;
|
|
|
|
|
return ibuf;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(ima->rr) {
|
|
|
|
|
RenderPass *rpass= BKE_image_multilayer_index(ima->rr, iuser);
|
|
|
|
|
|
|
|
|
|
if(rpass) {
|
|
|
|
|
ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0, 0);
|
|
|
|
|
|
|
|
|
|
image_assign_ibuf(ima, ibuf, iuser?iuser->multi_index:IMA_NO_INDEX, 0);
|
|
|
|
|
image_initialize_after_load(ima, ibuf);
|
|
|
|
|
|
|
|
|
|
ibuf->rect_float= rpass->rect;
|
|
|
|
|
ibuf->flags |= IB_rectfloat;
|
|
|
|
|
ibuf->channels= rpass->channels;
|
|
|
|
|
}
|
|
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if(ibuf==NULL)
|
|
|
|
|
ima->ok= 0;
|
|
|
|
|
if(iuser)
|
|
|
|
|
iuser->ok= ima->ok;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
return ibuf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* showing RGBA result itself (from compo/sequence) or
|
|
|
|
|
like exr, using layers etc */
|
|
|
|
|
static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser)
|
|
|
|
|
{
|
|
|
|
|
RenderResult *rr= RE_GetResult(RE_GetRender(G.scene->id.name));
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if(rr && iuser) {
|
|
|
|
|
RenderResult rres;
|
|
|
|
|
float *rectf;
|
|
|
|
|
unsigned int *rect;
|
|
|
|
|
int channels= 4, layer= iuser->layer;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* this gives active layer, composite or seqence result */
|
|
|
|
|
RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
|
2006-12-20 21:51:08 +00:00
|
|
|
rect= (unsigned int *)rres.rect32;
|
2006-12-20 17:57:56 +00:00
|
|
|
rectf= rres.rectf;
|
|
|
|
|
|
|
|
|
|
/* get compo/seq result by default */
|
|
|
|
|
if(rr->rectf && layer==0);
|
|
|
|
|
else if(rr->layers.first) {
|
|
|
|
|
RenderLayer *rl= BLI_findlink(&rr->layers, iuser->layer-(rr->rectf?1:0));
|
|
|
|
|
if(rl) {
|
|
|
|
|
/* there's no combined pass, is in renderlayer itself */
|
|
|
|
|
if(iuser->pass==0) {
|
|
|
|
|
rectf= rl->rectf;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
RenderPass *rpass= BLI_findlink(&rl->passes, iuser->pass-1);
|
|
|
|
|
if(rpass) {
|
|
|
|
|
channels= rpass->channels;
|
|
|
|
|
rectf= rpass->rect;
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if(rectf || rect) {
|
|
|
|
|
ImBuf *ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
|
|
|
|
|
|
|
|
|
|
/* make ibuf if needed, and initialize it */
|
|
|
|
|
if(ibuf==NULL) {
|
|
|
|
|
ibuf= IMB_allocImBuf(rr->rectx, rr->recty, 32, 0, 0);
|
|
|
|
|
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
|
|
|
|
|
}
|
|
|
|
|
ibuf->x= rr->rectx;
|
|
|
|
|
ibuf->y= rr->recty;
|
|
|
|
|
|
|
|
|
|
if(ibuf->rect_float!=rectf || rect) /* ensure correct redraw */
|
|
|
|
|
imb_freerectImBuf(ibuf);
|
|
|
|
|
if(rect)
|
|
|
|
|
ibuf->rect= rect;
|
|
|
|
|
|
|
|
|
|
ibuf->rect_float= rectf;
|
|
|
|
|
ibuf->flags |= IB_rectfloat;
|
|
|
|
|
ibuf->channels= channels;
|
|
|
|
|
|
|
|
|
|
ima->ok= IMA_OK_LOADED;
|
|
|
|
|
return ibuf;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Checks optional ImageUser and verifies/creates ImBuf. */
|
|
|
|
|
/* returns ibuf */
|
|
|
|
|
ImBuf *BKE_image_get_ibuf(Image *ima, ImageUser *iuser)
|
|
|
|
|
{
|
|
|
|
|
ImBuf *ibuf= NULL;
|
2007-05-03 15:10:44 +00:00
|
|
|
float color[] = {0, 0, 0, 1};
|
2006-12-20 17:57:56 +00:00
|
|
|
|
|
|
|
|
/* quick reject tests */
|
|
|
|
|
if(ima==NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
if(iuser) {
|
|
|
|
|
if(iuser->ok==0)
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
else if(ima->ok==0)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2006-12-21 15:44:46 +00:00
|
|
|
BLI_lock_thread(LOCK_IMAGE);
|
2006-12-20 17:57:56 +00:00
|
|
|
|
|
|
|
|
/* handle image source and types */
|
|
|
|
|
if(ima->source==IMA_SRC_MOVIE) {
|
|
|
|
|
/* source is from single file, use flipbook to store ibuf */
|
|
|
|
|
int frame= iuser?iuser->framenr:ima->lastframe;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
ibuf= image_get_ibuf(ima, 0, frame);
|
|
|
|
|
if(ibuf==NULL)
|
|
|
|
|
ibuf= image_load_movie_file(ima, iuser, frame);
|
|
|
|
|
}
|
|
|
|
|
else if(ima->source==IMA_SRC_SEQUENCE) {
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if(ima->type==IMA_TYPE_IMAGE) {
|
|
|
|
|
/* regular files, ibufs in flipbook, allows saving */
|
|
|
|
|
int frame= iuser?iuser->framenr:ima->lastframe;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
ibuf= image_get_ibuf(ima, 0, frame);
|
|
|
|
|
if(ibuf==NULL)
|
|
|
|
|
ibuf= image_load_sequence_file(ima, iuser, frame);
|
|
|
|
|
else
|
|
|
|
|
BLI_strncpy(ima->name, ibuf->name, sizeof(ima->name));
|
|
|
|
|
}
|
|
|
|
|
/* no else; on load the ima type can change */
|
|
|
|
|
if(ima->type==IMA_TYPE_MULTILAYER) {
|
|
|
|
|
/* only 1 layer/pass stored in imbufs, no exrhandle anim storage, no saving */
|
|
|
|
|
int frame= iuser?iuser->framenr:ima->lastframe;
|
|
|
|
|
int index= iuser?iuser->multi_index:IMA_NO_INDEX;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
ibuf= image_get_ibuf(ima, index, frame);
|
|
|
|
|
if(G.rt) printf("seq multi fra %d id %d ibuf %p %s\n", frame, index, ibuf, ima->id.name);
|
|
|
|
|
if(ibuf==NULL)
|
|
|
|
|
ibuf= image_load_sequence_multilayer(ima, iuser, frame);
|
|
|
|
|
else
|
|
|
|
|
BLI_strncpy(ima->name, ibuf->name, sizeof(ima->name));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if(ima->source==IMA_SRC_FILE) {
|
|
|
|
|
|
|
|
|
|
if(ima->type==IMA_TYPE_IMAGE) {
|
|
|
|
|
ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
|
|
|
|
|
if(ibuf==NULL)
|
|
|
|
|
ibuf= image_load_image_file(ima, iuser, G.scene->r.cfra); /* cfra only for '#', this global is OK */
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
/* no else; on load the ima type can change */
|
|
|
|
|
if(ima->type==IMA_TYPE_MULTILAYER) {
|
|
|
|
|
/* keeps render result, stores ibufs in listbase, allows saving */
|
|
|
|
|
ibuf= image_get_ibuf(ima, iuser?iuser->multi_index:IMA_NO_INDEX, 0);
|
|
|
|
|
if(ibuf==NULL)
|
|
|
|
|
ibuf= image_get_ibuf_multilayer(ima, iuser);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if(ima->source == IMA_SRC_GENERATED) {
|
|
|
|
|
/* generated is: ibuf is allocated dynamically */
|
|
|
|
|
ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if(ibuf==NULL) {
|
|
|
|
|
if(ima->type==IMA_TYPE_VERSE) {
|
|
|
|
|
/* todo */
|
|
|
|
|
}
|
|
|
|
|
else { /* always fall back to IMA_TYPE_UV_TEST */
|
|
|
|
|
/* UV testgrid or black or solid etc */
|
|
|
|
|
if(ima->gen_x==0) ima->gen_x= 256;
|
|
|
|
|
if(ima->gen_y==0) ima->gen_y= 256;
|
2007-05-03 15:10:44 +00:00
|
|
|
ibuf= add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, ima->gen_type, color);
|
2006-12-20 17:57:56 +00:00
|
|
|
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
|
2007-02-10 16:59:20 +00:00
|
|
|
ima->ok= IMA_OK_LOADED;
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
else if(ima->source == IMA_SRC_VIEWER) {
|
|
|
|
|
if(ima->type==IMA_TYPE_R_RESULT) {
|
|
|
|
|
/* always verify entirely */
|
|
|
|
|
ibuf= image_get_render_result(ima, iuser);
|
|
|
|
|
}
|
|
|
|
|
else if(ima->type==IMA_TYPE_COMPOSITE) {
|
|
|
|
|
int frame= iuser?iuser->framenr:0;
|
|
|
|
|
|
|
|
|
|
/* Composite Viewer, all handled in compositor */
|
|
|
|
|
ibuf= image_get_ibuf(ima, 0, frame);
|
|
|
|
|
if(ibuf==NULL) {
|
|
|
|
|
/* fake ibuf, will be filled in compositor */
|
2006-12-21 20:03:25 +00:00
|
|
|
ibuf= IMB_allocImBuf(256, 256, 32, IB_rect, 0);
|
2006-12-20 17:57:56 +00:00
|
|
|
image_assign_ibuf(ima, ibuf, 0, frame);
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
if(G.rendering==0)
|
|
|
|
|
tag_image_time(ima);
|
|
|
|
|
|
2006-12-21 15:44:46 +00:00
|
|
|
BLI_unlock_thread(LOCK_IMAGE);
|
2006-12-20 17:57:56 +00:00
|
|
|
|
|
|
|
|
return ibuf;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
void BKE_image_user_calc_imanr(ImageUser *iuser, int cfra, int fieldnr)
|
|
|
|
|
{
|
|
|
|
|
int imanr, len;
|
|
|
|
|
|
|
|
|
|
/* here (+fie_ima/2-1) makes sure that division happens correctly */
|
|
|
|
|
len= (iuser->fie_ima*iuser->frames)/2;
|
|
|
|
|
|
|
|
|
|
if(len==0) {
|
|
|
|
|
iuser->framenr= 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
cfra= cfra - iuser->sfra+1;
|
|
|
|
|
|
|
|
|
|
/* cyclic */
|
|
|
|
|
if(iuser->cycl) {
|
|
|
|
|
cfra= ( (cfra) % len );
|
|
|
|
|
if(cfra < 0) cfra+= len;
|
|
|
|
|
if(cfra==0) cfra= len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(cfra<1) cfra= 1;
|
|
|
|
|
else if(cfra>len) cfra= len;
|
|
|
|
|
|
|
|
|
|
/* convert current frame to current field */
|
|
|
|
|
cfra= 2*(cfra);
|
|
|
|
|
if(fieldnr) cfra++;
|
|
|
|
|
|
|
|
|
|
/* transform to images space */
|
|
|
|
|
imanr= (cfra+iuser->fie_ima-2)/iuser->fie_ima;
|
|
|
|
|
if(imanr>iuser->frames) imanr= iuser->frames;
|
|
|
|
|
imanr+= iuser->offset;
|
|
|
|
|
|
|
|
|
|
if(iuser->cycl) {
|
|
|
|
|
imanr= ( (imanr) % len );
|
|
|
|
|
while(imanr < 0) imanr+= len;
|
|
|
|
|
if(imanr==0) imanr= len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* allows image users to handle redraws */
|
|
|
|
|
if(iuser->flag & IMA_ANIM_ALWAYS)
|
|
|
|
|
if(imanr!=iuser->framenr)
|
|
|
|
|
iuser->flag |= IMA_ANIM_REFRESHED;
|
|
|
|
|
|
|
|
|
|
iuser->framenr= imanr;
|
|
|
|
|
if(iuser->ok==0) iuser->ok= 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|