diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-09-19 02:25:49 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-09-19 02:25:49 +0400 |
commit | be50ce61be7fdc96943dbdac79aabd88ba29996f (patch) | |
tree | 4dfde72478458923a3b2ce8d22e1658d4508024c /source/blender/makesdna | |
parent | 0a4d70f4d0ddc5bc709b162d84ec334e66ed848d (diff) |
Merged
https://svn.blender.org/svnroot/bf-blender/branches/soc-2008-mxcurioni (r22789) and
https://svn.blender.org/svnroot/bf-blender/trunk/blender (r23338)
with the "Ignore ancestry" and "Ignore line endings" options enabled (using
TortoiseSVN on Windows).
After the merge operation, all changes (i.e., deletion) in source/blender/freestyle/
were reverted in order to keep the primary source tree of the Freestyle renderer.
Diffstat (limited to 'source/blender/makesdna')
60 files changed, 5393 insertions, 1330 deletions
diff --git a/source/blender/makesdna/CMakeLists.txt b/source/blender/makesdna/CMakeLists.txt index a1afa37e5e6..1f8ab831ba6 100644 --- a/source/blender/makesdna/CMakeLists.txt +++ b/source/blender/makesdna/CMakeLists.txt @@ -24,4 +24,4 @@ # # ***** END GPL LICENSE BLOCK ***** -SUBDIRS(intern) +ADD_SUBDIRECTORY(intern) diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 3054e038ba2..0c38421a3f5 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -51,9 +51,9 @@ typedef struct IDPropertyData { typedef struct IDProperty { struct IDProperty *next, *prev; - char name[32]; char type, subtype; short flag; + char name[32]; 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 */ @@ -69,17 +69,19 @@ typedef struct IDProperty { #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 -/*the ID link property type hasn't been implemented yet, this will require - some cleanup of blenkernel, most likely.*/ -#define IDP_ID 7 -#define IDP_DOUBLE 8 - -/*add any future new id property types here.*/ +#define IDP_STRING 0 +#define IDP_INT 1 +#define IDP_FLOAT 2 +#define IDP_ARRAY 5 +#define IDP_GROUP 6 +/* the ID link property type hasn't been implemented yet, this will require + some cleanup of blenkernel, most likely.*/ +#define IDP_ID 7 +#define IDP_DOUBLE 8 +#define IDP_IDPARRAY 9 +#define IDP_NUMTYPES 10 + +/* add any future new id property types here.*/ /* watch it: Sequence has identical beginning. */ /** @@ -87,6 +89,8 @@ typedef struct IDProperty { * provides a common handle to place all data in double-linked lists. * */ +#define MAX_ID_NAME 24 + /* There's a nasty circular dependency here.... void* to the rescue! I * really wonder why this is needed. */ typedef struct ID { @@ -112,7 +116,7 @@ typedef struct Library { ID id; ID *idblock; struct FileData *filedata; - char name[240]; /* reveiled in the UI, can store relative path */ + char name[240]; /* revealed 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 */ @@ -151,37 +155,37 @@ typedef struct PreviewImage { #endif /* ID from database */ -#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') -#define ID_SCRIPT MAKE_ID2('P', 'Y') -#define ID_NT MAKE_ID2('N', 'T') -#define ID_BR MAKE_ID2('B', 'R') -#define ID_PA MAKE_ID2('P', 'A') +#define ID_SCE MAKE_ID2('S', 'C') /* Scene */ +#define ID_LI MAKE_ID2('L', 'I') /* Library */ +#define ID_OB MAKE_ID2('O', 'B') /* Object */ +#define ID_ME MAKE_ID2('M', 'E') /* Mesh */ +#define ID_CU MAKE_ID2('C', 'U') /* Curve */ +#define ID_MB MAKE_ID2('M', 'B') /* MetaBall */ +#define ID_MA MAKE_ID2('M', 'A') /* Material */ +#define ID_TE MAKE_ID2('T', 'E') /* Texture */ +#define ID_IM MAKE_ID2('I', 'M') /* Image */ +#define ID_WV MAKE_ID2('W', 'V') /* Wave (unused) */ +#define ID_LT MAKE_ID2('L', 'T') /* Lattice */ +#define ID_LA MAKE_ID2('L', 'A') /* Lamp */ +#define ID_CA MAKE_ID2('C', 'A') /* Camera */ +#define ID_IP MAKE_ID2('I', 'P') /* Ipo (depreciated, replaced by FCurves) */ +#define ID_KE MAKE_ID2('K', 'E') /* Key (shape key) */ +#define ID_WO MAKE_ID2('W', 'O') /* World */ +#define ID_SCR MAKE_ID2('S', 'R') /* Screen */ +#define ID_SCRN MAKE_ID2('S', 'N') /* (depreciated?) */ +#define ID_VF MAKE_ID2('V', 'F') /* VectorFont */ +#define ID_TXT MAKE_ID2('T', 'X') /* Text */ +#define ID_SO MAKE_ID2('S', 'O') /* Sound */ +#define ID_GR MAKE_ID2('G', 'R') /* Group */ +#define ID_ID MAKE_ID2('I', 'D') /* (internal use only) */ +#define ID_AR MAKE_ID2('A', 'R') /* Armature */ +#define ID_AC MAKE_ID2('A', 'C') /* Action */ +#define ID_SCRIPT MAKE_ID2('P', 'Y') /* Script (depreciated) */ +#define ID_NT MAKE_ID2('N', 'T') /* NodeTree */ +#define ID_BR MAKE_ID2('B', 'R') /* Brush */ +#define ID_PA MAKE_ID2('P', 'A') /* ParticleSettings */ +#define ID_GD MAKE_ID2('G', 'D') /* GreasePencil */ +#define ID_WM MAKE_ID2('W', 'M') /* WindowManager */ /* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */ #define ID_SEQ MAKE_ID2('S', 'Q') @@ -194,15 +198,6 @@ typedef struct PreviewImage { /* fluidsim Ipo */ #define ID_FLUIDSIM MAKE_ID2('F', 'S') - -/*#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 */ -#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 */ -/*#endif*/ - - /* id->flag: set frist 8 bits always at zero while reading */ #define LIB_LOCAL 0 #define LIB_EXTERN 1 diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 4a10ecf2368..318204e3dd8 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -22,6 +22,7 @@ * * Contributor(s): Original design: Reevan McKay * Contributor(s): Full recode, Ton Roosendaal, Crete 2005 + * Contributor(s): Animation recode, Joshua Leung * * ***** END GPL LICENSE BLOCK ***** */ @@ -39,12 +40,69 @@ struct SpaceLink; struct Object; -/* -------------- Poses ----------------- */ +/* ************************************************ */ +/* Visualisation */ -/* PoseChannel stores the results of Actions (ipos) and transform information - with respect to the restposition of Armature bones */ +/* Motion Paths ------------------------------------ */ +/* (used for Pose Channels and Objects) */ + +/* Data point for motion path */ +typedef struct bMotionPathVert { + float co[3]; /* coordinates of point in 3D-space */ + int flag; /* quick settings */ +} bMotionPathVert; + +/* Motion Path data cache - for elements providing transforms (i.e. Objects or PoseChannels) */ +typedef struct bMotionPath { + bMotionPathVert *points; /* path samples */ + int length; /* the number of cached verts */ + + int start_frame; /* for drawing paths, the start frame number */ + int end_frame; /* for drawing paths, the end frame number */ + + int flag; /* extra settings */ +} bMotionPath; + + + +/* Animation Visualisation Settings - for Objects or Armatures (not PoseChannels) */ +typedef struct bAnimVizSettings { + int pad; + int pathflag; /* eMotionPath_Settings */ + + int pathsf, pathef; /* start and end frames of path-calculation range */ + int pathbc, pathac; /* number of frames before/after current frame of path-calculation */ +} bAnimVizSettings; + +/* bMotionPathSettings->flag */ +typedef enum eMotionPath_Settings { + /* show frames on path */ + MOTIONPATH_FLAG_FNUMS = (1<<0), + /* show keyframes on path */ + MOTIONPATH_FLAG_KFRAS = (1<<1), + /* for bones - calculate head-points for curves instead of tips */ + MOTIONPATH_FLAG_HEADS = (1<<2), + /* show path around current frame */ + MOTIONPATH_FLAG_ACFRA = (1<<3), + /* show keyframe/frame numbers */ + MOTIONPATH_FLAG_KFNOS = (1<<4) +} eMotionPath_Settings; + +/* ************************************************ */ +/* Poses */ + +/* PoseChannel ------------------------------------ */ + +/* PoseChannel + * + * A PoseChannel stores the results of Actions and transform information + * with respect to the restposition of Armature bones + */ typedef struct bPoseChannel { struct bPoseChannel *next, *prev; + + IDProperty *prop; /* User-Defined Properties on this PoseChannel */ + ListBase constraints;/* Constraints that act on this PoseChannel */ char name[32]; /* Channels need longer names than normal blender objects */ @@ -70,9 +128,13 @@ typedef struct bPoseChannel { void *dual_quat; void *b_bone_dual_quats; - float loc[3]; /* written in by actions or transform */ + float loc[3]; /* transforms - written in by actions or transform */ float size[3]; + + float eul[3]; /* rotations - written in by actions or transform (but only euler/quat in use at any one time!) */ float quat[4]; + short rotmode; /* for now either quat (0), or xyz-euler (1) */ + short pad; float chan_mat[4][4]; /* matrix result of loc/quat/size , and where we put deform in, see next line */ float pose_mat[4][4]; /* constraints accumulate here. in the end, pose_mat = bone->arm_mat * chan_mat */ @@ -89,7 +151,73 @@ typedef struct bPoseChannel { struct Object *custom; /* draws custom object instead of this channel */ } bPoseChannel; -/* Pose-Object. It is only found under ob->pose. It is not library data, even + +/* PoseChannel (transform) flags */ +typedef enum ePchan_Flag { + POSE_LOC = 0x0001, + POSE_ROT = 0x0002, + POSE_SIZE = 0x0004, + POSE_IK_MAT = 0x0008, + POSE_UNUSED2 = 0x0010, + POSE_UNUSED3 = 0x0020, + POSE_UNUSED4 = 0x0040, + POSE_UNUSED5 = 0x0080, + POSE_HAS_IK = 0x0100, + POSE_CHAIN = 0x0200, + POSE_DONE = 0x0400, + POSE_KEY = 0x1000, + POSE_STRIDE = 0x2000 +} ePchan_Flag; + +/* PoseChannel constflag (constraint detection) */ +typedef enum ePchan_ConstFlag { + PCHAN_HAS_IK = (1<<0), + PCHAN_HAS_CONST = (1<<1), + /* only used for drawing Posemode, not stored in channel */ + PCHAN_HAS_ACTION = (1<<2), + PCHAN_HAS_TARGET = (1<<3), + /* only for drawing Posemode too */ + PCHAN_HAS_STRIDE = (1<<4) +} ePchan_ConstFlag; + +/* PoseChannel->ikflag */ +typedef enum ePchan_IkFlag { + BONE_IK_NO_XDOF = (1<<0), + BONE_IK_NO_YDOF = (1<<1), + BONE_IK_NO_ZDOF = (1<<2), + + BONE_IK_XLIMIT = (1<<3), + BONE_IK_YLIMIT = (1<<4), + BONE_IK_ZLIMIT = (1<<5), + + BONE_IK_NO_XDOF_TEMP = (1<<10), + BONE_IK_NO_YDOF_TEMP = (1<<11), + BONE_IK_NO_ZDOF_TEMP = (1<<12) +} ePchan_IkFlag; + +/* PoseChannel->rotmode */ +typedef enum ePchan_RotMode { + /* quaternion rotations (default, and for older Blender versions) */ + PCHAN_ROT_QUAT = 0, + /* euler rotations - keep in sync with enum in BLI_arithb.h */ + PCHAN_ROT_XYZ = 1, /* Blender 'default' (classic) - must be as 1 to sync with PoseChannel rotmode */ + PCHAN_ROT_XZY, + PCHAN_ROT_YXZ, + PCHAN_ROT_YZX, + PCHAN_ROT_ZXY, + PCHAN_ROT_ZYX, + /* NOTE: space is reserved here for 18 other possible + * euler rotation orders not implemented + */ + /* axis angle rotations */ + PCHAN_ROT_AXISANGLE = -1 +} ePchan_RotMode; + +/* Pose ------------------------------------ */ + +/* Pose-Object. + * + * It is only found under ob->pose. It is not library data, even * though there is a define for it (hack for the outliner). */ typedef struct bPose { @@ -109,15 +237,33 @@ typedef struct bPose { } bPose; -/* ------------- Action ---------------- */ +/* Pose->flag */ +typedef enum ePose_Flags { + /* results in armature_rebuild_pose being called */ + POSE_RECALC = (1<<0), + /* prevents any channel from getting overridden by anim from IPO */ + POSE_LOCKED = (1<<1), + /* clears the POSE_LOCKED flag for the next time the pose is evaluated */ + POSE_DO_UNLOCK = (1<<2), + /* pose has constraints which depend on time (used when depsgraph updates for a new frame) */ + POSE_CONSTRAINTS_TIMEDEPEND = (1<<3), + /* recalculate bone paths */ + POSE_RECALCPATHS = (1<<4), +} ePose_Flags; + +/* ************************************************ */ +/* Action */ + +/* Groups -------------------------------------- */ -/* Action-Channel Group. These are stored as a list per-Action, and are only used to - * group that Action's Action-Channels when displayed in the Action Editor. +/* Action-Channel Group (agrp) + + * These are stored as a list per-Action, and are only used to + * group that Action's channels in an Animation Editor. * - * Even though all Action-Channels live in a big list per Action, each group they are in also + * Even though all FCurves live in a big list per Action, each group they are in also * holds references to the achans within that list which belong to it. Care must be taken to * ensure that action-groups never end up being the sole 'owner' of a channel. - * * * This is also exploited for bone-groups. Bone-Groups are stored per bPose, and are used * primarily to colour bones in the 3d-view. There are other benefits too, but those are mostly related @@ -126,103 +272,144 @@ typedef struct bPose { typedef struct bActionGroup { struct bActionGroup *next, *prev; - ListBase channels; /* Note: this must not be touched by standard listbase functions */ + ListBase channels; /* Note: this must not be touched by standard listbase functions which would clear links to other channels */ int flag; /* settings for this action-group */ int customCol; /* index of custom color set to use when used for bones (0=default - used for all old files, -1=custom set) */ - char name[32]; /* name of the group */ + char name[64]; /* name of the group */ ThemeWireColor cs; /* color set to use when customCol == -1 */ } bActionGroup; -/* Action Channels belong to Actions. They are linked with an IPO block, and can also own - * Constraint Channels in certain situations. - * - * Action-Channels can only belong to one group at a time, but they still live the Action's - * list of achans (to preserve backwards compatability, and also minimise the code - * that would need to be recoded). Grouped achans are stored at the start of the list, according - * to the position of the group in the list, and their position within the group. - */ -typedef struct bActionChannel { - struct bActionChannel *next, *prev; - bActionGroup *grp; /* Action Group this Action Channel belongs to */ - - struct Ipo *ipo; /* IPO block this action channel references */ - ListBase constraintChannels; /* Constraint Channels (when Action Channel represents an Object or Bone) */ +/* Action Group flags */ +typedef enum eActionGroup_Flag { + /* group is selected */ + AGRP_SELECTED = (1<<0), + /* group is 'active' / last selected one */ + AGRP_ACTIVE = (1<<1), + /* keyframes/channels belonging to it cannot be edited */ + AGRP_PROTECTED = (1<<2), + /* for UI, sub-channels are shown */ + AGRP_EXPANDED = (1<<3), + /* sub-channels are not evaluated */ + AGRP_MUTED = (1<<4), + /* sub-channels are not visible in Graph Editor */ + AGRP_NOTVISIBLE = (1<<5), - int flag; /* settings accessed via bitmapping */ - char name[32]; /* channel name */ - int reserved1; -} bActionChannel; + AGRP_TEMP = (1<<30), + AGRP_MOVED = (1<<31) +} eActionGroup_Flag; + -/* Action. A recyclable block that contains a series of Action Channels (ipo), which define - * a clip of reusable animation for use in the NLA. +/* Actions -------------------------------------- */ + +/* Action - reusable F-Curve 'bag' (act) + * + * This contains F-Curves that may affect settings from more than one ID blocktype and/or + * datablock (i.e. sub-data linked/used directly to the ID block that the animation data is linked to), + * but with the restriction that the other unrelated data (i.e. data that is not directly used or linked to + * by the source ID block). + * + * It serves as a 'unit' of reusable animation information (i.e. keyframes/motion data), that + * affects a group of related settings (as defined by the user). */ typedef struct bAction { - ID id; + ID id; /* ID-serialisation for relinking */ - ListBase chanbase; /* Action Channels in this Action */ - ListBase groups; /* Action Groups in the Action */ - ListBase markers; /* TimeMarkers local to this Action for labelling 'poses' */ + ListBase curves; /* function-curves (FCurve) */ + ListBase chanbase; /* legacy data - Action Channels (bActionChannel) in pre-2.5 animation system */ + ListBase groups; /* groups of function-curves (bActionGroup) */ + ListBase markers; /* markers local to the Action (used to provide Pose-Libraries) */ - int active_marker; /* Index of active-marker (first marker = 1) */ - int pad; + int flag; /* settings for this action */ + int active_marker; /* index of the active marker */ } bAction; -/* ------------- Action Editor --------------------- */ +/* Flags for the action */ +typedef enum eAction_Flags { + /* flags for displaying in UI */ + ACT_COLLAPSED = (1<<0), + ACT_SELECTED = (1<<1), + + /* flags for evaluation/editing */ + ACT_MUTED = (1<<9), + ACT_PROTECTED = (1<<10), + ACT_DISABLED = (1<<11), +} eAction_Flags; + + +/* ************************************************ */ +/* Action/Dopesheet Editor */ + +/* Storage for Dopesheet/Grease-Pencil Editor data */ +typedef struct bDopeSheet { + ID *source; /* currently ID_SCE (for Dopesheet), and ID_SC (for Grease Pencil) */ + ListBase chanbase; /* cache for channels (only initialised when pinned) */ // XXX not used! + + int filterflag; /* flags to use for filtering data */ + int flag; /* standard flags */ +} bDopeSheet; + + +/* DopeSheet filter-flag */ +typedef enum DOPESHEET_FILTERFLAG { + /* general filtering */ + ADS_FILTER_ONLYSEL = (1<<0), /* only include channels relating to selected data */ + + /* temporary (runtime flags) */ + ADS_FILTER_ONLYDRIVERS = (1<<1), /* for 'Drivers' editor - only include Driver data from AnimData */ + ADS_FILTER_ONLYNLA = (1<<2), /* for 'NLA' editor - only include NLA data from AnimData */ + ADS_FILTER_SELEDIT = (1<<3), /* for Graph Editor - used to indicate whether to include a filtering flag or not */ + + /* datatype-based filtering */ + ADS_FILTER_NOSHAPEKEYS = (1<<6), + ADS_FILTER_NOCAM = (1<<10), + ADS_FILTER_NOMAT = (1<<11), + ADS_FILTER_NOLAM = (1<<12), + ADS_FILTER_NOCUR = (1<<13), + ADS_FILTER_NOWOR = (1<<14), + ADS_FILTER_NOSCE = (1<<15), + ADS_FILTER_NOPART = (1<<16), + ADS_FILTER_NOMBA = (1<<17), + + /* NLA-specific filters */ + ADS_FILTER_NLA_NOACT = (1<<20), /* if the AnimData block has no NLA data, don't include to just show Action-line */ + + /* combination filters (some only used at runtime) */ + ADS_FILTER_NOOBDATA = (ADS_FILTER_NOCAM|ADS_FILTER_NOMAT|ADS_FILTER_NOLAM|ADS_FILTER_NOCUR|ADS_FILTER_NOPART), +} DOPESHEET_FILTERFLAG; + +/* DopeSheet general flags */ +//typedef enum DOPESHEET_FLAG { + +//} DOPESHEET_FLAG; + + /* Action Editor Space. This is defined here instead of in DNA_space_types.h */ typedef struct SpaceAction { struct SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ int spacetype; float blockscale; - struct ScrArea *area; short blockhandler[8]; - View2D v2d; + View2D v2d; /* depricated, copied to region */ bAction *action; /* the currently active action */ + bDopeSheet ads; /* the currently active context (when not showing action) */ char mode, autosnap; /* mode: editing context; autosnap: automatic keyframe snapping mode */ short flag, actnr; /* flag: bitmapped settings; */ short pin, lock; /* pin: keep showing current action; actnr: used for finding chosen action from menu; lock: lock time to other windows */ - short actwidth; /* width of the left-hand side name panel (in pixels?) */ + short actwidth; /* width of the left-hand side name panel (in pixels?) */ // XXX depreceated! float timeslide; /* for Time-Slide transform mode drawing - current frame? */ } SpaceAction; - -/* -------------- Action Flags -------------- */ - -/* Action Channel flags */ -typedef enum ACHAN_FLAG { - ACHAN_SELECTED = (1<<0), - ACHAN_HILIGHTED = (1<<1), - ACHAN_HIDDEN = (1<<2), - ACHAN_PROTECTED = (1<<3), - ACHAN_EXPANDED = (1<<4), - ACHAN_SHOWIPO = (1<<5), - ACHAN_SHOWCONS = (1<<6), - ACHAN_MOVED = (1<<31), -} ACHAN_FLAG; - - -/* Action Group flags */ -typedef enum AGRP_FLAG { - AGRP_SELECTED = (1<<0), - AGRP_ACTIVE = (1<<1), - AGRP_PROTECTED = (1<<2), - AGRP_EXPANDED = (1<<3), - - AGRP_TEMP = (1<<30), - AGRP_MOVED = (1<<31) -} AGRP_FLAG; - -/* ------------ Action Editor Flags -------------- */ - /* SpaceAction flag */ -typedef enum SACTION_FLAG { +typedef enum eSAction_Flag { /* during transform (only set for TimeSlide) */ SACTION_MOVING = (1<<0), /* show sliders (if relevant) */ @@ -238,23 +425,26 @@ typedef enum SACTION_FLAG { /* hack for moving pose-markers (temp flag) */ SACTION_POSEMARKERS_MOVE = (1<<6), /* don't draw action channels using group colours (where applicable) */ - SACTION_NODRAWGCOLORS = (1<<7) -} SACTION_FLAG; + SACTION_NODRAWGCOLORS = (1<<7), + /* don't draw current frame number beside frame indicator */ + SACTION_NODRAWCFRANUM = (1<<8), +} eSAction_Flag; /* SpaceAction Mode Settings */ -typedef enum SACTCONT_MODES { +// XXX should this be used by other editors too? +typedef enum eAnimEdit_Context { /* action (default) */ SACTCONT_ACTION = 0, /* editing of shapekey's IPO block */ SACTCONT_SHAPEKEY, /* editing of gpencil data */ SACTCONT_GPENCIL, - /* dopesheet (unimplemented... future idea?) */ - SACTCONT_DOPESHEET -} SACTCONTEXT_MODES; + /* dopesheet */ + SACTCONT_DOPESHEET, +} eAnimEdit_Context; -/* SpaceAction AutoSnap Settings (also used by SpaceNLA) */ -typedef enum SACTSNAP_MODES { +/* SpaceAction AutoSnap Settings (also used by other Animation Editors) */ +typedef enum eAnimEdit_AutoSnap { /* no auto-snap */ SACTSNAP_OFF = 0, /* snap to 1.0 frame/second intervals */ @@ -263,68 +453,46 @@ typedef enum SACTSNAP_MODES { SACTSNAP_FRAME, /* snap to nearest marker */ SACTSNAP_MARKER, -} SACTSNAP_MODES; - - -/* --------- Pose Flags --------------- */ - -/* Pose->flag */ -typedef enum POSE_FLAG { - /* results in armature_rebuild_pose being called */ - POSE_RECALC = (1<<0), - /* prevents any channel from getting overridden by anim from IPO */ - POSE_LOCKED = (1<<1), - /* clears the POSE_LOCKED flag for the next time the pose is evaluated */ - POSE_DO_UNLOCK = (1<<2), - /* pose has constraints which depend on time (used when depsgraph updates for a new frame) */ - POSE_CONSTRAINTS_TIMEDEPEND = (1<<3), - /* recalculate bone paths */ - POSE_RECALCPATHS = (1<<4), -} POSE_FLAG; - -/* PoseChannel (transform) flags */ -enum { - POSE_LOC = 0x0001, - POSE_ROT = 0x0002, - POSE_SIZE = 0x0004, - POSE_IK_MAT = 0x0008, - POSE_UNUSED2 = 0x0010, - POSE_UNUSED3 = 0x0020, - POSE_UNUSED4 = 0x0040, - POSE_UNUSED5 = 0x0080, - POSE_HAS_IK = 0x0100, - POSE_CHAIN = 0x0200, - POSE_DONE = 0x0400, - POSE_KEY = 0x1000, - POSE_STRIDE = 0x2000 -}; +} eAnimEdit_AutoSnap; -/* PoseChannel constflag (constraint detection) */ -typedef enum PCHAN_CONSTFLAG { - PCHAN_HAS_IK = (1<<0), - PCHAN_HAS_CONST = (1<<1), - /* only used for drawing Posemode, not stored in channel */ - PCHAN_HAS_ACTION = (1<<2), - PCHAN_HAS_TARGET = (1<<3), - /* only for drawing Posemode too */ - PCHAN_HAS_STRIDE = (1<<4) -} PCHAN_CONSTFLAG; -/* PoseChannel->ikflag */ -typedef enum PCHAN_IKFLAG { - BONE_IK_NO_XDOF = (1<<0), - BONE_IK_NO_YDOF = (1<<1), - BONE_IK_NO_ZDOF = (1<<2), +/* ************************************************ */ +/* Legacy Data */ - BONE_IK_XLIMIT = (1<<3), - BONE_IK_YLIMIT = (1<<4), - BONE_IK_ZLIMIT = (1<<5), +/* WARNING: Action Channels are now depreceated... they were part of the old animation system! + * (ONLY USED FOR DO_VERSIONS...) + * + * Action Channels belong to Actions. They are linked with an IPO block, and can also own + * Constraint Channels in certain situations. + * + * Action-Channels can only belong to one group at a time, but they still live the Action's + * list of achans (to preserve backwards compatability, and also minimise the code + * that would need to be recoded). Grouped achans are stored at the start of the list, according + * to the position of the group in the list, and their position within the group. + */ +typedef struct bActionChannel { + struct bActionChannel *next, *prev; + bActionGroup *grp; /* Action Group this Action Channel belongs to */ - BONE_IK_NO_XDOF_TEMP = (1<<10), - BONE_IK_NO_YDOF_TEMP = (1<<11), - BONE_IK_NO_ZDOF_TEMP = (1<<12) -} PCHAN_IKFLAG; + struct Ipo *ipo; /* IPO block this action channel references */ + ListBase constraintChannels; /* Constraint Channels (when Action Channel represents an Object or Bone) */ + + int flag; /* settings accessed via bitmapping */ + char name[32]; /* channel name */ + int temp; /* temporary setting - may be used to indicate group that channel belongs to during syncing */ +} bActionChannel; +/* Action Channel flags (ONLY USED FOR DO_VERSIONS...) */ +typedef enum ACHAN_FLAG { + ACHAN_SELECTED = (1<<0), + ACHAN_HILIGHTED = (1<<1), + ACHAN_HIDDEN = (1<<2), + ACHAN_PROTECTED = (1<<3), + ACHAN_EXPANDED = (1<<4), + ACHAN_SHOWIPO = (1<<5), + ACHAN_SHOWCONS = (1<<6), + ACHAN_MOVED = (1<<31), +} ACHAN_FLAG; -#endif +#endif diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h index 43dada97d0e..278da27faf9 100644 --- a/source/blender/makesdna/DNA_actuator_types.h +++ b/source/blender/makesdna/DNA_actuator_types.h @@ -37,6 +37,9 @@ struct Scene; struct Group; struct Text; +// for Sound3D +#include "DNA_sound_types.h" + /* ****************** ACTUATORS ********************* */ /* unused now, moved to editobjectactuator in 2.02. Still needed for dna */ @@ -62,18 +65,13 @@ typedef struct bSoundActuator { short flag, sndnr; int sta, end; short pad1[2]; + float volume, pitch; struct bSound *sound; + struct Sound3D sound3D; short type, makecopy; short copymade, pad2[1]; } bSoundActuator; -typedef struct bCDActuator { - short flag, sndnr; - int sta, end; - short type, track; - float volume; -} bCDActuator; - typedef struct bEditObjectActuator { int time; short type, flag; @@ -82,7 +80,7 @@ typedef struct bEditObjectActuator { char name[32]; float linVelocity[3]; /* initial lin. velocity on creation */ float angVelocity[3]; /* initial ang. velocity on creation */ - float pad; + float mass; short localflag; /* flag for the lin & ang. vel: apply locally */ short dyn_operation; } bEditObjectActuator; @@ -107,6 +105,7 @@ typedef struct bObjectActuator { float loc[3], rot[3]; float dloc[3], drot[3]; float linearvelocity[3], angularvelocity[3]; + struct Object *reference; } bObjectActuator; typedef struct bIpoActuator { @@ -195,7 +194,8 @@ typedef struct bGameActuator { typedef struct bVisibilityActuator { /** bit 0: Is this object visible? - ** bit 1: Apply recursively */ + ** bit 1: Apply recursively + ** bit 2: Is this object an occluder? */ int flag; } bVisibilityActuator; @@ -213,7 +213,8 @@ typedef struct bTwoDFilterActuator{ }bTwoDFilterActuator; typedef struct bParentActuator { - char pad[4]; + char pad[2]; + short flag; int type; struct Object *ob; } bParentActuator; @@ -288,7 +289,6 @@ typedef struct FreeCamera { #define ACT_RANDOM 13 #define ACT_MESSAGE 14 #define ACT_ACTION 15 /* __ NLA */ -#define ACT_CD 16 #define ACT_GAME 17 #define ACT_VISIBILITY 18 #define ACT_2DFILTER 19 @@ -357,6 +357,7 @@ typedef struct FreeCamera { #define ACT_PROP_ASSIGN 0 #define ACT_PROP_ADD 1 #define ACT_PROP_COPY 2 +#define ACT_PROP_TOGGLE 3 /* constraint flag */ #define ACT_CONST_LOCX 1 @@ -401,6 +402,10 @@ typedef struct FreeCamera { /* editObjectActuator->flag */ #define ACT_TRACK_3D 1 +/* editObjectActuator->flag for replace mesh actuator */ +#define ACT_EDOB_REPLACE_MESH_NOGFX 2 /* use for replace mesh actuator */ +#define ACT_EDOB_REPLACE_MESH_PHYS 4 + /* SceneActuator->type */ #define ACT_SCENE_RESTART 0 #define ACT_SCENE_SET 1 @@ -424,6 +429,9 @@ typedef struct FreeCamera { #define ACT_RANDOM_FLOAT_NORMAL 8 #define ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL 9 +/* SoundActuator->flag */ +#define ACT_SND_3D_SOUND 1 + /* SoundActuator->type */ #define ACT_SND_PLAY_STOP_SOUND 0 #define ACT_SND_PLAY_END_SOUND 1 @@ -436,15 +444,6 @@ typedef struct FreeCamera { #define ACT_MESG_MESG 0 #define ACT_MESG_PROP 1 -/* cdactuator->type */ -#define ACT_CD_PLAY_ALL 0 -#define ACT_CD_PLAY_TRACK 1 -#define ACT_CD_LOOP_TRACK 2 -#define ACT_CD_VOLUME 3 -#define ACT_CD_STOP 4 -#define ACT_CD_PAUSE 5 -#define ACT_CD_RESUME 6 - /* gameactuator->type */ #define ACT_GAME_LOAD 0 #define ACT_GAME_START 1 @@ -457,6 +456,7 @@ typedef struct FreeCamera { /* Set means the object will become invisible */ #define ACT_VISIBILITY_INVISIBLE (1 << 0) #define ACT_VISIBILITY_RECURSIVE (1 << 1) +#define ACT_VISIBILITY_OCCLUSION (1 << 2) /* twodfilter->type */ #define ACT_2DFILTER_ENABLED -2 @@ -479,6 +479,11 @@ typedef struct FreeCamera { /* parentactuator->type */ #define ACT_PARENT_SET 0 #define ACT_PARENT_REMOVE 1 + +/* parentactuator->flag */ +#define ACT_PARENT_COMPOUND 1 +#define ACT_PARENT_GHOST 2 + #endif diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h new file mode 100644 index 00000000000..f75ed273164 --- /dev/null +++ b/source/blender/makesdna/DNA_anim_types.h @@ -0,0 +1,794 @@ +/** + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. + * + * 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) 2009 Blender Foundation, Joshua Leung + * All rights reserved. + * + * Contributor(s): Joshua Leung (full recode) + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef DNA_ANIM_TYPES_H +#define DNA_ANIM_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "DNA_ID.h" +#include "DNA_listBase.h" +#include "DNA_action_types.h" +#include "DNA_curve_types.h" + +/* ************************************************ */ +/* F-Curve DataTypes */ + +/* Modifiers -------------------------------------- */ + +/* F-Curve Modifiers (fcm) + * + * These alter the way F-Curves behave, by altering the value that is returned + * when evaluating the curve's data at some time (t). + */ +typedef struct FModifier { + struct FModifier *next, *prev; + + void *data; /* pointer to modifier data */ + void *edata; /* pointer to temporary data used during evaluation */ + + char name[64]; /* user-defined description for the modifier */ + short type; /* type of f-curve modifier */ + short flag; /* settings for the modifier */ + + float influence; /* the amount that the modifier should influence the value */ +} FModifier; + +/* Types of F-Curve modifier + * WARNING: order here is important! + */ +typedef enum eFModifier_Types { + FMODIFIER_TYPE_NULL = 0, + FMODIFIER_TYPE_GENERATOR, + FMODIFIER_TYPE_FN_GENERATOR, + FMODIFIER_TYPE_ENVELOPE, + FMODIFIER_TYPE_CYCLES, + FMODIFIER_TYPE_NOISE, + FMODIFIER_TYPE_FILTER, /* unimplemented - for applying: fft, high/low pass filters, etc. */ + FMODIFIER_TYPE_PYTHON, + FMODIFIER_TYPE_LIMITS, + + /* NOTE: all new modifiers must be added above this line */ + FMODIFIER_NUM_TYPES +} eFModifier_Types; + +/* F-Curve Modifier Settings */ +typedef enum eFModifier_Flags { + /* modifier is not able to be evaluated for some reason, and should be skipped (internal) */ + FMODIFIER_FLAG_DISABLED = (1<<0), + /* modifier's data is expanded (in UI) */ + FMODIFIER_FLAG_EXPANDED = (1<<1), + /* modifier is active one (in UI) for editing purposes */ + FMODIFIER_FLAG_ACTIVE = (1<<2), + /* user wants modifier to be skipped */ + FMODIFIER_FLAG_MUTED = (1<<3), +} eFModifier_Flags; + +/* --- */ + +/* Generator modifier data */ +typedef struct FMod_Generator { + /* general generator information */ + float *coefficients; /* coefficients array */ + unsigned int arraysize; /* size of the coefficients array */ + + int poly_order; /* order of polynomial generated (i.e. 1 for linear, 2 for quadratic) */ + int mode; /* which 'generator' to use eFMod_Generator_Modes */ + + /* settings */ + int flag; /* settings */ +} FMod_Generator; + +/* generator modes */ +typedef enum eFMod_Generator_Modes { + FCM_GENERATOR_POLYNOMIAL = 0, + FCM_GENERATOR_POLYNOMIAL_FACTORISED, +} eFMod_Generator_Modes; + + +/* generator flags + * - shared by Generator and Function Generator + */ +typedef enum eFMod_Generator_Flags { + /* generator works in conjunction with other modifiers (i.e. doesn't replace those before it) */ + FCM_GENERATOR_ADDITIVE = (1<<0), +} eFMod_Generator_Flags; + + +/* 'Built-In Function' Generator modifier data + * + * This uses the general equation for equations: + * y = amplitude * fn(phase_multiplier*x + phase_offset) + y_offset + * + * where amplitude, phase_multiplier/offset, y_offset are user-defined coefficients, + * x is the evaluation 'time', and 'y' is the resultant value + */ +typedef struct FMod_FunctionGenerator { + /* coefficients for general equation (as above) */ + float amplitude; + float phase_multiplier; + float phase_offset; + float value_offset; + + /* flags */ + int type; /* eFMod_Generator_Functions */ + int flag; /* eFMod_Generator_flags */ +} FMod_FunctionGenerator; + +/* 'function' generator types */ +typedef enum eFMod_Generator_Functions { + FCM_GENERATOR_FN_SIN = 0, + FCM_GENERATOR_FN_COS, + FCM_GENERATOR_FN_TAN, + FCM_GENERATOR_FN_SQRT, + FCM_GENERATOR_FN_LN, + FCM_GENERATOR_FN_SINC, +} eFMod_Generator_Functions; + + +/* envelope modifier - envelope data */ +typedef struct FCM_EnvelopeData { + float min, max; /* min/max values for envelope at this point (absolute values) */ + float time; /* time for that this sample-point occurs */ + + short f1; /* settings for 'min' control point */ + short f2; /* settings for 'max' control point */ +} FCM_EnvelopeData; + +/* envelope-like adjustment to values (for fade in/out) */ +typedef struct FMod_Envelope { + FCM_EnvelopeData *data; /* data-points defining envelope to apply (array) */ + int totvert; /* number of envelope points */ + + float midval; /* value that envelope's influence is centered around / based on */ + float min, max; /* distances from 'middle-value' for 1:1 envelope influence */ +} FMod_Envelope; + + +/* cycling/repetition modifier data */ +// TODO: we can only do complete cycles... +typedef struct FMod_Cycles { + short before_mode; /* extrapolation mode to use before first keyframe */ + short after_mode; /* extrapolation mode to use after last keyframe */ + short before_cycles; /* number of 'cycles' before first keyframe to do */ + short after_cycles; /* number of 'cycles' after last keyframe to do */ +} FMod_Cycles; + +/* cycling modes */ +typedef enum eFMod_Cycling_Modes { + FCM_EXTRAPOLATE_NONE = 0, /* don't do anything */ + FCM_EXTRAPOLATE_CYCLIC, /* repeat keyframe range as-is */ + FCM_EXTRAPOLATE_CYCLIC_OFFSET, /* repeat keyframe range, but with offset based on gradient between values */ + FCM_EXTRAPOLATE_MIRROR, /* alternate between forward and reverse playback of keyframe range */ +} eFMod_Cycling_Modes; + + +/* Python-script modifier data */ +typedef struct FMod_Python { + struct Text *script; /* text buffer containing script to execute */ + IDProperty *prop; /* ID-properties to provide 'custom' settings */ +} FMod_Python; + + +/* limits modifier data */ +typedef struct FMod_Limits { + rctf rect; /* rect defining the min/max values */ + int flag; /* settings for limiting */ + int pad; +} FMod_Limits; + +/* limiting flags */ +typedef enum eFMod_Limit_Flags { + FCM_LIMIT_XMIN = (1<<0), + FCM_LIMIT_XMAX = (1<<1), + FCM_LIMIT_YMIN = (1<<2), + FCM_LIMIT_YMAX = (1<<3), +} eFMod_Limit_Flags; + +/* noise modifier data */ +typedef struct FMod_Noise { + float size; + float strength; + float phase; + float pad; + + short depth; + short modification; +} FMod_Noise; + +/* modification modes */ +typedef enum eFMod_Noise_Modifications { + FCM_NOISE_MODIF_REPLACE = 0, /* Modify existing curve, matching it's shape */ + FCM_NOISE_MODIF_ADD, /* Add noise to the curve */ + FCM_NOISE_MODIF_SUBTRACT, /* Subtract noise from the curve */ + FCM_NOISE_MODIF_MULTIPLY, /* Multiply the curve by noise */ +} eFMod_Noise_Modifications; + +/* Drivers -------------------------------------- */ + +/* Driver Target + * + * A 'variable' for use as a target of the driver/expression. + * Defines a way of accessing some channel to use, that can be + * referred to in the expression as a variable, thus simplifying + * expressions and also Depsgraph building. + */ +typedef struct DriverTarget { + struct DriverTarget *next, *prev; + + ID *id; /* ID-block which owns the target */ + char *rna_path; /* target channel to use as driver value */ + int array_index; /* if applicable, the index of the RNA-array item to use as driver */ + + int flags; /* flags for the validity of the target */ + + char name[64]; /* name of the variable */ +} DriverTarget; + +/* Channel Driver (i.e. Drivers / Expressions) (driver) + * + * Channel Drivers are part of the dependency system, and are executed in addition to + * normal user-defined animation. They take the animation result of some channel(s), and + * use that (optionally combined with its own F-Curve for modification of results) to define + * the value of some setting semi-procedurally. + * + * Drivers are stored as part of F-Curve data, so that the F-Curve's RNA-path settings (for storing + * what setting the driver will affect). The order in which they are stored defines the order that they're + * evaluated in. This order is set by the Depsgraph's sorting stuff. + */ +typedef struct ChannelDriver { + ListBase targets; /* targets for this driver (i.e. list of DriverTarget) */ + + /* python expression to execute (may call functions defined in an accessory file) + * which relates the target 'variables' in some way to yield a single usable value + */ + char expression[256]; + + float curval; /* result of previous evaluation, for subtraction from result under certain circumstances */ + float influence; /* influence of driver on result */ // XXX to be implemented... this is like the constraint influence setting + + /* general settings */ + int type; /* type of driver */ + int flag; /* settings of driver */ +} ChannelDriver; + +/* driver type */ +typedef enum eDriver_Types { + /* target values are averaged together */ + DRIVER_TYPE_AVERAGE = 0, + /* python expression/function relates targets */ + DRIVER_TYPE_PYTHON, + /* rotational difference (must use rotation channels only) */ + DRIVER_TYPE_ROTDIFF, +} eDriver_Types; + +/* driver flags */ +typedef enum eDriver_Flags { + /* driver has invalid settings (internal flag) */ + DRIVER_FLAG_INVALID = (1<<0), + /* driver needs recalculation (set by depsgraph) */ + DRIVER_FLAG_RECALC = (1<<1), + /* driver does replace value, but overrides (for layering of animation over driver) */ + // TODO: this needs to be implemented at some stage or left out... + DRIVER_FLAG_LAYERING = (1<<2), +} eDriver_Flags; + +/* F-Curves -------------------------------------- */ + +/* FPoint (fpt) + * + * This is the bare-minimum data required storing motion samples. Should be more efficient + * than using BPoints, which contain a lot of other unnecessary data... + */ +typedef struct FPoint { + float vec[2]; /* time + value */ + int flag; /* selection info */ + int pad; +} FPoint; + +/* 'Function-Curve' - defines values over time for a given setting (fcu) */ +typedef struct FCurve { + struct FCurve *next, *prev; + + /* group */ + bActionGroup *grp; /* group that F-Curve belongs to */ + + /* driver settings */ + ChannelDriver *driver; /* only valid for drivers (i.e. stored in AnimData not Actions) */ + /* evaluation settings */ + ListBase modifiers; /* FCurve Modifiers */ + + /* motion data */ + BezTriple *bezt; /* user-editable keyframes (array) */ + FPoint *fpt; /* 'baked/imported' motion samples (array) */ + unsigned int totvert; /* total number of points which define the curve (i.e. size of arrays in FPoints) */ + + /* value cache + settings */ + float curval; /* value stored from last time curve was evaluated */ + short flag; /* user-editable settings for this curve */ + short extend; /* value-extending mode for this curve (does not cover */ + + /* RNA - data link */ + int array_index; /* if applicable, the index of the RNA-array item to get */ + char *rna_path; /* RNA-path to resolve data-access */ + + /* curve coloring (for editor) */ + int color_mode; /* coloring method to use */ + float color[3]; /* the last-color this curve took */ +} FCurve; + + +/* user-editable flags/settings */ +typedef enum eFCurve_Flags { + /* curve/keyframes are visible in editor */ + FCURVE_VISIBLE = (1<<0), + /* curve is selected for editing */ + FCURVE_SELECTED = (1<<1), + /* curve is active one */ + FCURVE_ACTIVE = (1<<2), + /* keyframes (beztriples) cannot be edited */ + FCURVE_PROTECTED = (1<<3), + /* fcurve will not be evaluated for the next round */ + FCURVE_MUTED = (1<<4), + /* fcurve uses 'auto-handles', which stay horizontal... */ + FCURVE_AUTO_HANDLES = (1<<5), + + /* skip evaluation, as RNA-path cannot be resolved (similar to muting, but cannot be set by user) */ + FCURVE_DISABLED = (1<<10), + /* curve can only have whole-number values (integer types) */ + FCURVE_INT_VALUES = (1<<11), + /* curve can only have certain discrete-number values (no interpolation at all, for enums/booleans) */ + FCURVE_DISCRETE_VALUES = (1<<12), +} eFCurve_Flags; + +/* extrapolation modes (only simple value 'extending') */ +typedef enum eFCurve_Extend { + FCURVE_EXTRAPOLATE_CONSTANT = 0, /* just extend min/max keyframe value */ + FCURVE_EXTRAPOLATE_LINEAR, /* just extend gradient of segment between first segment keyframes */ +} eFCurve_Extend; + +/* curve coloring modes */ +typedef enum eFCurve_Coloring { + FCURVE_COLOR_AUTO_RAINBOW = 0, /* automatically determine color using rainbow (calculated at drawtime) */ + FCURVE_COLOR_AUTO_RGB, /* automatically determine color using XYZ (array index) <-> RGB */ + FCURVE_COLOR_CUSTOM, /* custom color */ +} eFCurve_Coloring; + +/* ************************************************ */ +/* 'Action' Datatypes */ + +/* NOTE: Although these are part of the Animation System, + * they are not stored here... see DNA_action_types.h instead + */ + + +/* ************************************************ */ +/* Animation Reuse - i.e. users of Actions */ + +/* Retargetting ----------------------------------- */ + +/* Retargetting Pair + * + * Defines what parts of the paths should be remapped from 'abc' to 'xyz'. + * TODO: + * - Regrex (possibly provided through PY, though having our own module might be faster) + * would be important to have at some point. Current replacements are just simple + * string matches... + */ +typedef struct AnimMapPair { + char from[128]; /* part of path to bed replaced */ + char to[128]; /* part of path to replace with */ +} AnimMapPair; + +/* Retargetting Information for Actions + * + * This should only be used if it is strictly necessary (i.e. user will need to explictly + * add this when they find that some channels do not match, or motion is not going to right + * places). When executing an action, this will be checked to see if it provides any useful + * remaps for the given paths. + * + * NOTE: we currently don't store this in the Action itself, as that causes too many problems. + */ +// FIXME: will this be too clumsy or slow? If we're using RNA paths anyway, we'll have to accept +// such consequences... +typedef struct AnimMapper { + struct AnimMapper *next, *prev; + + bAction *target; /* target action */ + ListBase mappings; /* remapping table (bAnimMapPair) */ +} AnimMapper; + +/* ************************************************ */ +/* NLA - Non-Linear Animation */ + +/* NLA Strips ------------------------------------- */ + +/* NLA Strip (strip) + * + * A NLA Strip is a container for the reuse of Action data, defining parameters + * to control the remapping of the Action data to some destination. + */ +typedef struct NlaStrip { + struct NlaStrip *next, *prev; + + ListBase strips; /* 'Child' strips (used for 'meta' strips) */ + bAction *act; /* Action that is referenced by this strip (strip is 'user' of the action) */ + AnimMapper *remap; /* Remapping info this strip (for tweaking correspondance of action with context) */ + + ListBase fcurves; /* F-Curves for controlling this strip's influence and timing */ // TODO: move out? + ListBase modifiers; /* F-Curve modifiers to be applied to the entire strip's referenced F-Curves */ + + char name[64]; /* User-Visible Identifier for Strip */ + + float influence; /* Influence of strip */ + float strip_time; /* Current 'time' within action being used (automatically evaluated, but can be overridden) */ + + float start, end; /* extents of the strip */ + float actstart, actend; /* range of the action to use */ + + float repeat; /* The number of times to repeat the action range (only when no F-Curves) */ + float scale; /* The amount the action range is scaled by (only when no F-Curves) */ + + float blendin, blendout; /* strip blending length (only used when there are no F-Curves) */ + short blendmode; /* strip blending mode (layer-based mixing) */ + + short extendmode; /* strip extrapolation mode (time-based mixing) */ + short pad1; + + short type; /* type of NLA strip */ + + int flag; /* settings */ + int pad2; +} NlaStrip; + +/* NLA Strip Blending Mode */ +typedef enum eNlaStrip_Blend_Mode { + NLASTRIP_MODE_REPLACE = 0, + NLASTRIP_MODE_ADD, + NLASTRIP_MODE_SUBTRACT, + NLASTRIP_MODE_MULTIPLY, +} eNlaStrip_Blend_Mode; + +/* NLA Strip Extrpolation Mode */ +typedef enum eNlaStrip_Extrapolate_Mode { + /* extend before first frame if no previous strips in track, and always hold+extend last frame */ + NLASTRIP_EXTEND_HOLD = 0, + /* only hold+extend last frame */ + NLASTRIP_EXTEND_HOLD_FORWARD, + /* don't contribute at all */ + NLASTRIP_EXTEND_NOTHING, +} eNlaStrip_Extrapolate_Mode; + +/* NLA Strip Settings */ +typedef enum eNlaStrip_Flag { + /* UI selection flags */ + /* NLA strip is the active one in the track (also indicates if strip is being tweaked) */ + NLASTRIP_FLAG_ACTIVE = (1<<0), + /* NLA strip is selected for editing */ + NLASTRIP_FLAG_SELECT = (1<<1), +// NLASTRIP_FLAG_SELECT_L = (1<<2), // left handle selected +// NLASTRIP_FLAG_SELECT_R = (1<<3), // right handle selected + /* NLA strip uses the same action that the action being tweaked uses (not set for the twaking one though) */ + NLASTRIP_FLAG_TWEAKUSER = (1<<4), + + /* controls driven by local F-Curves */ + /* strip influence is controlled by local F-Curve */ + NLASTRIP_FLAG_USR_INFLUENCE = (1<<5), + NLASTRIP_FLAG_USR_TIME = (1<<6), + + /* NLA strip length is synced to the length of the referenced action */ + NLASTRIP_FLAG_SYNC_LENGTH = (1<<9), + + /* playback flags (may be overriden by F-Curves) */ + /* NLA strip blendin/out values are set automatically based on overlaps */ + NLASTRIP_FLAG_AUTO_BLENDS = (1<<10), + /* NLA strip is played back in reverse order */ + NLASTRIP_FLAG_REVERSE = (1<<11), + /* NLA strip is muted (i.e. doesn't contribute in any way) */ + NLASTRIP_FLAG_MUTED = (1<<12), + /* NLA Strip is played back in 'ping-pong' style */ + NLASTRIP_FLAG_MIRROR = (1<<13), + + /* temporary editing flags */ + /* NLA-Strip is really just a temporary meta used to facilitate easier transform code */ + NLASTRIP_FLAG_TEMP_META = (1<<30), + NLASTRIP_FLAG_EDIT_TOUCHED = (1<<31), +} eNlaStrip_Flag; + +/* NLA Strip Type */ +typedef enum eNlaStrip_Type { + /* 'clip' - references an Action */ + NLASTRIP_TYPE_CLIP = 0, + /* 'transition' - blends between the adjacent strips */ + NLASTRIP_TYPE_TRANSITION, + /* 'meta' - a strip which acts as a container for a few others */ + NLASTRIP_TYPE_META, +} eNlaStrip_Type; + +/* NLA Tracks ------------------------------------- */ + +/* NLA Track (nlt) + * + * A track groups a bunch of 'strips', which should form a continous set of + * motion, on top of which other such groups can be layered. This should allow + * for animators to work in a non-destructive manner, layering tweaks, etc. over + * 'rough' blocks of their work. + */ +typedef struct NlaTrack { + struct NlaTrack *next, *prev; + + ListBase strips; /* bActionStrips in this track */ + + int flag; /* settings for this track */ + int index; /* index of the track in the stack (NOTE: not really useful, but we need a pad var anyways!) */ + + char name[64]; /* short user-description of this track */ +} NlaTrack; + +/* settings for track */ +typedef enum eNlaTrack_Flag { + /* track is the one that settings can be modified on, also indicates if track is being 'tweaked' */ + NLATRACK_ACTIVE = (1<<0), + /* track is selected in UI for relevant editing operations */ + NLATRACK_SELECTED = (1<<1), + /* track is not evaluated */ + NLATRACK_MUTED = (1<<2), + /* track is the only one evaluated (must be used in conjunction with adt->flag) */ + NLATRACK_SOLO = (1<<3), + /* track's settings (and strips) cannot be edited (to guard against unwanted changes) */ + NLATRACK_PROTECTED = (1<<4), + + /* track is not allowed to execute, usually as result of tweaking being enabled (internal flag) */ + NLATRACK_DISABLED = (1<<10), +} eNlaTrack_Flag; + + +/* ************************************ */ +/* KeyingSet Datatypes */ + +/* Path for use in KeyingSet definitions (ksp) + * + * Paths may be either specific (specifying the exact sub-ID + * dynamic data-block - such as PoseChannels - to act upon, ala + * Maya's 'Character Sets' and XSI's 'Marking Sets'), or they may + * be generic (using various placeholder template tags that will be + * replaced with appropriate information from the context). + */ +typedef struct KS_Path { + struct KS_Path *next, *prev; + + /* absolute paths only */ + ID *id; /* ID block that keyframes are for */ + char group[64]; /* name of the group to add to */ + + /* relative paths only */ + int idtype; /* ID-type that path can be used on */ + int templates; /* Templates that will be encountered in the path (as set of bitflags) */ + + /* all paths */ + char *rna_path; /* dynamically (or statically in the case of predefined sets) path */ + int array_index; /* index that path affects */ + + short flag; /* various settings, etc. */ + short groupmode; /* group naming (eKSP_Grouping) */ +} KS_Path; + +/* KS_Path->flag */ +typedef enum eKSP_Settings { + /* entire array (not just the specified index) gets keyframed */ + KSP_FLAG_WHOLE_ARRAY = (1<<0), +} eKSP_Settings; + +/* KS_Path->groupmode */ +typedef enum eKSP_Grouping { + /* path should be grouped using group name stored in path */ + KSP_GROUP_NAMED = 0, + /* path should not be grouped at all */ + KSP_GROUP_NONE, + /* path should be grouped using KeyingSet's name */ + KSP_GROUP_KSNAME, + /* path should be grouped using name of inner-most context item from templates + * - this is most useful for relative KeyingSets only + */ + KSP_GROUP_TEMPLATE_ITEM, +} eKSP_Grouping; + +/* KS_Path->templates (Template Flags) + * + * Templates in paths are used to substitute information from the + * active context into relavent places in the path strings. This + * enum here defines the flags which define which templates are + * required by a path before it can be used + */ +typedef enum eKSP_TemplateTypes { + KSP_TEMPLATE_OBJECT = (1<<0), /* #obj - selected object */ + KSP_TEMPLATE_PCHAN = (1<<1), /* #pch - selected posechannel */ + KSP_TEMPLATE_CONSTRAINT = (1<<2), /* #con - active only */ + KSP_TEMPLATE_NODE = (1<<3), /* #nod - selected node */ + + KSP_TEMPLATE_PCHAN_ROT = (1<<16), /* modify rotation paths based on rotation mode of Pose Channel */ +} eKSP_TemplateTypes; + +/* ---------------- */ + +/* KeyingSet definition (ks) + * + * A KeyingSet defines a group of properties that should + * be keyframed together, providing a convenient way for animators + * to insert keyframes without resorting to Auto-Keyframing. + * + * A few 'generic' (non-absolute and dependant on templates) KeyingSets + * are defined 'built-in' to facilitate easy animating for the casual + * animator without the need to add extra steps to the rigging process. + */ +typedef struct KeyingSet { + struct KeyingSet *next, *prev; + + ListBase paths; /* (KS_Path) paths to keyframe to */ + + char name[64]; /* user-viewable name for KeyingSet (for menus, etc.) */ + + int flag; /* settings for KeyingSet */ + int keyingflag; /* settings to supply insertkey() with */ +} KeyingSet; + +/* KeyingSet settings */ +typedef enum eKS_Settings { + /* keyingset cannot be removed (and doesn't need to be freed) */ + KEYINGSET_BUILTIN = (1<<0), + /* keyingset does not depend on context info (i.e. paths are absolute) */ + KEYINGSET_ABSOLUTE = (1<<1), +} eKS_Settings; + +/* Flags for use by keyframe creation/deletion calls */ +typedef enum eInsertKeyFlags { + INSERTKEY_NEEDED = (1<<0), /* only insert keyframes where they're needed */ + INSERTKEY_MATRIX = (1<<1), /* insert 'visual' keyframes where possible/needed */ + INSERTKEY_FAST = (1<<2), /* don't recalculate handles,etc. after adding key */ + INSERTKEY_FASTR = (1<<3), /* don't realloc mem (or increase count, as array has already been set out) */ + INSERTKEY_REPLACE = (1<<4), /* only replace an existing keyframe (this overrides INSERTKEY_NEEDED) */ +} eInsertKeyFlags; + +/* ************************************************ */ +/* Animation Data */ + +/* AnimOverride ------------------------------------- */ + +/* Animation Override (aor) + * + * This is used to as temporary storage of values which have been changed by the user, but not + * yet keyframed (thus, would get overwritten by the animation system before the user had a chance + * to see the changes that were made). + * + * It is probably not needed for overriding keyframed values in most cases, as those will only get evaluated + * on frame-change now. That situation may change in future. + */ +typedef struct AnimOverride { + struct AnimOverride *next, *prev; + + char *rna_path; /* RNA-path to use to resolve data-access */ + int array_index; /* if applicable, the index of the RNA-array item to get */ + + float value; /* value to override setting with */ +} AnimOverride; + +/* AnimData ------------------------------------- */ + +/* Animation data for some ID block (adt) + * + * This block of data is used to provide all of the necessary animation data for a datablock. + * Currently, this data will not be reusable, as there shouldn't be any need to do so. + * + * This information should be made available for most if not all ID-blocks, which should + * enable all of its settings to be animatable locally. Animation from 'higher-up' ID-AnimData + * blocks may override local settings. + * + * This datablock should be placed immediately after the ID block where it is used, so that + * the code which retrieves this data can do so in an easier manner. See blenkernel/intern/anim_sys.c for details. + */ +typedef struct AnimData { + /* active action - acts as the 'tweaking track' for the NLA */ + bAction *action; + /* temp-storage for the 'real' active action (i.e. the one used before the tweaking-action + * took over to be edited in the Animation Editors) + */ + bAction *tmpact; + /* remapping-info for active action - should only be used if needed + * (for 'foreign' actions that aren't working correctly) + */ + AnimMapper *remap; + + /* nla-tracks */ + ListBase nla_tracks; + /* active NLA-strip (only set/used during tweaking, so no need to worry about dangling pointers) */ + NlaStrip *actstrip; + + /* 'drivers' for this ID-block's settings - FCurves, but are completely + * separate from those for animation data + */ + ListBase drivers; /* standard user-created Drivers/Expressions (used as part of a rig) */ + ListBase overrides; /* temp storage (AnimOverride) of values for settings that are animated (but the value hasn't been keyframed) */ + + /* settings for animation evaluation */ + int flag; /* user-defined settings */ + int recalc; /* depsgraph recalculation flags */ + + /* settings for active action evaluation (based on NLA strip settings) */ + short act_blendmode; /* accumulation mode for active action */ + short act_extendmode; /* extrapolation mode for active action */ + float act_influence; /* influence for active action */ +} AnimData; + +/* Animation Data settings (mostly for NLA) */ +typedef enum eAnimData_Flag { + /* only evaluate a single track in the NLA */ + ADT_NLA_SOLO_TRACK = (1<<0), + /* don't use NLA */ + ADT_NLA_EVAL_OFF = (1<<1), + /* NLA is being 'tweaked' (i.e. in EditMode) */ + ADT_NLA_EDIT_ON = (1<<2), + /* active Action for 'tweaking' does not have mapping applied for editing */ + ADT_NLA_EDIT_NOMAP = (1<<3), + /* NLA-Strip F-Curves are expanded in UI */ + ADT_NLA_SKEYS_COLLAPSED = (1<<4), + + /* drivers expanded in UI */ + ADT_DRIVERS_COLLAPSED = (1<<10), + /* don't execute drivers */ + ADT_DRIVERS_DISABLED = (1<<11), + + /* F-Curves from this AnimData block are not visible in the Graph Editor */ + ADT_CURVES_NOT_VISIBLE = (1<<16), +} eAnimData_Flag; + +/* Animation Data recalculation settings (to be set by depsgraph) */ +typedef enum eAnimData_Recalc { + ADT_RECALC_DRIVERS = (1<<0), + ADT_RECALC_ANIM = (1<<1), + ADT_RECALC_ALL = (ADT_RECALC_DRIVERS|ADT_RECALC_ANIM), +} eAnimData_Recalc; + +/* Base Struct for Anim ------------------------------------- */ + +/* Used for BKE_animdata_from_id() + * All ID-datablocks which have their own 'local' AnimData + * should have the same arrangement in their structs. + */ +typedef struct IdAdtTemplate { + ID id; + AnimData *adt; +} IdAdtTemplate; + +/* ************************************************ */ + +#ifdef __cplusplus +}; +#endif + +#endif /* DNA_ANIM_TYPES_H */ diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index 0648c535353..bb60fb107ff 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -71,6 +71,10 @@ typedef struct bArmature { ID id; ListBase bonebase; ListBase chainbase; + ListBase *edbo; /* editbone listbase, we use pointer so we can check state */ + + void *sketch; /* sketch struct for etch-a-ton */ + int flag; int drawtype; short deformflag; @@ -156,6 +160,8 @@ typedef enum eBone_Flag { BONE_DRAWWIRE = (1<<17), /* bone should be drawn as OB_WIRE, regardless of draw-types of view+armature */ BONE_NO_CYCLICOFFSET = (1<<18), /* when no parent, bone will not get cyclic offset */ BONE_EDITMODE_LOCKED = (1<<19), /* bone transforms are locked in EditMode */ + BONE_TRANSFORM_CHILD = (1<<20), /* Indicates that a parent is also being transformed */ + BONE_UNSELECTABLE = (1<<21), /* bone cannot be selected */ } eBone_Flag; #endif diff --git a/source/blender/makesdna/DNA_boid_types.h b/source/blender/makesdna/DNA_boid_types.h new file mode 100644 index 00000000000..3e5b0829c70 --- /dev/null +++ b/source/blender/makesdna/DNA_boid_types.h @@ -0,0 +1,223 @@ +/* DNA_particle_types.h + * + * + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. + * + * 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) 2009 by Janne Karhu. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef DNA_BOID_TYPES_H +#define DNA_BOID_TYPES_H + +#include "DNA_listBase.h" + +typedef enum BoidRuleType { + eBoidRuleType_None = 0, + eBoidRuleType_Goal, /* go to goal assigned object or loudest assigned signal source */ + eBoidRuleType_Avoid, /* get away from assigned object or loudest assigned signal source */ + eBoidRuleType_AvoidCollision, /* manoeuver to avoid collisions with other boids and deflector object in near future */ + eBoidRuleType_Separate, /* keep from going through other boids */ + eBoidRuleType_Flock, /* move to center of neighbors and match their velocity */ + eBoidRuleType_FollowLeader, /* follow a boid or assigned object */ + eBoidRuleType_AverageSpeed, /* maintain speed, flight level or wander*/ + eBoidRuleType_Fight, /* go to closest enemy and attack when in range */ + //eBoidRuleType_Protect, /* go to enemy closest to target and attack when in range */ + //eBoidRuleType_Hide, /* find a deflector move to it's other side from closest enemy */ + //eBoidRuleType_FollowPath, /* move along a assigned curve or closest curve in a group */ + //eBoidRuleType_FollowWall, /* move next to a deflector object's in direction of it's tangent */ + NUM_BOID_RULE_TYPES +} BoidRuleType; + +/* boidrule->flag */ +#define BOIDRULE_CURRENT 1 +#define BOIDRULE_IN_AIR 4 +#define BOIDRULE_ON_LAND 8 +typedef struct BoidRule { + struct BoidRule *next, *prev; + int type, flag; + char name[32]; +} BoidRule; +#define BRULE_GOAL_AVOID_PREDICT 1 +#define BRULE_GOAL_AVOID_ARRIVE 2 +#define BRULE_GOAL_AVOID_SIGNAL 4 +typedef struct BoidRuleGoalAvoid { + BoidRule rule; + struct Object *ob; + int options; + float fear_factor; + + /* signals */ + int signal_id, channels; +} BoidRuleGoalAvoid; +#define BRULE_ACOLL_WITH_BOIDS 1 +#define BRULE_ACOLL_WITH_DEFLECTORS 2 +typedef struct BoidRuleAvoidCollision { + BoidRule rule; + int options; + float look_ahead; +} BoidRuleAvoidCollision; +#define BRULE_LEADER_IN_LINE 1 +typedef struct BoidRuleFollowLeader { + BoidRule rule; + struct Object *ob; + float loc[3], oloc[3]; + float cfra, distance; + int options, queue_size; +} BoidRuleFollowLeader; +typedef struct BoidRuleAverageSpeed { + BoidRule rule; + float wander, level, speed, rt; +} BoidRuleAverageSpeed; +typedef struct BoidRuleFight { + BoidRule rule; + float distance, flee_distance; +} BoidRuleFight; + +typedef enum BoidMode { + eBoidMode_InAir = 0, + eBoidMode_OnLand, + eBoidMode_Climbing, + eBoidMode_Falling, + eBoidMode_Liftoff, + NUM_BOID_MODES +} BoidMode; +typedef struct BoidData { + float health, acc[3]; + short state_id, mode; +} BoidData; + +// planned for near future +//typedef enum BoidConditionMode { +// eBoidConditionType_Then = 0, +// eBoidConditionType_And, +// eBoidConditionType_Or, +// NUM_BOID_CONDITION_MODES +//} BoidConditionMode; +//typedef enum BoidConditionType { +// eBoidConditionType_None = 0, +// eBoidConditionType_Signal, +// eBoidConditionType_NoSignal, +// eBoidConditionType_HealthBelow, +// eBoidConditionType_HealthAbove, +// eBoidConditionType_See, +// eBoidConditionType_NotSee, +// eBoidConditionType_StateTime, +// eBoidConditionType_Touching, +// NUM_BOID_CONDITION_TYPES +//} BoidConditionType; +//typedef struct BoidCondition { +// struct BoidCondition *next, *prev; +// int state_id; +// short type, mode; +// float threshold, probability; +// +// /* signals */ +// int signal_id, channels; +//} BoidCondition; + +typedef enum BoidRulesetType { + eBoidRulesetType_Fuzzy = 0, + eBoidRulesetType_Random, + eBoidRulesetType_Average, + NUM_BOID_RULESET_TYPES +} BoidRulesetType; +#define BOIDSTATE_CURRENT 1 +typedef struct BoidState { + struct BoidState *next, *prev; + ListBase rules; + ListBase conditions; + ListBase actions; + char name[32]; + int id, flag; + + /* rules */ + int ruleset_type; + float rule_fuzziness; + + /* signal */ + int signal_id, channels; + float volume, falloff; +} BoidState; + +// planned for near future +//typedef struct BoidSignal { +// struct BoidSignal *next, *prev; +// float loc[3]; +// float volume, falloff; +// int id; +//} BoidSignal; +//typedef struct BoidSignalDefine { +// struct BoidSignalDefine *next, *prev; +// int id, rt; +// char name[32]; +//} BoidSignalDefine; + +//typedef struct BoidSimulationData { +// ListBase signal_defines;/* list of defined signals */ +// ListBase signals[20]; /* gathers signals from all channels */ +// struct KDTree *signaltrees[20]; +// char channel_names[20][32]; +// int last_signal_id; /* used for incrementing signal ids */ +// int flag; /* switches for drawing stuff */ +//} BoidSimulationData; + +typedef struct BoidSettings { + int options, last_state_id; + + float landing_smoothness, rt; + float banking, height; + + float health, aggression; + float strength, accuracy, range; + + /* flying related */ + float air_min_speed, air_max_speed; + float air_max_acc, air_max_ave; + float air_personal_space; + + /* walk/run related */ + float land_jump_speed, land_max_speed; + float land_max_acc, land_max_ave; + float land_personal_space; + float land_stick_force; + + struct ListBase states; +} BoidSettings; + +/* boidsettings->options */ +#define BOID_ALLOW_FLIGHT 1 +#define BOID_ALLOW_LAND 2 +#define BOID_ALLOW_CLIMB 4 + +/* boidrule->options */ +//#define BOID_RULE_FOLLOW_LINE 1 /* follow leader */ +//#define BOID_RULE_PREDICT 2 /* goal/avoid */ +//#define BOID_RULE_ARRIVAL 4 /* goal */ +//#define BOID_RULE_LAND 8 /* goal */ +//#define BOID_RULE_WITH_BOIDS 16 /* avoid collision */ +//#define BOID_RULE_WITH_DEFLECTORS 32 /* avoid collision */ + +#endif diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index c7196763358..1bbccd20486 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -36,6 +36,7 @@ #define MAX_MTEX 18 #endif +struct CurveMapping; struct MTex; struct Image; @@ -47,20 +48,27 @@ typedef struct BrushClone { typedef struct Brush { ID id; + + struct BrushClone clone; + + struct CurveMapping *curve; /* falloff curve */ + struct MTex *mtex[18]; /* MAX_MTEX */ short flag, blend; /* general purpose flag, blend mode */ int size; /* brush diameter */ - float innerradius; /* inner radius after which the falloff starts */ + float jitter; /* jitter the position of the brush */ float spacing; /* spacing of paint operations */ + int smooth_stroke_radius; /* turning radius (in pixels) for smooth stroke */ + float smooth_stroke_factor; /* higher values limit fast changes in the stroke direction */ float rate; /* paint operations / second (airbrush) */ float rgb[3]; /* color */ float alpha; /* opacity */ - short texact, pad; - struct MTex *mtex[18]; /* MAX_MTEX */ - - struct BrushClone clone; + short texact; /* active texture */ + char sculpt_tool; /* active tool */ + + char pad[1]; } Brush; /* Brush.flag */ @@ -68,20 +76,27 @@ typedef struct Brush { #define BRUSH_TORUS 2 #define BRUSH_ALPHA_PRESSURE 4 #define BRUSH_SIZE_PRESSURE 8 -#define BRUSH_RAD_PRESSURE 16 +#define BRUSH_JITTER_PRESSURE 16 /* was BRUSH_RAD_PRESSURE */ #define BRUSH_SPACING_PRESSURE 32 #define BRUSH_FIXED_TEX 64 +#define BRUSH_RAKE 128 +#define BRUSH_ANCHORED 256 +#define BRUSH_DIR_IN 512 +#define BRUSH_SPACE 1024 +#define BRUSH_SMOOTH_STROKE 2048 +#define BRUSH_PERSISTENT 4096 -/* Brush.blend */ -#define BRUSH_BLEND_MIX 0 -#define BRUSH_BLEND_ADD 1 -#define BRUSH_BLEND_SUB 2 -#define BRUSH_BLEND_MUL 3 -#define BRUSH_BLEND_LIGHTEN 4 -#define BRUSH_BLEND_DARKEN 5 -#define BRUSH_BLEND_ERASE_ALPHA 6 -#define BRUSH_BLEND_ADD_ALPHA 7 +/* Brush.sculpt_tool */ +#define SCULPT_TOOL_DRAW 1 +#define SCULPT_TOOL_SMOOTH 2 +#define SCULPT_TOOL_PINCH 3 +#define SCULPT_TOOL_INFLATE 4 +#define SCULPT_TOOL_GRAB 5 +#define SCULPT_TOOL_LAYER 6 +#define SCULPT_TOOL_FLATTEN 7 +#define SCULPT_TOOL_CLAY 8 +/* ImagePaintSettings.tool */ #define PAINT_TOOL_DRAW 0 #define PAINT_TOOL_SOFTEN 1 #define PAINT_TOOL_SMEAR 2 diff --git a/source/blender/makesdna/DNA_camera_types.h b/source/blender/makesdna/DNA_camera_types.h index 6db8358affe..3d839570e17 100644 --- a/source/blender/makesdna/DNA_camera_types.h +++ b/source/blender/makesdna/DNA_camera_types.h @@ -32,17 +32,18 @@ #define DNA_CAMERA_TYPES_H #include "DNA_ID.h" -#include "DNA_scriptlink_types.h" #ifdef __cplusplus extern "C" { #endif -struct Ipo; struct Object; +struct AnimData; +struct Ipo; typedef struct Camera { ID id; + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ short type, flag; float passepartalpha, angle; @@ -57,9 +58,8 @@ typedef struct Camera { short YF_bkhtype, YF_bkhbias; float YF_bkhrot; - struct Ipo *ipo; + struct Ipo *ipo; // XXX depreceated... old animation system - ScriptLink scriptlink; struct Object *dof_ob; } Camera; @@ -76,6 +76,8 @@ typedef struct Camera { #define CAM_SHOWTITLESAFE 8 #define CAM_SHOWNAME 16 #define CAM_ANGLETOGGLE 32 +#define CAM_DS_EXPAND 64 +#define CAM_PANORAMA 128 /* yafray: dof sampling switch */ #define CAM_YF_NO_QMC 512 diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h index c99dc44cd5e..5cfecf7cc01 100644 --- a/source/blender/makesdna/DNA_cloth_types.h +++ b/source/blender/makesdna/DNA_cloth_types.h @@ -1,5 +1,5 @@ /** -* $Id: DNA_cloth_types.h,v 1.1 2007/08/01 02:28:34 daniel Exp $ +* $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -47,6 +47,9 @@ typedef struct ClothSimSettings float mingoal; /* see SB */ float Cdis; /* Mechanical damping of springs. */ float Cvi; /* Viscous/fluid damping. */ + /* XXX the extra space here results in wrong DNA parsing, + * and reconstruct fails and gives corrupt settings when + * removing it because the old dna is wrong ... */ float gravity [3]; /* Gravity/external force vector. */ float dt; /* This is the duration of our time step, computed. */ float mass; /* The mass of the entire cloth. */ @@ -65,6 +68,7 @@ typedef struct ClothSimSettings float defgoal; float goalspring; float goalfrict; + float velocity_smooth; /* smoothing of velocities for hair */ int stepsPerFrame; /* Number of time steps per frame. */ int flags; /* flags, see CSIMSETT_FLAGS enum above. */ int preroll; /* How many frames of simulation to do before we start. */ @@ -74,8 +78,7 @@ typedef struct ClothSimSettings short vgroup_mass; /* optional vertexgroup name for assigning weight.*/ short vgroup_struct; /* vertex group for scaling structural stiffness */ short presets; /* used for presets on GUI */ - short pad; - int pad2; + short pad; } ClothSimSettings; diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index fe19cf60f12..70430af3fc8 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -64,7 +64,8 @@ typedef struct bConstraint { float enforce; /* Amount of influence exherted by constraint (0.0-1.0) */ float headtail; /* Point along subtarget bone where the actual target is. 0=head (default for all), 1=tail*/ int pad; - struct Ipo *ipo; /* local influence ipo or driver */ + + struct Ipo *ipo; /* local influence ipo or driver */ // XXX depreceated for 2.5... old animation system hack } bConstraint; @@ -85,7 +86,7 @@ typedef struct bConstraintTarget { short space; /* space that target should be evaluated in (overrides bConstraint->tarspace) */ short flag; /* runtime settings (for editor, etc.) */ short type; /* type of target (B_CONSTRAINT_OB_TYPE) */ - short pad; + short rotOrder; /* rotation order for target (as defined in BLI_arithb.h) */ } bConstraintTarget; /* bConstraintTarget -> flag */ @@ -317,6 +318,15 @@ typedef struct bDistLimitConstraint { int pad; } bDistLimitConstraint; +typedef struct bShrinkwrapConstraint { + Object *target; + float dist; /* distance to kept from target */ + short shrinkType; /* shrink type (look on MOD shrinkwrap for values) */ + char projAxis; /* axis to project over UP_X, UP_Y, UP_Z */ + char pad[9]; +} bShrinkwrapConstraint; + + /* ------------------------------------------ */ /* bConstraint->type @@ -344,10 +354,11 @@ typedef enum B_CONSTAINT_TYPES { CONSTRAINT_TYPE_RIGIDBODYJOINT, /* rigidbody constraint */ CONSTRAINT_TYPE_CLAMPTO, /* clampto constraint */ CONSTRAINT_TYPE_TRANSFORM, /* transformation (loc/rot/size -> loc/rot/size) constraint */ + CONSTRAINT_TYPE_SHRINKWRAP, /* shrinkwrap (loc/rot) constraint */ /* NOTE: everytime a new constraint is added, update this */ - NUM_CONSTRAINT_TYPES= CONSTRAINT_TYPE_TRANSFORM + NUM_CONSTRAINT_TYPES= CONSTRAINT_TYPE_SHRINKWRAP } B_CONSTRAINT_TYPES; /* bConstraint->flag */ @@ -439,6 +450,11 @@ typedef enum B_CONSTRAINTCHANNEL_FLAG { #define TRACK_nY 0x04 #define TRACK_nZ 0x05 +/* FollowPath flags */ +#define FOLLOWPATH_FOLLOW 0x01 +#define FOLLOWPATH_STATIC 0x02 +#define FOLLOWPATH_RADIUS 0x04 + /* bTrackToConstraint->flags */ #define TARGET_Z_UP 0x01 diff --git a/source/blender/makesdna/DNA_controller_types.h b/source/blender/makesdna/DNA_controller_types.h index 376f95b0145..599bbf9653a 100644 --- a/source/blender/makesdna/DNA_controller_types.h +++ b/source/blender/makesdna/DNA_controller_types.h @@ -43,6 +43,9 @@ typedef struct bExpressionCont { typedef struct bPythonCont { struct Text *text; + char module[64]; + int mode; + int flag; /* only used for debug now */ } bPythonCont; typedef struct bController { @@ -76,6 +79,10 @@ typedef struct bController { #define CONT_DEL 2 #define CONT_NEW 4 #define CONT_MASK 8 +#define CONT_PRIO 16 + +/* pyctrl->flag */ +#define CONT_PY_DEBUG 1 #endif diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index f809cac037d..109a9528de2 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -45,13 +45,25 @@ struct Ipo; struct Key; struct Material; struct VFont; +struct AnimData; +struct SelBox; +struct EditFont; + +/* These two Lines with # tell makesdna this struct can be excluded. */ +# +# +typedef struct PathPoint { + float vec[4]; /* grr, cant get rid of tilt yet */ + float quat[4]; + float radius; +} PathPoint; /* These two Lines with # tell makesdna this struct can be excluded. */ # # typedef struct Path { int len; - float *data; + struct PathPoint *data; float totdist; } Path; @@ -60,36 +72,42 @@ typedef struct Path { # typedef struct BevList { struct BevList *next, *prev; - int nr, flag; - short poly, gat; + int nr, dupe_nr; + short poly, hole; } BevList; /* These two Lines with # tell makesdna this struct can be excluded. */ # # typedef struct BevPoint { - float x, y, z, alfa, radius, sina, cosa, mat[3][3]; - short f1, f2; + float vec[3], alfa, radius; + float sina, cosa; /* 2D Only */ + float dir[3], tan[3], quat[4]; /* 3D Only */ + short split_tag, dupe_tag; } BevPoint; -/* Keyframes on IPO curves and Points on Bezier Curves/Paths are generally BezTriples */ +/* Keyframes on F-Curves (allows code reuse of Bezier eval code) and + * Points on Bezier Curves/Paths are generally BezTriples + */ /* note: alfa location in struct is abused by Key system */ /* vec in BezTriple looks like this: vec[0][0]=x location of handle 1 vec[0][1]=y location of handle 1 - vec[0][2]=z location of handle 1 (not used for IpoCurve Points(2d)) + vec[0][2]=z location of handle 1 (not used for FCurve Points(2d)) vec[1][0]=x location of control point vec[1][1]=y location of control point vec[1][2]=z location of control point vec[2][0]=x location of handle 2 vec[2][1]=y location of handle 2 - vec[2][2]=z location of handle 2 (not used for IpoCurve Points(2d)) + vec[2][2]=z location of handle 2 (not used for FCurve Points(2d)) */ typedef struct BezTriple { float vec[3][3]; float alfa, weight, radius; /* alfa: tilt in 3D View, weight: used for softbody goal weight, radius: for bevel tapering */ - short h1, h2; /* h1, h2: the handle type of the two handles */ - char f1, f2, f3, hide; /* f1, f2, f3: used for selection status, hide: used to indicate whether BezTriple is hidden */ + short ipo; /* ipo: interpolation mode for segment from this BezTriple to the next */ + char h1, h2; /* h1, h2: the handle type of the two handles */ + char f1, f2, f3; /* f1, f2, f3: used for selection status */ + char hide; /* hide: used to indicate whether BezTriple is hidden (3D), type of keyframe (eBezTriple_KeyframeTypes) */ } BezTriple; /* note; alfa location in struct is abused by Key system */ @@ -134,13 +152,17 @@ typedef struct TextBox { typedef struct Curve { ID id; + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ struct BoundBox *bb; - ListBase nurb; + ListBase nurb; /* actual data, called splines in rna */ ListBase disp; + + ListBase *editnurb; /* edited data, not in file, use pointer so we can check for it */ + struct Object *bevobj, *taperobj, *textoncurve; - struct Ipo *ipo; + struct Ipo *ipo; // XXX depreceated... old animation system Path *path; struct Key *key; struct Material **mat; @@ -152,7 +174,10 @@ typedef struct Curve { float size[3]; float rot[3]; - int texflag; + int texflag; /* keep an int because of give_obdata_texspace() */ + + short drawflag, twist_mode, pad[2]; + float twist_smooth, pad2; short pathlen, totcol; short flag, bevresol; @@ -161,7 +186,11 @@ typedef struct Curve { /* default */ short resolu, resolv; short resolu_ren, resolv_ren; - int pad2; + + /* edit, index in nurb list */ + int actnu; + /* edit, last selected bpoint */ + BPoint *lastselbp; /* font part */ short len, lines, pos, spacemode; @@ -170,6 +199,9 @@ typedef struct Curve { float linewidth; char *str; + struct SelBox *selboxes; + struct EditFont *editfont; + char family[24]; struct VFont *vfont; struct VFont *vfontb; @@ -178,13 +210,14 @@ typedef struct Curve { int sepchar; - int totbox, actbox, pad; + float ctime; /* current evaltime - for use by Objects parented to curves */ + int totbox, actbox; struct TextBox *tb; int selstart, selend; struct CharInfo *strinfo; - struct CharInfo curinfo; + struct CharInfo curinfo; } Curve; /* **************** CURVE ********************* */ @@ -192,6 +225,10 @@ typedef struct Curve { /* texflag */ #define CU_AUTOSPACE 1 +/* drawflag */ +#define CU_HIDE_HANDLES (1 << 0) +#define CU_HIDE_NORMALS (1 << 1) + /* flag */ #define CU_3D 1 #define CU_FRONT 2 @@ -204,6 +241,15 @@ typedef struct Curve { #define CU_OFFS_PATHDIST 256 #define CU_FAST 512 /* Font: no filling inside editmode */ #define CU_RETOPO 1024 +#define CU_DS_EXPAND 2048 +#define CU_PATH_RADIUS 4096 /* make use of the path radius if this is enabled (default for new curves) */ + +/* twist mode */ +#define CU_TWIST_Z_UP 0 +// #define CU_TWIST_Y_UP 1 // not used yet +// #define CU_TWIST_X_UP 2 +#define CU_TWIST_MINIMUM 3 +#define CU_TWIST_TANGENT 4 /* spacemode */ #define CU_LEFT 0 @@ -214,6 +260,7 @@ typedef struct Curve { /* flag (nurb) */ #define CU_SMOOTH 1 +#define CU_2D 8 /* moved from type since 2.4x */ /* type (nurb) */ #define CU_POLY 0 @@ -221,17 +268,54 @@ typedef struct Curve { #define CU_BSPLINE 2 #define CU_CARDINAL 3 #define CU_NURBS 4 -#define CU_2D 8 +#define CU_TYPE (CU_POLY|CU_BEZIER|CU_BSPLINE|CU_CARDINAL|CU_NURBS) + + /* only for adding */ +#define CU_PRIMITIVE 0xF00 + + /* 2 or 4 points */ +#define CU_PRIM_CURVE 0x100 + /* 8 points circle */ +#define CU_PRIM_CIRCLE 0x200 + /* 4x4 patch Nurb */ +#define CU_PRIM_PATCH 0x300 +#define CU_PRIM_TUBE 0x400 +#define CU_PRIM_SPHERE 0x500 +#define CU_PRIM_DONUT 0x600 + /* 5 points, 5th order straight line (for anim path) */ +#define CU_PRIM_PATH 0x700 + /* flagu flagv (nurb) */ #define CU_CYCLIC 1 +/* *************** BEZTRIPLE **************** */ + /* h1 h2 (beztriple) */ -#define HD_FREE 0 -#define HD_AUTO 1 -#define HD_VECT 2 -#define HD_ALIGN 3 -#define HD_AUTO_ANIM 4 +typedef enum eBezTriple_Handle { + HD_FREE = 0, + HD_AUTO, + HD_VECT, + HD_ALIGN, + HD_AUTO_ANIM +} eBezTriple_Handle; + +/* interpolation modes (used only for BezTriple->ipo) */ +typedef enum eBezTriple_Interpolation { + BEZT_IPO_CONST = 0, /* constant interpolation */ + BEZT_IPO_LIN, /* linear interpolation */ + BEZT_IPO_BEZ, /* bezier interpolation */ +} eBezTriple_Interpolation; + +/* types of keyframe (used only for BezTriple->hide when BezTriple is used in F-Curves) */ +typedef enum eBezTriple_KeyframeType { + BEZT_KEYTYPE_KEYFRAME = 0, /* default - 'proper' Keyframe */ + BEZT_KEYTYPE_BREAKDOWN, /* 'breakdown' keyframe */ +} eBezTriple_KeyframeType; + +/* checks if the given BezTriple is selected */ +#define BEZSELECTED(bezt) (((bezt)->f2 & SELECT) || ((bezt)->f1 & SELECT) || ((bezt)->f3 & SELECT)) +#define BEZSELECTED_HIDDENHANDLES(cu, bezt) (((cu)->drawflag & CU_HIDE_HANDLES) ? (bezt)->f2 & SELECT : BEZSELECTED(bezt)) /* *************** CHARINFO **************** */ diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h index 6c098e220bb..18c18d9e9dd 100644 --- a/source/blender/makesdna/DNA_customdata_types.h +++ b/source/blender/makesdna/DNA_customdata_types.h @@ -37,6 +37,8 @@ typedef struct CustomDataLayer { int flag; /* general purpose flag */ int active; /* number of the active layer of this type */ int active_rnd; /* number of the layer to render*/ + int active_clone; /* number of the layer to render*/ + int active_mask; /* number of the layer to render*/ char pad[4]; char name[32]; /* layer name */ void *data; /* layer data */ @@ -72,7 +74,9 @@ typedef struct CustomData { #define CD_MLOOPUV 16 #define CD_MLOOPCOL 17 #define CD_TANGENT 18 -#define CD_NUMTYPES 19 +#define CD_MDISPS 19 +#define CD_WEIGHT_MCOL 20 /* for displaying weightpaint colors */ +#define CD_NUMTYPES 21 /* Bits for CustomDataMask */ #define CD_MASK_MVERT (1 << CD_MVERT) @@ -94,7 +98,11 @@ typedef struct CustomData { #define CD_MASK_MLOOPUV (1 << CD_MLOOPUV) #define CD_MASK_MLOOPCOL (1 << CD_MLOOPCOL) #define CD_MASK_TANGENT (1 << CD_TANGENT) +#define CD_MASK_MDISPS (1 << CD_MDISPS) +#define CD_MASK_WEIGHT_MCOL (1 << CD_WEIGHT_MCOL) +/* derivedmesh wants CustomDataMask for weightpaint too, is not customdata though */ +#define CD_MASK_WEIGHTPAINT (1 << CD_WEIGHTPAINT) /* CustomData.flag */ diff --git a/source/blender/makesdna/DNA_documentation.h b/source/blender/makesdna/DNA_documentation.h index b0b3646aed5..f8aa8ae5b2a 100644 --- a/source/blender/makesdna/DNA_documentation.h +++ b/source/blender/makesdna/DNA_documentation.h @@ -65,7 +65,7 @@ /* PLEASE READ INSTRUCTIONS ABOUT ADDING VARIABLES IN 'DNA' STRUCTS IN - ../blenloader/intern/genfile.c + intern/dna_genfile.c (ton) */ diff --git a/source/blender/makesdna/DNA_fileglobal_types.h b/source/blender/makesdna/DNA_fileglobal_types.h index 270cb107309..43ab895b398 100644 --- a/source/blender/makesdna/DNA_fileglobal_types.h +++ b/source/blender/makesdna/DNA_fileglobal_types.h @@ -31,6 +31,9 @@ #ifndef DNA_FILEGLOBAL_TYPES_H #define DNA_FILEGLOBAL_TYPES_H +struct bScreen; +struct Scene; + /** * FileGlobal stores a part of the current user-unterface settings at * the moment of saving, and the file-specific settings. @@ -40,8 +43,8 @@ typedef struct FileGlobal { short subversion, pads; short minversion, minsubversion; short displaymode, winpos; - void *curscreen; - void *curscene; + struct bScreen *curscreen; + struct Scene *curscene; int fileflags; int globalf; } FileGlobal; diff --git a/source/blender/makesdna/DNA_freestyle_types.h b/source/blender/makesdna/DNA_freestyle_types.h deleted file mode 100644 index 14c59d5adb2..00000000000 --- a/source/blender/makesdna/DNA_freestyle_types.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef DNA_FREESTYLE_TYPES_H -#define DNA_FREESTYLE_TYPES_H - -#include "DNA_listBase.h" - -typedef struct FreestyleModuleConfig { - struct FreestyleModuleConfig *next, *prev; - - char module_path[256]; - short is_displayed; - short pad[3]; - -} FreestyleModuleConfig; - -typedef struct FreestyleConfig { - ListBase modules; - - int flags; - float sphere_radius; - float dkr_epsilon; - int pad; - -} FreestyleConfig; - - - -#endif - diff --git a/source/blender/makesdna/DNA_radio_types.h b/source/blender/makesdna/DNA_genfile.h index e757024603b..4b9401bf4b9 100644 --- a/source/blender/makesdna/DNA_radio_types.h +++ b/source/blender/makesdna/DNA_genfile.h @@ -1,9 +1,5 @@ -/** - * radio_types.h dec 2000 Nzc - * - * All type defs for the Blender core. - * - * $Id$ +/* + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -29,22 +25,28 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** - * + * blenloader genfile private function prototypes */ -#ifndef DNA_RADIO_TYPES_H -#define DNA_RADIO_TYPES_H +#ifndef GENFILE_H +#define GENFILE_H + +struct SDNA; + +extern unsigned char DNAstr[]; /* DNA.c */ +extern int DNAlen; -typedef struct Radio { - short hemires, maxiter; - short drawtype, flag; /* bit 0 and 1: show limits */ - short subshootp, subshoote, nodelim, maxsublamp; - short pama, pami, elma, elmi; /* patch and elem limits */ - int maxnode; - float convergence; - float radfac, gamma; /* for display */ - -} Radio; +struct SDNA *DNA_sdna_from_data(void *data, int datalen, int do_endian_swap); +void DNA_sdna_free(struct SDNA *sdna); + +int DNA_struct_find_nr(struct SDNA *sdna, const char *str); +void DNA_struct_switch_endian(struct SDNA *oldsdna, int oldSDNAnr, char *data); +char *DNA_struct_get_compareflags(struct SDNA *sdna, struct SDNA *newsdna); +void *DNA_struct_reconstruct(struct SDNA *newsdna, struct SDNA *oldsdna, char *compflags, int oldSDNAnr, int blocks, void *data); + +int DNA_elem_array_size(const char *astr, int len); +int DNA_elem_offset(struct SDNA *sdna, char *stype, char *vartype, char *name); #endif + diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h index 70f469b2bb8..4bae9935ea7 100644 --- a/source/blender/makesdna/DNA_gpencil_types.h +++ b/source/blender/makesdna/DNA_gpencil_types.h @@ -33,7 +33,7 @@ /* Grease-Pencil Annotations - 'Stroke Point' * -> Coordinates may either be 2d or 3d depending on settings at the time * -> Coordinates of point on stroke, in proportions of window size - * (i.e. n/1000). This assumes that the bottom-left corner is (0,0) + * This assumes that the bottom-left corner is (0,0) */ typedef struct bGPDspoint { float x, y, z; /* co-ordinates of point (usually 2d, but can be 3d as well) */ @@ -117,6 +117,8 @@ typedef struct bGPDlayer { /* Grease-Pencil Annotations - 'DataBlock' */ typedef struct bGPdata { + ID id; /* Grease Pencil data is */ + /* saved Grease-Pencil data */ ListBase layers; /* bGPDlayers */ int flag; /* settings for this datablock */ @@ -131,13 +133,16 @@ typedef struct bGPdata { } bGPdata; /* bGPdata->flag */ +// XXX many of these flags should be depreceated for more general ideas in 2.5 /* don't allow painting to occur at all */ + // XXX is depreceated - not well understood #define GP_DATA_LMBPLOCK (1<<0) /* show debugging info in viewport (i.e. status print) */ #define GP_DATA_DISPINFO (1<<1) /* in Action Editor, show as expanded channel */ #define GP_DATA_EXPAND (1<<2) /* is the block overriding all clicks? */ + // XXX is depreceated - nasty old concept #define GP_DATA_EDITPAINT (1<<3) /* new strokes are added in viewport space */ #define GP_DATA_VIEWALIGN (1<<4) diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h index e1d79f0f875..65e4be1173d 100644 --- a/source/blender/makesdna/DNA_image_types.h +++ b/source/blender/makesdna/DNA_image_types.h @@ -34,6 +34,7 @@ #include "DNA_ID.h" struct PackedFile; +struct Scene; struct anim; struct ImBuf; struct RenderResult; @@ -51,6 +52,8 @@ typedef struct ImageUser { short multi_index, layer, pass; /* listbase indices, for menu browsing or retrieve buffer */ short menunr; /* localized menu entry, for handling browse event */ + + struct Scene *scene; /* to retrieve render result */ } ImageUser; /* iuser->flag */ @@ -84,6 +87,9 @@ typedef struct Image { struct PackedFile * packedfile; struct PreviewImage * preview; + /* not saved in file, statistics for render result */ + char *render_text; + float lastupdate; int lastused; short animspeed; @@ -92,10 +98,6 @@ typedef struct Image { /* display aspect - for UV editing images resized for faster openGL display */ float aspx, aspy; - -/*#ifdef WITH_VERSE*/ - void *vnode; /* pointer at verse bitmap node */ -/*#endif*/ } Image; @@ -121,5 +123,9 @@ typedef struct Image { /* ima->type and ima->source moved to BKE_image.h, for API */ +/* render_text maxlen */ +#define IMA_RW_MAXTEXT 512 + + #endif diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h index 432399e3581..58c26f06e4c 100644 --- a/source/blender/makesdna/DNA_ipo_types.h +++ b/source/blender/makesdna/DNA_ipo_types.h @@ -28,6 +28,17 @@ * * ***** END GPL LICENSE BLOCK ***** */ + +/* ============================================== + * ATTENTION: + * + * The contents of this file are now officially depreceated. They were used for the 'old' animation system, + * which has (as of 2.50) been replaced with a completely new system by Joshua Leung (aligorith). All defines, + * etc. are only still maintained to provide backwards compatability for old files... + * + * ============================================= + */ + #ifndef DNA_IPO_TYPES_H #define DNA_IPO_TYPES_H @@ -349,8 +360,8 @@ typedef struct Ipo { /* ******* PoseChannel (ID_PO) ********* */ -#define AC_TOTIPO 10 -#define AC_TOTNAM 10 +#define AC_TOTIPO 13 +#define AC_TOTNAM 13 #define AC_LOC_X 1 #define AC_LOC_Y 2 @@ -360,6 +371,10 @@ typedef struct Ipo { #define AC_SIZE_Y 14 #define AC_SIZE_Z 15 +#define AC_EUL_X 16 +#define AC_EUL_Y 17 +#define AC_EUL_Z 18 + #define AC_QUAT_W 25 #define AC_QUAT_X 26 #define AC_QUAT_Y 27 diff --git a/source/blender/makesdna/DNA_key_types.h b/source/blender/makesdna/DNA_key_types.h index 9e49bcfcb9a..c42e555d562 100644 --- a/source/blender/makesdna/DNA_key_types.h +++ b/source/blender/makesdna/DNA_key_types.h @@ -34,6 +34,7 @@ #include "DNA_listBase.h" #include "DNA_ID.h" +struct AnimData; struct Ipo; typedef struct KeyBlock { @@ -56,6 +57,7 @@ typedef struct KeyBlock { typedef struct Key { ID id; + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ KeyBlock *refkey; char elemstr[32]; @@ -63,7 +65,7 @@ typedef struct Key { float curval; ListBase block; - struct Ipo *ipo; + struct Ipo *ipo; // XXX depreceated... old animation system ID *from; @@ -85,7 +87,8 @@ typedef struct Key { #define KEY_BSPLINE 2 /* keyblock->flag */ -#define KEYBLOCK_MUTE 1 +#define KEYBLOCK_MUTE 1 +#define KEYBLOCK_DS_EXPAND 2 #endif diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_lamp_types.h index f8f2255c1a7..78c8d1a5607 100644 --- a/source/blender/makesdna/DNA_lamp_types.h +++ b/source/blender/makesdna/DNA_lamp_types.h @@ -32,20 +32,21 @@ #define DNA_LAMP_TYPES_H #include "DNA_ID.h" -#include "DNA_scriptlink_types.h" #ifndef MAX_MTEX #define MAX_MTEX 18 #endif struct MTex; -struct Ipo; struct CurveMapping; +struct AnimData; +struct Ipo; typedef struct Lamp { ID id; + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ - short type, pad3; + short type, flag; int mode; short colormodel, totex; @@ -102,17 +103,19 @@ typedef struct Lamp { float YF_glowint, YF_glowofs; short YF_glowtype, YF_pad2; + struct Ipo *ipo; // XXX depreceated... old animation system struct MTex *mtex[18]; /* MAX_MTEX */ - struct Ipo *ipo; + short pr_texture, pad[3]; /* preview */ struct PreviewImage *preview; - - ScriptLink scriptlink; } Lamp; /* **************** LAMP ********************* */ +/* flag */ +#define LA_DS_EXPAND 1 + /* type */ #define LA_LOCAL 0 #define LA_SUN 1 diff --git a/source/blender/makesdna/DNA_lattice_types.h b/source/blender/makesdna/DNA_lattice_types.h index e889e08b066..a2748617f18 100644 --- a/source/blender/makesdna/DNA_lattice_types.h +++ b/source/blender/makesdna/DNA_lattice_types.h @@ -52,6 +52,12 @@ typedef struct Lattice { struct Key *key; struct MDeformVert *dvert; + + /* used while deforming, always free and NULL after use */ + float *latticedata; + float latmat[4][4]; + + struct Lattice *editlatt; } Lattice; /* ***************** LATTICE ********************* */ diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index aa847050581..55e3c9107e4 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -32,7 +32,6 @@ #define DNA_MATERIAL_TYPES_H #include "DNA_ID.h" -#include "DNA_scriptlink_types.h" #include "DNA_listBase.h" #ifndef MAX_MTEX @@ -40,18 +39,47 @@ #endif struct MTex; -struct Ipo; -struct Material; struct ColorBand; struct Group; struct bNodeTree; +struct AnimData; +struct Ipo; /* WATCH IT: change type? also make changes in ipo.h */ +typedef struct VolumeSettings { + float density; + float emission; + float absorption; + float scattering; + + float emission_col[3]; + float absorption_col[3]; + float density_scale; + float depth_cutoff; + + short phasefunc_type; + short vpad[3]; + float phasefunc_g; + + float stepsize; + float shade_stepsize; + + short stepsize_type; + short shadeflag; + short shade_type; + short precache_resolution; + + float ms_diff; + float ms_intensity; + int ms_steps; +} VolumeSettings; + typedef struct Material { ID id; + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ - short colormodel, flag; + short material_type, flag; /* note, keep this below synced with render_types.h */ float r, g, b; float specr, specg, specb; @@ -62,6 +90,8 @@ typedef struct Material { float translucency; /* end synced with render_types.h */ + struct VolumeSettings vol; + float fresnel_mir, fresnel_mir_i; float fresnel_tra, fresnel_tra_i; float filter; /* filter added, for raytrace transparency and transmissivity */ @@ -92,12 +122,14 @@ typedef struct Material { /* for buttons and render*/ char rgbsel, texact, pr_type, use_nodes; - short pr_back, pr_lamp, pad4, ml_flag; /* ml_flag is for disable base material */ + short pr_back, pr_lamp, pr_texture, ml_flag; /* ml_flag is for disable base material */ /* shaders */ short diff_shader, spec_shader; float roughness, refrac; - float param[4]; /* size, smooth, size, smooth, for toonshader */ + /* XXX param[4] needs review and improvement (shader system as whole anyway) + This is nasty reused variable for different goals and not easy to RNAify nicely. -jesterKing */ + float param[4]; /* size, smooth, size, smooth, for toonshader, 0 (fac) and 1 (fresnel) also for fresnel shader */ float rms; float darkness; short texco, mapto; @@ -112,7 +144,7 @@ typedef struct Material { struct MTex *mtex[18]; /* MAX_MTEX */ struct bNodeTree *nodetree; - struct Ipo *ipo; + struct Ipo *ipo; // XXX depreceated... old animation system struct Group *group; /* light group */ struct PreviewImage * preview; @@ -131,38 +163,38 @@ typedef struct Material { /* yafray: absorption color, dispersion parameters and material preset menu */ float YF_ar, YF_ag, YF_ab, YF_dscale, YF_dpwr; int YF_dsmp, YF_preset, YF_djit; - - ScriptLink scriptlink; ListBase gpumaterial; /* runtime */ } Material; /* **************** MATERIAL ********************* */ - /* maximum number of materials per material array - * (on object, mesh, lamp, etc.) - */ -#define MAXMAT 16 +/* maximum number of materials per material array. + * (on object, mesh, lamp, etc.). limited by + * short mat_nr in verts, faces. */ +#define MAXMAT 32767 -/* colormodel */ -#define MA_RGB 0 -#define MA_CMYK 1 -#define MA_YUV 2 -#define MA_HSV 3 +/* material_type */ +#define MA_TYPE_SURFACE 0 +#define MA_TYPE_HALO 1 +#define MA_TYPE_VOLUME 2 +#define MA_TYPE_WIRE 3 /* flag */ /* for render */ #define MA_IS_USED 1 + /* for dopesheet */ +#define MA_DS_EXPAND 2 /* mode (is int) */ #define MA_TRACEBLE 1 #define MA_SHADOW 2 #define MA_SHLESS 4 -#define MA_WIRE 8 +#define MA_WIRE 8 /* deprecated */ #define MA_VERTEXCOL 16 #define MA_HALO_SOFT 16 -#define MA_HALO 32 -#define MA_ZTRA 64 +#define MA_HALO 32 /* deprecated */ +#define MA_ZTRANSP 64 #define MA_VERTEXCOLP 128 #define MA_ZINV 256 #define MA_HALO_RINGS 256 @@ -178,7 +210,7 @@ typedef struct Material { #define MA_NOMIST 0x4000 #define MA_HALO_SHADE 0x4000 #define MA_HALO_FLARE 0x8000 -#define MA_RADIO 0x10000 +#define MA_TRANSP 0x10000 #define MA_RAYTRANSP 0x20000 #define MA_RAYMIRROR 0x40000 #define MA_SHADOW_TRA 0x80000 @@ -222,7 +254,7 @@ typedef struct Material { #define MA_SPEC_WARDISO 4 /* dynamode */ -#define MA_DRAW_DYNABUTS 1 +#define MA_DRAW_DYNABUTS 1 /* deprecated */ #define MA_FH_NOR 2 /* ramps */ @@ -247,6 +279,8 @@ typedef struct Material { #define MA_RAMP_SAT 13 #define MA_RAMP_VAL 14 #define MA_RAMP_COLOR 15 +#define MA_RAMP_SOFT 16 +#define MA_RAMP_LINEAR 17 /* texco */ #define TEXCO_ORCO 1 @@ -285,6 +319,14 @@ typedef struct Material { #define MAP_WARP 8192 #define MAP_LAYER 16384 +/* volume mapto - reuse definitions for now - a bit naughty! */ +#define MAP_DENSITY 128 +#define MAP_EMISSION 64 +#define MAP_EMISSION_COL 1 +#define MAP_ABSORPTION 512 +#define MAP_ABSORPTION_COL 8 +#define MAP_SCATTERING 16 + /* mapto for halo */ //#define MAP_HA_COL 1 //#define MAP_HA_ALPHA 128 @@ -328,5 +370,29 @@ typedef struct Material { /* sss_flag */ #define MA_DIFF_SSS 1 +/* vol_stepsize_type */ +#define MA_VOL_STEP_RANDOMIZED 0 +#define MA_VOL_STEP_CONSTANT 1 +#define MA_VOL_STEP_ADAPTIVE 2 + +/* vol_shadeflag */ +#define MA_VOL_SHADED 1 +#define MA_VOL_RECVSHADOW 4 +#define MA_VOL_PRECACHESHADING 8 + +/* vol_shading_type */ +#define MA_VOL_SHADE_NONE 0 +#define MA_VOL_SHADE_SINGLE 1 +#define MA_VOL_SHADE_MULTIPLE 2 +#define MA_VOL_SHADE_SINGLEPLUSMULTIPLE 3 + +/* vol_phasefunc_type */ +#define MA_VOL_PH_ISOTROPIC 0 +#define MA_VOL_PH_MIEHAZY 1 +#define MA_VOL_PH_MIEMURKY 2 +#define MA_VOL_PH_RAYLEIGH 3 +#define MA_VOL_PH_HG 4 +#define MA_VOL_PH_SCHLICK 5 + #endif diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index 752a2360905..f7f1d3b53bd 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -46,6 +46,7 @@ struct Mesh; struct OcInfo; struct Multires; struct PartialVisibility; +struct EditMesh; typedef struct Mesh { ID id; @@ -63,11 +64,13 @@ typedef struct Mesh { struct TFace *tface; /* depecrated, use mtface */ struct MVert *mvert; /* array of verts */ struct MEdge *medge; /* array of edges */ - struct MDeformVert *dvert; /* __NLA */ + struct MDeformVert *dvert; /* deformgroup vertices */ struct MCol *mcol; /* array of colors, this must be the number of faces * 4 */ struct MSticky *msticky; struct Mesh *texcomesh; struct MSelect *mselect; + + struct EditMesh *edit_mesh; /* not saved in file! */ struct CustomData vdata, edata, fdata; @@ -86,8 +89,9 @@ typedef struct Mesh { float size[3]; float rot[3]; - float cubemapsize, pad; - + float cubemapsize; + + int drawflag; short smoothresh, flag; short subdiv, subdivr; @@ -96,10 +100,6 @@ typedef struct Mesh { struct Multires *mr; /* Multiresolution modeling data */ struct PartialVisibility *pv; -/*ifdef WITH_VERSE*/ - /* not written in file, pointer at geometry VerseNode */ - void *vnode; -/*#endif*/ } Mesh; /* deprecated by MTFace, only here for file reading */ @@ -127,6 +127,45 @@ typedef struct TFace { #define ME_SUBSURF 128 #define ME_OPT_EDGES 256 +/* me->drawflag, int */ +#define ME_DRAWEDGES (1 << 0) +#define ME_DRAWFACES (1 << 1) +#define ME_DRAWNORMALS (1 << 2) +#define ME_DRAW_VNORMALS (1 << 3) + +#define ME_ALLEDGES (1 << 4) +#define ME_HIDDENEDGES (1 << 5) + +#define ME_DRAWCREASES (1 << 6) +#define ME_DRAWSEAMS (1 << 7) +#define ME_DRAWSHARP (1 << 8) +#define ME_DRAWBWEIGHTS (1 << 9) + +#define ME_DRAW_EDGELEN (1 << 10) +#define ME_DRAW_FACEAREA (1 << 11) +#define ME_DRAW_EDGEANG (1 << 12) + +/* old global flags: +#define G_DRAWEDGES (1 << 18) +#define G_DRAWFACES (1 << 7) +#define G_DRAWNORMALS (1 << 6) +#define G_DRAW_VNORMALS (1 << 14) + +#define G_ALLEDGES (1 << 11) +#define G_HIDDENEDGES (1 << 21) + +#define G_DRAWCREASES (1 << 19) +#define G_DRAWSEAMS (1 << 20) +#define G_DRAWSHARP (1 << 28) +#define G_DRAWBWEIGHTS (1 << 31) + +#define G_DRAW_EDGELEN (1 << 22) +#define G_DRAW_FACEAREA (1 << 23) +#define G_DRAW_EDGEANG (1 << 24) +*/ + + + /* Subsurf Type */ #define ME_CC_SUBSURF 0 #define ME_SIMPLE_SUBSURF 1 diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h index fc686a4cc10..d53a7833d0e 100644 --- a/source/blender/makesdna/DNA_meshdata_types.h +++ b/source/blender/makesdna/DNA_meshdata_types.h @@ -30,13 +30,14 @@ #define DNA_MESHDATA_TYPES_H #include "DNA_customdata_types.h" +#include "DNA_listBase.h" struct Bone; struct Image; typedef struct MFace { unsigned int v1, v2, v3, v4; - char pad, mat_nr; + short mat_nr; char edcode, flag; /* we keep edcode, for conversion to edges draw flags in old files */ } MFace; @@ -60,7 +61,8 @@ typedef struct MDeformVert { typedef struct MVert { float co[3]; short no[3]; - char flag, mat_nr, bweight, pad[3]; + short mat_nr; + char flag, bweight, pad[2]; } MVert; /* at the moment alpha is abused for vertex painting @@ -116,7 +118,14 @@ typedef struct OrigSpaceFace { float uv[4][2]; } OrigSpaceFace; -/* Multiresolution modeling */ +typedef struct MDisps { + /* Strange bug in SDNA: if disps pointer comes first, it fails to see totdisp */ + int totdisp; + char pad[4]; + float (*disps)[3]; +} MDisps; + +/** Multires structs kept for compatibility with old files **/ typedef struct MultiresCol { float a, r, g, b; } MultiresCol; @@ -126,7 +135,7 @@ typedef struct MultiresColFace { } MultiresColFace; typedef struct MultiresFace { unsigned int v[4]; - unsigned int mid; + unsigned int mid; char flag, mat_nr, pad[2]; } MultiresFace; typedef struct MultiresEdge { @@ -142,15 +151,9 @@ typedef struct MultiresLevel { MultiresColFace *colfaces; MultiresEdge *edges; - /* Temporary connectivity data */ - char *edge_boundary_states; - struct ListBase *vert_edge_map; - struct ListBase *vert_face_map; - struct MultiresMapNode *map_mem; - unsigned int totvert, totface, totedge, pad; - /* Kept for compatibility with older files */ + /* Kept for compatibility with even older files */ MVert *verts; } MultiresLevel; @@ -168,6 +171,8 @@ typedef struct Multires { char *edge_creases; } Multires; +/** End Multires **/ + typedef struct PartialVisibility { unsigned int *vert_map; /* vert_map[Old Index]= New Index */ int *edge_map; /* edge_map[Old Index]= New Index, -1= hidden */ @@ -235,7 +240,7 @@ typedef struct PartialVisibility { #define TF_LIGHT 16 #define TF_SHAREDCOL 64 -#define TF_TILES 128 +#define TF_TILES 128 /* deprecated */ #define TF_BILLBOARD 256 #define TF_TWOSIDE 512 #define TF_INVISIBLE 1024 @@ -265,7 +270,4 @@ typedef struct PartialVisibility { #define TF_PIN3 64 #define TF_PIN4 128 -/* multires->flag */ -#define MULTIRES_NO_RENDER 1 - #endif diff --git a/source/blender/makesdna/DNA_meta_types.h b/source/blender/makesdna/DNA_meta_types.h index d0ebd937740..8b61405b851 100644 --- a/source/blender/makesdna/DNA_meta_types.h +++ b/source/blender/makesdna/DNA_meta_types.h @@ -35,6 +35,7 @@ #include "DNA_ID.h" struct BoundBox; +struct AnimData; struct Ipo; struct Material; @@ -48,7 +49,9 @@ typedef struct MetaElem { short type, flag, selcol1, selcol2; float x, y, z; /* Position of center of MetaElem */ float quat[4]; /* Rotation of MetaElem */ - float expx, expy, expz; /* dimension parameters, used for some types like cubes */ + float expx; /* dimension parameters, used for some types like cubes */ + float expy; + float expz; float rad; /* radius of the meta element */ float rad2; /* temp field, used only while processing */ float s; /* stiffness, how much of the element to fill */ @@ -60,17 +63,20 @@ typedef struct MetaElem { typedef struct MetaBall { ID id; + struct AnimData *adt; struct BoundBox *bb; ListBase elems; ListBase disp; - struct Ipo *ipo; + ListBase *editelems; /* not saved in files, note we use pointer for editmode check */ + struct Ipo *ipo; // XXX... depreceated (old animation system) /* material of the mother ball will define the material used of all others */ struct Material **mat; - short flag, totcol; + char flag, flag2; /* flag is enum for updates, flag2 is bitflags for settings */ + short totcol; int texflag; /* used to store MB_AUTOSPACE */ /* texture space, copied as one block in editobject.c */ @@ -84,8 +90,10 @@ typedef struct MetaBall { mother ball changes will effect other objects thresholds, but these may also have their own thresh as an offset */ float thresh; - - + + /* used in editmode */ + /*ListBase edit_elems;*/ + MetaElem *lastelem; } MetaBall; /* **************** METABALL ********************* */ @@ -99,6 +107,10 @@ typedef struct MetaBall { #define MB_UPDATE_FAST 2 #define MB_UPDATE_NEVER 3 +/* mb->flag2 */ +#define MB_DS_EXPAND (1<<0) + + /* ml->type */ #define MB_BALL 0 #define MB_TUBEX 1 /* depercated */ diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index ae07434a37f..54433fd4254 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -39,6 +39,9 @@ typedef enum ModifierType { eModifierType_Fluidsim, eModifierType_Mask, eModifierType_SimpleDeform, + eModifierType_Multires, + eModifierType_Surface, + eModifierType_Smoke, NUM_MODIFIER_TYPES } ModifierType; @@ -57,7 +60,10 @@ typedef struct ModifierData { int type, mode; char name[32]; - + + /* XXX for timing info set by caller... solve later? (ton) */ + struct Scene *scene; + char *error; } ModifierData; @@ -232,6 +238,22 @@ typedef struct BMeshModifierData { int type; } BMeshModifierData; + +/* Smoke modifier flags */ +#define MOD_SMOKE_TYPE_DOMAIN (1 << 0) +#define MOD_SMOKE_TYPE_FLOW (1 << 1) +#define MOD_SMOKE_TYPE_COLL (1 << 2) + +typedef struct SmokeModifierData { + ModifierData modifier; + + struct SmokeDomainSettings *domain; + struct SmokeFlowSettings *flow; /* inflow, outflow, smoke objects */ + struct SmokeCollSettings *coll; /* collision objects */ + float time; + int type; /* domain, inflow, outflow, ... */ +} SmokeModifierData; + typedef struct DisplaceModifierData { ModifierData modifier; @@ -267,7 +289,7 @@ typedef struct UVProjectModifierData { ModifierData modifier; /* the objects which do the projecting */ - struct Object *projectors[10]; + struct Object *projectors[10]; /* MOD_UVPROJECT_MAX */ struct Image *image; /* the image to project */ int flags; int num_projectors; @@ -375,6 +397,8 @@ typedef struct HookModifierData { ModifierData modifier; struct Object *object; + char subtarget[32]; /* optional name of bone target */ + float parentinv[4][4]; /* matrix making current transform unmodified */ float cent[3]; /* visualization of hook */ float falloff; /* if not zero, falloff is distance where influence zero */ @@ -390,12 +414,14 @@ typedef struct SoftbodyModifierData { } SoftbodyModifierData; typedef struct ClothModifierData { - ModifierData modifier; + ModifierData modifier; - struct Cloth *clothObject; /* The internal data structure for cloth. */ - struct ClothSimSettings *sim_parms; /* definition is in DNA_cloth_types.h */ - struct ClothCollSettings *coll_parms; /* definition is in DNA_cloth_types.h */ - struct PointCache *point_cache; /* definition is in DNA_object_force.h */ + struct Scene *scene; /* the context, time etc is here */ + struct Cloth *clothObject; /* The internal data structure for cloth. */ + struct ClothSimSettings *sim_parms; /* definition is in DNA_cloth_types.h */ + struct ClothCollSettings *coll_parms; /* definition is in DNA_cloth_types.h */ + struct PointCache *point_cache; /* definition is in DNA_object_force.h */ + struct ListBase ptcaches; } ClothModifierData; typedef struct CollisionModifierData { @@ -418,6 +444,19 @@ typedef struct CollisionModifierData { struct BVHTree *bvhtree; /* bounding volume hierarchy for this cloth object */ } CollisionModifierData; +typedef struct SurfaceModifierData { + ModifierData modifier; + + struct MVert *x; /* old position */ + struct MVert *v; /* velocity */ + + struct DerivedMesh *dm; + + struct BVHTreeFromMesh *bvhtree; /* bounding volume hierarchy of the mesh faces */ + + int cfra, numverts; +} SurfaceModifierData; + typedef enum { eBooleanModifierOp_Intersect, eBooleanModifierOp_Union, @@ -430,8 +469,8 @@ typedef struct BooleanModifierData { int operation, pad; } BooleanModifierData; -#define MOD_MDEF_INVERT_VGROUP (1<<0) -#define MOD_MDEF_DYNAMIC_BIND (1<<1) +#define MOD_MDEF_INVERT_VGROUP (1<<0) +#define MOD_MDEF_DYNAMIC_BIND (1<<1) typedef struct MDefInfluence { int vertex; @@ -489,12 +528,15 @@ typedef enum { eParticleInstanceFlag_Unborn = (1<<3), eParticleInstanceFlag_Alive = (1<<4), eParticleInstanceFlag_Dead = (1<<5), + eParticleInstanceFlag_KeepShape = (1<<6), + eParticleInstanceFlag_UseSize = (1<<7), } ParticleInstanceModifierFlag; typedef struct ParticleInstanceModifierData { ModifierData modifier; struct Object *ob; - short psys, flag, rt[2]; + short psys, flag, axis, rt; + float position, random_position; } ParticleInstanceModifierData; typedef enum { @@ -513,6 +555,17 @@ typedef struct ExplodeModifierData { float protect; } ExplodeModifierData; +typedef struct MultiresModifierData { + ModifierData modifier; + + struct MVert *undo_verts; /* Store DerivedMesh vertices for multires undo */ + int undo_verts_tot; /* Length of undo_verts array */ + char undo_signal; /* If true, signals to replace verts with undo verts */ + + char lvl, totlvl; + char simple; +} MultiresModifierData; + typedef struct FluidsimModifierData { ModifierData modifier; @@ -589,4 +642,6 @@ typedef struct SimpleDeformModifierData { coordinates or global coordinates of origin */ #define MOD_SIMPLEDEFORM_ORIGIN_LOCAL (1<<0) +#define MOD_UVPROJECT_MAX 10 + #endif diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index eda37d952c1..e70221df9ab 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -39,6 +39,8 @@ struct SpaceNode; struct bNodeLink; struct bNodeType; struct bNodeGroup; +struct AnimData; +struct uiBlock; #define NODE_MAXSTR 32 @@ -121,13 +123,16 @@ typedef struct bNode { float locx, locy; /* root offset for drawing */ float width, miniwidth; short custom1, custom2; /* to be abused for buttons */ + float custom3, custom4; short need_exec, exec; /* need_exec is set as UI execution event, exec is flag during exec */ + void *threaddata; /* optional extra storage for use in thread (read only then!) */ rctf totr; /* entire boundbox */ rctf butr; /* optional buttons area */ rctf prvr; /* optional preview area */ bNodePreview *preview; /* optional preview image */ + struct uiBlock *block; /* runtime during drawing */ struct bNodeType *typeinfo; /* lookup of callbacks and defaults */ @@ -153,12 +158,15 @@ typedef struct bNodeLink { bNode *fromnode, *tonode; bNodeSocket *fromsock, *tosock; + int flag, pad; + } bNodeLink; /* the basis for a Node tree, all links and nodes reside internal here */ -/* only re-usable node trees are in the library though, materials allocate own tree struct */ +/* only re-usable node trees are in the library though, materials and textures allocate own tree struct */ typedef struct bNodeTree { ID id; + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ ListBase nodes, links; @@ -177,14 +185,17 @@ typedef struct bNodeTree { bNodeSocket *selout; /* callbacks */ - void (*timecursor)(int nr); - void (*stats_draw)(char *str); - int (*test_break)(void); + void (*timecursor)(void *, int nr); + void (*stats_draw)(void *, char *str); + int (*test_break)(void *); + void *tbh, *tch, *sdh; + } bNodeTree; /* ntree->type, index */ #define NTREE_SHADER 0 #define NTREE_COMPOSIT 1 +#define NTREE_TEXTURE 2 /* ntree->init, flag */ #define NTREE_TYPE_INIT 1 @@ -285,4 +296,9 @@ typedef struct NodeLensDist { short jit, proj, fit, pad; } NodeLensDist; +/* TEX_output */ +typedef struct TexNodeOutput { + char name[32]; +} TexNodeOutput; + #endif diff --git a/source/blender/makesdna/DNA_object_fluidsim.h b/source/blender/makesdna/DNA_object_fluidsim.h index 2914330a2b0..da55fb1d47c 100644 --- a/source/blender/makesdna/DNA_object_fluidsim.h +++ b/source/blender/makesdna/DNA_object_fluidsim.h @@ -1,6 +1,6 @@ /** * - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -41,6 +41,7 @@ struct Ipo; struct MVert; typedef struct FluidsimSettings { + struct FluidsimModifierData *fmd; /* for fast RNA access */ /* domain,fluid or obstacle */ short type; /* display advanced options in fluid sim tab (on=1,off=0)*/ @@ -135,12 +136,12 @@ typedef struct FluidsimSettings { /* ob->fluidsimSettings defines */ #define OB_FLUIDSIM_ENABLE 1 #define OB_FLUIDSIM_DOMAIN 2 -#define OB_FLUIDSIM_FLUID 4 +#define OB_FLUIDSIM_FLUID 4 #define OB_FLUIDSIM_OBSTACLE 8 -#define OB_FLUIDSIM_INFLOW 16 -#define OB_FLUIDSIM_OUTFLOW 32 -#define OB_FLUIDSIM_PARTICLE 64 -#define OB_FLUIDSIM_CONTROL 128 +#define OB_FLUIDSIM_INFLOW 16 +#define OB_FLUIDSIM_OUTFLOW 32 +#define OB_FLUIDSIM_PARTICLE 64 +#define OB_FLUIDSIM_CONTROL 128 #define OB_TYPEFLAG_START 7 #define OB_FSGEO_THIN (1<<(OB_TYPEFLAG_START+1)) @@ -157,6 +158,7 @@ typedef struct FluidsimSettings { #define OB_FSPART_DROP (1<<2) #define OB_FSPART_NEWPART (1<<3) #define OB_FSPART_FLOAT (1<<4) +#define OB_FSPART_TRACER (1<<5) // new fluid bit flags for fss->flags - dg #define OB_FLUIDSIM_REVERSE (1 << 0) diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h index 21c5242a703..986a75f1a96 100644 --- a/source/blender/makesdna/DNA_object_force.h +++ b/source/blender/makesdna/DNA_object_force.h @@ -33,6 +33,8 @@ #ifdef __cplusplus extern "C" { #endif + +#include "DNA_listBase.h" typedef struct PartDeflect { short deflect; /* Deflection flag - does mesh deflect particles*/ @@ -69,15 +71,59 @@ typedef struct PartDeflect { struct Tex *tex; /* Texture of the texture effector */ struct RNG *rng; /* random noise generator for e.g. wind */ float f_noise; /* noise of force (currently used for wind) */ - int pad; + int seed; /* wind noise random seed */ } PartDeflect; +/* Point cache file data types: + * - used as (1<<flag) so poke jahka if you reach the limit of 15 + * - to add new data types update: + * * BKE_ptcache_data_size() + * * ptcache_file_init_pointers() +*/ +#define BPHYS_DATA_INDEX 0 +#define BPHYS_DATA_LOCATION 1 +#define BPHYS_DATA_VELOCITY 2 +#define BPHYS_DATA_ROTATION 3 +#define BPHYS_DATA_AVELOCITY 4 /* used for particles */ +#define BPHYS_DATA_XCONST 4 /* used for cloth */ +#define BPHYS_DATA_SIZE 5 +#define BPHYS_DATA_TIMES 6 +#define BPHYS_DATA_BOIDS 7 + +#define BPHYS_TOT_DATA 8 + +typedef struct PTCacheMem { + struct PTCacheMem *next, *prev; + int frame, totpoint; + unsigned int data_types, flag; + int *index_array; /* quick access to stored points with index */ + + void *data[8]; /* BPHYS_TOT_DATA */ + void *cur[8]; /* BPHYS_TOT_DATA */ +} PTCacheMem; + typedef struct PointCache { + struct PointCache *next, *prev; int flag; /* generic flag */ + int step; /* frames between cached frames */ int simframe; /* current frame of simulation (only if SIMULATION_VALID) */ int startframe; /* simulation start frame */ int endframe; /* simulation end frame */ int editframe; /* frame being edited (runtime only) */ + int last_exact; /* last exact frame that's cached */ + + /* for external cache files */ + int totpoint; /* number of cached points */ + int index, rt; /* modifier stack index */ + + char name[64]; + char prev_name[64]; + char info[64]; + char path[240]; /* file path */ + struct ListBase mem_cache; + + struct PTCacheEdit *edit; + void (*free_edit)(struct PTCacheEdit *edit); /* free callback */ } PointCache; typedef struct SBVertex { @@ -119,7 +165,8 @@ typedef struct BulletSoftBody { float kAHR; /* Anchors hardness [0,1] */ int collisionflags; /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */ int numclusteriterations; /* number of iterations to refine collision clusters*/ - + float welding; /* welding limit to remove duplicate/nearby vertices, 0.0..0.01 */ + float margin; /* margin specific to softbody */ } BulletSoftBody; /* BulletSoftBody.flag */ @@ -137,18 +184,21 @@ typedef struct BulletSoftBody { typedef struct SoftBody { - struct ParticleSystem *particles; /* particlesystem softbody */ - /* dynamic data */ int totpoint, totspring; struct BodyPoint *bpoint; /* not saved in file */ struct BodySpring *bspring; /* not saved in file */ - float pad; + char pad; + char msg_lock; + short msg_value; /* part of UI: */ /* general options */ float nodemass; /* softbody mass of *vertex* */ + char namedVG_Mass[32]; /* along with it introduce mass painting + starting to fix old bug .. nastyness that VG are indexes + rather find them by name tag to find it -> jow20090613 */ float grav; /* softbody amount of gravitaion to apply */ float mediafrict; /* friction to env */ float rklimit; /* error limit for ODE solver */ @@ -161,13 +211,18 @@ typedef struct SoftBody { float maxgoal; float defgoal; /* default goal for vertices without vgroup */ short vertgroup; /* index starting at 1 */ + char namedVG_Softgoal[32]; /* starting to fix old bug .. nastyness that VG are indexes + rather find them by name tag to find it -> jow20090613 */ short fuzzyness; /* */ /* springs */ float inspring; /* softbody inner springs */ float infrict; /* softbody inner springs friction */ - + char namedVG_Spring_K[32]; /* along with it introduce Spring_K painting + starting to fix old bug .. nastyness that VG are indexes + rather find them by name tag to find it -> jow20090613 */ + /* baking */ int sfra, efra; int interval; @@ -197,6 +252,7 @@ typedef struct SoftBody { float inpush; struct PointCache *pointcache; + struct ListBase ptcaches; } SoftBody; @@ -210,6 +266,7 @@ typedef struct SoftBody { #define PFIELD_HARMONIC 7 #define PFIELD_CHARGE 8 #define PFIELD_LENNARDJ 9 +#define PFIELD_BOID 10 /* pd->flag: various settings */ @@ -225,6 +282,7 @@ typedef struct SoftBody { #define PFIELD_USEMAXR 512 #define PFIELD_USEMINR 1024 #define PFIELD_TEX_ROOTCO 2048 +#define PFIELD_SURFACE 4096 /* pd->falloff */ #define PFIELD_FALL_SPHERE 0 @@ -243,11 +301,19 @@ typedef struct SoftBody { #define PTCACHE_OUTDATED 2 #define PTCACHE_SIMULATION_VALID 4 #define PTCACHE_BAKING 8 -#define PTCACHE_BAKE_EDIT 16 -#define PTCACHE_BAKE_EDIT_ACTIVE 32 +//#define PTCACHE_BAKE_EDIT 16 +//#define PTCACHE_BAKE_EDIT_ACTIVE 32 +#define PTCACHE_DISK_CACHE 64 +#define PTCACHE_QUICK_CACHE 128 +#define PTCACHE_FRAMES_SKIPPED 256 +#define PTCACHE_EXTERNAL 512 +#define PTCACHE_READ_INFO 1024 + +/* PTCACHE_OUTDATED + PTCACHE_FRAMES_SKIPPED */ +#define PTCACHE_REDO_NEEDED 258 /* ob->softflag */ -#define OB_SB_ENABLE 1 +#define OB_SB_ENABLE 1 /* deprecated, use modifier */ #define OB_SB_GOAL 2 #define OB_SB_EDGES 4 #define OB_SB_QUADS 8 @@ -260,7 +326,7 @@ typedef struct SoftBody { #define OB_SB_FACECOLL 1024 #define OB_SB_EDGECOLL 2048 #define OB_SB_COLLFINAL 4096 -//#define OB_SB_PROTECT_CACHE 8192 +#define OB_SB_BIG_UI 8192 #define OB_SB_AERO_ANGLE 16384 /* sb->solverflags */ diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index fad5c020727..a89f8e1fb2e 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -35,7 +35,6 @@ #include "DNA_listBase.h" #include "DNA_ID.h" -#include "DNA_scriptlink_types.h" #ifdef __cplusplus extern "C" { @@ -43,6 +42,7 @@ extern "C" { struct bPose; struct Object; +struct AnimData; struct Ipo; struct BoundBox; struct Path; @@ -53,7 +53,11 @@ struct SoftBody; struct FluidsimSettings; struct ParticleSystem; struct DerivedMesh; +struct SculptSession; +struct bGPdata; + +/* Vertex Groups - Name Info */ typedef struct bDeformGroup { struct bDeformGroup *next, *prev; char name[32]; @@ -90,7 +94,10 @@ typedef struct BoundBox { typedef struct Object { ID id; + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ + struct SculptSession *sculpt; + short type, partype; int par1, par2, par3; /* can be vertexnrs */ char parsubstr[32]; /* String describing subobject info */ @@ -98,21 +105,30 @@ typedef struct Object { /* if ob->proxy (or proxy_group), this object is proxy for object ob->proxy */ /* proxy_from is set in target back to the proxy. */ struct Object *proxy, *proxy_group, *proxy_from; - struct Ipo *ipo; + struct Ipo *ipo; // XXX depreceated... old animation system struct Path *path; struct BoundBox *bb; - struct bAction *action; + struct bAction *action; // XXX depreceated... old animation system struct bAction *poselib; struct bPose *pose; void *data; - ListBase constraintChannels; + struct bGPdata *gpd; /* Grease Pencil data */ + + ListBase constraintChannels; // XXX depreceated... old animation system ListBase effect; ListBase disp; ListBase defbase; ListBase modifiers; /* list of ModifierData structures */ - - struct Material **mat; + + int mode; /* Local object mode */ + int restore_mode; /* Keep track of what mode to return to after toggling a mode */ + + /* materials */ + struct Material **mat; /* material slots */ + char *matbits; /* 1 if material linked to object */ + int totcol; /* copy of mesh or curve or meta */ + int actcol; /* currently selected material in the UI */ /* rot en drot have to be together! (transform('r' en 's')) */ float loc[3], dloc[3], orig[3]; @@ -127,17 +143,17 @@ typedef struct Object { unsigned int lay; /* copy of Base */ short flag; /* copy of Base */ - short colbits; /* when zero, from obdata */ + short colbits; /* deprecated */ - short transflag, ipoflag; /* transformation and ipo settings */ + short transflag, protectflag; /* transformation settings and transform locks */ short trackflag, upflag; - short nlaflag, protectflag; /* nlaflag defines NLA override, protectflag is bits to lock transform */ + short nlaflag, ipoflag; // xxx depreceated... old animation system short ipowin, scaflag; /* ipowin: blocktype last ipowindow */ short scavisflag, boundtype; int dupon, dupoff, dupsta, dupend; - float sf, ctime; /* sf is time-offset, ctime is the objects current time */ + float sf, ctime; /* sf is time-offset, ctime is the objects current time (XXX timing needs to be revised) */ /* during realtime */ @@ -157,16 +173,15 @@ typedef struct Object { float formfactor; float rdamping, sizefac; float margin; - int pad3; + float max_vel; /* clamp the maximum velocity 0.0 is disabled */ + float min_vel; /* clamp the maximum velocity 0.0 is disabled */ + float m_contactProcessingThreshold; char dt, dtx; - char totcol; /* copy of mesh or curve or meta */ - char actcol; /* currently selected material in the user interface */ - char empty_drawtype, pad1[3]; + char empty_drawtype, pad1[5]; float empty_drawsize; float dupfacesca; /* dupliface scale */ - ScriptLink scriptlink; ListBase prop; ListBase sensors; ListBase controllers; @@ -199,8 +214,8 @@ typedef struct Object { short recalc; /* dependency flag */ float anisotropicFriction[3]; - ListBase constraints; - ListBase nlastrips; + ListBase constraints; /* object constraints */ + ListBase nlastrips; // XXX depreceated... old animation system ListBase hooks; ListBase particlesystem; /* particle systems */ @@ -223,13 +238,11 @@ typedef struct Object { int lastDataMask; /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */ unsigned int state; /* bit masks of game controllers that are active */ unsigned int init_state; /* bit masks of initial state as recorded by the users */ - int pad2; -/*#ifdef WITH_VERSE*/ - void *vnode; /* pointer at object VerseNode */ -/*#endif*/ + int pad2; ListBase gpulamp; /* runtime, for lamps only */ + ListBase pc_ids; } Object; /* Warning, this is not used anymore because hooks are now modifiers */ @@ -306,6 +319,7 @@ extern Object workob; #define OB_RENDER_DUPLI 4096 /* (short) ipoflag */ + // XXX depreceated - old animation system crap #define OB_DRAWKEY 1 #define OB_DRAWKEYSEL 2 #define OB_OFFS_OB 4 @@ -340,18 +354,6 @@ extern Object workob; #define OB_SHADED 4 #define OB_TEXTURE 5 -/* this condition has been made more complex since editmode can draw textures */ -#define CHECK_OB_DRAWTEXTURE(vd, dt) \ - ((vd->drawtype==OB_TEXTURE && dt>OB_SOLID) || \ - (vd->drawtype==OB_SOLID && vd->flag2 & V3D_SOLID_TEX)) - -#define CHECK_OB_DRAWFACEDOT(sce, vd, dt) \ - ( (sce->selectmode & SCE_SELECT_FACE) && \ - (vd->drawtype<=OB_SOLID) && \ - (((vd->drawtype==OB_SOLID) && (dt>=OB_SOLID) && (vd->flag2 & V3D_SOLID_TEX) && (vd->flag & V3D_ZBUF_SELECT)) == 0) \ - ) - - /* dtx: flags, char! */ #define OB_AXIS 2 #define OB_TEXSPACE 4 @@ -395,6 +397,8 @@ extern Object workob; #define BA_FROMSET 128 +#define BA_TRANSFORM_CHILD 256 /* child of a transformed object */ + /* an initial attempt as making selection more specific! */ #define BA_DESELECT 0 #define BA_SELECT 1 @@ -404,7 +408,6 @@ extern Object workob; #define OB_DONE 1024 #define OB_RADIO 2048 #define OB_FROMGROUP 4096 -#define OB_POSEMODE 8192 /* ob->recalc (flag bits!) */ #define OB_RECALC_OB 1 @@ -435,9 +438,17 @@ extern Object workob; #define OB_COLLISION 65536 #define OB_SOFT_BODY 0x20000 +#define OB_OCCLUDER 0x40000 +#define OB_SENSOR 0x80000 /* ob->gameflag2 */ #define OB_NEVER_DO_ACTIVITY_CULLING 1 +#define OB_LOCK_RIGID_BODY_X_AXIS 4 +#define OB_LOCK_RIGID_BODY_Y_AXIS 8 +#define OB_LOCK_RIGID_BODY_Z_AXIS 16 +#define OB_LOCK_RIGID_BODY_X_ROT_AXIS 32 +#define OB_LOCK_RIGID_BODY_Y_ROT_AXIS 64 +#define OB_LOCK_RIGID_BODY_Z_ROT_AXIS 128 #define OB_LIFE (OB_PROP|OB_DYNAMIC|OB_ACTOR|OB_MAINACTOR|OB_CHILD) @@ -447,6 +458,8 @@ extern Object workob; #define OB_BODY_TYPE_DYNAMIC 2 #define OB_BODY_TYPE_RIGID 3 #define OB_BODY_TYPE_SOFT 4 +#define OB_BODY_TYPE_OCCLUDER 5 +#define OB_BODY_TYPE_SENSOR 6 /* ob->scavisflag */ #define OB_VIS_SENS 1 @@ -474,8 +487,20 @@ extern Object workob; #define OB_SHAPE_TEMPLOCK 2 /* ob->nlaflag */ -#define OB_NLA_OVERRIDE 1 -#define OB_NLA_COLLAPSED 2 + // XXX depreceated - old animation system +#define OB_NLA_OVERRIDE (1<<0) +#define OB_NLA_COLLAPSED (1<<1) + + /* object-channel expanded status */ +#define OB_ADS_COLLAPSED (1<<10) + /* object's ipo-block */ +#define OB_ADS_SHOWIPO (1<<11) + /* object's constraint channels */ +#define OB_ADS_SHOWCONS (1<<12) + /* object's material channels */ +#define OB_ADS_SHOWMATS (1<<13) + /* object's marticle channels */ +#define OB_ADS_SHOWPARTS (1<<14) /* ob->protectflag */ #define OB_LOCK_LOCX 1 @@ -490,8 +515,20 @@ extern Object workob; #define OB_LOCK_SCALEY 128 #define OB_LOCK_SCALEZ 256 #define OB_LOCK_SCALE 448 - -/* ob->softflag in DNA_object_force.h */ +#define OB_LOCK_ROTW 512 +#define OB_LOCK_ROT4D 1024 + +/* ob->mode */ +typedef enum ObjectMode { + OB_MODE_OBJECT = 0, + OB_MODE_EDIT = 1, + OB_MODE_SCULPT = 2, + OB_MODE_VERTEX_PAINT = 4, + OB_MODE_WEIGHT_PAINT = 8, + OB_MODE_TEXTURE_PAINT = 16, + OB_MODE_PARTICLE_EDIT = 32, + OB_MODE_POSE = 64 +} ObjectMode; #ifdef __cplusplus } diff --git a/source/blender/makesdna/DNA_oops_types.h b/source/blender/makesdna/DNA_outliner_types.h index 0a6b1a45b11..b19db15d73b 100644 --- a/source/blender/makesdna/DNA_oops_types.h +++ b/source/blender/makesdna/DNA_outliner_types.h @@ -1,6 +1,4 @@ /** - * blenlib/DNA_oops_types.h (mar-2001 nzc) - * * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -28,11 +26,8 @@ * * ***** END GPL LICENSE BLOCK ***** */ -#ifndef DNA_OOPS_TYPES_H -#define DNA_OOPS_TYPES_H - -#define OOPSX 5.0 -#define OOPSY 1.8 +#ifndef DNA_OUTLINER_TYPES_H +#define DNA_OUTLINER_TYPES_H #include "DNA_listBase.h" @@ -48,30 +43,6 @@ typedef struct TreeStore { TreeStoreElem *data; } TreeStore; -typedef struct Oops { - struct Oops *next, *prev; - short type, flag, dt, hide; - float x, y; /* left - bottom */ - float dx, dy; /* shuffle */ - struct ID *id; - ListBase link; -} Oops; - -# -# -typedef struct OopsLink { - struct OopsLink *next, *prev; - short type, flag; - struct ID **idfrom; - Oops *to, *from; /* from is for temp */ - float xof, yof; - char name[12]; -} OopsLink; - -/* oops->flag (1==SELECT) */ -#define OOPS_DOSELECT 2 -#define OOPS_REFER 4 - /* TreeStoreElem->flag */ #define TSE_CLOSED 1 #define TSE_SELECTED 2 diff --git a/source/blender/makesdna/DNA_packedFile_types.h b/source/blender/makesdna/DNA_packedFile_types.h index 2c965c92849..f11c51692e1 100644 --- a/source/blender/makesdna/DNA_packedFile_types.h +++ b/source/blender/makesdna/DNA_packedFile_types.h @@ -36,8 +36,6 @@ typedef struct PackedFile { int size; int seek; - int flags; - int pad; void * data; } PackedFile; @@ -60,3 +58,4 @@ enum PF_FileStatus #endif /* PACKEDFILE_TYPES_H */ + diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 7dd69b2151c..089c1c76bcf 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -1,7 +1,7 @@ /* DNA_particle_types.h * * - * $Id: DNA_particle_types.h $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -33,6 +33,9 @@ #define DNA_PARTICLE_TYPES_H #include "DNA_ID.h" +#include "DNA_boid_types.h" + +struct AnimData; typedef struct HairKey { float co[3]; /* location of hair vertex */ @@ -50,62 +53,73 @@ typedef struct ParticleKey { /* when changed update size of struct to copy_parti float time; /* when this key happens */ } ParticleKey; +typedef struct BoidParticle { + struct Object *ground; + struct BoidData data; + float gravity[3]; + float wander[3]; + float rt; +} BoidParticle; + /* Child particles are created around or between parent particles */ typedef struct ChildParticle { int num, parent; /* num is face index on the final derived mesh */ int pa[4]; /* nearest particles to the child, used for the interpolation */ float w[4]; /* interpolation weights for the above particles */ float fuv[4], foffset; /* face vertex weights and offset */ - float rand[3]; + float rt; } ChildParticle; -/* Everything that's non dynamic for a particle: */ -typedef struct ParticleData { - struct Object *stick_ob;/* object that particle sticks to when dead */ +typedef struct ParticleTarget { + struct ParticleTarget *next, *prev; + struct Object *ob; + int psys; + short flag, mode; + float time, duration; +} ParticleTarget; - ParticleKey state; /* normally current global coordinates or */ - /* in sticky object space if dead & sticky */ +typedef struct ParticleData { + ParticleKey state; /* current global coordinates */ ParticleKey prev_state; /* previous state */ - + HairKey *hair; /* hair vertices */ - ParticleKey *keys; /* keyed states */ + ParticleKey *keys; /* keyed keys */ - float i_rot[4],r_rot[4];/* initial & random values (i_rot should be removed as it's not used anymore)*/ - float r_ave[3],r_ve[3]; + BoidParticle *boid; /* boids data */ - float fuv[4], foffset; /* coordinates on face/edge number "num" and depth along*/ - /* face normal for volume emission */ + int totkey; /* amount of hair or keyed keys*/ float time, lifetime; /* dietime is not nescessarily time+lifetime as */ float dietime; /* particles can die unnaturally (collision) */ - float bank; /* banking angle for boids */ - - float size, sizemul; /* size and multiplier so that we can update size when ever */ - int num; /* index to vert/edge/face */ int num_dmcache; /* index to derived mesh data (face) to avoid slow lookups */ - int pad; - int totkey; - int bpi; /* softbody body point start index */ + float fuv[4], foffset; /* coordinates on face/edge number "num" and depth along*/ + /* face normal for volume emission */ + + float size; /* size and multiplier so that we can update size when ever */ short flag; - short alive; /* the life state of a particle */ + short alive; /* the life state of a particle */ short loop; /* how many times particle life has looped */ - short rt2; + short hair_index; } ParticleData; typedef struct ParticleSettings { ID id; + struct AnimData *adt; + + struct BoidSettings *boids; int flag; short type, from, distr; /* physics modes */ short phystype, rotmode, avemode, reactevent; short draw, draw_as, draw_size, childtype; + short ren_as, rt2; /* number of path segments, power of 2 except */ short draw_step, ren_step; short hair_step, keys_step; @@ -114,7 +128,7 @@ typedef struct ParticleSettings { short adapt_angle, adapt_pix; short disp, omat, interpolation, rotfrom, integrator; - short kink, kink_axis, nbetween, boidneighbours; + short kink, kink_axis; /* billboards */ short bb_align, bb_uv_split, bb_anim, bb_split_offset; @@ -127,7 +141,7 @@ typedef struct ParticleSettings { /* general values */ float sta, end, lifetime, randlife; - float timetweak, jitfac, keyed_time, eff_hair, rt; + float timetweak, jitfac, eff_hair; int totpart, userjit, grid_res; /* initial velocity factors */ @@ -138,11 +152,11 @@ typedef struct ParticleSettings { /* global physical properties */ float acc[3], dragfac, brownfac, dampfac; /* length */ - float length, abslength, randlength; + float randlength; /* children */ int child_nbr, ren_child_nbr; float parents, childsize, childrandsize; - float childrad, childflat, childspread; + float childrad, childflat; /* clumping */ float clumpfac, clumppow; /* kink */ @@ -151,22 +165,24 @@ typedef struct ParticleSettings { float rough1, rough1_size; float rough2, rough2_size, rough2_thres; float rough_end, rough_end_shape; + /* length */ + float clength, clength_thres; /* branching */ float branch_thres; /* drawing stuff */ float draw_line[2]; + float path_start, path_end; + int trail_count; + /* keyed particles */ + int keyed_loops; - /* boids */ - float max_vel, max_lat_acc, max_tan_acc; - float average_vel, banking, max_bank, groundz; - float boidfac[8]; - char boidrule[8]; + float effector_weight[10]; struct Group *dup_group; struct Group *eff_group; struct Object *dup_ob; struct Object *bb_ob; - struct Ipo *ipo; + struct Ipo *ipo; // xxx depreceated... old animation system struct PartDeflect *pd; struct PartDeflect *pd2; } ParticleSettings; @@ -179,25 +195,31 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in ParticleData *particles; /* (parent) particles */ ChildParticle *child; /* child particles */ - struct ParticleEdit *edit; /* particle editmode (runtime) */ + struct PTCacheEdit *edit; /* particle editmode (runtime) */ + void (*free_edit)(struct PTCacheEdit *edit); /* free callback */ struct ParticleCacheKey **pathcache; /* path cache (runtime) */ struct ParticleCacheKey **childcache; /* child cache (runtime) */ ListBase pathcachebufs, childcachebufs; /* buffers for the above */ - struct SoftBody *soft; /* hair softbody */ + struct ClothModifierData *clmd; /* cloth simulation for hair */ + struct DerivedMesh *hair_in_dm, *hair_out_dm; /* input/output for cloth simulation */ struct Object *target_ob; - struct Object *keyed_ob; struct Object *lattice; + struct Object *parent; /* particles from global space -> parent space */ struct ListBase effectors, reactevents; /* runtime */ + + struct ListBase targets; /* used for keyed and boid physics */ + + char name[32]; /* particle system name */ float imat[4][4]; /* used for duplicators */ - float cfra; - int seed; - int flag, totpart, totchild, totcached, totchildcache, rt; - short recalc, target_psys, keyed_psys, totkeyed, softflag, bakespace; + float cfra, tree_frame; + int seed, rt; + int flag, totpart, totchild, totcached, totchildcache; + short recalc, target_psys, totkeyed, bakespace; char bb_uvname[3][32]; /* billboard uv name */ @@ -209,20 +231,20 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in /* point cache */ struct PointCache *pointcache; -}ParticleSystem; + struct ListBase ptcaches; -/* general particle maximums */ -/* no special why's, just seem reasonable */ -/* changing these (atleast upwards) should not cause any major problems */ -#define MAX_PARTS 100000 /* real particles/system */ -#define MAX_PART_CHILDREN 10000 /* child particles/real particles */ -#define MAX_BOIDNEIGHBOURS 10 /* neigbours considered/boid */ + struct KDTree *tree; /* used for interactions with self and other systems */ + + struct ParticleDrawData *pdd; + + float *frand; /* array of 1024 random floats for fast lookups */ +}ParticleSystem; /* part->type */ /* hair is allways baked static in object/geometry space */ /* other types (normal particles) are in global space and not static baked */ #define PART_EMITTER 0 -#define PART_REACTOR 1 +//#define PART_REACTOR 1 #define PART_HAIR 2 #define PART_FLUID 3 @@ -231,7 +253,8 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PART_REACT_MULTIPLE 2 #define PART_LOOP 4 -//#define PART_LOOP_INSTANT 8 + /* for dopesheet */ +#define PART_DS_EXPAND 8 #define PART_HAIR_GEOMETRY 16 @@ -241,16 +264,16 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PART_TRAND 128 #define PART_EDISTR 256 /* particle/face from face areas */ -#define PART_STICKY 512 /*collided particles can stick to collider*/ +//#define PART_STICKY 512 /*collided particles can stick to collider*/ #define PART_DIE_ON_COL (1<<12) #define PART_SIZE_DEFL (1<<13) /* swept sphere deflections */ #define PART_ROT_DYN (1<<14) /* dynamic rotation */ #define PART_SIZEMASS (1<<16) -#define PART_ABS_LENGTH (1<<15) +//#define PART_KEYED_TIMING (1<<15) -#define PART_ABS_TIME (1<<17) -#define PART_GLOB_TIME (1<<18) +//#define PART_ABS_TIME (1<<17) +//#define PART_GLOB_TIME (1<<18) #define PART_BOIDS_2D (1<<19) @@ -301,12 +324,12 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in /* part->draw */ #define PART_DRAW_VEL 1 -#define PART_DRAW_ANG 2 +//#define PART_DRAW_PATH_LEN 2 #define PART_DRAW_SIZE 4 #define PART_DRAW_EMITTER 8 /* render emitter also */ -#define PART_DRAW_KEYS 16 -#define PART_DRAW_ADAPT 32 -#define PART_DRAW_COS 64 +#define PART_DRAW_HEALTH 16 +#define PART_ABS_PATH_TIME 32 +//#define PART_DRAW_TRAIL 64 /* deprecated */ #define PART_DRAW_BB_LOCK 128 #define PART_DRAW_PARENT 256 #define PART_DRAW_NUM 512 @@ -340,9 +363,11 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PART_BB_OFF_LINEAR 1 #define PART_BB_OFF_RANDOM 2 -/* part->draw as */ +/* part->draw_as */ +/* part->ren_as*/ #define PART_DRAW_NOT 0 #define PART_DRAW_DOT 1 +#define PART_DRAW_HALO 1 #define PART_DRAW_CIRC 2 #define PART_DRAW_CROSS 3 #define PART_DRAW_AXIS 4 @@ -351,6 +376,7 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PART_DRAW_OB 7 #define PART_DRAW_GR 8 #define PART_DRAW_BB 9 +#define PART_DRAW_REND 10 /* part->integrator */ #define PART_INT_EULER 0 @@ -381,37 +407,33 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PART_CHILD_FACES 2 /* psys->recalc */ -#define PSYS_INIT 1 -#define PSYS_DISTR 2 -#define PSYS_ALLOC 4 -#define PSYS_TYPE 8 -#define PSYS_RECALC_HAIR 16 +#define PSYS_RECALC_REDO 1 /* only do pathcache etc */ +#define PSYS_RECALC_RESET 2 /* reset everything including pointcache */ +#define PSYS_RECALC_TYPE 4 /* handle system type change */ +#define PSYS_RECALC_CHILD 16 /* only child settings changed */ +#define PSYS_RECALC_PHYS 32 /* physics type changed */ /* psys->flag */ #define PSYS_CURRENT 1 -//#define PSYS_BAKING 2 -//#define PSYS_BAKE_UI 4 -#define PSYS_KEYED_TIME 8 +#define PSYS_GLOBAL_HAIR 2 +#define PSYS_HAIR_DYNAMICS 4 +#define PSYS_KEYED_TIMING 8 #define PSYS_ENABLED 16 /* deprecated */ -#define PSYS_FIRST_KEYED 32 +#define PSYS_HAIR_UPDATED 32 /* signal for updating hair particle mode */ #define PSYS_DRAWING 64 //#define PSYS_SOFT_BAKE 128 #define PSYS_DELETE 256 /* remove particlesystem as soon as possible */ #define PSYS_HAIR_DONE 512 #define PSYS_KEYED 1024 #define PSYS_EDITED 2048 -//#define PSYS_PROTECT_CACHE 4096 +//#define PSYS_PROTECT_CACHE 4096 /* deprecated */ #define PSYS_DISABLED 8192 /* pars->flag */ #define PARS_UNEXIST 1 #define PARS_NO_DISP 2 -#define PARS_STICKY 4 -#define PARS_TRANSFORM 8 -#define PARS_HIDE 16 -#define PARS_TAG 32 -#define PARS_REKEY 64 -#define PARS_EDIT_RECALC 128 +//#define PARS_STICKY 4 /* deprecated */ +#define PARS_REKEY 8 /* pars->alive */ #define PARS_KILLED 0 @@ -436,22 +458,13 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PSYS_VG_ROT 10 #define PSYS_VG_EFFECTOR 11 -/* part->boidrules */ -#define BOID_TOT_RULES 8 - -#define BOID_COLLIDE 0 -#define BOID_AVOID 1 -#define BOID_CROWD 2 -#define BOID_CENTER 3 -#define BOID_AV_VEL 4 -#define BOID_VEL_MATCH 5 -#define BOID_GOAL 6 -#define BOID_LEVEL 7 - +/* ParticleTarget->flag */ +#define PTARGET_CURRENT 1 +#define PTARGET_VALID 2 -//#define PSYS_INTER_CUBIC 0 -//#define PSYS_INTER_LINEAR 1 -//#define PSYS_INTER_CARDINAL 2 -//#define PSYS_INTER_BSPLINE 3 +/* ParticleTarget->mode */ +#define PTARGET_MODE_NEUTRAL 0 +#define PTARGET_MODE_FRIEND 1 +#define PTARGET_MODE_ENEMY 2 #endif diff --git a/source/blender/makesdna/DNA_property_types.h b/source/blender/makesdna/DNA_property_types.h index b370c547ce0..af79b2e0a22 100644 --- a/source/blender/makesdna/DNA_property_types.h +++ b/source/blender/makesdna/DNA_property_types.h @@ -39,22 +39,19 @@ typedef struct bProperty { struct bProperty *next, *prev; char name[32]; - short type, otype; /* otype is for buttons, when a property type changes */ + short type, flag; int data; /* data should be 4 bytes to store int,float stuff */ - int old; /* old is for simul */ - short flag, pad; - void *poin; - void *oldpoin; /* oldpoin is for simul */ + void *poin; /* references data unless its a string which is malloc'd */ } bProperty; -/* property->type */ -#define PROP_BOOL 0 -#define PROP_INT 1 -#define PROP_FLOAT 2 -#define PROP_STRING 3 -#define PROP_VECTOR 4 -#define PROP_TIME 5 +/* property->type XXX Game Property, not RNA */ +#define GPROP_BOOL 0 +#define GPROP_INT 1 +#define GPROP_FLOAT 2 +#define GPROP_STRING 3 +#define GPROP_VECTOR 4 +#define GPROP_TIME 5 /* property->flag */ #define PROP_DEBUG 1 diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index a1f911eeffd..73afc3d1a53 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -33,21 +33,22 @@ extern "C" { #endif +#include "DNA_brush_types.h" #include "DNA_vec_types.h" #include "DNA_listBase.h" -#include "DNA_scriptlink_types.h" #include "DNA_ID.h" -#include "DNA_scriptlink_types.h" -#include "DNA_freestyle_types.h" -struct Radio; struct Object; struct World; struct Scene; struct Image; struct Group; +struct Text; struct bNodeTree; - +struct AnimData; +struct Editing; +struct SceneStats; +struct bGPdata; typedef struct Base { struct Base *next, *prev; @@ -127,9 +128,6 @@ typedef struct SceneRenderLayer { int passflag; /* pass_xor has to be after passflag */ int pass_xor; - - struct FreestyleConfig freestyleConfig; - } SceneRenderLayer; /* srl->layflag */ @@ -139,7 +137,6 @@ typedef struct SceneRenderLayer { #define SCE_LAY_EDGE 8 #define SCE_LAY_SKY 16 #define SCE_LAY_STRAND 32 -#define SCE_LAY_FRS 64 /* flags between 32 and 0x8000 are set to 1 already, for future options */ #define SCE_LAY_ALL_Z 0x8000 @@ -162,7 +159,7 @@ typedef struct SceneRenderLayer { #define SCE_PASS_REFRACT 1024 #define SCE_PASS_INDEXOB 2048 #define SCE_PASS_UV 4096 -#define SCE_PASS_RADIO 8192 +#define SCE_PASS_RADIO 8192 /* Radio removed, can use for new GI? */ #define SCE_PASS_MIST 16384 /* note, srl->passflag is treestore element 'nr' in outliner, short still... */ @@ -173,7 +170,8 @@ typedef struct RenderData { struct AviCodecData *avicodecdata; struct QuicktimeCodecData *qtcodecdata; struct FFMpegCodecData ffcodecdata; - + struct AudioData audio; /* new in 2.5 */ + int cfra, sfra, efra; /* frames as in 'images' */ int psfra, pefra; /* start+end frames of preview range */ @@ -186,10 +184,10 @@ typedef struct RenderData { /** For UR edge rendering: give the edges this color */ float edgeR, edgeG, edgeB; - short fullscreen, xplay, yplay, freqplay; /* standalone player */ - short depth, attrib, rt1, rt2; /* standalone player */ + short fullscreen, xplay, yplay, freqplay; /* standalone player */ // XXX deprecated since 2.5 + short depth, attrib, rt1, rt2; /* standalone player */ // XXX deprecated since 2.5 - short stereomode; /* standalone player stereo settings */ + short stereomode; /* standalone player stereo settings */ // XXX deprecated since 2.5 short dimensionspreset; /* for the dimensions presets menu */ @@ -221,7 +219,12 @@ typedef struct RenderData { short bufflag; short quality; - short rpad, rpad1, rpad2; + /** + * Render to image editor, fullscreen or to new window. + */ + short displaymode; + + short rpad1, rpad2; /** * Flags for render settings. Use bit-masking to access the settings. @@ -233,7 +236,7 @@ typedef struct RenderData { */ int mode; - /* render engine, octree resolution */ + /* render engine (deprecated), octree resolution */ short renderer, ocres; /** @@ -272,8 +275,12 @@ typedef struct RenderData { * Value used to define filter size for all filter options */ float gauss; + + /* color management settings - color profiles, gamma correction, etc */ + int color_mgt_flag; + /** post-production settings. Depricated, but here for upwards compat (initialized to 1) */ - float postmul, postgamma, posthue, postsat; + float postgamma, posthue, postsat; /* Dither noise intensity */ float dither_intensity; @@ -316,6 +323,20 @@ typedef struct RenderData { /* cineon */ short cineonwhite, cineonblack; float cineongamma; + + /* jpeg2000 */ + short jp2_preset, jp2_depth; + int rpad3; + + /* Dome variables */ // XXX deprecated since 2.5 + short domeres, domemode; // XXX deprecated since 2.5 + short domeangle, dometilt; // XXX deprecated since 2.5 + float domeresbuf; // XXX deprecated since 2.5 + float pad2; // XXX deprecated since 2.5 + struct Text *dometext; // XXX deprecated since 2.5 + + /* render engine */ + char engine[32]; } RenderData; /* control render convert and shading engine */ @@ -332,6 +353,20 @@ typedef struct RenderProfile { } RenderProfile; +typedef struct GameDome { + short res, mode; + short angle, tilt; + float resbuf, pad2; + struct Text *warptext; +} GameDome; + +#define DOME_FISHEYE 1 +#define DOME_TRUNCATED_FRONT 2 +#define DOME_TRUNCATED_REAR 3 +#define DOME_ENVMAP 4 +#define DOME_PANORAM_SPH 5 +#define DOME_NUM_MODES 6 + typedef struct GameFraming { float col[3]; char type, pad1, pad2, pad3; @@ -341,6 +376,74 @@ typedef struct GameFraming { #define SCE_GAMEFRAMING_EXTEND 1 #define SCE_GAMEFRAMING_SCALE 2 +typedef struct GameData { + + /* physics (it was in world)*/ + float gravity; /*Gravitation constant for the game world*/ + + /* + * Radius of the activity bubble, in Manhattan length. Objects + * outside the box are activity-culled. */ + float activityBoxRadius; //it's not being used ANYWHERE !!!!!!!!!!!!!! + /* + * bit 3: (gameengine): Activity culling is enabled. + * bit 5: (gameengine) : enable Bullet DBVT tree for view frustrum culling + */ + short mode, flag, matmode, pad[3]; + short occlusionRes; /* resolution of occlusion Z buffer in pixel */ + short physicsEngine; + short ticrate, maxlogicstep, physubstep, maxphystep; + + /* standalone player */ + struct GameFraming framing; + short fullscreen, xplay, yplay, freqplay; + short depth, attrib, rt1, rt2; + + /* stereo/dome mode */ + struct GameDome dome; + short stereoflag, stereomode, xsch, ysch; //xsch and ysch can be deleted !!! +} GameData; + +#define STEREO_NOSTEREO 1 +#define STEREO_ENABLED 2 +#define STEREO_DOME 3 + +//#define STEREO_NOSTEREO 1 +#define STEREO_QUADBUFFERED 2 +#define STEREO_ABOVEBELOW 3 +#define STEREO_INTERLACED 4 +#define STEREO_ANAGLYPH 5 +#define STEREO_SIDEBYSIDE 6 +#define STEREO_VINTERLACE 7 +//#define STEREO_DOME 8 + +/* physicsEngine */ +#define WOPHY_NONE 0 +#define WOPHY_ENJI 1 +#define WOPHY_SUMO 2 +#define WOPHY_DYNAMO 3 +#define WOPHY_ODE 4 +#define WOPHY_BULLET 5 + +/* GameData.flag */ +#define GAME_ENABLE_ALL_FRAMES (1 << 1) +#define GAME_SHOW_DEBUG_PROPS (1 << 2) +#define GAME_SHOW_FRAMERATE (1 << 3) +#define GAME_SHOW_PHYSICS (1 << 4) +#define GAME_DISPLAY_LISTS (1 << 5) +#define GAME_GLSL_NO_LIGHTS (1 << 6) +#define GAME_GLSL_NO_SHADERS (1 << 7) +#define GAME_GLSL_NO_SHADOWS (1 << 8) +#define GAME_GLSL_NO_RAMPS (1 << 9) +#define GAME_GLSL_NO_NODES (1 << 10) +#define GAME_GLSL_NO_EXTRA_TEX (1 << 11) +#define GAME_IGNORE_DEPRECATION_WARNINGS (1 << 12) + +/* GameData.matmode */ +#define GAME_MAT_TEXFACE 0 +#define GAME_MAT_MULTITEX 1 +#define GAME_MAT_GLSL 2 + typedef struct TimeMarker { struct TimeMarker *next, *prev; int frame; @@ -348,10 +451,27 @@ typedef struct TimeMarker { unsigned int flag; } TimeMarker; +typedef struct Paint { + /* Array of brushes selected for use in this paint mode */ + Brush **brushes; + int active_brush_index, brush_count; + + /* WM Paint cursor */ + void *paint_cursor; + unsigned char paint_cursor_col[4]; + + int pad; +} Paint; + typedef struct ImagePaintSettings { - struct Brush *brush; + Paint paint; + short flag, tool; - int pad3; + + /* for projection painting only */ + short seam_bleed, normal_angle; + + void *paintcursor; /* wm handle */ } ImagePaintSettings; typedef struct ParticleBrushData { @@ -366,9 +486,17 @@ typedef struct ParticleEditSettings { short brushtype; ParticleBrushData brush[7]; /* 7 = PE_TOT_BRUSH */ + void *paintcursor; /* runtime */ + + float emitterdist, rt; + + int selectmode; + int edittype; - float emitterdist; - int draw_timed; + int draw_step, fade_frames; + + struct Scene *scene; + struct Object *object; } ParticleEditSettings; typedef struct TransformOrientation { @@ -377,20 +505,67 @@ typedef struct TransformOrientation { float mat[3][3]; } TransformOrientation; +typedef struct Sculpt { + Paint paint; + + /* For rotating around a pivot point */ + float pivot[3]; + int flags; + + /* Control tablet input */ + char tablet_size, tablet_strength; + char pad[6]; +} Sculpt; + +typedef struct VPaint { + Paint paint; + + float gamma, mul; /* should become part of struct Brush? */ + short mode, flag; + int tot; /* allocation size of prev buffers */ + unsigned int *vpaint_prev; /* previous mesh colors */ + struct MDeformVert *wpaint_prev; /* previous vertex weights */ + + void *paintcursor; /* wm handle */ +} VPaint; + +/* VPaint flag */ +#define VP_COLINDEX 1 +#define VP_AREA 2 +#define VP_SOFT 4 +#define VP_NORMALS 8 +#define VP_SPRAY 16 +#define VP_MIRROR_X 32 +#define VP_HARD 64 +#define VP_ONLYVGROUP 128 + + typedef struct ToolSettings { + VPaint *vpaint; /* vertex paint */ + VPaint *wpaint; /* weight paint */ + Sculpt *sculpt; + + /* Vertex groups */ + float vgroup_weight; + /* Subdivide Settings */ short cornertype; short editbutflag; /*Triangle to Quad conversion threshold*/ float jointrilimit; - /* Extrude Tools */ + /* Editmode Tools */ float degr; short step; short turn; - float extr_offs; - float doublimit; - + float extr_offs; /* extrude offset */ + float doublimit; /* remove doubles limit */ + float normalsize; /* size of normals */ + short automerge; + + /* Selection Mode for Mesh */ + short selectmode; + /* Primitive Settings */ /* UV Sphere */ short segments; @@ -403,9 +578,12 @@ typedef struct ToolSettings { short unwrapper; float uvcalc_radius; float uvcalc_cubesize; + float uvcalc_margin; short uvcalc_mapdir; short uvcalc_mapalign; short uvcalc_flag; + short uv_flag, uv_selectmode; + short uv_pad[2]; /* Auto-IK */ short autoik_chainlen; @@ -416,11 +594,17 @@ typedef struct ToolSettings { /* Particle Editing */ struct ParticleEditSettings particle; + /* Transform Proportional Area of Effect */ + float proportional_size; + /* Select Group Threshold */ float select_thresh; - /* IPO-Editor */ + /* Graph Editor */ float clean_thresh; + + /* Auto-Keying Mode */ + short autokey_mode, autokey_flag; /* defines in DNA_userdef_types.h */ /* Retopo */ char retopo_mode; @@ -447,74 +631,42 @@ typedef struct ToolSettings { char skgen_postpro_passes; char skgen_subdivisions[3]; char skgen_multi_level; - char skgen_optimisation_method; - char tpad[6]; + /* Skeleton Sketching */ + struct Object *skgen_template; + char bone_sketching; + char bone_sketching_convert; + char skgen_subdivision_number; + char skgen_retarget_options; + char skgen_retarget_roll; + char skgen_side_string[8]; + char skgen_num_string[8]; /* Alt+RMB option */ char edge_mode; - -} ToolSettings; -/* Used by all brushes to store their properties, which can be directly set - by the interface code. Note that not all properties are actually used by - all the brushes. */ -typedef struct BrushData -{ - short size; - char strength, dir; /* Not used for smooth brush */ - char view; - char flag; - char pad[2]; -} BrushData; - -struct SculptSession; -typedef struct SculptData -{ - /* Note! all pointers in this struct must be duplicated header_info.c's copy_scene function */ - - /* Data stored only from entering sculptmode until exiting sculptmode */ - struct SculptSession *session; - - /* Pointers to all of sculptmodes's textures */ - struct MTex *mtex[18]; - - /* Editable brush shape */ - struct CurveMapping *cumap; - - /* Settings for each brush */ - BrushData drawbrush, smoothbrush, pinchbrush, inflatebrush, grabbrush, layerbrush, flattenbrush; - - /* For rotating around a pivot point */ - float pivot[3]; + /* Transform */ + short snap_mode, snap_flag, snap_target; + short proportional, prop_mode; +} ToolSettings; - short brush_type; +typedef struct bStats { + /* scene totals for visible layers */ + int totobj, totlamp, totobjsel, totcurve, totmesh, totarmature; + int totvert, totface; +} bStats; - /* For the Brush Shape */ - short texact, texnr; - short spacing; - char texrept; - char texfade; - char texsep; - - char averaging; - char flags; - - /* Control tablet input */ - char tablet_size, tablet_strength; - - /* Symmetry is separate from the other BrushData because the same - settings are always used for all brush types */ - char symm; - - /* Added to store if the 'Rake' setting has been set */ - char rake; - char axislock; - char pad[2]; -} SculptData; +typedef struct UnitSettings { + /* Display/Editing unit options for each scene */ + float scale_length; /* maybe have other unit conversions? */ + short system; + short flag; /* imperial, metric etc */ +} UnitSettings; typedef struct Scene { ID id; + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ + struct Object *camera; struct World *world; @@ -522,60 +674,59 @@ typedef struct Scene { struct Image *ima; ListBase base; - struct Base *basact; + struct Base *basact; /* active base */ + struct Object *obedit; /* name replaces old G.obedit */ - float cursor[3]; + float cursor[3]; /* 3d cursor location */ float twcent[3]; /* center for transform widget */ float twmin[3], twmax[3]; /* boundbox of selection for transform widget */ unsigned int lay; - /* editmode stuff */ - float editbutsize; /* size of normals */ - short selectmode; /* for mesh only! */ - short proportional, prop_mode; - short automerge, pad5, pad6; - - short autokey_mode; /* mode for autokeying (defines in DNA_userdef_types.h */ + + short flag; /* various settings */ short use_nodes; struct bNodeTree *nodetree; - void *ed; /* sequence editor data is allocated here */ - struct Radio *radio; + struct Editing *ed; /* sequence editor data is allocated here */ - struct GameFraming framing; - - struct ToolSettings *toolsettings; + struct ToolSettings *toolsettings; /* default allocated now */ + struct SceneStats *stats; /* default allocated now */ /* migrate or replace? depends on some internal things... */ /* no, is on the right place (ton) */ struct RenderData r; - struct AudioData audio; - - ScriptLink scriptlink; + struct AudioData audio; /* DEPRECATED 2.5 */ ListBase markers; ListBase transform_spaces; - short jumpframe; - short snap_mode, snap_flag, snap_target; + ListBase sound_handles; /* none of the dependancy graph vars is mean to be saved */ struct DagForest *theDag; short dagisvalid, dagflags; - short pad4, recalc; /* recalc = counterpart of ob->recalc */ + short recalc; /* recalc = counterpart of ob->recalc */ - /* Sculptmode data */ - struct SculptData sculptdata; + short jumpframe; /* frame step. */ int frame_step; - /* Freestyle */ - short freestyle_current_layer_number; - short pad; + /* User-Defined KeyingSets */ + int active_keyingset; /* index of the active KeyingSet. first KeyingSet has index 1, 'none' active is 0, 'add new' is -1 */ + ListBase keyingsets; /* KeyingSets for the given frame */ + /* Game Settings */ + struct GameFraming framing; // XXX deprecated since 2.5 + struct GameData gm; + + /* Units */ + struct UnitSettings unit; + + /* Grease Pencil */ + struct bGPdata *gpd; } Scene; @@ -594,12 +745,11 @@ typedef struct Scene { #define R_ORTHO 0x0008 #define R_ENVMAP 0x0010 #define R_EDGE 0x0020 -#define R_EDGE_FRS 0x2000000 // will replace R_EDGE #define R_FIELDS 0x0040 #define R_FIELDSTILL 0x0080 #define R_RADIO 0x0100 #define R_BORDER 0x0200 -#define R_PANORAMA 0x0400 +#define R_PANORAMA 0x0400 /* deprecated as scene option, still used in renderer */ #define R_CROP 0x0800 #define R_COSMO 0x1000 #define R_ODDFIELD 0x2000 @@ -621,6 +771,12 @@ typedef struct Scene { #define R_TOUCH 0x800000 /* touch files before rendering */ #define R_SIMPLIFY 0x1000000 +/* displaymode */ + +#define R_OUTPUT_SCREEN 0 +#define R_OUTPUT_AREA 1 +#define R_OUTPUT_WINDOW 2 +#define R_OUTPUT_FORKED 3 /* filtertype */ #define R_FILTER_BOX 0 @@ -652,9 +808,10 @@ typedef struct Scene { #define R_COMP_FREE 0x0800 #define R_NO_IMAGE_LOAD 0x1000 #define R_NO_TEX 0x2000 -#define R_STAMP_INFO 0x4000 +#define R_STAMP_INFO 0x4000 /* deprecated */ #define R_FULL_SAMPLE 0x8000 #define R_COMP_RERENDER 0x10000 +#define R_RECURS_PROTECTION 0x20000 /* r->stamp */ #define R_STAMP_TIME 0x0001 @@ -667,6 +824,7 @@ typedef struct Scene { #define R_STAMP_MARKER 0x0080 #define R_STAMP_FILENAME 0x0100 #define R_STAMP_SEQSTRIP 0x0200 +#define R_STAMP_ALL (R_STAMP_TIME|R_STAMP_FRAME|R_STAMP_DATE|R_STAMP_CAMERA|R_STAMP_SCENE|R_STAMP_NOTE|R_STAMP_MARKER|R_STAMP_FILENAME|R_STAMP_SEQSTRIP) /* alphamode */ #define R_ADDSKY 0 @@ -678,6 +836,9 @@ typedef struct Scene { #define R_PLANES32 32 #define R_PLANESBW 8 +/* color_mgt_flag */ +#define R_COLOR_MANAGEMENT 1 + /* imtype */ #define R_TARGA 0 #define R_IRIS 1 @@ -702,6 +863,10 @@ typedef struct Scene { #define R_DPX 27 #define R_MULTILAYER 28 #define R_DDS 29 +#define R_JP2 30 +#define R_H264 31 +#define R_XVID 32 +#define R_THEORA 33 /* subimtype, flag options for imtype */ #define R_OPENEXR_HALF 1 @@ -710,6 +875,13 @@ typedef struct Scene { #define R_CINEON_LOG 8 #define R_TIFF_16BIT 16 +#define R_JPEG2K_12BIT 32 /* Jpeg2000 */ +#define R_JPEG2K_16BIT 64 +#define R_JPEG2K_YCC 128 /* when disabled use RGB */ +#define R_JPEG2K_CINE_PRESET 256 +#define R_JPEG2K_CINE_48FPS 512 + + /* bake_mode: same as RE_BAKE_xxx defines */ /* bake_flag: */ #define R_BAKE_CLEAR 1 @@ -724,30 +896,67 @@ typedef struct Scene { #define R_BAKE_SPACE_TANGENT 3 /* **************** SCENE ********************* */ + +/* for general use */ +#define MAXFRAME 300000 +#define MAXFRAMEF 300000.0f + +#define MINFRAME 1 +#define MINFRAMEF 1.0f + +/* (minimum frame number for current-frame) */ +#define MINAFRAME -300000 +#define MINAFRAMEF -300000.0f + +/* depricate this! */ +#define TESTBASE(v3d, base) ( ((base)->flag & SELECT) && ((base)->lay & v3d->lay) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0) ) +#define TESTBASELIB(v3d, base) ( ((base)->flag & SELECT) && ((base)->lay & v3d->lay) && ((base)->object->id.lib==0) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0)) +#define TESTBASELIB_BGMODE(v3d, base) ( ((base)->flag & SELECT) && ((base)->lay & (v3d ? v3d->lay : scene->lay)) && ((base)->object->id.lib==0) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0)) +#define BASE_SELECTABLE(v3d, base) ((base->lay & v3d->lay) && (base->object->restrictflag & (OB_RESTRICT_SELECT|OB_RESTRICT_VIEW))==0) +#define FIRSTBASE scene->base.first +#define LASTBASE scene->base.last +#define BASACT (scene->basact) +#define OBACT (BASACT? BASACT->object: 0) + +#define ID_NEW(a) if( (a) && (a)->id.newid ) (a)= (void *)(a)->id.newid +#define ID_NEW_US(a) if( (a)->id.newid) {(a)= (void *)(a)->id.newid; (a)->id.us++;} +#define ID_NEW_US2(a) if( ((ID *)a)->newid) {(a)= ((ID *)a)->newid; ((ID *)a)->us++;} +#define CFRA (scene->r.cfra) +#define F_CFRA ((float)(scene->r.cfra)) +#define SFRA (scene->r.sfra) +#define EFRA (scene->r.efra) +#define PSFRA ((scene->r.psfra != 0)? (scene->r.psfra): (scene->r.sfra)) +#define PEFRA ((scene->r.psfra != 0)? (scene->r.pefra): (scene->r.efra)) +#define FRA2TIME(a) ((((double) scene->r.frs_sec_base) * (a)) / scene->r.frs_sec) +#define TIME2FRA(a) ((((double) scene->r.frs_sec) * (a)) / scene->r.frs_sec_base) +#define FPS (((double) scene->r.frs_sec) / scene->r.frs_sec_base) + #define RAD_PHASE_PATCHES 1 #define RAD_PHASE_FACES 2 /* base->flag is in DNA_object_types.h */ -/* scene->snap_flag */ +/* toolsettings->snap_flag */ #define SCE_SNAP 1 #define SCE_SNAP_ROTATE 2 -/* scene->snap_target */ +#define SCE_SNAP_PEEL_OBJECT 4 +/* toolsettings->snap_target */ #define SCE_SNAP_TARGET_CLOSEST 0 #define SCE_SNAP_TARGET_CENTER 1 #define SCE_SNAP_TARGET_MEDIAN 2 #define SCE_SNAP_TARGET_ACTIVE 3 -/* scene->snap_mode */ +/* toolsettings->snap_mode */ #define SCE_SNAP_MODE_VERTEX 0 #define SCE_SNAP_MODE_EDGE 1 #define SCE_SNAP_MODE_FACE 2 +#define SCE_SNAP_MODE_VOLUME 3 -/* sce->selectmode */ +/* toolsettings->selectmode */ #define SCE_SELECT_VERTEX 1 /* for mesh */ #define SCE_SELECT_EDGE 2 #define SCE_SELECT_FACE 4 -/* sce->selectmode for particles */ +/* toolsettings->particle.selectmode for particles */ #define SCE_SELECT_PATH 1 #define SCE_SELECT_POINT 2 #define SCE_SELECT_END 4 @@ -755,7 +964,7 @@ typedef struct Scene { /* sce->recalc (now in use by previewrender) */ #define SCE_PRV_CHANGED 1 -/* sce->prop_mode (proportional falloff) */ +/* toolsettings->prop_mode (proportional falloff) */ #define PROP_SMOOTH 0 #define PROP_SPHERE 1 #define PROP_ROOT 2 @@ -764,7 +973,14 @@ typedef struct Scene { #define PROP_CONST 5 #define PROP_RANDOM 6 +/* sce->flag */ +#define SCE_DS_SELECTED (1<<0) +#define SCE_DS_COLLAPSED (1<<1) +#define SCE_NLA_EDIT_ON (1<<2) + + /* return flag next_object function */ +#define F_ERROR -1 #define F_START 0 #define F_SCENE 1 #define F_SET 2 @@ -778,44 +994,47 @@ typedef struct Scene { #define FFMPEG_MULTIPLEX_AUDIO 1 #define FFMPEG_AUTOSPLIT_OUTPUT 2 -/* Sculpt brush flags */ -#define SCULPT_BRUSH_AIRBRUSH 1 -#define SCULPT_BRUSH_ANCHORED 2 -/* SculptData.flags */ -#define SCULPT_INPUT_SMOOTH 1 -#define SCULPT_DRAW_FAST 2 -#define SCULPT_DRAW_BRUSH 4 -/* SculptData.brushtype */ -#define DRAW_BRUSH 1 -#define SMOOTH_BRUSH 2 -#define PINCH_BRUSH 3 -#define INFLATE_BRUSH 4 -#define GRAB_BRUSH 5 -#define LAYER_BRUSH 6 -#define FLATTEN_BRUSH 7 -/* SculptData.texrept */ -#define SCULPTREPT_DRAG 1 -#define SCULPTREPT_TILE 2 -#define SCULPTREPT_3D 3 - -#define SYMM_X 1 -#define SYMM_Y 2 -#define SYMM_Z 4 - -#define AXISLOCK_X 1 -#define AXISLOCK_Y 2 -#define AXISLOCK_Z 4 - -/* toolsettings->imagepaint_flag */ +/* Sculpt.flags */ +typedef enum SculptFlags { + SCULPT_SYMM_X = 1, + SCULPT_SYMM_Y = 2, + SCULPT_SYMM_Z = 4, + SCULPT_INPUT_SMOOTH = 8, + SCULPT_DRAW_FAST = 16, + SCULPT_DRAW_BRUSH = 32, + SCULPT_LOCK_X = 64, + SCULPT_LOCK_Y = 128, + SCULPT_LOCK_Z = 256 +} SculptFlags; + +/* ImagePaintSettings.flag */ #define IMAGEPAINT_DRAWING 1 #define IMAGEPAINT_DRAW_TOOL 2 #define IMAGEPAINT_DRAW_TOOL_DRAWING 4 +/* projection painting only */ +#define IMAGEPAINT_PROJECT_DISABLE 8 /* Non projection 3D painting */ +#define IMAGEPAINT_PROJECT_XRAY 16 +#define IMAGEPAINT_PROJECT_BACKFACE 32 +#define IMAGEPAINT_PROJECT_FLAT 64 +#define IMAGEPAINT_PROJECT_LAYER_CLONE 128 +#define IMAGEPAINT_PROJECT_LAYER_MASK 256 +#define IMAGEPAINT_PROJECT_LAYER_MASK_INV 512 /* toolsettings->uvcalc_flag */ #define UVCALC_FILLHOLES 1 #define UVCALC_NO_ASPECT_CORRECT 2 /* would call this UVCALC_ASPECT_CORRECT, except it should be default with old file */ #define UVCALC_TRANSFORM_CORRECT 4 /* adjust UV's while transforming to avoid distortion */ +/* toolsettings->uv_flag */ +#define UV_SYNC_SELECTION 1 +#define UV_SHOW_SAME_IMAGE 2 + +/* toolsettings->uv_selectmode */ +#define UV_SELECT_VERTEX 1 +#define UV_SELECT_EDGE 2 +#define UV_SELECT_FACE 4 +#define UV_SELECT_ISLAND 8 + /* toolsettings->edge_mode */ #define EDGE_MODE_SELECT 0 #define EDGE_MODE_TAG_SEAM 1 @@ -828,9 +1047,10 @@ typedef struct Scene { #define PE_LOCK_FIRST 2 #define PE_DEFLECT_EMITTER 4 #define PE_INTERPOLATE_ADDED 8 -#define PE_SHOW_CHILD 16 -#define PE_SHOW_TIME 32 +#define PE_DRAW_PART 16 #define PE_X_MIRROR 64 +#define PE_FADE_TIME 128 +#define PE_AUTO_VELOCITY 256 /* toolsetting->particle brushtype */ #define PE_BRUSH_NONE -1 @@ -839,11 +1059,15 @@ typedef struct Scene { #define PE_BRUSH_LENGTH 2 #define PE_BRUSH_PUFF 3 #define PE_BRUSH_ADD 4 -#define PE_BRUSH_WEIGHT 5 -#define PE_BRUSH_SMOOTH 6 +#define PE_BRUSH_SMOOTH 5 /* this must equal ParticleEditSettings.brush array size */ -#define PE_TOT_BRUSH 7 +#define PE_TOT_BRUSH 6 + +/* tooksettings->particle edittype */ +#define PE_TYPE_PARTICLES 0 +#define PE_TYPE_SOFTBODY 1 +#define PE_TYPE_CLOTH 2 /* toolsettings->retopo_mode */ #define RETOPO 1 @@ -881,6 +1105,34 @@ typedef struct Scene { #define SKGEN_AVERAGE 1 #define SKGEN_SHARPEN 2 +/* toolsettings->bone_sketching */ +#define BONE_SKETCHING 1 +#define BONE_SKETCHING_QUICK 2 +#define BONE_SKETCHING_ADJUST 4 + +/* toolsettings->bone_sketching_convert */ +#define SK_CONVERT_CUT_FIXED 0 +#define SK_CONVERT_CUT_LENGTH 1 +#define SK_CONVERT_CUT_ADAPTATIVE 2 +#define SK_CONVERT_RETARGET 3 + +/* toolsettings->skgen_retarget_options */ +#define SK_RETARGET_AUTONAME 1 + +/* toolsettings->skgen_retarget_roll */ +#define SK_RETARGET_ROLL_VIEW 1 +#define SK_RETARGET_ROLL_JOINT 2 + +/* UnitSettings */ + +/* UnitSettings->system */ +#define USER_UNIT_NONE 0 +#define USER_UNIT_METRIC 1 +#define USER_UNIT_IMPERIAL 2 +/* UnitSettings->flag */ +#define USER_UNIT_OPT_SPLIT 1 + + #ifdef __cplusplus } #endif diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 9f0a70d9bca..e51da0c0818 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -1,6 +1,4 @@ /** - * blenlib/DNA_screen_types.h (mar-2001 nzc) - * * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -22,9 +20,7 @@ * 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. + * Contributor(s): Blender Foundation * * ***** END GPL LICENSE BLOCK ***** */ @@ -32,23 +28,50 @@ #define DNA_SCREEN_TYPES_H #include "DNA_listBase.h" +#include "DNA_view2d_types.h" #include "DNA_vec_types.h" #include "DNA_ID.h" -#include "DNA_scriptlink_types.h" +struct SpaceType; +struct SpaceLink; +struct ARegion; +struct ARegionType; +struct PanelType; +struct HeaderType; struct Scene; +struct uiLayout; +struct wmTimer; typedef struct bScreen { ID id; - ListBase vertbase, edgebase, areabase; + + ListBase vertbase; /* screens have vertices/edges to define areas */ + ListBase edgebase; + ListBase areabase; + ListBase regionbase; /* screen level regions (menus), runtime only */ + struct Scene *scene; - short startx, endx, starty, endy; /* framebuffer coords */ - short sizex, sizey; - short scenenr, screennr; /* only for pupmenu */ - short full, pad; - short mainwin, winakt; - short handler[8]; /* similar to space handler now */ + struct Scene *newscene; /* temporary when switching */ + + short full; /* fade out? */ + short winid; /* winid from WM, starts with 1 */ + short do_draw; /* notifier for drawing edges */ + short do_refresh; /* notifier for scale screen, changed screen, etc */ + short do_draw_gesture; /* notifier for gesture draw. */ + short do_draw_paintcursor; /* notifier for paint cursor draw. */ + short swap; /* indicator to survive swap-exchange systems */ + short pad; + + short mainwin; /* screensize subwindow, for screenedges and global menus */ + short subwinactive; /* active subwindow */ + + int pad2; + + struct wmTimer *animtimer; /* if set, screen has timer handler added in window */ + void *context; /* context callback */ + + short handler[8]; /* similar to space handler */ } bScreen; typedef struct ScrVert { @@ -65,63 +88,93 @@ typedef struct ScrEdge { int pad; } ScrEdge; -#ifndef DNA_USHORT_FIX -#define DNA_USHORT_FIX -/** - * @deprecated This typedef serves to avoid badly typed functions when - * @deprecated compiling while delivering a proper dna.c. Do not use - * @deprecated it in any case. - */ -typedef unsigned short dna_ushort_fix; -#endif - - - typedef struct Panel { /* the part from uiBlock that needs saved in file */ struct Panel *next, *prev; + + struct PanelType *type; /* runtime */ + struct uiLayout *layout; /* runtime for drawing */ + char panelname[64], tabname[64]; /* defined as UI_MAX_NAME_STR */ char drawname[64]; /* panelname is identifier for restoring location */ short ofsx, ofsy, sizex, sizey; - short flag, active; /* active= used currently by a uiBlock */ + short labelofs, pad; + short flag, runtime_flag; short control; short snap; - short old_ofsx, old_ofsy; /* for stow */ - int sortcounter; /* when sorting panels, it uses this to put new ones in right place */ + int sortorder; /* panels are aligned according to increasing sortorder */ struct Panel *paneltab; /* this panel is tabbed in *paneltab */ + void *activedata; /* runtime for panel manipulation */ + + int list_scroll, list_size; + char list_search[64]; } Panel; typedef struct ScrArea { struct ScrArea *next, *prev; + ScrVert *v1, *v2, *v3, *v4; bScreen *full; /* if area==full, this is the parent */ - float winmat[4][4]; - rcti totrct, headrct, winrct; - short headwin, win; - short headertype; /* 0=no header, 1= down, 2= up */ - char spacetype, butspacetype; /* SPACE_... */ - short winx, winy; /* size */ - char head_swap, head_equal; - char win_swap, win_equal; + rcti totrct; /* rect bound by v1 v2 v3 v4 */ + + char spacetype, butspacetype; /* SPACE_..., butspacetype is button arg */ + short winx, winy; /* size */ - short headbutlen, headbutofs; + short headertype; /* OLD! 0=no header, 1= down, 2= up */ + short pad; + short do_refresh; /* private, for spacetype refresh callback */ short cursor, flag; - - ScriptLink scriptlink; - - ListBase spacedata; - ListBase uiblocks; - ListBase panels; + + struct SpaceType *type; /* callbacks for this space type */ + + ListBase spacedata; /* SpaceLink */ + ListBase regionbase; /* ARegion */ + ListBase handlers; /* wmEventHandler */ + + ListBase actionzones; /* AZone */ } ScrArea; -#define MAXWIN 128 +typedef struct ARegion { + struct ARegion *next, *prev; + + View2D v2d; /* 2D-View scrolling/zoom info (most regions are 2d anyways) */ + rcti winrct; /* coordinates of region */ + rcti drawrct; /* runtime for partial redraw, same or smaller than winrct */ + short winx, winy; /* size */ + + short swinid; + short regiontype; /* window, header, etc. identifier for drawing */ + short alignment; /* how it should split */ + short flag; /* hide, ... */ + + float fsize; /* current split size in float */ + + short do_draw; /* private, cached notifier events */ + short swap; /* private, indicator to survive swap-exchange */ + int pad1; + + struct ARegionType *type; /* callbacks for this region type */ + + ListBase uiblocks; /* uiBlock */ + ListBase panels; /* Panel */ + ListBase handlers; /* wmEventHandler */ + + char *headerstr; /* use this string to draw info */ + void *regiondata; /* XXX 2.50, need spacedata equivalent? */ +} ARegion; + +/* swap */ +#define WIN_BACK_OK 1 +#define WIN_FRONT_OK 2 +#define WIN_EQUAL 3 /* area->flag */ #define HEADER_NO_PULLDOWN 1 +#define AREA_FLAG_DRAWJOINTO 2 +#define AREA_FLAG_DRAWJOINFROM 4 /* If you change EDGEWIDTH, also do the global arrat edcol[] */ #define EDGEWIDTH 1 -#define EDGEWIDTH2 0 #define AREAGRID 4 #define AREAMINX 32 #define HEADERY 26 @@ -133,20 +186,8 @@ typedef struct ScrArea { #define SCREENNORMAL 0 #define SCREENFULL 1 #define SCREENAUTOPLAY 2 +#define SCREENTEMP 3 -/* sa->win_swap */ -#define WIN_FRONT_OK 1 -#define WIN_BACK_OK 2 -#define WIN_EQUAL 3 - -#define L_SCROLL 1 /* left scrollbar */ -#define R_SCROLL 2 -#define VERT_SCROLL 3 -#define T_SCROLL 4 -#define B_SCROLL 8 -#define HOR_SCROLL 12 -#define B_SCROLLO 16 /* special hack for outliner hscroll - prevent hanging */ -#define HOR_SCROLLO 20 /* in older versions of blender */ /* Panel->snap - for snapping to screen edges */ #define PNL_SNAP_NONE 0 @@ -157,6 +198,10 @@ typedef struct ScrArea { #define PNL_SNAP_DIST 9.0 +/* paneltype flag */ +#define PNL_DEFAULT_CLOSED 1 +#define PNL_NO_HEADER 2 + /* screen handlers */ #define SCREEN_MAXHANDLER 8 @@ -164,5 +209,35 @@ typedef struct ScrArea { #define SCREEN_HANDLER_PYTHON 2 #define SCREEN_HANDLER_VERSE 3 +/* regiontype, first two are the default set */ +#define RGN_TYPE_WINDOW 0 +#define RGN_TYPE_HEADER 1 +#define RGN_TYPE_CHANNELS 2 +#define RGN_TYPE_TEMPORARY 3 +#define RGN_TYPE_UI 4 +#define RGN_TYPE_TOOLS 5 +#define RGN_TYPE_TOOL_PROPS 6 + +/* region alignment */ +#define RGN_ALIGN_NONE 0 +#define RGN_ALIGN_TOP 1 +#define RGN_ALIGN_BOTTOM 2 +#define RGN_ALIGN_LEFT 3 +#define RGN_ALIGN_RIGHT 4 +#define RGN_ALIGN_HSPLIT 5 +#define RGN_ALIGN_VSPLIT 6 +#define RGN_ALIGN_FLOAT 7 +#define RGN_ALIGN_QSPLIT 8 +#define RGN_OVERLAP_TOP 9 +#define RGN_OVERLAP_BOTTOM 10 +#define RGN_OVERLAP_LEFT 11 +#define RGN_OVERLAP_RIGHT 12 + +#define RGN_SPLIT_PREV 32 + +/* region flag */ +#define RGN_FLAG_HIDDEN 1 +#define RGN_FLAG_TOO_SMALL 2 + #endif diff --git a/source/blender/makesdna/DNA_scriptlink_types.h b/source/blender/makesdna/DNA_scriptlink_types.h deleted file mode 100644 index 95e20dd004d..00000000000 --- a/source/blender/makesdna/DNA_scriptlink_types.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * blenlib/DNA_object_types.h (mar-2001 nzc) - * - * Scriptlink is hard-coded in object for some reason. - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * 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 - * of the License, or (at your option) any later version. - * - * 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. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef DNA_SCRIPTLINK_TYPES_H -#define DNA_SCRIPTLINK_TYPES_H - -#ifdef __cplusplus -extern "C" { -#endif - -struct ID; - -typedef struct ScriptLink { - struct ID **scripts; - short *flag; - - short actscript, totscript; - int pad; -} ScriptLink; - -/* **************** SCRIPTLINKS ********************* */ - -#define SCRIPT_FRAMECHANGED 1 -#define SCRIPT_ONLOAD 2 -#define SCRIPT_REDRAW 4 -#define SCRIPT_ONSAVE 8 -#define SCRIPT_RENDER 16 -/* POSTRENDER is not meant for the UI, it simply calls the - * RENDER script links for clean-up actions */ -#define SCRIPT_POSTRENDER 32 - -#define SCRIPT_OBJECTUPDATE 64 -#define SCRIPT_OBDATAUPDATE 128 - -/* **************** SPACE HANDLERS ********************* */ -/* these are special scriptlinks that can be assigned to - * a given space in a given ScrArea to: - * - (EVENT type) handle events sent to that space; - * - (DRAW type) draw on the space after its own drawing function finishes - */ -#define SPACEHANDLER_VIEW3D_EVENT 1 -#define SPACEHANDLER_VIEW3D_DRAW 2 - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/source/blender/makesdna/DNA_sdna_types.h b/source/blender/makesdna/DNA_sdna_types.h index ac0b77aacf9..5726837a723 100644 --- a/source/blender/makesdna/DNA_sdna_types.h +++ b/source/blender/makesdna/DNA_sdna_types.h @@ -33,21 +33,31 @@ # # -struct SDNA { - char *data; - int datalen, nr_names; - char **names; - int nr_types, pointerlen; - char **types; - short *typelens; - int nr_structs; - short **structs; +typedef struct SDNA { + char *data; /* full copy of 'encoded' data */ + int datalen; /* length of data */ + + int nr_names; /* total number of struct members */ + char **names; /* struct member names */ + + int pointerlen; /* size of a pointer in bytes */ + + int nr_types; /* number of basic types + struct types */ + char **types; /* type names */ + short *typelens; /* type lengths */ + + int nr_structs; /* number of struct types */ + short **structs; /* sp= structs[a] is the adress of a struct definintion + sp[0] is struct type number, sp[1] amount of members + + (sp[2], sp[3]), (sp[4], sp[5]), .. are the member + type and name numbers respectively */ /* wrong place for this really, its a simple * cache for findstruct_nr. */ int lastfind; -}; +} SDNA; # # diff --git a/source/blender/makesdna/DNA_sensor_types.h b/source/blender/makesdna/DNA_sensor_types.h index d8a1ffc6c24..cc998de7eec 100644 --- a/source/blender/makesdna/DNA_sensor_types.h +++ b/source/blender/makesdna/DNA_sensor_types.h @@ -158,7 +158,8 @@ typedef struct bSensor { /* just add here, to avoid align errors... */ short invert; /* Whether or not to invert the output. */ short level; /* Whether the sensor is level base (edge by default) */ - int pad; + short tap; + short pad; } bSensor; typedef struct bJoystickSensor { @@ -166,7 +167,8 @@ typedef struct bJoystickSensor { char type; char joyindex; short flag; - int axis; + short axis; + short axis_single; int axisf; int button; int hat; @@ -176,6 +178,9 @@ typedef struct bJoystickSensor { /* bMouseSensor->type: uses blender event defines */ +/* bMouseSensor->flag: only pulse for now */ +#define SENS_MOUSE_FOCUS_PULSE 1 + /* propertysensor->type */ #define SENS_PROP_EQUAL 0 #define SENS_PROP_NEQUAL 1 @@ -238,6 +243,7 @@ typedef struct bJoystickSensor { * */ /* #define SENS_COLLISION_PROPERTY 0 */ #define SENS_COLLISION_MATERIAL 1 +#define SENS_COLLISION_PULSE 2 /* ray specific mode */ /* X-Ray means that the ray will traverse objects that don't have the property/material */ #define SENS_RAY_XRAY 2 @@ -254,20 +260,22 @@ typedef struct bJoystickSensor { #define SENS_JOY_ANY_EVENT 1 -#define SENS_JOY_BUTTON 0 +#define SENS_JOY_BUTTON 0 /* axis type */ #define SENS_JOY_BUTTON_PRESSED 0 #define SENS_JOY_BUTTON_RELEASED 1 -#define SENS_JOY_AXIS 1 +#define SENS_JOY_AXIS 1 /* axis type */ #define SENS_JOY_X_AXIS 0 #define SENS_JOY_Y_AXIS 1 #define SENS_JOY_NEG_X_AXIS 2 #define SENS_JOY_NEG_Y_AXIS 3 #define SENS_JOY_PRECISION 4 -#define SENS_JOY_HAT 2 +#define SENS_JOY_HAT 2 /* axis type */ #define SENS_JOY_HAT_DIR 0 +#define SENS_JOY_AXIS_SINGLE 3 /* axis type */ + #define SENS_DELAY_REPEAT 1 // should match JOYINDEX_MAX in SCA_JoystickDefines.h */ diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 7bad8ec3b44..6d455d20f59 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -78,6 +78,11 @@ typedef struct StripColorBalance { typedef struct StripProxy { char dir[160]; + char file[80]; + struct anim *anim; + short size; + short quality; + int pad; } StripProxy; typedef struct Strip { @@ -142,7 +147,7 @@ typedef struct Sequence { Strip *strip; - struct Ipo *ipo; + struct Ipo *ipo; // xxx depreceated... old animation system struct Scene *scene; struct anim *anim; float facf0, facf1; @@ -155,9 +160,9 @@ typedef struct Sequence { ListBase seqbase; /* list of strips for metastrips */ struct bSound *sound; /* the linked "bSound" object */ - struct hdaudio *hdaudio; /* external hdaudio object */ + struct SoundHandle *sound_handle; float level, pan; /* level in dB (0=full), pan -1..1 */ - int curpos; /* last sample position in audio_fill() */ + int scenenr; /* for scene selection */ float strobe; void *effectdata; /* Struct pointer for effect settings */ @@ -168,8 +173,6 @@ typedef struct Sequence { int blend_mode; float blend_opacity; - int scenenr; /* for scene selection */ - int pad; } Sequence; typedef struct MetaStack { @@ -182,9 +185,11 @@ typedef struct Editing { ListBase *seqbasep; ListBase seqbase; ListBase metastack; - short flag; - short pad; - int rt; + + /* Context vars, used to be static */ + Sequence *act_seq; + char act_imagedir[256]; + char act_sounddir[256]; } Editing; /* ************* Effect Variable Structs ********* */ @@ -230,6 +235,9 @@ typedef struct SpeedControlVars { int lastValidFrame; } SpeedControlVars; +#define SEQ_STRIP_OFSBOTTOM 0.2f +#define SEQ_STRIP_OFSTOP 0.8f + /* SpeedControlVars->flags */ #define SEQ_SPEED_INTEGRATE 1 #define SEQ_SPEED_BLEND 2 @@ -257,7 +265,10 @@ typedef struct SpeedControlVars { #define SEQ_USE_CROP 131072 #define SEQ_USE_COLOR_BALANCE 262144 #define SEQ_USE_PROXY_CUSTOM_DIR 524288 -#define SEQ_ACTIVE 1048576 +#define SEQ_USE_PROXY_CUSTOM_FILE 2097152 + +/* deprecated, dont use a flag anymore*/ +/*#define SEQ_ACTIVE 1048576*/ #define SEQ_COLOR_BALANCE_INVERSE_GAIN 1 #define SEQ_COLOR_BALANCE_INVERSE_GAMMA 2 @@ -270,7 +281,7 @@ typedef struct SpeedControlVars { #define SEQ_MOVIE 3 #define SEQ_RAM_SOUND 4 #define SEQ_HD_SOUND 5 -#define SEQ_MOVIE_AND_HD_SOUND 6 /* helper for add_sequence */ +#define SEQ_SOUND 4 #define SEQ_EFFECT 8 #define SEQ_CROSS 8 diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h new file mode 100644 index 00000000000..4e4714cdaa1 --- /dev/null +++ b/source/blender/makesdna/DNA_smoke_types.h @@ -0,0 +1,123 @@ +/** +* $Id$ +* +* ***** BEGIN GPL LICENSE BLOCK ***** +* +* 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 +* of the License, or (at your option) any later version. +* +* 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) 2006 by NaN Holding BV. +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): Daniel Genrich (Genscher) +* +* ***** END GPL LICENSE BLOCK ***** +*/ +#ifndef DNA_SMOKE_TYPES_H +#define DNA_SMOKE_TYPES_H + +/* flags */ +#define MOD_SMOKE_HIGHRES (1<<1) /* enable high resolution */ +#define MOD_SMOKE_DISSOLVE (1<<2) /* let smoke dissolve */ +#define MOD_SMOKE_DISSOLVE_LOG (1<<3) /* using 1/x for dissolve */ + +/* noise */ +#define MOD_SMOKE_NOISEWAVE (1<<0) +#define MOD_SMOKE_NOISEFFT (1<<1) +#define MOD_SMOKE_NOISECURL (1<<2) +/* viewsettings */ +#define MOD_SMOKE_VIEW_SHOWBIG (1<<0) + +typedef struct SmokeDomainSettings { + struct SmokeModifierData *smd; /* for fast RNA access */ + struct FLUID_3D *fluid; + struct Group *fluid_group; + struct Group *eff_group; // effector group for e.g. wind force + struct Group *coll_group; // collision objects group + struct WTURBULENCE *wt; // WTURBULENCE object, if active + struct GPUTexture *tex; + struct GPUTexture *tex_wt; + struct GPUTexture *tex_shadow; + float *shadow; + float p0[3]; /* start point of BB */ + float p1[3]; /* end point of BB */ + float dx; /* edge length of one cell */ + float omega; /* smoke color - from 0 to 1 */ + float temp; /* fluid temperature */ + float tempAmb; /* ambient temperature */ + float alpha; + float beta; + int res[3]; /* domain resolution */ + int amplify; /* wavelet amplification */ + int maxres; /* longest axis on the BB gets this resolution assigned */ + int flags; /* show up-res or low res, etc */ + int pad; + int viewsettings; + short noise; /* noise type: wave, curl, anisotropic */ + short diss_percent; + int diss_speed;/* in frames */ + float strength; + int res_wt[3]; + float dx_wt; + int v3dnum; + struct PointCache *point_cache[2]; /* definition is in DNA_object_force.h */ + struct ListBase ptcaches[2]; +} SmokeDomainSettings; + + +/* inflow / outflow */ + +/* type */ +#define MOD_SMOKE_FLOW_TYPE_OUTFLOW (1<<1) + +typedef struct SmokeFlowSettings { + struct SmokeModifierData *smd; /* for fast RNA access */ + struct ParticleSystem *psys; + float density; + float temp; /* delta temperature (temp - ambient temp) */ + float velocity[3]; /* UNUSED, velocity taken from particles */ + float vgrp_heat_scale[2]; /* min and max scaling for vgroup_heat */ + short vgroup_flow; /* where inflow/outflow happens - red=1=action */ + short vgroup_density; + short vgroup_heat; + short type; /* inflow =0 or outflow = 1 */ + int pad; +} SmokeFlowSettings; + +/* + struct BVHTreeFromMesh *bvh; + float mat[4][4]; + float mat_old[4][4]; + */ + +/* collision objects (filled with smoke) */ +typedef struct SmokeCollSettings { + struct SmokeModifierData *smd; /* for fast RNA access */ + struct BVHTree *bvhtree; /* bounding volume hierarchy for this cloth object */ + struct DerivedMesh *dm; + float *points; + float *points_old; + float *vel; + float mat[4][4]; + float mat_old[4][4]; + int numpoints; + int numverts; // check if mesh changed + short type; // static = 0, rigid = 1, dynamic = 2 + short pad; + int pad2; +} SmokeCollSettings; + +#endif diff --git a/source/blender/makesdna/DNA_sound_types.h b/source/blender/makesdna/DNA_sound_types.h index d05e6f1bae8..55b48e4aacd 100644 --- a/source/blender/makesdna/DNA_sound_types.h +++ b/source/blender/makesdna/DNA_sound_types.h @@ -37,94 +37,92 @@ /* stupid... could easily be solved */ #include "DNA_view2d_types.h" -/* extern int noaudio; * defined in sound.c . also not very nice */ -/* extern ListBase *samples; don't do this in DNA, but in BKE_... instead */ - -struct bSample; struct Ipo; struct PackedFile; struct SpaceLink; -/* should not be here! */ -# -# -typedef struct bSample { - ID id; - void *data; - void *snd_sample; - short type, bits; - short channels; - int len, rate; -// int buffer; - int alindex; - char fakedata[16]; - int flags; - char name[160]; - struct PackedFile * packedfile; - short us; -} bSample; - - +// runtime only - no saving +typedef struct SoundHandle { + struct SoundHandle *next, *prev; + struct bSound *source; + void *handle; + int state; + int startframe; + int endframe; + int frameskip; + int mute; + int changed; + float volume; + float pad; +} SoundHandle; + +typedef struct Sound3D +{ + float min_gain; + float max_gain; + float reference_distance; + float max_distance; + float rolloff_factor; + float cone_inner_angle; + float cone_outer_angle; + float cone_outer_gain; +} Sound3D; typedef struct bSound { ID id; - char name[160]; - struct bSample *sample; - void *stream; - struct PackedFile *packedfile; - struct PackedFile *newpackedfile; - void *snd_sound; - struct Ipo *ipo; - float volume, panning; + /** - * Sets the rollofffactor. The rollofffactor is a per-Source parameter - * the application can use to increase or decrease the range of a source - * by decreasing or increasing the attenuation, respectively. The default - * value is 1. The implementation is free to optimize for a rollofffactor - * value of 0, which indicates that the application does not wish any - * distance attenuation on the respective Source. + * The path to the sound file. */ - float attenuation; - float pitch; + char name[160]; + /** - * min_gain indicates the minimal gain which is always guaranteed for this sound + * The packed file. */ - float min_gain; + struct PackedFile *packedfile; + /** - * max_gain indicates the maximal gain which is always guaranteed for this sound + * The handle for audaspace. */ - float max_gain; + void *handle; + /** - * Sets the referencedistance at which the listener will experience gain. + * Deprecated; used for loading pre 2.5 files. */ + struct PackedFile *newpackedfile; + struct Ipo *ipo; + float volume; + float attenuation; + float pitch; + float min_gain; + float max_gain; float distance; int flags; - int streamlen; - char channels; - char highprio; - char pad[10]; -} bSound; -typedef struct bSoundListener { - ID id; - /** - * Overall gain - */ - float gain; +/** currently int type; + struct bSound *child_sound;*/ + /** - * Sets a scaling to exaggerate or deemphasize the Doppler (pitch) shift - * resulting from the calculation. + * Whether the sound has been changed and must be restarted if playing. */ - float dopplerfactor; + int changed; + /** - * Sets the value of the propagation speed relative to which the source - * velocities are interpreted. + * The audaspace handle for cache. */ - float dopplervelocity; - short numsoundsblender; - short numsoundsgameengine; - -} bSoundListener; + void *cache; + +/** XXX unused currently // SOUND_TYPE_LIMITER + float start, end;*/ +} bSound; + +/* XXX unused currently +typedef enum eSound_Type { + SOUND_TYPE_INVALID = -1, + SOUND_TYPE_FILE = 0, + SOUND_TYPE_BUFFER, + SOUND_TYPE_LIMITER +} eSound_Type;*/ /* spacesound->flag */ #define SND_DRAWFRAMES 1 @@ -132,6 +130,7 @@ typedef struct bSoundListener { typedef struct SpaceSound { struct SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ int spacetype; float blockscale; struct ScrArea *area; @@ -145,34 +144,7 @@ typedef struct SpaceSound { int pad2; } SpaceSound; - -enum SAMPLE_FileTypes { - SAMPLE_INVALID = -1, // must be negative - SAMPLE_UNKNOWN = 0, - SAMPLE_RAW, - SAMPLE_WAV, - SAMPLE_MP2, - SAMPLE_MP3, - SAMPLE_OGG_VORBIS, - SAMPLE_WMA, - SAMPLE_ASF, - SAMPLE_AIFF -}; - - -#define SOUND_CHANNELS_STEREO 0 -#define SOUND_CHANNELS_LEFT 1 -#define SOUND_CHANNELS_RIGHT 2 - -#define SOUND_FLAGS_LOOP (1 << 0) -#define SOUND_FLAGS_FIXED_VOLUME (1 << 1) -#define SOUND_FLAGS_FIXED_PANNING (1 << 2) #define SOUND_FLAGS_3D (1 << 3) -#define SOUND_FLAGS_BIDIRECTIONAL_LOOP (1 << 4) -#define SOUND_FLAGS_PRIORITY (1 << 5) -#define SOUND_FLAGS_SEQUENCE (1 << 6) - -#define SAMPLE_NEEDS_SAVE (1 << 0) /* to DNA_sound_types.h*/ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 226a3ecd834..806d12815b5 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -33,12 +33,11 @@ #include "DNA_listBase.h" #include "DNA_vec_types.h" -#include "DNA_oops_types.h" /* for TreeStoreElem */ +#include "DNA_outliner_types.h" /* for TreeStoreElem */ #include "DNA_image_types.h" /* ImageUser */ /* Hum ... Not really nice... but needed for spacebuts. */ #include "DNA_view2d_types.h" -struct Ipo; struct ID; struct Text; struct Script; @@ -51,102 +50,97 @@ struct bNodeTree; struct uiBlock; struct FileList; struct bGPdata; +struct bDopeSheet; +struct FileSelectParams; +struct FileLayout; +struct bScreen; +struct Scene; +struct wmOperator; +struct wmTimer; /** * The base structure all the other spaces * are derived (implicitly) from. Would be * good to make this explicit. */ -typedef struct SpaceLink SpaceLink; -struct SpaceLink { - SpaceLink *next, *prev; + +typedef struct SpaceLink { + struct SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ int spacetype; - float blockscale; - struct ScrArea *area; - short blockhandler[8]; -}; + float blockscale; /* XXX depricate this */ + short blockhandler[8]; /* XXX depricate this */ +} SpaceLink; typedef struct SpaceInfo { SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ int spacetype; float blockscale; - struct ScrArea *area; - short blockhandler[8]; + short blockhandler[8]; /* XXX depricate this */ + + struct bScreen *screen; /* browse screen */ + struct Scene *scene; /* browse scene */ + } SpaceInfo; +/* 'Graph' Editor (formerly known as the IPO Editor) */ +/* XXX for now, we keep all old data... */ typedef struct SpaceIpo { SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ int spacetype; float blockscale; - struct ScrArea *area; short blockhandler[8]; + View2D v2d; /* deprecated, copied to region */ - unsigned int rowbut, pad2; - View2D v2d; + struct bDopeSheet *ads; /* settings for filtering animation data (NOTE: we use a pointer due to code-linking issues) */ - void *editipo; - ListBase ipokey; + ListBase ghostCurves; /* sampled snapshots of F-Curves used as in-session guides */ - /* the ipo context we need to store */ - struct Ipo *ipo; - struct ID *from; - char actname[32], constname[32], bonename[32]; - - short totipo, pin; - short butofs, channel; - short showkey, blocktype; - short menunr, lock; - int flag; - float median[3]; - rctf tot; + short mode; /* mode for the Graph editor (eGraphEdit_Mode) */ + short flag; /* settings for Graph editor */ + short autosnap; /* time-transform autosnapping settings for Graph editor (eAnimEdit_AutoSnap in DNA_action_types.h) */ + char pin, lock; // XXX old, unused vars that are probably going to be depreceated soon... } SpaceIpo; typedef struct SpaceButs { SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ int spacetype; float blockscale; - struct ScrArea *area; - struct RenderInfo *ri; - - short blockhandler[8]; - - short cursens, curact; - short align, tabo; /* align for panels, tab is old tab */ - View2D v2d; - - short mainb, menunr; /* texnr and menunr have to remain shorts */ - short pin, mainbo; - void *lockpoin; - short texnr; - char texfrom, showgroup; + short blockhandler[8]; - short modeltype; - short scriptblock; - short scaflag; - short re_align; + struct RenderInfo *ri; + + View2D v2d; /* deprecated, copied to region */ - short oldkeypress; /* for keeping track of the sub tab key cycling */ - char pad, flag; + short mainb, mainbo, mainbuser; /* context tabs */ + short re_align, align; /* align for panels */ + short preview; /* preview is signal to refresh */ + char flag, pad[3]; - char texact, tab[7]; /* storing tabs for each context */ - + void *path; /* runtime */ + int pathflag, dataicon; /* runtime */ + ID *pinid; } SpaceButs; typedef struct SpaceSeq { SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ int spacetype; float blockscale; - struct ScrArea *area; short blockhandler[8]; - View2D v2d; + View2D v2d; /* deprecated, copied to region */ float xof, yof; /* offset for drawing the image preview */ - short mainb, pad; + short mainb; + short render_size; short chanshown; short zebra; int flag; @@ -155,54 +149,70 @@ typedef struct SpaceSeq { struct bGPdata *gpd; /* grease-pencil data */ } SpaceSeq; +typedef struct FileSelectParams { + char title[24]; /* title, also used for the text of the execute button */ + char dir[240]; /* directory */ + char file[80]; /* file */ + char renamefile[80]; + + short type; /* XXXXX for now store type here, should be moved to the operator */ + short flag; /* settings for filter, hiding dots files,... */ + short sort; /* sort order */ + short display; /* display mode flag */ + short filter; /* filter when (flags & FILE_FILTER) is true */ + + /* XXX - temporary, better move to filelist */ + short active_bookmark; + int active_file; + int selstate; + + /* short */ + /* XXX --- still unused -- */ + short f_fp; /* show font preview */ + short menu; /* currently selected option in pupmenu */ + char fp_str[8]; /* string to use for font preview */ + char *pupmenu; /* allows menu for save options - result stored in menup */ + /* XXX --- end unused -- */ +} FileSelectParams; + + typedef struct SpaceFile { SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ int spacetype; - float blockscale; - struct ScrArea *area; - - short blockhandler[8]; + int pad; - struct direntry *filelist; - int totfile; + struct FileSelectParams *params; /* config and input for file select */ - char title[24]; - char dir[240]; - char file[80]; - - short type, ofs, flag, sort; - short maxnamelen, collums, f_fp, pad1; - int pad2; - char fp_str[8]; + struct FileList *files; /* holds the list of files to show */ - struct BlendHandle *libfiledata; - - unsigned short retval; /* event */ - short menu, act, ipotype; - - /* one day we'll add unions to dna */ - void (*returnfunc)(char *); - void (*returnfunc_event)(unsigned short); - void (*returnfunc_args)(char *, void *, void *); + ListBase *folders_prev; /* holds the list of previous directories to show */ + ListBase *folders_next; /* holds the list of next directories (pushed from previous) to show */ + + /* operator that is invoking fileselect + op->exec() will be called on the 'Load' button. + if operator provides op->cancel(), then this will be invoked + on the cancel button. + */ + struct wmOperator *op; + + struct wmTimer *loadimage_timer; + + struct FileLayout *layout; - void *arg1, *arg2; - short *menup; /* pointer to menu result or ID browsing */ - char *pupmenu; /* optional menu in header */ + short recentnr, bookmarknr; + short systemnr, pad2; } SpaceFile; typedef struct SpaceOops { SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ int spacetype; float blockscale; - struct ScrArea *area; short blockhandler[8]; - View2D v2d; - - ListBase oops; - short pin, visiflag, flag, rt; - void *lockpoin; + View2D v2d; /* deprecated, copied to region */ ListBase tree; struct TreeStore *treestore; @@ -212,39 +222,33 @@ typedef struct SpaceOops { struct TreeStoreElem search_tse; int search_flags, do_; - short type, outlinevis, storeflag; - short deps_flags; - + short flag, outlinevis, storeflag, pad; } SpaceOops; typedef struct SpaceImage { SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ int spacetype; - float blockscale; - struct ScrArea *area; + float blockscale; short blockhandler[8]; - - View2D v2d; struct Image *image; struct ImageUser iuser; struct CurveMapping *cumap; - short mode, menunr; - short imanr; + short menunr, imanr, pad2; short curtile; /* the currently active tile of the image when tile is enabled, is kept in sync with the active faces tile */ int flag; - short selectmode; short imtypenr, lock; - short pin; - float zoom; + short pin, pad3; char dt_uv; /* UV draw type */ char sticky; /* sticky selection type */ char dt_uvstretch; - char pad[5]; + char around; float xof, yof; /* user defined offset, image is centered */ + float zoom, pad4; /* user defined zoom level */ float centx, centy; /* storage for offset while render drawing */ struct bGPdata *gpd; /* grease pencil data */ @@ -252,24 +256,25 @@ typedef struct SpaceImage { typedef struct SpaceNla { struct SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ int spacetype; float blockscale; - struct ScrArea *area; short blockhandler[8]; - short menunr, lock; short autosnap; /* this uses the same settings as autosnap for Action Editor */ short flag; + int pad; - View2D v2d; + struct bDopeSheet *ads; + View2D v2d; /* deprecated, copied to region */ } SpaceNla; typedef struct SpaceText { SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ int spacetype; float blockscale; - struct ScrArea *area; short blockhandler[8]; @@ -277,22 +282,24 @@ typedef struct SpaceText { int top, viewlines; short flags, menunr; - int font_id; - int lheight; + short lheight; /* user preference */ + char cwidth, linenrs_tot; /* runtime computed, character width and the number of chars to use when showing line numbers */ int left; int showlinenrs; int tabnumber; - int currtab_set; int showsyntax; - int overwrite; + short overwrite; + short live_edit; /* run python while editing, evil */ float pix_per_line; struct rcti txtscroll, txtbar; int wordwrap, doplugins; + char findstr[256]; /* ST_MAX_FIND_STR */ + char replacestr[256]; /* ST_MAX_FIND_STR */ } SpaceText; typedef struct Script { @@ -315,9 +322,9 @@ typedef struct Script { typedef struct SpaceScript { SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ int spacetype; float blockscale; - struct ScrArea *area; struct Script *script; short flags, menunr; @@ -328,11 +335,11 @@ typedef struct SpaceScript { typedef struct SpaceTime { SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ int spacetype; float blockscale; - struct ScrArea *area; - View2D v2d; + View2D v2d; /* deprecated, copied to region */ int flag, redraws; @@ -340,13 +347,13 @@ typedef struct SpaceTime { typedef struct SpaceNode { SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ int spacetype; float blockscale; - struct ScrArea *area; short blockhandler[8]; - View2D v2d; + View2D v2d; /* deprecated, copied to region */ struct ID *id, *from; /* context, no need to save in file? well... pinning... */ short flag, menunr; /* menunr: browse id block in header */ @@ -354,27 +361,48 @@ typedef struct SpaceNode { void *curfont; float xof, yof; /* offset for drawing the backdrop */ + float mx, my; /* mousepos for drawing socketless link */ struct bNodeTree *nodetree, *edittree; - int treetype, pad; /* treetype: as same nodetree->type */ + int treetype; /* treetype: as same nodetree->type */ + short texfrom, pad; /* texfrom object, world or brush */ struct bGPdata *gpd; /* grease-pencil data */ } SpaceNode; /* snode->flag */ -#define SNODE_DO_PREVIEW 1 #define SNODE_BACKDRAW 2 #define SNODE_DISPGP 4 +/* snode->texfrom */ +#define SNODE_TEX_OBJECT 0 +#define SNODE_TEX_WORLD 1 +#define SNODE_TEX_BRUSH 2 + +typedef struct SpaceLogic { + SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ + int spacetype; + float blockscale; + + short blockhandler[8]; + + short flag, scaflag; + int pad; + + struct bGPdata *gpd; /* grease-pencil data */ +} SpaceLogic; + + typedef struct SpaceImaSel { SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ int spacetype; float blockscale; - struct ScrArea *area; short blockhandler[8]; - View2D v2d; + View2D v2d; /* deprecated, copied to region */ struct FileList *files; @@ -426,15 +454,174 @@ typedef struct SpaceImaSel { } SpaceImaSel; -/* **************** SPACE ********************* */ +typedef struct ConsoleLine { + struct ConsoleLine *next, *prev; + + /* keep these 3 vars so as to share free, realloc funcs */ + int len_alloc; /* allocated length */ + int len; /* real len - strlen() */ + char *line; + + int cursor; + int type; /* only for use when in the 'scrollback' listbase */ +} ConsoleLine; + +/* ConsoleLine.type */ +enum { + CONSOLE_LINE_OUTPUT=0, + CONSOLE_LINE_INPUT, + CONSOLE_LINE_INFO, /* autocomp feedback */ + CONSOLE_LINE_ERROR +}; + +/* SpaceConsole.rpt_mask */ +enum { + CONSOLE_TYPE_PYTHON=0, + CONSOLE_TYPE_REPORT, +}; + +/* SpaceConsole.type see BKE_report.h */ +enum { + CONSOLE_RPT_DEBUG = 1<<0, + CONSOLE_RPT_INFO = 1<<1, + CONSOLE_RPT_OP = 1<<2, + CONSOLE_RPT_WARN = 1<<3, + CONSOLE_RPT_ERR = 1<<4, +}; + +typedef struct SpaceConsole { + SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ + int spacetype; + float blockscale; // XXX are these needed? + + short blockhandler[8]; // XXX are these needed? + + /* space vars */ + int type; /* console/report/..? */ + int rpt_mask; /* which reports to display */ + int flag, lheight; + + ListBase scrollback; /* ConsoleLine; output */ + ListBase history; /* ConsoleLine; command history, current edited line is the first */ + char prompt[8]; + +} SpaceConsole; +typedef struct SpaceUserPref { + SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ + int spacetype; + + int pad; +} SpaceUserPref; /* view3d Now in DNA_view3d_types.h */ -/* button defines in BIF_butspace.h */ + + +/* **************** SPACE DEFINES ********************* */ + +/* button defines (deprecated) */ +/* warning: the values of these defines are used in sbuts->tabs[8] */ +/* sbuts->mainb new */ +#define CONTEXT_SCENE 0 +#define CONTEXT_OBJECT 1 +#define CONTEXT_TYPES 2 +#define CONTEXT_SHADING 3 +#define CONTEXT_EDITING 4 +#define CONTEXT_SCRIPT 5 +#define CONTEXT_LOGIC 6 + +/* sbuts->mainb old (deprecated) */ +#define BUTS_VIEW 0 +#define BUTS_LAMP 1 +#define BUTS_MAT 2 +#define BUTS_TEX 3 +#define BUTS_ANIM 4 +#define BUTS_WORLD 5 +#define BUTS_RENDER 6 +#define BUTS_EDIT 7 +#define BUTS_GAME 8 +#define BUTS_FPAINT 9 +#define BUTS_RADIO 10 +#define BUTS_SCRIPT 11 +#define BUTS_SOUND 12 +#define BUTS_CONSTRAINT 13 +#define BUTS_EFFECTS 14 + +/* sbuts->tab new (deprecated) */ +#define TAB_SHADING_MAT 0 +#define TAB_SHADING_TEX 1 +#define TAB_SHADING_RAD 2 +#define TAB_SHADING_WORLD 3 +#define TAB_SHADING_LAMP 4 + +#define TAB_OBJECT_OBJECT 0 +#define TAB_OBJECT_PHYSICS 1 +#define TAB_OBJECT_PARTICLE 2 + +#define TAB_SCENE_RENDER 0 +#define TAB_SCENE_WORLD 1 +#define TAB_SCENE_ANIM 2 +#define TAB_SCENE_SOUND 3 +#define TAB_SCENE_SEQUENCER 4 + + +/* buts->mainb new */ +#define BCONTEXT_SCENE 0 +#define BCONTEXT_WORLD 1 +#define BCONTEXT_OBJECT 2 +#define BCONTEXT_DATA 3 +#define BCONTEXT_MATERIAL 4 +#define BCONTEXT_TEXTURE 5 +#define BCONTEXT_PARTICLE 6 +#define BCONTEXT_PHYSICS 7 +#define BCONTEXT_BONE 9 +#define BCONTEXT_MODIFIER 10 +#define BCONTEXT_CONSTRAINT 12 +#define BCONTEXT_TOT 13 /* sbuts->flag */ #define SB_PRV_OSA 1 +#define SB_PIN_CONTEXT 2 +#define SB_WORLD_TEX 4 +#define SB_BRUSH_TEX 8 + +/* sbuts->align */ +#define BUT_FREE 0 +#define BUT_HORIZONTAL 1 +#define BUT_VERTICAL 2 +#define BUT_AUTO 3 + +/* sbuts->scaflag */ +#define BUTS_SENS_SEL 1 +#define BUTS_SENS_ACT 2 +#define BUTS_SENS_LINK 4 +#define BUTS_CONT_SEL 8 +#define BUTS_CONT_ACT 16 +#define BUTS_CONT_LINK 32 +#define BUTS_ACT_SEL 64 +#define BUTS_ACT_ACT 128 +#define BUTS_ACT_LINK 256 +#define BUTS_SENS_STATE 512 +#define BUTS_ACT_STATE 1024 + +/* FileSelectParams.display */ +enum FileDisplayTypeE { + FILE_SHORTDISPLAY = 1, + FILE_LONGDISPLAY, + FILE_IMGDISPLAY +}; + +/* FileSelectParams.sort */ +enum FileSortTypeE { + FILE_SORT_NONE = 0, + FILE_SORT_ALPHA = 1, + FILE_SORT_EXTENSION, + FILE_SORT_TIME, + FILE_SORT_SIZE +}; /* these values need to be hardcoded in structs, dna does not recognize defines */ /* also defined in BKE */ @@ -463,14 +650,9 @@ typedef struct SpaceImaSel { #define FILE_FILTER 256 #define FILE_BOOKMARKS 512 -/* sfile->sort */ -#define FILE_SORTALPHA 0 -#define FILE_SORTDATE 1 -#define FILE_SORTSIZE 2 -#define FILE_SORTEXTENS 3 - /* files in filesel list: 2=ACTIVE */ -#define HILITE 1 +#define EDITING 1 +#define ACTIVE 2 #define BLENDERFILE 4 #define PSXFILE 8 #define IMAGEFILE 16 @@ -482,13 +664,6 @@ typedef struct SpaceImaSel { #define MOVIEFILE_ICON 1024 /* movie file that preview can't load */ #define FOLDERFILE 2048 /* represents folders for filtering */ -#define SCROLLH 16 /* height scrollbar */ -#define SCROLLB 16 /* width scrollbar */ - -/* SpaceImage->mode */ -#define SI_TEXTURE 0 -#define SI_SHOW 1 - /* SpaceImage->dt_uv */ #define SI_UVDT_OUTLINE 0 #define SI_UVDT_DASH 1 @@ -506,12 +681,6 @@ typedef struct SpaceImaSel { #define SI_STICKY_DISABLE 1 #define SI_STICKY_VERTEX 2 -/* SpaceImage->selectmode */ -#define SI_SELECT_VERTEX 0 -#define SI_SELECT_EDGE 1 /* not implemented */ -#define SI_SELECT_FACE 2 -#define SI_SELECT_ISLAND 3 - /* SpaceImage->flag */ #define SI_BE_SQUARE 1<<0 #define SI_EDITTILE 1<<1 @@ -531,52 +700,53 @@ typedef struct SpaceImaSel { /* next two for render window dislay */ #define SI_PREVSPACE 1<<15 #define SI_FULLWINDOW 1<<16 -#define SI_SYNC_UVSEL 1<<17 -#define SI_LOCAL_UV 1<<18 +#define SI_DEPRECATED4 1<<17 +#define SI_DEPRECATED5 1<<18 /* this means that the image is drawn until it reaches the view edge, * in the image view, its unrelated to the 'tile' mode for texface */ #define SI_DRAW_TILE 1<<19 #define SI_SMOOTH_UV 1<<20 #define SI_DRAW_STRETCH 1<<21 #define SI_DISPGP 1<<22 +#define SI_DRAW_OTHER 1<<23 -/* SpaceIpo->flag */ -#define SIPO_LOCK_VIEW 1<<0 -#define SIPO_NOTRANSKEYCULL 1<<1 +#define SI_COLOR_CORRECTION 1<<24 + +/* SpaceIpo->flag (Graph Editor Settings) */ +#define SIPO_LOCK_VIEW (1<<0) +#define SIPO_NOTRANSKEYCULL (1<<1) +#define SIPO_NOHANDLES (1<<2) +#define SIPO_NODRAWCFRANUM (1<<3) +#define SIPO_DRAWTIME (1<<4) +#define SIPO_SELCUVERTSONLY (1<<5) +#define SIPO_DRAWNAMES (1<<6) +#define SIPO_SLIDERS (1<<7) + +/* SpaceIpo->mode (Graph Editor Mode) */ +enum { + /* all animation curves (from all over Blender) */ + SIPO_MODE_ANIMATION = 0, + /* drivers only */ + SIPO_MODE_DRIVERS, +} eGraphEdit_Mode; /* SpaceText flags (moved from DNA_text_types.h) */ #define ST_SCROLL_SELECT 0x0001 // scrollable #define ST_CLEAR_NAMESPACE 0x0010 // clear namespace after script // execution (see BPY_main.c) +#define ST_FIND_WRAP 0x0020 +#define ST_FIND_ALL 0x0040 -/* SpaceOops->type */ -#define SO_OOPS 0 -#define SO_OUTLINER 1 -#define SO_DEPSGRAPH 2 + +/* stext->findstr/replacestr */ +#define ST_MAX_FIND_STR 256 /* SpaceOops->flag */ #define SO_TESTBLOCKS 1 #define SO_NEWSELECTED 2 #define SO_HIDE_RESTRICTCOLS 4 - -/* SpaceOops->visiflag */ -#define OOPS_SCE 1 -#define OOPS_OB 2 -#define OOPS_ME 4 -#define OOPS_CU 8 -#define OOPS_MB 16 -#define OOPS_LT 32 -#define OOPS_LA 64 -#define OOPS_MA 128 -#define OOPS_TE 256 -#define OOPS_IP 512 -#define OOPS_LAY 1024 -#define OOPS_LI 2048 -#define OOPS_IM 4096 -#define OOPS_AR 8192 -#define OOPS_GR 16384 -#define OOPS_CA 32768 +#define SO_HIDE_KEYINGSETINFO 8 /* SpaceOops->outlinevis */ #define SO_ALL_SCENES 0 @@ -590,6 +760,9 @@ typedef struct SpaceImaSel { #define SO_VERSE_SESSION 8 #define SO_VERSE_MS 9 #define SO_SEQUENCE 10 +#define SO_DATABLOCKS 11 +#define SO_USERDEF 12 +#define SO_KEYMAP 13 /* SpaceOops->storeflag */ #define SO_TREESTORE_CLEANUP 1 @@ -633,10 +806,15 @@ typedef struct SpaceImaSel { #define IMS_INFILESLI 4 /* nla->flag */ -#define SNLA_ALLKEYED 1 -#define SNLA_ACTIVELAYERS 2 -#define SNLA_DRAWTIME 4 -#define SNLA_NOTRANSKEYCULL 8 + // depreceated +#define SNLA_ALLKEYED (1<<0) + // depreceated +#define SNLA_ACTIVELAYERS (1<<1) + +#define SNLA_DRAWTIME (1<<2) +#define SNLA_NOTRANSKEYCULL (1<<3) +#define SNLA_NODRAWCFRANUM (1<<4) +#define SNLA_NOSTRIPCURVES (1<<5) /* time->flag */ /* show timing in frames instead of in seconds */ @@ -647,11 +825,11 @@ typedef struct SpaceImaSel { #define TIME_ONLYACTSEL 4 /* time->redraws */ -#define TIME_LEFTMOST_3D_WIN 1 +#define TIME_REGION 1 #define TIME_ALL_3D_WIN 2 #define TIME_ALL_ANIM_WIN 4 #define TIME_ALL_BUTS_WIN 8 -#define TIME_WITH_SEQ_AUDIO 16 +#define TIME_WITH_SEQ_AUDIO 16 // deprecated #define TIME_SEQ 32 #define TIME_ALL_IMAGE_WIN 64 #define TIME_CONTINUE_PHYSICS 128 @@ -675,7 +853,7 @@ enum { SPACE_EMPTY, SPACE_VIEW3D, SPACE_IPO, - SPACE_OOPS, + SPACE_OUTLINER, SPACE_BUTS, SPACE_FILE, SPACE_IMAGE, @@ -689,8 +867,10 @@ enum { SPACE_SCRIPT, SPACE_TIME, SPACE_NODE, - SPACEICONMAX = SPACE_NODE -/* SPACE_LOGIC */ + SPACE_LOGIC, + SPACE_CONSOLE, + SPACE_USERPREF, + SPACEICONMAX = SPACE_USERPREF }; #endif diff --git a/source/blender/makesdna/DNA_text_types.h b/source/blender/makesdna/DNA_text_types.h index 48ecccd517a..8f9d4b5f4b4 100644 --- a/source/blender/makesdna/DNA_text_types.h +++ b/source/blender/makesdna/DNA_text_types.h @@ -78,7 +78,7 @@ typedef struct Text { /* text flags */ #define TXT_ISDIRTY 0x0001 -#define TXT_ISTMP 0x0002 +#define TXT_DEPRECATED 0x0004 /* deprecated ISTMP flag */ #define TXT_ISMEM 0x0004 #define TXT_ISEXT 0x0008 #define TXT_ISSCRIPT 0x0010 /* used by space handler scriptlinks */ diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index 111dc08ee02..c13c0522004 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -34,6 +34,7 @@ #include "DNA_ID.h" #include "DNA_image_types.h" +struct AnimData; struct Ipo; struct PluginTex; struct ColorBand; @@ -52,17 +53,17 @@ typedef struct MTex { char uvname[32]; char projx, projy, projz, mapping; - float ofs[3], size[3]; + float ofs[3], size[3], rot; short texflag, colormodel, pmapto, pmaptoneg; - short normapspace, pad[3]; + short normapspace, which_output; + char brush_map_mode, pad[7]; float r, g, b, k; float def_var, rt; float colfac, norfac, varfac; float dispfac; - float warpfac; - + float warpfac; } MTex; #ifndef DNA_USHORT_FIX @@ -127,8 +128,58 @@ typedef struct EnvMap { short recalc, lastsize; } EnvMap; +typedef struct PointDensity { + short flag; + + short falloff_type; + float falloff_softness; + float radius; + short source; + short color_source; + int totpoints; + + int pdpad; + + struct Object *object; /* for 'Object' or 'Particle system' type - source object */ + struct ParticleSystem *psys; + short psys_cache_space; /* cache points in worldspace, object space, ... ? */ + short ob_cache_space; /* cache points in worldspace, object space, ... ? */ + + short pdpad2[2]; + + void *point_tree; /* the acceleration tree containing points */ + float *point_data; /* dynamically allocated extra for extra information, like particle age */ + + float noise_size; + short noise_depth; + short noise_influence; + short noise_basis; + short pdpad3[3]; + float noise_fac; + + float speed_scale; + struct ColorBand *coba; /* for time -> color */ + +} PointDensity; + +typedef struct VoxelData { + int resol[3]; + int interp_type; + short file_format; + short flag; + int pad; + + struct Object *object; /* for rendering smoke sims */ + float int_multiplier; + int still_frame; + char source_path[240]; + float *dataset; + +} VoxelData; + typedef struct Tex { ID id; + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ float noisesize, turbul; float bright, contrast, rfac, gfac, bfac; @@ -141,18 +192,24 @@ typedef struct Tex { float dist_amount, ns_outscale; /* newnoise: voronoi nearest neighbour weights, minkovsky exponent, distance metric & color type */ - float vn_w1, vn_w2, vn_w3, vn_w4, vn_mexp; + float vn_w1; + float vn_w2; + float vn_w3; + float vn_w4; + float vn_mexp; short vn_distm, vn_coltype; short noisedepth, noisetype; /* newnoise: noisebasis type for clouds/marble/etc, noisebasis2 only used for distorted noise */ short noisebasis, noisebasis2; - + short imaflag, flag; short type, stype; float cropxmin, cropymin, cropxmax, cropymax; + int texfilter; + int afmax; // anisotropic filter maximum value, ewa -> max eccentricity, feline -> max probes short xrepeat, yrepeat; short extend; @@ -166,12 +223,18 @@ typedef struct Tex { struct ImageUser iuser; - struct Ipo *ipo; + struct bNodeTree *nodetree; + struct Ipo *ipo; // XXX depreceated... old animation system struct Image *ima; struct PluginTex *plugin; struct ColorBand *coba; struct EnvMap *env; struct PreviewImage * preview; + struct PointDensity *pd; + struct VoxelData *vd; + + char use_nodes; + char pad[7]; } Tex; @@ -208,6 +271,8 @@ typedef struct TexMapping { #define TEX_MUSGRAVE 11 #define TEX_VORONOI 12 #define TEX_DISTNOISE 13 +#define TEX_POINTDENSITY 14 +#define TEX_VOXELDATA 15 /* musgrave stype */ #define TEX_MFRACTAL 0 @@ -247,6 +312,15 @@ typedef struct TexMapping { #define TEX_GAUSS_MIP 4096 #define TEX_FILTER_MIN 8192 +/* texfilter */ +// TXF_BOX -> blender's old texture filtering method +#define TXF_BOX 0 +#define TXF_EWA 1 +#define TXF_FELINE 2 +#define TXF_AREA 3 +// TXF_SAT only available when mipmaps disabled +#define TXF_SAT 4 + /* imaflag unused, only for version check */ #define TEX_FIELDS_ 8 #define TEX_ANIMCYCLIC_ 64 @@ -335,6 +409,11 @@ typedef struct TexMapping { #define TEX_RGB 1 #define TEX_NOR 2 +/* pr_texture in material, world, lamp, */ +#define TEX_PR_TEXTURE 0 +#define TEX_PR_OTHER 1 +#define TEX_PR_BOTH 2 + /* **************** MTEX ********************* */ /* proj */ @@ -351,6 +430,7 @@ typedef struct TexMapping { #define MTEX_VIEWSPACE 16 #define MTEX_DUPLI_MAPTO 32 #define MTEX_OB_DUPLI_ORIG 64 +#define MTEX_NEW_BUMP 128 /* blendtype */ #define MTEX_BLEND 0 @@ -368,6 +448,13 @@ typedef struct TexMapping { #define MTEX_BLEND_VAL 12 #define MTEX_BLEND_COLOR 13 #define MTEX_NUM_BLENDTYPES 14 +#define MTEX_SOFT_LIGHT 15 +#define MTEX_LIN_LIGHT 16 + +/* brush_map_mode */ +#define MTEX_MAP_MODE_FIXED 0 +#define MTEX_MAP_MODE_TILED 1 +#define MTEX_MAP_MODE_3D 2 /* **************** EnvMap ********************* */ @@ -385,5 +472,62 @@ typedef struct TexMapping { #define ENV_NORMAL 1 #define ENV_OSA 2 +/* **************** PointDensity ********************* */ + +/* source */ +#define TEX_PD_PSYS 0 +#define TEX_PD_OBJECT 1 +#define TEX_PD_FILE 2 + +/* falloff_type */ +#define TEX_PD_FALLOFF_STD 0 +#define TEX_PD_FALLOFF_SMOOTH 1 +#define TEX_PD_FALLOFF_SOFT 2 +#define TEX_PD_FALLOFF_CONSTANT 3 +#define TEX_PD_FALLOFF_ROOT 4 + +/* psys_cache_space */ +#define TEX_PD_OBJECTLOC 0 +#define TEX_PD_OBJECTSPACE 1 +#define TEX_PD_WORLDSPACE 2 + +/* flag */ +#define TEX_PD_TURBULENCE 1 + + +/* noise_influence */ +#define TEX_PD_NOISE_STATIC 0 +#define TEX_PD_NOISE_VEL 1 +#define TEX_PD_NOISE_AGE 2 +#define TEX_PD_NOISE_TIME 3 + +/* color_source */ +#define TEX_PD_COLOR_CONSTANT 0 +#define TEX_PD_COLOR_PARTAGE 1 +#define TEX_PD_COLOR_PARTSPEED 2 +#define TEX_PD_COLOR_PARTVEL 3 + +#define POINT_DATA_VEL 1 +#define POINT_DATA_LIFE 2 + +/******************** Voxel Data *****************************/ +/* flag */ +#define TEX_VD_STILL 1 + +/* interpolation */ +#define TEX_VD_NEARESTNEIGHBOR 0 +#define TEX_VD_LINEAR 1 +#define TEX_VD_QUADRATIC 2 +#define TEX_VD_TRICUBIC_CATROM 3 +#define TEX_VD_TRICUBIC_BSPLINE 4 +#define TEX_VD_TRICUBIC_SLOW 5 + +/* file format */ +#define TEX_VD_BLENDERVOXEL 0 +#define TEX_VD_RAW_8BIT 1 +#define TEX_VD_RAW_16BIT 2 +#define TEX_VD_IMAGE_SEQUENCE 3 +#define TEX_VD_SMOKE 4 + #endif diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index fbd962f9372..826eea43a4d 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -38,40 +38,148 @@ /* themes; defines in BIF_resource.h */ struct ColorBand; -/* global, button colors */ -typedef struct ThemeUI { +/* ************************ style definitions ******************** */ + +#define MAX_STYLE_NAME 64 +#define MAX_FONT_NAME 256 + +/* default uifont_id offered by Blender */ +#define UIFONT_DEFAULT 0 +#define UIFONT_BITMAP 1 +/* free slots */ +#define UIFONT_CUSTOM1 2 +#define UIFONT_CUSTOM2 3 + +/* default fonts to load/initalize */ +/* first font is the default (index 0), others optional */ +typedef struct uiFont { + struct uiFont *next, *prev; + char filename[256]; + short blf_id; /* from blfont lib */ + short uifont_id; /* own id */ + short r_to_l; /* fonts that read from left to right */ + short pad; + +} uiFont; + +/* this state defines appearance of text */ +typedef struct uiFontStyle { + short uifont_id; /* saved in file, 0 is default */ + short points; /* actual size depends on 'global' dpi */ + short kerning; /* unfitted or default kerning value. */ + char pad[6]; + short italic, bold; /* style hint */ + short shadow; /* value is amount of pixels blur */ + short shadx, shady; /* shadow offset in pixels */ + short align; /* text align hint */ + float shadowalpha; /* total alpha */ + float shadowcolor; /* 1 value, typically white or black anyway */ + +} uiFontStyle; + +/* uiFontStyle->align */ +#define UI_STYLE_TEXT_LEFT 0 +#define UI_STYLE_TEXT_CENTER 1 +#define UI_STYLE_TEXT_RIGHT 2 + + +/* this is fed to the layout engine and widget code */ +typedef struct uiStyle { + struct uiStyle *next, *prev; + + char name[64]; /* MAX_STYLE_NAME */ + + uiFontStyle paneltitle; + uiFontStyle grouplabel; + uiFontStyle widgetlabel; + uiFontStyle widget; + + float panelzoom; + + short minlabelchars; /* in characters */ + short minwidgetchars; /* in characters */ + + short columnspace; + short templatespace; + short boxspace; + short buttonspacex; + short buttonspacey; + short panelspace; + short panelouter; + + short pad[1]; +} uiStyle; + +typedef struct uiWidgetColors { char outline[4]; - char neutral[4]; - char action[4]; - char setting[4]; - char setting1[4]; - char setting2[4]; - char num[4]; - char textfield[4]; - char textfield_hi[4]; - char popup[4]; + char inner[4]; + char inner_sel[4]; + char item[4]; char text[4]; - char text_hi[4]; - char menu_back[4]; - char menu_item[4]; - char menu_hilite[4]; - char menu_text[4]; - char menu_text_hi[4]; + char text_sel[4]; + short shaded; + short shadetop, shadedown; + short pad; +} uiWidgetColors; + +typedef struct uiWidgetStateColors { + char inner_anim[4]; + char inner_anim_sel[4]; + char inner_key[4]; + char inner_key_sel[4]; + char inner_driven[4]; + char inner_driven_sel[4]; + float blend, pad; +} uiWidgetStateColors; + +typedef struct ThemeUI { + + /* Interface Elements (buttons, menus, icons) */ + uiWidgetColors wcol_regular, wcol_tool, wcol_text; + uiWidgetColors wcol_radio, wcol_option, wcol_toggle; + uiWidgetColors wcol_num, wcol_numslider; + uiWidgetColors wcol_menu, wcol_pulldown, wcol_menu_back, wcol_menu_item; + uiWidgetColors wcol_box, wcol_scroll, wcol_list_item; + + uiWidgetStateColors wcol_state; - char but_drawtype; - char pad[3]; char iconfile[80]; // FILE_MAXFILE length + } ThemeUI; /* try to put them all in one, if needed a special struct can be created as well * for example later on, when we introduce wire colors for ob types or so... */ typedef struct ThemeSpace { + /* main window colors */ char back[4]; + char title[4]; char text[4]; char text_hi[4]; + + /* header colors */ char header[4]; + char header_title[4]; + char header_text[4]; + char header_text_hi[4]; + + /* button/tool regions */ + char button[4]; + char button_title[4]; + char button_text[4]; + char button_text_hi[4]; + + /* listview regions */ + char list[4]; + char list_title[4]; + char list_text[4]; + char list_text_hi[4]; + + /* float panel */ char panel[4]; + char panel_title[4]; + char panel_text[4]; + char panel_text_hi[4]; char shade1[4]; char shade2[4]; @@ -90,7 +198,8 @@ typedef struct ThemeSpace { char normal[4]; char bone_solid[4], bone_pose[4]; char strip[4], strip_select[4]; - char cframe[4], pad[4]; + char cframe[4]; + char ds_channel[4], ds_subchannel[4]; // dopesheet char vertex_size, facedot_size; char bpad[2]; @@ -104,8 +213,12 @@ typedef struct ThemeSpace { char handle_vertex[4]; char handle_vertex_select[4]; + char handle_vertex_size; - char hpad[7]; + char hpad[3]; + + char pad[4]; + } ThemeSpace; @@ -128,7 +241,6 @@ typedef struct bTheme { struct bTheme *next, *prev; char name[32]; - /* Interface Elements (buttons, menus, icons) */ ThemeUI tui; /* Individual Spacetypes */ @@ -147,12 +259,13 @@ typedef struct bTheme { ThemeSpace toops; ThemeSpace ttime; ThemeSpace tnode; + ThemeSpace tlogic; + ThemeSpace tuserpref; /* 20 sets of bone colors for this theme */ ThemeWireColor tarm[20]; /*ThemeWireColor tobj[20];*/ - - unsigned char bpad[4], bpad1[4]; + } bTheme; typedef struct SolidLight { @@ -173,20 +286,29 @@ typedef struct UserDef { char sounddir[160]; /* yafray: temporary xml export directory */ char yfexportdir[160]; - short versions, vrmlflag; // tmp for export, will be replaced by strubi + short versions, pad; + int gameflags; int wheellinescroll; int uiflag, language; short userpref, viewzoom; - short console_buffer; //console vars here for tuhopuu compat, --phase - short console_out; + int mixbufsize; - int fontsize; + int audiodevice; + int audiorate; + int audioformat; + int audiochannels; + + int scrollback; /* console scrollback limit */ + int dpi; /* range 48-128? */ short encoding; short transopts; short menuthreshold1, menuthreshold2; - char fontname[256]; // FILE_MAXDIR+FILE length + struct ListBase themes; + struct ListBase uifonts; + struct ListBase uistyles; + short undosteps; short undomemory; short gp_manhattendist, gp_euclideandist, gp_eraser; @@ -194,7 +316,8 @@ typedef struct UserDef { short tb_leftmouse, tb_rightmouse; struct SolidLight light[3]; short tw_hotspot, tw_flag, tw_handlesize, tw_size; - int textimeout, texcollectrate; + short textimeout,texcollectrate; + short wmdrawmethod, wmpad; int memcachelimit; int prefetchframes; short frameserverport; @@ -206,19 +329,19 @@ typedef struct UserDef { short smooth_viewtx; /* miliseconds to spend spinning the view */ short glreslimit; short ndof_pan, ndof_rotate; - short curssize, pad; -// char pad[8]; + short curssize, ipo_new; + char versemaster[160]; char verseuser[160]; float glalphaclip; short autokey_mode; /* autokeying mode */ short autokey_flag; /* flags for autokeying */ - + struct ColorBand coba_weight; /* from texture.h */ } UserDef; -extern UserDef U; /* from usiblender.c !!!! */ +extern UserDef U; /* from blenkernel blender.c */ /* ***************** USERDEF ****************** */ @@ -246,6 +369,7 @@ extern UserDef U; /* from usiblender.c !!!! */ #define USER_RELPATHS (1 << 20) #define USER_DRAGIMMEDIATE (1 << 21) #define USER_DONT_DOSCRIPTLINKS (1 << 22) +#define USER_FILENOUI (1 << 23) /* viewzom */ #define USER_ZOOM_CONT 0 @@ -277,6 +401,7 @@ extern UserDef U; /* from usiblender.c !!!! */ #define USER_ZOOM_TO_MOUSEPOS (1 << 20) #define USER_SHOW_FPS (1 << 21) #define USER_MMB_PASTE (1 << 22) +#define USER_MENUFIXEDORDER (1 << 23) /* Auto-Keying mode */ /* AUTOKEY_ON is a bitflag */ @@ -286,10 +411,12 @@ extern UserDef U; /* from usiblender.c !!!! */ #define AUTOKEY_MODE_EDITKEYS 5 /* Auto-Keying flag */ + /* U.autokey_flag */ #define AUTOKEY_FLAG_INSERTAVAIL (1<<0) #define AUTOKEY_FLAG_INSERTNEEDED (1<<1) #define AUTOKEY_FLAG_AUTOMATKEY (1<<2) - + /* toolsettings->autokey_flag */ +#define ANIMRECORD_FLAG_WITHNLA (1<<10) /* transopts */ #define USER_TR_TOOLTIPS (1 << 0) @@ -313,16 +440,17 @@ extern UserDef U; /* from usiblender.c !!!! */ #define USER_DUP_TEX (1 << 8) #define USER_DUP_ARM (1 << 9) #define USER_DUP_ACT (1 << 10) +#define USER_DUP_PSYS (1 << 11) /* gameflags */ #define USER_DEPRECATED_FLAG 1 #define USER_DISABLE_SOUND 2 #define USER_DISABLE_MIPMAP 4 -/* vrml flag */ -#define USER_VRML_LAYERS 1 -#define USER_VRML_AUTOSCALE 2 -#define USER_VRML_TWOSIDED 4 +/* wm draw method */ +#define USER_DRAW_TRIPLE 0 +#define USER_DRAW_OVERLAP 1 +#define USER_DRAW_FULL 2 /* tw_flag (transform widget) */ @@ -330,5 +458,11 @@ extern UserDef U; /* from usiblender.c !!!! */ #define GP_PAINT_DOSMOOTH (1<<0) #define GP_PAINT_DOSIMPLIFY (1<<1) +/* theme drawtypes */ +#define TH_MINIMAL 0 +#define TH_ROUNDSHADED 1 +#define TH_ROUNDED 2 +#define TH_OLDSKOOL 3 +#define TH_SHADED 4 #endif diff --git a/source/blender/makesdna/DNA_vfont_types.h b/source/blender/makesdna/DNA_vfont_types.h index 33b8efa8dd5..b90e853d772 100644 --- a/source/blender/makesdna/DNA_vfont_types.h +++ b/source/blender/makesdna/DNA_vfont_types.h @@ -40,7 +40,6 @@ typedef struct VFont { ID id; char name[256]; - float scale, pad; struct VFontData *data; struct PackedFile * packedfile; diff --git a/source/blender/makesdna/DNA_view2d_types.h b/source/blender/makesdna/DNA_view2d_types.h index d7c422407ca..bc019ef8121 100644 --- a/source/blender/makesdna/DNA_view2d_types.h +++ b/source/blender/makesdna/DNA_view2d_types.h @@ -24,7 +24,7 @@ * * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): Joshua Leung * * ***** END GPL LICENSE BLOCK ***** */ @@ -33,32 +33,115 @@ #include "DNA_vec_types.h" +/* ---------------------------------- */ + +/* View 2D data - stored per region */ typedef struct View2D { - rctf tot, cur; - rcti vert, hor, mask; - float min[2], max[2]; - float minzoom, maxzoom; - short scroll, keeptot; - short keepaspect, keepzoom; - short oldwinx, oldwiny; - int flag; + rctf tot, cur; /* tot - area that data can be drawn in; cur - region of tot that is visible in viewport */ + rcti vert, hor; /* vert - vertical scrollbar region; hor - horizontal scrollbar region */ + rcti mask; /* mask - region (in screenspace) within which 'cur' can be viewed */ + + float min[2], max[2]; /* min/max sizes of 'cur' rect (only when keepzoom not set) */ + float minzoom, maxzoom; /* self explanatory. allowable zoom factor range (only when keepzoom set) */ + + short scroll; /* scroll - scrollbars to display (bitflag) */ + short scroll_ui; /* scroll_ui - temp settings used for UI drawing of scrollers */ + + short keeptot; /* keeptot - 'cur' rect cannot move outside the 'tot' rect? */ + short keepzoom; /* keepzoom - axes that zooming cannot occur on, and also clamp within zoom-limits */ + short keepofs; /* keepofs - axes that translation is not allowed to occur on */ - float cursor[2]; /* only used in the UV view for now*/ - short around; - char pad[6]; + short flag; /* settings */ + short align; /* alignment of content in totrect */ + + short winx, winy; /* storage of current winx/winy values, set in UI_view2d_size_update */ + short oldwinx, oldwiny; /* storage of previous winx/winy values encountered by UI_view2d_curRect_validate(), for keepaspect */ + + short around; /* pivot point for transforms (rotate and scale) */ + float cursor[2]; /* only used in the UV view for now (for 2D-cursor) */ + + float *tab_offset; /* different offset per tab, for buttons */ + int tab_num; /* number of tabs stored */ + int tab_cur; /* current tab */ } View2D; -/* v2d->keepzoom */ -#define V2D_KEEPZOOM 0x0001 -#define V2D_LOCKZOOM_X 0x0100 -#define V2D_LOCKZOOM_Y 0x0200 +/* ---------------------------------- */ + +/* view zooming restrictions, per axis (v2d->keepzoom) */ + /* zoom is clamped to lie within limits set by minzoom and maxzoom */ +#define V2D_LIMITZOOM 0x0001 + /* aspect ratio is maintained on view resize */ +#define V2D_KEEPASPECT 0x0002 + /* zoom is kept when the window resizes */ +#define V2D_KEEPZOOM 0x0004 + /* zooming on x-axis is not allowed */ +#define V2D_LOCKZOOM_X 0x0100 + /* zooming on y-axis is not allowed */ +#define V2D_LOCKZOOM_Y 0x0200 + +/* view panning restrictions, per axis (v2d->keepofs) */ + /* panning on x-axis is not allowed */ +#define V2D_LOCKOFS_X (1<<1) + /* panning on y-axis is not allowed */ +#define V2D_LOCKOFS_Y (1<<2) + /* on resize, keep the x offset */ +#define V2D_KEEPOFS_X (1<<3) + /* on resize, keep the y offset */ +#define V2D_KEEPOFS_Y (1<<4) + +/* view extent restrictions (v2d->keeptot) */ + /* 'cur' view can be out of extents of 'tot' */ +#define V2D_KEEPTOT_FREE 0 + /* 'cur' rect is adjusted so that it satisfies the extents of 'tot', with some compromises */ +#define V2D_KEEPTOT_BOUNDS 1 + /* 'cur' rect is moved so that the 'minimum' bounds of the 'tot' rect are always respected (particularly in x-axis) */ +#define V2D_KEEPTOT_STRICT 2 + +/* general refresh settings (v2d->flag) */ + /* global view2d horizontal locking (for showing same time interval) */ +#define V2D_VIEWSYNC_SCREEN_TIME (1<<0) + /* within area (i.e. between regions) view2d vertical locking */ +#define V2D_VIEWSYNC_AREA_VERTICAL (1<<1) + /* apply pixel offsets on x-axis when setting view matrices */ +#define V2D_PIXELOFS_X (1<<2) + /* apply pixel offsets on y-axis when setting view matrices */ +#define V2D_PIXELOFS_Y (1<<3) + /* view settings need to be set still... */ +#define V2D_IS_INITIALISED (1<<10) + +/* scroller flags for View2D (v2d->scroll) */ + /* left scrollbar */ +#define V2D_SCROLL_LEFT (1<<0) +#define V2D_SCROLL_RIGHT (1<<1) +#define V2D_SCROLL_VERTICAL (V2D_SCROLL_LEFT|V2D_SCROLL_RIGHT) + /* horizontal scrollbar */ +#define V2D_SCROLL_TOP (1<<2) +#define V2D_SCROLL_BOTTOM (1<<3) + /* special hack for outliner hscroll - prevent hanging older versions of Blender */ +#define V2D_SCROLL_BOTTOM_O (1<<4) +#define V2D_SCROLL_HORIZONTAL (V2D_SCROLL_TOP|V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O) + /* scale markings - vertical */ +#define V2D_SCROLL_SCALE_VERTICAL (1<<5) + /* scale markings - horizontal */ +#define V2D_SCROLL_SCALE_HORIZONTAL (1<<6) + /* disable draw temporary */ +#define V2D_SCROLL_VERTICAL_HIDE (1<<7) +#define V2D_SCROLL_HORIZONTAL_HIDE (1<<8) + +/* scroll_ui, activate flag for drawing */ +#define V2D_SCROLL_H_ACTIVE (1<<0) +#define V2D_SCROLL_V_ACTIVE (1<<1) -/* event codes for locking function */ -#define V2D_LOCK_COPY 1 -#define V2D_LOCK_REDRAW 2 +/* alignment flags for totrect, flags use 'shading-out' convention (v2d->align) */ + /* all quadrants free */ +#define V2D_ALIGN_FREE 0 + /* horizontal restrictions */ +#define V2D_ALIGN_NO_POS_X (1<<0) +#define V2D_ALIGN_NO_NEG_X (1<<1) + /* vertical restrictions */ +#define V2D_ALIGN_NO_POS_Y (1<<2) +#define V2D_ALIGN_NO_NEG_Y (1<<3) -/* v2d->flag */ -#define V2D_VIEWLOCK 1 #endif diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index b7b5f71c845..d42ccd62694 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -41,6 +41,8 @@ struct BoundBox; struct RenderInfo; struct RetopoViewData; struct bGPdata; +struct SmoothViewStore; +struct wmTimer; /* This is needed to not let VC choke on near and far... old * proprietary MS extensions... */ @@ -63,95 +65,124 @@ struct bGPdata; typedef struct BGpic { struct Image *ima; struct ImageUser iuser; - float xof, yof, size, zoom, blend; - short xim, yim; + float xof, yof, size, blend; } BGpic; /* ********************************* */ -/* 3D ViewPort Struct */ -typedef struct View3D { - struct SpaceLink *next, *prev; - int spacetype; - float blockscale; - struct ScrArea *area; +typedef struct RegionView3D { - short blockhandler[8]; - + float winmat[4][4]; float viewmat[4][4]; float viewinv[4][4]; float persmat[4][4]; float persinv[4][4]; - - float winmat1[4][4]; // persp(1) storage, for swap matrices - float viewmat1[4][4]; + + /* local viewmat/persmat, multiplied with object matrix, while drawing */ + float viewmatob[4][4]; + float persmatob[4][4]; + + /* transform widget matrix */ + float twmat[4][4]; float viewquat[4], dist, zfac; /* zfac is initgrabz() result */ - int lay_used; /* used while drawing */ - + float camdx, camdy; /* camera view offsets, 1.0 = viewplane moves entire width/height */ + float pixsize; + float ofs[3]; + short camzoom, viewbut, pad[2]; + + short rflag, viewlock; short persp; short view; + + /* user defined clipping planes */ + float clip[6][4]; + struct BoundBox *clipbb; + + struct bGPdata *gpd; /* Grease-Pencil Data (annotation layers) */ + + struct RegionView3D *localvd; + struct RenderInfo *ri; + struct RetopoViewData *retopo_view_data; + struct ViewDepths *depths; + + /* animated smooth view */ + struct SmoothViewStore *sms; + struct wmTimer *smooth_timer; + + /* last view */ + float lviewquat[4]; + short lpersp, lview; + int pad3; + +} RegionView3D; +/* 3D ViewPort Struct */ +typedef struct View3D { + struct SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ + int spacetype; + float blockscale; + short blockhandler[8]; + + float viewquat[4], dist, pad1; /* XXX depricated */ + + int lay_used; /* used while drawing */ + + short persp; /* XXX depricated */ + short view; /* XXX depricated */ + struct Object *camera, *ob_centre; struct BGpic *bgpic; struct View3D *localvd; - struct RenderInfo *ri; - struct RetopoViewData *retopo_view_data; - struct ViewDepths *depths; char ob_centre_bone[32]; /* optional string for armature bone to define center */ + int lay, layact; + /** * The drawing mode for the 3d display. Set to OB_WIRE, OB_SOLID, * OB_SHADED or OB_TEXTURE */ short drawtype; short localview; - int lay, layact; - short scenelock, around, camzoom; + short scenelock, around, pad3; + short flag, flag2; - char pivot_last, pad1; /* pivot_last is for rotating around the last edited element */ + short pivot_last; /* pivot_last is for rotating around the last edited element */ - float lens, grid, gridview, pixsize, near, far; - float camdx, camdy; /* camera view offsets, 1.0 = viewplane moves entire width/height */ - float ofs[3], cursor[3]; + float lens, grid, gridview, padf, near, far; + float ofs[3]; /* XXX depricated */ + float cursor[3]; - short gridlines, viewbut; + short gridlines, pad4; short gridflag; - short modeselect, menunr, texnr; + short gridsubdiv; /* Number of subdivisions in the grid between each highlighted grid line */ + short modeselect; + short keyflags; /* flags for display of keyframes */ /* transform widget info */ short twtype, twmode, twflag, twdrawflag; - float twmat[4][4]; - /* user defined clipping planes */ - float clip[4][4]; - - struct BoundBox *clipbb; + /* customdata flags from modes */ + unsigned int customdata_mask; /* afterdraw, for xray & transparent */ struct ListBase afterdraw; + /* drawflags, denoting state */ short zbuf, transp, xray; - short flag, flag2; - - short gridsubdiv; /* Number of subdivisions in the grid between each highlighted grid line */ - - short keyflags; /* flags for display of keyframes */ - - char ndofmode; /* mode of transform for 6DOF devices -1 not found, 0 normal, 1 fly, 2 ob transform */ - char ndoffilter; /*filter for 6DOF devices 0 normal, 1 dominant */ + char ndofmode; /* mode of transform for 6DOF devices -1 not found, 0 normal, 1 fly, 2 ob transform */ + char ndoffilter; /* filter for 6DOF devices 0 normal, 1 dominant */ void *properties_storage; /* Nkey panel stores stuff here, not in file */ + + /* XXX depricated? */ struct bGPdata *gpd; /* Grease-Pencil Data (annotation layers) */ - /* last view */ - float lviewquat[4]; - short lpersp, lview; - - short pad5, pad6; } View3D; +/* XXX this needs cleaning */ /* View3D->flag (short) */ #define V3D_MODE (16+32+64+128+256+512) @@ -169,14 +200,18 @@ typedef struct View3D { #define V3D_SELECT_OUTLINE 2048 #define V3D_ZBUF_SELECT 4096 #define V3D_GLOBAL_STATS 8192 -#define V3D_CLIPPING 16384 #define V3D_DRAW_CENTERS 32768 +/* RegionView3d->rflag */ +#define RV3D_FLYMODE 2 +#define RV3D_CLIPPING 4 + +/* RegionView3d->viewlock */ +#define RV3D_LOCKED 1 +#define RV3D_BOXVIEW 2 +#define RV3D_BOXCLIP 4 + /* View3d->flag2 (short) */ -#define V3D_MODE2 (32) -#define V3D_OPP_DIRECTION_NAME 1 -#define V3D_FLYMODE 2 -#define V3D_DEPRECATED 4 /* V3D_TRANSFORM_SNAP, moved to a scene setting */ #define V3D_SOLID_TEX 8 #define V3D_DISPGP 16 @@ -187,6 +222,23 @@ typedef struct View3D { #define V3D_LOCAL 2 #define V3D_ACTIVE 4 +/*View3D view types*/ +#define V3D_VIEW_FRONT 1 +#define V3D_VIEW_BACK 2 +#define V3D_VIEW_LEFT 3 +#define V3D_VIEW_RIGHT 4 +#define V3D_VIEW_TOP 5 +#define V3D_VIEW_BOTTOM 6 +#define V3D_VIEW_PERSPORTHO 7 +#define V3D_VIEW_CAMERA 8 +#define V3D_VIEW_STEPLEFT 9 +#define V3D_VIEW_STEPRIGHT 10 +#define V3D_VIEW_STEPDOWN 11 +#define V3D_VIEW_STEPUP 12 +#define V3D_VIEW_PANLEFT 13 +#define V3D_VIEW_PANRIGHT 14 +#define V3D_VIEW_PANDOWN 15 +#define V3D_VIEW_PANUP 16 /* View3d->persp */ #define V3D_ORTHO 0 diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h new file mode 100644 index 00000000000..f1ce3491d0a --- /dev/null +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -0,0 +1,349 @@ +/** + * $Id: + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. + * + * 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) 2007 Blender Foundation. + * All rights reserved. + * + * + * Contributor(s): Blender Foundation + * + * ***** END GPL LICENSE BLOCK ***** + */ +#ifndef DNA_WINDOWMANAGER_TYPES_H +#define DNA_WINDOWMANAGER_TYPES_H + +#include "DNA_listBase.h" +#include "DNA_vec_types.h" + +#include "DNA_ID.h" + +/* defined here: */ +struct wmWindowManager; +struct wmWindow; + +struct wmEvent; +struct wmGesture; +struct wmOperatorType; +struct wmOperator; +struct wmKeyMap; + +/* forwards */ +struct bContext; +struct wmLocal; +struct bScreen; +struct uiBlock; +struct wmSubWindow; +struct wmTimer; +struct StructRNA; +struct PointerRNA; +struct ReportList; +struct Report; +struct uiLayout; + +#define OP_MAX_TYPENAME 64 +#define KMAP_MAX_NAME 64 + + +typedef enum ReportType { + RPT_DEBUG = 1<<0, + RPT_INFO = 1<<1, + RPT_OPERATOR = 1<<2, + RPT_WARNING = 1<<3, + RPT_ERROR = 1<<4, + RPT_ERROR_INVALID_INPUT = 1<<5, + RPT_ERROR_INVALID_CONTEXT = 1<<6, + RPT_ERROR_OUT_OF_MEMORY = 1<<7 +} ReportType; + +#define RPT_DEBUG_ALL (RPT_DEBUG) +#define RPT_INFO_ALL (RPT_INFO) +#define RPT_OPERATOR_ALL (RPT_OPERATOR) +#define RPT_WARNING_ALL (RPT_WARNING) +#define RPT_ERROR_ALL (RPT_ERROR|RPT_ERROR_INVALID_INPUT|RPT_ERROR_INVALID_CONTEXT|RPT_ERROR_OUT_OF_MEMORY) + +enum ReportListFlags { + RPT_PRINT = 1, + RPT_STORE = 2, + RPT_FREE = 4, +}; +typedef struct Report { + struct Report *next, *prev; + short type; /* ReportType */ + short flag; + int len; /* strlen(message), saves some time calculating the word wrap */ + char *typestr; + char *message; +} Report; +typedef struct ReportList { + ListBase list; + int printlevel; /* ReportType */ + int storelevel; /* ReportType */ + int flag, pad; +} ReportList; +/* reports need to be before wmWindowManager */ + + +/* windowmanager is saved, tag WMAN */ +typedef struct wmWindowManager { + ID id; + + struct wmWindow *windrawable, *winactive; /* separate active from drawable */ + ListBase windows; + + int initialized; /* set on file read */ + short file_saved; /* indicator whether data was saved */ + short pad; + + ListBase operators; /* operator registry */ + + ListBase queue; /* refresh/redraw wmNotifier structs */ + + struct ReportList reports; /* information and error reports */ + + ListBase jobs; /* threaded jobs manager */ + + ListBase paintcursors; /* extra overlay cursors to draw, like circles */ + + /* used keymaps, optionally/partially saved */ + ListBase keymaps; + +} wmWindowManager; + +/* wmWindowManager.initialized */ +#define WM_INIT_WINDOW 1<<0 +#define WM_INIT_KEYMAP 1<<1 + +/* the savable part, rest of data is local in ghostwinlay */ +typedef struct wmWindow { + struct wmWindow *next, *prev; + + void *ghostwin; /* dont want to include ghost.h stuff */ + + int winid, pad; /* winid also in screens, is for retrieving this window after read */ + + struct bScreen *screen; /* active screen */ + struct bScreen *newscreen; /* temporary when switching */ + char screenname[32]; /* MAX_ID_NAME for matching window with active screen after file read */ + + short posx, posy, sizex, sizey; /* window coords */ + short windowstate; /* borderless, full */ + short monitor; /* multiscreen... no idea how to store yet */ + short active; /* set to 1 if an active window, for quick rejects */ + short cursor; /* current mouse cursor type */ + short lastcursor; /* for temp waitcursor */ + short addmousemove; /* internal: tag this for extra mousemove event, makes cursors/buttons active on UI switching */ + int pad3; + + struct wmEvent *eventstate; /* storage for event system */ + + struct wmSubWindow *curswin; /* internal for wm_subwindow.c only */ + + struct wmGesture *tweak; /* internal for wm_operators.c */ + + int drawmethod, drawfail; /* internal for wm_draw.c only */ + void *drawdata; /* internal for wm_draw.c only */ + + ListBase timers; + + ListBase queue; /* all events (ghost level events were handled) */ + ListBase handlers; /* window+screen handlers, handled last */ + ListBase modalhandlers; /* priority handlers, handled first */ + + ListBase subwindows; /* opengl stuff for sub windows, see notes in wm_subwindow.c */ + ListBase gesture; /* gesture stuff */ +} wmWindow; + +/* should be somthing like DNA_EXCLUDE + * but the preprocessor first removes all comments, spaces etc */ + +# +# +typedef struct wmOperatorTypeMacro { + struct wmOperatorTypeMacro *next, *prev; + + /* operator id */ + char idname[MAX_ID_NAME]; + /* rna pointer to access properties, like keymap */ + struct PointerRNA *ptr; + +} wmOperatorTypeMacro; + +# +# +typedef struct wmOperatorType { + struct wmOperatorType *next, *prev; + + char *name; /* text for ui, undo */ + char *idname; /* unique identifier */ + char *description; /* tooltips and python docs */ + + /* this callback executes the operator without any interactive input, + * parameters may be provided through operator properties. cannot use + * any interface code or input device state. + * - see defines below for return values */ + int (*exec)(struct bContext *, struct wmOperator *); + + /* for modal temporary operators, initially invoke is called. then + * any further events are handled in modal. if the operation is + * cancelled due to some external reason, cancel is called + * - see defines below for return values */ + int (*invoke)(struct bContext *, struct wmOperator *, struct wmEvent *); + int (*cancel)(struct bContext *, struct wmOperator *); + int (*modal)(struct bContext *, struct wmOperator *, struct wmEvent *); + + /* verify if the operator can be executed in the current context, note + * that the operator might still fail to execute even if this return true */ + int (*poll)(struct bContext *); + + /* optional panel for redo and repeat, autogenerated if not set */ + void (*ui)(struct bContext *, struct PointerRNA *, struct uiLayout *); + + /* rna for properties */ + struct StructRNA *srna; + + /* struct wmOperatorTypeMacro */ + ListBase macro; + + short flag; + + /* pointer to modal keymap, do not free! */ + struct wmKeyMap *modalkeymap; + + /* only used for operators defined with python + * use to store pointers to python functions */ + void *pyop_data; + int (*pyop_poll)(struct bContext *, struct wmOperatorType *ot); + +} wmOperatorType; + + +/* partial copy of the event, for matching by eventhandler */ +typedef struct wmKeymapItem { + struct wmKeymapItem *next, *prev; + + char idname[64]; /* used to retrieve operator type pointer */ + struct PointerRNA *ptr; /* rna pointer to access properties */ + + short type; /* event code itself */ + short val; /* 0=any, 1=click, 2=release, or wheelvalue, or... */ + short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */ + short keymodifier; /* rawkey modifier */ + + short propvalue; /* if used, the item is from modal map */ + + short inactive; /* if set, deactivated item */ + short maptype; /* keymap editor */ + short pad2, pad3; +} wmKeymapItem; + + +/* stored in WM, the actively used keymaps */ +typedef struct wmKeyMap { + struct wmKeyMap *next, *prev; + + ListBase keymap; + + char nameid[64]; /* global editor keymaps, or for more per space/region */ + short spaceid; /* same IDs as in DNA_space_types.h */ + short regionid; /* see above */ + + short is_modal; /* modal map, not using operatornames */ + short pad; + + void *items; /* struct EnumPropertyItem for now */ + + /* verify if the keymap is enabled in the current context */ + int (*poll)(struct bContext *); +} wmKeyMap; + + +/* this one is the operator itself, stored in files for macros etc */ +/* operator + operatortype should be able to redo entirely, but for different contextes */ +typedef struct wmOperator { + struct wmOperator *next, *prev; + + /* saved */ + char idname[64]; /* used to retrieve type pointer */ + IDProperty *properties; /* saved, user-settable properties */ + + /* runtime */ + wmOperatorType *type; /* operator type definition from idname */ + void *customdata; /* custom storage, only while operator runs */ + + struct PointerRNA *ptr; /* rna pointer to access properties */ + struct ReportList *reports; /* errors and warnings storage */ + + ListBase macro; /* list of operators, can be a tree */ + struct wmOperator *opm; /* current running macro, not saved */ + short flag, pad[3]; + +} wmOperator; + +/* operator type exec(), invoke() modal(), return values */ +#define OPERATOR_RUNNING_MODAL 1 +#define OPERATOR_CANCELLED 2 +#define OPERATOR_FINISHED 4 +/* add this flag if the event should pass through */ +#define OPERATOR_PASS_THROUGH 8 + +/* wmOperator flag */ + + +/* ************** wmEvent ************************ */ +/* for read-only rna access, dont save this */ + +/* each event should have full modifier state */ +/* event comes from eventmanager and from keymap */ +typedef struct wmEvent { + struct wmEvent *next, *prev; + + short type; /* event code itself (short, is also in keymap) */ + short val; /* press, release, scrollvalue */ + short x, y; /* mouse pointer position, screen coord */ + short mval[2]; /* region mouse position, name convention pre 2.5 :) */ + short prevx, prevy; /* previous mouse pointer position */ + short unicode; /* future, ghost? */ + char ascii; /* from ghost */ + char pad; + + /* modifier states */ + short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */ + short keymodifier; /* rawkey modifier */ + + short pad1; + + /* keymap item, set by handler (weak?) */ + const char *keymap_idname; + + /* custom data */ + short custom; /* custom data type, stylus, 6dof, see wm_event_types.h */ + short customdatafree; + int pad2; + void *customdata; /* ascii, unicode, mouse coords, angles, vectors, dragdrop info */ + +} wmEvent; + +typedef enum wmRadialControlMode { + WM_RADIALCONTROL_SIZE, + WM_RADIALCONTROL_STRENGTH, + WM_RADIALCONTROL_ANGLE +} wmRadialControlMode; + +#endif /* DNA_WINDOWMANAGER_TYPES_H */ + diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h index ab7e25190ad..64ff23dd1a8 100644 --- a/source/blender/makesdna/DNA_world_types.h +++ b/source/blender/makesdna/DNA_world_types.h @@ -32,8 +32,8 @@ #define DNA_WORLD_TYPES_H #include "DNA_ID.h" -#include "DNA_scriptlink_types.h" +struct AnimData; struct Ipo; struct MTex; @@ -48,6 +48,7 @@ struct MTex; * data and modeling data. */ typedef struct World { ID id; + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ short colormodel, totex; short texact, mistype; @@ -70,12 +71,12 @@ typedef struct World { /** * Gravitation constant for the game world */ - float gravity; + float gravity; // XXX moved to scene->gamedata in 2.5 /** * Radius of the activity bubble, in Manhattan length. Objects * outside the box are activity-culled. */ - float activityBoxRadius; + float activityBoxRadius; // XXX moved to scene->gamedata in 2.5 short skytype; /** @@ -84,9 +85,13 @@ typedef struct World { * bit 1: Do stars * bit 2: (reserved) depth of field * bit 3: (gameengine): Activity culling is enabled. + * bit 4: ambient occlusion + * bit 5: (gameengine) : enable Bullet DBVT tree for view frustrum culling */ - short mode; - int physicsEngine; /* here it's aligned */ + short mode; // partially moved to scene->gamedata in 2.5 + short occlusionRes; /* resolution of occlusion Z buffer in pixel */ // XXX moved to scene->gamedata in 2.5 + short physicsEngine; /* here it's aligned */ // XXX moved to scene->gamedata in 2.5 + short ticrate, maxlogicstep, physubstep, maxphystep; // XXX moved to scene->gamedata in 2.5 float misi, miststa, mistdist, misthi; @@ -102,19 +107,22 @@ typedef struct World { short aomode, aosamp, aomix, aocolor; float ao_adapt_thresh, ao_adapt_speed_fac; float ao_approx_error, ao_approx_correction; - short ao_samp_method, ao_gather_method, ao_approx_passes, pad1; + short ao_samp_method, ao_gather_method, ao_approx_passes; + /* assorted settings (in the middle of ambient occlusion settings for padding reasons) */ + short flag; + + /* ambient occlusion (contd...) */ float *aosphere, *aotables; - struct Ipo *ipo; + struct Ipo *ipo; // XXX depreceated... old animation system struct MTex *mtex[18]; /* MAX_MTEX */ + short pr_texture, pad[3]; /* previews */ struct PreviewImage *preview; - ScriptLink scriptlink; - } World; /* **************** WORLD ********************* */ @@ -133,6 +141,7 @@ typedef struct World { #define WO_DOF 4 #define WO_ACTIVITY_CULLING 8 #define WO_AMB_OCC 16 +#define WO_DBVT_CULLING 32 /* aomix */ #define WO_AOADD 0 @@ -170,13 +179,8 @@ typedef struct World { #define WOMAP_ZENDOWN 8 #define WOMAP_MIST 16 -/* physicsEngine */ -#define WOPHY_NONE 0 -#define WOPHY_ENJI 1 -#define WOPHY_SUMO 2 -#define WOPHY_DYNAMO 3 -#define WOPHY_ODE 4 -#define WOPHY_BULLET 5 +/* flag */ +#define WO_DS_EXPAND (1<<0) #endif diff --git a/source/blender/makesdna/SConscript b/source/blender/makesdna/SConscript index d67be4955c4..c3d39783b00 100644 --- a/source/blender/makesdna/SConscript +++ b/source/blender/makesdna/SConscript @@ -4,8 +4,8 @@ Import ('env') objs = [] o = SConscript('intern/SConscript') -objs.append (o) +objs += o -incs = '#/intern/guardedalloc' +incs = '#/intern/guardedalloc .' -env.BlenderLib ( 'bf_dna', objs, Split(incs), [], libtype=['common','player'], priority = [10, 215] ) +env.BlenderLib ( 'bf_dna', objs, Split(incs), [], libtype=['core','player'], priority = [215,200] ) diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt index a85f561da92..1fb63156f26 100644 --- a/source/blender/makesdna/intern/CMakeLists.txt +++ b/source/blender/makesdna/intern/CMakeLists.txt @@ -24,11 +24,22 @@ # # ***** END GPL LICENSE BLOCK ***** -SET(SRC makesdna.c ../../../../intern/guardedalloc/intern/mallocn.c ../../../../intern/guardedalloc/intern/mmap_win.c) - INCLUDE_DIRECTORIES(../../../../intern/guardedalloc ..) - FILE(GLOB INC_FILES ../*.h) + +# Build makesdna executable +SET(SRC makesdna.c ../../../../intern/guardedalloc/intern/mallocn.c ../../../../intern/guardedalloc/intern/mmap_win.c) ADD_EXECUTABLE(makesdna ${SRC} ${INC_FILES}) +# Output dna.c +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dna.c + COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna ${CMAKE_CURRENT_BINARY_DIR}/dna.c ${CMAKE_SOURCE_DIR}/source/blender/makesdna/ + DEPENDS makesdna +) + +# Build bf_dna library +SET(SRC dna_genfile.c dna.c) +BLENDERLIB(bf_dna "${SRC}" "${INC}") + MESSAGE(STATUS "Configuring makesdna") diff --git a/source/blender/makesdna/intern/Makefile b/source/blender/makesdna/intern/Makefile index 1dc82a542c7..857e53d2573 100644 --- a/source/blender/makesdna/intern/Makefile +++ b/source/blender/makesdna/intern/Makefile @@ -28,10 +28,9 @@ # # +LIBNAME = dna DIR = $(OCGDIR)/blender/makesdna -CSRCS = $(wildcard *.c) - -ALLTARGETS = $(OBJS) $(DIR)/$(DEBUG_DIR)makesdna $(DIR)/$(SHARED_DIR)$(DEBUG_DIR)DNA.o +CSRCS = DNA.c $(wildcard dna_*.c) include nan_compile.mk @@ -66,9 +65,10 @@ clean:: # A small note: we do not use the debug version of the alloc lib. That # is done quite intentionally. If there is a bug in that lib, it needs # to be fixed by the module maintainer. -$(DIR)/$(DEBUG_DIR)makesdna: $(OBJS) $(OCGDIR)/blender/blenlib/$(DEBUG_DIR)libblenlib.a - $(CC) $(LDFLAGS) -o $@ $(OBJS) \ - $(NAN_GUARDEDALLOC)/lib/libguardedalloc.a $(WINLIBS) +DNAOBJS = $(filter-out %DNA.o, $(OBJS)) + +$(DIR)/$(DEBUG_DIR)makesdna: $(DNAOBJS) $(DIR)/$(DEBUG_DIR)makesdna.o $(NAN_GUARDEDALLOC)/lib/libguardedalloc.a + $(CC) $(LDFLAGS) -o $@ $^ $(DIR)/$(DEBUG_DIR)DNA.c: $(DIR)/$(DEBUG_DIR)makesdna ifeq ($(OS),windows) @@ -78,6 +78,6 @@ $(DIR)/$(DEBUG_DIR)DNA.c: $(DIR)/$(DEBUG_DIR)makesdna $(DIR)/$(DEBUG_DIR)makesdna $(DIR)/$(DEBUG_DIR)DNA.c endif -$(DIR)/$(SHARED_DIR)$(DEBUG_DIR)DNA.o: $(DIR)/$(DEBUG_DIR)DNA.c - $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ +$(DIR)/$(DEBUG_DIR)makesdna.o: makesdna.c $(wildcard ../*.h) + $(CC) -c $(CFLAGS) $(CPPFLAGS) makesdna.c -o $@ diff --git a/source/blender/makesdna/intern/SConscript b/source/blender/makesdna/intern/SConscript index aaf5ecc910b..120398791a8 100644 --- a/source/blender/makesdna/intern/SConscript +++ b/source/blender/makesdna/intern/SConscript @@ -2,10 +2,13 @@ import sys import os +def normpath(path): + return os.path.abspath(os.path.normpath(path)) + Import ('env') cflags = '' defines = [] -root_build_dir=env['BF_BUILDDIR'] +root_build_dir=normpath(env['BF_BUILDDIR']) source_files = ['makesdna.c'] header_files = env.Glob('../*.h') @@ -15,31 +18,52 @@ dna = env.Clone() makesdna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesdna/\\"" ') makesdna_tool.Append (CPPPATH = ['#/intern/guardedalloc', - '../../makesdna']) + '../../makesdna']) if env['OURPLATFORM'] == 'linuxcross': - makesdna_tool.Replace(CC='gcc') - makesdna_tool.Replace(AR='ar') - makesdna_tool.Replace(LINK='gcc') + USE_WINE = True # when cross compiling on linux 64bit this is useful +else: + USE_WINE = False + +if not USE_WINE: + if env['OURPLATFORM'] == 'linuxcross': + makesdna_tool.Replace(CC='gcc') + makesdna_tool.Replace(AR='ar') + makesdna_tool.Replace(LINK='gcc') if sys.platform != 'cygwin': - makesdna_tool.Append (CCFLAGS = cflags) + makesdna_tool.Append (CCFLAGS = cflags) makesdna_tool.Append (CPPDEFINES = defines) -makesdna_tool.Append (LIBPATH = '#'+root_build_dir+'/lib') +makesdna_tool.Append( CFLAGS = env['CFLAGS']) +makesdna_tool.Append( CCFLAGS = env['CCFLAGS']) +makesdna_tool.Append( LINKFLAGS = env['PLATFORM_LINKFLAGS']) +targetdir = normpath(root_build_dir+'/lib') + +if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'): + targetdir = '#'+targetdir +makesdna_tool.Append (LIBPATH = targetdir) if env['BF_PROFILE']: - makesdna_tool.Append (LINKFLAGS = env['BF_PROFILE_FLAGS']) + makesdna_tool.Append (LINKFLAGS = env['BF_PROFILE_LINKFLAGS']) -if env['OURPLATFORM'] == 'linux2' and root_build_dir[0]==os.sep: - makesdna = makesdna_tool.Program (target = root_build_dir+'/makesdna', source = source_files, LIBS=['bf_guardedalloc']) -else: - makesdna = makesdna_tool.Program (target = '#'+root_build_dir+'/makesdna', source = source_files, LIBS=['bf_guardedalloc']) +targetdir = normpath(root_build_dir + '/makesdna') + +if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'): + targetdir = '#' + targetdir + +makesdna = makesdna_tool.Program (target = targetdir, source = source_files, LIBS=['bf_guardedalloc']) dna_dict = dna.Dictionary() dna.Depends ('dna.c', makesdna) dna.Depends ('dna.c', header_files) if env['OURPLATFORM'] != 'linuxcross': - dna.Command ('dna.c', '', root_build_dir+os.sep+"makesdna $TARGET") + if USE_WINE: + dna.Command ('dna.c', '', 'wine ' + root_build_dir+os.sep+"makesdna $TARGET") + else: + if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'): + dna.Command ('dna.c', '', "\"" + root_build_dir+os.sep+"makesdna\" $TARGET") + else: + dna.Command ('dna.c', '', root_build_dir+os.sep+"makesdna $TARGET") else: - dna.Command ('dna.c', '', root_build_dir+os.sep+"makesdna.exe $TARGET") -obj = 'intern/dna.c' + dna.Command ('dna.c', '', root_build_dir+os.sep+"makesdna.exe $TARGET") +obj = ['intern/dna.c', 'intern/dna_genfile.c'] Return ('obj') diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c new file mode 100644 index 00000000000..628983ae879 --- /dev/null +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -0,0 +1,1087 @@ +/* dna_genfile.c + * + * Functions for struct-dna, the genetic file dot c! + * + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. + * + * 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. + * + * ***** END GPL LICENSE BLOCK ***** + * DNA handling + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "MEM_guardedalloc.h" // for MEM_freeN MEM_mallocN MEM_callocN + +#include "DNA_genfile.h" +#include "DNA_sdna_types.h" // for SDNA ;-) + + +/* gcc 4.1 on mingw was complaining that __int64 was alredy defined +actually is saw the line below as typedef long long long long... +Anyhow, since its alredy defined, its safe to do an ifndef here- Cambpell*/ +#ifdef FREE_WINDOWS +#ifndef __int64 +typedef long long __int64; +#endif +#endif + +/* + * - please note: no builtin security to detect input of double structs + * - if you want a struct not to be in DNA file: add two hash marks above it (#<enter>#<enter>) + +Structure DNA data is added to each blender file and to each executable, this to detect +in .blend files new veriables in structs, changed array sizes, etc. It's also used for +converting endian and pointer size (32-64 bits) +As an extra, Python uses a call to detect run-time the contents of a blender struct. + +Create a structDNA: only needed when one of the input include (.h) files change. +File Syntax: + SDNA (4 bytes) (magic number) + NAME (4 bytes) + <nr> (4 bytes) amount of names (int) + <string> + <string> + ... + ... + TYPE (4 bytes) + <nr> amount of types (int) + <string> + <string> + ... + ... + TLEN (4 bytes) + <len> (short) the lengths of types + <len> + ... + ... + STRC (4 bytes) + <nr> amount of structs (int) + <typenr><nr_of_elems> <typenr><namenr> <typenr><namenr> ... + +!!Remember to read/write integer and short aligned!! + + While writing a file, the names of a struct is indicated with a type number, + to be found with: type= findstruct_nr(SDNA *, char *) + The value of 'type' corresponds with the the index within the structs array + + For the moment: the complete DNA file is included in a .blend file. For + the future we can think of smarter methods, like only included the used + structs. Only needed to keep a file short though... + +ALLOWED AND TESTED CHANGES IN STRUCTS: + - type change (a char to float will be divided by 255) + - location within a struct (everthing can be randomly mixed up) + - struct within struct (within struct etc), this is recursive + - adding new elements, will be default initialized zero + - remving elements + - change of array sizes + - change of a pointer type: when the name doesn't change the contents is copied + +NOT YET: + - array (vec[3]) to float struct (vec3f) + +DONE: + - endian compatibility + - pointer conversion (32-64 bits) + +IMPORTANT: + - do not use #defines in structs for array lenghts, this cannot be read by the dna functions + - do not use uint, but unsigned int instead, ushort and ulong are allowed + - only use a long in Blender if you want this to be the size of a pointer. so it is + 32 bits or 64 bits, dependant at the cpu architecture + - chars are always unsigned + - aligment of variables has to be done in such a way, that any system does + not create 'padding' (gaps) in structures. So make sure that: + - short: 2 aligned + - int: 4 aligned + - float: 4 aligned + - double: 8 aligned + - long: 8 aligned + - struct: 8 aligned + - the sdna functions have several error prints builtin, always check blender running from a console. + +*/ + +/* local */ +static int le_int(int temp); +static short le_short(short temp); + +/* ************************* ENDIAN STUFF ********************** */ + +static short le_short(short temp) +{ + short new; + char *rt=(char *)&temp, *rtn=(char *)&new; + + rtn[0]= rt[1]; + rtn[1]= rt[0]; + + return new; +} + + +static int le_int(int temp) +{ + int new; + char *rt=(char *)&temp, *rtn=(char *)&new; + + rtn[0]= rt[3]; + rtn[1]= rt[2]; + rtn[2]= rt[1]; + rtn[3]= rt[0]; + + return new; +} + + +/* ************************* MAKE DNA ********************** */ + +/* allowed duplicate code from makesdna.c */ +int DNA_elem_array_size(const char *astr, int len) +{ + int a, mul=1; + char str[100], *cp=0; + + memcpy(str, astr, len+1); + + for(a=0; a<len; a++) { + if( str[a]== '[' ) { + cp= &(str[a+1]); + } + else if( str[a]==']' && cp) { + str[a]= 0; + mul*= atoi(cp); + } + } + + return mul; +} + +/* ************************* END MAKE DNA ********************** */ + +/* ************************* DIV ********************** */ + +void DNA_sdna_free(SDNA *sdna) +{ + MEM_freeN(sdna->data); + MEM_freeN(sdna->names); + MEM_freeN(sdna->types); + MEM_freeN(sdna->structs); + + MEM_freeN(sdna); +} + +static int ispointer(char *name) +{ + /* check if pointer or function pointer */ + return (name[0]=='*' || (name[0]=='(' && name[1]=='*')); +} + +static int elementsize(SDNA *sdna, short type, short name) +/* call with numbers from struct-array */ +{ + int mul, namelen, len; + char *cp; + + cp= sdna->names[name]; + len= 0; + + namelen= strlen(cp); + /* is it a pointer or function pointer? */ + if(ispointer(cp)) { + /* has the naam an extra length? (array) */ + mul= 1; + if( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen); + + len= sdna->pointerlen*mul; + } + else if( sdna->typelens[type] ) { + /* has the naam an extra length? (array) */ + mul= 1; + if( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen); + + len= mul*sdna->typelens[type]; + + } + + return len; +} + +#if 0 +static void printstruct(SDNA *sdna, short strnr) +{ + /* is for debug */ + int b, nr; + short *sp; + + sp= sdna->structs[strnr]; + + printf("struct %s\n", sdna->types[ sp[0] ]); + nr= sp[1]; + sp+= 2; + + for(b=0; b< nr; b++, sp+= 2) { + printf(" %s %s\n", sdna->types[sp[0]], sdna->names[sp[1]]); + } +} +#endif + +static short *findstruct_name(SDNA *sdna, char *str) +{ + int a; + short *sp=0; + + + for(a=0; a<sdna->nr_structs; a++) { + + sp= sdna->structs[a]; + + if(strcmp( sdna->types[ sp[0] ], str )==0) return sp; + } + + return 0; +} + +int DNA_struct_find_nr(SDNA *sdna, const char *str) +{ + short *sp=0; + int a; + + if(sdna->lastfind<sdna->nr_structs) { + sp= sdna->structs[sdna->lastfind]; + if(strcmp( sdna->types[ sp[0] ], str )==0) return sdna->lastfind; + } + + for(a=0; a<sdna->nr_structs; a++) { + + sp= sdna->structs[a]; + + if(strcmp( sdna->types[ sp[0] ], str )==0) { + sdna->lastfind= a; + return a; + } + } + + return -1; +} + +/* ************************* END DIV ********************** */ + +/* ************************* READ DNA ********************** */ + +static void init_structDNA(SDNA *sdna, int do_endian_swap) +/* in sdna->data the data, now we convert that to something understandable */ +{ + int *data, *verg; + intptr_t nr; + short *sp; + char str[8], *cp; + + verg= (int *)str; + data= (int *)sdna->data; + + strcpy(str, "SDNA"); + if( *data == *verg ) { + + data++; + + /* load names array */ + strcpy(str, "NAME"); + if( *data == *verg ) { + data++; + + if(do_endian_swap) sdna->nr_names= le_int(*data); + else sdna->nr_names= *data; + + data++; + sdna->names= MEM_callocN( sizeof(void *)*sdna->nr_names, "sdnanames"); + } + else { + printf("NAME error in SDNA file\n"); + return; + } + + nr= 0; + cp= (char *)data; + while(nr<sdna->nr_names) { + sdna->names[nr]= cp; + while( *cp) cp++; + cp++; + nr++; + } + nr= (intptr_t)cp; /* prevent BUS error */ + nr= (nr+3) & ~3; + cp= (char *)nr; + + /* load type names array */ + data= (int *)cp; + strcpy(str, "TYPE"); + if( *data == *verg ) { + data++; + + if(do_endian_swap) sdna->nr_types= le_int(*data); + else sdna->nr_types= *data; + + data++; + sdna->types= MEM_callocN( sizeof(void *)*sdna->nr_types, "sdnatypes"); + } + else { + printf("TYPE error in SDNA file\n"); + return; + } + + nr= 0; + cp= (char *)data; + while(nr<sdna->nr_types) { + sdna->types[nr]= cp; + + /* this is a patch, to change struct names without a confict with SDNA */ + /* be careful to use it, in this case for a system-struct (opengl/X) */ + + if( *cp == 'b') { + /* struct Screen was already used by X, 'bScreen' replaces the old IrisGL 'Screen' struct */ + if( strcmp("bScreen", cp)==0 ) sdna->types[nr]= cp+1; + } + + while( *cp) cp++; + cp++; + nr++; + } + nr= (intptr_t)cp; /* prevent BUS error */ + nr= (nr+3) & ~3; + cp= (char *)nr; + + /* load typelen array */ + data= (int *)cp; + strcpy(str, "TLEN"); + if( *data == *verg ) { + data++; + sp= (short *)data; + sdna->typelens= sp; + + if(do_endian_swap) { + short a, *spo= sp; + + a= sdna->nr_types; + while(a--) { + spo[0]= le_short(spo[0]); + spo++; + } + } + + sp+= sdna->nr_types; + } + else { + printf("TLEN error in SDNA file\n"); + return; + } + if(sdna->nr_types & 1) sp++; /* prevent BUS error */ + + /* load struct array */ + data= (int *)sp; + strcpy(str, "STRC"); + if( *data == *verg ) { + data++; + + if(do_endian_swap) sdna->nr_structs= le_int(*data); + else sdna->nr_structs= *data; + + data++; + sdna->structs= MEM_callocN( sizeof(void *)*sdna->nr_structs, "sdnastrcs"); + } + else { + printf("STRC error in SDNA file\n"); + return; + } + + nr= 0; + sp= (short *)data; + while(nr<sdna->nr_structs) { + sdna->structs[nr]= sp; + + if(do_endian_swap) { + short a; + + sp[0]= le_short(sp[0]); + sp[1]= le_short(sp[1]); + + a= sp[1]; + sp+= 2; + while(a--) { + sp[0]= le_short(sp[0]); + sp[1]= le_short(sp[1]); + sp+= 2; + } + } + else { + sp+= 2*sp[1]+2; + } + + nr++; + } + + /* finally pointerlen: use struct ListBase to test it, never change the size of it! */ + sp= findstruct_name(sdna, "ListBase"); + /* weird; i have no memory of that... I think I used sizeof(void *) before... (ton) */ + + sdna->pointerlen= sdna->typelens[ sp[0] ]/2; + + if(sp[1]!=2 || (sdna->pointerlen!=4 && sdna->pointerlen!=8)) { + printf("ListBase struct error! Needs it to calculate pointerize.\n"); + exit(0); + /* well, at least sizeof(ListBase) is error proof! (ton) */ + } + + } +} + +SDNA *DNA_sdna_from_data(void *data, int datalen, int do_endian_swap) +{ + SDNA *sdna= MEM_mallocN(sizeof(*sdna), "sdna"); + + sdna->lastfind= 0; + + sdna->datalen= datalen; + sdna->data= MEM_mallocN(datalen, "sdna_data"); + memcpy(sdna->data, data, datalen); + + init_structDNA(sdna, do_endian_swap); + + return sdna; +} + +/* ******************** END READ DNA ********************** */ + +/* ******************* HANDLE DNA ***************** */ + +static void recurs_test_compflags(SDNA *sdna, char *compflags, int structnr) +{ + int a, b, typenr, elems; + short *sp; + char *cp; + + /* check all structs, test if it's inside another struct */ + sp= sdna->structs[structnr]; + typenr= sp[0]; + + for(a=0; a<sdna->nr_structs; a++) { + if(a!=structnr && compflags[a]==1) { + sp= sdna->structs[a]; + elems= sp[1]; + sp+= 2; + for(b=0; b<elems; b++, sp+=2) { + if(sp[0]==typenr) { + cp= sdna->names[ sp[1] ]; + if(!ispointer(cp)) { + compflags[a]= 2; + recurs_test_compflags(sdna, compflags, a); + } + } + } + } + } + +} + + /* Unsure of exact function - compares the sdna argument to + * newsdna and sets up the information necessary to convert + * data written with a dna of oldsdna to inmemory data with a + * structure defined by the newsdna sdna (I think). -zr + */ + +/* well, the function below is just a lookup table to speed + * up reading files. doh! -ton + */ + + +char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna) +{ + /* flag: 0: doesn't exist anymore (or not yet) + * 1: is equal + * 2: is different + */ + int a, b; + short *spold, *spcur; + char *str1, *str2; + char *compflags; + + if(sdna->nr_structs==0) { + printf("error: file without SDNA\n"); + return NULL; + } + + compflags= MEM_callocN(sdna->nr_structs, "compflags"); + + /* we check all structs in 'sdna' and compare them with + * the structs in 'newsdna' + */ + + for(a=0; a<sdna->nr_structs; a++) { + spold= sdna->structs[a]; + + /* search for type in cur */ + spcur= findstruct_name(newsdna, sdna->types[spold[0]]); + + if(spcur) { + compflags[a]= 2; + + /* compare length and amount of elems */ + if( spcur[1] == spold[1]) { + if( newsdna->typelens[spcur[0]] == sdna->typelens[spold[0]] ) { + + /* same length, same amount of elems, now per type and name */ + b= spold[1]; + spold+= 2; + spcur+= 2; + while(b > 0) { + str1= newsdna->types[spcur[0]]; + str2= sdna->types[spold[0]]; + if(strcmp(str1, str2)!=0) break; + + str1= newsdna->names[spcur[1]]; + str2= sdna->names[spold[1]]; + if(strcmp(str1, str2)!=0) break; + + /* same type and same name, now pointersize */ + if(ispointer(str1)) { + if(sdna->pointerlen!=newsdna->pointerlen) break; + } + + b--; + spold+= 2; + spcur+= 2; + } + if(b==0) compflags[a]= 1; + + } + } + + } + } + + /* first struct in util.h is struct Link, this is skipped in compflags (als # 0). + * was a bug, and this way dirty patched! Solve this later.... + */ + compflags[0]= 1; + + /* Because structs can be inside structs, we recursively + * set flags when a struct is altered + */ + for(a=0; a<sdna->nr_structs; a++) { + if(compflags[a]==2) recurs_test_compflags(sdna, compflags, a); + } + +/* + for(a=0; a<sdna->nr_structs; a++) { + if(compflags[a]==2) { + spold= sdna->structs[a]; + printf("changed: %s\n", sdna->types[ spold[0] ]); + } + } +*/ + + return compflags; +} + +static void cast_elem(char *ctype, char *otype, char *name, char *curdata, char *olddata) +{ + double val = 0.0; + int arrlen, curlen=1, oldlen=1, ctypenr, otypenr; + + arrlen= DNA_elem_array_size(name, strlen(name)); + + /* define otypenr */ + if(strcmp(otype, "char")==0 || (strcmp(otype, "const char")==0)) otypenr= 0; + else if((strcmp(otype, "uchar")==0) || (strcmp(otype, "unsigned char")==0)) otypenr= 1; + else if(strcmp(otype, "short")==0) otypenr= 2; + else if((strcmp(otype, "ushort")==0)||(strcmp(otype, "unsigned short")==0)) otypenr= 3; + else if(strcmp(otype, "int")==0) otypenr= 4; + else if(strcmp(otype, "long")==0) otypenr= 5; + else if((strcmp(otype, "ulong")==0)||(strcmp(otype, "unsigned long")==0)) otypenr= 6; + else if(strcmp(otype, "float")==0) otypenr= 7; + else if(strcmp(otype, "double")==0) otypenr= 8; + else return; + + /* define ctypenr */ + if(strcmp(ctype, "char")==0) ctypenr= 0; + else if(strcmp(ctype, "const char")==0) ctypenr= 0; + else if((strcmp(ctype, "uchar")==0)||(strcmp(ctype, "unsigned char")==0)) ctypenr= 1; + else if(strcmp(ctype, "short")==0) ctypenr= 2; + else if((strcmp(ctype, "ushort")==0)||(strcmp(ctype, "unsigned short")==0)) ctypenr= 3; + else if(strcmp(ctype, "int")==0) ctypenr= 4; + else if(strcmp(ctype, "long")==0) ctypenr= 5; + else if((strcmp(ctype, "ulong")==0)||(strcmp(ctype, "unsigned long")==0)) ctypenr= 6; + else if(strcmp(ctype, "float")==0) ctypenr= 7; + else if(strcmp(ctype, "double")==0) ctypenr= 8; + else return; + + /* define lengths */ + if(otypenr < 2) oldlen= 1; + else if(otypenr < 4) oldlen= 2; + else if(otypenr < 8) oldlen= 4; + else oldlen= 8; + + if(ctypenr < 2) curlen= 1; + else if(ctypenr < 4) curlen= 2; + else if(ctypenr < 8) curlen= 4; + else curlen= 8; + + while(arrlen>0) { + switch(otypenr) { + case 0: + val= *olddata; break; + case 1: + val= *( (unsigned char *)olddata); break; + case 2: + val= *( (short *)olddata); break; + case 3: + val= *( (unsigned short *)olddata); break; + case 4: + val= *( (int *)olddata); break; + case 5: + val= *( (int *)olddata); break; + case 6: + val= *( (unsigned int *)olddata); break; + case 7: + val= *( (float *)olddata); break; + case 8: + val= *( (double *)olddata); break; + } + + switch(ctypenr) { + case 0: + *curdata= val; break; + case 1: + *( (unsigned char *)curdata)= val; break; + case 2: + *( (short *)curdata)= val; break; + case 3: + *( (unsigned short *)curdata)= val; break; + case 4: + *( (int *)curdata)= val; break; + case 5: + *( (int *)curdata)= val; break; + case 6: + *( (unsigned int *)curdata)= val; break; + case 7: + if(otypenr<2) val/= 255; + *( (float *)curdata)= val; break; + case 8: + if(otypenr<2) val/= 255; + *( (double *)curdata)= val; break; + } + + olddata+= oldlen; + curdata+= curlen; + arrlen--; + } +} + +static void cast_pointer(int curlen, int oldlen, char *name, char *curdata, char *olddata) +{ +#ifdef WIN32 + __int64 lval; +#else + long long lval; +#endif + int arrlen; + + arrlen= DNA_elem_array_size(name, strlen(name)); + + while(arrlen>0) { + + if(curlen==oldlen) { + memcpy(curdata, olddata, curlen); + } + else if(curlen==4 && oldlen==8) { +#ifdef WIN32 + lval= *( (__int64 *)olddata ); +#else + lval= *( (long long *)olddata ); +#endif + *((int *)curdata) = lval>>3; /* is of course gambling! */ + } + else if(curlen==8 && oldlen==4) { +#ifdef WIN32 + *( (__int64 *)curdata ) = *((int *)olddata); +#else + *( (long long *)curdata ) = *((int *)olddata); +#endif + } + else { + /* for debug */ + printf("errpr: illegal pointersize! \n"); + } + + olddata+= oldlen; + curdata+= curlen; + arrlen--; + + } +} + +static int elem_strcmp(char *name, char *oname) +{ + int a=0; + + /* strcmp without array part */ + + while(1) { + if(name[a] != oname[a]) return 1; + if(name[a]=='[') break; + if(name[a]==0) break; + a++; + } + if(name[a] != oname[a]) return 1; + return 0; +} + +static char *find_elem(SDNA *sdna, char *type, char *name, short *old, char *olddata, short **sppo) +{ + int a, elemcount, len; + char *otype, *oname; + + /* without arraypart, so names can differ: return old namenr and type */ + + /* in old is the old struct */ + elemcount= old[1]; + old+= 2; + for(a=0; a<elemcount; a++, old+=2) { + + otype= sdna->types[old[0]]; + oname= sdna->names[old[1]]; + + len= elementsize(sdna, old[0], old[1]); + + if( elem_strcmp(name, oname)==0 ) { /* naam equal */ + if( strcmp(type, otype)==0 ) { /* type equal */ + if(sppo) *sppo= old; + return olddata; + } + + return 0; + } + + olddata+= len; + } + return 0; +} + +static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, char *type, char *name, char *curdata, short *old, char *olddata) +{ + /* rules: test for NAME: + - name equal: + - cast type + - name partially equal (array differs) + - type equal: memcpy + - types casten + (nzc 2-4-2001 I want the 'unsigned' bit to be parsed as well. Where + can I force this?) + */ + int a, elemcount, len, array, oldsize, cursize, mul; + char *otype, *oname, *cp; + + /* is 'name' an array? */ + cp= name; + array= 0; + while( *cp && *cp!='[') { + cp++; array++; + } + if( *cp!= '[' ) array= 0; + + /* in old is the old struct */ + elemcount= old[1]; + old+= 2; + for(a=0; a<elemcount; a++, old+=2) { + otype= oldsdna->types[old[0]]; + oname= oldsdna->names[old[1]]; + len= elementsize(oldsdna, old[0], old[1]); + + if( strcmp(name, oname)==0 ) { /* name equal */ + + if(ispointer(name)) { /* pointer of functionpointer afhandelen */ + cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, name, curdata, olddata); + } + else if( strcmp(type, otype)==0 ) { /* type equal */ + memcpy(curdata, olddata, len); + } + else cast_elem(type, otype, name, curdata, olddata); + + return; + } + else if(array) { /* name is an array */ + + if(oname[array]=='[' && strncmp(name, oname, array)==0 ) { /* basis equal */ + + cursize= DNA_elem_array_size(name, strlen(name)); + oldsize= DNA_elem_array_size(oname, strlen(oname)); + + if(ispointer(name)) { /* handle pointer or functionpointer */ + if(cursize>oldsize) cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, oname, curdata, olddata); + else cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, name, curdata, olddata); + } + else if(name[0]=='*' || strcmp(type, otype)==0 ) { /* type equal */ + mul= len/oldsize; + mul*= (cursize < oldsize)? cursize: oldsize; + memcpy(curdata, olddata, mul); + } + else { + if(cursize>oldsize) cast_elem(type, otype, oname, curdata, olddata); + else cast_elem(type, otype, name, curdata, olddata); + } + return; + } + } + olddata+= len; + } +} + +static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna, char *compflags, int oldSDNAnr, char *data, int curSDNAnr, char *cur) +{ + /* Recursive! + * Per element from cur_struct, read data from old_struct. + * If element is a struct, call recursive. + */ + int a, elemcount, elen, eleno, mul, mulo, firststructtypenr; + short *spo, *spc, *sppo; + char *name, *nameo, *type, *cpo, *cpc; + + if(oldSDNAnr== -1) return; + if(curSDNAnr== -1) return; + + if( compflags[oldSDNAnr]==1 ) { /* if recursive: test for equal */ + + spo= oldsdna->structs[oldSDNAnr]; + elen= oldsdna->typelens[ spo[0] ]; + memcpy( cur, data, elen); + + return; + } + + firststructtypenr= *(newsdna->structs[0]); + + spo= oldsdna->structs[oldSDNAnr]; + spc= newsdna->structs[curSDNAnr]; + + elemcount= spc[1]; + + spc+= 2; + cpc= cur; + for(a=0; a<elemcount; a++, spc+=2) { + type= newsdna->types[spc[0]]; + name= newsdna->names[spc[1]]; + + elen= elementsize(newsdna, spc[0], spc[1]); + + /* test: is type a struct? */ + if(spc[0]>=firststructtypenr && !ispointer(name)) { + + /* where does the old struct data start (and is there an old one?) */ + cpo= find_elem(oldsdna, type, name, spo, data, &sppo); + + if(cpo) { + oldSDNAnr= DNA_struct_find_nr(oldsdna, type); + curSDNAnr= DNA_struct_find_nr(newsdna, type); + + /* array! */ + mul= DNA_elem_array_size(name, strlen(name)); + nameo= oldsdna->names[sppo[1]]; + mulo= DNA_elem_array_size(nameo, strlen(nameo)); + + eleno= elementsize(oldsdna, sppo[0], sppo[1]); + + elen/= mul; + eleno/= mulo; + + while(mul--) { + reconstruct_struct(newsdna, oldsdna, compflags, oldSDNAnr, cpo, curSDNAnr, cpc); + cpo+= eleno; + cpc+= elen; + + /* new struct array larger than old */ + mulo--; + if(mulo<=0) break; + } + } + else cpc+= elen; + } + else { + + reconstruct_elem(newsdna, oldsdna, type, name, cpc, spo, data); + cpc+= elen; + + } + } +} + +void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) +{ + /* Recursive! + * If element is a struct, call recursive. + */ + int a, mul, elemcount, elen, elena, firststructtypenr; + short *spo, *spc, skip; + char *name, *type, *cpo, *cur, cval; + + if(oldSDNAnr== -1) return; + firststructtypenr= *(oldsdna->structs[0]); + + spo= spc= oldsdna->structs[oldSDNAnr]; + + elemcount= spo[1]; + + spc+= 2; + cur= data; + + for(a=0; a<elemcount; a++, spc+=2) { + type= oldsdna->types[spc[0]]; + name= oldsdna->names[spc[1]]; + + /* elementsize = including arraysize */ + elen= elementsize(oldsdna, spc[0], spc[1]); + + /* test: is type a struct? */ + if(spc[0]>=firststructtypenr && !ispointer(name)) { + /* where does the old data start (is there one?) */ + cpo= find_elem(oldsdna, type, name, spo, data, 0); + if(cpo) { + oldSDNAnr= DNA_struct_find_nr(oldsdna, type); + + mul= DNA_elem_array_size(name, strlen(name)); + elena= elen/mul; + + while(mul--) { + DNA_struct_switch_endian(oldsdna, oldSDNAnr, cpo); + cpo += elena; + } + } + } + else { + + if(ispointer(name)) { + if(oldsdna->pointerlen==8) { + + mul= DNA_elem_array_size(name, strlen(name)); + cpo= cur; + while(mul--) { + cval= cpo[0]; cpo[0]= cpo[7]; cpo[7]= cval; + cval= cpo[1]; cpo[1]= cpo[6]; cpo[6]= cval; + cval= cpo[2]; cpo[2]= cpo[5]; cpo[5]= cval; + cval= cpo[3]; cpo[3]= cpo[4]; cpo[4]= cval; + + cpo+= 8; + } + + } + } + else { + + if( spc[0]==2 || spc[0]==3 ) { /* short-ushort */ + + /* exception: variable called blocktype/ipowin: derived from ID_ */ + skip= 0; + if(name[0]=='b' && name[1]=='l') { + if(strcmp(name, "blocktype")==0) skip= 1; + } + else if(name[0]=='i' && name[1]=='p') { + if(strcmp(name, "ipowin")==0) skip= 1; + } + + if(skip==0) { + mul= DNA_elem_array_size(name, strlen(name)); + cpo= cur; + while(mul--) { + cval= cpo[0]; + cpo[0]= cpo[1]; + cpo[1]= cval; + cpo+= 2; + } + } + } + else if(spc[0]>3 && spc[0]<8) { /* int-long-ulong-float */ + + mul= DNA_elem_array_size(name, strlen(name)); + cpo= cur; + while(mul--) { + cval= cpo[0]; + cpo[0]= cpo[3]; + cpo[3]= cval; + cval= cpo[1]; + cpo[1]= cpo[2]; + cpo[2]= cval; + cpo+= 4; + } + } + } + } + cur+= elen; + } +} + +void *DNA_struct_reconstruct(SDNA *newsdna, SDNA *oldsdna, char *compflags, int oldSDNAnr, int blocks, void *data) +{ + int a, curSDNAnr, curlen=0, oldlen; + short *spo, *spc; + char *cur, *type, *cpc, *cpo; + + /* oldSDNAnr == structnr, we're looking for the corresponding 'cur' number */ + spo= oldsdna->structs[oldSDNAnr]; + type= oldsdna->types[ spo[0] ]; + oldlen= oldsdna->typelens[ spo[0] ]; + curSDNAnr= DNA_struct_find_nr(newsdna, type); + + /* init data and alloc */ + if(curSDNAnr >= 0) { + spc= newsdna->structs[curSDNAnr]; + curlen= newsdna->typelens[ spc[0] ]; + } + if(curlen==0) { + return NULL; + } + + cur= MEM_callocN( blocks*curlen, "reconstruct"); + cpc= cur; + cpo= data; + for(a=0; a<blocks; a++) { + reconstruct_struct(newsdna, oldsdna, compflags, oldSDNAnr, cpo, curSDNAnr, cpc); + cpc+= curlen; + cpo+= oldlen; + } + + return cur; +} + +int DNA_elem_offset(SDNA *sdna, char *stype, char *vartype, char *name) +{ + + int SDNAnr= DNA_struct_find_nr(sdna, stype); + short *spo= sdna->structs[SDNAnr]; + char *cp= find_elem(sdna, vartype, name, spo, NULL, NULL); + return (int)((intptr_t)cp); +} + diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index beb680ec8b9..cae28f163ed 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -76,7 +76,6 @@ char *includefiles[] = { "DNA_ID.h", "DNA_ipo_types.h", "DNA_key_types.h", - "DNA_scriptlink_types.h", "DNA_text_types.h", "DNA_packedFile_types.h", "DNA_camera_types.h", @@ -98,7 +97,6 @@ char *includefiles[] = { "DNA_object_force.h", "DNA_object_fluidsim.h", "DNA_world_types.h", - "DNA_radio_types.h", "DNA_scene_types.h", "DNA_view3d_types.h", "DNA_view2d_types.h", @@ -111,7 +109,7 @@ char *includefiles[] = { "DNA_fileglobal_types.h", "DNA_sequence_types.h", "DNA_effect_types.h", - "DNA_oops_types.h", + "DNA_outliner_types.h", "DNA_property_types.h", "DNA_sensor_types.h", "DNA_controller_types.h", @@ -129,9 +127,12 @@ char *includefiles[] = { "DNA_particle_types.h", "DNA_cloth_types.h", "DNA_gpencil_types.h", - "DNA_freestyle_types.h", // if you add files here, please add them at the end // of makesdna.c (this file) as well + "DNA_windowmanager_types.h", + "DNA_anim_types.h", + "DNA_boid_types.h", + "DNA_smoke_types.h", // empty string to indicate end of includefiles "" @@ -484,15 +485,18 @@ static void *read_file_data(char *filename, int *len_r) data= MEM_mallocN(*len_r, "read_file_data"); if (!data) { *len_r= -1; + fclose(fp); return NULL; } if (fread(data, *len_r, 1, fp)!=1) { *len_r= -1; MEM_freeN(data); + fclose(fp); return NULL; } - + + fclose(fp); return data; } @@ -519,7 +523,7 @@ int convert_include(char *filename) overslaan= 0; while(count<filelen) { - /* code for skipping a struct: two hashes. (preprocess added a space) */ + /* code for skipping a struct: two hashes on 2 lines. (preprocess added a space) */ if(md[0]=='#' && md[1]==' ' && md[2]=='#') { overslaan= 1; } @@ -559,10 +563,11 @@ int convert_include(char *filename) while( *md1 != '}' ) { if(md1>mainend) break; - /* skip when it says 'struct' or 'unsigned' */ + /* skip when it says 'struct' or 'unsigned' or 'const' */ if(*md1) { if( strncmp(md1, "struct", 6)==0 ) md1+= 7; - if( strncmp(md1, "unsigned", 6)==0 ) md1+= 9; + if( strncmp(md1, "unsigned", 8)==0 ) md1+= 9; + if( strncmp(md1, "const", 5)==0 ) md1+= 6; /* we've got a type! */ type= add_type(md1, 0); @@ -1103,7 +1108,6 @@ int main(int argc, char ** argv) #include "DNA_ID.h" #include "DNA_ipo_types.h" #include "DNA_key_types.h" -#include "DNA_scriptlink_types.h" #include "DNA_text_types.h" #include "DNA_packedFile_types.h" #include "DNA_camera_types.h" @@ -1123,7 +1127,6 @@ int main(int argc, char ** argv) #include "DNA_object_force.h" #include "DNA_object_fluidsim.h" #include "DNA_world_types.h" -#include "DNA_radio_types.h" #include "DNA_scene_types.h" #include "DNA_view3d_types.h" #include "DNA_view2d_types.h" @@ -1134,7 +1137,7 @@ int main(int argc, char ** argv) #include "DNA_fileglobal_types.h" #include "DNA_sequence_types.h" #include "DNA_effect_types.h" -#include "DNA_oops_types.h" +#include "DNA_outliner_types.h" #include "DNA_property_types.h" #include "DNA_sensor_types.h" #include "DNA_controller_types.h" @@ -1152,5 +1155,8 @@ int main(int argc, char ** argv) #include "DNA_particle_types.h" #include "DNA_cloth_types.h" #include "DNA_gpencil_types.h" -#include "DNA_freestyle_types.h" +#include "DNA_windowmanager_types.h" +#include "DNA_anim_types.h" +#include "DNA_boid_types.h" +#include "DNA_smoke_types.h" /* end of list */ |