diff options
author | Andre Susano Pinto <andresusanopinto@gmail.com> | 2009-08-17 21:43:49 +0400 |
---|---|---|
committer | Andre Susano Pinto <andresusanopinto@gmail.com> | 2009-08-17 21:43:49 +0400 |
commit | 950b770c1ea0c05a907abc93ad7174a02432843f (patch) | |
tree | 12936d6440bc7a0710a2fc776d1e122e000ea71e /source/blender | |
parent | 0e3acbaa386384f1b1d27a2b4e0f0dcd07c0e0e2 (diff) | |
parent | 931ffbedaa3e76a6ebec3df2af22176e504158db (diff) |
svn merge -r 22371:22571 https://svn.blender.org/svnroot/bf-blender/branches/blender2.5/blender
Diffstat (limited to 'source/blender')
225 files changed, 6978 insertions, 4907 deletions
diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index aef655ca0d1..bc03e69eb88 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -27,11 +27,13 @@ FILE(GLOB SRC intern/*.c) SET(INC ../../../intern/guardedalloc ../blenlib ../makesdna ../editors/include ../blenkernel ../../../extern/glew/include . - ${FTGL_INC} - ${FREETYPE_INC} - ${GETTEXT_INC} + ${FREETYPE_INCLUDE_DIRS} ) +IF(WITH_INTERNATIONAL) + SET(INC ${INC} ${GETTEXT_INC}) +ENDIF(WITH_INTERNATIONAL) + IF(WIN32) ADD_DEFINITIONS(-D_WIN32 -DUSE_GETTEXT_DLL) ENDIF(WIN32) diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c index 92dfe8457b0..b4d902ff428 100644 --- a/source/blender/blenfont/intern/blf_dir.c +++ b/source/blender/blenfont/intern/blf_dir.c @@ -153,7 +153,8 @@ char *blf_dir_search(char *file) int blf_dir_split(const char *str, char *file, int *size) { - char *s, i, len; + int i, len; + char *s; /* Window, Linux or Mac, this is always / */ s= strrchr(str, '/'); diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index 2447d1823af..cabbaa7aa0f 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -66,6 +66,9 @@ void BKE_keyingset_add_destination(struct KeyingSet *ks, struct ID *id, const ch struct KS_Path *BKE_keyingset_find_destination(struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, int group_mode); +/* Copy all KeyingSets in the given list */ +void BKE_keyingsets_copy(struct ListBase *newlist, struct ListBase *list); + /* Free data for KeyingSet but not set itself */ void BKE_keyingset_free(struct KeyingSet *ks); diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 19b9c315939..4fe1eec55c0 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -43,7 +43,7 @@ struct bContext; struct ReportList; #define BLENDER_VERSION 250 -#define BLENDER_SUBVERSION 0 +#define BLENDER_SUBVERSION 1 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index 9eb0b15aed4..6ec988e111e 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -38,16 +38,15 @@ struct Scene; struct wmOperator; /* datablock functions */ -struct Brush *add_brush(char *name); +struct Brush *add_brush(const char *name); struct Brush *copy_brush(struct Brush *brush); void make_local_brush(struct Brush *brush); void free_brush(struct Brush *brush); /* brush library operations used by different paint panels */ -struct Brush **current_brush_source(struct Scene *sce); -int brush_set_nr(struct Brush **current_brush, int nr); +int brush_set_nr(struct Brush **current_brush, int nr, const char *name); int brush_delete(struct Brush **current_brush); -void brush_check_exists(struct Brush **brush); +void brush_check_exists(struct Brush **brush, const char *name); void brush_toggled_fake_user(struct Brush *brush); int brush_texture_set_nr(struct Brush *brush, int nr); int brush_texture_delete(struct Brush *brush); diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index f3165c959bf..bc4585106e6 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -244,10 +244,6 @@ void cloth_update_normals ( ClothVertex *verts, int nVerts, MFace *face, int tot void bvhtree_update_from_cloth ( ClothModifierData *clmd, int moving ); void bvhselftree_update_from_cloth ( ClothModifierData *clmd, int moving ); -// needed for editmesh.c -void cloth_write_cache( Object *ob, ClothModifierData *clmd, int framenr ); -int cloth_read_cache( Scene *scene, Object *ob, ClothModifierData *clmd, float framenr, int *old_framenr ); - // needed for button_object.c void cloth_clear_cache ( Object *ob, ClothModifierData *clmd, float framenr ); diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index e47ad969b91..035b7e2e5b9 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -86,6 +86,25 @@ typedef struct bContextStore { int used; } bContextStore; +/* for the conrtext's rna mode enum + * keep aligned with data_mode_strings in context.c */ +enum { + CTX_MODE_EDIT_MESH = 0, + CTX_MODE_EDIT_CURVE, + CTX_MODE_EDIT_SURFACE, + CTX_MODE_EDIT_TEXT, + CTX_MODE_EDIT_ARMATURE, + CTX_MODE_EDIT_METABALL, + CTX_MODE_EDIT_LATTICE, + CTX_MODE_POSE, + CTX_MODE_SCULPT, + CTX_MODE_PAINT_WEIGHT, + CTX_MODE_PAINT_VERTEX, + CTX_MODE_PAINT_TEXTURE, + CTX_MODE_PARTICLE, + CTX_MODE_OBJECT +}; + /* Context */ bContext *CTX_create(void); @@ -191,6 +210,9 @@ struct Main *CTX_data_main(const bContext *C); struct Scene *CTX_data_scene(const bContext *C); struct ToolSettings *CTX_data_tool_settings(const bContext *C); +char *CTX_data_mode_string(const bContext *C); +int CTX_data_mode_enum(const bContext *C); + void CTX_data_main_set(bContext *C, struct Main *bmain); void CTX_data_scene_set(bContext *C, struct Scene *bmain); diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 315fe2a39cb..7ce616c37c9 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -112,27 +112,15 @@ typedef struct Global { #define G_FACESELECT (1 << 8) -#define G_VERTEXPAINT (1 << 10) - #define G_DEBUG (1 << 12) #define G_DOSCRIPTLINKS (1 << 13) -#define G_WEIGHTPAINT (1 << 15) -#define G_TEXTUREPAINT (1 << 16) /* #define G_NOFROZEN (1 << 17) also removed */ #define G_GREASEPENCIL (1 << 17) -#define G_SCULPTMODE (1 << 29) -#define G_PARTICLEEDIT (1 << 30) - /* #define G_AUTOMATKEYS (1 << 30) also removed */ #define G_HIDDENHANDLES (1 << 31) /* used for curves only */ -/* macro for testing face select mode - * Texture paint could be removed since selected faces are not used - * however hiding faces is useful */ -#define FACESEL_PAINT_TEST ((G.f&G_FACESELECT) && (G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT))) - /* G.fileflags */ #define G_AUTOPACK (1 << 0) diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 87ee8f9cab3..183cdaff0e6 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -47,6 +47,7 @@ struct rctf; struct ListBase; struct RenderData; struct Scene; +struct Main; struct Tex; struct GPUMaterial; struct GPUNode; @@ -432,4 +433,8 @@ char* ntreeTexOutputMenu(struct bNodeTree *ntree); void init_nodesystem(void); void free_nodesystem(void); +/**/ + +void clear_scene_in_nodes(struct Main *bmain, struct Scene *sce); + #endif diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h new file mode 100644 index 00000000000..67b260b2348 --- /dev/null +++ b/source/blender/blenkernel/BKE_paint.h @@ -0,0 +1,51 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2009 by Nicholas Bishop + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef BKE_PAINT_H +#define BKE_PAINT_H + +struct Brush; +struct Object; +struct Paint; +struct Scene; + +void paint_init(struct Paint *p, const char *brush_name); +void free_paint(struct Paint *p); +void copy_paint(struct Paint *orig, struct Paint *new); + +struct Paint *paint_get_active(struct Scene *sce); +struct Brush *paint_brush(struct Paint *paint); +void paint_brush_set(struct Paint *paint, struct Brush *br); +void paint_brush_slot_add(struct Paint *p); +void paint_brush_slot_remove(struct Paint *p); + +/* testing face select mode + * Texture paint could be removed since selected faces are not used + * however hiding faces is useful */ +int paint_facesel_test(struct Object *ob); + +#endif diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index 8062f807055..5d9dddfe30d 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -30,6 +30,8 @@ #define BKE_POINTCACHE_H #include "DNA_ID.h" +#include "DNA_object_force.h" +#include "DNA_boid_types.h" #include "MEM_guardedalloc.h" @@ -55,9 +57,11 @@ #define PTCACHE_FILE_WRITE 1 /* PTCacheID types */ -#define PTCACHE_TYPE_SOFTBODY 0 -#define PTCACHE_TYPE_PARTICLES 1 -#define PTCACHE_TYPE_CLOTH 2 +#define PTCACHE_TYPE_SOFTBODY 0 +#define PTCACHE_TYPE_PARTICLES 1 +#define PTCACHE_TYPE_CLOTH 2 +#define PTCACHE_TYPE_SMOKE_DOMAIN_LOW 3 +#define PTCACHE_TYPE_SMOKE_DOMAIN_HIGH 4 /* PTCache read return code */ #define PTCACHE_READ_EXACT 1 @@ -69,46 +73,70 @@ struct Object; struct Scene; struct SoftBody; struct ParticleSystem; +struct ParticleKey; struct ClothModifierData; +struct SmokeModifierData; struct PointCache; struct ListBase; +/* temp structure for read/write */ +typedef struct PTCacheData { + int index; + float loc[3]; + float vel[3]; + float rot[4]; + float ave[3]; + float size; + float times[3]; + struct BoidData boids; +} PTCacheData; + typedef struct PTCacheFile { FILE *fp; + + int totpoint, type; + unsigned int data_types; + + struct PTCacheData data; + void *cur[BPHYS_TOT_DATA]; } PTCacheFile; typedef struct PTCacheID { struct PTCacheID *next, *prev; + struct Scene *scene; struct Object *ob; - void *data; + void *calldata; int type; int stack_index; - struct PointCache *cache; -} PTCacheID; - -typedef struct PTCacheWriter { - struct PTCacheID *pid; - int cfra; - int totelem; + /* flags defined in DNA_object_force.h */ + unsigned int data_types, info_types; - void (*set_elem)(int index, void *calldata, float *data); - void *calldata; -} PTCacheWriter; + /* copies point data to cache data */ + int (*write_elem)(int index, void *calldata, void **data); + /* copies point data to cache data */ + int (*write_stream)(PTCacheFile *pf, void *calldata); + /* copies cache cata to point data */ + void (*read_elem)(int index, void *calldata, void **data, float frs_sec, float cfra, float *old_data); + /* copies cache cata to point data */ + void (*read_stream)(PTCacheFile *pf, void *calldata); + /* interpolated between previously read point data and cache data */ + void (*interpolate_elem)(int index, void *calldata, void **data, float frs_sec, float cfra, float cfra1, float cfra2, float *old_data); -typedef struct PTCacheReader { - struct Scene *scene; - struct PTCacheID *pid; - float cfra; - int totelem; + /* total number of simulated points */ + int (*totpoint)(void *calldata); + /* number of points written for current cache frame (currently not used) */ + int (*totwrite)(void *calldata); - void (*set_elem)(int elem_index, void *calldata, float *data); - void (*interpolate_elem)(int index, void *calldata, float frs_sec, float cfra, float cfra1, float cfra2, float *data1, float *data2); - void *calldata; + int (*write_header)(PTCacheFile *pf); + int (*read_header)(PTCacheFile *pf); - int *old_frame; -} PTCacheReader; + struct PointCache *cache; + /* used for setting the current cache from ptcaches list */ + struct PointCache **cache_ptr; + struct ListBase *ptcaches; +} PTCacheID; typedef struct PTCacheBaker { struct Scene *scene; @@ -123,49 +151,75 @@ typedef struct PTCacheBaker { void *progresscontext; } PTCacheBaker; -/* Creating ID's */ +/* Particle functions */ +void BKE_ptcache_make_particle_key(struct ParticleKey *key, int index, void **data, float time); + +/**************** Creating ID's ****************************/ void BKE_ptcache_id_from_softbody(PTCacheID *pid, struct Object *ob, struct SoftBody *sb); void BKE_ptcache_id_from_particles(PTCacheID *pid, struct Object *ob, struct ParticleSystem *psys); void BKE_ptcache_id_from_cloth(PTCacheID *pid, struct Object *ob, struct ClothModifierData *clmd); +void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeModifierData *smd, int num); void BKE_ptcache_ids_from_object(struct ListBase *lb, struct Object *ob); -/* Global funcs */ +/***************** Global funcs ****************************/ void BKE_ptcache_remove(void); -/* ID specific functions */ +/************ ID specific functions ************************/ void BKE_ptcache_id_clear(PTCacheID *id, int mode, int cfra); int BKE_ptcache_id_exist(PTCacheID *id, int cfra); int BKE_ptcache_id_reset(struct Scene *scene, PTCacheID *id, int mode); void BKE_ptcache_id_time(PTCacheID *pid, struct Scene *scene, float cfra, int *startframe, int *endframe, float *timescale); int BKE_ptcache_object_reset(struct Scene *scene, struct Object *ob, int mode); -/* File reading/writing */ -PTCacheFile *BKE_ptcache_file_open(PTCacheID *id, int mode, int cfra); -void BKE_ptcache_file_close(PTCacheFile *pf); -int BKE_ptcache_file_read_floats(PTCacheFile *pf, float *f, int tot); -int BKE_ptcache_file_write_floats(PTCacheFile *pf, float *f, int tot); - void BKE_ptcache_update_info(PTCacheID *pid); -/* General cache reading/writing */ -int BKE_ptcache_read_cache(PTCacheReader *reader); -int BKE_ptcache_write_cache(PTCacheWriter *writer); +/*********** General cache reading/writing ******************/ + +/* Size of cache data type. */ +int BKE_ptcache_data_size(int data_type); + +/* Copy a specific data type from cache data to point data. */ +void BKE_ptcache_data_get(void **data, int type, int index, void *to); + +/* Copy a specific data type from point data to cache data. */ +void BKE_ptcache_data_set(void **data, int type, void *from); + +/* Main cache reading call. */ +int BKE_ptcache_read_cache(PTCacheID *pid, float cfra, float frs_sec); -/* Continue physics */ +/* Main cache writing call. */ +int BKE_ptcache_write_cache(PTCacheID *pid, int cfra); + +/****************** Continue physics ***************/ void BKE_ptcache_set_continue_physics(struct Scene *scene, int enable); int BKE_ptcache_get_continue_physics(void); -/* Point Cache */ -struct PointCache *BKE_ptcache_add(void); +/******************* Allocate & free ***************/ +struct PointCache *BKE_ptcache_add(struct ListBase *ptcaches); +void BKE_ptache_free_mem(struct PointCache *cache); void BKE_ptcache_free(struct PointCache *cache); -struct PointCache *BKE_ptcache_copy(struct PointCache *cache); +void BKE_ptcache_free_list(struct ListBase *ptcaches); +struct PointCache *BKE_ptcache_copy_list(struct ListBase *ptcaches_new, struct ListBase *ptcaches_old); + +/********************** Baking *********************/ -/* Baking */ +/* Bakes cache with cache_step sized jumps in time, not accurate but very fast. */ void BKE_ptcache_quick_cache_all(struct Scene *scene); + +/* Bake cache or simulate to current frame with settings defined in the baker. */ void BKE_ptcache_make_cache(struct PTCacheBaker* baker); + +/* Convert disk cache to memory cache. */ +void BKE_ptcache_disk_to_mem(struct PTCacheID *pid); + +/* Convert memory cache to disk cache. */ +void BKE_ptcache_mem_to_disk(struct PTCacheID *pid); + +/* Convert disk cache to memory cache and vice versa. Clears the cache that was converted. */ void BKE_ptcache_toggle_disk_cache(struct PTCacheID *pid); +/* Loads simulation from external (disk) cache files. */ void BKE_ptcache_load_external(struct PTCacheID *pid); #endif diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 9bb246f88cc..12a13a2b50c 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -40,6 +40,12 @@ struct AviCodecData; struct QuicktimeCodecData; struct RenderData; struct Text; +struct Main; + +#define SCE_COPY_EMPTY 0 +#define SCE_COPY_LINK_OB 1 +#define SCE_COPY_LINK_DATA 2 +#define SCE_COPY_FULL 3 /* note; doesn't work when scene is empty */ #define SETLOOPER(s, b) sce= s, b= (Base*)sce->base.first; b; b= (Base*)(b->next?b->next:sce->set?(sce=sce->set)->base.first:NULL) @@ -48,13 +54,16 @@ struct Text; void free_avicodecdata(struct AviCodecData *acd); void free_qtcodecdata(struct QuicktimeCodecData *acd); -void free_scene(struct Scene *me); +void free_scene(struct Scene *sce); struct Scene *add_scene(char *name); struct Base *object_in_scene(struct Object *ob, struct Scene *sce); void set_scene_bg(struct Scene *sce); void set_scene_name(char *name); +struct Scene *copy_scene(struct Main *bmain, struct Scene *sce, int type); +void unlink_scene(struct Main *bmain, struct Scene *sce, struct Scene *newsce); + int next_object(struct Scene *scene, int val, struct Base **base, struct Object **ob); struct Object *scene_find_camera(struct Scene *sc); diff --git a/source/blender/blenkernel/BKE_sculpt.h b/source/blender/blenkernel/BKE_sculpt.h index 54cafc984a6..9e5647a8775 100644 --- a/source/blender/blenkernel/BKE_sculpt.h +++ b/source/blender/blenkernel/BKE_sculpt.h @@ -33,7 +33,7 @@ struct MFace; struct MultireModifierData; struct MVert; -struct Sculpt; +struct Object; struct StrokeCache; typedef struct SculptSession { @@ -63,13 +63,10 @@ typedef struct SculptSession { float (*mesh_co_orig)[3]; /* Copy of the mesh vertices' locations */ float *layer_disps; /* Displacements for each vertex */ - void *cursor; /* wm handle */ - struct SculptStroke *stroke; - struct StrokeCache *cache; } SculptSession; -void sculptsession_free(struct Sculpt *sculpt); +void free_sculptsession(SculptSession **); #endif diff --git a/source/blender/blenkernel/BKE_sequence.h b/source/blender/blenkernel/BKE_sequence.h index 35cff5c9422..f72617c8312 100644 --- a/source/blender/blenkernel/BKE_sequence.h +++ b/source/blender/blenkernel/BKE_sequence.h @@ -184,3 +184,7 @@ int shuffle_seq(struct ListBase * seqbasep, struct Sequence *test); void free_imbuf_seq(struct ListBase * seqbasep, int check_mem_usage); void seq_update_sound(struct Sequence *seq); + +void clear_scene_in_allseqs(struct Scene *sce); + + diff --git a/source/blender/blenkernel/BKE_softbody.h b/source/blender/blenkernel/BKE_softbody.h index 0d9682cf842..d8053281ceb 100644 --- a/source/blender/blenkernel/BKE_softbody.h +++ b/source/blender/blenkernel/BKE_softbody.h @@ -68,8 +68,5 @@ extern void sbObjectToSoftbody(struct Object *ob); /* pass NULL to unlink again */ extern void sbSetInterruptCallBack(int (*f)(void)); -/* writing to cache for bake editing */ -extern void softbody_write_cache(struct Object *ob, struct SoftBody *soft, int cfra); - #endif diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index ef66b29f112..1dd90b4dbda 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -39,8 +39,6 @@ struct Main; void sound_init(); -void sound_reinit(struct bContext *C); - void sound_exit(); struct bSound* sound_new_file(struct Main *main, char* filename); diff --git a/source/blender/blenkernel/BKE_unit.h b/source/blender/blenkernel/BKE_unit.h new file mode 100644 index 00000000000..5d5f8cddf47 --- /dev/null +++ b/source/blender/blenkernel/BKE_unit.h @@ -0,0 +1,68 @@ +/** + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Contributor(s): Campbell Barton + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef BKE_UNIT_H +#define BKE_UNIT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* in all cases the value is assumed to be scaled by the user preference */ + +/* humanly readable representation of a value in units (used for button drawing) */ +void bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, int split, int pad); + +/* replace units with values, used before python button evaluation */ +int bUnit_ReplaceString(char *str, int len_max, char *str_prev, double scale_pref, int system, int type); + +/* the size of the unit used for this value (used for calculating the ckickstep) */ +double bUnit_ClosestScalar(double value, int system, int type); + +/* base scale for these units */ +double bUnit_BaseScalar(int system, int type); + +/* loop over scales, coudl add names later */ +//double bUnit_Iter(void **unit, char **name, int system, int type); + +void bUnit_GetSystem(void **usys_pt, int *len, int system, int type); +char* bUnit_GetName(void *usys_pt, int index); +char* bUnit_GetNameDisplay(void *usys_pt, int index); +double bUnit_GetScaler(void *usys_pt, int index); + +/* aligned with PropertyUnit */ +#define B_UNIT_NONE 0 +#define B_UNIT_LENGTH 1 +#define B_UNIT_AREA 2 +#define B_UNIT_VOLUME 3 +#define B_UNIT_MASS 4 +#define B_UNIT_ROTATION 5 +#define B_UNIT_TIME 6 +#define B_UNIT_VELOCITY 7 +#define B_UNIT_ACCELERATION 8 + +#ifdef __cplusplus +} +#endif + +#endif /* BKE_UNIT_H */ diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index f5287e4e100..eba5032997d 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -62,11 +62,6 @@ #define SHIFT3(type, a, b, c) { type tmp; tmp = a; a = c; c = b; b = tmp; } #define SHIFT4(type, a, b, c, d) { type tmp; tmp = a; a = d; d = c; c = b; b = tmp; } -/* string compare */ -#define STREQ(str, a) ( strcmp((str), (a))==0 ) -#define STREQ2(str, a, b) ( STREQ(str, a) || STREQ(str, b) ) -#define STREQ3(str, a, b, c) ( STREQ2(str, a, b) || STREQ(str, c) ) - /* min/max */ #define MIN2(x,y) ( (x)<(y) ? (x) : (y) ) #define MIN3(x,y,z) MIN2( MIN2((x),(y)) , (z) ) @@ -100,8 +95,6 @@ if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0]; \ if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1]; } -#define MINSIZE(val, size) ( ((val)>=0.0) ? (((val)<(size)) ? (size): (val)) : ( ((val)>(-size)) ? (-size) : (val))) - /* some math and copy defines */ #define SWAP(type, a, b) { type sw_ap; sw_ap=(a); (a)=(b); (b)=sw_ap; } diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 950947f0d24..c1dfc2cf639 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -55,12 +55,6 @@ IF(WITH_QUICKTIME) ADD_DEFINITIONS(-DWITH_QUICKTIME) ENDIF(WITH_QUICKTIME) -IF(WITH_SDL) - SET(INC ${INC} ${SDL_INC}) -ELSE(WITH_SDL) - ADD_DEFINITIONS(-DDISABLE_SDL) -ENDIF(WITH_SDL) - IF(WITH_FFMPEG) SET(INC ${INC} ${FFMPEG_INC}) ADD_DEFINITIONS(-DWITH_FFMPEG) diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 090f256ab9f..84cccd8b939 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -72,6 +72,7 @@ #include "BKE_modifier.h" #include "BKE_mesh.h" #include "BKE_object.h" +#include "BKE_paint.h" #include "BKE_subsurf.h" #include "BKE_texture.h" #include "BKE_utildefines.h" @@ -2076,7 +2077,7 @@ static void clear_mesh_caches(Object *ob) static void mesh_build_data(Scene *scene, Object *ob, CustomDataMask dataMask) { Object *obact = scene->basact?scene->basact->object:NULL; - int editing = (FACESEL_PAINT_TEST)|(G.f & G_PARTICLEEDIT); + int editing = paint_facesel_test(ob)|(ob && ob->mode & OB_MODE_PARTICLE_EDIT); int needMapping = editing && (ob==obact); float min[3], max[3]; diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 983f1ecc31c..204935cc38d 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -342,6 +342,21 @@ void BKE_keyingset_add_destination (KeyingSet *ks, ID *id, const char group_name BLI_addtail(&ks->paths, ksp); } +/* Copy all KeyingSets in the given list */ +void BKE_keyingsets_copy(ListBase *newlist, ListBase *list) +{ + KeyingSet *ksn; + KS_Path *kspn; + + BLI_duplicatelist(newlist, list); + + for(ksn=newlist->first; ksn; ksn=ksn->next) { + BLI_duplicatelist(&ksn->paths, &ksn->paths); + + for(kspn=ksn->paths.first; kspn; kspn=kspn->next) + kspn->rna_path= MEM_dupallocN(kspn->rna_path); + } +} /* Freeing Tools --------------------------- */ diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 2e4e5596450..746dc6c59cc 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -226,7 +226,7 @@ static void clear_global(void) G.main= NULL; - G.f &= ~(G_WEIGHTPAINT + G_VERTEXPAINT + G_FACESELECT + G_PARTICLEEDIT); + G.f &= ~(G_FACESELECT); } /* make sure path names are correct for OS */ diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 30a35cbe91c..612f6d2051d 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -35,6 +35,7 @@ #include "DNA_brush_types.h" #include "DNA_color_types.h" #include "DNA_image_types.h" +#include "DNA_object_types.h" #include "DNA_texture_types.h" #include "DNA_scene_types.h" #include "DNA_windowmanager_types.h" @@ -50,6 +51,7 @@ #include "BKE_image.h" #include "BKE_library.h" #include "BKE_main.h" +#include "BKE_paint.h" #include "BKE_texture.h" #include "BKE_utildefines.h" @@ -61,7 +63,7 @@ /* Datablock add/copy/free/make_local */ -Brush *add_brush(char *name) +Brush *add_brush(const char *name) { Brush *brush; @@ -152,7 +154,7 @@ void make_local_brush(Brush *brush) } for(scene= G.main->scene.first; scene; scene=scene->id.next) - if(scene->toolsettings->imapaint.brush==brush) { + if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) { if(scene->id.lib) lib= 1; else local= 1; } @@ -174,9 +176,9 @@ void make_local_brush(Brush *brush) brushn->id.flag |= LIB_FAKEUSER; for(scene= G.main->scene.first; scene; scene=scene->id.next) - if(scene->toolsettings->imapaint.brush==brush) + if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) if(scene->id.lib==0) { - scene->toolsettings->imapaint.brush= brushn; + paint_brush_set(&scene->toolsettings->imapaint.paint, brushn); brushn->id.us++; brush->id.us--; } @@ -185,20 +187,7 @@ void make_local_brush(Brush *brush) /* Library Operations */ -Brush **current_brush_source(Scene *sce) -{ - if(G.f & G_SCULPTMODE) - return &sce->toolsettings->sculpt->brush; - else if(G.f & G_VERTEXPAINT) - return &sce->toolsettings->vpaint->brush; - else if(G.f & G_WEIGHTPAINT) - return &sce->toolsettings->wpaint->brush; - else if(G.f & G_TEXTUREPAINT) - return &sce->toolsettings->imapaint.brush; - return NULL; -} - -int brush_set_nr(Brush **current_brush, int nr) +int brush_set_nr(Brush **current_brush, int nr, const char *name) { ID *idtest, *id; @@ -207,7 +196,7 @@ int brush_set_nr(Brush **current_brush, int nr) if(idtest==0) { /* new brush */ if(id) idtest= (ID *)copy_brush((Brush *)id); - else idtest= (ID *)add_brush("Brush"); + else idtest= (ID *)add_brush(name); idtest->us--; } if(idtest!=id) { @@ -300,6 +289,13 @@ void brush_curve_preset(Brush *b, BrushCurvePreset preset) curvemapping_changed(b->curve, 0); } +static MTex *brush_active_texture(Brush *brush) +{ + if(brush && brush->texact >= 0) + return brush->mtex[brush->texact]; + return NULL; +} + int brush_texture_set_nr(Brush *brush, int nr) { ID *idtest, *id=NULL; @@ -374,10 +370,10 @@ int brush_clone_image_delete(Brush *brush) return 0; } -void brush_check_exists(Brush **brush) +void brush_check_exists(Brush **brush, const char *name) { if(*brush==NULL) - brush_set_nr(brush, 1); + brush_set_nr(brush, 1, name); } /* Brush Sampling */ @@ -1077,8 +1073,11 @@ void brush_radial_control_invoke(wmOperator *op, Brush *br, float size_weight) original_value = br->size * size_weight; else if(mode == WM_RADIALCONTROL_STRENGTH) original_value = br->alpha; - else if(mode == WM_RADIALCONTROL_ANGLE) - original_value = br->rot; + else if(mode == WM_RADIALCONTROL_ANGLE) { + MTex *mtex = brush_active_texture(br); + if(mtex) + original_value = mtex->rot; + } RNA_float_set(op->ptr, "initial_value", original_value); op->customdata = brush_gen_radial_control_imbuf(br); @@ -1094,8 +1093,11 @@ int brush_radial_control_exec(wmOperator *op, Brush *br, float size_weight) br->size = new_value * size_weight; else if(mode == WM_RADIALCONTROL_STRENGTH) br->alpha = new_value; - else if(mode == WM_RADIALCONTROL_ANGLE) - br->rot = new_value * conv; + else if(mode == WM_RADIALCONTROL_ANGLE) { + MTex *mtex = brush_active_texture(br); + if(mtex) + mtex->rot = new_value * conv; + } return OPERATOR_FINISHED; } diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 089dafeb8c7..3acaaecb1e8 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -340,92 +340,6 @@ void bvhselftree_update_from_cloth(ClothModifierData *clmd, int moving) } } -int modifiers_indexInObject(Object *ob, ModifierData *md_seek); -static void cloth_write_state(int index, void *cloth_v, float *data) -{ - Cloth *cloth= cloth_v; - ClothVertex *vert = cloth->verts + index; - - memcpy(data, vert->x, 3 * sizeof(float)); - memcpy(data + 3, vert->xconst, 3 * sizeof(float)); - memcpy(data + 6, vert->v, 3 * sizeof(float)); -} -static void cloth_read_state(int index, void *cloth_v, float *data) -{ - Cloth *cloth= cloth_v; - ClothVertex *vert = cloth->verts + index; - - memcpy(vert->x, data, 3 * sizeof(float)); - memcpy(vert->xconst, data + 3, 3 * sizeof(float)); - memcpy(vert->v, data + 6, 3 * sizeof(float)); -} -static void cloth_cache_interpolate(int index, void *cloth_v, float frs_sec, float cfra, float cfra1, float cfra2, float *data1, float *data2) -{ - Cloth *cloth= cloth_v; - ClothVertex *vert = cloth->verts + index; - ParticleKey keys[4]; - float dfra; - - if(cfra1 == cfra2) { - cloth_read_state(index, cloth, data1); - return; - } - - memcpy(keys[1].co, data1, 3 * sizeof(float)); - memcpy(keys[1].vel, data1 + 6, 3 * sizeof(float)); - - memcpy(keys[2].co, data2, 3 * sizeof(float)); - memcpy(keys[2].vel, data2 + 6, 3 * sizeof(float)); - - dfra = cfra2 - cfra1; - - VecMulf(keys[1].vel, dfra); - VecMulf(keys[2].vel, dfra); - - psys_interpolate_particle(-1, keys, (cfra - cfra1) / dfra, keys, 1); - - VecMulf(keys->vel, 1.0f / dfra); - - memcpy(vert->x, keys->co, 3 * sizeof(float)); - memcpy(vert->v, keys->vel, 3 * sizeof(float)); - - /* not sure what to do with this - jahka */ - memcpy(vert->xconst, data1 + 3, 3 * sizeof(float)); -} -void cloth_write_cache(Object *ob, ClothModifierData *clmd, int cfra) -{ - PTCacheWriter writer; - PTCacheID pid; - - BKE_ptcache_id_from_cloth(&pid, ob, clmd); - - writer.calldata = clmd->clothObject; - writer.cfra = cfra; - writer.set_elem = cloth_write_state; - writer.pid = &pid; - writer.totelem = clmd->clothObject->numverts; - - BKE_ptcache_write_cache(&writer); -} - -int cloth_read_cache(Scene *scene, Object *ob, ClothModifierData *clmd, float cfra, int *old_framenr) -{ - PTCacheReader reader; - PTCacheID pid; - - BKE_ptcache_id_from_cloth(&pid, ob, clmd); - - reader.calldata = clmd->clothObject; - reader.cfra = cfra; - reader.interpolate_elem = cloth_cache_interpolate; - reader.old_frame = old_framenr; - reader.pid = &pid; - reader.scene = scene; - reader.set_elem = cloth_read_state; - reader.totelem = clmd->clothObject->numverts; - - return BKE_ptcache_read_cache(&reader); -} void cloth_clear_cache(Object *ob, ClothModifierData *clmd, float framenr) { PTCacheID pid; @@ -512,7 +426,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, PTCacheID pid; float timescale; int framedelta, framenr, startframe, endframe; - int cache_result, old_framenr; + int cache_result; clmd->scene= scene; /* nice to pass on later :) */ framenr= (int)scene->r.cfra; @@ -583,7 +497,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, return result; /* try to read from cache */ - cache_result = cloth_read_cache(scene, ob, clmd, framenr, &old_framenr); + cache_result = BKE_ptcache_read_cache(&pid, (float)framenr, scene->r.frs_sec); if(cache_result == PTCACHE_READ_EXACT || cache_result == PTCACHE_READ_INTERPOLATED) { cache->flag |= PTCACHE_SIMULATION_VALID; @@ -600,7 +514,6 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, implicit_set_positions(clmd); cache->flag |= PTCACHE_SIMULATION_VALID; - cache->simframe= old_framenr; } else if(ob->id.lib || (cache->flag & PTCACHE_BAKED)) { /* if baked and nothing in cache, do nothing */ @@ -624,7 +537,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, else { /* if on second frame, write cache for first frame */ if(cache->simframe == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0)) - cloth_write_cache(ob, clmd, startframe); + BKE_ptcache_write_cache(&pid, startframe); clmd->sim_parms->timescale *= framenr - cache->simframe; @@ -638,7 +551,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, cache->last_exact= 0; } else - cloth_write_cache(ob, clmd, framenr); + BKE_ptcache_write_cache(&pid, framenr); cloth_to_object (ob, clmd, result); } diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 78c29a96bff..c38b994849a 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -34,6 +34,7 @@ #include "DNA_space_types.h" #include "DNA_view3d_types.h" #include "DNA_windowmanager_types.h" +#include "DNA_object_types.h" #include "RNA_access.h" @@ -43,6 +44,7 @@ #include "BKE_context.h" #include "BKE_main.h" #include "BKE_screen.h" +#include "BKE_global.h" #include <string.h> @@ -217,7 +219,10 @@ struct ARegion *CTX_wm_menu(const bContext *C) struct ReportList *CTX_wm_reports(const bContext *C) { - return &(C->wm.manager->reports); + if (C->wm.manager) + return &(C->wm.manager->reports); + + return NULL; } View3D *CTX_wm_view3d(const bContext *C) @@ -656,6 +661,69 @@ Scene *CTX_data_scene(const bContext *C) return C->data.scene; } +int CTX_data_mode_enum(const bContext *C) +{ + Object *obedit= CTX_data_edit_object(C); + + if(obedit) { + switch(obedit->type) { + case OB_MESH: + return CTX_MODE_EDIT_MESH; + case OB_CURVE: + return CTX_MODE_EDIT_CURVE; + case OB_SURF: + return CTX_MODE_EDIT_SURFACE; + case OB_FONT: + return CTX_MODE_EDIT_TEXT; + case OB_ARMATURE: + return CTX_MODE_EDIT_ARMATURE; + case OB_MBALL: + return CTX_MODE_EDIT_METABALL; + case OB_LATTICE: + return CTX_MODE_EDIT_LATTICE; + } + } + else { + Object *ob = CTX_data_active_object(C); + + if(ob) { + if(ob->mode & OB_MODE_POSE) return CTX_MODE_POSE; + else if(ob->mode & OB_MODE_SCULPT) return CTX_MODE_SCULPT; + else if(ob->mode & OB_MODE_WEIGHT_PAINT) return CTX_MODE_PAINT_WEIGHT; + else if(ob->mode & OB_MODE_VERTEX_PAINT) return CTX_MODE_PAINT_VERTEX; + else if(ob->mode & OB_MODE_TEXTURE_PAINT) return CTX_MODE_PAINT_TEXTURE; + else if(ob->mode & OB_MODE_PARTICLE_EDIT) return CTX_MODE_PARTICLE; + } + } + + return CTX_MODE_OBJECT; +} + + +/* would prefer if we can use the enum version below over this one - Campbell */ +/* must be aligned with above enum */ +static char *data_mode_strings[] = { + "mesh_edit", + "curve_edit", + "surface_edit", + "text_edit", + "armature_edit", + "mball_edit", + "lattice_edit", + "posemode", + "sculpt_mode", + "weightpaint", + "vertexpaint", + "texturepaint", + "particlemode", + "objectmode", + 0 +}; +char *CTX_data_mode_string(const bContext *C) +{ + return data_mode_strings[CTX_data_mode_enum(C)]; +} + void CTX_data_scene_set(bContext *C, Scene *scene) { C->data.scene= scene; diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index a72f26f6157..2f0e0931588 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -160,7 +160,7 @@ static AdrBit2Path ma_mode_bits[]= { // {MA_SHADOW, "shadow", 0}, // {MA_SHLESS, "shadeless", 0}, // ... - {MA_RAYTRANSP, "raytrace_transparency.enabled", 0}, + {MA_RAYTRANSP, "transparency", 0}, {MA_RAYMIRROR, "raytrace_mirror.enabled", 0}, // {MA_HALO, "type", MA_TYPE_HALO} }; diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 08a19cada7d..50db2bfe706 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -170,7 +170,7 @@ void init_material(Material *ma) ma->sss_front= 1.0f; ma->sss_back= 1.0f; - ma->mode= MA_TRACEBLE|MA_SHADBUF|MA_SHADOW|MA_RADIO|MA_RAYBIAS|MA_TANGENT_STR; + ma->mode= MA_TRACEBLE|MA_SHADBUF|MA_SHADOW|MA_RAYBIAS|MA_TANGENT_STR; ma->preview = NULL; } @@ -678,9 +678,6 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb) if(needtang) ma->mode |= MA_NORMAP_TANG; else ma->mode &= ~MA_NORMAP_TANG; - if(r_mode & R_RADIO) - if(ma->mode & MA_RADIO) needuv= 1; - if(ma->mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE)) { needuv= 1; if(r_mode & R_OSA) ma->texco |= TEXCO_OSA; /* for texfaces */ @@ -689,7 +686,7 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb) /* since the raytracer doesnt recalc O structs for each ray, we have to preset them all */ if(r_mode & R_RAYTRACE) { - if(ma->mode & (MA_RAYMIRROR|MA_RAYTRANSP|MA_SHADOW_TRA)) { + if((ma->mode & (MA_RAYMIRROR|MA_SHADOW_TRA)) || ((ma->mode && MA_TRANSP) && (ma->mode & MA_RAYTRANSP))) { ma->texco |= NEED_UV|TEXCO_ORCO|TEXCO_REFL|TEXCO_NORM; if(r_mode & R_OSA) ma->texco |= TEXCO_OSA; } diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index f8795edc878..53d1baa5c9c 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -5858,8 +5858,7 @@ static void smokeModifier_updateDepgraph( ModifierData *md, DagForest *forest, Scene *scene, Object *ob, DagNode *obNode) { - SmokeModifierData *smd = (SmokeModifierData *) md; - /* + /*SmokeModifierData *smd = (SmokeModifierData *) md; if(smd && (smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) { if(smd->domain->fluid_group) @@ -5893,7 +5892,7 @@ static void clothModifier_initData(ModifierData *md) clmd->sim_parms = MEM_callocN(sizeof(ClothSimSettings), "cloth sim parms"); clmd->coll_parms = MEM_callocN(sizeof(ClothCollSettings), "cloth coll parms"); - clmd->point_cache = BKE_ptcache_add(); + clmd->point_cache = BKE_ptcache_add(&clmd->ptcaches); /* check for alloc failing */ if(!clmd->sim_parms || !clmd->coll_parms || !clmd->point_cache) @@ -5972,12 +5971,13 @@ static void clothModifier_copyData(ModifierData *md, ModifierData *target) MEM_freeN(tclmd->sim_parms); if(tclmd->coll_parms) MEM_freeN(tclmd->coll_parms); - if(tclmd->point_cache) - BKE_ptcache_free(tclmd->point_cache); + + BKE_ptcache_free_list(&tclmd->ptcaches); + tclmd->point_cache = NULL; tclmd->sim_parms = MEM_dupallocN(clmd->sim_parms); tclmd->coll_parms = MEM_dupallocN(clmd->coll_parms); - tclmd->point_cache = BKE_ptcache_copy(clmd->point_cache); + tclmd->point_cache = BKE_ptcache_copy_list(&tclmd->ptcaches, &clmd->ptcaches); tclmd->clothObject = NULL; } @@ -6001,8 +6001,9 @@ static void clothModifier_freeData(ModifierData *md) MEM_freeN(clmd->sim_parms); if(clmd->coll_parms) MEM_freeN(clmd->coll_parms); - if(clmd->point_cache) - BKE_ptcache_free(clmd->point_cache); + + BKE_ptcache_free_list(&clmd->ptcaches); + clmd->point_cache = NULL; } } diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 22a471f6521..e91f318adad 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -220,6 +220,7 @@ static void multires_subdisp(DerivedMesh *orig, Mesh *me, DerivedMesh *final, in int skip = multires_side_tot[totlvl - lvl] - 1; int i, j, k; + memset(&mmd_sub, 0, sizeof(MultiresModifierData)); mmd_sub.lvl = mmd_sub.totlvl = totlvl; mrdm = multires_dm_create_from_derived(&mmd_sub, orig, me, 0, 0); @@ -465,6 +466,7 @@ void multiresModifier_subdivide(MultiresModifierData *mmd, Object *ob, int dista MultiresModifierData mmd_sub; orig = CDDM_from_mesh(me, NULL); + memset(&mmd_sub, 0, sizeof(MultiresModifierData)); mmd_sub.lvl = mmd_sub.totlvl = mmd->lvl; mrdm = multires_dm_create_from_derived(&mmd_sub, orig, me, 0, 0); totsubvert = mrdm->getNumVerts(mrdm); diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 0f42ba0d2e2..836f4281eb9 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -3112,3 +3112,29 @@ void free_nodesystem(void) BLI_freelistN(&node_all_shaders); BLI_freelistN(&node_all_textures); } + +/* called from unlink_scene, when deleting a scene goes over all scenes + * other than the input, checks if they have render layer nodes referencing + * the to-be-deleted scene, and resets them to NULL. */ + +/* XXX needs to get current scene then! */ +void clear_scene_in_nodes(Main *bmain, Scene *sce) +{ + Scene *sce1; + bNode *node; + + for(sce1= bmain->scene.first; sce1; sce1=sce1->id.next) { + if(sce1!=sce) { + if(sce1->nodetree) { + for(node= sce1->nodetree->nodes.first; node; node= node->next) { + if(node->type==CMP_NODE_R_LAYERS) { + Scene *nodesce= (Scene *)node->id; + + if (nodesce==sce) node->id = NULL; + } + } + } + } + } +} + diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 150a5aa97aa..0e45aedc3ed 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -107,6 +107,7 @@ #include "BKE_sca.h" #include "BKE_scene.h" #include "BKE_screen.h" +#include "BKE_sculpt.h" #include "BKE_softbody.h" #include "LBM_fluidsim.h" @@ -222,6 +223,34 @@ void object_free_display(Object *ob) freedisplist(&ob->disp); } +void free_sculptsession(SculptSession **ssp) +{ + if(ssp && *ssp) { + SculptSession *ss = *ssp; + if(ss->projverts) + MEM_freeN(ss->projverts); + + if(ss->fmap) + MEM_freeN(ss->fmap); + + if(ss->fmap_mem) + MEM_freeN(ss->fmap_mem); + + if(ss->texcache) + MEM_freeN(ss->texcache); + + if(ss->layer_disps) + MEM_freeN(ss->layer_disps); + + if(ss->mesh_co_orig) + MEM_freeN(ss->mesh_co_orig); + + MEM_freeN(ss); + + *ssp = NULL; + } +} + /* do not free object itself */ void free_object(Object *ob) { @@ -276,6 +305,8 @@ void free_object(Object *ob) if(ob->soft) sbFree(ob->soft); if(ob->bsoft) bsbFree(ob->bsoft); if(ob->gpulamp.first) GPU_lamp_free(ob); + + free_sculptsession(&ob->sculpt); } static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, Object **obpoin) @@ -1026,7 +1057,7 @@ SoftBody *copy_softbody(SoftBody *sb) sbn->scratch= NULL; - sbn->pointcache= BKE_ptcache_copy(sb->pointcache); + sbn->pointcache= BKE_ptcache_copy_list(&sbn->ptcaches, &sb->ptcaches); return sbn; } @@ -1085,7 +1116,7 @@ ParticleSystem *copy_particlesystem(ParticleSystem *psys) psysn->reactevents.first = psysn->reactevents.last = NULL; psysn->renderdata = NULL; - psysn->pointcache= BKE_ptcache_copy(psys->pointcache); + psysn->pointcache= BKE_ptcache_copy_list(&psysn->ptcaches, &psys->ptcaches); id_us_plus((ID *)psysn->part); @@ -1211,6 +1242,9 @@ Object *copy_object(Object *ob) copy_defgroups(&obn->defbase, &ob->defbase); copy_constraints(&obn->constraints, &ob->constraints); + obn->mode = 0; + obn->sculpt = NULL; + /* increase user numbers */ id_us_plus((ID *)obn->data); id_us_plus((ID *)obn->dup_group); diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c new file mode 100644 index 00000000000..80016f23d7c --- /dev/null +++ b/source/blender/blenkernel/intern/paint.c @@ -0,0 +1,181 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2009 by Nicholas Bishop + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "MEM_guardedalloc.h" + +#include "DNA_brush_types.h" +#include "DNA_object_types.h" +#include "DNA_scene_types.h" + +#include "BKE_brush.h" +#include "BKE_global.h" +#include "BKE_library.h" +#include "BKE_paint.h" + +#include <stdlib.h> +#include <string.h> + +Paint *paint_get_active(Scene *sce) +{ + if(sce && sce->basact && sce->basact->object) { + ToolSettings *ts = sce->toolsettings; + + switch(sce->basact->object->mode) { + case OB_MODE_SCULPT: + return &ts->sculpt->paint; + case OB_MODE_VERTEX_PAINT: + return &ts->vpaint->paint; + case OB_MODE_WEIGHT_PAINT: + return &ts->wpaint->paint; + case OB_MODE_TEXTURE_PAINT: + return &ts->imapaint.paint; + } + } + + return NULL; +} + +Brush *paint_brush(Paint *p) +{ + return p && p->brushes ? p->brushes[p->active_brush_index] : NULL; +} + +void paint_brush_set(Paint *p, Brush *br) +{ + if(p && !br) { + /* Setting to NULL removes the current slot */ + paint_brush_slot_remove(p); + } + else if(p) { + int found = 0; + + if(p->brushes) { + int i; + + /* See if there's already a slot with the brush */ + for(i = 0; i < p->brush_count; ++i) { + if(p->brushes[i] == br) { + p->active_brush_index = i; + found = 1; + break; + } + } + + } + + if(!found) { + paint_brush_slot_add(p); + id_us_plus(&br->id); + } + + /* Make sure the current slot is the new brush */ + p->brushes[p->active_brush_index] = br; + } +} + +static void paint_brush_slots_alloc(Paint *p, const int count) +{ + p->brush_count = count; + if(count == 0) + p->brushes = NULL; + else + p->brushes = MEM_callocN(sizeof(Brush*) * count, "Brush slots"); +} + +void paint_brush_slot_add(Paint *p) +{ + if(p) { + Brush **orig = p->brushes; + int orig_count = p->brushes ? p->brush_count : 0; + + /* Increase size of brush slot array */ + paint_brush_slots_alloc(p, orig_count + 1); + if(orig) { + memcpy(p->brushes, orig, sizeof(Brush*) * orig_count); + MEM_freeN(orig); + } + + p->active_brush_index = orig_count; + } +} + +void paint_brush_slot_remove(Paint *p) +{ + if(p && p->brushes) { + Brush **orig = p->brushes; + int src, dst; + + /* Decrease size of brush slot array */ + paint_brush_slots_alloc(p, p->brush_count - 1); + if(p->brushes) { + for(src = 0, dst = 0; dst < p->brush_count; ++src) { + if(src != p->active_brush_index) { + p->brushes[dst] = orig[src]; + ++dst; + } + } + } + MEM_freeN(orig); + + if(p->active_brush_index >= p->brush_count) + p->active_brush_index = p->brush_count - 1; + if(p->active_brush_index < 0) + p->active_brush_index = 0; + } +} + +int paint_facesel_test(Object *ob) +{ + return (G.f&G_FACESELECT) && (ob && (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))); + +} + +void paint_init(Paint *p, const char *name) +{ + Brush *brush; + + /* If there's no brush, create one */ + brush = paint_brush(p); + brush_check_exists(&brush, name); + paint_brush_set(p, brush); +} + +void free_paint(Paint *paint) +{ + if(paint->brushes) + MEM_freeN(paint->brushes); +} + +void copy_paint(Paint *orig, Paint *new) +{ + if(orig->brushes) { + int i; + new->brushes = MEM_dupallocN(orig->brushes); + for(i = 0; i < orig->brush_count; ++i) + id_us_plus((ID *)new->brushes[i]); + } +} diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index e4f8a484061..e1987d34a6c 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -321,7 +321,7 @@ int psys_ob_has_hair(Object *ob) } int psys_in_edit_mode(Scene *scene, ParticleSystem *psys) { - return ((G.f & G_PARTICLEEDIT) && psys==psys_get_current((scene->basact)->object) && psys->edit); + return ((scene->basact->object->mode & OB_MODE_PARTICLE_EDIT) && psys==psys_get_current((scene->basact)->object) && psys->edit); } int psys_check_enabled(Object *ob, ParticleSystem *psys) { @@ -431,9 +431,6 @@ void psys_free(Object *ob, ParticleSystem * psys) int nr = 0; ParticleSystem * tpsys; - if(ob->particlesystem.first == NULL && G.f & G_PARTICLEEDIT) - G.f &= ~G_PARTICLEEDIT; - psys_free_path_cache(psys); free_hair(psys, 1); @@ -484,8 +481,8 @@ void psys_free(Object *ob, ParticleSystem * psys) if(psys->reactevents.first) BLI_freelistN(&psys->reactevents); - if(psys->pointcache) - BKE_ptcache_free(psys->pointcache); + BKE_ptcache_free_list(&psys->ptcaches); + psys->pointcache = NULL; if(psys->targets.first) BLI_freelistN(&psys->targets); @@ -980,13 +977,13 @@ static void get_pointcache_keys_for_time(Object *ob, ParticleSystem *psys, int i while(pm && pm->next && (float)pm->frame < t) pm = pm->next; - copy_particle_key(key2, ((ParticleKey *)pm->data) + index, 1); - copy_particle_key(key1, ((ParticleKey *)(pm->prev)->data) + index, 1); + BKE_ptcache_make_particle_key(key2, pm->index_array ? pm->index_array[index] : index, pm->data, (float)pm->frame); + BKE_ptcache_make_particle_key(key1, pm->prev->index_array ? pm->prev->index_array[index] : index, pm->prev->data, (float)pm->prev->frame); } else if(cache->mem_cache.first) { PTCacheMem *pm2 = cache->mem_cache.first; - copy_particle_key(key2, ((ParticleKey *)pm2->data) + index, 1); - copy_particle_key(key1, ((ParticleKey *)pm2->data) + index, 1); + BKE_ptcache_make_particle_key(key2, pm2->index_array ? pm2->index_array[index] : index, pm2->data, (float)pm2->frame); + copy_particle_key(key1, key2, 1); } } } @@ -3038,7 +3035,7 @@ void object_add_particle_system(Scene *scene, Object *ob) psys->flag &= ~PSYS_CURRENT; psys = MEM_callocN(sizeof(ParticleSystem), "particle_system"); - psys->pointcache = BKE_ptcache_add(); + psys->pointcache = BKE_ptcache_add(&psys->ptcaches); BLI_addtail(&ob->particlesystem, psys); psys->part = psys_new_settings("ParticleSettings", NULL); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index b5d58e9db8c..dcd3fcd2f89 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -2260,56 +2260,21 @@ void psys_get_reactor_target(Object *ob, ParticleSystem *psys, Object **target_o void psys_make_temp_pointcache(Object *ob, ParticleSystem *psys) { PointCache *cache = psys->pointcache; - PTCacheFile *pf = NULL; - PTCacheMem *pm = NULL; PTCacheID pid; - int cfra, sfra = cache->startframe, efra = cache->endframe; - int totelem = psys->totpart; - int float_count = sizeof(ParticleKey) / sizeof(float); - int tot = totelem * float_count; if((cache->flag & PTCACHE_DISK_CACHE)==0 || cache->mem_cache.first) return; BKE_ptcache_id_from_particles(&pid, ob, psys); - for(cfra=sfra; cfra <= efra; cfra++) { - pf = BKE_ptcache_file_open(&pid, PTCACHE_FILE_READ, cfra); - - if(pf) { - pm = MEM_callocN(sizeof(PTCacheMem), "Pointcache temp mem"); - pm->data = MEM_callocN(sizeof(float)*tot, "Pointcache temp mem data"); - - if(fread(pm->data, sizeof(float), tot, pf->fp)!= tot) { - printf("Error reading from disk cache\n"); - - MEM_freeN(pm->data); - MEM_freeN(pm); - BKE_ptcache_file_close(pf); - return; - } - - pm->frame = cfra; - pm->totpoint = totelem; - - BLI_addtail(&cache->mem_cache, pm); - - BKE_ptcache_file_close(pf); - } - } + BKE_ptcache_disk_to_mem(&pid); } void psys_clear_temp_pointcache(ParticleSystem *psys) { - PTCacheMem *pm = psys->pointcache->mem_cache.first; - if((psys->pointcache->flag & PTCACHE_DISK_CACHE)==0) return; - for(; pm; pm=pm->next) { - MEM_freeN(pm->data); - } - - BLI_freelistN(&psys->pointcache->mem_cache); + BKE_ptache_free_mem(psys->pointcache); } void psys_get_pointcache_start_end(Scene *scene, ParticleSystem *psys, int *sfra, int *efra) { @@ -2318,88 +2283,6 @@ void psys_get_pointcache_start_end(Scene *scene, ParticleSystem *psys, int *sfra *sfra = MAX2(1, (int)part->sta); *efra = MIN2((int)(part->end + part->lifetime + 1.0), scene->r.efra); } -static void particle_write_state(int index, void *psys_ptr, float *data) -{ - ParticleSystem *psys= psys_ptr; - - memcpy(data, (float *)(&(psys->particles+index)->state), sizeof(ParticleKey)); -} -static void particle_read_state(int index, void *psys_ptr, float *data) -{ - ParticleSystem *psys= psys_ptr; - ParticleData *pa = psys->particles + index; - ParticleKey *key = (ParticleKey *)data; - - if(key->time > pa->state.time) - copy_particle_key(&pa->prev_state, &pa->state, 1); - - copy_particle_key(&pa->state, key, 1); -} -static void particle_cache_interpolate(int index, void *psys_ptr, float frs_sec, float cfra, float cfra1, float cfra2, float *data1, float *data2) -{ - ParticleSystem *psys= psys_ptr; - ParticleData *pa = psys->particles + index; - ParticleKey keys[4]; - float dfra; - - cfra = MIN2(cfra, pa->dietime); - cfra1 = MIN2(cfra1, pa->dietime); - cfra2 = MIN2(cfra2, pa->dietime); - - keys[1] = *((ParticleKey*)data1); - keys[2] = *((ParticleKey*)data2); - - if(cfra1 == cfra2) { - copy_particle_key(&pa->state, &keys[1], 1); - return; - } - - dfra = cfra2 - cfra1; - - VecMulf(keys[1].vel, dfra / frs_sec); - VecMulf(keys[2].vel, dfra / frs_sec); - - psys_interpolate_particle(-1, keys, (cfra - cfra1) / dfra, &pa->state, 1); - QuatInterpol(pa->state.rot, keys[1].rot,keys[2].rot, (cfra - cfra1) / dfra); - - VecMulf(pa->state.vel, frs_sec / dfra); - - pa->state.time = cfra; -} -static void write_particles_to_cache(Object *ob, ParticleSystem *psys, int cfra) -{ - PTCacheWriter writer; - PTCacheID pid; - - BKE_ptcache_id_from_particles(&pid, ob, psys); - - writer.calldata = psys; - writer.cfra = cfra; - writer.set_elem = particle_write_state; - writer.pid = &pid; - writer.totelem = psys->totpart; - - BKE_ptcache_write_cache(&writer); -} - -static int get_particles_from_cache(Scene *scene, Object *ob, ParticleSystem *psys, float cfra, int *old_frame) -{ - PTCacheReader reader; - PTCacheID pid; - - BKE_ptcache_id_from_particles(&pid, ob, psys); - - reader.calldata = psys; - reader.cfra = cfra; - reader.interpolate_elem = particle_cache_interpolate; - reader.old_frame = old_frame; - reader.pid = &pid; - reader.scene = scene; - reader.set_elem = particle_read_state; - reader.totelem = psys->totpart; - - return BKE_ptcache_read_cache(&reader); -} /************************************************/ /* Effectors */ @@ -3843,7 +3726,7 @@ static void psys_update_path_cache(Scene *scene, Object *ob, ParticleSystemModif if((psys->part->childtype && psys->totchild != get_psys_tot_child(scene, psys)) || psys->recalc&PSYS_RECALC_RESET) alloc=1; - if(alloc || psys->recalc&PSYS_RECALC_CHILD || (psys->vgroup[PSYS_VG_DENSITY] && (G.f & G_WEIGHTPAINT))) + if(alloc || psys->recalc&PSYS_RECALC_CHILD || (psys->vgroup[PSYS_VG_DENSITY] && (ob && ob->mode & OB_MODE_WEIGHT_PAINT))) distr=1; if(distr){ @@ -4237,7 +4120,7 @@ static void system_step(Scene *scene, Object *ob, ParticleSystem *psys, Particle int totpart, oldtotpart, totchild, oldtotchild, p; float disp, *vg_vel= 0, *vg_tan= 0, *vg_rot= 0, *vg_size= 0; int init= 0, distr= 0, alloc= 0, usecache= 0, only_children_changed= 0; - int framenr, framedelta, startframe, endframe, old_framenr; + int framenr, framedelta, startframe, endframe; part= psys->part; cache= psys->pointcache; @@ -4327,8 +4210,10 @@ static void system_step(Scene *scene, Object *ob, ParticleSystem *psys, Particle if(alloc) { realloc_particles(ob, psys, totpart); - if(usecache && !only_children_changed) + if(usecache && !only_children_changed) { BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_ALL, 0); + BKE_ptcache_id_from_particles(&pid, ob, psys); + } } if(!only_children_changed) @@ -4358,7 +4243,7 @@ static void system_step(Scene *scene, Object *ob, ParticleSystem *psys, Particle /* try to read from the cache */ if(usecache) { - int result = get_particles_from_cache(scene, ob, psys, (float)framenr, &old_framenr); + int result = BKE_ptcache_read_cache(&pid, cfra, scene->r.frs_sec); if(result == PTCACHE_READ_EXACT || result == PTCACHE_READ_INTERPOLATED) { cached_step(scene, ob, psmd, psys, cfra); @@ -4369,14 +4254,12 @@ static void system_step(Scene *scene, Object *ob, ParticleSystem *psys, Particle cache->flag |= PTCACHE_SIMULATION_VALID; if(result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED) - write_particles_to_cache(ob, psys, cfra); + BKE_ptcache_write_cache(&pid, (int)cfra); return; } else if(result==PTCACHE_READ_OLD) { - /* set old cfra */ - psys->cfra = (float)old_framenr; - + psys->cfra = (float)cache->simframe; for(p=0, pa=psys->particles; p<totpart; p++, pa++) { /* update alive status */ if(pa->time > psys->cfra) @@ -4402,7 +4285,7 @@ static void system_step(Scene *scene, Object *ob, ParticleSystem *psys, Particle /* if on second frame, write cache for first frame */ if(usecache && psys->cfra == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0)) - write_particles_to_cache(ob, psys, startframe); + BKE_ptcache_write_cache(&pid, startframe); if(part->phystype==PART_PHYS_KEYED) psys_count_keyed_targets(ob,psys); @@ -4448,7 +4331,7 @@ static void system_step(Scene *scene, Object *ob, ParticleSystem *psys, Particle /* only write cache starting from second frame */ if(usecache && framenr != startframe) - write_particles_to_cache(ob, psys, framenr); + BKE_ptcache_write_cache(&pid, (int)cfra); /* for keyed particles the path is allways known so it can be drawn */ if(part->phystype==PART_PHYS_KEYED) { diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index beb72c2c13f..09170d92866 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -39,6 +39,7 @@ #include "DNA_object_force.h" #include "DNA_particle_types.h" #include "DNA_scene_types.h" +#include "DNA_smoke_types.h" #include "BLI_blenlib.h" @@ -52,11 +53,14 @@ #include "BKE_particle.h" #include "BKE_pointcache.h" #include "BKE_scene.h" +#include "BKE_smoke.h" #include "BKE_softbody.h" #include "BKE_utildefines.h" #include "BLI_blenlib.h" +#include "smoke_API.h" + /* needed for directory lookup */ #ifndef WIN32 #include <dirent.h> @@ -77,8 +81,308 @@ #endif #endif -/* Creating ID's */ +static void ptcache_data_to(void **data, int type, int index, void *to); +static void ptcache_data_from(void **data, int type, void *from); + +/* Common functions */ +static int ptcache_read_basic_header(PTCacheFile *pf) +{ + int error=0; + + /* Custom functions should read these basic elements too! */ + if(!error && !fread(&pf->totpoint, sizeof(int), 1, pf->fp)) + error = 1; + + if(!error && !fread(&pf->data_types, sizeof(int), 1, pf->fp)) + error = 1; + + return !error; +} +static int ptcache_write_basic_header(PTCacheFile *pf) +{ + /* Custom functions should write these basic elements too! */ + if(!fwrite(&pf->totpoint, sizeof(int), 1, pf->fp)) + return 0; + + if(!fwrite(&pf->data_types, sizeof(int), 1, pf->fp)) + return 0; + + return 1; +} +/* Softbody functions */ +static int ptcache_write_softbody(int index, void *soft_v, void **data) +{ + SoftBody *soft= soft_v; + BodyPoint *bp = soft->bpoint + index; + + ptcache_data_from(data, BPHYS_DATA_LOCATION, bp->pos); + ptcache_data_from(data, BPHYS_DATA_VELOCITY, bp->vec); + + return 1; +} +static void ptcache_read_softbody(int index, void *soft_v, void **data, float frs_sec, float cfra, float *old_data) +{ + SoftBody *soft= soft_v; + BodyPoint *bp = soft->bpoint + index; + + if(old_data) { + memcpy(bp->pos, data, 3 * sizeof(float)); + memcpy(bp->vec, data + 3, 3 * sizeof(float)); + } + else { + ptcache_data_to(data, BPHYS_DATA_LOCATION, 0, bp->pos); + ptcache_data_to(data, BPHYS_DATA_VELOCITY, 0, bp->vec); + } +} +static void ptcache_interpolate_softbody(int index, void *soft_v, void **data, float frs_sec, float cfra, float cfra1, float cfra2, float *old_data) +{ + SoftBody *soft= soft_v; + BodyPoint *bp = soft->bpoint + index; + ParticleKey keys[4]; + float dfra; + + if(cfra1 == cfra2) + return; + + VECCOPY(keys[1].co, bp->pos); + VECCOPY(keys[1].vel, bp->vec); + + if(old_data) { + memcpy(keys[2].co, old_data, 3 * sizeof(float)); + memcpy(keys[2].vel, old_data + 3, 3 * sizeof(float)); + } + else + BKE_ptcache_make_particle_key(keys+2, 0, data, cfra2); + + dfra = cfra2 - cfra1; + + VecMulf(keys[1].vel, dfra); + VecMulf(keys[2].vel, dfra); + + psys_interpolate_particle(-1, keys, (cfra - cfra1) / dfra, keys, 1); + VecMulf(keys->vel, 1.0f / dfra); + + VECCOPY(bp->pos, keys->co); + VECCOPY(bp->vec, keys->vel); +} +static int ptcache_totpoint_softbody(void *soft_v) +{ + SoftBody *soft= soft_v; + return soft->totpoint; +} +/* Particle functions */ +static int ptcache_write_particle(int index, void *psys_v, void **data) +{ + ParticleSystem *psys= psys_v; + ParticleData *pa = psys->particles + index; + float times[3] = {pa->time, pa->dietime, pa->lifetime}; + + if(data[BPHYS_DATA_INDEX]) { + int step = psys->pointcache->step; + /* No need to store unborn or died particles */ + if(pa->time - step > pa->state.time || pa->dietime + step < pa->state.time) + return 0; + } + + ptcache_data_from(data, BPHYS_DATA_INDEX, &index); + ptcache_data_from(data, BPHYS_DATA_LOCATION, pa->state.co); + ptcache_data_from(data, BPHYS_DATA_VELOCITY, pa->state.vel); + ptcache_data_from(data, BPHYS_DATA_ROTATION, pa->state.rot); + ptcache_data_from(data, BPHYS_DATA_AVELOCITY, pa->state.ave); + ptcache_data_from(data, BPHYS_DATA_SIZE, &pa->size); + ptcache_data_from(data, BPHYS_DATA_TIMES, times); + + if(pa->boid) + ptcache_data_from(data, BPHYS_DATA_TIMES, &pa->boid); + + return 1; +} +void BKE_ptcache_make_particle_key(ParticleKey *key, int index, void **data, float time) +{ + ptcache_data_to(data, BPHYS_DATA_LOCATION, index, key->co); + ptcache_data_to(data, BPHYS_DATA_VELOCITY, index, key->vel); + ptcache_data_to(data, BPHYS_DATA_ROTATION, index, key->rot); + ptcache_data_to(data, BPHYS_DATA_AVELOCITY, index, key->ave); + key->time = time; +} +static void ptcache_read_particle(int index, void *psys_v, void **data, float frs_sec, float cfra, float *old_data) +{ + ParticleSystem *psys= psys_v; + ParticleData *pa = psys->particles + index; + + if(cfra > pa->state.time) + memcpy(&pa->prev_state, &pa->state, sizeof(ParticleKey)); + + if(old_data){ + /* old format cache */ + memcpy(&pa->state, old_data, sizeof(ParticleKey)); + return; + } + + BKE_ptcache_make_particle_key(&pa->state, 0, data, cfra); + + if(data[BPHYS_DATA_SIZE]) + ptcache_data_to(data, BPHYS_DATA_SIZE, 0, &pa->size); + + if(data[BPHYS_DATA_TIMES]) { + float times[3]; + ptcache_data_to(data, BPHYS_DATA_TIMES, 0, ×); + pa->time = times[0]; + pa->dietime = times[1]; + pa->lifetime = times[2]; + } + + if(pa->boid) + ptcache_data_to(data, BPHYS_DATA_BOIDS, 0, &pa->boid); + + /* determine velocity from previous location */ + if(data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_VELOCITY]) { + if(cfra > pa->prev_state.time) { + VecSubf(pa->state.vel, pa->state.co, pa->prev_state.co); + VecMulf(pa->state.vel, (cfra - pa->prev_state.time) / frs_sec); + } + else { + VecSubf(pa->state.vel, pa->prev_state.co, pa->state.co); + VecMulf(pa->state.vel, (pa->prev_state.time - cfra) / frs_sec); + } + } + + /* determine rotation from velocity */ + if(data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_ROTATION]) { + vectoquat(pa->state.vel, OB_POSX, OB_POSZ, pa->state.rot); + } +} +static void ptcache_interpolate_particle(int index, void *psys_v, void **data, float frs_sec, float cfra, float cfra1, float cfra2, float *old_data) +{ + ParticleSystem *psys= psys_v; + ParticleData *pa = psys->particles + index; + ParticleKey keys[4]; + float dfra; + + cfra = MIN2(cfra, pa->dietime); + cfra1 = MIN2(cfra1, pa->dietime); + cfra2 = MIN2(cfra2, pa->dietime); + + if(cfra1 == cfra2) + return; + + memcpy(keys+1, &pa->state, sizeof(ParticleKey)); + if(old_data) + memcpy(keys+2, old_data, sizeof(ParticleKey)); + else + BKE_ptcache_make_particle_key(keys+2, 0, data, cfra2); + + dfra = cfra2 - cfra1; + + VecMulf(keys[1].vel, dfra / frs_sec); + VecMulf(keys[2].vel, dfra / frs_sec); + + psys_interpolate_particle(-1, keys, (cfra - cfra1) / dfra, &pa->state, 1); + QuatInterpol(pa->state.rot, keys[1].rot,keys[2].rot, (cfra - cfra1) / dfra); + + VecMulf(pa->state.vel, frs_sec / dfra); + + pa->state.time = cfra; +} + +static int ptcache_totpoint_particle(void *psys_v) +{ + ParticleSystem *psys = psys_v; + return psys->totpart; +} +static int ptcache_totwrite_particle(void *psys_v) +{ + ParticleSystem *psys = psys_v; + int totwrite = 0; + + /* TODO for later */ + //if((psys->part->flag & (PART_UNBORN|PART_DIED))==0) { + // ParticleData *pa= psys->particles; + // int p, step = psys->pointcache->step; + + // for(p=0; p<psys->totpart; p++,pa++) + // totwrite += (pa->time - step > pa->state.time || pa->dietime + step > pa->state.time); + //} + //else + totwrite= psys->totpart; + + return totwrite; +} + +/* Cloth functions */ +static int ptcache_write_cloth(int index, void *cloth_v, void **data) +{ + ClothModifierData *clmd= cloth_v; + Cloth *cloth= clmd->clothObject; + ClothVertex *vert = cloth->verts + index; + + ptcache_data_from(data, BPHYS_DATA_LOCATION, vert->x); + ptcache_data_from(data, BPHYS_DATA_VELOCITY, vert->v); + ptcache_data_from(data, BPHYS_DATA_XCONST, vert->xconst); + + return 1; +} +static void ptcache_read_cloth(int index, void *cloth_v, void **data, float frs_sec, float cfra, float *old_data) +{ + ClothModifierData *clmd= cloth_v; + Cloth *cloth= clmd->clothObject; + ClothVertex *vert = cloth->verts + index; + + if(old_data) { + memcpy(vert->x, data, 3 * sizeof(float)); + memcpy(vert->xconst, data + 3, 3 * sizeof(float)); + memcpy(vert->v, data + 6, 3 * sizeof(float)); + } + else { + ptcache_data_to(data, BPHYS_DATA_LOCATION, 0, vert->x); + ptcache_data_to(data, BPHYS_DATA_VELOCITY, 0, vert->v); + ptcache_data_to(data, BPHYS_DATA_XCONST, 0, vert->xconst); + } +} +static void ptcache_interpolate_cloth(int index, void *cloth_v, void **data, float frs_sec, float cfra, float cfra1, float cfra2, float *old_data) +{ + ClothModifierData *clmd= cloth_v; + Cloth *cloth= clmd->clothObject; + ClothVertex *vert = cloth->verts + index; + ParticleKey keys[4]; + float dfra; + + if(cfra1 == cfra2) + return; + + VECCOPY(keys[1].co, vert->x); + VECCOPY(keys[1].vel, vert->v); + + if(old_data) { + memcpy(keys[2].co, old_data, 3 * sizeof(float)); + memcpy(keys[2].vel, old_data + 6, 3 * sizeof(float)); + } + else + BKE_ptcache_make_particle_key(keys+2, 0, data, cfra2); + + dfra = cfra2 - cfra1; + + VecMulf(keys[1].vel, dfra); + VecMulf(keys[2].vel, dfra); + + psys_interpolate_particle(-1, keys, (cfra - cfra1) / dfra, keys, 1); + + VecMulf(keys->vel, 1.0f / dfra); + + VECCOPY(vert->x, keys->co); + VECCOPY(vert->v, keys->vel); + + /* should vert->xconst be interpolated somehow too? - jahka */ +} + +static int ptcache_totpoint_cloth(void *cloth_v) +{ + ClothModifierData *clmd= cloth_v; + return clmd->clothObject->numverts; +} + +/* Creating ID's */ void BKE_ptcache_id_from_softbody(PTCacheID *pid, Object *ob, SoftBody *sb) { ParticleSystemModifierData *psmd; @@ -88,9 +392,24 @@ void BKE_ptcache_id_from_softbody(PTCacheID *pid, Object *ob, SoftBody *sb) memset(pid, 0, sizeof(PTCacheID)); pid->ob= ob; - pid->data= sb; + pid->calldata= sb; pid->type= PTCACHE_TYPE_SOFTBODY; pid->cache= sb->pointcache; + pid->cache_ptr= &sb->pointcache; + pid->ptcaches= &sb->ptcaches; + pid->totpoint= pid->totwrite= ptcache_totpoint_softbody; + + pid->write_elem= ptcache_write_softbody; + pid->write_stream = NULL; + pid->read_stream = NULL; + pid->read_elem= ptcache_read_softbody; + pid->interpolate_elem= ptcache_interpolate_softbody; + + pid->write_header= ptcache_write_basic_header; + pid->read_header= ptcache_read_basic_header; + + pid->data_types= (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_VELOCITY); + pid->info_types= 0; if(sb->particles) { psmd= psys_get_modifier(ob, sb->particles); @@ -113,21 +432,173 @@ void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *p memset(pid, 0, sizeof(PTCacheID)); pid->ob= ob; - pid->data= psys; + pid->calldata= psys; pid->type= PTCACHE_TYPE_PARTICLES; pid->stack_index= modifiers_indexInObject(ob, (ModifierData *)psmd); pid->cache= psys->pointcache; + pid->cache_ptr= &psys->pointcache; + pid->ptcaches= &psys->ptcaches; + + pid->write_elem= ptcache_write_particle; + pid->write_stream = NULL; + pid->read_stream = NULL; + pid->read_elem= ptcache_read_particle; + pid->interpolate_elem= ptcache_interpolate_particle; + + pid->totpoint= ptcache_totpoint_particle; + pid->totwrite= ptcache_totwrite_particle; + + pid->write_header= ptcache_write_basic_header; + pid->read_header= ptcache_read_basic_header; + + pid->data_types= (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_VELOCITY); + + /* TODO for later */ + //if((psys->part->flag & (PART_UNBORN|PART_DIED))==0) + // pid->data_types|= (1<<BPHYS_DATA_INDEX); + + if(psys->part->phystype == PART_PHYS_BOIDS) + pid->data_types|= (1<<BPHYS_DATA_AVELOCITY) | (1<<BPHYS_DATA_ROTATION) | (1<<BPHYS_DATA_BOIDS); + + if(psys->part->rotmode || psys->part->avemode) + pid->data_types|= (1<<BPHYS_DATA_AVELOCITY) | (1<<BPHYS_DATA_ROTATION); + + if(psys->part->flag & PART_ROT_DYN) + pid->data_types|= (1<<BPHYS_DATA_ROTATION); + + pid->info_types= (1<<BPHYS_DATA_TIMES); +} + +#if 0 // XXX smoke pointcache stuff breaks compiling now +/* Smoke functions */ +static int ptcache_totpoint_smoke(void *smoke_v) +{ + SmokeModifierData *smd= (SmokeModifierData *)smoke_v; + SmokeDomainSettings *sds = smd->domain; + + if(sds->fluid) + { + return sds->res[0]*sds->res[1]*sds->res[2]; + } + else + return 0; +} + +// forward decleration +static int ptcache_file_write(PTCacheFile *pf, void *f, size_t tot, int size); + +static int ptcache_write_smoke(PTCacheFile *pf, void *smoke_v) +{ + SmokeModifierData *smd= (SmokeModifierData *)smoke_v; + SmokeDomainSettings *sds = smd->domain; + + if(sds->fluid) + { + size_t res = sds->res[0]*sds->res[1]*sds->res[2]; + float *dens, *densold, *heat, *heatold, *vx, *vy, *vz; + + smoke_export(sds->fluid, &dens, &densold, &heat, &heatold, &vx, &vy, &vz); + + ptcache_file_write(pf, dens, res, sizeof(float)); + ptcache_file_write(pf, densold, res, sizeof(float)); + ptcache_file_write(pf, heat, res, sizeof(float)); + ptcache_file_write(pf, heatold, res, sizeof(float)); + ptcache_file_write(pf, vx, res, sizeof(float)); + ptcache_file_write(pf, vy, res, sizeof(float)); + ptcache_file_write(pf, vz, res, sizeof(float)); + + return 1; + } + + return 0; +} + +// forward decleration +static int ptcache_file_read(PTCacheFile *pf, void *f, size_t tot, int size); + +static void ptcache_read_smoke(PTCacheFile *pf, void *smoke_v) +{ + SmokeModifierData *smd= (SmokeModifierData *)smoke_v; + SmokeDomainSettings *sds = smd->domain; + + if(sds->fluid) + { + size_t res = sds->res[0]*sds->res[1]*sds->res[2]; + float *dens, *densold, *heat, *heatold, *vx, *vy, *vz; + + smoke_export(sds->fluid, &dens, &densold, &heat, &heatold, &vx, &vy, &vz); + + ptcache_file_read(pf, dens, res, sizeof(float)); + ptcache_file_read(pf, densold, res, sizeof(float)); + ptcache_file_read(pf, heat, res, sizeof(float)); + ptcache_file_read(pf, heatold, res, sizeof(float)); + ptcache_file_read(pf, vx, res, sizeof(float)); + ptcache_file_read(pf, vy, res, sizeof(float)); + ptcache_file_read(pf, vz, res, sizeof(float)); + + } +} +void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeModifierData *smd, int num) +{ + SmokeDomainSettings *sds = smd->domain; + + memset(pid, 0, sizeof(PTCacheID)); + + pid->ob= ob; + pid->calldata= smd; + + // if(num == 0) + pid->type= PTCACHE_TYPE_SMOKE_DOMAIN_LOW; + // else if(num == 1) + // pid->type= PTCACHE_TYPE_SMOKE_DOMAIN_HIGH; + + pid->stack_index= modifiers_indexInObject(ob, (ModifierData *)smd); + + pid->cache= sds->point_cache; + pid->cache_ptr= &sds->point_cache; + pid->ptcaches= &sds->ptcaches; + + + pid->totpoint= pid->totwrite= ptcache_totpoint_smoke; + + pid->write_elem= NULL; + pid->read_elem= NULL; + pid->read_stream = ptcache_read_smoke; + pid->write_stream = ptcache_write_smoke; + pid->interpolate_elem= NULL; + + pid->write_header= ptcache_write_basic_header; + pid->read_header= ptcache_read_basic_header; + + pid->data_types= (1<<BPHYS_DATA_LOCATION); // bogus values tot make pointcache happy + pid->info_types= 0; } +#endif // XXX smoke poitcache stuff breaks compiling void BKE_ptcache_id_from_cloth(PTCacheID *pid, Object *ob, ClothModifierData *clmd) { memset(pid, 0, sizeof(PTCacheID)); pid->ob= ob; - pid->data= clmd; + pid->calldata= clmd; pid->type= PTCACHE_TYPE_CLOTH; pid->stack_index= modifiers_indexInObject(ob, (ModifierData *)clmd); pid->cache= clmd->point_cache; + pid->cache_ptr= &clmd->point_cache; + pid->ptcaches= &clmd->ptcaches; + pid->totpoint= pid->totwrite= ptcache_totpoint_cloth; + + pid->write_elem= ptcache_write_cloth; + pid->write_stream = NULL; + pid->read_stream = NULL; + pid->read_elem= ptcache_read_cloth; + pid->interpolate_elem= ptcache_interpolate_cloth; + + pid->write_header= ptcache_write_basic_header; + pid->read_header= ptcache_read_basic_header; + + pid->data_types= (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_VELOCITY) | (1<<BPHYS_DATA_XCONST); + pid->info_types= 0; } void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob) @@ -162,9 +633,24 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob) BKE_ptcache_id_from_cloth(pid, ob, (ClothModifierData*)md); BLI_addtail(lb, pid); } + /* + // enabled on next commit + if(md->type == eModifierType_Smoke) { + SmokeModifierData *smd = (SmokeModifierData *)md; + if(smd->type & MOD_SMOKE_TYPE_DOMAIN) + { + pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID"); + BKE_ptcache_id_from_smoke(pid, ob, (SmokeModifierData*)md, 0); + BLI_addtail(lb, pid); + } + } + */ } } + +/* File handling */ + /* Takes an Object ID and returns a unique name - id: object id - cfra: frame for the cache, can be negative @@ -177,7 +663,7 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob) static int ptcache_path(PTCacheID *pid, char *filename) { Library *lib; - int i; + size_t i; lib= (pid)? pid->ob->id.lib: NULL; @@ -235,7 +721,7 @@ static int BKE_ptcache_id_filename(PTCacheID *pid, char *filename, int cfra, sho } } else { - int temp = strlen(pid->cache->name); + int temp = (int)strlen(pid->cache->name); strcpy(newname, pid->cache->name); newname+=temp; len += temp; @@ -258,7 +744,7 @@ static int BKE_ptcache_id_filename(PTCacheID *pid, char *filename, int cfra, sho } /* youll need to close yourself after! */ -PTCacheFile *BKE_ptcache_file_open(PTCacheID *pid, int mode, int cfra) +static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra) { PTCacheFile *pf; FILE *fp = NULL; @@ -291,136 +777,224 @@ PTCacheFile *BKE_ptcache_file_open(PTCacheID *pid, int mode, int cfra) return pf; } -void BKE_ptcache_file_close(PTCacheFile *pf) +static void ptcache_file_close(PTCacheFile *pf) { fclose(pf->fp); MEM_freeN(pf); } -int BKE_ptcache_file_read_floats(PTCacheFile *pf, float *f, int tot) +static int ptcache_file_read(PTCacheFile *pf, void *f, size_t tot, int size) { - return (fread(f, sizeof(float), tot, pf->fp) == tot); + return (fread(f, size, tot, pf->fp) == tot); } - -int BKE_ptcache_file_write_floats(PTCacheFile *pf, float *f, int tot) +static int ptcache_file_write(PTCacheFile *pf, void *f, size_t tot, int size) { - return (fwrite(f, sizeof(float), tot, pf->fp) == tot); + return (fwrite(f, size, tot, pf->fp) == tot); } - -static int ptcache_pid_elemsize(PTCacheID *pid) +static int ptcache_file_read_data(PTCacheFile *pf) { - if(pid->type==PTCACHE_TYPE_SOFTBODY) - return 6 * sizeof(float); - else if(pid->type==PTCACHE_TYPE_PARTICLES) - return sizeof(ParticleKey); - else if(pid->type==PTCACHE_TYPE_CLOTH) - return 9 * sizeof(float); + int i; - return 0; -} -static int ptcache_pid_totelem(PTCacheID *pid) -{ - if(pid->type==PTCACHE_TYPE_SOFTBODY) { - SoftBody *soft = pid->data; - return soft->totpoint; - } - else if(pid->type==PTCACHE_TYPE_PARTICLES) { - ParticleSystem *psys = pid->data; - return psys->totpart; + for(i=0; i<BPHYS_TOT_DATA; i++) { + if(pf->data_types & (1<<i) && !ptcache_file_read(pf, pf->cur[i], 1, BKE_ptcache_data_size(i))) + return 0; } - else if(pid->type==PTCACHE_TYPE_CLOTH) { - ClothModifierData *clmd = pid->data; - return clmd->clothObject->numverts; + + return 1; +} +static int ptcache_file_write_data(PTCacheFile *pf) +{ + int i; + + for(i=0; i<BPHYS_TOT_DATA; i++) { + if(pf->data_types & (1<<i) && !ptcache_file_write(pf, pf->cur[i], 1, BKE_ptcache_data_size(i))) + return 0; } + + return 1; +} +static int ptcache_file_read_header_begin(PTCacheFile *pf) +{ + int error=0; + char bphysics[8]; + + pf->data_types = 0; + + if(fread(bphysics, sizeof(char), 8, pf->fp) != 8) + error = 1; + + if(!error && strncmp(bphysics, "BPHYSICS", 8)) + error = 1; - return 0; + if(!error && !fread(&pf->type, sizeof(int), 1, pf->fp)) + error = 1; + + /* if there was an error set file as it was */ + if(error) + fseek(pf->fp, 0, SEEK_SET); + + return !error; } -void BKE_ptcache_update_info(PTCacheID *pid) + +static int ptcache_file_write_header_begin(PTCacheFile *pf) { - PointCache *cache = pid->cache; - int totframes = 0; - char mem_info[64]; + char *bphysics = "BPHYSICS"; + + if(fwrite(bphysics, sizeof(char), 8, pf->fp) != 8) + return 0; - if(cache->flag & PTCACHE_EXTERNAL) { - int cfra = cache->startframe; + if(!fwrite(&pf->type, sizeof(int), 1, pf->fp)) + return 0; + + return 1; +} - for(; cfra<=cache->endframe; cfra++) { - if(BKE_ptcache_id_exist(pid, cfra)) - totframes++; - } - if(totframes) - sprintf(cache->info, "%i points read for %i frames", cache->totpoint, totframes); +/* Data pointer handling */ +int BKE_ptcache_data_size(int data_type) +{ + switch(data_type) { + case BPHYS_DATA_INDEX: + return sizeof(int); + case BPHYS_DATA_LOCATION: + case BPHYS_DATA_VELOCITY: + case BPHYS_DATA_AVELOCITY: /* also BPHYS_DATA_XCONST */ + case BPHYS_DATA_TIMES: + return 3 * sizeof(float); + case BPHYS_DATA_ROTATION: + return 4 * sizeof(float); + case BPHYS_DATA_SIZE: + return sizeof(float); + case BPHYS_DATA_BOIDS: + return sizeof(BoidData); + default: + return 0; + } +} +static void ptcache_data_to(void **data, int type, int index, void *to) +{ + if(data[type]) { + if(index) + memcpy(to, (char*)data[type] + index * BKE_ptcache_data_size(type), BKE_ptcache_data_size(type)); else - sprintf(cache->info, "No valid data to read!"); - return; + memcpy(to, data[type], BKE_ptcache_data_size(type)); } +} - if(cache->flag & PTCACHE_DISK_CACHE) { - int cfra = cache->startframe; +static void ptcache_data_from(void **data, int type, void *from) +{ + if(data[type]) + memcpy(data[type], from, BKE_ptcache_data_size(type)); +} - for(; cfra<=cache->endframe; cfra++) { - if(BKE_ptcache_id_exist(pid, cfra)) - totframes++; - } +static void ptcache_file_init_pointers(PTCacheFile *pf) +{ + int data_types = pf->data_types; + + pf->cur[BPHYS_DATA_INDEX] = data_types & (1<<BPHYS_DATA_INDEX) ? &pf->data.index : NULL; + pf->cur[BPHYS_DATA_LOCATION] = data_types & (1<<BPHYS_DATA_LOCATION) ? &pf->data.loc : NULL; + pf->cur[BPHYS_DATA_VELOCITY] = data_types & (1<<BPHYS_DATA_VELOCITY) ? &pf->data.vel : NULL; + pf->cur[BPHYS_DATA_ROTATION] = data_types & (1<<BPHYS_DATA_ROTATION) ? &pf->data.rot : NULL; + pf->cur[BPHYS_DATA_AVELOCITY] = data_types & (1<<BPHYS_DATA_AVELOCITY) ? &pf->data.ave : NULL; + pf->cur[BPHYS_DATA_SIZE] = data_types & (1<<BPHYS_DATA_SIZE) ? &pf->data.size : NULL; + pf->cur[BPHYS_DATA_TIMES] = data_types & (1<<BPHYS_DATA_TIMES) ? &pf->data.times : NULL; + pf->cur[BPHYS_DATA_BOIDS] = data_types & (1<<BPHYS_DATA_BOIDS) ? &pf->data.boids : NULL; +} - sprintf(mem_info, "%i frames on disk", totframes); - } - else { - PTCacheMem *pm = cache->mem_cache.first; - float framesize = 0.0f, bytes = 0.0f; - int mb; +static void ptcache_mem_init_pointers(PTCacheMem *pm) +{ + int data_types = pm->data_types; + int i; - if(pm) - framesize = (float)ptcache_pid_elemsize(pid) * (float)pm->totpoint; - - for(; pm; pm=pm->next) - totframes++; + for(i=0; i<BPHYS_TOT_DATA; i++) + pm->cur[i] = data_types & (1<<i) ? pm->data[i] : NULL; +} - bytes = totframes * framesize; +static void ptcache_mem_incr_pointers(PTCacheMem *pm) +{ + int i; - mb = (bytes > 1024.0f * 1024.0f); + for(i=0; i<BPHYS_TOT_DATA; i++) { + if(pm->cur[i]) + pm->cur[i] = (char*)pm->cur[i] + BKE_ptcache_data_size(i); + } +} +static void ptcache_alloc_data(PTCacheMem *pm) +{ + int data_types = pm->data_types; + int totpoint = pm->totpoint; + int i; - sprintf(mem_info, "%i frames in memory (%.1f %s)", - totframes, - bytes / (mb ? 1024.0f * 1024.0f : 1024.0f), - mb ? "Mb" : "kb"); + for(i=0; i<BPHYS_TOT_DATA; i++) { + if(data_types & (1<<i)) + pm->data[i] = MEM_callocN(totpoint * BKE_ptcache_data_size(i), "PTCache Data"); } +} +static void ptcache_free_data(void *data[]) +{ + int i; - if(cache->flag & PTCACHE_OUTDATED) { - sprintf(cache->info, "%s, cache is outdated!", mem_info); + for(i=0; i<BPHYS_TOT_DATA; i++) { + if(data[i]) + MEM_freeN(data[i]); } - else if(cache->flag & PTCACHE_FRAMES_SKIPPED) { - sprintf(cache->info, "%s, not exact since frame %i.", mem_info, cache->last_exact); +} +static void ptcache_copy_data(void *from[], void *to[]) +{ + int i; + for(i=0; i<BPHYS_TOT_DATA; i++) { + if(from[i]) + memcpy(to[i], from[i], BKE_ptcache_data_size(i)); } - else - sprintf(cache->info, "%s.", mem_info); } + + + +static int ptcache_pid_old_elemsize(PTCacheID *pid) +{ + if(pid->type==PTCACHE_TYPE_SOFTBODY) + return 6 * sizeof(float); + else if(pid->type==PTCACHE_TYPE_PARTICLES) + return sizeof(ParticleKey); + else if(pid->type==PTCACHE_TYPE_CLOTH) + return 9 * sizeof(float); + + return 0; +} + /* reads cache from disk or memory */ /* possible to get old or interpolated result */ -int BKE_ptcache_read_cache(PTCacheReader *reader) +int BKE_ptcache_read_cache(PTCacheID *pid, float cfra, float frs_sec) { - PTCacheID *pid = reader->pid; PTCacheFile *pf=NULL, *pf2=NULL; PTCacheMem *pm=NULL, *pm2=NULL; - int totelem = reader->totelem; - float cfra = reader->cfra; + float old_data1[14], old_data2[14]; int cfrai = (int)cfra; - int elemsize = ptcache_pid_elemsize(pid); - int i, incr = elemsize / sizeof(float); - float frs_sec = reader->scene->r.frs_sec; - int cfra1=0, cfra2; - int ret = 0; + int old_elemsize = ptcache_pid_old_elemsize(pid); + int i; + + int cfra1 = 0, cfra2 = 0; + int totpoint = 0, totpoint2 = 0; + int *index = &i, *index2 = &i; + int use_old = 0, old_frame; + + int ret = 0, error = 0; - if(totelem == 0) + /* nothing to read to */ + if(pid->totpoint(pid->calldata) == 0) return 0; + if(pid->cache->flag & PTCACHE_READ_INFO) { + pid->cache->flag &= ~PTCACHE_READ_INFO; + BKE_ptcache_read_cache(pid, 0, frs_sec); + } + /* first check if we have the actual frame cached */ if(cfra == (float)cfrai) { if(pid->cache->flag & PTCACHE_DISK_CACHE) { - pf= BKE_ptcache_file_open(pid, PTCACHE_FILE_READ, cfrai); + pf= ptcache_file_open(pid, PTCACHE_FILE_READ, cfrai); } else { pm = pid->cache->mem_cache.first; @@ -432,240 +1006,297 @@ int BKE_ptcache_read_cache(PTCacheReader *reader) } } - /* if found, use exact frame */ - if(pf || pm) { - float *data; - - if(pm) - data = pm->data; - else - data = MEM_callocN(elemsize, "pointcache read data"); + /* no exact cache frame found so try to find cached frames around cfra */ + if(!pm && !pf) { + if(pid->cache->flag & PTCACHE_DISK_CACHE) { + pf=NULL; + while(cfrai > pid->cache->startframe && !pf) { + cfrai--; + pf= ptcache_file_open(pid, PTCACHE_FILE_READ, cfrai); + cfra1 = cfrai; + } - for(i=0; i<totelem; i++) { - if(pf) { - if(!BKE_ptcache_file_read_floats(pf, data, incr)) { - BKE_ptcache_file_close(pf); - MEM_freeN(data); - return 0; - } + old_frame = cfrai; - reader->set_elem(i, reader->calldata, data); + cfrai = (int)cfra; + while(cfrai < pid->cache->endframe && !pf2) { + cfrai++; + pf2= ptcache_file_open(pid, PTCACHE_FILE_READ, cfrai); + cfra2 = cfrai; } - else { - reader->set_elem(i, reader->calldata, data); - data += incr; + + if(pf && !pf2) { + pf2 = pf; + pf = NULL; } } + else if(pid->cache->mem_cache.first){ + pm = pid->cache->mem_cache.first; - if(pf) { - BKE_ptcache_file_close(pf); - pf = NULL; - MEM_freeN(data); - } + while(pm->next && pm->next->frame < cfra) + pm= pm->next; - ret = PTCACHE_READ_EXACT; - } + if(pm) { + old_frame = pm->frame; + cfra1 = pm->frame; + } - if(ret) - ; - /* no exact cache frame found so try to find cached frames around cfra */ - else if(pid->cache->flag & PTCACHE_DISK_CACHE) { - pf=NULL; - while(cfrai > pid->cache->startframe && !pf) { - cfrai--; - pf= BKE_ptcache_file_open(pid, PTCACHE_FILE_READ, cfrai); - cfra1 = cfrai; - } + pm2 = pid->cache->mem_cache.last; - if(reader->old_frame) - *(reader->old_frame) = cfrai; + if(pm2 && pm2->frame < cfra) + pm2 = NULL; + else { + while(pm2->prev && pm2->prev->frame > cfra) + pm2= pm2->prev; - cfrai = (int)cfra; - while(cfrai < pid->cache->endframe && !pf2) { - cfrai++; - pf2= BKE_ptcache_file_open(pid, PTCACHE_FILE_READ, cfrai); - cfra2 = cfrai; + if(pm2) + cfra2 = pm2->frame; + } + + if(pm && !pm2) { + pm2 = pm; + pm = NULL; + } } } - else if(pid->cache->mem_cache.first){ - pm = pid->cache->mem_cache.first; - while(pm->next && pm->next->frame < cfra) - pm= pm->next; + if(!pm && !pm2 && !pf && !pf2) + return 0; - if(pm) { - if(reader->old_frame) - *(reader->old_frame) = pm->frame; - cfra1 = pm->frame; + if(pm) { + ptcache_mem_init_pointers(pm); + totpoint = pm->totpoint; + index = pm->data_types & (1<<BPHYS_DATA_INDEX) ? pm->cur[BPHYS_DATA_INDEX] : &i; + } + if(pm2) { + ptcache_mem_init_pointers(pm2); + totpoint2 = pm2->totpoint; + index2 = pm2->data_types & (1<<BPHYS_DATA_INDEX) ? pm2->cur[BPHYS_DATA_INDEX] : &i; + } + if(pf) { + if(ptcache_file_read_header_begin(pf)) { + if(pf->type != pid->type) { + /* todo report error */ + ptcache_file_close(pf); + pf = NULL; + } + else if(pid->read_header(pf)) { + ptcache_file_init_pointers(pf); + totpoint = pf->totpoint; + index = pf->data_types & BPHYS_DATA_INDEX ? &pf->data.index : &i; + } } - - pm2 = pid->cache->mem_cache.last; - - if(pm2 && pm2->frame < cfra) - pm2 = NULL; else { - while(pm2->prev && pm2->prev->frame > cfra) - pm2= pm2->prev; - - if(pm2) - cfra2 = pm2->frame; + /* fall back to old cache file format */ + use_old = 1; + totpoint = pid->totpoint(pid->calldata); } } - - if(ret) - ; - else if((pf && pf2) || (pm && pm2)) { - /* interpolate from nearest frames if cache isn't outdated */ - float *data1, *data2; - - if(pm) { - data1 = pm->data; - data2 = pm2->data; + if(pf2) { + if(ptcache_file_read_header_begin(pf2)) { + if(pf2->type != pid->type) { + /* todo report error */ + ptcache_file_close(pf2); + pf2 = NULL; + } + else if(pid->read_header(pf2)) { + ptcache_file_init_pointers(pf2); + totpoint2 = pf2->totpoint; + index2 = pf->data_types & BPHYS_DATA_INDEX ? &pf2->data.index : &i; + } } else { - data1 = MEM_callocN(elemsize, "pointcache read data1"); - data2 = MEM_callocN(elemsize, "pointcache read data2"); + /* fall back to old cache file format */ + use_old = 1; + totpoint2 = pid->totpoint(pid->calldata); } + } - for(i=0; i<totelem; i++) { - if(pf && pf2) { - if(!BKE_ptcache_file_read_floats(pf, data1, incr)) { - BKE_ptcache_file_close(pf); - BKE_ptcache_file_close(pf2); - MEM_freeN(data1); - MEM_freeN(data2); - return 0; - } - if(!BKE_ptcache_file_read_floats(pf2, data2, incr)) { - BKE_ptcache_file_close(pf); - BKE_ptcache_file_close(pf2); - MEM_freeN(data1); - MEM_freeN(data2); - return 0; - } - reader->interpolate_elem(i, reader->calldata, frs_sec, cfra, (float)cfra1, (float)cfra2, data1, data2); + /* don't read old cache if allready simulated past cached frame */ + if(!pm && !pf && cfra1 && cfra1 <= pid->cache->simframe) + error = 1; + if(cfra1 && cfra1==cfra2) + error = 1; + + if(!error) + { + if(pf && pid->read_stream) { + if(totpoint != pid->totpoint(pid->calldata)) + error = 1; + else + { + // we have stream writing here + pid->read_stream(pf, pid->calldata); + } + } + } + + totpoint = MIN2(totpoint, pid->totpoint(pid->calldata)); + + if(!error) + { + for(i=0; i<totpoint; i++) { + /* read old cache file format */ + if(use_old) { + if(pid->read_elem && ptcache_file_read(pf, (void*)old_data1, 1, old_elemsize)) + pid->read_elem(i, pid->calldata, NULL, frs_sec, cfra, old_data1); + else + { error = 1; break; } } else { - reader->interpolate_elem(i, reader->calldata, frs_sec, cfra, (float)cfra1, (float)cfra2, data1, data2); - data1 += incr; - data2 += incr; + if(pid->read_elem && (pm || ptcache_file_read_data(pf))) + pid->read_elem(*index, pid->calldata, pm ? pm->cur : pf->cur, frs_sec, cfra1 ? (float)cfra1 : (float)cfrai, NULL); + else + { error = 1; break; } } - } - if(pf) { - BKE_ptcache_file_close(pf); - pf = NULL; - BKE_ptcache_file_close(pf2); - pf2 = NULL; - MEM_freeN(data1); - MEM_freeN(data2); + if(pm) { + ptcache_mem_incr_pointers(pm); + index = pm->data_types & (1<<BPHYS_DATA_INDEX) ? pm->cur[BPHYS_DATA_INDEX] : &i; + } } - - ret = PTCACHE_READ_INTERPOLATED; } - else if(pf || pm) { - /* use last valid cache frame */ - float *data; - - /* don't read cache if allready simulated past cached frame */ - if(cfra1 && cfra1 <= pid->cache->simframe) { - if(pf) - BKE_ptcache_file_close(pf); - if(pf2) - BKE_ptcache_file_close(pf2); - return 0; + if(!error) + { + if(pf2 && pid->read_stream) { + if(totpoint2 != pid->totpoint(pid->calldata)) + error = 1; + else + { + // we have stream writing here + pid->read_stream(pf2, pid->calldata); + } } + } - if(pm) - data = pm->data; - else - data = MEM_callocN(elemsize, "pointcache read data"); - - for(i=0; i<totelem; i++) { - if(pf) { - if(!BKE_ptcache_file_read_floats(pf, data, incr)) { - BKE_ptcache_file_close(pf); - if(pf2) - BKE_ptcache_file_close(pf2); - return 0; + totpoint2 = MIN2(totpoint2, pid->totpoint(pid->calldata)); + + if(!error) + { + for(i=0; i<totpoint2; i++) { + /* read old cache file format */ + if(use_old) { + if(pid->read_elem && ptcache_file_read(pf2, (void*)old_data2, 1, old_elemsize)) { + if(!pf && pf2) + pid->read_elem(i, pid->calldata, NULL, frs_sec, (float)cfra2, old_data2); + else if(pid->interpolate_elem) + pid->interpolate_elem(i, pid->calldata, NULL, frs_sec, cfra, (float)cfra1, (float)cfra2, old_data2); + else + { error = 1; break; } } - reader->set_elem(i, reader->calldata, data); + else + { error = 1; break; } } else { - reader->set_elem(i, reader->calldata, data); - data += incr; + if(pid->read_elem && (pm2 || ptcache_file_read_data(pf2))) { + if((!pf && pf2) || (!pm && pm2)) + pid->read_elem(*index2, pid->calldata, pm2 ? pm2->cur : pf2->cur, frs_sec, (float)cfra2, NULL); + else if(pid->interpolate_elem) + pid->interpolate_elem(*index2, pid->calldata, pm2 ? pm2->cur : pf2->cur, frs_sec, cfra, (float)cfra1, (float)cfra2, NULL); + else + { error = 1; break; } + } + else + { error = 1; break; } } - } - if(pf) { - BKE_ptcache_file_close(pf); - pf = NULL; - MEM_freeN(data); - } - if(pf2) { - BKE_ptcache_file_close(pf2); - pf = NULL; + if(pm2) { + ptcache_mem_incr_pointers(pm2); + index2 = pm2->data_types & (1<<BPHYS_DATA_INDEX) ? pm2->cur[BPHYS_DATA_INDEX] : &i; + } } + } + if(pm || pf) + ret = (pm2 || pf2) ? PTCACHE_READ_INTERPOLATED : PTCACHE_READ_EXACT; + else if(pm2 || pf2) { ret = PTCACHE_READ_OLD; + pid->cache->simframe = old_frame; } - if(pf) - BKE_ptcache_file_close(pf); - if(pf2) - BKE_ptcache_file_close(pf2); + if(pf) { + ptcache_file_close(pf); + pf = NULL; + } + + if(pf2) { + ptcache_file_close(pf2); + pf = NULL; + } if((pid->cache->flag & PTCACHE_QUICK_CACHE)==0) { + cfrai = (int)cfra; /* clear invalid cache frames so that better stuff can be simulated */ if(pid->cache->flag & PTCACHE_OUTDATED) { - BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, cfra); + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, cfrai); } else if(pid->cache->flag & PTCACHE_FRAMES_SKIPPED) { if(cfra <= pid->cache->last_exact) pid->cache->flag &= ~PTCACHE_FRAMES_SKIPPED; - BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, MAX2(cfra,pid->cache->last_exact)); + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, MAX2(cfrai,pid->cache->last_exact)); } } - return ret; + return (error ? 0 : ret); } +/* TODO for later */ +//static void ptcache_make_index_array(PTCacheMem *pm, int totpoint) +//{ +// int i, *index; +// +// if(pm->index_array) { +// MEM_freeN(pm->index_array); +// pm->index_array = NULL; +// } +// +// if(!pm->data[BPHYS_DATA_INDEX]) +// return; +// +// pm->index_array = MEM_callocN(totpoint * sizeof(int), "PTCacheMem index_array"); +// index = pm->data[BPHYS_DATA_INDEX]; +// +// for(i=0; i<pm->totpoint; i++, index++) +// pm->index_array[*index] = i; +//} /* writes cache to disk or memory */ -int BKE_ptcache_write_cache(PTCacheWriter *writer) +int BKE_ptcache_write_cache(PTCacheID *pid, int cfra) { - PointCache *cache = writer->pid->cache; + PointCache *cache = pid->cache; PTCacheFile *pf= NULL; - int elemsize = ptcache_pid_elemsize(writer->pid); - int i, incr = elemsize / sizeof(float); + int i; + int totpoint = pid->totpoint(pid->calldata); int add = 0, overwrite = 0; - float temp[14]; - if(writer->totelem == 0 || writer->cfra <= 0) + if(totpoint == 0 || cfra < 0 + || (cfra ? pid->data_types == 0 : pid->info_types == 0)) return 0; if(cache->flag & PTCACHE_DISK_CACHE) { - int cfra = cache->endframe; + int efra = cache->endframe; + if(cfra==0) + add = 1; /* allways start from scratch on the first frame */ - if(writer->cfra == cache->startframe) { - BKE_ptcache_id_clear(writer->pid, PTCACHE_CLEAR_ALL, writer->cfra); + else if(cfra == cache->startframe) { + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, cfra); cache->flag &= ~PTCACHE_REDO_NEEDED; add = 1; } else { - int ocfra; + int ofra; /* find last cached frame */ - while(cfra > cache->startframe && !BKE_ptcache_id_exist(writer->pid, cfra)) - cfra--; + while(efra > cache->startframe && !BKE_ptcache_id_exist(pid, efra)) + efra--; /* find second last cached frame */ - ocfra = cfra-1; - while(ocfra > cache->startframe && !BKE_ptcache_id_exist(writer->pid, ocfra)) - ocfra--; + ofra = efra-1; + while(ofra > cache->startframe && !BKE_ptcache_id_exist(pid, ofra)) + ofra--; - if(cfra >= cache->startframe && writer->cfra > cfra) { - if(ocfra >= cache->startframe && cfra - ocfra < cache->step) + if(efra >= cache->startframe && cfra > efra) { + if(ofra >= cache->startframe && efra - ofra < cache->step) overwrite = 1; else add = 1; @@ -674,74 +1305,92 @@ int BKE_ptcache_write_cache(PTCacheWriter *writer) if(add || overwrite) { if(overwrite) - BKE_ptcache_id_clear(writer->pid, PTCACHE_CLEAR_FRAME, cfra); + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_FRAME, efra); - pf = BKE_ptcache_file_open(writer->pid, PTCACHE_FILE_WRITE, writer->cfra); + pf = ptcache_file_open(pid, PTCACHE_FILE_WRITE, cfra); if(!pf) return 0; - for(i=0; i<writer->totelem; i++) { - writer->set_elem(i, writer->calldata, temp); - BKE_ptcache_file_write_floats(pf, temp, incr); + pf->type = pid->type; + pf->totpoint = cfra ? totpoint : pid->totwrite(pid->calldata); + pf->data_types = cfra ? pid->data_types : pid->info_types; + + if(!ptcache_file_write_header_begin(pf) || !pid->write_header(pf)) { + ptcache_file_close(pf); + return 0; } + + ptcache_file_init_pointers(pf); + + if(pf && pid->write_stream) { + // we have stream writing here + pid->write_stream(pf, pid->calldata); + } + else + for(i=0; i<totpoint; i++) { + if(pid->write_elem && pid->write_elem(i, pid->calldata, pf->cur)) + if(!ptcache_file_write_data(pf)) { + ptcache_file_close(pf); + return 0; + } + } } } else { PTCacheMem *pm; PTCacheMem *pm2; - float *pmdata; pm2 = cache->mem_cache.first; + /* don't write info file in memory */ + if(cfra==0) + return 1; /* allways start from scratch on the first frame */ - if(writer->cfra == cache->startframe) { - BKE_ptcache_id_clear(writer->pid, PTCACHE_CLEAR_ALL, writer->cfra); + if(cfra == cache->startframe) { + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, cfra); cache->flag &= ~PTCACHE_REDO_NEEDED; add = 1; } - else { + else if (cache->mem_cache.last) { pm2 = cache->mem_cache.last; - if(pm2 && writer->cfra > pm2->frame) { + if(pm2 && cfra > pm2->frame) { if(pm2->prev && pm2->frame - pm2->prev->frame < cache->step) overwrite = 1; else add = 1; } } + else + add = 1; - if(overwrite) { - pm = cache->mem_cache.last; - pmdata = pm->data; - - for(i=0; i<writer->totelem; i++, pmdata+=incr) { - writer->set_elem(i, writer->calldata, temp); - memcpy(pmdata, temp, elemsize); - } + if(add || overwrite) { + if(overwrite) + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_FRAME, pm2->frame); - pm->frame = writer->cfra; - } - else if(add) { pm = MEM_callocN(sizeof(PTCacheMem), "Pointcache mem"); - pm->data = MEM_callocN(elemsize * writer->totelem, "Pointcache mem data"); - pmdata = pm->data; - for(i=0; i<writer->totelem; i++, pmdata+=incr) { - writer->set_elem(i, writer->calldata, temp); - memcpy(pmdata, temp, elemsize); - } + pm->totpoint = pid->totwrite(pid->calldata); + pm->data_types = cfra ? pid->data_types : pid->info_types; + + ptcache_alloc_data(pm); + ptcache_mem_init_pointers(pm); - pm->frame = writer->cfra; - pm->totpoint = writer->totelem; + for(i=0; i<totpoint; i++) { + if(pid->write_elem && pid->write_elem(i, pid->calldata, pm->cur)) + ptcache_mem_incr_pointers(pm); + } + //ptcache_make_index_array(pm, pid->totpoint(pid->calldata)); + pm->frame = cfra; BLI_addtail(&cache->mem_cache, pm); } } if(add || overwrite) { - if(writer->cfra - cache->last_exact == 1 - || writer->cfra == cache->startframe) { - cache->last_exact = writer->cfra; + if(cfra - cache->last_exact == 1 + || cfra == cache->startframe) { + cache->last_exact = cfra; cache->flag &= ~PTCACHE_FRAMES_SKIPPED; } else @@ -749,9 +1398,9 @@ int BKE_ptcache_write_cache(PTCacheWriter *writer) } if(pf) - BKE_ptcache_file_close(pf); + ptcache_file_close(pf); - BKE_ptcache_update_info(writer->pid); + BKE_ptcache_update_info(pid); return 1; } @@ -759,7 +1408,7 @@ int BKE_ptcache_write_cache(PTCacheWriter *writer) * mode - PTCACHE_CLEAR_ALL, */ - +/* Clears & resets */ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra) { int len; /* store the length of the string */ @@ -806,7 +1455,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra) BLI_delete(path_full, 0, 0); } else { /* read the number of the file */ - int frame, len2 = strlen(de->d_name); + int frame, len2 = (int)strlen(de->d_name); char num[7]; if (len2 > 15) { /* could crash if trying to copy a string out of this range*/ @@ -833,7 +1482,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra) if(mode == PTCACHE_CLEAR_ALL) { pid->cache->last_exact = 0; for(; pm; pm=pm->next) - MEM_freeN(pm->data); + ptcache_free_data(pm->data); BLI_freelistN(&pid->cache->mem_cache); } else { while(pm) { @@ -841,7 +1490,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra) (mode==PTCACHE_CLEAR_AFTER && pm->frame > cfra) ) { link = pm; pm = pm->next; - MEM_freeN(link->data); + ptcache_free_data(link->data); BLI_freelinkN(&pid->cache->mem_cache, link); } else @@ -863,7 +1512,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra) for(; pm; pm=pm->next) { if(pm->frame == cfra) { - MEM_freeN(pm->data); + ptcache_free_data(pm->data); BLI_freelinkN(&pid->cache->mem_cache, pm); break; } @@ -985,11 +1634,13 @@ int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode) cache->last_exact= 0; if(pid->type == PTCACHE_TYPE_CLOTH) - cloth_free_modifier(pid->ob, pid->data); + cloth_free_modifier(pid->ob, pid->calldata); else if(pid->type == PTCACHE_TYPE_SOFTBODY) - sbFreeSimulation(pid->data); + sbFreeSimulation(pid->calldata); else if(pid->type == PTCACHE_TYPE_PARTICLES) - psys_reset(pid->data, PSYS_RESET_DEPSGRAPH); + psys_reset(pid->calldata, PSYS_RESET_DEPSGRAPH); + else if(pid->type == PTCACHE_TYPE_SMOKE_DOMAIN_LOW) + smokeModifier_reset(pid->calldata); } if(clear) BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0); @@ -1038,6 +1689,17 @@ int BKE_ptcache_object_reset(Scene *scene, Object *ob, int mode) BKE_ptcache_id_from_cloth(&pid, ob, (ClothModifierData*)md); reset |= BKE_ptcache_id_reset(scene, &pid, mode); } + /* + // enabled on next commit + if(md->type == eModifierType_Smoke) { + SmokeModifierData *smd = (SmokeModifierData *)md; + if(smd->type & MOD_SMOKE_TYPE_DOMAIN) + { + BKE_ptcache_id_from_smoke(&pid, ob, (SmokeModifierData*)md, 0); + reset |= BKE_ptcache_id_reset(scene, &pid, mode); + } + } + */ } return reset; @@ -1107,9 +1769,9 @@ int BKE_ptcache_get_continue_physics() return CONTINUE_PHYSICS; } -/* Point Cache */ +/* Point Cache handling */ -PointCache *BKE_ptcache_add() +PointCache *BKE_ptcache_add(ListBase *ptcaches) { PointCache *cache; @@ -1118,23 +1780,41 @@ PointCache *BKE_ptcache_add() cache->endframe= 250; cache->step= 10; + BLI_addtail(ptcaches, cache); + return cache; } -void BKE_ptcache_free(PointCache *cache) +void BKE_ptache_free_mem(PointCache *cache) { PTCacheMem *pm = cache->mem_cache.first; + if(pm) { - for(; pm; pm=pm->next) - MEM_freeN(pm->data); + for(; pm; pm=pm->next) { + ptcache_free_data(pm->data); + if(pm->index_array) + MEM_freeN(pm->index_array); + } BLI_freelistN(&cache->mem_cache); } - +} +void BKE_ptcache_free(PointCache *cache) +{ + BKE_ptache_free_mem(cache); MEM_freeN(cache); } +void BKE_ptcache_free_list(ListBase *ptcaches) +{ + PointCache *cache = ptcaches->first; + + for(; cache; cache=cache->next) + BKE_ptache_free_mem(cache); -PointCache *BKE_ptcache_copy(PointCache *cache) + BLI_freelistN(ptcaches); +} + +static PointCache *ptcache_copy(PointCache *cache) { PointCache *ncache; @@ -1149,7 +1829,18 @@ PointCache *BKE_ptcache_copy(PointCache *cache) return ncache; } +/* returns first point cache */ +PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old) +{ + PointCache *cache = ptcaches_old->first; + ptcaches_new->first = ptcaches_new->last = NULL; + + for(; cache; cache=cache->next) + BLI_addtail(ptcaches_new, ptcache_copy(cache)); + + return ptcaches_new->first; +} /* Baking */ @@ -1227,7 +1918,7 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker) cache = pid->cache; if((cache->flag & PTCACHE_BAKED)==0) { if(pid->type==PTCACHE_TYPE_PARTICLES) - psys_get_pointcache_start_end(scene, pid->data, &cache->startframe, &cache->endframe); + psys_get_pointcache_start_end(scene, pid->calldata, &cache->startframe, &cache->endframe); if(bake || cache->flag & PTCACHE_REDO_NEEDED) BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0); @@ -1253,12 +1944,12 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker) cache = pid->cache; if((cache->flag & PTCACHE_BAKED)==0) { if(pid->type==PTCACHE_TYPE_PARTICLES) { - ParticleSystem *psys = (ParticleSystem*)pid->data; + ParticleSystem *psys = (ParticleSystem*)pid->calldata; /* skip hair & keyed particles */ if(psys->part->type == PART_HAIR || psys->part->phystype == PART_PHYS_KEYED) continue; - psys_get_pointcache_start_end(scene, pid->data, &cache->startframe, &cache->endframe); + psys_get_pointcache_start_end(scene, pid->calldata, &cache->startframe, &cache->endframe); } if((cache->flag & PTCACHE_REDO_NEEDED || (cache->flag & PTCACHE_SIMULATION_VALID)==0) @@ -1285,10 +1976,10 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker) scene->r.framelen = 1.0; for(; CFRA <= endframe; CFRA+=step) { - float prog; + int prog; if(bake) - prog = (int)(100.0 * (float)(CFRA - startframe)/(float)(endframe-startframe)); + prog = (int)(100.0f * (float)(CFRA - startframe)/(float)(endframe-startframe)); else prog = CFRA; @@ -1307,15 +1998,19 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker) if(pid) { cache->flag &= ~(PTCACHE_BAKING|PTCACHE_REDO_NEEDED); cache->flag |= PTCACHE_SIMULATION_VALID; - if(bake) + if(bake) { cache->flag |= PTCACHE_BAKED; + /* write info file */ + if(cache->flag & PTCACHE_DISK_CACHE) + BKE_ptcache_write_cache(pid, 0); + } } else for(base=scene->base.first; base; base= base->next) { BKE_ptcache_ids_from_object(&pidlist, base->object); for(pid=pidlist.first; pid; pid=pid->next) { /* skip hair particles */ - if(pid->type==PTCACHE_TYPE_PARTICLES && ((ParticleSystem*)pid->data)->part->type == PART_HAIR) + if(pid->type==PTCACHE_TYPE_PARTICLES && ((ParticleSystem*)pid->calldata)->part->type == PART_HAIR) continue; cache = pid->cache; @@ -1327,8 +2022,11 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker) cache->flag |= PTCACHE_SIMULATION_VALID; - if(bake) + if(bake) { cache->flag |= PTCACHE_BAKED; + if(cache->flag & PTCACHE_DISK_CACHE) + BKE_ptcache_write_cache(pid, 0); + } } BLI_freelistN(&pidlist); } @@ -1341,97 +2039,141 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker) /* TODO: call redraw all windows somehow */ } - -void BKE_ptcache_toggle_disk_cache(PTCacheID *pid) { +/* Helpers */ +void BKE_ptcache_disk_to_mem(PTCacheID *pid) +{ PointCache *cache = pid->cache; PTCacheFile *pf; PTCacheMem *pm; - int totelem=0; - int float_count=0; - int tot; - int last_exact = cache->last_exact; - if (!G.relbase_valid){ - cache->flag &= ~PTCACHE_DISK_CACHE; - printf("File must be saved before using disk cache!\n"); - return; - } + int cfra, sfra = cache->startframe, efra = cache->endframe; + int i; - totelem = ptcache_pid_totelem(pid); - float_count = ptcache_pid_elemsize(pid) / sizeof(float); + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0); - if(totelem==0 || float_count==0) - return; + for(cfra=sfra; cfra <= efra; cfra++) { + pf = ptcache_file_open(pid, PTCACHE_FILE_READ, cfra); - tot = totelem*float_count; + if(pf) { + if(!ptcache_file_read_header_begin(pf)) { + printf("Can't yet convert old cache format\n"); + cache->flag |= PTCACHE_DISK_CACHE; + ptcache_file_close(pf); + return; + } - /* MEM -> DISK */ - if(cache->flag & PTCACHE_DISK_CACHE) { - pm = cache->mem_cache.first; + if(pf->type != pid->type || !pid->read_header(pf)) { + cache->flag |= PTCACHE_DISK_CACHE; + ptcache_file_close(pf); + return; + } + + pm = MEM_callocN(sizeof(PTCacheMem), "Pointcache mem"); - BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0); + pm->totpoint = pf->totpoint; + pm->data_types = pf->data_types; + pm->frame = cfra; - for(; pm; pm=pm->next) { - pf = BKE_ptcache_file_open(pid, PTCACHE_FILE_WRITE, pm->frame); + ptcache_alloc_data(pm); + ptcache_mem_init_pointers(pm); + ptcache_file_init_pointers(pf); - if(pf) { - if(fwrite(pm->data, sizeof(float), tot, pf->fp) != tot) { - printf("Error writing to disk cache\n"); + for(i=0; i<pm->totpoint; i++) { + if(!ptcache_file_read_data(pf)) { + printf("Error reading from disk cache\n"); - cache->flag &= ~PTCACHE_DISK_CACHE; + cache->flag |= PTCACHE_DISK_CACHE; + + ptcache_free_data(pm->data); + MEM_freeN(pm); + ptcache_file_close(pf); - BKE_ptcache_file_close(pf); return; } - BKE_ptcache_file_close(pf); + ptcache_copy_data(pf->cur, pm->cur); + ptcache_mem_incr_pointers(pm); } - else - printf("Error creating disk cache file\n"); - } - cache->flag &= ~PTCACHE_DISK_CACHE; - BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0); - cache->flag |= PTCACHE_DISK_CACHE; + //ptcache_make_index_array(pm, pid->totpoint(pid->calldata)); + + BLI_addtail(&pid->cache->mem_cache, pm); + + ptcache_file_close(pf); + } } - /* DISK -> MEM */ - else { - int cfra; - int sfra = cache->startframe; - int efra = cache->endframe; - BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0); +} +void BKE_ptcache_mem_to_disk(PTCacheID *pid) +{ + PointCache *cache = pid->cache; + PTCacheFile *pf; + PTCacheMem *pm; + int i; - for(cfra=sfra; cfra <= efra; cfra++) { - pf = BKE_ptcache_file_open(pid, PTCACHE_FILE_READ, cfra); + pm = cache->mem_cache.first; - if(pf) { - pm = MEM_callocN(sizeof(PTCacheMem), "Pointcache mem"); - pm->data = MEM_callocN(sizeof(float)*tot, "Pointcache mem data"); + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0); - if(fread(pm->data, sizeof(float), tot, pf->fp)!= tot) { - printf("Error reading from disk cache\n"); + for(; pm; pm=pm->next) { + pf = ptcache_file_open(pid, PTCACHE_FILE_WRITE, pm->frame); - cache->flag |= PTCACHE_DISK_CACHE; + if(pf) { + pf->data_types = pm->data_types; + pf->totpoint = pm->totpoint; + pf->type = pid->type; - MEM_freeN(pm->data); - MEM_freeN(pm); - BKE_ptcache_file_close(pf); - return; - } + ptcache_mem_init_pointers(pm); + ptcache_file_init_pointers(pf); - pm->frame = cfra; - pm->totpoint = totelem; + if(!ptcache_file_write_header_begin(pf) || !pid->write_header(pf)) { + printf("Error writing to disk cache\n"); + cache->flag &= ~PTCACHE_DISK_CACHE; - BLI_addtail(&pid->cache->mem_cache, pm); + ptcache_file_close(pf); + return; + } + + for(i=0; i<pm->totpoint; i++) { + ptcache_copy_data(pm->cur, pf->cur); + if(!ptcache_file_write_data(pf)) { + printf("Error writing to disk cache\n"); + cache->flag &= ~PTCACHE_DISK_CACHE; - BKE_ptcache_file_close(pf); + ptcache_file_close(pf); + return; + } + ptcache_mem_incr_pointers(pm); } + + ptcache_file_close(pf); + + /* write info file */ + if(cache->flag & PTCACHE_BAKED) + BKE_ptcache_write_cache(pid, 0); } + else + printf("Error creating disk cache file\n"); + } +} +void BKE_ptcache_toggle_disk_cache(PTCacheID *pid) +{ + PointCache *cache = pid->cache; + int last_exact = cache->last_exact; - cache->flag |= PTCACHE_DISK_CACHE; - BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0); + if (!G.relbase_valid){ cache->flag &= ~PTCACHE_DISK_CACHE; + printf("File must be saved before using disk cache!\n"); + return; } + + if(cache->flag & PTCACHE_DISK_CACHE) + BKE_ptcache_mem_to_disk(pid); + else + BKE_ptcache_disk_to_mem(pid); + + cache->flag ^= PTCACHE_DISK_CACHE; + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0); + cache->flag ^= PTCACHE_DISK_CACHE; cache->last_exact = last_exact; @@ -1440,15 +2182,16 @@ void BKE_ptcache_toggle_disk_cache(PTCacheID *pid) { void BKE_ptcache_load_external(PTCacheID *pid) { + /*todo*/ PointCache *cache = pid->cache; int len; /* store the length of the string */ + int info = 0; /* mode is same as fopen's modes */ DIR *dir; struct dirent *de; char path[MAX_PTCACHE_PATH]; char filename[MAX_PTCACHE_FILE]; - char path_full[MAX_PTCACHE_FILE]; char ext[MAX_PTCACHE_PATH]; if(!cache) @@ -1475,15 +2218,19 @@ void BKE_ptcache_load_external(PTCacheID *pid) if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ if (strncmp(filename, de->d_name, len ) == 0) { /* do we have the right prefix */ /* read the number of the file */ - int frame, len2 = strlen(de->d_name); + int frame, len2 = (int)strlen(de->d_name); char num[7]; if (len2 > 15) { /* could crash if trying to copy a string out of this range*/ BLI_strncpy(num, de->d_name + (strlen(de->d_name) - 15), sizeof(num)); frame = atoi(num); - cache->startframe = MIN2(cache->startframe, frame); - cache->endframe = MAX2(cache->endframe, frame); + if(frame) { + cache->startframe = MIN2(cache->startframe, frame); + cache->endframe = MAX2(cache->endframe, frame); + } + else + info = 1; } } } @@ -1492,18 +2239,36 @@ void BKE_ptcache_load_external(PTCacheID *pid) if(cache->startframe != MAXFRAME) { PTCacheFile *pf; - int elemsize = ptcache_pid_elemsize(pid); - int incr = elemsize / sizeof(float); - float *data = NULL; - pf= BKE_ptcache_file_open(pid, PTCACHE_FILE_READ, cache->startframe); - if(pf) { - data = MEM_callocN(elemsize, "pointcache read data"); - while(BKE_ptcache_file_read_floats(pf, data, incr)) - cache->totpoint++; - - BKE_ptcache_file_close(pf); - MEM_freeN(data); + /* read totpoint from info file (frame 0) */ + if(info) { + pf= ptcache_file_open(pid, PTCACHE_FILE_READ, 0); + + if(pf) { + if(ptcache_file_read_header_begin(pf)) { + if(pf->type == pid->type && pid->read_header(pf)) { + cache->totpoint = pf->totpoint; + cache->flag |= PTCACHE_READ_INFO; + } + else { + cache->totpoint = 0; + } + } + ptcache_file_close(pf); + } + } + /* or from any old format cache file */ + else { + float old_data[14]; + int elemsize = ptcache_pid_old_elemsize(pid); + pf= ptcache_file_open(pid, PTCACHE_FILE_READ, cache->startframe); + + if(pf) { + while(ptcache_file_read(pf, old_data, 1, elemsize)) + cache->totpoint++; + + ptcache_file_close(pf); + } } } @@ -1511,3 +2276,65 @@ void BKE_ptcache_load_external(PTCacheID *pid) BKE_ptcache_update_info(pid); } + +void BKE_ptcache_update_info(PTCacheID *pid) +{ + PointCache *cache = pid->cache; + int totframes = 0; + char mem_info[64]; + + if(cache->flag & PTCACHE_EXTERNAL) { + int cfra = cache->startframe; + + for(; cfra<=cache->endframe; cfra++) { + if(BKE_ptcache_id_exist(pid, cfra)) + totframes++; + } + + if(totframes && cache->totpoint) + sprintf(cache->info, "%i points found!", cache->totpoint); + else + sprintf(cache->info, "No valid data to read!"); + return; + } + + if(cache->flag & PTCACHE_DISK_CACHE) { + int cfra = cache->startframe; + + for(; cfra<=cache->endframe; cfra++) { + if(BKE_ptcache_id_exist(pid, cfra)) + totframes++; + } + + sprintf(mem_info, "%i frames on disk", totframes); + } + else { + PTCacheMem *pm = cache->mem_cache.first; + float framesize = 0.0f, bytes = 0.0f; + int mb; + + if(pm) + framesize = (float)ptcache_pid_old_elemsize(pid) * (float)pm->totpoint; + + for(; pm; pm=pm->next) + totframes++; + + bytes = totframes * framesize; + + mb = (bytes > 1024.0f * 1024.0f); + + sprintf(mem_info, "%i frames in memory (%.1f %s)", + totframes, + bytes / (mb ? 1024.0f * 1024.0f : 1024.0f), + mb ? "Mb" : "kb"); + } + + if(cache->flag & PTCACHE_OUTDATED) { + sprintf(cache->info, "%s, cache is outdated!", mem_info); + } + else if(cache->flag & PTCACHE_FRAMES_SKIPPED) { + sprintf(cache->info, "%s, not exact since frame %i.", mem_info, cache->last_exact); + } + else + sprintf(cache->info, "%s.", mem_info); +} diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 0a93874f24e..8488d7ab247 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -54,6 +54,7 @@ #include "DNA_meta_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" #include "DNA_texture_types.h" #include "DNA_userdef_types.h" @@ -75,8 +76,8 @@ #include "BKE_main.h" #include "BKE_node.h" #include "BKE_object.h" +#include "BKE_paint.h" #include "BKE_scene.h" -#include "BKE_sculpt.h" #include "BKE_sequence.h" #include "BKE_world.h" #include "BKE_utildefines.h" @@ -125,7 +126,112 @@ void free_qtcodecdata(QuicktimeCodecData *qcd) } } -/* copy_scene moved to src/header_info.c... should be back */ +Scene *copy_scene(Main *bmain, Scene *sce, int type) +{ + Scene *scen; + ToolSettings *ts; + Base *base, *obase; + + if(type == SCE_COPY_EMPTY) { + ListBase lb; + scen= add_scene(sce->id.name+2); + + lb= scen->r.layers; + scen->r= sce->r; + scen->r.layers= lb; + } + else { + scen= copy_libblock(sce); + BLI_duplicatelist(&(scen->base), &(sce->base)); + + clear_id_newpoins(); + + id_us_plus((ID *)scen->world); + id_us_plus((ID *)scen->set); + id_us_plus((ID *)scen->ima); + id_us_plus((ID *)scen->gm.dome.warptext); + + scen->ed= NULL; + scen->theDag= NULL; + scen->obedit= NULL; + scen->toolsettings= MEM_dupallocN(sce->toolsettings); + + ts= scen->toolsettings; + if(ts) { + if(ts->vpaint) { + ts->vpaint= MEM_dupallocN(ts->vpaint); + ts->vpaint->paintcursor= NULL; + ts->vpaint->vpaint_prev= NULL; + ts->vpaint->wpaint_prev= NULL; + copy_paint(&ts->vpaint->paint, &ts->vpaint->paint); + } + if(ts->wpaint) { + ts->wpaint= MEM_dupallocN(ts->wpaint); + ts->wpaint->paintcursor= NULL; + ts->wpaint->vpaint_prev= NULL; + ts->wpaint->wpaint_prev= NULL; + copy_paint(&ts->wpaint->paint, &ts->wpaint->paint); + } + if(ts->sculpt) { + ts->sculpt= MEM_dupallocN(ts->sculpt); + copy_paint(&ts->sculpt->paint, &ts->sculpt->paint); + } + + copy_paint(&ts->imapaint.paint, &ts->imapaint.paint); + ts->imapaint.paintcursor= NULL; + + ts->particle.paintcursor= NULL; + } + + BLI_duplicatelist(&(scen->markers), &(sce->markers)); + BLI_duplicatelist(&(scen->transform_spaces), &(sce->transform_spaces)); + BLI_duplicatelist(&(scen->r.layers), &(sce->r.layers)); + BKE_keyingsets_copy(&(scen->keyingsets), &(sce->keyingsets)); + + scen->nodetree= ntreeCopyTree(sce->nodetree, 0); + + obase= sce->base.first; + base= scen->base.first; + while(base) { + id_us_plus(&base->object->id); + if(obase==sce->basact) scen->basact= base; + + obase= obase->next; + base= base->next; + } + } + + /* make a private copy of the avicodecdata */ + if(sce->r.avicodecdata) { + scen->r.avicodecdata = MEM_dupallocN(sce->r.avicodecdata); + scen->r.avicodecdata->lpFormat = MEM_dupallocN(scen->r.avicodecdata->lpFormat); + scen->r.avicodecdata->lpParms = MEM_dupallocN(scen->r.avicodecdata->lpParms); + } + + /* make a private copy of the qtcodecdata */ + if(sce->r.qtcodecdata) { + scen->r.qtcodecdata = MEM_dupallocN(sce->r.qtcodecdata); + scen->r.qtcodecdata->cdParms = MEM_dupallocN(scen->r.qtcodecdata->cdParms); + } + + /* NOTE: part of SCE_COPY_LINK_DATA and SCE_COPY_FULL operations + * are done outside of blenkernel with ED_objects_single_users! */ + + /* camera */ + if(type == SCE_COPY_LINK_DATA || type == SCE_COPY_FULL) { + ID_NEW(scen->camera); + } + + /* world */ + if(type == SCE_COPY_FULL) { + if(scen->world) { + id_us_plus((ID *)scen->world); + scen->world= copy_world(scen->world); + } + } + + return scen; +} /* do not free scene itself */ void free_scene(Scene *sce) @@ -166,15 +272,20 @@ void free_scene(Scene *sce) BLI_freelistN(&sce->r.layers); if(sce->toolsettings) { - if(sce->toolsettings->vpaint) + if(sce->toolsettings->vpaint) { + free_paint(&sce->toolsettings->vpaint->paint); MEM_freeN(sce->toolsettings->vpaint); - if(sce->toolsettings->wpaint) + } + if(sce->toolsettings->wpaint) { + free_paint(&sce->toolsettings->wpaint->paint); MEM_freeN(sce->toolsettings->wpaint); + } if(sce->toolsettings->sculpt) { - sculptsession_free(sce->toolsettings->sculpt); + free_paint(&sce->toolsettings->sculpt->paint); MEM_freeN(sce->toolsettings->sculpt); } - + free_paint(&sce->toolsettings->imapaint.paint); + MEM_freeN(sce->toolsettings); sce->toolsettings = NULL; } @@ -280,6 +391,9 @@ Scene *add_scene(char *name) sce->toolsettings->proportional_size = 1.0f; + + sce->unit.scale_length = 1.0f; + pset= &sce->toolsettings->particle; pset->flag= PE_KEEP_LENGTHS|PE_LOCK_FIRST|PE_DEFLECT_EMITTER; pset->emitterdist= 0.25f; @@ -294,7 +408,7 @@ Scene *add_scene(char *name) pset->brush[PE_BRUSH_CUT].strength= 100; sce->jumpframe = 10; - sce->audio.mixrate = 44100; + sce->r.audio.mixrate = 44100; strcpy(sce->r.backbuf, "//backbuf"); strcpy(sce->r.pic, U.renderdir); @@ -387,7 +501,7 @@ void set_scene_bg(Scene *scene) base->flag |= flag; /* not too nice... for recovering objects with lost data */ - if(ob->pose==NULL) base->flag &= ~OB_POSEMODE; + //if(ob->pose==NULL) base->flag &= ~OB_POSEMODE; ob->flag= base->flag; ob->ctime= -1234567.0; /* force ipo to be calculated later */ @@ -410,6 +524,30 @@ void set_scene_name(char *name) //XXX error("Can't find scene: %s", name); } +void unlink_scene(Main *bmain, Scene *sce, Scene *newsce) +{ + Scene *sce1; + bScreen *sc; + + /* check all sets */ + for(sce1= bmain->scene.first; sce1; sce1= sce1->id.next) + if(sce1->set == sce) + sce1->set= NULL; + + /* check all sequences */ + clear_scene_in_allseqs(sce); + + /* check render layer nodes in other scenes */ + clear_scene_in_nodes(bmain, sce); + + /* al screens */ + for(sc= bmain->screen.first; sc; sc= sc->id.next) + if(sc->scene == sce) + sc->scene= newsce; + + free_libblock(&bmain->scene, sce); +} + /* used by metaballs * doesnt return the original duplicated object, only dupli's */ @@ -674,33 +812,6 @@ void scene_add_render_layer(Scene *sce) srl->passflag= SCE_PASS_COMBINED|SCE_PASS_Z; } -void sculptsession_free(Sculpt *sculpt) -{ - SculptSession *ss= sculpt->session; - if(ss) { - if(ss->projverts) - MEM_freeN(ss->projverts); - - if(ss->fmap) - MEM_freeN(ss->fmap); - - if(ss->fmap_mem) - MEM_freeN(ss->fmap_mem); - - if(ss->texcache) - MEM_freeN(ss->texcache); - - if(ss->layer_disps) - MEM_freeN(ss->layer_disps); - - if(ss->mesh_co_orig) - MEM_freeN(ss->mesh_co_orig); - - MEM_freeN(ss); - sculpt->session= NULL; - } -} - /* render simplification */ int get_render_subsurf_level(RenderData *r, int lvl) diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 8224f0dd3f3..22ea41276ff 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -207,7 +207,7 @@ int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, Derive // printf("res[0]: %d, res[1]: %d, res[2]: %d\n", smd->domain->res[0], smd->domain->res[1], smd->domain->res[2]); // dt max is 0.1 - smd->domain->fluid = smoke_init(smd->domain->res, smd->domain->p0, 2.5 / FPS); + smd->domain->fluid = smoke_init(smd->domain->res, smd->domain->p0, 0.1); smd->domain->wt = smoke_turbulence_init(smd->domain->res, (smd->domain->flags & MOD_SMOKE_HIGHRES) ? (smd->domain->amplify + 1) : 0, smd->domain->noise); smd->time = scene->r.cfra; smd->domain->firstframe = smd->time; @@ -228,6 +228,17 @@ int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, Derive // update particle lifetime to be one frame // smd->flow->psys->part->lifetime = scene->r.efra + 1; +/* + if(!smd->flow->bvh) + { + // smd->flow->bvh = MEM_callocN(sizeof(BVHTreeFromMesh), "smoke_bvhfromfaces"); + // bvhtree_from_mesh_faces(smd->flow->bvh, dm, 0.0, 2, 6); + + // copy obmat + // Mat4CpyMat4(smd->flow->mat, ob->obmat); + // Mat4CpyMat4(smd->flow->mat_old, ob->obmat); + } +*/ return 1; } @@ -249,7 +260,7 @@ int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, Derive int *tridivs = NULL; float cell_len = 1.0 / 50.0; // for res = 50 size_t newdivs = 0; - size_t max_points = 0; + //size_t max_points = 0; size_t quads = 0, facecounter = 0; // copy obmat @@ -291,7 +302,7 @@ int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, Derive size_t j, k; int divs1 = tridivs[3 * facecounter + 0]; int divs2 = tridivs[3 * facecounter + 1]; - int divs3 = tridivs[3 * facecounter + 2]; + //int divs3 = tridivs[3 * facecounter + 2]; float side1[3], side2[3], trinormorg[3], trinorm[3]; if(again == 1 && mface[i].v4) @@ -527,6 +538,14 @@ void smokeModifier_freeFlow(SmokeModifierData *smd) { if(smd->flow) { +/* + if(smd->flow->bvh) + { + free_bvhtree_from_mesh(smd->flow->bvh); + MEM_freeN(smd->flow->bvh); + } + smd->flow->bvh = NULL; +*/ MEM_freeN(smd->flow); smd->flow = NULL; } @@ -604,7 +623,14 @@ void smokeModifier_reset(struct SmokeModifierData *smd) } else if(smd->flow) { - + /* + if(smd->flow->bvh) + { + free_bvhtree_from_mesh(smd->flow->bvh); + MEM_freeN(smd->flow->bvh); + } + smd->flow->bvh = NULL; + */ } else if(smd->coll) { @@ -662,11 +688,11 @@ void smokeModifier_createType(struct SmokeModifierData *smd) smd->domain->omega = 1.0; smd->domain->alpha = -0.001; smd->domain->beta = 0.1; - smd->domain->flags = 0; // MOD_SMOKE_DISSOLVE_INV; + smd->domain->flags = MOD_SMOKE_DISSOLVE_LOG; smd->domain->strength = 2.0; smd->domain->noise = MOD_SMOKE_NOISEWAVE; smd->domain->visibility = 1; - // smd->domain->diss_speed = 50; + smd->domain->diss_speed = 5; // init 3dview buffer smd->domain->tvox = NULL; @@ -723,6 +749,12 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM { // XXX TODO smd->time = scene->r.cfra; + + // rigid movement support + /* + Mat4CpyMat4(smd->flow->mat_old, smd->flow->mat); + Mat4CpyMat4(smd->flow->mat, ob->obmat); + */ } else if(scene->r.cfra < smd->time) { @@ -763,8 +795,13 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM tstart(); - // if(sds->flags & MOD_SMOKE_DISSOLVE) - // smoke_dissolve(sds->fluid, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG, sds->flags & MOD_SMOKE_DISSOLVE_INV); + if(sds->flags & MOD_SMOKE_DISSOLVE) + { + smoke_dissolve(sds->fluid, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG); + + if(sds->wt) + smoke_dissolve_wavelet(sds->wt, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG); + } /* reset view for new frame */ if(sds->viewsettings < MOD_SMOKE_VIEW_USEBIG) @@ -830,7 +867,10 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM float *velocity_x = smoke_get_velocity_x(sds->fluid); float *velocity_y = smoke_get_velocity_y(sds->fluid); float *velocity_z = smoke_get_velocity_z(sds->fluid); - int bigres[3]; + unsigned char *obstacle = smoke_get_obstacle(sds->fluid); + int bigres[3]; + + printf("found flow psys\n"); // mostly copied from particle code for(p=0, pa=psys->particles; p<psys->totpart; p++, pa++) @@ -867,15 +907,20 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM // 2. set cell values (heat, density and velocity) index = smoke_get_index(cell[0], sds->res[0], cell[1], sds->res[1], cell[2]); - if(!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW)) // this is inflow + if(!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW) && !(obstacle[index] & 2)) // this is inflow { + // heat[index] += sfs->temp * 0.1; + // density[index] += sfs->density * 0.1; + heat[index] = sfs->temp; density[index] = sfs->density; + /* velocity_x[index] = pa->state.vel[0]; velocity_y[index] = pa->state.vel[1]; velocity_z[index] = pa->state.vel[2]; */ + obstacle[index] |= 2; // we need different handling for the high-res feature if(bigdensity) @@ -894,7 +939,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM } } } - else // outflow + else if(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW) // outflow { heat[index] = 0.f; density[index] = 0.f; @@ -920,7 +965,21 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM } } } - } + } + else + { + /* + for() + { + // no psys + BVHTreeNearest nearest; + + nearest.index = -1; + nearest.dist = FLT_MAX; + + BLI_bvhtree_find_nearest(sfs->bvh->tree, pco, &nearest, sfs->bvh->nearest_callback, sfs->bvh); + }*/ + } } } @@ -1058,7 +1117,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM smd->time = scene->r.cfra; // simulate the actual smoke (c++ code in intern/smoke) - smoke_step(sds->fluid); + smoke_step(sds->fluid, smd->time); if(sds->wt) smoke_turbulence_step(sds->wt, sds->fluid); diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 0a1963c84f2..68f918b0c68 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -3687,87 +3687,6 @@ static void softbody_to_object(Object *ob, float (*vertexCos)[3], int numVerts, } } -static void softbody_write_state(int index, void *soft_v, float *data) -{ - SoftBody *soft= soft_v; - BodyPoint *bp = soft->bpoint + index; - - memcpy(data, bp->pos, 3 * sizeof(float)); - memcpy(data + 3, bp->vec, 3 * sizeof(float)); -} -static void softbody_read_state(int index, void *soft_v, float *data) -{ - SoftBody *soft= soft_v; - BodyPoint *bp = soft->bpoint + index; - - memcpy(bp->pos, data, 3 * sizeof(float)); - memcpy(bp->vec, data + 3, 3 * sizeof(float)); -} -static void softbody_cache_interpolate(int index, void *soft_v, float frs_sec, float cfra, float cfra1, float cfra2, float *data1, float *data2) -{ - SoftBody *soft= soft_v; - BodyPoint *bp = soft->bpoint + index; - ParticleKey keys[4]; - float dfra; - - if(cfra1 == cfra2) { - softbody_read_state(index, soft, data1); - return; - } - - memcpy(keys[1].co, data1, 3 * sizeof(float)); - memcpy(keys[1].vel, data1 + 3, 3 * sizeof(float)); - - memcpy(keys[2].co, data2, 3 * sizeof(float)); - memcpy(keys[2].vel, data2 + 3, 3 * sizeof(float)); - - dfra = cfra2 - cfra1; - - VecMulf(keys[1].vel, dfra); - VecMulf(keys[2].vel, dfra); - - psys_interpolate_particle(-1, keys, (cfra - cfra1) / dfra, keys, 1); - - VecMulf(keys->vel, 1.0f / dfra); - - memcpy(bp->pos, keys->co, 3 * sizeof(float)); - memcpy(bp->vec, keys->vel, 3 * sizeof(float)); -} -void softbody_write_cache(Object *ob, SoftBody *soft, int cfra) -{ - PTCacheWriter writer; - PTCacheID pid; - - BKE_ptcache_id_from_softbody(&pid, ob, soft); - - writer.calldata = soft; - writer.cfra = cfra; - writer.set_elem = softbody_write_state; - writer.pid = &pid; - writer.totelem = soft->totpoint; - - BKE_ptcache_write_cache(&writer); -} - -int softbody_read_cache(Scene *scene, Object *ob, SoftBody *soft, float cfra, int *old_framenr) -{ - PTCacheReader reader; - PTCacheID pid; - - BKE_ptcache_id_from_softbody(&pid, ob, soft); - - reader.calldata = soft; - reader.cfra = cfra; - reader.interpolate_elem = softbody_cache_interpolate; - reader.old_frame = old_framenr; - reader.pid = &pid; - reader.scene = scene; - reader.set_elem = softbody_read_state; - reader.totelem = soft->totpoint; - - return BKE_ptcache_read_cache(&reader); -} - /* +++ ************ maintaining scratch *************** */ static void sb_new_scratch(SoftBody *sb) { @@ -3827,7 +3746,7 @@ SoftBody *sbNew(Scene *scene) sb->shearstiff = 1.0f; sb->solverflags |= SBSO_OLDERR; - sb->pointcache = BKE_ptcache_add(); + sb->pointcache = BKE_ptcache_add(&sb->ptcaches); return sb; } @@ -3836,7 +3755,8 @@ SoftBody *sbNew(Scene *scene) void sbFree(SoftBody *sb) { free_softbody_intern(sb); - BKE_ptcache_free(sb->pointcache); + BKE_ptcache_free_list(&sb->ptcaches); + sb->pointcache = NULL; MEM_freeN(sb); } @@ -4135,7 +4055,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i PTCacheID pid; float dtime, timescale; int framedelta, framenr, startframe, endframe; - int cache_result, old_framenr; + int cache_result; cache= sb->pointcache; @@ -4221,7 +4141,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i } /* try to read from cache */ - cache_result = softbody_read_cache(scene, ob, sb, framenr, &old_framenr); + cache_result = BKE_ptcache_read_cache(&pid, framenr, scene->r.frs_sec); if(cache_result == PTCACHE_READ_EXACT || cache_result == PTCACHE_READ_INTERPOLATED) { cache->flag |= PTCACHE_SIMULATION_VALID; @@ -4235,7 +4155,6 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i else if(cache_result==PTCACHE_READ_OLD) { BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_FREE); cache->flag |= PTCACHE_SIMULATION_VALID; - cache->simframe= old_framenr; } else if(ob->id.lib || (cache->flag & PTCACHE_BAKED)) { /* if baked and nothing in cache, do nothing */ @@ -4263,7 +4182,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i else { /* if on second frame, write cache for first frame */ if(cache->simframe == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0)) - softbody_write_cache(ob, sb, startframe); + BKE_ptcache_write_cache(&pid, startframe); softbody_update_positions(ob, sb, vertexCos, numVerts); @@ -4279,7 +4198,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i if(sb->particles==0) softbody_to_object(ob, vertexCos, numVerts, 0); - softbody_write_cache(ob, sb, framenr); + BKE_ptcache_write_cache(&pid, framenr); } } diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 347837d1dd0..a3275792a85 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -34,19 +34,7 @@ void sound_init() { AUD_Specs specs; - specs.channels = AUD_CHANNELS_STEREO; - specs.format = AUD_FORMAT_S16; - specs.rate = AUD_RATE_44100; - - if(!AUD_init(AUD_SDL_DEVICE, specs, AUD_DEFAULT_BUFFER_SIZE)) - if(!AUD_init(AUD_OPENAL_DEVICE, specs, AUD_DEFAULT_BUFFER_SIZE*4)) - AUD_init(AUD_NULL_DEVICE, specs, AUD_DEFAULT_BUFFER_SIZE); -} - -void sound_reinit(struct bContext *C) -{ - AUD_Specs specs; - int device, buffersize; + int device, buffersize, success; device = U.audiodevice; buffersize = U.mixbufsize; @@ -66,8 +54,15 @@ void sound_reinit(struct bContext *C) if(specs.channels <= AUD_CHANNELS_INVALID) specs.channels = AUD_CHANNELS_STEREO; - if(!AUD_init(device, specs, buffersize)) - AUD_init(AUD_NULL_DEVICE, specs, buffersize); + if(!AUD_init(device, specs, buffersize)) { + if(device == AUD_SDL_DEVICE) + success= AUD_init(AUD_OPENAL_DEVICE, specs, AUD_DEFAULT_BUFFER_SIZE*4); + else + success= AUD_init(AUD_SDL_DEVICE, specs, AUD_DEFAULT_BUFFER_SIZE*4); + + if(!success) + AUD_init(AUD_NULL_DEVICE, specs, buffersize); + } } void sound_exit() @@ -421,7 +416,7 @@ void sound_scrub(struct bContext *C) int cfra = CFRA; float fps = FPS; - if(scene->audio.flag & AUDIO_SCRUB && !CTX_wm_screen(C)->animtimer) + if(scene->r.audio.flag & AUDIO_SCRUB && !CTX_wm_screen(C)->animtimer) { AUD_lock(); diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c new file mode 100644 index 00000000000..e56d8f173e5 --- /dev/null +++ b/source/blender/blenkernel/intern/unit.c @@ -0,0 +1,582 @@ +/** + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Contributor(s): Campbell Barton + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include <stdlib.h> +#include <stdio.h> +#include <ctype.h> +#include <string.h> +#include <math.h> + +#if defined(WIN32) && (!(defined snprintf)) +#define snprintf _snprintf +#endif + +#define TEMP_STR_SIZE 256 + +#define SEP_CHR '#' +#define SEP_STR "#" + +#define EUL 0.000001 + + +/* define a single unit */ +typedef struct bUnitDef { + char *name; + char *name_plural; /* abused a bit for the display name */ + char *name_short; /* this is used for display*/ + char *name_alt; /* can be NULL */ + + char *name_display; /* can be NULL */ + + double scalar; + double bias; /* not used yet, needed for converting temperature */ + int flag; +} bUnitDef; + +#define B_UNIT_DEF_NONE 0 +#define B_UNIT_DEF_SUPPRESS 1 /* Use for units that are not used enough to be translated into for common use */ + +/* define a single unit */ +typedef struct bUnitCollection { + struct bUnitDef *units; + int base_unit; /* use for 0.0, or none given */ + int flag; /* options for this system */ + int length; /* to quickly find the last item */ +} bUnitCollection; + +/* Dummy */ +static struct bUnitDef buDummyDef[] = { + {"", NULL, "", NULL, NULL, 1.0, 0.0}, + {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} +}; +static struct bUnitCollection buDummyCollecton = {buDummyDef, 0, 0, sizeof(buDummyDef)}; + + +/* Lengths */ +static struct bUnitDef buMetricLenDef[] = { + {"kilometer", "kilometers", "km", NULL, "Kilometers", 1000.0, 0.0, B_UNIT_DEF_NONE}, + {"hectometer", "hectometers", "hm", NULL, "10 Meters", 100.0, 0.0, B_UNIT_DEF_SUPPRESS}, + {"dekameter", "dekameters", "dkm",NULL, "10 Meters", 10.0, 0.0, B_UNIT_DEF_SUPPRESS}, + {"meter", "meters", "m", NULL, "Meters", 1.0, 0.0, B_UNIT_DEF_NONE}, /* base unit */ + {"decimetre", "decimetres", "dm", NULL, "10 Centimeters", 0.1, 0.0, B_UNIT_DEF_SUPPRESS}, + {"centimeter", "centimeters", "cm", NULL, "Centimeters", 0.01, 0.0, B_UNIT_DEF_NONE}, + {"millimeter", "millimeters", "mm", NULL, "Millimeters", 0.001, 0.0, B_UNIT_DEF_NONE}, + {"micrometer", "micrometers", "um", "µm", "Micrometers", 0.000001, 0.0, B_UNIT_DEF_NONE}, // micron too? + + /* These get displayed because of float precision problems in the transform header, + * could work around, but for now probably people wont use these */ + /* + {"nanometer", "Nanometers", "nm", NULL, 0.000000001, 0.0, B_UNIT_DEF_NONE}, + {"picometer", "Picometers", "pm", NULL, 0.000000000001, 0.0,B_UNIT_DEF_NONE}, + */ + {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} +}; +static struct bUnitCollection buMetricLenCollecton = {buMetricLenDef, 3, 0, sizeof(buMetricLenDef)/sizeof(bUnitDef)}; + +static struct bUnitDef buImperialLenDef[] = { + {"mile", "miles", "mi", "m", "Miles", 1609.344, 0.0, B_UNIT_DEF_NONE}, + {"furlong", "furlongs", "fur", NULL, "Furlongs",201.168, 0.0, B_UNIT_DEF_SUPPRESS}, + {"chain", "chains", "ch", NULL, "Chains", 0.9144*22.0, 0.0, B_UNIT_DEF_SUPPRESS}, + {"yard", "yards", "yd", NULL, "Yards", 0.9144, 0.0, B_UNIT_DEF_NONE}, + {"foot", "feet", "'", "ft", "Feet", 0.3048, 0.0, B_UNIT_DEF_NONE}, + {"inch", "inches", "\"", "in", "Inches", 0.0254, 0.0, B_UNIT_DEF_NONE}, /* base unit */ + {"thou", "thous", "mil", NULL, "Thous", 0.0000254, 0.0, B_UNIT_DEF_NONE}, + {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} +}; +static struct bUnitCollection buImperialLenCollecton = {buImperialLenDef, 4, 0, sizeof(buImperialLenDef)/sizeof(bUnitDef)}; + + +/* Time */ +static struct bUnitDef buNaturalTimeDef[] = { + /* weeks? - probably not needed for blender */ + {"day", "days", "d", NULL, "Days", 90000.0, 0.0, B_UNIT_DEF_NONE}, + {"hour", "hours", "hr", "h", "Hours", 3600.0, 0.0, B_UNIT_DEF_NONE}, + {"minute", "minutes", "min", "m", "Minutes", 60.0, 0.0, B_UNIT_DEF_NONE}, + {"second", "seconds", "sec", "s", "Seconds", 1.0, 0.0, B_UNIT_DEF_NONE}, /* base unit */ + {"millisecond", "milliseconds", "ms", NULL, "Milliseconds", 0.001, 0.0 , B_UNIT_DEF_NONE}, + {"microsecond", "microseconds", "us", NULL, "Microseconds", 0.000001, 0.0, B_UNIT_DEF_NONE}, + {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} +}; +static struct bUnitCollection buNaturalTimeCollecton = {buNaturalTimeDef, 3, 0, sizeof(buNaturalTimeDef)/sizeof(bUnitDef)}; + +#define UNIT_SYSTEM_MAX 3 +static struct bUnitCollection *bUnitSystems[][8] = { + {0,0,0,0,0,0,0,0}, + {0,&buMetricLenCollecton, 0,0,0,0, &buNaturalTimeCollecton,0}, /* metric */ + {0,&buImperialLenCollecton, 0,0,0,0, &buNaturalTimeCollecton,0}, /* imperial */ + {0,0,0,0,0,0,0,0} +}; + +/* internal, has some option not exposed */ +static bUnitCollection *unit_get_system(int system, int type) +{ + return bUnitSystems[system][type]; /* select system to use, metric/imperial/other? */ +} + +static bUnitDef *unit_default(bUnitCollection *usys) +{ + return &usys->units[usys->base_unit]; +} + +static bUnitDef *unit_best_fit(double value, bUnitCollection *usys, bUnitDef *unit_start, int suppress) +{ + bUnitDef *unit; + double value_abs= value>0.0?value:-value; + + for(unit= unit_start ? unit_start:usys->units; unit->name; unit++) { + + if(suppress && (unit->flag & B_UNIT_DEF_SUPPRESS)) + continue; + + if (value_abs >= unit->scalar*(1.0-EUL)) /* scale down scalar so 1cm doesnt convert to 10mm because of float error */ + return unit; + } + + return unit_default(usys); +} + + + +/* convert into 2 units and 2 values for "2ft, 3inch" syntax */ +static void unit_dual_convert(double value, bUnitCollection *usys, + bUnitDef **unit_a, bUnitDef **unit_b, double *value_a, double *value_b) +{ + bUnitDef *unit= unit_best_fit(value, usys, NULL, 1); + + *value_a= floor(value/unit->scalar) * unit->scalar; + *value_b= value - (*value_a); + + *unit_a= unit; + *unit_b= unit_best_fit(*value_b, usys, *unit_a, 1); +} + +static int unit_as_string(char *str, int len_max, double value, int prec, bUnitCollection *usys, + /* non exposed options */ + bUnitDef *unit, char pad) +{ + double value_conv; + int len, i; + + if(unit) { + /* use unit without finding the best one */ + } + else if(value == 0.0) { + /* use the default units since there is no way to convert */ + unit= unit_default(usys); + } + else { + unit= unit_best_fit(value, usys, NULL, 1); + } + + value_conv= value/unit->scalar; + + /* Convert to a string */ + { + char conv_str[6] = {'%', '.', '0'+prec, 'l', 'f', '\0'}; /* "%.2lf" when prec is 2, must be under 10 */ + len= snprintf(str, len_max, conv_str, (float)value_conv); + + if(len >= len_max) + len= len_max; + } + + /* Add unit prefix and strip zeros */ + + /* replace trailing zero's with spaces + * so the number is less complicated but allignment in a button wont + * jump about while dragging */ + i= len-1; + + while(i>0 && str[i]=='0') { /* 4.300 -> 4.3 */ + str[i--]= pad; + } + + if(i>0 && str[i]=='.') { /* 10. -> 10 */ + str[i--]= pad; + } + + /* Now add the suffix */ + if(i<len_max) { + int j=0; + i++; + while(unit->name_short[j] && (i < len_max)) { + str[i++]= unit->name_short[j++]; + } + + if(pad) { + /* this loop only runs if so many zeros were removed that + * the unit name only used padded chars, + * In that case add padding for the name. */ + + while(i<=len+j && (i < len_max)) { + str[i++]= pad; + } + } + } + + /* terminate no matter whats done with padding above */ + if(i >= len_max) + i= len_max-1; + + str[i] = '\0'; + return i; +} + + +/* Used for drawing number buttons, try keep fast */ +void bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, int split, int pad) +{ + bUnitCollection *usys = unit_get_system(system, type); + + if(usys==NULL || usys->units[0].name==NULL) + usys= &buDummyCollecton; + + if(split) { + int i; + bUnitDef *unit_a, *unit_b; + double value_a, value_b; + + unit_dual_convert(value, usys, &unit_a, &unit_b, &value_a, &value_b); + + /* check the 2 is a smaller unit */ + if(unit_b > unit_a) { + i= unit_as_string(str, len_max, value_a, prec, usys, unit_a, '\0'); + + /* is there enough space for at least 1 char of the next unit? */ + if(i+2 < len_max) { + str[i++]= ' '; + + /* use low precision since this is a smaller unit */ + unit_as_string(str+i, len_max-i, value_b, prec?1:0, usys, unit_b, '\0'); + } + return; + } + } + + unit_as_string(str, len_max, value, prec, usys, NULL, pad?' ':'\0'); +} + + +static char *unit_find_str(char *str, char *substr) +{ + char *str_found; + + if(substr && substr[0] != '\0') { + str_found= strstr(str, substr); + if(str_found) { + /* previous char cannot be a letter */ + if (str_found == str || isalpha(*(str_found-1))==0) { + /* next char cannot be alphanum */ + int len_name = strlen(substr); + + if (!isalpha(*(str_found+len_name))) { + return str_found; + } + } + } + + } + return NULL; + +} + +/* Note that numbers are added within brackets + * ") " - is used to detect numbers we added so we can detect if commas need to be added + * + * "1m1cm+2mm" - Original value + * "1*1#1*0.01#+2*0.001#" - Replace numbers + * "1*1,1*0.01 +2*0.001 " - Add comma's if ( - + * / % ^ < > ) not found in between + * + */ + +/* not too strict, (- = * /) are most common */ +static int ch_is_op(char op) +{ + switch(op) { + case '+': + case '-': + case '*': + case '/': + case '|': + case '<': + case '>': + case '^': + case '!': + case '=': + return 1; + default: + return 0; + } +} + +static int unit_scale_str(char *str, int len_max, char *str_tmp, double scale_pref, bUnitDef *unit, char *replace_str) +{ + char *str_found; + + if((len_max>0) && (str_found= unit_find_str(str, replace_str))) { /* XXX - investigate, does not respect len_max properly */ + int len, len_num, len_name, len_move, found_ofs; + + found_ofs = (int)(str_found-str); + + len= strlen(str); + + len_name = strlen(replace_str); + len_move= (len - (found_ofs+len_name)) + 1; /* 1+ to copy the string terminator */ + len_num= snprintf(str_tmp, TEMP_STR_SIZE, "*%lg"SEP_STR, unit->scalar/scale_pref); /* # removed later */ + + if(len_num > len_max) + len_num= len_max; + + if(found_ofs+len_num+len_move > len_max) { + /* can't move the whole string, move just as much as will fit */ + len_move -= (found_ofs+len_num+len_move) - len_max; + } + + if(len_move>0) { + /* resize the last part of the string */ + memmove(str_found+len_num, str_found+len_name, len_move); /* may grow or shrink the string */ + } + + if(found_ofs+len_num > len_max) { + /* not even the number will fit into the string, only copy part of it */ + len_num -= (found_ofs+len_num) - len_max; + } + + if(len_num > 0) { + /* its possible none of the number could be copied in */ + memcpy(str_found, str_tmp, len_num); /* without the string terminator */ + } + + /* since the null terminator wont be moved if the stringlen_max + * was not long enough to fit everything in it */ + str[len_max-1]= '\0'; + return found_ofs + len_num; + } + return 0; +} + +static int unit_replace(char *str, int len_max, char *str_tmp, double scale_pref, bUnitDef *unit) +{ + int ofs= 0; + ofs += unit_scale_str(str+ofs, len_max-ofs, str_tmp, scale_pref, unit, unit->name_short); + ofs += unit_scale_str(str+ofs, len_max-ofs, str_tmp, scale_pref, unit, unit->name_plural); + ofs += unit_scale_str(str+ofs, len_max-ofs, str_tmp, scale_pref, unit, unit->name_alt); + ofs += unit_scale_str(str+ofs, len_max-ofs, str_tmp, scale_pref, unit, unit->name); + return ofs; +} + +static int unit_find(char *str, bUnitDef *unit) +{ + if (unit_find_str(str, unit->name_short)) return 1; + if (unit_find_str(str, unit->name_plural)) return 1; + if (unit_find_str(str, unit->name_alt)) return 1; + if (unit_find_str(str, unit->name)) return 1; + + return 0; +} + +/* make a copy of the string that replaces the units with numbers + * this is used before parsing + * This is only used when evaluating user input and can afford to be a bit slower + * + * This is to be used before python evaluation so.. + * 10.1km -> 10.1*1000.0 + * ...will be resolved by python. + * + * values will be split by a comma's + * 5'2" -> 5'0.0254, 2*0.3048 + * + * str_prev is optional, when valid it is used to get a base unit when none is set. + * + * return true of a change was made. + */ +int bUnit_ReplaceString(char *str, int len_max, char *str_prev, double scale_pref, int system, int type) +{ + bUnitCollection *usys = unit_get_system(system, type); + + bUnitDef *unit; + char str_tmp[TEMP_STR_SIZE]; + int change= 0; + + if(usys==NULL || usys->units[0].name==NULL) { + return 0; + } + + + { /* make lowercase */ + int i; + char *ch= str; + + for(i=0; (i>=len_max || *ch=='\0'); i++, ch++) + if((*ch>='A') && (*ch<='Z')) + *ch += ('a'-'A'); + } + + + for(unit= usys->units; unit->name; unit++) { + + if(unit->flag & B_UNIT_DEF_SUPPRESS) + continue; + + /* incase there are multiple instances */ + while(unit_replace(str, len_max, str_tmp, scale_pref, unit)) + change= 1; + } + unit= NULL; + + { + /* try other unit systems now, so we can evaluate imperial when metric is set for eg. */ + bUnitCollection *usys_iter; + int system_iter; + + for(system_iter= 1; system_iter<UNIT_SYSTEM_MAX; system_iter++) { + if (system_iter != system) { + usys_iter= unit_get_system(system_iter, type); + for(unit= usys_iter->units; unit->name; unit++) { + + if((unit->flag & B_UNIT_DEF_SUPPRESS) == 0) { + int ofs = 0; + /* incase there are multiple instances */ + while((ofs=unit_replace(str+ofs, len_max-ofs, str_tmp, scale_pref, unit))) + change= 1; + } + } + } + } + } + unit= NULL; + + if(change==0) { + /* no units given so infer a unit from the previous string or default */ + if(str_prev) { + /* see which units the original value had */ + for(unit= usys->units; unit->name; unit++) { + + if(unit->flag & B_UNIT_DEF_SUPPRESS) + continue; + + if (unit_find(str_prev, unit)) + break; + } + } + + if(unit==NULL) + unit= unit_default(usys); + + /* add the unit prefic and re-run, use brackets incase there was an expression given */ + if(snprintf(str_tmp, sizeof(str_tmp), "(%s)%s", str, unit->name) < sizeof(str_tmp)) { + strncpy(str, str_tmp, len_max); + return bUnit_ReplaceString(str, len_max, NULL, scale_pref, system, type); + } + else { + /* snprintf would not fit into str_tmp, cant do much in this case + * check for this because otherwise bUnit_ReplaceString could call its self forever */ + return 0; + } + + } + + /* replace # with commas when there is no operator between it and the next number + * + * "1*1# 3*100# * 3" -> "1 *1, 3 *100 * 3" + * + * */ + { + char *str_found= str; + char *ch= str; + + while((str_found= strchr(str_found, SEP_CHR))) { + + int op_found= 0; + /* any operators after this?*/ + for(ch= str_found+1; *ch!='\0'; ch++) { + + if(*ch==' ' || *ch=='\t') { + /* do nothing */ + } + else if (ch_is_op(*ch) || *ch==',') { /* found an op, no need to insert a ,*/ + op_found= 1; + break; + } + else { /* found a non-op character */ + op_found= 0; + break; + } + } + + *str_found++ = op_found ? ' ':','; + } + } + + // printf("replace %s\n", str); + return change; +} + + +double bUnit_ClosestScalar(double value, int system, int type) +{ + bUnitCollection *usys = unit_get_system(system, type); + bUnitDef *unit; + + if(usys==NULL) + return -1; + + unit= unit_best_fit(value, usys, NULL, 1); + if(unit==NULL) + return -1; + + return unit->scalar; +} + +double bUnit_BaseScalar(int system, int type) +{ + bUnitCollection *usys = unit_get_system(system, type); + return unit_default(usys)->scalar; +} + +/* external access */ +void bUnit_GetSystem(void **usys_pt, int *len, int system, int type) +{ + bUnitCollection *usys = unit_get_system(system, type); + *usys_pt= usys; + + if(usys==NULL) { + *len= 0; + return; + } + + *len= usys->length; +} + +char *bUnit_GetName(void *usys_pt, int index) +{ + return ((bUnitCollection *)usys_pt)->units[index].name; +} +char *bUnit_GetNameDisplay(void *usys_pt, int index) +{ + return ((bUnitCollection *)usys_pt)->units[index].name_display; +} + +double bUnit_GetScaler(void *usys_pt, int index) +{ + return ((bUnitCollection *)usys_pt)->units[index].scalar; +} diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 334c8e6906b..a0bf2367b98 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -28,8 +28,7 @@ FILE(GLOB SRC intern/*.c) SET(INC . ../makesdna ../blenkernel ../../../intern/guardedalloc ../include - ${FREETYPE_INC} - ${SDL_INC} + ${FREETYPE_INCLUDE_DIRS} ${ZLIB_INC} ) diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 31035dc0e0f..3e9df678f89 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -1620,7 +1620,6 @@ float BLI_bvhtree_bb_raycast(float *bv, float *light_start, float *light_end, fl { BVHRayCastData data; float dist = 0.0; - int i; data.hit.dist = FLT_MAX; diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c index 79a46da4c66..1f3a861ba6a 100644 --- a/source/blender/blenlib/intern/BLI_kdtree.c +++ b/source/blender/blenlib/intern/BLI_kdtree.c @@ -374,7 +374,7 @@ int BLI_kdtree_range_search(KDTree *tree, float range, float *co, float *nor, KD KDTreeNode **stack, *defaultstack[100]; KDTreeNearest *foundstack=NULL; float range2 = range*range, dist2; - int i, totstack, cur=0, found=0, totfoundstack=0; + int totstack, cur=0, found=0, totfoundstack=0; if(!tree || !tree->root) return 0; diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c index db7bae8a91d..7d5e1eec53e 100644 --- a/source/blender/blenlib/intern/boxpack2d.c +++ b/source/blender/blenlib/intern/boxpack2d.c @@ -16,28 +16,22 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): Campbell barton + * Contributor(s): Campbell Barton * * ***** END GPL LICENSE BLOCK ***** */ -#include <stdlib.h> +#include <stdlib.h> /* for qsort */ -#include "BKE_utildefines.h" #include "MEM_guardedalloc.h" #include "BLI_boxpack2d.h" -/* BoxPacker ported from Python by Campbell Barton +/* BoxPacker for backing 2D rectangles into a square * * The defined Below are for internal use only */ /* free vert flags */ -#define eul 0.0000001 +#define eul 0.0000001f #define BLF 1 #define TRF 2 #define TLF 4 @@ -79,6 +73,9 @@ BOXRIGHT(b1)-eul<=BOXLEFT(b2) ||\ BOXTOP(b1)-eul<=BOXBOTTOM(b2) )) +#define MIN2(x,y) ( (x)<(y) ? (x) : (y) ) +#define MAX2(x,y) ( (x)>(y) ? (x) : (y) ) + /* #define BOXDEBUG(b)\ * printf("\tBox Debug i %i, w:%.3f h:%.3f x:%.3f y:%.3f\n",\ * b->index, b->w, b->h, b->x, b->y) */ @@ -141,11 +138,11 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height) int box_index, verts_pack_len, i, j, k, isect; int quad_flags[4]= {BLF,TRF,TLF,BRF}; /* use for looping */ boxPack *box, *box_test; /*current box and another for intersection tests*/ - int *vertex_pack_indicies; /*an array of indicies used for sorting verts*/ + int *vertex_pack_indicies; /*an array of indices used for sorting verts*/ if (!len) { - *tot_width = 0.0; - *tot_height = 0.0; + *tot_width = 0.0f; + *tot_height = 0.0f; return; } @@ -153,8 +150,8 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height) qsort(boxarray, len, sizeof(boxPack), box_areasort); /* add verts to the boxes, these are only used internally */ - vert = vertarray = MEM_mallocN( len*4*sizeof(boxVert), "boxPack verts"); - vertex_pack_indicies = MEM_mallocN( len*3*sizeof(int), "boxPack indicies"); + vert = vertarray = MEM_mallocN( len*4*sizeof(boxVert), "boxPack Verts"); + vertex_pack_indicies = MEM_mallocN( len*3*sizeof(int), "boxPack Indices"); for (box=boxarray, box_index=0, i=0; box_index < len; box_index++, box++) { @@ -194,11 +191,11 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height) /* Pack the First box! - * then enter the main boxpacking loop */ + * then enter the main box-packing loop */ box = boxarray; /* get the first box */ /* First time, no boxes packed */ - box->v[BL]->free = 0; /* Cant use any if these */ + box->v[BL]->free = 0; /* Can't use any if these */ box->v[BR]->free &= ~(BLF|BRF); box->v[TL]->free &= ~(BLF|TLF); @@ -206,9 +203,9 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height) *tot_height = box->h; /* This sets all the vertex locations */ - SET_BOXLEFT(box, 0.0); - SET_BOXBOTTOM(box, 0.0); - box->x = box->y = 0.0; + SET_BOXLEFT(box, 0.0f); + SET_BOXBOTTOM(box, 0.0f); + box->x = box->y = 0.0f; for (i=0; i<3; i++) vertex_pack_indicies[i] = box->v[i+1]->index; @@ -219,7 +216,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height) /* Main boxpacking loop */ for (box_index=1; box_index < len; box_index++, box++) { - /* Sort the verts, these constants are used in sorting */ + /* These static floatds are used for sorting */ box_width = box->w; box_height = box->h; @@ -234,7 +231,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height) /* printf("\ttesting vert %i %i %i %f %f\n", i, * vert->free, verts_pack_len, vert->x, vert->y); */ - /* This vert has a free quaderent + /* This vert has a free quadrant * Test if we can place the box here * vert->free & quad_flags[j] - Checks * */ @@ -266,7 +263,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height) isect = 0; if (/* Constrain boxes to positive X/Y values */ - BOXLEFT(box)<0.0 || BOXBOTTOM(box) < 0.0 || + BOXLEFT(box)<0.0f || BOXBOTTOM(box) < 0.0f || /* check for last intersected */ ( vert->isect_cache[j] && BOXINTERSECT(box, vert->isect_cache[j]) ) @@ -274,13 +271,13 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height) /* Here we check that the last intersected * box will intersect with this one using * isect_cache that can store a pointer to a - * box for each quaderent + * box for each quadrant * big speedup */ isect = 1; } else { - /* do a full saech for colliding box - * this is realy slow, some spacialy divided - * datastructure would be better */ + /* do a full search for colliding box + * this is really slow, some spacialy divided + * data-structure would be better */ for (box_test=boxarray; box_test != box; box_test++) { if BOXINTERSECT(box, box_test) { /* Store the last intersecting here as cache @@ -321,7 +318,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height) } /* Mask free flags for verts that are - * on the bottom or side so we dont get + * on the bottom or side so we don't get * boxes outside the given rectangle ares * * We can do an else/if here because only the first @@ -392,7 +389,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height) verts_pack_len++; } } - /* The Box verts are only used interially + /* The Box verts are only used internally * Update the box x and y since thats what external * functions will see */ box->x = BOXLEFT(box); @@ -403,8 +400,8 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height) } } - /* free all the verts, not realy needed because they shouldebt be - * touched anymore but accessing the pointers woud crash blender */ + /* free all the verts, not really needed because they shouldn't be + * touched anymore but accessing the pointers would crash blender */ for (box_index=0; box_index < len; box_index++) { box = boxarray+box_index; box->v[0] = box->v[1] = box->v[2] = box->v[3] = NULL; diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index 1064c8ac1bf..3194593374f 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -347,11 +347,11 @@ void BLI_duplicatelist(ListBase *list1, ListBase *list2) /* copy from 2 to 1 */ { struct Link *link1, *link2; + /* in this order, to ensure it works if list1 == list2 */ + link2= list2->first; list1->first= list1->last= 0; - link2= list2->first; while(link2) { - link1= MEM_dupallocN(link2); BLI_addtail(list1, link1); diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 0a416e624cb..e6e37c58805 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -47,13 +47,13 @@ #include <time.h> #include <sys/stat.h> -#if defined (__sun__) || defined (__sun) || defined (__sgi) +#if defined (__sun__) || defined (__sun) || defined (__sgi) || defined (__NetBSD__) #include <sys/statvfs.h> /* Other modern unix os's should probably use this also */ #elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sparc) || defined(__sparc__)) #include <sys/statfs.h> #endif -#if defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) +#if defined (__FreeBSD__) || defined (__OpenBSD__) #include <sys/param.h> #include <sys/mount.h> #endif @@ -173,7 +173,7 @@ double BLI_diskfree(char *dir) return (double) (freec*bytesps*sectorspc); #else -#if defined (__sun__) || defined (__sun) || defined (__sgi) +#if defined (__sun__) || defined (__sun) || defined (__sgi) || defined (__NetBSD__) struct statvfs disk; #else struct statfs disk; @@ -195,7 +195,7 @@ double BLI_diskfree(char *dir) if (statfs(name, &disk)) return(-1); #endif -#if defined (__sun__) || defined (__sun) || defined (__sgi) +#if defined (__sun__) || defined (__sun) || defined (__sgi) || defined (__NetBSD__) if (statvfs(name, &disk)) return(-1); #elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sparc) || defined(__sparc__)) /* WARNING - This may not be supported by geeneric unix os's - Campbell */ diff --git a/source/blender/blenloader/BLO_sys_types.h b/source/blender/blenloader/BLO_sys_types.h index 49155260b31..4032f778f4b 100644 --- a/source/blender/blenloader/BLO_sys_types.h +++ b/source/blender/blenloader/BLO_sys_types.h @@ -78,7 +78,7 @@ typedef unsigned long uintptr_t; #define _UINTPTR_T_DEFINED #endif -#elif defined(__linux__) +#elif defined(__linux__) || defined(__NetBSD__) /* Linux-i386, Linux-Alpha, Linux-ppc */ #include <stdint.h> diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 2b6c372861a..9272c6fe353 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2929,13 +2929,21 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache) { if((cache->flag & PTCACHE_DISK_CACHE)==0) { PTCacheMem *pm; + int i; link_list(fd, &cache->mem_cache); pm = cache->mem_cache.first; - for(; pm; pm=pm->next) - pm->data = newdataadr(fd, pm->data); + for(; pm; pm=pm->next) { + if(pm->index_array) + pm->index_array = newdataadr(fd, pm->index_array); + + for(i=0; i<BPHYS_TOT_DATA; i++) { + if(pm->data[i] && pm->data_types & (1<<i)) + pm->data[i] = newdataadr(fd, pm->data[i]); + } + } } else cache->mem_cache.first = cache->mem_cache.last = NULL; @@ -2944,6 +2952,26 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache) cache->simframe= 0; } +static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointCache **ocache) +{ + PointCache *cache; + + if(ptcaches->first) { + link_list(fd, ptcaches); + for(cache=ptcaches->first; cache; cache=cache->next) + direct_link_pointcache(fd, cache); + + *ocache = newdataadr(fd, *ocache); + } + else if(*ocache) { + /* old "single" caches need to be linked too */ + *ocache = newdataadr(fd, *ocache); + direct_link_pointcache(fd, *ocache); + + ptcaches->first = ptcaches->last = *ocache; + } +} + static void lib_link_particlesettings(FileData *fd, Main *main) { ParticleSettings *part; @@ -3089,9 +3117,7 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) sb->bspring= NULL; sb->scratch= NULL; - sb->pointcache= newdataadr(fd, sb->pointcache); - if(sb->pointcache) - direct_link_pointcache(fd, sb->pointcache); + direct_link_pointcache_list(fd, &sb->ptcaches, &sb->pointcache); } link_list(fd, &psys->targets); @@ -3104,9 +3130,7 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) psys->childcachebufs.first = psys->childcachebufs.last = 0; psys->reactevents.first = psys->reactevents.last = 0; - psys->pointcache= newdataadr(fd, psys->pointcache); - if(psys->pointcache) - direct_link_pointcache(fd, psys->pointcache); + direct_link_pointcache_list(fd, &psys->ptcaches, &psys->pointcache); psys->tree = NULL; } @@ -3406,7 +3430,7 @@ static void lib_link_object(FileData *fd, Main *main) if(ob->pose) { free_pose(ob->pose); ob->pose= NULL; - ob->flag &= ~OB_POSEMODE; + ob->mode &= ~OB_MODE_POSE; } } for(a=0; a<ob->totcol; a++) ob->mat[a]= newlibadr_us(fd, ob->id.lib, ob->mat[a]); @@ -3628,10 +3652,8 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) clmd->sim_parms= newdataadr(fd, clmd->sim_parms); clmd->coll_parms= newdataadr(fd, clmd->coll_parms); - clmd->point_cache= newdataadr(fd, clmd->point_cache); - if(clmd->point_cache) - direct_link_pointcache(fd, clmd->point_cache); + direct_link_pointcache_list(fd, &clmd->ptcaches, &clmd->point_cache); if(clmd->sim_parms) { if(clmd->sim_parms->presets > 10) @@ -3886,9 +3908,7 @@ static void direct_link_object(FileData *fd, Object *ob) } } - sb->pointcache= newdataadr(fd, sb->pointcache); - if(sb->pointcache) - direct_link_pointcache(fd, sb->pointcache); + direct_link_pointcache_list(fd, &sb->ptcaches, &sb->pointcache); } ob->bsoft= newdataadr(fd, ob->bsoft); ob->fluidsimSettings= newdataadr(fd, ob->fluidsimSettings); /* NT */ @@ -3974,6 +3994,9 @@ static void direct_link_object(FileData *fd, Object *ob) ob->derivedDeform= NULL; ob->derivedFinal= NULL; ob->gpulamp.first= ob->gpulamp.last= NULL; + + if(ob->sculpt) + ob->sculpt= MEM_callocN(sizeof(SculptSession), "reload sculpt session"); } /* ************ READ SCENE ***************** */ @@ -3988,6 +4011,14 @@ static void composite_patch(bNodeTree *ntree, Scene *scene) node->id= &scene->id; } +static void link_paint(FileData *fd, Scene *sce, Paint *p) +{ + if(p && p->brushes) { + int i; + for(i = 0; i < p->brush_count; ++i) + p->brushes[i]= newlibadr_us(fd, sce->id.lib, p->brushes[i]); + } +} static void lib_link_scene(FileData *fd, Main *main) { @@ -4011,18 +4042,11 @@ static void lib_link_scene(FileData *fd, Main *main) sce->set= newlibadr(fd, sce->id.lib, sce->set); sce->ima= newlibadr_us(fd, sce->id.lib, sce->ima); - sce->toolsettings->imapaint.brush= - newlibadr_us(fd, sce->id.lib, sce->toolsettings->imapaint.brush); - if(sce->toolsettings->sculpt) - sce->toolsettings->sculpt->brush= - newlibadr_us(fd, sce->id.lib, sce->toolsettings->sculpt->brush); - if(sce->toolsettings->vpaint) - sce->toolsettings->vpaint->brush= - newlibadr_us(fd, sce->id.lib, sce->toolsettings->vpaint->brush); - if(sce->toolsettings->wpaint) - sce->toolsettings->wpaint->brush= - newlibadr_us(fd, sce->id.lib, sce->toolsettings->wpaint->brush); - + link_paint(fd, sce, &sce->toolsettings->sculpt->paint); + link_paint(fd, sce, &sce->toolsettings->vpaint->paint); + link_paint(fd, sce, &sce->toolsettings->wpaint->paint); + link_paint(fd, sce, &sce->toolsettings->imapaint.paint); + sce->toolsettings->skgen_template = newlibadr(fd, sce->id.lib, sce->toolsettings->skgen_template); for(base= sce->base.first; base; base= next) { @@ -4095,6 +4119,13 @@ static void link_recurs_seq(FileData *fd, ListBase *lb) link_recurs_seq(fd, &seq->seqbase); } +static void direct_link_paint(FileData *fd, Paint **paint) +{ + (*paint)= newdataadr(fd, (*paint)); + if(*paint) + (*paint)->brushes= newdataadr(fd, (*paint)->brushes); +} + static void direct_link_scene(FileData *fd, Scene *sce) { Editing *ed; @@ -4122,14 +4153,14 @@ static void direct_link_scene(FileData *fd, Scene *sce) sce->toolsettings= newdataadr(fd, sce->toolsettings); if(sce->toolsettings) { - sce->toolsettings->vpaint= newdataadr(fd, sce->toolsettings->vpaint); - sce->toolsettings->wpaint= newdataadr(fd, sce->toolsettings->wpaint); - sce->toolsettings->sculpt= newdataadr(fd, sce->toolsettings->sculpt); + direct_link_paint(fd, (Paint**)&sce->toolsettings->sculpt); + direct_link_paint(fd, (Paint**)&sce->toolsettings->vpaint); + direct_link_paint(fd, (Paint**)&sce->toolsettings->wpaint); + + sce->toolsettings->imapaint.paint.brushes= newdataadr(fd, sce->toolsettings->imapaint.paint.brushes); + sce->toolsettings->imapaint.paintcursor= NULL; sce->toolsettings->particle.paintcursor= NULL; - - if(sce->toolsettings->sculpt) - sce->toolsettings->sculpt->session= MEM_callocN(sizeof(SculptSession), "reload sculpt session"); } if(sce->ed) { @@ -5706,7 +5737,7 @@ static void alphasort_version_246(FileData *fd, Library *lib, Mesh *me) tf = ((MTFace*)me->fdata.layers[b].data) + a; tf->mode &= ~TF_ALPHASORT; - if(ma && (ma->mode & MA_ZTRA)) + if(ma && (ma->mode & MA_ZTRANSP)) if(ELEM(tf->transp, TF_ALPHA, TF_ADD) || (texalpha && (tf->transp != TF_CLIP))) tf->mode |= TF_ALPHASORT; } @@ -8301,20 +8332,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* add point caches */ for(ob=main->object.first; ob; ob=ob->id.next) { if(ob->soft && !ob->soft->pointcache) - ob->soft->pointcache= BKE_ptcache_add(); + ob->soft->pointcache= BKE_ptcache_add(&ob->soft->ptcaches); for(psys=ob->particlesystem.first; psys; psys=psys->next) { if(psys->soft && !psys->soft->pointcache) - psys->soft->pointcache= BKE_ptcache_add(); + psys->soft->pointcache= BKE_ptcache_add(&psys->soft->ptcaches); if(!psys->pointcache) - psys->pointcache= BKE_ptcache_add(); + psys->pointcache= BKE_ptcache_add(&psys->ptcaches); } for(md=ob->modifiers.first; md; md=md->next) { if(md->type==eModifierType_Cloth) { ClothModifierData *clmd = (ClothModifierData*) md; if(!clmd->point_cache) - clmd->point_cache= BKE_ptcache_add(); + clmd->point_cache= BKE_ptcache_add(&clmd->ptcaches); } } } @@ -8602,7 +8633,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* create new particle system */ psys = MEM_callocN(sizeof(ParticleSystem), "particle_system"); - psys->pointcache = BKE_ptcache_add(); + psys->pointcache = BKE_ptcache_add(&psys->ptcaches); part = psys->part = psys_new_settings("ParticleSettings", main); @@ -9188,8 +9219,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Tex *tx; ParticleSettings *part; Object *ob; - PTCacheID *pid; - ListBase pidlist; + //PTCacheID *pid; + //ListBase pidlist; bSound *sound; Sequence *seq; @@ -9323,30 +9354,34 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* set old pointcaches to have disk cache flag */ for(ob = main->object.first; ob; ob= ob->id.next) { - BKE_ptcache_ids_from_object(&pidlist, ob); + //BKE_ptcache_ids_from_object(&pidlist, ob); - for(pid=pidlist.first; pid; pid=pid->next) - pid->cache->flag |= PTCACHE_DISK_CACHE; + //for(pid=pidlist.first; pid; pid=pid->next) + // pid->cache->flag |= PTCACHE_DISK_CACHE; - BLI_freelistN(&pidlist); + //BLI_freelistN(&pidlist); } } if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 1)) { - } - - /* TODO: should be moved into one of the version blocks once this branch moves to trunk and we can - bump the version (or sub-version.) */ - { - World *wo; Object *ob; Material *ma; Tex *tex; Scene *sce; ToolSettings *ts; + //PTCacheID *pid; + //ListBase pidlist; int i, a; for(ob = main->object.first; ob; ob = ob->id.next) { + //BKE_ptcache_ids_from_object(&pidlist, ob); + + //for(pid=pidlist.first; pid; pid=pid->next) { + // if(pid->ptcaches->first == NULL) + // pid->ptcaches->first = pid->ptcaches->last = pid->cache; + //} + + //BLI_freelistN(&pidlist); if(ob->type == OB_MESH) { Mesh *me = newlibadr(fd, lib, ob->data); @@ -9434,6 +9469,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ma->mode &= ~MA_HALO; } + if(ma->mode & (MA_ZTRANSP|MA_RAYTRANSP)) { + ma->mode |= MA_TRANSP; + } + else { + ma->mode |= MA_ZTRANSP; + ma->mode &= ~MA_TRANSP; + } + /* set new bump for unused slots */ for(a=0; a<MAX_MTEX; a++) { if(ma->mtex[a]) { @@ -9518,6 +9561,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } + /* put 2.50 compatibility code here until next subversion bump */ + { + } + /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */ diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index cf636cc2b94..cd388cdf9cc 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -157,6 +157,7 @@ Any case: direct data is ALWAYS after the lib block #include "BKE_main.h" #include "BKE_node.h" #include "BKE_packedFile.h" // for packAll +#include "BKE_pointcache.h" #include "BKE_report.h" #include "BKE_screen.h" // for waitcursor #include "BKE_sequence.h" @@ -582,19 +583,27 @@ static void write_boid_state(WriteData *wd, BoidState *state) /* TODO: replace *cache with *cachelist once it's coded */ #define PTCACHE_WRITE_PSYS 0 #define PTCACHE_WRITE_CLOTH 1 -static void write_pointcaches(WriteData *wd, PointCache *cache, int type) +static void write_pointcaches(WriteData *wd, ListBase *ptcaches) { - writestruct(wd, DATA, "PointCache", 1, cache); + PointCache *cache = ptcaches->first; + int i; + + for(; cache; cache=cache->next) { + writestruct(wd, DATA, "PointCache", 1, cache); - if((cache->flag & PTCACHE_DISK_CACHE)==0) { - PTCacheMem *pm = cache->mem_cache.first; + if((cache->flag & PTCACHE_DISK_CACHE)==0) { + PTCacheMem *pm = cache->mem_cache.first; - for(; pm; pm=pm->next) { - writestruct(wd, DATA, "PTCacheMem", 1, pm); - if(type==PTCACHE_WRITE_PSYS) - writestruct(wd, DATA, "ParticleKey", pm->totpoint, pm->data); - else if(type==PTCACHE_WRITE_CLOTH) - writedata(wd, DATA, 9 * sizeof(float) * pm->totpoint, pm->data); + for(; pm; pm=pm->next) { + writestruct(wd, DATA, "PTCacheMem", 1, pm); + if(pm->index_array) + writedata(wd, DATA, sizeof(int) * pm->totpoint, pm->index_array); + + for(i=0; i<BPHYS_TOT_DATA; i++) { + if(pm->data[i] && pm->data_types & (1<<i)) + writedata(wd, DATA, BKE_ptcache_data_size(i) * pm->totpoint, pm->data[i]); + } + } } } } @@ -652,8 +661,8 @@ static void write_particlesystems(WriteData *wd, ListBase *particles) if(psys->child) writestruct(wd, DATA, "ChildParticle", psys->totchild ,psys->child); writestruct(wd, DATA, "SoftBody", 1, psys->soft); - if(psys->soft) write_pointcaches(wd, psys->soft->pointcache, PTCACHE_WRITE_PSYS); - write_pointcaches(wd, psys->pointcache, PTCACHE_WRITE_PSYS); + if(psys->soft) write_pointcaches(wd, &psys->soft->ptcaches); + write_pointcaches(wd, &psys->ptcaches); } } @@ -1112,7 +1121,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase, int write_undo) writestruct(wd, DATA, "ClothSimSettings", 1, clmd->sim_parms); writestruct(wd, DATA, "ClothCollSettings", 1, clmd->coll_parms); - write_pointcaches(wd, clmd->point_cache, PTCACHE_WRITE_CLOTH); + write_pointcaches(wd, &clmd->ptcaches); } else if(md->type==eModifierType_Smoke) { SmokeModifierData *smd = (SmokeModifierData*) md; @@ -1667,6 +1676,11 @@ static void write_lamps(WriteData *wd, ListBase *idbase) } } +static void write_paint(WriteData *wd, Paint *p) +{ + if(p && p->brushes) + writedata(wd, DATA, p->brush_count * sizeof(Brush*), p->brushes); +} static void write_scenes(WriteData *wd, ListBase *scebase) { @@ -1679,6 +1693,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase) TimeMarker *marker; TransformOrientation *ts; SceneRenderLayer *srl; + ToolSettings *tos; sce= scebase->first; while(sce) { @@ -1696,13 +1711,22 @@ static void write_scenes(WriteData *wd, ListBase *scebase) base= base->next; } - writestruct(wd, DATA, "ToolSettings", 1, sce->toolsettings); - if(sce->toolsettings->vpaint) - writestruct(wd, DATA, "VPaint", 1, sce->toolsettings->vpaint); - if(sce->toolsettings->wpaint) - writestruct(wd, DATA, "VPaint", 1, sce->toolsettings->wpaint); - if(sce->toolsettings->sculpt) - writestruct(wd, DATA, "Sculpt", 1, sce->toolsettings->sculpt); + tos = sce->toolsettings; + writestruct(wd, DATA, "ToolSettings", 1, tos); + if(tos->vpaint) { + writestruct(wd, DATA, "VPaint", 1, tos->vpaint); + write_paint(wd, &tos->vpaint->paint); + } + if(tos->wpaint) { + writestruct(wd, DATA, "VPaint", 1, tos->wpaint); + write_paint(wd, &tos->wpaint->paint); + } + if(tos->sculpt) { + writestruct(wd, DATA, "Sculpt", 1, tos->sculpt); + write_paint(wd, &tos->sculpt->paint); + } + + write_paint(wd, &tos->imapaint.paint); ed= sce->ed; if(ed) { diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt index ce9f01235a3..fc28e21ab8f 100644 --- a/source/blender/editors/CMakeLists.txt +++ b/source/blender/editors/CMakeLists.txt @@ -40,7 +40,6 @@ SET(INC ../windowmanager ../nodes ../gpu ../blenfont - ${SDL_INC} ) IF(WITH_INTERNATIONAL) diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 8132d83fd7b..25e3c112389 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -1,5 +1,5 @@ /** - * $Id: $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -274,7 +274,7 @@ static void acf_generic_idblock_name(bAnimListElem *ale, char *name) /* just copy the name... */ if (id && name) - sprintf(name, id->name+2); + strcpy(name, id->name+2); } /* Settings ------------------------------------------- */ @@ -287,6 +287,10 @@ static short acf_generic_dsexpand_setting_valid(bAnimContext *ac, bAnimListElem case ACHANNEL_SETTING_EXPAND: return 1; + /* visible - only available in Graph Editor */ + case ACHANNEL_SETTING_VISIBLE: + return ((ac) && (ac->spacetype == SPACE_IPO)); + default: return 0; } @@ -345,6 +349,10 @@ static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *ale, int s /* muted only in NLA */ case ACHANNEL_SETTING_MUTE: return ((ac) && (ac->spacetype == SPACE_NLA)); + + /* visible only in Graph Editor */ + case ACHANNEL_SETTING_VISIBLE: + return ((ac) && (ac->spacetype == SPACE_IPO)); /* only select and expand supported otherwise */ case ACHANNEL_SETTING_SELECT: @@ -373,6 +381,10 @@ static int acf_scene_setting_flag(int setting, short *neg) case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */ return ADT_NLA_EVAL_OFF; + case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */ + *neg= 1; + return ADT_CURVES_NOT_VISIBLE; + default: /* unsupported */ return 0; } @@ -394,6 +406,7 @@ static void *acf_scene_setting_ptr(bAnimListElem *ale, int setting, short *type) GET_ACF_FLAG_PTR(scene->flag); case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */ + case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (scene->adt) GET_ACF_FLAG_PTR(scene->adt->flag) else @@ -441,7 +454,7 @@ static void acf_object_name(bAnimListElem *ale, char *name) /* just copy the name... */ if (ob && name) - sprintf(name, ob->id.name+2); + strcpy(name, ob->id.name+2); } /* check if some setting exists for this channel */ @@ -451,6 +464,10 @@ static short acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, int /* muted only in NLA */ case ACHANNEL_SETTING_MUTE: return ((ac) && (ac->spacetype == SPACE_NLA)); + + /* visible only in Graph Editor */ + case ACHANNEL_SETTING_VISIBLE: + return ((ac) && (ac->spacetype == SPACE_IPO)); /* only select and expand supported otherwise */ case ACHANNEL_SETTING_SELECT: @@ -479,6 +496,10 @@ static int acf_object_setting_flag(int setting, short *neg) case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */ return ADT_NLA_EVAL_OFF; + case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */ + *neg= 1; + return ADT_CURVES_NOT_VISIBLE; + default: /* unsupported */ return 0; } @@ -501,6 +522,7 @@ static void *acf_object_setting_ptr(bAnimListElem *ale, int setting, short *type GET_ACF_FLAG_PTR(ob->nlaflag); // xxx case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */ + case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (ob->adt) GET_ACF_FLAG_PTR(ob->adt->flag) else @@ -554,14 +576,20 @@ static void acf_group_name(bAnimListElem *ale, char *name) /* just copy the name... */ if (agrp && name) - sprintf(name, agrp->name); + strcpy(name, agrp->name); } /* check if some setting exists for this channel */ static short acf_group_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) { - /* for now, all settings are supported */ - return 1; + /* for now, all settings are supported, though some are only conditionally */ + switch (setting) { + case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */ + return ((ac->sa) && (ac->sa->spacetype==SPACE_IPO)); + + default: /* always supported */ + return 1; + } } /* get the appropriate flag(s) for the setting when it is valid */ @@ -641,6 +669,9 @@ static short acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, int return 1; else return 0; // NOTE: in this special case, we need to draw ICON_ZOOMOUT + + case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */ + return ((ac->sa) && (ac->sa->spacetype==SPACE_IPO)); /* always available */ default: @@ -783,7 +814,7 @@ static int acf_filldrivers_icon(bAnimListElem *ale) static void acf_filldrivers_name(bAnimListElem *ale, char *name) { - sprintf(name, "Drivers"); + strcpy(name, "Drivers"); } /* check if some setting exists for this channel */ @@ -858,7 +889,7 @@ static int acf_fillmatd_icon(bAnimListElem *ale) static void acf_fillmatd_name(bAnimListElem *ale, char *name) { - sprintf(name, "Materials"); + strcpy(name, "Materials"); } /* get the appropriate flag(s) for the setting when it is valid */ @@ -902,7 +933,7 @@ static int acf_fillpartd_icon(bAnimListElem *ale) static void acf_fillpartd_name(bAnimListElem *ale, char *name) { - sprintf(name, "Particles"); + strcpy(name, "Particles"); } /* get the appropriate flag(s) for the setting when it is valid */ @@ -962,6 +993,10 @@ static int acf_dsmat_setting_flag(int setting, short *neg) case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */ return ADT_NLA_EVAL_OFF; + + case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */ + *neg= 1; + return ADT_CURVES_NOT_VISIBLE; default: /* unsupported */ return 0; @@ -981,10 +1016,11 @@ static void *acf_dsmat_setting_ptr(bAnimListElem *ale, int setting, short *type) GET_ACF_FLAG_PTR(ma->flag); case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */ + case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (ma->adt) GET_ACF_FLAG_PTR(ma->adt->flag) else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -1026,6 +1062,10 @@ static int acf_dslam_setting_flag(int setting, short *neg) case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */ return ADT_NLA_EVAL_OFF; + + case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */ + *neg= 1; + return ADT_CURVES_NOT_VISIBLE; default: /* unsupported */ return 0; @@ -1045,10 +1085,11 @@ static void *acf_dslam_setting_ptr(bAnimListElem *ale, int setting, short *type) GET_ACF_FLAG_PTR(la->flag); case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */ + case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (la->adt) GET_ACF_FLAG_PTR(la->adt->flag) else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -1090,6 +1131,10 @@ static int acf_dscam_setting_flag(int setting, short *neg) case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */ return ADT_NLA_EVAL_OFF; + + case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */ + *neg= 1; + return ADT_CURVES_NOT_VISIBLE; default: /* unsupported */ return 0; @@ -1109,6 +1154,7 @@ static void *acf_dscam_setting_ptr(bAnimListElem *ale, int setting, short *type) GET_ACF_FLAG_PTR(ca->flag); case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */ + case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (ca->adt) GET_ACF_FLAG_PTR(ca->adt->flag) else @@ -1154,6 +1200,10 @@ static int acf_dscur_setting_flag(int setting, short *neg) case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */ return ADT_NLA_EVAL_OFF; + + case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */ + *neg= 1; + return ADT_CURVES_NOT_VISIBLE; default: /* unsupported */ return 0; @@ -1173,6 +1223,7 @@ static void *acf_dscur_setting_ptr(bAnimListElem *ale, int setting, short *type) GET_ACF_FLAG_PTR(cu->flag); case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */ + case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (cu->adt) GET_ACF_FLAG_PTR(cu->adt->flag) else @@ -1218,6 +1269,10 @@ static int acf_dsskey_setting_flag(int setting, short *neg) case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */ return ADT_NLA_EVAL_OFF; + + case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */ + *neg= 1; + return ADT_CURVES_NOT_VISIBLE; default: /* unsupported */ return 0; @@ -1237,6 +1292,7 @@ static void *acf_dsskey_setting_ptr(bAnimListElem *ale, int setting, short *type GET_ACF_FLAG_PTR(key->flag); case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */ + case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (key->adt) GET_ACF_FLAG_PTR(key->adt->flag) else @@ -1282,6 +1338,10 @@ static int acf_dswor_setting_flag(int setting, short *neg) case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */ return ADT_NLA_EVAL_OFF; + + case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */ + *neg= 1; + return ADT_CURVES_NOT_VISIBLE; default: /* unsupported */ return 0; @@ -1301,6 +1361,7 @@ static void *acf_dswor_setting_ptr(bAnimListElem *ale, int setting, short *type) GET_ACF_FLAG_PTR(wo->flag); case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */ + case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (wo->adt) GET_ACF_FLAG_PTR(wo->adt->flag) else @@ -1346,6 +1407,10 @@ static int acf_dspart_setting_flag(int setting, short *neg) case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */ return ADT_NLA_EVAL_OFF; + + case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */ + *neg= 1; + return ADT_CURVES_NOT_VISIBLE; default: /* unsupported */ return 0; @@ -1365,6 +1430,7 @@ static void *acf_dspart_setting_ptr(bAnimListElem *ale, int setting, short *type GET_ACF_FLAG_PTR(part->flag); case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */ + case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (part->adt) GET_ACF_FLAG_PTR(part->adt->flag) else @@ -1410,6 +1476,10 @@ static int acf_dsmball_setting_flag(int setting, short *neg) case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */ return ADT_NLA_EVAL_OFF; + + case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */ + *neg= 1; + return ADT_CURVES_NOT_VISIBLE; default: /* unsupported */ return 0; @@ -1429,6 +1499,7 @@ static void *acf_dsmball_setting_ptr(bAnimListElem *ale, int setting, short *typ GET_ACF_FLAG_PTR(mb->flag); case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */ + case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (mb->adt) GET_ACF_FLAG_PTR(mb->adt->flag) else @@ -1805,7 +1876,7 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float { bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale); View2D *v2d= &ac->ar->v2d; - short selected, offset, enabled; + short selected, offset; float y, ymid, ytext; /* sanity checks - don't draw anything */ @@ -1815,8 +1886,6 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float /* get initial offset */ if (acf->get_offset) offset= acf->get_offset(ac, ale); - else if (acf->get_indent_level) - offset= acf->get_indent_level(ac, ale) * INDENT_STEP_SIZE; else offset= 0; @@ -1834,19 +1903,13 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float else selected= 0; - /* enable correct blending mode for icons to work... */ - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - /* step 1) draw backdrop ........................................... */ if (acf->draw_backdrop) acf->draw_backdrop(ac, ale, yminc, ymaxc); /* step 2) draw expand widget ....................................... */ if (acf->has_setting(ac, ale, ACHANNEL_SETTING_EXPAND)) { - enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND); - - UI_icon_draw(offset, ymid, ((enabled)? ICON_TRIA_DOWN : ICON_TRIA_RIGHT)); + /* just skip - drawn as widget now */ offset += ICON_WIDTH; } @@ -1862,8 +1925,6 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float */ if (ac->sa) { if ((ac->spacetype == SPACE_IPO) && acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE)) { - enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_VISIBLE); - /* for F-Curves, draw color-preview of curve behind checkbox */ if (ale->type == ANIMTYPE_FCURVE) { FCurve *fcu= (FCurve *)ale->data; @@ -1874,28 +1935,21 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float glColor3fv(fcu->color); /* just a solid color rect - * hardcoded 18 pixels width is slightly wider than icon width, so that + * hardcoded 17 pixels width is slightly wider than icon width, so that * there's a slight border around it */ - glRectf(offset, yminc, offset+18, ymaxc); + glRectf(offset, yminc, offset+17, ymaxc); } - /* finally the icon itself */ - UI_icon_draw(offset, ymid, ((enabled)? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT)); + /* icon is drawn as widget now... */ offset += ICON_WIDTH; } else if ((ac->spacetype == SPACE_NLA) && acf->has_setting(ac, ale, ACHANNEL_SETTING_SOLO)) { - /* simply draw glowing dot in NLA for whether the track is enabled or not... */ - // NOTE: assumed to be for NLA track only for now... - enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_SOLO); - - UI_icon_draw(offset, ymid, ((enabled)? ICON_LAYER_ACTIVE : ICON_LAYER_USED)); + /* just skip - drawn as widget now */ offset += ICON_WIDTH; } } - glDisable(GL_BLEND); /* End of blending with background (text now gets drawn) */ - /* step 5) draw name ............................................... */ if (acf->name) { char name[256]; /* hopefully this will be enough! */ @@ -1913,34 +1967,210 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float UI_DrawString(offset, ytext, name); } - /* step 6) draw mute+protection toggles ............................. */ + /* step 6) draw mute+protection toggles + (sliders) ....................... */ /* reset offset - now goes from RHS of panel */ offset = 0; // TODO: we need a mechanism of drawing over (and hiding) stuff from here... + // TODO: when drawing sliders, make those draw instead of these toggles if not enough space + + if (v2d) { + /* protect... */ + if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) { + /* just skip - drawn as widget now */ + offset += ICON_WIDTH; + } + /* mute... */ + if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) { + /* just skip - drawn as widget now */ + offset += ICON_WIDTH; + } + } +} + +/* ------------------ */ + +/* callback for widget settings - send notifiers */ +static void achannel_setting_widget_cb(bContext *C, void *poin, void *poin2) +{ + WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL); +} + +/* Draw a widget for some setting */ +static void draw_setting_widget (bAnimContext *ac, bAnimListElem *ale, bAnimChannelType *acf, uiBlock *block, int xpos, int ypos, int setting) +{ + short negflag, ptrsize, enabled, butType; + int flag, icon; + void *ptr; + char *tooltip; + uiBut *but = NULL; + + /* get the flag and the pointer to that flag */ + flag= acf->setting_flag(setting, &negflag); + ptr= acf->setting_ptr(ale, setting, &ptrsize); + enabled= ANIM_channel_setting_get(ac, ale, setting); + + /* get the base icon for the setting */ + switch (setting) { + case ACHANNEL_SETTING_VISIBLE: /* visibility checkboxes */ + //icon= ((enabled)? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT); + icon= ICON_CHECKBOX_DEHLT; + + if (ale->type == ANIMTYPE_FCURVE) + tooltip= "F-Curve is visible in Graph Editor for editing."; + else + tooltip= "F-Curve(s) are visible in Graph Editor for editing."; + break; + + case ACHANNEL_SETTING_EXPAND: /* expanded triangle */ + //icon= ((enabled)? ICON_TRIA_DOWN : ICON_TRIA_RIGHT); + icon= ICON_TRIA_RIGHT; + tooltip= "Make channels grouped under this channel visible."; + break; + + case ACHANNEL_SETTING_SOLO: /* NLA Tracks only */ + //icon= ((enabled)? ICON_LAYER_ACTIVE : ICON_LAYER_USED); + icon= ICON_LAYER_USED; + tooltip= "NLA Track is the only one evaluated for the AnimData block it belongs to."; + break; + + /* --- */ + + case ACHANNEL_SETTING_PROTECT: /* protected lock */ + // TODO: what about when there's no protect needed? + //icon= ((enabled)? ICON_LOCKED : ICON_UNLOCKED); + icon= ICON_UNLOCKED; + tooltip= "Editability of keyframes for this channel."; + break; + + case ACHANNEL_SETTING_MUTE: /* muted eye */ + //icon= ((enabled)? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF); + icon= ICON_MUTE_IPO_OFF; + + if (ale->type == ALE_FCURVE) + tooltip= "Does F-Curve contribute to result."; + else + tooltip= "Do channels contribute to result."; + break; + + default: + tooltip= NULL; + icon= 0; + break; + } - /* set blending again, as text drawing may clear it */ - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); + /* type of button */ + if (negflag) + butType= ICONTOGN; + else + butType= ICONTOG; + + /* draw button for setting */ + if (ptr && flag) { + switch (ptrsize) { + case sizeof(int): /* integer pointer for setting */ + but= uiDefIconButBitI(block, butType, flag, 0, icon, + xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip); + break; + + case sizeof(short): /* short pointer for setting */ + but= uiDefIconButBitS(block, butType, flag, 0, icon, + xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip); + break; + + case sizeof(char): /* char pointer for setting */ + but= uiDefIconButBitC(block, butType, flag, 0, icon, + xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip); + break; + } + + /* set call to send relevant notifiers */ + // NOTE: for now, we only need to send 'edited' + if (but) + uiButSetFunc(but, achannel_setting_widget_cb, NULL, NULL); + } +} + +/* Draw UI widgets the given channel */ +// TODO: make this use UI controls for the buttons +void ANIM_channel_draw_widgets (bAnimContext *ac, bAnimListElem *ale, uiBlock *block, float yminc, float ymaxc) +{ + bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale); + View2D *v2d= &ac->ar->v2d; + float y, ymid, ytext; + short offset; - /* protect... */ - // XXX v2d might not be valid - if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) { - enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_PROTECT); + /* sanity checks - don't draw anything */ + if ELEM3(NULL, acf, ale, block) + return; + + /* get initial offset */ + if (acf->get_offset) + offset= acf->get_offset(ac, ale); + else + offset= 0; - offset += ICON_WIDTH; - UI_icon_draw(v2d->cur.xmax-(float)offset, ymid, ((enabled)? ICON_LOCKED : ICON_UNLOCKED)); + /* calculate appropriate y-coordinates for icon buttons + * 7 is hardcoded factor for half-height of icons + */ + y= (ymaxc - yminc)/2 + yminc; + ymid= y - 7; + /* y-coordinates for text is only 4 down from middle */ + ytext= y - 4; + + /* no button backdrop behind icons */ + uiBlockSetEmboss(block, UI_EMBOSSN); + + /* step 1) draw expand widget ....................................... */ + if (acf->has_setting(ac, ale, ACHANNEL_SETTING_EXPAND)) { + draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_EXPAND); + offset += ICON_WIDTH; } - /* mute... */ - // XXX v2d might not be valid - if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) { - enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_MUTE); + /* step 2) draw icon ............................................... */ + if (acf->icon) { + /* icon is not drawn here (not a widget) */ offset += ICON_WIDTH; - UI_icon_draw(v2d->cur.xmax-(float)offset, ymid, ((enabled)? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF)); + } + + /* step 3) draw special toggles ................................. + * - in Graph Editor, checkboxes for visibility in curves area + * - in NLA Editor, glowing dots for solo/not solo... + */ + if (ac->sa) { + if ((ac->spacetype == SPACE_IPO) && acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE)) { + /* visibility toggle */ + draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_VISIBLE); + offset += ICON_WIDTH; + } + else if ((ac->spacetype == SPACE_NLA) && acf->has_setting(ac, ale, ACHANNEL_SETTING_SOLO)) { + /* 'solo' setting for NLA Tracks */ + draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_SOLO); + offset += ICON_WIDTH; + } } - glDisable(GL_BLEND); /* End of blending with background */ + /* step 4) draw text... */ + /* NOTE: this is not done here, since nothing to be clicked on... */ + + /* step 5) draw mute+protection toggles + (sliders) ....................... */ + /* reset offset - now goes from RHS of panel */ + offset = 0; + + // TODO: when drawing sliders, make those draw instead of these toggles if not enough space + + if (v2d) { + /* protect... */ + if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) { + offset += ICON_WIDTH; + draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax-offset, ymid, ACHANNEL_SETTING_PROTECT); + } + /* mute... */ + if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) { + offset += ICON_WIDTH; + draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax-offset, ymid, ACHANNEL_SETTING_MUTE); + } + } } /* *********************************************** */ diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index d74c9fbf48b..72d8f71bc26 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -1193,47 +1193,19 @@ static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short sele /* if channel is within border-select region, alter it */ if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))) { - /* only the following types can be selected */ + /* set selection flags only */ + ANIM_channel_setting_set(ac, ale, ACHANNEL_SETTING_SELECT, selectmode); + + /* type specific actions */ switch (ale->type) { - case ANIMTYPE_OBJECT: /* object */ - { - Base *base= (Base *)ale->data; - Object *ob= base->object; - - ACHANNEL_SET_FLAG(base, selectmode, SELECT); - ACHANNEL_SET_FLAG(ob, selectmode, SELECT); - } - break; - case ANIMTYPE_GROUP: /* action group */ + case ANIMTYPE_GROUP: { bActionGroup *agrp= (bActionGroup *)ale->data; - ACHANNEL_SET_FLAG(agrp, selectmode, AGRP_SELECTED); + /* always clear active flag after doing this */ agrp->flag &= ~AGRP_ACTIVE; } break; - case ANIMTYPE_FCURVE: /* F-Curve channel */ - { - FCurve *fcu = (FCurve *)ale->data; - - ACHANNEL_SET_FLAG(fcu, selectmode, FCURVE_SELECTED); - } - break; - case ANIMTYPE_GPLAYER: /* grease-pencil layer */ - { - bGPDlayer *gpl = (bGPDlayer *)ale->data; - - ACHANNEL_SET_FLAG(gpl, selectmode, GP_LAYER_SELECT); - } - break; - - case ANIMTYPE_NLATRACK: /* nla-track */ - { - NlaTrack *nlt= (NlaTrack *)ale->data; - - ACHANNEL_SET_FLAG(nlt, selectmode, NLATRACK_SELECTED); - } - break; } } @@ -1305,11 +1277,7 @@ void ANIM_OT_channels_select_border(wmOperatorType *ot) } /* ******************** Mouse-Click Operator *********************** */ -/* Depending on the channel that was clicked on, the mouse click will activate whichever - * part of the channel is relevant. - * - * NOTE: eventually, this should probably be phased out when many of these things are replaced with buttons - */ +/* Handle selection changes due to clicking on channels. Settings will get caught by UI code... */ static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, short selectmode) { @@ -1347,24 +1315,16 @@ static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, sh { Scene *sce= (Scene *)ale->data; - if (x < 16) { - /* toggle expand */ - sce->flag ^= SCE_DS_COLLAPSED; - - notifierFlags |= ND_ANIMCHAN_EDIT; + /* set selection status */ + if (selectmode == SELECT_INVERT) { + /* swap select */ + sce->flag ^= SCE_DS_SELECTED; } else { - /* set selection status */ - if (selectmode == SELECT_INVERT) { - /* swap select */ - sce->flag ^= SCE_DS_SELECTED; - } - else { - sce->flag |= SCE_DS_SELECTED; - } - - notifierFlags |= ND_ANIMCHAN_SELECT; + sce->flag |= SCE_DS_SELECTED; } + + notifierFlags |= ND_ANIMCHAN_SELECT; } break; case ANIMTYPE_OBJECT: @@ -1374,233 +1334,87 @@ static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, sh Base *base= (Base *)ale->data; Object *ob= base->object; - if (x < 16) { - /* toggle expand */ - ob->nlaflag ^= OB_ADS_COLLAPSED; // XXX - - notifierFlags |= ND_ANIMCHAN_EDIT; + /* set selection status */ + if (selectmode == SELECT_INVERT) { + /* swap select */ + base->flag ^= SELECT; + ob->flag= base->flag; } else { - /* set selection status */ - if (selectmode == SELECT_INVERT) { - /* swap select */ - base->flag ^= SELECT; - ob->flag= base->flag; - } - else { - Base *b; - - /* deleselect all */ - for (b= sce->base.first; b; b= b->next) { - b->flag &= ~SELECT; - b->object->flag= b->flag; - } - - /* select object now */ - base->flag |= SELECT; - ob->flag |= SELECT; - } + Base *b; - /* xxx should be ED_base_object_activate(), but we need context pointer for that... */ - //set_active_base(base); + /* deleselect all */ + for (b= sce->base.first; b; b= b->next) { + b->flag &= ~SELECT; + b->object->flag= b->flag; + } - notifierFlags |= ND_ANIMCHAN_SELECT; + /* select object now */ + base->flag |= SELECT; + ob->flag |= SELECT; } - } - break; - case ANIMTYPE_FILLACTD: - { - bAction *act= (bAction *)ale->data; - act->flag ^= ACT_COLLAPSED; - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_FILLDRIVERS: - { - AnimData *adt= (AnimData* )ale->data; - adt->flag ^= ADT_DRIVERS_COLLAPSED; - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_FILLMATD: - { - Object *ob= (Object *)ale->data; - ob->nlaflag ^= OB_ADS_SHOWMATS; // XXX - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_FILLPARTD: - { - Object *ob= (Object *)ale->data; - ob->nlaflag ^= OB_ADS_SHOWPARTS; // XXX - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - - case ANIMTYPE_DSMAT: - { - Material *ma= (Material *)ale->data; - ma->flag ^= MA_DS_EXPAND; - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSLAM: - { - Lamp *la= (Lamp *)ale->data; - la->flag ^= LA_DS_EXPAND; - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSCAM: - { - Camera *ca= (Camera *)ale->data; - ca->flag ^= CAM_DS_EXPAND; - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSCUR: - { - Curve *cu= (Curve *)ale->data; - cu->flag ^= CU_DS_EXPAND; - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSSKEY: - { - Key *key= (Key *)ale->data; - key->flag ^= KEYBLOCK_DS_EXPAND; - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSWOR: - { - World *wo= (World *)ale->data; - wo->flag ^= WO_DS_EXPAND; - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSPART: - { - ParticleSettings *part= (ParticleSettings *)ale->data; - part->flag ^= PART_DS_EXPAND; - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSMBALL: - { - MetaBall *mb= (MetaBall *)ale->data; - mb->flag2 ^= MB_DS_EXPAND; - notifierFlags |= ND_ANIMCHAN_EDIT; + + /* xxx should be ED_base_object_activate(), but we need context pointer for that... */ + //set_active_base(base); + + notifierFlags |= ND_ANIMCHAN_SELECT; } break; case ANIMTYPE_GROUP: { bActionGroup *agrp= (bActionGroup *)ale->data; - short offset= (ELEM3(ac->datatype, ANIMCONT_DOPESHEET, ANIMCONT_FCURVES, ANIMCONT_DRIVERS))? 18 : 0; - if ((x < (offset+17)) && (agrp->channels.first)) { - /* toggle expand */ - agrp->flag ^= AGRP_EXPANDED; - notifierFlags |= ND_ANIMCHAN_EDIT; - } - else if ((x < (offset+32)) && (ac->spacetype==SPACE_IPO)) { - /* toggle visibility (of grouped F-Curves in Graph editor) */ - agrp->flag ^= AGRP_NOTVISIBLE; - notifierFlags |= ND_ANIMCHAN_EDIT; + /* select/deselect group */ + if (selectmode == SELECT_INVERT) { + /* inverse selection status of this group only */ + agrp->flag ^= AGRP_SELECTED; } - else if (x >= (ACHANNEL_NAMEWIDTH-ACHANNEL_BUTTON_WIDTH)) { - /* toggle protection/locking */ - agrp->flag ^= AGRP_PROTECTED; - notifierFlags |= ND_ANIMCHAN_EDIT; - } - else if (x >= (ACHANNEL_NAMEWIDTH-2*ACHANNEL_BUTTON_WIDTH)) { - /* toggle mute */ - agrp->flag ^= AGRP_MUTED; - notifierFlags |= ND_ANIMCHAN_EDIT; + else if (selectmode == -1) { + /* select all in group (and deselect everthing else) */ + FCurve *fcu; + + /* deselect all other channels */ + ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); + + /* only select channels in group and group itself */ + for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcu->next) + fcu->flag |= FCURVE_SELECTED; + agrp->flag |= AGRP_SELECTED; } else { - /* select/deselect group */ - if (selectmode == SELECT_INVERT) { - /* inverse selection status of this group only */ - agrp->flag ^= AGRP_SELECTED; - } - else if (selectmode == -1) { - /* select all in group (and deselect everthing else) */ - FCurve *fcu; - - /* deselect all other channels */ - ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); - - /* only select channels in group and group itself */ - for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcu->next) - fcu->flag |= FCURVE_SELECTED; - agrp->flag |= AGRP_SELECTED; - } - else { - /* select group by itself */ - ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); - agrp->flag |= AGRP_SELECTED; - } - - /* if group is selected now, make group the 'active' one in the visible list */ - if (agrp->flag & AGRP_SELECTED) - ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, agrp, ANIMTYPE_GROUP); - - notifierFlags |= ND_ANIMCHAN_SELECT; + /* select group by itself */ + ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); + agrp->flag |= AGRP_SELECTED; } + + /* if group is selected now, make group the 'active' one in the visible list */ + if (agrp->flag & AGRP_SELECTED) + ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, agrp, ANIMTYPE_GROUP); + + notifierFlags |= ND_ANIMCHAN_SELECT; } break; case ANIMTYPE_FCURVE: { FCurve *fcu= (FCurve *)ale->data; - short offset; - if (ac->datatype != ANIMCONT_ACTION) { - /* for now, special case for materials */ - if (ale->ownertype == ANIMTYPE_DSMAT) - offset= 21; - else - offset= 18; - } - else - offset = 0; - - if (x >= (ACHANNEL_NAMEWIDTH-ACHANNEL_BUTTON_WIDTH)) { - /* toggle protection (only if there's a toggle there) */ - if (fcu->bezt) { - fcu->flag ^= FCURVE_PROTECTED; - notifierFlags |= ND_ANIMCHAN_EDIT; - } - } - else if (x >= (ACHANNEL_NAMEWIDTH-2*ACHANNEL_BUTTON_WIDTH)) { - /* toggle mute */ - fcu->flag ^= FCURVE_MUTED; - notifierFlags |= ND_ANIMCHAN_EDIT; - } - else if ((x < (offset+17)) && (ac->spacetype==SPACE_IPO)) { - /* toggle visibility */ - fcu->flag ^= FCURVE_VISIBLE; - notifierFlags |= ND_ANIMCHAN_EDIT; + /* select/deselect */ + if (selectmode == SELECT_INVERT) { + /* inverse selection status of this F-Curve only */ + fcu->flag ^= FCURVE_SELECTED; } else { - /* select/deselect */ - if (selectmode == SELECT_INVERT) { - /* inverse selection status of this F-Curve only */ - fcu->flag ^= FCURVE_SELECTED; - } - else { - /* select F-Curve by itself */ - ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); - fcu->flag |= FCURVE_SELECTED; - } - - /* if F-Curve is selected now, make F-Curve the 'active' one in the visible list */ - if (fcu->flag & FCURVE_SELECTED) - ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, fcu, ANIMTYPE_FCURVE); - - notifierFlags |= ND_ANIMCHAN_SELECT; + /* select F-Curve by itself */ + ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); + fcu->flag |= FCURVE_SELECTED; } + + /* if F-Curve is selected now, make F-Curve the 'active' one in the visible list */ + if (fcu->flag & FCURVE_SELECTED) + ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, fcu, ANIMTYPE_FCURVE); + + notifierFlags |= ND_ANIMCHAN_SELECT; } break; case ANIMTYPE_GPDATABLOCK: diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 4797c7946a4..37c8aeac13a 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -374,27 +374,29 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac) */ #define ANIMDATA_FILTER_CASES(id, adtOk, nlaOk, driversOk, keysOk) \ {\ - if (filter_mode & ANIMFILTER_ANIMDATA) {\ - if ((id)->adt) {\ - adtOk\ - }\ - }\ - else if (ads->filterflag & ADS_FILTER_ONLYNLA) {\ - if (ANIMDATA_HAS_NLA(id)) {\ - nlaOk\ - }\ - else if (!(ads->filterflag & ADS_FILTER_NLA_NOACT) && ANIMDATA_HAS_KEYS(id)) {\ - nlaOk\ - }\ - }\ - else if (ads->filterflag & ADS_FILTER_ONLYDRIVERS) {\ - if (ANIMDATA_HAS_DRIVERS(id)) {\ - driversOk\ - }\ - }\ - else {\ - if (ANIMDATA_HAS_KEYS(id)) {\ - keysOk\ + if ((id)->adt) {\ + if (!(filter_mode & ANIMFILTER_CURVEVISIBLE) || !((id)->adt->flag & ADT_CURVES_NOT_VISIBLE)) {\ + if (filter_mode & ANIMFILTER_ANIMDATA) {\ + adtOk\ + }\ + else if (ads->filterflag & ADS_FILTER_ONLYNLA) {\ + if (ANIMDATA_HAS_NLA(id)) {\ + nlaOk\ + }\ + else if (!(ads->filterflag & ADS_FILTER_NLA_NOACT) && ANIMDATA_HAS_KEYS(id)) {\ + nlaOk\ + }\ + }\ + else if (ads->filterflag & ADS_FILTER_ONLYDRIVERS) {\ + if (ANIMDATA_HAS_DRIVERS(id)) {\ + driversOk\ + }\ + }\ + else {\ + if (ANIMDATA_HAS_KEYS(id)) {\ + keysOk\ + }\ + }\ }\ }\ } @@ -1465,6 +1467,14 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int worOk= !(ads->filterflag & ADS_FILTER_NOWOR);) } + /* if only F-Curves with visible flags set can be shown, check that + * datablocks haven't been set to invisible + */ + if (filter_mode & ANIMFILTER_CURVEVISIBLE) { + if ((sce->adt) && (sce->adt->flag & ADT_CURVES_NOT_VISIBLE)) + sceOk= worOk= 0; + } + /* check if not all bad (i.e. so there is something to show) */ if ( !(!sceOk && !worOk) ) { /* add scene data to the list of filtered channels */ @@ -1481,7 +1491,7 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int Key *key= ob_get_key(ob); short actOk=1, keyOk=1, dataOk=1, matOk=1, partOk=1; - /* firstly, check if object can be included, by the following fanimors: + /* firstly, check if object can be included, by the following factors: * - if only visible, must check for layer and also viewport visibility * - if only selected, must check if object is selected * - there must be animation data to edit @@ -1495,6 +1505,14 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int if (ob->restrictflag & OB_RESTRICT_VIEW) continue; } + /* if only F-Curves with visible flags set can be shown, check that + * datablock hasn't been set to invisible + */ + if (filter_mode & ANIMFILTER_CURVEVISIBLE) { + if ((ob->adt) && (ob->adt->flag & ADT_CURVES_NOT_VISIBLE)) + continue; + } + /* additionally, dopesheet filtering also affects what objects to consider */ if (ads->filterflag) { /* check selection and object type filters */ diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index ffc93340f8c..5bd37ba7831 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -899,7 +899,7 @@ short keyingset_context_ok_poll (bContext *C, KeyingSet *ks) Object *obact= CTX_data_active_object(C); /* if in posemode, check if 'pose-channels' requested for in KeyingSet */ - if ((obact && obact->pose) && (obact->flag & OB_POSEMODE)) { + if ((obact && obact->pose) && (obact->mode & OB_MODE_POSE)) { /* check for posechannels */ } @@ -930,7 +930,7 @@ static short modifykey_get_context_v3d_data (bContext *C, ListBase *dsources, Ke /* check if the active object is in PoseMode (i.e. only deal with bones) */ // TODO: check with the templates to see what we really need to store - if ((obact && obact->pose) && (obact->flag & OB_POSEMODE)) { + if ((obact && obact->pose) && (obact->mode & OB_MODE_POSE)) { /* Pose Mode: Selected bones */ #if 0 //set_pose_keys(ob); /* sets pchan->flag to POSE_KEY if bone selected, and clears if not */ diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index c1b24375b3d..632f037679f 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -713,7 +713,7 @@ int join_armature_exec(bContext *C, wmOperator *op) /* get pose of active object and move it out of posemode */ pose= ob->pose; - ob->flag &= ~OB_POSEMODE; + ob->mode &= ~OB_MODE_POSE; CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { if ((base->object->type==OB_ARMATURE) && (base->object!=ob)) { @@ -724,8 +724,8 @@ int join_armature_exec(bContext *C, wmOperator *op) /* Get Pose of current armature */ opose= base->object->pose; - base->object->flag &= ~OB_POSEMODE; - BASACT->flag &= ~OB_POSEMODE; + base->object->mode &= ~OB_MODE_POSE; + //BASACT->flag &= ~OB_MODE_POSE; /* Find the difference matrix */ Mat4Invert(oimat, ob->obmat); @@ -1034,8 +1034,8 @@ static int separate_armature_exec (bContext *C, wmOperator *op) /* 1) store starting settings and exit editmode */ oldob= obedit; oldbase= BASACT; - oldob->flag &= ~OB_POSEMODE; - oldbase->flag &= ~OB_POSEMODE; + oldob->mode &= ~OB_MODE_POSE; + //oldbase->flag &= ~OB_POSEMODE; ED_armature_from_edit(scene, obedit); ED_armature_edit_free(obedit); @@ -4332,7 +4332,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor } /* in weightpaint we select the associated vertex group too */ - if (G.f & G_WEIGHTPAINT) { + if (ob->mode & OB_MODE_WEIGHT_PAINT) { if (nearBone->flag & BONE_ACTIVE) { vertexgroup_select_by_name(OBACT, nearBone->name); DAG_object_flush_update(scene, OBACT, OB_RECALC_DATA); @@ -4424,7 +4424,7 @@ static int bone_skinnable(Object *ob, Bone *bone, void *datap) int a, segments; struct { Object *armob; void *list; int heat; } *data = datap; - if(!(G.f & G_WEIGHTPAINT) || !(bone->flag & BONE_HIDDEN_P)) { + if(!(ob->mode & OB_MODE_WEIGHT_PAINT) || !(bone->flag & BONE_HIDDEN_P)) { if (!(bone->flag & BONE_NO_DEFORM)) { if (data->heat && data->armob->pose && get_pose_channel(data->armob->pose, bone->name)) segments = bone->segments; @@ -4489,7 +4489,7 @@ static int dgroup_skinnable(Object *ob, Bone *bone, void *datap) int a, segments; struct { Object *armob; void *list; int heat; } *data= datap; - if (!(G.f & G_WEIGHTPAINT) || !(bone->flag & BONE_HIDDEN_P)) { + if (!(ob->mode & OB_MODE_WEIGHT_PAINT) || !(bone->flag & BONE_HIDDEN_P)) { if (!(bone->flag & BONE_NO_DEFORM)) { if (data->heat && data->armob->pose && get_pose_channel(data->armob->pose, bone->name)) segments = bone->segments; @@ -4588,7 +4588,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m float (*root)[3], (*tip)[3], (*verts)[3]; int *selected; int numbones, vertsfilled = 0, i, j, segments = 0; - int wpmode = (G.f & G_WEIGHTPAINT); + int wpmode = (ob->mode & OB_MODE_WEIGHT_PAINT); struct { Object *armob; void *list; int heat; } looper_data; looper_data.armob = par; diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index ce3bcc8aed5..79d3d7b1366 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -2320,7 +2320,7 @@ void sk_drawSketch(Scene *scene, View3D *v3d, SK_Sketch *sketch, int with_names) for (p = sketch->depth_peels.first; p; p = p->next) { - int index = (int)(p->ob); + int index = GET_INT_FROM_POINTER(p->ob); index = (index >> 5) & 7; glColor3fv(colors[index]); diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 174bb39d7b9..5b378878f91 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -126,7 +126,7 @@ void ED_armature_enter_posemode(bContext *C, Base *base) switch (ob->type){ case OB_ARMATURE: - ob->flag |= OB_POSEMODE; + ob->mode |= OB_MODE_POSE; base->flag= ob->flag; WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_POSE, NULL); @@ -135,7 +135,8 @@ void ED_armature_enter_posemode(bContext *C, Base *base) default: return; } - ED_view3d_exit_paint_modes(C); + + ED_object_toggle_modes(C, ob->mode); } void ED_armature_exit_posemode(bContext *C, Base *base) @@ -143,7 +144,7 @@ void ED_armature_exit_posemode(bContext *C, Base *base) if(base) { Object *ob= base->object; - ob->flag &= ~OB_POSEMODE; + ob->mode &= ~OB_MODE_POSE; base->flag= ob->flag; WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL); @@ -527,7 +528,7 @@ void pose_select_constraint_target(Scene *scene) /* paranoia checks */ if (!ob && !ob->pose) return; - if (ob==obedit || (ob->flag & OB_POSEMODE)==0) return; + if (ob==obedit || (ob->mode & OB_MODE_POSE)==0) return; for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { if (arm->layer & pchan->bone->layer) { @@ -715,7 +716,7 @@ void pose_copy_menu(Scene *scene) /* paranoia checks */ if (ELEM(NULL, ob, ob->pose)) return; - if ((ob==obedit) || (ob->flag & OB_POSEMODE)==0) return; + if ((ob==obedit) || (ob->mode & OB_MODE_POSE)==0) return; /* find active */ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { @@ -1105,7 +1106,7 @@ void pose_adds_vgroups(Scene *scene, Object *meshobj, int heatweights) // XXX extern VPaint Gwp; /* from vpaint */ Object *poseobj= modifiers_isDeformedByArmature(meshobj); - if(poseobj==NULL || (poseobj->flag & OB_POSEMODE)==0) { + if(poseobj==NULL || (poseobj->mode & OB_MODE_POSE)==0) { error("The active object must have a deforming armature in pose mode"); return; } @@ -1646,10 +1647,10 @@ void pose_activate_flipped_bone(Scene *scene) if(ob==NULL) return; - if(G.f & G_WEIGHTPAINT) { + if(ob->mode && OB_MODE_WEIGHT_PAINT) { ob= modifiers_isDeformedByArmature(ob); } - if(ob && (ob->flag & OB_POSEMODE)) { + if(ob && (ob->mode & OB_MODE_POSE)) { bPoseChannel *pchan, *pchanf; for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { @@ -1670,7 +1671,7 @@ void pose_activate_flipped_bone(Scene *scene) pchanf->bone->flag |= (BONE_SELECTED|BONE_ACTIVE); /* in weightpaint we select the associated vertex group too */ - if(G.f & G_WEIGHTPAINT) { + if(ob->mode & OB_MODE_WEIGHT_PAINT) { vertexgroup_select_by_name(OBACT, name); DAG_object_flush_update(scene, OBACT, OB_RECALC_DATA); } @@ -2150,7 +2151,7 @@ void pose_special_editmenu(Scene *scene) /* paranoia checks */ if(!ob && !ob->pose) return; - if(ob==obedit || (ob->flag & OB_POSEMODE)==0) return; + if(ob==obedit || (ob->mode & OB_MODE_POSE)==0) return; nr= pupmenu("Specials%t|Select Constraint Target%x1|Flip Left-Right Names%x2|Calculate Paths%x3|Clear Paths%x4|Clear User Transform %x5|Relax Pose %x6|%l|AutoName Left-Right%x7|AutoName Front-Back%x8|AutoName Top-Bottom%x9"); if(nr==1) { diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index d3d42deba21..179f362b13f 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -46,6 +46,8 @@ struct bActionGroup; struct FCurve; struct FModifier; +struct uiBlock; + /* ************************************************ */ /* ANIMATION CHANNEL FILTERING */ /* anim_filter.c */ @@ -338,6 +340,8 @@ bAnimChannelType *ANIM_channel_get_typeinfo(bAnimListElem *ale); /* Draw the given channel */ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc); +/* Draw the widgets for the given channel */ +void ANIM_channel_draw_widgets(bAnimContext *ac, bAnimListElem *ale, struct uiBlock *block, float yminc, float ymaxc); /* ------------------------ Editing API -------------------------- */ @@ -402,14 +406,16 @@ void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *id, List /* ------------ Animation F-Curves <-> Icons/Names Mapping ------------ */ /* anim_ipo_utils.c */ +/* Get icon for type of setting F-Curve is for */ +// XXX include this in the getname() method via RNA? int geticon_anim_blocktype(short blocktype); +/* Get name for channel-list displays for F-Curve */ void getname_anim_fcurve(char *name, struct ID *id, struct FCurve *fcu); - +/* Automatically determine a color for the nth F-Curve */ void ipo_rainbow(int cur, int tot, float *out); - /* ------------- NLA-Mapping ----------------------- */ /* anim_draw.c */ diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index c8a72a2aa97..d31f85d08ea 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -59,6 +59,8 @@ struct Base *ED_object_add_duplicate(struct Scene *scene, struct Base *base, int void ED_object_parent(struct Object *ob, struct Object *parent, int type, const char *substr); +void ED_object_toggle_modes(struct bContext *C, int mode); + /* bitflags for enter/exit editmode */ #define EM_FREEDATA 1 #define EM_FREEUNDO 2 @@ -69,6 +71,8 @@ void ED_object_enter_editmode(struct bContext *C, int flag); void ED_object_base_init_from_view(struct bContext *C, struct Base *base); +void ED_object_single_users(struct Scene *scene, int full); + /* cleanup */ int object_is_libdata(struct Object *ob); int object_data_is_libdata(struct Object *ob); @@ -89,6 +93,9 @@ void ED_object_constraint_set_active(struct Object *ob, struct bConstraint *con) void mouse_lattice(struct bContext *C, short mval[2], int extend); void undo_push_lattice(struct bContext *C, char *name); +/* editmball.c */ +void undo_push_mball(struct bContext *C, char *name); + /* editkey.c */ void insert_shapekey(struct Scene *scene, struct Object *ob); void delete_key(struct Scene *scene, struct Object *ob); diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index fc29d64eb37..6cb7593e07d 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -89,10 +89,13 @@ void ED_screen_do_listen(struct wmWindow *win, struct wmNotifier *note); bScreen *ED_screen_duplicate(struct wmWindow *win, struct bScreen *sc); bScreen *ED_screen_add(struct wmWindow *win, struct Scene *scene, char *name); void ED_screen_set(struct bContext *C, struct bScreen *sc); +void ED_screen_delete(struct bContext *C, struct bScreen *sc); void ED_screen_set_scene(struct bContext *C, struct Scene *scene); +void ED_screen_delete_scene(struct bContext *C, struct Scene *scene); void ED_screen_set_subwinactive(struct wmWindow *win, struct wmEvent *event); void ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen); -void ED_screen_animation_timer(struct bContext *C, int redraws, int enable); +void ED_screen_animation_timer(struct bContext *C, int redraws, int sync, int enable); +void ED_screen_animation_timer_update(struct bContext *C, int redraws); int ED_screen_full_newspace(struct bContext *C, ScrArea *sa, int type); void ED_screen_full_prevspace(struct bContext *C); diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h index 76a2a55c29e..72afe7704b4 100644 --- a/source/blender/editors/include/ED_screen_types.h +++ b/source/blender/editors/include/ED_screen_types.h @@ -31,9 +31,9 @@ /* for animplayer */ typedef struct ScreenAnimData { - ARegion *ar; /* do not read from this, only for comparing if region exists */ + ARegion *ar; /* do not read from this, only for comparing if region exists */ int redraws; - int flag; /* flags for playback */ + int flag; /* flags for playback */ } ScreenAnimData; /* for animplayer */ @@ -42,6 +42,10 @@ enum { ANIMPLAY_FLAG_REVERSE = (1<<0), /* temporary - playback just jumped to the start/end */ ANIMPLAY_FLAG_JUMPED = (1<<1), + /* drop frames as needed to maintain framerate */ + ANIMPLAY_FLAG_SYNC = (1<<2), + /* don't drop frames (and ignore AUDIO_SYNC flag) */ + ANIMPLAY_FLAG_NO_SYNC = (1<<3), }; diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index b576299c1d0..07aa44cadd8 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -130,8 +130,6 @@ int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, int lasso_inside(short mcords[][2], short moves, short sx, short sy); int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, int y1); -/* modes */ -void ED_view3d_exit_paint_modes(struct bContext *C); /* get 3d region from context, also if mouse is in header or toolbar */ struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C); diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 4d6dfe993a6..cc3b243d38d 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -608,6 +608,7 @@ int uiLayoutGetEnabled(uiLayout *layout); int uiLayoutGetRedAlert(uiLayout *layout); int uiLayoutGetAlignment(uiLayout *layout); int uiLayoutGetKeepAspect(uiLayout *layout); +int uiLayoutGetWidth(uiLayout *layout); float uiLayoutGetScaleX(uiLayout *layout); float uiLayoutGetScaleY(uiLayout *layout); ListBase *uiLayoutBoxGetList(uiLayout *layout); @@ -638,6 +639,10 @@ void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *i void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C); void uiTemplateOperatorSearch(uiLayout *layout); void uiTemplateHeader3D(uiLayout *layout, struct bContext *C); +void uiTemplate_view3d_select_metaballmenu(uiLayout *layout, struct bContext *C); +void uiTemplate_view3d_select_armaturemenu(uiLayout *layout, struct bContext *C); +void uiTemplate_view3d_select_posemenu(uiLayout *layout, struct bContext *C); +void uiTemplate_view3d_select_faceselmenu(uiLayout *layout, struct bContext *C); void uiTemplateTextureImage(uiLayout *layout, struct bContext *C, struct Tex *tex); typedef struct uiListItem { diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 1c58d087ec4..4f6c6db3b16 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -48,6 +48,7 @@ #include "BKE_screen.h" #include "BKE_texture.h" #include "BKE_utildefines.h" +#include "BKE_unit.h" #include "BIF_gl.h" #include "BIF_glutil.h" @@ -1141,6 +1142,21 @@ int ui_is_but_float(uiBut *but) return 0; } +int ui_is_but_unit(uiBut *but) +{ + Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); + if(scene->unit.system == USER_UNIT_NONE) + return 0; + + if(but->rnaprop==NULL) + return 0; + + if(RNA_SUBTYPE_UNIT_VALUE(RNA_property_subtype(but->rnaprop))==0) + return 0; + + return 1; +} + double ui_get_but_val(uiBut *but) { PropertyRNA *prop; @@ -1307,6 +1323,55 @@ int ui_get_but_string_max_length(uiBut *but) return UI_MAX_DRAW_STR; } +static double ui_get_but_scale_unit(uiBut *but, double value) +{ + Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); + int subtype= RNA_property_subtype(but->rnaprop); + + if(subtype & PROP_UNIT_LENGTH) { + return value * scene->unit.scale_length; + } + else if(subtype & PROP_UNIT_TIME) { /* WARNING - using evil_C :| */ + return FRA2TIME(value); + } + else { + return value; + } +} + +static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double value, int pad) +{ + Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); + int do_split= scene->unit.flag & USER_UNIT_OPT_SPLIT; + int unit_type= RNA_SUBTYPE_UNIT_VALUE(RNA_property_subtype(but->rnaprop)); + int precission= but->a2; + + if(scene->unit.scale_length<0.0001) scene->unit.scale_length= 1.0; // XXX do_versions + + /* Sanity checks */ + if(precission>4) precission= 4; + else if(precission==0) precission= 2; + + bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precission, scene->unit.system, unit_type, do_split, pad); +} + +static float ui_get_but_step_unit(uiBut *but, double value, float step_default) +{ + Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); + int unit_type= RNA_SUBTYPE_UNIT_VALUE(RNA_property_subtype(but->rnaprop)); + float step; + + step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, value), scene->unit.system, unit_type); + + if(step > 0.0) { /* -1 is an error value */ + return (step/ui_get_but_scale_unit(but, 1.0))*100; + } + else { + return step_default; + } +} + + void ui_get_but_string(uiBut *but, char *str, int maxlen) { if(but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) { @@ -1362,7 +1427,10 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen) value= ui_get_but_val(but); if(ui_is_but_float(but)) { - if(but->a2) { /* amount of digits defined */ + if(ui_is_but_unit(but)) { + ui_get_but_string_unit(but, str, maxlen, value, 0); + } + else if(but->a2) { /* amount of digits defined */ if(but->a2==1) BLI_snprintf(str, maxlen, "%.1f", value); else if(but->a2==2) BLI_snprintf(str, maxlen, "%.2f", value); else if(but->a2==3) BLI_snprintf(str, maxlen, "%.3f", value); @@ -1435,13 +1503,30 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) /* number editing */ double value; - /* XXX 2.50 missing python api */ #ifndef DISABLE_PYTHON - if(BPY_button_eval(C, str, &value)) { - value = ui_get_but_val(but); /* use its original value */ - - if(str[0]) - return 0; + { + char str_unit_convert[256]; + int unit_type; + Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); + + if(but->rnaprop) + unit_type= RNA_SUBTYPE_UNIT_VALUE(RNA_property_subtype(but->rnaprop)); + else + unit_type= 0; + + BLI_strncpy(str_unit_convert, str, sizeof(str_unit_convert)); + + if(scene->unit.system != USER_UNIT_NONE && unit_type) { + /* ugly, use the draw string to get the value, this could cause problems if it includes some text which resolves to a unit */ + bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr, ui_get_but_scale_unit(but, 1.0), scene->unit.system, unit_type); + } + + if(BPY_button_eval(C, str_unit_convert, &value)) { + value = ui_get_but_val(but); /* use its original value */ + + if(str[0]) + return 0; + } } #else value= atof(str); @@ -1787,6 +1872,12 @@ void ui_check_but(uiBut *but) if(ui_is_but_float(but)) { if(value == FLT_MAX) sprintf(but->drawstr, "%sinf", but->str); else if(value == -FLT_MAX) sprintf(but->drawstr, "%s-inf", but->str); + /* support length type buttons */ + else if(ui_is_but_unit(but)) { + char new_str[sizeof(but->drawstr)]; + ui_get_but_string_unit(but, new_str, sizeof(new_str), value, TRUE); + BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%s", but->str, new_str); + } else if(but->a2) { /* amount of digits defined */ if(but->a2==1) sprintf(but->drawstr, "%s%.1f", but->str, value); else if(but->a2==2) sprintf(but->drawstr, "%s%.2f", but->str, value); @@ -2326,6 +2417,10 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1, but->lockstr = ""; } + /* If this button uses units, calculate the step from this */ + if(ui_is_but_unit(but)) + but->a1= ui_get_but_step_unit(but, ui_get_but_val(but), but->a1); + if(freestr) MEM_freeN(str); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 6f438edc966..e3518b446ba 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -974,7 +974,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, char *str; opptr= uiButGetOperatorPtrRNA(but); /* allocated when needed, the button owns it */ - str= WM_operator_pystring(but->optype, opptr, 0); + str= WM_operator_pystring(C, but->optype, opptr, 0); WM_clipboard_text_set(str, 0); diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 04c0c417fdb..fbf95a4cde8 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -337,6 +337,7 @@ extern void ui_set_but_soft_range(uiBut *but, double value); extern void ui_check_but(uiBut *but); extern int ui_is_but_float(uiBut *but); +extern int ui_is_but_unit(uiBut *but); extern void ui_update_block_buts_hsv(uiBlock *block, float *hsv); extern void ui_bounds_block(uiBlock *block); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 60a043a1394..dee486b6b93 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -766,6 +766,8 @@ static void ui_item_rna_size(uiLayout *layout, char *name, int icon, PropertyRNA w += UI_UNIT_X; else if(type == PROP_ENUM) w += UI_UNIT_X/2; + else if(type == PROP_FLOAT || type == PROP_INT) + w += UI_UNIT_X*2; } *r_w= w; @@ -1971,6 +1973,11 @@ int uiLayoutGetAlignment(uiLayout *layout) return layout->alignment; } +int uiLayoutGetWidth(uiLayout *layout) +{ + return layout->w; +} + float uiLayoutGetScaleX(uiLayout *layout) { return layout->scale[0]; diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 846fbe75072..efff5b8f39c 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1247,7 +1247,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event) if(!pa || pa->paneltab!=NULL) continue; - if(pa->type && pa->type->flag & PNL_NO_HEADER) + if(pa->type && pa->type->flag & PNL_NO_HEADER) // XXX - accessed freed panels when scripts reload, need to fix. continue; if(block->minx <= mx && block->maxx >= mx) diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index b59db055647..bf921715524 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -396,7 +396,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) char *str; opptr= uiButGetOperatorPtrRNA(but); /* allocated when needed, the button owns it */ - str= WM_operator_pystring(but->optype, opptr, 0); + str= WM_operator_pystring(C, but->optype, opptr, 0); /* operator info */ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", str); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 0217e9646fa..1a5c1178983 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -236,7 +236,7 @@ static void template_ID(bContext *C, uiBlock *block, TemplateID *template, Struc int w= idptr.data?UI_UNIT_X:UI_UNIT_X*6; if(newop) { - but= uiDefIconTextButO(block, BUT, newop, WM_OP_EXEC_REGION_WIN, ICON_ZOOMIN, "Add New", 0, 0, w, UI_UNIT_Y, NULL); + but= uiDefIconTextButO(block, BUT, newop, WM_OP_INVOKE_REGION_WIN, ICON_ZOOMIN, "Add New", 0, 0, w, UI_UNIT_Y, NULL); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW)); } else { @@ -248,7 +248,7 @@ static void template_ID(bContext *C, uiBlock *block, TemplateID *template, Struc /* delete button */ if(idptr.data && (flag & UI_ID_DELETE)) { if(unlinkop) { - but= uiDefIconButO(block, BUT, unlinkop, WM_OP_EXEC_REGION_WIN, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL); + but= uiDefIconButO(block, BUT, unlinkop, WM_OP_INVOKE_REGION_WIN, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL); } else { but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); @@ -483,7 +483,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i if(md->type==eModifierType_ParticleSystem) { ParticleSystem *psys= ((ParticleSystemModifierData *)md)->psys; - if(!(G.f & G_PARTICLEEDIT)) + if(!(ob->mode & OB_MODE_PARTICLE_EDIT)) if(ELEM3(psys->part->ren_as, PART_DRAW_PATH, PART_DRAW_GR, PART_DRAW_OB) && psys->pathcache) uiItemO(row, "Convert", 0, "OBJECT_OT_modifier_convert"); } @@ -628,7 +628,7 @@ static void verify_constraint_name_func (bContext *C, void *con_v, void *name_v) /* some commonly used macros in the constraints drawing code */ #define is_armature_target(target) (target && target->type==OB_ARMATURE) -#define is_armature_owner(ob) ((ob->type == OB_ARMATURE) && (ob->flag & OB_POSEMODE)) +#define is_armature_owner(ob) ((ob->type == OB_ARMATURE) && (ob->mode & OB_MODE_POSE)) #define is_geom_target(target) (target && (ELEM(target->type, OB_MESH, OB_LATTICE)) ) /* Helper function for draw constraint - draws constraint space stuff @@ -1453,7 +1453,8 @@ ListBase uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, char *pr /* init numbers */ RNA_property_int_range(activeptr, activeprop, &min, &max); - len= max - min + 1; + if(prop) + len= RNA_property_collection_length(ptr, prop); items= CLAMPIS(len, rows, 5); pa->list_scroll= MIN2(pa->list_scroll, len-items); @@ -1579,7 +1580,7 @@ static void do_running_jobs(bContext *C, void *arg, int event) WM_jobs_stop(CTX_wm_manager(C), CTX_wm_screen(C)); break; case B_STOPANIM: - ED_screen_animation_timer(C, 0, 0); + WM_operator_name_call(C, "SCREEN_OT_animation_play", WM_OP_INVOKE_SCREEN, NULL); break; } } diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index f8578be1f33..4201850f5e4 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -152,8 +152,6 @@ void uiDefAutoButsRNA(const bContext *C, uiLayout *layout, PointerRNA *ptr, int uiLayout *split, *col; char *name; - uiItemL(layout, (char*)RNA_struct_ui_name(ptr->type), 0); - RNA_STRUCT_BEGIN(ptr, prop) { if(strcmp(RNA_property_identifier(prop), "rna_type") == 0) continue; diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index e32dd0e8ac7..17838d6042c 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -67,6 +67,7 @@ #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_object.h" +#include "BKE_paint.h" #include "BKE_pointcache.h" #include "BKE_softbody.h" #include "BKE_texture.h" @@ -873,11 +874,11 @@ void make_editMesh(Scene *scene, Object *ob) if(cacheedit) { if(pid.type == PTCACHE_TYPE_CLOTH) { - cloth= ((ClothModifierData*)pid.data)->clothObject; + cloth= ((ClothModifierData*)pid.calldata)->clothObject; VECCOPY(cacheco, cloth->verts[a].x) } else if(pid.type == PTCACHE_TYPE_SOFTBODY) { - sb= (SoftBody*)pid.data; + sb= (SoftBody*)pid.calldata; VECCOPY(cacheco, sb->bpoint[a].pos) } @@ -891,7 +892,7 @@ void make_editMesh(Scene *scene, Object *ob) evlist[a]= eve; // face select sets selection in next loop - if( (FACESEL_PAINT_TEST)==0 ) + if(!paint_facesel_test(ob)) eve->f |= (mvert->flag & 1); if (mvert->flag & ME_HIDE) eve->h= 1; @@ -966,7 +967,7 @@ void make_editMesh(Scene *scene, Object *ob) if(mface->flag & ME_FACE_SEL) { efa->f |= SELECT; - if(FACESEL_PAINT_TEST) { + if(paint_facesel_test(ob)) { EM_select_face(efa, 1); /* flush down */ } } @@ -1095,7 +1096,7 @@ void load_editMesh(Scene *scene, Object *ob) while(eve) { if(cacheedit) { if(pid.type == PTCACHE_TYPE_CLOTH) { - clmd= (ClothModifierData*)pid.data; + clmd= (ClothModifierData*)pid.calldata; cloth= clmd->clothObject; /* assign position */ @@ -1110,7 +1111,7 @@ void load_editMesh(Scene *scene, Object *ob) VECADD(cloth->verts[a].v, cloth->verts[a].v, cacheco); } else if(pid.type == PTCACHE_TYPE_SOFTBODY) { - sb= (SoftBody*)pid.data; + sb= (SoftBody*)pid.calldata; /* assign position */ VECCOPY(cacheco, sb->bpoint[a].pos) @@ -1156,12 +1157,8 @@ void load_editMesh(Scene *scene, Object *ob) } /* write changes to cache */ - if(cacheedit) { - if(pid.type == PTCACHE_TYPE_CLOTH) - cloth_write_cache(ob, pid.data, pid.cache->editframe); - else if(pid.type == PTCACHE_TYPE_SOFTBODY) - softbody_write_cache(ob, pid.data, pid.cache->editframe); - } + if(cacheedit) + BKE_ptcache_write_cache(&pid, pid.cache->editframe); /* the edges */ a= 0; @@ -1626,6 +1623,7 @@ void MESH_OT_separate(wmOperatorType *ot) { /* identifiers */ ot->name= "Separate"; + ot->description= "Separate selected geometry into a new mesh."; ot->idname= "MESH_OT_separate"; /* api callbacks */ diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 34eca8748bc..19078d2f6ff 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -227,6 +227,7 @@ void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot) { /* identifiers */ ot->name= "Duplicate or Extrude at 3D Cursor"; + ot->description= "Duplicate and extrude selected vertices, edges or faces towards 3D Cursor."; ot->idname= "MESH_OT_dupli_extrude_cursor"; /* api callbacks */ @@ -358,6 +359,7 @@ void MESH_OT_fgon_make(struct wmOperatorType *ot) { /* identifiers */ ot->name= "Make F-gon"; + ot->description= "Make fgon from selected faces."; ot->idname= "MESH_OT_fgon_make"; /* api callbacks */ @@ -390,6 +392,7 @@ void MESH_OT_fgon_clear(struct wmOperatorType *ot) { /* identifiers */ ot->name= "Clear F-gon"; + ot->description= "Clear fgon from selected face."; ot->idname= "MESH_OT_fgon_clear"; /* api callbacks */ @@ -801,6 +804,7 @@ void MESH_OT_edge_face_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Make Edge/Face"; + ot->description= "Add an edge or face to selected."; ot->idname= "MESH_OT_edge_face_add"; /* api callbacks */ @@ -1327,6 +1331,7 @@ void MESH_OT_primitive_plane_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Plane"; + ot->description= "Construct a filled planar mesh with 4 vertices."; ot->idname= "MESH_OT_primitive_plane_add"; /* api callbacks */ @@ -1359,6 +1364,7 @@ void MESH_OT_primitive_cube_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Cube"; + ot->description= "Construct a cube mesh."; ot->idname= "MESH_OT_primitive_cube_add"; /* api callbacks */ @@ -1391,6 +1397,7 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Circle"; + ot->description= "Construct a circle mesh."; ot->idname= "MESH_OT_primitive_circle_add"; /* api callbacks */ @@ -1428,6 +1435,7 @@ void MESH_OT_primitive_cylinder_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Cylinder"; + ot->description= "Construct a cylindrical mesh (ends filled)."; ot->idname= "MESH_OT_primitive_cylinder_add"; /* api callbacks */ @@ -1465,6 +1473,7 @@ void MESH_OT_primitive_tube_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Tube"; + ot->description= "Construct a cylindrical mesh (ends not filled)."; ot->idname= "MESH_OT_primitive_tube_add"; /* api callbacks */ @@ -1502,6 +1511,7 @@ void MESH_OT_primitive_cone_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Cone"; + ot->description= "Construct a conic mesh (ends filled)."; ot->idname= "MESH_OT_primitive_cone_add"; /* api callbacks */ @@ -1541,6 +1551,7 @@ void MESH_OT_primitive_grid_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Grid"; + ot->description= "Construct a grid mesh."; ot->idname= "MESH_OT_primitive_grid_add"; /* api callbacks */ @@ -1576,6 +1587,7 @@ void MESH_OT_primitive_monkey_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Monkey"; + ot->description= "Construct a Suzanne mesh."; ot->idname= "MESH_OT_primitive_monkey_add"; /* api callbacks */ @@ -1608,6 +1620,7 @@ void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add UV Sphere"; + ot->description= "Construct a UV sphere mesh."; ot->idname= "MESH_OT_primitive_uv_sphere_add"; /* api callbacks */ @@ -1645,6 +1658,7 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Ico Sphere"; + ot->description= "Construct an Icosphere mesh."; ot->idname= "MESH_OT_primitive_ico_sphere_add"; /* api callbacks */ @@ -1690,6 +1704,7 @@ void MESH_OT_duplicate(wmOperatorType *ot) { /* identifiers */ ot->name= "Duplicate"; + ot->description= "Duplicate selected vertices, edges or faces."; ot->idname= "MESH_OT_duplicate"; /* api callbacks */ diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c index 20fd33fc731..b46f745e8f5 100644 --- a/source/blender/editors/mesh/editmesh_loop.c +++ b/source/blender/editors/mesh/editmesh_loop.c @@ -717,6 +717,7 @@ void MESH_OT_knife_cut(wmOperatorType *ot) PropertyRNA *prop; ot->name= "Knife Cut"; + ot->description= "Cut selected edges and faces into parts."; ot->idname= "MESH_OT_knife_cut"; ot->invoke= WM_gesture_lines_invoke; diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 72ca97921ef..d27aa3f7e3a 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -65,6 +65,7 @@ editmesh_mods.c, UI level access, no geometry changes #include "BKE_global.h" #include "BKE_mesh.h" #include "BKE_material.h" +#include "BKE_paint.h" #include "BKE_texture.h" #include "BKE_utildefines.h" #include "BKE_report.h" @@ -242,7 +243,7 @@ int EM_mask_init_backbuf_border(ViewContext *vc, short mcords[][2], short tot, s /* method in use for face selecting too */ if(vc->obedit==NULL) { - if(FACESEL_PAINT_TEST); + if(paint_facesel_test(vc->obact)); else return 0; } else if(vc->v3d->drawtype<OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT)==0) return 0; @@ -297,7 +298,7 @@ int EM_init_backbuf_circle(ViewContext *vc, short xs, short ys, short rads) /* method in use for face selecting too */ if(vc->obedit==NULL) { - if(FACESEL_PAINT_TEST); + if(paint_facesel_test(vc->obact)); else return 0; } else if(vc->v3d->drawtype<OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT)==0) return 0; @@ -1271,6 +1272,7 @@ void MESH_OT_select_similar(wmOperatorType *ot) /* identifiers */ ot->name= "Select Similar"; + ot->description= "Select similar vertices, edges or faces by property types."; ot->idname= "MESH_OT_select_similar"; /* api callbacks */ @@ -1999,6 +2001,7 @@ void MESH_OT_loop_multi_select(wmOperatorType *ot) { /* identifiers */ ot->name= "Multi Select Loops"; + ot->description= "Select a loop of connected edges by connection type."; ot->idname= "MESH_OT_loop_multi_select"; /* api callbacks */ @@ -2077,6 +2080,7 @@ void MESH_OT_loop_select(wmOperatorType *ot) { /* identifiers */ ot->name= "Loop Select"; + ot->description= "Select a loop of connected edges."; ot->idname= "MESH_OT_loop_select"; /* api callbacks */ @@ -2176,6 +2180,7 @@ void MESH_OT_select_shortest_path(wmOperatorType *ot) { /* identifiers */ ot->name= "Shortest Path Select"; + ot->description= "Select shortest path between two selections."; ot->idname= "MESH_OT_select_shortest_path"; /* api callbacks */ @@ -2467,6 +2472,7 @@ void MESH_OT_select_linked_pick(wmOperatorType *ot) { /* identifiers */ ot->name= "Select Linked"; + ot->description= "(un)select all vertices linked to the active mesh."; ot->idname= "MESH_OT_select_linked_pick"; /* api callbacks */ @@ -2549,6 +2555,7 @@ void MESH_OT_select_linked(wmOperatorType *ot) { /* identifiers */ ot->name= "Select Linked All"; + ot->description= "Select all vertices linked to the active mesh."; ot->idname= "MESH_OT_select_linked"; /* api callbacks */ @@ -2684,6 +2691,7 @@ void MESH_OT_hide(wmOperatorType *ot) { /* identifiers */ ot->name= "Hide Selection"; + ot->description= "Hide (un)selected vertices, edges or faces."; ot->idname= "MESH_OT_hide"; /* api callbacks */ @@ -2750,6 +2758,7 @@ void MESH_OT_reveal(wmOperatorType *ot) { /* identifiers */ ot->name= "Reveal Hidden"; + ot->description= "Reveal all hidden vertices, edges and faces."; ot->idname= "MESH_OT_reveal"; /* api callbacks */ @@ -2804,6 +2813,7 @@ void MESH_OT_select_by_number_vertices(wmOperatorType *ot) /* identifiers */ ot->name= "Select by Number of Vertices"; + ot->description= "Select vertices or faces by vertex count."; ot->idname= "MESH_OT_select_by_number_vertices"; /* api callbacks */ @@ -2924,6 +2934,7 @@ void MESH_OT_edges_select_sharp(wmOperatorType *ot) { /* identifiers */ ot->name= "Select Sharp Edges"; + ot->description= "Marked selected edges as sharp."; ot->idname= "MESH_OT_edges_select_sharp"; /* api callbacks */ @@ -3091,6 +3102,7 @@ void MESH_OT_faces_select_linked_flat(wmOperatorType *ot) { /* identifiers */ ot->name= "Select Linked Flat Faces"; + ot->description= "Select linked faces by angle."; ot->idname= "MESH_OT_faces_select_linked_flat"; /* api callbacks */ @@ -3191,6 +3203,7 @@ void MESH_OT_select_non_manifold(wmOperatorType *ot) { /* identifiers */ ot->name= "Select Non Manifold"; + ot->description= "Select all non-manifold vertices or edges."; ot->idname= "MESH_OT_select_non_manifold"; /* api callbacks */ @@ -3254,6 +3267,7 @@ void MESH_OT_select_inverse(wmOperatorType *ot) { /* identifiers */ ot->name= "Select Inverse"; + ot->description= "Select inverse of (un)selected vertices, edges or faces."; ot->idname= "MESH_OT_select_inverse"; /* api callbacks */ @@ -3291,6 +3305,7 @@ void MESH_OT_select_all_toggle(wmOperatorType *ot) { /* identifiers */ ot->name= "Select/Deselect All"; + ot->description= "(de)select all vertices, edges or faces."; ot->idname= "MESH_OT_select_all_toggle"; /* api callbacks */ @@ -3361,6 +3376,7 @@ void MESH_OT_select_more(wmOperatorType *ot) { /* identifiers */ ot->name= "Select More"; + ot->description= "Select more vertices, edges or faces connected to initial selection."; ot->idname= "MESH_OT_select_more"; /* api callbacks */ @@ -3450,6 +3466,7 @@ void MESH_OT_select_less(wmOperatorType *ot) { /* identifiers */ ot->name= "Select Less"; + ot->description= "Select less vertices, edges or faces connected to initial selection."; ot->idname= "MESH_OT_select_less"; /* api callbacks */ @@ -3519,6 +3536,7 @@ void MESH_OT_select_random(wmOperatorType *ot) { /* identifiers */ ot->name= "Select Random"; + ot->description= "Randomly select vertices."; ot->idname= "MESH_OT_select_random"; /* api callbacks */ @@ -3610,6 +3628,7 @@ void MESH_OT_selection_type(wmOperatorType *ot) { /* identifiers */ ot->name= "Selection Mode"; + ot->description= "Set the selection mode type."; ot->idname= "MESH_OT_selection_type"; /* api callbacks */ @@ -3672,6 +3691,7 @@ void MESH_OT_mark_seam(wmOperatorType *ot) { /* identifiers */ ot->name= "Mark Seam"; + ot->description= "(un)mark selected edges as a seam."; ot->idname= "MESH_OT_mark_seam"; /* api callbacks */ @@ -3724,6 +3744,7 @@ void MESH_OT_mark_sharp(wmOperatorType *ot) { /* identifiers */ ot->name= "Mark Sharp"; + ot->description= "(un)mark selected edges as sharp."; ot->idname= "MESH_OT_mark_sharp"; /* api callbacks */ @@ -3973,6 +3994,7 @@ void MESH_OT_normals_make_consistent(wmOperatorType *ot) { /* identifiers */ ot->name= "Make Normals Consistent"; + ot->description= "Flip all selected vertex and face normals in a consistent direction."; ot->idname= "MESH_OT_normals_make_consistent"; /* api callbacks */ @@ -4309,12 +4331,15 @@ static int smooth_vertex_exec(bContext *C, wmOperator *op) for (i=0; i<repeat; i++) { smooth_vertex(C, op); } + + return OPERATOR_FINISHED; } void MESH_OT_vertices_smooth(wmOperatorType *ot) { /* identifiers */ ot->name= "Smooth Vertex"; + ot->description= "Flatten angles of selected vertices."; ot->idname= "MESH_OT_vertices_smooth"; /* api callbacks */ @@ -4450,6 +4475,7 @@ void MESH_OT_vertices_transform_to_sphere(wmOperatorType *ot) { /* identifiers */ ot->name= "Vertices to Sphere"; + ot->description= "Move selected vertices outward in a spherical shape."; ot->idname= "MESH_OT_vertices_transform_to_sphere"; /* api callbacks */ @@ -4513,6 +4539,7 @@ void MESH_OT_flip_normals(wmOperatorType *ot) { /* identifiers */ ot->name= "Flip Normals"; + ot->description= "Toggle the direction of selected face's vertex and face normals."; ot->idname= "MESH_OT_flip_normals"; /* api callbacks */ diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index d29a4e21913..ac65820bfea 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -507,6 +507,7 @@ void MESH_OT_remove_doubles(wmOperatorType *ot) { /* identifiers */ ot->name= "Remove Doubles"; + ot->description= "Remove duplicate vertices."; ot->idname= "MESH_OT_remove_doubles"; /* api callbacks */ @@ -747,6 +748,7 @@ void MESH_OT_extrude(wmOperatorType *ot) { /* identifiers */ ot->name= "Extrude"; + ot->description= "Extrude selected vertices, edges or faces."; ot->idname= "MESH_OT_extrude"; /* api callbacks */ @@ -756,11 +758,6 @@ void MESH_OT_extrude(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - - /* to give to transform */ - Properties_Proportional(ot); - Properties_Constraints(ot); - RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", ""); } static int split_mesh(bContext *C, wmOperator *op) @@ -790,6 +787,7 @@ void MESH_OT_split(wmOperatorType *ot) { /* identifiers */ ot->name= "Split"; + ot->description= "Split selected geometry into separate disconnected mesh."; ot->idname= "MESH_OT_split"; /* api callbacks */ @@ -850,6 +848,7 @@ void MESH_OT_extrude_repeat(wmOperatorType *ot) { /* identifiers */ ot->name= "Extrude Repeat Mesh"; + ot->description= "Extrude selected vertices, edges or faces repeatedly."; ot->idname= "MESH_OT_extrude_repeat"; /* api callbacks */ @@ -984,6 +983,7 @@ void MESH_OT_spin(wmOperatorType *ot) { /* identifiers */ ot->name= "Spin"; + ot->description= "Extrude selected vertices in a circle around the cursor in indicated viewport."; ot->idname= "MESH_OT_spin"; /* api callbacks */ @@ -1092,6 +1092,7 @@ void MESH_OT_screw(wmOperatorType *ot) { /* identifiers */ ot->name= "Screw"; + ot->description= "Extrude selected vertices in screw-shaped rotation around the cursor in indicated viewport."; ot->idname= "MESH_OT_screw"; /* api callbacks */ @@ -1324,6 +1325,7 @@ void MESH_OT_delete(wmOperatorType *ot) { /* identifiers */ ot->name= "Delete"; + ot->description= "Delete selected vertices, edges or faces."; ot->idname= "MESH_OT_delete"; /* api callbacks */ @@ -3768,6 +3770,7 @@ void MESH_OT_edge_rotate(wmOperatorType *ot) { /* identifiers */ ot->name= "Rotate Selected Edge"; + ot->description= "Rotate selected edge or adjoining faces."; ot->idname= "MESH_OT_edge_rotate"; /* api callbacks */ @@ -5002,6 +5005,7 @@ void MESH_OT_rip(wmOperatorType *ot) { /* identifiers */ ot->name= "Rip"; + ot->description= "Rip selection from mesh (quads only)."; ot->idname= "MESH_OT_rip"; /* api callbacks */ @@ -5848,6 +5852,7 @@ void MESH_OT_merge(wmOperatorType *ot) /* identifiers */ ot->name= "Merge"; + ot->description= "Merge selected vertices."; ot->idname= "MESH_OT_merge"; /* api callbacks */ @@ -6050,6 +6055,7 @@ void MESH_OT_select_vertex_path(wmOperatorType *ot) /* identifiers */ ot->name= "Select Vertex Path"; + ot->description= "Select shortest path between two vertices by distance type."; ot->idname= "MESH_OT_select_vertex_path"; /* api callbacks */ @@ -6111,6 +6117,7 @@ void MESH_OT_region_to_loop(wmOperatorType *ot) { /* identifiers */ ot->name= "Region to Loop"; + ot->description= "Select a region as a loop of connected edges."; ot->idname= "MESH_OT_region_to_loop"; /* api callbacks */ @@ -6286,6 +6293,7 @@ void MESH_OT_loop_to_region(wmOperatorType *ot) { /* identifiers */ ot->name= "Loop to Region"; + ot->description= "Select a loop of connected edges as a region."; ot->idname= "MESH_OT_loop_to_region"; /* api callbacks */ @@ -6584,6 +6592,7 @@ void MESH_OT_uvs_rotate(wmOperatorType *ot) { /* identifiers */ ot->name= "Rotate UVs"; + ot->description= "Rotate selected UVs."; ot->idname= "MESH_OT_uvs_rotate"; /* api callbacks */ @@ -6601,6 +6610,7 @@ void MESH_OT_uvs_mirror(wmOperatorType *ot) { /* identifiers */ ot->name= "Mirror UVs"; + ot->description= "Mirror selected UVs."; ot->idname= "MESH_OT_uvs_mirror"; /* api callbacks */ @@ -6618,6 +6628,7 @@ void MESH_OT_colors_rotate(wmOperatorType *ot) { /* identifiers */ ot->name= "Rotate Colors"; + ot->description= "Rotate UV/image color layer."; ot->idname= "MESH_OT_colors_rotate"; /* api callbacks */ @@ -6635,6 +6646,7 @@ void MESH_OT_colors_mirror(wmOperatorType *ot) { /* identifiers */ ot->name= "Mirror Colors"; + ot->description= "Mirror UV/image color layer."; ot->idname= "MESH_OT_colors_mirror"; /* api callbacks */ @@ -6668,7 +6680,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) esubdivideflag(obedit, em, 1, smooth, fractal, scene->toolsettings->editbutflag|flag, cuts, 0); DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); return OPERATOR_FINISHED; } @@ -6677,6 +6689,7 @@ void MESH_OT_subdivide(wmOperatorType *ot) { /* identifiers */ ot->name= "Subdivide"; + ot->description= "Subdivide selected edges."; ot->idname= "MESH_OT_subdivide"; /* api callbacks */ @@ -6959,6 +6972,7 @@ void MESH_OT_fill(wmOperatorType *ot) { /* identifiers */ ot->name= "Fill"; + ot->description= "Create a segment, edge or face."; ot->idname= "MESH_OT_fill"; /* api callbacks */ @@ -6989,6 +7003,7 @@ void MESH_OT_beauty_fill(wmOperatorType *ot) { /* identifiers */ ot->name= "Beauty Fill"; + ot->description= "Arrange geometry on a selected surface to avoid skinny faces."; ot->idname= "MESH_OT_beauty_fill"; /* api callbacks */ @@ -7020,6 +7035,7 @@ void MESH_OT_quads_convert_to_tris(wmOperatorType *ot) { /* identifiers */ ot->name= "Quads to Tris"; + ot->description= "Convert selected quads to triangles."; ot->idname= "MESH_OT_quads_convert_to_tris"; /* api callbacks */ @@ -7049,6 +7065,7 @@ void MESH_OT_tris_convert_to_quads(wmOperatorType *ot) { /* identifiers */ ot->name= "Tris to Quads"; + ot->description= "Convert selected triangles to quads."; ot->idname= "MESH_OT_tris_convert_to_quads"; /* api callbacks */ @@ -7078,6 +7095,7 @@ void MESH_OT_edge_flip(wmOperatorType *ot) { /* identifiers */ ot->name= "Edge Flip"; + ot->description= "Flip selected edge or adjoining faces."; ot->idname= "MESH_OT_edge_flip"; /* api callbacks */ @@ -7124,6 +7142,7 @@ void MESH_OT_faces_shade_smooth(wmOperatorType *ot) { /* identifiers */ ot->name= "Shade Smooth"; + ot->description= "Display faces 'smooth' (using vertex normals)."; ot->idname= "MESH_OT_faces_shade_smooth"; /* api callbacks */ @@ -7152,6 +7171,7 @@ void MESH_OT_faces_shade_flat(wmOperatorType *ot) { /* identifiers */ ot->name= "Shade Flat"; + ot->description= "Display faces 'flat'."; ot->idname= "MESH_OT_faces_shade_flat"; /* api callbacks */ diff --git a/source/blender/editors/mesh/mesh_layers.c b/source/blender/editors/mesh/mesh_layers.c index 99d50d1a9b0..17a448ecf90 100644 --- a/source/blender/editors/mesh/mesh_layers.c +++ b/source/blender/editors/mesh/mesh_layers.c @@ -54,12 +54,14 @@ #include "WM_types.h" #include "ED_mesh.h" +#include "ED_object.h" #include "ED_view3d.h" #include "mesh_intern.h" -static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer) +static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *layer) { + Mesh *me = ob->data; CustomData *data= (me->edit_mesh)? &me->edit_mesh->fdata: &me->fdata; void *actlayerdata, *rndlayerdata, *clonelayerdata, *masklayerdata, *layerdata=layer->data; int type= layer->type; @@ -87,9 +89,8 @@ static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer) mesh_update_customdata_pointers(me); } - if(!CustomData_has_layer(data, type)) - if(type == CD_MCOL && (G.f & G_VERTEXPAINT)) - G.f &= ~G_VERTEXPAINT; /* get out of vertexpaint mode */ + if(!CustomData_has_layer(data, type) && (type == CD_MCOL && (ob->mode & OB_MODE_VERTEX_PAINT))) + ED_object_toggle_modes(C, OB_MODE_VERTEX_PAINT); /* reconstruct active layer */ if (actlayerdata != layerdata) { @@ -198,6 +199,7 @@ void MESH_OT_uv_texture_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add UV Texture"; + ot->description= "Add UV texture layer."; ot->idname= "MESH_OT_uv_texture_add"; /* api callbacks */ @@ -225,7 +227,7 @@ static int uv_texture_remove_exec(bContext *C, wmOperator *op) if(!cdl) return OPERATOR_CANCELLED; - delete_customdata_layer(me, cdl); + delete_customdata_layer(C, ob, cdl); DAG_object_flush_update(scene, ob, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob); @@ -237,6 +239,7 @@ void MESH_OT_uv_texture_remove(wmOperatorType *ot) { /* identifiers */ ot->name= "Remove UV Texture"; + ot->description= "Remove UV texture layer."; ot->idname= "MESH_OT_uv_texture_remove"; /* api callbacks */ @@ -301,6 +304,7 @@ void MESH_OT_vertex_color_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Vertex Color"; + ot->description= "Add vertex color layer."; ot->idname= "MESH_OT_vertex_color_add"; /* api callbacks */ @@ -328,7 +332,7 @@ static int vertex_color_remove_exec(bContext *C, wmOperator *op) if(!cdl) return OPERATOR_CANCELLED; - delete_customdata_layer(me, cdl); + delete_customdata_layer(C, ob, cdl); DAG_object_flush_update(scene, ob, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob); @@ -340,6 +344,7 @@ void MESH_OT_vertex_color_remove(wmOperatorType *ot) { /* identifiers */ ot->name= "Remove Vertex Color"; + ot->description= "Remove vertex color layer."; ot->idname= "MESH_OT_vertex_color_remove"; /* api callbacks */ @@ -377,6 +382,7 @@ void MESH_OT_sticky_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Sticky"; + ot->description= "Add sticky UV texture layer."; ot->idname= "MESH_OT_sticky_add"; /* api callbacks */ @@ -413,6 +419,7 @@ void MESH_OT_sticky_remove(wmOperatorType *ot) { /* identifiers */ ot->name= "Remove Sticky"; + ot->description= "Remove sticky UV texture layer."; ot->idname= "MESH_OT_sticky_remove"; /* api callbacks */ diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index edb131d7da2..c545f7d70d6 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -90,6 +90,7 @@ static void MESH_OT_vertex_specials(wmOperatorType *ot) { /* identifiers */ ot->name= "Vertex Specials"; + //ot->description= "Perform special vertex operations."; ot->idname= "MESH_OT_vertex_specials"; /* api callbacks */ @@ -128,6 +129,7 @@ static void MESH_OT_edge_specials(wmOperatorType *ot) { /* identifiers */ ot->name= "Edge Specials"; + //ot->description= "Perform special edge operations."; ot->idname= "MESH_OT_edge_specials"; /* api callbacks */ @@ -178,6 +180,7 @@ static void MESH_OT_face_specials(wmOperatorType *ot) { /* identifiers */ ot->name= "Face Specials"; + //ot->description= "Perform special face operations."; ot->idname= "MESH_OT_face_specials"; /* api callbacks */ @@ -219,6 +222,7 @@ static void MESH_OT_specials(wmOperatorType *ot) { /* identifiers */ ot->name= "Specials"; + //ot->description= "Perform special vertice, edge or face operations."; ot->idname= "MESH_OT_specials"; /* api callbacks */ diff --git a/source/blender/editors/object/editconstraint.c b/source/blender/editors/object/editconstraint.c index 9e8205e58ab..23b3caf8e26 100644 --- a/source/blender/editors/object/editconstraint.c +++ b/source/blender/editors/object/editconstraint.c @@ -87,7 +87,7 @@ ListBase *get_active_constraints (Object *ob) if (ob == NULL) return NULL; - if (ob->flag & OB_POSEMODE) { + if (ob->mode & OB_MODE_POSE) { bPoseChannel *pchan; pchan = get_active_posechannel(ob); @@ -1065,7 +1065,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase { /* if this constraint is being added to a posechannel, make sure * the constraint gets evaluated in pose-space */ - if (ob->flag & OB_POSEMODE) { + if (ob->mode & OB_MODE_POSE) { con->ownspace = CONSTRAINT_SPACE_POSE; con->flag |= CONSTRAINT_SPACEONCE; } diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index a6bd38752ae..d4f2493be2b 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -98,6 +98,7 @@ #include "BKE_mesh.h" #include "BKE_nla.h" #include "BKE_object.h" +#include "BKE_paint.h" #include "BKE_particle.h" #include "BKE_property.h" #include "BKE_report.h" @@ -126,6 +127,7 @@ #include "RNA_access.h" #include "RNA_define.h" +#include "RNA_enum_types.h" /* for menu/popup icons etc etc*/ #include "UI_interface.h" @@ -177,10 +179,6 @@ void ED_base_object_activate(bContext *C, Base *base) Scene *scene= CTX_data_scene(C); Base *tbase; - /* activating a non-mesh, should end a couple of modes... */ - if(base && base->object->type!=OB_MESH) - ED_view3d_exit_paint_modes(C); - /* sets scene->basact */ BASACT= base; @@ -272,9 +270,6 @@ static Object *object_add_type(bContext *C, int type) Scene *scene= CTX_data_scene(C); Object *ob; - /* XXX hrms, this is editor level operator, remove? */ - ED_view3d_exit_paint_modes(C); - /* for as long scene has editmode... */ if (CTX_data_edit_object(C)) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* freedata, and undo */ @@ -751,8 +746,6 @@ static int object_delete_exec(bContext *C, wmOperator *op) if(CTX_data_edit_object(C)) return OPERATOR_CANCELLED; - ED_view3d_exit_paint_modes(C); - CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { if(base->object->type==OB_LAMP) islamp= 1; @@ -2246,7 +2239,7 @@ static int object_location_clear_exec(bContext *C, wmOperator *op) int armature_clear= 0; CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { - if((G.f & G_WEIGHTPAINT)==0) { + if(!(ob->mode & OB_MODE_WEIGHT_PAINT)) { if ((ob->protectflag & OB_LOCK_LOCX)==0) ob->loc[0]= ob->dloc[0]= 0.0f; if ((ob->protectflag & OB_LOCK_LOCY)==0) @@ -2289,7 +2282,7 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op) int armature_clear= 0; CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { - if((G.f & G_WEIGHTPAINT)==0) { + if(!(ob->mode & OB_MODE_WEIGHT_PAINT)) { /* eulers can only get cleared if they are not protected */ if ((ob->protectflag & OB_LOCK_ROTX)==0) ob->rot[0]= ob->drot[0]= 0.0f; @@ -2333,7 +2326,7 @@ static int object_scale_clear_exec(bContext *C, wmOperator *op) int armature_clear= 0; CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { - if((G.f & G_WEIGHTPAINT)==0) { + if(!(ob->mode & OB_MODE_WEIGHT_PAINT)) { if ((ob->protectflag & OB_LOCK_SCALEX)==0) { ob->dsize[0]= 0.0f; ob->size[0]= 1.0f; @@ -3700,7 +3693,7 @@ void ED_object_exit_editmode(bContext *C, int flag) me->edit_mesh= NULL; } - if(G.f & G_WEIGHTPAINT) + if(obedit->restore_mode & OB_MODE_WEIGHT_PAINT) mesh_octree_table(obedit, NULL, NULL, 'e'); } else if (obedit->type==OB_ARMATURE) { @@ -3724,7 +3717,7 @@ void ED_object_exit_editmode(bContext *C, int flag) load_editMball(obedit); if(freedata) free_editMball(obedit); } - + /* freedata only 0 now on file saves */ if(freedata) { /* for example; displist make is different in editmode */ @@ -3739,6 +3732,9 @@ void ED_object_exit_editmode(bContext *C, int flag) WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene); } + + obedit->mode &= ~OB_MODE_EDIT; + ED_object_toggle_modes(C, obedit->restore_mode); } @@ -3772,7 +3768,10 @@ void ED_object_enter_editmode(bContext *C, int flag) if(flag & EM_WAITCURSOR) waitcursor(1); - ED_view3d_exit_paint_modes(C); + ob->restore_mode = ob->mode; + ED_object_toggle_modes(C, ob->mode); + + ob->mode |= OB_MODE_EDIT; if(ob->type==OB_MESH) { Mesh *me= ob->data; @@ -3888,7 +3887,7 @@ static int posemode_exec(bContext *C, wmOperator *op) ED_object_exit_editmode(C, EM_FREEDATA); ED_armature_enter_posemode(C, base); } - else if(base->object->flag & OB_POSEMODE) + else if(base->object->mode & OB_MODE_POSE) ED_armature_exit_posemode(C, base); else ED_armature_enter_posemode(C, base); @@ -4111,10 +4110,10 @@ void special_editmenu(Scene *scene, View3D *v3d) if(obedit==NULL) { - if(ob->flag & OB_POSEMODE) { + if(ob->mode & OB_MODE_POSE) { // XXX pose_special_editmenu(); } - else if(FACESEL_PAINT_TEST) { + else if(paint_facesel_test(ob)) { Mesh *me= get_mesh(ob); MTFace *tface; MFace *mface; @@ -4160,7 +4159,7 @@ void special_editmenu(Scene *scene, View3D *v3d) } DAG_object_flush_update(scene, ob, OB_RECALC_DATA); } - else if(G.f & G_VERTEXPAINT) { + else if(ob->mode & OB_MODE_VERTEX_PAINT) { Mesh *me= get_mesh(ob); if(me==0 || (me->mcol==NULL && me->mtface==NULL) ) return; @@ -4173,17 +4172,17 @@ void special_editmenu(Scene *scene, View3D *v3d) DAG_object_flush_update(scene, ob, OB_RECALC_DATA); } } - else if(G.f & G_WEIGHTPAINT) { + else if(ob->mode & OB_MODE_WEIGHT_PAINT) { Object *par= modifiers_isDeformedByArmature(ob); - if(par && (par->flag & OB_POSEMODE)) { + if(par && (par->mode & OB_MODE_POSE)) { nr= pupmenu("Specials%t|Apply Bone Envelopes to Vertex Groups %x1|Apply Bone Heat Weights to Vertex Groups %x2"); // XXX if(nr==1 || nr==2) // XXX pose_adds_vgroups(ob, (nr == 2)); } } - else if(G.f & G_PARTICLEEDIT) { + else if(ob->mode & OB_MODE_PARTICLE_EDIT) { #if 0 // XXX ParticleSystem *psys = PE_get_current(ob); @@ -5725,7 +5724,7 @@ void new_id_matar(Material **matar, int totcol) } } -void single_obdata_users(Scene *scene, View3D *v3d, int flag) +void single_obdata_users(Scene *scene, int flag) { Object *ob; Lamp *la; @@ -5848,7 +5847,7 @@ void single_obdata_users(Scene *scene, View3D *v3d, int flag) } } -void single_ipo_users(Scene *scene, View3D *v3d, int flag) +void single_ipo_users(Scene *scene, int flag) { #if 0 // XXX old animation system Object *ob; @@ -5871,7 +5870,7 @@ void single_ipo_users(Scene *scene, View3D *v3d, int flag) #endif // XXX old animation system } -void single_mat_users(Scene *scene, View3D *v3d, int flag) +void single_mat_users(Scene *scene, int flag) { Object *ob; Base *base; @@ -6057,19 +6056,19 @@ void single_user(Scene *scene, View3D *v3d) else if(nr==2) { single_object_users(scene, v3d, 1); - single_obdata_users(scene, v3d, 1); + single_obdata_users(scene, 1); } else if(nr==3) { single_object_users(scene, v3d, 1); - single_obdata_users(scene, v3d, 1); - single_mat_users(scene, v3d, 1); /* also tex */ + single_obdata_users(scene, 1); + single_mat_users(scene, 1); /* also tex */ } else if(nr==4) { - single_mat_users(scene, v3d, 1); + single_mat_users(scene, 1); } else if(nr==5) { - single_ipo_users(scene, v3d, 1); + single_ipo_users(scene, 1); } @@ -6078,6 +6077,20 @@ void single_user(Scene *scene, View3D *v3d) } } +/* used for copying scenes */ +void ED_object_single_users(Scene *scene, int full) +{ + single_object_users(scene, NULL, 0); + + if(full) { + single_obdata_users(scene, 0); + single_mat_users_expand(); + single_tex_users_expand(); + } + + clear_id_newpoins(); +} + /* ************************************************************* */ /* helper for below, ma was checked to be not NULL */ @@ -6282,7 +6295,7 @@ static Base *object_add_duplicate_internal(Scene *scene, Base *base, int dupflag int a, didit; ob= base->object; - if(ob->flag & OB_POSEMODE) { + if(ob->mode & OB_MODE_POSE) { ; /* nothing? */ } else { @@ -7018,3 +7031,97 @@ void hookmenu(Scene *scene, View3D *v3d) if (changed) { } } + +static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *ptr, int *free) +{ + EnumPropertyItem *input = object_mode_items; + EnumPropertyItem *item= NULL; + Object *ob; + int totitem= 0; + + if(!C) /* needed for docs */ + return object_mode_items; + + ob = CTX_data_active_object(C); + while(ob && input->identifier) { + if((input->value == OB_MODE_EDIT && ((ob->type == OB_MESH) || (ob->type == OB_ARMATURE) || + (ob->type == OB_CURVE) || (ob->type == OB_SURF) || + (ob->type == OB_FONT) || (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) || + (input->value == OB_MODE_POSE && (ob->type == OB_ARMATURE)) || + (input->value == OB_MODE_PARTICLE_EDIT && ob->particlesystem.first) || + ((input->value == OB_MODE_SCULPT || input->value == OB_MODE_VERTEX_PAINT || + input->value == OB_MODE_WEIGHT_PAINT || input->value == OB_MODE_TEXTURE_PAINT) && (ob->type == OB_MESH)) || + (input->value == OB_MODE_OBJECT)) + RNA_enum_item_add(&item, &totitem, input); + ++input; + } + + RNA_enum_item_end(&item, &totitem); + + *free= 1; + + return item; +} + +static int object_mode_set_exec(bContext *C, wmOperator *op) +{ + Object *ob= CTX_data_active_object(C); + int mode = RNA_enum_get(op->ptr, "mode"); + + if(!ob) + return OPERATOR_CANCELLED; + + if((mode == OB_MODE_EDIT) == !(ob->mode & OB_MODE_EDIT)) + WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_EXEC_REGION_WIN, NULL); + if((mode == OB_MODE_SCULPT) == !(ob->mode & OB_MODE_SCULPT)) + WM_operator_name_call(C, "SCULPT_OT_sculptmode_toggle", WM_OP_EXEC_REGION_WIN, NULL); + if((mode == OB_MODE_VERTEX_PAINT) == !(ob->mode & OB_MODE_VERTEX_PAINT)) + WM_operator_name_call(C, "PAINT_OT_vertex_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL); + if((mode == OB_MODE_WEIGHT_PAINT) == !(ob->mode & OB_MODE_WEIGHT_PAINT)) + WM_operator_name_call(C, "PAINT_OT_weight_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL); + if((mode == OB_MODE_TEXTURE_PAINT) == !(ob->mode & OB_MODE_TEXTURE_PAINT)) + WM_operator_name_call(C, "PAINT_OT_texture_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL); + if((mode == OB_MODE_PARTICLE_EDIT) == !(ob->mode & OB_MODE_PARTICLE_EDIT)) + WM_operator_name_call(C, "PARTICLE_OT_particle_edit_toggle", WM_OP_EXEC_REGION_WIN, NULL); + if((mode == OB_MODE_POSE) == !(ob->mode & OB_MODE_POSE)) + WM_operator_name_call(C, "OBJECT_OT_posemode_toggle", WM_OP_EXEC_REGION_WIN, NULL); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_mode_set(wmOperatorType *ot) +{ + PropertyRNA *prop; + + /* identifiers */ + ot->name= "Set Object Mode"; + ot->description = "Sets the object interaction mode."; + ot->idname= "OBJECT_OT_mode_set"; + + /* api callbacks */ + ot->exec= object_mode_set_exec; + + ot->poll= ED_operator_object_active; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + prop= RNA_def_enum(ot->srna, "mode", object_mode_items, 0, "Mode", ""); + RNA_def_enum_funcs(prop, object_mode_set_itemsf); +} + + + +void ED_object_toggle_modes(bContext *C, int mode) +{ + if(mode & OB_MODE_SCULPT) + WM_operator_name_call(C, "SCULPT_OT_sculptmode_toggle", WM_OP_EXEC_REGION_WIN, NULL); + if(mode & OB_MODE_VERTEX_PAINT) + WM_operator_name_call(C, "PAINT_OT_vertex_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL); + if(mode & OB_MODE_WEIGHT_PAINT) + WM_operator_name_call(C, "PAINT_OT_weight_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL); + if(mode & OB_MODE_TEXTURE_PAINT) + WM_operator_name_call(C, "PAINT_OT_texture_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL); + if(mode & OB_MODE_PARTICLE_EDIT) + WM_operator_name_call(C, "PARTICLE_OT_particle_edit_toggle", WM_OP_EXEC_REGION_WIN, NULL); +} diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 17d4f5deaae..e47087a3c27 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -39,6 +39,7 @@ struct Mesh; /* object_edit.c */ +void OBJECT_OT_mode_set(struct wmOperatorType *ot); void OBJECT_OT_editmode_toggle(struct wmOperatorType *ot); void OBJECT_OT_posemode_toggle(struct wmOperatorType *ot); void OBJECT_OT_parent_set(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 6b9f2db0d96..9983e24f2c9 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -226,7 +226,7 @@ int ED_object_modifier_convert(ReportList *reports, Scene *scene, Object *ob, Mo int totpart=0, totchild=0; if(md->type != eModifierType_ParticleSystem) return 0; - if(G.f & G_PARTICLEEDIT) return 0; + if(ob && ob->mode & OB_MODE_PARTICLE_EDIT) return 0; psys=((ParticleSystemModifierData *)md)->psys; part= psys->part; @@ -640,14 +640,19 @@ static int multires_subdivide_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } +static int multires_subdivide_poll(bContext *C) +{ + return NULL != CTX_data_active_object(C) && NULL == CTX_data_edit_object(C); +} + void OBJECT_OT_multires_subdivide(wmOperatorType *ot) { ot->name= "Multires Subdivide"; ot->description= "Add a new level of subdivision."; ot->idname= "OBJECT_OT_multires_subdivide"; - ot->poll= ED_operator_object_active; ot->exec= multires_subdivide_exec; + ot->poll= multires_subdivide_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index c1509e78502..f2e048284f4 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -65,6 +65,7 @@ void ED_operatortypes_object(void) { wmOperatorType *ot; + WM_operatortype_append(OBJECT_OT_mode_set); WM_operatortype_append(OBJECT_OT_editmode_toggle); WM_operatortype_append(OBJECT_OT_posemode_toggle); WM_operatortype_append(OBJECT_OT_parent_set); diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 3d3e29bcc22..154ab14df60 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -57,6 +57,7 @@ #include "BKE_global.h" #include "BKE_lattice.h" #include "BKE_mesh.h" +#include "BKE_paint.h" #include "BKE_utildefines.h" #include "RNA_access.h" @@ -1028,11 +1029,11 @@ void vgroup_assign_with_menu(Scene *scene, Object *ob) switch (mode) { case 1: /* add to new group */ add_defgroup(ob); - assign_verts_defgroup(ob, wp->brush->alpha); + assign_verts_defgroup(ob, paint_brush(&wp->paint)->alpha); BIF_undo_push("Assign to vertex group"); break; case 2: /* add to current group */ - assign_verts_defgroup(ob, wp->brush->alpha); + assign_verts_defgroup(ob, paint_brush(&wp->paint)->alpha); BIF_undo_push("Assign to vertex group"); break; case 3: /* remove from current group */ diff --git a/source/blender/editors/physics/ed_pointcache.c b/source/blender/editors/physics/ed_pointcache.c index 5d0a6d21fac..917e2b40d72 100644 --- a/source/blender/editors/physics/ed_pointcache.c +++ b/source/blender/editors/physics/ed_pointcache.c @@ -61,7 +61,6 @@ static int cache_break_test(void *cbd) { return G.afbreek==1; } -/**************************** general **********************************/ static int ptcache_bake_all_poll(bContext *C) { Scene *scene= CTX_data_scene(C); @@ -130,7 +129,7 @@ void PTCACHE_OT_bake_all(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_boolean(ot->srna, "bake", 0, "Bake", ""); + RNA_def_boolean(ot->srna, "bake", 1, "Bake", ""); } void PTCACHE_OT_free_bake_all(wmOperatorType *ot) { @@ -145,32 +144,25 @@ void PTCACHE_OT_free_bake_all(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } - -/**************************** softbody **********************************/ -static int ptcache_bake_softbody_poll(bContext *C) -{ - Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); - SoftBody *sb = ob->soft; - - if(!scene || !ob || ob->id.lib || !sb) - return 0; - - return 1; -} - -static int ptcache_bake_softbody_exec(bContext *C, wmOperator *op) +static int ptcache_bake_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); - SoftBody *sb = ob->soft; - PTCacheID pid; + Scene *scene = CTX_data_scene(C); + PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache); + Object *ob= ptr.id.data; + PointCache *cache= ptr.data; PTCacheBaker baker; + PTCacheID *pid; + ListBase pidlist; - BKE_ptcache_id_from_softbody(&pid, ob, sb); + BKE_ptcache_ids_from_object(&pidlist, ob); + + for(pid=pidlist.first; pid; pid=pid->next) { + if(pid->cache == cache) + break; + } baker.scene = scene; - baker.pid = &pid; + baker.pid = pid; baker.bake = RNA_boolean_get(op->ptr, "bake"); baker.render = 0; baker.anim_init = 0; @@ -182,305 +174,160 @@ static int ptcache_bake_softbody_exec(bContext *C, wmOperator *op) BKE_ptcache_make_cache(&baker); - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); - - return OPERATOR_FINISHED; -} -static int ptcache_free_bake_softbody_exec(bContext *C, wmOperator *op) -{ - Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); - SoftBody *sb = ob->soft; - PTCacheID pid; - - BKE_ptcache_id_from_softbody(&pid, ob, sb); - pid.cache->flag &= ~PTCACHE_BAKED; + BLI_freelistN(&pidlist); WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); return OPERATOR_FINISHED; } -void PTCACHE_OT_cache_softbody(wmOperatorType *ot) +static int ptcache_free_bake_exec(bContext *C, wmOperator *op) { - /* identifiers */ - ot->name= "Bake Softbody"; - ot->idname= "PTCACHE_OT_cache_softbody"; + PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache); + PointCache *cache= ptr.data; - /* api callbacks */ - ot->exec= ptcache_bake_softbody_exec; - ot->poll= ptcache_bake_softbody_poll; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - - RNA_def_boolean(ot->srna, "bake", 0, "Bake", ""); -} -void PTCACHE_OT_free_bake_softbody(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Free SoftBody Bake"; - ot->idname= "PTCACHE_OT_free_bake_softbody"; - - /* api callbacks */ - ot->exec= ptcache_free_bake_softbody_exec; - ot->poll= ptcache_bake_softbody_poll; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} -static int ptcache_bake_from_softbody_cache_exec(bContext *C, wmOperator *op) -{ - Object *ob= CTX_data_active_object(C); - SoftBody *sb = ob->soft; - PTCacheID pid; - - BKE_ptcache_id_from_softbody(&pid, ob, sb); - pid.cache->flag |= PTCACHE_BAKED; + cache->flag &= ~PTCACHE_BAKED; return OPERATOR_FINISHED; } -void PTCACHE_OT_bake_from_softbody_cache(wmOperatorType *ot) +static int ptcache_bake_from_cache_exec(bContext *C, wmOperator *op) { - /* identifiers */ - ot->name= "Bake From Cache"; - ot->idname= "PTCACHE_OT_bake_from_softbody_cache"; - - /* api callbacks */ - ot->exec= ptcache_bake_from_softbody_cache_exec; - ot->poll= ptcache_bake_softbody_poll; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} - -/**************************** cloth **********************************/ -static int ptcache_bake_cloth_poll(bContext *C) -{ - Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); - ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth); - - if(!scene || !ob || ob->id.lib || !clmd) - return 0; + PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache); + PointCache *cache= ptr.data; - return 1; -} - -static int ptcache_bake_cloth_exec(bContext *C, wmOperator *op) -{ - Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); - ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth); - PTCacheID pid; - PTCacheBaker baker; - - BKE_ptcache_id_from_cloth(&pid, ob, clmd); - - baker.scene = scene; - baker.pid = &pid; - baker.bake = RNA_boolean_get(op->ptr, "bake"); - baker.render = 0; - baker.anim_init = 0; - baker.quick_step = 1; - baker.break_test = cache_break_test; - baker.break_data = NULL; - baker.progressbar = (void (*)(void *, int))WM_timecursor; - baker.progresscontext = CTX_wm_window(C); - - BKE_ptcache_make_cache(&baker); - - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + cache->flag |= PTCACHE_BAKED; return OPERATOR_FINISHED; } -static int ptcache_free_bake_cloth_exec(bContext *C, wmOperator *op) -{ - Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); - ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth); - PTCacheID pid; - - BKE_ptcache_id_from_cloth(&pid, ob, clmd); - pid.cache->flag &= ~PTCACHE_BAKED; - - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); - - return OPERATOR_FINISHED; -} -void PTCACHE_OT_cache_cloth(wmOperatorType *ot) +void PTCACHE_OT_bake(wmOperatorType *ot) { /* identifiers */ - ot->name= "Bake Cloth"; - ot->idname= "PTCACHE_OT_cache_cloth"; + ot->name= "Bake Physics"; + ot->idname= "PTCACHE_OT_bake"; /* api callbacks */ - ot->exec= ptcache_bake_cloth_exec; - ot->poll= ptcache_bake_cloth_poll; + ot->exec= ptcache_bake_exec; + ot->poll= ptcache_bake_all_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_boolean(ot->srna, "bake", 0, "Bake", ""); + RNA_def_boolean(ot->srna, "bake", 1, "Bake", ""); } -void PTCACHE_OT_free_bake_cloth(wmOperatorType *ot) +void PTCACHE_OT_free_bake(wmOperatorType *ot) { /* identifiers */ - ot->name= "Free Cloth Bake"; - ot->idname= "PTCACHE_OT_free_bake_cloth"; + ot->name= "Free Physics Bake"; + ot->idname= "PTCACHE_OT_free_bake"; /* api callbacks */ - ot->exec= ptcache_free_bake_cloth_exec; - ot->poll= ptcache_bake_cloth_poll; + ot->exec= ptcache_free_bake_exec; + ot->poll= ptcache_bake_all_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int ptcache_bake_from_cloth_cache_exec(bContext *C, wmOperator *op) -{ - Object *ob= CTX_data_active_object(C); - ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth); - PTCacheID pid; - - BKE_ptcache_id_from_cloth(&pid, ob, clmd); - pid.cache->flag |= PTCACHE_BAKED; - - return OPERATOR_FINISHED; -} -void PTCACHE_OT_bake_from_cloth_cache(wmOperatorType *ot) +void PTCACHE_OT_bake_from_cache(wmOperatorType *ot) { /* identifiers */ ot->name= "Bake From Cache"; - ot->idname= "PTCACHE_OT_bake_from_cloth_cache"; + ot->idname= "PTCACHE_OT_bake_from_cache"; /* api callbacks */ - ot->exec= ptcache_bake_from_cloth_cache_exec; - ot->poll= ptcache_bake_cloth_poll; + ot->exec= ptcache_bake_from_cache_exec; + ot->poll= ptcache_bake_all_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -/**************************** particles **********************************/ -static int ptcache_bake_particle_system_poll(bContext *C) +static int ptcache_add_new_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); + Scene *scene = CTX_data_scene(C); + PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache); + Object *ob= ptr.id.data; + PointCache *cache= ptr.data; + PTCacheID *pid; + ListBase pidlist; - if(!scene || !ob || ob->id.lib) - return 0; + BKE_ptcache_ids_from_object(&pidlist, ob); - return (ob->particlesystem.first != NULL); -} - -static int ptcache_bake_particle_system_exec(bContext *C, wmOperator *op) -{ - Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); - ParticleSystem *psys =psys_get_current(ob); - PTCacheID pid; - PTCacheBaker baker; - - BKE_ptcache_id_from_particles(&pid, ob, psys); - - baker.scene = scene; - baker.pid = &pid; - baker.bake = RNA_boolean_get(op->ptr, "bake"); - baker.render = 0; - baker.anim_init = 0; - baker.quick_step = 1; - baker.break_test = cache_break_test; - baker.break_data = NULL; - baker.progressbar = (void (*)(void *, int))WM_timecursor; - baker.progresscontext = CTX_wm_window(C); + for(pid=pidlist.first; pid; pid=pid->next) { + if(pid->cache == cache) { + *(pid->cache_ptr) = BKE_ptcache_add(pid->ptcaches); + break; + } + } - BKE_ptcache_make_cache(&baker); + BLI_freelistN(&pidlist); WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); return OPERATOR_FINISHED; } -static int ptcache_free_bake_particle_system_exec(bContext *C, wmOperator *op) +static int ptcache_remove_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); - ParticleSystem *psys= psys_get_current(ob); - PTCacheID pid; + PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache); + Object *ob= ptr.id.data; + PointCache *cache= ptr.data; + PTCacheID *pid; + ListBase pidlist; - BKE_ptcache_id_from_particles(&pid, ob, psys); - psys->pointcache->flag &= ~PTCACHE_BAKED; + BKE_ptcache_ids_from_object(&pidlist, ob); + + for(pid=pidlist.first; pid; pid=pid->next) { + if(pid->cache == cache) { + if(pid->ptcaches->first == pid->ptcaches->last) + continue; /* don't delete last cache */ - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + BLI_remlink(pid->ptcaches, pid->cache); + BKE_ptcache_free(pid->cache); + *(pid->cache_ptr) = pid->ptcaches->first; - return OPERATOR_FINISHED; -} -void PTCACHE_OT_cache_particle_system(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Bake Particles"; - ot->idname= "PTCACHE_OT_cache_particle_system"; - - /* api callbacks */ - ot->exec= ptcache_bake_particle_system_exec; - ot->poll= ptcache_bake_particle_system_poll; + break; + } + } - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + BLI_freelistN(&pidlist); - RNA_def_boolean(ot->srna, "bake", 0, "Bake", ""); + return OPERATOR_FINISHED; } -void PTCACHE_OT_free_bake_particle_system(wmOperatorType *ot) +void PTCACHE_OT_add_new(wmOperatorType *ot) { /* identifiers */ - ot->name= "Free Particles Bake"; - ot->idname= "PTCACHE_OT_free_bake_particle_system"; + ot->name= "Add new cache"; + ot->idname= "PTCACHE_OT_add_new"; /* api callbacks */ - ot->exec= ptcache_free_bake_particle_system_exec; - ot->poll= ptcache_bake_particle_system_poll; + ot->exec= ptcache_add_new_exec; + ot->poll= ptcache_bake_all_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int ptcache_bake_from_particles_cache_exec(bContext *C, wmOperator *op) -{ - Object *ob= CTX_data_active_object(C); - ParticleSystem *psys= psys_get_current(ob); - PTCacheID pid; - - BKE_ptcache_id_from_particles(&pid, ob, psys); - psys->pointcache->flag |= PTCACHE_BAKED; - - return OPERATOR_FINISHED; -} -void PTCACHE_OT_bake_from_particles_cache(wmOperatorType *ot) +void PTCACHE_OT_remove(wmOperatorType *ot) { /* identifiers */ - ot->name= "Bake From Cache"; - ot->idname= "PTCACHE_OT_bake_from_particles_cache"; + ot->name= "Delete current cache"; + ot->idname= "PTCACHE_OT_remove"; /* api callbacks */ - ot->exec= ptcache_bake_from_particles_cache_exec; - ot->poll= ptcache_bake_particle_system_poll; + ot->exec= ptcache_remove_exec; + ot->poll= ptcache_bake_all_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } - /**************************** registration **********************************/ void ED_operatortypes_pointcache(void) { WM_operatortype_append(PTCACHE_OT_bake_all); WM_operatortype_append(PTCACHE_OT_free_bake_all); - WM_operatortype_append(PTCACHE_OT_cache_particle_system); - WM_operatortype_append(PTCACHE_OT_free_bake_particle_system); - WM_operatortype_append(PTCACHE_OT_bake_from_particles_cache); - WM_operatortype_append(PTCACHE_OT_cache_cloth); - WM_operatortype_append(PTCACHE_OT_free_bake_cloth); - WM_operatortype_append(PTCACHE_OT_bake_from_cloth_cache); - WM_operatortype_append(PTCACHE_OT_cache_softbody); - WM_operatortype_append(PTCACHE_OT_free_bake_softbody); - WM_operatortype_append(PTCACHE_OT_bake_from_softbody_cache); + WM_operatortype_append(PTCACHE_OT_bake); + WM_operatortype_append(PTCACHE_OT_free_bake); + WM_operatortype_append(PTCACHE_OT_bake_from_cache); + WM_operatortype_append(PTCACHE_OT_add_new); + WM_operatortype_append(PTCACHE_OT_remove); } //void ED_keymap_pointcache(wmWindowManager *wm) diff --git a/source/blender/editors/physics/editparticle.c b/source/blender/editors/physics/editparticle.c index 20033c747f9..83bf12d651e 100644 --- a/source/blender/editors/physics/editparticle.c +++ b/source/blender/editors/physics/editparticle.c @@ -104,21 +104,12 @@ static int PE_poll(bContext *C) psys= PE_get_current(scene, ob); - return (psys && psys->edit && (G.f & G_PARTICLEEDIT)); + return (psys && psys->edit && (ob && ob->mode & OB_MODE_PARTICLE_EDIT)); } static int PE_poll_3dview(bContext *C) { - Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); - ParticleSystem *psys; - - if(!scene || !ob || !CTX_wm_region_view3d(C)) - return 0; - - psys= PE_get_current(scene, ob); - - return (psys && psys->edit && (G.f & G_PARTICLEEDIT)); + return PE_poll(C) && CTX_wm_region_view3d(C); } static void PE_free_particle_edit(ParticleSystem *psys) @@ -164,7 +155,7 @@ static void PE_free_particle_edit(ParticleSystem *psys) int PE_can_edit(ParticleSystem *psys) { - return (psys && psys->edit && (G.f & G_PARTICLEEDIT)); + return (psys && psys->edit); } ParticleEditSettings *PE_settings(Scene *scene) @@ -194,7 +185,7 @@ ParticleSystem *PE_get_current(Scene *scene, Object *ob) /* this happens when Blender is started with particle * edit mode enabled XXX there's a draw error then? */ - if(psys && psys_check_enabled(ob, psys) && (ob == OBACT) && (G.f & G_PARTICLEEDIT)) + if(psys && psys_check_enabled(ob, psys) && (ob == OBACT) && (ob->mode & OB_MODE_PARTICLE_EDIT)) if(psys->part->type == PART_HAIR && psys->flag & PSYS_EDITED) if(psys->edit == NULL) PE_create_particle_edit(scene, ob, psys); @@ -3710,7 +3701,7 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op) psys->flag |= PSYS_CURRENT; } - if(!(G.f & G_PARTICLEEDIT)) { + if(!(ob->mode & OB_MODE_PARTICLE_EDIT)) { if(psys && psys->part->type == PART_HAIR && psys->flag & PSYS_EDITED) { if(psys_check_enabled(ob, psys)) { if(psys->edit==NULL) @@ -3720,12 +3711,12 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op) } } - G.f |= G_PARTICLEEDIT; + ob->mode |= OB_MODE_PARTICLE_EDIT; toggle_particle_cursor(C, 1); WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_PARTICLE, NULL); } else { - G.f &= ~G_PARTICLEEDIT; + ob->mode &= ~OB_MODE_PARTICLE_EDIT; toggle_particle_cursor(C, 0); WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL); } @@ -3773,7 +3764,7 @@ static int set_editable_exec(bContext *C, wmOperator *op) if(psys_check_enabled(ob, psys)) { psys->flag |= PSYS_EDITED; - if(G.f & G_PARTICLEEDIT) + if(ob->mode & OB_MODE_PARTICLE_EDIT) PE_create_particle_edit(scene, ob, psys); } else @@ -3814,7 +3805,7 @@ void PE_change_act(void *ob_v, void *act_v) psys->flag |= PSYS_CURRENT; if(psys_check_enabled(ob, psys)) { - if(G.f & G_PARTICLEEDIT && !psys->edit) + if(ob->mode & OB_MODE_PARTICLE_EDIT && !psys->edit) PE_create_particle_edit(scene, ob, psys); psys_update_world_cos(ob, psys); } @@ -3832,7 +3823,7 @@ void PE_change_act_psys(Scene *scene, Object *ob, ParticleSystem *psys) psys->flag |= PSYS_CURRENT; if(psys_check_enabled(ob, psys)) { - if(G.f & G_PARTICLEEDIT && !psys->edit) + if(ob->mode & OB_MODE_PARTICLE_EDIT && !psys->edit) PE_create_particle_edit(scene, ob, psys); psys_update_world_cos(ob, psys); diff --git a/source/blender/editors/physics/physics_boids.c b/source/blender/editors/physics/physics_boids.c index 2d3b11080e7..148359068ad 100644 --- a/source/blender/editors/physics/physics_boids.c +++ b/source/blender/editors/physics/physics_boids.c @@ -249,7 +249,6 @@ void BOID_OT_boidrule_move_down(wmOperatorType *ot) /************************ add/del boid state operators *********************/ static int boidstate_add_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; Object *ob= ptr.id.data; @@ -344,7 +343,6 @@ void BOID_OT_boidstate_del(wmOperatorType *ot) /************************ move up/down boid state operators *********************/ static int boidstate_move_up_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; Object *ob = ptr.id.data; @@ -385,7 +383,6 @@ static int boidstate_move_down_exec(bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; - Object *ob = ptr.id.data; BoidSettings *boids; BoidState *state; @@ -430,4 +427,4 @@ void ED_operatortypes_boids(void) WM_operatortype_append(BOID_OT_boidstate_del); WM_operatortype_append(BOID_OT_boidstate_move_up); WM_operatortype_append(BOID_OT_boidstate_move_down); -}
\ No newline at end of file +} diff --git a/source/blender/editors/preview/previewrender.c b/source/blender/editors/preview/previewrender.c index c5a741b11ed..159e644bb39 100644 --- a/source/blender/editors/preview/previewrender.c +++ b/source/blender/editors/preview/previewrender.c @@ -304,7 +304,9 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre end_render_material(mat); /* turn on raytracing if needed */ - if(mat->mode_l & (MA_RAYTRANSP|MA_RAYMIRROR)) + if(mat->mode_l & MA_RAYMIRROR) + sce->r.mode |= R_RAYTRACE; + if((mat->mode_l & MA_RAYTRANSP) && (mat->mode_l & MA_TRANSP)) sce->r.mode |= R_RAYTRACE; if(mat->sss_flag & MA_DIFF_SSS) sce->r.mode |= R_SSS; diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt index 89820e0d362..6861f82ac3f 100644 --- a/source/blender/editors/screen/CMakeLists.txt +++ b/source/blender/editors/screen/CMakeLists.txt @@ -41,7 +41,6 @@ SET(INC ../../windowmanager ../../quicktime ../../../../intern/elbeem/extern ../../../../intern/ghost ../../../../intern/opennl/extern ../../nodes - ${SDL_INC} ) IF(WITH_INTERNATIONAL) diff --git a/source/blender/editors/screen/Makefile b/source/blender/editors/screen/Makefile index 923a020afcf..00698917be5 100644 --- a/source/blender/editors/screen/Makefile +++ b/source/blender/editors/screen/Makefile @@ -54,3 +54,8 @@ CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include # own include CPPFLAGS += -I../include + +ifeq ($(WITH_OPENEXR), true) + CPPFLAGS += -DWITH_OPENEXR +endif + diff --git a/source/blender/editors/screen/SConscript b/source/blender/editors/screen/SConscript index 3972efd8eed..a4f73cfea7e 100644 --- a/source/blender/editors/screen/SConscript +++ b/source/blender/editors/screen/SConscript @@ -12,5 +12,7 @@ defs = '' if not env['WITH_BF_PYTHON']: defs += 'DISABLE_PYTHON' +if env['WITH_BF_OPENEXR']: + defs += ' WITH_OPENEXR' env.BlenderLib ( 'bf_editors_screen', sources, Split(incs), Split(defs), libtype=['core'], priority=[105] ) diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 79ba11a5c55..296c38fa51a 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -499,7 +499,7 @@ static void region_azone_initialize(ScrArea *sa, ARegion *ar, char edge) /* if more azones on 1 spot, set offset */ for(azt= sa->actionzones.first; azt; azt= azt->next) { if(az!=azt) { - if(az->x1==azt->x1 && az->y1==azt->y1) { + if( ABS(az->x1-azt->x1) < 2 && ABS(az->y1-azt->y1) < 2) { if(edge=='t' || edge=='b') { az->x1+= AZONESPOT; az->x2+= AZONESPOT; @@ -1309,7 +1309,7 @@ void ED_region_header(const bContext *C, ARegion *ar) HeaderType *ht; Header header = {0}; float col[3]; - int xco, yco; + int maxco, xco, yco; /* clear */ if(ED_screen_area_active(C)) @@ -1323,7 +1323,7 @@ void ED_region_header(const bContext *C, ARegion *ar) /* set view2d view matrix for scrolling (without scrollers) */ UI_view2d_view_ortho(C, &ar->v2d); - xco= 8; + xco= maxco= 8; yco= HEADERY-3; /* draw all headers types */ @@ -1335,15 +1335,25 @@ void ED_region_header(const bContext *C, ARegion *ar) header.type= ht; header.layout= layout; ht->draw(C, &header); + + /* for view2d */ + xco= uiLayoutGetWidth(layout); + if(xco > maxco) + maxco= xco; } uiBlockLayoutResolve(C, block, &xco, &yco); + + /* for view2d */ + if(xco > maxco) + maxco= xco; + uiEndBlock(C, block); uiDrawBlock(C, block); } /* always as last */ - UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin); + UI_view2d_totRect_set(&ar->v2d, maxco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin); /* restore view matrix? */ UI_view2d_view_restore(C); diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 3842dd3d62f..1e36a32b9e1 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -44,6 +44,10 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult bScreen *sc= CTX_wm_screen(C); Scene *scene= sc->scene; Base *base; + Object *ob = NULL; + + if(scene && scene->basact) + ob = scene->basact->object; if(CTX_data_dir(member)) { static const char *dir[] = { @@ -112,32 +116,32 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult return 1; } else if(CTX_data_equals(member, "sculpt_object")) { - if(G.f & G_SCULPTMODE && scene->basact) - CTX_data_id_pointer_set(result, &scene->basact->object->id); + if(ob && (ob->mode & OB_MODE_SCULPT)) + CTX_data_id_pointer_set(result, &ob->id); return 1; } else if(CTX_data_equals(member, "vertex_paint_object")) { - if(G.f & G_VERTEXPAINT && scene->basact) - CTX_data_id_pointer_set(result, &scene->basact->object->id); + if(ob && (ob->mode & OB_MODE_VERTEX_PAINT)) + CTX_data_id_pointer_set(result, &ob->id); return 1; } else if(CTX_data_equals(member, "weight_paint_object")) { - if(G.f & G_WEIGHTPAINT && scene->basact) - CTX_data_id_pointer_set(result, &scene->basact->object->id); + if(ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) + CTX_data_id_pointer_set(result, &ob->id); return 1; } else if(CTX_data_equals(member, "texture_paint_object")) { - if(G.f & G_TEXTUREPAINT && scene->basact) - CTX_data_id_pointer_set(result, &scene->basact->object->id); + if(ob && (ob->mode & OB_MODE_TEXTURE_PAINT)) + CTX_data_id_pointer_set(result, &ob->id); return 1; } else if(CTX_data_equals(member, "particle_edit_object")) { - if(G.f & G_PARTICLEEDIT && scene->basact) - CTX_data_id_pointer_set(result, &scene->basact->object->id); + if(ob && (ob->mode & OB_MODE_PARTICLE_EDIT)) + CTX_data_id_pointer_set(result, &ob->id); return 1; } diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 5519b2609a1..76a62128e91 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -923,12 +923,6 @@ bScreen *ED_screen_duplicate(wmWindow *win, bScreen *sc) newsc= ED_screen_add(win, sc->scene, sc->id.name+2); /* copy all data */ screen_copy(newsc, sc); - /* set in window */ - win->screen= newsc; - - /* store identifier */ - win->screen->winid= win->winid; - BLI_strncpy(win->screenname, win->screen->id.name+2, 21); return newsc; } @@ -1289,6 +1283,49 @@ void ED_screen_set(bContext *C, bScreen *sc) } } +static int ed_screen_used(wmWindowManager *wm, bScreen *sc) +{ + wmWindow *win; + + for(win=wm->windows.first; win; win=win->next) + if(win->screen == sc) + return 1; + + return 0; +} + +/* only call outside of area/region loops */ +void ED_screen_delete(bContext *C, bScreen *sc) +{ + Main *bmain= CTX_data_main(C); + wmWindowManager *wm= CTX_wm_manager(C); + wmWindow *win= CTX_wm_window(C); + bScreen *newsc; + int delete= 1; + + /* screen can only be in use by one window at a time, so as + long as we are able to find a screen that is unused, we + can safely assume ours is not in use anywhere an delete it */ + + for(newsc= sc->id.prev; newsc; newsc=newsc->id.prev) + if(!ed_screen_used(wm, newsc)) + break; + + if(!newsc) { + for(newsc= sc->id.next; newsc; newsc=newsc->id.next) + if(!ed_screen_used(wm, newsc)) + break; + } + + if(!newsc) + return; + + ED_screen_set(C, newsc); + + if(delete && win->screen != sc) + free_libblock(&bmain->screen, sc); +} + /* only call outside of area/region loops */ void ED_screen_set_scene(bContext *C, Scene *scene) { @@ -1346,6 +1383,24 @@ void ED_screen_set_scene(bContext *C, Scene *scene) } +/* only call outside of area/region loops */ +void ED_screen_delete_scene(bContext *C, Scene *scene) +{ + Main *bmain= CTX_data_main(C); + Scene *newscene; + + if(scene->id.prev) + newscene= scene->id.prev; + else if(scene->id.next) + newscene= scene->id.next; + else + return; + + ED_screen_set_scene(C, newscene); + + unlink_scene(bmain, scene, newscene); +} + /* this function toggles: if area is full then the parent will be restored */ void ed_screen_fullarea(bContext *C, ScrArea *sa) { @@ -1461,7 +1516,7 @@ void ED_screen_full_prevspace(bContext *C) /* redraws: uses defines from stime->redraws * enable: 1 - forward on, -1 - backwards on, 0 - off */ -void ED_screen_animation_timer(bContext *C, int redraws, int enable) +void ED_screen_animation_timer(bContext *C, int redraws, int sync, int enable) { bScreen *screen= CTX_wm_screen(C); wmWindow *win= CTX_wm_window(C); @@ -1477,7 +1532,8 @@ void ED_screen_animation_timer(bContext *C, int redraws, int enable) screen->animtimer= WM_event_add_window_timer(win, TIMER0, (1.0/FPS)); sad->ar= CTX_wm_region(C); sad->redraws= redraws; - sad->flag= (enable < 0) ? ANIMPLAY_FLAG_REVERSE : 0; + sad->flag |= (enable < 0)? ANIMPLAY_FLAG_REVERSE: 0; + sad->flag |= (sync == 0)? ANIMPLAY_FLAG_NO_SYNC: (sync == 1)? ANIMPLAY_FLAG_SYNC: 0; screen->animtimer->customdata= sad; } @@ -1485,6 +1541,45 @@ void ED_screen_animation_timer(bContext *C, int redraws, int enable) WM_event_add_notifier(C, NC_SCREEN|ND_ANIMPLAY, screen); } +/* helper for screen_animation_play() - only to be used for TimeLine */ +static ARegion *time_top_left_3dwindow(bScreen *screen) +{ + ARegion *aret= NULL; + ScrArea *sa; + int min= 10000; + + for(sa= screen->areabase.first; sa; sa= sa->next) { + if(sa->spacetype==SPACE_VIEW3D) { + ARegion *ar; + for(ar= sa->regionbase.first; ar; ar= ar->next) { + if(ar->regiontype==RGN_TYPE_WINDOW) { + if(ar->winrct.xmin - ar->winrct.ymin < min) { + aret= ar; + min= ar->winrct.xmin - ar->winrct.ymin; + } + } + } + } + } + + return aret; +} + +void ED_screen_animation_timer_update(bContext *C, int redraws) +{ + bScreen *screen= CTX_wm_screen(C); + + if(screen && screen->animtimer) { + wmTimer *wt= screen->animtimer; + ScreenAnimData *sad= wt->customdata; + + sad->redraws= redraws; + sad->ar= NULL; + if(redraws & TIME_REGION) + sad->ar= time_top_left_3dwindow(screen); + } +} + unsigned int ED_screen_view3d_layers(bScreen *screen) { if(screen) { @@ -1514,7 +1609,7 @@ void ED_update_for_newframe(const bContext *C, int mute) /* XXX future: do all windows */ scene_update_for_newframe(scene, ED_screen_view3d_layers(screen)); /* BKE_scene.h */ - //if ( (CFRA>1) && (!mute) && (scene->audio.flag & AUDIO_SCRUB)) + //if ( (CFRA>1) && (!mute) && (scene->r.audio.flag & AUDIO_SCRUB)) // audiostream_scrub( CFRA ); /* 3d window, preview */ diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index f882a25c363..b591c6e6856 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -54,6 +54,7 @@ #include "BKE_mesh.h" #include "BKE_multires.h" #include "BKE_report.h" +#include "BKE_scene.h" #include "BKE_screen.h" #include "BKE_utildefines.h" #include "BKE_sound.h" @@ -231,7 +232,7 @@ int ED_operator_posemode(bContext *C) Object *obedit= CTX_data_edit_object(C); if ((obact != obedit) && (obact) && (obact->type==OB_ARMATURE)) - return (obact->flag & OB_POSEMODE)!=0; + return (obact->mode & OB_MODE_POSE)!=0; return 0; } @@ -2226,17 +2227,25 @@ static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event) wmTimer *wt= screen->animtimer; ScreenAnimData *sad= wt->customdata; ScrArea *sa; + int sync; + + /* sync, don't sync, or follow scene setting */ + if(sad->flag & ANIMPLAY_FLAG_SYNC) sync= 1; + else if(sad->flag & ANIMPLAY_FLAG_NO_SYNC) sync= 0; + else sync= (scene->r.audio.flag & AUDIO_SYNC); - if(scene->audio.flag & AUDIO_SYNC) { + if(sync) { + /* skip frames */ int step = floor(wt->duration * FPS); - if (sad->flag & ANIMPLAY_FLAG_REVERSE) // XXX does this option work with audio? + if(sad->flag & ANIMPLAY_FLAG_REVERSE) // XXX does this option work with audio? scene->r.cfra -= step; else scene->r.cfra += step; wt->duration -= ((float)step)/FPS; } else { - if (sad->flag & ANIMPLAY_FLAG_REVERSE) + /* one frame +/- */ + if(sad->flag & ANIMPLAY_FLAG_REVERSE) scene->r.cfra--; else scene->r.cfra++; @@ -2314,39 +2323,34 @@ static void SCREEN_OT_animation_step(wmOperatorType *ot) /* ****************** anim player, starts or ends timer ***************** */ -/* helper for screen_animation_play() - only to be used for TimeLine */ -// NOTE: defined in time_header.c for now... -extern ARegion *time_top_left_3dwindow(bScreen *screen); - /* toggle operator */ static int screen_animation_play(bContext *C, wmOperator *op, wmEvent *event) { bScreen *screen= CTX_wm_screen(C); if(screen->animtimer) { - ED_screen_animation_timer(C, 0, 0); + ED_screen_animation_timer(C, 0, 0, 0); sound_stop_all(C); } else { ScrArea *sa= CTX_wm_area(C); int mode= (RNA_boolean_get(op->ptr, "reverse")) ? -1 : 1; + int sync= -1; + + if(RNA_property_is_set(op->ptr, "sync")) + sync= (RNA_boolean_get(op->ptr, "sync")); /* timeline gets special treatment since it has it's own menu for determining redraws */ if ((sa) && (sa->spacetype == SPACE_TIME)) { SpaceTime *stime= (SpaceTime *)sa->spacedata.first; - ED_screen_animation_timer(C, stime->redraws, mode); + ED_screen_animation_timer(C, stime->redraws, sync, mode); /* update region if TIME_REGION was set, to leftmost 3d window */ - if(screen->animtimer && (stime->redraws & TIME_REGION)) { - wmTimer *wt= screen->animtimer; - ScreenAnimData *sad= wt->customdata; - - sad->ar= time_top_left_3dwindow(screen); - } + ED_screen_animation_timer_update(C, stime->redraws); } else { - ED_screen_animation_timer(C, TIME_REGION|TIME_ALL_3D_WIN, mode); + ED_screen_animation_timer(C, TIME_REGION|TIME_ALL_3D_WIN, sync, mode); if(screen->animtimer) { wmTimer *wt= screen->animtimer; @@ -2372,6 +2376,7 @@ static void SCREEN_OT_animation_play(wmOperatorType *ot) ot->poll= ED_operator_screenactive; RNA_def_boolean(ot->srna, "reverse", 0, "Play in Reverse", "Animation is played backwards"); + RNA_def_boolean(ot->srna, "sync", 0, "Sync", "Drop frames to maintain framerate and stay in sync with audio."); } /* ************** border select operator (template) ***************************** */ @@ -2880,10 +2885,13 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event) RenderJob *rj; Image *ima; - /* only one job at a time */ + /* only one render job at a time */ if(WM_jobs_test(CTX_wm_manager(C), scene)) return OPERATOR_CANCELLED; + /* stop all running jobs, currently previews frustrate Render */ + WM_jobs_stop_all(CTX_wm_manager(C)); + /* handle UI stuff */ WM_cursor_wait(1); @@ -3087,7 +3095,124 @@ static void SCREEN_OT_userpref_show(struct wmOperatorType *ot) ot->poll= ED_operator_screenactive; } +/********************* new screen operator *********************/ +static int screen_new_exec(bContext *C, wmOperator *op) +{ + wmWindow *win= CTX_wm_window(C); + bScreen *sc= CTX_wm_screen(C); + + sc= ED_screen_duplicate(win, sc); + WM_event_add_notifier(C, NC_SCREEN|ND_SCREENBROWSE, sc); + + return OPERATOR_FINISHED; +} + +void SCREEN_OT_new(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "New Screen"; + ot->idname= "SCREEN_OT_new"; + + /* api callbacks */ + ot->exec= screen_new_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +/********************* delete screen operator *********************/ + +static int screen_delete_exec(bContext *C, wmOperator *op) +{ + bScreen *sc= CTX_wm_screen(C); + + WM_event_add_notifier(C, NC_SCREEN|ND_SCREENDELETE, sc); + + return OPERATOR_FINISHED; +} + +void SCREEN_OT_delete(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Delete Scene"; + ot->idname= "SCREEN_OT_delete"; + + /* api callbacks */ + ot->exec= screen_delete_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +/********************* new scene operator *********************/ + +static int scene_new_exec(bContext *C, wmOperator *op) +{ + Scene *newscene, *scene= CTX_data_scene(C); + Main *bmain= CTX_data_main(C); + int type= RNA_enum_get(op->ptr, "type"); + + newscene= copy_scene(bmain, scene, type); + + /* these can't be handled in blenkernel curently, so do them here */ + if(type == SCE_COPY_LINK_DATA) + ED_object_single_users(newscene, 0); + else if(type == SCE_COPY_FULL) + ED_object_single_users(newscene, 1); + + WM_event_add_notifier(C, NC_SCENE|ND_SCENEBROWSE, newscene); + + return OPERATOR_FINISHED; +} + +void SCENE_OT_new(wmOperatorType *ot) +{ + static EnumPropertyItem type_items[]= { + {SCE_COPY_EMPTY, "EMPTY", 0, "Empty", "Add empty scene."}, + {SCE_COPY_LINK_OB, "LINK_OBJECTS", 0, "Link Objects", "Link to the objects from the current scene."}, + {SCE_COPY_LINK_DATA, "LINK_OBJECT_DATA", 0, "Link Object Data", "Copy objects linked to data from the current scene."}, + {SCE_COPY_FULL, "FULL_COPY", 0, "Full Copy", "Make a full copy of the current scene."}, + {0, NULL, 0, NULL, NULL}}; + + /* identifiers */ + ot->name= "New Scene"; + ot->idname= "SCENE_OT_new"; + + /* api callbacks */ + ot->exec= scene_new_exec; + ot->invoke= WM_menu_invoke; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + /* properties */ + RNA_def_enum(ot->srna, "type", type_items, 0, "Type", ""); +} + +/********************* delete scene operator *********************/ + +static int scene_delete_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + + WM_event_add_notifier(C, NC_SCENE|ND_SCENEDELETE, scene); + + return OPERATOR_FINISHED; +} + +void SCENE_OT_delete(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Delete Scene"; + ot->idname= "SCENE_OT_delete"; + + /* api callbacks */ + ot->exec= scene_delete_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} /* **************** Assigning operatortypes to global list, adding handlers **************** */ @@ -3129,6 +3254,12 @@ void ED_operatortypes_screen(void) WM_operatortype_append(SCREEN_OT_render_view_cancel); WM_operatortype_append(SCREEN_OT_render_view_show); + /* new/delete */ + WM_operatortype_append(SCREEN_OT_new); + WM_operatortype_append(SCREEN_OT_delete); + WM_operatortype_append(SCENE_OT_new); + WM_operatortype_append(SCENE_OT_delete); + /* tools shared by more space types */ WM_operatortype_append(ED_OT_undo); WM_operatortype_append(ED_OT_redo); @@ -3239,6 +3370,7 @@ void ED_keymap_screen(wmWindowManager *wm) /* play (forward and backwards) */ WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT, 0); + WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", KKEY, KM_PRESS, 0, LKEY); RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0)->ptr, "reverse", 1); keymap_modal_set(wm); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 48e07b7a489..975bfd8dbe7 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -71,6 +71,7 @@ #include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_node.h" +#include "BKE_paint.h" #include "BKE_utildefines.h" #include "BKE_DerivedMesh.h" #include "BKE_report.h" @@ -4023,7 +4024,7 @@ static void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, s if(texpaint || (sima && sima->lock)) { int w = imapaintpartial.x2 - imapaintpartial.x1; int h = imapaintpartial.y2 - imapaintpartial.y1; - GPU_paint_update_image(image, imapaintpartial.x1, imapaintpartial.y1, w, h); + GPU_paint_update_image(image, imapaintpartial.x1, imapaintpartial.y1, w, h, !texpaint); } } @@ -4375,15 +4376,17 @@ static Brush *image_paint_brush(bContext *C) Scene *scene= CTX_data_scene(C); ToolSettings *settings= scene->toolsettings; - return settings->imapaint.brush; + return paint_brush(&settings->imapaint.paint); } static int image_paint_poll(bContext *C) { + Object *obact = CTX_data_active_object(C); + if(!image_paint_brush(C)) return 0; - if((G.f & G_TEXTUREPAINT) && CTX_wm_region_view3d(C)) { + if((obact && obact->mode & OB_MODE_TEXTURE_PAINT) && CTX_wm_region_view3d(C)) { return 1; } else { @@ -4484,11 +4487,12 @@ static void paint_redraw(bContext *C, ImagePaintState *s, int final) } } -static int paint_init(bContext *C, wmOperator *op) +static int texture_paint_init(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); ToolSettings *settings= scene->toolsettings; PaintOperation *pop; + Brush *brush; pop= MEM_callocN(sizeof(PaintOperation), "PaintOperation"); pop->first= 1; @@ -4516,10 +4520,11 @@ static int paint_init(bContext *C, wmOperator *op) pop->ps.ar= CTX_wm_region(C); /* intialize brush */ - if(!settings->imapaint.brush) + brush= paint_brush(&settings->imapaint.paint); + if(!brush) return 0; - pop->s.brush = settings->imapaint.brush; + pop->s.brush = brush; pop->s.tool = settings->imapaint.tool; if(pop->mode == PAINT_MODE_3D && (pop->s.tool == PAINT_TOOL_CLONE)) pop->s.tool = PAINT_TOOL_DRAW; @@ -4670,7 +4675,7 @@ static void paint_exit(bContext *C, wmOperator *op) static int paint_exec(bContext *C, wmOperator *op) { - if(!paint_init(C, op)) { + if(!texture_paint_init(C, op)) { MEM_freeN(op->customdata); return OPERATOR_CANCELLED; } @@ -4744,7 +4749,7 @@ static int paint_invoke(bContext *C, wmOperator *op, wmEvent *event) { PaintOperation *pop; - if(!paint_init(C, op)) { + if(!texture_paint_init(C, op)) { MEM_freeN(op->customdata); return OPERATOR_CANCELLED; } @@ -4872,7 +4877,7 @@ static int paint_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *eve ToolSettings *ts = CTX_data_scene(C)->toolsettings; get_imapaint_zoom(C, &zoom, &zoom); toggle_paint_cursor(C, !ts->imapaint.paintcursor); - brush_radial_control_invoke(op, ts->imapaint.brush, 0.5 * zoom); + brush_radial_control_invoke(op, paint_brush(&ts->imapaint.paint), 0.5 * zoom); return WM_radial_control_invoke(C, op, event); } @@ -4891,7 +4896,7 @@ static int paint_radial_control_exec(bContext *C, wmOperator *op) int ret; char str[256]; get_imapaint_zoom(C, &zoom, &zoom); - ret = brush_radial_control_exec(op, CTX_data_scene(C)->toolsettings->imapaint.brush, 2.0 / zoom); + ret = brush_radial_control_exec(op, paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint), 2.0 / zoom); WM_radial_control_string(op, str, 256); return ret; @@ -5144,13 +5149,13 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op) me= get_mesh(ob); - if(!(G.f & G_TEXTUREPAINT) && !me) { + if(!(ob->mode & OB_MODE_TEXTURE_PAINT) && !me) { BKE_report(op->reports, RPT_ERROR, "Can only enter texture paint mode for mesh objects."); return OPERATOR_CANCELLED; } - if(G.f & G_TEXTUREPAINT) { - G.f &= ~G_TEXTUREPAINT; + if(ob->mode & OB_MODE_TEXTURE_PAINT) { + ob->mode &= ~OB_MODE_TEXTURE_PAINT; if(U.glreslimit != 0) GPU_free_images(); @@ -5159,13 +5164,13 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op) toggle_paint_cursor(C, 0); } else { - G.f |= G_TEXTUREPAINT; + ob->mode |= OB_MODE_TEXTURE_PAINT; if(me->mtface==NULL) me->mtface= CustomData_add_layer(&me->fdata, CD_MTFACE, CD_DEFAULT, NULL, me->totface); - brush_check_exists(&scene->toolsettings->imapaint.brush); + paint_init(&scene->toolsettings->imapaint.paint, "Brush"); if(U.glreslimit != 0) GPU_free_images(); @@ -5200,13 +5205,13 @@ static int texture_paint_radial_control_invoke(bContext *C, wmOperator *op, wmEv { ToolSettings *ts = CTX_data_scene(C)->toolsettings; toggle_paint_cursor(C, !ts->imapaint.paintcursor); - brush_radial_control_invoke(op, ts->imapaint.brush, 0.5); + brush_radial_control_invoke(op, paint_brush(&ts->imapaint.paint), 0.5); return WM_radial_control_invoke(C, op, event); } static int texture_paint_radial_control_exec(bContext *C, wmOperator *op) { - int ret = brush_radial_control_exec(op, CTX_data_scene(C)->toolsettings->imapaint.brush, 2); + int ret = brush_radial_control_exec(op, paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint), 2); char str[256]; WM_radial_control_string(op, str, 256); @@ -5216,7 +5221,7 @@ static int texture_paint_radial_control_exec(bContext *C, wmOperator *op) static int texture_paint_poll(bContext *C) { if(texture_paint_toggle_poll(C)) - if(G.f & G_TEXTUREPAINT) + if(CTX_data_active_object(C)->mode & OB_MODE_TEXTURE_PAINT) return 1; return 0; diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index b630975c934..40423e17fe4 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -59,6 +59,7 @@ int imapaint_pick_face(struct ViewContext *vc, struct Mesh *me, int *mval, unsig void imapaint_pick_uv(struct Scene *scene, struct Object *ob, struct Mesh *mesh, unsigned int faceindex, int *xy, float *uv); void paint_sample_color(struct Scene *scene, struct ARegion *ar, int x, int y); +void BRUSH_OT_curve_preset(struct wmOperatorType *ot); #endif /* ED_PAINT_INTERN_H */ diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index e9263ddabf0..63a6591d057 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -1,15 +1,96 @@ +/** + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "DNA_brush_types.h" +#include "DNA_object_types.h" +#include "DNA_scene_types.h" + +#include "BKE_brush.h" +#include "BKE_context.h" +#include "BKE_paint.h" #include "ED_sculpt.h" +#include "UI_resources.h" #include "WM_api.h" #include "WM_types.h" +#include "RNA_access.h" +#include "RNA_define.h" +#include "RNA_enum_types.h" + #include "paint_intern.h" +#include <string.h> + +/* Brush operators */ +static int brush_add_exec(bContext *C, wmOperator *op) +{ + /*int type = RNA_enum_get(op->ptr, "type");*/ + Brush *br = NULL; + + br = add_brush("Brush"); + + if(br) + paint_brush_set(paint_get_active(CTX_data_scene(C)), br); + + return OPERATOR_FINISHED; +} + +static EnumPropertyItem brush_type_items[] = { + {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt", ""}, + {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""}, + {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""}, + {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""}, + {0, NULL, 0, NULL, NULL}}; + +void BRUSH_OT_add(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Add Brush"; + ot->idname= "BRUSH_OT_add"; + + /* api callbacks */ + ot->exec= brush_add_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + RNA_def_enum(ot->srna, "type", brush_type_items, OB_MODE_VERTEX_PAINT, "Type", "Which paint mode to create the brush for."); +} + +/* Paint operators */ +static int paint_poll(bContext *C) +{ + return !!paint_get_active(CTX_data_scene(C)); +} + /**************************** registration **********************************/ void ED_operatortypes_paint(void) { + /* brush */ + WM_operatortype_append(BRUSH_OT_add); + WM_operatortype_append(BRUSH_OT_curve_preset); + /* image */ WM_operatortype_append(PAINT_OT_texture_paint_toggle); WM_operatortype_append(PAINT_OT_texture_paint_radial_control); diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 85ea55331dc..23bc119afb4 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -5,21 +5,31 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" + #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_view3d_types.h" +#include "RNA_access.h" +#include "RNA_define.h" + #include "BLI_arithb.h" #include "BKE_brush.h" +#include "BKE_context.h" #include "BKE_DerivedMesh.h" #include "BKE_global.h" +#include "BKE_paint.h" + #include "BKE_utildefines.h" #include "BIF_gl.h" #include "ED_view3d.h" +#include "WM_api.h" +#include "WM_types.h" + #include "paint_intern.h" /* 3D Paint */ @@ -160,7 +170,7 @@ int imapaint_pick_face(ViewContext *vc, Mesh *me, int *mval, unsigned int *index /* used for both 3d view and image window */ void paint_sample_color(Scene *scene, ARegion *ar, int x, int y) /* frontbuf */ { - Brush **br = current_brush_source(scene); + Brush *br = paint_brush(paint_get_active(scene)); unsigned int col; char *cp; @@ -173,10 +183,43 @@ void paint_sample_color(Scene *scene, ARegion *ar, int x, int y) /* frontbuf */ cp = (char *)&col; - if(br && *br) { - (*br)->rgb[0]= cp[0]/255.0f; - (*br)->rgb[1]= cp[1]/255.0f; - (*br)->rgb[2]= cp[2]/255.0f; + if(br) { + br->rgb[0]= cp[0]/255.0f; + br->rgb[1]= cp[1]/255.0f; + br->rgb[2]= cp[2]/255.0f; } } +static int brush_curve_preset_exec(bContext *C, wmOperator *op) +{ + Brush *br = paint_brush(paint_get_active(CTX_data_scene(C))); + brush_curve_preset(br, RNA_enum_get(op->ptr, "shape")); + + return OPERATOR_FINISHED; +} + +static int brush_curve_preset_poll(bContext *C) +{ + Brush *br = paint_brush(paint_get_active(CTX_data_scene(C))); + + return br && br->curve; +} + +void BRUSH_OT_curve_preset(wmOperatorType *ot) +{ + static EnumPropertyItem prop_shape_items[] = { + {BRUSH_PRESET_SHARP, "SHARP", 0, "Sharp", ""}, + {BRUSH_PRESET_SMOOTH, "SMOOTH", 0, "Smooth", ""}, + {BRUSH_PRESET_MAX, "MAX", 0, "Max", ""}, + {0, NULL, 0, NULL, NULL}}; + + ot->name= "Preset"; + ot->idname= "BRUSH_OT_curve_preset"; + + ot->exec= brush_curve_preset_exec; + ot->poll= brush_curve_preset_poll; + + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + RNA_def_enum(ot->srna, "shape", prop_shape_items, BRUSH_PRESET_SHARP, "Mode", ""); +} diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 812c41f430e..1a548708ec8 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -76,6 +76,7 @@ #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_object.h" +#include "BKE_paint.h" #include "BKE_utildefines.h" #include "WM_api.h" @@ -108,7 +109,10 @@ static void error() {} static int vp_poll(bContext *C) { - if(G.f & G_VERTEXPAINT) { + Object *ob = CTX_data_active_object(C); + + if(ob && ob->mode & OB_MODE_VERTEX_PAINT && + paint_brush(&CTX_data_tool_settings(C)->vpaint->paint)) { ScrArea *sa= CTX_wm_area(C); if(sa->spacetype==SPACE_VIEW3D) { ARegion *ar= CTX_wm_region(C); @@ -121,7 +125,10 @@ static int vp_poll(bContext *C) static int wp_poll(bContext *C) { - if(G.f & G_WEIGHTPAINT) { + Object *ob = CTX_data_active_object(C); + + if(ob && ob->mode & OB_MODE_WEIGHT_PAINT && + paint_brush(&CTX_data_tool_settings(C)->wpaint->paint)) { ScrArea *sa= CTX_wm_area(C); if(sa->spacetype==SPACE_VIEW3D) { ARegion *ar= CTX_wm_region(C); @@ -136,14 +143,14 @@ static int wp_poll(bContext *C) /* Cursors */ static void vp_drawcursor(bContext *C, int x, int y, void *customdata) { - ToolSettings *ts= CTX_data_tool_settings(C); + Brush *brush = paint_brush(&CTX_data_tool_settings(C)->vpaint->paint); glTranslatef((float)x, (float)y, 0.0f); glColor4ub(255, 255, 255, 128); glEnable( GL_LINE_SMOOTH ); glEnable(GL_BLEND); - glutil_draw_lined_arc(0.0, M_PI*2.0, ts->vpaint->brush->size, 40); + glutil_draw_lined_arc(0.0, M_PI*2.0, brush->size, 40); glDisable(GL_BLEND); glDisable( GL_LINE_SMOOTH ); @@ -152,14 +159,14 @@ static void vp_drawcursor(bContext *C, int x, int y, void *customdata) static void wp_drawcursor(bContext *C, int x, int y, void *customdata) { - ToolSettings *ts= CTX_data_tool_settings(C); - + Brush *brush = paint_brush(&CTX_data_tool_settings(C)->wpaint->paint); + glTranslatef((float)x, (float)y, 0.0f); glColor4ub(200, 200, 255, 128); glEnable( GL_LINE_SMOOTH ); glEnable(GL_BLEND); - glutil_draw_lined_arc(0.0, M_PI*2.0, ts->wpaint->brush->size, 40); + glutil_draw_lined_arc(0.0, M_PI*2.0, brush->size, 40); glDisable(GL_BLEND); glDisable( GL_LINE_SMOOTH ); @@ -232,7 +239,8 @@ unsigned int rgba_to_mcol(float r, float g, float b, float a) static unsigned int vpaint_get_current_col(VPaint *vp) { - return rgba_to_mcol(vp->brush->rgb[0], vp->brush->rgb[1], vp->brush->rgb[2], 1.0f); + Brush *brush = paint_brush(&vp->paint); + return rgba_to_mcol(brush->rgb[0], brush->rgb[1], brush->rgb[2], 1.0f); } void do_shared_vertexcol(Mesh *me) @@ -369,12 +377,12 @@ void clear_vpaint(Scene *scene) unsigned int *to, paintcol; int a; - if((G.f & G_VERTEXPAINT)==0) return; - ob= OBACT; me= get_mesh(ob); if(!ob || ob->id.lib) return; + if(!(ob->mode & OB_MODE_VERTEX_PAINT)) return; + if(me==0 || me->mcol==0 || me->totface==0) return; paintcol= vpaint_get_current_col(scene->toolsettings->vpaint); @@ -540,10 +548,10 @@ void vpaint_dogamma(Scene *scene) int a, temp; unsigned char *cp, gamtab[256]; - if((G.f & G_VERTEXPAINT)==0) return; - ob= OBACT; me= get_mesh(ob); + + if(!(ob->mode & OB_MODE_VERTEX_PAINT)) return; if(me==0 || me->mcol==0 || me->totface==0) return; igam= 1.0/vp->gamma; @@ -721,6 +729,7 @@ static unsigned int mcol_darken(unsigned int col1, unsigned int col2, int fac) static void vpaint_blend(VPaint *vp, unsigned int *col, unsigned int *colorig, unsigned int paintcol, int alpha) { + Brush *brush = paint_brush(&vp->paint); if(vp->mode==VP_MIX || vp->mode==VP_BLUR) *col= mcol_blend( *col, paintcol, alpha); else if(vp->mode==VP_ADD) *col= mcol_add( *col, paintcol, alpha); @@ -734,7 +743,7 @@ static void vpaint_blend(VPaint *vp, unsigned int *col, unsigned int *colorig, u unsigned int testcol=0, a; char *cp, *ct, *co; - alpha= (int)(255.0*vp->brush->alpha); + alpha= (int)(255.0*brush->alpha); if(vp->mode==VP_MIX || vp->mode==VP_BLUR) testcol= mcol_blend( *colorig, paintcol, alpha); else if(vp->mode==VP_ADD) testcol= mcol_add( *colorig, paintcol, alpha); @@ -800,6 +809,7 @@ static int sample_backbuf_area(ViewContext *vc, int *indexar, int totface, int x static int calc_vp_alpha_dl(VPaint *vp, ViewContext *vc, float vpimat[][3], float *vert_nor, short *mval) { + Brush *brush = paint_brush(&vp->paint); float fac, dx, dy; int alpha; short vertco[2]; @@ -810,14 +820,14 @@ static int calc_vp_alpha_dl(VPaint *vp, ViewContext *vc, float vpimat[][3], floa dy= mval[1]-vertco[1]; fac= sqrt(dx*dx + dy*dy); - if(fac > vp->brush->size) return 0; + if(fac > brush->size) return 0; if(vp->flag & VP_HARD) alpha= 255; else - alpha= 255.0*vp->brush->alpha*(1.0-fac/vp->brush->size); + alpha= 255.0*brush->alpha*(1.0-fac/brush->size); } else { - alpha= 255.0*vp->brush->alpha; + alpha= 255.0*brush->alpha; } if(vp->flag & VP_NORMALS) { @@ -839,6 +849,7 @@ static int calc_vp_alpha_dl(VPaint *vp, ViewContext *vc, float vpimat[][3], floa static void wpaint_blend(VPaint *wp, MDeformWeight *dw, MDeformWeight *uw, float alpha, float paintval) { + Brush *brush = paint_brush(&wp->paint); if(dw==NULL || uw==NULL) return; @@ -864,7 +875,7 @@ static void wpaint_blend(VPaint *wp, MDeformWeight *dw, MDeformWeight *uw, float if((wp->flag & VP_SPRAY)==0) { float testw=0.0f; - alpha= wp->brush->alpha; + alpha= brush->alpha; if(wp->mode==VP_MIX || wp->mode==VP_BLUR) testw = paintval*alpha + uw->weight*(1.0-alpha); else if(wp->mode==VP_ADD) @@ -1092,12 +1103,12 @@ static int set_wpaint(bContext *C, wmOperator *op) /* toggle */ if(me && me->totface>=MAXINDEX) { error("Maximum number of faces: %d", MAXINDEX-1); - G.f &= ~G_WEIGHTPAINT; + ob->mode &= ~OB_MODE_WEIGHT_PAINT; return OPERATOR_CANCELLED; } - if(G.f & G_WEIGHTPAINT) G.f &= ~G_WEIGHTPAINT; - else G.f |= G_WEIGHTPAINT; + if(ob->mode & OB_MODE_WEIGHT_PAINT) ob->mode &= ~OB_MODE_WEIGHT_PAINT; + else ob->mode |= OB_MODE_WEIGHT_PAINT; /* Weightpaint works by overriding colors in mesh, @@ -1107,21 +1118,21 @@ static int set_wpaint(bContext *C, wmOperator *op) /* toggle */ */ DAG_object_flush_update(scene, ob, OB_RECALC_DATA); - if(G.f & G_WEIGHTPAINT) { + if(ob->mode & OB_MODE_WEIGHT_PAINT) { Object *par; if(wp==NULL) wp= scene->toolsettings->wpaint= new_vpaint(1); - brush_check_exists(&wp->brush); - + paint_init(&wp->paint, "Brush"); + toggle_paint_cursor(C, 1); mesh_octree_table(ob, NULL, NULL, 's'); /* verify if active weight group is also active bone */ par= modifiers_isDeformedByArmature(ob); - if(par && (par->flag & OB_POSEMODE)) { + if(par && (par->mode & OB_MODE_POSE)) { bPoseChannel *pchan; for(pchan= par->pose->chanbase.first; pchan; pchan= pchan->next) if(pchan->bone->flag & BONE_ACTIVE) @@ -1174,8 +1185,10 @@ void PAINT_OT_weight_paint_toggle(wmOperatorType *ot) static int vpaint_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event) { + Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->vpaint->paint); + toggle_paint_cursor(C, 0); - brush_radial_control_invoke(op, CTX_data_scene(C)->toolsettings->vpaint->brush, 1); + brush_radial_control_invoke(op, brush, 1); return WM_radial_control_invoke(C, op, event); } @@ -1189,13 +1202,15 @@ static int vpaint_radial_control_modal(bContext *C, wmOperator *op, wmEvent *eve static int vpaint_radial_control_exec(bContext *C, wmOperator *op) { - return brush_radial_control_exec(op, CTX_data_scene(C)->toolsettings->vpaint->brush, 1); + Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->vpaint->paint); + return brush_radial_control_exec(op, brush, 1); } static int wpaint_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event) { + Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->wpaint->paint); toggle_paint_cursor(C, 1); - brush_radial_control_invoke(op, CTX_data_scene(C)->toolsettings->wpaint->brush, 1); + brush_radial_control_invoke(op, brush, 1); return WM_radial_control_invoke(C, op, event); } @@ -1209,7 +1224,8 @@ static int wpaint_radial_control_modal(bContext *C, wmOperator *op, wmEvent *eve static int wpaint_radial_control_exec(bContext *C, wmOperator *op) { - return brush_radial_control_exec(op, CTX_data_scene(C)->toolsettings->wpaint->brush, 1); + Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->wpaint->paint); + return brush_radial_control_exec(op, brush, 1); } void PAINT_OT_weight_paint_radial_control(wmOperatorType *ot) @@ -1293,6 +1309,7 @@ static int wpaint_modal(bContext *C, wmOperator *op, wmEvent *event) { ToolSettings *ts= CTX_data_tool_settings(C); VPaint *wp= ts->wpaint; + Brush *brush = paint_brush(&wp->paint); switch(event->type) { case LEFTMOUSE: @@ -1328,7 +1345,7 @@ static int wpaint_modal(bContext *C, wmOperator *op, wmEvent *event) /* which faces are involved */ if(wp->flag & VP_AREA) { - totindex= sample_backbuf_area(vc, indexar, me->totface, mval[0], mval[1], wp->brush->size); + totindex= sample_backbuf_area(vc, indexar, me->totface, mval[0], mval[1], brush->size); } else { indexar[0]= view3d_sample_backbuf(vc, mval[0], mval[1]); @@ -1584,22 +1601,22 @@ static int set_vpaint(bContext *C, wmOperator *op) /* toggle */ me= get_mesh(ob); if(me==NULL || object_data_is_libdata(ob)) { - G.f &= ~G_VERTEXPAINT; + ob->mode &= ~OB_MODE_VERTEX_PAINT; return OPERATOR_PASS_THROUGH; } if(me && me->totface>=MAXINDEX) { error("Maximum number of faces: %d", MAXINDEX-1); - G.f &= ~G_VERTEXPAINT; + ob->mode &= ~OB_MODE_VERTEX_PAINT; return OPERATOR_FINISHED; } if(me && me->mcol==NULL) make_vertexcol(scene, 0); /* toggle: end vpaint */ - if(G.f & G_VERTEXPAINT) { + if(ob->mode & OB_MODE_VERTEX_PAINT) { - G.f &= ~G_VERTEXPAINT; + ob->mode &= ~OB_MODE_VERTEX_PAINT; if(vp) { toggle_paint_cursor(C, 0); @@ -1607,17 +1624,17 @@ static int set_vpaint(bContext *C, wmOperator *op) /* toggle */ } } else { - - G.f |= G_VERTEXPAINT; + ob->mode |= OB_MODE_VERTEX_PAINT; /* Turn off weight painting */ - if (G.f & G_WEIGHTPAINT) + if (ob->mode & OB_MODE_WEIGHT_PAINT) set_wpaint(C, op); if(vp==NULL) vp= scene->toolsettings->vpaint= new_vpaint(0); toggle_paint_cursor(C, 0); - brush_check_exists(&scene->toolsettings->vpaint->brush); + + paint_init(&vp->paint, "Brush"); } if (me) @@ -1696,6 +1713,7 @@ static int vpaint_modal(bContext *C, wmOperator *op, wmEvent *event) { ToolSettings *ts= CTX_data_tool_settings(C); VPaint *vp= ts->vpaint; + Brush *brush = paint_brush(&vp->paint); switch(event->type) { case LEFTMOUSE: @@ -1728,7 +1746,7 @@ static int vpaint_modal(bContext *C, wmOperator *op, wmEvent *event) /* which faces are involved */ if(vp->flag & VP_AREA) { - totindex= sample_backbuf_area(vc, indexar, me->totface, mval[0], mval[1], vp->brush->size); + totindex= sample_backbuf_area(vc, indexar, me->totface, mval[0], mval[1], brush->size); } else { indexar[0]= view3d_sample_backbuf(vc, mval[0], mval[1]); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 90d2eb31355..2a4c553a94c 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -64,6 +64,7 @@ #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_multires.h" +#include "BKE_paint.h" #include "BKE_sculpt.h" #include "BKE_texture.h" #include "BKE_utildefines.h" @@ -217,12 +218,13 @@ static void project(bglMats *mats, const float v[3], short p[2]) shrink the brush. Skipped for grab brush because only the first mouse down size is used, which is small if the user has just touched the pen to the tablet */ -static char brush_size(Sculpt *sd) +static char brush_size(Sculpt *sd, SculptSession *ss) { - float size= sd->brush->size; + Brush *brush = paint_brush(&sd->paint); + float size= brush->size; - if((sd->brush->sculpt_tool != SCULPT_TOOL_GRAB) && (sd->brush->flag & BRUSH_SIZE_PRESSURE)) - size *= sd->session->cache->pressure; + if((brush->sculpt_tool != SCULPT_TOOL_GRAB) && (brush->flag & BRUSH_SIZE_PRESSURE)) + size *= ss->cache->pressure; return size; } @@ -232,17 +234,18 @@ static char brush_size(Sculpt *sd) special multiplier found experimentally to scale the strength factor. */ static float brush_strength(Sculpt *sd, StrokeCache *cache) { + Brush *brush = paint_brush(&sd->paint); /* Primary strength input; square it to make lower values more sensitive */ - float alpha = sd->brush->alpha * sd->brush->alpha; + float alpha = brush->alpha * brush->alpha; - float dir= sd->brush->flag & BRUSH_DIR_IN ? -1 : 1; + float dir= brush->flag & BRUSH_DIR_IN ? -1 : 1; float pressure= 1; float flip= cache->flip ? -1:1; - if(sd->brush->flag & BRUSH_ALPHA_PRESSURE) + if(brush->flag & BRUSH_ALPHA_PRESSURE) pressure *= cache->pressure; - switch(sd->brush->sculpt_tool){ + switch(brush->sculpt_tool){ case SCULPT_TOOL_DRAW: case SCULPT_TOOL_INFLATE: case SCULPT_TOOL_CLAY: @@ -261,7 +264,7 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache) } /* Handles clipping against a mirror modifier and SCULPT_LOCK axis flags */ -static void sculpt_clip(Sculpt *sd, float *co, const float val[3]) +static void sculpt_clip(Sculpt *sd, SculptSession *ss, float *co, const float val[3]) { int i; @@ -269,7 +272,7 @@ static void sculpt_clip(Sculpt *sd, float *co, const float val[3]) if(sd->flags & (SCULPT_LOCK_X << i)) continue; - if((sd->session->cache->flag & (CLIP_X << i)) && (fabs(co[i]) <= sd->session->cache->clip_tolerance[i])) + if((ss->cache->flag & (CLIP_X << i)) && (fabs(co[i]) <= ss->cache->clip_tolerance[i])) co[i]= 0.0f; else co[i]= val[i]; @@ -291,23 +294,24 @@ static void add_norm_if(float view_vec[3], float out[3], float out_flip[3], cons /* Currently only for the draw brush; finds average normal for all active vertices */ -static void calc_area_normal(Sculpt *sd, float out[3], const ListBase* active_verts) +static void calc_area_normal(Sculpt *sd, SculptSession *ss, float out[3], const ListBase* active_verts) { - StrokeCache *cache = sd->session->cache; + Brush *brush = paint_brush(&sd->paint); + StrokeCache *cache = ss->cache; ActiveData *node = active_verts->first; - const int view = 0; /* XXX: should probably be a flag, not number: sd->brush_type==SCULPT_TOOL_DRAW ? sculptmode_brush()->view : 0; */ + const int view = 0; /* XXX: should probably be a flag, not number: brush_type==SCULPT_TOOL_DRAW ? sculptmode_brush()->view : 0; */ float out_flip[3]; float *out_dir = cache->view_normal_symmetry; out[0]=out[1]=out[2] = out_flip[0]=out_flip[1]=out_flip[2] = 0; - if(sd->brush->flag & BRUSH_ANCHORED) { + if(brush->flag & BRUSH_ANCHORED) { for(; node; node = node->next) add_norm_if(out_dir, out, out_flip, cache->orig_norms[node->Index]); } else { for(; node; node = node->next) - add_norm_if(out_dir, out, out_flip, sd->session->mvert[node->Index].no); + add_norm_if(out_dir, out, out_flip, ss->mvert[node->Index].no); } if (out[0]==0.0 && out[1]==0.0 && out[2]==0.0) { @@ -330,7 +334,7 @@ static void do_draw_brush(Sculpt *sd, SculptSession *ss, const ListBase* active_ float area_normal[3]; ActiveData *node= active_verts->first; - calc_area_normal(sd, area_normal, active_verts); + calc_area_normal(sd, ss, area_normal, active_verts); while(node){ float *co= ss->mvert[node->Index].co; @@ -339,7 +343,7 @@ static void do_draw_brush(Sculpt *sd, SculptSession *ss, const ListBase* active_ co[1]+area_normal[1]*ss->cache->radius*node->Fade*ss->cache->scale[1], co[2]+area_normal[2]*ss->cache->radius*node->Fade*ss->cache->scale[2]}; - sculpt_clip(sd, co, val); + sculpt_clip(sd, ss, co, val); node= node->next; } @@ -389,37 +393,37 @@ static void neighbor_average(SculptSession *ss, float avg[3], const int vert) VecCopyf(avg, ss->mvert[vert].co); } -static void do_smooth_brush(Sculpt *s, const ListBase* active_verts) +static void do_smooth_brush(Sculpt *s, SculptSession *ss, const ListBase* active_verts) { ActiveData *node= active_verts->first; int i; for(i = 0; i < 2; ++i) { while(node){ - float *co= s->session->mvert[node->Index].co; + float *co= ss->mvert[node->Index].co; float avg[3], val[3]; - neighbor_average(s->session, avg, node->Index); + neighbor_average(ss, avg, node->Index); val[0] = co[0]+(avg[0]-co[0])*node->Fade; val[1] = co[1]+(avg[1]-co[1])*node->Fade; val[2] = co[2]+(avg[2]-co[2])*node->Fade; - sculpt_clip(s, co, val); + sculpt_clip(s, ss, co, val); node= node->next; } } } -static void do_pinch_brush(Sculpt *s, const ListBase* active_verts) +static void do_pinch_brush(Sculpt *s, SculptSession *ss, const ListBase* active_verts) { ActiveData *node= active_verts->first; while(node) { - float *co= s->session->mvert[node->Index].co; - const float val[3]= {co[0]+(s->session->cache->location[0]-co[0])*node->Fade, - co[1]+(s->session->cache->location[1]-co[1])*node->Fade, - co[2]+(s->session->cache->location[2]-co[2])*node->Fade}; - sculpt_clip(s, co, val); + float *co= ss->mvert[node->Index].co; + const float val[3]= {co[0]+(ss->cache->location[0]-co[0])*node->Fade, + co[1]+(ss->cache->location[1]-co[1])*node->Fade, + co[2]+(ss->cache->location[2]-co[2])*node->Fade}; + sculpt_clip(s, ss, co, val); node= node->next; } } @@ -438,7 +442,7 @@ static void do_grab_brush(Sculpt *sd, SculptSession *ss) VecCopyf(add, grab_delta); VecMulf(add, node->Fade); VecAddf(add, add, co); - sculpt_clip(sd, co, add); + sculpt_clip(sd, ss, co, add); node= node->next; } @@ -454,7 +458,7 @@ static void do_layer_brush(Sculpt *sd, SculptSession *ss, const ListBase *active if(ss->cache->flip) lim = -lim; - calc_area_normal(sd, area_normal, active_verts); + calc_area_normal(sd, ss, area_normal, active_verts); while(node){ float *disp= &ss->layer_disps[node->Index]; @@ -471,16 +475,15 @@ static void do_layer_brush(Sculpt *sd, SculptSession *ss, const ListBase *active val[1] = ss->mesh_co_orig[node->Index][1]+area_normal[1] * *disp*ss->cache->scale[1]; val[2] = ss->mesh_co_orig[node->Index][2]+area_normal[2] * *disp*ss->cache->scale[2]; - sculpt_clip(sd, co, val); + sculpt_clip(sd, ss, co, val); node= node->next; } } -static void do_inflate_brush(Sculpt *s, const ListBase *active_verts) +static void do_inflate_brush(Sculpt *s, SculptSession *ss, const ListBase *active_verts) { ActiveData *node= active_verts->first; - SculptSession *ss = s->session; float add[3]; while(node) { @@ -496,7 +499,7 @@ static void do_inflate_brush(Sculpt *s, const ListBase *active_verts) add[2]*= ss->cache->scale[2]; VecAddf(add, add, co); - sculpt_clip(s, co, add); + sculpt_clip(s, ss, co, add); node= node->next; } @@ -546,7 +549,7 @@ static void do_flatten_clay_brush(Sculpt *sd, SculptSession *ss, const ListBase float area_normal[3]; float cntr[3], cntr2[3], bstr; - calc_area_normal(sd, area_normal, active_verts); + calc_area_normal(sd, ss, area_normal, active_verts); calc_flatten_center(ss, node, cntr); if(clay) { @@ -589,7 +592,7 @@ static void do_flatten_clay_brush(Sculpt *sd, SculptSession *ss, const ListBase VecMulf(val, fabs(node->Fade)); VecAddf(val, val, co); - sculpt_clip(sd, co, val); + sculpt_clip(sd, ss, co, val); } node= node->next; @@ -651,35 +654,29 @@ static float get_texcache_pixel_bilinear(const SculptSession *ss, float u, float } /* Return a multiplier for brush strength on a particular vertex. */ -static float tex_strength(Sculpt *sd, float *point, const float len) +static float tex_strength(Sculpt *sd, SculptSession *ss, float *point, const float len) { - SculptSession *ss= sd->session; - Brush *br = sd->brush; + Brush *br = paint_brush(&sd->paint); + MTex *tex = NULL; float avg= 1; - if(br->texact==-1 || !br->mtex[br->texact]) + if(br->texact >= 0) + tex = br->mtex[br->texact]; + + if(!tex) { avg= 1; - else if(br->tex_mode==BRUSH_TEX_3D) { - /* Get strength by feeding the vertex location directly - into a texture */ + } + else if(tex->brush_map_mode == MTEX_MAP_MODE_3D) { float jnk; - const float factor= 0.01; - MTex mtex; - memset(&mtex,0,sizeof(MTex)); - mtex.tex= br->mtex[br->texact]->tex; - mtex.projx= 1; - mtex.projy= 2; - mtex.projz= 3; - VecCopyf(mtex.size, br->mtex[br->texact]->size); - VecMulf(mtex.size, factor); - if(!sd->texsep) - mtex.size[1]= mtex.size[2]= mtex.size[0]; - - externtex(&mtex,point,&avg,&jnk,&jnk,&jnk,&jnk); + + /* Get strength by feeding the vertex + location directly into a texture */ + externtex(tex, point, &avg, + &jnk, &jnk, &jnk, &jnk); } else if(ss->texcache) { const float bsize= ss->cache->pixel_radius * 2; - const float rot= sd->brush->rot + ss->cache->rotation; + const float rot= tex->rot + ss->cache->rotation; int px, py; float flip[3], point_2d[2]; @@ -692,9 +689,9 @@ static float tex_strength(Sculpt *sd, float *point, const float len) /* For Tile and Drag modes, get the 2D screen coordinates of the and scale them up or down to the texture size. */ - if(br->tex_mode==BRUSH_TEX_TILE) { - const int sx= (const int)br->mtex[br->texact]->size[0]; - const int sy= (const int)sd->texsep ? br->mtex[br->texact]->size[1] : sx; + if(tex->brush_map_mode == MTEX_MAP_MODE_TILED) { + const int sx= (const int)tex->size[0]; + const int sy= (const int)tex->size[1]; float fx= point_2d[0]; float fy= point_2d[1]; @@ -714,7 +711,8 @@ static float tex_strength(Sculpt *sd, float *point, const float len) if(sy != 1) py %= sy-1; avg= get_texcache_pixel_bilinear(ss, ss->texcache_side*px/sx, ss->texcache_side*py/sy); - } else { + } + else if(tex->brush_map_mode == MTEX_MAP_MODE_FIXED) { float fx= (point_2d[0] - ss->cache->mouse[0]) / bsize; float fy= (point_2d[1] - ss->cache->mouse[1]) / bsize; @@ -728,7 +726,7 @@ static float tex_strength(Sculpt *sd, float *point, const float len) } } - avg*= brush_curve_strength(sd->brush, len, ss->cache->radius); /* Falloff curve */ + avg*= brush_curve_strength(br, len, ss->cache->radius); /* Falloff curve */ return avg; } @@ -766,9 +764,9 @@ static void sculpt_add_damaged_rect(SculptSession *ss) } } -static void do_brush_action(Sculpt *sd, StrokeCache *cache) +static void do_brush_action(Sculpt *sd, SculptSession *ss, StrokeCache *cache) { - SculptSession *ss = sd->session; + Brush *brush = paint_brush(&sd->paint); float av_dist; ListBase active_verts={0,0}; ListBase *grab_active_verts = &ss->cache->grab_active_verts[ss->cache->symmetry]; @@ -777,7 +775,7 @@ static void do_brush_action(Sculpt *sd, StrokeCache *cache) Mesh *me= NULL; /*XXX: get_mesh(OBACT); */ const float bstrength= brush_strength(sd, cache); KeyBlock *keyblock= NULL; /*XXX: ob_get_keyblock(OBACT); */ - Brush *b = sd->brush; + Brush *b = brush; int i; sculpt_add_damaged_rect(ss); @@ -797,7 +795,7 @@ static void do_brush_action(Sculpt *sd, StrokeCache *cache) adata->Index = i; /* Fade is used to store the final strength at which the brush should modify a particular vertex. */ - adata->Fade= tex_strength(sd, vert, av_dist) * bstrength; + adata->Fade= tex_strength(sd, ss, vert, av_dist) * bstrength; adata->dist = av_dist; if(b->sculpt_tool == SCULPT_TOOL_GRAB && cache->first_time) @@ -817,13 +815,13 @@ static void do_brush_action(Sculpt *sd, StrokeCache *cache) do_draw_brush(sd, ss, &active_verts); break; case SCULPT_TOOL_SMOOTH: - do_smooth_brush(sd, &active_verts); + do_smooth_brush(sd, ss, &active_verts); break; case SCULPT_TOOL_PINCH: - do_pinch_brush(sd, &active_verts); + do_pinch_brush(sd, ss, &active_verts); break; case SCULPT_TOOL_INFLATE: - do_inflate_brush(sd, &active_verts); + do_inflate_brush(sd, ss, &active_verts); break; case SCULPT_TOOL_GRAB: do_grab_brush(sd, ss); @@ -872,20 +870,21 @@ static void calc_brushdata_symm(StrokeCache *cache, const char symm) cache->symmetry= symm; } -static void do_symmetrical_brush_actions(Sculpt *sd, StrokeCache *cache) +static void do_symmetrical_brush_actions(Sculpt *sd, SculptSession *ss) { + StrokeCache *cache = ss->cache; const char symm = sd->flags & 7; int i; VecCopyf(cache->location, cache->true_location); VecCopyf(cache->grab_delta_symmetry, cache->grab_delta); cache->symmetry = 0; - do_brush_action(sd, cache); + do_brush_action(sd, ss, cache); for(i = 1; i <= symm; ++i) { if(symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5))) { calc_brushdata_symm(cache, i); - do_brush_action(sd, cache); + do_brush_action(sd, ss, cache); } } @@ -958,9 +957,9 @@ static void projverts_clear_inside(SculptSession *ss) } #endif -static void sculpt_update_tex(Sculpt *sd) +static void sculpt_update_tex(Sculpt *sd, SculptSession *ss) { - SculptSession *ss= sd->session; + Brush *brush = paint_brush(&sd->paint); if(ss->texcache) { MEM_freeN(ss->texcache); @@ -968,9 +967,9 @@ static void sculpt_update_tex(Sculpt *sd) } /* Need to allocate a bigger buffer for bigger brush size */ - ss->texcache_side = sd->brush->size * 2; + ss->texcache_side = brush->size * 2; if(!ss->texcache || ss->texcache_side > ss->texcache_actual) { - ss->texcache = brush_gen_texture_cache(sd->brush, sd->brush->size); + ss->texcache = brush_gen_texture_cache(brush, brush->size); ss->texcache_actual = ss->texcache_side; } } @@ -1021,8 +1020,8 @@ static struct MultiresModifierData *sculpt_multires_active(Object *ob) static void sculpt_update_mesh_elements(bContext *C) { - SculptSession *ss = CTX_data_tool_settings(C)->sculpt->session; Object *ob = CTX_data_active_object(C); + SculptSession *ss = ob->sculpt; int oldtotvert = ss->totvert; if((ss->multires = sculpt_multires_active(ob))) { @@ -1055,12 +1054,14 @@ static void sculpt_update_mesh_elements(bContext *C) static int sculpt_mode_poll(bContext *C) { - return G.f & G_SCULPTMODE; + Object *ob = CTX_data_active_object(C); + return ob && ob->mode & OB_MODE_SCULPT; } static int sculpt_poll(bContext *C) { - return G.f & G_SCULPTMODE && CTX_wm_area(C)->spacetype == SPACE_VIEW3D && + return sculpt_mode_poll(C) && paint_brush(&CTX_data_tool_settings(C)->sculpt->paint) && + CTX_wm_area(C)->spacetype == SPACE_VIEW3D && CTX_wm_region(C)->regiontype == RGN_TYPE_WINDOW; } @@ -1068,18 +1069,20 @@ static int sculpt_poll(bContext *C) static void draw_paint_cursor(bContext *C, int x, int y, void *customdata) { Sculpt *sd= CTX_data_tool_settings(C)->sculpt; + SculptSession *ss= CTX_data_active_object(C)->sculpt; + Brush *brush = paint_brush(&sd->paint); glColor4ub(255, 100, 100, 128); glEnable( GL_LINE_SMOOTH ); glEnable(GL_BLEND); glTranslatef((float)x, (float)y, 0.0f); - glutil_draw_lined_arc(0.0, M_PI*2.0, sd->brush->size, 40); + glutil_draw_lined_arc(0.0, M_PI*2.0, brush->size, 40); glTranslatef((float)-x, (float)-y, 0.0f); - if(sd->session && sd->session->cache && sd->brush && (sd->brush->flag & BRUSH_SMOOTH_STROKE)) { + if(ss && ss->cache && brush && (brush->flag & BRUSH_SMOOTH_STROKE)) { ARegion *ar = CTX_wm_region(C); - sdrawline(x, y, sd->session->cache->mouse[0] - ar->winrct.xmin, sd->session->cache->mouse[1] - ar->winrct.ymin); + sdrawline(x, y, ss->cache->mouse[0] - ar->winrct.xmin, ss->cache->mouse[1] - ar->winrct.ymin); } glDisable(GL_BLEND); @@ -1090,19 +1093,21 @@ static void toggle_paint_cursor(bContext *C) { Sculpt *s = CTX_data_scene(C)->toolsettings->sculpt; - if(s->session->cursor) { - WM_paint_cursor_end(CTX_wm_manager(C), s->session->cursor); - s->session->cursor = NULL; + if(s->cursor) { + WM_paint_cursor_end(CTX_wm_manager(C), s->cursor); + s->cursor = NULL; } else { - s->session->cursor = + s->cursor = WM_paint_cursor_activate(CTX_wm_manager(C), sculpt_poll, draw_paint_cursor, NULL); } } static void sculpt_undo_push(bContext *C, Sculpt *sd) { - switch(sd->brush->sculpt_tool) { + Brush *brush = paint_brush(&sd->paint); + + switch(brush->sculpt_tool) { case SCULPT_TOOL_DRAW: ED_undo_push(C, "Draw Brush"); break; case SCULPT_TOOL_SMOOTH: @@ -1122,36 +1127,12 @@ static void sculpt_undo_push(bContext *C, Sculpt *sd) } } -static int sculpt_brush_curve_preset_exec(bContext *C, wmOperator *op) -{ - brush_curve_preset(CTX_data_scene(C)->toolsettings->sculpt->brush, RNA_enum_get(op->ptr, "mode")); - return OPERATOR_FINISHED; -} - -static void SCULPT_OT_brush_curve_preset(wmOperatorType *ot) -{ - static EnumPropertyItem prop_mode_items[] = { - {BRUSH_PRESET_SHARP, "SHARP", 0, "Sharp Curve", ""}, - {BRUSH_PRESET_SMOOTH, "SMOOTH", 0, "Smooth Curve", ""}, - {BRUSH_PRESET_MAX, "MAX", 0, "Max Curve", ""}, - {0, NULL, 0, NULL, NULL}}; - - ot->name= "Preset"; - ot->idname= "SCULPT_OT_brush_curve_preset"; - - ot->exec= sculpt_brush_curve_preset_exec; - ot->poll= sculpt_mode_poll; - - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - - RNA_def_enum(ot->srna, "mode", prop_mode_items, BRUSH_PRESET_SHARP, "Mode", ""); -} - /**** Radial control ****/ static int sculpt_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event) { + Brush *brush = paint_brush(&CTX_data_tool_settings(C)->sculpt->paint); toggle_paint_cursor(C); - brush_radial_control_invoke(op, CTX_data_scene(C)->toolsettings->sculpt->brush, 1); + brush_radial_control_invoke(op, brush, 1); return WM_radial_control_invoke(C, op, event); } @@ -1165,7 +1146,9 @@ static int sculpt_radial_control_modal(bContext *C, wmOperator *op, wmEvent *eve static int sculpt_radial_control_exec(bContext *C, wmOperator *op) { - return brush_radial_control_exec(op, CTX_data_scene(C)->toolsettings->sculpt->brush, 1); + Brush *brush = paint_brush(&CTX_data_tool_settings(C)->sculpt->paint); + + return brush_radial_control_exec(op, brush, 1); } static void SCULPT_OT_radial_control(wmOperatorType *ot) @@ -1209,12 +1192,13 @@ static void sculpt_cache_free(StrokeCache *cache) } /* Initialize the stroke cache invariants from operator properties */ -static void sculpt_update_cache_invariants(Sculpt *sd, bContext *C, wmOperator *op) +static void sculpt_update_cache_invariants(Sculpt *sd, SculptSession *ss, bContext *C, wmOperator *op) { StrokeCache *cache = MEM_callocN(sizeof(StrokeCache), "stroke cache"); + Brush *brush = paint_brush(&sd->paint); int i; - sd->session->cache = cache; + ss->cache = cache; RNA_float_get_array(op->ptr, "scale", cache->scale); cache->flag = RNA_int_get(op->ptr, "flag"); @@ -1235,72 +1219,74 @@ static void sculpt_update_cache_invariants(Sculpt *sd, bContext *C, wmOperator * sculpt_update_mesh_elements(C); /* Initialize layer brush displacements */ - if(sd->brush->sculpt_tool == SCULPT_TOOL_LAYER && - (!sd->session->layer_disps || !(sd->brush->flag & BRUSH_PERSISTENT))) { - if(sd->session->layer_disps) - MEM_freeN(sd->session->layer_disps); - sd->session->layer_disps = MEM_callocN(sizeof(float) * sd->session->totvert, "layer brush displacements"); + if(brush->sculpt_tool == SCULPT_TOOL_LAYER && + (!ss->layer_disps || !(brush->flag & BRUSH_PERSISTENT))) { + if(ss->layer_disps) + MEM_freeN(ss->layer_disps); + ss->layer_disps = MEM_callocN(sizeof(float) * ss->totvert, "layer brush displacements"); } /* Make copies of the mesh vertex locations and normals for some tools */ - if(sd->brush->sculpt_tool == SCULPT_TOOL_LAYER || (sd->brush->flag & BRUSH_ANCHORED)) { - if(sd->brush->sculpt_tool != SCULPT_TOOL_LAYER || - !sd->session->mesh_co_orig || !(sd->brush->flag & BRUSH_PERSISTENT)) { - if(!sd->session->mesh_co_orig) - sd->session->mesh_co_orig= MEM_mallocN(sizeof(float) * 3 * sd->session->totvert, + if(brush->sculpt_tool == SCULPT_TOOL_LAYER || (brush->flag & BRUSH_ANCHORED)) { + if(brush->sculpt_tool != SCULPT_TOOL_LAYER || + !ss->mesh_co_orig || !(brush->flag & BRUSH_PERSISTENT)) { + if(!ss->mesh_co_orig) + ss->mesh_co_orig= MEM_mallocN(sizeof(float) * 3 * ss->totvert, "sculpt mesh vertices copy"); - for(i = 0; i < sd->session->totvert; ++i) - VecCopyf(sd->session->mesh_co_orig[i], sd->session->mvert[i].co); + for(i = 0; i < ss->totvert; ++i) + VecCopyf(ss->mesh_co_orig[i], ss->mvert[i].co); } - if(sd->brush->flag & BRUSH_ANCHORED) { - cache->orig_norms= MEM_mallocN(sizeof(short) * 3 * sd->session->totvert, "Sculpt orig norm"); - for(i = 0; i < sd->session->totvert; ++i) { - cache->orig_norms[i][0] = sd->session->mvert[i].no[0]; - cache->orig_norms[i][1] = sd->session->mvert[i].no[1]; - cache->orig_norms[i][2] = sd->session->mvert[i].no[2]; + if(brush->flag & BRUSH_ANCHORED) { + cache->orig_norms= MEM_mallocN(sizeof(short) * 3 * ss->totvert, "Sculpt orig norm"); + for(i = 0; i < ss->totvert; ++i) { + cache->orig_norms[i][0] = ss->mvert[i].no[0]; + cache->orig_norms[i][1] = ss->mvert[i].no[1]; + cache->orig_norms[i][2] = ss->mvert[i].no[2]; } - if(sd->session->face_normals) { - float *fn = sd->session->face_normals; - cache->face_norms= MEM_mallocN(sizeof(float) * 3 * sd->session->totface, "Sculpt face norms"); - for(i = 0; i < sd->session->totface; ++i, fn += 3) + if(ss->face_normals) { + float *fn = ss->face_normals; + cache->face_norms= MEM_mallocN(sizeof(float) * 3 * ss->totface, "Sculpt face norms"); + for(i = 0; i < ss->totface; ++i, fn += 3) VecCopyf(cache->face_norms[i], fn); } } } unproject(cache->mats, cache->true_location, cache->initial_mouse[0], cache->initial_mouse[1], cache->depth); - cache->radius = unproject_brush_radius(sd->session, brush_size(sd)); + cache->radius = unproject_brush_radius(ss, brush_size(sd, ss)); cache->rotation = 0; cache->first_time = 1; } /* Initialize the stroke cache variants from operator properties */ -static void sculpt_update_cache_variants(Sculpt *sd, PointerRNA *ptr) +static void sculpt_update_cache_variants(Sculpt *sd, SculptSession *ss, PointerRNA *ptr) { - StrokeCache *cache = sd->session->cache; + StrokeCache *cache = ss->cache; + Brush *brush = paint_brush(&sd->paint); float grab_location[3]; int dx, dy; - if(!(sd->brush->flag & BRUSH_ANCHORED)) + if(!(brush->flag & BRUSH_ANCHORED)) RNA_float_get_array(ptr, "location", cache->true_location); cache->flip = RNA_boolean_get(ptr, "flip"); RNA_int_get_array(ptr, "mouse", cache->mouse); + cache->pressure = RNA_float_get(ptr, "pressure"); /* Truly temporary data that isn't stored in properties */ cache->previous_pixel_radius = cache->pixel_radius; - cache->pixel_radius = brush_size(sd); + cache->pixel_radius = brush_size(sd, ss); - if(sd->brush->flag & BRUSH_ANCHORED) { + if(brush->flag & BRUSH_ANCHORED) { dx = cache->mouse[0] - cache->initial_mouse[0]; dy = cache->mouse[1] - cache->initial_mouse[1]; cache->pixel_radius = sqrt(dx*dx + dy*dy); - cache->radius = unproject_brush_radius(sd->session, cache->pixel_radius); + cache->radius = unproject_brush_radius(ss, cache->pixel_radius); cache->rotation = atan2(dy, dx); } - else if(sd->brush->flag & BRUSH_RAKE) { + else if(brush->flag & BRUSH_RAKE) { int update; dx = cache->last_rake[0] - cache->mouse[0]; @@ -1319,7 +1305,7 @@ static void sculpt_update_cache_variants(Sculpt *sd, PointerRNA *ptr) } /* Find the grab delta */ - if(sd->brush->sculpt_tool == SCULPT_TOOL_GRAB) { + if(brush->sculpt_tool == SCULPT_TOOL_GRAB) { unproject(cache->mats, grab_location, cache->mouse[0], cache->mouse[1], cache->depth); if(!cache->first_time) VecSubf(cache->grab_delta, grab_location, cache->old_grab_location); @@ -1368,19 +1354,20 @@ static void sculpt_brush_stroke_init_properties(bContext *C, wmOperator *op, wmE view3d_set_viewcontext(C, &vc); RNA_float_set(op->ptr, "depth", read_cached_depth(&vc, event->x, event->y)); - sculpt_update_cache_invariants(sd, C, op); + sculpt_update_cache_invariants(sd, ss, C, op); } static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *event) { Sculpt *sd = CTX_data_tool_settings(C)->sculpt; + SculptSession *ss = CTX_data_active_object(C)->sculpt; view3d_operator_needs_opengl(C); /* TODO: Shouldn't really have to do this at the start of every stroke, but sculpt would need some sort of notification when changes are made to the texture. */ - sculpt_update_tex(sd); + sculpt_update_tex(sd, ss); /* add modal handler */ WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op); @@ -1388,14 +1375,14 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *even return OPERATOR_RUNNING_MODAL; } -static void sculpt_restore_mesh(Sculpt *sd) +static void sculpt_restore_mesh(Sculpt *sd, SculptSession *ss) { - SculptSession *ss = sd->session; StrokeCache *cache = ss->cache; + Brush *brush = paint_brush(&sd->paint); int i; /* Restore the mesh before continuing with anchored stroke */ - if((sd->brush->flag & BRUSH_ANCHORED) && ss->mesh_co_orig) { + if((brush->flag & BRUSH_ANCHORED) && ss->mesh_co_orig) { for(i = 0; i < ss->totvert; ++i) { VecCopyf(ss->mvert[i].co, ss->mesh_co_orig[i]); ss->mvert[i].no[0] = cache->orig_norms[i][0]; @@ -1409,7 +1396,7 @@ static void sculpt_restore_mesh(Sculpt *sd) VecCopyf(fn, cache->face_norms[i]); } - if(sd->brush->sculpt_tool == SCULPT_TOOL_LAYER) + if(brush->sculpt_tool == SCULPT_TOOL_LAYER) memset(ss->layer_disps, 0, sizeof(float) * ss->totvert); } } @@ -1422,32 +1409,35 @@ static void sculpt_post_stroke_free(SculptSession *ss) static void sculpt_flush_update(bContext *C) { - Sculpt *s = CTX_data_tool_settings(C)->sculpt; + Object *ob = CTX_data_active_object(C); + SculptSession *ss = ob->sculpt; ARegion *ar = CTX_wm_region(C); - MultiresModifierData *mmd = s->session->multires; + MultiresModifierData *mmd = ss->multires; - calc_damaged_verts(s->session); + calc_damaged_verts(ss); if(mmd) { - if(mmd->undo_verts && mmd->undo_verts != s->session->mvert) + if(mmd->undo_verts && mmd->undo_verts != ss->mvert) MEM_freeN(mmd->undo_verts); - mmd->undo_verts = s->session->mvert; - mmd->undo_verts_tot = s->session->totvert; - multires_mark_as_modified(CTX_data_active_object(C)); + mmd->undo_verts = ss->mvert; + mmd->undo_verts_tot = ss->totvert; + multires_mark_as_modified(ob); } ED_region_tag_redraw(ar); } /* Returns zero if no sculpt changes should be made, non-zero otherwise */ -static int sculpt_smooth_stroke(Sculpt *s, int output[2], wmEvent *event) +static int sculpt_smooth_stroke(Sculpt *s, SculptSession *ss, int output[2], wmEvent *event) { + Brush *brush = paint_brush(&s->paint); + output[0] = event->x; output[1] = event->y; - if(s->brush->flag & BRUSH_SMOOTH_STROKE && s->brush->sculpt_tool != SCULPT_TOOL_GRAB) { - StrokeCache *cache = s->session->cache; + if(brush->flag & BRUSH_SMOOTH_STROKE && brush->sculpt_tool != SCULPT_TOOL_GRAB) { + StrokeCache *cache = ss->cache; float u = .9, v = 1.0 - u; int dx = cache->mouse[0] - event->x, dy = cache->mouse[1] - event->y; int radius = 50; @@ -1467,7 +1457,7 @@ static int sculpt_smooth_stroke(Sculpt *s, int output[2], wmEvent *event) /* Returns zero if the stroke dots should not be spaced, non-zero otherwise */ int sculpt_space_stroke_enabled(Sculpt *s) { - Brush *br = s->brush; + Brush *br = paint_brush(&s->paint); return (br->flag & BRUSH_SPACE) && !(br->flag & BRUSH_ANCHORED) && (br->sculpt_tool != SCULPT_TOOL_GRAB); } @@ -1475,30 +1465,40 @@ int sculpt_space_stroke_enabled(Sculpt *s) static void sculpt_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *event, int mouse[2]) { Sculpt *sd = CTX_data_tool_settings(C)->sculpt; - StrokeCache *cache = sd->session->cache; + SculptSession *ss = CTX_data_active_object(C)->sculpt; + StrokeCache *cache = ss->cache; PointerRNA itemptr; - float cur_depth; + float cur_depth, pressure = 1; float center[3]; cur_depth = read_cached_depth(&cache->vc, mouse[0], mouse[1]); - unproject(sd->session->cache->mats, center, mouse[0], mouse[1], cur_depth); + unproject(ss->cache->mats, center, mouse[0], mouse[1], cur_depth); + + /* Tablet */ + if(event->custom == EVT_DATA_TABLET) { + wmTabletData *wmtab= event->customdata; + if(wmtab->Active != EVT_TABLET_NONE) + pressure= wmtab->Pressure; + } /* Add to stroke */ RNA_collection_add(op->ptr, "stroke", &itemptr); RNA_float_set_array(&itemptr, "location", center); RNA_int_set_array(&itemptr, "mouse", mouse); RNA_boolean_set(&itemptr, "flip", event->shift); - sculpt_update_cache_variants(sd, &itemptr); + RNA_float_set(&itemptr, "pressure", pressure); + sculpt_update_cache_variants(sd, ss, &itemptr); - sculpt_restore_mesh(sd); - do_symmetrical_brush_actions(sd, cache); + sculpt_restore_mesh(sd, ss); + do_symmetrical_brush_actions(sd, ss); } /* For brushes with stroke spacing enabled, moves mouse in steps towards the final mouse location. */ -static int sculpt_space_stroke(bContext *C, wmOperator *op, wmEvent *event, Sculpt *s, const int final_mouse[2]) +static int sculpt_space_stroke(bContext *C, wmOperator *op, wmEvent *event, Sculpt *s, SculptSession *ss, const int final_mouse[2]) { - StrokeCache *cache = s->session->cache; + StrokeCache *cache = ss->cache; + Brush *brush = paint_brush(&s->paint); int cnt = 0; if(sculpt_space_stroke_enabled(s)) { @@ -1511,11 +1511,11 @@ static int sculpt_space_stroke(bContext *C, wmOperator *op, wmEvent *event, Scul length = sqrt(vec[0]*vec[0] + vec[1]*vec[1]); if(length > FLT_EPSILON) { - scale = s->brush->spacing / length; + scale = brush->spacing / length; vec[0] *= scale; vec[1] *= scale; - steps = (int)(length / s->brush->spacing); + steps = (int)(length / brush->spacing); for(i = 0; i < steps; ++i, ++cnt) { mouse[0] += vec[0]; mouse[1] += vec[1]; @@ -1530,38 +1530,39 @@ static int sculpt_space_stroke(bContext *C, wmOperator *op, wmEvent *event, Scul static int sculpt_brush_stroke_modal(bContext *C, wmOperator *op, wmEvent *event) { Sculpt *sd = CTX_data_tool_settings(C)->sculpt; + SculptSession *ss = CTX_data_active_object(C)->sculpt; ARegion *ar = CTX_wm_region(C); float cur_depth; sculpt_update_mesh_elements(C); - if(!sd->session->cache) { + if(!ss->cache) { ViewContext vc; view3d_set_viewcontext(C, &vc); cur_depth = read_cached_depth(&vc, event->x, event->y); /* Don't start the stroke until a valid depth is found */ if(cur_depth < 1.0 - FLT_EPSILON) { - sculpt_brush_stroke_init_properties(C, op, event, sd->session); - sculptmode_update_all_projverts(sd->session); + sculpt_brush_stroke_init_properties(C, op, event, ss); + sculptmode_update_all_projverts(ss); } ED_region_tag_redraw(ar); } - if(sd->session->cache) { + if(ss->cache) { int mouse[2]; - if(sculpt_smooth_stroke(sd, mouse, event)) { + if(sculpt_smooth_stroke(sd, ss, mouse, event)) { if(sculpt_space_stroke_enabled(sd)) { - if(!sculpt_space_stroke(C, op, event, sd, mouse)) + if(!sculpt_space_stroke(C, op, event, sd, ss, mouse)) ED_region_tag_redraw(ar); } else sculpt_brush_stroke_add_step(C, op, event, mouse); sculpt_flush_update(C); - sculpt_post_stroke_free(sd->session); + sculpt_post_stroke_free(ss); } else ED_region_tag_redraw(ar); @@ -1569,10 +1570,10 @@ static int sculpt_brush_stroke_modal(bContext *C, wmOperator *op, wmEvent *event /* Finished */ if(event->type == LEFTMOUSE && event->val == 0) { - if(sd->session->cache) { - request_depth_update(sd->session->cache->vc.rv3d); - sculpt_cache_free(sd->session->cache); - sd->session->cache = NULL; + if(ss->cache) { + request_depth_update(ss->cache->vc.rv3d); + sculpt_cache_free(ss->cache); + ss->cache = NULL; sculpt_undo_push(C, sd); } @@ -1585,24 +1586,25 @@ static int sculpt_brush_stroke_modal(bContext *C, wmOperator *op, wmEvent *event static int sculpt_brush_stroke_exec(bContext *C, wmOperator *op) { Sculpt *sd = CTX_data_tool_settings(C)->sculpt; + SculptSession *ss = CTX_data_active_object(C)->sculpt; view3d_operator_needs_opengl(C); - sculpt_update_cache_invariants(sd, C, op); - sculptmode_update_all_projverts(sd->session); - sculpt_update_tex(sd); + sculpt_update_cache_invariants(sd, ss, C, op); + sculptmode_update_all_projverts(ss); + sculpt_update_tex(sd, ss); RNA_BEGIN(op->ptr, itemptr, "stroke") { - sculpt_update_cache_variants(sd, &itemptr); + sculpt_update_cache_variants(sd, ss, &itemptr); - sculpt_restore_mesh(sd); - do_symmetrical_brush_actions(sd, sd->session->cache); + sculpt_restore_mesh(sd, ss); + do_symmetrical_brush_actions(sd, ss); - sculpt_post_stroke_free(sd->session); + sculpt_post_stroke_free(ss); } RNA_END; sculpt_flush_update(C); - sculpt_cache_free(sd->session->cache); + sculpt_cache_free(ss->cache); sculpt_undo_push(C, sd); @@ -1649,7 +1651,7 @@ static void SCULPT_OT_brush_stroke(wmOperatorType *ot) static int sculpt_set_persistent_base(bContext *C, wmOperator *op) { - SculptSession *ss = CTX_data_tool_settings(C)->sculpt->session; + SculptSession *ss = CTX_data_active_object(C)->sculpt; if(ss) { if(ss->layer_disps) @@ -1682,35 +1684,34 @@ static void SCULPT_OT_set_persistent_base(wmOperatorType *ot) static int sculpt_toggle_mode(bContext *C, wmOperator *op) { ToolSettings *ts = CTX_data_tool_settings(C); + Object *ob = CTX_data_active_object(C); - if(G.f & G_SCULPTMODE) { - multires_force_update(CTX_data_active_object(C)); + if(ob->mode & OB_MODE_SCULPT) { + multires_force_update(ob); /* Leave sculptmode */ - G.f &= ~G_SCULPTMODE; - - toggle_paint_cursor(C); + ob->mode &= ~OB_MODE_SCULPT; - sculptsession_free(ts->sculpt); + free_sculptsession(&ob->sculpt); } else { /* Enter sculptmode */ - G.f |= G_SCULPTMODE; + ob->mode |= OB_MODE_SCULPT; /* Create persistent sculpt mode data */ if(!ts->sculpt) ts->sculpt = MEM_callocN(sizeof(Sculpt), "sculpt mode data"); /* Create sculpt mode session data */ - if(ts->sculpt->session) - MEM_freeN(ts->sculpt->session); - ts->sculpt->session = MEM_callocN(sizeof(SculptSession), "sculpt session"); + if(ob->sculpt) + free_sculptsession(&ob->sculpt); + ob->sculpt = MEM_callocN(sizeof(SculptSession), "sculpt session"); - toggle_paint_cursor(C); + if(!ts->sculpt->cursor) + toggle_paint_cursor(C); - /* If there's no brush, create one */ - brush_check_exists(&ts->sculpt->brush); + paint_init(&ts->sculpt->paint, "Brush"); WM_event_add_notifier(C, NC_SCENE|ND_MODE, CTX_data_scene(C)); } @@ -1736,6 +1737,5 @@ void ED_operatortypes_sculpt() WM_operatortype_append(SCULPT_OT_radial_control); WM_operatortype_append(SCULPT_OT_brush_stroke); WM_operatortype_append(SCULPT_OT_sculptmode_toggle); - WM_operatortype_append(SCULPT_OT_brush_curve_preset); WM_operatortype_append(SCULPT_OT_set_persistent_base); } diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index f5fa263eee8..4fb22064c17 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -397,7 +397,7 @@ static void action_icu_buts(SpaceAction *saction) /* Channel List */ /* left hand part */ -void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar) +void draw_channel_names(bContext *C, bAnimContext *ac, SpaceAction *saction, ARegion *ar) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -428,22 +428,48 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar) UI_view2d_sync(NULL, ac->sa, v2d, V2D_VIEWSYNC_AREA_VERTICAL); /* loop through channels, and set up drawing depending on their type */ - y= (float)ACHANNEL_FIRST; - - for (ale= anim_data.first; ale; ale= ale->next) { - float yminc= (float)(y - ACHANNEL_HEIGHT_HALF); - float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF); + { /* first pass: just the standard GL-drawing for backdrop + text */ + y= (float)ACHANNEL_FIRST; - /* check if visible */ - if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || - IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) - { - /* draw all channels using standard channel-drawing API */ - ANIM_channel_draw(ac, ale, yminc, ymaxc); + for (ale= anim_data.first; ale; ale= ale->next) { + float yminc= (float)(y - ACHANNEL_HEIGHT_HALF); + float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF); + + /* check if visible */ + if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || + IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) + { + /* draw all channels using standard channel-drawing API */ + ANIM_channel_draw(ac, ale, yminc, ymaxc); + } + + /* adjust y-position for next one */ + y -= ACHANNEL_STEP; } + } + { /* second pass: widgets */ + uiBlock *block= uiBeginBlock(C, ar, "dopesheet channel buttons", UI_EMBOSS); - /* adjust y-position for next one */ - y -= ACHANNEL_STEP; + y= (float)ACHANNEL_FIRST; + + for (ale= anim_data.first; ale; ale= ale->next) { + float yminc= (float)(y - ACHANNEL_HEIGHT_HALF); + float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF); + + /* check if visible */ + if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || + IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) + { + /* draw all channels using standard channel-drawing API */ + ANIM_channel_draw_widgets(ac, ale, block, yminc, ymaxc); + } + + /* adjust y-position for next one */ + y -= ACHANNEL_STEP; + } + + uiEndBlock(C, block); + uiDrawBlock(C, block); } /* free tempolary channels */ diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h index 26655892176..1aeeeff0c80 100644 --- a/source/blender/editors/space_action/action_intern.h +++ b/source/blender/editors/space_action/action_intern.h @@ -41,7 +41,7 @@ struct bAnimListElem; /* ***************************************** */ /* action_draw.c */ -void draw_channel_names(struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar); +void draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar); void draw_channel_strips(struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar); struct ActKeysInc *init_aki_data(struct bAnimContext *ac, struct bAnimListElem *ale); diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 55e035cfced..275ac4ea4c1 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -243,7 +243,7 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar) /* data */ if (ANIM_animdata_get_context(C, &ac)) { - draw_channel_names(&ac, saction, ar); + draw_channel_names(C, &ac, saction, ar); } /* reset view matrix */ diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 59d6a0ec6be..6b89532cdaf 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -49,6 +49,7 @@ #include "BKE_global.h" #include "BKE_material.h" #include "BKE_modifier.h" +#include "BKE_paint.h" #include "BKE_particle.h" #include "BKE_screen.h" #include "BKE_utildefines.h" @@ -304,12 +305,13 @@ static int buttons_context_path_particle(ButsContextPath *path) return 0; } -static int buttons_context_path_brush(ButsContextPath *path) +static int buttons_context_path_brush(const bContext *C, ButsContextPath *path) { Scene *scene; ToolSettings *ts; Brush *br= NULL; PointerRNA *ptr= &path->ptr[path->len-1]; + const Object *obact = CTX_data_active_object(C); /* if we already have a (pinned) brush, we're done */ if(RNA_struct_is_a(ptr->type, &RNA_Brush)) { @@ -320,14 +322,8 @@ static int buttons_context_path_brush(ButsContextPath *path) scene= path->ptr[path->len-1].data; ts= scene->toolsettings; - if(G.f & G_SCULPTMODE) - br= ts->sculpt->brush; - else if(G.f & G_VERTEXPAINT) - br= ts->vpaint->brush; - else if(G.f & G_WEIGHTPAINT) - br= ts->wpaint->brush; - else if(G.f & G_TEXTUREPAINT) - br= ts->imapaint.brush; + if(scene) + br= paint_brush(paint_get_active(scene)); if(br) { RNA_id_pointer_create(&br->id, &path->ptr[path->len]); @@ -341,7 +337,7 @@ static int buttons_context_path_brush(ButsContextPath *path) return 0; } -static int buttons_context_path_texture(ButsContextPath *path) +static int buttons_context_path_texture(const bContext *C, ButsContextPath *path) { Material *ma; Lamp *la; @@ -356,7 +352,7 @@ static int buttons_context_path_texture(ButsContextPath *path) return 1; } /* try brush */ - else if((path->flag & SB_BRUSH_TEX) && buttons_context_path_brush(path)) { + else if((path->flag & SB_BRUSH_TEX) && buttons_context_path_brush(C, path)) { br= path->ptr[path->len-1].data; if(br) { @@ -465,7 +461,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma found= buttons_context_path_material(path); break; case BCONTEXT_TEXTURE: - found= buttons_context_path_texture(path); + found= buttons_context_path_texture(C, path); break; case BCONTEXT_BONE: found= buttons_context_path_bone(path); diff --git a/source/blender/editors/space_file/Makefile b/source/blender/editors/space_file/Makefile index 2f4180448e5..43b2f09ed2d 100644 --- a/source/blender/editors/space_file/Makefile +++ b/source/blender/editors/space_file/Makefile @@ -59,3 +59,7 @@ ifeq ($(WITH_OPENJPEG),true) CPPFLAGS += -DWITH_OPENJPEG endif +ifeq ($(WITH_OPENEXR), true) + CPPFLAGS += -DWITH_OPENEXR +endif + diff --git a/source/blender/editors/space_file/SConscript b/source/blender/editors/space_file/SConscript index 36e042bdaa6..e6fba38fb8f 100644 --- a/source/blender/editors/space_file/SConscript +++ b/source/blender/editors/space_file/SConscript @@ -12,5 +12,7 @@ defs = [] if env['WITH_BF_OPENJPEG']: defs.append('WITH_OPENJPEG') +if env['WITH_BF_OPENEXR']: + defs.append('WITH_OPENEXR') env.BlenderLib ( 'bf_editors_space_file', sources, Split(incs), defs, libtype=['core'], priority=[115] ) diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index f3c18859fb0..30598d39d58 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -170,23 +170,28 @@ static void file_panel_operator(const bContext *C, Panel *pa) wmOperator *op= sfile->op; int empty= 1; - RNA_STRUCT_BEGIN(op->ptr, prop) { - if(strcmp(RNA_property_identifier(prop), "rna_type") == 0) - continue; - if(strcmp(RNA_property_identifier(prop), "filename") == 0) - continue; - if(strcmp(RNA_property_identifier(prop), "display") == 0) - continue; - if(strncmp(RNA_property_identifier(prop), "filter", 6) == 0) - continue; - - uiItemFullR(pa->layout, NULL, 0, op->ptr, prop, -1, 0, 0, 0, 0); - empty= 0; + if(op->type->ui) { + op->type->ui((bContext*)C, op->ptr, pa->layout); } - RNA_STRUCT_END; + else { + RNA_STRUCT_BEGIN(op->ptr, prop) { + if(strcmp(RNA_property_identifier(prop), "rna_type") == 0) + continue; + if(strcmp(RNA_property_identifier(prop), "filename") == 0) + continue; + if(strcmp(RNA_property_identifier(prop), "display") == 0) + continue; + if(strncmp(RNA_property_identifier(prop), "filter", 6) == 0) + continue; + + uiItemFullR(pa->layout, NULL, 0, op->ptr, prop, -1, 0, 0, 0, 0); + empty= 0; + } + RNA_STRUCT_END; - if(empty) - uiItemL(pa->layout, "No properties.", 0); + if(empty) + uiItemL(pa->layout, "No properties.", 0); + } } void file_panels_register(ARegionType *art) diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 82babb70c53..fb995285ab7 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -160,7 +160,7 @@ static void graph_panel_properties(const bContext *C, Panel *pa) } getname_anim_fcurve(name, ale->id, fcu); - uiDefBut(block, LABEL, 1, name, 30, 180, 300, 19, NULL, 0.0, 0.0, 0, 0, "Name of Active F-Curve"); + uiDefBut(block, LABEL, 1, name, 40, 180, 300, 19, NULL, 0.0, 0.0, 0, 0, "Name of Active F-Curve"); /* TODO: the following settings could be added here * - F-Curve coloring mode - mode selector + color selector diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 07918646926..c2d8d7b1345 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -877,12 +877,8 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri /* ************************************************************************* */ /* Channel List */ -// XXX quite a few of these need to be kept in sync with their counterparts in Action Editor -// as they're the same. We have 2 separate copies of this for now to make it easier to develop -// the diffences between the two editors, but one day these should be merged! - /* left hand part */ -void graph_draw_channel_names(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) +void graph_draw_channel_names(bContext *C, bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -903,36 +899,51 @@ void graph_draw_channel_names(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) * start of list offset, and the second is as a correction for the scrollers. */ height= (float)((items*ACHANNEL_STEP) + (ACHANNEL_HEIGHT*2)); - -#if 0 - if (height > (v2d->mask.ymax - v2d->mask.ymin)) { - /* don't use totrect set, as the width stays the same - * (NOTE: this is ok here, the configuration is pretty straightforward) - */ - v2d->tot.ymin= (float)(-height); - } - - /* XXX I would call the below line! (ton) */ -#endif UI_view2d_totRect_set(v2d, ar->winx, height); /* loop through channels, and set up drawing depending on their type */ - y= (float)ACHANNEL_FIRST; - - for (ale= anim_data.first, i=0; ale; ale= ale->next, i++) { - const float yminc= (float)(y - ACHANNEL_HEIGHT_HALF); - const float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF); + { /* first pass: just the standard GL-drawing for backdrop + text */ + y= (float)ACHANNEL_FIRST; - /* check if visible */ - if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || - IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) - { - /* draw all channels using standard channel-drawing API */ - ANIM_channel_draw(ac, ale, yminc, ymaxc); + for (ale= anim_data.first, i=0; ale; ale= ale->next, i++) { + const float yminc= (float)(y - ACHANNEL_HEIGHT_HALF); + const float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF); + + /* check if visible */ + if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || + IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) + { + /* draw all channels using standard channel-drawing API */ + ANIM_channel_draw(ac, ale, yminc, ymaxc); + } + + /* adjust y-position for next one */ + y -= ACHANNEL_STEP; + } + } + { /* second pass: widgets */ + uiBlock *block= uiBeginBlock(C, ar, "graph channel buttons", UI_EMBOSS); + + y= (float)ACHANNEL_FIRST; + + for (ale= anim_data.first, i=0; ale; ale= ale->next, i++) { + const float yminc= (float)(y - ACHANNEL_HEIGHT_HALF); + const float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF); + + /* check if visible */ + if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || + IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) + { + /* draw all channels using standard channel-drawing API */ + ANIM_channel_draw_widgets(ac, ale, block, yminc, ymaxc); + } + + /* adjust y-position for next one */ + y -= ACHANNEL_STEP; } - /* adjust y-position for next one */ - y -= ACHANNEL_STEP; + uiEndBlock(C, block); + uiDrawBlock(C, block); } /* free tempolary channels */ diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h index 31f1c6d4301..2e8d0655d2d 100644 --- a/source/blender/editors/space_graph/graph_intern.h +++ b/source/blender/editors/space_graph/graph_intern.h @@ -48,7 +48,7 @@ struct ARegion *graph_has_buttons_region(struct ScrArea *sa); /* ***************************************** */ /* graph_draw.c */ -void graph_draw_channel_names(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar); +void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar); void graph_draw_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar, struct View2DGrid *grid, short sel); void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar, struct View2DGrid *grid); diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 0390586951b..3717ccc8244 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -309,7 +309,7 @@ static void graph_channel_area_draw(const bContext *C, ARegion *ar) /* draw channels */ if (ANIM_animdata_get_context(C, &ac)) { - graph_draw_channel_names(&ac, sipo, ar); + graph_draw_channel_names((bContext*)C, &ac, sipo, ar); } /* reset view matrix */ diff --git a/source/blender/editors/space_image/Makefile b/source/blender/editors/space_image/Makefile index e7e9a9b5665..af15b1d9724 100644 --- a/source/blender/editors/space_image/Makefile +++ b/source/blender/editors/space_image/Makefile @@ -53,3 +53,7 @@ CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include CPPFLAGS += -I../include +ifeq ($(WITH_OPENEXR), true) + CPPFLAGS += -DWITH_OPENEXR +endif + diff --git a/source/blender/editors/space_image/SConscript b/source/blender/editors/space_image/SConscript index e7041ef0458..874549e6949 100644 --- a/source/blender/editors/space_image/SConscript +++ b/source/blender/editors/space_image/SConscript @@ -11,5 +11,7 @@ defs = [] if env['WITH_BF_LCMS']: defs.append('WITH_LCMS') +if env['WITH_BF_OPENEXR']: + defs.append('WITH_OPENEXR') env.BlenderLib ( 'bf_editors_space_image', sources, Split(incs), defs, libtype=['core'], priority=[40] ) diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 4dcaa96caf7..ac0a5c7f53a 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -58,6 +58,7 @@ #include "BKE_mesh.h" #include "BKE_node.h" #include "BKE_packedFile.h" +#include "BKE_paint.h" #include "BKE_screen.h" #include "BKE_utildefines.h" @@ -450,7 +451,7 @@ void brush_buttons(const bContext *C, uiBlock *block, short fromsima, { // SpaceImage *sima= CTX_wm_space_image(C); ToolSettings *settings= CTX_data_tool_settings(C); - Brush *brush= settings->imapaint.brush; + Brush *brush= paint_brush(&settings->imapaint.paint); ID *id; int yco, xco, butw, but_idx; // short *menupoin = &(sima->menunr); // XXX : &(G.buts->menunr); @@ -472,7 +473,7 @@ void brush_buttons(const bContext *C, uiBlock *block, short fromsima, uiBlockEndAlign(block); yco -= 30; - id= (ID*)settings->imapaint.brush; + id= (ID*)brush; xco= 200; // std_libbuttons(block, 0, yco, 0, NULL, evt_browse, ID_BR, 0, id, NULL, menupoin, 0, evt_local, evt_del, 0, evt_keepdata); if(brush && !brush->id.lib) { @@ -574,7 +575,7 @@ static void image_panel_paintcolor(const bContext *C, Panel *pa) { SpaceImage *sima= CTX_wm_space_image(C); ToolSettings *settings= CTX_data_tool_settings(C); - Brush *brush= settings->imapaint.brush; + Brush *brush= paint_brush(&settings->imapaint.paint); uiBlock *block; static float hsv[3], old[3]; // used as temp mem for picker static char hexcol[128]; @@ -1318,7 +1319,7 @@ void ED_image_uiblock_panel(const bContext *C, uiBlock *block, Image **ima_pp, I } /* exception, let's do because we only use this panel 3 times in blender... but not real good code! */ - if( (FACESEL_PAINT_TEST) && sima && &sima->iuser==iuser) + if( (paint_facesel_test(CTX_data_active_object(C))) && sima && &sima->iuser==iuser) return; /* left side default per-image options, right half the additional options */ diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index ff25a2635d2..2f5fc805367 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -47,6 +47,7 @@ #include "BKE_colortools.h" #include "BKE_global.h" #include "BKE_image.h" +#include "BKE_paint.h" #include "BKE_utildefines.h" #include "BIF_gl.h" @@ -577,7 +578,7 @@ static void draw_image_view_tool(Scene *scene) static unsigned char *get_alpha_clone_image(Scene *scene, int *width, int *height) { - Brush *brush = scene->toolsettings->imapaint.brush; + Brush *brush = paint_brush(&scene->toolsettings->imapaint.paint); ImBuf *ibuf; unsigned int size, alpha; unsigned char *rect, *cp; @@ -615,7 +616,7 @@ static void draw_image_paint_helpers(SpaceImage *sima, ARegion *ar, Scene *scene int x, y, w, h; unsigned char *clonerect; - brush= scene->toolsettings->imapaint.brush; + brush= paint_brush(&scene->toolsettings->imapaint.paint); if(brush && (scene->toolsettings->imapaint.tool == PAINT_TOOL_CLONE)) { /* this is not very efficient, but glDrawPixels doesn't allow diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index ab918519ec0..063b329b7a1 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -89,6 +89,7 @@ * part of the channel is relevant. * * NOTE: eventually, this should probably be phased out when many of these things are replaced with buttons + * --> Most channels are now selection only... */ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, short selectmode) @@ -118,32 +119,17 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho case ANIMTYPE_SCENE: { Scene *sce= (Scene *)ale->data; - AnimData *adt= ale->data; - if (x < 16) { - /* toggle expand */ - sce->flag ^= SCE_DS_COLLAPSED; - - notifierFlags |= ND_ANIMCHAN_EDIT; - } - else if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - - notifierFlags |= ND_ANIMCHAN_EDIT; + /* set selection status */ + if (selectmode == SELECT_INVERT) { + /* swap select */ + sce->flag ^= SCE_DS_SELECTED; } else { - /* set selection status */ - if (selectmode == SELECT_INVERT) { - /* swap select */ - sce->flag ^= SCE_DS_SELECTED; - } - else { - sce->flag |= SCE_DS_SELECTED; - } - - notifierFlags |= ND_ANIMCHAN_SELECT; + sce->flag |= SCE_DS_SELECTED; } + + notifierFlags |= ND_ANIMCHAN_SELECT; } break; case ANIMTYPE_OBJECT: @@ -152,20 +138,8 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho Scene *sce= (Scene *)ads->source; Base *base= (Base *)ale->data; Object *ob= base->object; - AnimData *adt= ale->adt; - if (x < 16) { - /* toggle expand */ - ob->nlaflag ^= OB_ADS_COLLAPSED; // XXX - notifierFlags |= ND_ANIMCHAN_EDIT; - } - else if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - - notifierFlags |= ND_ANIMCHAN_EDIT; - } - else if (nlaedit_is_tweakmode_on(ac) == 0) { + if (nlaedit_is_tweakmode_on(ac) == 0) { /* set selection status */ if (selectmode == SELECT_INVERT) { /* swap select */ @@ -194,149 +168,6 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho } } break; - case ANIMTYPE_FILLMATD: - { - Object *ob= (Object *)ale->data; - ob->nlaflag ^= OB_ADS_SHOWMATS; // XXX - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_FILLPARTD: - { - Object *ob= (Object *)ale->data; - ob->nlaflag ^= OB_ADS_SHOWPARTS; // XXX - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - - case ANIMTYPE_DSMAT: - { - Material *ma= (Material *)ale->data; - AnimData *adt= ale->adt; - - if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - } - else { - /* toggle expand */ - ma->flag ^= MA_DS_EXPAND; - } - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSLAM: - { - Lamp *la= (Lamp *)ale->data; - AnimData *adt= ale->adt; - - if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - } - else { - /* toggle expand */ - la->flag ^= LA_DS_EXPAND; - } - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSCAM: - { - Camera *ca= (Camera *)ale->data; - AnimData *adt= ale->adt; - - if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - } - else { - /* toggle expand */ - ca->flag ^= CAM_DS_EXPAND; - } - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSCUR: - { - Curve *cu= (Curve *)ale->data; - AnimData *adt= ale->adt; - - if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - } - else { - /* toggle expand */ - cu->flag ^= CU_DS_EXPAND; - } - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSSKEY: - { - Key *key= (Key *)ale->data; - AnimData *adt= ale->adt; - - if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - } - else { - /* toggle expand */ - key->flag ^= KEYBLOCK_DS_EXPAND; - } - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSWOR: - { - World *wo= (World *)ale->data; - AnimData *adt= ale->adt; - - if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - } - else { - /* toggle expand */ - wo->flag ^= WO_DS_EXPAND; - } - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSPART: - { - ParticleSettings *part= (ParticleSettings *)ale->data; - AnimData *adt= ale->adt; - - if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - } - else { - /* toggle expand */ - part->flag ^= PART_DS_EXPAND; - } - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSMBALL: - { - MetaBall *mb= (MetaBall *)ale->data; - AnimData *adt= ale->adt; - - if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - } - else { - /* toggle expand */ - mb->flag2 ^= MB_DS_EXPAND; - } - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; case ANIMTYPE_NLATRACK: { diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index a7a854a7277..3a0e150050b 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -592,36 +592,15 @@ void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar) /* *********************************************** */ /* Channel List */ -void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) +/* old code for drawing NLA channels using GL only */ +// TODO: depreceate this code... +static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, View2D *v2d, float y) { - ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; - int filter; - - View2D *v2d= &ar->v2d; - float x= 0.0f, y= 0.0f; - int items, height; - - /* build list of channels to draw */ - filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS); - items= ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); - - /* Update max-extent of channels here (taking into account scrollers): - * - this is done to allow the channel list to be scrollable, but must be done here - * to avoid regenerating the list again and/or also because channels list is drawn first - * - offset of NLACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for - * start of list offset, and the second is as a correction for the scrollers. - */ - height= ((items*NLACHANNEL_STEP) + (NLACHANNEL_HEIGHT*2)); - /* don't use totrect set, as the width stays the same - * (NOTE: this is ok here, the configuration is pretty straightforward) - */ - v2d->tot.ymin= (float)(-height); + float x = 0.0f; /* loop through channels, and set up drawing depending on their type */ - y= (float)(-NLACHANNEL_HEIGHT); - - for (ale= anim_data.first; ale; ale= ale->next) { + for (ale= anim_data->first; ale; ale= ale->next) { const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF); const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF); const float ydatac= (float)(y - 7); @@ -633,308 +612,10 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) short indent= 0, offset= 0, sel= 0, group= 0; int expand= -1, protect = -1, special= -1, mute = -1; char name[128]; + short doDraw=0; /* determine what needs to be drawn */ switch (ale->type) { - case ANIMTYPE_SCENE: /* scene */ - { - Scene *sce= (Scene *)ale->data; - AnimData *adt= ale->adt; - - group= 4; - indent= 0; - - special= ICON_SCENE_DATA; - - /* only show expand if there are any channels */ - if (EXPANDED_SCEC(sce)) - expand= ICON_TRIA_DOWN; - else - expand= ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - sel = SEL_SCEC(sce); - strcpy(name, sce->id.name+2); - } - break; - case ANIMTYPE_OBJECT: /* object */ - { - Base *base= (Base *)ale->data; - Object *ob= base->object; - AnimData *adt= ale->adt; - - group= 4; - indent= 0; - - /* icon depends on object-type */ - if (ob->type == OB_ARMATURE) - special= ICON_ARMATURE_DATA; - else - special= ICON_OBJECT_DATA; - - /* only show expand if there are any channels */ - if (EXPANDED_OBJC(ob)) - expand= ICON_TRIA_DOWN; - else - expand= ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - sel = SEL_OBJC(base); - strcpy(name, ob->id.name+2); - } - break; - case ANIMTYPE_FILLMATD: /* object materials (dopesheet) expand widget */ - { - Object *ob = (Object *)ale->data; - - group = 4; - indent = 1; - special = ICON_MATERIAL_DATA; - - if (FILTER_MAT_OBJC(ob)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - strcpy(name, "Materials"); - } - break; - case ANIMTYPE_FILLPARTD: /* object particles (dopesheet) expand widget */ - { - Object *ob = (Object *)ale->data; - - group = 4; - indent = 1; - special = ICON_PARTICLE_DATA; - - if (FILTER_PART_OBJC(ob)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - strcpy(name, "Particles"); - } - break; - - - case ANIMTYPE_DSMAT: /* single material (dopesheet) expand widget */ - { - Material *ma = (Material *)ale->data; - AnimData *adt= ale->adt; - - group = 0; - indent = 0; - special = ICON_MATERIAL_DATA; - offset = 21; - - if (FILTER_MAT_OBJD(ma)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - strcpy(name, ma->id.name+2); - } - break; - case ANIMTYPE_DSLAM: /* lamp (dopesheet) expand widget */ - { - Lamp *la = (Lamp *)ale->data; - AnimData *adt= ale->adt; - - group = 4; - indent = 1; - special = ICON_LAMP_DATA; - - if (FILTER_LAM_OBJD(la)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - strcpy(name, la->id.name+2); - } - break; - case ANIMTYPE_DSCAM: /* camera (dopesheet) expand widget */ - { - Camera *ca = (Camera *)ale->data; - AnimData *adt= ale->adt; - - group = 4; - indent = 1; - special = ICON_CAMERA_DATA; - - if (FILTER_CAM_OBJD(ca)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - strcpy(name, ca->id.name+2); - } - break; - case ANIMTYPE_DSCUR: /* curve (dopesheet) expand widget */ - { - Curve *cu = (Curve *)ale->data; - AnimData *adt= ale->adt; - - group = 4; - indent = 1; - special = ICON_CURVE_DATA; - - if (FILTER_CUR_OBJD(cu)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - strcpy(name, cu->id.name+2); - } - break; - case ANIMTYPE_DSSKEY: /* shapekeys (dopesheet) expand widget */ - { - Key *key= (Key *)ale->data; - AnimData *adt= ale->adt; - - group = 4; - indent = 1; - special = ICON_SHAPEKEY_DATA; - - if (FILTER_SKE_OBJD(key)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - //sel = SEL_OBJC(base); - strcpy(name, "Shape Keys"); - } - break; - case ANIMTYPE_DSWOR: /* world (dopesheet) expand widget */ - { - World *wo= (World *)ale->data; - AnimData *adt= ale->adt; - - group = 4; - indent = 1; - special = ICON_WORLD_DATA; - - if (FILTER_WOR_SCED(wo)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - strcpy(name, wo->id.name+2); - } - break; - case ANIMTYPE_DSPART: /* particle (dopesheet) expand widget */ - { - ParticleSettings *part= (ParticleSettings*)ale->data; - AnimData *adt= ale->adt; - - group = 0; - indent = 0; - special = ICON_PARTICLE_DATA; - offset = 21; - - if (FILTER_PART_OBJD(part)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - strcpy(name, part->id.name+2); - } - break; - case ANIMTYPE_DSMBALL: /* metaball (dopesheet) expand widget */ - { - MetaBall *mb = (MetaBall *)ale->data; - AnimData *adt= ale->adt; - - group = 4; - indent = 1; - special = ICON_META_DATA; - - if (FILTER_MBALL_OBJD(mb)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - strcpy(name, mb->id.name+2); - } - break; - case ANIMTYPE_NLATRACK: /* NLA Track */ { NlaTrack *nlt= (NlaTrack *)ale->data; @@ -978,6 +659,9 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) sel = SEL_NLT(nlt); strcpy(name, nlt->name); + + // draw manually still + doDraw= 1; } break; case ANIMTYPE_NLAACTION: /* NLA Action-Line */ @@ -1004,167 +688,213 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) sprintf(name, "ActAction: <%s>", act->id.name+2); else sprintf(name, "<No Action>"); + + // draw manually still + doDraw= 1; } break; + + default: /* handled by standard channel-drawing API */ + // draw backdrops only... + ANIM_channel_draw(ac, ale, yminc, ymaxc); + break; } - /* now, start drawing based on this information */ - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - /* draw backing strip behind channel name */ - if (group == 4) { - /* only used in dopesheet... */ - if (ELEM(ale->type, ANIMTYPE_SCENE, ANIMTYPE_OBJECT)) { - /* object channel - darker */ - UI_ThemeColor(TH_DOPESHEET_CHANNELOB); - uiSetRoundBox((expand == ICON_TRIA_DOWN)? (8):(1|8)); - gl_round_box(GL_POLYGON, x+offset, yminc, (float)NLACHANNEL_NAMEWIDTH, ymaxc, 10); + /* if special types, draw manually for now... */ + if (doDraw) { + /* now, start drawing based on this information */ + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + /* draw backing strip behind channel name */ + if (group == 5) { + /* Action Line */ + AnimData *adt= ale->adt; + + // TODO: if tweaking some action, use the same color as for the tweaked track (quick hack done for now) + if (adt && (adt->flag & ADT_NLA_EDIT_ON)) { + // greenish color (same as tweaking strip) - hardcoded for now + glColor3f(0.3f, 0.95f, 0.1f); + } + else { + if (ale->data) + glColor3f(0.8f, 0.2f, 0.0f); // reddish color - hardcoded for now + else + glColor3f(0.6f, 0.5f, 0.5f); // greyish-red color - hardcoded for now + } + + offset += 7 * indent; + + /* only on top two corners, to show that this channel sits on top of the preceeding ones */ + uiSetRoundBox((1|2)); + + /* draw slightly shifted up vertically to look like it has more separtion from other channels, + * but we then need to slightly shorten it so that it doesn't look like it overlaps + */ + gl_round_box(GL_POLYGON, x+offset, yminc+NLACHANNEL_SKIP, (float)v2d->cur.xmax, ymaxc+NLACHANNEL_SKIP-1, 8); + + /* clear group value, otherwise we cause errors... */ + group = 0; } else { - /* sub-object folders - lighter */ - UI_ThemeColor(TH_DOPESHEET_CHANNELSUBOB); + /* for normal channels + * - use 3 shades of color group/standard color for 3 indention level + */ + UI_ThemeColorShade(TH_HEADER, ((indent==0)?20: (indent==1)?-20: -40)); + indent += group; offset += 7 * indent; glBegin(GL_QUADS); glVertex2f(x+offset, yminc); glVertex2f(x+offset, ymaxc); - glVertex2f((float)ACHANNEL_NAMEWIDTH, ymaxc); - glVertex2f((float)ACHANNEL_NAMEWIDTH, yminc); + glVertex2f((float)v2d->cur.xmax, ymaxc); + glVertex2f((float)v2d->cur.xmax, yminc); glEnd(); - - /* clear group value, otherwise we cause errors... */ - group = 0; } - } - else if (group == 5) { - /* Action Line */ - AnimData *adt= ale->adt; - // TODO: if tweaking some action, use the same color as for the tweaked track (quick hack done for now) - if (adt && (adt->flag & ADT_NLA_EDIT_ON)) { - // greenish color (same as tweaking strip) - hardcoded for now - glColor3f(0.3f, 0.95f, 0.1f); + /* draw expand/collapse triangle */ + if (expand > 0) { + UI_icon_draw(x+offset, ydatac, expand); + offset += 17; } - else { - if (ale->data) - glColor3f(0.8f, 0.2f, 0.0f); // reddish color - hardcoded for now - else - glColor3f(0.6f, 0.5f, 0.5f); // greyish-red color - hardcoded for now + + /* draw special icon indicating certain data-types */ + if (special > -1) { + /* for normal channels */ + UI_icon_draw(x+offset, ydatac, special); + offset += 17; } + glDisable(GL_BLEND); - offset += 7 * indent; + /* draw name */ + if (sel) + UI_ThemeColor(TH_TEXT_HI); + else + UI_ThemeColor(TH_TEXT); + offset += 3; + UI_DrawString(x+offset, y-4, name); - /* only on top two corners, to show that this channel sits on top of the preceeding ones */ - uiSetRoundBox((1|2)); + /* reset offset - for RHS of panel */ + offset = 0; - /* draw slightly shifted up vertically to look like it has more separtion from other channels, - * but we then need to slightly shorten it so that it doesn't look like it overlaps - */ - gl_round_box(GL_POLYGON, x+offset, yminc+NLACHANNEL_SKIP, (float)NLACHANNEL_NAMEWIDTH, ymaxc+NLACHANNEL_SKIP-1, 8); + /* set blending again, as text drawing may clear it */ + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); - /* clear group value, otherwise we cause errors... */ - group = 0; - } - else { - /* for normal channels - * - use 3 shades of color group/standard color for 3 indention level - */ - UI_ThemeColorShade(TH_HEADER, ((indent==0)?20: (indent==1)?-20: -40)); - - indent += group; - offset += 7 * indent; - glBegin(GL_QUADS); - glVertex2f(x+offset, yminc); - glVertex2f(x+offset, ymaxc); - glVertex2f((float)NLACHANNEL_NAMEWIDTH, ymaxc); - glVertex2f((float)NLACHANNEL_NAMEWIDTH, yminc); - glEnd(); - } - - /* draw expand/collapse triangle */ - if (expand > 0) { - UI_icon_draw(x+offset, ydatac, expand); - offset += 17; - } - - /* draw special icon indicating certain data-types */ - if (special > -1) { - /* for normal channels */ - UI_icon_draw(x+offset, ydatac, special); - offset += 17; - } - glDisable(GL_BLEND); - - /* draw name */ - if (sel) - UI_ThemeColor(TH_TEXT_HI); - else - UI_ThemeColor(TH_TEXT); - offset += 3; - UI_DrawString(x+offset, y-4, name); - - /* reset offset - for RHS of panel */ - offset = 0; - - /* set blending again, as text drawing may clear it */ - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - /* draw protect 'lock' */ - if (protect > -1) { - offset = 16; - UI_icon_draw((float)NLACHANNEL_NAMEWIDTH-offset, ydatac, protect); - } - - /* draw mute 'eye' */ - if (mute > -1) { - offset += 16; - UI_icon_draw((float)(NLACHANNEL_NAMEWIDTH-offset), ydatac, mute); - } - - /* draw NLA-action line 'status-icons' - only when there's an action */ - if ((ale->type == ANIMTYPE_NLAACTION) && (ale->data)) { - AnimData *adt= ale->adt; + /* draw protect 'lock' */ + if (protect > -1) { + offset = 16; + UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, protect); + } - offset += 16; + /* draw mute 'eye' */ + if (mute > -1) { + offset += 16; + UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, mute); + } - /* now draw some indicator icons */ - if ((adt) && (adt->flag & ADT_NLA_EDIT_ON)) { - /* toggle for tweaking with mapping/no-mapping (i.e. 'in place editing' toggle) */ - // for now, use pin icon to symbolise this - if (adt->flag & ADT_NLA_EDIT_NOMAP) - UI_icon_draw((float)(NLACHANNEL_NAMEWIDTH-offset), ydatac, ICON_PINNED); - else - UI_icon_draw((float)(NLACHANNEL_NAMEWIDTH-offset), ydatac, ICON_UNPINNED); + /* draw NLA-action line 'status-icons' - only when there's an action */ + if ((ale->type == ANIMTYPE_NLAACTION) && (ale->data)) { + AnimData *adt= ale->adt; - fdrawline((float)(NLACHANNEL_NAMEWIDTH-offset), yminc, - (float)(NLACHANNEL_NAMEWIDTH-offset), ymaxc); - offset += 16;; + offset += 16; - /* 'tweaking action' indicator - not a button */ - UI_icon_draw((float)NLACHANNEL_NAMEWIDTH-offset, ydatac, ICON_EDIT); - } - else { - /* XXX firstly draw a little rect to help identify that it's different from the toggles */ - glBegin(GL_LINE_LOOP); - glVertex2f((float)NLACHANNEL_NAMEWIDTH-offset-1, y-7); - glVertex2f((float)NLACHANNEL_NAMEWIDTH-offset-1, y+9); - glVertex2f((float)NLACHANNEL_NAMEWIDTH-1, y+9); - glVertex2f((float)NLACHANNEL_NAMEWIDTH-1, y-7); - glEnd(); // GL_LINES - - /* 'push down' icon for normal active-actions */ - UI_icon_draw((float)NLACHANNEL_NAMEWIDTH-offset, ydatac, ICON_FREEZE); + /* now draw some indicator icons */ + if ((adt) && (adt->flag & ADT_NLA_EDIT_ON)) { + /* toggle for tweaking with mapping/no-mapping (i.e. 'in place editing' toggle) */ + // for now, use pin icon to symbolise this + if (adt->flag & ADT_NLA_EDIT_NOMAP) + UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, ICON_PINNED); + else + UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, ICON_UNPINNED); + + fdrawline((float)(v2d->cur.xmax-offset), yminc, + (float)(v2d->cur.xmax-offset), ymaxc); + offset += 16;; + + /* 'tweaking action' indicator - not a button */ + UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, ICON_EDIT); + } + else { + /* XXX firstly draw a little rect to help identify that it's different from the toggles */ + glBegin(GL_LINE_LOOP); + glVertex2f((float)v2d->cur.xmax-offset-1, y-7); + glVertex2f((float)v2d->cur.xmax-offset-1, y+9); + glVertex2f((float)v2d->cur.xmax-1, y+9); + glVertex2f((float)v2d->cur.xmax-1, y-7); + glEnd(); // GL_LINES + + /* 'push down' icon for normal active-actions */ + UI_icon_draw((float)NLACHANNEL_NAMEWIDTH-offset, ydatac, ICON_FREEZE); + } } + + glDisable(GL_BLEND); } - - glDisable(GL_BLEND); } /* adjust y-position for next one */ y -= NLACHANNEL_STEP; } +} + +void draw_nla_channel_list (bContext *C, bAnimContext *ac, SpaceNla *snla, ARegion *ar) +{ + ListBase anim_data = {NULL, NULL}; + bAnimListElem *ale; + int filter; + + View2D *v2d= &ar->v2d; + float y= 0.0f; + int items, height; + + /* build list of channels to draw */ + filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS); + items= ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); + + /* Update max-extent of channels here (taking into account scrollers): + * - this is done to allow the channel list to be scrollable, but must be done here + * to avoid regenerating the list again and/or also because channels list is drawn first + * - offset of NLACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for + * start of list offset, and the second is as a correction for the scrollers. + */ + height= ((items*NLACHANNEL_STEP) + (NLACHANNEL_HEIGHT*2)); + /* don't use totrect set, as the width stays the same + * (NOTE: this is ok here, the configuration is pretty straightforward) + */ + v2d->tot.ymin= (float)(-height); + + /* draw channels */ + { /* first pass: backdrops + oldstyle drawing */ + y= (float)(-NLACHANNEL_HEIGHT); + + draw_nla_channel_list_gl(ac, &anim_data, v2d, y); + } + { /* second pass: UI widgets */ + uiBlock *block= uiBeginBlock(C, ar, "NLA channel buttons", UI_EMBOSS); + + y= (float)(-NLACHANNEL_HEIGHT); + + /* loop through channels, and set up drawing depending on their type */ + for (ale= anim_data.first; ale; ale= ale->next) { + const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF); + const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF); + + /* check if visible */ + if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || + IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) + { + /* draw all channels using standard channel-drawing API */ + ANIM_channel_draw_widgets(ac, ale, block, yminc, ymaxc); + } + + /* adjust y-position for next one */ + y -= NLACHANNEL_STEP; + } + + uiEndBlock(C, block); + uiDrawBlock(C, block); + } /* free tempolary channels */ BLI_freelistN(&anim_data); diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index d476852ef2d..763f4116416 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -919,6 +919,58 @@ void NLA_OT_split (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } +/* ******************** Bake Strips Operator ***************************** */ +/* Bakes the NLA Strips for the active AnimData blocks */ + +static int nlaedit_bake_exec (bContext *C, wmOperator *op) +{ + bAnimContext ac; + + ListBase anim_data = {NULL, NULL}; + bAnimListElem *ale; + int filter; + + /* get editor data */ + if (ANIM_animdata_get_context(C, &ac) == 0) + return OPERATOR_CANCELLED; + + /* get a list of the editable tracks being shown in the NLA */ + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_ANIMDATA | ANIMFILTER_FOREDIT); + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + + /* for each AnimData block, bake strips to animdata... */ + for (ale= anim_data.first; ale; ale= ale->next) { + // FIXME + } + + /* free temp data */ + BLI_freelistN(&anim_data); + + /* refresh auto strip properties */ + ED_nla_postop_refresh(&ac); + + /* set notifier that things have changed */ + WM_event_add_notifier(C, NC_ANIMATION|ND_NLA_EDIT, NULL); + + /* done */ + return OPERATOR_FINISHED; +} + +void NLA_OT_bake (wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Bake Strips"; + ot->idname= "NLA_OT_bake"; + ot->description= "Bake all strips of selected AnimData blocks."; + + /* api callbacks */ + ot->exec= nlaedit_bake_exec; + ot->poll= nlaop_poll_tweakmode_off; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + /* *********************************************** */ /* NLA Editing Operations (Modifying) */ diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h index 7cc09707ba7..e4557ec878f 100644 --- a/source/blender/editors/space_nla/nla_intern.h +++ b/source/blender/editors/space_nla/nla_intern.h @@ -45,7 +45,7 @@ void NLA_OT_properties(wmOperatorType *ot); /* nla_draw.c */ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar); -void draw_nla_channel_list(bAnimContext *ac, SpaceNla *snla, ARegion *ar); +void draw_nla_channel_list(bContext *C, bAnimContext *ac, SpaceNla *snla, ARegion *ar); /* **************************************** */ /* nla_header.c */ diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index 6f377aabd4e..c4f929274c7 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -238,7 +238,7 @@ static void nla_channel_area_draw(const bContext *C, ARegion *ar) /* data */ if (ANIM_animdata_get_context(C, &ac)) { - draw_nla_channel_list(&ac, snla, ar); + draw_nla_channel_list((bContext *)C, &ac, snla, ar); } /* reset view matrix */ diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index fe68a56dea5..d66cbb55baa 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -56,6 +56,7 @@ #include "BKE_main.h" #include "BKE_node.h" #include "BKE_material.h" +#include "BKE_paint.h" #include "BKE_texture.h" #include "BKE_scene.h" #include "BKE_utildefines.h" @@ -623,17 +624,17 @@ void snode_set_context(SpaceNode *snode, Scene *scene) } else { MTex *mtex= NULL; + Brush *brush= NULL; - if(G.f & G_SCULPTMODE) { - Sculpt *sd= scene->toolsettings->sculpt; - if(sd && sd->brush) - if(sd->brush->texact != -1) - mtex= sd->brush->mtex[sd->brush->texact]; + if(ob && ob->mode & OB_MODE_SCULPT) { + brush= paint_brush(&scene->toolsettings->sculpt->paint); } - else { - Brush *br= scene->toolsettings->imapaint.brush; - if(br) - mtex= br->mtex[br->texact]; + else + brush= paint_brush(&scene->toolsettings->imapaint.paint); + + if(brush) { + if(brush && brush->texact != -1) + mtex= brush->mtex[brush->texact]; } if(mtex) { @@ -2270,34 +2271,6 @@ void node_read_fullsamplelayers(SpaceNode *snode) WM_cursor_wait(0); } -/* called from header_info, when deleting a scene - * goes over all scenes other than the input, checks if they have - * render layer nodes referencing the to-be-deleted scene, and - * resets them to NULL. */ - -/* XXX needs to get current scene then! */ -void clear_scene_in_nodes(Scene *sce) -{ - Scene *sce1; - bNode *node; - - sce1= G.main->scene.first; - while(sce1) { - if(sce1!=sce) { - if (sce1->nodetree) { - for(node= sce1->nodetree->nodes.first; node; node= node->next) { - if(node->type==CMP_NODE_R_LAYERS) { - Scene *nodesce= (Scene *)node->id; - - if (nodesce==sce) node->id = NULL; - } - } - } - } - sce1= sce1->id.next; - } -} - void imagepaint_composite_tags(bNodeTree *ntree, Image *image, ImageUser *iuser) { bNode *node; diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 4f5d3f8f736..fffec61ec60 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -620,7 +620,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i tenla->name= "Pose"; - if(arm->edbo==NULL && (ob->flag & OB_POSEMODE)) { // channels undefined in editmode, but we want the 'tenla' pose icon itself + if(arm->edbo==NULL && (ob->mode & OB_MODE_POSE)) { // channels undefined in editmode, but we want the 'tenla' pose icon itself int a= 0, const_index= 1000; /* ensure unique id for bone constraints */ for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next, a++) { @@ -887,7 +887,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i else { /* do not extend Armature when we have posemode */ tselem= TREESTORE(te->parent); - if( GS(tselem->id->name)==ID_OB && ((Object *)tselem->id)->flag & OB_POSEMODE); + if( GS(tselem->id->name)==ID_OB && ((Object *)tselem->id)->mode & OB_MODE_POSE); else { Bone *curBone; for (curBone=arm->bonebase.first; curBone; curBone=curBone->next){ @@ -1016,7 +1016,6 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i PointerRNA pptr, propptr, *ptr= (PointerRNA*)idv; PropertyRNA *prop, *iterprop; PropertyType proptype; - PropertySubType propsubtype; int a, tot; /* we do lazy build, for speed and to avoid infinite recusion */ @@ -2178,13 +2177,13 @@ static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *te, if(scene->obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); - if(ob->flag & OB_POSEMODE) + if(ob->mode & OB_MODE_POSE) ED_armature_exit_posemode(C, base); else ED_armature_enter_posemode(C, base); } else { - if(ob->flag & OB_POSEMODE) return 1; + if(ob->mode & OB_MODE_POSE) return 1; } return 0; } @@ -3062,10 +3061,6 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto if(scene->obedit==base->object) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); - if(base==BASACT) { - ED_view3d_exit_paint_modes(C); - } - ED_base_object_free_and_unlink(scene, base); te->directdata= NULL; tselem->id= NULL; @@ -3239,7 +3234,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); SpaceOops *soops= CTX_wm_space_outliner(C); int event; - char *str; + char *str= NULL; /* check for invalid states */ if (soops == NULL) @@ -3663,7 +3658,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle } else if(RNA_property_type(prop) == PROP_COLLECTION) { char buf[128], *name; - + temnext= (TreeElement*)(ld->next->data); tsenext= TREESTORE(temnext); @@ -3931,7 +3926,7 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa short groupmode= KSP_GROUP_KSNAME; /* check if RNA-property described by this selected element is an animateable prop */ - if ((tselem->type == TSE_RNA_PROPERTY) && RNA_property_animateable(&te->rnaptr, te->directdata)) { + if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM) && RNA_property_animateable(&te->rnaptr, te->directdata)) { /* get id + path + index info from the selected element */ tree_element_to_path(soops, te, tselem, &id, &path, &array_index, &flag, &groupmode); @@ -3968,8 +3963,6 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa /* free path, since it had to be generated */ MEM_freeN(path); } - - } /* go over sub-tree */ @@ -5086,6 +5079,28 @@ static char *keymap_tweak_menu(void) return string; } +static char *keymap_tweak_dir_menu(void) +{ + static char string[500]; + static char formatstr[] = "|%s %%x%d"; + char *str= string; + + str += sprintf(str, "Tweak Direction %%t"); + + str += sprintf(str, formatstr, "Any", KM_ANY); + str += sprintf(str, formatstr, "North", EVT_GESTURE_N); + str += sprintf(str, formatstr, "North-East", EVT_GESTURE_NE); + str += sprintf(str, formatstr, "East", EVT_GESTURE_E); + str += sprintf(str, formatstr, "Sout-East", EVT_GESTURE_SE); + str += sprintf(str, formatstr, "South", EVT_GESTURE_S); + str += sprintf(str, formatstr, "South-West", EVT_GESTURE_SW); + str += sprintf(str, formatstr, "West", EVT_GESTURE_W); + str += sprintf(str, formatstr, "North-West", EVT_GESTURE_NW); + + return string; +} + + static void keymap_type_cb(bContext *C, void *kmi_v, void *unused_v) { wmKeymapItem *kmi= kmi_v; @@ -5163,17 +5178,20 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo str= keymap_tweak_menu(); uiDefButS(block, MENU, 0, str, xstart, (int)te->ys+1, butw2, OL_H-1, &kmi->type, 0, 0, 0, 0, "Tweak gesture"); xstart+= butw2+5; + str= keymap_tweak_dir_menu(); + uiDefButS(block, MENU, 0, str, xstart, (int)te->ys+1, butw2, OL_H-1, &kmi->val, 0, 0, 0, 0, "Tweak gesture direction"); + xstart+= butw2+5; break; } /* modifiers */ - uiBlockBeginAlign(block); uiDefButS(block, OPTION, 0, "Shift", xstart, (int)te->ys+1, butw3+5, OL_H-1, &kmi->shift, 0, 0, 0, 0, "Modifier"); xstart+= butw3+5; uiDefButS(block, OPTION, 0, "Ctrl", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->ctrl, 0, 0, 0, 0, "Modifier"); xstart+= butw3; uiDefButS(block, OPTION, 0, "Alt", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->alt, 0, 0, 0, 0, "Modifier"); xstart+= butw3; uiDefButS(block, OPTION, 0, "Cmd", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->oskey, 0, 0, 0, 0, "Modifier"); xstart+= butw3; xstart+= 5; - uiBlockEndAlign(block); + uiDefKeyevtButS(block, 0, "", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->keymodifier, "Key Modifier code"); + xstart+= butw3+5; /* rna property */ if(kmi->ptr && kmi->ptr->data) diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 3d0d908d3f6..367bfb68208 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -660,9 +660,9 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence * draw_shadedstrip(seq, background_col, x1, y1, x2, y2); /* draw additional info and controls */ -// XXX -/* if (seq->type == SEQ_SOUND) - drawseqwave(scene, v2d, seq, x1, y1, x2, y2, ar->winx);*/ + // XXX + if(0) // (seq->type == SEQ_SOUND) + drawseqwave(scene, v2d, seq, x1, y1, x2, y2, ar->winx); if (!is_single_image) draw_seq_extensions(scene, sseq, seq); diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 8445f1b47e7..784b151f909 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -270,14 +270,23 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn) /* ************************ header time area region *********************** */ +#define PY_HEADER /* add handlers, stuff you only do once or on area/region changes */ static void time_header_area_init(wmWindowManager *wm, ARegion *ar) { +#ifdef PY_HEADER + ED_region_header_init(ar); +#else UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy); +#endif } static void time_header_area_draw(const bContext *C, ARegion *ar) { +#ifdef PY_HEADER + ED_region_header(C, ar); +#else + float col[3]; /* clear */ @@ -293,7 +302,8 @@ static void time_header_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_ortho(C, &ar->v2d); time_header_buttons(C, ar); - +#endif + /* restore view matrix? */ UI_view2d_view_restore(C); } diff --git a/source/blender/editors/space_time/time_header.c b/source/blender/editors/space_time/time_header.c index b4e3c087360..13265166d98 100644 --- a/source/blender/editors/space_time/time_header.c +++ b/source/blender/editors/space_time/time_header.c @@ -69,106 +69,6 @@ /* ************************ header time area region *********************** */ -/* exported for use in screen_ops.c */ -ARegion *time_top_left_3dwindow(bScreen *screen) -{ - ARegion *aret= NULL; - ScrArea *sa; - int min= 10000; - - for(sa= screen->areabase.first; sa; sa= sa->next) { - if(sa->spacetype==SPACE_VIEW3D) { - ARegion *ar; - for(ar= sa->regionbase.first; ar; ar= ar->next) { - if(ar->regiontype==RGN_TYPE_WINDOW) { - if(ar->winrct.xmin - ar->winrct.ymin < min) { - aret= ar; - min= ar->winrct.xmin - ar->winrct.ymin; - } - } - } - } - } - return aret; -} - -static void do_time_redrawmenu(bContext *C, void *arg, int event) -{ - - if(event < 1001) { - bScreen *screen= CTX_wm_screen(C); - SpaceTime *stime= CTX_wm_space_time(C); - - stime->redraws ^= event; - - if(screen->animtimer) { - wmTimer *wt= screen->animtimer; - ScreenAnimData *sad= wt->customdata; - - sad->redraws= stime->redraws; - sad->ar= NULL; - if(stime->redraws & TIME_REGION) - sad->ar= time_top_left_3dwindow(screen); - } - } -} - - -static uiBlock *time_redrawmenu(bContext *C, ARegion *ar, void *arg_unused) -{ - ScrArea *curarea= CTX_wm_area(C); - SpaceTime *stime= CTX_wm_space_time(C); - uiBlock *block; - short yco= 0, menuwidth=120, icon; - - block= uiBeginBlock(C, ar, "header time_redrawmenu", UI_EMBOSSP); - uiBlockSetButmFunc(block, do_time_redrawmenu, NULL); - - if(stime->redraws & TIME_REGION) icon= ICON_CHECKBOX_HLT; - else icon= ICON_CHECKBOX_DEHLT; - uiDefIconTextBut(block, BUTM, 1, icon, "Top-Left 3D Window", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_REGION, ""); - - if(stime->redraws & TIME_ALL_3D_WIN) icon= ICON_CHECKBOX_HLT; - else icon= ICON_CHECKBOX_DEHLT; - uiDefIconTextBut(block, BUTM, 1, icon, "All 3D Windows", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_3D_WIN, ""); - - if(stime->redraws & TIME_ALL_ANIM_WIN) icon= ICON_CHECKBOX_HLT; - else icon= ICON_CHECKBOX_DEHLT; - uiDefIconTextBut(block, BUTM, 1, icon, "Animation Windows", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_ANIM_WIN, ""); - - if(stime->redraws & TIME_ALL_BUTS_WIN) icon= ICON_CHECKBOX_HLT; - else icon= ICON_CHECKBOX_DEHLT; - uiDefIconTextBut(block, BUTM, 1, icon, "Buttons Windows", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_BUTS_WIN, ""); - - if(stime->redraws & TIME_ALL_IMAGE_WIN) icon= ICON_CHECKBOX_HLT; - else icon= ICON_CHECKBOX_DEHLT; - uiDefIconTextBut(block, BUTM, 1, icon, "Image Windows", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_IMAGE_WIN, ""); - - /* Add sequencer only redraw*/ - if(stime->redraws & TIME_SEQ) icon= ICON_CHECKBOX_HLT; - else icon= ICON_CHECKBOX_DEHLT; - uiDefIconTextBut(block, BUTM, 1, icon, "Sequencer Windows", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_SEQ, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - if(stime->redraws & TIME_CONTINUE_PHYSICS) icon= ICON_CHECKBOX_HLT; - else icon= ICON_CHECKBOX_DEHLT; - uiDefIconTextBut(block, BUTM, 1, icon, "Continue Physics", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_CONTINUE_PHYSICS, "During playblack, continue physics simulations regardless of the frame number"); - - if(curarea->headertype==HEADERTOP) { - uiBlockSetDirection(block, UI_DOWN); - } - else { - uiBlockSetDirection(block, UI_TOP); - uiBlockFlipOrder(block); - } - - uiTextBoundsBlock(block, 50); - uiEndBlock(C, block); - - return block; -} - static void do_time_viewmenu(bContext *C, void *arg, int event) { ScrArea *curarea= CTX_wm_area(C); @@ -397,7 +297,6 @@ void do_time_buttons(bContext *C, void *arg, int event) void time_header_buttons(const bContext *C, ARegion *ar) { ScrArea *sa= CTX_wm_area(C); - SpaceTime *stime= CTX_wm_space_time(C); Scene *scene= CTX_data_scene(C); wmTimer *animtimer= CTX_wm_screen(C)->animtimer; uiBlock *block; @@ -421,16 +320,11 @@ void time_header_buttons(const bContext *C, ARegion *ar) uiDefPulldownBut(block, time_framemenu, sa, "Frame", xco, yco, xmax-3, 20, ""); xco+= xmax; - - xmax= GetButStringLength("Playback"); - uiDefPulldownBut(block, time_redrawmenu, sa, - "Playback", xco, yco, xmax-3, 20, ""); - xco+= xmax; } uiBlockSetEmboss(block, UI_EMBOSS); - uiBlockBeginAlign(block); + uiDefButI(block, TOG, B_TL_PREVIEWON,"PR", xco,yco, XIC*2, YIC, @@ -439,6 +333,8 @@ void time_header_buttons(const bContext *C, ARegion *ar) xco += XIC*2; + uiBlockBeginAlign(block); + if (scene->r.psfra) { uiDefButI(block, NUM, B_REDRAWALL,"Start:", xco,yco, (int)4.5*XIC, YIC, @@ -473,11 +369,11 @@ void time_header_buttons(const bContext *C, ARegion *ar) * to facilitate easier keyframing in some situations */ uiDefButI(block, NUM, B_NEWFRAME, "", - xco,yco, (int)3.5*XIC,YIC, + xco,yco, (int)4.5*XIC,YIC, &(scene->r.cfra), MINAFRAMEF, MAXFRAMEF, 0, 0, "Displays Current Frame of animation"); - xco += (short)(3.5 * XIC); + xco += (short)(4.5 * XIC); uiBlockBeginAlign(block); @@ -514,32 +410,37 @@ void time_header_buttons(const bContext *C, ARegion *ar) xco+= XIC; uiBlockEndAlign(block); - xco+= 1.5*XIC; + xco+= (short)(0.5*XIC); uiBlockBeginAlign(block); uiDefIconButBitS(block, TOG, AUTOKEY_ON, B_REDRAWALL, ICON_REC, xco, yco, XIC, YIC, &(scene->toolsettings->autokey_mode), 0, 0, 0, 0, "Automatic keyframe insertion for Objects and Bones"); - xco+= XIC; - + xco+= 1*XIC; if (IS_AUTOKEY_ON(scene)) { uiDefButS(block, MENU, B_REDRAWALL, - "Auto-Keying Mode %t|Add/Replace Keys%x3|Replace Keys %x5", - xco, yco, (int)5.5*XIC, YIC, &(scene->toolsettings->autokey_mode), 0, 1, 0, 0, + "Auto-Keying Mode %t|Add/Replace%x3|Replace%x5", + xco, yco, (int)(4.25*XIC), YIC, &(scene->toolsettings->autokey_mode), 0, 1, 0, 0, "Mode of automatic keyframe insertion for Objects and Bones"); - xco+= (5.5*XIC); + xco+= (short)(4.25*XIC); if (animtimer) { uiDefButBitS(block, TOG, ANIMRECORD_FLAG_WITHNLA, B_REDRAWALL, "Layered", - xco,yco, XIC*2.5, YIC, + xco,yco, (int)(3.5*XIC), YIC, &(scene->toolsettings->autokey_flag),0, 1, 0, 0, "Add a new NLA Track + Strip for every loop/pass made over the animation to allow non-destructive tweaking."); - xco+= (3*XIC); + uiBlockEndAlign(block); + + xco+= (short)(3.5*XIC); } + + xco += XIC; + + uiBlockEndAlign(block); + } + else { + xco+= (short)(5.25*XIC); + uiBlockEndAlign(block); } - else - xco+= 6; - - uiBlockEndAlign(block); menustr= ANIM_build_keyingsets_menu(&scene->keyingsets, 0); uiDefButI(block, MENU, B_DIFF, @@ -549,6 +450,9 @@ void time_header_buttons(const bContext *C, ARegion *ar) MEM_freeN(menustr); xco+= (5.5*XIC); + /* NOTE: order of these buttons needs to be kept in sync with other occurances + * (see Outliner header for instance, also +/- stuff for filebrowser) + */ uiBlockBeginAlign(block); uiDefIconButO(block, BUT, "ANIM_OT_delete_keyframe", WM_OP_INVOKE_REGION_WIN, ICON_KEY_DEHLT, xco,yco,XIC,YIC, "Delete Keyframes for the Active Keying Set (Alt-I)"); xco += XIC; @@ -558,8 +462,8 @@ void time_header_buttons(const bContext *C, ARegion *ar) xco+= XIC; - uiDefIconButBitI(block, TOG, TIME_WITH_SEQ_AUDIO, B_DIFF, ICON_SPEAKER, - xco, yco, XIC, YIC, &(stime->redraws), 0, 0, 0, 0, "Play back and sync with audio from Sequence Editor"); + uiDefIconButBitS(block, TOG, AUDIO_SYNC, B_DIFF, ICON_SPEAKER, + xco, yco, XIC, YIC, &(scene->r.audio.flag), 0, 0, 0, 0, "Play back and sync with audio from Sequence Editor"); /* always as last */ diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 5a9790390b7..a5718386554 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -2271,7 +2271,7 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, RegionView3D *rv3d range= (float)(end - start); /* store values */ - ob->flag &= ~OB_POSEMODE; + ob->mode &= ~OB_MODE_POSE; cfrao= CFRA; flago= arm->flag; arm->flag &= ~(ARM_DRAWNAMES|ARM_DRAWAXES); @@ -2308,7 +2308,7 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, RegionView3D *rv3d ob->pose= poseo; arm->flag= flago; armature_rebuild_pose(ob, ob->data); - ob->flag |= OB_POSEMODE; + ob->mode |= OB_MODE_POSE; ob->ipoflag= ipoflago; } @@ -2349,7 +2349,7 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, RegionView3D *rv3d, if (range == 0) return; /* store values */ - ob->flag &= ~OB_POSEMODE; + ob->mode &= ~OB_MODE_POSE; cfrao= CFRA; flago= arm->flag; arm->flag &= ~(ARM_DRAWNAMES|ARM_DRAWAXES); @@ -2388,7 +2388,7 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, RegionView3D *rv3d, ob->pose= poseo; arm->flag= flago; armature_rebuild_pose(ob, ob->data); - ob->flag |= OB_POSEMODE; + ob->mode |= OB_MODE_POSE; } /* draw ghosts around current frame @@ -2415,7 +2415,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base range= (float)(arm->ghostep)*stepsize + 0.5f; /* plus half to make the for loop end correct */ /* store values */ - ob->flag &= ~OB_POSEMODE; + ob->mode &= ~OB_MODE_POSE; cfrao= CFRA; actframe= BKE_nla_tweakedit_remap(adt, (float)CFRA, 0); flago= arm->flag; @@ -2474,7 +2474,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base ob->pose= poseo; arm->flag= flago; armature_rebuild_pose(ob, ob->data); - ob->flag |= OB_POSEMODE; + ob->mode |= OB_MODE_POSE; } /* ********************************** Armature Drawing - Main ************************* */ @@ -2513,10 +2513,10 @@ int draw_armature(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int /* drawing posemode selection indices or colors only in these cases */ if(!(base->flag & OB_FROMDUPLI)) { if(G.f & G_PICKSEL) { - if(ob->flag & OB_POSEMODE) + if(ob->mode & OB_MODE_POSE) arm->flag |= ARM_POSEMODE; } - else if(ob->flag & OB_POSEMODE) { + else if(ob->mode & OB_MODE_POSE) { if (arm->ghosttype == ARM_GHOST_RANGE) { draw_ghost_poses_range(scene, v3d, rv3d, base); } @@ -2530,7 +2530,7 @@ int draw_armature(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int if ((flag & DRAW_SCENESET)==0) { if(ob==OBACT) arm->flag |= ARM_POSEMODE; - else if(G.f & G_WEIGHTPAINT) { + else if(ob->mode & OB_MODE_WEIGHT_PAINT) { if(OBACT && ob==modifiers_isDeformedByArmature(OBACT)) arm->flag |= ARM_POSEMODE; } @@ -2541,7 +2541,7 @@ int draw_armature(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int draw_pose_channels(scene, v3d, rv3d, base, dt); arm->flag &= ~ARM_POSEMODE; - if(ob->flag & OB_POSEMODE) + if(ob->mode & OB_MODE_POSE) UI_ThemeColor(TH_WIRE); /* restore, for extra draw stuff */ } else retval= 1; diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 1807de9efbb..da67bd8707e 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -60,6 +60,7 @@ #include "BKE_material.h" #include "BKE_mesh.h" #include "BKE_object.h" +#include "BKE_paint.h" #include "BKE_property.h" #include "BKE_utildefines.h" @@ -297,9 +298,9 @@ static int set_draw_settings_cached(int clearcache, int textured, MTFace *texfac if (textured!=c_textured || texface!=c_texface) { if (textured ) { - c_badtex= !GPU_set_tpage(texface); + c_badtex= !GPU_set_tpage(texface, !(litob->mode & OB_MODE_TEXTURE_PAINT)); } else { - GPU_set_tpage(0); + GPU_set_tpage(NULL, 0); c_badtex= 0; } c_textured= textured; @@ -377,7 +378,7 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O static void draw_textured_end() { /* switch off textures */ - GPU_set_tpage(0); + GPU_set_tpage(NULL, 0); glShadeModel(GL_FLAT); glDisable(GL_CULL_FACE); @@ -482,7 +483,7 @@ void draw_mesh_text(Scene *scene, Object *ob, int glsl) if(ob == scene->obedit) return; else if(ob==OBACT) - if(FACESEL_PAINT_TEST) + if(paint_facesel_test(ob)) return; ddm = mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH); @@ -562,7 +563,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o if(ob == scene->obedit) { dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, me->edit_mesh); } else if(faceselect) { - if(G.f & G_WEIGHTPAINT) + if(ob->mode & OB_MODE_WEIGHT_PAINT) dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1); else dm->drawMappedFacesTex(dm, draw_tface_mapped__set_draw, me); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 05336d29dc3..cb07796ed67 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -87,9 +87,11 @@ #include "BKE_mball.h" #include "BKE_modifier.h" #include "BKE_object.h" +#include "BKE_paint.h" #include "BKE_particle.h" #include "BKE_property.h" #include "BKE_smoke.h" +#include "BKE_unit.h" #include "BKE_utildefines.h" #include "smoke_API.h" @@ -211,7 +213,7 @@ int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt) return 0; if(!CHECK_OB_DRAWTEXTURE(v3d, dt)) return 0; - if(ob==OBACT && (G.f & G_WEIGHTPAINT)) + if(ob==OBACT && (ob && ob->mode & OB_MODE_WEIGHT_PAINT)) return 0; return ((G.fileflags & G_FILE_GAME_MAT) && @@ -1849,7 +1851,7 @@ static void draw_em_fancy_edges(Scene *scene, View3D *v3d, Mesh *me, DerivedMesh } } -static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, EditMesh *em) +static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, EditMesh *em, UnitSettings *unit) { Mesh *me= ob->data; EditEdge *eed; @@ -1859,18 +1861,20 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E char val[32]; /* Stores the measurement display text here */ char conv_float[5]; /* Use a float conversion matching the grid size */ float area, col[3]; /* area of the face, color of the text to draw */ - + float grid= unit->system ? unit->scale_length : v3d->grid; + int do_split= unit->flag & USER_UNIT_OPT_SPLIT; if(G.f & (G_RENDER_OGL|G_RENDER_SHADOW)) return; /* make the precission of the pronted value proportionate to the gridsize */ - if ((v3d->grid) < 0.01) + + if (grid < 0.01f) strcpy(conv_float, "%.6f"); - else if ((v3d->grid) < 0.1) + else if (grid < 0.1f) strcpy(conv_float, "%.5f"); - else if ((v3d->grid) < 1.0) + else if (grid < 1.0f) strcpy(conv_float, "%.4f"); - else if ((v3d->grid) < 10.0) + else if (grid < 10.0f) strcpy(conv_float, "%.3f"); else strcpy(conv_float, "%.2f"); @@ -1879,13 +1883,13 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E if(v3d->zbuf && (v3d->flag & V3D_ZBUF_SELECT)==0) glDisable(GL_DEPTH_TEST); - if(v3d->zbuf) bglPolygonOffset(rv3d->dist, 5.0); + if(v3d->zbuf) bglPolygonOffset(rv3d->dist, 5.0f); if(me->drawflag & ME_DRAW_EDGELEN) { UI_GetThemeColor3fv(TH_TEXT, col); /* make color a bit more red */ - if(col[0]> 0.5) {col[1]*=0.7; col[2]*= 0.7;} - else col[0]= col[0]*0.7 + 0.3; + if(col[0]> 0.5f) {col[1]*=0.7f; col[2]*= 0.7f;} + else col[0]= col[0]*0.7f + 0.3f; glColor3fv(col); for(eed= em->edges.first; eed; eed= eed->next) { @@ -1894,16 +1898,19 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E VECCOPY(v1, eed->v1->co); VECCOPY(v2, eed->v2->co); - x= 0.5*(v1[0]+v2[0]); - y= 0.5*(v1[1]+v2[1]); - z= 0.5*(v1[2]+v2[2]); + x= 0.5f*(v1[0]+v2[0]); + y= 0.5f*(v1[1]+v2[1]); + z= 0.5f*(v1[2]+v2[2]); if(v3d->flag & V3D_GLOBAL_STATS) { Mat4MulVecfl(ob->obmat, v1); Mat4MulVecfl(ob->obmat, v2); } + if(unit->system) + bUnit_AsString(val, sizeof(val), VecLenf(v1, v2)*unit->scale_length, 3, unit->system, B_UNIT_LENGTH, do_split, FALSE); + else + sprintf(val, conv_float, VecLenf(v1, v2)); - sprintf(val, conv_float, VecLenf(v1, v2)); view3d_object_text_draw_add(x, y, z, val, 0); } } @@ -1914,8 +1921,8 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E UI_GetThemeColor3fv(TH_TEXT, col); /* make color a bit more green */ - if(col[1]> 0.5) {col[0]*=0.7; col[2]*= 0.7;} - else col[1]= col[1]*0.7 + 0.3; + if(col[1]> 0.5f) {col[0]*=0.7f; col[2]*= 0.7f;} + else col[1]= col[1]*0.7f + 0.3f; glColor3fv(col); for(efa= em->faces.first; efa; efa= efa->next) { @@ -1938,7 +1945,11 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E else area = AreaT3Dfl(v1, v2, v3); - sprintf(val, conv_float, area); + if(unit->system) + bUnit_AsString(val, sizeof(val), area*unit->scale_length, 3, unit->system, B_UNIT_LENGTH, do_split, FALSE); // XXX should be B_UNIT_AREA + else + sprintf(val, conv_float, area); + view3d_object_text_draw_add(efa->cent[0], efa->cent[1], efa->cent[2], val, 0); } } @@ -1949,8 +1960,8 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E UI_GetThemeColor3fv(TH_TEXT, col); /* make color a bit more blue */ - if(col[2]> 0.5) {col[0]*=0.7; col[1]*= 0.7;} - else col[2]= col[2]*0.7 + 0.3; + if(col[2]> 0.5f) {col[0]*=0.7f; col[1]*= 0.7f;} + else col[2]= col[2]*0.7f + 0.3f; glColor3fv(col); for(efa= em->faces.first; efa; efa= efa->next) { @@ -1980,13 +1991,13 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E if( (e4->f & e1->f & SELECT) || (G.moving && (efa->v1->f & SELECT)) ) { /* Vec 1 */ sprintf(val,"%.3f", VecAngle3(v4, v1, v2)); - VecLerpf(fvec, efa->cent, efa->v1->co, 0.8); + VecLerpf(fvec, efa->cent, efa->v1->co, 0.8f); view3d_object_text_draw_add(efa->cent[0], efa->cent[1], efa->cent[2], val, 0); } if( (e1->f & e2->f & SELECT) || (G.moving && (efa->v2->f & SELECT)) ) { /* Vec 2 */ sprintf(val,"%.3f", VecAngle3(v1, v2, v3)); - VecLerpf(fvec, efa->cent, efa->v2->co, 0.8); + VecLerpf(fvec, efa->cent, efa->v2->co, 0.8f); view3d_object_text_draw_add(fvec[0], fvec[1], fvec[2], val, 0); } if( (e2->f & e3->f & SELECT) || (G.moving && (efa->v3->f & SELECT)) ) { @@ -1995,14 +2006,14 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E sprintf(val,"%.3f", VecAngle3(v2, v3, v4)); else sprintf(val,"%.3f", VecAngle3(v2, v3, v1)); - VecLerpf(fvec, efa->cent, efa->v3->co, 0.8); + VecLerpf(fvec, efa->cent, efa->v3->co, 0.8f); view3d_object_text_draw_add(fvec[0], fvec[1], fvec[2], val, 0); } /* Vec 4 */ if(efa->v4) { if( (e3->f & e4->f & SELECT) || (G.moving && (efa->v4->f & SELECT)) ) { sprintf(val,"%.3f", VecAngle3(v3, v4, v1)); - VecLerpf(fvec, efa->cent, efa->v4->co, 0.8); + VecLerpf(fvec, efa->cent, efa->v4->co, 0.8f); view3d_object_text_draw_add(fvec[0], fvec[1], fvec[2], val, 0); } } @@ -2011,7 +2022,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E if(v3d->zbuf) { glEnable(GL_DEPTH_TEST); - bglPolygonOffset(rv3d->dist, 0.0); + bglPolygonOffset(rv3d->dist, 0.0f); } } @@ -2096,7 +2107,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object } } - if((me->drawflag & (ME_DRAWFACES)) || FACESEL_PAINT_TEST) { /* transp faces */ + if((me->drawflag & (ME_DRAWFACES)) || paint_facesel_test(ob)) { /* transp faces */ unsigned char col1[4], col2[4], col3[4]; UI_GetThemeColor4ubv(TH_FACE, (char *)col1); @@ -2184,7 +2195,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object } if(me->drawflag & (ME_DRAW_EDGELEN|ME_DRAW_FACEAREA|ME_DRAW_EDGEANG)) - draw_em_measure_stats(v3d, rv3d, ob, em); + draw_em_measure_stats(v3d, rv3d, ob, em, &scene->unit); } if(dt>OB_WIRE) { @@ -2255,7 +2266,7 @@ static void draw_mesh_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW); // Unwanted combination. - if (ob==OBACT && FACESEL_PAINT_TEST) draw_wire = 0; + if (ob==OBACT && paint_facesel_test(ob)) draw_wire = 0; if(dt==OB_BOUNDBOX) { draw_bounding_volume(scene, ob); @@ -2268,12 +2279,12 @@ static void draw_mesh_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base else if(dt==OB_WIRE || totface==0) { draw_wire = 1; /* draw wire only, no depth buffer stuff */ } - else if( (ob==OBACT && (G.f & G_TEXTUREPAINT || FACESEL_PAINT_TEST)) || + else if( (ob==OBACT && (ob->mode & OB_MODE_TEXTURE_PAINT || paint_facesel_test(ob))) || CHECK_OB_DRAWTEXTURE(v3d, dt)) { - int faceselect= (ob==OBACT && FACESEL_PAINT_TEST); + int faceselect= (ob==OBACT && paint_facesel_test(ob)); - if ((v3d->flag&V3D_SELECT_OUTLINE) && (base->flag&SELECT) && !(G.f&G_PICKSEL || FACESEL_PAINT_TEST) && !draw_wire) { + if ((v3d->flag&V3D_SELECT_OUTLINE) && (base->flag&SELECT) && !(G.f&G_PICKSEL || paint_facesel_test(ob)) && !draw_wire) { draw_mesh_object_outline(v3d, ob, dm); } @@ -2327,7 +2338,7 @@ static void draw_mesh_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base if(ob==OBACT) { do_draw= 0; - if( (G.f & G_WEIGHTPAINT)) { + if(ob && ob->mode & OB_MODE_WEIGHT_PAINT) { /* enforce default material settings */ GPU_enable_material(0, NULL); @@ -2347,12 +2358,13 @@ static void draw_mesh_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base GPU_disable_material(); } - else if((G.f & (G_VERTEXPAINT+G_TEXTUREPAINT)) && me->mcol) { - dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1); - } - else if(G.f & (G_VERTEXPAINT+G_TEXTUREPAINT)) { - glColor3f(1.0f, 1.0f, 1.0f); - dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0); + else if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_TEXTURE_PAINT)) { + if(me->mcol) + dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1); + else { + glColor3f(1.0f, 1.0f, 1.0f); + dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0); + } } else do_draw= 1; } @@ -3512,7 +3524,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv } if((part->draw&PART_DRAW_NUM || part->draw&PART_DRAW_HEALTH) && !(G.f & G_RENDER_SHADOW)){ - strcpy(val, ""); + val[0]= '\0'; if(part->draw&PART_DRAW_NUM) sprintf(val, " %i", a); @@ -4776,7 +4788,7 @@ static void drawSolidSelect(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base drawDispListwire(&ob->disp); } else if(ob->type==OB_ARMATURE) { - if(!(ob->flag & OB_POSEMODE)) + if(!(ob->mode & OB_MODE_POSE)) draw_armature(scene, v3d, rv3d, base, OB_WIRE, 0); } @@ -4925,7 +4937,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) /* xray delay? */ if((flag & DRAW_PICKING)==0 && (base->flag & OB_FROMDUPLI)==0) { /* don't do xray in particle mode, need the z-buffer */ - if(!(G.f & G_PARTICLEEDIT)) { + if(!(ob->mode & OB_MODE_PARTICLE_EDIT)) { /* xray and transp are set when it is drawing the 2nd/3rd pass */ if(!v3d->xray && !v3d->transp && (ob->dtx & OB_DRAWXRAY) && !(ob->dtx & OB_DRAWTRANSP)) { add_view3d_after(v3d, base, V3D_XRAY, flag); @@ -5071,7 +5083,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) dtx= 0; /* faceselect exception: also draw solid when dt==wire, except in editmode */ - if(ob==OBACT && (G.f & (G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT))) { + if(ob==OBACT && (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))) { if(ob->type==OB_MESH) { if(ob==scene->obedit); @@ -5284,7 +5296,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) for(psys=ob->particlesystem.first; psys; psys=psys->next) draw_new_particle_system(scene, v3d, rv3d, base, psys, dt); - if(G.f & G_PARTICLEEDIT && ob==OBACT) { + if(ob->mode & OB_MODE_PARTICLE_EDIT && ob==OBACT) { psys= PE_get_current(scene, ob); if(psys && !scene->obedit && psys_in_edit_mode(scene, psys)) draw_particle_edit(scene, v3d, rv3d, ob, psys, dt); @@ -5298,15 +5310,14 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } /* draw code for smoke */ - if(md = modifiers_findByType(ob, eModifierType_Smoke)) + if((md = modifiers_findByType(ob, eModifierType_Smoke))) { SmokeModifierData *smd = (SmokeModifierData *)md; // draw collision objects if((smd->type & MOD_SMOKE_TYPE_COLL) && smd->coll) { - SmokeCollSettings *scs = smd->coll; - /* + /*SmokeCollSettings *scs = smd->coll; if(scs->points) { size_t i; @@ -5351,6 +5362,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) float bigfactor = 1.0; int big = (smd->domain->flags & MOD_SMOKE_HIGHRES) && (smd->domain->viewsettings & MOD_SMOKE_VIEW_USEBIG); int new = 0; + int have_lamp = 0; // GUI sent redraw event if(smd->domain->flags & MOD_SMOKE_VIEW_REDRAWNICE) @@ -5439,7 +5451,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(new > 1) { - float light[3] = {0.0,0.0,2.0}; // TODO: take real LAMP coordinates - dg + float light[3] = {0.0,0.0,0.0}; // TODO: take real LAMP coordinates - dg Base *base_tmp = NULL; for(base_tmp = scene->base.first; base_tmp; base_tmp= base_tmp->next) @@ -5451,6 +5463,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(la->type == LA_LOCAL) { VECCOPY(light, base_tmp->object->obmat[3]); + have_lamp = 1; break; } } @@ -5554,6 +5567,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) tvox = smoke_get_bigtvox(smd, index); tray = smoke_get_bigtray(smd, index); } + + if(!have_lamp) + tray = 1.0; // fill buffer with luminance and alpha // 1 - T_vox @@ -5705,7 +5721,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(G.f & G_RENDER_SHADOW) return; /* object centers, need to be drawn in viewmat space for speed, but OK for picking select */ - if(ob!=OBACT || (G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT))==0) { + if(ob!=OBACT || !(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))) { int do_draw_center= -1; /* defines below are zero or positive... */ if((scene->basact)==base) diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 48ea5cf5df2..8b719dd2d80 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -595,7 +595,7 @@ static void view3d_tools_area_init(wmWindowManager *wm, ARegion *ar) static void view3d_tools_area_draw(const bContext *C, ARegion *ar) { - ED_region_panels(C, ar, 1, view3d_context_string(C), -1); + ED_region_panels(C, ar, 1, CTX_data_mode_string(C), -1); } static int view3d_context(const bContext *C, const char *member, bContextDataResult *result) diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 4b7f7ebed29..9b05f5b25b2 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1002,6 +1002,7 @@ static void view3d_panel_transform_spaces(const bContext *C, Panel *pa) } #endif // XXX not used +#if 0 static void brush_idpoin_handle(bContext *C, ID *id, int event) { Brush **br = current_brush_source(CTX_data_scene(C)); @@ -1032,6 +1033,7 @@ static void brush_idpoin_handle(bContext *C, ID *id, int event) break; } } +#endif static void view3d_panel_object(const bContext *C, Panel *pa) { @@ -1043,7 +1045,6 @@ static void view3d_panel_object(const bContext *C, Panel *pa) Object *ob= OBACT; TransformProperties *tfp; float lim; - static char hexcol[128]; if(ob==NULL) return; @@ -1057,13 +1058,13 @@ static void view3d_panel_object(const bContext *C, Panel *pa) // XXX uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE); - if(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT)) { + if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)) { } else { //bt= uiDefBut(block, TEX, B_IDNAME, "OB: ", 10,180,140,20, ob->id.name+2, 0.0, 21.0, 0, 0, ""); //uiButSetFunc(bt, test_idbutton_cb, ob->id.name, NULL); - if((G.f & G_PARTICLEEDIT)==0) { + if((ob->mode & OB_MODE_PARTICLE_EDIT)==0) { // uiBlockBeginAlign(block); // uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_OBJECTPANELPARENT, "Par:", 160, 180, 140, 20, &ob->parent, "Parent Object"); if((ob->parent) && (ob->partype == PARBONE)) { @@ -1084,7 +1085,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa) if(ob->type==OB_MBALL) v3d_editmetaball_buts(block, ob, lim); else v3d_editvertex_buts(C, block, v3d, ob, lim); } - else if(ob->flag & OB_POSEMODE) { + else if(ob->mode & OB_MODE_POSE) { v3d_posearmature_buts(block, v3d, ob, lim); } else { diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 5e6bfe89165..01bc330267d 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -59,9 +59,11 @@ #include "BKE_key.h" #include "BKE_object.h" #include "BKE_global.h" +#include "BKE_paint.h" #include "BKE_scene.h" #include "BKE_screen.h" #include "BKE_utildefines.h" +#include "BKE_unit.h" #include "RE_pipeline.h" // make_stars @@ -234,15 +236,18 @@ static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, flo } -static void drawgrid(ARegion *ar, View3D *v3d) +#define GRID_MIN_PX 6.0f + +static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, char **grid_unit) { /* extern short bgpicmode; */ RegionView3D *rv3d= ar->regiondata; float wx, wy, x, y, fw, fx, fy, dx; float vec4[4]; char col[3], col2[3]; - short sublines = v3d->gridsubdiv; + *grid_unit= NULL; + vec4[0]=vec4[1]=vec4[2]=0.0; vec4[3]= 1.0; Mat4MulVec4fl(rv3d->persmat, vec4); @@ -256,7 +261,8 @@ static void drawgrid(ARegion *ar, View3D *v3d) x= (wx)*fx/fw; y= (wy)*fy/fw; - vec4[0]=vec4[1]=v3d->grid; + vec4[0]=vec4[1]= (unit->system) ? 1.0 : v3d->grid; + vec4[2]= 0.0; vec4[3]= 1.0; Mat4MulVec4fl(rv3d->persmat, vec4); @@ -272,72 +278,115 @@ static void drawgrid(ARegion *ar, View3D *v3d) /* check zoom out */ UI_ThemeColor(TH_GRID); - if(dx<6.0) { - v3d->gridview*= sublines; - dx*= sublines; - - if(dx<6.0) { + if(unit->system) { + /* Use GRID_MIN_PX*2 for units because very very small grid + * items are less useful when dealing with units */ + void *usys; + int len, i; + double scalar; + float dx_scalar; + float blend_fac; + + bUnit_GetSystem(&usys, &len, unit->system, B_UNIT_LENGTH); + + if(usys) { + i= len; + while(i--) { + scalar= bUnit_GetScaler(usys, i); + + dx_scalar = dx * scalar * unit->scale_length; + if (dx_scalar < (GRID_MIN_PX*2)) + continue; + + /* Store the smallest drawn grid size units name so users know how big each grid cell is */ + if(*grid_unit==NULL) { + *grid_unit= bUnit_GetNameDisplay(usys, i); + v3d->gridview= (scalar * unit->scale_length); + } + blend_fac= 1-((GRID_MIN_PX*2)/dx_scalar); + + /* tweak to have the fade a bit nicer */ + blend_fac= (blend_fac * blend_fac) * 2.0f; + CLAMP(blend_fac, 0.3f, 1.0f); + + + UI_ThemeColorBlend(TH_BACK, TH_GRID, blend_fac); + + drawgrid_draw(ar, wx, wy, x, y, dx_scalar); + } + } + } + else { + short sublines = v3d->gridsubdiv; + + if(dx<GRID_MIN_PX) { v3d->gridview*= sublines; dx*= sublines; - if(dx<6.0) { + if(dx<GRID_MIN_PX) { v3d->gridview*= sublines; - dx*=sublines; - if(dx<6.0); - else { - UI_ThemeColor(TH_GRID); + dx*= sublines; + + if(dx<GRID_MIN_PX) { + v3d->gridview*= sublines; + dx*=sublines; + if(dx<GRID_MIN_PX); + else { + UI_ThemeColor(TH_GRID); + drawgrid_draw(ar, wx, wy, x, y, dx); + } + } + else { // start blending out + UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*10)); drawgrid_draw(ar, wx, wy, x, y, dx); + + UI_ThemeColor(TH_GRID); + drawgrid_draw(ar, wx, wy, x, y, sublines*dx); } } - else { // start blending out - UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0); + else { // start blending out (GRID_MIN_PX < dx < (GRID_MIN_PX*10)) + UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*10)); drawgrid_draw(ar, wx, wy, x, y, dx); - + UI_ThemeColor(TH_GRID); drawgrid_draw(ar, wx, wy, x, y, sublines*dx); } } - else { // start blending out (6 < dx < 60) - UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0); - drawgrid_draw(ar, wx, wy, x, y, dx); - - UI_ThemeColor(TH_GRID); - drawgrid_draw(ar, wx, wy, x, y, sublines*dx); - } - } - else { - if(dx>60.0) { // start blending in - v3d->gridview/= sublines; - dx/= sublines; - if(dx>60.0) { // start blending in + else { + if(dx>(GRID_MIN_PX*10)) { // start blending in v3d->gridview/= sublines; dx/= sublines; - if(dx>60.0) { - UI_ThemeColor(TH_GRID); - drawgrid_draw(ar, wx, wy, x, y, dx); + if(dx>(GRID_MIN_PX*10)) { // start blending in + v3d->gridview/= sublines; + dx/= sublines; + if(dx>(GRID_MIN_PX*10)) { + UI_ThemeColor(TH_GRID); + drawgrid_draw(ar, wx, wy, x, y, dx); + } + else { + UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*10)); + drawgrid_draw(ar, wx, wy, x, y, dx); + UI_ThemeColor(TH_GRID); + drawgrid_draw(ar, wx, wy, x, y, dx*sublines); + } } else { - UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0); + UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*10)); drawgrid_draw(ar, wx, wy, x, y, dx); UI_ThemeColor(TH_GRID); drawgrid_draw(ar, wx, wy, x, y, dx*sublines); } } else { - UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0); + UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*10)); drawgrid_draw(ar, wx, wy, x, y, dx); - UI_ThemeColor(TH_GRID); + UI_ThemeColor(TH_GRID); drawgrid_draw(ar, wx, wy, x, y, dx*sublines); } } - else { - UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0); - drawgrid_draw(ar, wx, wy, x, y, dx); - UI_ThemeColor(TH_GRID); - drawgrid_draw(ar, wx, wy, x, y, dx*sublines); - } } + x+= (wx); y+= (wy); UI_GetThemeColor3ubv(TH_GRID, col); @@ -361,7 +410,7 @@ static void drawgrid(ARegion *ar, View3D *v3d) glDepthMask(1); // enable write in zbuffer } - +#undef GRID_MIN_PX static void drawfloor(Scene *scene, View3D *v3d) { @@ -749,7 +798,7 @@ static void draw_selected_name(Scene *scene, Object *ob, View3D *v3d) } } } - else if(ob->pose && (ob->flag & OB_POSEMODE)) { + else if(ob->pose && (ob->mode & OB_MODE_POSE)) { bPoseChannel *pchan; for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { if((pchan->bone->flag & BONE_ACTIVE) && (pchan->bone->layer & arm->layer)) { @@ -1042,7 +1091,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) { RegionView3D *rv3d= ar->regiondata; - struct Base *base; + struct Base *base = scene->basact; /*for 2.43 release, don't use glext and just define the constant. this to avoid possibly breaking platforms before release.*/ @@ -1054,9 +1103,11 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) int m; #endif - if(G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT || (FACESEL_PAINT_TEST)); - else if((G.f & G_TEXTUREPAINT) && scene->toolsettings && (scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE)); - else if((G.f & G_PARTICLEEDIT) && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)); + if(base && (base->object->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT) || + paint_facesel_test(base->object))); + else if((base && (base->object->mode & OB_MODE_TEXTURE_PAINT)) && + scene->toolsettings && (scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE)); + else if((base && (base->object->mode & OB_MODE_PARTICLE_EDIT)) && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)); else if(scene->obedit && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)); else { v3d->flag &= ~V3D_NEEDBACKBUFDRAW; @@ -1101,7 +1152,6 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) G.f |= G_BACKBUFSEL; - base= (scene->basact); if(base && (base->lay & v3d->lay)) { draw_object_backbufsel(scene, v3d, rv3d, base->object); } @@ -1805,13 +1855,13 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d) /* *********************** customdata **************** */ /* goes over all modes and view3d settings */ -static CustomDataMask get_viewedit_datamask(bScreen *screen) +static CustomDataMask get_viewedit_datamask(bScreen *screen, Object *ob) { CustomDataMask mask = CD_MASK_BAREMESH; ScrArea *sa; /* check if we need tfaces & mcols due to face select or texture paint */ - if(FACESEL_PAINT_TEST || G.f & G_TEXTUREPAINT) + if(paint_facesel_test(ob) || (ob && ob->mode & OB_MODE_TEXTURE_PAINT)) mask |= CD_MASK_MTFACE | CD_MASK_MCOL; /* check if we need tfaces & mcols due to view mode */ @@ -1834,14 +1884,15 @@ static CustomDataMask get_viewedit_datamask(bScreen *screen) } /* check if we need mcols due to vertex paint or weightpaint */ - if(G.f & G_VERTEXPAINT) - mask |= CD_MASK_MCOL; - if(G.f & G_WEIGHTPAINT) - mask |= CD_MASK_WEIGHT_MCOL; - - if(G.f & G_SCULPTMODE) - mask |= CD_MASK_MDISPS; - + if(ob) { + if(ob->mode & OB_MODE_VERTEX_PAINT) + mask |= CD_MASK_MCOL; + if(ob->mode & OB_MODE_WEIGHT_PAINT) + mask |= CD_MASK_WEIGHT_MCOL; + if(ob->mode & OB_MODE_SCULPT) + mask |= CD_MASK_MDISPS; + } + return mask; } @@ -1855,9 +1906,10 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) Object *ob; int retopo= 0, sculptparticle= 0; Object *obact = OBACT; + char *grid_unit= NULL; /* from now on all object derived meshes check this */ - v3d->customdata_mask= get_viewedit_datamask(CTX_wm_screen(C)); + v3d->customdata_mask= get_viewedit_datamask(CTX_wm_screen(C), obact); /* shadow buffers, before we setup matrices */ if(draw_glsl_material(scene, NULL, v3d, v3d->drawtype)) @@ -1929,7 +1981,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) } else { ED_region_pixelspace(ar); - drawgrid(ar, v3d); + drawgrid(&scene->unit, ar, v3d, &grid_unit); /* XXX make function? replaces persp(1) */ glMatrixMode(GL_PROJECTION); wmLoadMatrix(rv3d->winmat); @@ -1983,7 +2035,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) } // retopo= retopo_mesh_check() || retopo_curve_check(); - sculptparticle= (G.f & (G_SCULPTMODE|G_PARTICLEEDIT)) && !scene->obedit; + sculptparticle= (obact && obact->mode & (OB_MODE_SCULPT|OB_MODE_PARTICLE_EDIT)) && !scene->obedit; if(retopo) view3d_update_depths(ar, v3d); @@ -1996,7 +2048,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) } if(!retopo && sculptparticle && !(obact && (obact->dtx & OB_DRAWXRAY))) { - if(G.f & G_SCULPTMODE) + if(obact && obact->mode & OB_MODE_SCULPT) draw_sculpt_depths(scene, ar, v3d); view3d_update_depths(ar, v3d); } @@ -2012,7 +2064,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used! if(!retopo && sculptparticle && (obact && (OBACT->dtx & OB_DRAWXRAY))) { - if(G.f & G_SCULPTMODE) + if(obact && obact->mode & OB_MODE_SCULPT) draw_sculpt_depths(scene, ar, v3d); view3d_update_depths(ar, v3d); } @@ -2060,19 +2112,23 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) if(U.uiflag & USER_SHOW_VIEWPORTNAME) { draw_viewport_name(ar, v3d); } - + if (grid_unit) { /* draw below the viewport name */ + UI_ThemeColor(TH_TEXT_HI); + BLF_draw_default(10, ar->winy-(USER_SHOW_VIEWPORTNAME?40:20), 0.0f, grid_unit); + } + ob= OBACT; if(U.uiflag & USER_DRAWVIEWINFO) draw_selected_name(scene, ob, v3d); /* XXX here was the blockhandlers for floating panels */ - if(G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT || G.f & G_TEXTUREPAINT) { + if(ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)) { v3d->flag |= V3D_NEEDBACKBUFDRAW; // XXX addafterqueue(ar->win, BACKBUFDRAW, 1); } - if((G.f & G_PARTICLEEDIT) && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)) { + if((ob && ob->mode & OB_MODE_PARTICLE_EDIT) && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)) { v3d->flag |= V3D_NEEDBACKBUFDRAW; // XXX addafterqueue(ar->win, BACKBUFDRAW, 1); } diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index acb3a2257dc..5ef64274e72 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -54,6 +54,7 @@ #include "BKE_depsgraph.h" #include "BKE_object.h" #include "BKE_global.h" +#include "BKE_paint.h" #include "BKE_report.h" #include "BKE_scene.h" #include "BKE_screen.h" @@ -904,6 +905,9 @@ static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2. rv3d->persp= V3D_PERSP; smooth_view(C, NULL, v3d->camera, new_ofs, NULL, &new_dist, NULL); } + else { + smooth_view(C, NULL, NULL, new_ofs, NULL, &new_dist, NULL); + } } // XXX BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT); @@ -947,14 +951,14 @@ static int viewcenter_exec(bContext *C, wmOperator *op) /* like a localview with INIT_MINMAX(min, max); - if (G.f & G_WEIGHTPAINT) { + if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) { /* hardcoded exception, we look for the one selected armature */ /* this is weak code this way, we should make a generic active/selection callback interface once... */ Base *base; for(base=scene->base.first; base; base= base->next) { if(TESTBASELIB(v3d, base)) { if(base->object->type==OB_ARMATURE) - if(base->object->flag & OB_POSEMODE) + if(base->object->mode & OB_MODE_POSE) break; } } @@ -966,7 +970,7 @@ static int viewcenter_exec(bContext *C, wmOperator *op) /* like a localview with if(obedit) { ok = minmax_verts(obedit, min, max); /* only selected */ } - else if(ob && (ob->flag & OB_POSEMODE)) { + else if(ob && (ob->mode & OB_MODE_POSE)) { if(ob->pose) { bArmature *arm= ob->data; bPoseChannel *pchan; @@ -987,10 +991,10 @@ static int viewcenter_exec(bContext *C, wmOperator *op) /* like a localview with } } } - else if (FACESEL_PAINT_TEST) { + else if (paint_facesel_test(ob)) { // XXX ok= minmax_tface(min, max); } - else if (G.f & G_PARTICLEEDIT) { + else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT)) { ok= PE_minmax(scene, min, max); } else { @@ -2196,7 +2200,7 @@ void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int mode) rv3d->view = 0; //printf("passing here \n"); // - if (scene->obedit==NULL && ob && !(ob->flag & OB_POSEMODE)) { + if (scene->obedit==NULL && ob && !(ob->mode & OB_MODE_POSE)) { use_sel = 1; } diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 26ca5a07973..2a7b718a664 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -61,6 +61,7 @@ #include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_paint.h" #include "BKE_particle.h" #include "BKE_screen.h" #include "BKE_utildefines.h" /* for VECCOPY */ @@ -79,6 +80,7 @@ #include "RNA_access.h" #include "RNA_define.h" +#include "RNA_enum_types.h" #include "BIF_gl.h" #include "BIF_glutil.h" @@ -104,16 +106,6 @@ * This can be cleaned when I make some new 'mode' icons. */ -#define V3D_OBJECTMODE_SEL ICON_OBJECT_DATA -#define V3D_EDITMODE_SEL ICON_EDITMODE_HLT -#define V3D_SCULPTMODE_SEL ICON_SCULPTMODE_HLT -#define V3D_FACESELECT_SEL ICON_FACESEL_HLT /* this is not a mode anymore - just a switch */ -#define V3D_VERTEXPAINTMODE_SEL ICON_VPAINT_HLT -#define V3D_TEXTUREPAINTMODE_SEL ICON_TPAINT_HLT -#define V3D_WEIGHTPAINTMODE_SEL ICON_WPAINT_HLT -#define V3D_POSEMODE_SEL ICON_POSE_HLT -#define V3D_PARTICLEEDITMODE_SEL ICON_ANIM - #define TEST_EDITMESH if(obedit==0) return; \ if( (v3d->lay & obedit->lay)==0 ) return; @@ -134,29 +126,6 @@ static int retopo_mesh_paint_check() {return 0;} /* end XXX ************* */ - -/* well... in this file a lot of view mode manipulation happens, so let's have it defined here */ -void ED_view3d_exit_paint_modes(bContext *C) -{ - if(G.f & G_TEXTUREPAINT) - WM_operator_name_call(C, "PAINT_OT_texture_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL); - if(G.f & G_VERTEXPAINT) - WM_operator_name_call(C, "PAINT_OT_vertex_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL); - else if(G.f & G_WEIGHTPAINT) - WM_operator_name_call(C, "PAINT_OT_weight_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL); - - if(G.f & G_SCULPTMODE) - WM_operator_name_call(C, "SCULPT_OT_sculptmode_toggle", WM_OP_EXEC_REGION_WIN, NULL); - if(G.f & G_PARTICLEEDIT) - WM_operator_name_call(C, "PARTICLE_OT_particle_edit_toggle", WM_OP_EXEC_REGION_WIN, NULL); - - G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT+G_SCULPTMODE+G_PARTICLEEDIT); -} - - - - - static void do_view3d_header_buttons(bContext *C, void *arg, int event); #define B_SCENELOCK 101 @@ -519,7 +488,7 @@ static void do_view3d_view_alignviewmenu(bContext *C, void *arg, int event) if ((obedit) && (obedit->type == OB_MESH)) { editmesh_align_view_to_selected(v3d, event + 1); } - else if (FACESEL_PAINT_TEST) { + else if (paint_facesel_test(CTX_data_active_object(C))) { Object *obact= OBACT; if (obact && obact->type==OB_MESH) { Mesh *me= obact->data; @@ -571,7 +540,7 @@ static uiBlock *view3d_view_alignviewmenu(bContext *C, ARegion *ar, void *arg_un uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center Cursor and View All|Shift C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align Active Camera to View|Ctrl Alt NumPad 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, ""); - if (((obedit) && (obedit->type == OB_MESH)) || (FACESEL_PAINT_TEST)) { + if (((obedit) && (obedit->type == OB_MESH)) || (paint_facesel_test(CTX_data_active_object(C)))) { uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected (Top)|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected (Front)|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected (Side)|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, ""); @@ -963,112 +932,6 @@ static uiBlock *view3d_select_object_groupedmenu(bContext *C, ARegion *ar, void #endif -static void view3d_select_objectmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border"); - - uiItemS(layout); - - uiItemO(layout, "Select/Deselect All", 0, "OBJECT_OT_select_all_toggle"); - uiItemO(layout, "Inverse", 0, "OBJECT_OT_select_inverse"); - uiItemO(layout, "Random", 0, "OBJECT_OT_select_random"); - uiItemO(layout, "Select All by Layer", 0, "OBJECT_OT_select_by_layer"); - uiItemMenuEnumO(layout, "Select All by Type", 0, "OBJECT_OT_select_by_type", "type"); - uiItemMenuEnumO(layout, "Select Grouped", 0, "OBJECT_OT_select_grouped", "type"); - -#if 0 - uiDefIconTextBlockBut(block, view3d_select_object_layermenu, NULL, ICON_RIGHTARROW_THIN, "Select All by Layer", 0, yco-=20, 120, 19, ""); - uiDefIconTextBlockBut(block, view3d_select_object_typemenu, NULL, ICON_RIGHTARROW_THIN, "Select All by Type", 0, yco-=20, 120, 19, ""); - - uiItemS(layout); - - uiDefIconTextBlockBut(block, view3d_select_object_linkedmenu, NULL, ICON_RIGHTARROW_THIN, "Linked", 0, yco-=20, 120, 19, ""); - uiDefIconTextBlockBut(block, view3d_select_object_groupedmenu, NULL, ICON_RIGHTARROW_THIN, "Grouped", 0, yco-=20, 120, 19, ""); -#endif -} - -static void view3d_select_meshmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border"); - - uiItemS(layout); - - uiItemO(layout, "Select/Deselect All", 0, "MESH_OT_select_all_toggle"); - uiItemO(layout, "Inverse", 0, "MESH_OT_select_inverse"); - - uiItemS(layout); - - uiItemO(layout, "Random...", 0, "MESH_OT_select_random"); // Random... - uiItemO(layout, "Sharp Edges", 0, "MESH_OT_edges_select_sharp"); - uiItemO(layout, "Linked Flat Faces", 0, "MESH_OT_faces_select_linked_flat"); - - uiItemS(layout); - - uiItemEnumO(layout, "Triangles", 0, "MESH_OT_select_by_number_vertices", "type", 3); // Ctrl Alt Shift 3 - uiItemEnumO(layout, "Quads", 0, "MESH_OT_select_by_number_vertices", "type", 4); // Ctrl Alt Shift 4 - uiItemEnumO(layout, "Loose Verts/Edges", 0, "MESH_OT_select_by_number_vertices", "type", 5); // Ctrl Alt Shift 5 - uiItemO(layout, "Similar...", 0, "MESH_OT_select_similar"); - - uiItemS(layout); - - uiItemO(layout, "Less", 0, "MESH_OT_select_more"); - uiItemO(layout, "More", 0, "MESH_OT_select_less"); - - uiItemS(layout); - - uiItemO(layout, "Linked", 0, "MESH_OT_select_linked"); - uiItemO(layout, "Vertex Path", 0, "MESH_OT_select_vertex_path"); // W, Alt 7 - uiItemO(layout, "Edge Loop", 0, "MESH_OT_loop_multi_select"); - uiItemBooleanO(layout, "Edge Ring", 0, "MESH_OT_loop_multi_select", "ring", 1); - - uiItemS(layout); - - uiItemO(layout, NULL, 0, "MESH_OT_loop_to_region"); // Ctrl E 8 - uiItemO(layout, NULL, 0, "MESH_OT_region_to_loop"); // Ctrl E 9 -} - -static void view3d_select_curvemenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - Object *obedit= CTX_data_edit_object(C); - - uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border"); - uiItemO(layout, NULL, 0, "VIEW3D_OT_select_circle"); - - uiItemS(layout); - - uiItemO(layout, NULL, 0, "CURVE_OT_select_all_toggle"); - uiItemO(layout, NULL, 0, "CURVE_OT_select_inverse"); - uiItemO(layout, NULL, 0, "CURVE_OT_select_random"); // Random... - uiItemO(layout, NULL, 0, "CURVE_OT_select_every_nth"); // Every Nth.. - - uiItemS(layout); - - if(obedit->type == OB_SURF) { - uiItemO(layout, NULL, 0, "CURVE_OT_select_row"); - } - else { - uiItemO(layout, NULL, 0, "CURVE_OT_de_select_first"); - uiItemO(layout, NULL, 0, "CURVE_OT_de_select_last"); - uiItemO(layout, NULL, 0, "CURVE_OT_select_next"); - uiItemO(layout, NULL, 0, "CURVE_OT_select_previous"); - } - - uiItemS(layout); - - uiItemO(layout, NULL, 0, "CURVE_OT_select_more"); - uiItemO(layout, NULL, 0, "CURVE_OT_select_less"); - - /* commented out because it seems to only like the LKEY method - based on mouse pointer position :( */ - /* uiItemO(layout, NULL, 0, "CURVE_OT_select_linked"); */ - -#if 0 - G.qual |= LR_CTRLKEY; - select_connected_nurb(); - G.qual &= ~LR_CTRLKEY; - break;*/ -#endif -} - static void view3d_select_metaballmenu(bContext *C, uiLayout *layout, void *arg_unused) { uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border"); @@ -1079,18 +942,19 @@ static void view3d_select_metaballmenu(bContext *C, uiLayout *layout, void *arg_ uiItemO(layout, NULL, 0, "MBALL_OT_select_random_metaelems"); } -static void view3d_select_latticemenu(bContext *C, uiLayout *layout, void *arg_unused) +/* wrapper for python layouts */ +void uiTemplate_view3d_select_metaballmenu(uiLayout *layout, bContext *C) { - uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border"); - uiItemS(layout); - uiItemO(layout, NULL, 0, "LATTICE_OT_select_all_toggle"); + void *arg_unused = NULL; + view3d_select_metaballmenu(C, layout, arg_unused); } static void view3d_select_armaturemenu(bContext *C, uiLayout *layout, void *arg_unused) { PointerRNA ptr; - uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border"); + /* this part of the menu has been moved to python */ + /*uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border"); uiItemS(layout); @@ -1102,7 +966,7 @@ static void view3d_select_armaturemenu(bContext *C, uiLayout *layout, void *arg_ uiItemEnumO(layout, "Parent", 0, "ARMATURE_OT_select_hierarchy", "direction", BONE_SELECT_PARENT); uiItemEnumO(layout, "Child", 0, "ARMATURE_OT_select_hierarchy", "direction", BONE_SELECT_CHILD); - uiItemS(layout); + uiItemS(layout);*/ WM_operator_properties_create(&ptr, "ARMATURE_OT_select_hierarchy"); RNA_boolean_set(&ptr, "extend", 1); @@ -1115,25 +979,17 @@ static void view3d_select_armaturemenu(bContext *C, uiLayout *layout, void *arg_ uiItemFullO(layout, "Extend Child", 0, "ARMATURE_OT_select_hierarchy", ptr.data, WM_OP_EXEC_REGION_WIN); } +/* wrapper for python layouts */ +void uiTemplate_view3d_select_armaturemenu(uiLayout *layout, bContext *C) +{ + void *arg_unused = NULL; + view3d_select_armaturemenu(C, layout, arg_unused); +} + static void view3d_select_posemenu(bContext *C, uiLayout *layout, void *arg_unused) { PointerRNA ptr; - uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border"); - - uiItemS(layout); - - uiItemO(layout, "Select/Deselect All", 0, "POSE_OT_select_all_toggle"); - uiItemO(layout, "Inverse", 0, "POSE_OT_select_inverse"); - uiItemO(layout, "Constraint Target", 0, "POSE_OT_select_constraint_target"); - - uiItemS(layout); - - uiItemEnumO(layout, "Parent", 0, "POSE_OT_select_hierarchy", "direction", BONE_SELECT_PARENT); - uiItemEnumO(layout, "Child", 0, "POSE_OT_select_hierarchy", "direction", BONE_SELECT_CHILD); - - uiItemS(layout); - WM_operator_properties_create(&ptr, "POSE_OT_select_hierarchy"); RNA_boolean_set(&ptr, "extend", 1); RNA_enum_set(&ptr, "direction", BONE_SELECT_PARENT); @@ -1145,6 +1001,13 @@ static void view3d_select_posemenu(bContext *C, uiLayout *layout, void *arg_unus uiItemFullO(layout, "Extend Child", 0, "POSE_OT_select_hierarchy", ptr.data, WM_OP_EXEC_REGION_WIN); } +/* wrapper for python layouts */ +void uiTemplate_view3d_select_posemenu(uiLayout *layout, bContext *C) +{ + void *arg_unused = NULL; + view3d_select_posemenu(C, layout, arg_unused); +} + void do_view3d_select_faceselmenu(bContext *C, void *arg, int event) { #if 0 @@ -1215,6 +1078,14 @@ static uiBlock *view3d_select_faceselmenu(bContext *C, ARegion *ar, void *arg_un return block; } +/* wrapper for python layouts */ +void uiTemplate_view3d_select_faceselmenu(uiLayout *layout, bContext *C) +{ + void *arg_unused = NULL; + ARegion *ar= CTX_wm_region(C); + view3d_select_faceselmenu(C, ar, arg_unused); +} + static void view3d_edit_snapmenu(bContext *C, uiLayout *layout, void *arg_unused) { uiItemO(layout, NULL, 0, "VIEW3D_OT_snap_selected_to_grid"); @@ -1228,6 +1099,7 @@ static void view3d_edit_snapmenu(bContext *C, uiLayout *layout, void *arg_unused uiItemO(layout, NULL, 0, "VIEW3D_OT_snap_cursor_to_active"); } +#if 0 void do_view3d_transform_moveaxismenu(bContext *C, void *arg, int event) { #if 0 @@ -1428,7 +1300,9 @@ static uiBlock *view3d_transform_scaleaxismenu(bContext *C, ARegion *ar, void *a uiTextBoundsBlock(block, 60); return block; } +#endif +#if 0 static void do_view3d_transformmenu(bContext *C, void *arg, int event) { #if 0 @@ -1664,6 +1538,7 @@ static uiBlock *view3d_object_mirrormenu(bContext *C, ARegion *ar, void *arg_unu return block; } #endif +#endif static void view3d_edit_object_transformmenu(bContext *C, uiLayout *layout, void *arg_unused) { @@ -1924,42 +1799,6 @@ static uiBlock *view3d_edit_object_copyattrmenu(bContext *C, ARegion *ar, void * } #endif -static void view3d_edit_object_parentmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, "Make Parent...", 0, "OBJECT_OT_parent_set"); - uiItemO(layout, "Clear Parent...", 0, "OBJECT_OT_parent_clear"); -} - -static void view3d_edit_object_groupmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, NULL, 0, "GROUP_OT_group_create"); - uiItemO(layout, NULL, 0, "GROUP_OT_objects_remove"); - - uiItemS(layout); - - uiItemO(layout, NULL, 0, "GROUP_OT_objects_add_active"); - uiItemO(layout, NULL, 0, "GROUP_OT_objects_remove_active"); -} - -static void view3d_edit_object_trackmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, "Make Track...", 0, "OBJECT_OT_track_set"); - uiItemO(layout, "Clear Track...", 0, "OBJECT_OT_track_clear"); -} - -static void view3d_edit_object_constraintsmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, NULL, 0, "OBJECT_OT_constraint_add_with_targets"); - uiItemO(layout, NULL, 0, "OBJECT_OT_constraints_clear"); -} - -static void view3d_edit_object_showhidemenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, "Show Hidden", 0, "OBJECT_OT_restrictview_clear"); - uiItemO(layout, "Hide Selected", 0, "OBJECT_OT_restrictview_set"); - uiItemBooleanO(layout, "Hide Unselected", 0, "OBJECT_OT_restrictview_set", "unselected", 1); -} - #if 0 #ifndef DISABLE_PYTHON static void do_view3d_edit_object_scriptsmenu(bContext *C, void *arg, int event) @@ -2033,74 +1872,8 @@ static void do_view3d_edit_objectmenu(bContext *C, void *arg, int event) } #endif -static void view3d_edit_objectmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ -#if 0 - Object *ob= CTX_data_active_object(C); - - uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, ""); - uiDefIconTextBlockBut(block, view3d_object_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, ""); -#endif - - uiItemMenuF(layout, "Clear/Apply", 0, view3d_edit_object_transformmenu); - uiItemMenuF(layout, "Snap", 0, view3d_edit_snapmenu); - - uiItemS(layout); - - // TODO: these operators may get renamed - uiItemO(layout, NULL, 0, "ANIM_OT_insert_keyframe_menu"); - uiItemO(layout, NULL, 0, "ANIM_OT_delete_keyframe_v3d"); - - uiItemS(layout); - - uiItemO(layout, NULL, 0, "OBJECT_OT_duplicate"); - uiItemBooleanO(layout, "Duplicate Linked", 0, "OBJECT_OT_duplicate", "linked", 1); - uiItemO(layout, NULL, 0, "OBJECT_OT_delete"); - - uiItemO(layout, NULL, 0, "OBJECT_OT_proxy_make"); -#if 0 - uiDefIconTextBlockBut(block, view3d_edit_object_makelinksmenu, NULL, ICON_RIGHTARROW_THIN, "Make Links", 0, yco-=20, 120, 19, ""); - uiDefIconTextBlockBut(block, view3d_edit_object_singleusermenu, NULL, ICON_RIGHTARROW_THIN, "Make Single User", 0, yco-=20, 120, 19, ""); - uiDefIconTextBlockBut(block, view3d_edit_object_makelocalmenu, NULL, ICON_RIGHTARROW_THIN, "Make Local", 0, yco-=20, 120, 19, ""); - uiDefIconTextBlockBut(block, view3d_edit_object_copyattrmenu, NULL, ICON_RIGHTARROW_THIN, "Copy Attributes", 0, yco-=20, 120, 19, ""); -#endif - - uiItemS(layout); - - uiItemMenuF(layout, "Parent", 0, view3d_edit_object_parentmenu); - uiItemMenuF(layout, "Track", 0, view3d_edit_object_trackmenu); - uiItemMenuF(layout, "Group", 0, view3d_edit_object_groupmenu); - uiItemMenuF(layout, "Constraints", 0, view3d_edit_object_constraintsmenu); - -#if 0 - if(ob && ob->type == OB_MESH) { - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Boolean Operation...|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, ""); - } - - // join... (added already) - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Convert Object Type...|Alt C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, ""); -#endif - uiItemS(layout); - - uiItemO(layout, NULL, 0, "OBJECT_OT_join"); - - uiItemS(layout); - -#if 0 - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move to Layer...|M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, ""); -#endif - - uiItemMenuF(layout, "Show/Hide", 0, view3d_edit_object_showhidemenu); - #if 0 -#ifndef DISABLE_PYTHON - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefIconTextBlockBut(block, view3d_edit_object_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, ""); -#endif -#endif -} - +/* visible buttons ported to python, check ifedout buttons */ static void view3d_edit_mesh_verticesmenu(bContext *C, uiLayout *layout, void *arg_unused) { uiItemO(layout, "Merge...", 0, "MESH_OT_merge"); @@ -2120,45 +1893,10 @@ static void view3d_edit_mesh_verticesmenu(bContext *C, uiLayout *layout, void *a uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Hook|Ctrl H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); // make_parent(); #endif } - -void do_view3d_edit_mesh_edgesmenu(bContext *C, void *arg, int event) -{ -#if 0 - Scene *scene= CTX_data_scene(C); - float fac; - short randfac; - - switch(event) { - case 9: /* Crease SubSurf */ - if(!multires_level1_test()) { - initTransform(TFM_CREASE, CTX_EDGE); - Transform(); - } - break; - case 12: /* Edgeslide */ - EdgeSlide(0,0.0); - break; - case 13: /* Edge Loop Delete */ - if(EdgeLoopDelete()) { - countall(); - ED_undo_push(C, "Erase Edge Loop"); - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - } - break; - case 14: /*Collapse Edges*/ - collapseEdges(); - ED_undo_push(C, "Collapse"); - break; - case 17: /* Adjust Bevel Weight */ - if(!multires_level1_test()) { - initTransform(TFM_BWEIGHT, CTX_EDGE); - Transform(); - } - break; - } #endif -} +#if 0 +/* visible buttons ported to python, check ifedout buttons */ static void view3d_edit_mesh_edgesmenu(bContext *C, uiLayout *layout, void *arg_unused) { uiItemO(layout, NULL, 0, "MESH_OT_edge_face_add"); @@ -2205,38 +1943,11 @@ static void view3d_edit_mesh_edgesmenu(bContext *C, uiLayout *layout, void *arg_ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Collapse", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, ""); #endif } +#endif -static void view3d_edit_mesh_facesmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, NULL, 0, "MESH_OT_edge_face_add"); - uiItemO(layout, NULL, 0, "MESH_OT_fill"); - uiItemO(layout, NULL, 0, "MESH_OT_beauty_fill"); - - uiItemS(layout); - - uiItemO(layout, NULL, 0, "MESH_OT_quads_convert_to_tris"); - uiItemO(layout, NULL, 0, "MESH_OT_tris_convert_to_quads"); - uiItemO(layout, NULL, 0, "MESH_OT_edge_flip"); - - uiItemS(layout); - - uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_smooth"); - uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_flat"); -} - -static void view3d_edit_mesh_normalsmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, "Recalculate Outside", 0, "MESH_OT_normals_make_consistent"); - uiItemBooleanO(layout, "Recalculate Inside", 0, "MESH_OT_normals_make_consistent", "inside", 1); - - uiItemS(layout); - - uiItemO(layout, NULL, 0, "MESH_OT_flip_normals"); -} - +#if 0 void do_view3d_edit_mirrormenu(bContext *C, void *arg, int event) { -#if 0 float mat[3][3]; Mat3One(mat); @@ -2277,7 +1988,6 @@ void do_view3d_edit_mirrormenu(bContext *C, void *arg, int event) Transform(); break; } -#endif } static uiBlock *view3d_edit_mirrormenu(bContext *C, ARegion *ar, void *arg_unused) @@ -2306,13 +2016,7 @@ static uiBlock *view3d_edit_mirrormenu(bContext *C, ARegion *ar, void *arg_unuse uiTextBoundsBlock(block, 60); return block; } - -static void view3d_edit_mesh_showhidemenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, NULL, 0, "MESH_OT_reveal"); - uiItemO(layout, NULL, 0, "MESH_OT_hide"); - uiItemBooleanO(layout, "Hide Unselected", 0, "MESH_OT_hide", "unselected", 1); -} +#endif #ifndef DISABLE_PYTHON #if 0 @@ -2363,6 +2067,8 @@ static void do_view3d_edit_meshmenu(bContext *C, void *arg, int event) } #endif +#if 0 +/* visible buttons ported to python, check ifedout buttons */ static void view3d_edit_meshmenu(bContext *C, uiLayout *layout, void *arg_unused) { Scene *scene= CTX_data_scene(C); @@ -2429,7 +2135,10 @@ static void view3d_edit_meshmenu(bContext *C, uiLayout *layout, void *arg_unused #endif #endif } +#endif +#if 0 +/* visible buttons ported to python, check ifedout buttons */ static void view3d_edit_curve_controlpointsmenu(bContext *C, uiLayout *layout, void *arg_unused) { Object *obedit= CTX_data_edit_object(C); @@ -2453,20 +2162,10 @@ static void view3d_edit_curve_controlpointsmenu(bContext *C, uiLayout *layout, v // XXX uiItemO(layout, NULL, 0, "OBJECT_OT_add_hook"); Add Hook| Ctrl H // add_hook_menu() } +#endif -static void view3d_edit_curve_segmentsmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, NULL, 0, "CURVE_OT_subdivide"); - uiItemO(layout, NULL, 0, "CURVE_OT_switch_direction"); -} - -static void view3d_edit_curve_showhidemenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, NULL, 0, "CURVE_OT_reveal"); - uiItemO(layout, NULL, 0, "CURVE_OT_hide"); - uiItemBooleanO(layout, "Hide Unselected", 0, "CURVE_OT_hide", "unselected", 1); -} - +#if 0 +/* visible buttons ported to python, check ifedout buttons */ static void view3d_edit_curvemenu(bContext *C, uiLayout *layout, void *arg_unused) { Scene *scene= CTX_data_scene(C); @@ -2512,83 +2211,10 @@ static void view3d_edit_curvemenu(bContext *C, uiLayout *layout, void *arg_unuse uiItemMenuF(layout, "Show/Hide Control Points", 0, view3d_edit_curve_showhidemenu); } +#endif -static void view3d_edit_metaball_showhidemenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, NULL, 0, "MBALL_OT_hide_metaelems"); - uiItemO(layout, NULL, 0, "MBALL_OT_reveal_metaelems"); - uiItemBooleanO(layout, "Hide Unselected", 0, "MBALL_OT_hide_metaelems", "unselected", 1); -} - -static void view3d_edit_metaballmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - Scene *scene= CTX_data_scene(C); - ToolSettings *ts= CTX_data_tool_settings(C); - PointerRNA tsptr; - - RNA_pointer_create(&scene->id, &RNA_ToolSettings, ts, &tsptr); - - uiItemO(layout, "Undo Editing", 0, "ED_OT_undo"); - uiItemO(layout, "Redo Editing", 0, "ED_OT_redo"); - - uiItemS(layout); - - uiItemMenuF(layout, "Snap", 0, view3d_edit_snapmenu); - - uiItemS(layout); - - uiItemO(layout, NULL, 0, "MBALL_OT_delete_metaelems"); - uiItemO(layout, NULL, 0, "MBALL_OT_duplicate_metaelems"); - - uiItemS(layout); - - uiItemR(layout, NULL, 0, &tsptr, "proportional_editing", 0, 0, 0); // |O - uiItemMenuEnumR(layout, NULL, 0, &tsptr, "proportional_editing_falloff"); // |Shift O - - uiItemS(layout); - - uiItemMenuF(layout, "Show/Hide Control Points", 0, view3d_edit_metaball_showhidemenu); -} - -static void view3d_edit_text_charsmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - /* the character codes are specified in UTF-8 */ - - uiItemStringO(layout, "Copyright|Alt C", 0, "FONT_OT_text_insert", "text", "\xC2\xA9"); - uiItemStringO(layout, "Registered Trademark|Alt R", 0, "FONT_OT_text_insert", "text", "\xC2\xAE"); - - uiItemS(layout); - - uiItemStringO(layout, "Degree Sign|Alt G", 0, "FONT_OT_text_insert", "text", "\xC2\xB0"); - uiItemStringO(layout, "Multiplication Sign|Alt x", 0, "FONT_OT_text_insert", "text", "\xC3\x97"); - uiItemStringO(layout, "Circle|Alt .", 0, "FONT_OT_text_insert", "text", "\xC2\x8A"); - uiItemStringO(layout, "Superscript 1|Alt 1", 0, "FONT_OT_text_insert", "text", "\xC2\xB9"); - uiItemStringO(layout, "Superscript 2|Alt 2", 0, "FONT_OT_text_insert", "text", "\xC2\xB2"); - uiItemStringO(layout, "Superscript 3|Alt 3", 0, "FONT_OT_text_insert", "text", "\xC2\xB3"); - uiItemStringO(layout, "Double >>|Alt >", 0, "FONT_OT_text_insert", "text", "\xC2\xBB"); - uiItemStringO(layout, "Double <<|Alt <", 0, "FONT_OT_text_insert", "text", "\xC2\xAB"); - uiItemStringO(layout, "Promillage|Alt %", 0, "FONT_OT_text_insert", "text", "\xE2\x80\xB0"); - - uiItemS(layout); - - uiItemStringO(layout, "Dutch Florin|Alt F", 0, "FONT_OT_text_insert", "text", "\xC2\xA4"); - uiItemStringO(layout, "British Pound|Alt L", 0, "FONT_OT_text_insert", "text", "\xC2\xA3"); - uiItemStringO(layout, "Japanese Yen|Alt Y", 0, "FONT_OT_text_insert", "text", "\xC2\xA5"); - - uiItemS(layout); - - uiItemStringO(layout, "German S|Alt S", 0, "FONT_OT_text_insert", "text", "\xC3\x9F"); - uiItemStringO(layout, "Spanish Question Mark|Alt ?", 0, "FONT_OT_text_insert", "text", "\xC2\xBF"); - uiItemStringO(layout, "Spanish Exclamation Mark|Alt !", 0, "FONT_OT_text_insert", "text", "\xC2\xA1"); -} - -static void view3d_edit_textmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, NULL, 0, "FONT_OT_file_paste"); - uiItemS(layout); - uiItemMenuF(layout, "Special Characters", 0, view3d_edit_text_charsmenu); -} - +#if 0 +/* visible buttons ported to python, check ifedout buttons */ static void view3d_edit_latticemenu(bContext *C, uiLayout *layout, void *arg_unused) { Scene *scene= CTX_data_scene(C); @@ -2622,32 +2248,7 @@ static void view3d_edit_latticemenu(bContext *C, uiLayout *layout, void *arg_unu uiItemR(layout, NULL, 0, &tsptr, "proportional_editing", 0, 0, 0); // |O uiItemMenuEnumR(layout, NULL, 0, &tsptr, "proportional_editing_falloff"); // |Shift O } - - -static void view3d_edit_armature_parentmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, NULL, 0, "ARMATURE_OT_parent_set"); - uiItemO(layout, NULL, 0, "ARMATURE_OT_parent_clear"); -} - -static void view3d_edit_armature_rollmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - /* 0 = 'Global', 1 = 'Cursor' */ - // TODO: keep these in sync... - uiItemEnumO(layout, "Clear Roll (Z-Axis Up)", 0, "ARMATURE_OT_calculate_roll", "type", 0); - uiItemEnumO(layout, "Roll to Cursor", 0, "ARMATURE_OT_calculate_roll", "type", 1); - - uiItemS(layout); - - uiItemEnumO(layout, "Set Roll", 0, "TFM_OT_transform", "mode", TFM_BONE_ROLL); -} - -static void view3d_edit_armature_settingsmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemEnumO(layout, "Toggle a Setting", 0, "ARMATURE_OT_flags_set", "mode", 2); - uiItemEnumO(layout, "Enable a Setting", 0, "ARMATURE_OT_flags_set", "mode", 1); - uiItemEnumO(layout, "Disable a Setting", 0, "ARMATURE_OT_flags_set", "mode", 0); -} +#endif #if 0 static void do_view3d_edit_armaturemenu(bContext *C, void *arg, int event) @@ -2673,6 +2274,8 @@ static void do_view3d_edit_armaturemenu(bContext *C, void *arg, int event) } #endif +#if 0 +/* visible buttons ported to python, check ifedout buttons */ static void view3d_edit_armaturemenu(bContext *C, uiLayout *layout, void *arg_unused) { Object *obedit = CTX_data_edit_object(C); @@ -2728,7 +2331,7 @@ static void view3d_edit_armaturemenu(bContext *C, uiLayout *layout, void *arg_un uiItemMenuF(layout, "Bone Settings ", 0, view3d_edit_armature_settingsmenu); } - +#endif static void view3d_pose_armature_transformmenu(bContext *C, uiLayout *layout, void *arg_unused) { @@ -2896,7 +2499,7 @@ static void do_view3d_vpaintmenu(bContext *C, void *arg, int event) BIF_undo(); break; case 1: /* set vertex colors/weight */ - if(FACESEL_PAINT_TEST) + if(paint_facesel_test(CTX_data_active_object(C))) clear_vpaint_selectedfaces(); else /* we know were in vertex paint mode */ clear_vpaint(); @@ -3031,7 +2634,7 @@ static uiBlock *view3d_wpaintmenu(bContext *C, ARegion *ar, void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - if (FACESEL_PAINT_TEST) { + if (paint_facesel_test(CTX_data_active_object(C))) { uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Weight|Shift K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); menunr++; @@ -3059,185 +2662,6 @@ static uiBlock *view3d_wpaintmenu(bContext *C, ARegion *ar, void *arg_unused) return block; } -void do_view3d_sculpt_inputmenu(bContext *C, void *arg, int event) -{ -#if 0 - Scene *scene= CTX_data_scene(C); - SculptData *sd= &scene->sculptdata; - short val; - - switch(event) { - case 0: - sd->flags ^= SCULPT_INPUT_SMOOTH; - ED_undo_push(C, "Smooth stroke"); - break; - case 1: - val= sd->tablet_size; - if(button(&val,0,10,"Tablet Size:")==0) return; - sd->tablet_size= val; - ED_undo_push(C, "Tablet size"); - break; - case 2: - val= sd->tablet_strength; - if(button(&val,0,10,"Tablet Strength:")==0) return; - sd->tablet_strength= val; - ED_undo_push(C, "Tablet strength"); - break; - } - -#endif -} - -void do_view3d_sculptmenu(bContext *C, void *arg, int event) -{ -#if 0 - Scene *scene= CTX_data_scene(C); - ScrArea *sa= CTX_wm_area(C); - View3D *v3d= sa->spacedata.first; - SculptData *sd= &scene->sculptdata; - BrushData *br= sculptmode_brush(); - - switch(event) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - sd->brush_type= event+1; - ED_undo_push(C, "Brush type"); - break; - case 11: - if(v3d) - v3d->pivot_last= !v3d->pivot_last; - break; - case 12: - sd->flags ^= SCULPT_DRAW_FAST; - ED_undo_push(C, "Partial Redraw"); - break; - case 13: - sd->flags ^= SCULPT_DRAW_BRUSH; - ED_undo_push(C, "Draw Brush"); - break; - case 14: - add_blockhandler(sa, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW); - break; - case 15: - sculpt_radialcontrol_start(RADIALCONTROL_ROTATION); - break; - case 16: - sculpt_radialcontrol_start(RADIALCONTROL_STRENGTH); - break; - case 17: - sculpt_radialcontrol_start(RADIALCONTROL_SIZE); - break; -#endif -} - -uiBlock *view3d_sculpt_inputmenu(bContext *C, ARegion *ar, void *arg_unused) -{ - uiBlock *block; - short yco= 0, menuwidth= 120; - Sculpt *sd= CTX_data_tool_settings(C)->sculpt; - - block= uiBeginBlock(C, ar, "view3d_sculpt_inputmenu", UI_EMBOSSP); - uiBlockSetButmFunc(block, do_view3d_sculpt_inputmenu, NULL); - - uiDefIconTextBut(block, BUTM, 1, ((sd->flags & SCULPT_INPUT_SMOOTH) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Smooth Stroke|Shift S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Tablet Size Adjust", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Tablet Strength Adjust", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); - - uiBlockSetDirection(block, UI_RIGHT); - uiTextBoundsBlock(block, 50); - return block; -} - -static void view3d_sculpt_menu(bContext *C, uiLayout *layout, void *arg_unused) -{ - bScreen *sc= CTX_wm_screen(C); - Sculpt *s = CTX_data_tool_settings(C)->sculpt; - PointerRNA rna; - - RNA_pointer_create(&sc->id, &RNA_Sculpt, s, &rna); - - uiItemR(layout, NULL, 0, &rna, "symmetry_x", 0, 0, 0); - uiItemR(layout, NULL, 0, &rna, "symmetry_y", 0, 0, 0); - uiItemR(layout, NULL, 0, &rna, "symmetry_z", 0, 0, 0); - uiItemR(layout, NULL, 0, &rna, "lock_x", 0, 0, 0); - uiItemR(layout, NULL, 0, &rna, "lock_y", 0, 0, 0); - uiItemR(layout, NULL, 0, &rna, "lock_z", 0, 0, 0); - - /* Brush settings */ - RNA_pointer_create(&sc->id, &RNA_Brush, s->brush, &rna); - - /* Curve */ - uiItemS(layout); - uiItemEnumO(layout, NULL, 0, "SCULPT_OT_brush_curve_preset", "mode", BRUSH_PRESET_SHARP); - uiItemEnumO(layout, NULL, 0, "SCULPT_OT_brush_curve_preset", "mode", BRUSH_PRESET_SMOOTH); - uiItemEnumO(layout, NULL, 0, "SCULPT_OT_brush_curve_preset", "mode", BRUSH_PRESET_MAX); - - uiItemS(layout); - - uiItemR(layout, NULL, 0, &rna, "airbrush", 0, 0, 0); - uiItemR(layout, NULL, 0, &rna, "rake", 0, 0, 0); - uiItemR(layout, NULL, 0, &rna, "anchored", 0, 0, 0); - uiItemR(layout, NULL, 0, &rna, "space", 0, 0, 0); - uiItemR(layout, NULL, 0, &rna, "smooth_stroke", 0, 0, 0); - - uiItemR(layout, NULL, 0, &rna, "flip_direction", 0, 0, 0); -} - -uiBlock *view3d_sculptmenu(bContext *C, ARegion *ar, void *arg_unused) -{ - ScrArea *sa= CTX_wm_area(C); - View3D *v3d= sa->spacedata.first; - uiBlock *block; - Sculpt *sd= CTX_data_tool_settings(C)->sculpt; -// XXX const BrushData *br= sculptmode_brush(); - short yco= 0, menuwidth= 120; - - block= uiBeginBlock(C, ar, "view3d_sculptmenu", UI_EMBOSSP); - uiBlockSetButmFunc(block, do_view3d_sculptmenu, NULL); - - uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Sculpt Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 14, ""); - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefIconTextBlockBut(block, view3d_sculpt_inputmenu, NULL, ICON_RIGHTARROW_THIN, "Input Settings", 0, yco-=20, 120, 19, ""); - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefIconTextBut(block, BUTM, 1, ((sd->flags & SCULPT_DRAW_BRUSH) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Display Brush", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, ""); - uiDefIconTextBut(block, BUTM, 1, ((sd->flags & SCULPT_DRAW_FAST) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Partial Redraw", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, ""); - if(v3d) - uiDefIconTextBut(block, BUTM, 1, (v3d->pivot_last ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Pivot Last", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale Brush|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Strengthen Brush|Shift F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Rotate Brush|Ctrl F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - /* XXX uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==FLATTEN_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Flatten|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); - uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==LAYER_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Layer|L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); - uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==GRAB_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Grab|G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); - uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==INFLATE_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Inflate|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); - uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==PINCH_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Pinch|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); - uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==SMOOTH_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Smooth|S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); - uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==DRAW_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Draw|D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");*/ - - - if(ar->alignment==RGN_ALIGN_TOP) { - uiBlockSetDirection(block, UI_DOWN); - } - else { - uiBlockSetDirection(block, UI_TOP); - uiBlockFlipOrder(block); - } - - uiTextBoundsBlock(block, 50); - - return block; -} - static void do_view3d_facesel_showhidemenu(bContext *C, void *arg, int event) { #if 0 @@ -3322,28 +2746,6 @@ static uiBlock *view3d_faceselmenu(bContext *C, ARegion *ar, void *arg_unused) return block; } -static void view3d_select_particlemenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - ToolSettings *ts= CTX_data_tool_settings(C); - - uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border"); - - uiItemS(layout); - - uiItemO(layout, NULL, 0, "PARTICLE_OT_select_all_toggle"); - uiItemO(layout, NULL, 0, "PARTICLE_OT_select_linked"); - - if(ts->particle.selectmode & SCE_SELECT_POINT) { - uiItemO(layout, NULL, 0, "PARTICLE_OT_select_last"); // |W, 4 - uiItemO(layout, NULL, 0, "PARTICLE_OT_select_first"); // |W, 3 - } - - uiItemS(layout); - - uiItemO(layout, NULL, 0, "PARTICLE_OT_select_more"); - uiItemO(layout, NULL, 0, "PARTICLE_OT_select_less"); -} - static void view3d_particle_showhidemenu(bContext *C, uiLayout *layout, void *arg_unused) { uiItemO(layout, NULL, 0, "PARTICLE_OT_reveal"); @@ -3386,10 +2788,7 @@ static char *view3d_modeselect_pup(Scene *scene) str += sprintf(str, "Mode: %%t"); - if(ob) - str += sprintf(str, formatstr, "Object Mode", V3D_OBJECTMODE_SEL, ICON_OBJECT_DATA); - else - str += sprintf(str, formatstr, "Object Mode", V3D_OBJECTMODE_SEL, ICON_OBJECT_DATA); + str += sprintf(str, formatstr, "Object Mode", OB_MODE_OBJECT, ICON_OBJECT_DATA); if(ob==NULL) return string; @@ -3398,26 +2797,25 @@ static char *view3d_modeselect_pup(Scene *scene) || (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT) || (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) { - str += sprintf(str, formatstr, "Edit Mode", V3D_EDITMODE_SEL, ICON_EDITMODE_HLT); + str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT); } if (ob->type == OB_MESH) { - str += sprintf(str, formatstr, "Sculpt Mode", V3D_SCULPTMODE_SEL, ICON_SCULPTMODE_HLT); - /*str += sprintf(str, formatstr, "Face Select", V3D_FACESELECTMODE_SEL, ICON_FACESEL_HLT);*/ - str += sprintf(str, formatstr, "Vertex Paint", V3D_VERTEXPAINTMODE_SEL, ICON_VPAINT_HLT); - str += sprintf(str, formatstr, "Texture Paint", V3D_TEXTUREPAINTMODE_SEL, ICON_TPAINT_HLT); - str += sprintf(str, formatstr, "Weight Paint", V3D_WEIGHTPAINTMODE_SEL, ICON_WPAINT_HLT); + str += sprintf(str, formatstr, "Sculpt Mode", OB_MODE_SCULPT, ICON_SCULPTMODE_HLT); + str += sprintf(str, formatstr, "Vertex Paint", OB_MODE_VERTEX_PAINT, ICON_VPAINT_HLT); + str += sprintf(str, formatstr, "Texture Paint", OB_MODE_TEXTURE_PAINT, ICON_TPAINT_HLT); + str += sprintf(str, formatstr, "Weight Paint", OB_MODE_WEIGHT_PAINT, ICON_WPAINT_HLT); } /* if active object is an armature */ if (ob->type==OB_ARMATURE) { - str += sprintf(str, formatstr, "Pose Mode", V3D_POSEMODE_SEL, ICON_POSE_HLT); + str += sprintf(str, formatstr, "Pose Mode", OB_MODE_POSE, ICON_POSE_HLT); } if (ob->particlesystem.first) { - str += sprintf(str, formatstr, "Particle Mode", V3D_PARTICLEEDITMODE_SEL, ICON_PARTICLEMODE); + str += sprintf(str, formatstr, "Particle Mode", OB_MODE_PARTICLE_EDIT, ICON_PARTICLEMODE); } return (string); @@ -3505,11 +2903,10 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) ToolSettings *ts= CTX_data_tool_settings(C); ScrArea *sa= CTX_wm_area(C); View3D *v3d= sa->spacedata.first; - Base *basact= CTX_data_active_base(C); - Object *ob= CTX_data_active_object(C); Object *obedit = CTX_data_edit_object(C); EditMesh *em= NULL; int bit, ctrl= win->eventstate->ctrl, shift= win->eventstate->shift; + PointerRNA props_ptr; if(obedit && obedit->type==OB_MESH) { em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -3556,79 +2953,10 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) // XXX start_game(); break; case B_MODESELECT: - if (v3d->modeselect == V3D_OBJECTMODE_SEL) { - - v3d->flag &= ~V3D_MODE; - ED_view3d_exit_paint_modes(C); - ED_armature_exit_posemode(C, basact); - if(obedit) - ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */ - } - else if (v3d->modeselect == V3D_EDITMODE_SEL) { - if(!obedit) { - v3d->flag &= ~V3D_MODE; - ED_object_enter_editmode(C, EM_WAITCURSOR); - ED_undo_push(C, "Original"); /* here, because all over code enter_editmode is abused */ - } - } - else if (v3d->modeselect == V3D_SCULPTMODE_SEL) { - if (!(G.f & G_SCULPTMODE)) { - v3d->flag &= ~V3D_MODE; - ED_view3d_exit_paint_modes(C); - if(obedit) ED_object_exit_editmode(C, EM_FREEUNDO|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */ - - WM_operator_name_call(C, "SCULPT_OT_sculptmode_toggle", WM_OP_EXEC_REGION_WIN, NULL); - } - } - else if (v3d->modeselect == V3D_VERTEXPAINTMODE_SEL) { - if (!(G.f & G_VERTEXPAINT)) { - v3d->flag &= ~V3D_MODE; - ED_view3d_exit_paint_modes(C); - if(obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */ - - WM_operator_name_call(C, "PAINT_OT_vertex_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL); - } - } - else if (v3d->modeselect == V3D_TEXTUREPAINTMODE_SEL) { - if (!(G.f & G_TEXTUREPAINT)) { - v3d->flag &= ~V3D_MODE; - ED_view3d_exit_paint_modes(C); - if(obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */ - - WM_operator_name_call(C, "PAINT_OT_texture_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL); - } - } - else if (v3d->modeselect == V3D_WEIGHTPAINTMODE_SEL) { - if (!(G.f & G_WEIGHTPAINT) && (ob && ob->type == OB_MESH) ) { - v3d->flag &= ~V3D_MODE; - ED_view3d_exit_paint_modes(C); - if(obedit) - ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */ - - WM_operator_name_call(C, "PAINT_OT_weight_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL); - } - } - else if (v3d->modeselect == V3D_POSEMODE_SEL) { - - if (ob) { - v3d->flag &= ~V3D_MODE; - if(obedit) - ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */ - - ED_armature_enter_posemode(C, basact); - } - } - else if(v3d->modeselect == V3D_PARTICLEEDITMODE_SEL){ - if (!(G.f & G_PARTICLEEDIT)) { - v3d->flag &= ~V3D_MODE; - ED_view3d_exit_paint_modes(C); - if(obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */ - - WM_operator_name_call(C, "PARTICLE_OT_particle_edit_toggle", WM_OP_EXEC_REGION_WIN, NULL); - } - } - break; - + WM_operator_properties_create(&props_ptr, "OBJECT_OT_mode_set"); + RNA_enum_set(&props_ptr, "mode", v3d->modeselect); + WM_operator_name_call(C, "OBJECT_OT_mode_set", WM_OP_EXEC_REGION_WIN, &props_ptr); + break; case B_AROUND: // XXX handle_view3d_around(); /* copies to other 3d windows */ break; @@ -3688,20 +3016,20 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) case B_MAN_TRANS: if( shift==0 || v3d->twtype==0) { v3d->twtype= V3D_MANIP_TRANSLATE; - ED_area_tag_redraw(sa); } - break; + ED_area_tag_redraw(sa); + break; case B_MAN_ROT: if( shift==0 || v3d->twtype==0) { - v3d->twtype= V3D_MANIP_ROTATE; - ED_area_tag_redraw(sa); + v3d->twtype= V3D_MANIP_ROTATE; } + ED_area_tag_redraw(sa); break; case B_MAN_SCALE: if( shift==0 || v3d->twtype==0) { - v3d->twtype= V3D_MANIP_SCALE; - ED_area_tag_redraw(sa); + v3d->twtype= V3D_MANIP_SCALE; } + ED_area_tag_redraw(sa); break; case B_NDOF: break; @@ -3771,112 +3099,44 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o * height of the header */ xmax= GetButStringLength("Select"); - if (obedit) { - if (ob && ob->type == OB_MESH) { - uiDefMenuBut(block, view3d_select_meshmenu, NULL, "Select", xco,yco, xmax-3, 20, ""); - } else if (ob && (ob->type == OB_CURVE || ob->type == OB_SURF)) { - uiDefMenuBut(block, view3d_select_curvemenu, NULL, "Select", xco, yco, xmax-3, 20, ""); - } else if (ob && ob->type == OB_FONT) { - xmax= 0; - } else if (ob && ob->type == OB_MBALL) { - uiDefMenuBut(block, view3d_select_metaballmenu, NULL, "Select", xco,yco, xmax-3, 20, ""); - } else if (ob && ob->type == OB_LATTICE) { - uiDefMenuBut(block, view3d_select_latticemenu, NULL, "Select", xco, yco, xmax-3, 20, ""); - } else if (ob && ob->type == OB_ARMATURE) { - uiDefMenuBut(block, view3d_select_armaturemenu, NULL, "Select", xco,yco, xmax-3, 20, ""); - } - } else if (FACESEL_PAINT_TEST) { - if (ob && ob->type == OB_MESH) { - uiDefPulldownBut(block, view3d_select_faceselmenu, NULL, "Select", xco,yco, xmax-3, 20, ""); - } - } else if ((G.f & G_VERTEXPAINT) || (G.f & G_TEXTUREPAINT) || (G.f & G_WEIGHTPAINT)) { - uiDefBut(block, LABEL,0,"", xco, 0, xmax, 20, 0, 0, 0, 0, 0, ""); - } else if (G.f & G_PARTICLEEDIT) { - uiDefMenuBut(block, view3d_select_particlemenu, NULL, "Select", xco,yco, xmax-3, 20, ""); - } else { - - if (ob && (ob->flag & OB_POSEMODE)) - uiDefMenuBut(block, view3d_select_posemenu, NULL, "Select", xco,yco, xmax-3, 20, ""); - else - uiDefMenuBut(block, view3d_select_objectmenu, NULL, "Select", xco,yco, xmax-3, 20, ""); - } + xco+= xmax; if (obedit) { - if (ob && ob->type == OB_MESH) { - xmax= GetButStringLength("Mesh"); - uiDefMenuBut(block, view3d_edit_meshmenu, NULL, "Mesh", xco,yco, xmax-3, 20, ""); - xco+= xmax; - } else if (ob && ob->type == OB_CURVE) { - xmax= GetButStringLength("Curve"); - uiDefMenuBut(block, view3d_edit_curvemenu, NULL, "Curve", xco, yco, xmax-3, 20, ""); - xco+= xmax; - } else if (ob && ob->type == OB_SURF) { - xmax= GetButStringLength("Surface"); - uiDefMenuBut(block, view3d_edit_curvemenu, NULL, "Surface", xco, yco, xmax-3, 20, ""); - xco+= xmax; - } else if (ob && ob->type == OB_FONT) { - xmax= GetButStringLength("Text"); - uiDefMenuBut(block, view3d_edit_textmenu, NULL, "Text", xco, yco, xmax-3, 20, ""); - xco+= xmax; - } else if (ob && ob->type == OB_MBALL) { - xmax= GetButStringLength("Metaball"); - uiDefMenuBut(block, view3d_edit_metaballmenu, NULL, "Metaball", xco,yco, xmax-3, 20, ""); - xco+= xmax; - } else if (ob && ob->type == OB_LATTICE) { - xmax= GetButStringLength("Lattice"); - uiDefMenuBut(block, view3d_edit_latticemenu, NULL, "Lattice", xco, yco, xmax-3, 20, ""); - xco+= xmax; - } else if (ob && ob->type == OB_ARMATURE) { - xmax= GetButStringLength("Armature"); - uiDefMenuBut(block, view3d_edit_armaturemenu, NULL, "Armature", xco,yco, xmax-3, 20, ""); - xco+= xmax; - } - } - else if (G.f & G_WEIGHTPAINT) { + else if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) { xmax= GetButStringLength("Paint"); uiDefPulldownBut(block, view3d_wpaintmenu, NULL, "Paint", xco,yco, xmax-3, 20, ""); xco+= xmax; } - else if (G.f & G_VERTEXPAINT) { + else if (ob && ob->mode & OB_MODE_VERTEX_PAINT) { xmax= GetButStringLength("Paint"); uiDefPulldownBut(block, view3d_vpaintmenu, NULL, "Paint", xco,yco, xmax-3, 20, ""); xco+= xmax; } - else if (G.f & G_TEXTUREPAINT) { + else if (ob && ob->mode & OB_MODE_TEXTURE_PAINT) { xmax= GetButStringLength("Paint"); uiDefPulldownBut(block, view3d_tpaintmenu, NULL, "Paint", xco,yco, xmax-3, 20, ""); xco+= xmax; } - else if( G.f & G_SCULPTMODE) { - xmax= GetButStringLength("Sculpt"); - uiDefMenuBut(block, view3d_sculpt_menu, NULL, "Sculpt", xco, yco, xmax-3, 20, ""); - xco+= xmax; - } - else if (FACESEL_PAINT_TEST) { + else if (paint_facesel_test(ob)) { if (ob && ob->type == OB_MESH) { xmax= GetButStringLength("Face"); uiDefPulldownBut(block, view3d_faceselmenu, NULL, "Face", xco,yco, xmax-3, 20, ""); xco+= xmax; } } - else if(G.f & G_PARTICLEEDIT) { + else if(ob && ob->mode & OB_MODE_PARTICLE_EDIT) { xmax= GetButStringLength("Particle"); uiDefMenuBut(block, view3d_particlemenu, NULL, "Particle", xco,yco, xmax-3, 20, ""); xco+= xmax; } else { - if (ob && (ob->flag & OB_POSEMODE)) { + if (ob && (ob->mode & OB_MODE_POSE)) { xmax= GetButStringLength("Pose"); uiDefMenuBut(block, view3d_pose_armaturemenu, NULL, "Pose", xco,yco, xmax-3, 20, ""); xco+= xmax; } - else { - xmax= GetButStringLength("Object"); - uiDefMenuBut(block, view3d_edit_objectmenu, NULL, "Object", xco,yco, xmax-3, 20, ""); - xco+= xmax; - } } *xcoord= xco; @@ -3905,6 +3165,20 @@ static void header_xco_step(ARegion *ar, int *xco, int *yco, int *maxco, int ste } } +/* Returns the icon associated with an object mode */ +static int object_mode_icon(int mode) +{ + EnumPropertyItem *item = object_mode_items; + + while(item->name != NULL) { + if(item->value == mode) + return item->icon; + ++item; + } + + return ICON_OBJECT_DATAMODE; +} + void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) { ARegion *ar= CTX_wm_region(C); @@ -3927,29 +3201,23 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) uiBlockSetEmboss(block, UI_EMBOSS); /* mode */ - v3d->modeselect = V3D_OBJECTMODE_SEL; - - if (obedit) v3d->modeselect = V3D_EDITMODE_SEL; - else if(ob && (ob->flag & OB_POSEMODE)) v3d->modeselect = V3D_POSEMODE_SEL; - else if (G.f & G_SCULPTMODE) v3d->modeselect = V3D_SCULPTMODE_SEL; - else if (G.f & G_WEIGHTPAINT) v3d->modeselect = V3D_WEIGHTPAINTMODE_SEL; - else if (G.f & G_VERTEXPAINT) v3d->modeselect = V3D_VERTEXPAINTMODE_SEL; - else if (G.f & G_TEXTUREPAINT) v3d->modeselect = V3D_TEXTUREPAINTMODE_SEL; - /*else if(G.f & G_FACESELECT) v3d->modeselect = V3D_FACESELECTMODE_SEL;*/ - else if(G.f & G_PARTICLEEDIT) v3d->modeselect = V3D_PARTICLEEDITMODE_SEL; + if(ob) + v3d->modeselect = ob->mode; + else + v3d->modeselect = OB_MODE_OBJECT; v3d->flag &= ~V3D_MODE; /* not sure what the v3d->flag is useful for now... modeselect is confusing */ if(obedit) v3d->flag |= V3D_EDITMODE; - if(ob && (ob->flag & OB_POSEMODE)) v3d->flag |= V3D_POSEMODE; - if(G.f & G_VERTEXPAINT) v3d->flag |= V3D_VERTEXPAINT; - if(G.f & G_WEIGHTPAINT) v3d->flag |= V3D_WEIGHTPAINT; - if (G.f & G_TEXTUREPAINT) v3d->flag |= V3D_TEXTUREPAINT; - if(FACESEL_PAINT_TEST) v3d->flag |= V3D_FACESELECT; - - uiDefIconTextButS(block, MENU, B_MODESELECT, (v3d->modeselect),view3d_modeselect_pup(scene) , - xco,yco,126,20, &(v3d->modeselect), 0, 0, 0, 0, "Mode (Hotkeys: Tab, V, Ctrl Tab)"); + if(ob && (ob->mode & OB_MODE_POSE)) v3d->flag |= V3D_POSEMODE; + if(ob && (ob->mode & OB_MODE_VERTEX_PAINT)) v3d->flag |= V3D_VERTEXPAINT; + if(ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) v3d->flag |= V3D_WEIGHTPAINT; + if(ob && (ob->mode & OB_MODE_TEXTURE_PAINT)) v3d->flag |= V3D_TEXTUREPAINT; + if(paint_facesel_test(ob)) v3d->flag |= V3D_FACESELECT; + + uiDefIconTextButS(block, MENU, B_MODESELECT, object_mode_icon(v3d->modeselect), view3d_modeselect_pup(scene) , + xco,yco,126,20, &(v3d->modeselect), 0, 0, 0, 0, "Mode (Hotkeys: Tab, V, Ctrl Tab)"); header_xco_step(ar, &xco, &yco, &maxco, 126+8); /* DRAWTYPE */ @@ -3989,7 +3257,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) uiBlockEndAlign(block); } } else { - if (obedit==NULL && (G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT))) { + if (obedit==NULL && ((ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)))) { uiDefIconButBitI(block, TOG, G_FACESELECT, B_VIEW_BUTSEDIT, ICON_FACESEL_HLT,xco,yco,XIC,YIC, &G.f, 0, 0, 0, 0, "Painting Mask (FKey)"); header_xco_step(ar, &xco, &yco, &maxco, XIC+10); } else { @@ -4076,7 +3344,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) } /* proportional falloff */ - if((obedit && (obedit->type == OB_MESH || obedit->type == OB_CURVE || obedit->type == OB_SURF || obedit->type == OB_LATTICE)) || G.f & G_PARTICLEEDIT) { + if((obedit && (obedit->type == OB_MESH || obedit->type == OB_CURVE || obedit->type == OB_SURF || obedit->type == OB_LATTICE)) || (ob && ob->mode & OB_MODE_PARTICLE_EDIT)) { uiBlockBeginAlign(block); uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_PROP_OFF, "Proportional %t|Off %x0|On %x1|Connected %x2", xco,yco,XIC+10,YIC, &(ts->proportional), 0, 1.0, 0, 0, "Proportional Edit Falloff (Hotkeys: O, Alt O) "); @@ -4137,7 +3405,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) BKE_mesh_end_editmesh(obedit->data, em); } - else if(G.f & G_PARTICLEEDIT) { + else if(ob && ob->mode & OB_MODE_PARTICLE_EDIT) { uiBlockBeginAlign(block); uiDefIconButBitI(block, TOG, SCE_SELECT_PATH, B_SEL_PATH, ICON_EDGESEL, xco,yco,XIC,YIC, &ts->particle.selectmode, 1.0, 0.0, 0, 0, "Path edit mode"); xco+= XIC; @@ -4157,7 +3425,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) uiDefIconBut(block, BUT, B_VIEWRENDER, ICON_SCENE, xco,yco,XIC,YIC, NULL, 0, 1.0, 0, 0, "Render this window (Ctrl Click for anim)"); - if (ob && (ob->flag & OB_POSEMODE)) { + if (ob && (ob->mode & OB_MODE_POSE)) { xco+= XIC; uiBlockBeginAlign(block); @@ -4174,9 +3442,8 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) } } - - /* always as last */ - UI_view2d_totRect_set(&ar->v2d, maxco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin); + + /* do not do view2d totrect set here, it's now a template */ uiEndBlock(C, block); uiDrawBlock(C, block); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 3e9382509f4..acd1c62bc17 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -140,7 +140,6 @@ void view3d_buttons_register(struct ARegionType *art); void VIEW3D_OT_toolbar(struct wmOperatorType *ot); void view3d_toolbar_register(struct ARegionType *art); void view3d_tool_props_register(struct ARegionType *art); -char *view3d_context_string(const struct bContext *C); /* view3d_snap.c */ int minmax_verts(Object *obedit, float *min, float *max); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index c1fbb676179..7743ede399b 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -59,6 +59,7 @@ #include "BKE_depsgraph.h" #include "BKE_object.h" #include "BKE_global.h" +#include "BKE_paint.h" #include "BKE_scene.h" #include "BKE_screen.h" #include "BKE_utildefines.h" @@ -378,7 +379,7 @@ static void do_lasso_select_objects(ViewContext *vc, short mcords[][2], short mo else ED_base_object_select(base, BA_DESELECT); base->object->flag= base->flag; } - if(base->object->flag & OB_POSEMODE) { + if(base->object->mode & OB_MODE_POSE) { do_lasso_select_pose(vc, mcords, moves, select); } } @@ -693,12 +694,14 @@ static void do_lasso_select_node(short mcords[][2], short moves, short select) void view3d_lasso_select(bContext *C, ViewContext *vc, short mcords[][2], short moves, short select) { + Object *ob = CTX_data_active_object(C); + if(vc->obedit==NULL) { - if(FACESEL_PAINT_TEST) + if(paint_facesel_test(ob)) do_lasso_select_facemode(vc, mcords, moves, select); - else if(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT)) + else if(ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)) ; - else if(G.f & G_PARTICLEEDIT) + else if(ob && ob->mode & OB_MODE_PARTICLE_EDIT) PE_lasso_select(C, mcords, moves, select); else do_lasso_select_objects(vc, mcords, moves, select); @@ -1109,7 +1112,7 @@ static void mouse_select(bContext *C, short *mval, short extend, short obcenter) WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, basact->object); /* in weightpaint, we use selected bone to select vertexgroup, so no switch to new active object */ - if(G.f & G_WEIGHTPAINT) { + if(basact->object->mode & OB_MODE_WEIGHT_PAINT) { /* prevent activating */ basact= NULL; } @@ -1323,6 +1326,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) ScrArea *sa= CTX_wm_area(C); View3D *v3d= sa->spacedata.first; Object *obedit= CTX_data_edit_object(C); + Object *obact= CTX_data_active_object(C); rcti rect; Base *base; MetaElem *ml; @@ -1341,11 +1345,11 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) rect.xmax= RNA_int_get(op->ptr, "xmax"); rect.ymax= RNA_int_get(op->ptr, "ymax"); - if(obedit==NULL && (FACESEL_PAINT_TEST)) { + if(obedit==NULL && (paint_facesel_test(OBACT))) { // XXX face_borderselect(); return OPERATOR_FINISHED; } - else if(obedit==NULL && (G.f & G_PARTICLEEDIT)) { + else if(obedit==NULL && (obact && obact->mode & OB_MODE_PARTICLE_EDIT)) { return PE_border_select(C, &rect, (val==LEFTMOUSE)); } @@ -1453,7 +1457,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) int bone_only; int totobj= MAXPICKBUF; // XXX solve later - if((ob) && (ob->flag & OB_POSEMODE)) + if((ob) && (ob->mode & OB_MODE_POSE)) bone_only= 1; else bone_only= 0; @@ -1558,6 +1562,7 @@ void VIEW3D_OT_select_border(wmOperatorType *ot) static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event) { Object *obedit= CTX_data_edit_object(C); + Object *obact= CTX_data_active_object(C); short extend= RNA_boolean_get(op->ptr, "extend"); view3d_operator_needs_opengl(C); @@ -1575,7 +1580,7 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event) mouse_mball(C, event->mval, extend); } - else if(G.f & G_PARTICLEEDIT) + else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) PE_mouse_particles(C, event->mval, extend); else mouse_select(C, event->mval, extend, 0); @@ -1637,9 +1642,9 @@ static void mesh_circle_select(ViewContext *vc, int selecting, short *mval, floa { ToolSettings *ts= vc->scene->toolsettings; int bbsel; + Object *ob= vc->obact; - if(vc->obedit==NULL && (FACESEL_PAINT_TEST)) { - Object *ob= vc->obact; + if(vc->obedit==NULL && paint_facesel_test(ob)) { Mesh *me = ob?ob->data:NULL; if (me) { @@ -1778,12 +1783,13 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op) ScrArea *sa= CTX_wm_area(C); ARegion *ar= CTX_wm_region(C); Scene *scene= CTX_data_scene(C); + Object *obact= CTX_data_active_object(C); View3D *v3d= sa->spacedata.first; int x= RNA_int_get(op->ptr, "x"); int y= RNA_int_get(op->ptr, "y"); int radius= RNA_int_get(op->ptr, "radius"); - if(CTX_data_edit_object(C) || (G.f & G_PARTICLEEDIT)) { + if(CTX_data_edit_object(C) || (obact && obact->mode & OB_MODE_PARTICLE_EDIT)) { ViewContext vc; short mval[2], selecting; @@ -1794,8 +1800,10 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op) mval[1]= y; selecting= LEFTMOUSE==RNA_int_get(op->ptr, "event_type"); // XXX solve - if(CTX_data_edit_object(C)) + if(CTX_data_edit_object(C)) { obedit_circle_select(&vc, selecting, mval, (float)radius); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obact); + } else return PE_circle_select(C, selecting, mval, (float)radius); } diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index fba8d13c6a5..335bc2c9e56 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -482,7 +482,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *op) CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { ob= base->object; - if(ob->flag & OB_POSEMODE) { + if(ob->mode & OB_MODE_POSE) { bPoseChannel *pchan; bArmature *arm= ob->data; @@ -609,7 +609,7 @@ static int snap_sel_to_curs(bContext *C, wmOperator *op) else { CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { ob= base->object; - if(ob->flag & OB_POSEMODE) { + if(ob->mode & OB_MODE_POSE) { bPoseChannel *pchan; bArmature *arm= ob->data; float cursp[3]; @@ -775,7 +775,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *op) else { Object *ob= OBACT; - if(ob && (ob->flag & OB_POSEMODE)) { + if(ob && (ob->mode & OB_MODE_POSE)) { bArmature *arm= ob->data; bPoseChannel *pchan; for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) { @@ -935,7 +935,7 @@ static int snap_selected_to_center(bContext *C, wmOperator *op) CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { ob= base->object; - if(ob->flag & OB_POSEMODE) { + if(ob->mode & OB_MODE_POSE) { bPoseChannel *pchan; bArmature *arm= ob->data; @@ -1004,7 +1004,7 @@ static int snap_selected_to_center(bContext *C, wmOperator *op) CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { ob= base->object; - if(ob->flag & OB_POSEMODE) { + if(ob->mode & OB_MODE_POSE) { bPoseChannel *pchan; bArmature *arm= ob->data; diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 67d8bc3e5ee..32378a915bd 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -118,6 +118,19 @@ static void redo_cb(bContext *C, void *arg_op, void *arg2) } } +static wmOperator *view3d_last_operator(const bContext *C) +{ + wmWindowManager *wm= CTX_wm_manager(C); + wmOperator *op; + + /* only for operators that are registered and did an undo push */ + for(op= wm->operators.last; op; op= op->prev) + if((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO)) + break; + + return op; +} + static void view3d_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOperator *op) { wmWindowManager *wm= CTX_wm_manager(C); @@ -129,28 +142,32 @@ static void view3d_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOper } RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - uiDefAutoButsRNA(C, pa->layout, &ptr, 1); - + if(op->type->ui) + op->type->ui((bContext*)C, &ptr, pa->layout); + else + uiDefAutoButsRNA(C, pa->layout, &ptr, 1); +} + +static void view3d_panel_operator_redo_header(const bContext *C, Panel *pa) +{ + wmOperator *op= view3d_last_operator(C); + + if(op) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname)); + else BLI_strncpy(pa->drawname, "Operator", sizeof(pa->drawname)); } static void view3d_panel_operator_redo(const bContext *C, Panel *pa) { - wmWindowManager *wm= CTX_wm_manager(C); - wmOperator *op; + wmOperator *op= view3d_last_operator(C); uiBlock *block; - block= uiLayoutGetBlock(pa->layout); - - /* only for operators that are registered and did an undo push */ - for(op= wm->operators.last; op; op= op->prev) - if((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO)) - break; - if(op==NULL) return; if(op->type->poll && op->type->poll((bContext *)C)==0) return; + block= uiLayoutGetBlock(pa->layout); + uiBlockSetFunc(block, redo_cb, op, NULL); if(op->macro.first) { @@ -164,42 +181,6 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa) /* ******************* */ -char *view3d_context_string(const bContext *C) -{ - Object *obedit= CTX_data_edit_object(C); - - if(obedit) { - switch(obedit->type) { - case OB_MESH: - return "editmode_mesh"; - case OB_CURVE: - return "editmode_curve"; - case OB_SURF: - return "editmode_surface"; - case OB_FONT: - return "editmode_text"; - case OB_ARMATURE: - return "editmode_armature"; - case OB_MBALL: - return "editmode_mball"; - case OB_LATTICE: - return "editmode_lattice"; - } - } - else { - Object *ob = CTX_data_active_object(C); - - if(ob && (ob->flag & OB_POSEMODE)) return "pose_mode"; - else if (G.f & G_SCULPTMODE) return "sculpt_mode"; - else if (G.f & G_WEIGHTPAINT) return "weight_paint"; - else if (G.f & G_VERTEXPAINT) return "vertex_paint"; - else if (G.f & G_TEXTUREPAINT) return "texture_paint"; - else if(G.f & G_PARTICLEEDIT) return "particle_mode"; - } - - return "objectmode"; -} - typedef struct CustomTool { struct CustomTool *next, *prev; char opname[OP_MAX_TYPENAME]; @@ -215,7 +196,7 @@ static void operator_call_cb(struct bContext *C, void *arg_listbase, void *arg2) BLI_addtail(arg_listbase, ct); BLI_strncpy(ct->opname, ot->idname, OP_MAX_TYPENAME); - BLI_strncpy(ct->context, view3d_context_string(C), OP_MAX_TYPENAME); + BLI_strncpy(ct->context, CTX_data_mode_string(C), OP_MAX_TYPENAME); } } @@ -278,7 +259,7 @@ static void view3d_panel_tool_shelf(const bContext *C, Panel *pa) SpaceLink *sl= CTX_wm_space_data(C); SpaceType *st= NULL; uiLayout *col; - const char *context= view3d_context_string(C); + const char *context= CTX_data_mode_string(C); if(sl) st= BKE_spacetype_from_id(sl->spacetype); @@ -315,7 +296,8 @@ void view3d_tool_props_register(ARegionType *art) pt= MEM_callocN(sizeof(PanelType), "spacetype view3d panel last operator"); strcpy(pt->idname, "VIEW3D_PT_last_operator"); - strcpy(pt->label, "Last Operator"); + strcpy(pt->label, "Operator"); + pt->draw_header= view3d_panel_operator_redo_header; pt->draw= view3d_panel_operator_redo; BLI_addtail(&art->paneltypes, pt); } diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 20e0a79f0c7..58b7a70a128 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1389,12 +1389,13 @@ static ListBase queue_back; static void SaveState(bContext *C) { wmWindow *win= CTX_wm_window(C); + Object *obact = CTX_data_active_object(C); glPushAttrib(GL_ALL_ATTRIB_BITS); GPU_state_init(); - if(G.f & G_TEXTUREPAINT) + if(obact && obact->mode & OB_MODE_TEXTURE_PAINT) GPU_paint_set_mipmap(1); queue_back= win->queue; @@ -1407,8 +1408,9 @@ static void SaveState(bContext *C) static void RestoreState(bContext *C) { wmWindow *win= CTX_wm_window(C); + Object *obact = CTX_data_active_object(C); - if(G.f & G_TEXTUREPAINT) + if(obact && obact->mode & OB_MODE_TEXTURE_PAINT) GPU_paint_set_mipmap(0); //XXX curarea->win_swap = 0; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 510193fdade..dd7cebdfe3f 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -89,6 +89,7 @@ #include "BKE_pointcache.h" #include "BKE_utildefines.h" #include "BKE_context.h" +#include "BKE_unit.h" //#include "BSE_view.h" @@ -3039,12 +3040,22 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) { applyAspectRatio(t, dvec); dist = VecLength(vec); - sprintf(&tvec[0], "%.4f", dvec[0]); - sprintf(&tvec[20], "%.4f", dvec[1]); - sprintf(&tvec[40], "%.4f", dvec[2]); + if(t->scene->unit.system) { + int i, do_split= t->scene->unit.flag & USER_UNIT_OPT_SPLIT ? 1:0; + + for(i=0; i<3; i++) + bUnit_AsString(&tvec[i*20], 20, dvec[i]*t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, do_split, 1); + } + else { + sprintf(&tvec[0], "%.4f", dvec[0]); + sprintf(&tvec[20], "%.4f", dvec[1]); + sprintf(&tvec[40], "%.4f", dvec[2]); + } } - if( dist > 1e10 || dist < -1e10 ) /* prevent string buffer overflow */ + if(t->scene->unit.system) + bUnit_AsString(distvec, sizeof(distvec), dist*t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, t->scene->unit.flag & USER_UNIT_OPT_SPLIT, 0); + else if( dist > 1e10 || dist < -1e10 ) /* prevent string buffer overflow */ sprintf(distvec, "%.4e", dist); else sprintf(distvec, "%.4f", dist); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 40e133f554f..57a77ae75b8 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -917,7 +917,7 @@ static short pose_grab_with_ik(Object *ob) Bone *bonec; short tot_ik= 0; - if ((ob==NULL) || (ob->pose==NULL) || (ob->flag & OB_POSEMODE)==0) + if ((ob==NULL) || (ob->pose==NULL) || (ob->mode & OB_MODE_POSE)==0) return 0; arm = ob->data; @@ -4898,7 +4898,7 @@ void special_aftertrans_update(TransInfo *t) // allqueue(REDRAWBUTSEDIT, 0); } - else if(G.f & G_PARTICLEEDIT) { + else if(t->scene->basact && (ob = t->scene->basact->object) && ob->mode & OB_MODE_PARTICLE_EDIT) { ; } else { @@ -4957,9 +4957,9 @@ static void createTransObject(bContext *C, TransInfo *t) set_trans_object_base_flags(C, t); /* count */ +#if 0 // TRANSFORM_FIX_ME CTX_DATA_BEGIN(C, Object*, ob, selected_objects) { -#if 0 // TRANSFORM_FIX_ME /* store ipo keys? */ if ((ob->id.lib == 0) && (ob->ipo) && (ob->ipo->showkey) && (ob->ipoflag & OB_DRAWKEY)) { elems.first= elems.last= NULL; @@ -4973,12 +4973,14 @@ static void createTransObject(bContext *C, TransInfo *t) if(elems.first==NULL) t->total++; } -#endif // else { t->total++; // } } CTX_DATA_END; +#else + t->total= CTX_DATA_COUNT(C, selected_objects); +#endif if(!t->total) { /* clear here, main transform function escapes too */ @@ -5232,18 +5234,18 @@ void createTransData(bContext *C, TransInfo *t) t->poseobj = ob; /* <- tsk tsk, this is going to give issues one day */ } } - else if (ob && (ob->flag & OB_POSEMODE)) { + else if (ob && (ob->mode & OB_MODE_POSE)) { // XXX this is currently limited to active armature only... // XXX active-layer checking isn't done as that should probably be checked through context instead createTransPose(C, t, ob); } - else if (G.f & G_WEIGHTPAINT) { + else if (ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) { /* exception, we look for the one selected armature */ CTX_DATA_BEGIN(C, Object*, ob_armature, selected_objects) { if(ob_armature->type==OB_ARMATURE) { - if(ob_armature->flag & OB_POSEMODE) + if(ob_armature->mode & OB_MODE_POSE) { createTransPose(C, t, ob_armature); break; @@ -5252,7 +5254,7 @@ void createTransData(bContext *C, TransInfo *t) } CTX_DATA_END; } - else if (G.f & G_PARTICLEEDIT && PE_can_edit(PE_get_current(scene, ob))) { + else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_can_edit(PE_get_current(scene, ob))) { createTransParticleVerts(C, t); if(t->data && t->flag & T_PROP_EDIT) { diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 9e04799d77e..168a65a2e75 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -343,11 +343,11 @@ static void animrecord_check_state (Scene *scene, ID *id, wmTimer *animtimer) void recalcData(TransInfo *t) { Scene *scene = t->scene; - Base *base; + Base *base = scene->basact; if (t->obedit) { } - else if(G.f & G_PARTICLEEDIT) { + else if(base && base->object->mode & OB_MODE_PARTICLE_EDIT) { flushTransParticles(t); } if (t->spacetype==SPACE_NODE) { @@ -765,7 +765,7 @@ void recalcData(TransInfo *t) */ // TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes? if ((t->animtimer) && IS_AUTOKEY_ON(t->scene)) { - short targetless_ik= (t->flag & T_AUTOIK); // XXX this currently doesn't work, since flags aren't set yet! + int targetless_ik= (t->flag & T_AUTOIK); // XXX this currently doesn't work, since flags aren't set yet! animrecord_check_state(t->scene, &ob->id, t->animtimer); autokeyframe_pose_cb_func(t->scene, (View3D *)t->view, ob, t->mode, targetless_ik); diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 3366f8d72d7..37fd79e38e1 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -338,7 +338,7 @@ int calc_manipulator_stats(const bContext *C) Mat4MulVecfl(obedit->obmat, scene->twmax); } } - else if(ob && (ob->flag & OB_POSEMODE)) { + else if(ob && (ob->mode & OB_MODE_POSE)) { bPoseChannel *pchan; int mode = TFM_ROTATION; // mislead counting bones... bah. We don't know the manipulator mode, could be mixed @@ -358,10 +358,10 @@ int calc_manipulator_stats(const bContext *C) Mat4MulVecfl(ob->obmat, scene->twmax); } } - else if(G.f & (G_VERTEXPAINT + G_TEXTUREPAINT + G_WEIGHTPAINT + G_SCULPTMODE)) { + else if(ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))) { ; } - else if(G.f & G_PARTICLEEDIT) { + else if(ob && ob->mode & OB_MODE_PARTICLE_EDIT) { ParticleSystem *psys= PE_get_current(scene, ob); ParticleData *pa = psys->particles; ParticleEditKey *ek; @@ -412,7 +412,7 @@ int calc_manipulator_stats(const bContext *C) switch(v3d->twmode) { case V3D_MANIP_NORMAL: - if(obedit || ob->flag & OB_POSEMODE) { + if(obedit || ob->mode & OB_MODE_POSE) { float mat[3][3]; int type; @@ -1415,7 +1415,7 @@ void BIF_draw_manipulator(const bContext *C) rv3d->twmat[3][2]= (scene->twmin[2] + scene->twmax[2])/2.0f; if(v3d->around==V3D_ACTIVE && scene->obedit==NULL) { Object *ob= OBACT; - if(ob && !(ob->flag & OB_POSEMODE)) + if(ob && !(ob->mode & OB_MODE_POSE)) VECCOPY(rv3d->twmat[3], ob->obmat[3]); } break; diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 605eb6996a5..8f9d6108e37 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -87,7 +87,7 @@ void BIF_manageTransformOrientation(bContext *C, int confirm, int set) { else if (obedit->type == OB_ARMATURE) index = manageBoneSpace(C, confirm, set); } - else if (ob && (ob->flag & OB_POSEMODE)) { + else if (ob && (ob->mode & OB_MODE_POSE)) { index = manageBoneSpace(C, confirm, set); } else { @@ -487,7 +487,7 @@ void initTransformOrientation(bContext *C, TransInfo *t) break; case V3D_MANIP_NORMAL: - if(obedit || ob->flag & OB_POSEMODE) { + if(obedit || ob->mode & OB_MODE_POSE) { float mat[3][3]; int type; @@ -864,7 +864,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], Mat3MulVecfl(mat, plane); } } - else if(ob && (ob->flag & OB_POSEMODE)) + else if(ob && (ob->mode & OB_MODE_POSE)) { bArmature *arm= ob->data; bPoseChannel *pchan; @@ -894,10 +894,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], result = ORIENTATION_EDGE; } } - else if(G.f & (G_VERTEXPAINT + G_TEXTUREPAINT + G_WEIGHTPAINT + G_SCULPTMODE)) - { - } - else if(G.f & G_PARTICLEEDIT) + else if(ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT|OB_MODE_PARTICLE_EDIT))) { } else { diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index e175f7c1393..18159414cf6 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -79,6 +79,7 @@ void ED_undo_push(bContext *C, char *str) { wmWindowManager *wm= CTX_wm_manager(C); Object *obedit= CTX_data_edit_object(C); + Object *obact= CTX_data_active_object(C); if(obedit) { if (U.undosteps == 0) return; @@ -96,7 +97,7 @@ void ED_undo_push(bContext *C, char *str) else if (obedit->type==OB_ARMATURE) undo_push_armature(C, str); } - else if(G.f & G_PARTICLEEDIT) { + else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) { if (U.undosteps == 0) return; PE_undo_push(CTX_data_scene(C), str); @@ -115,12 +116,13 @@ void ED_undo_push(bContext *C, char *str) static int ed_undo_step(bContext *C, int step, const char *undoname) { Object *obedit= CTX_data_edit_object(C); + Object *obact= CTX_data_active_object(C); ScrArea *sa= CTX_wm_area(C); if(sa && sa->spacetype==SPACE_IMAGE) { SpaceImage *sima= (SpaceImage *)sa->spacedata.first; - if(G.f & G_TEXTUREPAINT || sima->flag & SI_DRAWTOOL) { + if((obact && obact->mode & OB_MODE_TEXTURE_PAINT) || sima->flag & SI_DRAWTOOL) { undo_imagepaint_step(step); WM_event_add_notifier(C, NC_WINDOW, NULL); @@ -142,9 +144,9 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) else { int do_glob_undo= 0; - if(G.f & G_TEXTUREPAINT) + if(obact && obact->mode & OB_MODE_TEXTURE_PAINT) undo_imagepaint_step(step); - else if(G.f & G_PARTICLEEDIT) { + else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) { if(step==1) PE_undo(CTX_data_scene(C)); else @@ -209,13 +211,14 @@ static int ed_redo_exec(bContext *C, wmOperator *op) void ED_undo_menu(bContext *C) { Object *obedit= CTX_data_edit_object(C); + Object *obact= CTX_data_active_object(C); if(obedit) { //if ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE) // undo_editmode_menu(); } else { - if(G.f & G_PARTICLEEDIT) + if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) PE_undo_menu(CTX_data_scene(C), CTX_data_active_object(C)); else if(U.uiflag & USER_GLOBALUNDO) { char *menu= BKE_undo_menu_string(); diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h index 802f30506f8..82ff51dc5ce 100644 --- a/source/blender/gpu/GPU_draw.h +++ b/source/blender/gpu/GPU_draw.h @@ -78,7 +78,7 @@ int GPU_get_material_blend_mode(void); * be drawn using one or the other * - passing NULL clears the state again */ -int GPU_set_tpage(struct MTFace *tface); +int GPU_set_tpage(struct MTFace *tface, int mipmap); /* Lights * - returns how many lights were enabled @@ -105,10 +105,10 @@ void GPU_paint_set_mipmap(int mipmap); /* Image updates and free * - these deal with images bound as opengl textures */ -void GPU_paint_update_image(struct Image *ima, int x, int y, int w, int h); +void GPU_paint_update_image(struct Image *ima, int x, int y, int w, int h, int mipmap); void GPU_update_images_framechange(void); int GPU_update_image_time(struct Image *ima, double time); -int GPU_verify_image(struct Image *ima, int tftile, int tfmode, int compare); +int GPU_verify_image(struct Image *ima, int tftile, int tfmode, int compare, int mipmap); void GPU_free_image(struct Image *ima); void GPU_free_images(void); diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h index 7218b6b1328..eba585e8838 100644 --- a/source/blender/gpu/GPU_extensions.h +++ b/source/blender/gpu/GPU_extensions.h @@ -75,7 +75,7 @@ GPUTexture *GPU_texture_create_1D(int w, float *pixels); GPUTexture *GPU_texture_create_2D(int w, int h, float *pixels); GPUTexture *GPU_texture_create_depth(int w, int h); GPUTexture *GPU_texture_from_blender(struct Image *ima, - struct ImageUser *iuser, double time); + struct ImageUser *iuser, double time, int mipmap); void GPU_texture_free(GPUTexture *tex); void GPU_texture_ref(GPUTexture *tex); diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h index 49c0dc166c1..f7318869fb3 100644 --- a/source/blender/gpu/GPU_material.h +++ b/source/blender/gpu/GPU_material.h @@ -124,7 +124,7 @@ void GPU_material_free(struct Material *ma); void GPU_materials_free(); -void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double time); +void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double time, int mipmap); void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[][4], float viewmat[][4], float viewinv[][4], float obcol[4]); void GPU_material_unbind(GPUMaterial *material); int GPU_material_bound(GPUMaterial *material); diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 94c1910e3bc..c8a2d553685 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -824,7 +824,7 @@ void GPU_nodes_extract_dynamic_inputs(GPUPass *pass, ListBase *nodes) GPU_shader_unbind(shader); } -void GPU_pass_bind(GPUPass *pass, double time) +void GPU_pass_bind(GPUPass *pass, double time, int mipmap) { GPUInput *input; GPUShader *shader = pass->shader; @@ -838,7 +838,7 @@ void GPU_pass_bind(GPUPass *pass, double time) /* now bind the textures */ for (input=inputs->first; input; input=input->next) { if (input->ima) - input->tex = GPU_texture_from_blender(input->ima, input->iuser, time); + input->tex = GPU_texture_from_blender(input->ima, input->iuser, time, mipmap); if(input->tex && input->bindtex) { GPU_texture_bind(input->tex, input->texid); diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h index 53b52f24f16..f5dd956d176 100644 --- a/source/blender/gpu/intern/gpu_codegen.h +++ b/source/blender/gpu/intern/gpu_codegen.h @@ -71,7 +71,7 @@ GPUPass *GPU_generate_pass(ListBase *nodes, struct GPUNodeLink *outlink, struct GPUShader *GPU_pass_shader(GPUPass *pass); -void GPU_pass_bind(GPUPass *pass, double time); +void GPU_pass_bind(GPUPass *pass, double time, int mipmap); void GPU_pass_update_uniforms(GPUPass *pass); void GPU_pass_unbind(GPUPass *pass); diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index eb834abc670..e7846a23905 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -194,8 +194,11 @@ static int smaller_pow2(int num) static int is_pow2_limit(int num) { /* take texture clamping into account */ - if (G.f & G_TEXTUREPAINT) - return 1; + + /* XXX: texturepaint not global! + if (G.f & G_TEXTUREPAINT) + return 1;*/ + if (U.glreslimit != 0 && num > U.glreslimit) return 0; @@ -204,8 +207,9 @@ static int is_pow2_limit(int num) static int smaller_pow2_limit(int num) { - if (G.f & G_TEXTUREPAINT) - return 1; + /* XXX: texturepaint not global! + if (G.f & G_TEXTUREPAINT) + return 1;*/ /* take texture clamping into account */ if (U.glreslimit != 0 && num > U.glreslimit) @@ -249,7 +253,7 @@ void GPU_set_linear_mipmap(int linear) static int gpu_get_mipmap(void) { - return GTS.domipmap && (!(G.f & G_TEXTUREPAINT)); + return GTS.domipmap; } static GLenum gpu_get_mipmap_filter(int mag) @@ -382,7 +386,7 @@ static void gpu_verify_reflection(Image *ima) } } -int GPU_verify_image(Image *ima, int tftile, int tfmode, int compare) +int GPU_verify_image(Image *ima, int tftile, int tfmode, int compare, int mipmap) { ImBuf *ibuf = NULL; unsigned int *bind = NULL; @@ -507,7 +511,7 @@ int GPU_verify_image(Image *ima, int tftile, int tfmode, int compare) } /* scale if not a power of two */ - if (!is_pow2_limit(rectw) || !is_pow2_limit(recth)) { + if (!mipmap && (!is_pow2_limit(rectw) || !is_pow2_limit(recth))) { rectw= smaller_pow2_limit(rectw); recth= smaller_pow2_limit(recth); @@ -520,7 +524,7 @@ int GPU_verify_image(Image *ima, int tftile, int tfmode, int compare) glGenTextures(1, (GLuint *)bind); glBindTexture( GL_TEXTURE_2D, *bind); - if (!gpu_get_mipmap()) { + if (!(gpu_get_mipmap() && mipmap)) { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rectw, recth, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1)); @@ -559,7 +563,7 @@ static void gpu_verify_repeat(Image *ima) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); } -int GPU_set_tpage(MTFace *tface) +int GPU_set_tpage(MTFace *tface, int mipmap) { Image *ima; @@ -575,7 +579,7 @@ int GPU_set_tpage(MTFace *tface) gpu_verify_alpha_mode(tface); gpu_verify_reflection(ima); - if(GPU_verify_image(ima, tface->tile, tface->mode, 1)) { + if(GPU_verify_image(ima, tface->tile, tface->mode, 1, mipmap)) { GTS.curtile= GTS.tile; GTS.curima= GTS.ima; GTS.curtilemode= GTS.tilemode; @@ -640,13 +644,13 @@ void GPU_paint_set_mipmap(int mipmap) } } -void GPU_paint_update_image(Image *ima, int x, int y, int w, int h) +void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap) { ImBuf *ibuf; ibuf = BKE_image_get_ibuf(ima, NULL); - if (ima->repbind || gpu_get_mipmap() || !ima->bindcode || !ibuf || + if (ima->repbind || (gpu_get_mipmap() && mipmap) || !ima->bindcode || !ibuf || (!is_pow2(ibuf->x) || !is_pow2(ibuf->y)) || (w == 0) || (h == 0)) { /* these cases require full reload still */ @@ -988,7 +992,7 @@ int GPU_enable_material(int nr, void *attribs) gpumat = GPU_material_from_blender(GMS.gscene, mat); GPU_material_vertex_attributes(gpumat, gattribs); - GPU_material_bind(gpumat, GMS.gob->lay, GMS.glay, 1.0); + GPU_material_bind(gpumat, GMS.gob->lay, GMS.glay, 1.0, !(GMS.gob->mode & OB_MODE_TEXTURE_PAINT)); GPU_material_bind_uniforms(gpumat, GMS.gob->obmat, GMS.gviewmat, GMS.gviewinv, GMS.gob->col); GMS.gboundmat= mat; diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 4984e043031..467b2c4a7f4 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -312,7 +312,7 @@ static GPUTexture *GPU_texture_create_nD(int w, int h, int n, float *fpixels, in return tex; } -GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, double time) +GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, double time, int mipmap) { GPUTexture *tex; GLint w, h, border, lastbindcode, bindcode; @@ -320,7 +320,7 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, double time) glGetIntegerv(GL_TEXTURE_BINDING_2D, &lastbindcode); GPU_update_image_time(ima, time); - bindcode = GPU_verify_image(ima, 0, 0, 0); + bindcode = GPU_verify_image(ima, 0, 0, 0, mipmap); if(ima->gputexture) { ima->gputexture->bindcode = bindcode; diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 7e8b5c18d71..c85e2b5a7f1 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -246,7 +246,7 @@ void GPU_material_free(Material *ma) BLI_freelistN(&ma->gpumaterial); } -void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double time) +void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double time, int mipmap) { if(material->pass) { LinkData *nlink; @@ -266,7 +266,7 @@ void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double tim } } - GPU_pass_bind(material->pass, time); + GPU_pass_bind(material->pass, time, mipmap); material->bound = 1; } } @@ -1139,7 +1139,7 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr) do_material_tex(shi); - if(ma->mode & MA_ZTRA) + if((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP)) GPU_material_enable_alpha(mat); if((G.fileflags & G_FILE_GLSL_NO_LIGHTS) || (ma->mode & MA_SHLESS)) { @@ -1213,7 +1213,7 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr) GPU_uniform(&world->horr), &shr->combined); } - if(!(ma->mode & MA_ZTRA)) { + if(!((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))) { if(world && (GPU_link_changed(shr->alpha) || ma->alpha != 1.0f)) GPU_link(mat, "shade_world_mix", GPU_uniform(&world->horr), shr->combined, &shr->combined); diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index adb7fa2303d..e8962d013f4 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -63,13 +63,10 @@ typedef struct Brush { float rgb[3]; /* color */ float alpha; /* opacity */ - float rot; /* rotation in radians */ - short texact; /* active texture */ char sculpt_tool; /* active tool */ - char tex_mode; - char pad[4]; + char pad; } Brush; /* Brush.flag */ @@ -97,11 +94,6 @@ typedef struct Brush { #define BRUSH_BLEND_ERASE_ALPHA 6 #define BRUSH_BLEND_ADD_ALPHA 7 -/* Brush.tex_mode */ -#define BRUSH_TEX_DRAG 0 -#define BRUSH_TEX_TILE 1 -#define BRUSH_TEX_3D 2 - /* Brush.sculpt_tool */ #define SCULPT_TOOL_DRAW 1 #define SCULPT_TOOL_SMOOTH 2 diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index 8428e750025..f7b3273c2e1 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -164,7 +164,7 @@ typedef struct Material { #define MA_VERTEXCOL 16 #define MA_HALO_SOFT 16 #define MA_HALO 32 /* deprecated */ -#define MA_ZTRA 64 +#define MA_ZTRANSP 64 #define MA_VERTEXCOLP 128 #define MA_ZINV 256 #define MA_HALO_RINGS 256 @@ -180,7 +180,7 @@ typedef struct Material { #define MA_NOMIST 0x4000 #define MA_HALO_SHADE 0x4000 #define MA_HALO_FLARE 0x8000 -#define MA_RADIO 0x10000 +#define MA_TRANSP 0x10000 #define MA_RAYTRANSP 0x20000 #define MA_RAYMIRROR 0x40000 #define MA_SHADOW_TRA 0x80000 diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 3f504848d77..9d1707599b9 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -420,6 +420,7 @@ typedef struct ClothModifierData { struct ClothSimSettings *sim_parms; /* definition is in DNA_cloth_types.h */ struct ClothCollSettings *coll_parms; /* definition is in DNA_cloth_types.h */ struct PointCache *point_cache; /* definition is in DNA_object_force.h */ + struct ListBase ptcaches; } ClothModifierData; typedef struct CollisionModifierData { diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h index b5b33610bfe..625864c4888 100644 --- a/source/blender/makesdna/DNA_object_force.h +++ b/source/blender/makesdna/DNA_object_force.h @@ -74,14 +74,36 @@ typedef struct PartDeflect { int seed; /* wind noise random seed */ } PartDeflect; +/* Point cache file data types: + * - used as (1<<flag) so poke jahka if you reach the limit of 15 + * - to add new data types update: + * * BKE_ptcache_data_size() + * * ptcache_file_init_pointers() +*/ +#define BPHYS_DATA_INDEX 0 +#define BPHYS_DATA_LOCATION 1 +#define BPHYS_DATA_VELOCITY 2 +#define BPHYS_DATA_ROTATION 3 +#define BPHYS_DATA_AVELOCITY 4 /* used for particles */ +#define BPHYS_DATA_XCONST 4 /* used for cloth */ +#define BPHYS_DATA_SIZE 5 +#define BPHYS_DATA_TIMES 6 +#define BPHYS_DATA_BOIDS 7 + +#define BPHYS_TOT_DATA 8 + typedef struct PTCacheMem { struct PTCacheMem *next, *prev; int frame, totpoint; - float *data; /* data points */ - void *xdata; /* extra data */ + unsigned int data_types, rt; + int *index_array; /* quick access to stored points with index */ + + void *data[8]; /* BPHYS_TOT_DATA */ + void *cur[8]; /* BPHYS_TOT_DATA */ } PTCacheMem; typedef struct PointCache { + struct PointCache *next, *prev; int flag; /* generic flag */ int step; /* frames between cached frames */ int simframe; /* current frame of simulation (only if SIMULATION_VALID) */ @@ -229,6 +251,7 @@ typedef struct SoftBody { float inpush; struct PointCache *pointcache; + struct ListBase ptcaches; } SoftBody; @@ -283,6 +306,7 @@ typedef struct SoftBody { #define PTCACHE_QUICK_CACHE 128 #define PTCACHE_FRAMES_SKIPPED 256 #define PTCACHE_EXTERNAL 512 +#define PTCACHE_READ_INFO 1024 /* PTCACHE_OUTDATED + PTCACHE_FRAMES_SKIPPED */ #define PTCACHE_REDO_NEEDED 258 diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index ae9d775a74a..5c821b532fb 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -53,6 +53,7 @@ struct SoftBody; struct FluidsimSettings; struct ParticleSystem; struct DerivedMesh; +struct SculptSession; typedef struct bDeformGroup { struct bDeformGroup *next, *prev; @@ -91,6 +92,8 @@ typedef struct BoundBox { typedef struct Object { ID id; struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ + + struct SculptSession *sculpt; short type, partype; int par1, par2, par3; /* can be vertexnrs */ @@ -113,6 +116,9 @@ typedef struct Object { ListBase defbase; ListBase modifiers; /* list of ModifierData structures */ + /* For now just a flag for sculpt mode, eventually we make the other modes local too */ + int mode, pad2; + /* materials */ struct Material **mat; /* material slots */ char *matbits; /* 1 if material linked to object */ @@ -227,7 +233,8 @@ typedef struct Object { int lastDataMask; /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */ unsigned int state; /* bit masks of game controllers that are active */ unsigned int init_state; /* bit masks of initial state as recorded by the users */ - int pad2; + + int restore_mode; /* Keep track of what mode to return to after edit mode exits */ ListBase gpulamp; /* runtime, for lamps only */ } Object; @@ -395,7 +402,6 @@ extern Object workob; #define OB_DONE 1024 #define OB_RADIO 2048 #define OB_FROMGROUP 4096 -#define OB_POSEMODE 8192 /* ob->recalc (flag bits!) */ #define OB_RECALC_OB 1 @@ -504,6 +510,16 @@ extern Object workob; #define OB_LOCK_SCALEZ 256 #define OB_LOCK_SCALE 448 +/* ob->mode */ +#define OB_MODE_OBJECT 0 +#define OB_MODE_EDIT 1 +#define OB_MODE_SCULPT 2 +#define OB_MODE_VERTEX_PAINT 4 +#define OB_MODE_WEIGHT_PAINT 8 +#define OB_MODE_TEXTURE_PAINT 16 +#define OB_MODE_PARTICLE_EDIT 32 +#define OB_MODE_POSE 64 + /* ob->softflag in DNA_object_force.h */ #ifdef __cplusplus diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index b71d390db5a..925fd31328d 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -229,6 +229,7 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in /* point cache */ struct PointCache *pointcache; + struct ListBase ptcaches; struct KDTree *tree; /* used for interactions with self and other systems */ }ParticleSystem; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index a0f59338ac1..6efd47d9348 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -434,8 +434,18 @@ typedef struct TimeMarker { unsigned int flag; } TimeMarker; +typedef struct Paint { + /* Array of brushes selected for use in this paint mode */ + Brush **brushes; + int active_brush_index, brush_count; + + /* WM handle */ + void *paint_cursor; +} Paint; + typedef struct ImagePaintSettings { - struct Brush *brush; + Paint paint; + short flag, tool; /* for projection painting only */ @@ -470,26 +480,23 @@ typedef struct TransformOrientation { float mat[3][3]; } TransformOrientation; -struct SculptSession; -typedef struct Sculpt -{ - /* Note! a deep copy of this struct must be done header_info.c's copy_scene function */ - /* Data stored only from entering sculptmode until exiting sculptmode */ - struct SculptSession *session; - struct Brush *brush; +typedef struct Sculpt { + Paint paint; + + /* WM handle */ + void *cursor; /* For rotating around a pivot point */ float pivot[3]; int flags; - /* For the Brush Shape */ - char texsep; + /* Control tablet input */ char tablet_size, tablet_strength; - char pad[5]; + char pad[6]; } Sculpt; typedef struct VPaint { - struct Brush *brush; + Paint paint; float gamma, mul; /* should become part of struct Brush? */ short mode, flag; @@ -627,6 +634,12 @@ typedef struct bStats { int totvert, totface; } bStats; +typedef struct UnitSettings { + /* Display/Editing unit options for each scene */ + float scale_length; /* maybe have other unit conversions? */ + short system; + short flag; /* imperial, metric etc */ +} UnitSettings; typedef struct Scene { ID id; @@ -647,7 +660,7 @@ typedef struct Scene { float twmin[3], twmax[3]; /* boundbox of selection for transform widget */ unsigned int lay; - + short flag; /* various settings */ short use_nodes; @@ -686,6 +699,10 @@ typedef struct Scene { /* Game Settings */ struct GameFraming framing; // XXX deprecated since 2.5 struct GameData gm; + + /* Units */ + struct UnitSettings unit; + } Scene; @@ -1088,6 +1105,15 @@ typedef enum SculptFlags { #define SK_RETARGET_ROLL_VIEW 1 #define SK_RETARGET_ROLL_JOINT 2 +/* UnitSettings */ + +/* UnitSettings->system */ +#define USER_UNIT_NONE 0 +#define USER_UNIT_METRIC 1 +#define USER_UNIT_IMPERIAL 2 +/* UnitSettings->flag */ +#define USER_UNIT_OPT_SPLIT 1 + #ifdef __cplusplus } diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h index 7d64862ba32..c7f49d3ddd2 100644 --- a/source/blender/makesdna/DNA_smoke_types.h +++ b/source/blender/makesdna/DNA_smoke_types.h @@ -30,7 +30,10 @@ #define DNA_SMOKE_TYPES_H /* flags */ -#define MOD_SMOKE_HIGHRES (1<<1) +#define MOD_SMOKE_HIGHRES (1<<1) /* compute high resolution */ +#define MOD_SMOKE_DISSOLVE (1<<2) /* let smoke dissolve */ +#define MOD_SMOKE_DISSOLVE_LOG (1<<3) /* using 1/x for dissolve */ + /* noise */ #define MOD_SMOKE_NOISEWAVE (1<<0) #define MOD_SMOKE_NOISEFFT (1<<1) @@ -75,8 +78,8 @@ typedef struct SmokeDomainSettings { int viewsettings; int max_textures; short noise; /* noise type: wave, curl, anisotropic */ - short pad2; - int pad; + short diss_percent; + int diss_speed;/* in frames */ float strength; struct WTURBULENCE *wt; // WTURBULENCE object, if active } SmokeDomainSettings; @@ -101,6 +104,12 @@ typedef struct SmokeFlowSettings { int pad; } SmokeFlowSettings; +/* + struct BVHTreeFromMesh *bvh; + float mat[4][4]; + float mat_old[4][4]; + */ + /* collision objects (filled with smoke) */ typedef struct SmokeCollSettings { struct SmokeModifierData *smd; /* for fast RNA access */ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index d24d9af4177..6eb5afbd6ac 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -821,7 +821,7 @@ enum { #define TIME_ALL_3D_WIN 2 #define TIME_ALL_ANIM_WIN 4 #define TIME_ALL_BUTS_WIN 8 -#define TIME_WITH_SEQ_AUDIO 16 +#define TIME_WITH_SEQ_AUDIO 16 // deprecated #define TIME_SEQ 32 #define TIME_ALL_IMAGE_WIN 64 #define TIME_CONTINUE_PHYSICS 128 diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index 7367ee3cf71..0054e885a21 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -53,17 +53,17 @@ typedef struct MTex { char uvname[32]; char projx, projy, projz, mapping; - float ofs[3], size[3]; + float ofs[3], size[3], rot; short texflag, colormodel, pmapto, pmaptoneg; - short normapspace, which_output, pad[2]; + short normapspace, which_output; + char brush_map_mode, pad[7]; float r, g, b, k; float def_var, rt; float colfac, norfac, varfac; float dispfac; float warpfac; - } MTex; #ifndef DNA_USHORT_FIX @@ -396,6 +396,11 @@ typedef struct TexMapping { #define MTEX_BLEND_COLOR 13 #define MTEX_NUM_BLENDTYPES 14 +/* brush_map_mode */ +#define MTEX_MAP_MODE_FIXED 0 +#define MTEX_MAP_MODE_TILED 1 +#define MTEX_MAP_MODE_3D 2 + /* **************** EnvMap ********************* */ /* type */ diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 4a317dfb369..019dad4eed5 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -416,7 +416,6 @@ extern UserDef U; /* from blenkernel blender.c */ /* toolsettings->autokey_flag */ #define ANIMRECORD_FLAG_WITHNLA (1<<10) - /* transopts */ #define USER_TR_TOOLTIPS (1 << 0) #define USER_TR_BUTTONS (1 << 1) diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index b6a2b4c0544..7d03bbec1ee 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -54,6 +54,7 @@ struct StructRNA; struct PointerRNA; struct ReportList; struct Report; +struct uiLayout; #define OP_MAX_TYPENAME 64 #define KMAP_MAX_NAME 64 @@ -208,8 +209,8 @@ typedef struct wmOperatorType { * that the operator might still fail to execute even if this return true */ int (*poll)(struct bContext *); - /* panel for redo and repeat */ - void *(*uiBlock)(struct wmOperator *); + /* optional panel for redo and repeat, autogenerated if not set */ + void (*ui)(struct bContext *, struct PointerRNA *, struct uiLayout *); /* rna for properties */ struct StructRNA *srna; diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 06752250bd0..95c46515204 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -393,6 +393,7 @@ extern StructRNA RNA_SpaceFileBrowser; extern StructRNA RNA_SpaceGraphEditor; extern StructRNA RNA_SpaceImageEditor; extern StructRNA RNA_SpaceNLA; +extern StructRNA RNA_SpaceTimeline; extern StructRNA RNA_SpaceOutliner; extern StructRNA RNA_SpaceSequenceEditor; extern StructRNA RNA_SpaceTextEditor; @@ -470,6 +471,7 @@ extern StructRNA RNA_TransformSequence; extern StructRNA RNA_UILayout; extern StructRNA RNA_UIListItem; extern StructRNA RNA_UVProjectModifier; +extern StructRNA RNA_UnitSettings; extern StructRNA RNA_UnknownType; extern StructRNA RNA_UserPreferences; extern StructRNA RNA_UserPreferencesAutosave; @@ -765,7 +767,7 @@ void RNA_collection_clear(PointerRNA *ptr, const char *name); int RNA_property_is_set(PointerRNA *ptr, const char *name); /* python compatible string representation of this property, (must be freed!) */ -char *RNA_property_as_string(PointerRNA *ptr, PropertyRNA *prop); +char *RNA_property_as_string(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop); char *RNA_pointer_as_string(PointerRNA *ptr); /* Function */ diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index ae9eaba8646..33f5d7137b8 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -63,6 +63,7 @@ void RNA_def_struct_path_func(StructRNA *srna, const char *path); void RNA_def_struct_identifier(StructRNA *srna, const char *identifier); void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description); void RNA_def_struct_ui_icon(StructRNA *srna, int icon); +void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *ext); void RNA_struct_free(BlenderRNA *brna, StructRNA *srna); /* Compact Property Definitions */ diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index 78e65e8fc06..46d8c50caa6 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -29,6 +29,8 @@ /* Types */ +extern EnumPropertyItem object_mode_items[]; + extern EnumPropertyItem prop_mode_items[]; extern EnumPropertyItem space_type_items[]; extern EnumPropertyItem region_type_items[]; @@ -47,6 +49,8 @@ extern EnumPropertyItem nla_mode_blend_items[]; extern EnumPropertyItem event_value_items[]; extern EnumPropertyItem event_type_items[]; +extern EnumPropertyItem brush_sculpt_tool_items[]; + #endif /* RNA_ENUM_TYPES */ diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 4833640a04b..72ecf0e7a93 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -80,6 +80,7 @@ typedef enum PropertyUnit { } PropertyUnit; #define RNA_SUBTYPE_UNIT(subtype) (subtype & 0x00FF0000) +#define RNA_SUBTYPE_UNIT_VALUE(subtype) (subtype>>16) /* also update rna_property_subtypename when you change this */ typedef enum PropertySubType { diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 9db4210c9cc..2de59586611 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1989,9 +1989,10 @@ void rna_iterator_array_end(CollectionPropertyIterator *iter) { ArrayIterator *internal= iter->internal; - if(internal->free_ptr) + if(internal->free_ptr) { MEM_freeN(internal->free_ptr); - + internal->free_ptr= NULL; + } MEM_freeN(iter->internal); iter->internal= NULL; } @@ -2647,7 +2648,7 @@ char *RNA_pointer_as_string(PointerRNA *ptr) BLI_dynstr_append(dynstr, ", "); first_time= 0; - cstring = RNA_property_as_string(ptr, prop); + cstring = RNA_property_as_string(NULL, ptr, prop); BLI_dynstr_appendf(dynstr, "\"%s\":%s", propname, cstring); MEM_freeN(cstring); } @@ -2661,7 +2662,7 @@ char *RNA_pointer_as_string(PointerRNA *ptr) return cstring; } -char *RNA_property_as_string(PointerRNA *ptr, PropertyRNA *prop) +char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop) { int type = RNA_property_type(prop); int len = RNA_property_array_length(prop); @@ -2730,7 +2731,7 @@ char *RNA_property_as_string(PointerRNA *ptr, PropertyRNA *prop) const char *identifier; int val = RNA_property_enum_get(ptr, prop); - if(RNA_property_enum_identifier(NULL, ptr, prop, val, &identifier)) { + if(RNA_property_enum_identifier(C, ptr, prop, val, &identifier)) { BLI_dynstr_appendf(dynstr, "'%s'", identifier); } else { diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 3b8586e020d..65c66800f41 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -32,6 +32,17 @@ #include "DNA_brush_types.h" #include "DNA_texture_types.h" +EnumPropertyItem brush_sculpt_tool_items[] = { + {SCULPT_TOOL_DRAW, "DRAW", 0, "Draw", ""}, + {SCULPT_TOOL_SMOOTH, "SMOOTH", 0, "Smooth", ""}, + {SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", ""}, + {SCULPT_TOOL_INFLATE, "INFLATE", 0, "Inflate", ""}, + {SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", ""}, + {SCULPT_TOOL_LAYER, "LAYER", 0, "Layer", ""}, + {SCULPT_TOOL_FLATTEN, "FLATTEN", 0, "Flatten", ""}, + {SCULPT_TOOL_CLAY, "CLAY", 0, "Clay", ""}, + {0, NULL, 0, NULL, NULL}}; + #ifdef RNA_RUNTIME #include "MEM_guardedalloc.h" @@ -74,20 +85,6 @@ static void rna_Brush_active_texture_set(PointerRNA *ptr, PointerRNA value) } } -static float rna_Brush_rotation_get(PointerRNA *ptr) -{ - Brush *brush= (Brush*)ptr->data; - const float conv = 57.295779506; - return brush->rot * conv; -} - -static void rna_Brush_rotation_set(PointerRNA *ptr, float v) -{ - Brush *brush= (Brush*)ptr->data; - const float conv = 0.017453293; - brush->rot = v * conv; -} - #else void rna_def_brush(BlenderRNA *brna) @@ -106,23 +103,6 @@ void rna_def_brush(BlenderRNA *brna) {BRUSH_BLEND_ADD_ALPHA, "ADD_ALPHA", 0, "Add Alpha", "Add alpha while painting."}, {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem prop_texture_mode_items[] = { - {BRUSH_TEX_DRAG, "TEX_DRAG", 0, "Drag", ""}, - {BRUSH_TEX_TILE, "TEX_TILE", 0, "Tile", ""}, - {BRUSH_TEX_3D, "TEX_3D", 0, "3D", ""}, - {0, NULL, 0, NULL, NULL}}; - - static EnumPropertyItem prop_sculpt_tool_items[] = { - {SCULPT_TOOL_DRAW, "DRAW", 0, "Draw", ""}, - {SCULPT_TOOL_SMOOTH, "SMOOTH", 0, "Smooth", ""}, - {SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", ""}, - {SCULPT_TOOL_INFLATE, "INFLATE", 0, "Inflate", ""}, - {SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", ""}, - {SCULPT_TOOL_LAYER, "LAYER", 0, "Layer", ""}, - {SCULPT_TOOL_FLATTEN, "FLATTEN", 0, "Flatten", ""}, - {SCULPT_TOOL_CLAY, "CLAY", 0, "Clay", ""}, - {0, NULL, 0, NULL, NULL}}; - srna= RNA_def_struct(brna, "Brush", "ID"); RNA_def_struct_ui_text(srna, "Brush", "Brush datablock for storing brush settings for painting and sculpting."); RNA_def_struct_ui_icon(srna, ICON_BRUSH_DATA); @@ -132,13 +112,8 @@ void rna_def_brush(BlenderRNA *brna) RNA_def_property_enum_items(prop, prop_blend_items); RNA_def_property_ui_text(prop, "Blending mode", "Brush blending mode."); - prop= RNA_def_property(srna, "texture_mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "tex_mode"); - RNA_def_property_enum_items(prop, prop_texture_mode_items); - RNA_def_property_ui_text(prop, "Texture Mode", ""); - prop= RNA_def_property(srna, "sculpt_tool", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_sculpt_tool_items); + RNA_def_property_enum_items(prop, brush_sculpt_tool_items); RNA_def_property_ui_text(prop, "Sculpt Tool", ""); /* number values */ @@ -170,12 +145,6 @@ void rna_def_brush(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Strength", "The amount of pressure on the brush."); - prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "rot"); - RNA_def_property_range(prop, 0, 360); - RNA_def_property_float_funcs(prop, "rna_Brush_rotation_get", "rna_Brush_rotation_set", NULL); - RNA_def_property_ui_text(prop, "Rotation", "Angle of the brush texture."); - /* flag */ prop= RNA_def_property(srna, "airbrush", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_AIRBRUSH); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 467b8f6e8e1..a8dc0454cef 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -416,7 +416,7 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Pole Sub-Target", ""); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); - prop= RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_ANGLE); // XXX - todo, convert to rad RNA_def_property_float_sdna(prop, NULL, "poleangle"); RNA_def_property_range(prop, 0.0, 180.f); RNA_def_property_ui_text(prop, "Pole Angle", "Pole rotation offset."); @@ -676,7 +676,7 @@ static void rna_def_constraint_minmax(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Use Rotation", "Use the target's rotation to determine floor."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_range(prop, 0.0, 100.f); RNA_def_property_ui_text(prop, "Offset", "Offset of floor from object center."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); @@ -871,7 +871,7 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); - prop= RNA_def_property(srna, "offset", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "offset", PROP_INT, PROP_TIME); RNA_def_property_range(prop, -300000.0, 300000.f); RNA_def_property_ui_text(prop, "Offset", "Offset from the position corresponding to the time frame."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); @@ -938,7 +938,7 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Keep Axis", "Axis to maintain during stretch."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "original_length", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "original_length", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "orglength"); RNA_def_property_range(prop, 0.0, 100.f); RNA_def_property_ui_text(prop, "Original Length", "Length at rest position."); @@ -983,37 +983,37 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Pivot Type", ""); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "pivX"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Pivot X", "Offset pivot on X."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "pivY"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Pivot Y", "Offset pivot on Y."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "pivot_z", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "pivot_z", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "pivZ"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Pivot Z", "Offset pivot on Z."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_ANGLE); // XXX - convert to radians RNA_def_property_float_sdna(prop, NULL, "axX"); RNA_def_property_range(prop, -360.0, 360.f); RNA_def_property_ui_text(prop, "Axis X", "Rotate pivot on X axis in degrees."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_ANGLE); // XXX - convert to radians RNA_def_property_float_sdna(prop, NULL, "axY"); RNA_def_property_range(prop, -360.0, 360.f); RNA_def_property_ui_text(prop, "Axis Y", "Rotate pivot on Y axis in degrees."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_ANGLE); // XXX - convert to radians RNA_def_property_float_sdna(prop, NULL, "axZ"); RNA_def_property_range(prop, -360.0, 360.f); RNA_def_property_ui_text(prop, "Axis Z", "Rotate pivot on Z axis in degrees."); @@ -1135,73 +1135,73 @@ static void rna_def_constraint_transform(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Extrapolate Motion", "Extrapolate ranges."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "from_min[0]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "from_min[1]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "from_min[2]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "from_max[0]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "from_max[1]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "from_max[2]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "to_min[0]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "to_min[1]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "to_min[2]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "to_max[0]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "to_max[1]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "to_max[2]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion."); @@ -1247,37 +1247,37 @@ static void rna_def_constraint_location_limit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "xmin"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "ymin"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "zmin"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "xmax"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "ymax"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "zmax"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow."); @@ -1313,37 +1313,37 @@ static void rna_def_constraint_rotation_limit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Limit Z", "Use the minimum Z value."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "xmin"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "ymin"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "zmin"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "xmax"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "ymax"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "zmax"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow."); @@ -1462,7 +1462,7 @@ static void rna_def_constraint_distance_limit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Sub-Target", ""); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); - prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "dist"); RNA_def_property_range(prop, 0.0, 100.f); RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere."); @@ -1502,7 +1502,7 @@ static void rna_def_constraint_shrinkwrap(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Shrinkwrap Type", "Selects type of shrinkwrap algorithm for target position"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "dist"); RNA_def_property_range(prop, 0.0, 100.f); RNA_def_property_ui_text(prop, "Distance", "Distance to Target."); diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c index 5e164c6525f..7239fc1ff3d 100644 --- a/source/blender/makesrna/intern/rna_context.c +++ b/source/blender/makesrna/intern/rna_context.c @@ -31,10 +31,10 @@ #include "RNA_define.h" #include "RNA_types.h" -#ifdef RNA_RUNTIME - #include "BKE_context.h" +#ifdef RNA_RUNTIME + static PointerRNA rna_Context_manager_get(PointerRNA *ptr) { bContext *C= (bContext*)ptr->data; @@ -110,6 +110,12 @@ static PointerRNA rna_Context_user_preferences_get(PointerRNA *ptr) return newptr; } +static int rna_Context_mode_get(PointerRNA *ptr) +{ + bContext *C= (bContext*)ptr->data; + return CTX_data_mode_enum(C); +} + #else void RNA_def_context(BlenderRNA *brna) @@ -117,6 +123,23 @@ void RNA_def_context(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; + static EnumPropertyItem mode_items[] = { + {CTX_MODE_EDIT_MESH, "EDIT_MESH", 0, "Mesh Edit", ""}, + {CTX_MODE_EDIT_CURVE, "EDIT_CURVE", 0, "Curve Edit", ""}, + {CTX_MODE_EDIT_SURFACE, "EDIT_SURFACE", 0, "Surface Edit", ""}, + {CTX_MODE_EDIT_TEXT, "EDIT_TEXT", 0, "Edit Edit", ""}, + {CTX_MODE_EDIT_ARMATURE, "EDIT_ARMATURE", 0, "Armature Edit", ""}, // PARSKEL reuse will give issues + {CTX_MODE_EDIT_METABALL, "EDIT_METABALL", 0, "Metaball Edit", ""}, + {CTX_MODE_EDIT_LATTICE, "EDIT_LATTICE", 0, "Lattice Edit", ""}, + {CTX_MODE_POSE, "POSE", 0, "Pose ", ""}, + {CTX_MODE_SCULPT, "SCULPT", 0, "Sculpt", ""}, + {CTX_MODE_PAINT_WEIGHT, "PAINT_WEIGHT", 0, "Weight Paint", ""}, + {CTX_MODE_PAINT_VERTEX, "PAINT_VERTEX", 0, "Vertex Paint", ""}, + {CTX_MODE_PAINT_TEXTURE, "PAINT_TEXTURE", 0, "Texture Paint", ""}, + {CTX_MODE_PARTICLE, "PARTICLE", 0, "Particle", ""}, + {CTX_MODE_OBJECT, "OBJECT", 0, "Object", ""}, + {0, NULL, 0, NULL, NULL}}; + srna= RNA_def_struct(brna, "Context", NULL); RNA_def_struct_ui_text(srna, "Context", "Current windowmanager and data context."); RNA_def_struct_sdna(srna, "bContext"); @@ -177,6 +200,11 @@ void RNA_def_context(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "UserPreferences"); RNA_def_property_pointer_funcs(prop, "rna_Context_user_preferences_get", NULL, NULL); + + prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, mode_items); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_enum_funcs(prop, "rna_Context_mode_get", NULL, NULL); } #endif diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 5f1a069d876..0861d7d51a0 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -458,6 +458,15 @@ void RNA_define_verify_sdna(int verify) DefRNA.verify= verify; } +void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *ext) +{ +#ifdef RNA_RUNTIME + ext->free(ext->data); /* decref's the PyObject that the srna owns */ + RNA_struct_blender_type_set(srna, NULL); /* this gets accessed again - XXX fixme */ + RNA_struct_py_type_set(srna, NULL); /* NULL the srna's value so RNA_struct_free wont complain of a leak */ +#endif +} + void RNA_struct_free(BlenderRNA *brna, StructRNA *srna) { #ifdef RNA_RUNTIME @@ -465,6 +474,12 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna) PropertyRNA *prop, *nextprop; PropertyRNA *parm, *nextparm; + if(srna->flag & STRUCT_RUNTIME) { + if(RNA_struct_py_type_get(srna)) { + fprintf(stderr, "StructRNA \"%s\" freed while holdng a python reference\n", srna->name); + } + } + for(prop=srna->cont.properties.first; prop; prop=nextprop) { nextprop= prop->next; @@ -496,6 +511,7 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna) if(srna->flag & STRUCT_RUNTIME) rna_freelinkN(&brna->structs, srna); + #endif } diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index b7084a0b26d..936e1700ed7 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -98,7 +98,7 @@ static void rna_FluidSettings_update_type(bContext *C, PointerRNA *ptr) part->type= PART_FLUID; psys->part= part; - psys->pointcache= BKE_ptcache_add(); + psys->pointcache= BKE_ptcache_add(&psys->ptcaches); psys->flag |= PSYS_ENABLED; BLI_addtail(&ob->particlesystem,psys); diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index 16dc4fbc8cb..57aa1ba2736 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -314,7 +314,7 @@ static void rna_def_lamp(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Type", "Type of Lamp."); RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL); - prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "dist"); RNA_def_property_ui_range(prop, 0, 1000, 1.0, 2); RNA_def_property_ui_text(prop, "Distance", "Falloff distance - the light is at half the original intensity at this point."); @@ -465,7 +465,7 @@ static void rna_def_lamp_shadow(StructRNA *srna, int spot, int area) RNA_def_property_ui_text(prop, "Shadow Adaptive Threshold", "Threshold for Adaptive Sampling (Raytraced shadows)."); RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL); - prop= RNA_def_property(srna, "shadow_soft_size", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "shadow_soft_size", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "soft"); RNA_def_property_ui_range(prop, 0, 100, 0.1, 3); RNA_def_property_ui_text(prop, "Shadow Soft Size", "Light size for ray shadow sampling (Raytraced shadows)."); @@ -526,13 +526,13 @@ static void rna_def_area_lamp(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Shape", "Shape of the area lamp."); RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL); - prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "area_size"); RNA_def_property_ui_range(prop, 0, 100, 0.1, 3); RNA_def_property_ui_text(prop, "Size", "Size of the area of the area Lamp, X direction size for Rectangle shapes."); RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL); - prop= RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "area_sizey"); RNA_def_property_ui_range(prop, 0, 100, 0.1, 3); RNA_def_property_ui_text(prop, "Size Y", "Size of the area of the area Lamp in the Y direction for Rectangle shapes."); @@ -628,13 +628,13 @@ static void rna_def_spot_lamp(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Spot Size", "Angle of the spotlight beam in degrees."); RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL); - prop= RNA_def_property(srna, "shadow_buffer_clip_start", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "shadow_buffer_clip_start", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "clipsta"); RNA_def_property_range(prop, 0.0f, 9999.0f); RNA_def_property_ui_text(prop, "Shadow Buffer Clip Start", "Shadow map clip start: objects closer will not generate shadows"); RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL); - prop= RNA_def_property(srna, "shadow_buffer_clip_end", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "shadow_buffer_clip_end", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "clipend"); RNA_def_property_range(prop, 0.0f, 9999.0f); RNA_def_property_ui_text(prop, "Shadow Buffer Clip End", "Shadow map clip end beyond which objects will not generate shadows."); diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index e6de6a46c8e..6f0a19b7aa9 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -527,10 +527,16 @@ static void rna_def_material_colors(StructRNA *srna) RNA_def_property_ui_text(prop, "Mirror Color", "Mirror color of the material."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Alpha", "Alpha transparency of the material."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL); + + prop= RNA_def_property(srna, "specular_alpha", PROP_FLOAT, PROP_PERCENTAGE); + RNA_def_property_float_sdna(prop, NULL, "spectra"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Specular Alpha", "Alpha transparency for specular areas."); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); /* Color bands */ prop= RNA_def_property(srna, "use_diffuse_ramp", PROP_BOOLEAN, PROP_NONE); @@ -599,7 +605,7 @@ static void rna_def_material_diffuse(StructRNA *srna) RNA_def_property_ui_text(prop, "Diffuse Shader Model", ""); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "diffuse_reflection", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "diffuse_reflection", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "ref"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Diffuse Reflection", "Amount of diffuse reflection."); @@ -616,7 +622,7 @@ static void rna_def_material_diffuse(StructRNA *srna) RNA_def_property_ui_text(prop, "Diffuse Toon Size", "Size of diffuse toon area."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "diffuse_toon_smooth", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "diffuse_toon_smooth", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "param[1]"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Diffuse Toon Smooth", "Smoothness of diffuse toon area."); @@ -660,7 +666,7 @@ static void rna_def_material_raymirror(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Enabled", "Enable raytraced reflections."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "reflect", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "reflect", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "ray_mirror"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Reflect", "Sets the amount mirror reflection for raytrace."); @@ -672,19 +678,19 @@ static void rna_def_material_raymirror(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Fresnel", "Power of Fresnel for mirror reflection."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "fresnel_fac", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "fresnel_factor", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "fresnel_mir_i"); RNA_def_property_range(prop, 0.0f, 5.0f); RNA_def_property_ui_text(prop, "Fresnel Factor", "Blending factor for Fresnel."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "gloss", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "gloss", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "gloss_mir"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Gloss", "The shininess of the reflection. Values < 1.0 give diffuse, blurry reflections."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "gloss_anisotropic", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "gloss_anisotropic", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "aniso_gloss_mir"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Gloss Anisotropy", "The shape of the reflection, from 0.0 (circular) to 1.0 (fully stretched along the tangent."); @@ -696,7 +702,7 @@ static void rna_def_material_raymirror(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Gloss Samples", "Number of cone samples averaged for blurry reflections."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "gloss_threshold", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "gloss_threshold", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "adapt_thresh_mir"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Gloss Threshold", "Threshold for adaptive sampling. If a sample contributes less than this amount (as a percentage), sampling is stopped."); @@ -708,7 +714,7 @@ static void rna_def_material_raymirror(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Depth", "Maximum allowed number of light inter-reflections."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "dist_mir"); RNA_def_property_range(prop, 0.0f, 10000.0f); RNA_def_property_ui_text(prop, "Maximum Distance", "Maximum distance of reflected rays. Reflections further than this range fade to sky color or material color."); @@ -731,11 +737,6 @@ static void rna_def_material_raytra(BlenderRNA *brna) RNA_def_struct_nested(brna, srna, "Material"); RNA_def_struct_ui_text(srna, "Material Raytrace Transparency", "Raytraced refraction settings for a Material datablock."); - prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAYTRANSP); /* use bitflags */ - RNA_def_property_ui_text(prop, "Enabled", "Enables raytracing for transparent refraction rendering."); - RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "ior", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ang"); RNA_def_property_range(prop, 1.0f, 3.0f); @@ -748,13 +749,13 @@ static void rna_def_material_raytra(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Fresnel", "Power of Fresnel for transparency (Ray or ZTransp)."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "fresnel_fac", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "fresnel_factor", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "fresnel_tra_i"); RNA_def_property_range(prop, 1.0f, 5.0f); RNA_def_property_ui_text(prop, "Fresnel Factor", "Blending factor for Fresnel."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "gloss", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "gloss", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "gloss_tra"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Gloss", "The clarity of the refraction. Values < 1.0 give diffuse, blurry refractions."); @@ -766,7 +767,7 @@ static void rna_def_material_raytra(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Gloss Samples", "Number of cone samples averaged for blurry refractions."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "gloss_threshold", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "gloss_threshold", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "adapt_thresh_tra"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Gloss Threshold", "Threshold for adaptive sampling. If a sample contributes less than this amount (as a percentage), sampling is stopped."); @@ -778,13 +779,13 @@ static void rna_def_material_raytra(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Depth", "Maximum allowed number of light inter-refractions."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "filter", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "filter", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "filter"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Filter", "Amount to blend in the material's diffuse color in raytraced transparency (simulating absorption)."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "limit", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "limit", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "tx_limit"); RNA_def_property_range(prop, 0.0f, 100.0f); RNA_def_property_ui_text(prop, "Limit", "Maximum depth for light to travel through the transparent material before becoming fully filtered (0.0 is disabled)."); @@ -795,12 +796,6 @@ static void rna_def_material_raytra(BlenderRNA *brna) RNA_def_property_range(prop, 0.1f, 10.0f); RNA_def_property_ui_text(prop, "Falloff", "Falloff power for transmissivity filter effect (1.0 is linear)."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - - prop= RNA_def_property(srna, "specular_opacity", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "spectra"); - RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Specular Opacity", "Makes specular areas opaque on transparent materials."); - RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); } static void rna_def_material_halo(BlenderRNA *brna) @@ -825,7 +820,7 @@ static void rna_def_material_halo(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Hardness", "Sets the hardness of the halo."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "add", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "add", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "add"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Add", "Sets the strength of the add effect."); @@ -941,7 +936,7 @@ static void rna_def_material_sss(BlenderRNA *brna) RNA_def_struct_nested(brna, srna, "Material"); RNA_def_struct_ui_text(srna, "Material Subsurface Scattering", "Diffuse subsurface scattering settings for a Material datablock."); - prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_RGB); + prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_RGB|PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "sss_radius"); RNA_def_property_range(prop, 0.001, FLT_MAX); RNA_def_property_ui_range(prop, 0.001, 10000, 1, 3); @@ -971,13 +966,13 @@ static void rna_def_material_sss(BlenderRNA *brna) RNA_def_property_ui_text(prop, "IOR", "Index of refraction (higher values are denser)."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "color_factor", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "color_factor", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "sss_colfac"); RNA_def_property_ui_range(prop, 0, 1, 10, 3); RNA_def_property_ui_text(prop, "Color Factor", "Blend factor for SSS colors."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "texture_factor", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "texture_factor", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "sss_texfac"); RNA_def_property_ui_range(prop, 0, 1, 10, 3); RNA_def_property_ui_text(prop, "Texture Factor", "Texture scatting blend factor."); @@ -1019,7 +1014,7 @@ void rna_def_material_specularity(StructRNA *srna) RNA_def_property_ui_text(prop, "Specular Shader Model", ""); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "specular_reflection", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "specular_reflection", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "spec"); RNA_def_property_range(prop, 0, 1); RNA_def_property_ui_text(prop, "Specularity Intensity", ""); @@ -1048,7 +1043,7 @@ void rna_def_material_specularity(StructRNA *srna) RNA_def_property_ui_text(prop, "Specular Toon Size", "Size of specular toon area."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "specular_toon_smooth", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "specular_toon_smooth", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "param[3]"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Specular Toon Smooth", "Ssmoothness of specular toon area."); @@ -1081,10 +1076,10 @@ void rna_def_material_strand(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Surface Diffuse", "Make diffuse shading more similar to shading the surface."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "blend_distance", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "blend_distance", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "strand_surfnor"); RNA_def_property_range(prop, 0, 10); - RNA_def_property_ui_text(prop, "Blend Distance", "Distance in Blender units over which to blend in the surface normal."); + RNA_def_property_ui_text(prop, "Blend Distance", "Worldspace distance over which to blend in the surface normal."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); prop= RNA_def_property(srna, "blender_units", PROP_BOOLEAN, PROP_NONE); @@ -1179,6 +1174,10 @@ void RNA_def_material(BlenderRNA *brna) // {MA_TYPE_VOLUME, "VOLUME", 0, "Volume", "Render object as a volume."}, {MA_TYPE_HALO, "HALO", 0, "Halo", "Render object as halo particles."}, {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem transparency_items[] = { + {MA_ZTRANSP, "Z_TRANSPARENCY", 0, "Z Transparency", "Use alpha buffer for transparent faces."}, + {MA_RAYTRANSP, "RAYTRACE", 0, "Raytrace", "Use raytracing for transparent refraction rendering."}, + {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "Material", "ID"); RNA_def_struct_ui_text(srna, "Material", "Material datablock to defined the appearance of geometric objects for rendering."); @@ -1190,19 +1189,31 @@ void RNA_def_material(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Type", "Material type defining how the object is rendered."); RNA_def_property_enum_funcs(prop, NULL, "rna_Material_type_set", NULL); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL); + + prop= RNA_def_property(srna, "transparency", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_TRANSP); + RNA_def_property_ui_text(prop, "Transparency", "Render material as transparent."); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "transparency_method", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode"); + RNA_def_property_enum_items(prop, transparency_items); + RNA_def_property_ui_text(prop, "Transparency Method", "Method to use for rendering transparency."); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "ambient", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "ambient", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "amb"); RNA_def_property_range(prop, 0, 1); RNA_def_property_ui_text(prop, "Ambient", "Amount of global ambient color the material receives."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); prop= RNA_def_property(srna, "emit", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0, 2); + RNA_def_property_range(prop, 0, FLT_MAX); + RNA_def_property_ui_range(prop, 0, 2.0f, 10, 2); RNA_def_property_ui_text(prop, "Emit", "Amount of light to emit."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "translucency", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "translucency", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_range(prop, 0, 1); RNA_def_property_ui_text(prop, "Translucency", "Amount of diffuse shading on the back side."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); @@ -1227,7 +1238,7 @@ void RNA_def_material(BlenderRNA *brna) RNA_def_property_range(prop, 0, 10); RNA_def_property_ui_text(prop, "Shadow Buffer Bias", "Factor to multiply shadow buffer bias with (0 is ignore.)"); - prop= RNA_def_property(srna, "shadow_casting_alpha", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "shadow_casting_alpha", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "shad_alpha"); RNA_def_property_range(prop, 0.001, 1); RNA_def_property_ui_text(prop, "Shadow Casting Alpha", "Shadow casting alpha, only in use for Irregular Shadowbuffer."); @@ -1262,11 +1273,6 @@ void RNA_def_material(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Shadeless", "Makes this material insensitive to light or shadow."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "z_transparency", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ZTRA); - RNA_def_property_ui_text(prop, "Z Transparency", "Enable alpha buffer for transparent faces."); - RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "vertex_color_light", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_VERTEXCOL); RNA_def_property_ui_text(prop, "Vertex Color Light", "Add vertex colors as additional lighting."); @@ -1312,11 +1318,6 @@ void RNA_def_material(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Exclude Mist", "Excludes this material from mist effects (in world settings)"); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "radiosity", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RADIO); - RNA_def_property_ui_text(prop, "Radiosity", "Include this material in radiosity calculations"); - RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "transparent_shadows", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHADOW_TRA); RNA_def_property_ui_text(prop, "Transparent Shadows", "Allow this object to receive transparent shadows casted through other objects"); diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index a5f4ef73f7b..7b14a7a4712 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -104,24 +104,24 @@ void rna_def_metaelement(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Rotation", ""); RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); - prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_UNSIGNED); + prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_UNSIGNED|PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "rad"); RNA_def_property_ui_text(prop, "Radius", ""); RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); - prop= RNA_def_property(srna, "size_x", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "size_x", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "expx"); RNA_def_property_range(prop, 0.0f, 20.0f); RNA_def_property_ui_text(prop, "Size X", "Size of element, use of components depends on element type."); RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); - prop= RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "expy"); RNA_def_property_range(prop, 0.0f, 20.0f); RNA_def_property_ui_text(prop, "Size Y", "Size of element, use of components depends on element type."); RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); - prop= RNA_def_property(srna, "size_z", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "size_z", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "expz"); RNA_def_property_range(prop, 0.0f, 20.0f); RNA_def_property_ui_text(prop, "Size Z", "Size of element, use of components depends on element type."); @@ -176,13 +176,13 @@ void rna_def_metaball(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); /* number values */ - prop= RNA_def_property(srna, "wire_size", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "wire_size", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "wiresize"); RNA_def_property_range(prop, 0.050f, 1.0f); RNA_def_property_ui_text(prop, "Wire Size", "Polygonization resolution in the 3D viewport."); RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); - prop= RNA_def_property(srna, "render_size", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "render_size", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "rendersize"); RNA_def_property_range(prop, 0.050f, 1.0f); RNA_def_property_ui_text(prop, "Render Size", "Polygonization resolution in rendering."); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 91ec0365573..837158b9ec8 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -538,12 +538,12 @@ static void rna_def_modifier_build(BlenderRNA *brna) RNA_def_struct_sdna(srna, "BuildModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_BUILD); - prop= RNA_def_property(srna, "start", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "start", PROP_FLOAT, PROP_TIME); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); RNA_def_property_ui_text(prop, "Start", "Specify the start frame of the effect."); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); - prop= RNA_def_property(srna, "length", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "length", PROP_FLOAT, PROP_TIME); RNA_def_property_range(prop, 1, MAXFRAMEF); RNA_def_property_ui_text(prop, "Length", "Specify the total time the build effect requires"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); @@ -708,21 +708,21 @@ static void rna_def_modifier_wave(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Damping Time", ""); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); - prop= RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "falloff"); RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_range(prop, 0, 100, 100, 2); RNA_def_property_ui_text(prop, "Falloff Radius", ""); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); - prop= RNA_def_property(srna, "start_position_x", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "start_position_x", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "startx"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_range(prop, -100, 100, 100, 2); RNA_def_property_ui_text(prop, "Start Position X", ""); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); - prop= RNA_def_property(srna, "start_position_y", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "start_position_y", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "starty"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_range(prop, -100, 100, 100, 2); @@ -853,7 +853,7 @@ static void rna_def_modifier_hook(BlenderRNA *brna) RNA_def_struct_sdna(srna, "HookModifierData"); RNA_def_struct_ui_icon(srna, ICON_HOOK); - prop= RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_range(prop, 0, 100, 100, 2); RNA_def_property_ui_text(prop, "Falloff", "If not zero, the distance from the hook where influence ends."); @@ -953,7 +953,7 @@ static void rna_def_modifier_array(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Count", "Number of duplicates to make."); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); - prop= RNA_def_property(srna, "length", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "length", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_range(prop, 0, INT_MAX); RNA_def_property_ui_range(prop, 0, 10000, 10, 2); RNA_def_property_ui_text(prop, "Length", "Length to fit array within."); @@ -998,7 +998,7 @@ static void rna_def_modifier_array(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices in first and last duplicates."); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); - prop= RNA_def_property(srna, "merge_distance", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "merge_distance", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "merge_dist"); RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_range(prop, 0, 1, 1, 4); @@ -1280,7 +1280,7 @@ static void rna_def_modifier_cast(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Factor", ""); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); - prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_range(prop, 0, 100, 10, 2); RNA_def_property_ui_text(prop, "Radius", "Only deform vertices within this distance from the center of the effect (leave as 0 for infinite.)"); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 87e102a9a54..bad36025eda 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -41,6 +41,18 @@ #include "WM_types.h" + +EnumPropertyItem object_mode_items[] = { + {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object", ""}, + {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit", ""}, + {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt", ""}, + {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""}, + {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""}, + {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""}, + {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""}, + {OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose", ""}, + {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem parent_type_items[] = { {PAROBJECT, "OBJECT", 0, "Object", ""}, {PARCURVE, "CURVE", 0, "Curve", ""}, @@ -824,10 +836,10 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_range(prop, 0.01, 10000.0); RNA_def_property_ui_text(prop, "Mass", "Mass of the object."); - prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "inertia"); RNA_def_property_range(prop, 0.01, 10.0); - RNA_def_property_ui_text(prop, "Radius", "Radius for Bounding sphere and Fh/Fh Rot."); + RNA_def_property_ui_text(prop, "Radius", "Radius of bounding sphere and material physics"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "no_sleeping", PROP_BOOLEAN, PROP_NONE); @@ -887,13 +899,13 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis."); - prop= RNA_def_property(srna, "do_fh", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "material_physics", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_DO_FH); - RNA_def_property_ui_text(prop, "Do Fh", "Use Fh settings in materials."); + RNA_def_property_ui_text(prop, "Use Material Physics", "Use physics settings in materials."); - prop= RNA_def_property(srna, "rotation_fh", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "rotate_from_normal", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ROT_FH); - RNA_def_property_ui_text(prop, "Rotation Fh", "Use face normal to rotate Object"); + RNA_def_property_ui_text(prop, "Rotate From Normal", "Use face normal to rotate object, so that it points away from the surface"); prop= RNA_def_property(srna, "form_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "formfactor"); @@ -922,7 +934,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_CHILD); RNA_def_property_ui_text(prop, "Collison Compound", "Add children to form a compound collision object."); - prop= RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "margin"); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_ui_text(prop, "Collision Margin", "Extra margin around object for collision detection, small amount required for stability."); @@ -1036,6 +1048,12 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Type", "Type of Object."); + prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "mode"); + RNA_def_property_enum_items(prop, object_mode_items); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Mode", "Object interaction mode."); + prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "lay", 1); RNA_def_property_array(prop, 20); @@ -1218,7 +1236,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Empty Draw Type", "Viewport display style for empties."); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); - prop= RNA_def_property(srna, "empty_draw_size", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "empty_draw_size", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "empty_drawsize"); RNA_def_property_range(prop, 0.01, 10.0); RNA_def_property_ui_text(prop, "Empty Draw Size", "Size of of display for empties in the viewport."); @@ -1344,25 +1362,25 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Dupli Group", "Instance an existing group."); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update"); - prop= RNA_def_property(srna, "dupli_frames_start", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "dupli_frames_start", PROP_INT, PROP_NONE|PROP_UNIT_TIME); RNA_def_property_int_sdna(prop, NULL, "dupsta"); RNA_def_property_range(prop, 1, 32767); RNA_def_property_ui_text(prop, "Dupli Frames Start", "Start frame for DupliFrames."); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); - prop= RNA_def_property(srna, "dupli_frames_end", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "dupli_frames_end", PROP_INT, PROP_NONE|PROP_UNIT_TIME); RNA_def_property_int_sdna(prop, NULL, "dupend"); RNA_def_property_range(prop, 1, 32767); RNA_def_property_ui_text(prop, "Dupli Frames End", "End frame for DupliFrames."); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); - prop= RNA_def_property(srna, "dupli_frames_on", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "dupli_frames_on", PROP_INT, PROP_NONE|PROP_UNIT_TIME); RNA_def_property_int_sdna(prop, NULL, "dupon"); RNA_def_property_range(prop, 1, 1500); RNA_def_property_ui_text(prop, "Dupli Frames On", "Number of frames to use between DupOff frames."); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); - prop= RNA_def_property(srna, "dupli_frames_off", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "dupli_frames_off", PROP_INT, PROP_NONE|PROP_UNIT_TIME); RNA_def_property_int_sdna(prop, NULL, "dupoff"); RNA_def_property_range(prop, 0, 1500); RNA_def_property_ui_text(prop, "Dupli Frames Off", "Recurring frames to exclude from the Dupliframes."); @@ -1370,7 +1388,7 @@ static void rna_def_object(BlenderRNA *brna) /* time offset */ - prop= RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE|PROP_UNIT_TIME); RNA_def_property_float_sdna(prop, NULL, "sf"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); RNA_def_property_ui_text(prop, "Time Offset", "Animation offset in frames for IPO's and dupligroup instances."); @@ -1455,11 +1473,6 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_struct_type(prop, "Pose"); RNA_def_property_ui_text(prop, "Pose", "Current pose for armatures."); - prop= RNA_def_property(srna, "pose_mode", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_POSEMODE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Pose Mode", "Object with armature data is in pose mode."); - /* shape keys */ prop= RNA_def_property(srna, "shape_key_lock", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index f04001d8a64..932bef9969d 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -148,6 +148,7 @@ static void rna_Cache_idname_change(bContext *C, PointerRNA *ptr) if(new_name) { if(pid2 && cache->flag & PTCACHE_DISK_CACHE) { + /* TODO: change to simple file rename */ strcpy(name, cache->name); strcpy(cache->name, cache->prev_name); @@ -169,6 +170,87 @@ static void rna_Cache_idname_change(bContext *C, PointerRNA *ptr) BLI_freelistN(&pidlist); } +static void rna_Cache_list_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + Object *ob = ptr->id.data; + PointCache *cache= ptr->data; + PTCacheID *pid; + ListBase pidlist; + + BKE_ptcache_ids_from_object(&pidlist, ob); + + for(pid=pidlist.first; pid; pid=pid->next) { + if(pid->cache == cache) { + rna_iterator_listbase_begin(iter, pid->ptcaches, NULL); + break; + } + } + + BLI_freelistN(&pidlist); +} +static void rna_Cache_active_point_cache_index_range(PointerRNA *ptr, int *min, int *max) +{ + Object *ob = ptr->id.data; + PointCache *cache= ptr->data; + PTCacheID *pid; + ListBase pidlist; + + BKE_ptcache_ids_from_object(&pidlist, ob); + + *min= 0; + *max= 0; + + for(pid=pidlist.first; pid; pid=pid->next) { + if(pid->cache == cache) { + *max= BLI_countlist(pid->ptcaches)-1; + *max= MAX2(0, *max); + break; + } + } + + BLI_freelistN(&pidlist); +} + +static int rna_Cache_active_point_cache_index_get(PointerRNA *ptr) +{ + Object *ob = ptr->id.data; + PointCache *cache= ptr->data; + PTCacheID *pid; + ListBase pidlist; + int num = 0; + + BKE_ptcache_ids_from_object(&pidlist, ob); + + for(pid=pidlist.first; pid; pid=pid->next) { + if(pid->cache == cache) { + num = BLI_findindex(pid->ptcaches, cache); + break; + } + } + + BLI_freelistN(&pidlist); + + return num; +} + +static void rna_Cache_active_point_cache_index_set(struct PointerRNA *ptr, int value) +{ + Object *ob = ptr->id.data; + PointCache *cache= ptr->data; + PTCacheID *pid; + ListBase pidlist; + + BKE_ptcache_ids_from_object(&pidlist, ob); + + for(pid=pidlist.first; pid; pid=pid->next) { + if(pid->cache == cache) { + *(pid->cache_ptr) = BLI_findlink(pid->ptcaches, value); + break; + } + } + + BLI_freelistN(&pidlist); +} static int rna_SoftBodySettings_use_edges_get(PointerRNA *ptr) { Object *data= (Object*)(ptr->id.data); @@ -371,6 +453,7 @@ static void rna_def_pointcache(BlenderRNA *brna) srna= RNA_def_struct(brna, "PointCache", NULL); RNA_def_struct_ui_text(srna, "Point Cache", "Point cache for physics simulations."); + RNA_def_struct_ui_icon(srna, ICON_PHYSICS); prop= RNA_def_property(srna, "start_frame", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "startframe"); @@ -420,6 +503,7 @@ static void rna_def_pointcache(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "Name", "Cache name"); RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change"); + RNA_def_struct_name_property(srna, prop); prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "path"); @@ -440,6 +524,16 @@ static void rna_def_pointcache(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_EXTERNAL); RNA_def_property_ui_text(prop, "External", "Read cache from an external location"); RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change"); + + prop= RNA_def_property(srna, "point_cache_list", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0, 0); + RNA_def_property_struct_type(prop, "PointCache"); + RNA_def_property_ui_text(prop, "Point Cache List", "Point cache list"); + + prop= RNA_def_property(srna, "active_point_cache_index", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get", "rna_Cache_active_point_cache_index_set", "rna_Cache_active_point_cache_index_range"); + RNA_def_property_ui_text(prop, "Active Point Cache Index", ""); + RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change"); } static void rna_def_collision(BlenderRNA *brna) @@ -770,13 +864,13 @@ static void rna_def_game_softbody(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_BSB_BENDING_CONSTRAINTS); RNA_def_property_ui_text(prop, "Bending Const", "Enable bending constraints"); - prop= RNA_def_property(srna, "enable_rs_collision", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "cluster_rigid_to_softbody", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "collisionflags", OB_BSB_COL_CL_RS); - RNA_def_property_ui_text(prop, "Cluster Collision RS", "Enable cluster collision between soft and rigid body"); + RNA_def_property_ui_text(prop, "Rigid to Soft Body", "Enable cluster collision between soft and rigid body"); - prop= RNA_def_property(srna, "enable_ss_collision", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "cluster_soft_to_softbody", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "collisionflags", OB_BSB_COL_CL_SS); - RNA_def_property_ui_text(prop, "Cluster Collision SS", "Enable cluster collision between soft and soft body"); + RNA_def_property_ui_text(prop, "Soft to Soft Body", "Enable cluster collision between soft and soft body"); } static void rna_def_softbody(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 7268d560282..a219bd5aefa 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -106,6 +106,7 @@ static void rna_RenderEngine_unregister(const bContext *C, StructRNA *type) if(!et) return; + RNA_struct_free_extension(type, &et->ext); BLI_freelinkN(&R_engines, et); RNA_struct_free(&BLENDER_RNA, type); } @@ -272,10 +273,17 @@ static void rna_def_render_result(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; + FunctionRNA *func; srna= RNA_def_struct(brna, "RenderResult", NULL); RNA_def_struct_ui_text(srna, "Render Result", "Result of rendering, including all layers and passes."); + func= RNA_def_function(srna, "load_from_file", "RE_result_load_from_file"); + RNA_def_function_ui_description(func, "Copies the pixels of this render result from an image file."); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + prop= RNA_def_string(func, "filename", "", 0, "Filename", "Filename to load into this render tile, must be no smaller then the render result"); + RNA_def_property_flag(prop, PROP_REQUIRED); + RNA_define_verify_sdna(0); prop= RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE); @@ -302,15 +310,11 @@ static void rna_def_render_layer(BlenderRNA *brna) srna= RNA_def_struct(brna, "RenderLayer", NULL); RNA_def_struct_ui_text(srna, "Render Layer", ""); - func= RNA_def_function(srna, "rect_from_file", "RE_layer_rect_from_file"); + func= RNA_def_function(srna, "load_from_file", "RE_layer_load_from_file"); RNA_def_function_ui_description(func, "Copies the pixels of this renderlayer from an image file."); RNA_def_function_flag(func, FUNC_USE_REPORTS); prop= RNA_def_string(func, "filename", "", 0, "Filename", "Filename to load into this render tile, must be no smaller then the renderlayer"); RNA_def_property_flag(prop, PROP_REQUIRED); - prop= RNA_def_int(func, "x", 0, 0, INT_MAX, "Offset X", "Offset the position to copy from if the image is larger then the render layer", 0, INT_MAX); - RNA_def_property_flag(prop, PROP_REQUIRED); - prop= RNA_def_int(func, "y", 0, 0, INT_MAX, "Offset Y", "Offset the position to copy from if the image is larger then the render layer", 0, INT_MAX); - RNA_def_property_flag(prop, PROP_REQUIRED); RNA_define_verify_sdna(0); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 54f3cc23458..57ed5ccef39 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -420,6 +420,12 @@ static int rna_Property_editable_get(PointerRNA *ptr) return RNA_property_editable(ptr, prop); } +static int rna_Property_use_return_get(PointerRNA *ptr) +{ + PropertyRNA *prop= (PropertyRNA*)ptr->data; + return prop->flag & PROP_RETURN ? 1:0; +} + static int rna_Property_array_length_get(PointerRNA *ptr) { PropertyRNA *prop= (PropertyRNA*)ptr->data; @@ -848,6 +854,11 @@ static void rna_def_property(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_Property_editable_get", NULL); RNA_def_property_ui_text(prop, "Editable", "Property is editable through RNA."); + prop= RNA_def_property(srna, "use_return", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Property_use_return_get", NULL); + RNA_def_property_ui_text(prop, "Return", "True when this property is a return value from an rna function.."); + prop= RNA_def_property(srna, "registered", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_boolean_funcs(prop, "rna_Property_registered_get", NULL); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index a236f25c40f..7baf8c8fd93 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -30,6 +30,7 @@ #include "rna_internal.h" #include "DNA_scene_types.h" +#include "DNA_userdef_types.h" #ifdef WITH_FFMPEG #include "BKE_writeffmpeg.h" @@ -52,6 +53,7 @@ EnumPropertyItem prop_mode_items[] ={ #ifdef RNA_RUNTIME +#include "DNA_anim_types.h" #include "DNA_node_types.h" #include "BKE_context.h" @@ -174,6 +176,54 @@ static void rna_Scene_frame_update(bContext *C, PointerRNA *ptr) //ED_update_for_newframe(C); } +static int rna_Scene_active_keying_set_editable(PointerRNA *ptr) +{ + Scene *scene= (Scene *)ptr->data; + + /* only editable if there are some Keying Sets to change to */ + return (scene->keyingsets.first != NULL); +} + +static PointerRNA rna_Scene_active_keying_set_get(PointerRNA *ptr) +{ + Scene *scene= (Scene *)ptr->data; + return rna_pointer_inherit_refine(ptr, &RNA_KeyingSet, BLI_findlink(&scene->keyingsets, scene->active_keyingset-1)); +} + +static void rna_Scene_active_keying_set_set(PointerRNA *ptr, PointerRNA value) +{ + Scene *scene= (Scene *)ptr->data; + KeyingSet *ks= (KeyingSet*)value.data; + scene->active_keyingset= BLI_findindex(&scene->keyingsets, ks) + 1; +} + +static int rna_Scene_active_keying_set_index_get(PointerRNA *ptr) +{ + Scene *scene= (Scene *)ptr->data; + return MAX2(scene->active_keyingset-1, 0); +} + +static void rna_Scene_active_keying_set_index_set(PointerRNA *ptr, int value) +{ + Scene *scene= (Scene *)ptr->data; + scene->active_keyingset= value+1; +} + +static void rna_Scene_active_keying_set_index_range(PointerRNA *ptr, int *min, int *max) +{ + Scene *scene= (Scene *)ptr->data; + + *min= 0; + *max= BLI_countlist(&scene->keyingsets)-1; + *max= MAX2(0, *max); +} + + +static char *rna_SceneRenderData_path(PointerRNA *ptr) +{ + return BLI_sprintfN("render_data"); +} + static int rna_SceneRenderData_threads_get(PointerRNA *ptr) { RenderData *rd= (RenderData*)ptr->data; @@ -354,6 +404,11 @@ static void rna_def_tool_settings(BlenderRNA *brna) {SCE_SNAP_TARGET_MEDIAN, "MEDIAN", 0, "Median", "Snap median onto target."}, {SCE_SNAP_TARGET_ACTIVE, "ACTIVE", 0, "Active", "Snap active onto target."}, {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem auto_key_items[] = { + {AUTOKEY_MODE_NORMAL, "ADD_REPLACE_KEYS", 0, "Add/Replace", ""}, + {AUTOKEY_MODE_EDITKEYS, "REPLACE_KEYS", 0, "Replace", ""}, + {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "ToolSettings", NULL); RNA_def_struct_ui_text(srna, "Tool Settings", ""); @@ -416,6 +471,20 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PEEL_OBJECT); RNA_def_property_ui_text(prop, "Snap Peel Object", "Consider objects as whole when finding volume center."); RNA_def_property_ui_icon(prop, ICON_SNAP_PEEL_OBJECT, 0); + + /* Auto Keying */ + prop= RNA_def_property(srna, "enable_auto_key", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON); + RNA_def_property_ui_text(prop, "Auto Keying", "Automatic keyframe insertion for Objects and Bones"); + + prop= RNA_def_property(srna, "autokey_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "autokey_mode"); + RNA_def_property_enum_items(prop, auto_key_items); + RNA_def_property_ui_text(prop, "Auto-Keying Mode", "Mode of automatic keyframe insertion for Objects and Bones"); + + prop= RNA_def_property(srna, "record_with_nla", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA); + RNA_def_property_ui_text(prop, "Layered", "Add a new NLA Track + Strip for every loop/pass made over the animation to allow non-destructive tweaking."); /* UV */ prop= RNA_def_property(srna, "uv_selection_mode", PROP_ENUM, PROP_NONE); @@ -443,6 +512,40 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Vertex Group Weight", "Weight to assign in vertex groups."); } + +static void rna_def_unit_settings(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem unit_systems[] = { + {USER_UNIT_NONE, "NONE", 0, "None", ""}, + {USER_UNIT_METRIC, "METRIC", 0, "Metric", ""}, + {USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "UnitSettings", NULL); + RNA_def_struct_ui_text(srna, "Unit Settings", ""); + + /* Units */ + prop= RNA_def_property(srna, "system", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, unit_systems); + RNA_def_property_ui_text(prop, "Unit System", "The unit system to use for button display."); + RNA_def_property_update(prop, NC_WINDOW, NULL); + + prop= RNA_def_property(srna, "scale_length", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_ui_text(prop, "Unit Scale", "Scale to use when converting between blender units and dimensions."); + RNA_def_property_range(prop, 0.00001, 100000.0); + RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3); + RNA_def_property_update(prop, NC_WINDOW, NULL); + + prop= RNA_def_property(srna, "use_separate", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_UNIT_OPT_SPLIT); + RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs."); + RNA_def_property_update(prop, NC_WINDOW, NULL); +} + + void rna_def_render_layer_common(StructRNA *srna, int scene) { PropertyRNA *prop; @@ -1094,6 +1197,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) srna= RNA_def_struct(brna, "SceneRenderData", NULL); RNA_def_struct_sdna(srna, "RenderData"); RNA_def_struct_nested(brna, srna, "Scene"); + RNA_def_struct_path_func(srna, "rna_SceneRenderData_path"); RNA_def_struct_ui_text(srna, "Render Data", "Rendering settings for a Scene datablock."); prop= RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE); @@ -1390,6 +1494,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Fields Still", "Disable the time difference between fields."); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + prop= RNA_def_property(srna, "sync_audio", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_SYNC); + RNA_def_property_ui_text(prop, "Sync Audio", "Play back and sync with audio from Sequence Editor"); + RNA_def_property_update(prop, NC_SCENE, NULL); + prop= RNA_def_property(srna, "render_shadows", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_SHADOW); RNA_def_property_ui_text(prop, "Render Shadows", "Calculate shadows while rendering."); @@ -1666,7 +1775,7 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_ui_text(prop, "World", "World used for rendering the scene."); RNA_def_property_update(prop, NC_WORLD, NULL); - prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ); + prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ|PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "cursor"); RNA_def_property_ui_text(prop, "Cursor Location", "3D cursor location."); RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4); @@ -1753,21 +1862,36 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Sequence Editor", ""); /* Keying Sets */ - // TODO: hide the fact that active keyingset is an int? - prop= RNA_def_property(srna, "keyingsets", PROP_COLLECTION, PROP_NONE); + prop= RNA_def_property(srna, "keying_sets", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "keyingsets", NULL); RNA_def_property_struct_type(prop, "KeyingSet"); RNA_def_property_ui_text(prop, "Keying Sets", "Keying Sets for this Scene."); + RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); - prop= RNA_def_property(srna, "active_keyingset", PROP_INT, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Active Keying Set", "Current Keying Set index."); + prop= RNA_def_property(srna, "active_keying_set", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "KeyingSet"); + RNA_def_property_editable_func(prop, "rna_Scene_active_keying_set_editable"); + RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL); + RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes."); + RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); + + prop= RNA_def_property(srna, "active_keying_set_index", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "active_keyingset"); + RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", "rna_Scene_active_keying_set_index_range"); + RNA_def_property_ui_text(prop, "Active Keying Set Index", "Current Keying Set index."); + RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); /* Tool Settings */ prop= RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "toolsettings"); RNA_def_property_struct_type(prop, "ToolSettings"); RNA_def_property_ui_text(prop, "Tool Settings", ""); + + /* Unit Settings */ + prop= RNA_def_property(srna, "unit_settings", PROP_POINTER, PROP_NEVER_NULL); + RNA_def_property_pointer_sdna(prop, NULL, "unit"); + RNA_def_property_struct_type(prop, "UnitSettings"); + RNA_def_property_ui_text(prop, "Unit Settings", "Unit editing settings"); /* Render Data */ prop= RNA_def_property(srna, "render_data", PROP_POINTER, PROP_NEVER_NULL); @@ -1788,6 +1912,7 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Game Data", ""); rna_def_tool_settings(brna); + rna_def_unit_settings(brna); rna_def_scene_render_data(brna); rna_def_scene_game_data(brna); rna_def_scene_render_layer(brna); diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index e3171d38932..7a243327bd1 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -71,9 +71,15 @@ static void rna_Screen_scene_update(bContext *C, PointerRNA *ptr) } } +static int rna_Screen_animation_playing_get(PointerRNA *ptr) +{ + bScreen *sc= (bScreen*)ptr->data; + return (sc->animtimer != NULL); +} + #else -static void rna_def_scrarea(BlenderRNA *brna) +static void rna_def_area(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; @@ -119,7 +125,7 @@ static void rna_def_region(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Region ID", "Uniqute ID for this region."); } -static void rna_def_bscreen(BlenderRNA *brna) +static void rna_def_screen(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; @@ -139,12 +145,17 @@ static void rna_def_bscreen(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "areabase", NULL); RNA_def_property_struct_type(prop, "Area"); RNA_def_property_ui_text(prop, "Areas", "Areas the screen is subdivided into."); + + prop= RNA_def_property(srna, "animation_playing", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Screen_animation_playing_get", NULL); + RNA_def_property_ui_text(prop, "Animation Playing", "Animation playback is active."); } void RNA_def_screen(BlenderRNA *brna) { - rna_def_bscreen(brna); - rna_def_scrarea(brna); + rna_def_screen(brna); + rna_def_area(brna); rna_def_region(brna); } diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 1e512d8f9bb..c2c906e38f2 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -31,6 +31,8 @@ #include "DNA_scene_types.h" +#include "BKE_paint.h" + #ifdef RNA_RUNTIME static PointerRNA rna_ParticleEdit_brush_get(PointerRNA *ptr) @@ -49,20 +51,67 @@ static PointerRNA rna_ParticleBrush_curve_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_CurveMapping, NULL); } +static void rna_Paint_brushes_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + Paint *p= (Paint*)ptr->data; + rna_iterator_array_begin(iter, (void*)p->brushes, sizeof(Brush*), p->brush_count, 0, NULL); +} + +static int rna_Paint_brushes_length(PointerRNA *ptr) +{ + Paint *p= (Paint*)ptr->data; + + return p->brush_count; +} + +static PointerRNA rna_Paint_active_brush_get(PointerRNA *ptr) +{ + return rna_pointer_inherit_refine(ptr, &RNA_Brush, paint_brush(ptr->data)); +} + +static void rna_Paint_active_brush_set(PointerRNA *ptr, PointerRNA value) +{ + paint_brush_set(ptr->data, value.data); +} + #else -static void rna_def_sculpt(BlenderRNA *brna) +static void rna_def_paint(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "Sculpt", NULL); - RNA_def_struct_ui_text(srna, "Sculpt", ""); - + srna= RNA_def_struct(brna, "Paint", NULL); + RNA_def_struct_ui_text(srna, "Paint", ""); + + prop= RNA_def_property(srna, "brushes", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "Brush"); + RNA_def_property_collection_funcs(prop, "rna_Paint_brushes_begin", + "rna_iterator_array_next", + "rna_iterator_array_end", + "rna_iterator_array_dereference_get", + "rna_Paint_brushes_length", 0, 0, 0, 0); + RNA_def_property_ui_text(prop, "Brushes", "Brushes selected for this paint mode."); + + prop= RNA_def_property(srna, "active_brush_index", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 0, INT_MAX); + + /* Fake property to get active brush directly, rather than integer index */ prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Brush"); - RNA_def_property_ui_text(prop, "Brush", ""); + RNA_def_property_pointer_funcs(prop, "rna_Paint_active_brush_get", "rna_Paint_active_brush_set", NULL); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Brush", "Active paint brush."); +} + +static void rna_def_sculpt(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + srna= RNA_def_struct(brna, "Sculpt", "Paint"); + RNA_def_struct_ui_text(srna, "Sculpt", ""); + prop= RNA_def_property(srna, "symmetry_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_X); RNA_def_property_ui_text(prop, "Symmetry X", "Mirror brush across the X axis."); @@ -110,14 +159,10 @@ static void rna_def_vertex_paint(BlenderRNA *brna) {6, "DARKEN", 0, "Darken", "Use darken blending mode while painting."}, {0, NULL, 0, NULL, NULL}}; - srna= RNA_def_struct(brna, "VertexPaint", NULL); + srna= RNA_def_struct(brna, "VertexPaint", "Paint"); RNA_def_struct_sdna(srna, "VPaint"); RNA_def_struct_ui_text(srna, "Vertex Paint", "Properties of vertex and weight paint mode."); - prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Brush"); - RNA_def_property_ui_text(prop, "Brush", ""); - prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prop_mode_items); RNA_def_property_ui_text(prop, "Brush Mode", "Mode in which color is painted."); @@ -159,14 +204,10 @@ static void rna_def_image_paint(BlenderRNA *brna) {PAINT_TOOL_CLONE, "CLONE", 0, "Clone", ""}, {0, NULL, 0, NULL, NULL}}; - srna= RNA_def_struct(brna, "ImagePaint", NULL); + srna= RNA_def_struct(brna, "ImagePaint", "Paint"); RNA_def_struct_sdna(srna, "ImagePaintSettings"); RNA_def_struct_ui_text(srna, "Image Paint", "Properties of image and texture painting mode."); - prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Brush"); - RNA_def_property_ui_text(prop, "Brush", ""); - prop= RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, tool_items); RNA_def_property_ui_text(prop, "Tool", ""); @@ -353,6 +394,7 @@ static void rna_def_particle_edit(BlenderRNA *brna) void RNA_def_sculpt_paint(BlenderRNA *brna) { + rna_def_paint(brna); rna_def_sculpt(brna); rna_def_vertex_paint(brna); rna_def_image_paint(brna); diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 1cd98ca3a9c..6f1babb495a 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -210,10 +210,27 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "strength"); - RNA_def_property_range(prop, -5.0, 5.0); + RNA_def_property_range(prop, 1.0, 10.0); RNA_def_property_ui_range(prop, 1.0, 10.0, 1, 2); RNA_def_property_ui_text(prop, "Strength", "Strength of wavelet noise"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); + + prop= RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "diss_speed"); + RNA_def_property_range(prop, 1.0, 100.0); + RNA_def_property_ui_range(prop, 1.0, 1000.0, 1, 0); + RNA_def_property_ui_text(prop, "Dissolve Speed", "Dissolve Speed"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, NULL); + + prop= RNA_def_property(srna, "dissolve_smoke", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_DISSOLVE); + RNA_def_property_ui_text(prop, "Dissolve Smoke", "Enable smoke to disappear over time."); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, NULL); + + prop= RNA_def_property(srna, "dissolve_smoke_log", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_DISSOLVE_LOG); + RNA_def_property_ui_text(prop, "Logarithmic dissolve", "Using 1/x "); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, NULL); } static void rna_def_smoke_flow_settings(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 793970dea49..664b1713b31 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -37,6 +37,8 @@ #include "DNA_space_types.h" #include "DNA_view3d_types.h" +#include "BKE_paint.h" + #include "WM_types.h" EnumPropertyItem space_type_items[] = { @@ -83,6 +85,7 @@ static EnumPropertyItem dc_all_items[] = {DC_RGB, DC_RGBA, DC_ALPHA, DC_Z, DC_LC #include "BKE_context.h" #include "ED_image.h" +#include "ED_screen.h" #include "IMB_imbuf_types.h" @@ -118,10 +121,10 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr) case SPACE_NLA: return &RNA_SpaceNLA; /*case SPACE_SCRIPT: - return &RNA_SpaceScriptsWindow; + return &RNA_SpaceScriptsWindow;*/ case SPACE_TIME: return &RNA_SpaceTimeline; - case SPACE_NODE: + /*case SPACE_NODE: return &RNA_SpaceNodeEditor; case SPACE_LOGIC: return &RNA_SpaceLogicEditor;*/ @@ -144,7 +147,7 @@ static void rna_SpaceImageEditor_paint_update(bContext *C, PointerRNA *ptr) Scene *scene= CTX_data_scene(C); if(scene) - brush_check_exists(&scene->toolsettings->imapaint.brush); + paint_init(&scene->toolsettings->imapaint.paint, "Brush"); } static int rna_SpaceImageEditor_show_render_get(PointerRNA *ptr) @@ -303,6 +306,13 @@ static void rna_View3D_display_background_image_set(PointerRNA *ptr, int value) } } +/* Space Time */ +static void rna_SpaceTime_redraw_update(bContext *C, PointerRNA *ptr) +{ + SpaceTime *st= (SpaceTime*)ptr->data; + ED_screen_animation_timer_update(C, st->redraws); +} + #else static void rna_def_space(BlenderRNA *brna) @@ -564,19 +574,19 @@ static void rna_def_space_3dview(BlenderRNA *brna) RNA_def_property_range(prop, 1.0f, 250.0f); RNA_def_property_update(prop, NC_WINDOW, NULL); - prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "near"); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_text(prop, "Clip Start", "3D View near clipping distance."); RNA_def_property_update(prop, NC_WINDOW, NULL); - prop= RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "far"); RNA_def_property_range(prop, 1.0f, FLT_MAX); RNA_def_property_ui_text(prop, "Clip End", "3D View far clipping distance."); RNA_def_property_update(prop, NC_WINDOW, NULL); - prop= RNA_def_property(srna, "grid_spacing", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "grid_spacing", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "grid"); RNA_def_property_ui_text(prop, "Grid Spacing", "The distance between 3D View grid lines."); RNA_def_property_range(prop, 0.0f, FLT_MAX); @@ -836,11 +846,11 @@ static void rna_def_space_sequencer(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem display_mode_items[] = { - {SEQ_DRAW_SEQUENCE, "SEQUENCER", 0, "Sequencer", ""}, - {SEQ_DRAW_IMG_IMBUF, "IMAGE", 0, "Image Preview", ""}, - {SEQ_DRAW_IMG_WAVEFORM, "WAVEFORM", 0, "Luma Waveform", ""}, - {SEQ_DRAW_IMG_VECTORSCOPE, "VECTOR_SCOPE", 0, "Chroma Vectorscope", ""}, - {SEQ_DRAW_IMG_HISTOGRAM, "HISTOGRAM", 0, "Histogram", ""}, + {SEQ_DRAW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""}, + {SEQ_DRAW_IMG_IMBUF, "IMAGE", ICON_SEQ_PREVIEW, "Image Preview", ""}, + {SEQ_DRAW_IMG_WAVEFORM, "WAVEFORM", ICON_SEQ_LUMA_WAVEFORM, "Luma Waveform", ""}, + {SEQ_DRAW_IMG_VECTORSCOPE, "VECTOR_SCOPE", ICON_SEQ_CHROMA_SCOPE, "Chroma Vectorscope", ""}, + {SEQ_DRAW_IMG_HISTOGRAM, "HISTOGRAM", ICON_SEQ_HISTOGRAM, "Histogram", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "SpaceSequenceEditor", "Space"); @@ -1104,6 +1114,59 @@ static void rna_def_space_nla(BlenderRNA *brna) // TODO... autosnap, dopesheet? } +static void rna_def_space_time(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "SpaceTimeline", "Space"); + RNA_def_struct_sdna(srna, "SpaceTime"); + RNA_def_struct_ui_text(srna, "Space Timeline Editor", "Timeline editor space data."); + + /* Define Anim Playback Areas */ + + prop= RNA_def_property(srna, "play_top_left", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_REGION); + RNA_def_property_ui_text(prop, "Top-Left 3D Window", ""); + RNA_def_property_update(prop, 0, "rna_SpaceTime_redraw_update"); + + prop= RNA_def_property(srna, "play_all_3d", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_ALL_3D_WIN); + RNA_def_property_ui_text(prop, "All 3D Windows", ""); + RNA_def_property_update(prop, 0, "rna_SpaceTime_redraw_update"); + + prop= RNA_def_property(srna, "play_anim", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_ALL_ANIM_WIN); + RNA_def_property_ui_text(prop, "Animation Windows", ""); + RNA_def_property_update(prop, 0, "rna_SpaceTime_redraw_update"); + + prop= RNA_def_property(srna, "play_buttons", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_ALL_BUTS_WIN); + RNA_def_property_ui_text(prop, "Buttons Windows", ""); + RNA_def_property_update(prop, 0, "rna_SpaceTime_redraw_update"); + + prop= RNA_def_property(srna, "play_image", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_ALL_IMAGE_WIN); + RNA_def_property_ui_text(prop, "Image Windows", ""); + RNA_def_property_update(prop, 0, "rna_SpaceTime_redraw_update"); + + prop= RNA_def_property(srna, "play_sequencer", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_SEQ); + RNA_def_property_ui_text(prop, "Sequencer Windows", ""); + RNA_def_property_update(prop, 0, "rna_SpaceTime_redraw_update"); + + /* Other options */ + + prop= RNA_def_property(srna, "continue_physics", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_CONTINUE_PHYSICS); + RNA_def_property_ui_text(prop, "Continue Physics", "During playblack, continue physics simulations regardless of the frame number"); + + prop= RNA_def_property(srna, "only_selected", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ONLYACTSEL); + RNA_def_property_ui_text(prop, "Only Selected channels", "Show keyframes only from active/selected channels."); + RNA_def_property_update(prop, NC_WINDOW, NULL); +} + static void rna_def_console_line(BlenderRNA *brna) { StructRNA *srna; @@ -1332,6 +1395,7 @@ void RNA_def_space(BlenderRNA *brna) rna_def_space_dopesheet(brna); rna_def_space_graph(brna); rna_def_space_nla(brna); + rna_def_space_time(brna); rna_def_space_console(brna); rna_def_console_line(brna); } diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 5c7fd5ece0e..ccb5e5b2f95 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -147,6 +147,20 @@ static EnumPropertyItem *rna_ImageTexture_filter_itemf(bContext *C, PointerRNA * return item; } +static float rna_TextureSlot_angle_get(PointerRNA *ptr) +{ + MTex *tex= (MTex*)ptr->data; + const float conv = 57.295779506; + return tex->rot * conv; +} + +static void rna_TextureSlot_angle_set(PointerRNA *ptr, float v) +{ + MTex *tex= (MTex*)ptr->data; + const float conv = 0.017453293; + tex->rot = v * conv; +} + #else static void rna_def_color_ramp_element(BlenderRNA *brna) @@ -267,6 +281,12 @@ static void rna_def_mtex(BlenderRNA *brna) {MTEX_BLEND_COLOR, "COLOR", 0, "Color", ""}, {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem prop_map_mode_items[] = { + {MTEX_MAP_MODE_FIXED, "FIXED", 0, "Fixed", ""}, + {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""}, + {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""}, + {0, NULL, 0, NULL, NULL}}; + srna= RNA_def_struct(brna, "TextureSlot", NULL); RNA_def_struct_sdna(srna, "MTex"); RNA_def_struct_ui_text(srna, "Texture Slot", "Texture slot defining the mapping and influence of a texture."); @@ -325,6 +345,17 @@ static void rna_def_mtex(BlenderRNA *brna) RNA_def_property_ui_text(prop, "RGB to Intensity", "Converts texture RGB values to intensity (gray) values."); RNA_def_property_update(prop, NC_TEXTURE, NULL); + prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "rot"); + RNA_def_property_range(prop, 0, 360); + RNA_def_property_float_funcs(prop, "rna_TextureSlot_angle_get", "rna_TextureSlot_angle_set", NULL); + RNA_def_property_ui_text(prop, "Angle", "Defines brush texture rotation."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "brush_map_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, prop_map_mode_items); + RNA_def_property_ui_text(prop, "Mode", ""); + prop= RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "def_var"); RNA_def_property_ui_range(prop, 0, 1, 10, 3); diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 590f85fedd7..660dbb49027 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -138,6 +138,8 @@ static void rna_Panel_unregister(const bContext *C, StructRNA *type) if(!(art=region_type_find(NULL, pt->space_type, pt->region_type))) return; + RNA_struct_free_extension(type, &pt->ext); + BLI_freelinkN(&art->paneltypes, pt); RNA_struct_free(&BLENDER_RNA, type); @@ -233,6 +235,8 @@ static void rna_Header_unregister(const bContext *C, StructRNA *type) if(!(art=region_type_find(NULL, ht->space_type, RGN_TYPE_HEADER))) return; + RNA_struct_free_extension(type, &ht->ext); + BLI_freelinkN(&art->headertypes, ht); RNA_struct_free(&BLENDER_RNA, type); @@ -347,6 +351,8 @@ static void rna_Menu_unregister(const bContext *C, StructRNA *type) if(!(art=region_type_find(NULL, mt->space_type, RGN_TYPE_HEADER))) return; + RNA_struct_free_extension(type, &mt->ext); + BLI_freelinkN(&art->menutypes, mt); RNA_struct_free(&BLENDER_RNA, type); diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index e788250e407..40d300315f5 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -288,6 +288,15 @@ void RNA_api_ui_layout(StructRNA *srna) func= RNA_def_function(srna, "template_header_3D", "uiTemplateHeader3D"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); + func= RNA_def_function(srna, "view3d_select_metaballmenu", "uiTemplate_view3d_select_metaballmenu"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + func= RNA_def_function(srna, "view3d_select_armaturemenu", "uiTemplate_view3d_select_armaturemenu"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + func= RNA_def_function(srna, "view3d_select_posemenu", "uiTemplate_view3d_select_posemenu"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + func= RNA_def_function(srna, "view3d_select_faceselmenu", "uiTemplate_view3d_select_faceselmenu"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + func= RNA_def_function(srna, "template_texture_image", "uiTemplateTextureImage"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm= RNA_def_pointer(func, "texture", "Texture", "", ""); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 19b2b5376f7..59333f1191d 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -120,7 +120,7 @@ static PointerRNA rna_UserDef_system_get(PointerRNA *ptr) static void rna_UserDef_audio_update(bContext *C, PointerRNA *ptr) { - sound_reinit(C); + sound_init(C); } #else @@ -1992,6 +1992,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) {0, "AUDIO_DEVICE_NULL", 0, "No Audio", "Null device - there will be no audio output."}, {1, "AUDIO_DEVICE_SDL", 0, "SDL", "SDL device - simple direct media layer, recommended for sequencer usage."}, {2, "AUDIO_DEVICE_OPENAL", 0, "OpenAL", "OpenAL device - supports 3D audio, recommended for game engine usage."}, + {3, "AUDIO_DEVICE_JACK", 0, "Jack", "Jack device - open source pro audio, recommended for pro audio users."}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem audio_rate_items[] = { diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index e999ae5d601..525a4446932 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -216,7 +216,7 @@ static void rna_def_ambient_occlusion(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_AMB_OCC); RNA_def_property_ui_text(prop, "Enabled", "Use Ambient Occlusion to add light based on distance between elements, creating the illusion of omnipresent light"); - prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "aodist"); RNA_def_property_ui_text(prop, "Distance", "Length of rays, defines how far away other faces give occlusion effect."); @@ -319,19 +319,19 @@ static void rna_def_world_mist(BlenderRNA *brna) RNA_def_property_range(prop, 0, 1); RNA_def_property_ui_text(prop, "Intensity", "Intensity of the mist effect."); - prop= RNA_def_property(srna, "start", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "start", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "miststa"); RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_range(prop, 0, 10000, 10, 2); RNA_def_property_ui_text(prop, "Start", "Starting distance of the mist, measured from the camera"); - prop= RNA_def_property(srna, "depth", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "depth", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "mistdist"); RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_range(prop, 0, 10000, 10, 2); RNA_def_property_ui_text(prop, "Depth", "The distance over which the mist effect fades in"); - prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "misthi"); RNA_def_property_range(prop, 0, 100); RNA_def_property_ui_text(prop, "Height", "Control how much mist density decreases with height"); @@ -363,7 +363,7 @@ static void rna_def_world_stars(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Size", "Average screen dimension of stars."); RNA_def_property_update(prop, NC_WORLD, NULL); - prop= RNA_def_property(srna, "min_distance", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "min_distance", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "starmindist"); RNA_def_property_range(prop, 0, 1000); RNA_def_property_ui_text(prop, "Minimum Distance", "Minimum distance to the camera for stars."); diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index 664aacf11ab..ca21ba592a8 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -31,7 +31,6 @@ SET(INC ../imbuf ../avi ../../../intern/elbeem/extern ../../../intern/iksolver/extern ../blenloader ../quicktime ../blenkernel ../../../extern/glew/include ../gpu - ${SDL_INC} ${ZLIB_INC} ) diff --git a/source/blender/python/epy_doc_gen.py b/source/blender/python/epy_doc_gen.py index 8630a0c8f8e..1da69c622a6 100644 --- a/source/blender/python/epy_doc_gen.py +++ b/source/blender/python/epy_doc_gen.py @@ -76,6 +76,7 @@ def write_func(rna, ident, out, func_type): rna_func_desc = rna.description.strip() items = rna.parameters.items() + for rna_prop_identifier, rna_prop in items: if rna_prop_identifier=='rna_type': continue @@ -88,13 +89,25 @@ def write_func(rna, ident, out, func_type): rna_prop_type = rna_prop.type.lower() # enum, float, int, boolean + # only for rna funcions, operators should not get pointers as args + if rna_prop_type=='pointer': + rna_prop_type_refine = "L{%s}" % rna_prop.fixed_type.identifier + else: + rna_prop_type_refine = rna_prop_type + + try: length = rna_prop.array_length except: length = 0 array_str = get_array_str(length) - kw_type_str= "@type %s: %s%s" % (rna_prop_identifier, rna_prop_type, array_str) - kw_param_str= "@param %s: %s" % (rna_prop_identifier, rna_prop.description.strip()) + if rna_prop.use_return: + kw_type_str= "@rtype: %s%s" % (rna_prop_type_refine, array_str) + kw_param_str= "@return: %s" % (rna_prop.description.strip()) + else: + kw_type_str= "@type %s: %s%s" % (rna_prop_identifier, rna_prop_type_refine, array_str) + kw_param_str= "@param %s: %s" % (rna_prop_identifier, rna_prop.description.strip()) + kw_param_set = False if func_type=='OPERATOR': @@ -159,8 +172,11 @@ def write_func(rna, ident, out, func_type): # stora else: # currently functions dont have a default value - kw_args.append('%s' % (rna_prop_identifier)) - + if not rna_prop.use_return: + kw_args.append('%s' % (rna_prop_identifier)) + else: + kw_param_set = True + # Same for operators and functions kw_arg_attrs.append(kw_type_str) @@ -174,7 +190,8 @@ def write_func(rna, ident, out, func_type): out.write(ident+'\t%s\n' % rna_func_desc) for desc in kw_arg_attrs: out.write(ident+'\t%s\n' % desc) - out.write(ident+'\t@rtype: None\n') + + # out.write(ident+'\t@rtype: None\n') # implicit out.write(ident+'\t"""\n') @@ -269,7 +286,8 @@ def rna2epy(target_path): out.write(ident+ '\t@ivar %s: %s in (%s)\n' % (rna_prop_identifier, rna_desc, ', '.join(rna_prop.items.keys()))) else: out.write(ident+ '\t@ivar %s: %s in...\n' % (rna_prop_identifier, rna_desc)) - for e in rna_prop.items.keys(): + for e, e_rna_prop in rna_prop.items.items(): + #out.write(ident+ '\t\t- %s: %s\n' % (e, e_rna_prop.description)) # XXX - segfaults, FIXME out.write(ident+ '\t\t- %s\n' % e) out.write(ident+ '\t@type %s: %s%s%s\n' % (rna_prop_identifier, rna_prop_type, array_str, readonly_str)) diff --git a/source/blender/python/generic/BGL.c b/source/blender/python/generic/BGL.c index 2fd9130857f..767af8e0836 100644 --- a/source/blender/python/generic/BGL.c +++ b/source/blender/python/generic/BGL.c @@ -67,7 +67,7 @@ static int Buffer_ass_slice( PyObject * self, int begin, int end, PyObject * seq ); static PySequenceMethods Buffer_SeqMethods = { - ( inquiry ) Buffer_len, /*sq_length */ + ( lenfunc ) Buffer_len, /*sq_length */ ( binaryfunc ) 0, /*sq_concat */ ( ssizeargfunc ) 0, /*sq_repeat */ ( ssizeargfunc ) Buffer_item, /*sq_item */ diff --git a/source/blender/python/generic/BGL.h b/source/blender/python/generic/BGL.h index a8c37bf3edd..91f88549faf 100644 --- a/source/blender/python/generic/BGL.h +++ b/source/blender/python/generic/BGL.h @@ -304,31 +304,30 @@ typedef struct _Buffer { #define ret_def_void #define ret_set_void -/* would use Py_RETURN_NONE - except for py 2.3 doesnt have it */ -#define ret_ret_void { Py_INCREF(Py_None); return Py_None; } +#define ret_ret_void return Py_INCREF(Py_None), Py_None #define ret_def_GLint int ret_int #define ret_set_GLint ret_int= -#define ret_ret_GLint return PyLong_FromLong(ret_int); +#define ret_ret_GLint return PyLong_FromLong(ret_int) #define ret_def_GLuint unsigned int ret_uint #define ret_set_GLuint ret_uint= -#define ret_ret_GLuint return PyLong_FromLong((long) ret_uint); +#define ret_ret_GLuint return PyLong_FromLong((long) ret_uint) #define ret_def_GLenum unsigned int ret_uint #define ret_set_GLenum ret_uint= -#define ret_ret_GLenum return PyLong_FromLong((long) ret_uint); +#define ret_ret_GLenum return PyLong_FromLong((long) ret_uint) #define ret_def_GLboolean unsigned char ret_bool #define ret_set_GLboolean ret_bool= -#define ret_ret_GLboolean return PyLong_FromLong((long) ret_bool); +#define ret_ret_GLboolean return PyLong_FromLong((long) ret_bool) #define ret_def_GLstring const unsigned char *ret_str; #define ret_set_GLstring ret_str= #define ret_ret_GLstring \ if (ret_str) {\ - return PyUnicode_FromString(ret_str);\ + return PyUnicode_FromString((const char *)ret_str);\ } else {\ PyErr_SetString(PyExc_AttributeError, "could not get opengl string");\ return NULL;\ diff --git a/source/blender/python/generic/euler.c b/source/blender/python/generic/euler.c index c6aaee64ebe..73fcaeb457b 100644 --- a/source/blender/python/generic/euler.c +++ b/source/blender/python/generic/euler.c @@ -242,7 +242,7 @@ static PyObject *Euler_Rotate(EulerObject * self, PyObject *args) PyErr_SetString(PyExc_TypeError, "euler.rotate():expected angle (float) and axis (x,y,z)"); return NULL; } - if(!STREQ3(axis,"x","y","z")){ + if(ELEM3(*axis, 'x', 'y', 'z') && axis[1]=='\0'){ PyErr_SetString(PyExc_TypeError, "euler.rotate(): expected axis to be 'x', 'y' or 'z'"); return NULL; } @@ -508,7 +508,7 @@ static int Euler_ass_slice(EulerObject * self, int begin, int end, } //-----------------PROTCOL DECLARATIONS-------------------------- static PySequenceMethods Euler_SeqMethods = { - (inquiry) Euler_len, /* sq_length */ + (lenfunc) Euler_len, /* sq_length */ (binaryfunc) 0, /* sq_concat */ (ssizeargfunc) 0, /* sq_repeat */ (ssizeargfunc) Euler_item, /* sq_item */ diff --git a/source/blender/python/generic/matrix.c b/source/blender/python/generic/matrix.c index d4153243516..be3e704460a 100644 --- a/source/blender/python/generic/matrix.c +++ b/source/blender/python/generic/matrix.c @@ -37,14 +37,17 @@ static PyObject *column_vector_multiplication(MatrixObject * mat, VectorObject* /* matrix vector callbacks */ int mathutils_matrix_vector_cb_index= -1; -static int mathutils_matrix_vector_check(MatrixObject *self) +static int mathutils_matrix_vector_check(PyObject *self_p) { + MatrixObject *self= (MatrixObject*)self_p; return BaseMath_ReadCallback(self); } -static int mathutils_matrix_vector_get(MatrixObject *self, int subtype, float *vec_from) +static int mathutils_matrix_vector_get(PyObject *self_p, int subtype, float *vec_from) { + MatrixObject *self= (MatrixObject*)self_p; int i; + if(!BaseMath_ReadCallback(self)) return 0; @@ -54,9 +57,11 @@ static int mathutils_matrix_vector_get(MatrixObject *self, int subtype, float *v return 1; } -static int mathutils_matrix_vector_set(MatrixObject *self, int subtype, float *vec_to) +static int mathutils_matrix_vector_set(PyObject *self_p, int subtype, float *vec_to) { + MatrixObject *self= (MatrixObject*)self_p; int i; + if(!BaseMath_ReadCallback(self)) return 0; @@ -67,8 +72,10 @@ static int mathutils_matrix_vector_set(MatrixObject *self, int subtype, float *v return 1; } -static int mathutils_matrix_vector_get_index(MatrixObject *self, int subtype, float *vec_from, int index) +static int mathutils_matrix_vector_get_index(PyObject *self_p, int subtype, float *vec_from, int index) { + MatrixObject *self= (MatrixObject*)self_p; + if(!BaseMath_ReadCallback(self)) return 0; @@ -76,8 +83,10 @@ static int mathutils_matrix_vector_get_index(MatrixObject *self, int subtype, fl return 1; } -static int mathutils_matrix_vector_set_index(MatrixObject *self, int subtype, float *vec_to, int index) +static int mathutils_matrix_vector_set_index(PyObject *self_p, int subtype, float *vec_to, int index) { + MatrixObject *self= (MatrixObject*)self_p; + if(!BaseMath_ReadCallback(self)) return 0; @@ -988,7 +997,7 @@ static PyObject* Matrix_inv(MatrixObject *self) /*-----------------PROTOCOL DECLARATIONS--------------------------*/ static PySequenceMethods Matrix_SeqMethods = { - (inquiry) Matrix_len, /* sq_length */ + (lenfunc) Matrix_len, /* sq_length */ (binaryfunc) 0, /* sq_concat */ (ssizeargfunc) 0, /* sq_repeat */ (ssizeargfunc) Matrix_item, /* sq_item */ diff --git a/source/blender/python/generic/quat.c b/source/blender/python/generic/quat.c index e06bee32031..7e12fe7925a 100644 --- a/source/blender/python/generic/quat.c +++ b/source/blender/python/generic/quat.c @@ -611,7 +611,7 @@ static PyObject *Quaternion_mul(PyObject * q1, PyObject * q2) //-----------------PROTOCOL DECLARATIONS-------------------------- static PySequenceMethods Quaternion_SeqMethods = { - (inquiry) Quaternion_len, /* sq_length */ + (lenfunc) Quaternion_len, /* sq_length */ (binaryfunc) 0, /* sq_concat */ (ssizeargfunc) 0, /* sq_repeat */ (ssizeargfunc) Quaternion_item, /* sq_item */ diff --git a/source/blender/python/generic/vector.c b/source/blender/python/generic/vector.c index 63bc2fbc7d1..923c4bbe58a 100644 --- a/source/blender/python/generic/vector.c +++ b/source/blender/python/generic/vector.c @@ -1054,7 +1054,7 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa /*-----------------PROTCOL DECLARATIONS--------------------------*/ static PySequenceMethods Vector_SeqMethods = { - (inquiry) Vector_len, /* sq_length */ + (lenfunc) Vector_len, /* sq_length */ (binaryfunc) 0, /* sq_concat */ (ssizeargfunc) 0, /* sq_repeat */ (ssizeargfunc) Vector_item, /* sq_item */ @@ -1267,7 +1267,7 @@ static PyObject *Vector_getSwizzle(VectorObject * self, void *closure) /* Unpack the axes from the closure into an array. */ axisA = 0; - swizzleClosure = (unsigned int) closure; + swizzleClosure = GET_INT_FROM_POINTER(closure); while (swizzleClosure & SWIZZLE_VALID_AXIS) { axisB = swizzleClosure & SWIZZLE_AXIS; @@ -1307,7 +1307,7 @@ static int Vector_setSwizzle(VectorObject * self, PyObject * value, void *closur /* Check that the closure can be used with this vector: even 2D vectors have swizzles defined for axes z and w, but they would be invalid. */ - swizzleClosure = (unsigned int) closure; + swizzleClosure = GET_INT_FROM_POINTER(closure); while (swizzleClosure & SWIZZLE_VALID_AXIS) { axisA = swizzleClosure & SWIZZLE_AXIS; @@ -1324,7 +1324,7 @@ static int Vector_setSwizzle(VectorObject * self, PyObject * value, void *closur /* Copy vector contents onto swizzled axes. */ vecVal = (VectorObject*) value; axisB = 0; - swizzleClosure = (unsigned int) closure; + swizzleClosure = GET_INT_FROM_POINTER(closure); while (swizzleClosure & SWIZZLE_VALID_AXIS && axisB < vecVal->size) { axisA = swizzleClosure & SWIZZLE_AXIS; @@ -1340,7 +1340,7 @@ static int Vector_setSwizzle(VectorObject * self, PyObject * value, void *closur { /* Copy list contents onto swizzled axes. */ listLen = PyList_Size(value); - swizzleClosure = (unsigned int) closure; + swizzleClosure = GET_INT_FROM_POINTER(closure); axisB = 0; while (swizzleClosure & SWIZZLE_VALID_AXIS && axisB < listLen) { @@ -1365,7 +1365,7 @@ static int Vector_setSwizzle(VectorObject * self, PyObject * value, void *closur else if (((scalarVal = (float)PyFloat_AsDouble(value)) == -1.0 && PyErr_Occurred())==0) { /* Assign the same value to each axis. */ - swizzleClosure = (unsigned int) closure; + swizzleClosure = GET_INT_FROM_POINTER(closure); while (swizzleClosure & SWIZZLE_VALID_AXIS) { axisA = swizzleClosure & SWIZZLE_AXIS; @@ -1424,342 +1424,342 @@ static PyGetSetDef Vector_getseters[] = { NULL}, /* autogenerated swizzle attrs, see python script below */ - {"xx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 36 */ - {"xxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 292 */ - {"xxxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2340 */ - {"xxxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2852 */ - {"xxxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3364 */ - {"xxxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3876 */ - {"xxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 356 */ - {"xxyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2404 */ - {"xxyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2916 */ - {"xxyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3428 */ - {"xxyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3940 */ - {"xxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 420 */ - {"xxzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2468 */ - {"xxzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2980 */ - {"xxzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3492 */ - {"xxzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4004 */ - {"xxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 484 */ - {"xxwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2532 */ - {"xxwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3044 */ - {"xxwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3556 */ - {"xxww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4068 */ - {"xy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 44 */ - {"xyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 300 */ - {"xyxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2348 */ - {"xyxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2860 */ - {"xyxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3372 */ - {"xyxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3884 */ - {"xyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 364 */ - {"xyyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2412 */ - {"xyyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2924 */ - {"xyyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3436 */ - {"xyyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3948 */ - {"xyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 428 */ - {"xyzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2476 */ - {"xyzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2988 */ - {"xyzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3500 */ - {"xyzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4012 */ - {"xyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 492 */ - {"xywx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2540 */ - {"xywy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3052 */ - {"xywz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3564 */ - {"xyww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4076 */ - {"xz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 52 */ - {"xzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 308 */ - {"xzxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2356 */ - {"xzxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2868 */ - {"xzxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3380 */ - {"xzxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3892 */ - {"xzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 372 */ - {"xzyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2420 */ - {"xzyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2932 */ - {"xzyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3444 */ - {"xzyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3956 */ - {"xzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 436 */ - {"xzzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2484 */ - {"xzzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2996 */ - {"xzzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3508 */ - {"xzzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4020 */ - {"xzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 500 */ - {"xzwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2548 */ - {"xzwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3060 */ - {"xzwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3572 */ - {"xzww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4084 */ - {"xw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 60 */ - {"xwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 316 */ - {"xwxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2364 */ - {"xwxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2876 */ - {"xwxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3388 */ - {"xwxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3900 */ - {"xwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 380 */ - {"xwyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2428 */ - {"xwyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2940 */ - {"xwyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3452 */ - {"xwyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3964 */ - {"xwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 444 */ - {"xwzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2492 */ - {"xwzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3004 */ - {"xwzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3516 */ - {"xwzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4028 */ - {"xww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 508 */ - {"xwwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2556 */ - {"xwwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3068 */ - {"xwwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3580 */ - {"xwww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4092 */ - {"yx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 37 */ - {"yxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 293 */ - {"yxxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2341 */ - {"yxxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2853 */ - {"yxxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3365 */ - {"yxxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3877 */ - {"yxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 357 */ - {"yxyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2405 */ - {"yxyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2917 */ - {"yxyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3429 */ - {"yxyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3941 */ - {"yxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 421 */ - {"yxzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2469 */ - {"yxzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2981 */ - {"yxzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3493 */ - {"yxzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4005 */ - {"yxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 485 */ - {"yxwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2533 */ - {"yxwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3045 */ - {"yxwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3557 */ - {"yxww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4069 */ - {"yy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 45 */ - {"yyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 301 */ - {"yyxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2349 */ - {"yyxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2861 */ - {"yyxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3373 */ - {"yyxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3885 */ - {"yyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 365 */ - {"yyyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2413 */ - {"yyyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2925 */ - {"yyyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3437 */ - {"yyyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3949 */ - {"yyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 429 */ - {"yyzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2477 */ - {"yyzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2989 */ - {"yyzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3501 */ - {"yyzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4013 */ - {"yyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 493 */ - {"yywx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2541 */ - {"yywy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3053 */ - {"yywz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3565 */ - {"yyww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4077 */ - {"yz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 53 */ - {"yzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 309 */ - {"yzxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2357 */ - {"yzxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2869 */ - {"yzxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3381 */ - {"yzxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3893 */ - {"yzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 373 */ - {"yzyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2421 */ - {"yzyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2933 */ - {"yzyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3445 */ - {"yzyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3957 */ - {"yzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 437 */ - {"yzzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2485 */ - {"yzzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2997 */ - {"yzzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3509 */ - {"yzzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4021 */ - {"yzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 501 */ - {"yzwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2549 */ - {"yzwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3061 */ - {"yzwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3573 */ - {"yzww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4085 */ - {"yw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 61 */ - {"ywx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 317 */ - {"ywxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2365 */ - {"ywxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2877 */ - {"ywxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3389 */ - {"ywxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3901 */ - {"ywy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 381 */ - {"ywyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2429 */ - {"ywyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2941 */ - {"ywyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3453 */ - {"ywyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3965 */ - {"ywz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 445 */ - {"ywzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2493 */ - {"ywzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3005 */ - {"ywzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3517 */ - {"ywzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4029 */ - {"yww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 509 */ - {"ywwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2557 */ - {"ywwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3069 */ - {"ywwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3581 */ - {"ywww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4093 */ - {"zx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 38 */ - {"zxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 294 */ - {"zxxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2342 */ - {"zxxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2854 */ - {"zxxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3366 */ - {"zxxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3878 */ - {"zxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 358 */ - {"zxyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2406 */ - {"zxyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2918 */ - {"zxyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3430 */ - {"zxyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3942 */ - {"zxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 422 */ - {"zxzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2470 */ - {"zxzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2982 */ - {"zxzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3494 */ - {"zxzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4006 */ - {"zxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 486 */ - {"zxwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2534 */ - {"zxwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3046 */ - {"zxwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3558 */ - {"zxww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4070 */ - {"zy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 46 */ - {"zyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 302 */ - {"zyxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2350 */ - {"zyxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2862 */ - {"zyxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3374 */ - {"zyxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3886 */ - {"zyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 366 */ - {"zyyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2414 */ - {"zyyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2926 */ - {"zyyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3438 */ - {"zyyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3950 */ - {"zyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 430 */ - {"zyzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2478 */ - {"zyzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2990 */ - {"zyzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3502 */ - {"zyzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4014 */ - {"zyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 494 */ - {"zywx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2542 */ - {"zywy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3054 */ - {"zywz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3566 */ - {"zyww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4078 */ - {"zz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 54 */ - {"zzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 310 */ - {"zzxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2358 */ - {"zzxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2870 */ - {"zzxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3382 */ - {"zzxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3894 */ - {"zzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 374 */ - {"zzyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2422 */ - {"zzyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2934 */ - {"zzyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3446 */ - {"zzyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3958 */ - {"zzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 438 */ - {"zzzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2486 */ - {"zzzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2998 */ - {"zzzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3510 */ - {"zzzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4022 */ - {"zzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 502 */ - {"zzwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2550 */ - {"zzwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3062 */ - {"zzwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3574 */ - {"zzww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4086 */ - {"zw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 62 */ - {"zwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 318 */ - {"zwxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2366 */ - {"zwxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2878 */ - {"zwxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3390 */ - {"zwxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3902 */ - {"zwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 382 */ - {"zwyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2430 */ - {"zwyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2942 */ - {"zwyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3454 */ - {"zwyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3966 */ - {"zwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 446 */ - {"zwzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2494 */ - {"zwzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3006 */ - {"zwzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3518 */ - {"zwzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4030 */ - {"zww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 510 */ - {"zwwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2558 */ - {"zwwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3070 */ - {"zwwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3582 */ - {"zwww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4094 */ - {"wx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 39 */ - {"wxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 295 */ - {"wxxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2343 */ - {"wxxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2855 */ - {"wxxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3367 */ - {"wxxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3879 */ - {"wxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 359 */ - {"wxyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2407 */ - {"wxyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2919 */ - {"wxyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3431 */ - {"wxyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3943 */ - {"wxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 423 */ - {"wxzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2471 */ - {"wxzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2983 */ - {"wxzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3495 */ - {"wxzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4007 */ - {"wxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 487 */ - {"wxwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2535 */ - {"wxwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3047 */ - {"wxwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3559 */ - {"wxww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4071 */ - {"wy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 47 */ - {"wyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 303 */ - {"wyxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2351 */ - {"wyxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2863 */ - {"wyxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3375 */ - {"wyxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3887 */ - {"wyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 367 */ - {"wyyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2415 */ - {"wyyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2927 */ - {"wyyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3439 */ - {"wyyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3951 */ - {"wyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 431 */ - {"wyzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2479 */ - {"wyzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2991 */ - {"wyzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3503 */ - {"wyzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4015 */ - {"wyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 495 */ - {"wywx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2543 */ - {"wywy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3055 */ - {"wywz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3567 */ - {"wyww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4079 */ - {"wz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 55 */ - {"wzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 311 */ - {"wzxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2359 */ - {"wzxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2871 */ - {"wzxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3383 */ - {"wzxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3895 */ - {"wzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 375 */ - {"wzyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2423 */ - {"wzyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2935 */ - {"wzyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3447 */ - {"wzyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3959 */ - {"wzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 439 */ - {"wzzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2487 */ - {"wzzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2999 */ - {"wzzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3511 */ - {"wzzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4023 */ - {"wzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 503 */ - {"wzwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2551 */ - {"wzwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3063 */ - {"wzwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3575 */ - {"wzww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4087 */ - {"ww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 63 */ - {"wwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 319 */ - {"wwxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2367 */ - {"wwxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2879 */ - {"wwxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3391 */ - {"wwxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3903 */ - {"wwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 383 */ - {"wwyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2431 */ - {"wwyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2943 */ - {"wwyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3455 */ - {"wwyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3967 */ - {"wwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 447 */ - {"wwzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2495 */ - {"wwzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3007 */ - {"wwzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3519 */ - {"wwzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4031 */ - {"www", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 511 */ - {"wwwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2559 */ - {"wwwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3071 */ - {"wwwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3583 */ - {"wwww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4095 */ + {"xx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 36 */ + {"xxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 292 */ + {"xxxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2340 */ + {"xxxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2852 */ + {"xxxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3364 */ + {"xxxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3876 */ + {"xxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 356 */ + {"xxyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2404 */ + {"xxyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2916 */ + {"xxyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3428 */ + {"xxyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3940 */ + {"xxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 420 */ + {"xxzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2468 */ + {"xxzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2980 */ + {"xxzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3492 */ + {"xxzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4004 */ + {"xxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 484 */ + {"xxwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2532 */ + {"xxwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3044 */ + {"xxwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3556 */ + {"xxww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4068 */ + {"xy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 44 */ + {"xyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 300 */ + {"xyxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2348 */ + {"xyxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2860 */ + {"xyxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3372 */ + {"xyxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3884 */ + {"xyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 364 */ + {"xyyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2412 */ + {"xyyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2924 */ + {"xyyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3436 */ + {"xyyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3948 */ + {"xyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 428 */ + {"xyzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2476 */ + {"xyzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2988 */ + {"xyzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3500 */ + {"xyzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4012 */ + {"xyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 492 */ + {"xywx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2540 */ + {"xywy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3052 */ + {"xywz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3564 */ + {"xyww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4076 */ + {"xz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 52 */ + {"xzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 308 */ + {"xzxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2356 */ + {"xzxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2868 */ + {"xzxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3380 */ + {"xzxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3892 */ + {"xzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 372 */ + {"xzyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2420 */ + {"xzyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2932 */ + {"xzyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3444 */ + {"xzyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3956 */ + {"xzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 436 */ + {"xzzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2484 */ + {"xzzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2996 */ + {"xzzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3508 */ + {"xzzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4020 */ + {"xzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 500 */ + {"xzwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2548 */ + {"xzwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3060 */ + {"xzwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3572 */ + {"xzww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4084 */ + {"xw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 60 */ + {"xwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 316 */ + {"xwxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2364 */ + {"xwxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2876 */ + {"xwxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3388 */ + {"xwxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3900 */ + {"xwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 380 */ + {"xwyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2428 */ + {"xwyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2940 */ + {"xwyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3452 */ + {"xwyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3964 */ + {"xwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 444 */ + {"xwzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2492 */ + {"xwzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3004 */ + {"xwzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3516 */ + {"xwzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4028 */ + {"xww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 508 */ + {"xwwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2556 */ + {"xwwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3068 */ + {"xwwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3580 */ + {"xwww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4092 */ + {"yx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 37 */ + {"yxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 293 */ + {"yxxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2341 */ + {"yxxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2853 */ + {"yxxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3365 */ + {"yxxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3877 */ + {"yxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 357 */ + {"yxyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2405 */ + {"yxyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2917 */ + {"yxyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3429 */ + {"yxyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3941 */ + {"yxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 421 */ + {"yxzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2469 */ + {"yxzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2981 */ + {"yxzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3493 */ + {"yxzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4005 */ + {"yxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 485 */ + {"yxwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2533 */ + {"yxwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3045 */ + {"yxwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3557 */ + {"yxww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4069 */ + {"yy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 45 */ + {"yyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 301 */ + {"yyxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2349 */ + {"yyxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2861 */ + {"yyxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3373 */ + {"yyxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3885 */ + {"yyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 365 */ + {"yyyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2413 */ + {"yyyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2925 */ + {"yyyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3437 */ + {"yyyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3949 */ + {"yyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 429 */ + {"yyzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2477 */ + {"yyzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2989 */ + {"yyzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3501 */ + {"yyzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4013 */ + {"yyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 493 */ + {"yywx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2541 */ + {"yywy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3053 */ + {"yywz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3565 */ + {"yyww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4077 */ + {"yz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 53 */ + {"yzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 309 */ + {"yzxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2357 */ + {"yzxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2869 */ + {"yzxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3381 */ + {"yzxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3893 */ + {"yzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 373 */ + {"yzyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2421 */ + {"yzyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2933 */ + {"yzyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3445 */ + {"yzyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3957 */ + {"yzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 437 */ + {"yzzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2485 */ + {"yzzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2997 */ + {"yzzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3509 */ + {"yzzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4021 */ + {"yzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 501 */ + {"yzwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2549 */ + {"yzwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3061 */ + {"yzwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3573 */ + {"yzww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4085 */ + {"yw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 61 */ + {"ywx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 317 */ + {"ywxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2365 */ + {"ywxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2877 */ + {"ywxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3389 */ + {"ywxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3901 */ + {"ywy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 381 */ + {"ywyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2429 */ + {"ywyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2941 */ + {"ywyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3453 */ + {"ywyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3965 */ + {"ywz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 445 */ + {"ywzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2493 */ + {"ywzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3005 */ + {"ywzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3517 */ + {"ywzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4029 */ + {"yww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 509 */ + {"ywwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2557 */ + {"ywwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3069 */ + {"ywwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3581 */ + {"ywww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4093 */ + {"zx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 38 */ + {"zxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 294 */ + {"zxxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2342 */ + {"zxxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2854 */ + {"zxxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3366 */ + {"zxxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3878 */ + {"zxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 358 */ + {"zxyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2406 */ + {"zxyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2918 */ + {"zxyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3430 */ + {"zxyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3942 */ + {"zxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 422 */ + {"zxzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2470 */ + {"zxzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2982 */ + {"zxzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3494 */ + {"zxzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4006 */ + {"zxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 486 */ + {"zxwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2534 */ + {"zxwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3046 */ + {"zxwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3558 */ + {"zxww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4070 */ + {"zy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 46 */ + {"zyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 302 */ + {"zyxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2350 */ + {"zyxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2862 */ + {"zyxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3374 */ + {"zyxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3886 */ + {"zyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 366 */ + {"zyyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2414 */ + {"zyyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2926 */ + {"zyyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3438 */ + {"zyyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3950 */ + {"zyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 430 */ + {"zyzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2478 */ + {"zyzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2990 */ + {"zyzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3502 */ + {"zyzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4014 */ + {"zyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 494 */ + {"zywx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2542 */ + {"zywy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3054 */ + {"zywz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3566 */ + {"zyww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4078 */ + {"zz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 54 */ + {"zzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 310 */ + {"zzxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2358 */ + {"zzxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2870 */ + {"zzxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3382 */ + {"zzxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3894 */ + {"zzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 374 */ + {"zzyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2422 */ + {"zzyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2934 */ + {"zzyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3446 */ + {"zzyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3958 */ + {"zzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 438 */ + {"zzzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2486 */ + {"zzzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2998 */ + {"zzzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3510 */ + {"zzzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4022 */ + {"zzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 502 */ + {"zzwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2550 */ + {"zzwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3062 */ + {"zzwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3574 */ + {"zzww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4086 */ + {"zw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 62 */ + {"zwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 318 */ + {"zwxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2366 */ + {"zwxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2878 */ + {"zwxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3390 */ + {"zwxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3902 */ + {"zwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 382 */ + {"zwyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2430 */ + {"zwyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2942 */ + {"zwyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3454 */ + {"zwyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3966 */ + {"zwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 446 */ + {"zwzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2494 */ + {"zwzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3006 */ + {"zwzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3518 */ + {"zwzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4030 */ + {"zww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 510 */ + {"zwwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2558 */ + {"zwwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3070 */ + {"zwwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3582 */ + {"zwww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4094 */ + {"wx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 39 */ + {"wxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 295 */ + {"wxxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2343 */ + {"wxxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2855 */ + {"wxxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3367 */ + {"wxxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3879 */ + {"wxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 359 */ + {"wxyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2407 */ + {"wxyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2919 */ + {"wxyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3431 */ + {"wxyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3943 */ + {"wxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 423 */ + {"wxzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2471 */ + {"wxzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2983 */ + {"wxzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3495 */ + {"wxzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4007 */ + {"wxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 487 */ + {"wxwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2535 */ + {"wxwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3047 */ + {"wxwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3559 */ + {"wxww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4071 */ + {"wy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 47 */ + {"wyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 303 */ + {"wyxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2351 */ + {"wyxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2863 */ + {"wyxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3375 */ + {"wyxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3887 */ + {"wyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 367 */ + {"wyyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2415 */ + {"wyyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2927 */ + {"wyyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3439 */ + {"wyyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3951 */ + {"wyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 431 */ + {"wyzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2479 */ + {"wyzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2991 */ + {"wyzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3503 */ + {"wyzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4015 */ + {"wyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 495 */ + {"wywx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2543 */ + {"wywy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3055 */ + {"wywz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3567 */ + {"wyww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4079 */ + {"wz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 55 */ + {"wzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 311 */ + {"wzxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2359 */ + {"wzxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2871 */ + {"wzxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3383 */ + {"wzxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3895 */ + {"wzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 375 */ + {"wzyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2423 */ + {"wzyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2935 */ + {"wzyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3447 */ + {"wzyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3959 */ + {"wzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 439 */ + {"wzzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2487 */ + {"wzzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2999 */ + {"wzzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3511 */ + {"wzzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4023 */ + {"wzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 503 */ + {"wzwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2551 */ + {"wzwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3063 */ + {"wzwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3575 */ + {"wzww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4087 */ + {"ww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 63 */ + {"wwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 319 */ + {"wwxx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2367 */ + {"wwxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2879 */ + {"wwxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3391 */ + {"wwxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3903 */ + {"wwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 383 */ + {"wwyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2431 */ + {"wwyy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2943 */ + {"wwyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3455 */ + {"wwyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3967 */ + {"wwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 447 */ + {"wwzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2495 */ + {"wwzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3007 */ + {"wwzz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3519 */ + {"wwzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4031 */ + {"www", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, /* 511 */ + {"wwwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 2559 */ + {"wwwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3071 */ + {"wwwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 3583 */ + {"wwww", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, /* 4095 */ {NULL,NULL,NULL,NULL,NULL} /* Sentinel */ }; @@ -1796,7 +1796,7 @@ items.sort(key = lambda a: a[0].replace('x', '0').replace('y', '1').replace('z', unique = set() for key, val in items: num = eval(val) - print '\t{"%s", %s(getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, (void *)((unsigned int)%s)}, // %s' % (key, (' '*(4-len(key))), axis_dict[key], num) + print '\t{"%s", %s(getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(%s)}, // %s' % (key, (' '*(4-len(key))), axis_dict[key], num) unique.add(num) if len(unique) != len(items): diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index f8b2f38961d..69b733d3fda 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -154,9 +154,15 @@ static void bpy_init_modules( void ) void BPY_update_modules( void ) { +#if 0 // slow, this runs all the time poll, draw etc 100's of time a sec. PyObject *mod= PyImport_ImportModuleLevel("bpy", NULL, NULL, NULL, 0); PyModule_AddObject( mod, "data", BPY_rna_module() ); - PyModule_AddObject( mod, "types", BPY_rna_types() ); + PyModule_AddObject( mod, "types", BPY_rna_types() ); // atm this does not need updating +#endif + + /* refreshes the main struct */ + BPY_update_rna_module(); + } /***************************************************************************** @@ -264,16 +270,22 @@ void BPY_start_python( int argc, char **argv ) PyDict_SetItemString(d, "__import__", item=PyCFunction_New(bpy_import_meth, NULL)); Py_DECREF(item); } + pyrna_alloc_types(); + py_tstate = PyGILState_GetThisThreadState(); PyEval_ReleaseThread(py_tstate); } void BPY_end_python( void ) { + // fprintf(stderr, "Ending Python!\n"); + PyGILState_Ensure(); /* finalizing, no need to grab the state */ // free other python data. - //BPY_rna_free_types(); + pyrna_free_types(); + + /* clear all python data from structs */ Py_Finalize( ); @@ -292,6 +304,8 @@ void BPY_end_python( void ) printf("\n"); + // fprintf(stderr, "Ending Python Done!\n"); + #endif } @@ -808,44 +822,35 @@ float BPY_pydriver_eval (ChannelDriver *driver) int BPY_button_eval(bContext *C, char *expr, double *value) { PyGILState_STATE gilstate; - PyObject *dict, *retval, *expr_conv= NULL; + PyObject *dict, *retval; int error_ret = 0; if (!value || !expr || expr[0]=='\0') return -1; bpy_context_set(C, &gilstate); - // experemental, fun. "button_convert.convert" is currently defined in bpy_ops.py - { - PyObject *mod= PyDict_GetItemString(PySys_GetObject("modules"), "button_convert"); - if(mod && PyModule_Check(mod)) { - PyObject *mod_dict= PyModule_GetDict(mod); - PyObject *func= PyDict_GetItemString(mod_dict, "convert"); - if(func) { - PyObject *expr_conv = PyObject_CallFunction(func, "s", expr); - if(expr_conv==NULL) { - PyErr_Print(); - PyErr_Clear(); - } - else { - expr= _PyUnicode_AsString(expr_conv); /* TODO, check */ - } - } - } - } - dict= CreateGlobalDictionary(C); retval = PyRun_String(expr, Py_eval_input, dict, dict); - if(expr_conv) { - Py_DECREF(expr_conv); /* invalidates expr */ - } - if (retval == NULL) { error_ret= -1; } else { - double val = PyFloat_AsDouble(retval); + double val; + + if(PyTuple_Check(retval)) { + /* Users my have typed in 10km, 2m + * add up all values */ + int i; + val= 0.0; + + for(i=0; i<PyTuple_GET_SIZE(retval); i++) { + val+= PyFloat_AsDouble(PyTuple_GET_ITEM(retval, i)); + } + } + else { + val = PyFloat_AsDouble(retval); + } Py_DECREF(retval); if(val==-1 && PyErr_Occurred()) { diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 0edd5e8dbff..114727eeef5 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -132,6 +132,8 @@ Mathutils_Callback mathutils_rna_matrix_cb = { #endif +static StructRNA *pyrna_struct_as_srna(PyObject *self); + static int pyrna_struct_compare( BPy_StructRNA * a, BPy_StructRNA * b ) { return (a->ptr.data==b->ptr.data) ? 0 : -1; @@ -2263,7 +2265,7 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna) PyObject *item; Py_INCREF(newclass); - + if (RNA_struct_py_type_get(srna)) PyObSpit("RNA WAS SET - ", RNA_struct_py_type_get(srna)); @@ -2273,18 +2275,44 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna) /* Not 100% needed but useful, * having an instance within a type looks wrong however this instance IS an rna type */ + + /* python deals with the curcular ref */ RNA_pointer_create(NULL, &RNA_Struct, srna, &ptr); item = pyrna_struct_CreatePyObject(&ptr); + + //item = PyCObject_FromVoidPtr(srna, NULL); PyDict_SetItemString(((PyTypeObject *)newclass)->tp_dict, "__rna__", item); Py_DECREF(item); /* done with rna instance */ } +/* +static StructRNA *srna_from_self(PyObject *self); +PyObject *BPy_GetStructRNA(PyObject *self) +{ + StructRNA *srna= pyrna_struct_as_srna(self); + PointerRNA ptr; + PyObject *ret; + + RNA_pointer_create(NULL, &RNA_Struct, srna, &ptr); + ret= pyrna_struct_CreatePyObject(&ptr); + + if(ret) { + return ret; + } + else { + Py_RETURN_NONE; + } +} +*/ + static struct PyMethodDef pyrna_struct_subtype_methods[] = { {"FloatProperty", (PyCFunction)BPy_FloatProperty, METH_VARARGS|METH_KEYWORDS, ""}, {"IntProperty", (PyCFunction)BPy_IntProperty, METH_VARARGS|METH_KEYWORDS, ""}, {"BoolProperty", (PyCFunction)BPy_BoolProperty, METH_VARARGS|METH_KEYWORDS, ""}, {"StringProperty", (PyCFunction)BPy_StringProperty, METH_VARARGS|METH_KEYWORDS, ""}, + +// {"__get_rna", (PyCFunction)BPy_GetStructRNA, METH_NOARGS, ""}, {NULL, NULL, 0, NULL} }; @@ -2319,18 +2347,26 @@ PyObject* pyrna_srna_Subtype(StructRNA *srna) if(base && base != srna) { /*/printf("debug subtype %s %p\n", RNA_struct_identifier(srna), srna); */ py_base= pyrna_srna_Subtype(base); + Py_DECREF(py_base); /* srna owns, this is only to pass as an arg */ } if(py_base==NULL) { py_base= (PyObject *)&pyrna_struct_Type; - Py_INCREF(py_base); } - newclass = PyObject_CallFunction( (PyObject*)&PyType_Type, "s(N){ssss}", idname, py_base, "__module__","bpy.types", "__doc__",descr); + /* always use O not N when calling, N causes refcount errors */ + newclass = PyObject_CallFunction( (PyObject*)&PyType_Type, "s(O){ssss}", idname, py_base, "__module__","bpy.types", "__doc__",descr); + /* newclass will now have 2 ref's, ???, probably 1 is internal since decrefing here segfaults */ + + /* PyObSpit("new class ref", newclass); */ if (newclass) { + + /* srna owns one, and the other is owned by the caller */ pyrna_subtype_set_rna(newclass, srna); - // PyObSpit("NewStructRNA Type: ", (PyObject *)newclass); + + Py_DECREF(newclass); /* let srna own */ + /* attach functions into the class * so you can do... bpy.types.Scene.SomeFunction() @@ -2353,9 +2389,21 @@ PyObject* pyrna_srna_Subtype(StructRNA *srna) return newclass; } +/* use for subtyping so we know which srna is used for a PointerRNA */ +static StructRNA *srna_from_ptr(PointerRNA *ptr) +{ + if(ptr->type == &RNA_Struct) { + return ptr->data; + } + else { + return ptr->type; + } +} + +/* always returns a new ref, be sure to decref when done */ PyObject* pyrna_struct_Subtype(PointerRNA *ptr) { - return pyrna_srna_Subtype((ptr->type == &RNA_Struct) ? ptr->data : ptr->type); + return pyrna_srna_Subtype(srna_from_ptr(ptr)); } /*-----------------------CreatePyObject---------------------------------*/ @@ -2371,6 +2419,7 @@ PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr ) if (tp) { pyrna = (BPy_StructRNA *) tp->tp_alloc(tp, 0); + Py_DECREF(tp); /* srna owns, cant hold a ref */ } else { fprintf(stderr, "Could not make type\n"); @@ -2408,8 +2457,11 @@ PyObject *pyrna_prop_CreatePyObject( PointerRNA *ptr, PropertyRNA *prop ) return ( PyObject * ) pyrna; } +/* bpy.data from python */ +static PointerRNA *rna_module_ptr= NULL; PyObject *BPY_rna_module( void ) { + BPy_StructRNA *pyrna; PointerRNA ptr; #ifdef USE_MATHUTILS // register mathutils callbacks, ok to run more then once. @@ -2429,8 +2481,15 @@ PyObject *BPY_rna_module( void ) /* for now, return the base RNA type rather then a real module */ RNA_main_pointer_create(G.main, &ptr); + pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr); - return pyrna_struct_CreatePyObject(&ptr); + rna_module_ptr= &pyrna->ptr; + return (PyObject *)pyrna; +} + +void BPY_update_rna_module(void) +{ + RNA_main_pointer_create(G.main, rna_module_ptr); } #if 0 @@ -2476,8 +2535,8 @@ static PyObject *pyrna_basetype_getattro( BPy_BaseTypeRNA * self, PyObject *pyna static PyObject *pyrna_basetype_dir(BPy_BaseTypeRNA *self); static struct PyMethodDef pyrna_basetype_methods[] = { {"__dir__", (PyCFunction)pyrna_basetype_dir, METH_NOARGS, ""}, - {"register", (PyCFunction)pyrna_basetype_register, METH_VARARGS, ""}, - {"unregister", (PyCFunction)pyrna_basetype_unregister, METH_VARARGS, ""}, + {"register", (PyCFunction)pyrna_basetype_register, METH_O, ""}, + {"unregister", (PyCFunction)pyrna_basetype_unregister, METH_O, ""}, {NULL, NULL, 0, NULL} }; @@ -2553,13 +2612,40 @@ PyObject *BPY_rna_props( void ) return submodule; } +static StructRNA *pyrna_struct_as_srna(PyObject *self) +{ + BPy_StructRNA *py_srna= (BPy_StructRNA*)PyObject_GetAttrString(self, "__rna__"); + StructRNA *srna; + + if(py_srna==NULL) { + PyErr_SetString(PyExc_SystemError, "internal error, self had no __rna__ attribute, should never happen."); + return NULL; + } + + if(!BPy_StructRNA_Check(py_srna)) { + PyErr_Format(PyExc_SystemError, "internal error, __rna__ was of type %.200s, instead of %.200s instance.", Py_TYPE(py_srna)->tp_name, pyrna_struct_Type.tp_name); + Py_DECREF(py_srna); + return NULL; + } + + if(py_srna->ptr.type != &RNA_Struct) { + PyErr_SetString(PyExc_SystemError, "internal error, __rna__ was not a RNA_Struct type of rna struct."); + Py_DECREF(py_srna); + return NULL; + } + + srna= py_srna->ptr.data; + Py_DECREF(py_srna); + + return srna; +} + + /* Orphan functions, not sure where they should go */ /* get the srna for methods attached to types */ /* */ static StructRNA *srna_from_self(PyObject *self) { - BPy_StructRNA *py_srna; - /* a bit sloppy but would cause a very confusing bug if * an error happened to be set here */ PyErr_Clear(); @@ -2576,30 +2662,7 @@ static StructRNA *srna_from_self(PyObject *self) /* These cases above not errors, they just mean the type was not compatible * After this any errors will be raised in the script */ - - py_srna= (BPy_StructRNA *)PyObject_GetAttrString(self, "__rna__"); - - if(py_srna==NULL) { - PyErr_SetString(PyExc_SystemError, "internal error, self had no __rna__ attribute, should never happen."); - return NULL; - } - - if(!BPy_StructRNA_Check(py_srna)) { - PyErr_SetString(PyExc_SystemError, "internal error, self's __rna__ attribute isnt a StructRNA type, should never happen."); - return NULL; - } - - if((py_srna->ptr.data && py_srna->ptr.type == &RNA_Struct) == 0) { - PyErr_SetString(PyExc_SystemError, "internal error, self's __rna__ attribute wasnt an RNA_Struct, should never happen."); - return NULL; - } - - if(!RNA_struct_is_ID(py_srna->ptr.data)) { - PyErr_SetString(PyExc_TypeError, "only ID types support python defined properties"); - return NULL; - } - - return py_srna->ptr.data; + return pyrna_struct_as_srna(self); } /* operators use this so it can store the args given but defer running @@ -2969,50 +3032,94 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par static void bpy_class_free(void *pyob_ptr) { + PyObject *self= (PyObject *)pyob_ptr; + PyGILState_STATE gilstate; + + gilstate = PyGILState_Ensure(); + + PyDict_Clear(((PyTypeObject*)self)->tp_dict); + if(G.f&G_DEBUG) { - if(((PyObject *)pyob_ptr)->ob_refcnt > 1) - PyObSpit("zombie class - ref should be 1", (PyObject *)pyob_ptr); + if(self->ob_refcnt > 1) { + PyObSpit("zombie class - ref should be 1", self); + } } + Py_DECREF((PyObject *)pyob_ptr); + + PyGILState_Release(gilstate); } -PyObject *pyrna_basetype_register(PyObject *self, PyObject *args) +void pyrna_alloc_types(void) { - bContext *C= NULL; - PyObject *py_class, *item; - ReportList reports; - StructRegisterFunc reg; - BPy_StructRNA *py_srna; - StructRNA *srna; + PyGILState_STATE gilstate; - if(!PyArg_ParseTuple(args, "O:register", &py_class)) - return NULL; + PointerRNA ptr; + PropertyRNA *prop; - if(!PyType_Check(py_class)) { - PyErr_SetString(PyExc_AttributeError, "expected a Type subclassed from a registerable rna type (no a Type object)."); - return NULL; + gilstate = PyGILState_Ensure(); + + /* avoid doing this lookup for every getattr */ + RNA_blender_rna_pointer_create(&ptr); + prop = RNA_struct_find_property(&ptr, "structs"); + + RNA_PROP_BEGIN(&ptr, itemptr, prop) { + Py_DECREF(pyrna_struct_Subtype(&itemptr)); } + RNA_PROP_END; - /* check we got an __rna__ attribute */ - item= PyObject_GetAttrString(py_class, "__rna__"); + PyGILState_Release(gilstate); +} - if(!item || !BPy_StructRNA_Check(item)) { - Py_XDECREF(item); - PyErr_SetString(PyExc_AttributeError, "expected a Type subclassed from a registerable rna type (no __rna__ property)."); - return NULL; + +void pyrna_free_types(void) +{ + PointerRNA ptr; + PropertyRNA *prop; + + /* avoid doing this lookup for every getattr */ + RNA_blender_rna_pointer_create(&ptr); + prop = RNA_struct_find_property(&ptr, "structs"); + + + RNA_PROP_BEGIN(&ptr, itemptr, prop) { + StructRNA *srna= srna_from_ptr(&itemptr); + void *py_ptr= RNA_struct_py_type_get(srna); + + if(py_ptr) { +#if 0 // XXX - should be able to do this but makes python crash on exit + bpy_class_free(py_ptr); +#endif + RNA_struct_py_type_set(srna, NULL); + } } + RNA_PROP_END; +} - /* check the __rna__ attribute has the right type */ - Py_DECREF(item); - py_srna= (BPy_StructRNA*)item; +/* Note! MemLeak XXX + * + * There is currently a bug where moving registering a python class does + * not properly manage refcounts from the python class, since the srna owns + * the python class this should not be so tricky but changing the references as + * youd expect when changing ownership crashes blender on exit so I had to comment out + * the decref. This is not so bad because the leak only happens when re-registering (hold F8) + * - Should still be fixed - Campbell + * */ - if(py_srna->ptr.type != &RNA_Struct) { - PyErr_SetString(PyExc_AttributeError, "expected a Type subclassed from a registerable rna type (not a Struct)."); +PyObject *pyrna_basetype_register(PyObject *self, PyObject *py_class) +{ + bContext *C= NULL; + ReportList reports; + StructRegisterFunc reg; + StructRNA *srna; + StructRNA *srna_new; + + srna= pyrna_struct_as_srna(py_class); + if(srna==NULL) return NULL; - } /* check that we have a register callback for this type */ - reg= RNA_struct_register(py_srna->ptr.data); + reg= RNA_struct_register(srna); if(!reg) { PyErr_SetString(PyExc_AttributeError, "expected a Type subclassed from a registerable rna type (no register supported)."); @@ -3024,9 +3131,9 @@ PyObject *pyrna_basetype_register(PyObject *self, PyObject *args) /* call the register callback */ BKE_reports_init(&reports, RPT_STORE); - srna= reg(C, &reports, py_class, bpy_class_validate, bpy_class_call, bpy_class_free); + srna_new= reg(C, &reports, py_class, bpy_class_validate, bpy_class_call, bpy_class_free); - if(!srna) { + if(!srna_new) { BPy_reports_to_error(&reports); BKE_reports_clear(&reports); return NULL; @@ -3034,44 +3141,29 @@ PyObject *pyrna_basetype_register(PyObject *self, PyObject *args) BKE_reports_clear(&reports); - pyrna_subtype_set_rna(py_class, srna); /* takes a ref to py_class */ + pyrna_subtype_set_rna(py_class, srna_new); /* takes a ref to py_class */ + + /* old srna still references us, keep the check incase registering somehow can free it */ + if(RNA_struct_py_type_get(srna)) { + RNA_struct_py_type_set(srna, NULL); + // Py_DECREF(py_class); // shuld be able to do this XXX since the old rna adds a new ref. + } Py_RETURN_NONE; } -PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *args) +PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *py_class) { bContext *C= NULL; - PyObject *py_class, *item; - BPy_StructRNA *py_srna; StructUnregisterFunc unreg; + StructRNA *srna; - if(!PyArg_ParseTuple(args, "O:unregister", &py_class)) - return NULL; - - if(!PyType_Check(py_class)) { - PyErr_SetString(PyExc_AttributeError, "expected a Type subclassed from a registerable rna type (no a Type object)."); - return NULL; - } - - /* check we got an __rna__ attribute */ - item= PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "__rna__"); /* borrow ref */ - - if(!item || !BPy_StructRNA_Check(item)) { - PyErr_SetString(PyExc_AttributeError, "expected a Type subclassed from a registerable rna type (no __rna__ property)."); - return NULL; - } - - /* check the __rna__ attribute has the right type */ - py_srna= (BPy_StructRNA*)item; - - if(py_srna->ptr.type != &RNA_Struct) { - PyErr_SetString(PyExc_AttributeError, "expected a Type subclassed from a registerable rna type (not a Struct)."); + srna= pyrna_struct_as_srna(py_class); + if(srna==NULL) return NULL; - } /* check that we have a unregister callback for this type */ - unreg= RNA_struct_unregister(py_srna->ptr.data); + unreg= RNA_struct_unregister(srna); if(!unreg) { PyErr_SetString(PyExc_AttributeError, "expected a Type subclassed from a registerable rna type (no unregister supported)."); @@ -3083,10 +3175,7 @@ PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *args) /* call unregister */ - unreg(C, py_srna->ptr.data); - - /* remove reference to old type */ - Py_DECREF(py_class); + unreg(C, srna); /* calls bpy_class_free, this decref's py_class */ Py_RETURN_NONE; } diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index 9138fd511b0..717ea75a7a8 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -61,6 +61,7 @@ typedef struct { #define BPy_BaseTypeRNA BPy_PropertyRNA PyObject *BPY_rna_module( void ); +void BPY_update_rna_module( void ); /*PyObject *BPY_rna_doc( void );*/ PyObject *BPY_rna_types( void ); PyObject *BPY_rna_props( void ); @@ -83,4 +84,8 @@ PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw); PyObject *pyrna_basetype_register(PyObject *self, PyObject *args); PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *args); +/* called before stopping python */ +void pyrna_alloc_types(void); +void pyrna_free_types(void); + #endif diff --git a/source/blender/python/intern/bpy_ui.c b/source/blender/python/intern/bpy_ui.c index af3588f458c..f03a83bee9c 100644 --- a/source/blender/python/intern/bpy_ui.c +++ b/source/blender/python/intern/bpy_ui.c @@ -57,7 +57,7 @@ static struct PyModuleDef ui_module = { PyObject *BPY_ui_module( void ) { - PyObject *submodule, *mod; + PyObject *submodule; submodule= PyModule_Create(&ui_module); /* INCREF since its its assumed that all these functions return the diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c index 1e73e357526..be343843acc 100644 --- a/source/blender/python/intern/bpy_util.c +++ b/source/blender/python/intern/bpy_util.c @@ -168,7 +168,7 @@ void PyObSpit(char *name, PyObject *var) { } else { PyObject_Print(var, stderr, 0); - fprintf(stderr, " ref:%d ", var->ob_refcnt); + fprintf(stderr, " ref:%d ", (int)var->ob_refcnt); fprintf(stderr, " ptr:%p", (void *)var); fprintf(stderr, " type:"); diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 2df3a0a4f8b..bf02af6ac36 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -266,7 +266,8 @@ typedef struct RenderEngine { ListBase fullresult; } RenderEngine; -void RE_layer_rect_from_file(RenderLayer *layer, struct ReportList *reports, char *filename, int x, int y); +void RE_layer_load_from_file(RenderLayer *layer, struct ReportList *reports, char *filename); +void RE_result_load_from_file(RenderResult *result, struct ReportList *reports, char *filename); struct RenderResult *RE_engine_begin_result(RenderEngine *engine, int x, int y, int w, int h); void RE_engine_update_result(RenderEngine *engine, struct RenderResult *result); diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/extern/include/RE_shader_ext.h index 980ff59b86a..9a340e625f3 100644 --- a/source/blender/render/extern/include/RE_shader_ext.h +++ b/source/blender/render/extern/include/RE_shader_ext.h @@ -56,7 +56,6 @@ typedef struct ShadeResult float refl[3]; float refr[3]; float nor[3]; - float rad[3]; float winspeed[4]; float rayhits[4]; } ShadeResult; @@ -134,7 +133,7 @@ typedef struct ShadeInput float layerfac; /* texture coordinates */ - float lo[3], gl[3], ref[3], orn[3], winco[3], sticky[3], vcol[4], rad[3]; + float lo[3], gl[3], ref[3], orn[3], winco[3], sticky[3], vcol[4]; float refcol[4], displace[3]; float strandco, tang[3], nmaptang[3], stress, winspeed[4]; float duplilo[3], dupliuv[3]; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 2b06f164c12..2c264ce2337 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -895,7 +895,7 @@ static void flag_render_node_material(Render *re, bNodeTree *ntree) if(GS(node->id->name)==ID_MA) { Material *ma= (Material *)node->id; - if(ma->mode & MA_ZTRA) + if((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP)) re->flag |= R_ZTRA; ma->flag |= MA_IS_USED; @@ -917,7 +917,7 @@ static Material *give_render_material(Render *re, Object *ob, int nr) if(re->r.mode & R_SPEED) ma->texco |= NEED_UV; - if(ma->mode & MA_ZTRA) + if((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP)) re->flag |= R_ZTRA; /* for light groups */ @@ -3025,11 +3025,6 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset) } need_nmap_tangent= 1; } - - /* radio faces need autosmooth, to separate shared vertices in corners */ - if(re->r.mode & R_RADIO) - if(ma->mode & MA_RADIO) - do_autosmooth= 1; } } @@ -3799,7 +3794,7 @@ static void set_phong_threshold(ObjectRen *obr) static void set_fullsample_flag(Render *re, ObjectRen *obr) { VlakRen *vlr; - int a, trace; + int a, trace, mode; if(re->osa==0) return; @@ -3808,12 +3803,13 @@ static void set_fullsample_flag(Render *re, ObjectRen *obr) for(a=obr->totvlak-1; a>=0; a--) { vlr= RE_findOrAddVlak(obr, a); + mode= vlr->mat->mode; - if(vlr->mat->mode & MA_FULL_OSA) + if(mode & MA_FULL_OSA) vlr->flag |= R_FULL_OSA; else if(trace) { - if(vlr->mat->mode & MA_SHLESS); - else if(vlr->mat->mode & (MA_RAYTRANSP|MA_RAYMIRROR)) + if(mode & MA_SHLESS); + else if((mode & MA_RAYMIRROR) || ((mode & MA_TRANSP) && (mode & MA_RAYTRANSP))) /* for blurry reflect/refract, better to take more samples * inside the raytrace than as OSA samples */ if ((vlr->mat->gloss_mir == 1.0) && (vlr->mat->gloss_tra == 1.0)) diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 31091ab020a..b417e07577c 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -879,33 +879,26 @@ static void renderresult_add_names(RenderResult *rr) strcpy(rpass->name, get_pass_name(rpass->passtype, -1)); } - -/* only for temp buffer files, makes exact copy of render result */ -static void read_render_result(Render *re, int sample) +/* called for reading temp files, and for external engines */ +static int read_render_result_from_file(char *filename, RenderResult *rr) { RenderLayer *rl; RenderPass *rpass; void *exrhandle= IMB_exr_get_handle(); int rectx, recty; - char str[FILE_MAX]; - - RE_FreeRenderResult(re->result); - re->result= new_render_result(re, &re->disprect, 0, RR_USEMEM); - render_unique_exr_name(re, str, sample); - if(IMB_exr_begin_read(exrhandle, str, &rectx, &recty)==0) { + if(IMB_exr_begin_read(exrhandle, filename, &rectx, &recty)==0) { IMB_exr_close(exrhandle); - printf("cannot read: %s\n", str); - return; + return 0; } - printf("read exr tmp file: %s\n", str); - - if(re->result == NULL || rectx!=re->result->rectx || recty!=re->result->recty) { + if(rr == NULL || rectx!=rr->rectx || recty!=rr->recty) { printf("error in reading render result\n"); + IMB_exr_close(exrhandle); + return 0; } else { - for(rl= re->result->layers.first; rl; rl= rl->next) { + for(rl= rr->layers.first; rl; rl= rl->next) { /* combined */ if(rl->rectf) { @@ -925,10 +918,27 @@ static void read_render_result(Render *re, int sample) } IMB_exr_read_channels(exrhandle); - renderresult_add_names(re->result); + renderresult_add_names(rr); } IMB_exr_close(exrhandle); + + return 1; +} + +/* only for temp buffer files, makes exact copy of render result */ +static void read_render_result(Render *re, int sample) +{ + char str[FILE_MAX]; + + RE_FreeRenderResult(re->result); + re->result= new_render_result(re, &re->disprect, 0, RR_USEMEM); + + render_unique_exr_name(re, str, sample); + printf("read exr tmp file: %s\n", str); + + if(!read_render_result_from_file(str, re->result)) + printf("cannot read: %s\n", str); } /* *************************************************** */ @@ -2571,8 +2581,15 @@ static int render_initialize_from_scene(Render *re, Scene *scene, int anim, int /* check all scenes involved */ tag_scenes_for_render(re); - /* make sure dynamics are up to date */ - update_physics_cache(re, scene, anim_init); + /* + * Disabled completely for now, + * can be later set as render profile option + * and default for background render. + */ + if(0) { + /* make sure dynamics are up to date */ + update_physics_cache(re, scene, anim_init); + } if(scene->r.scemode & R_SINGLE_LAYER) push_render_result(re); @@ -2948,7 +2965,7 @@ void RE_engine_update_stats(RenderEngine *engine, char *stats, char *info) /* loads in image into a result, size must match * x/y offsets are only used on a partial copy when dimensions dont match */ -void RE_layer_rect_from_file(RenderLayer *layer, ReportList *reports, char *filename, int x, int y) +void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, char *filename) { ImBuf *ibuf = IMB_loadiffname(filename, IB_rect); @@ -2959,7 +2976,7 @@ void RE_layer_rect_from_file(RenderLayer *layer, ReportList *reports, char *file memcpy(layer->rectf, ibuf->rect_float, sizeof(float)*4*layer->rectx*layer->recty); } else { - if ((ibuf->x - x >= layer->rectx) && (ibuf->y - y >= layer->recty)) { + if ((ibuf->x >= layer->rectx) && (ibuf->y >= layer->recty)) { ImBuf *ibuf_clip; if(ibuf->rect_float==NULL) @@ -2967,7 +2984,7 @@ void RE_layer_rect_from_file(RenderLayer *layer, ReportList *reports, char *file ibuf_clip = IMB_allocImBuf(layer->rectx, layer->recty, 32, IB_rectfloat, 0); if(ibuf_clip) { - IMB_rectcpy(ibuf_clip, ibuf, 0,0, x,y, layer->rectx, layer->recty); + IMB_rectcpy(ibuf_clip, ibuf, 0,0, 0,0, layer->rectx, layer->recty); memcpy(layer->rectf, ibuf_clip->rect_float, sizeof(float)*4*layer->rectx*layer->recty); IMB_freeImBuf(ibuf_clip); @@ -2987,6 +3004,15 @@ void RE_layer_rect_from_file(RenderLayer *layer, ReportList *reports, char *file BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: failed to load '%s'\n", filename); } } + +void RE_result_load_from_file(RenderResult *result, ReportList *reports, char *filename) +{ + if(!read_render_result_from_file(filename, result)) { + BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: failed to load '%s'\n", filename); + return; + } +} + static void external_render_3d(Render *re, RenderEngineType *type) { RenderEngine engine; diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index 071c70ae504..05c961d49de 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -582,7 +582,7 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr) { float dx, dy, dz, d, p; - if (0 == (shi->mat->mode & (MA_RAYTRANSP|MA_ZTRA))) + if (0 == (shi->mat->mode & MA_TRANSP)) return -1; if (shi->mat->tx_limit <= 0.0f) { @@ -686,7 +686,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo if(depth>0) { - if(shi.mat->mode_l & (MA_RAYTRANSP|MA_ZTRA) && shr.alpha < 1.0f) { + if((shi.mat->mode_l & MA_TRANSP) && shr.alpha < 1.0f) { float nf, f, f1, refract[3], tracol[4]; tracol[0]= shi.r; @@ -694,7 +694,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo tracol[2]= shi.b; tracol[3]= col[3]; // we pass on and accumulate alpha - if(shi.mat->mode & MA_RAYTRANSP) { + if((shi.mat->mode & MA_TRANSP) && (shi.mat->mode & MA_RAYTRANSP)) { /* odd depths: use normal facing viewer, otherwise flip */ if(traflag & RAY_TRAFLIP) { float norm[3]; @@ -1402,7 +1402,7 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr) float diff[3]; int do_tra, do_mir; - do_tra= ((shi->mat->mode & (MA_RAYTRANSP)) && shr->alpha!=1.0f); + do_tra= ((shi->mat->mode & MA_TRANSP) && (shi->mat->mode & MA_RAYTRANSP) && shr->alpha!=1.0f); do_mir= ((shi->mat->mode & MA_RAYMIRROR) && shi->ray_mirror!=0.0f); /* raytrace mirror amd refract like to separate the spec color */ diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 7e9578d179e..94d7651a03c 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -478,7 +478,7 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset, col= shr->refr; break; case SCE_PASS_RADIO: - col= shr->rad; + col= NULL; // removed shr->rad; break; case SCE_PASS_NORMAL: col= shr->nor; @@ -576,7 +576,7 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult col= shr->refr; break; case SCE_PASS_RADIO: - col= shr->rad; + col= NULL; // removed shr->rad; break; case SCE_PASS_NORMAL: col= shr->nor; diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index 030091b80f6..0da2f0b1c9d 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -156,13 +156,13 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr) /* depth >= 1 when ray-shading */ if(shi->depth==0) { if(R.r.mode & R_RAYTRACE) { - if(shi->ray_mirror!=0.0f || ((shi->mat->mode & MA_RAYTRANSP) && shr->alpha!=1.0f)) { + if(shi->ray_mirror!=0.0f || ((shi->mat->mode & MA_TRANSP) && (shi->mat->mode & MA_RAYTRANSP) && shr->alpha!=1.0f)) { /* ray trace works on combined, but gives pass info */ ray_trace(shi, shr); } } /* disable adding of sky for raytransp */ - if(shi->mat->mode & MA_RAYTRANSP) + if((shi->mat->mode & MA_TRANSP) && (shi->mat->mode & MA_RAYTRANSP)) if((shi->layflag & SCE_LAY_SKY) && (R.r.alphamode==R_ADDSKY)) shr->alpha= 1.0f; } @@ -191,7 +191,6 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr) if(shi->passflag & (SCE_PASS_VECTOR|SCE_PASS_NORMAL|SCE_PASS_RADIO)) { QUATCOPY(shr->winspeed, shi->winspeed); VECCOPY(shr->nor, shi->vn); - VECCOPY(shr->rad, shi->rad); } /* MIST */ @@ -569,10 +568,6 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert shi->orn[2]= -shi->vn[2]; } - if(mode & MA_RADIO) { - /* not supported */ - } - if(texco & TEXCO_REFL) { /* mirror reflection color textures (and envmap) */ calc_R_ref(shi); /* wrong location for normal maps! XXXXXXXXXXXXXX */ @@ -591,8 +586,6 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert } } - shi->rad[0]= shi->rad[1]= shi->rad[2]= 0.0f; - /* this only avalailable for scanline renders */ if(shi->depth==0) { if(texco & TEXCO_WINDOW) { @@ -1165,24 +1158,6 @@ void shade_input_set_shade_texco(ShadeInput *shi) shi->orn[2]= -shi->vn[2]; } - if(mode & MA_RADIO) { - float *r1, *r2, *r3; - - r1= RE_vertren_get_rad(obr, v1, 0); - r2= RE_vertren_get_rad(obr, v2, 0); - r3= RE_vertren_get_rad(obr, v3, 0); - - if(r1 && r2 && r3) { - shi->rad[0]= (l*r3[0] - u*r1[0] - v*r2[0]); - shi->rad[1]= (l*r3[1] - u*r1[1] - v*r2[1]); - shi->rad[2]= (l*r3[2] - u*r1[2] - v*r2[2]); - } - else - shi->rad[0]= shi->rad[1]= shi->rad[2]= 0.0f; - } - else - shi->rad[0]= shi->rad[1]= shi->rad[2]= 0.0f; - if(texco & TEXCO_REFL) { /* mirror reflection color textures (and envmap) */ calc_R_ref(shi); /* wrong location for normal maps! XXXXXXXXXXXXXX */ @@ -1210,8 +1185,6 @@ void shade_input_set_shade_texco(ShadeInput *shi) } } } - else - shi->rad[0]= shi->rad[1]= shi->rad[2]= 0.0f; /* this only avalailable for scanline renders */ if(shi->depth==0) { diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 2fbd93df0ce..d5c8cf30b30 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -1713,7 +1713,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) shi->alpha*= fresnel_fac(shi->view, shi->vn, ma->fresnel_tra_i, ma->fresnel_tra); /* note: shi->mode! */ - if(shi->mode & (MA_ZTRA|MA_RAYTRANSP)) { + if(shi->mode & MA_TRANSP) { if(shi->spectra!=0.0f) { float t = MAX3(shr->spec[0], shr->spec[1], shr->spec[2]); t *= shi->spectra; @@ -1730,11 +1730,12 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) shr->combined[1]+= shi->ambg; shr->combined[2]+= shi->ambb; + /* removed if(shi->combinedflag & SCE_PASS_RADIO) { shr->combined[0]+= shi->r*shi->amb*shi->rad[0]; shr->combined[1]+= shi->g*shi->amb*shi->rad[1]; shr->combined[2]+= shi->b*shi->amb*shi->rad[2]; - } + }*/ /* add AO in combined? */ if(R.wrld.mode & WO_AMB_OCC) { diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index a47fef840ca..6e2a0e966dc 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -234,8 +234,8 @@ void interpolate_shade_result(ShadeResult *shr1, ShadeResult *shr2, float t, Sha interpolate_vec3(shr1->refl, shr2->refl, t, negt, shr->refl); if(addpassflag & SCE_PASS_REFRACT) interpolate_vec3(shr1->refr, shr2->refr, t, negt, shr->refr); - if(addpassflag & SCE_PASS_RADIO) - interpolate_vec3(shr1->rad, shr2->rad, t, negt, shr->rad); + /* removed if(addpassflag & SCE_PASS_RADIO) + interpolate_vec3(shr1->rad, shr2->rad, t, negt, shr->rad);*/ if(addpassflag & SCE_PASS_MIST) interpolate_vec1(&shr1->mist, &shr2->mist, t, negt, &shr->mist); } diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 4436f3aa047..53a05dd0d67 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -2152,7 +2152,7 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*, if(obi->lay & lay) { if(vlr->mat!=ma) { ma= vlr->mat; - nofill= ma->mode & (MA_ZTRA|MA_ONLYCAST); + nofill= (ma->mode & MA_ONLYCAST) || ((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP)); env= (ma->mode & MA_ENV); wire= (ma->material_type == MA_TYPE_WIRE); @@ -3306,7 +3306,7 @@ static int zbuffer_abuf(RenderPart *pa, APixstr *APixbuf, ListBase *apsmbase, Re if(vlr->mat!=ma) { ma= vlr->mat; - dofill= (ma->mode & MA_ZTRA) && !(ma->mode & MA_ONLYCAST); + dofill= ((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP)) && !(ma->mode & MA_ONLYCAST); } if(dofill) { @@ -3480,7 +3480,7 @@ void merge_transp_passes(RenderLayer *rl, ShadeResult *shr) col= shr->refl; break; case SCE_PASS_RADIO: - col= shr->rad; + col= NULL; // removed shr->rad; break; case SCE_PASS_REFRACT: col= shr->refr; @@ -3582,7 +3582,7 @@ void add_transp_passes(RenderLayer *rl, int offset, ShadeResult *shr, float alph col= shr->refr; break; case SCE_PASS_RADIO: - col= shr->rad; + col= NULL; // removed shr->rad; break; case SCE_PASS_NORMAL: col= shr->nor; @@ -3817,8 +3817,8 @@ static int addtosamp_shr(ShadeResult *samp_shr, ShadeSample *ssamp, int addpassf if(addpassflag & SCE_PASS_REFRACT) addvecmul(samp_shr->refr, shr->refr, fac); - if(addpassflag & SCE_PASS_RADIO) - addvecmul(samp_shr->rad, shr->rad, fac); + /* removed if(addpassflag & SCE_PASS_RADIO) + addvecmul(samp_shr->rad, shr->rad, fac);*/ if(addpassflag & SCE_PASS_MIST) samp_shr->mist= samp_shr->mist+fac*shr->mist; diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 69ebedbc684..a268ffebffb 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -39,7 +39,7 @@ SET(INC . ../nodes ../gpu ../blenfont - ${SDL_INC} + ${OPENGL_INCLUDE_DIR} ) IF(WITH_INTERNATIONAL) diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index decd855eae0..0f5558382c4 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -172,7 +172,7 @@ void WM_operator_properties_free(struct PointerRNA *ptr); void WM_operator_properties_filesel(struct wmOperatorType *ot, int filter); /* operator as a python command (resultuing string must be free'd) */ -char *WM_operator_pystring(struct wmOperatorType *ot, struct PointerRNA *opptr, int all_args); +char *WM_operator_pystring(struct bContext *C, struct wmOperatorType *ot, struct PointerRNA *opptr, int all_args); void WM_operator_bl_idname(char *to, const char *from); void WM_operator_py_idname(char *to, const char *from); diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index a083d589d31..89927003220 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -144,8 +144,9 @@ typedef struct wmNotifier { /* NC_SCREEN screen */ #define ND_SCREENBROWSE (1<<16) -#define ND_SCREENCAST (2<<16) -#define ND_ANIMPLAY (3<<16) +#define ND_SCREENDELETE (2<<16) +#define ND_SCREENCAST (3<<16) +#define ND_ANIMPLAY (4<<16) /* NC_SCENE Scene */ #define ND_SCENEBROWSE (1<<16) @@ -160,6 +161,7 @@ typedef struct wmNotifier { #define ND_RENDER_RESULT (10<<16) #define ND_COMPO_RESULT (11<<16) #define ND_KEYINGSET (12<<16) +#define ND_SCENEDELETE (13<<16) /* NC_OBJECT Object */ #define ND_TRANSFORM (16<<16) diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 406541d62ba..85f8a647826 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -103,7 +103,7 @@ void wm_operator_register(bContext *C, wmOperator *op) /* Report the string representation of the operator */ - buf = WM_operator_pystring(op->type, op->ptr, 1); + buf = WM_operator_pystring(C, op->type, op->ptr, 1); BKE_report(CTX_wm_reports(C), RPT_OPERATOR, buf); MEM_freeN(buf); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index d40e6c60bfd..737028843d3 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -156,12 +156,20 @@ void wm_event_do_notifiers(bContext *C) ED_screen_set(C, note->reference); // XXX hrms, think this over! printf("screen set %p\n", note->reference); } + else if(note->data==ND_SCREENDELETE) { + ED_screen_delete(C, note->reference); // XXX hrms, think this over! + printf("screen delete %p\n", note->reference); + } } else if(note->category==NC_SCENE) { if(note->data==ND_SCENEBROWSE) { ED_screen_set_scene(C, note->reference); // XXX hrms, think this over! printf("scene set %p\n", note->reference); } + if(note->data==ND_SCENEDELETE) { + ED_screen_delete_scene(C, note->reference); // XXX hrms, think this over! + printf("scene delete %p\n", note->reference); + } else if(note->data==ND_FRAME) do_anim= 1; } @@ -362,7 +370,7 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot, P static void wm_operator_print(wmOperator *op) { - char *buf = WM_operator_pystring(op->type, op->ptr, 1); + char *buf = WM_operator_pystring(NULL, op->type, op->ptr, 1); printf("%s\n", buf); MEM_freeN(buf); } @@ -683,8 +691,15 @@ static int wm_eventmatch(wmEvent *winevent, wmKeymapItem *kmi) if(winevent->alt != kmi->alt && !(winevent->alt & kmi->alt)) return 0; if(kmi->oskey!=KM_ANY) if(winevent->oskey != kmi->oskey && !(winevent->oskey & kmi->oskey)) return 0; + if(kmi->keymodifier) if(winevent->keymodifier!=kmi->keymodifier) return 0; + + /* key modifiers always check when event has it */ + /* otherwise regular keypresses with keymodifier still work */ + if(winevent->keymodifier) + if(ISKEYBOARD(winevent->type)) + if(winevent->keymodifier!=kmi->keymodifier) return 0; return 1; } @@ -1501,11 +1516,6 @@ void wm_event_add_ghostevent(wmWindow *win, int type, void *customdata) else event.type= MIDDLEMOUSE; - if(event.val) - event.keymodifier= evt->keymodifier= event.type; - else - event.keymodifier= evt->keymodifier= 0; - update_tablet_data(win, &event); wm_event_add(win, &event); @@ -1544,6 +1554,12 @@ void wm_event_add_ghostevent(wmWindow *win, int type, void *customdata) if(event.val==KM_PRESS && (evt->ctrl || evt->alt || evt->shift)) event.oskey= evt->oskey = 3; // define? } + else { + if(event.val==KM_PRESS && event.keymodifier==0) + evt->keymodifier= event.type; /* only set in eventstate, for next event */ + else if(event.val==KM_RELEASE && event.keymodifier==event.type) + event.keymodifier= evt->keymodifier= 0; + } /* if test_break set, it catches this. XXX Keep global for now? */ if(event.type==ESCKEY) diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index ffaa315f04e..9c30c99bbdd 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -68,6 +68,7 @@ #include "BKE_main.h" #include "BKE_packedFile.h" #include "BKE_report.h" +#include "BKE_sound.h" #include "BKE_texture.h" #include "BKE_utildefines.h" @@ -224,7 +225,7 @@ static void wm_init_userdef() { UI_init_userdef(); MEM_CacheLimiter_set_maximum(U.memcachelimit * 1024 * 1024); - + sound_init(); } void WM_read_file(bContext *C, char *name, ReportList *reports) @@ -252,7 +253,6 @@ void WM_read_file(bContext *C, char *name, ReportList *reports) wm_check(C); /* opens window(s), checks keymaps */ // XXX mainwindow_set_filename_to_title(G.main->name); -// XXX sound_initialize_sounds(); if(retval==2) wm_init_userdef(); // in case a userdef is read from regular .blend diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index aaa38cee7d8..46786b159c0 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -144,8 +144,6 @@ void WM_init(bContext *C) read_Blog(); BLI_strncpy(G.lib, G.sce, FILE_MAX); - - sound_init(); } /* free strings of open recent files */ @@ -208,12 +206,6 @@ void WM_exit(bContext *C) BKE_freecubetable(); - /* before free_blender so py's gc happens while library still exists */ - /* needed at least for a rare sigsegv that can happen in pydrivers */ -#ifndef DISABLE_PYTHON - BPY_end_python(); -#endif - fastshade_free_render(); /* shaded view */ ED_preview_free_dbase(); /* frees a Main dbase, before free_blender! */ @@ -236,6 +228,18 @@ void WM_exit(bContext *C) // free_txt_data(); + +#ifndef DISABLE_PYTHON + /* XXX - old note */ + /* before free_blender so py's gc happens while library still exists */ + /* needed at least for a rare sigsegv that can happen in pydrivers */ + + /* Update for blender 2.5, move after free_blender because blender now holds references to PyObject's + * so decref'ing them after python ends causes bad problems every time + * the pyDriver bug can be fixed if it happens again we can deal with it then */ + BPY_end_python(); +#endif + libtiff_exit(); #ifdef WITH_QUICKTIME @@ -259,7 +263,7 @@ void WM_exit(bContext *C) UI_exit(); BKE_userdef_free(); - RNA_exit(); + RNA_exit(); /* should be after BPY_end_python so struct python slots are cleared */ wm_ghost_exit(); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 41613d0ab78..2e813bac37d 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -322,7 +322,7 @@ void WM_operator_py_idname(char *to, const char *from) /* some.op -> SOME_OT_op */ void WM_operator_bl_idname(char *to, const char *from) { - char *sep= strstr(from, "."); + char *sep= strchr(from, '.'); if(sep) { int i, ofs= (sep-from); @@ -345,7 +345,7 @@ void WM_operator_bl_idname(char *to, const char *from) * When calling from an existing wmOperator do. * WM_operator_pystring(op->type, op->ptr); */ -char *WM_operator_pystring(wmOperatorType *ot, PointerRNA *opptr, int all_args) +char *WM_operator_pystring(bContext *C, wmOperatorType *ot, PointerRNA *opptr, int all_args) { const char *arg_name= NULL; char idname_py[OP_MAX_TYPENAME]; @@ -378,7 +378,7 @@ char *WM_operator_pystring(wmOperatorType *ot, PointerRNA *opptr, int all_args) if (strcmp(arg_name, "rna_type")==0) continue; - buf= RNA_property_as_string(opptr, prop); + buf= RNA_property_as_string(C, opptr, prop); ok= 1; @@ -388,7 +388,7 @@ char *WM_operator_pystring(wmOperatorType *ot, PointerRNA *opptr, int all_args) prop_default= RNA_struct_find_property(&opptr_default, arg_name); if(prop_default) { - buf_default= RNA_property_as_string(&opptr_default, prop_default); + buf_default= RNA_property_as_string(C, &opptr_default, prop_default); if(strcmp(buf, buf_default)==0) ok= 0; /* values match, dont bother printing */ @@ -543,7 +543,12 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op) RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 300, 20, style); - uiDefAutoButsRNA(C, layout, &ptr, 2); + uiItemL(layout, op->type->name, 0); + + if(op->type->ui) + op->type->ui((bContext*)C, &ptr, layout); + else + uiDefAutoButsRNA(C, layout, &ptr, 2); uiPopupBoundsBlock(block, 4.0f, 0, 0); uiEndBlock(C, block); @@ -585,7 +590,12 @@ static uiBlock *wm_block_create_menu(bContext *C, ARegion *ar, void *arg_op) uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN|UI_BLOCK_RET_1); layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 300, 20, style); - uiDefAutoButsRNA(C, layout, op->ptr, 2); + uiItemL(layout, op->type->name, 0); + + if(op->type->ui) + op->type->ui(C, op->ptr, layout); + else + uiDefAutoButsRNA(C, layout, op->ptr, 2); uiPopupBoundsBlock(block, 4.0f, 0, 0); uiEndBlock(C, block); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 4d80836dd05..a6fbb0515bc 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -207,7 +207,10 @@ wmWindow *wm_window_copy(bContext *C, wmWindow *winorig) win->sizey= winorig->sizey; /* duplicate assigns to window */ - ED_screen_duplicate(win, winorig->screen); + win->screen= ED_screen_duplicate(win, winorig->screen); + BLI_strncpy(win->screenname, win->screen->id.name+2, 21); + win->screen->winid= win->winid; + win->screen->do_refresh= 1; win->screen->do_draw= 1; @@ -585,6 +588,8 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private) kdata.key= GHOST_kKeyCommand; wm_event_add_ghostevent(win, GHOST_kEventKeyUp, &kdata); } + /* keymodifier zero, it hangs on hotkeys that open windows otherwise */ + win->eventstate->keymodifier= 0; /* entering window, update mouse pos. but no event */ GHOST_GetCursorPosition(g_system, &wx, &wy); |