2002-10-12 11:37:38 +00:00
/**
* blenlib / DNA_ID . h ( mar - 2001 nzc )
*
2006-11-17 04:46:48 +00:00
* ID and Library types , which are fundamental for sdna ,
2002-10-12 11:37:38 +00:00
*
2006-11-17 04:46:48 +00:00
* $ Id $
2002-10-12 11:37:38 +00:00
*
2008-04-16 22:40:48 +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
2008-04-16 22:40:48 +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 .
*
* Contributor ( s ) : none yet .
*
2008-04-16 22:40:48 +00:00
* * * * * * END GPL LICENSE BLOCK * * * * *
2002-10-12 11:37:38 +00:00
*/
# ifndef DNA_ID_H
# define DNA_ID_H
2006-11-17 04:46:48 +00:00
# include "DNA_listBase.h"
2002-10-12 11:37:38 +00:00
# ifdef __cplusplus
extern " C " {
# endif
struct Library ;
struct FileData ;
2006-11-17 04:46:48 +00:00
struct ID ;
typedef struct IDPropertyData {
void * pointer ;
ListBase group ;
int val , pad ;
} IDPropertyData ;
typedef struct IDProperty {
struct IDProperty * next , * prev ;
char name [ 32 ] ;
char type , subtype ;
short flag ;
2007-04-24 14:52:35 +00:00
int saved ; /*saved is used to indicate if this struct has been saved yet.
seemed like a good idea as a pad var was needed anyway : ) */
IDPropertyData data ; /* note, alignment for 64 bits */
2006-11-17 04:46:48 +00:00
int len ; /* array length, also (this is important!) string length + 1.
the idea is to be able to reuse array realloc functions on strings . */
/*totallen is total length of allocated array/string, including a buffer.
Note that the buffering is mild ; the code comes from python ' s list implementation . */
int totallen ; /*strings and arrays are both buffered, though the buffer isn't
2007-07-09 20:42:14 +00:00
saved . */
2006-11-17 04:46:48 +00:00
} IDProperty ;
# define MAX_IDPROP_NAME 32
# define DEFAULT_ALLOC_FOR_NULL_STRINGS 64
/*->type*/
# define IDP_STRING 0
# define IDP_INT 1
# define IDP_FLOAT 2
# define IDP_ARRAY 5
# define IDP_GROUP 6
2007-07-09 20:42:14 +00:00
/*the ID link property type hasn't been implemented yet, this will require
some cleanup of blenkernel , most likely . */
2006-11-17 04:46:48 +00:00
# define IDP_ID 7
/*add any future new id property types here.*/
2002-10-12 11:37:38 +00:00
2003-04-27 11:55:33 +00:00
/* watch it: Sequence has identical beginning. */
2002-10-12 11:37:38 +00:00
/**
* ID is the first thing included in all serializable types . It
* provides a common handle to place all data in double - linked lists .
* */
2006-11-17 04:46:48 +00:00
/* There's a nasty circular dependency here.... void* to the rescue! I
* really wonder why this is needed . */
2002-10-12 11:37:38 +00:00
typedef struct ID {
void * next , * prev ;
struct ID * newid ;
struct Library * lib ;
char name [ 24 ] ;
short us ;
/**
* LIB_ . . . flags report on status of the datablock this ID belongs
* to .
*/
short flag ;
2005-12-21 22:21:43 +00:00
int icon_id ;
2006-11-17 04:46:48 +00:00
IDProperty * properties ;
2002-10-12 11:37:38 +00:00
} ID ;
/**
2003-04-27 11:55:33 +00:00
* For each library file used , a Library struct is added to Main
2006-12-01 10:12:41 +00:00
* WARNING : readfile . c , expand_doit ( ) reads this struct without DNA check !
2002-10-12 11:37:38 +00:00
*/
typedef struct Library {
ID id ;
ID * idblock ;
struct FileData * filedata ;
2006-12-01 10:12:41 +00:00
char name [ 240 ] ; /* reveiled in the UI, can store relative path */
char filename [ 240 ] ; /* expanded name, not relative, used while reading */
int tot , pad ; /* tot, idblock and filedata are only fo read and write */
struct Library * parent ; /* for outliner, showing dependency */
2002-10-12 11:37:38 +00:00
} Library ;
2007-09-02 17:25:03 +00:00
# define PREVIEW_MIPMAPS 2
# define PREVIEW_MIPMAP_ZERO 0
# define PREVIEW_MIPMAP_LARGE 1
typedef struct PreviewImage {
unsigned int w [ 2 ] ;
unsigned int h [ 2 ] ;
short changed [ 2 ] ;
short pad0 , pad1 ;
unsigned int * rect [ 2 ] ;
} PreviewImage ;
2002-10-12 11:37:38 +00:00
/**
* Defines for working with IDs .
*
* The tags represent types ! This is a dirty way of enabling RTTI . The
* sig_byte end endian defines aren ' t really used much .
*
* */
2008-03-23 12:59:26 +00:00
# if defined(__sgi) || defined(__sparc) || defined(__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__hppa__) || defined (__BIG_ENDIAN__)
2002-10-12 11:37:38 +00:00
/* big endian */
# define MAKE_ID2(c, d) ( (c)<<8 | (d) )
# define MOST_SIG_BYTE 0
# define BBIG_ENDIAN
# else
/* little endian */
# define MAKE_ID2(c, d) ( (d)<<8 | (c) )
# define MOST_SIG_BYTE 1
# define BLITTLE_ENDIAN
# endif
2006-11-25 13:07:28 +00:00
/* ID from database */
2002-10-12 11:37:38 +00:00
# define ID_SCE MAKE_ID2('S', 'C')
# define ID_LI MAKE_ID2('L', 'I')
# define ID_OB MAKE_ID2('O', 'B')
# define ID_ME MAKE_ID2('M', 'E')
# define ID_CU MAKE_ID2('C', 'U')
# define ID_MB MAKE_ID2('M', 'B')
# define ID_MA MAKE_ID2('M', 'A')
# define ID_TE MAKE_ID2('T', 'E')
# define ID_IM MAKE_ID2('I', 'M')
# define ID_IK MAKE_ID2('I', 'K')
# define ID_WV MAKE_ID2('W', 'V')
# define ID_LT MAKE_ID2('L', 'T')
# define ID_SE MAKE_ID2('S', 'E')
# define ID_LF MAKE_ID2('L', 'F')
# define ID_LA MAKE_ID2('L', 'A')
# define ID_CA MAKE_ID2('C', 'A')
# define ID_IP MAKE_ID2('I', 'P')
# define ID_KE MAKE_ID2('K', 'E')
# define ID_WO MAKE_ID2('W', 'O')
# define ID_SCR MAKE_ID2('S', 'R')
# define ID_VF MAKE_ID2('V', 'F')
# define ID_TXT MAKE_ID2('T', 'X')
# define ID_SO MAKE_ID2('S', 'O')
# define ID_GR MAKE_ID2('G', 'R')
# define ID_ID MAKE_ID2('I', 'D')
# define ID_AR MAKE_ID2('A', 'R')
# define ID_AC MAKE_ID2('A', 'C')
2003-12-14 01:18:09 +00:00
# define ID_SCRIPT MAKE_ID2('P', 'Y')
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
# define ID_NT MAKE_ID2('N', 'T')
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
# define ID_BR MAKE_ID2('B', 'R')
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
# define ID_PA MAKE_ID2('P', 'A')
2002-10-12 11:37:38 +00:00
2005-10-10 18:05:30 +00:00
/* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */
# define ID_SEQ MAKE_ID2('S', 'Q')
/* constraint */
# define ID_CO MAKE_ID2('C', 'O')
/* pose (action channel, used to be ID_AC in code, so we keep code for backwards compat) */
# define ID_PO MAKE_ID2('A', 'C')
/* used in outliner... */
# define ID_NLA MAKE_ID2('N', 'L')
2006-11-25 13:07:28 +00:00
/* fluidsim Ipo */
# define ID_FLUIDSIM MAKE_ID2('F', 'S')
2005-10-10 18:05:30 +00:00
2006-08-20 15:22:56 +00:00
/*#ifdef WITH_VERSE*/
# define ID_VS MAKE_ID2('V', 'S') /* fake id for VerseSession, needed for outliner */
# define ID_VN MAKE_ID2('V', 'N') /* fake id for VerseNode, needed for outliner */
2006-10-12 11:53:50 +00:00
# define ID_MS MAKE_ID2('M', 'S') /* fake id for VerseServer root entry, needed for outliner */
# define ID_SS MAKE_ID2('S', 'S') /* fake id for VerseServer entry, needed for ountliner */
2006-08-20 15:22:56 +00:00
/*#endif*/
2005-10-10 18:05:30 +00:00
2003-04-27 11:55:33 +00:00
/* id->flag: set frist 8 bits always at zero while reading */
2002-10-12 11:37:38 +00:00
# define LIB_LOCAL 0
# define LIB_EXTERN 1
# define LIB_INDIRECT 2
# define LIB_TEST 8
# define LIB_TESTEXT 9
# define LIB_TESTIND 10
# define LIB_READ 16
# define LIB_NEEDLINK 32
# define LIB_NEW 256
# define LIB_FAKEUSER 512
2003-04-27 11:55:33 +00:00
/* free test flag */
2002-10-12 11:37:38 +00:00
# define LIB_DOIT 1024
2007-04-07 17:35:47 +00:00
/* */
# define LIB_APPEND_TAG 2048
2002-10-12 11:37:38 +00:00
# ifdef __cplusplus
}
# endif
# endif
2002-10-30 02:07:20 +00:00