diff options
Diffstat (limited to 'source/blender/makesdna')
56 files changed, 3579 insertions, 759 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..9e5212e159f 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 */ @@ -171,6 +175,7 @@ typedef struct PreviewImage { #define ID_KE MAKE_ID2('K', 'E') #define ID_WO MAKE_ID2('W', 'O') #define ID_SCR MAKE_ID2('S', 'R') +#define ID_SCRN MAKE_ID2('S', 'N') #define ID_VF MAKE_ID2('V', 'F') #define ID_TXT MAKE_ID2('T', 'X') #define ID_SO MAKE_ID2('S', 'O') @@ -182,6 +187,8 @@ typedef struct PreviewImage { #define ID_NT MAKE_ID2('N', 'T') #define ID_BR MAKE_ID2('B', 'R') #define ID_PA MAKE_ID2('P', 'A') +#define ID_GD MAKE_ID2('G', 'D') +#define ID_WM MAKE_ID2('W', 'M') /* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */ #define ID_SEQ MAKE_ID2('S', 'Q') @@ -194,15 +201,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..7e54045b5e4 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,21 @@ struct SpaceLink; struct Object; -/* -------------- Poses ----------------- */ +/* ************************************************ */ +/* Poses */ -/* PoseChannel stores the results of Actions (ipos) and transform information - with respect to the restposition of Armature bones */ +/* 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 +80,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 +103,63 @@ 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 (xyz only) */ + PCHAN_ROT_EUL, +} 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 +179,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-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 */ + +/* Groups -------------------------------------- */ + +/* 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 +214,127 @@ 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 { + AGRP_SELECTED = (1<<0), + AGRP_ACTIVE = (1<<1), + AGRP_PROTECTED = (1<<2), + AGRP_EXPANDED = (1<<3), - 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), +} 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), + ADS_FILTER_ONLYDRIVERS = (1<<1), + + /* 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), + + /* combination filters (some only used at runtime) */ + ADS_FILTER_NOOBDATA = (ADS_FILTER_NOCAM|ADS_FILTER_NOMAT|ADS_FILTER_NOLAM|ADS_FILTER_NOCUR), + ADS_FILTER_NLADUMMY = (ADS_FILTER_NOSHAPEKEYS|ADS_FILTER_NOOBDATA), +} 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 +350,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 +378,48 @@ 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 + diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h index aeabae42adf..f713b4a8acc 100644 --- a/source/blender/makesdna/DNA_actuator_types.h +++ b/source/blender/makesdna/DNA_actuator_types.h @@ -107,6 +107,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 { @@ -214,7 +215,8 @@ typedef struct bTwoDFilterActuator{ }bTwoDFilterActuator; typedef struct bParentActuator { - char pad[4]; + char pad[2]; + short flag; int type; struct Object *ob; } bParentActuator; @@ -482,6 +484,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..bf6b9bed5a1 --- /dev/null +++ b/source/blender/makesdna/DNA_anim_types.h @@ -0,0 +1,710 @@ +/* Testing code for new animation system in 2.5 + * Copyright 2009, Joshua Leung + */ + +#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! + */ +enum { + FMODIFIER_TYPE_NULL = 0, + FMODIFIER_TYPE_GENERATOR, + FMODIFIER_TYPE_ENVELOPE, + FMODIFIER_TYPE_CYCLES, + FMODIFIER_TYPE_NOISE, /* unimplemented - generate variations using some basic noise generator... */ + 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 */ +enum { + /* 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 { + /* generator based on PyExpression */ + char expression[256]; /* python expression to use as generator */ + + /* general generator information */ + float *coefficients; /* coefficients array */ + unsigned int arraysize; /* size of the coefficients array */ + + short poly_order; /* order of polynomial generated (i.e. 1 for linear, 2 for quadratic) */ + short func_type; /* builtin math function eFMod_Generator_Functions */ + + int pad; + + /* settings */ + short flag; /* settings */ + short mode; /* which 'generator' to use eFMod_Generator_Modes */ +} FMod_Generator; + +/* generator modes */ +enum { + FCM_GENERATOR_POLYNOMIAL = 0, + FCM_GENERATOR_POLYNOMIAL_FACTORISED, + FCM_GENERATOR_FUNCTION, + FCM_GENERATOR_EXPRESSION, +} eFMod_Generator_Modes; + +/* generator flags */ +enum { + /* generator works in conjunction with other modifiers (i.e. doesn't replace those before it) */ + FCM_GENERATOR_ADDITIVE = (1<<0), +} eFMod_Generator_Flags; + +/* 'function' generator types */ +enum { + FCM_GENERATOR_FN_SIN = 0, + FCM_GENERATOR_FN_COS, + FCM_GENERATOR_FN_TAN, + FCM_GENERATOR_FN_SQRT, + FCM_GENERATOR_FN_LN, +} 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 */ +enum { + 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 */ +enum { + 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 */ +enum { + 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 */ +enum { + /* 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 */ +enum { + /* 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 */ +enum { + /* 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') */ +enum { + 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 */ +enum { + 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 */ +// TODO: the concepts here still need to be refined to solve any unresolved items + +/* NLA Modifiers ---------------------------------- */ + +/* These differ from F-Curve modifiers, as although F-Curve modifiers also operate on a + * per-channel basis too (in general), they are part of the animation data itself, which + * means that their effects are inherited by all of their users. In order to counteract this, + * the modifiers here should be used to provide variation to pre-created motions only. + */ + +/* 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. Actions being + * referenced by NLA-Strips SHOULD-NOT be editable, unless they were created in such + * a way that results in very little mapping distortion (i.e. for layered animation only, + * opposed to prebuilt 'blocks' which are quickly dumped into the NLA for crappymatic machima-type + * stuff) + */ +typedef struct NlaStrip { + struct NlaStrip *next, *prev; + + bAction *act; /* Action that is referenced by this strip */ + AnimMapper *remap; /* Remapping info this strip (for tweaking correspondance of action with context) */ + + ListBase modifiers; /* NLA Modifiers */ + + ListBase fcurves; /* F-Curves for controlling this strip's influence and timing */ + float influence; /* Influence of strip */ + float act_time; /* Current 'time' within action being used */ + + 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) */ + int blendmode; /* strip blending mode */ + + int flag; /* settings */ + + // umm... old unused cruft? + int stride_axis; /* axis for stridebone stuff - 0=x, 1=y, 2=z */ + int pad; + + float actoffs; /* Offset within action, for cycles and striding (only set for ACT_USESTRIDE) */ + float stridelen; /* The stridelength (considered when flag & ACT_USESTRIDE) */ + + char stridechannel[32]; /* Instead of stridelen, it uses an action channel */ + char offs_bone[32]; /* if repeat, use this bone/channel for defining offset */ +} NlaStrip; + +/* NLA Strip Blending Mode */ +enum { + NLASTRIPMODE_BLEND = 0, + NLASTRIPMODE_ADD, + NLASTRIPMODE_SUBTRACT, +} eActStrip_Mode; + +/* NLA Strip Settings */ +// TODO: check on which of these are still useful... +enum { + NLASTRIP_SELECT = (1<<0), + NLASTRIP_USESTRIDE = (1<<1), + NLASTRIP_BLENDTONEXT = (1<<2), /* Not implemented. Is not used anywhere */ + NLASTRIP_HOLDLASTFRAME = (1<<3), + NLASTRIP_ACTIVE = (1<<4), + NLASTRIP_LOCK_ACTION = (1<<5), + NLASTRIP_MUTE = (1<<6), + NLASTRIP_REVERSE = (1<<7), /* This has yet to be implemented. To indicate that a strip should be played backwards */ + NLASTRIP_CYCLIC_USEX = (1<<8), + NLASTRIP_CYCLIC_USEY = (1<<9), + NLASTRIP_CYCLIC_USEZ = (1<<10), + NLASTRIP_AUTO_BLENDS = (1<<11), + NLASTRIP_TWEAK = (1<<12), /* This strip is a tweaking strip (only set if owner track is a tweak track) */ +} eActionStrip_Flag; + +/* 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 info[64]; /* short user-description of this track */ +} NlaTrack; + +/* settings for track */ +enum { + /* track is the one that settings can be modified on (doesn't indicate + * that it's for 'tweaking' though) + */ + 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), + /* strip is the 'last' one that should be evaluated, as the active action + * is being used to tweak the animation of the strips up to here + */ + NLATRACK_TWEAK = (1<<5), +} 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 */ +enum { + /* entire array (not just the specified index) gets keyframed */ + KSP_FLAG_WHOLE_ARRAY = (1<<0), +} eKSP_Settings; + +/* KS_Path->groupmode */ +enum { + /* 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 + */ +enum { + 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 */ +} 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 */ +enum { + /* 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 */ +enum { + 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/internal/anim_sys.c for details. + */ +typedef struct AnimData { + /* active action - acts as the 'tweaking track' for the NLA */ + bAction *action; + /* 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; + + /* '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 */ +} AnimData; + +/* Animation Data settings (mostly for NLA) */ +enum { + /* only evaluate a single track in the NLA */ + ADT_NLA_SOLO_TRACK = (1<<0), + /* don't use NLA */ + ADT_NLA_EVAL_OFF = (1<<1), + /* don't execute drivers */ + ADT_DRIVERS_DISABLED = (1<<2), + + /* drivers expanded in UI */ + ADT_DRIVERS_COLLAPSED = (1<<10), +} eAnimData_Flag; + +/* Animation Data recalculation settings (to be set by depsgraph) */ +enum { + 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 93cb9f59860..69b5e9b0f92 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -71,6 +71,8 @@ typedef struct bArmature { ID id; ListBase bonebase; ListBase chainbase; + ListBase *edbo; /* editbone listbase, we use pointer so we can check state */ + int flag; int drawtype; short deformflag; @@ -157,6 +159,7 @@ typedef enum eBone_Flag { 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_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index c7196763358..88520a12e75 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,6 +48,11 @@ 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 */ @@ -57,10 +63,13 @@ typedef struct Brush { float rgb[3]; /* color */ float alpha; /* opacity */ - short texact, pad; - struct MTex *mtex[18]; /* MAX_MTEX */ + float rot; /* rotation in radians */ - struct BrushClone clone; + short texact; /* active texture */ + char sculpt_tool; /* active tool */ + char tex_mode; + + char pad[4]; } Brush; /* Brush.flag */ @@ -71,6 +80,10 @@ typedef struct Brush { #define BRUSH_RAD_PRESSURE 16 #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 /* Brush.blend */ #define BRUSH_BLEND_MIX 0 @@ -82,6 +95,20 @@ typedef struct Brush { #define BRUSH_BLEND_ERASE_ALPHA 6 #define BRUSH_BLEND_ADD_ALPHA 7 +/* Brush.tex_mode */ +#define BRUSH_TEX_DRAG 0 +#define BRUSH_TEX_TILE 1 +#define BRUSH_TEX_3D 2 + +/* 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 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..7a504efdd2a 100644 --- a/source/blender/makesdna/DNA_camera_types.h +++ b/source/blender/makesdna/DNA_camera_types.h @@ -38,11 +38,13 @@ 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,7 +59,7 @@ 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; @@ -76,6 +78,7 @@ typedef struct Camera { #define CAM_SHOWTITLESAFE 8 #define CAM_SHOWNAME 16 #define CAM_ANGLETOGGLE 32 +#define CAM_DS_EXPAND 64 /* 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 311a70c93ca..33984582d7f 100644 --- a/source/blender/makesdna/DNA_cloth_types.h +++ b/source/blender/makesdna/DNA_cloth_types.h @@ -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. */ @@ -74,8 +77,8 @@ 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; + int pad2; } ClothSimSettings; 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..f8ea5f95d65 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -45,6 +45,9 @@ 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. */ # @@ -88,7 +91,8 @@ typedef struct BevPoint { 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 */ + 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, hide; /* f1, f2, f3: used for selection status, hide: used to indicate whether BezTriple is hidden */ } BezTriple; @@ -134,11 +138,15 @@ 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 */ 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; Path *path; @@ -161,7 +169,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 +182,9 @@ typedef struct Curve { float linewidth; char *str; + struct SelBox *selboxes; + struct EditFont *editfont; + char family[24]; struct VFont *vfont; struct VFont *vfontb; @@ -184,7 +199,7 @@ typedef struct Curve { int selstart, selend; struct CharInfo *strinfo; - struct CharInfo curinfo; + struct CharInfo curinfo; } Curve; /* **************** CURVE ********************* */ @@ -204,6 +219,7 @@ 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 /* spacemode */ #define CU_LEFT 0 @@ -221,17 +237,46 @@ typedef struct Curve { #define CU_BSPLINE 2 #define CU_CARDINAL 3 #define CU_NURBS 4 +#define CU_TYPE 7 + #define CU_2D 8 + /* 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; /* *************** CHARINFO **************** */ diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h index e6b18641d2a..18c18d9e9dd 100644 --- a/source/blender/makesdna/DNA_customdata_types.h +++ b/source/blender/makesdna/DNA_customdata_types.h @@ -74,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) @@ -96,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_genfile.h b/source/blender/makesdna/DNA_genfile.h new file mode 100644 index 00000000000..4b9401bf4b9 --- /dev/null +++ b/source/blender/makesdna/DNA_genfile.h @@ -0,0 +1,52 @@ +/* + * $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 ***** + * blenloader genfile private function prototypes + */ + +#ifndef GENFILE_H +#define GENFILE_H + +struct SDNA; + +extern unsigned char DNAstr[]; /* DNA.c */ +extern int DNAlen; + +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..ed209a127c7 100644 --- a/source/blender/makesdna/DNA_gpencil_types.h +++ b/source/blender/makesdna/DNA_gpencil_types.h @@ -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,6 +133,7 @@ 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 */ #define GP_DATA_LMBPLOCK (1<<0) /* show debugging info in viewport (i.e. status print) */ diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h index e1d79f0f875..371b0d75951 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 */ @@ -92,10 +95,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; 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..c6a1a2b45e2 100644 --- a/source/blender/makesdna/DNA_lamp_types.h +++ b/source/blender/makesdna/DNA_lamp_types.h @@ -39,13 +39,15 @@ #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; @@ -103,7 +105,7 @@ typedef struct Lamp { short YF_glowtype, YF_pad2; struct MTex *mtex[18]; /* MAX_MTEX */ - struct Ipo *ipo; + struct Ipo *ipo; // XXX depreceated... old animation system /* preview */ struct PreviewImage *preview; @@ -113,6 +115,9 @@ typedef struct 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..cd0b73c8f70 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -40,18 +40,19 @@ #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 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; @@ -97,7 +98,9 @@ typedef struct 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 +115,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; @@ -144,15 +147,16 @@ typedef struct Material { */ #define MAXMAT 16 -/* 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 /* flag */ /* for render */ #define MA_IS_USED 1 + /* for dopesheet */ +#define MA_DS_EXPAND 2 /* mode (is int) */ #define MA_TRACEBLE 1 @@ -161,7 +165,7 @@ typedef struct Material { #define MA_WIRE 8 #define MA_VERTEXCOL 16 #define MA_HALO_SOFT 16 -#define MA_HALO 32 +#define MA_HALO 32 /* deprecated */ #define MA_ZTRA 64 #define MA_VERTEXCOLP 128 #define MA_ZINV 256 diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index 752a2360905..3ecfe416c79 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 << 8) + +#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..c07989b2ce6 100644 --- a/source/blender/makesdna/DNA_meshdata_types.h +++ b/source/blender/makesdna/DNA_meshdata_types.h @@ -30,6 +30,7 @@ #define DNA_MESHDATA_TYPES_H #include "DNA_customdata_types.h" +#include "DNA_listBase.h" struct Bone; struct Image; @@ -116,7 +117,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; @@ -142,15 +150,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 +170,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 */ @@ -265,7 +269,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..862f3ca184b 100644 --- a/source/blender/makesdna/DNA_meta_types.h +++ b/source/blender/makesdna/DNA_meta_types.h @@ -65,6 +65,7 @@ typedef struct MetaBall { ListBase elems; ListBase disp; + ListBase *editelems; /* not saved in files, note we use pointer for editmode check */ struct Ipo *ipo; /* material of the mother ball will define the material used of all others */ diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 077481dfa6e..76f6b980aa2 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -39,6 +39,7 @@ typedef enum ModifierType { eModifierType_Fluidsim, eModifierType_Mask, eModifierType_SimpleDeform, + eModifierType_Multires, eModifierType_Surface, NUM_MODIFIER_TYPES } ModifierType; @@ -58,7 +59,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; @@ -391,12 +395,13 @@ 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 */ } ClothModifierData; typedef struct CollisionModifierData { @@ -522,6 +527,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; diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index d5eb4024dcc..b10de02dbb4 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -39,6 +39,7 @@ struct SpaceNode; struct bNodeLink; struct bNodeType; struct bNodeGroup; +struct AnimData; #define NODE_MAXSTR 32 @@ -124,6 +125,7 @@ typedef struct bNode { 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 */ @@ -154,12 +156,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 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; @@ -178,9 +183,11 @@ 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 */ diff --git a/source/blender/makesdna/DNA_object_fluidsim.h b/source/blender/makesdna/DNA_object_fluidsim.h index 2914330a2b0..66c5baab84b 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 ***** * @@ -157,6 +157,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 49435000820..718d1a17834 100644 --- a/source/blender/makesdna/DNA_object_force.h +++ b/source/blender/makesdna/DNA_object_force.h @@ -69,7 +69,7 @@ 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; typedef struct PointCache { @@ -119,7 +119,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 */ diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 82da883df4a..febf2fe59cd 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -43,6 +43,7 @@ extern "C" { struct bPose; struct Object; +struct AnimData; struct Ipo; struct BoundBox; struct Path; @@ -90,7 +91,8 @@ typedef struct BoundBox { typedef struct Object { ID id; - + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ + short type, partype; int par1, par2, par3; /* can be vertexnrs */ char parsubstr[32]; /* String describing subobject info */ @@ -98,15 +100,15 @@ 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; + ListBase constraintChannels; // XXX depreceated... old animation system ListBase effect; ListBase disp; ListBase defbase; @@ -129,15 +131,15 @@ typedef struct Object { short flag; /* copy of Base */ short colbits; /* when zero, from obdata */ - 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 */ @@ -159,7 +161,7 @@ typedef struct Object { float margin; float max_vel; /* clamp the maximum velocity 0.0 is disabled */ float min_vel; /* clamp the maximum velocity 0.0 is disabled */ - float pad3; /* clamp the maximum velocity 0.0 is disabled */ + float m_contactProcessingThreshold; char dt, dtx; char totcol; /* copy of mesh or curve or meta */ @@ -202,7 +204,7 @@ typedef struct Object { float anisotropicFriction[3]; ListBase constraints; - ListBase nlastrips; + ListBase nlastrips; // XXX depreceated... old animation system ListBase hooks; ListBase particlesystem; /* particle systems */ @@ -227,10 +229,6 @@ typedef struct Object { 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*/ - ListBase gpulamp; /* runtime, for lamps only */ } Object; @@ -308,6 +306,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 @@ -342,18 +341,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 @@ -440,6 +427,7 @@ 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 @@ -459,6 +447,7 @@ extern Object workob; #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 @@ -486,8 +475,18 @@ 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) /* ob->protectflag */ #define OB_LOCK_LOCX 1 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 e68f8515af1..6805082d094 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -106,6 +106,7 @@ typedef struct ParticleSettings { /* physics modes */ short phystype, rotmode, avemode, reactevent; short draw, draw_as, draw_size, childtype; + short ren_as, rt2[3]; /* number of path segments, power of 2 except */ short draw_step, ren_step; short hair_step, keys_step; @@ -179,7 +180,8 @@ 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 ParticleEdit *edit; /* particle editmode (runtime) */ + void (*free_edit)(struct ParticleSystem *sys); /* free callback */ struct ParticleCacheKey **pathcache; /* path cache (runtime) */ struct ParticleCacheKey **childcache; /* child cache (runtime) */ @@ -301,12 +303,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 /* not used anywhere */ -#define PART_DRAW_ADAPT 32 -#define PART_DRAW_COS 64 +//#define PART_DRAW_HEALTH 16 +//#define PART_DRAW_TIMED_PATH 32 +//#define PART_DRAW_CACHED_PATH 64 #define PART_DRAW_BB_LOCK 128 #define PART_DRAW_PARENT 256 #define PART_DRAW_NUM 512 @@ -340,9 +342,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 +355,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,11 +386,10 @@ 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 */ /* psys->flag */ #define PSYS_CURRENT 1 diff --git a/source/blender/makesdna/DNA_property_types.h b/source/blender/makesdna/DNA_property_types.h index b370c547ce0..7cc365a9ebc 100644 --- a/source/blender/makesdna/DNA_property_types.h +++ b/source/blender/makesdna/DNA_property_types.h @@ -48,13 +48,13 @@ typedef struct bProperty { } 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_radio_types.h b/source/blender/makesdna/DNA_radio_types.h index e757024603b..4219bf59b93 100644 --- a/source/blender/makesdna/DNA_radio_types.h +++ b/source/blender/makesdna/DNA_radio_types.h @@ -46,5 +46,17 @@ typedef struct Radio { } Radio; + +/* **************** RADIOSITY ********************* */ + +/* draw type */ +#define RAD_WIREFRAME 0 +#define RAD_SOLID 1 +#define RAD_GOURAUD 2 + +/* flag */ +#define RAD_SHOWLIMITS 1 +#define RAD_SHOWZ 2 + #endif diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index d26bdd469f6..7391201776e 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -33,11 +33,11 @@ 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" struct Radio; struct Object; @@ -47,6 +47,7 @@ struct Image; struct Group; struct Text; struct bNodeTree; +struct AnimData; typedef struct Base { struct Base *next, *prev; @@ -168,7 +169,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 */ @@ -318,9 +320,9 @@ typedef struct RenderData { /* Dome variables */ short domeres, domemode; - short domeangle, pad9; - float domesize; + short domeangle, dometilt; float domeresbuf; + float pad2; struct Text *dometext; } RenderData; @@ -361,6 +363,8 @@ typedef struct ImagePaintSettings { /* for projection painting only */ short seam_bleed,normal_angle; + + void *paintcursor; /* wm handle */ } ImagePaintSettings; typedef struct ParticleBrushData { @@ -375,6 +379,7 @@ typedef struct ParticleEditSettings { short brushtype; ParticleBrushData brush[7]; /* 7 = PE_TOT_BRUSH */ + void *paintcursor; /* runtime */ float emitterdist; int draw_timed; @@ -386,7 +391,52 @@ typedef struct TransformOrientation { float mat[3][3]; } TransformOrientation; +struct SculptSession; +typedef struct Sculpt +{ + /* Note! a deep copy of this struct must be done header_info.c's copy_scene function */ + /* Data stored only from entering sculptmode until exiting sculptmode */ + struct SculptSession *session; + struct Brush *brush; + + /* For rotating around a pivot point */ + float pivot[3]; + int flags; + /* For the Brush Shape */ + char texsep; + /* Control tablet input */ + char tablet_size, tablet_strength; + char pad[5]; +} Sculpt; + +typedef struct VPaint { + struct Brush *brush; + + 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; + /* Subdivide Settings */ short cornertype; short editbutflag; @@ -417,6 +467,8 @@ typedef struct ToolSettings { short uvcalc_mapdir; short uvcalc_mapalign; short uvcalc_flag; + short uv_flag, uv_selectmode; + short uv_pad[2]; /* Auto-IK */ short autoik_chainlen; @@ -427,6 +479,9 @@ typedef struct ToolSettings { /* Particle Editing */ struct ParticleEditSettings particle; + /* Transform Proportional Area of Effect */ + float proportional_size; + /* Select Group Threshold */ float select_thresh; @@ -458,6 +513,7 @@ typedef struct ToolSettings { char skgen_postpro_passes; char skgen_subdivisions[3]; char skgen_multi_level; + int skgen_pad; /* Skeleton Sketching */ struct Object *skgen_template; @@ -474,65 +530,17 @@ typedef struct ToolSettings { char pad3[2]; } 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; +typedef struct bStats { + /* scene totals for visible layers */ + int totobj, totlamp, totobjsel, totcurve, totmesh, totarmature; + int totvert, totface; +} bStats; - /* Settings for each brush */ - BrushData drawbrush, smoothbrush, pinchbrush, inflatebrush, grabbrush, layerbrush, flattenbrush; - - /* For rotating around a pivot point */ - float pivot[3]; - - short brush_type; - - /* 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 Scene { ID id; + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ + struct Object *camera; struct World *world; @@ -541,6 +549,7 @@ typedef struct Scene { ListBase base; struct Base *basact; + struct Object *obedit; /* name replaces old G.obedit */ float cursor[3]; float twcent[3]; /* center for transform widget */ @@ -551,9 +560,10 @@ typedef struct Scene { float editbutsize; /* size of normals */ short selectmode; /* for mesh only! */ short proportional, prop_mode; - short automerge, pad5, pad6; + short automerge, pad5; - short autokey_mode; /* mode for autokeying (defines in DNA_userdef_types.h */ + short flag; /* various settings */ + short autokey_mode; /* mode for autokeying (defines in DNA_userdef_types.h) */ short use_nodes; @@ -564,12 +574,13 @@ typedef struct Scene { 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; + struct AudioData audio; /* DEPRICATED 2.5 */ ScriptLink scriptlink; @@ -584,12 +595,12 @@ typedef struct Scene { short dagisvalid, dagflags; short pad4, recalc; /* recalc = counterpart of ob->recalc */ - /* Sculptmode data */ - struct SculptData sculptdata; - /* frame step. */ int frame_step; - int 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 */ } Scene; @@ -668,6 +679,7 @@ typedef struct Scene { #define R_STAMP_INFO 0x4000 #define R_FULL_SAMPLE 0x8000 #define R_COMP_RERENDER 0x10000 +#define R_RECURS_PROTECTION 0x20000 /* r->stamp */ #define R_STAMP_TIME 0x0001 @@ -745,6 +757,37 @@ 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 + +/* 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(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 @@ -787,7 +830,13 @@ 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) + + /* return flag next_object function */ +#define F_ERROR -1 #define F_START 0 #define F_SCENE 1 #define F_SET 2 @@ -801,33 +850,18 @@ 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 +/* 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; /* toolsettings->imagepaint_flag */ #define IMAGEPAINT_DRAWING 1 @@ -848,6 +882,16 @@ typedef struct Scene { #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 /* not implemented */ +#define UV_SELECT_FACE 4 +#define UV_SELECT_ISLAND 8 + /* toolsettings->edge_mode */ #define EDGE_MODE_SELECT 0 #define EDGE_MODE_TAG_SEAM 1 diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 9f0a70d9bca..418cc84205a 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" +#include "DNA_ID.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 */ + + 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,102 @@ 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 */ } Panel; +typedef struct Header { + struct HeaderType *type; /* runtime */ + struct uiLayout *layout; /* runtime for drawing */ +} Header; + +typedef struct Menu { + struct MenuType *type; /* runtime */ + struct uiLayout *layout; /* runtime for drawing */ +} Menu; + 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 @@ -134,20 +196,6 @@ typedef struct ScrArea { #define SCREENFULL 1 #define SCREENAUTOPLAY 2 -/* 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 #define PNL_SNAP_TOP 1 @@ -164,5 +212,34 @@ 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 + +/* 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_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 7a358ad0694..8b29ce1338d 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 { diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 7bad8ec3b44..7fa26aa7572 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -78,6 +78,8 @@ typedef struct StripColorBalance { typedef struct StripProxy { char dir[160]; + char file[80]; + struct anim *anim; } StripProxy; typedef struct Strip { @@ -182,9 +184,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 +234,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 +264,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 diff --git a/source/blender/makesdna/DNA_sound_types.h b/source/blender/makesdna/DNA_sound_types.h index d05e6f1bae8..5dedd20e1e4 100644 --- a/source/blender/makesdna/DNA_sound_types.h +++ b/source/blender/makesdna/DNA_sound_types.h @@ -132,6 +132,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; diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 735e1c4f195..3864bcd0a21 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,70 +50,79 @@ 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; /* depricated, copied to region */ - unsigned int rowbut, pad2; - View2D v2d; + // 'IPO keys' - vertical lines for editing multiple keyframes at once - use Dopesheet instead for this? + //ListBase ipokey; // XXX it's not clear how these will come back yet + //short showkey; // XXX this doesn't need to be restored until ipokeys come back - void *editipo; - ListBase ipokey; + struct bDopeSheet *ads; /* settings for filtering animation data (NOTE: we use a pointer due to code-linking issues) */ - /* 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; + ListBase ghostCurves; /* sampled snapshots of F-Curves used as in-session guides */ + + 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; } 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]; + + struct RenderInfo *ri; short cursens, curact; - short align, tabo; /* align for panels, tab is old tab */ - View2D v2d; + short align, preview; /* align for panels, preview is signal to refresh */ + View2D v2d; /* depricated, copied to region */ short mainb, menunr; /* texnr and menunr have to remain shorts */ short pin, mainbo; @@ -129,24 +137,26 @@ typedef struct SpaceButs { short re_align; short oldkeypress; /* for keeping track of the sub tab key cycling */ - char pad, flag; + char flag, texact; - 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; /* depricated, 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; @@ -157,52 +167,36 @@ typedef struct SpaceSeq { 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 *); + /* 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 */ } 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; /* depricated, copied to region */ ListBase tree; struct TreeStore *treestore; @@ -212,39 +206,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 pad; 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,9 +240,9 @@ 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]; @@ -262,14 +250,14 @@ typedef struct SpaceNla { short autosnap; /* this uses the same settings as autosnap for Action Editor */ short flag; - View2D v2d; + View2D v2d; /* depricated, 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,14 +265,12 @@ typedef struct SpaceText { int top, viewlines; short flags, menunr; - int font_id; int lheight; int left; int showlinenrs; int tabnumber; - int currtab_set; int showsyntax; int overwrite; float pix_per_line; @@ -293,6 +279,8 @@ typedef struct SpaceText { int wordwrap, doplugins; + char findstr[256]; /* ST_MAX_FIND_STR */ + char replacestr[256]; /* ST_MAX_FIND_STR */ } SpaceText; typedef struct Script { @@ -315,9 +303,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 +316,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; /* depricated, copied to region */ int flag, redraws; @@ -340,13 +328,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; /* depricated, 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 +342,33 @@ 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 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; /* depricated, copied to region */ struct FileList *files; @@ -426,15 +420,96 @@ typedef struct SpaceImaSel { } SpaceImaSel; -/* **************** SPACE ********************* */ +/* view3d Now in DNA_view3d_types.h */ -/* 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_GAME 8 +#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 + +/* 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 /* these values need to be hardcoded in structs, dna does not recognize defines */ /* also defined in BKE */ @@ -482,13 +557,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 +574,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,8 +593,8 @@ 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 @@ -541,43 +603,40 @@ typedef struct SpaceImaSel { #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) + +/* 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 @@ -591,6 +650,8 @@ 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 /* SpaceOops->storeflag */ #define SO_TREESTORE_CLEANUP 1 @@ -634,10 +695,11 @@ 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 +#define SNLA_ALLKEYED (1<<0) +#define SNLA_ACTIVELAYERS (1<<1) +#define SNLA_DRAWTIME (1<<2) +#define SNLA_NOTRANSKEYCULL (1<<3) +#define SNLA_NODRAWCFRANUM (1<<4) /* time->flag */ /* show timing in frames instead of in seconds */ @@ -648,7 +710,7 @@ 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 @@ -676,7 +738,7 @@ enum { SPACE_EMPTY, SPACE_VIEW3D, SPACE_IPO, - SPACE_OOPS, + SPACE_OUTLINER, SPACE_BUTS, SPACE_FILE, SPACE_IMAGE, 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 6e07336a4b1..f37d9eca282 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; @@ -129,6 +130,7 @@ typedef struct EnvMap { 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; @@ -167,7 +169,7 @@ typedef struct Tex { struct ImageUser iuser; struct bNodeTree *nodetree; - struct Ipo *ipo; + struct Ipo *ipo; // XXX depreceated... old animation system struct Image *ima; struct PluginTex *plugin; struct ColorBand *coba; diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index fbd962f9372..022e1cef840 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -38,40 +38,131 @@ /* 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 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; + + short minlabelchars; /* in characters */ + short minwidgetchars; /* in characters */ + + short columnspace; + short templatespace; + short boxspace; + short buttonspacex; + short buttonspacey; + short panelspace; + short panelouter; + + short pad[3]; +} 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 ThemeUI { + + /* Interface Elements (buttons, menus, icons) */ + uiWidgetColors wcol_regular, wcol_tool, wcol_radio, wcol_text, wcol_option; + uiWidgetColors wcol_num, wcol_numslider; + uiWidgetColors wcol_menu, wcol_pulldown, wcol_menu_back, wcol_menu_item; + uiWidgetColors wcol_box; - 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 +181,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 +196,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 +224,6 @@ typedef struct bTheme { struct bTheme *next, *prev; char name[32]; - /* Interface Elements (buttons, menus, icons) */ ThemeUI tui; /* Individual Spacetypes */ @@ -151,8 +246,7 @@ typedef struct bTheme { /* 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 +267,24 @@ 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 pad1; + 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 +292,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 +305,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 ****************** */ @@ -319,10 +418,10 @@ extern UserDef U; /* from usiblender.c !!!! */ #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 +429,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..ac628ca2266 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,101 @@ #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 */ + + 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 */ - float cursor[2]; /* only used in the UV view for now*/ - short around; - char pad[6]; + short around; /* pivot point for transforms (rotate and scale) */ + float cursor[2]; /* only used in the UV view for now (for 2D-cursor) */ } 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_KEEPZOOM 0x0001 + /* aspect ratio is maintained on view resize */ +#define V2D_KEEPASPECT 0x0002 + /* 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) + +/* 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) -/* 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..5cd78670e71 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,123 @@ 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]; + + /* local viewmat/persmat, multiplied with object matrix, while drawing */ + float viewmatob[4][4]; + float persmatob[4][4]; + + float viewquat[4], dist, zfac; /* zfac is initgrabz() result */ + float camdx, camdy; /* camera view offsets, 1.0 = viewplane moves entire width/height */ + float pixsize; + float ofs[3]; + short camzoom, viewbut; - float winmat1[4][4]; // persp(1) storage, for swap matrices - float viewmat1[4][4]; + int lastmode; /* for modal keymap switching, int because it stores notifier code */ - float viewquat[4], dist, zfac; /* zfac is initgrabz() result */ - int lay_used; /* used while drawing */ - + 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 +199,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 +221,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..7d6b5ec8764 --- /dev/null +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -0,0 +1,226 @@ +/** + * $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; + +/* forwards */ +struct bContext; +struct wmLocal; +struct bScreen; +struct uiBlock; +struct wmSubWindow; +struct wmTimer; +struct StructRNA; +struct PointerRNA; +struct ReportList; + +/* 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 */ + + ListBase 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; + + +/* 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 */ + 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, overriding all queues */ + + 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 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 *); + + /* panel for redo and repeat */ + void *(*uiBlock)(struct wmOperator *); + + /* rna for properties */ + struct StructRNA *srna; + + short flag; + + /* only used for operators defined with python + * use to store pointers to python functions */ + void *pyop_data; + +} wmOperatorType; + +#define OP_MAX_TYPENAME 64 + +/* 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 pad; +} wmKeymapItem; + +#define KMAP_MAX_NAME 64 + +/* 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 */ + int spaceid; /* same IDs as in DNA_space_types.h */ + int regionid; /* see above */ +} 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 */ +} 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 + +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 f599364ed66..608a4ca982e 100644 --- a/source/blender/makesdna/DNA_world_types.h +++ b/source/blender/makesdna/DNA_world_types.h @@ -34,6 +34,7 @@ #include "DNA_ID.h" #include "DNA_scriptlink_types.h" +struct AnimData; struct Ipo; struct MTex; @@ -48,6 +49,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; @@ -90,6 +92,7 @@ typedef struct World { short mode; short occlusionRes; /* resolution of occlusion Z buffer in pixel */ short physicsEngine; /* here it's aligned */ + short ticrate, maxlogicstep, physubstep, maxphystep; float misi, miststa, mistdist, misthi; @@ -105,12 +108,16 @@ 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 */ /* previews */ @@ -182,5 +189,8 @@ typedef struct World { #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..f91cf166f62 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, 215] ) diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt index a85f561da92..6024799f852 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 c8c8bd1ba68..1c716019e80 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') @@ -31,14 +34,15 @@ if not USE_WINE: if sys.platform != 'cygwin': makesdna_tool.Append (CCFLAGS = cflags) makesdna_tool.Append (CPPDEFINES = defines) -targetdir = root_build_dir+'/lib' +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_LINKFLAGS']) -targetdir = root_build_dir + '/makesdna' +targetdir = normpath(root_build_dir + '/makesdna') if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'): targetdir = '#' + targetdir @@ -52,8 +56,11 @@ if env['OURPLATFORM'] != 'linuxcross': if USE_WINE: dna.Command ('dna.c', '', 'wine ' + root_build_dir+os.sep+"makesdna $TARGET") else: - dna.Command ('dna.c', '', root_build_dir+os.sep+"makesdna $TARGET") + 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' +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..b4b029a19e5 --- /dev/null +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -0,0 +1,1086 @@ +/* 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) 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, "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 b4deb1f2b60..bf2f0f3900e 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -111,7 +111,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", @@ -131,6 +131,8 @@ char *includefiles[] = { "DNA_gpencil_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", // empty string to indicate end of includefiles "" @@ -518,7 +520,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; } @@ -1133,7 +1135,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" @@ -1151,4 +1153,6 @@ int main(int argc, char ** argv) #include "DNA_particle_types.h" #include "DNA_cloth_types.h" #include "DNA_gpencil_types.h" +#include "DNA_windowmanager_types.h" +#include "DNA_anim_types.h" /* end of list */ |