diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-13 13:07:20 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-13 13:07:20 +0400 |
commit | 92089e3c4d89c2689dbd4452fb21cbbd9a0ecc71 (patch) | |
tree | b22c37b97efec05c592b86f03a098f56179a7f5b /source/blender/makesdna | |
parent | 9c4165fde0ba8c8d05b49240dab8abdf2d187861 (diff) | |
parent | 520778163debe82b8cebe9ddec6ab4111ab2d6bd (diff) |
svn merge -r39900:40000 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_modifier_types.h | 173 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_node_types.h | 171 |
2 files changed, 288 insertions, 56 deletions
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 053f3b38168..32a78cb823a 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -71,6 +71,9 @@ typedef enum ModifierType { eModifierType_Solidify, eModifierType_Screw, eModifierType_Warp, + eModifierType_WeightVGEdit, + eModifierType_WeightVGMix, + eModifierType_WeightVGProximity, NUM_MODIFIER_TYPES } ModifierType; @@ -675,7 +678,6 @@ 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; @@ -785,4 +787,173 @@ typedef enum { /* PROP_RANDOM not used */ } WarpModifierFalloff; +typedef struct WeightVGEditModifierData { + ModifierData modifier; + + /* Note: I tried to keep everything logically ordered - provided the + * alignment constraints... */ + + char defgrp_name[32]; /* Name of vertex group to edit. */ + + short edit_flags; /* Using MOD_WVG_EDIT_* flags. */ + short falloff_type; /* Using MOD_WVG_MAPPING_* defines. */ + float default_weight; /* Weight for vertices not in vgroup. */ + + /* Mapping stuff. */ + struct CurveMapping *cmap_curve; /* The custom mapping curve! */ + + /* The add/remove vertices weight thresholds. */ + float add_threshold, rem_threshold; + + /* Masking options. */ + float mask_constant; /* The global "influence", if no vgroup nor tex is used as mask. */ + /* Name of mask vertex group from which to get weight factors. */ + char mask_defgrp_name[32]; + + /* Texture masking. */ + int mask_tex_use_channel; /* Which channel to use as weightf. */ + struct Tex *mask_texture; /* The texture. */ + struct Object *mask_tex_map_obj; /* Name of the map object. */ + /* How to map the texture (using MOD_DISP_MAP_* constants). */ + int mask_tex_mapping; + char mask_tex_uvlayer_name[32]; /* Name of the UV layer. */ + + /* Padding… */ + int pad_i1; +} WeightVGEditModifierData; + +/* WeightVGEdit flags. */ +/* Use parametric mapping. */ +//#define MOD_WVG_EDIT_MAP (1 << 0) +/* Use curve mapping. */ +//#define MOD_WVG_EDIT_CMAP (1 << 1) +/* Reverse weights (in the [0.0, 1.0] standard range). */ +//#define MOD_WVG_EDIT_REVERSE_WEIGHTS (1 << 2) +/* Add vertices with higher weight than threshold to vgroup. */ +#define MOD_WVG_EDIT_ADD2VG (1 << 3) +/* Remove vertices with lower weight than threshold from vgroup. */ +#define MOD_WVG_EDIT_REMFVG (1 << 4) +/* Clamp weights. */ +//#define MOD_WVG_EDIT_CLAMP (1 << 5) + +typedef struct WeightVGMixModifierData { + ModifierData modifier; + + /* XXX Note: I tried to keep everything logically ordered – provided the + * alignment constraints... */ + + char defgrp_name_a[32]; /* Name of vertex group to modify/weight. */ + char defgrp_name_b[32]; /* Name of other vertex group to mix in. */ + float default_weight_a; /* Default weight value for first vgroup. */ + float default_weight_b; /* Default weight value to mix in. */ + char mix_mode; /* How second vgroups weights affect first ones */ + char mix_set; /* What vertices to affect. */ + + char pad_c1[6]; + + /* Masking options. */ + float mask_constant; /* The global "influence", if no vgroup nor tex is used as mask. */ + /* Name of mask vertex group from which to get weight factors. */ + char mask_defgrp_name[32]; + + /* Texture masking. */ + int mask_tex_use_channel; /* Which channel to use as weightf. */ + struct Tex *mask_texture; /* The texture. */ + struct Object *mask_tex_map_obj; /* Name of the map object. */ + int mask_tex_mapping; /* How to map the texture! */ + char mask_tex_uvlayer_name[32]; /* Name of the UV layer. */ + + /* Padding… */ + int pad_i1; +} WeightVGMixModifierData; + +/* How second vgroup's weights affect first ones. */ +#define MOD_WVG_MIX_SET 1 /* Second weights replace weights. */ +#define MOD_WVG_MIX_ADD 2 /* Second weights are added to weights. */ +#define MOD_WVG_MIX_SUB 3 /* Second weights are subtracted from weights. */ +#define MOD_WVG_MIX_MUL 4 /* Second weights are multiplied with weights. */ +#define MOD_WVG_MIX_DIV 5 /* Second weights divide weights. */ +#define MOD_WVG_MIX_DIF 6 /* Difference between second weights and weights. */ +#define MOD_WVG_MIX_AVG 7 /* Average of both weights. */ + +/* What vertices to affect. */ +#define MOD_WVG_SET_ALL 1 /* Affect all vertices. */ +#define MOD_WVG_SET_A 2 /* Affect only vertices in first vgroup. */ +#define MOD_WVG_SET_B 3 /* Affect only vertices in second vgroup. */ +#define MOD_WVG_SET_OR 4 /* Affect only vertices in one vgroup or the other. */ +#define MOD_WVG_SET_AND 5 /* Affect only vertices in both vgroups. */ + +typedef struct WeightVGProximityModifierData { + ModifierData modifier; + + /* Note: I tried to keep everything logically ordered - provided the + * alignment constraints... */ + + char defgrp_name[32]; /* Name of vertex group to modify/weight. */ + + /* Proximity modes. */ + int proximity_mode; + int proximity_flags; + + /* Target object from which to calculate vertices distances. */ + struct Object *proximity_ob_target; + + /* Masking options. */ + float mask_constant; /* The global "influence", if no vgroup nor tex is used as mask. */ + /* Name of mask vertex group from which to get weight factors. */ + char mask_defgrp_name[32]; + + /* Texture masking. */ + int mask_tex_use_channel; /* Which channel to use as weightf. */ + struct Tex *mask_texture; /* The texture. */ + struct Object *mask_tex_map_obj; /* Name of the map object. */ + int mask_tex_mapping; /* How to map the texture! */ + char mask_tex_uvlayer_name[32]; /* Name of the UV layer. */ + + float min_dist, max_dist; /* Distances mapping to 0.0/1.0 weights. */ + + /* Put here to avoid breaking existing struct... */ + short falloff_type; /* Using MOD_WVG_MAPPING_* defines. */ + + /* Padding... */ + short pad_s1; +} WeightVGProximityModifierData; + +/* Modes of proximity weighting. */ +/* Dist from target object to affected object. */ +#define MOD_WVG_PROXIMITY_OBJECT 1 /* source vertex to other location */ +/* Dist from target object to vertex. */ +#define MOD_WVG_PROXIMITY_GEOMETRY 2 /* source vertex to other geometry */ + +/* Flags options for proximity weighting. */ +/* Use nearest vertices of target obj, in MOD_WVG_PROXIMITY_GEOMETRY mode. */ +#define MOD_WVG_PROXIMITY_GEOM_VERTS (1 << 0) +/* Use nearest edges of target obj, in MOD_WVG_PROXIMITY_GEOMETRY mode. */ +#define MOD_WVG_PROXIMITY_GEOM_EDGES (1 << 1) +/* Use nearest faces of target obj, in MOD_WVG_PROXIMITY_GEOMETRY mode. */ +#define MOD_WVG_PROXIMITY_GEOM_FACES (1 << 2) + +/* Defines common to all WeightVG modifiers. */ +/* Mapping modes. */ +#define MOD_WVG_MAPPING_NONE 0 +#define MOD_WVG_MAPPING_CURVE 1 +#define MOD_WVG_MAPPING_SHARP 2 /* PROP_SHARP */ +#define MOD_WVG_MAPPING_SMOOTH 3 /* PROP_SMOOTH */ +#define MOD_WVG_MAPPING_ROOT 4 /* PROP_ROOT */ +/* PROP_LIN not used (same as NONE, here...). */ +/* PROP_CONST not used. */ +#define MOD_WVG_MAPPING_SPHERE 7 /* PROP_SPHERE */ +#define MOD_WVG_MAPPING_RANDOM 8 /* PROP_RANDOM */ +#define MOD_WVG_MAPPING_STEP 9 /* Median Step. */ + +/* Tex channel to be used as mask. */ +#define MOD_WVG_MASK_TEX_USE_INT 1 +#define MOD_WVG_MASK_TEX_USE_RED 2 +#define MOD_WVG_MASK_TEX_USE_GREEN 3 +#define MOD_WVG_MASK_TEX_USE_BLUE 4 +#define MOD_WVG_MASK_TEX_USE_HUE 5 +#define MOD_WVG_MASK_TEX_USE_SAT 6 +#define MOD_WVG_MASK_TEX_USE_VAL 7 +#define MOD_WVG_MASK_TEX_USE_ALPHA 8 + #endif diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index efaf30b02f6..bac1e3cd8ca 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -38,26 +38,29 @@ #include "DNA_vec_types.h" #include "DNA_listBase.h" +struct ID; struct ListBase; struct SpaceNode; struct bNodeLink; struct bNodeType; -struct bNodeGroup; +struct bNodeTreeExec; struct AnimData; struct bGPdata; struct uiBlock; #define NODE_MAXSTR 32 - typedef struct bNodeStack { float vec[4]; - float min, max; /* min/max for values (UI writes it, execute might use it) */ + float min, max; void *data; short hasinput; /* when input has link, tagged before executing */ short hasoutput; /* when output is linked, tagged before executing */ short datatype; /* type of data pointer */ short sockettype; /* type of socket stack comes from, to remap linking different sockets */ + short is_copy; /* data is a copy of external data (no freeing) */ + short external; /* data is used by external nodes (no freeing) */ + short pad[2]; } bNodeStack; /* ns->datatype, shadetree only */ @@ -68,50 +71,58 @@ typedef struct bNodeSocket { struct bNodeSocket *next, *prev, *new_sock; char name[32]; - bNodeStack ns; /* custom data for inputs, only UI writes in this */ + + void *storage; /* custom storage */ short type, flag; short limit; /* max. number of links */ - - /* stack data info (only during execution!) */ - short stack_type; /* type of stack reference */ - /* XXX only one of stack_ptr or stack_index is used (depending on stack_type). - * could store the index in the pointer with SET_INT_IN_POINTER (a bit ugly). - * (union won't work here, not supported by DNA) - */ - struct bNodeStack *stack_ptr; /* constant input value */ - short stack_index; /* local stack index or external input number */ short pad1; float locx, locy; - /* internal data to retrieve relations and groups */ + void *default_value; /* default input value used for unlinked sockets */ + + /* execution data */ + short stack_index; /* local stack index */ + short stack_type; /* deprecated, kept for forward compatibility */ + int pad3; + void *cache; /* cached data from execution */ + /* internal data to retrieve relations and groups */ int own_index; /* group socket identifiers, to find matching pairs after reading files */ - struct bNodeSocket *groupsock; int to_index; /* XXX deprecated, only used for restoring old group node links */ - int pad2; + struct bNodeSocket *groupsock; - struct bNodeLink *link; /* a link pointer, set in nodeSolveOrder() */ + struct bNodeLink *link; /* a link pointer, set in ntreeUpdateTree */ + + /* DEPRECATED only needed for do_versions */ + bNodeStack ns; /* custom data for inputs, only UI writes in this */ } bNodeSocket; /* sock->type */ -#define SOCK_VALUE 0 -#define SOCK_VECTOR 1 -#define SOCK_RGBA 2 +#define SOCK_FLOAT 0 +#define SOCK_VECTOR 1 +#define SOCK_RGBA 2 +#define SOCK_INT 3 +#define SOCK_BOOLEAN 4 +#define SOCK_MESH 5 +#define NUM_SOCKET_TYPES 6 /* must be last! */ + +/* socket side (input/output) */ +#define SOCK_IN 1 +#define SOCK_OUT 2 /* sock->flag, first bit is select */ - /* hidden is user defined, to hide unused */ + /* hidden is user defined, to hide unused */ #define SOCK_HIDDEN 2 - /* only used now for groups... */ -#define SOCK_IN_USE 4 - /* unavailable is for dynamic sockets */ + /* only used now for groups... */ +#define SOCK_IN_USE 4 /* XXX deprecated */ + /* unavailable is for dynamic sockets */ #define SOCK_UNAVAIL 8 - -/* sock->stack_type */ -#define SOCK_STACK_LOCAL 1 /* part of the local tree stack */ -#define SOCK_STACK_EXTERN 2 /* use input stack pointer */ -#define SOCK_STACK_CONST 3 /* use pointer to constant input value */ + /* dynamic socket (can be modified by user) */ +#define SOCK_DYNAMIC 16 + /* group socket should not be exposed */ +#define SOCK_INTERNAL 32 typedef struct bNodePreview { unsigned char *rect; @@ -119,7 +130,6 @@ typedef struct bNodePreview { int pad; } bNodePreview; - /* limit data in bNode to what we want to see saved? */ typedef struct bNode { struct bNode *next, *prev, *new_node; @@ -132,11 +142,14 @@ typedef struct bNode { short nr; /* number of this node in list, used for UI exec events */ ListBase inputs, outputs; + struct bNode *parent; /* parent node */ struct ID *id; /* optional link to libdata */ void *storage; /* custom data, must be struct, for storage in file */ float locx, locy; /* root offset for drawing */ - float width, miniwidth; + float width, height; /* node custom width and height */ + float miniwidth; /* node width if hidden */ + int pad; char label[32]; /* custom user-defined label */ short custom1, custom2; /* to be abused for buttons */ float custom3, custom4; @@ -151,7 +164,6 @@ typedef struct bNode { struct uiBlock *block; /* runtime during drawing */ struct bNodeType *typeinfo; /* lookup of callbacks and defaults */ - } bNode; /* node->flag */ @@ -163,11 +175,17 @@ typedef struct bNode { #define NODE_ACTIVE_ID 32 #define NODE_DO_OUTPUT 64 #define NODE_GROUP_EDIT 128 - /* free test flag, undefined */ + /* free test flag, undefined */ #define NODE_TEST 256 - /* composite: don't do node but pass on buffer(s) */ + /* composite: don't do node but pass on buffer(s) */ #define NODE_MUTED 512 -#define NODE_CUSTOM_NAME 1024 /* deprecated! */ +#define NODE_CUSTOM_NAME 1024 /* deprecated! */ + /* group node types: use const outputs by default */ +#define NODE_CONST_OUTPUT (1<<11) + /* node is always behind others */ +#define NODE_BACKGROUND (1<<12) + /* automatic flag for nodes included in transforms */ +#define NODE_TRANSFORM (1<<13) typedef struct bNodeLink { struct bNodeLink *next, *prev; @@ -175,13 +193,13 @@ typedef struct bNodeLink { bNode *fromnode, *tonode; bNodeSocket *fromsock, *tosock; - int flag, pad; - + int flag; + int pad; } bNodeLink; - /* link->flag */ -#define NODE_LINKFLAG_HILITE 1 +#define NODE_LINKFLAG_HILITE 1 /* link has been successfully validated */ +#define NODE_LINK_VALID 2 /* the basis for a Node tree, all links and nodes reside internal here */ /* only re-usable node trees are in the library though, materials and textures allocate own tree struct */ @@ -193,19 +211,24 @@ typedef struct bNodeTree { ListBase nodes, links; - bNodeStack *stack; /* stack is only while executing, no read/write in file */ - struct ListBase *threadstack; /* same as above */ - int type, init; /* set init on fileread */ - int stacksize; /* amount of elements in stack */ int cur_index; /* sockets in groups have unique identifiers, adding new sockets always will increase this counter */ - int flag, pad; + int flag; + int update; /* update flags */ + + int nodetype; /* specific node type this tree is used for */ - ListBase alltypes; /* type definitions */ ListBase inputs, outputs; /* external sockets for group nodes */ - - int pad2[2]; + + /* execution data */ + /* XXX It would be preferable to completely move this data out of the underlying node tree, + * so node tree execution could finally run independent of the tree itself. This would allow node trees + * to be merely linked by other data (materials, textures, etc.), as ID data is supposed to. + * Execution data is generated from the tree once at execution start and can then be used + * as long as necessary, even while the tree is being modified. + */ + struct bNodeTreeExec *execdata; /* callbacks */ void (*progress)(void *, float progress); @@ -216,20 +239,59 @@ typedef struct bNodeTree { } bNodeTree; /* ntree->type, index */ -#define NTREE_SHADER 0 -#define NTREE_COMPOSIT 1 -#define NTREE_TEXTURE 2 +#define NTREE_SHADER 0 +#define NTREE_COMPOSIT 1 +#define NTREE_TEXTURE 2 +#define NUM_NTREE_TYPES 3 /* ntree->init, flag */ -#define NTREE_TYPE_INIT 1 -#define NTREE_EXEC_INIT 2 +#define NTREE_TYPE_INIT 1 /* ntree->flag */ #define NTREE_DS_EXPAND 1 /* for animation editors */ -/* XXX not nice, but needed as a temporary flag +/* XXX not nice, but needed as a temporary flags * for group updates after library linking. */ -#define NTREE_DO_VERSIONS 1024 +#define NTREE_DO_VERSIONS_GROUP_EXPOSE 1024 + +/* ntree->update */ +#define NTREE_UPDATE 0xFFFF /* generic update flag (includes all others) */ +#define NTREE_UPDATE_LINKS 1 /* links have been added or removed */ +#define NTREE_UPDATE_NODES 2 /* nodes or sockets have been added or removed */ +#define NTREE_UPDATE_GROUP_IN 16 /* group inputs have changed */ +#define NTREE_UPDATE_GROUP_OUT 32 /* group outputs have changed */ +#define NTREE_UPDATE_GROUP 48 /* group has changed (generic flag including all other group flags) */ + + +/* socket value structs for input buttons */ + +typedef struct bNodeSocketValueInt { + int subtype; /* RNA subtype */ + int value; + int min, max; +} bNodeSocketValueInt; + +typedef struct bNodeSocketValueFloat { + int subtype; /* RNA subtype */ + float value; + float min, max; +} bNodeSocketValueFloat; + +typedef struct bNodeSocketValueBoolean { + char value; + char pad[3]; +} bNodeSocketValueBoolean; + +typedef struct bNodeSocketValueVector { + int subtype; /* RNA subtype */ + float value[3]; + float min, max; +} bNodeSocketValueVector; + +typedef struct bNodeSocketValueRGBA { + float value[4]; +} bNodeSocketValueRGBA; + /* data structs, for node->storage */ @@ -354,7 +416,6 @@ typedef struct TexNodeOutput { char name[32]; } TexNodeOutput; - /* comp channel matte */ #define CMP_NODE_CHANNEL_MATTE_CS_RGB 1 #define CMP_NODE_CHANNEL_MATTE_CS_HSV 2 |