forked from bartvdbraak/blender
Rolled back comments. According to new guidelines, no .c files
should contain doxygen comments.
This commit is contained in:
parent
63537d1e77
commit
17ca22de62
@ -32,15 +32,6 @@
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file allocimbuf.c
|
||||
* \ingroup imbuf
|
||||
* \brief Handles de/allocating memory for ImBuf struct variables.
|
||||
*
|
||||
* This file uses free() and MEM_mallocN() to allocate and deallocate memory
|
||||
* to the members of the ImBuf struct. It also zeroes out pointers and
|
||||
* tracks buffer sizes.
|
||||
*/
|
||||
/* It's become a bit messy... Basically, only the IMB_ prefixed files
|
||||
* should remain. */
|
||||
|
||||
@ -57,9 +48,6 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Default cmap. Used to initialize the ImBuf->cmap variable.
|
||||
*/
|
||||
static unsigned int dfltcmap[16] = {
|
||||
0x00000000, 0xffffffff, 0x777777ff, 0xccccccff,
|
||||
0xcc3344ff, 0xdd8844ff, 0xccdd44ff, 0x888833ff,
|
||||
@ -67,13 +55,6 @@ static unsigned int dfltcmap[16] = {
|
||||
0x8888ddff, 0x4433ccff, 0xcc33ccff, 0xcc88ddff
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Clears memory associated to the ImBuf* ibuf->planes
|
||||
*
|
||||
* This function uses free() to de-allocate the memory associated with
|
||||
* the planes member of the ImBuf struct, and sets the pointer to 0.
|
||||
* The ibuf->mall also gets the IB_planes bit unset.
|
||||
*/
|
||||
void imb_freeplanesImBuf(struct ImBuf * ibuf)
|
||||
{
|
||||
if (ibuf==0) return;
|
||||
@ -85,13 +66,6 @@ void imb_freeplanesImBuf(struct ImBuf * ibuf)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Clears memory associated to the ImBuf* ibuf->rect
|
||||
*
|
||||
* This function uses free() to de-allocate the memory associated with
|
||||
* the rect member of the ImBuf struct, and sets the pointer to 0.
|
||||
* The ibuf->mall also gets the IB_rect bit unset.
|
||||
*/
|
||||
void imb_freerectImBuf(struct ImBuf * ibuf)
|
||||
{
|
||||
if (ibuf==0) return;
|
||||
@ -102,19 +76,6 @@ void imb_freerectImBuf(struct ImBuf * ibuf)
|
||||
ibuf->mall &= ~IB_rect;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Clears memory associated to the ImBuf* ibuf->encodedbuffer
|
||||
*
|
||||
* This function uses free() to de-allocate the memory associated with
|
||||
* the encodedbuffer member of the ImBuf struct, and sets the following
|
||||
* variables to 0:
|
||||
*
|
||||
* encodedbuffer
|
||||
* encodedbuffersize
|
||||
* encodedsize
|
||||
*
|
||||
* The ibuf->mall also gets the IB_mem bit unset.
|
||||
*/
|
||||
static void freeencodedbufferImBuf(struct ImBuf * ibuf)
|
||||
{
|
||||
if (ibuf==0) return;
|
||||
@ -127,13 +88,6 @@ static void freeencodedbufferImBuf(struct ImBuf * ibuf)
|
||||
ibuf->mall &= ~IB_mem;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Clears memory associated to the ImBuf* ibuf->zbuf
|
||||
*
|
||||
* This function uses free() to de-allocate the memory associated with
|
||||
* the zbuf member of the ImBuf struct, and sets the pointer to 0.
|
||||
* The ibuf->mall also gets the IB_zbuf bit unset.
|
||||
*/
|
||||
void IMB_freezbufImBuf(struct ImBuf * ibuf)
|
||||
{
|
||||
if (ibuf==0) return;
|
||||
@ -144,13 +98,6 @@ void IMB_freezbufImBuf(struct ImBuf * ibuf)
|
||||
ibuf->mall &= ~IB_zbuf;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Clears memory associated to the ImBuf* ibuf->cmap
|
||||
*
|
||||
* This function uses free() to de-allocate the memory associated with
|
||||
* the cmap member of the ImBuf struct, and sets the pointer to 0.
|
||||
* The ibuf->mall also gets the IB_cmap bit unset.
|
||||
*/
|
||||
void IMB_freecmapImBuf(struct ImBuf * ibuf)
|
||||
{
|
||||
if (ibuf == 0) return;
|
||||
@ -162,13 +109,6 @@ void IMB_freecmapImBuf(struct ImBuf * ibuf)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Clears memory associated to the ImBuf ibuf
|
||||
*
|
||||
* This function uses the imb_free*ImBuf() functions to free the
|
||||
* memory associated to the ibuf argument, and then frees the ibuf
|
||||
* pointer using free()
|
||||
*/
|
||||
void IMB_freeImBuf(struct ImBuf * ibuf)
|
||||
{
|
||||
if (ibuf){
|
||||
@ -181,18 +121,6 @@ void IMB_freeImBuf(struct ImBuf * ibuf)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Allocates memory to the zbuf member of the ImBuf struct.
|
||||
*
|
||||
* This function uses MEM_mallocN(int,char *) to allocate memory to
|
||||
* the zbuf member of the ImBuf struct. Any memory associated to the
|
||||
* zbuf member is overwritten.
|
||||
*
|
||||
* The IB_zbuf bit of the ibuf->mall variable is set.
|
||||
* \return Returns FALSE if ibuf==0 or if MEM_mallocN() fails, otherwise
|
||||
* returns TRUE
|
||||
*/
|
||||
static short addzbufImBuf(struct ImBuf * ibuf)
|
||||
{
|
||||
int size;
|
||||
@ -210,21 +138,6 @@ static short addzbufImBuf(struct ImBuf * ibuf)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Allocates memory to the encodedbuffer member of the ImBuf struct.
|
||||
*
|
||||
* This function uses MEM_mallocN(int,char *) to allocate memory to
|
||||
* the encodedbuffer member of the ImBuf struct. Any memory associated to the
|
||||
* encodedbuffer member is overwritten.
|
||||
*
|
||||
* The ibuf->encodedbuffersize is set to 10000 if it was previously 0.
|
||||
*
|
||||
* The ibuf->encodedsize is set to 0.
|
||||
*
|
||||
* The IB_mem bit of the ibuf->mall variable is set.
|
||||
* \return Returns FALSE if ibuf==0 or if MEM_mallocN() fails, otherwise
|
||||
* returns TRUE
|
||||
*/
|
||||
short imb_addencodedbufferImBuf(struct ImBuf * ibuf)
|
||||
{
|
||||
if (ibuf==0) return(FALSE);
|
||||
@ -245,19 +158,6 @@ short imb_addencodedbufferImBuf(struct ImBuf * ibuf)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Adds memory to ibuf->encodedbuffer
|
||||
*
|
||||
* This function doubles the size of encodedbuffer if it is less than 10000,
|
||||
* otherwise sets encodedbuffersize to 10000.
|
||||
*
|
||||
* The ibuf members encodedbuffersize and encoded size also get set.
|
||||
* \return Returns FALSE if:
|
||||
* - ibuf==0
|
||||
* - ibuf->encodedbuffersize < ibuf->encodedsize
|
||||
* - MEM_mallocN() fails (returns NULL)
|
||||
* otherwise, returns TRUE
|
||||
*/
|
||||
short imb_enlargeencodedbufferImBuf(struct ImBuf * ibuf)
|
||||
{
|
||||
unsigned int newsize, encodedsize;
|
||||
@ -294,17 +194,6 @@ short imb_enlargeencodedbufferImBuf(struct ImBuf * ibuf)
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Allocates memory to the rect member of the ImBuf struct.
|
||||
*
|
||||
* This function uses MEM_mallocN(int,char *) to allocate memory to
|
||||
* the rect member of the ImBuf struct. Any memory associated to the
|
||||
* rect member is overwritten.
|
||||
*
|
||||
* The IB_rect bit of the ibuf->mall variable is set.
|
||||
* \return Returns FALSE if ibuf==0 or if MEM_mallocN() fails, otherwise
|
||||
* returns TRUE
|
||||
*/
|
||||
|
||||
short imb_addrectImBuf(struct ImBuf * ibuf)
|
||||
{
|
||||
@ -324,19 +213,6 @@ short imb_addrectImBuf(struct ImBuf * ibuf)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Allocates memory to the cmap member of the ImBuf struct.
|
||||
*
|
||||
* This function uses MEM_mallocN(int,char *) to allocate memory to
|
||||
* the cmap member of the ImBuf struct. Any memory associated to the
|
||||
* cmap member is overwritten.
|
||||
*
|
||||
* The memory is initialized to the value of the dfltcmap variable.
|
||||
*
|
||||
* The IB_cmap bit of the ibuf->mall variable is set.
|
||||
* \return Returns FALSE if ibuf==0 or if MEM_mallocN() fails, otherwise
|
||||
* returns TRUE
|
||||
*/
|
||||
short imb_addcmapImBuf(struct ImBuf *ibuf)
|
||||
{
|
||||
int min;
|
||||
@ -359,19 +235,6 @@ short imb_addcmapImBuf(struct ImBuf *ibuf)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Adds memory to the planes member of ibuf.
|
||||
*
|
||||
* This function adds ibuf->depth number of planes to ibuf.
|
||||
*
|
||||
* Sets:
|
||||
* - ibuf->skipx
|
||||
* - IB_planes bit of ibuf->mall
|
||||
* \return Returns FALSE if:
|
||||
* - ibuf==0
|
||||
* - MEM_mallocN() fails (returns 0)
|
||||
* Otherwise, returns TRUE
|
||||
*/
|
||||
short imb_addplanesImBuf(struct ImBuf *ibuf)
|
||||
{
|
||||
int size;
|
||||
@ -404,21 +267,7 @@ short imb_addplanesImBuf(struct ImBuf *ibuf)
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief This functions allocates memory to an ImBuf struct.
|
||||
*
|
||||
* This function allocates memory for an ImBuf struct and returns a pointer
|
||||
* to the struct. The MEM_callocN() function us used to allocate the memory.
|
||||
*
|
||||
* The x and y parameters define the resolution of the image, the d parameter
|
||||
* defines the (bit?) depth, the flags parameter defines whether the rect, zbuf or
|
||||
* planes members should exist. The bitmap flag will set the IB_planes bit in the
|
||||
* flags variable.
|
||||
*
|
||||
* \return Returns 0 if any of the imb_add*ImBuf() functions return FALSE. If the
|
||||
* memory for ibuf is not allocated, the return also should be 0. Otherwise, returns
|
||||
* a pointer to an ImBuf struct.
|
||||
*/
|
||||
|
||||
struct ImBuf *IMB_allocImBuf(short x,short y,uchar d,unsigned int flags,uchar bitmap)
|
||||
{
|
||||
struct ImBuf *ibuf;
|
||||
@ -456,12 +305,6 @@ struct ImBuf *IMB_allocImBuf(short x,short y,uchar d,unsigned int flags,uchar bi
|
||||
return (ibuf);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Returns a pointer to a new imbuf which is a duplicate of the ibuf1 parameter.
|
||||
*
|
||||
* \return Returns 0 if any memory allocation fails (except for the cmap allocation. Is
|
||||
* this right?), otherwise returns a copy of ibuf1.
|
||||
*/
|
||||
struct ImBuf *IMB_dupImBuf(struct ImBuf *ibuf1)
|
||||
{
|
||||
struct ImBuf *ibuf2, tbuf;
|
||||
|
@ -31,14 +31,6 @@
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
/**
|
||||
* \file amiga.c
|
||||
* \brief This file handles loading and saving of amiga files.
|
||||
* \ingroup imbuf
|
||||
* \warning This file contains endian code. Some way should be found to move
|
||||
* this code out of here.
|
||||
* \help Endian #defines are in multiple files!
|
||||
*/
|
||||
|
||||
#include "imbuf.h"
|
||||
#include "imbuf_patch.h"
|
||||
@ -56,23 +48,9 @@
|
||||
#endif
|
||||
|
||||
/* actually hard coded endianness */
|
||||
/**
|
||||
* \brief Makes a 4 bit id for a 32 bit value: Big-endian
|
||||
* \todo How is this used?
|
||||
*/
|
||||
#define GET_BIG_LONG(x) (((uchar *) (x))[0] << 24 | ((uchar *) (x))[1] << 16 | ((uchar *) (x))[2] << 8 | ((uchar *) (x))[3])
|
||||
/**
|
||||
* \brief Makes a 4 bit id for a 16? bit value: Little-endian
|
||||
* \todo How is this used?
|
||||
*/
|
||||
#define GET_LITTLE_LONG(x) (((uchar *) (x))[3] << 24 | ((uchar *) (x))[2] << 16 | ((uchar *) (x))[1] << 8 | ((uchar *) (x))[0])
|
||||
/**
|
||||
* \brief Converts between little and big endian: 32 bit values
|
||||
*/
|
||||
#define SWAP_L(x) (((x << 24) & 0xff000000) | ((x << 8) & 0xff0000) | ((x >> 8) & 0xff00) | ((x >> 24) & 0xff))
|
||||
/**
|
||||
* \brief Converts between little and big endian: 16 bit values
|
||||
*/
|
||||
#define SWAP_S(x) (((x << 8) & 0xff00) | ((x >> 8) & 0xff))
|
||||
|
||||
/* more endianness... should move to a separate file... */
|
||||
@ -412,16 +390,6 @@ static uchar *readbody(struct ImBuf *ibuf, uchar *body)
|
||||
return body;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Loads an amiga (.ami) image.
|
||||
* \ingroup imbuf
|
||||
* \param iffmem A pointer to a memory location.
|
||||
* \param flags A set of bit flags determining what parts of the image to load.
|
||||
* \return Returns 0 if loading the image fails, otherwise returns a pointer to an ImBuf.
|
||||
*
|
||||
* I am fairly certain of what is going on in this function, so if I am
|
||||
* wrong, please let me know, so I can update the docs!
|
||||
*/
|
||||
struct ImBuf *imb_loadamiga(int *iffmem,int flags)
|
||||
{
|
||||
int chunk,totlen,len,*cmap=0,cmaplen,*mem,ftype=0;
|
||||
@ -429,45 +397,16 @@ struct ImBuf *imb_loadamiga(int *iffmem,int flags)
|
||||
struct BitMapHeader bmhd;
|
||||
struct ImBuf *ibuf=0;
|
||||
|
||||
/**
|
||||
* \internal The memory address to the data is copiend into mem.
|
||||
*/
|
||||
mem = iffmem;
|
||||
/**
|
||||
* \internal The w member of the BitMapHeader is initialized to 0 because
|
||||
* it will be tested to see if it has been set later.
|
||||
*/
|
||||
bmhd.w = 0;
|
||||
|
||||
/**
|
||||
* \internal The first three chunks must have the form: FORMxxxxILBM
|
||||
* else the function returns with 0;
|
||||
* FORM and ILBM are defined in imbuf_patch.h
|
||||
*/
|
||||
if (GET_ID(mem) != FORM) return (0);
|
||||
if (GET_ID(mem+2) != ILBM) return (0);
|
||||
/**
|
||||
* \internal The second chunk is the total size of the image.
|
||||
*/
|
||||
totlen= (GET_BIG_LONG(mem+1) + 1) & ~1;
|
||||
/**
|
||||
* \internal mem is incremented to skip the first three chunks.
|
||||
*/
|
||||
mem += 3;
|
||||
/**
|
||||
* \internal Anyone know why the total length is decreased by four here?
|
||||
*/
|
||||
totlen -= 4;
|
||||
|
||||
|
||||
/**
|
||||
* \internal The while loop retrieves at most four blocks of memory:
|
||||
* - bmhd: the bit map header
|
||||
* - body: which is the image data
|
||||
* - cmap: the color map
|
||||
* - ftype: the file type (what does CAMG stand for?)
|
||||
* The body and the bitmap header are required.
|
||||
*/
|
||||
while(totlen > 0){
|
||||
chunk = GET_ID(mem);
|
||||
len= (GET_BIG_LONG(mem+1) + 1) & ~1;
|
||||
@ -500,36 +439,18 @@ struct ImBuf *imb_loadamiga(int *iffmem,int flags)
|
||||
break;
|
||||
}
|
||||
mem = (int *)((uchar *)mem +len);
|
||||
/**
|
||||
* \intern Anything after the first BODY ID is discarded.
|
||||
*/
|
||||
if (body) break;
|
||||
}
|
||||
/**
|
||||
* \internal After the while loop, the existance of body and bmhd are detected.
|
||||
*/
|
||||
if (bmhd.w == 0) return (0);
|
||||
if (body == 0) return (0);
|
||||
|
||||
/**
|
||||
* \internal if the IB_test bit is set in flags, don't do masking.
|
||||
* (I'm not too sure about this) In any case, allocate the memory
|
||||
* for the imbuf, and return 0 if this fails.
|
||||
*/
|
||||
if (flags & IB_test) ibuf = IMB_allocImBuf(bmhd.w, bmhd.h, bmhd.nPlanes, 0, 0);
|
||||
else ibuf = IMB_allocImBuf(bmhd.w, bmhd.h, bmhd.nPlanes + (bmhd.masking & 1),0,1);
|
||||
|
||||
if (ibuf == 0) return (0);
|
||||
|
||||
/**
|
||||
* \internal Set the AMI bit in ftype.
|
||||
*/
|
||||
ibuf->ftype = (ftype | AMI);
|
||||
|
||||
/**
|
||||
* \internal If there was a cmap chunk in the data, add the cmap
|
||||
* to the ImBuf and copy the data there.
|
||||
*/
|
||||
if (cmap){
|
||||
ibuf->mincol = 0;
|
||||
ibuf->maxcol = cmaplen;
|
||||
@ -540,21 +461,11 @@ struct ImBuf *imb_loadamiga(int *iffmem,int flags)
|
||||
imb_makecolarray(ibuf, cmap, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* \internal If the IB_test bit of flags was set, we're done:
|
||||
* If the IB_freem bit is set, free the data pointed to by iffmem.
|
||||
* Return the data.
|
||||
*/
|
||||
if (flags & IB_test){
|
||||
if (flags & IB_freem) free(iffmem);
|
||||
return(ibuf);
|
||||
}
|
||||
|
||||
/**
|
||||
* \internal Check the bitmap header to see if there is any
|
||||
* compression. 0 is no, 1 is horizontal, 2 is vertical.
|
||||
* Load the data according to the type of compression.
|
||||
*/
|
||||
switch (bmhd.compression){
|
||||
case 0:
|
||||
body= readbody(ibuf, body);
|
||||
@ -568,42 +479,23 @@ struct ImBuf *imb_loadamiga(int *iffmem,int flags)
|
||||
break;
|
||||
}
|
||||
|
||||
/**
|
||||
* \internal If the IB_freem bit is set, free the data pointed to by iffmem.
|
||||
*/
|
||||
if (flags & IB_freem) free(iffmem);
|
||||
|
||||
/**
|
||||
* \internal If there was some problem loading the body
|
||||
* data, free the memory already allocated in ibuf and
|
||||
* return 0.
|
||||
*/
|
||||
if (body == 0){
|
||||
free (ibuf);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* \internal Set the bit depth to the number of planes in bmhd.
|
||||
* This discards the "stencil" data (What is the stencil? Alpha channel?)
|
||||
*/
|
||||
/* forget stencil */
|
||||
ibuf->depth = bmhd.nPlanes;
|
||||
|
||||
/**
|
||||
* \internal If the IB_rect bit is set in flags, add the rect and
|
||||
* get rid of the planes.
|
||||
*/
|
||||
if (flags & IB_rect){
|
||||
imb_addrectImBuf(ibuf);
|
||||
imb_bptolong(ibuf);
|
||||
imb_freeplanesImBuf(ibuf);
|
||||
/**
|
||||
* \internal If the image has a color map, apply it.
|
||||
*/
|
||||
if (ibuf->cmap){
|
||||
if ((flags & IB_cmap) == 0) IMB_applycmap(ibuf);
|
||||
} else if (ibuf->depth == 18){ /** \internal No color map, and the bit depths is 18, convert to 24-bit */
|
||||
} else if (ibuf->depth == 18){
|
||||
int i,col;
|
||||
unsigned int *rect;
|
||||
|
||||
@ -615,7 +507,7 @@ struct ImBuf *imb_loadamiga(int *iffmem,int flags)
|
||||
*rect++ = col;
|
||||
}
|
||||
ibuf->depth = 24;
|
||||
} else if (ibuf->depth <= 8) { /** \internal No colormap and no 24 bits, so it's b&w */
|
||||
} else if (ibuf->depth <= 8) { /* no colormap and no 24 bits: b&w */
|
||||
uchar *rect;
|
||||
int size, shift;
|
||||
|
||||
@ -637,14 +529,8 @@ struct ImBuf *imb_loadamiga(int *iffmem,int flags)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \internal Anyone know what IB_ttob is? What does IMB_flipy do?
|
||||
*/
|
||||
if ((flags & IB_ttob) == 0) IMB_flipy(ibuf);
|
||||
|
||||
/**
|
||||
* \internal Last thing to do before returning is to flip the bits from rgba to abgr.
|
||||
*/
|
||||
if (ibuf) {
|
||||
if (ibuf->rect)
|
||||
IMB_convert_rgba_to_abgr(ibuf->x*ibuf->y, ibuf->rect);
|
||||
|
@ -29,33 +29,13 @@
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file B.blend.c
|
||||
* \brief DataToC output of file <B_blend>
|
||||
*
|
||||
* Contains the data to create the default initial .blend file that
|
||||
* is loaded. It contains the default user preferences and initial
|
||||
* blend screen with the plane and the camera.
|
||||
*
|
||||
* Referenced in usiblender.c
|
||||
* \ingroup defaultconfig
|
||||
*/
|
||||
/* DataToC output of file <B_blend> */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Array size.
|
||||
* This is generated automatically, and should not be changed.
|
||||
*/
|
||||
int datatoc_B_blend_size= 32472;
|
||||
|
||||
/**
|
||||
* The is an array of characters which creates the .blend file.
|
||||
* This is generated automatically, and should not be changed.
|
||||
*/
|
||||
char datatoc_B_blend[]= {
|
||||
66, 76, 69, 78, 68, 69, 82, 95,118, 50, 49, 50, 82, 69, 78, 68, 32, 0, 0, 0,136,237,255,191,
|
||||
0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,250, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
@ -29,27 +29,9 @@
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
/**
|
||||
* \file blenderbuttons.c
|
||||
* \brief DataToC output of file <blenderbuttons_png>
|
||||
*
|
||||
* Contains an array of image data used to create the buttons used in the
|
||||
* blender gui.
|
||||
*
|
||||
* Referenced in resources.c
|
||||
* \ingroup defaultconfig
|
||||
*/
|
||||
/* DataToC output of file <blenderbuttons_png> */
|
||||
|
||||
/**
|
||||
* Array size.
|
||||
* This is generated automatically, and should not be changed.
|
||||
*/
|
||||
int datatoc_blenderbuttons_size= 42002;
|
||||
|
||||
/**
|
||||
* The is an array of characters which creates the icon file.
|
||||
* This is generated automatically, and should not be changed.
|
||||
*/
|
||||
char datatoc_blenderbuttons[]= {
|
||||
137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0,
|
||||
1,190, 0, 0, 0,242, 8, 2, 0, 0, 0,189, 2, 55, 29, 0, 0, 0, 9,112, 72, 89,115, 0, 0, 11, 19, 0, 0, 11, 19, 1,
|
||||
|
@ -28,24 +28,9 @@
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file mainqueue.c
|
||||
* \brief Just the functions to maintain a central event queue.
|
||||
*
|
||||
* Creates the functionality of a FIFO queue for events.
|
||||
*
|
||||
* \note The documentor (me) doesn't know the full description of
|
||||
* the fields of the QEvent structure, and the parameters to the
|
||||
* functions (event, val, ascii). The comments should be updated
|
||||
* with more detailed descriptions of what is stored in each one.
|
||||
*
|
||||
* \warning This queue structure uses a method that assumes the presence
|
||||
* of allocated memory. As well it doesn't de-allocate memory after
|
||||
* a read off of the queue, thereby causing a situation whereby memory
|
||||
* isn't being freed and can grow with out bound even though there is
|
||||
* a limit on the queue size.
|
||||
* Just the functions to maintain a central event
|
||||
* queue.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -56,49 +41,15 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \struct QEvent
|
||||
* \brief This is the definition for the event queue datastructure
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* \var unsigned short event
|
||||
* \brief holds the event type
|
||||
*/
|
||||
unsigned short event;
|
||||
/**
|
||||
* \var short val
|
||||
*/
|
||||
short val;
|
||||
/**
|
||||
* \var char ascii
|
||||
*/
|
||||
char ascii;
|
||||
} QEvent;
|
||||
|
||||
/**
|
||||
* \var static QEvent mainqueue[MAXQUEUE]
|
||||
* \brief The Main Queue store.
|
||||
*/
|
||||
static QEvent mainqueue[MAXQUEUE];
|
||||
|
||||
/**
|
||||
* \var static unsigned int nevents=0
|
||||
* \brief The count of the events currently stored.
|
||||
*/
|
||||
static unsigned int nevents= 0;
|
||||
|
||||
/**
|
||||
* \brief Reads and removes events from the queue and returns the event type,
|
||||
* if the queue is empty return 0.
|
||||
* \param val the val of the event to read into.
|
||||
* \param ascii the buffer of the event to read into.
|
||||
* \return the event type or 0 if no event.
|
||||
*
|
||||
* Pops off the last item in the queue and returns the pieces in their
|
||||
* little parts. The last item was the oldest item in the queue.
|
||||
*
|
||||
*/
|
||||
unsigned short mainqread(short *val, char *ascii)
|
||||
{
|
||||
if (nevents) {
|
||||
@ -111,24 +62,11 @@ unsigned short mainqread(short *val, char *ascii)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief A short cut to mainqenter_ext setting ascii to 0
|
||||
*/
|
||||
void mainqenter(unsigned short event, short val)
|
||||
{
|
||||
mainqenter_ext(event, val, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Adds event to the beginning of the queue.
|
||||
* \param event the event type.
|
||||
* \param val the val of the event.
|
||||
* \param ascii the event characters.
|
||||
*
|
||||
* If the event isn't nothing, and if the queue still
|
||||
* has some room, then add to the queue. Otherwise the
|
||||
* event is lost.
|
||||
*/
|
||||
void mainqenter_ext(unsigned short event, short val, char ascii)
|
||||
{
|
||||
if (!event)
|
||||
@ -144,19 +82,6 @@ void mainqenter_ext(unsigned short event, short val, char ascii)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Pushes and event back on to the front of the queue.
|
||||
* \param event
|
||||
* \param val
|
||||
* \param ascii
|
||||
*
|
||||
* Pushes an event back onto the queue, possibly after a peek
|
||||
* at the item. This method assumes that the memory has already
|
||||
* been allocated and should be mentioned in a precondition.
|
||||
*
|
||||
* \pre This method assumes that the memory is already allocated
|
||||
* for the event.
|
||||
*/
|
||||
void mainqpushback(unsigned short event, short val, char ascii)
|
||||
{
|
||||
if (nevents<MAXQUEUE) {
|
||||
@ -167,12 +92,6 @@ void mainqpushback(unsigned short event, short val, char ascii)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Returns the event type from the last item in the queue
|
||||
* (the next one that would be popped off). Probably used as a test
|
||||
* to see if the queue is empty or if a valid event is still around.
|
||||
* \return the event type of the last item in the queue
|
||||
*/
|
||||
unsigned short mainqtest()
|
||||
{
|
||||
if (nevents)
|
||||
|
@ -29,31 +29,14 @@
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
/**
|
||||
* \file buildinfo.c
|
||||
* \brief Info on the date, time, os, and type of blender build.
|
||||
* \ingroup mainmodule
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_DATE
|
||||
/**
|
||||
* Global build date.
|
||||
*/
|
||||
char * build_date=BUILD_DATE;
|
||||
/**
|
||||
* Global build time.
|
||||
*/
|
||||
char * build_time=BUILD_TIME;
|
||||
/**
|
||||
* Global build platform.
|
||||
*/
|
||||
char * build_platform=BUILD_PLATFORM;
|
||||
/**
|
||||
* Global build type.
|
||||
*/
|
||||
char * build_type=BUILD_TYPE;
|
||||
#endif
|
||||
|
@ -29,23 +29,6 @@
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
/**
|
||||
* \file creator.c
|
||||
* \ingroup mainmodule
|
||||
* \brief The main blender function is defined here.
|
||||
*
|
||||
* This file contains the int main(int,char**) function along with some helper
|
||||
* functions.
|
||||
*
|
||||
* For some reason, doxygen wants to say that the build_* info variables are
|
||||
* defined here. They are really defined in buildinfo.c
|
||||
* \todo clear out unnecessary includes
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* \defgroup main_helpers Helpers
|
||||
* \ingroup mainmodule
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -127,45 +110,17 @@ extern char * build_platform;
|
||||
extern char * build_type;
|
||||
|
||||
/* Local Function prototypes */
|
||||
|
||||
/**
|
||||
* \brief Prints help message
|
||||
*
|
||||
* Prints a help message to the prompt when triggered by the switches:
|
||||
* - "-h"
|
||||
* - "--help"
|
||||
* - "/?"
|
||||
*
|
||||
* \todo document -nofrozen switch
|
||||
*/
|
||||
static void print_help();
|
||||
|
||||
/* for the callbacks: */
|
||||
|
||||
/**
|
||||
* \brief For callback functions. What does this do?
|
||||
* \ingroup main_helpers
|
||||
* \ingroup undoc
|
||||
*/
|
||||
extern int pluginapi_force_ref(void); /* from blenpluginapi:pluginapi.c */
|
||||
|
||||
/**
|
||||
* \brief Holds the blender program name.
|
||||
*
|
||||
* Copied from argv[0]. Used for playanim and creting runtimes.
|
||||
*/
|
||||
char bprogname[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char bprogname[FILE_MAXDIR+FILE_MAXFILE]; /* from blenpluginapi:pluginapi.c */
|
||||
|
||||
/** \brief Initialise callbacks for the modules that need them */
|
||||
/* Initialise callbacks for the modules that need them */
|
||||
void setCallbacks(void);
|
||||
|
||||
/**
|
||||
* \brief Used for trapping the SIGFPE signal.
|
||||
*
|
||||
* This function is passed to signal() on the following platforms:
|
||||
* - Alpha Linux
|
||||
* - SGI
|
||||
*/
|
||||
static void fpe_handler(int sig)
|
||||
{
|
||||
// printf("SIGFPE trapped\n");
|
||||
@ -217,50 +172,21 @@ static void print_help(void)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \todo This function is neither used nor defined in this file!
|
||||
* It is declared in source/blender/blenlib/PIL_time.h
|
||||
* It is defined in source/blender/blenlib/intern/time.c
|
||||
* Should this be here?
|
||||
*
|
||||
*/
|
||||
double PIL_check_seconds_timer(void);
|
||||
|
||||
/* This is defined in: ??? */
|
||||
extern void winlay_get_screensize(int *width_r, int *height_r);
|
||||
|
||||
/**
|
||||
* \brief The main blender function.
|
||||
*
|
||||
* This is function is compiled into the blender executable. It handles
|
||||
* command line arugments and initialization.
|
||||
*/
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int a, i, stax, stay, sizx, sizy;
|
||||
SYS_SystemHandle syshandle;
|
||||
Scene *sce;
|
||||
|
||||
/**
|
||||
* First step is to initialize platform specific variables and functions, and to
|
||||
* set the callbacks.
|
||||
*/
|
||||
/**
|
||||
* \internal - Turn on audio for WIN32 and linux
|
||||
*/
|
||||
#if defined(WIN32) || defined (__linux__)
|
||||
int audio = 1;
|
||||
#else
|
||||
int audio = 0;
|
||||
#endif
|
||||
/**
|
||||
* \internal - Call the setCallbacks() function
|
||||
*/
|
||||
setCallbacks();
|
||||
/**
|
||||
* \internal Do some apple specific initialization.
|
||||
* \todo Does anyone know why the first #ifdef __APPLE__ is here?
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
/* patch to ignore argument finder gives us (pid?) */
|
||||
if (argc==2 && strncmp(argv[1], "-psn_", 5)==0) {
|
||||
@ -281,9 +207,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \internal OS specific stuff for FreeBSD, Linux alpha, and sgi.
|
||||
*/
|
||||
#ifdef __FreeBSD__
|
||||
fpsetmask(0);
|
||||
#endif
|
||||
@ -296,40 +219,23 @@ int main(int argc, char **argv)
|
||||
signal (SIGFPE, fpe_handler);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \internal copy path to executable in bprogname. playanim and creting runtimes need this.
|
||||
*/
|
||||
// copy path to executable in bprogname. playanim and creting runtimes
|
||||
// need this.
|
||||
|
||||
BLI_where_am_i(bprogname, argv[0]);
|
||||
|
||||
/** \internal Hack - force inclusion of the plugin api functions,
|
||||
* \internal see blenpluginapi:pluginapi.c
|
||||
* \todo pluginapi_force_ref() is defined as a hack. Fix this?
|
||||
/* Hack - force inclusion of the plugin api functions,
|
||||
* see blenpluginapi:pluginapi.c
|
||||
*/
|
||||
pluginapi_force_ref();
|
||||
|
||||
/**
|
||||
* Initialize globals, get the system handle and initialize the messaging system.
|
||||
*/
|
||||
initglobals(); /* blender.c */
|
||||
|
||||
syshandle = SYS_GetSystem();
|
||||
GEN_init_messaging_system();
|
||||
|
||||
/* first test for background */
|
||||
/** \internal The G_SCENESCRIPT is always set. */
|
||||
G.f |= G_SCENESCRIPT; /* scenescript always set! */
|
||||
/**
|
||||
* The first for loop parses thru the following command line arguments:
|
||||
* - "-h", "--help", and "/?": prints a help message.
|
||||
* - "-a": plays animations (only when it's before the -b switch).
|
||||
* - "-b", "-B": sets blender to run in background mode.
|
||||
* - "-m": obsolete switch.
|
||||
* - "-y": disables python.
|
||||
* - "-Y": explains \e why "-y" is used to disable python.
|
||||
* \todo Put the -h, --help, and /? flags in one if statment.
|
||||
* \todo -a has 2 different meanings, depending on context.
|
||||
* \todo The -m switch has been disabled. Is there any reason to keep it here?
|
||||
*/
|
||||
for(a=1; a<argc; a++) {
|
||||
|
||||
/* Handle unix and windows style help requests */
|
||||
@ -388,29 +294,13 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a few more options.
|
||||
*/
|
||||
#ifdef __sgi
|
||||
setuid(getuid()); /* end superuser */
|
||||
#endif
|
||||
|
||||
RE_init_render_data(); /** Render initializer must be called here because R.winpos from default file */
|
||||
RE_init_render_data(); /* must be called here because R.winpos from default file */
|
||||
|
||||
/**
|
||||
* If blender is not in background:
|
||||
*/
|
||||
if(G.background==0) {
|
||||
/**
|
||||
* Parse the following command line arguments:
|
||||
* - "-p": set the prefered window location and size.
|
||||
* - "-d": enables debugging.
|
||||
* - "-w": fullscreen mode.
|
||||
* - "-W": borderless window (MS windows only).
|
||||
* - "-R": registers the blender extensions. (MS windows only).
|
||||
* - "-noaudion", "-nosound": disables audio.
|
||||
* - "-nofrozen": disables frozen python.
|
||||
*/
|
||||
for(a=1; a<argc; a++) {
|
||||
if(argv[a][0] == '-') {
|
||||
switch(argv[a][1]) {
|
||||
@ -470,9 +360,9 @@ int main(int argc, char **argv)
|
||||
case 'N':
|
||||
if (strcasecmp(argv[a], "-noaudio") == 0|| strcasecmp(argv[a], "-nosound") == 0) {
|
||||
/**
|
||||
* \internal The noaudio flag notifies the gameengine that no audio is wanted,
|
||||
* even if the user didn't give the flag -g noaudio.
|
||||
*/
|
||||
notify the gameengine that no audio is wanted, even if the user didn't give
|
||||
the flag -g noaudio.
|
||||
*/
|
||||
|
||||
SYS_WriteCommandLineInt(syshandle,"noaudio",1);
|
||||
audio = 0;
|
||||
@ -488,9 +378,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the python module, and initialize audio and BIF_init().
|
||||
*/
|
||||
BPY_start_python();
|
||||
|
||||
/**
|
||||
@ -502,11 +389,6 @@ int main(int argc, char **argv)
|
||||
|
||||
BIF_init();
|
||||
}
|
||||
/**
|
||||
* If blender is in background:
|
||||
* - Start python.
|
||||
* - Turn audio off.
|
||||
*/
|
||||
else {
|
||||
BPY_start_python();
|
||||
SYS_WriteCommandLineInt(syshandle,"noaudio",1);
|
||||
@ -515,9 +397,6 @@ int main(int argc, char **argv)
|
||||
if (G.f & G_DEBUG) printf("setting audio to: %d\n", audio);
|
||||
}
|
||||
|
||||
/**
|
||||
* Next, initialize more stuff :)
|
||||
*/
|
||||
RE_init_filt_mask();
|
||||
|
||||
#ifdef WITH_QUICKTIME
|
||||
@ -543,17 +422,6 @@ int main(int argc, char **argv)
|
||||
|
||||
/* OK we are ready for it */
|
||||
|
||||
/**
|
||||
* The third and final for loop processes the following arguments:
|
||||
* - "-p" (again): This time four args are skipped and then break;
|
||||
* - "-g": passes arguments to the game engine.
|
||||
* - "-f": renders a single frame and saves it.
|
||||
* - "-a": renders an animation. "-b" must be before "-a"
|
||||
* - "-S": sets the starting scene name.
|
||||
* - "-s": sets the start frame.
|
||||
* - "-e": sets the end frame.
|
||||
* - <file>: sets the blender file to open.
|
||||
*/
|
||||
for(a=1; a<argc; a++) {
|
||||
if (G.afbreek==1) break;
|
||||
|
||||
@ -566,13 +434,13 @@ int main(int argc, char **argv)
|
||||
case 'g':
|
||||
{
|
||||
/**
|
||||
* gameengine parameters are automaticly put into system
|
||||
* -g [paramname = value]
|
||||
* -g [boolparamname]
|
||||
* example:
|
||||
* -g novertexarrays
|
||||
* -g maxvertexarraysize = 512
|
||||
*/
|
||||
gameengine parameters are automaticly put into system
|
||||
-g [paramname = value]
|
||||
-g [boolparamname]
|
||||
example:
|
||||
-g novertexarrays
|
||||
-g maxvertexarraysize = 512
|
||||
*/
|
||||
|
||||
if(++a < argc)
|
||||
{
|
||||
@ -649,50 +517,29 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* If the argument does not begin with a dash, it must be a file name.
|
||||
*/
|
||||
else {
|
||||
BKE_read_file(argv[a], NULL);
|
||||
sound_initialize_sounds();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If blender is in background mode, exit.
|
||||
*/
|
||||
if(G.background)
|
||||
{
|
||||
exit_usiblender();
|
||||
}
|
||||
|
||||
/**
|
||||
* Otherwise, initialize the GUI.
|
||||
*/
|
||||
setscreen(G.curscreen);
|
||||
|
||||
/**
|
||||
* \internal if no scene exists, add one called "1".
|
||||
*/
|
||||
if(G.main->scene.first==0) {
|
||||
sce= add_scene("1");
|
||||
set_scene(sce);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the main GUI loop.
|
||||
*/
|
||||
screenmain();
|
||||
|
||||
/**
|
||||
* If everything went well, return with 0.
|
||||
*/
|
||||
return 0;
|
||||
} /* end of int main(argc,argv) */
|
||||
|
||||
/**
|
||||
* Helper function for setCallbacks().
|
||||
*/
|
||||
static void error_cb(char *err)
|
||||
{
|
||||
error("%s", err);
|
||||
|
Loading…
Reference in New Issue
Block a user