diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-04-14 14:46:47 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-04-14 14:46:47 +0400 |
commit | bfca79a6577c7e4ab3d0dcae585abcf2a17fe710 (patch) | |
tree | 00804e29d009c81406892159233d372aee12e500 /source/blender/makesdna | |
parent | 69ee17f0b6121ab63f0a7712c9563295eda88d39 (diff) | |
parent | 9a79bd38ade00fc663c27ffda9892629ef5ca755 (diff) |
Merging r44227 through r45619 from trunk into soc-2011-tomato
Diffstat (limited to 'source/blender/makesdna')
43 files changed, 880 insertions, 707 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index eb8d06fc9f2..1737f3b79e6 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -54,15 +54,14 @@ typedef struct IDProperty { char type, subtype; short flag; char name[64]; /* MAX_IDPROP_NAME */ - 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 :)*/ + 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 */ int len; /* array length, also (this is important!) string length + 1. * the idea is to be able to reuse array realloc functions on strings.*/ /* totallen is total length of allocated array/string, including a buffer. * Note that the buffering is mild; the code comes from python's list implementation.*/ - int totallen; /*strings and arrays are both buffered, though the buffer isn't - saved.*/ + int totallen; /*strings and arrays are both buffered, though the buffer isn't saved.*/ } IDProperty; #define MAX_IDPROP_NAME 64 diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 058c72be639..43474d72de9 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -219,14 +219,15 @@ typedef struct bPoseChannel { 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 */ + float pose_mat[4][4]; /* constraints accumulate here. in the end, pose_mat = bone->arm_mat * chan_mat + * this matrix is object space */ float constinv[4][4]; /* inverse result of constraints. * doesn't include effect of restposition, parent, and local transform*/ float pose_head[3]; /* actually pose_mat[3] */ float pose_tail[3]; /* also used for drawing help lines... */ - float limitmin[3], limitmax[3]; /* DOF constraint */ + float limitmin[3], limitmax[3]; /* DOF constraint, note! - these are stored in degrees, not radians */ float stiffness[3]; /* DOF stiffness */ float ikstretch; float ikrotweight; /* weight of joint rotation constraint */ @@ -416,7 +417,7 @@ typedef enum eItasc_Solver { /* 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. * @@ -511,7 +512,7 @@ typedef enum eAction_Flags { /* 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! + ListBase chanbase; /* cache for channels (only initialized when pinned) */ // XXX not used! struct Group *filter_grp; /* object group for ADS_FILTER_ONLYOBGROUP filtering option */ char searchstr[64]; /* string to search for in displayed names of F-Curves for ADS_FILTER_BY_FCU_NAME filtering option */ diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h index 817da3cd445..f4e06455c63 100644 --- a/source/blender/makesdna/DNA_actuator_types.h +++ b/source/blender/makesdna/DNA_actuator_types.h @@ -138,7 +138,7 @@ typedef struct bCameraActuator { float damping; short pad1, axis; float pad2; -} bCameraActuator ; +} bCameraActuator; typedef struct bConstraintActuator { short type, mode; @@ -199,7 +199,7 @@ typedef struct bTwoDFilterActuator { /* Tells what type of 2D Filter */ short type; /* (flag == 0) means 2D filter is activate and - (flag != 0) means 2D filter is inactive */ + * (flag != 0) means 2D filter is inactive */ short flag; int int_arg; /* a float argument */ @@ -224,6 +224,8 @@ typedef struct bArmatureActuator { char constraint[64]; /* MAX_NAME */ int type; /* 0=run, 1=enable, 2=disable, 3=set target, 4=set weight */ float weight; + float influence; + float pad; struct Object *target; struct Object *subtarget; } bArmatureActuator; @@ -511,8 +513,9 @@ typedef struct bActuator { #define ACT_ARM_DISABLE 2 #define ACT_ARM_SETTARGET 3 #define ACT_ARM_SETWEIGHT 4 -/* update this define if more type are addedd */ -#define ACT_ARM_MAXTYPE 4 +#define ACT_ARM_SETINFLUENCE 5 +/* update this define if more types are added */ +#define ACT_ARM_MAXTYPE 5 /* stateactuator->type */ #define ACT_STATE_SET 0 diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index ae31bea4981..fd4b86a4155 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -373,7 +373,7 @@ typedef struct ChannelDriver { * which relates the target 'variables' in some way to yield a single usable value */ char expression[256]; /* expression to compile for evaluation */ - void *expr_comp; /* PyObject - compiled expression, dont save this */ + void *expr_comp; /* PyObject - compiled expression, don't save this */ float curval; /* result of previous evaluation */ float influence; /* influence of driver on result */ // XXX to be implemented... this is like the constraint influence setting @@ -408,7 +408,7 @@ typedef enum eDriver_Flags { //DRIVER_FLAG_LAYERING = (1<<2), /* use when the expression needs to be recompiled */ DRIVER_FLAG_RECOMPILE = (1<<3), - /* the names are cached so they dont need have python unicode versions created each time */ + /* the names are cached so they don't need have python unicode versions created each time */ DRIVER_FLAG_RENAMEVAR = (1<<4), /* intermediate values of driver should be shown in the UI for debugging purposes */ DRIVER_FLAG_SHOWDEBUG = (1<<5) @@ -528,7 +528,7 @@ typedef struct AnimMapPair { /* Retargetting Information for Actions * - * This should only be used if it is strictly necessary (i.e. user will need to explictly + * This should only be used if it is strictly necessary (i.e. user will need to explicitly * 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. @@ -559,7 +559,7 @@ typedef struct NlaStrip { ListBase strips; /* 'Child' strips (used for 'meta' strips) */ bAction *act; /* Action that is referenced by this strip (strip is 'user' of the action) */ - AnimMapper *remap; /* Remapping info this strip (for tweaking correspondance of action with context) */ + AnimMapper *remap; /* Remapping info this strip (for tweaking correspondence of action with context) */ ListBase fcurves; /* F-Curves for controlling this strip's influence and timing */ // TODO: move out? ListBase modifiers; /* F-Curve modifiers to be applied to the entire strip's referenced F-Curves */ @@ -661,7 +661,7 @@ typedef enum eNlaStrip_Type { /* NLA Track (nlt) * - * A track groups a bunch of 'strips', which should form a continous set of + * A track groups a bunch of 'strips', which should form a continuous 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. @@ -752,7 +752,7 @@ typedef enum eKSP_Grouping { * 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 + * A few 'generic' (non-absolute and dependent 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. */ @@ -761,7 +761,9 @@ typedef struct KeyingSet { ListBase paths; /* (KS_Path) paths to keyframe to */ + char idname[64]; /* unique name (for search, etc.) */ char name[64]; /* user-viewable name for KeyingSet (for menus, etc.) */ + char description[240]; /* (RNA_DYN_DESCR_MAX) short help text. */ char typeinfo[64]; /* name of the typeinfo data used for the relative paths */ short flag; /* settings for KeyingSet */ diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index f915b75a77f..ea564e8c499 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -36,13 +36,13 @@ struct AnimData; /* this system works on different transformation space levels; - -1) Bone Space; with each Bone having own (0,0,0) origin -2) Armature Space; the rest position, in Object space, Bones Spaces are applied hierarchical -3) Pose Space; the animation position, in Object space -4) World Space; Object matrix applied to Pose or Armature space - -*/ + * + * 1) Bone Space; with each Bone having own (0,0,0) origin + * 2) Armature Space; the rest position, in Object space, Bones Spaces are applied hierarchical + * 3) Pose Space; the animation position, in Object space + * 4) World Space; Object matrix applied to Pose or Armature space + * + */ typedef struct Bone { struct Bone *next, *prev; /* Next/prev elements within this list */ @@ -113,7 +113,7 @@ typedef struct bArmature { } bArmature; /* armature->flag */ -/* dont use bit 7, was saved in files to disable stuff */ +/* don't use bit 7, was saved in files to disable stuff */ typedef enum eArmature_Flag { ARM_RESTPOS = (1<<0), ARM_DRAWXRAY = (1<<1), /* XRAY is here only for backwards converting */ @@ -182,7 +182,7 @@ typedef enum eBone_Flag { BONE_CONNECTED = (1<<4), /* when bone has a parent, connect head of bone to parent's tail*/ /* 32 used to be quatrot, was always set in files, do not reuse unless you clear it always */ BONE_HIDDEN_P = (1<<6), /* hidden Bones when drawing PoseChannels */ - BONE_DONE = (1<<7), /* For detecting cyclic dependancies */ + BONE_DONE = (1<<7), /* For detecting cyclic dependencies */ BONE_DRAW_ACTIVE = (1<<8), /* active is on mouse clicks only - deprecated, ONLY USE FOR DRAWING */ BONE_HINGE = (1<<9), /* No parent rotation or scale */ BONE_HIDDEN_A = (1<<10), /* hidden Bones when drawing Armature Editmode */ diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index 454008c73a7..0d06b55f1d3 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -102,58 +102,65 @@ typedef struct Brush { } Brush; /* Brush.flag */ -#define BRUSH_AIRBRUSH (1<<0) -#define BRUSH_TORUS (1<<1) -#define BRUSH_ALPHA_PRESSURE (1<<2) -#define BRUSH_SIZE_PRESSURE (1<<3) -#define BRUSH_JITTER_PRESSURE (1<<4) /* was BRUSH_RAD_PRESSURE */ -#define BRUSH_SPACING_PRESSURE (1<<5) -#define BRUSH_FIXED_TEX (1<<6) -#define BRUSH_RAKE (1<<7) -#define BRUSH_ANCHORED (1<<8) -#define BRUSH_DIR_IN (1<<9) -#define BRUSH_SPACE (1<<10) -#define BRUSH_SMOOTH_STROKE (1<<11) -#define BRUSH_PERSISTENT (1<<12) -#define BRUSH_ACCUMULATE (1<<13) -#define BRUSH_LOCK_ALPHA (1<<14) -#define BRUSH_ORIGINAL_NORMAL (1<<15) -#define BRUSH_OFFSET_PRESSURE (1<<16) -#define BRUSH_SPACE_ATTEN (1<<18) -#define BRUSH_ADAPTIVE_SPACE (1<<19) -#define BRUSH_LOCK_SIZE (1<<20) -#define BRUSH_TEXTURE_OVERLAY (1<<21) -#define BRUSH_EDGE_TO_EDGE (1<<22) -#define BRUSH_RESTORE_MESH (1<<23) -#define BRUSH_INVERSE_SMOOTH_PRESSURE (1<<24) -#define BRUSH_RANDOM_ROTATION (1<<25) -#define BRUSH_PLANE_TRIM (1<<26) -#define BRUSH_FRONTFACE (1<<27) -#define BRUSH_CUSTOM_ICON (1<<28) - -/* temporary flag which sets up autmatically for correct - * brush drawing when inverted modal operator is running */ -#define BRUSH_INVERTED (1<<29) +typedef enum BrushFlags { + BRUSH_AIRBRUSH = (1<<0), + BRUSH_TORUS = (1<<1), + BRUSH_ALPHA_PRESSURE = (1<<2), + BRUSH_SIZE_PRESSURE = (1<<3), + BRUSH_JITTER_PRESSURE = (1<<4), + BRUSH_SPACING_PRESSURE = (1<<5), + BRUSH_FIXED_TEX = (1<<6), + BRUSH_RAKE = (1<<7), + BRUSH_ANCHORED = (1<<8), + BRUSH_DIR_IN = (1<<9), + BRUSH_SPACE = (1<<10), + BRUSH_SMOOTH_STROKE = (1<<11), + BRUSH_PERSISTENT = (1<<12), + BRUSH_ACCUMULATE = (1<<13), + BRUSH_LOCK_ALPHA = (1<<14), + BRUSH_ORIGINAL_NORMAL = (1<<15), + BRUSH_OFFSET_PRESSURE = (1<<16), + BRUSH_SPACE_ATTEN = (1<<18), + BRUSH_ADAPTIVE_SPACE = (1<<19), + BRUSH_LOCK_SIZE = (1<<20), + BRUSH_TEXTURE_OVERLAY = (1<<21), + BRUSH_EDGE_TO_EDGE = (1<<22), + BRUSH_RESTORE_MESH = (1<<23), + BRUSH_INVERSE_SMOOTH_PRESSURE = (1<<24), + BRUSH_RANDOM_ROTATION = (1<<25), + BRUSH_PLANE_TRIM = (1<<26), + BRUSH_FRONTFACE = (1<<27), + BRUSH_CUSTOM_ICON = (1<<28), + + /* temporary flag which sets up automatically for correct brush + * drawing when inverted modal operator is running */ + BRUSH_INVERTED = (1<<29) +} BrushFlags; /* Brush.sculpt_tool */ -#define SCULPT_TOOL_DRAW 1 -#define SCULPT_TOOL_SMOOTH 2 -#define SCULPT_TOOL_PINCH 3 -#define SCULPT_TOOL_INFLATE 4 -#define SCULPT_TOOL_GRAB 5 -#define SCULPT_TOOL_LAYER 6 -#define SCULPT_TOOL_FLATTEN 7 -#define SCULPT_TOOL_CLAY 8 -#define SCULPT_TOOL_FILL 9 -#define SCULPT_TOOL_SCRAPE 10 -#define SCULPT_TOOL_NUDGE 11 -#define SCULPT_TOOL_THUMB 12 -#define SCULPT_TOOL_SNAKE_HOOK 13 -#define SCULPT_TOOL_ROTATE 14 -//#define SCULPT_TOOL_WAX 15 // XXX: reuse this slot later -#define SCULPT_TOOL_CREASE 16 -#define SCULPT_TOOL_BLOB 17 -#define SCULPT_TOOL_CLAY_TUBES 18 +typedef enum BrushSculptTool { + SCULPT_TOOL_DRAW = 1, + SCULPT_TOOL_SMOOTH = 2, + SCULPT_TOOL_PINCH = 3, + SCULPT_TOOL_INFLATE = 4, + SCULPT_TOOL_GRAB = 5, + SCULPT_TOOL_LAYER = 6, + SCULPT_TOOL_FLATTEN = 7, + SCULPT_TOOL_CLAY = 8, + SCULPT_TOOL_FILL = 9, + SCULPT_TOOL_SCRAPE = 10, + SCULPT_TOOL_NUDGE = 11, + SCULPT_TOOL_THUMB = 12, + SCULPT_TOOL_SNAKE_HOOK = 13, + SCULPT_TOOL_ROTATE = 14, + + /* slot 15 is free for use */ + /* SCULPT_TOOL_ = 15, */ + + SCULPT_TOOL_CREASE = 16, + SCULPT_TOOL_BLOB = 17, + SCULPT_TOOL_CLAY_STRIPS = 18 +} BrushSculptTool; /* ImagePaintSettings.tool */ #define PAINT_TOOL_DRAW 0 diff --git a/source/blender/makesdna/DNA_camera_types.h b/source/blender/makesdna/DNA_camera_types.h index 4618b99f6b6..112247f3d66 100644 --- a/source/blender/makesdna/DNA_camera_types.h +++ b/source/blender/makesdna/DNA_camera_types.h @@ -58,8 +58,8 @@ typedef struct Camera { float shiftx, shifty; /* yafray: dof params */ - /* qdn: yafray var 'YF_dofdist' now enabled for defocus composit node as well. - The name was not changed so that no other files need to be modified */ + /* qdn: yafray var 'YF_dofdist' now enabled for defocus composite node as well. + * The name was not changed so that no other files need to be modified */ float YF_dofdist; struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */ diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h index 79a1d821543..fd8b08e68c6 100644 --- a/source/blender/makesdna/DNA_cloth_types.h +++ b/source/blender/makesdna/DNA_cloth_types.h @@ -33,16 +33,16 @@ #define __DNA_CLOTH_TYPES_H__ /** -* This struct contains all the global data required to run a simulation. -* At the time of this writing, this structure contains data appropriate -* to run a simulation as described in Deformation Constraints in a -* Mass-Spring Model to Describe Rigid Cloth Behavior by Xavier Provot. -* -* I've tried to keep similar, if not exact names for the variables as -* are presented in the paper. Where I've changed the concept slightly, -* as in stepsPerFrame comapred to the time step in the paper, I've used -* variables with different names to minimize confusion. -**/ + * This struct contains all the global data required to run a simulation. + * At the time of this writing, this structure contains data appropriate + * to run a simulation as described in Deformation Constraints in a + * Mass-Spring Model to Describe Rigid Cloth Behavior by Xavier Provot. + * + * I've tried to keep similar, if not exact names for the variables as + * are presented in the paper. Where I've changed the concept slightly, + * as in stepsPerFrame comapred to the time step in the paper, I've used + * variables with different names to minimize confusion. + */ typedef struct ClothSimSettings { diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index d5b9477f7f6..c9d80476fde 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -92,16 +92,16 @@ typedef struct BevPoint { */ /* note: alfa location in struct is abused by Key system */ /* vec in BezTriple looks like this: - vec[0][0]=x location of handle 1 - vec[0][1]=y location of handle 1 - vec[0][2]=z location of handle 1 (not used for FCurve Points(2d)) - vec[1][0]=x location of control point - vec[1][1]=y location of control point - vec[1][2]=z location of control point - vec[2][0]=x location of handle 2 - vec[2][1]=y location of handle 2 - vec[2][2]=z location of handle 2 (not used for FCurve Points(2d)) -*/ + * - vec[0][0]=x location of handle 1 + * - vec[0][1]=y location of handle 1 + * - vec[0][2]=z location of handle 1 (not used for FCurve Points(2d)) + * - vec[1][0]=x location of control point + * - vec[1][1]=y location of control point + * - vec[1][2]=z location of control point + * - vec[2][0]=x location of handle 2 + * - vec[2][1]=y location of handle 2 + * - vec[2][2]=z location of handle 2 (not used for FCurve Points(2d)) + */ typedef struct BezTriple { float vec[3][3]; float alfa, weight, radius; /* alfa: tilt in 3D View, weight: used for softbody goal weight, radius: for bevel tapering */ @@ -125,7 +125,7 @@ typedef struct Nurb { short mat_nr; /* index into material list */ short hide, flag; short pntsu, pntsv; /* number of points in the U or V directions */ - short resolu, resolv; /* tesselation resolution in the U or V directions */ + short resolu, resolv; /* tessellation resolution in the U or V directions */ short orderu, orderv; short flagu, flagv; diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h index eeeb0581527..9898f9715a0 100644 --- a/source/blender/makesdna/DNA_customdata_types.h +++ b/source/blender/makesdna/DNA_customdata_types.h @@ -47,7 +47,7 @@ typedef struct CustomDataLayer { int active_rnd; /* number of the layer to render*/ int active_clone; /* number of the layer to render*/ int active_mask; /* number of the layer to render*/ - char pad[4]; + int uid; /* shape keyblock unique id reference*/ char name[64]; /* layer name, MAX_CUSTOMDATA_LAYER_AAME */ void *data; /* layer data */ } CustomDataLayer; @@ -59,15 +59,16 @@ typedef struct CustomDataExternal { } CustomDataExternal; /** structure which stores custom element data associated with mesh elements - * (vertices, edges or faces). The custom data is organised into a series of + * (vertices, edges or faces). The custom data is organized into a series of * layers, each with a data type (e.g. MTFace, MDeformVert, etc.). */ typedef struct CustomData { CustomDataLayer *layers; /* CustomDataLayers, ordered by type */ - int typemap[32]; /* runtime only! - maps types to indices of first layer of that type, + int typemap[34]; /* runtime only! - maps types to indices of first layer of that type, * MUST be >= CD_NUMTYPES, but we cant use a define here. * Correct size is ensured in CustomData_update_typemap assert() */ + int totlayer, maxlayer; /* number of layers, size of layers array */ - int totsize, pad; /* in editmode, total size of all data layers */ + int totsize, pad2; /* in editmode, total size of all data layers */ void *pool; /* Bmesh: Memory pool for allocation of blocks */ CustomDataExternal *external; /* external file storing customdata layers */ } CustomData; @@ -93,14 +94,12 @@ typedef struct CustomData { #define CD_MLOOPCOL 17 #define CD_TANGENT 18 #define CD_MDISPS 19 -#define CD_WEIGHT_MCOL 20 /* for displaying weightpaint colors */ +#define CD_PREVIEW_MCOL 20 /* for displaying weightpaint colors */ #define CD_ID_MCOL 21 #define CD_TEXTURE_MCOL 22 #define CD_CLOTH_ORCO 23 #define CD_RECAST 24 -#ifdef USE_BMESH_FORWARD_COMPAT - /* BMESH ONLY START */ #define CD_MPOLY 25 #define CD_MLOOP 26 @@ -108,16 +107,12 @@ typedef struct CustomData { #define CD_SHAPEKEY 28 #define CD_BWEIGHT 29 #define CD_CREASE 30 -#define CD_WEIGHT_MLOOPCOL 31 +#define CD_ORIGSPACE_MLOOP 31 +#define CD_PREVIEW_MLOOPCOL 32 +#define CD_BM_ELEM_PYPTR 33 /* BMESH ONLY END */ -#define CD_NUMTYPES 32 - -#else - -#define CD_NUMTYPES 25 - -#endif +#define CD_NUMTYPES 34 /* Bits for CustomDataMask */ #define CD_MASK_MVERT (1 << CD_MVERT) @@ -140,12 +135,10 @@ typedef struct CustomData { #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) +#define CD_MASK_PREVIEW_MCOL (1 << CD_PREVIEW_MCOL) #define CD_MASK_CLOTH_ORCO (1 << CD_CLOTH_ORCO) #define CD_MASK_RECAST (1 << CD_RECAST) -#ifdef USE_BMESH_FORWARD_COMPAT - /* BMESH ONLY START */ #define CD_MASK_MPOLY (1 << CD_MPOLY) #define CD_MASK_MLOOP (1 << CD_MLOOP) @@ -153,11 +146,11 @@ typedef struct CustomData { #define CD_MASK_SHAPEKEY (1 << CD_SHAPEKEY) #define CD_MASK_BWEIGHT (1 << CD_BWEIGHT) #define CD_MASK_CREASE (1 << CD_CREASE) -#define CD_MASK_WEIGHT_MLOOPCOL (1 << CD_WEIGHT_MLOOPCOL) +#define CD_MASK_ORIGSPACE_MLOOP (1 << CD_ORIGSPACE_MLOOP) +#define CD_MASK_PREVIEW_MLOOPCOL (1LL << CD_PREVIEW_MLOOPCOL) +#define CD_MASK_BM_ELEM_PYPTR (1LL << CD_BM_ELEM_PYPTR) /* BMESH ONLY END */ -#endif - /* CustomData.flag */ /* indicates layer should not be copied by CustomData_from_template or diff --git a/source/blender/makesdna/DNA_defs.h b/source/blender/makesdna/DNA_defs.h index aa2cfb3f6e9..762e027f934 100644 --- a/source/blender/makesdna/DNA_defs.h +++ b/source/blender/makesdna/DNA_defs.h @@ -45,7 +45,8 @@ /* hrmf, we need a better include then this */ #include "../blenloader/BLO_sys_types.h" /* needed for int64_t only! */ -#define USE_BMESH_FORWARD_COMPAT +/* Must not be defined for BMesh, as this guards code for pre-BMesh code to load BMesh .blend files */ +/* #define USE_BMESH_FORWARD_COMPAT */ /* non-id name variables should use this length */ #define MAX_NAME 64 diff --git a/source/blender/makesdna/DNA_documentation.h b/source/blender/makesdna/DNA_documentation.h index c1d6ee4aec3..0dd7f37f8b4 100644 --- a/source/blender/makesdna/DNA_documentation.h +++ b/source/blender/makesdna/DNA_documentation.h @@ -60,14 +60,14 @@ * * DNA has no external dependencies (except for a few system * includes). - + * * \section dnanote NOTE - + * * PLEASE READ INSTRUCTIONS ABOUT ADDING VARIABLES IN 'DNA' STRUCTS IN * * intern/dna_genfile.c * (ton) - + * */ diff --git a/source/blender/makesdna/DNA_dynamicpaint_types.h b/source/blender/makesdna/DNA_dynamicpaint_types.h index fedc603fde2..ca1b1bf1725 100644 --- a/source/blender/makesdna/DNA_dynamicpaint_types.h +++ b/source/blender/makesdna/DNA_dynamicpaint_types.h @@ -159,7 +159,7 @@ typedef struct DynamicPaintCanvasSettings { #define MOD_DPAINT_PART_RAD (1<<0) /* use particle radius */ #define MOD_DPAINT_USE_MATERIAL (1<<1) /* use object material */ #define MOD_DPAINT_ABS_ALPHA (1<<2) /* don't increase alpha unless - paint alpha is higher than existing */ + * paint alpha is higher than existing */ #define MOD_DPAINT_ERASE (1<<3) /* removes paint */ #define MOD_DPAINT_RAMP_ALPHA (1<<4) /* only read falloff ramp alpha */ diff --git a/source/blender/makesdna/DNA_fileglobal_types.h b/source/blender/makesdna/DNA_fileglobal_types.h index 0ae5c2465da..7e81041fe4a 100644 --- a/source/blender/makesdna/DNA_fileglobal_types.h +++ b/source/blender/makesdna/DNA_fileglobal_types.h @@ -36,7 +36,7 @@ struct bScreen; struct Scene; /** - * FileGlobal stores a part of the current user-unterface settings at + * FileGlobal stores a part of the current user-interface settings at * the moment of saving, and the file-specific settings. */ typedef struct FileGlobal { diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h index d4cfccaef70..20f7bb44e92 100644 --- a/source/blender/makesdna/DNA_genfile.h +++ b/source/blender/makesdna/DNA_genfile.h @@ -70,4 +70,4 @@ int DNA_elem_offset(struct SDNA *sdna, const char *stype, const char *vartype, c int DNA_elem_type_size(const eSDNA_Type elem_nr); -#endif +#endif /* __DNA_GENFILE_H__ */ diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h index 6f3014c0961..3de5372d848 100644 --- a/source/blender/makesdna/DNA_gpencil_types.h +++ b/source/blender/makesdna/DNA_gpencil_types.h @@ -132,7 +132,7 @@ typedef struct bGPdata { int flag; /* settings for this datablock */ /* not-saved stroke buffer data (only used during paint-session) - * - buffer must be initialised before use, but freed after + * - buffer must be initialized before use, but freed after * whole paint operation is over */ short sbuffer_size; /* number of elements currently in cache */ diff --git a/source/blender/makesdna/DNA_key_types.h b/source/blender/makesdna/DNA_key_types.h index d27ec513cc1..847d0b2cbbe 100644 --- a/source/blender/makesdna/DNA_key_types.h +++ b/source/blender/makesdna/DNA_key_types.h @@ -40,57 +40,95 @@ struct Ipo; typedef struct KeyBlock { struct KeyBlock *next, *prev; + + float pos; /* point in time (Key->type == KEY_NORMAL) only, + * for historic reasons this is relative to (Key->ctime / 100), + * so this value increments by 0.1f per frame. */ + float curval; /* influence (typically [0 - 1] but can be more), (Key->type == KEY_RELATIVE) only.*/ + + short type; /* interpolation type (Key->type == KEY_NORMAL) only. */ + short pad1; + + short relative; /* relative == 0 means first key is reference, otherwise the index of Key->blocks */ + short flag; + + int totelem; /* total number if items in the keyblock (compare with mesh/curve verts to chech we match) */ + int uid; /* for meshes only, match the unique number with the customdata layer */ - float pos; - float curval; - short type, adrcode, relative, flag; /* relative == 0 means first key is reference */ - int totelem, pad2; - - void *data; - float *weights; - char name[64]; /* MAX_NAME */ - char vgroup[64]; /* MAX_VGROUP_NAME */ + void *data; /* array of shape key values, size is (Key->elemsize * KeyBlock->totelem) */ + float *weights; /* store an aligned array of weights from 'vgroup' */ + char name[64]; /* MAX_NAME (unique name, user assigned) */ + char vgroup[64]; /* MAX_VGROUP_NAME (optional vertex group), array gets allocated into 'weights' when set */ + /* ranges, for RNA and UI only to clamp 'curval' */ float slidermin; float slidermax; + } KeyBlock; typedef struct Key { ID id; struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ - + + /* commonly called 'Basis', (Key->type == KEY_RELATIVE) only. + * Looks like this is _always_ 'key->block.first', + * perhaps later on it could be defined as some other KeyBlock - campbell */ KeyBlock *refkey; - char elemstr[64]; /* MAX_NAME */ - int elemsize; - float curval DNA_DEPRECATED; + + /* this is not a regular string, although it is \0 terminated + * this is an array of (element_array_size, element_type) pairs + * (each one char) used for calculating shape key-blocks */ + char elemstr[32]; + int elemsize; /* size of each element in #KeyBlock.data, use for allocation and stride */ + int pad; - ListBase block; + ListBase block; /* list of KeyBlock's */ struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */ - + ID *from; - short type, totkey; - short slurph, flag; + short type; /* absolute or relative shape key */ + short totkey; /* (totkey == BLI_countlist(&key->block)) */ + short slurph; /* quaint feature to delay moving points based on their order (Key->type == KEY_NORMAL) only */ + short flag; + + /* only used when (Key->type == KEY_NORMAL), this value is used as a time slider, + * rather then using the scenes time, this value can be animated to give greater control */ + float ctime; + + /* can never be 0, this is used for detecting old data */ + int uidgen; /* current free uid for keyblocks */ } Key; /* **************** KEY ********************* */ -/* key->type */ -#define KEY_NORMAL 0 -#define KEY_RELATIVE 1 +/* Key->type: KeyBlocks are interpreted as... */ +enum { + /* Sequencial positions over time (using KeyBlock->pos and Key->ctime) */ + KEY_NORMAL = 0, + + /* States to blend between (default) */ + KEY_RELATIVE = 1 +}; -/* key->flag */ -#define KEY_DS_EXPAND 1 +/* Key->flag */ +enum { + KEY_DS_EXPAND = 1 +}; -/* keyblock->type */ -#define KEY_LINEAR 0 -#define KEY_CARDINAL 1 -#define KEY_BSPLINE 2 +/* KeyBlock->type */ +enum { + KEY_LINEAR = 0, + KEY_CARDINAL = 1, + KEY_BSPLINE = 2 +}; -/* keyblock->flag */ -#define KEYBLOCK_MUTE (1<<0) -#define KEYBLOCK_SEL (1<<1) -#define KEYBLOCK_LOCKED (1<<2) +/* KeyBlock->flag */ +enum { + KEYBLOCK_MUTE = (1 << 0), + KEYBLOCK_SEL = (1 << 1), + KEYBLOCK_LOCKED = (1 << 2) +}; -#endif +#endif /* __DNA_KEY_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index b58ae921200..2b3719a10b5 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -136,7 +136,7 @@ typedef struct Material { short diff_shader, spec_shader; float roughness, refrac; /* 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 */ + * 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; @@ -168,7 +168,7 @@ typedef struct Material { float sss_front, sss_back; short sss_flag, sss_preset; - int mapto_textured; /* render-time cache to optimise texture lookups */ + int mapto_textured; /* render-time cache to optimize texture lookups */ short shadowonly_flag; /* "shadowsonly" type */ short index; /* custom index for render passes */ @@ -206,7 +206,7 @@ typedef struct Material { /* maximum number of materials per material array. * (on object, mesh, lamp, etc.). limited by * short mat_nr in verts, faces. - * -1 becayse for active material we store the index + 1 */ + * -1 because for active material we store the index + 1 */ #define MAXMAT (32767-1) /* material_type */ diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index d15cf4f1871..5d55bb8a4db 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -39,25 +39,24 @@ #include "DNA_defs.h" /* USE_BMESH_FORWARD_COMPAT */ +struct AnimData; struct DerivedMesh; struct Ipo; struct Key; -struct Material; -struct MVert; +struct MCol; struct MEdge; struct MFace; -struct MCol; -struct MSticky; -struct Mesh; -struct OcInfo; -struct MPoly; -struct MTexPoly; struct MLoop; -struct MLoopUV; struct MLoopCol; +struct MLoopUV; +struct MPoly; +struct MSticky; +struct MTexPoly; +struct MVert; +struct Material; +struct Mesh; struct Multires; -struct EditMesh; -struct AnimData; +struct OcInfo; typedef struct Mesh { ID id; @@ -68,8 +67,8 @@ typedef struct Mesh { struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */ struct Key *key; struct Material **mat; + struct MSelect *mselect; -/*#ifdef USE_BMESH_FORWARD_COMPAT*/ /* XXX - ifdefs dont work here! */ /* BMESH ONLY */ /*new face structures*/ struct MPoly *mpoly; @@ -78,36 +77,35 @@ typedef struct Mesh { struct MLoopUV *mloopuv; struct MLoopCol *mloopcol; /* END BMESH ONLY */ -/*#endif*/ - struct MFace *mface; /* array of mesh object mode faces */ - struct MTFace *mtface; /* store face UV's and texture here */ + /* mface stores the tessellation (triangulation) of the mesh, + * real faces are now stored in nface.*/ + struct MFace *mface; /* array of mesh object mode faces for tessellation */ + struct MTFace *mtface; /* store tessellation face UV's and texture here */ struct TFace *tface; /* depecrated, use mtface */ struct MVert *mvert; /* array of verts */ struct MEdge *medge; /* array of edges */ struct MDeformVert *dvert; /* deformgroup vertices */ - struct MCol *mcol; /* array of colors, this must be the number of faces * 4 */ + + /* array of colors for the tessellated faces, must be number of tessellated + * faces * 4 in length */ + struct MCol *mcol; struct MSticky *msticky; struct Mesh *texcomesh; - struct MSelect *mselect; - struct EditMesh *edit_mesh; /* not saved in file! */ + struct BMEditMesh *edit_btmesh; /* not saved in file! */ struct CustomData vdata, edata, fdata; -/*#ifdef USE_BMESH_FORWARD_COMPAT*/ /* XXX - ifdefs dont work here! */ /* BMESH ONLY */ struct CustomData pdata, ldata; /* END BMESH ONLY */ -/*#endif*/ int totvert, totedge, totface, totselect; -/*#ifdef USE_BMESH_FORWARD_COMPAT*/ /* BMESH ONLY */ int totpoly, totloop; /* END BMESH ONLY */ -/*#endif*/ /* XXX - ifdefs dont work here! */ /* the last selected vertex/edge/face are used for the active face however * this means the active face must always be selected, this is to keep track @@ -144,7 +142,7 @@ typedef struct TFace { /* **************** MESH ********************* */ /* texflag */ -#define AUTOSPACE 1 +#define ME_AUTOSPACE 1 /* me->editflag */ #define ME_EDIT_MIRROR_X (1 << 0) @@ -196,27 +194,6 @@ typedef struct TFace { /* debug only option */ #define ME_DRAWEXTRA_INDICES (1 << 13) -/* 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 @@ -226,9 +203,13 @@ typedef struct TFace { /* this is so we can save bmesh files that load in trunk, ignoring NGons * will eventually be removed */ -#if 0 /* enable in bmesh branch only for now */ #define USE_BMESH_SAVE_AS_COMPAT -#endif +#define USE_BMESH_SAVE_WITHOUT_MFACE + +/* enable this to calculate mpoly normal layer and face origindex mapping */ +// #define USE_BMESH_MPOLY_NORMALS +/* enable this so meshes get tessfaces calculated by default */ +// #define USE_TESSFACE_DEFAULT #endif diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h index e85e703cd27..2de89a31ab0 100644 --- a/source/blender/makesdna/DNA_meshdata_types.h +++ b/source/blender/makesdna/DNA_meshdata_types.h @@ -38,6 +38,7 @@ struct Bone; struct Image; +/*tessellation face, see MLoop/MPoly for the real face data*/ typedef struct MFace { unsigned int v1, v2, v3, v4; short mat_nr; @@ -67,16 +68,15 @@ typedef struct MVert { char flag, bweight; } MVert; -/* at the moment alpha is abused for vertex painting - * and not used for transperency, note that red and blue are swapped */ +/* tessellation vertex color data. + * at the moment alpha is abused for vertex painting + * and not used for transparency, note that red and blue are swapped */ typedef struct MCol { char a, r, g, b; } MCol; -#ifdef USE_BMESH_FORWARD_COMPAT - -/*new face structure, replaces MFace, which is now - only used for storing tesselations.*/ +/* new face structure, replaces MFace, which is now + * only used for storing tessellations.*/ typedef struct MPoly { /* offset into loop array and number of loops in the face */ int loopstart; @@ -85,30 +85,67 @@ typedef struct MPoly { char flag, pad; } MPoly; -/*the e here is because we want to move away from - relying on edge hashes.*/ +/* the e here is because we want to move away from + * relying on edge hashes.*/ typedef struct MLoop { unsigned int v; /*vertex index*/ unsigned int e; /*edge index*/ } MLoop; -#endif /* USE_BMESH_FORWARD_COMPAT */ - -/*bmesh custom data stuff*/ typedef struct MTexPoly { struct Image *tpage; char flag, transp; short mode,tile,unwrap; } MTexPoly; +/* can copy from/to MTexPoly/MTFace */ +#define ME_MTEXFACE_CPY(dst, src) \ +{ \ + (dst)->tpage = (src)->tpage; \ + (dst)->flag = (src)->flag; \ + (dst)->transp = (src)->transp; \ + (dst)->mode = (src)->mode; \ + (dst)->tile = (src)->tile; \ + (dst)->unwrap = (src)->unwrap; \ +} + typedef struct MLoopUV { float uv[2]; + int flag; } MLoopUV; +/*mloopuv->flag*/ +#define MLOOPUV_EDGESEL 1 +#define MLOOPUV_VERTSEL 2 +#define MLOOPUV_PINNED 4 + +/* at the moment alpha is abused for vertex painting + * and not used for transparency, note that red and blue are swapped */ typedef struct MLoopCol { - char a, r, g, b; + char r, g, b, a; } MLoopCol; +#define MESH_MLOOPCOL_FROM_MCOL(_mloopcol, _mcol) \ +{ \ + MLoopCol *mloopcol__tmp = _mloopcol; \ + const MCol *mcol__tmp = _mcol; \ + mloopcol__tmp->r = mcol__tmp->b; \ + mloopcol__tmp->g = mcol__tmp->g; \ + mloopcol__tmp->b = mcol__tmp->r; \ + mloopcol__tmp->a = mcol__tmp->a; \ +} (void)0 + + +#define MESH_MLOOPCOL_TO_MCOL(_mloopcol, _mcol) \ +{ \ + const MLoopCol *mloopcol__tmp = _mloopcol; \ + MCol *mcol__tmp = _mcol; \ + mcol__tmp->b = mloopcol__tmp->r; \ + mcol__tmp->g = mloopcol__tmp->g; \ + mcol__tmp->r = mloopcol__tmp->b; \ + mcol__tmp->a = mloopcol__tmp->a; \ +} (void)0 + typedef struct MSticky { float co[2]; } MSticky; @@ -118,6 +155,7 @@ typedef struct MSelect { int type; /* EDITVERT/EDITEDGE/EDITFACE */ } MSelect; +/*tessellation uv face data*/ typedef struct MTFace { float uv[4][2]; struct Image *tpage; @@ -140,11 +178,21 @@ typedef struct OrigSpaceFace { float uv[4][2]; } OrigSpaceFace; +typedef struct OrigSpaceLoop { + float uv[2]; +} OrigSpaceLoop; + typedef struct MDisps { /* Strange bug in SDNA: if disps pointer comes first, it fails to see totdisp */ int totdisp; - char pad[4]; + int level; float (*disps)[3]; + + /* Used for hiding parts of a multires mesh. Essentially the multires + equivalent of MVert.flag's ME_HIDE bit. + + This is a bitmap, keep in sync with type used in BLI_bitmap.h */ + unsigned int *hidden; } MDisps; /** Multires structs kept for compatibility with old files **/ @@ -231,7 +279,16 @@ typedef struct MRecast { /* flag (mface) */ #define ME_SMOOTH 1 #define ME_FACE_SEL 2 - /* flag ME_HIDE==16 is used here too */ +/* flag ME_HIDE==16 is used here too */ + +#define ME_POLY_LOOP_PREV(mloop, mp, i) (&(mloop)[(mp)->loopstart + (((i) + (mp)->totloop - 1) % (mp)->totloop)]) +#define ME_POLY_LOOP_NEXT(mloop, mp, i) (&(mloop)[(mp)->loopstart + (((i) + 1) % (mp)->totloop)]) + +/* mselect->type */ +#define ME_VSEL 0 +#define ME_ESEL 1 +#define ME_FSEL 2 + /* mtface->flag */ #define TF_SELECT 1 /* use MFace hide flag (after 2.43), should be able to reuse after 2.44 */ #define TF_ACTIVE 2 /* deprecated! */ diff --git a/source/blender/makesdna/DNA_meta_types.h b/source/blender/makesdna/DNA_meta_types.h index 9c20b8f644b..2912650c77c 100644 --- a/source/blender/makesdna/DNA_meta_types.h +++ b/source/blender/makesdna/DNA_meta_types.h @@ -87,8 +87,8 @@ typedef struct MetaBall { float wiresize, rendersize; /* display and render res */ /* bias elements to have an offset volume. - mother ball changes will effect other objects thresholds, - but these may also have their own thresh as an offset */ + * mother ball changes will effect other objects thresholds, + * but these may also have their own thresh as an offset */ float thresh; /* used in editmode */ diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 0899b77abbc..6c1d9892ba2 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -135,6 +135,8 @@ typedef struct LatticeModifierData { struct Object *object; char name[64]; /* optional vertexgroup name, MAX_VGROUP_NAME */ + float strength; + char pad[4]; } LatticeModifierData; typedef struct CurveModifierData { @@ -191,33 +193,33 @@ typedef struct ArrayModifierData { /* the object to use for object offset */ struct Object *offset_ob; /* a constant duplicate offset; - 1 means the duplicates are 1 unit apart - */ + * 1 means the duplicates are 1 unit apart + */ float offset[3]; /* a scaled factor for duplicate offsets; - 1 means the duplicates are 1 object-width apart - */ + * 1 means the duplicates are 1 object-width apart + */ float scale[3]; /* the length over which to distribute the duplicates */ float length; /* the limit below which to merge vertices in adjacent duplicates */ float merge_dist; /* determines how duplicate count is calculated; one of: - MOD_ARR_FIXEDCOUNT -> fixed - MOD_ARR_FITLENGTH -> calculated to fit a set length - MOD_ARR_FITCURVE -> calculated to fit the length of a Curve object - */ + * - MOD_ARR_FIXEDCOUNT -> fixed + * - MOD_ARR_FITLENGTH -> calculated to fit a set length + * - MOD_ARR_FITCURVE -> calculated to fit the length of a Curve object + */ int fit_type; /* flags specifying how total offset is calculated; binary OR of: - MOD_ARR_OFF_CONST -> total offset += offset - MOD_ARR_OFF_RELATIVE -> total offset += relative * object width - MOD_ARR_OFF_OBJ -> total offset += offset_ob's matrix - total offset is the sum of the individual enabled offsets - */ + * - MOD_ARR_OFF_CONST -> total offset += offset + * - MOD_ARR_OFF_RELATIVE -> total offset += relative * object width + * - MOD_ARR_OFF_OBJ -> total offset += offset_ob's matrix + * total offset is the sum of the individual enabled offsets + */ int offset_type; /* general flags: - MOD_ARR_MERGE -> merge vertices in adjacent duplicates - */ + * MOD_ARR_MERGE -> merge vertices in adjacent duplicates + */ int flags; /* the number of duplicates to generate for MOD_ARR_FIXEDCOUNT */ int count; @@ -676,6 +678,7 @@ typedef struct ShrinkwrapModifierData { #define MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS (1<<2) #define MOD_SHRINKWRAP_PROJECT_OVER_NORMAL 0 /* projection over normal is used if no axis is selected */ + typedef struct SimpleDeformModifierData { ModifierData modifier; @@ -810,7 +813,6 @@ typedef struct OceanModifierData { typedef struct WarpModifierData { ModifierData modifier; - /* keep in sync with MappingInfoModifierData */ struct Tex *texture; struct Object *map_object; @@ -1045,7 +1047,7 @@ typedef struct RemeshModifierData { ModifierData modifier; /* floodfill option, controls how small components can be - before they are removed */ + * before they are removed */ float threshold; /* ratio between size of model and grid */ diff --git a/source/blender/makesdna/DNA_movieclip_types.h b/source/blender/makesdna/DNA_movieclip_types.h index be189e883c7..ed7310ff883 100644 --- a/source/blender/makesdna/DNA_movieclip_types.h +++ b/source/blender/makesdna/DNA_movieclip_types.h @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * The Original Code is Copyright (C) 2011 Blender Foundation. * All rights reserved. * * The Original Code is: all of this file. @@ -78,11 +78,13 @@ typedef struct MovieClip { struct MovieTracking tracking; /* data for SfM tracking */ void *tracking_context; /* context of tracking job - used to synchronize data like framenumber - in SpaceClip clip user */ + * used to synchronize data like framenumber + * in SpaceClip clip user */ struct MovieClipProxy proxy; /* proxy to clip data */ - int flag, pad; + int flag; + + int len; /* lenght of movie */ } MovieClip; typedef struct MovieClipScopes { diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 361aca4a572..6caf0a7d8b2 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -77,7 +77,7 @@ typedef struct bNodeSocket { short type, flag; short limit; /* max. number of links */ - short pad1; + short struct_type; /* optional identifier for RNA struct subtype */ float locx, locy; @@ -112,6 +112,10 @@ typedef struct bNodeSocket { #define SOCK_INT 6 #define NUM_SOCKET_TYPES 7 /* must be last! */ +/* sock->struct_type */ +#define SOCK_STRUCT_NONE 0 /* default, type is defined by sock->type only */ +#define SOCK_STRUCT_OUTPUT_FILE 1 /* file output node socket */ + /* socket side (input/output) */ #define SOCK_IN 1 #define SOCK_OUT 2 @@ -189,7 +193,7 @@ typedef struct bNode { #define NODE_GROUP_EDIT 128 /* free test flag, undefined */ #define NODE_TEST 256 - /* composite: don't do node but pass on buffer(s) */ + /* node is disabled */ #define NODE_MUTED 512 #define NODE_CUSTOM_NAME 1024 /* deprecated! */ /* group node types: use const outputs by default */ @@ -234,7 +238,7 @@ typedef struct bNodeTree { int type, init; /* set init on fileread */ int cur_index; /* sockets in groups have unique identifiers, adding new sockets always - will increase this counter */ + * will increase this counter */ int flag; int update; /* update flags */ @@ -354,6 +358,21 @@ typedef struct NodeImageFile { int sfra, efra; } NodeImageFile; +/* XXX first struct fields should match NodeImageFile to ensure forward compatibility */ +typedef struct NodeImageMultiFile { + char base_path[1024]; /* 1024 = FILE_MAX */ + ImageFormatData format; + int sfra DNA_DEPRECATED, efra DNA_DEPRECATED; /* XXX old frame rand values from NodeImageFile for forward compatibility */ + int active_input; /* selected input in details view list */ + int pad; +} NodeImageMultiFile; +typedef struct NodeImageMultiFileSocket { + short use_render_format DNA_DEPRECATED; + short use_node_format; /* use overall node image format */ + int pad2; + ImageFormatData format; +} NodeImageMultiFileSocket; + typedef struct NodeChroma { float t1,t2,t3; float fsize,fstrength,falpha; @@ -456,7 +475,7 @@ typedef struct NodeTexChecker { typedef struct NodeTexEnvironment { NodeTexBase base; - int color_space, pad; + int color_space, projection; } NodeTexEnvironment; typedef struct NodeTexGradient { @@ -563,8 +582,12 @@ typedef struct TexNodeOutput { #define SHD_WAVE_TRI 2 /* image/environment texture */ -#define SHD_COLORSPACE_LINEAR 0 -#define SHD_COLORSPACE_SRGB 1 +#define SHD_COLORSPACE_NONE 0 +#define SHD_COLORSPACE_COLOR 1 + +/* environment texture */ +#define SHD_PROJ_EQUIRECTANGULAR 0 +#define SHD_PROJ_MIRROR_BALL 1 /* blur node */ #define CMP_NODE_BLUR_ASPECT_NONE 0 diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h index 6603288912b..6fefd2d672f 100644 --- a/source/blender/makesdna/DNA_object_force.h +++ b/source/blender/makesdna/DNA_object_force.h @@ -130,7 +130,7 @@ typedef struct EffectorWeights { * - to add new data types update: * * BKE_ptcache_data_size() * * ptcache_file_init_pointers() -*/ + */ #define BPHYS_DATA_INDEX 0 #define BPHYS_DATA_LOCATION 1 #define BPHYS_DATA_SMOKE_LOW 1 @@ -276,9 +276,10 @@ typedef struct SoftBody { /* general options */ float nodemass; /* softbody mass of *vertex* */ - char namedVG_Mass[64]; /* MAX_VGROUP_NAME */ /* along with it introduce mass painting - starting to fix old bug .. nastyness that VG are indexes - rather find them by name tag to find it -> jow20090613 */ + char namedVG_Mass[64]; /* MAX_VGROUP_NAME */ + /* along with it introduce mass painting + * starting to fix old bug .. nastyness that VG are indexes + * rather find them by name tag to find it -> jow20090613 */ float grav; /* softbody amount of gravitaion to apply */ float mediafrict; /* friction to env */ float rklimit; /* error limit for ODE solver */ @@ -291,17 +292,19 @@ typedef struct SoftBody { float maxgoal; float defgoal; /* default goal for vertices without vgroup */ short vertgroup; /* index starting at 1 */ - char namedVG_Softgoal[64]; /* MAX_VGROUP_NAME */ /* starting to fix old bug .. nastyness that VG are indexes - rather find them by name tag to find it -> jow20090613 */ + char namedVG_Softgoal[64]; /* MAX_VGROUP_NAME */ + /* starting to fix old bug .. nastyness that VG are indexes + * rather find them by name tag to find it -> jow20090613 */ short fuzzyness; /* */ /* springs */ float inspring; /* softbody inner springs */ float infrict; /* softbody inner springs friction */ - char namedVG_Spring_K[64]; /* MAX_VGROUP_NAME */ /* along with it introduce Spring_K painting - starting to fix old bug .. nastyness that VG are indexes - rather find them by name tag to find it -> jow20090613 */ + char namedVG_Spring_K[64]; /* MAX_VGROUP_NAME */ + /* along with it introduce Spring_K painting + * starting to fix old bug .. nastyness that VG are indexes + * rather find them by name tag to find it -> jow20090613 */ /* baking */ int sfra, efra; @@ -325,7 +328,7 @@ typedef struct SoftBody { choke, solver_ID, plastic,springpreload - ; + ; struct SBScratch *scratch; /* scratch pad/cache on live time not saved in file */ float shearstiff; @@ -398,7 +401,7 @@ typedef struct SoftBody { #define PTCACHE_FRAMES_SKIPPED 256 #define PTCACHE_EXTERNAL 512 #define PTCACHE_READ_INFO 1024 -/* dont use the filename of the blendfile the data is linked from (write a local cache) */ +/* don't use the filename of the blendfile the data is linked from (write a local cache) */ #define PTCACHE_IGNORE_LIBPATH 2048 /* high resolution cache is saved for smoke for backwards compatibility, so set this flag to know it's a "fake" cache */ #define PTCACHE_FAKE_SMOKE (1<<12) diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 7d3662c7ffb..86a2bb60cc9 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -136,7 +136,7 @@ typedef struct Object { /* materials */ struct Material **mat; /* material slots */ - char *matbits; /* a boolean field, with each byte 1 if corrusponding material is linked to object */ + char *matbits; /* a boolean field, with each byte 1 if corresponding material is linked to object */ int totcol; /* copy of mesh or curve or meta */ int actcol; /* currently selected material in the UI */ @@ -353,7 +353,7 @@ typedef struct DupliObject { #define OB_NO_CONSTRAINTS 8192 /* runtime constraints disable */ /* (short) ipoflag */ -/* XXX: many old flags for features removed due to incompatability +/* XXX: many old flags for features removed due to incompatibility * with new system and/or other design issues were here */ /* for stride/path editing (XXX: NEEDS REVIEW) */ @@ -439,13 +439,14 @@ typedef struct DupliObject { // #define OB_RADIO 2048 /* deprecated */ #define OB_FROMGROUP 4096 +/* WARNING - when adding flags check on PSYS_RECALC */ /* ob->recalc (flag bits!) */ -#define OB_RECALC_OB 1 -#define OB_RECALC_DATA 2 - /* time flag is set when time changes need recalc, so baked systems can ignore it */ -#define OB_RECALC_TIME 4 - /* only use for matching any flag, NOT as an argument since more flags may be added. */ -#define OB_RECALC_ALL (OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME) +#define OB_RECALC_OB (1 << 0) +#define OB_RECALC_DATA (1 << 1) +/* time flag is set when time changes need recalc, so baked systems can ignore it */ +#define OB_RECALC_TIME (1 << 2) +/* only use for matching any flag, NOT as an argument since more flags may be added. */ +#define OB_RECALC_ALL (OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME) /* controller state */ #define OB_MAX_STATES 30 diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 220ee69b442..58ffcf6480e 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -321,7 +321,7 @@ typedef struct ParticleSystem #define PART_TRAND 128 #define PART_EDISTR 256 /* particle/face from face areas */ -//#define PART_STICKY 512 /*collided particles can stick to collider*/ +#define PART_ROTATIONS 512 /* calculate particle rotations (and store them in pointcache) */ #define PART_DIE_ON_COL (1<<12) #define PART_SIZE_DEFL (1<<13) /* swept sphere deflections */ #define PART_ROT_DYN (1<<14) /* dynamic rotation */ @@ -463,8 +463,13 @@ typedef struct ParticleSystem #define PART_ROT_OB_Z 8 /* part->avemode */ -#define PART_AVE_SPIN 1 +#define PART_AVE_VELOCITY 1 #define PART_AVE_RAND 2 +#define PART_AVE_HORIZONTAL 3 +#define PART_AVE_VERTICAL 4 +#define PART_AVE_GLOBAL_X 5 +#define PART_AVE_GLOBAL_Y 6 +#define PART_AVE_GLOBAL_Z 7 /* part->reactevent */ #define PART_EVENT_DEATH 0 @@ -476,13 +481,13 @@ typedef struct ParticleSystem #define PART_CHILD_FACES 2 /* psys->recalc */ -/* starts from 8 so that the first bits can be ob->recalc */ -#define PSYS_RECALC_REDO 8 /* only do pathcache etc */ -#define PSYS_RECALC_RESET 16 /* reset everything including pointcache */ -#define PSYS_RECALC_TYPE 32 /* handle system type change */ -#define PSYS_RECALC_CHILD 64 /* only child settings changed */ -#define PSYS_RECALC_PHYS 128 /* physics type changed */ -#define PSYS_RECALC 248 +/* starts from (1 << 3) so that the first bits can be ob->recalc */ +#define PSYS_RECALC_REDO (1 << 3) /* only do pathcache etc */ +#define PSYS_RECALC_RESET (1 << 4) /* reset everything including pointcache */ +#define PSYS_RECALC_TYPE (1 << 5) /* handle system type change */ +#define PSYS_RECALC_CHILD (1 << 6) /* only child settings changed */ +#define PSYS_RECALC_PHYS (1 << 7) /* physics type changed */ +#define PSYS_RECALC (PSYS_RECALC_REDO | PSYS_RECALC_RESET | PSYS_RECALC_TYPE | PSYS_RECALC_CHILD | PSYS_RECALC_PHYS) /* psys->flag */ #define PSYS_CURRENT 1 @@ -498,7 +503,8 @@ typedef struct ParticleSystem #define PSYS_KEYED 1024 #define PSYS_EDITED 2048 //#define PSYS_PROTECT_CACHE 4096 /* deprecated */ -#define PSYS_DISABLED 8192 +#define PSYS_DISABLED 8192 +#define PSYS_OB_ANIM_RESTORE 16384 /* runtime flag */ /* pars->flag */ #define PARS_UNEXIST 1 diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 79d561fd2ea..79ed1186c1a 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -614,7 +614,7 @@ typedef struct GameData { /* * bit 3: (gameengine): Activity culling is enabled. * bit 5: (gameengine) : enable Bullet DBVT tree for view frustrum culling - */ + */ int flag; short mode, matmode; short occlusionRes; /* resolution of occlusion Z buffer in pixel */ @@ -837,11 +837,12 @@ typedef struct TransformOrientation { } TransformOrientation; /* *************************************************************** */ -/* Unified Paint Settings */ +/* Unified Paint Settings + */ /* These settings can override the equivalent fields in the active - Brush for any paint mode; the flag field controls whether these - values are used */ + * Brush for any paint mode; the flag field controls whether these + * values are used */ typedef struct UnifiedPaintSettings { /* unified radius of brush in pixels */ int size; @@ -861,12 +862,12 @@ typedef enum { UNIFIED_PAINT_ALPHA = (1<<1), /* only used if unified size is enabled, mirros the brush flags - BRUSH_LOCK_SIZE and BRUSH_SIZE_PRESSURE */ + * BRUSH_LOCK_SIZE and BRUSH_SIZE_PRESSURE */ UNIFIED_PAINT_BRUSH_LOCK_SIZE = (1<<2), UNIFIED_PAINT_BRUSH_SIZE_PRESSURE = (1<<3), /* only used if unified alpha is enabled, mirrors the brush flag - BRUSH_ALPHA_PRESSURE */ + * BRUSH_ALPHA_PRESSURE */ UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE = (1<<4) } UnifiedPaintSettingsFlags; @@ -995,7 +996,7 @@ typedef struct ToolSettings { int uv_sculpt_tool; int uv_relax_method; /* XXX: these sculpt_paint_* fields are deprecated, use the - unified_paint_settings field instead! */ + * unified_paint_settings field instead! */ short sculpt_paint_settings DNA_DEPRECATED; short pad1; int sculpt_paint_unified_size DNA_DEPRECATED; float sculpt_paint_unified_unprojected_radius DNA_DEPRECATED; @@ -1024,7 +1025,7 @@ typedef struct UnitSettings { /* Display/Editing unit options for each scene */ float scale_length; /* maybe have other unit conversions? */ char system; /* imperial, metric etc */ - char system_rotation; /* not implimented as a propper unit system yet */ + char system_rotation; /* not implemented as a propper unit system yet */ short flag; } UnitSettings; @@ -1086,7 +1087,7 @@ typedef struct Scene { void *fps_info; /* (runtime) info/cache used for presenting playback framerate info to the user */ - /* none of the dependancy graph vars is mean to be saved */ + /* none of the dependency graph vars is mean to be saved */ struct DagForest *theDag; short dagisvalid, dagflags; short recalc; /* recalc = counterpart of ob->recalc */ diff --git a/source/blender/makesdna/DNA_sdna_types.h b/source/blender/makesdna/DNA_sdna_types.h index 97b65235a29..ec02db192fd 100644 --- a/source/blender/makesdna/DNA_sdna_types.h +++ b/source/blender/makesdna/DNA_sdna_types.h @@ -48,14 +48,14 @@ typedef struct SDNA { short *typelens; /* type lengths */ int nr_structs; /* number of struct types */ - short **structs; /* sp= structs[a] is the address 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 */ + short **structs; /* sp = structs[a] is the address 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 */ struct GHash *structs_map; /* ghash for faster lookups, - requires WITH_DNA_GHASH to be used for now */ + * requires WITH_DNA_GHASH to be used for now */ /* wrong place for this really, its a simple * cache for findstruct_nr. diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index cff4e539e6e..7aa37b547f4 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -40,6 +40,7 @@ struct Ipo; struct Scene; struct bSound; +struct MovieClip; /* strlens; 256= FILE_MAXFILE, 768= FILE_MAXDIR */ @@ -88,9 +89,11 @@ typedef struct StripProxy { typedef struct Strip { struct Strip *next, *prev; - int rt, len, us, done; + int us, done; int startstill, endstill; - StripElem *stripdata; + StripElem *stripdata; /* only used as an array in IMAGE sequences(!), + and as a 1-element array in MOVIE sequences, + NULL for all other strip-types */ char dir[768]; StripProxy *proxy; StripCrop *crop; @@ -137,10 +140,11 @@ typedef struct Sequence { int startdisp, enddisp; /*starting and ending points in the sequence*/ float sat; float mul, handsize; - /* is sfra needed anymore? - it looks like its only used in one place */ - int sfra; /* starting frame according to the timeline of the scene. */ - int anim_preseek; - int streamindex; /* streamindex for movie or sound files with several streams */ + + short anim_preseek; + short streamindex; /* streamindex for movie or sound files with several streams */ + int multicam_source; /* for multicam source selection */ + int clip_flag; /* MOVIECLIP render flags */ Strip *strip; @@ -148,7 +152,9 @@ typedef struct Sequence { struct Scene *scene; struct Object *scene_camera; /* override scene camera */ - struct anim *anim; + struct anim *anim; /* for MOVIE strips */ + struct MovieClip *clip; /* for MOVIECLIP strips */ + float effect_fader; float speed_fader; @@ -164,8 +170,6 @@ typedef struct Sequence { float volume; float pitch, pan; /* pitch (-0.1..10), pan -2..2 */ - int scenenr; /* for scene selection */ - int multicam_source; /* for multicam source selection */ float strobe; void *effectdata; /* Struct pointer for effect settings */ @@ -173,9 +177,12 @@ typedef struct Sequence { int anim_startofs; /* only use part of animation file */ int anim_endofs; /* is subtle different to startofs / endofs */ + int blend_mode; float blend_opacity; + /* is sfra needed anymore? - it looks like its only used in one place */ + int sfra, pad; /* starting frame according to the timeline of the scene. */ } Sequence; typedef struct MetaStack { @@ -292,7 +299,7 @@ typedef struct SpeedControlVars { /* convenience define for all selection flags */ #define SEQ_ALLSEL (SELECT+SEQ_LEFTSEL+SEQ_RIGHTSEL) -/* deprecated, dont use a flag anymore*/ +/* deprecated, don't use a flag anymore*/ /*#define SEQ_ACTIVE 1048576*/ #define SEQ_COLOR_BALANCE_INVERSE_GAIN 1 @@ -321,6 +328,7 @@ typedef struct SpeedControlVars { #define SEQ_RAM_SOUND 4 #define SEQ_HD_SOUND 5 #define SEQ_SOUND 4 +#define SEQ_MOVIECLIP 6 #define SEQ_EFFECT 8 #define SEQ_CROSS 8 @@ -346,6 +354,9 @@ typedef struct SpeedControlVars { #define STRIPELEM_PREVIEW_DONE 1 +#define SEQ_MOVIECLIP_RENDER_UNDISTORTED (1<<0) +#define SEQ_MOVIECLIP_RENDER_STABILIZED (1<<1) + #define SEQ_BLEND_REPLACE 0 /* all other BLEND_MODEs are simple SEQ_EFFECT ids and therefore identical * to the table above. (Only those effects that handle _exactly_ two inputs, diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h index 894e1135c0d..26b3a3e6c62 100644 --- a/source/blender/makesdna/DNA_smoke_types.h +++ b/source/blender/makesdna/DNA_smoke_types.h @@ -109,8 +109,8 @@ typedef struct SmokeDomainSettings { /* flags */ #define MOD_SMOKE_FLOW_ABSOLUTE (1<<1) /*old style emission*/ -#define MOD_SMOKE_FLOW_INITVELOCITY (1<<2) /* passes particles speed to - the smoke*/ +#define MOD_SMOKE_FLOW_INITVELOCITY (1<<2) /* passes particles speed to the smoke */ +#define MOD_SMOKE_FLOW_INIT (1 << 3) /* is the flow object already initialized? */ typedef struct SmokeFlowSettings { @@ -128,11 +128,10 @@ typedef struct SmokeFlowSettings { int flags; /* absolute emission etc*/ } SmokeFlowSettings; -/* - struct BVHTreeFromMesh *bvh; - float mat[4][4]; - float mat_old[4][4]; - */ + +// struct BVHTreeFromMesh *bvh; +// float mat[4][4]; +// float mat_old[4][4]; /* collision objects (filled with smoke) */ typedef struct SmokeCollSettings { diff --git a/source/blender/makesdna/DNA_sound_types.h b/source/blender/makesdna/DNA_sound_types.h index 1fab63f9d63..6f67f1fd3c9 100644 --- a/source/blender/makesdna/DNA_sound_types.h +++ b/source/blender/makesdna/DNA_sound_types.h @@ -75,8 +75,9 @@ typedef struct bSound { int flags; int pad; -/** currently int type; - struct bSound *child_sound;*/ + /* unused currently + int type; + struct bSound *child_sound; */ /** * The audaspace handle for cache. @@ -94,17 +95,19 @@ typedef struct bSound { */ void *playback_handle; -/** XXX unused currently // SOUND_TYPE_LIMITER - float start, end;*/ + /* XXX unused currently (SOUND_TYPE_LIMITER) */ + /* float start, end; */ } bSound; -/* XXX unused currently +/* XXX unused currently */ +#if 0 typedef enum eSound_Type { SOUND_TYPE_INVALID = -1, SOUND_TYPE_FILE = 0, SOUND_TYPE_BUFFER, SOUND_TYPE_LIMITER -} eSound_Type;*/ +} eSound_Type; +#endif /* spacesound->flag */ #define SND_DRAWFRAMES 1 diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 8d9f52a78d4..a05dd491b69 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -215,10 +215,10 @@ typedef struct SpaceFile { ListBase *folders_next; /* holds the list of next directories (pushed from previous) to show */ /* operator that is invoking fileselect - op->exec() will be called on the 'Load' button. - if operator provides op->cancel(), then this will be invoked - on the cancel button. - */ + * 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 *smoothscroll_timer; @@ -348,7 +348,7 @@ typedef struct Script { char scriptname[1024]; /* 1024 = FILE_MAX */ char scriptarg[256]; /* 1024 = FILE_MAX */ } Script; -#define SCRIPT_SET_NULL(_script) _script->py_draw = _script->py_event = _script->py_button = _script->py_browsercallback = _script->py_globaldict = NULL; _script->flags = 0; +#define SCRIPT_SET_NULL(_script) _script->py_draw = _script->py_event = _script->py_button = _script->py_browsercallback = _script->py_globaldict = NULL; _script->flags = 0 typedef struct SpaceScript { SpaceLink *next, *prev; @@ -516,11 +516,13 @@ typedef struct SpaceClip { /* current stabilization data */ float loc[2], scale, angle; /* pre-composed stabilization data */ int pad; - float stabmat[4][4], unistabmat[4][4]; /* current stabilization matrix and the same matrix in unified space, - defined when drawing and used for mouse position calculation */ + float stabmat[4][4], unistabmat[4][4]; /* current stabilization matrix and the same matrix in unified space, + * defined when drawing and used for mouse position calculation */ /* movie postprocessing */ - int postproc_flag, pad2; + int postproc_flag; + + int runtime_flag; /* different runtime flags */ void *draw_context; } SpaceClip; @@ -635,7 +637,7 @@ enum FileSortTypeE { /* filesel types */ #define FILE_UNIX 8 -#define FILE_BLENDER 8 /* dont display relative paths */ +#define FILE_BLENDER 8 /* don't display relative paths */ #define FILE_SPECIAL 9 #define FILE_LOADLIB 1 @@ -693,7 +695,7 @@ enum FileSortTypeE { /* SpaceImage->sticky * Note DISABLE should be 0, however would also need to re-arrange icon order, - * also, sticky loc is the default mode so this means we dont need to 'do_versons' */ + * also, sticky loc is the default mode so this means we don't need to 'do_versons' */ #define SI_STICKY_LOC 0 #define SI_STICKY_DISABLE 1 #define SI_STICKY_VERTEX 2 @@ -705,7 +707,7 @@ enum FileSortTypeE { #define SI_DRAWTOOL (1<<3) #define SI_NO_DRAWFACES (1<<4) #define SI_DRAWSHADOW (1<<5) -#define SI_SELACTFACE (1<<6) /* deprecated */ +/* #define SI_SELACTFACE (1<<6) */ /* deprecated */ #define SI_DEPRECATED2 (1<<7) #define SI_DEPRECATED3 (1<<8) /* stick UV selection to mesh vertex (UVs wont always be touching) */ #define SI_COORDFLOATS (1<<9) @@ -866,7 +868,7 @@ enum { /* sseq->flag */ #define SEQ_DRAWFRAMES 1 #define SEQ_MARKER_TRANS 2 -#define SEQ_DRAW_COLOR_SEPERATED 4 +#define SEQ_DRAW_COLOR_SEPARATED 4 #define SEQ_DRAW_SAFE_MARGINS 8 #define SEQ_DRAW_GPENCIL 16 #define SEQ_NO_DRAW_CFRANUM 32 @@ -915,6 +917,9 @@ enum { #define SC_VIEW_CLIP 0 #define SC_VIEW_GRAPH 1 +/* SpaceClip->runtime_flag */ +#define SC_GRAPH_BOTTOM (1<<0) + /* space types, moved from DNA_screen_types.h */ /* Do NOT change order, append on end. types are hardcoded needed */ enum { diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index c6ffec2aff7..c026c2018fd 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -97,9 +97,9 @@ typedef struct MTex { #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. + * \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 @@ -232,7 +232,7 @@ typedef struct Tex { /* newnoise: distorted noise amount, musgrave & voronoi ouput scale */ float dist_amount, ns_outscale; - /* newnoise: voronoi nearest neighbour weights, minkovsky exponent, distance metric & color type */ + /* newnoise: voronoi nearest neighbor weights, minkovsky exponent, distance metric & color type */ float vn_w1; float vn_w2; float vn_w3; diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h index 03e731cf765..9c0f63028c1 100644 --- a/source/blender/makesdna/DNA_tracking_types.h +++ b/source/blender/makesdna/DNA_tracking_types.h @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * The Original Code is Copyright (C) 2011 Blender Foundation. * All rights reserved. * * The Original Code is: all of this file. @@ -218,6 +218,7 @@ enum { #define MARKER_TRACKED (1<<1) #define MARKER_GRAPH_SEL_X (1<<2) #define MARKER_GRAPH_SEL_Y (1<<3) +#define MARKER_GRAPH_SEL (MARKER_GRAPH_SEL_X|MARKER_GRAPH_SEL_Y) /* MovieTrackingTrack->flag */ #define TRACK_HAS_BUNDLE (1<<1) diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index d64c3133001..40c4a7fab9d 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -151,7 +151,7 @@ typedef struct ThemeUI { uiWidgetColors wcol_regular, wcol_tool, wcol_text; uiWidgetColors wcol_radio, wcol_option, wcol_toggle; uiWidgetColors wcol_num, wcol_numslider; - uiWidgetColors wcol_menu, wcol_pulldown, wcol_menu_back, wcol_menu_item; + uiWidgetColors wcol_menu, wcol_pulldown, wcol_menu_back, wcol_menu_item, wcol_tooltip; uiWidgetColors wcol_box, wcol_scroll, wcol_progress, wcol_list_item; uiWidgetStateColors wcol_state; @@ -205,7 +205,7 @@ typedef struct ThemeSpace { char grid[4]; char wire[4], select[4]; - char lamp[4], speaker[4], pad2[4]; + char lamp[4], speaker[4], empty[4],camera[4], pad[8]; char active[4], group[4], group_active[4], transform[4]; char vertex[4], vertex_select[4]; char edge[4], edge_select[4]; @@ -236,7 +236,7 @@ typedef struct ThemeSpace { char syntaxl[4], syntaxn[4], syntaxb[4]; // syntax for textwindow and nodes char syntaxv[4], syntaxc[4]; - char movie[4], image[4], scene[4], audio[4]; // for sequence editor + char movie[4], movieclip[4], image[4], scene[4], audio[4]; // for sequence editor char effect[4], plugin[4], transition[4], meta[4]; char editmesh_active[4]; @@ -422,6 +422,9 @@ typedef struct UserDef { int compute_device_type; int compute_device_id; + + float fcu_inactive_alpha; /* opacity of inactive F-Curves in F-Curve Editor */ + float pad; } UserDef; extern UserDef U; /* from blenkernel blender.c */ @@ -510,6 +513,7 @@ extern UserDef U; /* from blenkernel blender.c */ #define USER_SPLASH_DISABLE (1 << 27) #define USER_HIDE_RECENT (1 << 28) #define USER_SHOW_THUMBNAILS (1 << 29) +#define USER_QUIT_PROMPT (1 << 30) /* Auto-Keying mode */ /* AUTOKEY_ON is a bitflag */ @@ -617,13 +621,13 @@ extern UserDef U; /* from blenkernel blender.c */ #define NDOF_SHOULD_ZOOM (1 << 4) #define NDOF_SHOULD_ROTATE (1 << 5) /* orbit navigation modes - * only two options, so it's sort of a hyrbrid bool/enum + * only two options, so it's sort of a hybrid bool/enum * if ((U.ndof_flag & NDOF_ORBIT_MODE) == NDOF_OM_OBJECT)... */ -/* -#define NDOF_ORBIT_MODE (1 << 6) -#define NDOF_OM_TARGETCAMERA 0 -#define NDOF_OM_OBJECT NDOF_ORBIT_MODE -*/ + +// #define NDOF_ORBIT_MODE (1 << 6) +// #define NDOF_OM_TARGETCAMERA 0 +// #define NDOF_OM_OBJECT NDOF_ORBIT_MODE + /* actually... users probably don't care about what the mode * is called, just that it feels right */ /* zoom is up/down if this flag is set (otherwise forward/backward) */ diff --git a/source/blender/makesdna/DNA_vec_types.h b/source/blender/makesdna/DNA_vec_types.h index 0e832b8c95f..1420ca48c22 100644 --- a/source/blender/makesdna/DNA_vec_types.h +++ b/source/blender/makesdna/DNA_vec_types.h @@ -60,11 +60,11 @@ typedef struct vec2d { typedef struct vec3i { int x, y, z; } vec3i; - +*/ typedef struct vec3f { float x, y, z; } vec3f; - +/* typedef struct vec3d { double x, y, z; } vec3d; diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 0758e6e1713..fb4d4202b31 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -94,42 +94,45 @@ typedef struct RegionView3D { float viewmatob[4][4]; float persmatob[4][4]; - /* transform widget matrix */ - float twmat[4][4]; - float viewquat[4]; /* view rotation, must be kept normalized */ - float dist; /* distance from 'ofs' along -viewinv[2] vector, where result is negative as is 'ofs' */ - float zfac; /* initgrabz() result */ - float camdx, camdy; /* camera view offsets, 1.0 = viewplane moves entire width/height */ - float pixsize; /* runtime only */ - float ofs[3]; /* view center & orbit pivot, negative of worldspace location, - * also matches -viewinv[3][0:3] in ortho mode.*/ - short camzoom; /* viewport zoom on the camera frame, see BKE_screen_view3d_zoom_to_fac */ - short twdrawflag; - char is_persp; /* check if persp/ortho view, since 'persp' cant be used for this since - * it can have cameras assigned as well. (only set in setwinmatrixview3d) */ - char pad[3]; - - short rflag, viewlock; - short persp; - short view; - /* user defined clipping planes */ float clip[6][4]; float clip_local[6][4]; /* clip in object space, means we can test for clipping in editmode without first going into worldspace */ - struct BoundBox *clipbb; - + struct BoundBox *clipbb; + struct bGPdata *gpd; /* Grease-Pencil Data (annotation layers) */ - + struct RegionView3D *localvd; /* allocated backup of its self while in localview */ struct RenderInfo *ri; struct RenderEngine *render_engine; struct ViewDepths *depths; - + /* animated smooth view */ struct SmoothViewStore *sms; struct wmTimer *smooth_timer; + + + /* transform widget matrix */ + float twmat[4][4]; + + float viewquat[4]; /* view rotation, must be kept normalized */ + float dist; /* distance from 'ofs' along -viewinv[2] vector, where result is negative as is 'ofs' */ + float zfac; /* initgrabz() result */ + float camdx, camdy; /* camera view offsets, 1.0 = viewplane moves entire width/height */ + float pixsize; /* runtime only */ + float ofs[3]; /* view center & orbit pivot, negative of worldspace location, + * also matches -viewinv[3][0:3] in ortho mode.*/ + float camzoom; /* viewport zoom on the camera frame, see BKE_screen_view3d_zoom_to_fac */ + char is_persp; /* check if persp/ortho view, since 'persp' cant be used for this since + * it can have cameras assigned as well. (only set in setwinmatrixview3d) */ + char persp; + char view; + char viewlock; + + short twdrawflag; + short rflag; + /* last view */ float lviewquat[4]; short lpersp, lview; /* lpersp can never be set to 'RV3D_CAMOB' */ @@ -137,11 +140,10 @@ typedef struct RegionView3D { float twangle[3]; + /* active rotation from NDOF or elsewhere */ float rot_angle; float rot_axis[3]; - - char pad2[4]; } RegionView3D; @@ -312,6 +314,7 @@ typedef struct View3D { #define V3D_BGPIC_EXPANDED 2 #define V3D_BGPIC_CAMERACLIP 4 #define V3D_BGPIC_DISABLED 8 +#define V3D_BGPIC_FOREGROUND 16 /* BGPic->source */ /* may want to use 1 for select ?*/ diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index 3e6c46ba8b1..c86d9d17b1f 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -85,7 +85,7 @@ enum ReportListFlags { RPT_PRINT = 1, RPT_STORE = 2, RPT_FREE = 4, - RPT_OP_HOLD = 8 /* dont move them into the operator global list (caller will use) */ + RPT_OP_HOLD = 8 /* don't move them into the operator global list (caller will use) */ }; # # @@ -98,7 +98,7 @@ typedef struct Report { const char *message; } Report; -/* saved in the wm, dont remove */ +/* saved in the wm, don't remove */ typedef struct ReportList { ListBase list; int printlevel; /* ReportType */ @@ -159,7 +159,7 @@ typedef struct wmWindowManager { typedef struct wmWindow { struct wmWindow *next, *prev; - void *ghostwin; /* dont want to include ghost.h stuff */ + void *ghostwin; /* don't want to include ghost.h stuff */ int winid; /* winid also in screens, is for retrieving this window after read */ @@ -197,7 +197,7 @@ typedef struct wmWindow { ListBase gesture; /* gesture stuff */ } wmWindow; -/* should be somthing like DNA_EXCLUDE +/* should be something like DNA_EXCLUDE * but the preprocessor first removes all comments, spaces etc */ # diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h index 5482566ac41..b3c10406d4c 100644 --- a/source/blender/makesdna/DNA_world_types.h +++ b/source/blender/makesdna/DNA_world_types.h @@ -66,7 +66,7 @@ typedef struct World { /** * Exposure= mult factor. unused now, but maybe back later. Kept in to be upward compat. * New is exp/range control. linfac & logfac are constants... don't belong in - * file, but allocating 8 bytes for temp mem isnt useful either. + * file, but allocating 8 bytes for temp mem isn't useful either. */ float exposure, exp, range; float linfac, logfac; diff --git a/source/blender/makesdna/intern/SConscript b/source/blender/makesdna/intern/SConscript index 8185676cbfc..a819d827788 100644 --- a/source/blender/makesdna/intern/SConscript +++ b/source/blender/makesdna/intern/SConscript @@ -18,7 +18,7 @@ dna = env.Clone() makesdna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesdna/\\"" ') makesdna_tool.Append (CPPPATH = ['#/intern/guardedalloc', - '../../makesdna', '../../blenloader']) + '../../makesdna', '../../blenloader', '../../bmesh']) if env['OURPLATFORM'] == 'linuxcross': USE_WINE = True # when cross compiling on linux 64bit this is useful diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 5b115a404ce..ef7a2746d37 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -42,6 +42,7 @@ #include "MEM_guardedalloc.h" // for MEM_freeN MEM_mallocN MEM_callocN #ifdef WITH_DNA_GHASH +# include "BLI_utildefines.h" # include "BLI_ghash.h" #endif @@ -50,90 +51,90 @@ /* gcc 4.1 on mingw was complaining that __int64 was already defined -actually is saw the line below as typedef long long long long... -Anyhow, since its already defined, its safe to do an ifndef here- Campbell */ + * actually is saw the line below as typedef long long long long... + * Anyhow, since its already defined, its safe to do an ifndef here- Campbell */ #ifdef FREE_WINDOWS -#ifndef __int64 +# ifndef __int64 typedef long long __int64; -#endif +# 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 lengths, 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. - -*/ + * + * 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 lengths, 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, dependent 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); @@ -177,11 +178,11 @@ int DNA_elem_array_size(const char *astr, int len) memcpy(str, astr, len+1); - for(a=0; a<len; a++) { - if( str[a]== '[' ) { + for (a=0; a<len; a++) { + if ( str[a]== '[' ) { cp= &(str[a+1]); } - else if( str[a]==']' && cp) { + else if ( str[a]==']' && cp) { str[a]= 0; mul*= atoi(cp); } @@ -225,17 +226,17 @@ static int elementsize(SDNA *sdna, short type, short name) namelen= strlen(cp); /* is it a pointer or function pointer? */ - if(ispointer(cp)) { + if (ispointer(cp)) { /* has the naam an extra length? (array) */ mul= 1; - if( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen); + if ( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen); len= sdna->pointerlen*mul; } - else if( sdna->typelens[type] ) { + 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); + if ( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen); len= mul*sdna->typelens[type]; @@ -257,7 +258,7 @@ static void printstruct(SDNA *sdna, short strnr) nr= sp[1]; sp+= 2; - for(b=0; b< nr; b++, sp+= 2) { + for (b=0; b< nr; b++, sp+= 2) { printf(" %s %s\n", sdna->types[sp[0]], sdna->names[sp[1]]); } } @@ -269,11 +270,11 @@ static short *findstruct_name(SDNA *sdna, const char *str) short *sp= NULL; - for(a=0; a<sdna->nr_structs; a++) { + for (a=0; a<sdna->nr_structs; a++) { sp= sdna->structs[a]; - if(strcmp( sdna->types[ sp[0] ], str )==0) return sp; + if (strcmp( sdna->types[ sp[0] ], str )==0) return sp; } return NULL; @@ -283,9 +284,9 @@ int DNA_struct_find_nr(SDNA *sdna, const char *str) { short *sp= NULL; - if(sdna->lastfind<sdna->nr_structs) { + if (sdna->lastfind<sdna->nr_structs) { sp= sdna->structs[sdna->lastfind]; - if(strcmp( sdna->types[ sp[0] ], str )==0) return sdna->lastfind; + if (strcmp( sdna->types[ sp[0] ], str )==0) return sdna->lastfind; } #ifdef WITH_DNA_GHASH @@ -294,11 +295,11 @@ int DNA_struct_find_nr(SDNA *sdna, const char *str) { int a; - for(a=0; a<sdna->nr_structs; a++) { + for (a=0; a<sdna->nr_structs; a++) { sp= sdna->structs[a]; - if(strcmp( sdna->types[ sp[0] ], str )==0) { + if (strcmp( sdna->types[ sp[0] ], str )==0) { sdna->lastfind= a; return a; } @@ -324,16 +325,16 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) data= (int *)sdna->data; strcpy(str, "SDNA"); - if( *data == *verg ) { + if ( *data == *verg ) { data++; /* load names array */ strcpy(str, "NAME"); - if( *data == *verg ) { + if ( *data == *verg ) { data++; - if(do_endian_swap) sdna->nr_names= le_int(*data); + if (do_endian_swap) sdna->nr_names= le_int(*data); else sdna->nr_names= *data; data++; @@ -346,20 +347,20 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) nr= 0; cp= (char *)data; - while(nr<sdna->nr_names) { + while (nr<sdna->nr_names) { sdna->names[nr]= cp; /* "float gravity [3]" was parsed wrong giving both "gravity" and - "[3]" members. we rename "[3]", and later set the type of - "gravity" to "void" so the offsets work out correct */ - if(*cp == '[' && strcmp(cp, "[3]")==0) { - if(nr && strcmp(sdna->names[nr-1], "Cvi") == 0) { + * "[3]" members. we rename "[3]", and later set the type of + * "gravity" to "void" so the offsets work out correct */ + if (*cp == '[' && strcmp(cp, "[3]")==0) { + if (nr && strcmp(sdna->names[nr-1], "Cvi") == 0) { sdna->names[nr]= "gravity[3]"; gravity_fix= nr; } } - while( *cp) cp++; + while ( *cp) cp++; cp++; nr++; } @@ -370,10 +371,10 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) /* load type names array */ data= (int *)cp; strcpy(str, "TYPE"); - if( *data == *verg ) { + if ( *data == *verg ) { data++; - if(do_endian_swap) sdna->nr_types= le_int(*data); + if (do_endian_swap) sdna->nr_types= le_int(*data); else sdna->nr_types= *data; data++; @@ -386,18 +387,18 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) nr= 0; cp= (char *)data; - while(nr<sdna->nr_types) { + while (nr<sdna->nr_types) { sdna->types[nr]= cp; - /* this is a patch, to change struct names without a confict with SDNA */ + /* this is a patch, to change struct names without a conflict with SDNA */ /* be careful to use it, in this case for a system-struct (opengl/X) */ - if( *cp == 'b') { + 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; + if ( strcmp("bScreen", cp)==0 ) sdna->types[nr]= cp+1; } - while( *cp) cp++; + while ( *cp) cp++; cp++; nr++; } @@ -408,16 +409,16 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) /* load typelen array */ data= (int *)cp; strcpy(str, "TLEN"); - if( *data == *verg ) { + if ( *data == *verg ) { data++; sp= (short *)data; sdna->typelens= sp; - if(do_endian_swap) { + if (do_endian_swap) { short a, *spo= sp; a= sdna->nr_types; - while(a--) { + while (a--) { spo[0]= le_short(spo[0]); spo++; } @@ -429,15 +430,15 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) printf("TLEN error in SDNA file\n"); return; } - if(sdna->nr_types & 1) sp++; /* prevent BUS error */ + if (sdna->nr_types & 1) sp++; /* prevent BUS error */ /* load struct array */ data= (int *)sp; strcpy(str, "STRC"); - if( *data == *verg ) { + if ( *data == *verg ) { data++; - if(do_endian_swap) sdna->nr_structs= le_int(*data); + if (do_endian_swap) sdna->nr_structs= le_int(*data); else sdna->nr_structs= *data; data++; @@ -450,10 +451,10 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) nr= 0; sp= (short *)data; - while(nr<sdna->nr_structs) { + while (nr<sdna->nr_structs) { sdna->structs[nr]= sp; - if(do_endian_swap) { + if (do_endian_swap) { short a; sp[0]= le_short(sp[0]); @@ -461,7 +462,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) a= sp[1]; sp+= 2; - while(a--) { + while (a--) { sp[0]= le_short(sp[0]); sp[1]= le_short(sp[1]); sp+= 2; @@ -480,17 +481,17 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) sdna->pointerlen= sdna->typelens[ sp[0] ]/2; - if(sp[1]!=2 || (sdna->pointerlen!=4 && sdna->pointerlen!=8)) { + 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) */ } /* second part of gravity problem, setting "gravity" type to void */ - if(gravity_fix > -1) { - for(nr=0; nr<sdna->nr_structs; nr++) { + if (gravity_fix > -1) { + for (nr=0; nr<sdna->nr_structs; nr++) { sp= sdna->structs[nr]; - if(strcmp(sdna->types[sp[0]], "ClothSimSettings") == 0) + if (strcmp(sdna->types[sp[0]], "ClothSimSettings") == 0) sp[10]= SDNA_TYPE_VOID; } } @@ -499,7 +500,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) /* create a ghash lookup to speed up */ sdna->structs_map= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "init_structDNA gh"); - for(nr = 0; nr < sdna->nr_structs; nr++) { + for (nr = 0; nr < sdna->nr_structs; nr++) { sp= sdna->structs[nr]; BLI_ghash_insert(sdna->structs_map, (void *)sdna->types[sp[0]], (void *)(nr + 1)); } @@ -536,15 +537,15 @@ static void recurs_test_compflags(SDNA *sdna, char *compflags, int structnr) sp= sdna->structs[structnr]; typenr= sp[0]; - for(a=0; a<sdna->nr_structs; a++) { - if(a!=structnr && compflags[a]==1) { + 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) { + for (b=0; b<elems; b++, sp+=2) { + if (sp[0]==typenr) { cp= sdna->names[ sp[1] ]; - if(!ispointer(cp)) { + if (!ispointer(cp)) { compflags[a]= 2; recurs_test_compflags(sdna, compflags, a); } @@ -577,7 +578,7 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna) const char *str1, *str2; char *compflags; - if(sdna->nr_structs==0) { + if (sdna->nr_structs==0) { printf("error: file without SDNA\n"); return NULL; } @@ -588,42 +589,42 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna) * the structs in 'newsdna' */ - for(a=0; a<sdna->nr_structs; a++) { + 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) { + 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]] ) { + 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) { + while (b > 0) { str1= newsdna->types[spcur[0]]; str2= sdna->types[spold[0]]; - if(strcmp(str1, str2)!=0) break; + if (strcmp(str1, str2)!=0) break; str1= newsdna->names[spcur[1]]; str2= sdna->names[spold[1]]; - if(strcmp(str1, str2)!=0) break; + if (strcmp(str1, str2)!=0) break; /* same type and same name, now pointersize */ - if(ispointer(str1)) { - if(sdna->pointerlen!=newsdna->pointerlen) break; + if (ispointer(str1)) { + if (sdna->pointerlen!=newsdna->pointerlen) break; } b--; spold+= 2; spcur+= 2; } - if(b==0) compflags[a]= 1; + if (b==0) compflags[a]= 1; } } @@ -639,18 +640,18 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna) /* 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) recurs_test_compflags(sdna, compflags, a); } -/* - for(a=0; a<sdna->nr_structs; a++) { - if(compflags[a]==2) { +#if 0 + for (a=0; a<sdna->nr_structs; a++) { + if (compflags[a]==2) { spold= sdna->structs[a]; printf("changed: %s\n", sdna->types[ spold[0] ]); } } -*/ +#endif return compflags; } @@ -658,16 +659,16 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna) static eSDNA_Type sdna_type_nr(const char *dna_type) { if ((strcmp(dna_type, "char")==0) || (strcmp(dna_type, "const char")==0)) return SDNA_TYPE_CHAR; - else if((strcmp(dna_type, "uchar")==0) || (strcmp(dna_type, "unsigned char")==0)) return SDNA_TYPE_UCHAR; - else if( strcmp(dna_type, "short")==0) return SDNA_TYPE_SHORT; - else if((strcmp(dna_type, "ushort")==0)||(strcmp(dna_type, "unsigned short")==0)) return SDNA_TYPE_USHORT; - else if( strcmp(dna_type, "int")==0) return SDNA_TYPE_INT; - else if( strcmp(dna_type, "long")==0) return SDNA_TYPE_LONG; - else if((strcmp(dna_type, "ulong")==0)||(strcmp(dna_type, "unsigned long")==0)) return SDNA_TYPE_ULONG; - else if( strcmp(dna_type, "float")==0) return SDNA_TYPE_FLOAT; - else if( strcmp(dna_type, "double")==0) return SDNA_TYPE_DOUBLE; - else if( strcmp(dna_type, "int64_t")==0) return SDNA_TYPE_INT64; - else if( strcmp(dna_type, "uint64_t")==0) return SDNA_TYPE_UINT64; + else if ((strcmp(dna_type, "uchar")==0) || (strcmp(dna_type, "unsigned char")==0)) return SDNA_TYPE_UCHAR; + else if ( strcmp(dna_type, "short")==0) return SDNA_TYPE_SHORT; + else if ((strcmp(dna_type, "ushort")==0)||(strcmp(dna_type, "unsigned short")==0)) return SDNA_TYPE_USHORT; + else if ( strcmp(dna_type, "int")==0) return SDNA_TYPE_INT; + else if ( strcmp(dna_type, "long")==0) return SDNA_TYPE_LONG; + else if ((strcmp(dna_type, "ulong")==0)||(strcmp(dna_type, "unsigned long")==0)) return SDNA_TYPE_ULONG; + else if ( strcmp(dna_type, "float")==0) return SDNA_TYPE_FLOAT; + else if ( strcmp(dna_type, "double")==0) return SDNA_TYPE_DOUBLE; + else if ( strcmp(dna_type, "int64_t")==0) return SDNA_TYPE_INT64; + else if ( strcmp(dna_type, "uint64_t")==0) return SDNA_TYPE_UINT64; else return -1; /* invalid! */ } @@ -690,7 +691,7 @@ static void cast_elem(const char *ctype, const char *otype, const char *name, ch oldlen= DNA_elem_type_size(otypenr); curlen= DNA_elem_type_size(ctypenr); - while(arrlen>0) { + while (arrlen>0) { switch(otypenr) { case SDNA_TYPE_CHAR: val= *olddata; break; @@ -732,10 +733,10 @@ static void cast_elem(const char *ctype, const char *otype, const char *name, ch case SDNA_TYPE_ULONG: *( (unsigned int *)curdata)= val; break; case SDNA_TYPE_FLOAT: - if(otypenr<2) val/= 255; + if (otypenr<2) val/= 255; *( (float *)curdata)= val; break; case SDNA_TYPE_DOUBLE: - if(otypenr<2) val/= 255; + if (otypenr<2) val/= 255; *( (double *)curdata)= val; break; case SDNA_TYPE_INT64: *( (int64_t *)curdata)= val; break; @@ -760,12 +761,12 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata arrlen= DNA_elem_array_size(name, strlen(name)); - while(arrlen>0) { + while (arrlen>0) { - if(curlen==oldlen) { + if (curlen==oldlen) { memcpy(curdata, olddata, curlen); } - else if(curlen==4 && oldlen==8) { + else if (curlen==4 && oldlen==8) { #ifdef WIN32 lval= *( (__int64 *)olddata ); #else @@ -773,7 +774,7 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata #endif *((int *)curdata) = lval>>3; /* is of course gambling! */ } - else if(curlen==8 && oldlen==4) { + else if (curlen==8 && oldlen==4) { #ifdef WIN32 *( (__int64 *)curdata ) = *((int *)olddata); #else @@ -782,7 +783,7 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata } else { /* for debug */ - printf("errpr: illegal pointersize! \n"); + printf("errpr: illegal pointersize!\n"); } olddata+= oldlen; @@ -798,10 +799,10 @@ static int elem_strcmp(const char *name, const char *oname) /* strcmp without array part */ - while(1) { - if(name[a] != oname[a]) return 1; - if(name[a]=='[') break; - if(name[a]==0) break; + while (1) { + if (name[a] != oname[a]) return 1; + if (name[a]=='[') break; + if (name[a]==0) break; a++; } return 0; @@ -817,16 +818,16 @@ static char *find_elem(SDNA *sdna, const char *type, const char *name, short *ol /* in old is the old struct */ elemcount= old[1]; old+= 2; - for(a=0; a<elemcount; a++, 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; + if ( elem_strcmp(name, oname)==0 ) { /* naam equal */ + if ( strcmp(type, otype)==0 ) { /* type equal */ + if (sppo) *sppo= old; return olddata; } @@ -842,14 +843,14 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, char *type, const 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?) - */ + * - 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; const char *oname, *cp; @@ -857,53 +858,53 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, /* is 'name' an array? */ cp= name; array= 0; - while( *cp && *cp!='[') { + while ( *cp && *cp!='[') { cp++; array++; } - if( *cp!= '[' ) array= 0; + if ( *cp!= '[' ) array= 0; /* in old is the old struct */ elemcount= old[1]; old+= 2; - for(a=0; a<elemcount; a++, 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 ( strcmp(name, oname)==0 ) { /* name equal */ - if(ispointer(name)) { /* pointer of functionpointer afhandelen */ + if (ispointer(name)) { /* pointer of functionpointer afhandelen */ cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, name, curdata, olddata); } - else if( strcmp(type, otype)==0 ) { /* type equal */ + 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 */ + else if (array) { /* name is an array */ - if(oname[array]=='[' && strncmp(name, oname, array)==0 ) { /* basis equal */ + 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); + 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 */ + else if (name[0]=='*' || strcmp(type, otype)==0 ) { /* type equal */ mul= len/oldsize; mul*= (cursize < oldsize)? cursize: oldsize; memcpy(curdata, olddata, mul); /* terminate strings */ - if(oldsize > cursize && strcmp(type, "char")==0) + if (oldsize > cursize && strcmp(type, "char")==0) curdata[mul-1]= 0; } else { - if(cursize>oldsize) cast_elem(type, otype, oname, curdata, olddata); + if (cursize>oldsize) cast_elem(type, otype, oname, curdata, olddata); else cast_elem(type, otype, name, curdata, olddata); } return; @@ -925,10 +926,10 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna, char *type, *cpo, *cpc; const char *name, *nameo; - if(oldSDNAnr== -1) return; - if(curSDNAnr== -1) return; + if (oldSDNAnr== -1) return; + if (curSDNAnr== -1) return; - if( compflags[oldSDNAnr]==1 ) { /* if recursive: test for equal */ + if ( compflags[oldSDNAnr]==1 ) { /* if recursive: test for equal */ spo= oldsdna->structs[oldSDNAnr]; elen= oldsdna->typelens[ spo[0] ]; @@ -946,19 +947,19 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna, spc+= 2; cpc= cur; - for(a=0; a<elemcount; a++, spc+=2) { + 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)) { + 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) { + if (cpo) { oldSDNAnr= DNA_struct_find_nr(oldsdna, type); curSDNAnr= DNA_struct_find_nr(newsdna, type); @@ -972,14 +973,14 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna, elen/= mul; eleno/= mulo; - while(mul--) { + 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; + if (mulo<=0) break; } } else cpc+= elen; @@ -1003,7 +1004,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) char *type, *cpo, *cur, cval; const char *name; - if(oldSDNAnr== -1) return; + if (oldSDNAnr== -1) return; firststructtypenr= *(oldsdna->structs[0]); spo= spc= oldsdna->structs[oldSDNAnr]; @@ -1013,7 +1014,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) spc+= 2; cur= data; - for(a=0; a<elemcount; a++, spc+=2) { + for (a=0; a<elemcount; a++, spc+=2) { type= oldsdna->types[spc[0]]; name= oldsdna->names[spc[1]]; @@ -1021,16 +1022,16 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) elen= elementsize(oldsdna, spc[0], spc[1]); /* test: is type a struct? */ - if(spc[0]>=firststructtypenr && !ispointer(name)) { + if (spc[0]>=firststructtypenr && !ispointer(name)) { /* where does the old data start (is there one?) */ cpo= find_elem(oldsdna, type, name, spo, data, NULL); - if(cpo) { + if (cpo) { oldSDNAnr= DNA_struct_find_nr(oldsdna, type); mul= DNA_elem_array_size(name, strlen(name)); elena= elen/mul; - while(mul--) { + while (mul--) { DNA_struct_switch_endian(oldsdna, oldSDNAnr, cpo); cpo += elena; } @@ -1038,12 +1039,12 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) } else { - if(ispointer(name)) { - if(oldsdna->pointerlen==8) { + if (ispointer(name)) { + if (oldsdna->pointerlen==8) { mul= DNA_elem_array_size(name, strlen(name)); cpo= cur; - while(mul--) { + 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; @@ -1062,17 +1063,17 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) /* exception: variable called blocktype/ipowin: derived from ID_ */ skip= 0; - if(name[0]=='b' && name[1]=='l') { - if(strcmp(name, "blocktype")==0) skip= 1; + 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; + else if (name[0]=='i' && name[1]=='p') { + if (strcmp(name, "ipowin")==0) skip= 1; } - if(skip==0) { + if (skip==0) { mul= DNA_elem_array_size(name, strlen(name)); cpo= cur; - while(mul--) { + while (mul--) { cval= cpo[0]; cpo[0]= cpo[1]; cpo[1]= cval; @@ -1088,7 +1089,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) mul= DNA_elem_array_size(name, strlen(name)); cpo= cur; - while(mul--) { + while (mul--) { cval= cpo[0]; cpo[0]= cpo[3]; cpo[3]= cval; @@ -1103,7 +1104,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) { mul= DNA_elem_array_size(name, strlen(name)); cpo= cur; - while(mul--) { + 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; @@ -1131,18 +1132,18 @@ void *DNA_struct_reconstruct(SDNA *newsdna, SDNA *oldsdna, char *compflags, int curSDNAnr= DNA_struct_find_nr(newsdna, type); /* init data and alloc */ - if(curSDNAnr >= 0) { + if (curSDNAnr >= 0) { spc= newsdna->structs[curSDNAnr]; curlen= newsdna->typelens[ spc[0] ]; } - if(curlen==0) { + if (curlen==0) { return NULL; } cur= MEM_callocN( blocks*curlen, "reconstruct"); cpc= cur; cpo= data; - for(a=0; a<blocks; a++) { + for (a=0; a<blocks; a++) { reconstruct_struct(newsdna, oldsdna, compflags, oldSDNAnr, cpo, curSDNAnr, cpc); cpc+= curlen; cpo+= oldlen; diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 2fa52776453..deb3b88a910 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -46,9 +46,7 @@ * There is a facility to get verbose output from sdna. Search for * \ref debugSDNA. This int can be set to 0 (no output) to some int. Higher * numbers give more output. - * */ - -#define DNA_VERSION_DATE "FIXME-DNA_VERSION_DATE" + */ #include <string.h> #include <stdlib.h> @@ -148,9 +146,9 @@ static char **types, *typedata; /* at address types[a] is string a */ static short *typelens; /* at typelens[a] is de length of type a */ static short *alphalens; /* contains sizes as they are calculated on the DEC Alpha (64 bits), infact any 64bit system */ static short **structs, *structdata;/* at sp= structs[a] is the first address of a struct definition - sp[0] is type number - sp[1] is amount of elements - sp[2] sp[3] is typenr, namenr (etc) */ + * sp[0] is type number + * sp[1] is amount of elements + * sp[2] sp[3] is typenr, namenr (etc) */ /** * Variable to control debug output of makesdna. * debugSDNA: @@ -229,11 +227,19 @@ static int add_type(const char *str, int len) int nr; char *cp; - if(str[0]==0) return -1; + /* first do validity check */ + if (str[0]==0) { + return -1; + } + else if (strchr(str, '*')) { + /* note: this is valid C syntax but we can't parse, complain! + * 'struct SomeStruct* somevar;' <-- correct but we cant handle right now. */ + return -1; + } /* search through type array */ - for(nr=0; nr<nr_types; nr++) { - if(strcmp(str, types[nr])==0) { + for (nr=0; nr<nr_types; nr++) { + if (strcmp(str, types[nr])==0) { if (len) { typelens[nr]= len; alphalens[nr] = len; @@ -243,7 +249,7 @@ static int add_type(const char *str, int len) } /* append new type */ - if(nr_types==0) cp= typedata; + if (nr_types==0) cp= typedata; else { cp= types[nr_types-1]+strlen(types[nr_types-1])+1; } @@ -252,7 +258,7 @@ static int add_type(const char *str, int len) typelens[nr_types]= len; alphalens[nr_types]= len; - if(nr_types>=maxnr) { + if (nr_types>=maxnr) { printf("too many types\n"); return nr_types-1; } @@ -279,13 +285,13 @@ static int add_name(const char *str) additional_slen_offset = 0; - if(str[0]==0 /* || (str[1]==0) */) return -1; + if (str[0]==0 /* || (str[1]==0) */) return -1; if (str[0] == '(' && str[1] == '*') { /* we handle function pointer and special array cases here, e.g. - void (*function)(...) and float (*array)[..]. the array case - name is still converted to (array*)() though because it is that - way in old dna too, and works correct with elementsize() */ + * void (*function)(...) and float (*array)[..]. the array case + * name is still converted to (array*)() though because it is that + * way in old dna too, and works correct with elementsize() */ int isfuncptr = (strchr(str+1, '(')) != NULL; if (debugSDNA > 3) printf("\t\t\t\t*** Function pointer or multidim array pointer found\n"); @@ -306,16 +312,16 @@ static int add_name(const char *str) j++; /* j beyond closing brace ? */ while ((str[j] != 0) && (str[j] != ')' )) { - if (debugSDNA > 3) printf("seen %c ( %d) \n", str[j], str[j]); + if (debugSDNA > 3) printf("seen %c ( %d)\n", str[j], str[j]); j++; } - if (debugSDNA > 3) printf("seen %c ( %d) \n" + if (debugSDNA > 3) printf("seen %c ( %d)\n" "special after offset%d\n", str[j], str[j], j); if (!isfuncptr) { /* multidimensional array pointer case */ - if(str[j] == 0) { + if (str[j] == 0) { if (debugSDNA > 3) printf("offsetting for multidim array pointer\n"); } else @@ -331,10 +337,12 @@ static int add_name(const char *str) } if (debugSDNA > 3) printf("extra offset %d\n", k); additional_slen_offset = k; - } else if (str[j] == ')' ) { + } + else if (str[j] == ')' ) { if (debugSDNA > 3) printf("offsetting for brace\n"); ; /* don't get extra offset */ - } else { + } + else { printf("Error during tokening function pointer argument list\n"); } @@ -362,7 +370,8 @@ static int add_name(const char *str) buf[i+5] = 'd'; buf[i+6] = ')'; buf[i+7] = 0; - } else { + } + else { buf[i] = ')'; buf[i+1] = '('; buf[i+2] = ')'; @@ -371,27 +380,28 @@ static int add_name(const char *str) /* now precede with buf*/ if (debugSDNA > 3) printf("\t\t\t\t\tProposing fp name %s\n", buf); name = buf; - } else { + } + else { /* normal field: old code */ name = str; } /* search name array */ - for(nr=0; nr<nr_names; nr++) { - if(strcmp(name, names[nr])==0) { + for (nr=0; nr<nr_names; nr++) { + if (strcmp(name, names[nr])==0) { return nr; } } /* append new type */ - if(nr_names==0) cp= namedata; + if (nr_names==0) cp= namedata; else { cp= names[nr_names-1]+strlen(names[nr_names-1])+1; } strcpy(cp, name); names[nr_names]= cp; - if(nr_names>=maxnr) { + if (nr_names>=maxnr) { printf("too many names\n"); return nr_names-1; } @@ -405,7 +415,7 @@ static short *add_struct(int namecode) int len; short *sp; - if(nr_structs==0) { + if (nr_structs==0) { structs[0]= structdata; } else { @@ -417,7 +427,7 @@ static short *add_struct(int namecode) sp= structs[nr_structs]; sp[0]= namecode; - if(nr_structs>=maxnr) { + if (nr_structs>=maxnr) { printf("too many structs\n"); return sp; } @@ -443,10 +453,11 @@ static int preprocess_include(char *maindata, int len) cp= temp; a= len; comment = 0; - while(a--) { - if(cp[0]=='/' && cp[1]=='/') { + while (a--) { + if (cp[0]=='/' && cp[1]=='/') { comment = 1; - } else if (*cp<32) { + } + else if (*cp<32) { comment = 0; } if (comment || *cp<32 || *cp>128 ) *cp= 32; @@ -460,21 +471,21 @@ static int preprocess_include(char *maindata, int len) newlen= 0; comment= 0; a= len; - while(a--) { + while (a--) { - if(cp[0]=='/' && cp[1]=='*') { + if (cp[0]=='/' && cp[1]=='*') { comment= 1; cp[0]=cp[1]= 32; } - if(cp[0]=='*' && cp[1]=='/') { + if (cp[0]=='*' && cp[1]=='/') { comment= 0; cp[0]=cp[1]= 32; } /* do not copy when: */ - if(comment); - else if( cp[0]==' ' && cp[1]==' ' ); - else if( cp[-1]=='*' && cp[0]==' ' ); /* pointers with a space */ + if (comment); + else if ( cp[0]==' ' && cp[1]==' ' ); + else if ( cp[-1]=='*' && cp[0]==' ' ); /* pointers with a space */ /* skip special keywords */ else if (strncmp("DNA_DEPRECATED", cp, 14)==0) { @@ -533,8 +544,8 @@ static void *read_file_data(char *filename, int *len_r) static int convert_include(char *filename) { /* read include file, skip structs with a '#' before it. - store all data in temporal arrays. - */ + * store all data in temporal arrays. + */ int filelen, count, overslaan, slen, type, name, strct; short *structpoin, *sp; char *maindata, *mainend, *md, *md1; @@ -551,29 +562,33 @@ static int convert_include(char *filename) /* we look for '{' and then back to 'struct' */ count= 0; overslaan= 0; - while(count<filelen) { + while (count<filelen) { /* code for skipping a struct: two hashes on 2 lines. (preprocess added a space) */ - if(md[0]=='#' && md[1]==' ' && md[2]=='#') { + if (md[0]=='#' && md[1]==' ' && md[2]=='#') { overslaan= 1; } - if(md[0]=='{') { + if (md[0]=='{') { md[0]= 0; - if(overslaan) { + if (overslaan) { overslaan= 0; } else { - if(md[-1]==' ') md[-1]= 0; + if (md[-1]==' ') md[-1]= 0; md1= md-2; - while( *md1!=32) md1--; /* to beginning of word */ + while ( *md1!=32) md1--; /* to beginning of word */ md1++; /* we've got a struct name when... */ - if( strncmp(md1-7, "struct", 6)==0 ) { + if ( strncmp(md1-7, "struct", 6)==0 ) { + + strct = add_type(md1, 0); + if (strct == -1) { + printf("File '%s' contains struct we cant parse \"%s\"\n", filename, md1); + return 1; + } - - strct= add_type(md1, 0); structpoin= add_struct(strct); sp= structpoin+2; @@ -581,26 +596,30 @@ static int convert_include(char *filename) /* first lets make it all nice strings */ md1= md+1; - while(*md1 != '}') { - if(md1>mainend) break; + while (*md1 != '}') { + if (md1>mainend) break; - if(*md1==',' || *md1==' ') *md1= 0; + if (*md1==',' || *md1==' ') *md1= 0; md1++; } /* read types and names until first character that is not '}' */ md1= md+1; - while( *md1 != '}' ) { - if(md1>mainend) break; + while ( *md1 != '}' ) { + if (md1>mainend) break; /* skip when it says 'struct' or 'unsigned' or 'const' */ - if(*md1) { - if( strncmp(md1, "struct", 6)==0 ) md1+= 7; - if( strncmp(md1, "unsigned", 8)==0 ) md1+= 9; - if( strncmp(md1, "const", 5)==0 ) md1+= 6; + if (*md1) { + if ( strncmp(md1, "struct", 6)==0 ) md1+= 7; + if ( strncmp(md1, "unsigned", 8)==0 ) md1+= 9; + if ( strncmp(md1, "const", 5)==0 ) md1+= 6; /* we've got a type! */ type= add_type(md1, 0); + if (type == -1) { + printf("File '%s' contains struct we can't parse \"%s\"\n", filename, md1); + return 1; + } if (debugSDNA > 1) printf("\t|\t|\tfound type %s (", md1); @@ -608,15 +627,15 @@ static int convert_include(char *filename) /* read until ';' */ - while( *md1 != ';' ) { - if(md1>mainend) break; + while ( *md1 != ';' ) { + if (md1>mainend) break; - if(*md1) { + if (*md1) { /* We've got a name. slen needs * correction for function * pointers! */ slen= (int) strlen(md1); - if( md1[slen-1]==';' ) { + if ( md1[slen-1]==';' ) { md1[slen-1]= 0; @@ -674,11 +693,11 @@ static int arraysize(char *astr, int len) memcpy(str, astr, len+1); - for(a=0; a<len; a++) { - if( str[a]== '[' ) { + for (a=0; a<len; a++) { + if ( str[a]== '[' ) { cp= &(str[a+1]); } - else if( str[a]==']' && cp) { + else if ( str[a]==']' && cp) { str[a]= 0; /* if 'cp' is a preprocessor definition, it will evaluate to 0, * the caller needs to check for this case and throw an error */ @@ -696,17 +715,17 @@ static int calculate_structlens(int firststruct) char *cp; int has_pointer, dna_error = 0; - while(unknown) { + while (unknown) { lastunknown= unknown; unknown= 0; /* check all structs... */ - for(a=0; a<nr_structs; a++) { + for (a=0; a<nr_structs; a++) { structpoin= structs[a]; structtype= structpoin[0]; /* when length is not known... */ - if(typelens[structtype]==0) { + if (typelens[structtype]==0) { sp= structpoin+2; len= 0; @@ -714,17 +733,17 @@ static int calculate_structlens(int firststruct) has_pointer = 0; /* check all elements in struct */ - for(b=0; b<structpoin[1]; b++, sp+=2) { + for (b=0; b<structpoin[1]; b++, sp+=2) { type= sp[0]; cp= names[sp[1]]; namelen= (int) strlen(cp); /* is it a pointer or function pointer? */ - if(cp[0]=='*' || cp[1]=='*') { + if (cp[0]=='*' || cp[1]=='*') { has_pointer = 1; /* has the name an extra length? (array) */ mul= 1; - if( cp[namelen-1]==']') mul= arraysize(cp, namelen); + if ( cp[namelen-1]==']') mul= arraysize(cp, namelen); if (mul == 0) { printf("Zero array size found or could not parse %s: '%.*s'\n", types[structtype], namelen + 1, cp); @@ -732,12 +751,13 @@ static int calculate_structlens(int firststruct) } /* 4-8 aligned/ */ - if(sizeof(void *) == 4) { + if (sizeof(void *) == 4) { if (len % 4) { printf("Align pointer error in struct (len4): %s %s\n", types[structtype], cp); dna_error = 1; } - } else { + } + else { if (len % 8) { printf("Align pointer error in struct (len8): %s %s\n", types[structtype], cp); dna_error = 1; @@ -752,14 +772,16 @@ static int calculate_structlens(int firststruct) len += sizeof(void *) * mul; alphalen += 8 * mul; - } else if(cp[0]=='[') { + } + else if (cp[0]=='[') { /* parsing can cause names "var" and "[3]" to be found for "float var [3]" ... */ printf("Parse error in struct, invalid member name: %s %s\n", types[structtype], cp); dna_error = 1; - } else if( typelens[type] ) { + } + else if ( typelens[type] ) { /* has the name an extra length? (array) */ mul= 1; - if( cp[namelen-1]==']') mul= arraysize(cp, namelen); + if ( cp[namelen-1]==']') mul= arraysize(cp, namelen); if (mul == 0) { printf("Zero array size found or could not parse %s: '%.*s'\n", types[structtype], namelen + 1, cp); @@ -767,19 +789,19 @@ static int calculate_structlens(int firststruct) } /* struct alignment */ - if(type >= firststruct) { - if(sizeof(void *)==8 && (len % 8) ) { + if (type >= firststruct) { + if (sizeof(void *)==8 && (len % 8) ) { printf("Align struct error: %s %s\n", types[structtype],cp); dna_error = 1; } } /* 2-4 aligned/ */ - if(typelens[type]>3 && (len % 4) ) { + if (typelens[type]>3 && (len % 4) ) { printf("Align 4 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len%4); dna_error = 1; } - else if(typelens[type]==2 && (len % 2) ) { + else if (typelens[type]==2 && (len % 2) ) { printf("Align 2 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len%2); dna_error = 1; } @@ -787,7 +809,8 @@ static int calculate_structlens(int firststruct) len += mul*typelens[type]; alphalen += mul * alphalens[type]; - } else { + } + else { len= 0; alphalen = 0; break; @@ -796,7 +819,8 @@ static int calculate_structlens(int firststruct) if (len==0) { unknown++; - } else { + } + else { typelens[structtype]= len; alphalens[structtype]= alphalen; // two ways to detect if a struct contains a pointer: @@ -808,7 +832,7 @@ static int calculate_structlens(int firststruct) } } - if(len % 4) { + if (len % 4) { printf("Sizeerror 4 in struct: %s (add %d bytes)\n", types[structtype], len%4); dna_error = 1; } @@ -817,35 +841,35 @@ static int calculate_structlens(int firststruct) } } - if(unknown==lastunknown) break; + if (unknown==lastunknown) break; } - if(unknown) { + if (unknown) { printf("ERROR: still %d structs unknown\n", unknown); if (debugSDNA) { - printf("*** Known structs : \n"); + printf("*** Known structs :\n"); - for(a=0; a<nr_structs; a++) { + for (a=0; a<nr_structs; a++) { structpoin= structs[a]; structtype= structpoin[0]; /* length unknown */ - if(typelens[structtype]!=0) { + if (typelens[structtype]!=0) { printf(" %s\n", types[structtype]); } } } - printf("*** Unknown structs : \n"); + printf("*** Unknown structs :\n"); - for(a=0; a<nr_structs; a++) { + for (a=0; a<nr_structs; a++) { structpoin= structs[a]; structtype= structpoin[0]; - /* length unkown yet */ - if(typelens[structtype]==0) { + /* length unknown yet */ + if (typelens[structtype]==0) { printf(" %s\n", types[structtype]); } } @@ -882,12 +906,12 @@ void printStructLenghts(void) short *structpoin; printf("\n\n*** All detected structs:\n"); - while(unknown) { + while (unknown) { /*lastunknown= unknown;*/ /*UNUSED*/ unknown= 0; /* check all structs... */ - for(a=0; a<nr_structs; a++) { + for (a=0; a<nr_structs; a++) { structpoin= structs[a]; structtype= structpoin[0]; printf("\t%s\t:%d\n", types[structtype], typelens[structtype]); @@ -911,7 +935,6 @@ static int make_structDNA(char *baseDirectory, FILE *file) if (debugSDNA > -1) { fflush(stdout); printf("Running makesdna at debug level %d\n", debugSDNA); - printf("\tProgram version: %s\n", DNA_VERSION_DATE); } /* the longest known struct is 50k, so we assume 100k is sufficent! */ @@ -965,31 +988,30 @@ static int make_structDNA(char *baseDirectory, FILE *file) } /* FOR DEBUG */ - if (debugSDNA > 1) - { + if (debugSDNA > 1) { int a,b; /* short *elem; */ short num_types; printf("nr_names %d nr_types %d nr_structs %d\n", nr_names, nr_types, nr_structs); - for(a=0; a<nr_names; a++) { - printf(" %s \n", names[a]); + for (a=0; a<nr_names; a++) { + printf(" %s\n", names[a]); } printf("\n"); sp= typelens; - for(a=0; a<nr_types; a++, sp++) { + for (a=0; a<nr_types; a++, sp++) { printf(" %s %d\n", types[a], *sp); } printf("\n"); - for(a=0; a<nr_structs; a++) { + for (a=0; a<nr_structs; a++) { sp= structs[a]; printf(" struct %s elems: %d size: %d\n", types[sp[0]], sp[1],typelens[sp[0]]); num_types = sp[1]; sp+= 2; /* ? num_types was elem? */ - for(b=0; b< num_types; b++, sp+= 2) { + for (b=0; b< num_types; b++, sp+= 2) { printf(" %s %s\n", types[sp[0]], names[sp[1]]); } } @@ -999,7 +1021,7 @@ static int make_structDNA(char *baseDirectory, FILE *file) if (debugSDNA > -1) printf("Writing file ... "); - if(nr_names==0 || nr_structs==0); + if (nr_names==0 || nr_structs==0); else { strcpy(str, "SDNA"); dna_write(file, str, 4); @@ -1036,7 +1058,7 @@ static int make_structDNA(char *baseDirectory, FILE *file) dna_write(file, str, 4); len= 2*nr_types; - if(nr_types & 1) len+= 2; + if (nr_types & 1) len+= 2; dna_write(file, typelens, len); /* WRITE STRUCTS */ @@ -1059,7 +1081,7 @@ static int make_structDNA(char *baseDirectory, FILE *file) int a; fp= fopen("padding.c", "w"); - if(fp==NULL); + if (fp==NULL); else { // add all include files defined in the global array @@ -1067,11 +1089,11 @@ static int make_structDNA(char *baseDirectory, FILE *file) fprintf(fp, "#include \"%s%s\"\n", baseDirectory, includefiles[i]); } - fprintf(fp, "main(){\n"); + fprintf(fp, "main() {\n"); sp = typelens; sp += firststruct; - for(a=firststruct; a<nr_types; a++, sp++) { - if(*sp) { + for (a=firststruct; a<nr_types; a++, sp++) { + if (*sp) { fprintf(fp, "\tif(sizeof(struct %s) - %d) printf(\"ALIGN ERROR:", types[a], *sp); fprintf(fp, "%%d %s %d ", types[a], *sp); fprintf(fp, "\\n\", sizeof(struct %s) - %d);\n", types[a], *sp); @@ -1120,17 +1142,20 @@ int main(int argc, char ** argv) if (argc!=2 && argc!=3) { printf("Usage: %s outfile.c [base directory]\n", argv[0]); return_status = 1; - } else { + } + else { file = fopen(argv[1], "w"); if (!file) { printf ("Unable to open file: %s\n", argv[1]); return_status = 1; - } else { + } + else { char baseDirectory[256]; if (argc==3) { strcpy(baseDirectory, argv[2]); - } else { + } + else { strcpy(baseDirectory, BASE_HEADER); } @@ -1140,7 +1165,8 @@ int main(int argc, char ** argv) fclose(file); make_bad_file(argv[1], __LINE__); return_status = 1; - } else { + } + else { fprintf(file, "};\n"); fprintf(file, "int DNAlen= sizeof(DNAstr);\n"); @@ -1153,7 +1179,7 @@ int main(int argc, char ** argv) return(return_status); } -// include files for automatic dependancies +/* include files for automatic dependencies */ #include "DNA_listBase.h" #include "DNA_vec_types.h" #include "DNA_ID.h" |