diff options
Diffstat (limited to 'source')
448 files changed, 5376 insertions, 4447 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index ef903671fae..c898820b949 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenfont/Makefile b/source/blender/blenfont/Makefile index 43eda027855..9f34d458126 100644 --- a/source/blender/blenfont/Makefile +++ b/source/blender/blenfont/Makefile @@ -1,5 +1,5 @@ # -# $Id: +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/blenfont/intern/Makefile b/source/blender/blenfont/intern/Makefile index 6e53ca959d3..38e76d03cad 100644 --- a/source/blender/blenfont/intern/Makefile +++ b/source/blender/blenfont/intern/Makefile @@ -1,5 +1,5 @@ # -# $Id: +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 682a0aabb4f..9a65b15200f 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -41,14 +41,7 @@ #include "DNA_listBase.h" #include "DNA_vec_types.h" -#include "BKE_utildefines.h" - -#include "BLI_blenlib.h" -#include "BLI_linklist.h" /* linknode */ -#include "BLI_string.h" - #include "BIF_gl.h" -#include "BIF_glutil.h" #include "BLF_api.h" #include "blf_internal_types.h" diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c index 5d623c61d34..e650586aa9c 100644 --- a/source/blender/blenfont/intern/blf_dir.c +++ b/source/blender/blenfont/intern/blf_dir.c @@ -36,14 +36,11 @@ #include "MEM_guardedalloc.h" -#include "DNA_listBase.h" #include "DNA_vec_types.h" #include "BKE_utildefines.h" #include "BLI_blenlib.h" -#include "BLI_linklist.h" /* linknode */ -#include "BLI_string.h" #include "BIF_gl.h" diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 98044b965e1..2d79626a3d6 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -45,7 +45,6 @@ #include "BLI_blenlib.h" #include "BLI_linklist.h" /* linknode */ -#include "BLI_string.h" #include "BLI_math.h" #include "BIF_gl.h" @@ -226,19 +225,21 @@ void blf_font_buffer(FontBLF *font, char *str) for (y= 0; y < g->height; y++) { for (x= 0; x < g->width; x++) { - fbuf= font->b_fbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw)); - data= g->bitmap + x + (yb * g->pitch); - a= data[0]/255.0f; - - if (a == 1.0) { - fbuf[0]= font->b_col[0]; - fbuf[1]= font->b_col[1]; - fbuf[2]= font->b_col[2]; - } - else { - fbuf[0]= (font->b_col[0]*a) + (fbuf[0] * (1-a)); - fbuf[1]= (font->b_col[1]*a) + (fbuf[1] * (1-a)); - fbuf[2]= (font->b_col[2]*a) + (fbuf[2] * (1-a)); + + a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f; + + if(a > 0.0f) { + fbuf= font->b_fbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw)); + if (a >= 1.0f) { + fbuf[0]= font->b_col[0]; + fbuf[1]= font->b_col[1]; + fbuf[2]= font->b_col[2]; + } + else { + fbuf[0]= (font->b_col[0]*a) + (fbuf[0] * (1-a)); + fbuf[1]= (font->b_col[1]*a) + (fbuf[1] * (1-a)); + fbuf[2]= (font->b_col[2]*a) + (fbuf[2] * (1-a)); + } } } @@ -252,6 +253,11 @@ void blf_font_buffer(FontBLF *font, char *str) if (font->b_cbuf) { if (chx >= 0 && chx < font->bw && pen_y >= 0 && pen_y < font->bh) { + char b_col_char[3]; + b_col_char[0]= font->b_col[0] * 255; + b_col_char[1]= font->b_col[1] * 255; + b_col_char[2]= font->b_col[2] * 255; + if (g->pitch < 0) yb= 0; else @@ -259,19 +265,20 @@ void blf_font_buffer(FontBLF *font, char *str) for (y= 0; y < g->height; y++) { for (x= 0; x < g->width; x++) { - cbuf= font->b_cbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw)); - data= g->bitmap + x + (yb * g->pitch); - a= data[0]; - - if (a == 256) { - cbuf[0]= font->b_col[0]; - cbuf[1]= font->b_col[1]; - cbuf[2]= font->b_col[2]; - } - else { - cbuf[0]= (font->b_col[0]*a) + (cbuf[0] * (256-a)); - cbuf[1]= (font->b_col[1]*a) + (cbuf[1] * (256-a)); - cbuf[2]= (font->b_col[2]*a) + (cbuf[2] * (256-a)); + a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f; + + if(a > 0.0f) { + cbuf= font->b_cbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw)); + if (a >= 1.0f) { + cbuf[0]= b_col_char[0]; + cbuf[1]= b_col_char[1]; + cbuf[2]= b_col_char[2]; + } + else { + cbuf[0]= (b_col_char[0]*a) + (cbuf[0] * (1-a)); + cbuf[1]= (b_col_char[1]*a) + (cbuf[1] * (1-a)); + cbuf[2]= (b_col_char[2]*a) + (cbuf[2] * (1-a)); + } } } diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index f2f3f0ea4c4..0d694c28b2b 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -39,14 +39,9 @@ #include "MEM_guardedalloc.h" -#include "DNA_listBase.h" #include "DNA_vec_types.h" -#include "BKE_utildefines.h" - #include "BLI_blenlib.h" -#include "BLI_linklist.h" /* linknode */ -#include "BLI_string.h" #include "BIF_gl.h" #include "BLF_api.h" diff --git a/source/blender/blenfont/intern/blf_util.c b/source/blender/blenfont/intern/blf_util.c index 319a837bbb6..30e6e3fd3f5 100644 --- a/source/blender/blenfont/intern/blf_util.c +++ b/source/blender/blenfont/intern/blf_util.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -30,8 +30,6 @@ #include <stdlib.h> #include <string.h> -#include "BIF_gl.h" - unsigned int blf_next_p2(unsigned int x) { diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index f6950ba07b8..af5e31b1efa 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -71,7 +71,7 @@ void BKE_animdata_make_local(struct AnimData *adt); struct KeyingSet *BKE_keyingset_add(struct ListBase *list, const char name[], short flag, short keyingflag); /* Add a path to a KeyingSet */ -void BKE_keyingset_add_path(struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, short flag, short groupmode); +struct KS_Path *BKE_keyingset_add_path(struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, short flag, short groupmode); /* Find the destination matching the criteria given */ struct KS_Path *BKE_keyingset_find_path(struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, int group_mode); @@ -79,6 +79,9 @@ struct KS_Path *BKE_keyingset_find_path(struct KeyingSet *ks, struct ID *id, con /* Copy all KeyingSets in the given list */ void BKE_keyingsets_copy(struct ListBase *newlist, struct ListBase *list); +/* Free the given Keying Set path */ +void BKE_keyingset_free_path(struct KeyingSet *ks, struct KS_Path *ksp); + /* Free data for KeyingSet but not set itself */ void BKE_keyingset_free(struct KeyingSet *ks); @@ -89,7 +92,7 @@ void BKE_keyingsets_free(struct ListBase *list); /* Path Fixing API */ /* Fix all the paths for the given ID+AnimData */ -void BKE_animdata_fix_paths_rename(struct ID *owner_id, struct AnimData *adt, char *prefix, char *oldName, char *newName); +void BKE_animdata_fix_paths_rename(struct ID *owner_id, struct AnimData *adt, char *prefix, char *oldName, char *newName, int oldSubscript, int newSubscript, int verify_paths); /* Fix all the paths for the entire database... */ void BKE_all_animdata_fix_paths_rename(char *prefix, char *oldName, char *newName); diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index 5fb44c52307..7119a725630 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -40,12 +40,12 @@ struct ListBase; struct BezTriple; struct BevList; -#define KNOTSU(nu) ( (nu)->orderu+ (nu)->pntsu+ (((nu)->flagu & CU_CYCLIC) ? (nu->orderu-1) : 0) ) -#define KNOTSV(nu) ( (nu)->orderv+ (nu)->pntsv+ (((nu)->flagv & CU_CYCLIC) ? (nu->orderv-1) : 0) ) +#define KNOTSU(nu) ( (nu)->orderu+ (nu)->pntsu+ (((nu)->flagu & CU_NURB_CYCLIC) ? (nu->orderu-1) : 0) ) +#define KNOTSV(nu) ( (nu)->orderv+ (nu)->pntsv+ (((nu)->flagv & CU_NURB_CYCLIC) ? (nu->orderv-1) : 0) ) /* Non cyclic nurbs have 1 less segment */ -#define SEGMENTSU(nu) ( ((nu)->flagu & CU_CYCLIC) ? (nu)->pntsu : (nu)->pntsu-1 ) -#define SEGMENTSV(nu) ( ((nu)->flagv & CU_CYCLIC) ? (nu)->pntsv : (nu)->pntsv-1 ) +#define SEGMENTSU(nu) ( ((nu)->flagu & CU_NURB_CYCLIC) ? (nu)->pntsu : (nu)->pntsu-1 ) +#define SEGMENTSV(nu) ( ((nu)->flagv & CU_NURB_CYCLIC) ? (nu)->pntsv : (nu)->pntsv-1 ) #define CU_DO_TILT(cu, nu) (((nu->flag & CU_2D) && (cu->flag & CU_3D)==0) ? 0 : 1) #define CU_DO_RADIUS(cu, nu) ((CU_DO_TILT(cu, nu) || cu->bevobj || cu->ext1!=0.0 || cu->ext2!=0.0) ? 1:0) @@ -89,6 +89,9 @@ void sethandlesNurb(ListBase *editnurb, short code); void switchdirectionNurb( struct Nurb *nu); +void addNurbPoints(struct Nurb *nu, int number); +void addNurbPointsBezier(struct Nurb *nu, int number); + float (*curve_getVertexCos(struct Curve *cu, struct ListBase *lb, int *numVerts_r))[3]; void curve_applyVertexCos(struct Curve *cu, struct ListBase *lb, float (*vertexCos)[3]); diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index 9df6bfdbe7c..c4d74f86284 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -158,6 +158,7 @@ FModifierTypeInfo *get_fmodifier_typeinfo(int type); /* ---------------------- */ struct FModifier *add_fmodifier(ListBase *modifiers, int type); +struct FModifier *copy_fmodifier(struct FModifier *src); void copy_fmodifiers(ListBase *dst, ListBase *src); int remove_fmodifier(ListBase *modifiers, struct FModifier *fcm); int remove_fmodifier_index(ListBase *modifiers, int index); diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 6084b0cfb73..291deb5ea70 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -106,7 +106,7 @@ typedef struct Global { #define G_RENDER_OGL (1 << 0) #define G_SWAP_EXCHANGE (1 << 1) /* also uses G_FILE_AUTOPLAY */ -#define G_RENDER_SHADOW (1 << 3) +/* #define G_RENDER_SHADOW (1 << 3) */ /* temp flag, removed */ #define G_BACKBUFSEL (1 << 4) #define G_PICKSEL (1 << 5) diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index 9634b872e91..6e364ef63b6 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -1,5 +1,5 @@ /** - * $Id: BKE_idprop.h + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index d1808366944..df51d017594 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -162,6 +162,11 @@ struct Image *BKE_image_copy(struct Image *ima); /* merge source into dest, and free source */ void BKE_image_merge(struct Image *dest, struct Image *source); +/* image_gen.c */ +void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width, int height, float color[4]); +void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int height, int width); +void BKE_image_buf_fill_checker_color(unsigned char *rect, float *rect_float, int height, int width); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index a6ebb72320c..0e5ad8e3ee9 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -290,9 +290,11 @@ void ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMaterial *mat); #define RRES_OUT_AO 10 #define RRES_OUT_REFLECT 11 #define RRES_OUT_REFRACT 12 -#define RRES_OUT_RADIO 13 +#define RRES_OUT_INDIRECT 13 #define RRES_OUT_INDEXOB 14 #define RRES_OUT_MIST 15 +#define RRES_OUT_EMIT 16 +#define RRES_OUT_ENV 17 /* note: types are needed to restore callbacks, don't change values */ #define CMP_NODE_VIEWER 201 diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 21cd2f694ca..40168882dcb 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -234,7 +234,7 @@ struct Sequence *sequencer_add_sound_strip(struct bContext *C, ListBase *seqbase struct Sequence *sequencer_add_movie_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load); /* view3d draw callback, run when not in background view */ -typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, int, int); +typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, int, int, int); extern SequencerDrawView sequencer_view3d_cb; /* copy/paste */ diff --git a/source/blender/blenkernel/BKE_softbody.h b/source/blender/blenkernel/BKE_softbody.h index e7fbf50ad82..30b7e8cda53 100644 --- a/source/blender/blenkernel/BKE_softbody.h +++ b/source/blender/blenkernel/BKE_softbody.h @@ -1,7 +1,7 @@ /** * BKE_softbody.h * - * $Id: BKE_softbody.h + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index fa035d62d62..b89767d2586 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -72,6 +72,8 @@ void sound_create_scene(struct Scene *scene); void sound_destroy_scene(struct Scene *scene); +void* sound_scene_add_scene_sound(struct Scene *scene, struct Sequence* sequence, int startframe, int endframe, int frameskip); + void* sound_add_scene_sound(struct Scene *scene, struct Sequence* sequence, int startframe, int endframe, int frameskip); void sound_remove_scene_sound(struct Scene *scene, void* handle); diff --git a/source/blender/blenkernel/intern/BME_Customdata.c b/source/blender/blenkernel/intern/BME_Customdata.c index cd9254eef53..736b5e05798 100644 --- a/source/blender/blenkernel/intern/BME_Customdata.c +++ b/source/blender/blenkernel/intern/BME_Customdata.c @@ -34,13 +34,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +#include <string.h> -#include "BKE_bmesh.h" #include "BKE_bmeshCustomData.h" #include "bmesh_private.h" -#include <string.h> #include "MEM_guardedalloc.h" -#include "BLI_mempool.h" /********************* Layer type information **********************/ typedef struct BME_LayerTypeInfo { diff --git a/source/blender/blenkernel/intern/BME_conversions.c b/source/blender/blenkernel/intern/BME_conversions.c index c5c74b388ff..d6a00450e4a 100644 --- a/source/blender/blenkernel/intern/BME_conversions.c +++ b/source/blender/blenkernel/intern/BME_conversions.c @@ -33,22 +33,14 @@ */ #include "MEM_guardedalloc.h" -#include "BKE_customdata.h" -#include "DNA_listBase.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" -#include "BKE_utildefines.h" #include "BKE_mesh.h" -#include "BKE_bmesh.h" -#include "BKE_global.h" -#include "BKE_DerivedMesh.h" #include "BKE_cdderivedmesh.h" -#include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_edgehash.h" //XXX #include "BIF_editmesh.h" //XXX #include "editmesh.h" diff --git a/source/blender/blenkernel/intern/BME_eulers.c b/source/blender/blenkernel/intern/BME_eulers.c index 647671d0ed8..9c9c71292c2 100644 --- a/source/blender/blenkernel/intern/BME_eulers.c +++ b/source/blender/blenkernel/intern/BME_eulers.c @@ -34,17 +34,8 @@ #include "MEM_guardedalloc.h" -#include "DNA_listBase.h" -#include "DNA_meshdata_types.h" -#include "DNA_mesh_types.h" -#include "BKE_utildefines.h" -#include "BKE_customdata.h" -#include "BKE_bmesh.h" - -#include "BLI_blenlib.h" #include "bmesh_private.h" -#include "BLI_ghash.h" /********************************************************* * "Euler API" * diff --git a/source/blender/blenkernel/intern/BME_mesh.c b/source/blender/blenkernel/intern/BME_mesh.c index c34695b2fb5..f616d21c6fd 100644 --- a/source/blender/blenkernel/intern/BME_mesh.c +++ b/source/blender/blenkernel/intern/BME_mesh.c @@ -34,13 +34,9 @@ #include "MEM_guardedalloc.h" -#include "DNA_listBase.h" -#include "BLI_blenlib.h" -#include "BKE_utildefines.h" #include "BKE_bmesh.h" #include "bmesh_private.h" - /* * BME MAKE MESH * diff --git a/source/blender/blenkernel/intern/BME_structure.c b/source/blender/blenkernel/intern/BME_structure.c index da0ce4da43b..de3eb94beac 100644 --- a/source/blender/blenkernel/intern/BME_structure.c +++ b/source/blender/blenkernel/intern/BME_structure.c @@ -35,12 +35,7 @@ #include <limits.h> #include "MEM_guardedalloc.h" -#include "DNA_listBase.h" -#include "BKE_utildefines.h" #include "BKE_bmesh.h" -#include "BLI_blenlib.h" -#include "BLI_linklist.h" -#include "BLI_ghash.h" /** * MISC utility functions. * diff --git a/source/blender/blenkernel/intern/BME_tools.c b/source/blender/blenkernel/intern/BME_tools.c index 05dda65a914..9753ad47488 100644 --- a/source/blender/blenkernel/intern/BME_tools.c +++ b/source/blender/blenkernel/intern/BME_tools.c @@ -35,15 +35,11 @@ #include "MEM_guardedalloc.h" -#include "DNA_listBase.h" #include "DNA_meshdata_types.h" -#include "DNA_mesh_types.h" #include "DNA_object_types.h" -#include "BKE_utildefines.h" #include "BKE_bmesh.h" #include "BLI_math.h" -#include "BLI_blenlib.h" /*split this all into a seperate bevel.c file in src*/ diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 28b093cd693..e69686eeb00 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -33,51 +33,27 @@ #include <config.h> #endif -#include "PIL_time.h" #include "MEM_guardedalloc.h" -#include "DNA_effect_types.h" -#include "DNA_mesh_types.h" #include "DNA_key_types.h" #include "DNA_meshdata_types.h" -#include "DNA_modifier_types.h" #include "DNA_object_types.h" -#include "DNA_object_force.h" -#include "DNA_object_fluidsim.h" // N_T #include "DNA_scene_types.h" // N_T -#include "DNA_texture_types.h" -#include "DNA_view3d_types.h" -#include "DNA_screen_types.h" -#include "DNA_space_types.h" -#include "DNA_particle_types.h" #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_edgehash.h" #include "BLI_editVert.h" -#include "BLI_linklist.h" #include "BLI_memarena.h" #include "BKE_cdderivedmesh.h" -#include "BKE_customdata.h" -#include "BKE_DerivedMesh.h" -#include "BKE_deform.h" #include "BKE_displist.h" -#include "BKE_effect.h" -#include "BKE_fluidsim.h" -#include "BKE_global.h" -#include "BKE_key.h" -#include "BKE_material.h" #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" -#include "BKE_particle.h" -#include "BKE_bvhutils.h" #include "BLO_sys_types.h" // for intptr_t support @@ -2125,7 +2101,7 @@ static void mesh_build_data(Scene *scene, Object *ob, CustomDataMask dataMask) Object *obact = scene->basact?scene->basact->object:NULL; int editing = paint_facesel_test(ob); /* weight paint and face select need original indicies because of selection buffer drawing */ - int needMapping = (ob==obact) && (editing || (ob->mode & OB_MODE_WEIGHT_PAINT) || editing); + int needMapping = (ob==obact) && (editing || (ob->mode & (OB_MODE_WEIGHT_PAINT|OB_MODE_VERTEX_PAINT)) || editing); clear_mesh_caches(ob); diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 13f247e7c3c..cf61de195e5 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -38,26 +38,16 @@ #include "MEM_guardedalloc.h" #include "DNA_anim_types.h" -#include "DNA_action_types.h" #include "DNA_armature_types.h" #include "DNA_constraint_types.h" -#include "DNA_curve_types.h" -#include "DNA_key_types.h" -#include "DNA_nla_types.h" -#include "DNA_object_types.h" #include "DNA_scene_types.h" #include "BKE_animsys.h" #include "BKE_action.h" #include "BKE_anim.h" -#include "BKE_armature.h" -#include "BKE_blender.h" #include "BKE_constraint.h" -#include "BKE_displist.h" #include "BKE_global.h" #include "BKE_fcurve.h" -#include "BKE_key.h" -#include "BKE_lattice.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_object.h" @@ -68,10 +58,8 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_ghash.h" #include "RNA_access.h" -#include "RNA_types.h" /* *********************** NOTE ON POSE AND ACTION ********************** diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 08c8528384f..9eb6c3ad467 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -40,30 +40,18 @@ #include "BLI_math.h" #include "BLI_rand.h" -#include "DNA_listBase.h" #include "DNA_anim_types.h" -#include "DNA_action_types.h" #include "DNA_armature_types.h" -#include "DNA_curve_types.h" -#include "DNA_effect_types.h" #include "DNA_group_types.h" #include "DNA_key_types.h" -#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" -#include "DNA_modifier_types.h" -#include "DNA_object_types.h" -#include "DNA_particle_types.h" #include "DNA_scene_types.h" -#include "DNA_view3d_types.h" #include "DNA_vfont_types.h" #include "BKE_anim.h" -#include "BKE_animsys.h" #include "BKE_curve.h" #include "BKE_DerivedMesh.h" -#include "BKE_displist.h" -#include "BKE_effect.h" #include "BKE_font.h" #include "BKE_group.h" #include "BKE_global.h" @@ -81,7 +69,6 @@ #endif // XXX bad level call... -#include "ED_mesh.h" /* --------------------- */ /* forward declarations */ diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index a880417a111..584f31769ef 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -36,7 +36,6 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" -#include "BLI_math.h" #include "BLI_dynstr.h" #include "DNA_anim_types.h" @@ -51,7 +50,6 @@ #include "BKE_utildefines.h" #include "RNA_access.h" -#include "RNA_types.h" #include "nla_private.h" @@ -274,7 +272,7 @@ static short check_rna_path_is_valid (ID *owner_id, char *path) /* Check if some given RNA Path needs fixing - free the given path and set a new one as appropriate * NOTE: we assume that oldName and newName have [" "] padding around them */ -static char *rna_path_rename_fix (ID *owner_id, char *prefix, char *oldName, char *newName, char *oldpath) +static char *rna_path_rename_fix (ID *owner_id, char *prefix, char *oldName, char *newName, char *oldpath, int verify_paths) { char *prefixPtr= strstr(oldpath, prefix); char *oldNamePtr= strstr(oldpath, oldName); @@ -286,7 +284,7 @@ static char *rna_path_rename_fix (ID *owner_id, char *prefix, char *oldName, cha */ if ( (prefixPtr && oldNamePtr) && (prefixPtr+prefixLen == oldNamePtr) ) { /* if we haven't aren't able to resolve the path now, try again after fixing it */ - if (check_rna_path_is_valid(owner_id, oldpath) == 0) { + if (!verify_paths || check_rna_path_is_valid(owner_id, oldpath) == 0) { DynStr *ds= BLI_dynstr_new(); char *postfixPtr= oldNamePtr+oldNameLen; char *newPath = NULL; @@ -315,7 +313,7 @@ static char *rna_path_rename_fix (ID *owner_id, char *prefix, char *oldName, cha /* check if the new path will solve our problems */ // TODO: will need to check whether this step really helps in practice - if (check_rna_path_is_valid(owner_id, newPath)) { + if (!verify_paths || check_rna_path_is_valid(owner_id, newPath)) { /* free the old path, and return the new one, since we've solved the issues */ MEM_freeN(oldpath); return newPath; @@ -332,7 +330,7 @@ static char *rna_path_rename_fix (ID *owner_id, char *prefix, char *oldName, cha } /* Check RNA-Paths for a list of F-Curves */ -static void fcurves_path_rename_fix (ID *owner_id, char *prefix, char *oldName, char *newName, ListBase *curves) +static void fcurves_path_rename_fix (ID *owner_id, char *prefix, char *oldName, char *newName, ListBase *curves, int verify_paths) { FCurve *fcu; @@ -340,7 +338,7 @@ static void fcurves_path_rename_fix (ID *owner_id, char *prefix, char *oldName, for (fcu= curves->first; fcu; fcu= fcu->next) { /* firstly, handle the F-Curve's own path */ if (fcu->rna_path) - fcu->rna_path= rna_path_rename_fix(owner_id, prefix, oldName, newName, fcu->rna_path); + fcu->rna_path= rna_path_rename_fix(owner_id, prefix, oldName, newName, fcu->rna_path, verify_paths); /* driver? */ if (fcu->driver) { @@ -354,7 +352,7 @@ static void fcurves_path_rename_fix (ID *owner_id, char *prefix, char *oldName, { /* rename RNA path */ if (dtar->rna_path) - dtar->rna_path= rna_path_rename_fix(dtar->id, prefix, oldName, newName, dtar->rna_path); + dtar->rna_path= rna_path_rename_fix(dtar->id, prefix, oldName, newName, dtar->rna_path, verify_paths); /* also fix the bone-name (if applicable) */ // XXX this has been disabled because the old/new names have padding which means this check will fail @@ -371,7 +369,7 @@ static void fcurves_path_rename_fix (ID *owner_id, char *prefix, char *oldName, } /* Fix all RNA-Paths for Actions linked to NLA Strips */ -static void nlastrips_path_rename_fix (ID *owner_id, char *prefix, char *oldName, char *newName, ListBase *strips) +static void nlastrips_path_rename_fix (ID *owner_id, char *prefix, char *oldName, char *newName, ListBase *strips, int verify_paths) { NlaStrip *strip; @@ -379,11 +377,11 @@ static void nlastrips_path_rename_fix (ID *owner_id, char *prefix, char *oldName for (strip= strips->first; strip; strip= strip->next) { /* fix strip's action */ if (strip->act) - fcurves_path_rename_fix(owner_id, prefix, oldName, newName, &strip->act->curves); + fcurves_path_rename_fix(owner_id, prefix, oldName, newName, &strip->act->curves, verify_paths); /* ignore own F-Curves, since those are local... */ /* check sub-strips (if metas) */ - nlastrips_path_rename_fix(owner_id, prefix, oldName, newName, &strip->strips); + nlastrips_path_rename_fix(owner_id, prefix, oldName, newName, &strip->strips, verify_paths); } } @@ -391,31 +389,36 @@ static void nlastrips_path_rename_fix (ID *owner_id, char *prefix, char *oldName * NOTE: it is assumed that the structure we're replacing is <prefix><["><name><"]> * i.e. pose.bones["Bone"] */ -void BKE_animdata_fix_paths_rename (ID *owner_id, AnimData *adt, char *prefix, char *oldName, char *newName) +void BKE_animdata_fix_paths_rename (ID *owner_id, AnimData *adt, char *prefix, char *oldName, char *newName, int oldSubscript, int newSubscript, int verify_paths) { NlaTrack *nlt; char *oldN, *newN; /* if no AnimData, no need to proceed */ - if (ELEM4(NULL, owner_id, adt, oldName, newName)) + if (ELEM(NULL, owner_id, adt)) return; - /* pad the names with [" "] so that only exact matches are made */ - oldN= BLI_sprintfN("[\"%s\"]", oldName); - newN= BLI_sprintfN("[\"%s\"]", newName); + if (oldName != NULL && newName != NULL) { + /* pad the names with [" "] so that only exact matches are made */ + oldN= BLI_sprintfN("[\"%s\"]", oldName); + newN= BLI_sprintfN("[\"%s\"]", newName); + } else { + oldN= BLI_sprintfN("[%d]", oldSubscript); + newN= BLI_sprintfN("[%d]", newSubscript); + } /* Active action and temp action */ if (adt->action) - fcurves_path_rename_fix(owner_id, prefix, oldN, newN, &adt->action->curves); + fcurves_path_rename_fix(owner_id, prefix, oldN, newN, &adt->action->curves, verify_paths); if (adt->tmpact) - fcurves_path_rename_fix(owner_id, prefix, oldN, newN, &adt->tmpact->curves); + fcurves_path_rename_fix(owner_id, prefix, oldN, newN, &adt->tmpact->curves, verify_paths); /* Drivers - Drivers are really F-Curves */ - fcurves_path_rename_fix(owner_id, prefix, oldN, newN, &adt->drivers); + fcurves_path_rename_fix(owner_id, prefix, oldN, newN, &adt->drivers, verify_paths); /* NLA Data - Animation Data for Strips */ for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) - nlastrips_path_rename_fix(owner_id, prefix, oldN, newN, &nlt->strips); + nlastrips_path_rename_fix(owner_id, prefix, oldN, newN, &nlt->strips, verify_paths); /* free the temp names */ MEM_freeN(oldN); @@ -482,7 +485,7 @@ void BKE_all_animdata_fix_paths_rename (char *prefix, char *oldName, char *newNa #define RENAMEFIX_ANIM_IDS(first) \ for (id= first; id; id= id->next) { \ AnimData *adt= BKE_animdata_from_id(id); \ - BKE_animdata_fix_paths_rename(id, adt, prefix, oldName, newName);\ + BKE_animdata_fix_paths_rename(id, adt, prefix, oldName, newName, 0, 0, 1);\ } /* nodes */ @@ -532,11 +535,11 @@ void BKE_all_animdata_fix_paths_rename (char *prefix, char *oldName, char *newNa /* do compositing nodes first (since these aren't included in main tree) */ if (scene->nodetree) { AnimData *adt2= BKE_animdata_from_id((ID *)scene->nodetree); - BKE_animdata_fix_paths_rename((ID *)scene->nodetree, adt2, prefix, oldName, newName); + BKE_animdata_fix_paths_rename((ID *)scene->nodetree, adt2, prefix, oldName, newName, 0, 0, 1); } /* now fix scene animation data as per normal */ - BKE_animdata_fix_paths_rename((ID *)id, adt, prefix, oldName, newName); + BKE_animdata_fix_paths_rename((ID *)id, adt, prefix, oldName, newName, 0, 0, 1); } } @@ -552,15 +555,9 @@ KS_Path *BKE_keyingset_find_path (KeyingSet *ks, ID *id, const char group_name[] KS_Path *ksp; /* sanity checks */ - if ELEM(NULL, ks, rna_path) + if ELEM3(NULL, ks, rna_path, id) return NULL; - /* ID is optional for relative KeyingSets, but is necessary for absolute KeyingSets */ - if (id == NULL) { - if (ks->flag & KEYINGSET_ABSOLUTE) - return NULL; - } - /* loop over paths in the current KeyingSet, finding the first one where all settings match * (i.e. the first one where none of the checks fail and equal 0) */ @@ -568,7 +565,7 @@ KS_Path *BKE_keyingset_find_path (KeyingSet *ks, ID *id, const char group_name[] short eq_id=1, eq_path=1, eq_index=1, eq_group=1; /* id */ - if ((ks->flag & KEYINGSET_ABSOLUTE) && (id != ksp->id)) + if (id != ksp->id) eq_id= 0; /* path */ @@ -621,53 +618,48 @@ KeyingSet *BKE_keyingset_add (ListBase *list, const char name[], short flag, sho return ks; } -/* Add a destination to a KeyingSet. Nothing is returned for now... +/* Add a path to a KeyingSet. Nothing is returned for now... * Checks are performed to ensure that destination is appropriate for the KeyingSet in question */ -void BKE_keyingset_add_path (KeyingSet *ks, ID *id, const char group_name[], const char rna_path[], int array_index, short flag, short groupmode) +KS_Path *BKE_keyingset_add_path (KeyingSet *ks, ID *id, const char group_name[], const char rna_path[], int array_index, short flag, short groupmode) { KS_Path *ksp; /* sanity checks */ if ELEM(NULL, ks, rna_path) { - printf("ERROR: no Keying Set and/or RNA Path to add destination with \n"); - return; + printf("ERROR: no Keying Set and/or RNA Path to add path with \n"); + return NULL; } - /* ID is optional for relative KeyingSets, but is necessary for absolute KeyingSets */ + /* ID is required for all types of KeyingSets */ if (id == NULL) { - if (ks->flag & KEYINGSET_ABSOLUTE) { - printf("ERROR: No ID provided for absolute destination. \n"); - return; - } + printf("ERROR: No ID provided for Keying Set Path. \n"); + return NULL; } /* don't add if there is already a matching KS_Path in the KeyingSet */ if (BKE_keyingset_find_path(ks, id, group_name, rna_path, array_index, groupmode)) { if (G.f & G_DEBUG) printf("ERROR: destination already exists in Keying Set \n"); - return; + return NULL; } /* allocate a new KeyingSet Path */ ksp= MEM_callocN(sizeof(KS_Path), "KeyingSet Path"); /* just store absolute info */ - if (ks->flag & KEYINGSET_ABSOLUTE) { - ksp->id= id; - if (group_name) - BLI_snprintf(ksp->group, 64, group_name); - else - strcpy(ksp->group, ""); - } + ksp->id= id; + if (group_name) + BLI_snprintf(ksp->group, 64, group_name); + else + strcpy(ksp->group, ""); /* store additional info for relative paths (just in case user makes the set relative) */ if (id) ksp->idtype= GS(id->name); /* just copy path info */ - // XXX no checks are performed for templates yet - // should array index be checked too? + // TODO: should array index be checked too? ksp->rna_path= BLI_strdupn(rna_path, strlen(rna_path)); ksp->array_index= array_index; @@ -677,20 +669,37 @@ void BKE_keyingset_add_path (KeyingSet *ks, ID *id, const char group_name[], con /* add KeyingSet path to KeyingSet */ BLI_addtail(&ks->paths, ksp); + + /* return this path */ + return ksp; } +/* Free the given Keying Set path */ +void BKE_keyingset_free_path (KeyingSet *ks, KS_Path *ksp) +{ + /* sanity check */ + if ELEM(NULL, ks, ksp) + return; + + /* free RNA-path info */ + MEM_freeN(ksp->rna_path); + + /* free path itself */ + BLI_freelinkN(&ks->paths, ksp); +} + /* Copy all KeyingSets in the given list */ -void BKE_keyingsets_copy(ListBase *newlist, ListBase *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) { + for (ksn=newlist->first; ksn; ksn=ksn->next) { BLI_duplicatelist(&ksn->paths, &ksn->paths); - - for(kspn=ksn->paths.first; kspn; kspn=kspn->next) + + for (kspn=ksn->paths.first; kspn; kspn=kspn->next) kspn->rna_path= MEM_dupallocN(kspn->rna_path); } } @@ -709,12 +718,7 @@ void BKE_keyingset_free (KeyingSet *ks) /* free each path as we go to avoid looping twice */ for (ksp= ks->paths.first; ksp; ksp= kspn) { kspn= ksp->next; - - /* free RNA-path info */ - MEM_freeN(ksp->rna_path); - - /* free path itself */ - BLI_freelinkN(&ks->paths, ksp); + BKE_keyingset_free_path(ks, ksp); } } @@ -765,6 +769,8 @@ static short animsys_remap_path (AnimMapper *remap, char *path, char **dst) /* Write the given value to a setting using RNA, and return success */ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_index, float value) { + // printf("%p %s %i %f\n", ptr, path, array_index, value); + PropertyRNA *prop; PointerRNA new_ptr; @@ -774,22 +780,35 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i /* set value - only for animatable numerical values */ if (RNA_property_animateable(&new_ptr, prop)) { + int array_len= RNA_property_array_length(&new_ptr, prop); + + if(array_len && array_index >= array_len) + { + if (G.f & G_DEBUG) { + printf("Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d \n", + (ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name+2) : "<No ID>", + path, array_index, array_len-1); + } + + return 0; + } + switch (RNA_property_type(prop)) { case PROP_BOOLEAN: - if (RNA_property_array_length(&new_ptr, prop)) + if (array_len) RNA_property_boolean_set_index(&new_ptr, prop, array_index, (int)value); else RNA_property_boolean_set(&new_ptr, prop, (int)value); break; case PROP_INT: - if (RNA_property_array_length(&new_ptr, prop)) + if (array_len) RNA_property_int_set_index(&new_ptr, prop, array_index, (int)value); else RNA_property_int_set(&new_ptr, prop, (int)value); break; case PROP_FLOAT: - if (RNA_property_array_length(&new_ptr, prop)) + if (array_len) RNA_property_float_set_index(&new_ptr, prop, array_index, value); else RNA_property_float_set(&new_ptr, prop, value); @@ -811,7 +830,7 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i // XXX don't tag as failed yet though, as there are some legit situations (Action Constraint) // where some channels will not exist, but shouldn't lock up Action if (G.f & G_DEBUG) { - printf("Animato: Invalid path. ID = '%s', '%s [%d]' \n", + printf("Animato: Invalid path. ID = '%s', '%s[%d]' \n", (ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name+2) : "<No ID>", path, array_index); } @@ -983,6 +1002,9 @@ static void nlastrip_evaluate_controls (NlaStrip *strip, float ctime) /* execute these settings as per normal */ animsys_evaluate_fcurves(&strip_ptr, &strip->fcurves, NULL, ctime); } + + if (strip->flag & NLASTRIP_FLAG_USR_TIME && strip->flag & NLASTRIP_FLAG_USR_TIME_CYCLIC) + strip->strip_time= fmod(strip->strip_time - strip->actstart, strip->actend - strip->actstart); } /* gets the strip active at the current time for a list of strips for evaluation purposes */ diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 36c78c9f947..387b8a1d5b2 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -39,25 +39,19 @@ #include "DNA_anim_types.h" #include "DNA_armature_types.h" -#include "DNA_action_types.h" -#include "DNA_curve_types.h" #include "DNA_constraint_types.h" #include "DNA_mesh_types.h" #include "DNA_lattice_types.h" #include "DNA_meshdata_types.h" #include "DNA_nla_types.h" -#include "DNA_object_types.h" #include "DNA_scene_types.h" -#include "DNA_view3d_types.h" #include "BKE_animsys.h" #include "BKE_armature.h" #include "BKE_action.h" #include "BKE_anim.h" -#include "BKE_blender.h" #include "BKE_constraint.h" #include "BKE_curve.h" -#include "BKE_deform.h" #include "BKE_depsgraph.h" #include "BKE_DerivedMesh.h" #include "BKE_displist.h" @@ -67,7 +61,6 @@ #include "BKE_lattice.h" #include "BKE_main.h" #include "BKE_object.h" -#include "BKE_object.h" #include "BKE_utildefines.h" #include "BIK_api.h" #include "BKE_sketch.h" diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 171b48af974..d7f8d73e31f 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -48,45 +48,31 @@ #include "MEM_guardedalloc.h" -#include "DNA_curve_types.h" -#include "DNA_listBase.h" -#include "DNA_sdna_types.h" #include "DNA_userdef_types.h" -#include "DNA_object_types.h" -#include "DNA_mesh_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" -#include "DNA_sound_types.h" #include "DNA_sequence_types.h" #include "BLI_blenlib.h" #include "BLI_dynstr.h" -#include "IMB_imbuf_types.h" #include "IMB_imbuf.h" -#include "BKE_animsys.h" -#include "BKE_action.h" #include "BKE_blender.h" #include "BKE_context.h" -#include "BKE_curve.h" #include "BKE_depsgraph.h" #include "BKE_displist.h" -#include "BKE_font.h" #include "BKE_global.h" #include "BKE_idprop.h" #include "BKE_library.h" #include "BKE_ipo.h" #include "BKE_main.h" #include "BKE_node.h" -#include "BKE_object.h" #include "BKE_report.h" #include "BKE_scene.h" #include "BKE_screen.h" #include "BKE_sequencer.h" -#include "BKE_sound.h" -#include "BLI_editVert.h" #include "BLO_undofile.h" #include "BLO_readfile.h" diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c index 409e7edb519..5f9b4f11850 100644 --- a/source/blender/blenkernel/intern/bmfont.c +++ b/source/blender/blenkernel/intern/bmfont.c @@ -51,11 +51,9 @@ #include <stdio.h> #include "MEM_guardedalloc.h" -#include "BLI_blenlib.h" #include "BKE_global.h" #include "IMB_imbuf_types.h" -#include "BKE_bmfont.h" #include "BKE_bmfont_types.h" #ifdef HAVE_CONFIG_H diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index b521ec41cba..25c42dfbf49 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -34,19 +34,13 @@ #include "MEM_guardedalloc.h" -#include "DNA_particle_types.h" -#include "DNA_modifier_types.h" #include "DNA_object_force.h" -#include "DNA_object_types.h" #include "DNA_scene_types.h" -#include "DNA_boid_types.h" -#include "DNA_listBase.h" #include "BLI_rand.h" #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_kdtree.h" -#include "BLI_kdopbvh.h" #include "BKE_collision.h" #include "BKE_effect.h" #include "BKE_boids.h" diff --git a/source/blender/blenkernel/intern/booleanops.c b/source/blender/blenkernel/intern/booleanops.c index 14a740fb5d1..710bbfaf12b 100644 --- a/source/blender/blenkernel/intern/booleanops.c +++ b/source/blender/blenkernel/intern/booleanops.c @@ -34,7 +34,6 @@ #include "MEM_guardedalloc.h" #include "BLI_math.h" -#include "BLI_blenlib.h" #include "BLI_ghash.h" #include "DNA_material_types.h" @@ -45,17 +44,11 @@ #include "CSG_BooleanOps.h" -#include "BKE_booleanops.h" #include "BKE_cdderivedmesh.h" -#include "BKE_customdata.h" #include "BKE_depsgraph.h" -#include "BKE_DerivedMesh.h" -#include "BKE_global.h" -#include "BKE_library.h" #include "BKE_material.h" #include "BKE_mesh.h" #include "BKE_object.h" -#include "BKE_utildefines.h" diff --git a/source/blender/blenkernel/intern/booleanops_mesh.c b/source/blender/blenkernel/intern/booleanops_mesh.c index 1e99661f445..431e51cf149 100644 --- a/source/blender/blenkernel/intern/booleanops_mesh.c +++ b/source/blender/blenkernel/intern/booleanops_mesh.c @@ -30,24 +30,10 @@ */ #include "CSG_BooleanOps.h" -#include "BKE_booleanops.h" -#include "BKE_booleanops_mesh.h" #include "MEM_guardedalloc.h" -#include "DNA_material_types.h" -#include "DNA_mesh_types.h" -#include "DNA_object_types.h" -#include "DNA_scene_types.h" -#include "BKE_global.h" -#include "BKE_mesh.h" -#include "BKE_displist.h" -#include "BKE_object.h" -#include "BKE_utildefines.h" -#include "BKE_library.h" -#include "BKE_material.h" -#include "BLI_math.h" /** * Implementation of boolean ops mesh interface. diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index f2cb7d31592..4aaf95e7037 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -34,9 +34,6 @@ #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" @@ -56,7 +53,6 @@ #include "BKE_main.h" #include "BKE_paint.h" #include "BKE_texture.h" -#include "BKE_utildefines.h" diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index b7cda698a29..65fda678ce0 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -32,21 +32,12 @@ #include <math.h> #include <assert.h> -#include "BKE_bvhutils.h" - -#include "DNA_object_types.h" -#include "DNA_modifier_types.h" #include "DNA_meshdata_types.h" #include "BKE_DerivedMesh.h" #include "BKE_utildefines.h" -#include "BKE_deform.h" -#include "BKE_cdderivedmesh.h" -#include "BKE_displist.h" -#include "BKE_global.h" #include "BLI_math.h" -#include "BLI_linklist.h" #include "MEM_guardedalloc.h" /* Math stuff for ray casting on mesh faces and for nearest surface */ diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 347a501dfcc..3a415d6564d 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -37,12 +37,8 @@ #include "BIF_gl.h" #include "BKE_cdderivedmesh.h" -#include "BKE_customdata.h" -#include "BKE_DerivedMesh.h" -#include "BKE_displist.h" #include "BKE_global.h" #include "BKE_mesh.h" -#include "BKE_multires.h" #include "BKE_utildefines.h" #include "BLI_math.h" @@ -51,12 +47,8 @@ #include "BLI_editVert.h" #include "BLI_pbvh.h" -#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" -#include "DNA_modifier_types.h" -#include "DNA_object_fluidsim.h" #include "DNA_object_types.h" -#include "DNA_scene_types.h" #include "DNA_curve_types.h" /* for Curve */ #include "MEM_guardedalloc.h" diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 855de95572a..7183a514225 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -29,25 +29,14 @@ #include "BKE_cloth.h" -#include "DNA_cloth_types.h" -#include "DNA_mesh_types.h" -#include "DNA_object_force.h" -#include "DNA_scene_types.h" -#include "DNA_particle_types.h" - -#include "BKE_deform.h" -#include "BKE_DerivedMesh.h" #include "BKE_cdderivedmesh.h" #include "BKE_effect.h" #include "BKE_global.h" -#include "BKE_object.h" #include "BKE_modifier.h" #include "BKE_utildefines.h" -#include "BKE_particle.h" #include "BKE_pointcache.h" -#include "BLI_kdopbvh.h" #ifdef _WIN32 void tstart ( void ) diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 28b70b539c1..6410d02603d 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -40,20 +40,14 @@ #include "DNA_color_types.h" #include "DNA_curve_types.h" -#include "DNA_image_types.h" -#include "DNA_texture_types.h" #include "BKE_colortools.h" #include "BKE_curve.h" -#include "BKE_global.h" #include "BKE_ipo.h" -#include "BKE_image.h" -#include "BKE_main.h" #include "BKE_utildefines.h" #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_threads.h" #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 91bf4b8d8b2..78f1bb4e469 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -73,8 +73,6 @@ #include "BPY_extern.h" #endif -#include "ED_mesh.h" - #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -1859,6 +1857,64 @@ static bConstraintTypeInfo CTI_TRANSLIKE = { translike_evaluate /* evaluate */ }; +/* ---------- Maintain Volume ---------- */ + +static void samevolume_new_data (void *cdata) +{ + bSameVolumeConstraint *data= (bSameVolumeConstraint *)cdata; + + data->flag = SAMEVOL_Y; + data->volume = 1.0f; +} + +static void samevolume_evaluate (bConstraint *con, bConstraintOb *cob) +{ + bSameVolumeConstraint *data= con->data; + + float obsize[3]; + float volume=data->volume; + + mat4_to_size(obsize, cob->matrix); + + switch (data->flag) { + case SAMEVOL_X: + if (obsize[0]!=0) { + mul_v3_fl(cob->matrix[1], sqrt(volume/obsize[0])/obsize[0]); + mul_v3_fl(cob->matrix[2], sqrt(volume/obsize[0])/obsize[0]); + } + break; + case SAMEVOL_Y: + if (obsize[1]!=0) { + mul_v3_fl(cob->matrix[0], sqrt(volume/obsize[1])/obsize[1]); + mul_v3_fl(cob->matrix[2], sqrt(volume/obsize[1])/obsize[1]); + } + break; + case SAMEVOL_Z: + if (obsize[2]!=0) { + mul_v3_fl(cob->matrix[0], sqrt(volume/obsize[2])/obsize[2]); + mul_v3_fl(cob->matrix[1], sqrt(volume/obsize[2])/obsize[2]); + } + break; + } + +} + +static bConstraintTypeInfo CTI_SAMEVOL = { + CONSTRAINT_TYPE_SAMEVOL, /* type */ + sizeof(bSameVolumeConstraint), /* size */ + "Maintain Volume", /* name */ + "bSameVolumeConstraint", /* struct name */ + NULL, /* free data */ + NULL, /* relink data */ + NULL, /* id looper */ + NULL, /* copy data */ + samevolume_new_data, /* new data */ + NULL, /* get constraint targets */ + NULL, /* flush constraint targets */ + NULL, /* get target matrix */ + samevolume_evaluate /* evaluate */ +}; + /* ----------- Python Constraint -------------- */ static void pycon_free (bConstraint *con) @@ -3805,6 +3861,7 @@ static void constraints_init_typeinfo () { constraintsTypeInfo[21]= &CTI_DAMPTRACK; /* Damped TrackTo Constraint */ constraintsTypeInfo[22]= &CTI_SPLINEIK; /* Spline IK Constraint */ constraintsTypeInfo[23]= &CTI_TRANSLIKE; /* Copy Transforms Constraint */ + constraintsTypeInfo[24]= &CTI_SAMEVOL; /* Maintain Volume Constraint */ } /* This function should be used for getting the appropriate type-info when only diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 26320e2475f..e8f73a92ad5 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -27,8 +27,6 @@ #include "MEM_guardedalloc.h" -#include "DNA_ID.h" -#include "DNA_listBase.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" @@ -44,7 +42,6 @@ #include "BKE_context.h" #include "BKE_main.h" #include "BKE_screen.h" -#include "BKE_global.h" #ifndef DISABLE_PYTHON #include "BPY_extern.h" diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 2430e417e51..06921a0b9af 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -42,12 +42,10 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "DNA_object_types.h" #include "DNA_curve_types.h" #include "DNA_material_types.h" /* for dereferencing pointers */ -#include "DNA_ID.h" #include "DNA_key_types.h" #include "DNA_scene_types.h" #include "DNA_vfont_types.h" @@ -61,7 +59,6 @@ #include "BKE_key.h" #include "BKE_library.h" #include "BKE_main.h" -#include "BKE_mesh.h" #include "BKE_object.h" #include "BKE_utildefines.h" // VECCOPY @@ -519,7 +516,47 @@ void minmaxNurb(Nurb *nu, float *min, float *max) bp++; } } +} + +/* be sure to call makeknots after this */ +void addNurbPoints(Nurb *nu, int number) +{ + BPoint *tmp= nu->bp; + int i; + nu->bp= (BPoint *)MEM_mallocN((nu->pntsu + number) * sizeof(BPoint), "rna_Curve_spline_points_add"); + + if(tmp) { + memmove(nu->bp, tmp, nu->pntsu * sizeof(BPoint)); + MEM_freeN(tmp); + } + + memset(nu->bp + nu->pntsu, 0, number * sizeof(BPoint)); + + for(i=0, tmp= nu->bp + nu->pntsu; i < number; i++, tmp++) { + tmp->radius= 1.0f; + } + + nu->pntsu += number; +} + +void addNurbPointsBezier(Nurb *nu, int number) +{ + BezTriple *tmp= nu->bezt; + int i; + nu->bezt= (BezTriple *)MEM_mallocN((nu->pntsu + number) * sizeof(BezTriple), "rna_Curve_spline_points_add"); + + if(tmp) { + memmove(nu->bezt, tmp, nu->pntsu * sizeof(BezTriple)); + MEM_freeN(tmp); + } + + memset(nu->bezt + nu->pntsu, 0, number * sizeof(BezTriple)); + + for(i=0, tmp= nu->bezt + nu->pntsu; i < number; i++, tmp++) { + tmp->radius= 1.0f; + } + nu->pntsu += number; } /* ~~~~~~~~~~~~~~~~~~~~Non Uniform Rational B Spline calculations ~~~~~~~~~~~ */ @@ -603,7 +640,7 @@ void makeknots(Nurb *nu, short uv) if(nu->knotsu) MEM_freeN(nu->knotsu); if(check_valid_nurb_u(nu)) { nu->knotsu= MEM_callocN(4+sizeof(float)*KNOTSU(nu), "makeknots"); - if(nu->flagu & CU_CYCLIC) { + if(nu->flagu & CU_NURB_CYCLIC) { calcknots(nu->knotsu, nu->pntsu, nu->orderu, 0); /* cyclic should be uniform */ makecyclicknots(nu->knotsu, nu->pntsu, nu->orderu); } else { @@ -616,7 +653,7 @@ void makeknots(Nurb *nu, short uv) if(nu->knotsv) MEM_freeN(nu->knotsv); if(check_valid_nurb_v(nu)) { nu->knotsv= MEM_callocN(4+sizeof(float)*KNOTSV(nu), "makeknots"); - if(nu->flagv & CU_CYCLIC) { + if(nu->flagv & CU_NURB_CYCLIC) { calcknots(nu->knotsv, nu->pntsv, nu->orderv, 0); /* cyclic should be uniform */ makecyclicknots(nu->knotsv, nu->pntsv, nu->orderv); } else { @@ -734,18 +771,18 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride) fp= nu->knotsu; ustart= fp[nu->orderu-1]; - if(nu->flagu & CU_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1]; + if(nu->flagu & CU_NURB_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1]; else uend= fp[nu->pntsu]; - ustep= (uend-ustart)/((nu->flagu & CU_CYCLIC) ? totu : totu - 1); + ustep= (uend-ustart)/((nu->flagu & CU_NURB_CYCLIC) ? totu : totu - 1); basisu= (float *)MEM_mallocN(sizeof(float)*KNOTSU(nu), "makeNurbfaces3"); fp= nu->knotsv; vstart= fp[nu->orderv-1]; - if(nu->flagv & CU_CYCLIC) vend= fp[nu->pntsv+nu->orderv-1]; + if(nu->flagv & CU_NURB_CYCLIC) vend= fp[nu->pntsv+nu->orderv-1]; else vend= fp[nu->pntsv]; - vstep= (vend-vstart)/((nu->flagv & CU_CYCLIC) ? totv : totv - 1); + vstep= (vend-vstart)/((nu->flagv & CU_NURB_CYCLIC) ? totv : totv - 1); len= KNOTSV(nu); basisv= (float *)MEM_mallocN(sizeof(float)*len*totv, "makeNurbfaces3"); @@ -753,7 +790,7 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride) jend= (int *)MEM_mallocN(sizeof(float)*totv, "makeNurbfaces5"); /* precalculation of basisv and jstart,jend */ - if(nu->flagv & CU_CYCLIC) cycl= nu->orderv-1; + if(nu->flagv & CU_NURB_CYCLIC) cycl= nu->orderv-1; else cycl= 0; v= vstart; basis= basisv; @@ -764,7 +801,7 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride) v+= vstep; } - if(nu->flagu & CU_CYCLIC) cycl= nu->orderu-1; + if(nu->flagu & CU_NURB_CYCLIC) cycl= nu->orderu-1; else cycl= 0; in= coord_array; u= ustart; @@ -882,13 +919,13 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu fp= nu->knotsu; ustart= fp[nu->orderu-1]; - if(nu->flagu & CU_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1]; + if(nu->flagu & CU_NURB_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1]; else uend= fp[nu->pntsu]; - ustep= (uend-ustart)/(resolu - ((nu->flagu & CU_CYCLIC) ? 0 : 1)); + ustep= (uend-ustart)/(resolu - ((nu->flagu & CU_NURB_CYCLIC) ? 0 : 1)); basisu= (float *)MEM_mallocN(sizeof(float)*KNOTSU(nu), "makeNurbcurve3"); - if(nu->flagu & CU_CYCLIC) cycl= nu->orderu-1; + if(nu->flagu & CU_NURB_CYCLIC) cycl= nu->orderu-1; else cycl= 0; u= ustart; @@ -1022,8 +1059,8 @@ float *make_orco_surf(Object *ob) sizeu = nu->pntsu*nu->resolu; sizev = nu->pntsv*nu->resolv; - if (nu->flagu & CU_CYCLIC) sizeu++; - if (nu->flagv & CU_CYCLIC) sizev++; + if (nu->flagu & CU_NURB_CYCLIC) sizeu++; + if (nu->flagv & CU_NURB_CYCLIC) sizev++; if(nu->pntsv>1) tot+= sizeu * sizev; nu= nu->next; @@ -1036,8 +1073,8 @@ float *make_orco_surf(Object *ob) if(nu->pntsv>1) { sizeu = nu->pntsu*nu->resolu; sizev = nu->pntsv*nu->resolv; - if (nu->flagu & CU_CYCLIC) sizeu++; - if (nu->flagv & CU_CYCLIC) sizev++; + if (nu->flagu & CU_NURB_CYCLIC) sizeu++; + if (nu->flagv & CU_NURB_CYCLIC) sizev++; if(cu->flag & CU_UV_ORCO) { for(b=0; b< sizeu; b++) { @@ -1063,12 +1100,12 @@ float *make_orco_surf(Object *ob) for(b=0; b<sizeu; b++) { int use_b= b; - if (b==sizeu-1 && (nu->flagu & CU_CYCLIC)) + if (b==sizeu-1 && (nu->flagu & CU_NURB_CYCLIC)) use_b= 0; for(a=0; a<sizev; a++) { int use_a= a; - if (a==sizev-1 && (nu->flagv & CU_CYCLIC)) + if (a==sizev-1 && (nu->flagv & CU_NURB_CYCLIC)) use_a= 0; tdata = _tdata + 3 * (use_b * (nu->pntsv*nu->resolv) + use_a); @@ -1511,14 +1548,14 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float * /* returns a point */ if(prevbezt==nu->bezt) { - if(nu->flagu & CU_CYCLIC) pprev= last; + if(nu->flagu & CU_NURB_CYCLIC) pprev= last; else pprev= prevbezt; } else pprev= prevbezt-1; /* next point */ if(bezt==last) { - if(nu->flagu & CU_CYCLIC) next= nu->bezt; + if(nu->flagu & CU_NURB_CYCLIC) next= nu->bezt; else next= bezt; } else next= bezt+1; @@ -1977,7 +2014,7 @@ void makeBevelList(Object *ob) bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelList2"); BLI_addtail(&(cu->bev), bl); - if(nu->flagu & CU_CYCLIC) bl->poly= 0; + if(nu->flagu & CU_NURB_CYCLIC) bl->poly= 0; else bl->poly= -1; bl->nr= len; bl->dupe_nr= 0; @@ -1995,17 +2032,17 @@ void makeBevelList(Object *ob) } else if(nu->type == CU_BEZIER) { - len= resolu*(nu->pntsu+ (nu->flagu & CU_CYCLIC) -1)+1; /* in case last point is not cyclic */ + len= resolu*(nu->pntsu+ (nu->flagu & CU_NURB_CYCLIC) -1)+1; /* in case last point is not cyclic */ bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelBPoints"); BLI_addtail(&(cu->bev), bl); - if(nu->flagu & CU_CYCLIC) bl->poly= 0; + if(nu->flagu & CU_NURB_CYCLIC) bl->poly= 0; else bl->poly= -1; bevp= (BevPoint *)(bl+1); a= nu->pntsu-1; bezt= nu->bezt; - if(nu->flagu & CU_CYCLIC) { + if(nu->flagu & CU_NURB_CYCLIC) { a++; prevbezt= nu->bezt+(nu->pntsu-1); } @@ -2066,7 +2103,7 @@ void makeBevelList(Object *ob) bezt++; } - if((nu->flagu & CU_CYCLIC)==0) { /* not cyclic: endpoint */ + if((nu->flagu & CU_NURB_CYCLIC)==0) { /* not cyclic: endpoint */ VECCOPY(bevp->vec, prevbezt->vec[1]); bevp->alfa= prevbezt->alfa; bevp->radius= prevbezt->radius; @@ -2081,7 +2118,7 @@ void makeBevelList(Object *ob) BLI_addtail(&(cu->bev), bl); bl->nr= len; bl->dupe_nr= 0; - if(nu->flagu & CU_CYCLIC) bl->poly= 0; + if(nu->flagu & CU_NURB_CYCLIC) bl->poly= 0; else bl->poly= -1; bevp= (BevPoint *)(bl+1); @@ -2521,7 +2558,7 @@ void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */ a= nu->pntsu; bezt= nu->bezt; - if(nu->flagu & CU_CYCLIC) prev= bezt+(a-1); + if(nu->flagu & CU_NURB_CYCLIC) prev= bezt+(a-1); else prev= 0; next= bezt+1; @@ -2529,7 +2566,7 @@ void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */ calchandleNurb(bezt, prev, next, 0); prev= bezt; if(a==1) { - if(nu->flagu & CU_CYCLIC) next= nu->bezt; + if(nu->flagu & CU_NURB_CYCLIC) next= nu->bezt; else next= 0; } else next++; @@ -2986,7 +3023,7 @@ int check_valid_nurb_u( struct Nurb *nu ) if (nu->type != CU_NURBS) return 1; /* not a nurb, lets assume its valid */ if (nu->pntsu < nu->orderu) return 0; - if (((nu->flag & CU_CYCLIC)==0) && ((nu->flagu>>1) & 2)) { /* Bezier U Endpoints */ + if (((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagu & CU_NURB_BEZIER)) { /* Bezier U Endpoints */ if (nu->orderu==4) { if (nu->pntsu < 5) return 0; /* bezier with 4 orderu needs 5 points */ } else if (nu->orderu != 3) return 0; /* order must be 3 or 4 */ @@ -3000,7 +3037,7 @@ int check_valid_nurb_v( struct Nurb *nu) if (nu->type != CU_NURBS) return 1; /* not a nurb, lets assume its valid */ if (nu->pntsv < nu->orderv) return 0; - if (((nu->flag & CU_CYCLIC)==0) && ((nu->flagv>>1) & 2)) { /* Bezier V Endpoints */ + if (((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagv & CU_NURB_BEZIER)) { /* Bezier V Endpoints */ if (nu->orderv==4) { if (nu->pntsv < 5) return 0; /* bezier with 4 orderu needs 5 points */ } else if (nu->orderv != 3) return 0; /* order must be 3 or 4 */ @@ -3015,7 +3052,7 @@ int clamp_nurb_order_u( struct Nurb *nu ) nu->orderu= nu->pntsu; change= 1; } - if(((nu->flag & CU_CYCLIC)==0) && (nu->flagu>>1)&2) { + if(((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagu & CU_NURB_BEZIER)) { CLAMP(nu->orderu, 3,4); change= 1; } @@ -3029,7 +3066,7 @@ int clamp_nurb_order_v( struct Nurb *nu) nu->orderv= nu->pntsv; change= 1; } - if(((nu->flag & CU_CYCLIC)==0) && (nu->flagv>>1)&2) { + if(((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagv & CU_NURB_BEZIER)) { CLAMP(nu->orderv, 3,4); change= 1; } diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 07960dd2fa0..a0eef4d666e 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -37,16 +37,12 @@ #include "MEM_guardedalloc.h" -#include "DNA_customdata_types.h" -#include "DNA_listBase.h" #include "DNA_meshdata_types.h" #include "DNA_ID.h" #include "BLI_blenlib.h" #include "BLI_linklist.h" -#include "BLI_math.h" #include "BLI_mempool.h" -#include "BLI_string.h" #include "BKE_customdata.h" #include "BKE_customdata_file.h" diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 728f77cd618..0ae8169cc67 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -38,29 +38,12 @@ #include "MEM_guardedalloc.h" -#include "DNA_curve_types.h" -#include "DNA_effect_types.h" -#include "DNA_lattice_types.h" -#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" -#include "DNA_object_force.h" -#include "DNA_scene_types.h" -#include "BKE_curve.h" #include "BKE_deform.h" -#include "BKE_displist.h" -#include "BKE_effect.h" -#include "BKE_global.h" -#include "BKE_key.h" -#include "BKE_lattice.h" -#include "BKE_object.h" -#include "BKE_softbody.h" -#include "BKE_utildefines.h" -#include "BKE_mesh.h" #include "BLI_blenlib.h" -#include "BLI_math.h" #ifdef HAVE_CONFIG_H #include <config.h> diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 155cc2af05e..397a0526160 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -29,35 +29,16 @@ #include <string.h> #include <math.h> -#include "BLI_blenlib.h" -#include "BLI_math.h" #include "BLI_winstuff.h" #include "DNA_anim_types.h" -#include "DNA_action_types.h" -#include "DNA_armature_types.h" -#include "DNA_boid_types.h" -#include "DNA_curve_types.h" #include "DNA_camera_types.h" -#include "DNA_ID.h" -#include "DNA_effect_types.h" #include "DNA_group_types.h" #include "DNA_lattice_types.h" -#include "DNA_lamp_types.h" #include "DNA_key_types.h" #include "DNA_mesh_types.h" -#include "DNA_modifier_types.h" -#include "DNA_nla_types.h" -#include "DNA_object_types.h" -#include "DNA_object_force.h" -#include "DNA_object_fluidsim.h" -#include "DNA_outliner_types.h" -#include "DNA_particle_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" -#include "DNA_space_types.h" -#include "DNA_view2d_types.h" -#include "DNA_view3d_types.h" #include "DNA_windowmanager_types.h" #include "BLI_ghash.h" @@ -75,7 +56,6 @@ #include "BKE_object.h" #include "BKE_particle.h" #include "BKE_pointcache.h" -#include "BKE_utildefines.h" #include "BKE_scene.h" #include "BKE_screen.h" diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index ee746a4dacd..ed7d11872c1 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -35,55 +35,28 @@ #include "MEM_guardedalloc.h" -#include "IMB_imbuf_types.h" -#include "DNA_texture_types.h" -#include "DNA_meta_types.h" #include "DNA_curve_types.h" -#include "DNA_effect_types.h" -#include "DNA_listBase.h" -#include "DNA_lamp_types.h" -#include "DNA_object_types.h" -#include "DNA_object_force.h" -#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" -#include "DNA_modifier_types.h" #include "DNA_scene_types.h" -#include "DNA_image_types.h" #include "DNA_material_types.h" -#include "DNA_view3d_types.h" -#include "DNA_lattice_types.h" -#include "DNA_key_types.h" #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_editVert.h" -#include "BLI_edgehash.h" -#include "BKE_utildefines.h" #include "BKE_global.h" #include "BKE_displist.h" -#include "BKE_deform.h" -#include "BKE_DerivedMesh.h" #include "BKE_cdderivedmesh.h" #include "BKE_object.h" -#include "BKE_world.h" -#include "BKE_mesh.h" -#include "BKE_effect.h" #include "BKE_mball.h" #include "BKE_material.h" #include "BKE_curve.h" #include "BKE_key.h" #include "BKE_anim.h" -#include "BKE_screen.h" -#include "BKE_texture.h" -#include "BKE_library.h" #include "BKE_font.h" #include "BKE_lattice.h" -#include "BKE_scene.h" -#include "BKE_subsurf.h" #include "BKE_modifier.h" -#include "BKE_customdata.h" #include "RE_pipeline.h" #include "RE_shader_ext.h" @@ -840,17 +813,17 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase) /* count */ len= 0; a= nu->pntsu-1; - if(nu->flagu & CU_CYCLIC) a++; + if(nu->flagu & CU_NURB_CYCLIC) a++; prevbezt= nu->bezt; bezt= prevbezt+1; while(a--) { - if(a==0 && (nu->flagu & CU_CYCLIC)) bezt= nu->bezt; + if(a==0 && (nu->flagu & CU_NURB_CYCLIC)) bezt= nu->bezt; if(prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) len++; else len+= resolu; - if(a==0 && (nu->flagu & CU_CYCLIC)==0) len++; + if(a==0 && (nu->flagu & CU_NURB_CYCLIC)==0) len++; prevbezt= bezt; bezt++; @@ -867,7 +840,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase) data= dl->verts; - if(nu->flagu & CU_CYCLIC) { + if(nu->flagu & CU_NURB_CYCLIC) { dl->type= DL_POLY; a= nu->pntsu; } @@ -920,7 +893,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase) dl->charidx = nu->charidx; data= dl->verts; - if(nu->flagu & CU_CYCLIC) dl->type= DL_POLY; + if(nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY; else dl->type= DL_SEGM; makeNurbcurve(nu, data, NULL, NULL, resolu, 3*sizeof(float)); } @@ -935,7 +908,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase) dl->charidx = nu->charidx; data= dl->verts; - if(nu->flagu & CU_CYCLIC) dl->type= DL_POLY; + if(nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY; else dl->type= DL_SEGM; a= len; @@ -1391,7 +1364,11 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba CDDM_calc_normals(dm); } } else { - dm= CDDM_from_curve(ob); + if (ELEM(ob->type, OB_CURVE, OB_FONT) && (cu->flag & CU_DEFORM_FILL)) { + curve_to_filledpoly(cu, nurb, &cu->disp); + } + + dm= CDDM_from_curve_customDB(ob, dispbase); if(dmDeformedVerts) { CDDM_apply_vert_coords(dm, dmDeformedVerts); @@ -1606,7 +1583,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase, dl->rt= nu->flag; data= dl->verts; - if(nu->flagu & CU_CYCLIC) dl->type= DL_POLY; + if(nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY; else dl->type= DL_SEGM; makeNurbcurve(nu, data, NULL, NULL, nu->resolu, 3*sizeof(float)); @@ -1627,8 +1604,8 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase, dl->parts= (nu->pntsu*nu->resolu); /* in reverse, because makeNurbfaces works that way */ dl->nr= (nu->pntsv*nu->resolv); - if(nu->flagv & CU_CYCLIC) dl->flag|= DL_CYCL_U; /* reverse too! */ - if(nu->flagu & CU_CYCLIC) dl->flag|= DL_CYCL_V; + if(nu->flagv & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_U; /* reverse too! */ + if(nu->flagu & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_V; makeNurbfaces(nu, data, 0); @@ -1801,7 +1778,9 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba freedisplist(&dlbev); } - curve_to_filledpoly(cu, nubase, dispbase); + if (!(cu->flag & CU_DEFORM_FILL)) { + curve_to_filledpoly(cu, nubase, dispbase); + } if(cu->flag & CU_PATH) calc_curvepath(ob); @@ -1810,6 +1789,10 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba } if(!forOrco) curve_calc_modifiers_post(scene, ob, dispbase, derivedFinal, forRender, originalVerts, deformedVerts); + + if (cu->flag & CU_DEFORM_FILL && !ob->derivedFinal) { + curve_to_filledpoly(cu, nubase, dispbase); + } } } diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c index 9902503950b..772a589f520 100644 --- a/source/blender/blenkernel/intern/exotic.c +++ b/source/blender/blenkernel/intern/exotic.c @@ -55,35 +55,26 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_material_types.h" -#include "DNA_lamp_types.h" #include "DNA_curve_types.h" -#include "DNA_image_types.h" #include "DNA_camera_types.h" #include "DNA_scene_types.h" -#include "DNA_view3d_types.h" -#include "DNA_userdef_types.h" #include "BKE_utildefines.h" #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BKE_blender.h" #include "BKE_global.h" #include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_library.h" -#include "BKE_global.h" #include "BKE_object.h" #include "BKE_material.h" -#include "BKE_exotic.h" #include "BKE_report.h" -#include "BKE_screen.h" #include "BKE_displist.h" #include "BKE_DerivedMesh.h" #include "BKE_curve.h" -#include "BKE_customdata.h" #ifndef DISABLE_PYTHON #include "BPY_extern.h" diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 807a723685a..5bfef86b7c6 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -45,7 +45,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_noise.h" #include "BKE_fcurve.h" #include "BKE_animsys.h" @@ -53,12 +52,10 @@ #include "BKE_armature.h" #include "BKE_curve.h" #include "BKE_global.h" -#include "BKE_idprop.h" #include "BKE_object.h" #include "BKE_utildefines.h" #include "RNA_access.h" -#include "RNA_types.h" #ifndef DISABLE_PYTHON #include "BPY_extern.h" diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index bbef3227490..6c73a3ae64c 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -41,18 +41,12 @@ #include "DNA_anim_types.h" #include "BLI_blenlib.h" -#include "BLI_math.h" -#include "BLI_noise.h" +#include "BLI_math.h" /* windows needs for M_PI */ #include "BKE_fcurve.h" -#include "BKE_curve.h" -#include "BKE_global.h" #include "BKE_idprop.h" #include "BKE_utildefines.h" -#include "RNA_access.h" -#include "RNA_types.h" - #ifndef DISABLE_PYTHON #include "BPY_extern.h" /* for BPY_pydriver_eval() */ #endif @@ -871,6 +865,59 @@ static FModifierTypeInfo FMI_LIMITS = { fcm_limits_evaluate /* evaluate */ }; +/* Stepped F-Curve Modifier --------------------------- */ + +static void fcm_stepped_new_data (void *mdata) +{ + FMod_Stepped *data= (FMod_Stepped *)mdata; + + /* just need to set the step-size to 2-frames by default */ + // XXX: or would 5 be more normal? + data->step_size = 2.0f; +} + +static float fcm_stepped_time (FCurve *fcu, FModifier *fcm, float cvalue, float evaltime) +{ + FMod_Stepped *data= (FMod_Stepped *)fcm->data; + int snapblock; + + /* check range clamping to see if we should alter the timing to achieve the desired results */ + if (data->flag & FCM_STEPPED_NO_BEFORE) { + if (evaltime < data->start_frame) + return evaltime; + } + if (data->flag & FCM_STEPPED_NO_AFTER) { + if (evaltime > data->end_frame) + return evaltime; + } + + /* we snap to the start of the previous closest block of 'step_size' frames + * after the start offset has been discarded + * - i.e. round down + */ + snapblock = (int)((evaltime - data->offset) / data->step_size); + + /* reapply the offset, and multiple the snapblock by the size of the steps to get + * the new time to evaluate at + */ + return ((float)snapblock * data->step_size) + data->offset; +} + +static FModifierTypeInfo FMI_STEPPED = { + FMODIFIER_TYPE_STEPPED, /* type */ + sizeof(FMod_Limits), /* size */ + FMI_TYPE_GENERATE_CURVE, /* action type */ /* XXX... err... */ + FMI_REQUIRES_RUNTIME_CHECK, /* requirements */ + "Stepped", /* name */ + "FMod_Stepped", /* struct name */ + NULL, /* free data */ + NULL, /* copy data */ + fcm_stepped_new_data, /* new data */ + NULL, /* verify */ + fcm_stepped_time, /* evaluate time */ + NULL /* evaluate */ +}; + /* F-Curve Modifier API --------------------------- */ /* All of the F-Curve Modifier api functions use FModifierTypeInfo structs to carry out * and operations that involve F-Curve modifier specific code. @@ -892,6 +939,7 @@ static void fmods_init_typeinfo () fmodifiersTypeInfo[6]= NULL/*&FMI_FILTER*/; /* Filter F-Curve Modifier */ // XXX unimplemented fmodifiersTypeInfo[7]= &FMI_PYTHON; /* Custom Python F-Curve Modifier */ fmodifiersTypeInfo[8]= &FMI_LIMITS; /* Limits F-Curve Modifier */ + fmodifiersTypeInfo[9]= &FMI_STEPPED; /* Stepped F-Curve Modifier */ } /* This function should be used for getting the appropriate type-info when only @@ -968,6 +1016,31 @@ FModifier *add_fmodifier (ListBase *modifiers, int type) return fcm; } +/* Make a copy of the specified F-Modifier */ +FModifier *copy_fmodifier (FModifier *src) +{ + FModifierTypeInfo *fmi= fmodifier_get_typeinfo(src); + FModifier *dst; + + /* sanity check */ + if (src == NULL) + return NULL; + + /* copy the base data, clearing the links */ + dst = MEM_dupallocN(src); + dst->next = dst->prev = NULL; + + /* make a new copy of the F-Modifier's data */ + dst->data = MEM_dupallocN(src->data); + + /* only do specific constraints if required */ + if (fmi && fmi->copy_data) + fmi->copy_data(dst, src); + + /* return the new modifier */ + return dst; +} + /* Duplicate all of the F-Modifiers in the Modifier stacks */ void copy_fmodifiers (ListBase *dst, ListBase *src) { @@ -1132,14 +1205,20 @@ short list_has_suitable_fmodifier (ListBase *modifiers, int mtype, short acttype float evaluate_time_fmodifiers (ListBase *modifiers, FCurve *fcu, float cvalue, float evaltime) { FModifier *fcm; - float m_evaltime= evaltime; /* sanity checks */ if ELEM(NULL, modifiers, modifiers->last) return evaltime; - /* find the first modifier from end of stack that modifies time, and calculate the time the modifier - * would calculate time at + /* Starting from the end of the stack, calculate the time effects of various stacked modifiers + * on the time the F-Curve should be evaluated at. + * + * This is done in reverse order to standard evaluation, as when this is done in standard + * order, each modifier would cause jumps to other points in the curve, forcing all + * previous ones to be evaluated again for them to be correct. However, if we did in the + * reverse order as we have here, we can consider them a macro to micro type of waterfall + * effect, which should get us the desired effects when using layered time manipulations + * (such as multiple 'stepped' modifiers in sequence, causing different stepping rates) */ for (fcm= modifiers->last; fcm; fcm= fcm->prev) { FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm); @@ -1148,13 +1227,12 @@ float evaluate_time_fmodifiers (ListBase *modifiers, FCurve *fcu, float cvalue, // TODO: implement the 'influence' control feature... if (fmi && fmi->evaluate_modifier_time) { if ((fcm->flag & (FMODIFIER_FLAG_DISABLED|FMODIFIER_FLAG_MUTED)) == 0) - m_evaltime= fmi->evaluate_modifier_time(fcu, fcm, cvalue, evaltime); - break; + evaltime= fmi->evaluate_modifier_time(fcu, fcm, cvalue, evaltime); } } /* return the modified evaltime */ - return m_evaltime; + return evaltime; } /* Evalautes the given set of F-Curve Modifiers using the given data diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 36bb031744e..1ca39bbaac4 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -47,8 +47,6 @@ #include "DNA_packedFile_types.h" #include "DNA_curve_types.h" -#include "DNA_object_types.h" -#include "DNA_view3d_types.h" #include "DNA_vfont_types.h" #include "DNA_scene_types.h" @@ -60,7 +58,6 @@ #include "BKE_font.h" #include "BKE_global.h" #include "BKE_main.h" -#include "BKE_screen.h" #include "BKE_anim.h" #include "BKE_curve.h" #include "BKE_displist.h" @@ -473,7 +470,7 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i nu2->pntsv = 1; nu2->orderu = 4; nu2->orderv = 1; - nu2->flagu = CU_CYCLIC; + nu2->flagu = CU_NURB_CYCLIC; bp = (BPoint*)MEM_callocN(4 * sizeof(BPoint),"underline_bp"); if (bp == 0){ @@ -960,7 +957,8 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) } /* TEXT ON CURVE */ - if(cu->textoncurve) { + /* Note: Only OB_CURVE objects could have a path */ + if(cu->textoncurve && cu->textoncurve->type==OB_CURVE) { Curve *cucu= cu->textoncurve->data; int oldflag= cucu->flag; diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index c65961d0953..5612d69ed76 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -33,27 +33,13 @@ #include "MEM_guardedalloc.h" -#include "IMB_imbuf.h" -#include "IMB_imbuf_types.h" -#include "BLI_math.h" #include "BLI_blenlib.h" -#include "DNA_listBase.h" #include "DNA_gpencil_types.h" -#include "DNA_object_types.h" -#include "DNA_scene_types.h" -#include "DNA_screen_types.h" -#include "DNA_space_types.h" -#include "DNA_userdef_types.h" -#include "DNA_vec_types.h" -#include "BKE_blender.h" -#include "BKE_context.h" -#include "BKE_curve.h" #include "BKE_global.h" #include "BKE_gpencil.h" -#include "BKE_image.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_utildefines.h" diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index 4f768bbad23..5f35ab87cb2 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -32,11 +32,7 @@ #include "MEM_guardedalloc.h" -#include "DNA_action_types.h" -#include "DNA_effect_types.h" #include "DNA_group_types.h" -#include "DNA_ID.h" -#include "DNA_ipo_types.h" #include "DNA_material_types.h" #include "DNA_object_types.h" #include "DNA_nla_types.h" @@ -47,7 +43,6 @@ #include "BKE_global.h" #include "BKE_group.h" -#include "BKE_ipo.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_object.h" diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index 1f22e8c1e3f..5580c73099e 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -38,8 +38,6 @@ #include "MEM_guardedalloc.h" -#include "DNA_ID.h" -#include "DNA_image_types.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" #include "DNA_texture_types.h" @@ -48,7 +46,6 @@ #include "BLI_ghash.h" #include "BKE_icons.h" -#include "BKE_utildefines.h" #include "BKE_global.h" /* only for G.background test */ #include "BLO_sys_types.h" // for intptr_t support diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 37aee8fb4aa..7981c66d2f6 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -1,5 +1,5 @@ /** - * $Id: idprop.c + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -29,13 +29,8 @@ #include <stdlib.h> #include <string.h> -#include "DNA_listBase.h" -#include "DNA_ID.h" - #include "BKE_idprop.h" -#include "BKE_global.h" #include "BKE_library.h" -#include "BKE_utildefines.h" #include "BLI_blenlib.h" diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index ee3d685938b..85f15094740 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -52,16 +52,12 @@ #include "intern/openexr/openexr_multi.h" #endif -#include "DNA_image_types.h" #include "DNA_packedFile_types.h" #include "DNA_scene_types.h" #include "DNA_camera_types.h" #include "DNA_sequence_types.h" -#include "DNA_texture_types.h" -#include "DNA_sequence_types.h" #include "DNA_userdef_types.h" -#include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_threads.h" @@ -73,8 +69,6 @@ #include "BKE_main.h" #include "BKE_packedFile.h" #include "BKE_scene.h" -#include "BKE_texture.h" -#include "BKE_utildefines.h" //XXX #include "BIF_editseq.h" @@ -84,7 +78,6 @@ #include "RE_pipeline.h" -#include "GPU_extensions.h" #include "GPU_draw.h" #include "BLO_sys_types.h" // for intptr_t support @@ -438,11 +431,8 @@ Image *BKE_add_image_file(const char *name, int frame) static ImBuf *add_ibuf_size(int width, int height, char *name, int floatbuf, short uvtestgrid, float color[4]) { ImBuf *ibuf; - float h=0.0, hoffs=0.0, hue=0.0, s=0.9, v=0.9, r, g, b; unsigned char *rect= NULL; float *rect_float= NULL; - int x, y; - int checkerwidth=32, dark=1; if (floatbuf) { ibuf= IMB_allocImBuf(width, height, 24, IB_rectfloat, 0); @@ -456,107 +446,17 @@ static ImBuf *add_ibuf_size(int width, int height, char *name, int floatbuf, sho strcpy(ibuf->name, "//Untitled"); ibuf->userflags |= IB_BITMAPDIRTY; - if (uvtestgrid) { - /* these two passes could be combined into one, but it's more readable and - * easy to tweak like this, speed isn't really that much of an issue in this situation... */ - - /* checkers */ - for(y=0; y<height; y++) { - dark = powf(-1.0f, floorf(y / checkerwidth)); - - for(x=0; x<width; x++) { - if (x % checkerwidth == 0) dark *= -1; - - if (floatbuf) { - if (dark > 0) { - rect_float[0] = rect_float[1] = rect_float[2] = 0.25f; - rect_float[3] = 1.0f; - } else { - rect_float[0] = rect_float[1] = rect_float[2] = 0.58f; - rect_float[3] = 1.0f; - } - rect_float+=4; - } - else { - if (dark > 0) { - rect[0] = rect[1] = rect[2] = 64; - rect[3] = 255; - } else { - rect[0] = rect[1] = rect[2] = 150; - rect[3] = 255; - } - rect += 4; - } - } - } - - /* 2nd pass, colored + */ - if (floatbuf) rect_float= (float*)ibuf->rect_float; - else rect= (unsigned char*)ibuf->rect; - - for(y=0; y<height; y++) { - hoffs = 0.125f * floorf(y / checkerwidth); - - for(x=0; x<width; x++) { - h = 0.125f * floorf(x / checkerwidth); - - if ((fabs((x % checkerwidth) - (checkerwidth / 2)) < 4) && - (fabs((y % checkerwidth) - (checkerwidth / 2)) < 4)) { - - if ((fabs((x % checkerwidth) - (checkerwidth / 2)) < 1) || - (fabs((y % checkerwidth) - (checkerwidth / 2)) < 1)) { - - hue = fmodf(fabs(h-hoffs), 1.0f); - hsv_to_rgb(hue, s, v, &r, &g, &b); - - if (floatbuf) { - rect_float[0]= r; - rect_float[1]= g; - rect_float[2]= b; - rect_float[3]= 1.0f; - } - else { - rect[0]= (char)(r * 255.0f); - rect[1]= (char)(g * 255.0f); - rect[2]= (char)(b * 255.0f); - rect[3]= 255; - } - } - } + switch(uvtestgrid) { + case 1: + BKE_image_buf_fill_checker(rect, rect_float, width, height); + break; + case 2: + BKE_image_buf_fill_checker_color(rect, rect_float, width, height); + break; + default: + BKE_image_buf_fill_color(rect, rect_float, width, height, color); + } - if (floatbuf) - rect_float+=4; - else - rect+=4; - } - } - } else { /* blank image */ - char ccol[4]; - - ccol[0]= (char)(color[0]*255.0f); - ccol[1]= (char)(color[1]*255.0f); - ccol[2]= (char)(color[2]*255.0f); - ccol[3]= (char)(color[3]*255.0f); - - for(y=0; y<height; y++) { - for(x=0; x<width; x++) { - if (floatbuf) { - rect_float[0]= color[0]; - rect_float[1]= color[1]; - rect_float[2]= color[2]; - rect_float[3]= color[3]; - rect_float+=4; - } - else { - rect[0]= ccol[0]; - rect[1]= ccol[1]; - rect[2]= ccol[2]; - rect[3]= ccol[3]; - rect+=4; - } - } - } - } return ibuf; } @@ -1124,7 +1024,7 @@ extern int datatoc_bmonofont_ttf_size; extern char datatoc_bmonofont_ttf[]; // XXX - copied from text_font_begin -static void stamp_font_begin(int size) +void stamp_font_begin(int size) { static int mono= -1; @@ -1932,113 +1832,93 @@ static ImBuf *image_get_ibuf_multilayer(Image *ima, ImageUser *iuser) /* always returns a single ibuf, also during render progress */ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_r) { - Render *re= NULL; - RenderResult *rr= NULL; - + Render *re; + RenderResult rres; + float *rectf, *rectz; + unsigned int *rect; + float dither; + int channels, layer, pass; + ImBuf *ibuf; + + if(!(iuser && iuser->scene)) + return NULL; + /* if we the caller is not going to release the lock, don't give the image */ if(!lock_r) return NULL; - if(iuser && iuser->scene) { - re= RE_GetRender(iuser->scene->id.name, RE_SLOT_VIEW); - rr= RE_AcquireResultRead(re); + re= RE_GetRender(iuser->scene->id.name, RE_SLOT_VIEW); + + channels= 4; + layer= (iuser)? iuser->layer: 0; + pass= (iuser)? iuser->pass: 0; + + /* this gives active layer, composite or seqence result */ + RE_AcquireResultImage(re, &rres); + rect= (unsigned int *)rres.rect32; + rectf= rres.rectf; + rectz= rres.rectz; + dither= iuser->scene->r.dither_intensity; + + /* get compo/seq result by default */ + if(rres.rectf && layer==0); + else if(rres.layers.first) { + RenderLayer *rl= BLI_findlink(&rres.layers, layer-(rres.rectf?1:0)); + if(rl) { + RenderPass *rpass; + + /* there's no combined pass, is in renderlayer itself */ + if(pass==0) { + rectf= rl->rectf; + } + else { + rpass= BLI_findlink(&rl->passes, pass-1); + if(rpass) { + channels= rpass->channels; + rectf= rpass->rect; + dither= 0.0f; /* don't dither passes */ + } + } - /* release is done in BKE_image_release_ibuf using lock_r */ - *lock_r= re; + for(rpass= rl->passes.first; rpass; rpass= rpass->next) + if(rpass->passtype == SCE_PASS_Z) + rectz= rpass->rect; + } } - - if(rr==NULL) - return NULL; - if(RE_RenderInProgress(re)) { - ImBuf *ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0); - - /* make ibuf if needed, and initialize it */ - /* this only gets called when mutex locked */ - if(ibuf==NULL) { - ibuf= IMB_allocImBuf(rr->rectx, rr->recty, 32, IB_rect, 0); - image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0); - } - - return ibuf; + if(!(rectf || rect)) { + RE_ReleaseResultImage(re); + return NULL; } - else { - RenderResult rres; - float *rectf, *rectz; - unsigned int *rect; - float dither; - int channels, layer, pass; - - channels= 4; - layer= (iuser)? iuser->layer: 0; - pass= (iuser)? iuser->pass: 0; - - /* this gives active layer, composite or seqence result */ - RE_AcquireResultImage(RE_GetRender(iuser->scene->id.name, RE_SLOT_VIEW), &rres); - rect= (unsigned int *)rres.rect32; - rectf= rres.rectf; - rectz= rres.rectz; - dither= iuser->scene->r.dither_intensity; - - /* get compo/seq result by default */ - if(rr->rectf && layer==0); - else if(rr->layers.first) { - RenderLayer *rl= BLI_findlink(&rr->layers, layer-(rr->rectf?1:0)); - if(rl) { - RenderPass *rpass; - - /* there's no combined pass, is in renderlayer itself */ - if(pass==0) { - rectf= rl->rectf; - } - else { - rpass= BLI_findlink(&rl->passes, pass-1); - if(rpass) { - channels= rpass->channels; - rectf= rpass->rect; - dither= 0.0f; /* don't dither passes */ - } - } - for(rpass= rl->passes.first; rpass; rpass= rpass->next) - if(rpass->passtype == SCE_PASS_Z) - rectz= rpass->rect; - } - } - - if(rectf || rect) { - ImBuf *ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0); + ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0); - /* make ibuf if needed, and initialize it */ - if(ibuf==NULL) { - ibuf= IMB_allocImBuf(rr->rectx, rr->recty, 32, 0, 0); - image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0); - } - ibuf->x= rr->rectx; - ibuf->y= rr->recty; - - if(ibuf->rect_float!=rectf || rect) /* ensure correct redraw */ - imb_freerectImBuf(ibuf); - if(rect) - ibuf->rect= rect; - - ibuf->rect_float= rectf; - ibuf->flags |= IB_rectfloat; - ibuf->channels= channels; - ibuf->zbuf_float= rectz; - ibuf->flags |= IB_zbuffloat; - ibuf->dither= dither; + /* make ibuf if needed, and initialize it */ + if(ibuf==NULL) { + ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, 0, 0); + image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0); + } + ibuf->x= rres.rectx; + ibuf->y= rres.recty; + + if(ibuf->rect_float!=rectf || rect) /* ensure correct redraw */ + imb_freerectImBuf(ibuf); + if(rect) + ibuf->rect= rect; + + ibuf->rect_float= rectf; + ibuf->flags |= IB_rectfloat; + ibuf->channels= channels; + ibuf->zbuf_float= rectz; + ibuf->flags |= IB_zbuffloat; + ibuf->dither= dither; - RE_ReleaseResultImage(re); + ima->ok= IMA_OK_LOADED; - ima->ok= IMA_OK_LOADED; - return ibuf; - } + /* release is done in BKE_image_release_ibuf using lock_r */ + *lock_r= re; - RE_ReleaseResultImage(re); - } - - return NULL; + return ibuf; } static ImBuf *image_get_ibuf_threadsafe(Image *ima, ImageUser *iuser, int *frame_r, int *index_r) @@ -2199,10 +2079,17 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r) ibuf= image_get_render_result(ima, iuser, lock_r); } else if(ima->type==IMA_TYPE_COMPOSITE) { - /* Composite Viewer, all handled in compositor */ - /* fake ibuf, will be filled in compositor */ - ibuf= IMB_allocImBuf(256, 256, 32, IB_rect, 0); - image_assign_ibuf(ima, ibuf, 0, frame); + /* requires lock/unlock, otherwise don't return image */ + if(lock_r) { + /* unlock in BKE_image_release_ibuf */ + BLI_lock_thread(LOCK_VIEWER); + *lock_r= ima; + + /* Composite Viewer, all handled in compositor */ + /* fake ibuf, will be filled in compositor */ + ibuf= IMB_allocImBuf(256, 256, 32, IB_rect, 0); + image_assign_ibuf(ima, ibuf, 0, frame); + } } } } @@ -2220,9 +2107,11 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r) void BKE_image_release_ibuf(Image *ima, void *lock) { - /* for getting image during threaded render, need to release */ - if(lock) - RE_ReleaseResult(lock); + /* for getting image during threaded render / compositing, need to release */ + if(lock == ima) + BLI_unlock_thread(LOCK_VIEWER); /* viewer image */ + else if(lock) + RE_ReleaseResultImage(lock); /* render result */ } ImBuf *BKE_image_get_ibuf(Image *ima, ImageUser *iuser) diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c new file mode 100644 index 00000000000..2c4851b1835 --- /dev/null +++ b/source/blender/blenkernel/intern/image_gen.c @@ -0,0 +1,367 @@ +/* image_gen.c + * + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Matt Ebb, Campbell Barton, Shuvro Sarker + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include <math.h> +#include "BLI_math_color.h" +#include "BLF_api.h" + +void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width, int height, float color[4]) +{ + int x, y; + + /* blank image */ + if(rect_float) { + for(y= 0; y<height; y++) { + for(x= 0; x<width; x++) { + rect_float[0]= color[0]; + rect_float[1]= color[1]; + rect_float[2]= color[2]; + rect_float[3]= color[3]; + rect_float+= 4; + } + } + } + + if(rect) { + char ccol[4]; + + ccol[0]= (char)(color[0]*255.0f); + ccol[1]= (char)(color[1]*255.0f); + ccol[2]= (char)(color[2]*255.0f); + ccol[3]= (char)(color[3]*255.0f); + for(y= 0; y<height; y++) { + for(x= 0; x<width; x++) { + + rect[0]= ccol[0]; + rect[1]= ccol[1]; + rect[2]= ccol[2]; + rect[3]= ccol[3]; + rect+= 4; + } + } + } +} + + +void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int width, int height) +{ + /* these two passes could be combined into one, but it's more readable and + * easy to tweak like this, speed isn't really that much of an issue in this situation... */ + + int checkerwidth= 32, dark= 1; + int x, y; + + unsigned char *rect_orig= rect; + float *rect_float_orig= rect_float; + + + float h=0.0, hoffs=0.0, hue=0.0, s=0.9, v=0.9, r, g, b; + + /* checkers */ + for(y= 0; y<height; y++) { + dark= powf(-1.0f, floorf(y / checkerwidth)); + + for(x= 0; x<width; x++) { + if (x % checkerwidth == 0) dark= -dark; + + if (rect_float) { + if (dark > 0) { + rect_float[0]= rect_float[1]= rect_float[2]= 0.25f; + rect_float[3]= 1.0f; + } else { + rect_float[0]= rect_float[1]= rect_float[2]= 0.58f; + rect_float[3]= 1.0f; + } + rect_float+= 4; + } + else { + if (dark > 0) { + rect[0]= rect[1]= rect[2]= 64; + rect[3]= 255; + } else { + rect[0]= rect[1]= rect[2]= 150; + rect[3]= 255; + } + rect+= 4; + } + } + } + + rect= rect_orig; + rect_float= rect_float_orig; + + /* 2nd pass, colored + */ + for(y= 0; y<height; y++) { + hoffs= 0.125f * floorf(y / checkerwidth); + + for(x= 0; x<width; x++) { + h= 0.125f * floorf(x / checkerwidth); + + if ((fabs((x % checkerwidth) - (checkerwidth / 2)) < 4) && + (fabs((y % checkerwidth) - (checkerwidth / 2)) < 4)) { + + if ((fabs((x % checkerwidth) - (checkerwidth / 2)) < 1) || + (fabs((y % checkerwidth) - (checkerwidth / 2)) < 1)) { + + hue= fmodf(fabs(h-hoffs), 1.0f); + hsv_to_rgb(hue, s, v, &r, &g, &b); + + if (rect) { + rect[0]= (char)(r * 255.0f); + rect[1]= (char)(g * 255.0f); + rect[2]= (char)(b * 255.0f); + rect[3]= 255; + } + + if (rect_float) { + rect_float[0]= r; + rect_float[1]= g; + rect_float[2]= b; + rect_float[3]= 1.0f; + } + } + } + + if (rect_float) rect_float+= 4; + if (rect) rect+= 4; + } + } +} + + +/* Utility functions for BKE_image_buf_fill_checker_color */ + +#define BLEND_FLOAT(real, add) (real+add <= 1.0) ? (real+add) : 1.0 +#define BLEND_CHAR(real, add) ((real + (char)(add * 255.0)) <= 255) ? (real + (char)(add * 255.0)) : 255 + +static int is_pow2(int n) +{ + return ((n)&(n-1))==0; +} +static int larger_pow2(int n) +{ + if (is_pow2(n)) + return n; + + while(!is_pow2(n)) + n= n&(n-1); + + return n*2; +} + +static void checker_board_color_fill(unsigned char *rect, float *rect_float, int width, int height) +{ + int hue_step, y, x; + float hue, val, sat, r, g, b; + + sat= 1.0; + + hue_step= larger_pow2(width / 8); + if(hue_step < 8) hue_step= 8; + + for(y= 0; y < height; y++) + { + + val= 0.1 + (y * (0.4 / height)); /* use a number lower then 1.0 else its too bright */ + for(x= 0; x < width; x++) + { + hue= (float)((double)(x/hue_step) * 1.0 / width * hue_step); + hsv_to_rgb(hue, sat, val, &r, &g, &b); + + if (rect) { + rect[0]= (char)(r * 255.0f); + rect[1]= (char)(g * 255.0f); + rect[2]= (char)(b * 255.0f); + rect[3]= 255; + + rect += 4; + } + + if (rect_float) { + rect_float[0]= r; + rect_float[1]= g; + rect_float[2]= b; + rect_float[3]= 1.0f; + + rect_float += 4; + } + } + } +} + +static void checker_board_color_tint(unsigned char *rect, float *rect_float, int width, int height, int size, float blend) +{ + int x, y; + float blend_half= blend * 0.5f; + + for(y= 0; y < height; y++) + { + for(x= 0; x < width; x++) + { + if( ( (y/size)%2 == 1 && (x/size)%2 == 1 ) || ( (y/size)%2 == 0 && (x/size)%2 == 0 ) ) + { + if (rect) { + rect[0]= (char)BLEND_CHAR(rect[0], blend); + rect[1]= (char)BLEND_CHAR(rect[1], blend); + rect[2]= (char)BLEND_CHAR(rect[2], blend); + rect[3]= 255; + + rect += 4; + } + if (rect_float) { + rect_float[0]= BLEND_FLOAT(rect_float[0], blend); + rect_float[1]= BLEND_FLOAT(rect_float[1], blend); + rect_float[2]= BLEND_FLOAT(rect_float[2], blend); + rect_float[3]= 1.0f; + + rect_float += 4; + } + } + else { + if (rect) { + rect[0]= (char)BLEND_CHAR(rect[0], blend_half); + rect[1]= (char)BLEND_CHAR(rect[1], blend_half); + rect[2]= (char)BLEND_CHAR(rect[2], blend_half); + rect[3]= 255; + + rect += 4; + } + if (rect_float) { + rect_float[0]= BLEND_FLOAT(rect_float[0], blend_half); + rect_float[1]= BLEND_FLOAT(rect_float[1], blend_half); + rect_float[2]= BLEND_FLOAT(rect_float[2], blend_half); + rect_float[3]= 1.0f; + + rect_float += 4; + } + } + + } + } +} + +static void checker_board_grid_fill(unsigned char *rect, float *rect_float, int width, int height, float blend) +{ + int x, y; + for(y= 0; y < height; y++) + { + for(x= 0; x < width; x++) + { + if( ((y % 32) == 0) || ((x % 32) == 0) || x == 0 ) + { + if (rect) { + rect[0]= BLEND_CHAR(rect[0], blend); + rect[1]= BLEND_CHAR(rect[1], blend); + rect[2]= BLEND_CHAR(rect[2], blend); + rect[3]= 255; + + rect += 4; + } + if (rect_float) { + rect_float[0]= BLEND_FLOAT(rect_float[0], blend); + rect_float[1]= BLEND_FLOAT(rect_float[1], blend); + rect_float[2]= BLEND_FLOAT(rect_float[2], blend); + rect_float[3]= 1.0f; + + rect_float += 4; + } + } + else { + if(rect_float) rect_float += 4; + if(rect) rect += 4; + } + } + } +} + +/* defined in image.c */ +extern void stamp_font_begin(int size); + +static void checker_board_text(unsigned char *rect, float *rect_float, int width, int height, int step, int outline) +{ + int x, y; + int pen_x, pen_y; + char text[3]= {'A', '1', '\0'}; + + /* hard coded size! */ + stamp_font_begin(54); + BLF_buffer(rect_float, rect, width, height, 4); + + for(y= 0; y < height; y+=step) + { + text[1]= '1'; + + for(x= 0; x < width; x+=step) + { + /* hard coded offset */ + pen_x = x + 33; + pen_y = y + 44; + + /* terribly crappy outline font! */ + BLF_buffer_col(1.0, 1.0, 1.0, 1.0); + + BLF_position(pen_x-outline, pen_y, 0.0); + BLF_draw_buffer(text); + BLF_position(pen_x+outline, pen_y, 0.0); + BLF_draw_buffer(text); + BLF_position(pen_x, pen_y-outline, 0.0); + BLF_draw_buffer(text); + BLF_position(pen_x, pen_y+outline, 0.0); + BLF_draw_buffer(text); + + BLF_position(pen_x-outline, pen_y-outline, 0.0); + BLF_draw_buffer(text); + BLF_position(pen_x+outline, pen_y+outline, 0.0); + BLF_draw_buffer(text); + BLF_position(pen_x-outline, pen_y+outline, 0.0); + BLF_draw_buffer(text); + BLF_position(pen_x+outline, pen_y-outline, 0.0); + BLF_draw_buffer(text); + + BLF_buffer_col(0.0, 0.0, 0.0, 1.0); + BLF_position(pen_x, pen_y, 0.0); + BLF_draw_buffer(text); + + text[1]++; + } + text[0]++; + } + + /* cleanup the buffer. */ + BLF_buffer(0, 0, 0, 0, 0); + +} + +void BKE_image_buf_fill_checker_color(unsigned char *rect, float *rect_float, int width, int height) +{ + checker_board_color_fill(rect, rect_float, width, height); + checker_board_color_tint(rect, rect_float, width, height, 1, 0.03f); + checker_board_color_tint(rect, rect_float, width, height, 4, 0.05f); + checker_board_color_tint(rect, rect_float, width, height, 32, 0.07f); + checker_board_color_tint(rect, rect_float, width, height, 128, 0.15f); + checker_board_grid_fill(rect, rect_float, width, height, 1.0f/4.0f); + + checker_board_text(rect, rect_float, width, height, 128, 2); +} diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 6912a65886a..b4fb34d8464 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -31,13 +31,10 @@ #include "BKE_cloth.h" -#include "DNA_cloth_types.h" -#include "DNA_scene_types.h" #include "DNA_object_force.h" #include "BKE_effect.h" #include "BKE_global.h" -#include "BKE_cloth.h" #include "BKE_utildefines.h" #ifdef _WIN32 diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 807b584d6f8..2c0ca0f69f9 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -48,46 +48,29 @@ #include "MEM_guardedalloc.h" #include "DNA_anim_types.h" -#include "DNA_action_types.h" -#include "DNA_armature_types.h" #include "DNA_constraint_types.h" -#include "DNA_curve_types.h" #include "DNA_camera_types.h" #include "DNA_lamp_types.h" #include "DNA_ipo_types.h" #include "DNA_key_types.h" #include "DNA_material_types.h" -#include "DNA_mesh_types.h" #include "DNA_nla_types.h" -#include "DNA_object_types.h" -#include "DNA_object_force.h" -#include "DNA_particle_types.h" #include "DNA_sequence_types.h" #include "DNA_scene_types.h" -#include "DNA_sound_types.h" -#include "DNA_texture_types.h" -#include "DNA_view3d_types.h" #include "DNA_world_types.h" +#include "BLI_math.h" /* windows needs for M_PI */ #include "BLI_blenlib.h" -#include "BLI_math.h" #include "BLI_dynstr.h" #include "BKE_utildefines.h" #include "BKE_animsys.h" #include "BKE_action.h" -#include "BKE_blender.h" -#include "BKE_curve.h" -#include "BKE_constraint.h" #include "BKE_fcurve.h" #include "BKE_global.h" -#include "BKE_ipo.h" -#include "BKE_library.h" #include "BKE_main.h" -#include "BKE_mesh.h" #include "BKE_nla.h" -#include "BKE_object.h" diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 413d25edd31..9c78742ada0 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -40,24 +40,19 @@ #include "BLI_editVert.h" #include "DNA_anim_types.h" -#include "DNA_curve_types.h" #include "DNA_key_types.h" #include "DNA_lattice_types.h" -#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "BKE_animsys.h" -#include "BKE_action.h" -#include "BKE_blender.h" #include "BKE_curve.h" #include "BKE_customdata.h" #include "BKE_global.h" #include "BKE_key.h" #include "BKE_lattice.h" #include "BKE_library.h" -#include "BKE_mesh.h" #include "BKE_main.h" #include "BKE_object.h" #include "BKE_utildefines.h" diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 8a06ce9234e..347fd01299f 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -41,22 +41,15 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "DNA_armature_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" -#include "DNA_modifier_types.h" -#include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_lattice_types.h" #include "DNA_curve_types.h" #include "DNA_key_types.h" #include "BKE_anim.h" -#include "BKE_armature.h" -#include "BKE_curve.h" #include "BKE_cdderivedmesh.h" -#include "BKE_DerivedMesh.h" -#include "BKE_deform.h" #include "BKE_displist.h" #include "BKE_global.h" #include "BKE_key.h" @@ -65,8 +58,6 @@ #include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_modifier.h" -#include "BKE_object.h" -#include "BKE_screen.h" #include "BKE_utildefines.h" //XXX #include "BIF_editdeform.h" diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 83268a0a165..91e53742fea 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -47,17 +47,11 @@ #include "MEM_guardedalloc.h" /* all types are needed here, in order to do memory operations */ -#include "DNA_ID.h" -#include "DNA_listBase.h" #include "DNA_scene_types.h" -#include "DNA_object_types.h" #include "DNA_mesh_types.h" #include "DNA_lattice_types.h" -#include "DNA_curve_types.h" #include "DNA_meta_types.h" #include "DNA_material_types.h" -#include "DNA_texture_types.h" -#include "DNA_image_types.h" #include "DNA_wave_types.h" #include "DNA_lamp_types.h" #include "DNA_camera_types.h" @@ -70,17 +64,10 @@ #include "DNA_sound_types.h" #include "DNA_group_types.h" #include "DNA_armature_types.h" -#include "DNA_action_types.h" -#include "DNA_userdef_types.h" #include "DNA_node_types.h" #include "DNA_nla_types.h" -#include "DNA_effect_types.h" -#include "DNA_brush_types.h" -#include "DNA_particle_types.h" -#include "DNA_space_types.h" #include "DNA_windowmanager_types.h" #include "DNA_anim_types.h" -#include "DNA_gpencil_types.h" #include "BLI_blenlib.h" #include "BLI_dynstr.h" @@ -93,7 +80,6 @@ #include "BKE_sound.h" #include "BKE_object.h" #include "BKE_screen.h" -#include "BKE_script.h" #include "BKE_mesh.h" #include "BKE_material.h" #include "BKE_curve.h" @@ -112,7 +98,6 @@ #include "BKE_armature.h" #include "BKE_action.h" #include "BKE_node.h" -#include "BKE_effect.h" #include "BKE_brush.h" #include "BKE_idprop.h" #include "BKE_particle.h" diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 0f8248a38df..9a1177f0f84 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -42,14 +42,10 @@ #include "DNA_node_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" -#include "DNA_texture_types.h" -#include "DNA_userdef_types.h" -#include "BLI_blenlib.h" #include "BLI_math.h" #include "BKE_animsys.h" -#include "BKE_blender.h" #include "BKE_displist.h" #include "BKE_global.h" #include "BKE_icons.h" diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 24eeb1ab43f..d65870b71ce 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -57,7 +57,6 @@ /* #include "BKE_object.h" */ #include "BKE_animsys.h" #include "BKE_scene.h" -#include "BKE_blender.h" #include "BKE_library.h" #include "BKE_displist.h" #include "BKE_mball.h" diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index b7efc0c626b..15f9fc4ac11 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -40,26 +40,18 @@ #include "MEM_guardedalloc.h" -#include "DNA_ID.h" -#include "DNA_anim_types.h" -#include "DNA_curve_types.h" #include "DNA_scene_types.h" #include "DNA_material_types.h" #include "DNA_object_types.h" -#include "DNA_image_types.h" #include "DNA_key_types.h" -#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_ipo_types.h" #include "BKE_animsys.h" -#include "BKE_customdata.h" -#include "BKE_depsgraph.h" #include "BKE_main.h" #include "BKE_DerivedMesh.h" #include "BKE_global.h" #include "BKE_mesh.h" -#include "BKE_subsurf.h" #include "BKE_displist.h" #include "BKE_library.h" #include "BKE_material.h" @@ -987,6 +979,9 @@ void nurbs_to_mesh(Object *ob) me->totcol= cu->totcol; me->mat= cu->mat; + + tex_space_mesh(me); + cu->mat= 0; cu->totcol= 0; @@ -1162,7 +1157,7 @@ void mesh_to_curve(Scene *scene, Object *ob) nu->pntsu= totpoly; nu->pntsv= 1; nu->orderu= 4; - nu->flagu= 2 | (closed ? CU_CYCLIC:0); /* endpoint */ + nu->flagu= CU_NURB_ENDPOINT | (closed ? CU_NURB_CYCLIC:0); /* endpoint */ nu->resolu= 12; nu->bp= (BPoint *)MEM_callocN(sizeof(BPoint)*totpoly, "bpoints"); diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index c5a420b85a8..4c4abf80db4 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -40,61 +40,30 @@ #include "math.h" #include "float.h" -#include "BLI_math.h" -#include "BLI_blenlib.h" -#include "BLI_kdopbvh.h" #include "BLI_kdtree.h" -#include "BLI_linklist.h" #include "BLI_rand.h" -#include "BLI_edgehash.h" -#include "BLI_ghash.h" -#include "BLI_memarena.h" #include "MEM_guardedalloc.h" -#include "DNA_action_types.h" #include "DNA_armature_types.h" #include "DNA_camera_types.h" -#include "DNA_cloth_types.h" #include "DNA_curve_types.h" -#include "DNA_effect_types.h" -#include "DNA_group_types.h" #include "DNA_key_types.h" #include "DNA_material_types.h" -#include "DNA_mesh_types.h" -#include "DNA_meshdata_types.h" -#include "DNA_modifier_types.h" -#include "DNA_object_types.h" #include "DNA_object_fluidsim.h" -#include "DNA_object_force.h" -#include "DNA_particle_types.h" -#include "DNA_scene_types.h" -#include "DNA_smoke_types.h" -#include "DNA_texture_types.h" -#include "BLI_editVert.h" - - - -#include "BKE_main.h" -#include "BKE_anim.h" #include "BKE_action.h" #include "BKE_bmesh.h" #include "BKE_booleanops.h" #include "BKE_cloth.h" -#include "BKE_collision.h" #include "BKE_cdderivedmesh.h" -#include "BKE_curve.h" -#include "BKE_customdata.h" -#include "BKE_DerivedMesh.h" #include "BKE_displist.h" #include "BKE_fluidsim.h" #include "BKE_global.h" #include "BKE_multires.h" #include "BKE_key.h" #include "BKE_lattice.h" -#include "BKE_library.h" #include "BKE_material.h" #include "BKE_mesh.h" #include "BKE_modifier.h" @@ -106,7 +75,6 @@ #include "BKE_softbody.h" #include "BKE_subsurf.h" #include "BKE_texture.h" -#include "BKE_utildefines.h" #include "depsgraph_private.h" #include "BKE_deform.h" @@ -5697,6 +5665,7 @@ static void solidifyModifier_copyData(ModifierData *md, ModifierData *target) tsmd->crease_inner = smd->crease_inner; tsmd->crease_outer = smd->crease_outer; tsmd->crease_rim = smd->crease_rim; + tsmd->flag = smd->flag; strcpy(tsmd->defgrp_name, smd->defgrp_name); } diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index cf1a81fc7e0..248b7ed407d 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -29,27 +29,19 @@ #include "MEM_guardedalloc.h" -#include "DNA_key_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" -#include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" -#include "DNA_view3d_types.h" #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_pbvh.h" #include "BKE_cdderivedmesh.h" -#include "BKE_customdata.h" -#include "BKE_depsgraph.h" -#include "BKE_DerivedMesh.h" -#include "BKE_global.h" #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_multires.h" -#include "BKE_object.h" #include "BKE_scene.h" #include "BKE_subsurf.h" #include "BKE_utildefines.h" diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index bbef2b3e0db..56da45ed19a 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -36,20 +36,14 @@ #include "MEM_guardedalloc.h" -#include "BLI_blenlib.h" #include "BLI_ghash.h" #include "DNA_anim_types.h" -#include "DNA_action_types.h" -#include "BKE_animsys.h" #include "BKE_action.h" #include "BKE_fcurve.h" #include "BKE_nla.h" -#include "BKE_blender.h" #include "BKE_library.h" -#include "BKE_object.h" -#include "BKE_utildefines.h" #include "RNA_access.h" #include "nla_private.h" diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 844139dd871..10da12753e7 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -36,42 +36,16 @@ #include <string.h> #include "DNA_anim_types.h" -#include "DNA_ID.h" -#include "DNA_image_types.h" -#include "DNA_node_types.h" -#include "DNA_material_types.h" -#include "DNA_texture_types.h" -#include "DNA_text_types.h" -#include "DNA_scene_types.h" #include "RNA_access.h" -#include "BKE_blender.h" -#include "BKE_colortools.h" #include "BKE_fcurve.h" -#include "BKE_global.h" -#include "BKE_image.h" -#include "BKE_library.h" -#include "BKE_main.h" -#include "BKE_node.h" -#include "BKE_texture.h" -#include "BKE_text.h" -#include "BKE_utildefines.h" #include "BKE_animsys.h" /* BKE_free_animdata only */ -#include "BLI_math.h" -#include "BLI_blenlib.h" -#include "BLI_rand.h" -#include "BLI_threads.h" #include "PIL_time.h" #include "MEM_guardedalloc.h" -#include "IMB_imbuf.h" - -#include "RE_pipeline.h" -#include "RE_shader_ext.h" /* <- TexResult */ -#include "RE_render_ext.h" /* <- ibuf_sample() */ #include "CMP_node.h" #include "intern/CMP_util.h" /* stupid include path... */ @@ -80,7 +54,6 @@ #include "TEX_node.h" #include "intern/TEX_util.h" -#include "GPU_extensions.h" #include "GPU_material.h" static ListBase empty_list = {NULL, NULL}; @@ -2809,12 +2782,16 @@ static void force_hidden_passes(bNode *node, int passflag) if(!(passflag & SCE_PASS_REFLECT)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_REFRACT); if(!(passflag & SCE_PASS_REFRACT)) sock->flag |= SOCK_UNAVAIL; - sock= BLI_findlink(&node->outputs, RRES_OUT_RADIO); - if(!(passflag & SCE_PASS_RADIO)) sock->flag |= SOCK_UNAVAIL; + sock= BLI_findlink(&node->outputs, RRES_OUT_INDIRECT); + if(!(passflag & SCE_PASS_INDIRECT)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_INDEXOB); if(!(passflag & SCE_PASS_INDEXOB)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_MIST); if(!(passflag & SCE_PASS_MIST)) sock->flag |= SOCK_UNAVAIL; + sock= BLI_findlink(&node->outputs, RRES_OUT_EMIT); + if(!(passflag & SCE_PASS_EMIT)) sock->flag |= SOCK_UNAVAIL; + sock= BLI_findlink(&node->outputs, RRES_OUT_ENV); + if(!(passflag & SCE_PASS_ENVIRONMENT)) sock->flag |= SOCK_UNAVAIL; } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 336f45fc2e2..b08754a7a3f 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -40,34 +40,20 @@ #include "MEM_guardedalloc.h" #include "DNA_anim_types.h" -#include "DNA_action_types.h" #include "DNA_armature_types.h" -#include "DNA_boid_types.h" #include "DNA_camera_types.h" #include "DNA_constraint_types.h" -#include "DNA_curve_types.h" #include "DNA_group_types.h" #include "DNA_key_types.h" #include "DNA_lamp_types.h" #include "DNA_lattice_types.h" #include "DNA_material_types.h" -#include "DNA_mesh_types.h" #include "DNA_meta_types.h" -#include "DNA_curve_types.h" #include "DNA_meshdata_types.h" -#include "DNA_modifier_types.h" -#include "DNA_nla_types.h" -#include "DNA_object_types.h" -#include "DNA_object_force.h" -#include "DNA_object_fluidsim.h" -#include "DNA_outliner_types.h" -#include "DNA_particle_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_sequence_types.h" #include "DNA_space_types.h" -#include "DNA_texture_types.h" -#include "DNA_userdef_types.h" #include "DNA_view3d_types.h" #include "DNA_world_types.h" @@ -86,10 +72,8 @@ #include "BKE_colortools.h" #include "BKE_deform.h" #include "BKE_DerivedMesh.h" -#include "BKE_nla.h" #include "BKE_animsys.h" #include "BKE_anim.h" -#include "BKE_blender.h" #include "BKE_constraint.h" #include "BKE_curve.h" #include "BKE_displist.h" @@ -110,7 +94,6 @@ #include "BKE_property.h" #include "BKE_sca.h" #include "BKE_scene.h" -#include "BKE_screen.h" #include "BKE_sequencer.h" #include "BKE_softbody.h" diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index cdcdcc07eef..b62f856e1f3 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -49,17 +49,14 @@ #include "DNA_sound_types.h" #include "DNA_vfont_types.h" #include "DNA_packedFile_types.h" -#include "DNA_scene_types.h" #include "BLI_blenlib.h" #include "BKE_utildefines.h" #include "BKE_global.h" #include "BKE_main.h" -#include "BKE_screen.h" #include "BKE_sound.h" #include "BKE_image.h" -#include "BKE_font.h" #include "BKE_packedFile.h" #include "BKE_report.h" diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 5728c7a1fe0..cf5deb95258 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -27,13 +27,11 @@ #include "MEM_guardedalloc.h" -#include "DNA_brush_types.h" #include "DNA_object_types.h" #include "DNA_mesh_types.h" #include "DNA_scene_types.h" #include "BKE_brush.h" -#include "BKE_global.h" #include "BKE_library.h" #include "BKE_paint.h" diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 97e8d6c7f7d..f228dc5002e 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -35,27 +35,15 @@ #include "MEM_guardedalloc.h" -#include "DNA_boid_types.h" #include "DNA_curve_types.h" #include "DNA_group_types.h" -#include "DNA_ipo_types.h" // XXX old animation system stuff to remove! #include "DNA_key_types.h" #include "DNA_material_types.h" #include "DNA_mesh_types.h" -#include "DNA_meshdata_types.h" -#include "DNA_modifier_types.h" -#include "DNA_object_force.h" -#include "DNA_object_types.h" #include "DNA_particle_types.h" -#include "DNA_scene_types.h" #include "DNA_smoke_types.h" -#include "DNA_texture_types.h" -#include "BLI_math.h" -#include "BLI_blenlib.h" -#include "BLI_dynstr.h" #include "BLI_kdtree.h" -#include "BLI_listbase.h" #include "BLI_rand.h" #include "BLI_threads.h" @@ -72,9 +60,7 @@ #include "BKE_utildefines.h" #include "BKE_displist.h" #include "BKE_particle.h" -#include "BKE_DerivedMesh.h" #include "BKE_object.h" -#include "BKE_cloth.h" #include "BKE_material.h" #include "BKE_key.h" #include "BKE_library.h" diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 3908429e606..7e73f9b23e7 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -54,7 +54,6 @@ #include "BKE_global.h" #include "BKE_library.h" #include "BKE_main.h" -#include "BKE_modifier.h" #include "BKE_object.h" #include "BKE_particle.h" #include "BKE_pointcache.h" diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c index d65e3391f04..1129cc9d736 100644 --- a/source/blender/blenkernel/intern/property.c +++ b/source/blender/blenkernel/intern/property.c @@ -43,10 +43,8 @@ #include "DNA_property_types.h" #include "DNA_object_types.h" -#include "DNA_listBase.h" #include "BLI_blenlib.h" -#include "BKE_property.h" void free_property(bProperty *prop) { diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c index a2a44ca53a7..a7800ddc12a 100644 --- a/source/blender/blenkernel/intern/report.c +++ b/source/blender/blenkernel/intern/report.c @@ -27,8 +27,6 @@ #include "MEM_guardedalloc.h" -#include "DNA_listBase.h" - #include "BLI_blenlib.h" #include "BLI_dynstr.h" diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index 1c727ee1596..bc66f4d52d3 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -39,7 +39,6 @@ #include "MEM_guardedalloc.h" -#include "DNA_text_types.h" #include "DNA_controller_types.h" #include "DNA_sensor_types.h" #include "DNA_actuator_types.h" @@ -49,8 +48,6 @@ #include "BKE_utildefines.h" #include "BKE_global.h" #include "BKE_main.h" -#include "BKE_blender.h" -#include "BKE_sca.h" /* ******************* SENSORS ************************ */ diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 0cec7e71262..df6e0c78661 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -45,34 +45,15 @@ #include "MEM_guardedalloc.h" #include "DNA_anim_types.h" -#include "DNA_armature_types.h" -#include "DNA_color_types.h" -#include "DNA_constraint_types.h" -#include "DNA_curve_types.h" #include "DNA_group_types.h" -#include "DNA_lamp_types.h" -#include "DNA_material_types.h" -#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" -#include "BKE_action.h" #include "BKE_anim.h" #include "BKE_animsys.h" -#include "BKE_armature.h" -#include "BKE_colortools.h" -#include "BKE_colortools.h" -#include "BKE_constraint.h" #include "BKE_depsgraph.h" #include "BKE_global.h" -#include "BKE_group.h" -#include "BKE_ipo.h" #include "BKE_idprop.h" -#include "BKE_image.h" -#include "BKE_key.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_node.h" @@ -372,7 +353,11 @@ Scene *add_scene(char *name) sce->r.scemode= R_DOCOMP|R_DOSEQ|R_EXTENSION; sce->r.stamp= R_STAMP_TIME|R_STAMP_FRAME|R_STAMP_DATE|R_STAMP_SCENE|R_STAMP_CAMERA|R_STAMP_RENDERTIME; sce->r.stamp_font_id= 12; - + + sce->r.seq_prev_type= OB_SOLID; + sce->r.seq_rend_type= OB_SOLID; + sce->r.seq_flag= R_SEQ_GL_PREV; + sce->r.threads= 1; sce->r.simplify_subsurf= 6; diff --git a/source/blender/blenkernel/intern/script.c b/source/blender/blenkernel/intern/script.c index 424067a7046..c07032f71d7 100644 --- a/source/blender/blenkernel/intern/script.c +++ b/source/blender/blenkernel/intern/script.c @@ -31,17 +31,10 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include "BKE_script.h" -#include "DNA_space_types.h" #include "MEM_guardedalloc.h" /* -#include "BLI_blenlib.h" -#include "BKE_utildefines.h" -#include "BKE_library.h" -#include "BKE_global.h" -#include "BKE_main.h" #ifndef DISABLE_PYTHON #include "BPY_extern.h" // Blender Python library diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 770bcddfffd..7cabb620085 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -34,14 +34,12 @@ #include "MEM_guardedalloc.h" #include "PIL_dynlib.h" +#include "BLI_math.h" /* windows needs for M_PI */ + #include "DNA_scene_types.h" #include "DNA_sequence_types.h" #include "DNA_anim_types.h" -#include "BLI_blenlib.h" -#include "BLI_math.h" - -#include "BKE_global.h" #include "BKE_fcurve.h" #include "BKE_plugin_types.h" #include "BKE_sequencer.h" diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 341d0a542e6..1309bdf465b 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -35,7 +35,6 @@ #include "MEM_guardedalloc.h" #include "MEM_CacheLimiterC-Api.h" -#include "DNA_listBase.h" #include "DNA_sequence_types.h" #include "DNA_scene_types.h" #include "DNA_anim_types.h" @@ -46,7 +45,6 @@ #include "BKE_main.h" #include "BKE_sequencer.h" #include "BKE_fcurve.h" -#include "BKE_utildefines.h" #include "BKE_scene.h" #include "RNA_access.h" #include "RE_pipeline.h" @@ -55,7 +53,6 @@ #include "BLI_listbase.h" #include "BLI_path_util.h" #include "BLI_string.h" -#include "BLI_threads.h" #include <pthread.h> #include "IMB_imbuf.h" @@ -2152,6 +2149,7 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int int rendering = 1; int doseq; + int doseq_gl= G.rendering ? (scene->r.seq_flag & R_SEQ_GL_REND) : (scene->r.seq_flag & R_SEQ_GL_PREV); /* prevent eternal loop */ doseq= scene->r.scemode & R_DOSEQ; @@ -2167,10 +2165,10 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int seq->scene->markers.first= seq->scene->markers.last= NULL; #endif - if(sequencer_view3d_cb && (seq->flag & SEQ_USE_SCENE_OPENGL) && (seq->scene == scene || have_seq==0)) { + if(sequencer_view3d_cb && doseq_gl && (seq->scene == scene || have_seq==0)) { /* opengl offscreen render */ scene_update_for_newframe(seq->scene, seq->scene->lay); - se->ibuf= sequencer_view3d_cb(seq->scene, seqrectx, seqrecty); + se->ibuf= sequencer_view3d_cb(seq->scene, seqrectx, seqrecty, scene->r.seq_prev_type); } else { Render *re; @@ -2181,7 +2179,7 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int else re= RE_NewRender(sce->id.name, RE_SLOT_VIEW); - RE_BlenderFrame(re, sce, NULL, frame); + RE_BlenderFrame(re, sce, NULL, sce->lay, frame); RE_AcquireResultImage(re, &rres); @@ -2452,6 +2450,42 @@ static TStripElem* do_build_seq_recursively(Scene *scene, Sequence * seq, int cf return se; } +static int seq_must_swap_input_in_blend_mode(Sequence * seq) +{ + int swap_input = FALSE; + + /* bad hack, to fix crazy input ordering of + those two effects */ + + if (seq->blend_mode == SEQ_ALPHAOVER || + seq->blend_mode == SEQ_ALPHAUNDER || + seq->blend_mode == SEQ_OVERDROP) { + swap_input = TRUE; + } + + return swap_input; +} + +static int seq_get_early_out_for_blend_mode(Sequence * seq) +{ + struct SeqEffectHandle sh = get_sequence_blend(seq); + float facf = seq->blend_opacity / 100.0; + int early_out = sh.early_out(seq, facf, facf); + + if (early_out < 1) { + return early_out; + } + + if (seq_must_swap_input_in_blend_mode(seq)) { + if (early_out == 2) { + return 1; + } else if (early_out == 1) { + return 2; + } + } + return early_out; +} + static TStripElem* do_build_seq_array_recursively(Scene *scene, ListBase *seqbasep, int cfra, int chanshown, int render_size) { @@ -2460,7 +2494,8 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene, int i; TStripElem* se = 0; - count = get_shown_sequences(seqbasep, cfra, chanshown, (Sequence **)&seq_arr); + count = get_shown_sequences(seqbasep, cfra, chanshown, + (Sequence **)&seq_arr); if (!count) { return 0; @@ -2483,7 +2518,8 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene, if(count == 1) { - se = do_build_seq_recursively(scene, seq_arr[0], cfra, render_size); + se = do_build_seq_recursively(scene, seq_arr[0], + cfra, render_size); if (se->ibuf) { se->ibuf_comp = se->ibuf; IMB_refImBuf(se->ibuf_comp); @@ -2495,8 +2531,6 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene, for (i = count - 1; i >= 0; i--) { int early_out; Sequence * seq = seq_arr[i]; - struct SeqEffectHandle sh; - float facf; se = give_tstripelem(seq, cfra); @@ -2506,7 +2540,9 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene, break; } if (seq->blend_mode == SEQ_BLEND_REPLACE) { - do_build_seq_recursively(scene, seq, cfra, render_size); + do_build_seq_recursively( + scene, seq, cfra, render_size); + if (se->ibuf) { se->ibuf_comp = se->ibuf; IMB_refImBuf(se->ibuf); @@ -2521,16 +2557,14 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene, break; } - sh = get_sequence_blend(seq); - - facf = seq->blend_opacity / 100.0; - - early_out = sh.early_out(seq, facf, facf); + early_out = seq_get_early_out_for_blend_mode(seq); switch (early_out) { case -1: case 2: - do_build_seq_recursively(scene, seq, cfra, render_size); + do_build_seq_recursively( + scene, seq, cfra, render_size); + if (se->ibuf) { se->ibuf_comp = se->ibuf; IMB_refImBuf(se->ibuf_comp); @@ -2554,7 +2588,9 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene, } break; case 0: - do_build_seq_recursively(scene, seq, cfra, render_size); + do_build_seq_recursively( + scene, seq, cfra, render_size); + if (!se->ibuf) { se->ibuf = IMB_allocImBuf( (short)seqrectx, (short)seqrecty, @@ -2584,14 +2620,13 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene, TStripElem* se2 = give_tstripelem(seq_arr[i], cfra); float facf = seq->blend_opacity / 100.0; - - int early_out = sh.early_out(seq, facf, facf); + int swap_input = seq_must_swap_input_in_blend_mode(seq); + int early_out = seq_get_early_out_for_blend_mode(seq); switch (early_out) { case 0: { int x= se2->ibuf->x; int y= se2->ibuf->y; - int swap_input = FALSE; if(se1->ibuf_comp == NULL) continue; @@ -2626,15 +2661,6 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene, IMB_rect_from_float(se2->ibuf); } - /* bad hack, to fix crazy input ordering of - those two effects */ - - if (seq->blend_mode == SEQ_ALPHAOVER || - seq->blend_mode == SEQ_ALPHAUNDER || - seq->blend_mode == SEQ_OVERDROP) { - swap_input = TRUE; - } - if (swap_input) { sh.execute(scene, seq, cfra, facf, facf, x, y, @@ -2657,7 +2683,7 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene, break; } case 1: { - se2->ibuf_comp = se1->ibuf; + se2->ibuf_comp = se1->ibuf_comp; if(se2->ibuf_comp) IMB_refImBuf(se2->ibuf_comp); @@ -3669,7 +3695,7 @@ static void seq_update_muting_recursive(Scene *scene, ListBase *seqbasep, Sequen seq_update_muting_recursive(scene, &seq->seqbase, metaseq, seqmute); } - else if(seq->type == SEQ_SOUND) { + else if((seq->type == SEQ_SOUND) || (seq->type == SEQ_SCENE)) { if(seq->scene_sound) { sound_mute_scene_sound(scene, seq->scene_sound, seqmute); } diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index f0b3db4dca5..574ec848291 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -45,21 +45,14 @@ #include "BKE_lattice.h" #include "BKE_utildefines.h" #include "BKE_deform.h" -#include "BKE_cdderivedmesh.h" -#include "BKE_displist.h" -#include "BKE_global.h" #include "BKE_mesh.h" #include "BKE_subsurf.h" #include "BLI_math.h" -#include "BLI_kdtree.h" -#include "BLI_kdopbvh.h" #include "BLI_editVert.h" -#include "RE_raytrace.h" #include "MEM_guardedalloc.h" -#include "ED_mesh.h" /* Util macros */ #define TO_STR(a) #a diff --git a/source/blender/blenkernel/intern/simple_deform.c b/source/blender/blenkernel/intern/simple_deform.c index f3984eb1c8b..8ceb327b63c 100644 --- a/source/blender/blenkernel/intern/simple_deform.c +++ b/source/blender/blenkernel/intern/simple_deform.c @@ -30,7 +30,6 @@ #include "DNA_modifier_types.h" #include "DNA_meshdata_types.h" -#include "BKE_simple_deform.h" #include "BKE_DerivedMesh.h" #include "BKE_lattice.h" #include "BKE_deform.h" diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 2196e2ccd04..69209699a69 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -1398,11 +1398,12 @@ static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int static void smoke_calc_transparency(float *result, float *input, float *p0, float *p1, int res[3], float dx, float *light, bresenham_callback cb, float correct) { - int z; float bv[6]; - int slabsize=res[0]*res[1]; + int a, z, slabsize=res[0]*res[1], size= res[0]*res[1]*res[2]; + + for(a=0; a<size; a++) + result[a]= -1.0f; - memset(result, -1, sizeof(float)*res[0]*res[1]*res[2]); // x bv[0] = p0[0]; bv[1] = p1[0]; // y diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 09f7f32bc12..af40d9be643 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -56,16 +56,11 @@ variables on the UI for now /* types */ #include "DNA_curve_types.h" -#include "DNA_object_types.h" -#include "DNA_object_force.h" /* here is the softbody struct */ -#include "DNA_key_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" -#include "DNA_modifier_types.h" #include "DNA_lattice_types.h" #include "DNA_scene_types.h" -#include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_ghash.h" #include "BLI_threads.h" @@ -73,13 +68,9 @@ variables on the UI for now #include "BKE_curve.h" #include "BKE_effect.h" #include "BKE_global.h" -#include "BKE_key.h" -#include "BKE_object.h" #include "BKE_softbody.h" -#include "BKE_utildefines.h" #include "BKE_DerivedMesh.h" #include "BKE_pointcache.h" -#include "BKE_modifier.h" #include "BKE_deform.h" //XXX #include "BIF_editdeform.h" //XXX #include "BIF_graphics.h" @@ -212,6 +203,46 @@ static float sb_time_scale(Object *ob) } /*--- frame based timing ---*/ +/* helper functions for everything is animatable jow_go_for2_5 +++++++*/ +/* introducing them here, because i know: steps in properties ( at frame timing ) + will cause unwanted responses of the softbody system (which does inter frame calculations ) + so first 'cure' would be: interpolate linear in time .. + Q: why do i write this? + A: because it happend once, that some eger coder 'streamlined' code to fail. + We DO linear interpolation for goals .. and i think we should do on animated properties as well +*/ + +/* animate sb->maxgoal,sb->mingoal */ +static float _final_goal(Object *ob,BodyPoint *bp)/*jow_go_for2_5 */ +{ + float f = -1999.99f; + if (ob){ + SoftBody *sb= ob->soft; /* is supposed to be there */ + if(!(ob->softflag & OB_SB_GOAL)) return (0.0f); + if (sb&&bp){ + if (bp->goal < 0.0f) return (0.0f); + f = sb->mingoal + bp->goal*ABS(sb->maxgoal - sb->mingoal); + f = pow(f, 4.0f); + return (f); + } + } + printf("_final_goal failed! sb or bp ==NULL \n" ); + return f; /*using crude but spot able values some times helps debuggin */ +} + +static float _final_mass(Object *ob,BodyPoint *bp) +{ + if (ob){ + SoftBody *sb= ob->soft; /* is supposed to be there */ + if (sb&&bp){ + return(bp->mass*sb->nodemass); + } + } + printf("_final_mass failed! sb or bp ==NULL \n" ); + return 1.0f; +} +/* helper functions for everything is animateble jow_go_for2_5 ------*/ + /*+++ collider caching and dicing +++*/ /******************** @@ -846,6 +877,10 @@ static void renew_softbody(Scene *scene, Object *ob, int totpoint, int totspring for (i=0; i<totpoint; i++) { BodyPoint *bp = &sb->bpoint[i]; + + /* hum as far as i see this is overridden by _final_goal() now jow_go_for2_5 */ + /* sadly breaks compatibility with older versions */ + /* but makes goals behave the same for meshes, lattices and curves */ if(softflag & OB_SB_GOAL) { bp->goal= sb->defgoal; } @@ -862,7 +897,7 @@ static void renew_softbody(Scene *scene, Object *ob, int totpoint, int totspring bp->colball = 0.0f; bp->flag = 0; bp->springweight = 1.0f; - bp->mass = sb->nodemass; + bp->mass = 1.0f; } } } @@ -2202,14 +2237,14 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo mid_v3_v3v3(velcenter, bp->vec, obp->vec); sub_v3_v3v3(dvel,velcenter,bp->vec); - mul_v3_fl(dvel,bp->mass); + mul_v3_fl(dvel,_final_mass(ob,bp)); Vec3PlusStVec(bp->force,f*(1.0f-sb->balldamp),def); Vec3PlusStVec(bp->force,sb->balldamp,dvel); /* exploit force(a,b) == -force(b,a) part2/2 */ sub_v3_v3v3(dvel,velcenter,obp->vec); - mul_v3_fl(dvel,bp->mass); + mul_v3_fl(dvel,_final_mass(ob,bp)); Vec3PlusStVec(obp->force,sb->balldamp,dvel); Vec3PlusStVec(obp->force,-f*(1.0f-sb->balldamp),def); @@ -2219,7 +2254,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo } /* naive ball self collision done */ - if(bp->goal < SOFTGOALSNAP){ /* ommit this bp when it snaps */ + if(_final_goal(ob,bp) < SOFTGOALSNAP){ /* ommit this bp when it snaps */ float auxvect[3]; float velgoal[3]; @@ -2228,7 +2263,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo /* true elastic goal */ float ks,kd; sub_v3_v3v3(auxvect,bp->pos,bp->origT); - ks = 1.0f/(1.0f- bp->goal*sb->goalspring)-1.0f ; + ks = 1.0f/(1.0f- _final_goal(ob,bp)*sb->goalspring)-1.0f ; bp->force[0]+= -ks*(auxvect[0]); bp->force[1]+= -ks*(auxvect[1]); bp->force[2]+= -ks*(auxvect[2]); @@ -2255,7 +2290,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo if (sb && scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY){ float gravity[3]; VECCOPY(gravity, scene->physics_settings.gravity); - mul_v3_fl(gravity, sb_grav_force_scale(ob)*bp->mass*sb->effector_weights->global_gravity); /* individual mass of node here */ + mul_v3_fl(gravity, sb_grav_force_scale(ob)*_final_mass(ob,bp)*sb->effector_weights->global_gravity); /* individual mass of node here */ add_v3_v3v3(bp->force, bp->force, gravity); } @@ -2573,7 +2608,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa mid_v3_v3v3(velcenter, bp->vec, obp->vec); sub_v3_v3v3(dvel,velcenter,bp->vec); - mul_v3_fl(dvel,bp->mass); + mul_v3_fl(dvel,_final_mass(ob,bp)); Vec3PlusStVec(bp->force,f*(1.0f-sb->balldamp),def); Vec3PlusStVec(bp->force,sb->balldamp,dvel); @@ -2604,7 +2639,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa /* exploit force(a,b) == -force(b,a) part2/2 */ sub_v3_v3v3(dvel,velcenter,obp->vec); - mul_v3_fl(dvel,(bp->mass+obp->mass)/2.0f); + mul_v3_fl(dvel,(_final_mass(ob,bp)+_final_mass(ob,obp))/2.0f); Vec3PlusStVec(obp->force,sb->balldamp,dvel); Vec3PlusStVec(obp->force,-f*(1.0f-sb->balldamp),def); @@ -2616,7 +2651,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa } /* naive ball self collision done */ - if(bp->goal < SOFTGOALSNAP){ /* ommit this bp when it snaps */ + if(_final_goal(ob,bp) < SOFTGOALSNAP){ /* ommit this bp when it snaps */ float auxvect[3]; float velgoal[3]; @@ -2624,7 +2659,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa if(ob->softflag & OB_SB_GOAL) { /* true elastic goal */ sub_v3_v3v3(auxvect,bp->pos,bp->origT); - ks = 1.0f/(1.0f- bp->goal*sb->goalspring)-1.0f ; + ks = 1.0f/(1.0f- _final_goal(ob,bp)*sb->goalspring)-1.0f ; bp->force[0]+= -ks*(auxvect[0]); bp->force[1]+= -ks*(auxvect[1]); bp->force[2]+= -ks*(auxvect[2]); @@ -2664,7 +2699,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa /* gravitation */ - VECADDFAC(bp->force, bp->force, gravity, bp->mass); /* individual mass of node here */ + VECADDFAC(bp->force, bp->force, gravity, _final_mass(ob,bp)); /* individual mass of node here */ /* particle field & vortex */ @@ -2884,11 +2919,11 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float * for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) { /* now we have individual masses */ /* claim a minimum mass for vertex */ - if (bp->mass > 0.009999f) timeovermass = forcetime/bp->mass; + if (_final_mass(ob,bp) > 0.009999f) timeovermass = forcetime/_final_mass(ob,bp); else timeovermass = forcetime/0.009999f; - if(bp->goal < SOFTGOALSNAP){ + if(_final_goal(ob,bp) < SOFTGOALSNAP){ /* this makes t~ = t */ if(mid_flags & MID_PRESERVE) VECCOPY(dx,bp->vec); @@ -3092,7 +3127,7 @@ static void softbody_apply_goalsnap(Object *ob) int a; for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) { - if (bp->goal >= SOFTGOALSNAP){ + if (_final_goal(ob,bp) >= SOFTGOALSNAP){ VECCOPY(bp->prevpos,bp->pos); VECCOPY(bp->pos,bp->origT); } @@ -3137,7 +3172,7 @@ static void interpolate_exciter(Object *ob, int timescale, int time) bp->origT[0] = bp->origS[0] + f*(bp->origE[0] - bp->origS[0]); bp->origT[1] = bp->origS[1] + f*(bp->origE[1] - bp->origS[1]); bp->origT[2] = bp->origS[2] + f*(bp->origE[2] - bp->origS[2]); - if (bp->goal >= SOFTGOALSNAP){ + if (_final_goal(ob,bp) >= SOFTGOALSNAP){ bp->vec[0] = bp->origE[0] - bp->origS[0]; bp->vec[1] = bp->origE[1] - bp->origS[1]; bp->vec[2] = bp->origE[2] - bp->origS[2]; @@ -3224,37 +3259,6 @@ static void springs_from_mesh(Object *ob) -/* helper functions for everything is animateble jow_go_for2_5 +++++++*/ -/* introducing them here, because i know: steps in properties ( at frame timing ) - will cause unwanted responses of the softbody system (which does inter frame calculations ) - so first 'cure' would be: interpolate linear in time .. - Q: why do i write this? - A: because it happend once, that some eger coder 'streamlined' code to fail. - We DO linear interpolation for goals .. and i think we should do on animated properties as well -*/ -static float _goalfac(SoftBody *sb)/*jow_go_for2_5 */ -{ - if (sb){ - return ABS(sb->maxgoal - sb->mingoal); - } - printf("_goalfac failed! sb==NULL \n" ); - return -9999.99f; /*using crude but spot able values some times helps debuggin */ -} - - -static float _final_goal(SoftBody *sb,BodyPoint *bp)/*jow_go_for2_5 */ -{ - float f = -1999.99f; - if (sb && bp){ - if (bp->goal < 0.0f) return (0.0f); - f = pow(_goalfac(sb), 4.0f); - return (bp->goal *f); - } - printf("_final_goal failed! sb or bp ==NULL \n" ); - return f; /*using crude but spot able values some times helps debuggin */ -} -/* helper functions for everything is animateble jow_go_for2_5 ------*/ - /* makes totally fresh start situation */ static void mesh_to_softbody(Scene *scene, Object *ob) @@ -3264,7 +3268,6 @@ static void mesh_to_softbody(Scene *scene, Object *ob) MEdge *medge= me->medge; BodyPoint *bp; BodySpring *bs; - float goalfac; int a, totedge; if (ob->softflag & OB_SB_EDGES) totedge= me->totedge; else totedge= 0; @@ -3275,8 +3278,6 @@ static void mesh_to_softbody(Scene *scene, Object *ob) /* we always make body points */ sb= ob->soft; bp= sb->bpoint; - /*pick it from _goalfac jow_go_for2_5*/ - goalfac= _goalfac(sb); for(a=0; a<me->totvert; a++, bp++) { /* get scalar values needed *per vertex* from vertex group functions, @@ -3293,16 +3294,18 @@ static void mesh_to_softbody(Scene *scene, Object *ob) /* this is where '2.5 every thing is animateable' goes wrong in the first place jow_go_for2_5 */ /* 1st coding action to take : move this to frame level */ /* reads: leave the bp->goal as it was read from vertex group / or default .. we will need it at per frame call */ - bp->goal= sb->mingoal + bp->goal*goalfac; /* do not do here jow_go_for2_5 */ + /* should be fixed for meshes */ + // bp->goal= sb->mingoal + bp->goal*goalfac; /* do not do here jow_go_for2_5 */ + } + else{ + /* in consequence if no group was set .. but we want to animate it laters */ + /* logically attach to goal with default first */ + if(ob->softflag & OB_SB_GOAL){bp->goal =sb->defgoal;} } - /* a little ad hoc changing the goal control to be less *sharp* */ - bp->goal = (float)pow(bp->goal, 4.0f);/* do not do here jow_go_for2_5 */ /* to proove the concept - this would enable per vertex *mass painting* + this enables per vertex *mass painting* */ - /* first set the default */ - bp->mass = sb->nodemass; if (sb->namedVG_Mass[0]) { @@ -3310,7 +3313,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob) /* printf("VGN %s %d \n",sb->namedVG_Mass,grp); */ if(grp > -1){ get_scalar_from_vertexgroup(ob, a,(short) (grp), &bp->mass); - bp->mass = bp->mass * sb->nodemass; + /* 2.5 bp->mass = bp->mass * sb->nodemass; */ /* printf("bp->mass %f \n",bp->mass); */ } @@ -3400,7 +3403,7 @@ static void reference_to_scratch(Object *ob) for(a=0; a<sb->totpoint; a++, rp++, bp++) { VECCOPY(rp->pos,bp->pos); VECADD(accu_pos,accu_pos,bp->pos); - accu_mass += bp-> mass; + accu_mass += _final_mass(ob,bp); } mul_v3_fl(accu_pos,1.0f/accu_mass); VECCOPY(sb->scratch->Ref.com,accu_pos); @@ -3530,13 +3533,11 @@ static void lattice_to_softbody(Scene *scene, Object *ob) if(ob->softflag & OB_SB_GOAL){ BodyPoint *bp= sb->bpoint; BPoint *bpnt= lt->def; - float goalfac= ABS(sb->maxgoal - sb->mingoal); + /* jow_go_for2_5 */ int a; for(a=0; a<totvert; a++, bp++, bpnt++) { - bp->goal= sb->mingoal + bpnt->weight*goalfac; - /* a little ad hoc changing the goal control to be less *sharp* */ - bp->goal = (float)pow(bp->goal, 4.0f); + bp->goal= bpnt->weight; } } @@ -3557,7 +3558,6 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob) Nurb *nu; BezTriple *bezt; BPoint *bpnt; - float goalfac; int a, curindex=0; int totvert, totspring = 0, setgoal=0; @@ -3574,7 +3574,6 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob) sb= ob->soft; /* can be created in renew_softbody() */ /* set vars now */ - goalfac= ABS(sb->maxgoal - sb->mingoal); bp= sb->bpoint; bs= sb->bspring; @@ -3588,9 +3587,7 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob) if(nu->bezt) { for(bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++, bp+=3, curindex+=3) { if(setgoal) { - bp->goal= sb->mingoal + bezt->weight*goalfac; - /* a little ad hoc changing the goal control to be less *sharp* */ - bp->goal = (float)pow(bp->goal, 4.0f); + bp->goal= bezt->weight; /* all three triples */ (bp+1)->goal= bp->goal; @@ -3622,9 +3619,7 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob) else { for(bpnt=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bpnt++, bp++, curindex++) { if(setgoal) { - bp->goal= sb->mingoal + bpnt->weight*goalfac; - /* a little ad hoc changing the goal control to be less *sharp* */ - bp->goal = (float)pow(bp->goal, 4.0f); + bp->goal= bpnt->weight; } if(totspring && a>0) { bs->v1= curindex-1; diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 9d189237ba0..7308146ef92 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -14,10 +14,8 @@ #include "DNA_anim_types.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" -#include "DNA_sound_types.h" #include "DNA_packedFile_types.h" #include "DNA_screen_types.h" -#include "DNA_userdef_types.h" #include "AUD_C-API.h" @@ -31,7 +29,6 @@ #include "BKE_fcurve.h" #include "BKE_animsys.h" -#include "RNA_access.h" #ifdef HAVE_CONFIG_H #include <config.h> @@ -349,6 +346,13 @@ void sound_destroy_scene(struct Scene *scene) AUD_destroySequencer(scene->sound_scene); } +void* sound_scene_add_scene_sound(struct Scene *scene, struct Sequence* sequence, int startframe, int endframe, int frameskip) +{ + if(scene != sequence->scene) + return AUD_addSequencer(scene->sound_scene, &(sequence->scene->sound_scene), startframe / FPS, endframe / FPS, frameskip / FPS, sequence); + return NULL; +} + void* sound_add_scene_sound(struct Scene *scene, struct Sequence* sequence, int startframe, int endframe, int frameskip) { return AUD_addSequencer(scene->sound_scene, &(sequence->sound->playback_handle), startframe / FPS, endframe / FPS, frameskip / FPS, sequence); diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 5d542e143c3..c5c3ae0f022 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -42,20 +42,14 @@ #include "DNA_scene_types.h" #include "BKE_cdderivedmesh.h" -#include "BKE_customdata.h" -#include "BKE_DerivedMesh.h" -#include "BKE_displist.h" #include "BKE_utildefines.h" #include "BKE_global.h" #include "BKE_mesh.h" -#include "BKE_multires.h" #include "BKE_scene.h" #include "BKE_subsurf.h" #include "BLI_blenlib.h" #include "BLI_edgehash.h" -#include "BLI_editVert.h" -#include "BLI_linklist.h" #include "BLI_math.h" #include "BLI_memarena.h" #include "BLI_pbvh.h" diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c index 59635d4d344..1b720c1adaa 100644 --- a/source/blender/blenkernel/intern/suggestions.c +++ b/source/blender/blenkernel/intern/suggestions.c @@ -32,9 +32,7 @@ #include <ctype.h> #include "MEM_guardedalloc.h" -#include "BLI_blenlib.h" #include "DNA_text_types.h" -#include "BKE_text.h" #include "BKE_suggestions.h" /**********************/ diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 37c583943c6..a0908529a3a 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -37,8 +37,6 @@ #include "BLI_blenlib.h" -#include "DNA_action_types.h" -#include "DNA_armature_types.h" #include "DNA_constraint_types.h" #include "DNA_controller_types.h" #include "DNA_scene_types.h" @@ -50,7 +48,6 @@ #include "BKE_global.h" #include "BKE_library.h" #include "BKE_main.h" -#include "BKE_node.h" #include "BKE_text.h" #include "BKE_utildefines.h" diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 16cb8a8fb49..0a3f46b617e 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -42,28 +42,21 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_rand.h" #include "BLI_kdopbvh.h" -#include "DNA_texture_types.h" #include "DNA_key_types.h" #include "DNA_object_types.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" -#include "DNA_image_types.h" #include "DNA_world_types.h" #include "DNA_brush_types.h" #include "DNA_node_types.h" #include "DNA_color_types.h" -#include "DNA_scene_types.h" -#include "IMB_imbuf_types.h" #include "IMB_imbuf.h" #include "BKE_plugin_types.h" - #include "BKE_utildefines.h" - #include "BKE_global.h" #include "BKE_main.h" @@ -73,7 +66,6 @@ #include "BKE_texture.h" #include "BKE_key.h" #include "BKE_icons.h" -#include "BKE_brush.h" #include "BKE_node.h" #include "BKE_animsys.h" diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index fff0a08136b..0ac8b14166d 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -35,20 +35,10 @@ #include "MEM_guardedalloc.h" #include "DNA_world_types.h" -#include "DNA_texture_types.h" #include "DNA_scene_types.h" -#include "DNA_object_types.h" -#include "DNA_camera_types.h" - - -#include "BLI_blenlib.h" -#include "BLI_math.h" - -#include "BKE_utildefines.h" #include "BKE_library.h" #include "BKE_animsys.h" -#include "BKE_world.h" #include "BKE_global.h" #include "BKE_main.h" #include "BKE_icons.h" diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 8aa9282937c..ccef6832be8 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -1242,7 +1242,8 @@ void ffmpeg_verify_image_type(RenderData *rd) rd->ffcodecdata.video_bitrate <= 1) { rd->ffcodecdata.codec = CODEC_ID_MPEG2VIDEO; - ffmpeg_set_preset(rd, FFMPEG_PRESET_DVD); + /* Don't set preset, disturbs render resolution. + * ffmpeg_set_preset(rd, FFMPEG_PRESET_DVD); */ } audio= 1; diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c index 20d858fffeb..d715d18877d 100644 --- a/source/blender/blenkernel/intern/writeframeserver.c +++ b/source/blender/blenkernel/intern/writeframeserver.c @@ -44,14 +44,11 @@ #include <stdlib.h> #include "MEM_guardedalloc.h" -#include "BLI_blenlib.h" #include "DNA_userdef_types.h" #include "BKE_global.h" #include "BKE_report.h" -#include "IMB_imbuf_types.h" -#include "IMB_imbuf.h" #include "DNA_scene_types.h" diff --git a/source/blender/blenlib/BLI_args.h b/source/blender/blenlib/BLI_args.h index d2bbdd1bf5f..61f83ccf6f9 100644 --- a/source/blender/blenlib/BLI_args.h +++ b/source/blender/blenlib/BLI_args.h @@ -1,7 +1,7 @@ /** * A general argument parsing module * - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h index f2fec215c2b..1f6a1ee5a97 100644 --- a/source/blender/blenlib/BLI_listbase.h +++ b/source/blender/blenlib/BLI_listbase.h @@ -49,6 +49,7 @@ int BLI_findstringindex(struct ListBase *listbase, const char *id, int offset); void BLI_freelistN(struct ListBase *listbase); void BLI_addtail(struct ListBase *listbase, void *vlink); void BLI_remlink(struct ListBase *listbase, void *vlink); +int BLI_remlink_safe(struct ListBase *listbase, void *vlink); void BLI_addhead(struct ListBase *listbase, void *vlink); void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink); diff --git a/source/blender/blenlib/BLI_storage.h b/source/blender/blenlib/BLI_storage.h index 7791c596229..61f175cb772 100644 --- a/source/blender/blenlib/BLI_storage.h +++ b/source/blender/blenlib/BLI_storage.h @@ -50,7 +50,7 @@ int BLI_filesize(int file); int BLI_filepathsize(const char *path); double BLI_diskfree(char *dir); char *BLI_getwdN(char *dir); -void BLI_hide_dot_files(int set); + unsigned int BLI_getdir(char *dirname, struct direntry **filelist); /** * @attention Do not confuse with BLI_exists diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h index 25ecea919e7..eda0e830736 100644 --- a/source/blender/blenlib/BLI_threads.h +++ b/source/blender/blenlib/BLI_threads.h @@ -1,6 +1,6 @@ /* * - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -59,7 +59,8 @@ int BLI_system_thread_count(void); /* gets the number of threads the system can #define LOCK_IMAGE 0 #define LOCK_PREVIEW 1 -#define LOCK_CUSTOM1 2 +#define LOCK_VIEWER 2 +#define LOCK_CUSTOM1 3 void BLI_lock_thread(int type); void BLI_unlock_thread(int type); diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index cd876023830..1a677499d1f 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -1,7 +1,7 @@ /** * A general argument parsing module * - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -177,6 +177,10 @@ void BLI_argsParse(struct bArgs *ba, int pass, BA_ArgCallback default_cb, void * int i = 0; for( i = 1; i < ba->argc; i++) { /* skip argv[0] */ + /* stop on -- */ + if (BLI_streq(ba->argv[i], "--")) + break; + if (ba->passes[i] == 0) { /* -1 signal what side of the comparison it is */ bArgument *a = lookUp(ba, ba->argv[i], pass, -1); diff --git a/source/blender/blenlib/intern/BLI_dynstr.c b/source/blender/blenlib/intern/BLI_dynstr.c index 4b7b61e64d9..5b61a86305b 100644 --- a/source/blender/blenlib/intern/BLI_dynstr.c +++ b/source/blender/blenlib/intern/BLI_dynstr.c @@ -29,8 +29,6 @@ */ #include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> #include "MEM_guardedalloc.h" diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 23200680d5d..b95f276a702 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -28,17 +28,10 @@ * A general (pointer -> pointer) hash table ADT */ -#include <stdlib.h> -#include <string.h> -#include "MEM_guardedalloc.h" #include "BLI_ghash.h" -#include "BLI_mempool.h" - #include "BLO_sys_types.h" // for intptr_t support -#include "BKE_utildefines.h" - #ifdef HAVE_CONFIG_H #include <config.h> #endif diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c index 196c9ed284c..6c4e568c380 100644 --- a/source/blender/blenlib/intern/BLI_heap.c +++ b/source/blender/blenlib/intern/BLI_heap.c @@ -28,7 +28,6 @@ * A heap / priority queue ADT. */ -#include <stdlib.h> #include <string.h> #include "MEM_guardedalloc.h" diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 7118b804cad..bba9b1793c7 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -26,10 +26,6 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include "math.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> #include <assert.h> #include "MEM_guardedalloc.h" diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c index 38b4d7a54d2..cf94a0c9ffe 100644 --- a/source/blender/blenlib/intern/BLI_kdtree.c +++ b/source/blender/blenlib/intern/BLI_kdtree.c @@ -28,9 +28,6 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include <stdlib.h> -#include <string.h> -#include <math.h> #include "MEM_guardedalloc.h" diff --git a/source/blender/blenlib/intern/BLI_linklist.c b/source/blender/blenlib/intern/BLI_linklist.c index 4631d9e6bf2..f9c5fc58a63 100644 --- a/source/blender/blenlib/intern/BLI_linklist.c +++ b/source/blender/blenlib/intern/BLI_linklist.c @@ -29,7 +29,6 @@ */ #include "MEM_guardedalloc.h" -#include "BLI_blenlib.h" #include "BLI_linklist.h" #include "BLI_memarena.h" diff --git a/source/blender/blenlib/intern/BLI_memarena.c b/source/blender/blenlib/intern/BLI_memarena.c index 6c87f0914f9..07e22b30fcc 100644 --- a/source/blender/blenlib/intern/BLI_memarena.c +++ b/source/blender/blenlib/intern/BLI_memarena.c @@ -28,11 +28,9 @@ * Efficient memory allocation for lots of similar small chunks. */ -#include <stdlib.h> #include "MEM_guardedalloc.h" -#include "BLI_blenlib.h" #include "BLI_memarena.h" #include "BLI_linklist.h" diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index 7972000c4d6..26d6f5af147 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -32,8 +32,6 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" -#include "DNA_listBase.h" -#include "BLI_linklist.h" #include <string.h> typedef struct BLI_freenode{ diff --git a/source/blender/blenlib/intern/DLRB_tree.c b/source/blender/blenlib/intern/DLRB_tree.c index 9b38289f15b..69c9cc7e522 100644 --- a/source/blender/blenlib/intern/DLRB_tree.c +++ b/source/blender/blenlib/intern/DLRB_tree.c @@ -25,17 +25,11 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" #include "BLI_dlrbTree.h" -#include "DNA_listBase.h" - /* *********************************************** */ /* Tree API */ diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 8e294395c86..f7c16a0a8b2 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -27,12 +27,7 @@ */ #include <sys/stat.h> -#include <sys/types.h> -#include <fcntl.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> #include <string.h> /* path/file handeling stuff */ @@ -46,13 +41,9 @@ #include "MEM_guardedalloc.h" -#include "DNA_ID.h" /* Library */ -#include "DNA_customdata_types.h" -#include "DNA_image_types.h" #include "DNA_mesh_types.h" #include "DNA_scene_types.h" /* to get the current frame */ #include "DNA_sequence_types.h" -#include "DNA_sound_types.h" #include "DNA_vfont_types.h" #include "DNA_windowmanager_types.h" diff --git a/source/blender/blenlib/intern/dynamiclist.c b/source/blender/blenlib/intern/dynamiclist.c index 4bcccab4b18..48ba8247ea9 100644 --- a/source/blender/blenlib/intern/dynamiclist.c +++ b/source/blender/blenlib/intern/dynamiclist.c @@ -34,7 +34,6 @@ #include "MEM_guardedalloc.h" -#include "DNA_listBase.h" #include "BLI_listbase.h" #include "BLI_dynamiclist.h" diff --git a/source/blender/blenlib/intern/dynlib.c b/source/blender/blenlib/intern/dynlib.c index eb41916c619..cc681a4c7c7 100644 --- a/source/blender/blenlib/intern/dynlib.c +++ b/source/blender/blenlib/intern/dynlib.c @@ -28,8 +28,6 @@ */ #include <stdlib.h> -#include <string.h> -#include <stdio.h> #include "../PIL_dynlib.h" @@ -47,6 +45,8 @@ */ #ifdef WIN32 +#include <string.h> +#include <stdio.h> #include <windows.h> diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 3503164ea56..73434c548a0 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -29,7 +29,6 @@ #include <string.h> #include <stdio.h> -#include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> @@ -49,9 +48,6 @@ #include "BLI_blenlib.h" -#include "BLI_storage.h" -#include "BLI_fileops.h" -#include "BLI_callbacks.h" #include "BKE_utildefines.h" diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index b08631b9317..9227803b681 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -36,10 +36,11 @@ #include <ft2build.h> #include FT_FREETYPE_H -#include FT_GLYPH_H -#include FT_BBOX_H -#include FT_SIZES_H -#include <freetype/ttnameid.h> +/* not needed yet */ +// #include FT_GLYPH_H +// #include FT_BBOX_H +// #include FT_SIZES_H +// #include <freetype/ttnameid.h> #include "MEM_guardedalloc.h" @@ -49,7 +50,6 @@ //XXX #include "BIF_toolbox.h" -#include "BKE_global.h" #include "BKE_font.h" #include "BKE_utildefines.h" @@ -150,7 +150,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf nu->pntsu = onpoints[j]; nu->resolu= 8; nu->flag= CU_2D; - nu->flagu= CU_CYCLIC; + nu->flagu= CU_NURB_CYCLIC; nu->bezt = bezt; //individual curve loop, start-end diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c index dd708b27019..808dc743d44 100644 --- a/source/blender/blenlib/intern/graph.c +++ b/source/blender/blenlib/intern/graph.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenlib/intern/jitter.c b/source/blender/blenlib/intern/jitter.c index 12b7482897a..dfc554394d6 100644 --- a/source/blender/blenlib/intern/jitter.c +++ b/source/blender/blenlib/intern/jitter.c @@ -30,13 +30,10 @@ */ #include <math.h> -#include <stdlib.h> #include <string.h> #include "MEM_guardedalloc.h" -#include "BLI_math.h" #include "BLI_rand.h" -#include "BLI_jitter.h" void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1) diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index 5d046dce023..0a6831558d1 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -108,6 +108,17 @@ void BLI_remlink(ListBase *listbase, void *vlink) if (listbase->first == link) listbase->first = link->next; } +int BLI_remlink_safe(ListBase *listbase, void *vlink) +{ + if(BLI_findindex(listbase, vlink) != -1) { + BLI_remlink(listbase, vlink); + return 1; + } + else { + return 0; + } +} + void BLI_freelinkN(ListBase *listbase, void *vlink) { diff --git a/source/blender/blenlib/intern/math_base.c b/source/blender/blenlib/intern/math_base.c index a0d878f3a03..8301f790614 100644 --- a/source/blender/blenlib/intern/math_base.c +++ b/source/blender/blenlib/intern/math_base.c @@ -25,10 +25,6 @@ * ***** END GPL LICENSE BLOCK ***** * */ -#include <float.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> #include "BLI_math.h" diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c index fa0ca097ef1..b364ff73e4f 100644 --- a/source/blender/blenlib/intern/math_base_inline.c +++ b/source/blender/blenlib/intern/math_base_inline.c @@ -26,7 +26,6 @@ * */ #include <float.h> -#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index fc6e722afeb..633585a3336 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -25,10 +25,6 @@ * ***** END GPL LICENSE BLOCK ***** * */ -#include <float.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> #include "BLI_math.h" diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index d12aa1051dc..f2454f05977 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -25,10 +25,6 @@ * ***** END GPL LICENSE BLOCK ***** * */ -#include <float.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> #include "BLI_math.h" #include "BLI_memarena.h" diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index c970f2132c3..b3dd5a09f71 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -25,10 +25,6 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include <float.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> #include "BLI_math.h" diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index a92f80e35c7..b6dc0ca06cd 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -25,10 +25,6 @@ * ***** END GPL LICENSE BLOCK ***** * */ -#include <float.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> #include "BLI_math.h" diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 2452de0dc4c..97f5ea73ea9 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -25,10 +25,6 @@ * ***** END GPL LICENSE BLOCK ***** * */ -#include <float.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> #include "BLI_math.h" diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index 343589d9a41..d0ce193e0e0 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -35,7 +35,6 @@ #endif #include <math.h> -#include "BLI_blenlib.h" #ifdef HAVE_CONFIG_H #include <config.h> diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 3fe9a387a54..00cb6764b60 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -29,20 +29,14 @@ * various string, file, list operations. */ -#include <stdio.h> -#include <fcntl.h> #include <ctype.h> #include <string.h> #include <stdlib.h> -#include <stdarg.h> -#include <math.h> /* for log10 */ #include "MEM_guardedalloc.h" -#include "DNA_listBase.h" #include "DNA_userdef_types.h" -#include "BLI_dynamiclist.h" #include "BLI_fileops.h" #include "BLI_path_util.h" #include "BLI_string.h" @@ -58,13 +52,9 @@ #include <config.h> #endif -#ifndef WIN32 -#include <unistd.h> -#else -#include <io.h> -#endif #ifdef WIN32 +#include <io.h> #ifdef _WIN32_IE #undef _WIN32_IE @@ -75,12 +65,7 @@ #include "BLI_winstuff.h" -#endif - - -#ifndef WIN32 -#include <sys/time.h> -#endif +#else /* non windows */ #ifdef __APPLE__ #include <sys/param.h> @@ -91,6 +76,8 @@ #include "binreloc.h" #endif +#endif /* WIN32 */ + /* local */ static int add_win32_extension(char *name); @@ -1512,8 +1499,6 @@ char* BLI_getbundle(void) { #endif #ifdef WITH_ICONV -#include "iconv.h" -#include "localcharset.h" void BLI_string_to_utf8(char *original, char *utf_8, const char *code) { diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index 1cc4f4edfcd..c21f086156e 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -20,11 +20,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include <float.h> -#include <stdlib.h> -#include <string.h> -#include "MEM_guardedalloc.h" #include "DNA_meshdata_types.h" @@ -33,8 +29,6 @@ #include "BLI_pbvh.h" #include "BKE_DerivedMesh.h" -#include "BKE_mesh.h" -#include "BKE_utildefines.h" #include "gpu_buffers.h" diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c index 959d8be466f..4506115cd8c 100644 --- a/source/blender/blenlib/intern/rct.c +++ b/source/blender/blenlib/intern/rct.c @@ -36,7 +36,6 @@ */ #include "DNA_vec_types.h" -#include "BLI_blenlib.h" #ifdef HAVE_CONFIG_H #include <config.h> diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index efcc767fd18..9870951d4d3 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -28,20 +28,12 @@ * (uit traces) maart 95 */ -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - #include "MEM_guardedalloc.h" -#include "DNA_listBase.h" -#include "DNA_mesh_types.h" #include "BLI_editVert.h" #include "BLI_listbase.h" #include "BLI_math.h" -#include "BLI_scanfill.h" -#include "BLI_callbacks.h" #ifdef HAVE_CONFIG_H #include <config.h> diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index f21e5ef5575..086f20b7e21 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -90,8 +90,6 @@ #include "BLI_listbase.h" #include "BLI_linklist.h" -#include "BLI_path_util.h" -#include "BLI_storage.h" #include "BLI_storage_types.h" #include "BLI_string.h" #include "BKE_utildefines.h" @@ -204,14 +202,6 @@ double BLI_diskfree(char *dir) #endif } -static int hide_dot= 0; - -void BLI_hide_dot_files(int set) -{ - if(set) hide_dot= 1; - else hide_dot= 0; -} - void BLI_builddir(char *dirname, char *relname) { struct dirent *fname; @@ -237,17 +227,12 @@ void BLI_builddir(char *dirname, char *relname) while ((fname = (struct dirent*) readdir(dir)) != NULL) { len= strlen(fname->d_name); - if(hide_dot && fname->d_name[0]=='.' && fname->d_name[1]!='.' && fname->d_name[1]!=0); /* ignore .file */ - else if(hide_dot && len && fname->d_name[len-1]=='~'); /* ignore file~ */ - else if (((fname->d_name[0] == '.') && (fname->d_name[1] == 0) )); /* ignore . */ - else { - dlink = (struct dirlink *)malloc(sizeof(struct dirlink)); - if (dlink){ - strcpy(buf+rellen,fname->d_name); - dlink->name = BLI_strdup(buf); - BLI_addhead(dirbase,dlink); - newnum++; - } + dlink = (struct dirlink *)malloc(sizeof(struct dirlink)); + if (dlink){ + strcpy(buf+rellen,fname->d_name); + dlink->name = BLI_strdup(buf); + BLI_addhead(dirbase,dlink); + newnum++; } } diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index dd1d0a3bd4f..fd0b7e13a66 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -32,7 +32,6 @@ * */ -#include <stdio.h> #include <string.h> #include <stdlib.h> #include <stdarg.h> diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index 5f5a0720940..351e0be1102 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -28,15 +28,10 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include <math.h> -#include <stdlib.h> -#include <string.h> -#include <pthread.h> #include <errno.h> #include "MEM_guardedalloc.h" -#include "DNA_listBase.h" #include "BLI_blenlib.h" #include "BLI_gsqueue.h" @@ -109,6 +104,7 @@ A sample loop can look like this (pseudo c); static pthread_mutex_t _malloc_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _image_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _preview_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t _viewer_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _custom1_lock = PTHREAD_MUTEX_INITIALIZER; static int thread_levels= 0; /* threads can be invoked inside threads */ @@ -229,8 +225,8 @@ void BLI_remove_thread(ListBase *threadbase, void *callerdata) for(tslot= threadbase->first; tslot; tslot= tslot->next) { if(tslot->callerdata==callerdata) { - tslot->callerdata= NULL; pthread_join(tslot->pthread, NULL); + tslot->callerdata= NULL; tslot->avail= 1; } } @@ -243,8 +239,8 @@ void BLI_remove_thread_index(ListBase *threadbase, int index) for(tslot = threadbase->first; tslot; tslot = tslot->next, counter++) { if (counter == index && tslot->avail == 0) { - tslot->callerdata = NULL; pthread_join(tslot->pthread, NULL); + tslot->callerdata = NULL; tslot->avail = 1; break; } @@ -257,8 +253,8 @@ void BLI_remove_threads(ListBase *threadbase) for(tslot = threadbase->first; tslot; tslot = tslot->next) { if (tslot->avail == 0) { - tslot->callerdata = NULL; pthread_join(tslot->pthread, NULL); + tslot->callerdata = NULL; tslot->avail = 1; } } @@ -327,6 +323,8 @@ void BLI_lock_thread(int type) pthread_mutex_lock(&_image_lock); else if (type==LOCK_PREVIEW) pthread_mutex_lock(&_preview_lock); + else if (type==LOCK_VIEWER) + pthread_mutex_lock(&_viewer_lock); else if (type==LOCK_CUSTOM1) pthread_mutex_lock(&_custom1_lock); } @@ -337,6 +335,8 @@ void BLI_unlock_thread(int type) pthread_mutex_unlock(&_image_lock); else if (type==LOCK_PREVIEW) pthread_mutex_unlock(&_preview_lock); + else if (type==LOCK_VIEWER) + pthread_mutex_unlock(&_viewer_lock); else if(type==LOCK_CUSTOM1) pthread_mutex_unlock(&_custom1_lock); } diff --git a/source/blender/blenlib/intern/time.c b/source/blender/blenlib/intern/time.c index b0a284c4074..304884ba8ca 100644 --- a/source/blender/blenlib/intern/time.c +++ b/source/blender/blenlib/intern/time.c @@ -26,14 +26,13 @@ * * ***** END GPL LICENSE BLOCK ***** */ -#include "PIL_time.h" #ifdef HAVE_CONFIG_H #include <config.h> #endif #ifdef WIN32 - +#include "PIL_time.h" #include <windows.h> double PIL_check_seconds_timer(void) diff --git a/source/blender/blenlib/intern/voxel.c b/source/blender/blenlib/intern/voxel.c index 78267528e21..302d721264d 100644 --- a/source/blender/blenlib/intern/voxel.c +++ b/source/blender/blenlib/intern/voxel.c @@ -25,7 +25,6 @@ * * ***** END GPL LICENSE BLOCK ***** */ -#include <math.h> #include "BLI_voxel.h" diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 811b7e88f82..df7cd25a6db 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -205,7 +205,7 @@ int BLO_has_bfile_extension(char *str); /* return ok when a blenderfile, in dir is the filename, * in group the type of libdata */ -int BLO_is_a_library(char *path, char *dir, char *group); +int BLO_is_a_library(const char *path, char *dir, char *group); struct Main* BLO_library_append_begin(const struct bContext *C, BlendHandle** bh, char *dir); void BLO_library_append_named_part(const struct bContext *C, struct Main *mainl, BlendHandle** bh, char *name, int idcode, short flag); diff --git a/source/blender/blenloader/BLO_undofile.h b/source/blender/blenloader/BLO_undofile.h index 435091b49e0..9ec03c4e4d4 100644 --- a/source/blender/blenloader/BLO_undofile.h +++ b/source/blender/blenloader/BLO_undofile.h @@ -1,5 +1,5 @@ /* - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 083b57cf2b6..013544acffb 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -377,7 +377,7 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil /* makes lookup of existing images in old main */ blo_make_image_pointer_map(fd, oldmain); - bfd= blo_read_file_internal(fd, ""); + bfd= blo_read_file_internal(fd, filename); /* ensures relinked images are not freed */ blo_end_image_pointer_map(fd, oldmain); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 23ea01b8451..ec378c4d4a7 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1070,7 +1070,7 @@ int BLO_has_bfile_extension(char *str) return (BLI_testextensie(str, ".ble") || BLI_testextensie(str, ".blend")||BLI_testextensie(str, ".blend.gz")); } -int BLO_is_a_library(char *path, char *dir, char *group) +int BLO_is_a_library(const char *path, char *dir, char *group) { /* return ok when a blenderfile, in dir is the filename, * in group the type of libdata @@ -1087,7 +1087,7 @@ int BLO_is_a_library(char *path, char *dir, char *group) dir[len-1]= 0; /* Find the last slash */ - fd= (strrchr(dir, '/')>strrchr(dir, '\\'))?strrchr(dir, '/'):strrchr(dir, '\\'); + fd= BLI_last_slash(dir); if(fd==0) return 0; *fd= 0; @@ -1099,7 +1099,7 @@ int BLO_is_a_library(char *path, char *dir, char *group) char *gp = fd+1; // in case we have a .blend file, gp points to the group /* Find the last slash */ - fd= (strrchr(dir, '/')>strrchr(dir, '\\'))?strrchr(dir, '/'):strrchr(dir, '\\'); + fd= BLI_last_slash(dir); if (!fd || !BLO_has_bfile_extension(fd+1)) return 0; /* now we know that we are in a blend file and it is safe to @@ -3029,6 +3029,7 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part) part->pd= newdataadr(fd, part->pd); part->pd2= newdataadr(fd, part->pd2); + direct_link_animdata(fd, part->adt); direct_link_partdeflect(part->pd); direct_link_partdeflect(part->pd2); @@ -4142,7 +4143,10 @@ static void lib_link_scene(FileData *fd, Main *main) SEQ_BEGIN(sce->ed, seq) { if(seq->ipo) seq->ipo= newlibadr_us(fd, sce->id.lib, seq->ipo); - if(seq->scene) seq->scene= newlibadr(fd, sce->id.lib, seq->scene); + if(seq->scene) { + seq->scene= newlibadr(fd, sce->id.lib, seq->scene); + seq->scene_sound = sound_scene_add_scene_sound(sce, seq, seq->startdisp, seq->enddisp, seq->startofs); + } if(seq->scene_camera) seq->scene_camera= newlibadr(fd, sce->id.lib, seq->scene_camera); if(seq->sound) { seq->scene_sound = NULL; @@ -10740,7 +10744,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead) return bhead; } -BlendFileData *blo_read_file_internal(FileData *fd, char *file) +BlendFileData *blo_read_file_internal(FileData *fd, const char *filename) { BHead *bhead= blo_firstbhead(fd); BlendFileData *bfd; @@ -10752,7 +10756,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, char *file) bfd->main->versionfile= fd->fileversion; bfd->type= BLENFILETYPE_BLEND; - strncpy(bfd->main->name, file, sizeof(bfd->main->name)-1); + strncpy(bfd->main->name, filename, sizeof(bfd->main->name)-1); while(bhead) { switch(bhead->code) { diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index cc3643c0364..8e391fa438e 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -108,7 +108,7 @@ struct Main; void blo_join_main(ListBase *mainlist); void blo_split_main(ListBase *mainlist, struct Main *main); -BlendFileData *blo_read_file_internal(FileData *fd, char *file); +BlendFileData *blo_read_file_internal(FileData *fd, const char *filename); FileData *blo_openblenderfile(char *name, struct ReportList *reports); FileData *blo_openblendermemory(void *buffer, int buffersize, struct ReportList *reports); diff --git a/source/blender/blenloader/intern/undofile.c b/source/blender/blenloader/intern/undofile.c index d52646cbe00..f9d51e946a0 100644 --- a/source/blender/blenloader/intern/undofile.c +++ b/source/blender/blenloader/intern/undofile.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 3e711ccc2c1..1ce66ecf602 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -25,10 +25,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include <math.h> -#include <stdlib.h> -#include <string.h> -#include <float.h> + #ifdef HAVE_CONFIG_H #include <config.h> @@ -39,54 +36,33 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "DNA_listBase.h" #include "DNA_anim_types.h" -#include "DNA_action_types.h" #include "DNA_armature_types.h" #include "DNA_camera_types.h" -#include "DNA_curve_types.h" #include "DNA_object_types.h" #include "DNA_particle_types.h" #include "DNA_screen_types.h" #include "DNA_scene_types.h" #include "DNA_space_types.h" -#include "DNA_constraint_types.h" #include "DNA_key_types.h" #include "DNA_lamp_types.h" #include "DNA_mesh_types.h" #include "DNA_material_types.h" -#include "DNA_texture_types.h" #include "DNA_meta_types.h" #include "DNA_node_types.h" -#include "DNA_userdef_types.h" -#include "DNA_gpencil_types.h" -#include "DNA_windowmanager_types.h" #include "DNA_world_types.h" #include "RNA_access.h" -#include "RNA_define.h" - -#include "BKE_animsys.h" -#include "BKE_action.h" #include "BKE_curve.h" -#include "BKE_depsgraph.h" -#include "BKE_fcurve.h" #include "BKE_key.h" -#include "BKE_material.h" -#include "BKE_object.h" #include "BKE_context.h" -#include "BKE_utildefines.h" #include "UI_interface.h" #include "UI_interface_icons.h" #include "UI_resources.h" -#include "UI_view2d.h" #include "ED_anim_api.h" #include "ED_keyframing.h" -#include "ED_keyframes_edit.h" // XXX move the select modes out of there! -#include "ED_screen.h" -#include "ED_space_api.h" #include "BIF_gl.h" diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 26dd0285a2f..4f8e09d3df9 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -25,11 +25,6 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include <math.h> -#include <stdlib.h> -#include <string.h> -#include <float.h> - #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -37,51 +32,25 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" -#include "BLI_math.h" -#include "DNA_listBase.h" #include "DNA_anim_types.h" -#include "DNA_action_types.h" -#include "DNA_armature_types.h" -#include "DNA_camera_types.h" -#include "DNA_curve_types.h" #include "DNA_object_types.h" -#include "DNA_particle_types.h" -#include "DNA_screen_types.h" #include "DNA_scene_types.h" -#include "DNA_space_types.h" -#include "DNA_constraint_types.h" #include "DNA_key_types.h" -#include "DNA_lamp_types.h" -#include "DNA_material_types.h" -#include "DNA_meta_types.h" -#include "DNA_userdef_types.h" -#include "DNA_gpencil_types.h" -#include "DNA_windowmanager_types.h" -#include "DNA_world_types.h" #include "RNA_access.h" #include "RNA_define.h" -#include "BKE_animsys.h" #include "BKE_action.h" -#include "BKE_depsgraph.h" #include "BKE_fcurve.h" -#include "BKE_key.h" -#include "BKE_material.h" -#include "BKE_object.h" #include "BKE_context.h" #include "BKE_global.h" -#include "BKE_utildefines.h" -#include "UI_interface.h" -#include "UI_resources.h" #include "UI_view2d.h" #include "ED_anim_api.h" #include "ED_keyframes_edit.h" // XXX move the select modes out of there! #include "ED_screen.h" -#include "ED_space_api.h" #include "WM_api.h" #include "WM_types.h" diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index 3f461889485..82575cf58fa 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -26,14 +26,11 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include <stdlib.h> #include <string.h> -#include <math.h> #include "MEM_guardedalloc.h" #include "DNA_anim_types.h" -#include "DNA_action_types.h" #include "DNA_armature_types.h" #include "DNA_object_types.h" #include "DNA_node_types.h" @@ -47,21 +44,13 @@ #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_global.h" -#include "BKE_main.h" #include "BKE_node.h" -#include "BKE_scene.h" #include "BKE_sequencer.h" -#include "BKE_screen.h" #include "BKE_utildefines.h" #include "RNA_access.h" -#include "RNA_define.h" #include "ED_anim_api.h" -#include "ED_screen.h" - -#include "WM_api.h" -#include "WM_types.h" /* **************************** depsgraph tagging ******************************** */ diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 9d723c1b8f5..8ac64a78d18 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -25,47 +25,22 @@ * * ***** END GPL LICENSE BLOCK ***** */ - -#include <string.h> -#include <stdio.h> #include "DNA_anim_types.h" -#include "DNA_action_types.h" -#include "DNA_curve_types.h" #include "DNA_object_types.h" -#include "DNA_space_types.h" #include "DNA_scene_types.h" -#include "DNA_screen_types.h" -#include "DNA_windowmanager_types.h" - -#include "MEM_guardedalloc.h" - -#include "BLI_blenlib.h" #include "BLI_math.h" -#include "BKE_animsys.h" -#include "BKE_action.h" #include "BKE_context.h" -#include "BKE_global.h" -#include "BKE_fcurve.h" -#include "BKE_main.h" #include "BKE_nla.h" #include "BKE_object.h" -#include "BKE_screen.h" -#include "BKE_utildefines.h" #include "ED_anim_api.h" #include "ED_keyframes_edit.h" -#include "ED_types.h" -#include "ED_util.h" - -#include "WM_api.h" -#include "WM_types.h" #include "RNA_access.h" #include "BIF_gl.h" -#include "BIF_glutil.h" #include "UI_interface.h" #include "UI_resources.h" diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 2bd4ab34fa5..15c899c6d8d 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -46,18 +46,11 @@ */ #include <string.h> -#include <stdio.h> -#include "DNA_listBase.h" -#include "DNA_ID.h" #include "DNA_anim_types.h" -#include "DNA_action_types.h" #include "DNA_armature_types.h" #include "DNA_constraint_types.h" #include "DNA_camera_types.h" -#include "DNA_curve_types.h" -#include "DNA_gpencil_types.h" -#include "DNA_group_types.h" #include "DNA_lamp_types.h" #include "DNA_lattice_types.h" #include "DNA_key_types.h" @@ -65,14 +58,11 @@ #include "DNA_mesh_types.h" #include "DNA_meta_types.h" #include "DNA_node_types.h" -#include "DNA_object_types.h" #include "DNA_particle_types.h" #include "DNA_space_types.h" #include "DNA_sequence_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" -#include "DNA_texture_types.h" -#include "DNA_windowmanager_types.h" #include "DNA_world_types.h" #include "MEM_guardedalloc.h" @@ -86,26 +76,12 @@ #include "BKE_global.h" #include "BKE_group.h" #include "BKE_key.h" -#include "BKE_object.h" #include "BKE_material.h" #include "BKE_node.h" #include "BKE_sequencer.h" -#include "BKE_screen.h" #include "BKE_utildefines.h" #include "ED_anim_api.h" -#include "ED_types.h" -#include "ED_util.h" - -#include "WM_api.h" -#include "WM_types.h" - -#include "BIF_gl.h" -#include "BIF_glutil.h" - -#include "UI_interface.h" -#include "UI_resources.h" -#include "UI_view2d.h" /* ************************************************************ */ /* Blender Context <-> Animation Context mapping */ diff --git a/source/blender/editors/animation/anim_intern.h b/source/blender/editors/animation/anim_intern.h index 5602bff77ce..379b8c27de5 100644 --- a/source/blender/editors/animation/anim_intern.h +++ b/source/blender/editors/animation/anim_intern.h @@ -33,12 +33,6 @@ /* list of builtin KeyingSets (defined in keyingsets.c) */ extern ListBase builtin_keyingsets; -/* for builtin keyingsets - context poll */ -short keyingset_context_ok_poll(bContext *C, KeyingSet *ks); - -/* Main KeyingSet operations API call */ -short modifykey_get_context_data (bContext *C, ListBase *dsources, KeyingSet *ks); - /* Operator Define Prototypes ------------------- */ /* Main Keyframe Management operators: diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c index 0f29c274535..b71e9ac3507 100644 --- a/source/blender/editors/animation/anim_ipo_utils.c +++ b/source/blender/editors/animation/anim_ipo_utils.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -33,31 +33,16 @@ */ -#include <math.h> -#include <stdio.h> -#include <string.h> - #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" #include "BLI_math.h" #include "DNA_anim_types.h" -#include "DNA_key_types.h" -#include "DNA_object_types.h" -#include "DNA_space_types.h" -#include "DNA_scene_types.h" -#include "DNA_view3d_types.h" -#include "BKE_animsys.h" -#include "BKE_key.h" #include "BKE_utildefines.h" -#include "UI_resources.h" -#include "ED_anim_api.h" - #include "RNA_access.h" -#include "RNA_types.h" /* ----------------------- Getter functions ----------------------- */ diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 2888a95f704..4ebf03349ec 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -26,18 +26,11 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include <stdlib.h> #include <math.h> #include "MEM_guardedalloc.h" -#include "DNA_action_types.h" #include "DNA_scene_types.h" -#include "DNA_screen_types.h" -#include "DNA_space_types.h" -#include "DNA_view2d_types.h" -#include "DNA_userdef_types.h" -#include "DNA_windowmanager_types.h" #include "DNA_object_types.h" #include "RNA_access.h" @@ -47,9 +40,7 @@ #include "BLI_blenlib.h" #include "BKE_context.h" -#include "BKE_global.h" #include "BKE_fcurve.h" -#include "BKE_utildefines.h" #include "BKE_main.h" #include "BKE_report.h" #include "BKE_scene.h" @@ -67,7 +58,6 @@ #include "ED_markers.h" #include "ED_screen.h" -#include "ED_types.h" #include "ED_util.h" #include "ED_numinput.h" #include "ED_object.h" diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 4e310e27c5f..348520b60bf 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -29,22 +29,12 @@ #include <stdlib.h> #include <math.h> -#include "MEM_guardedalloc.h" - #include "DNA_anim_types.h" -#include "DNA_action_types.h" #include "DNA_scene_types.h" -#include "DNA_screen_types.h" -#include "DNA_space_types.h" -#include "DNA_windowmanager_types.h" - -#include "BLI_blenlib.h" #include "BKE_context.h" -#include "BKE_utildefines.h" #include "BKE_sound.h" -#include "UI_interface.h" #include "UI_view2d.h" #include "RNA_access.h" @@ -53,9 +43,6 @@ #include "WM_api.h" #include "WM_types.h" -#include "ED_anim_api.h" -#include "ED_keyframing.h" -#include "ED_markers.h" #include "ED_screen.h" #include "anim_intern.h" diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index ababa25917a..5024ca39970 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -27,45 +27,18 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include <stdio.h> -#include <stddef.h> #include <string.h> -#include <math.h> -#include <float.h> #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" -#include "BLI_math.h" -#include "BLI_dynstr.h" #include "DNA_anim_types.h" -#include "DNA_action_types.h" -#include "DNA_armature_types.h" -#include "DNA_constraint_types.h" -#include "DNA_key_types.h" -#include "DNA_object_types.h" -#include "DNA_material_types.h" -#include "DNA_scene_types.h" -#include "DNA_userdef_types.h" -#include "DNA_windowmanager_types.h" #include "BKE_animsys.h" -#include "BKE_action.h" -#include "BKE_constraint.h" #include "BKE_depsgraph.h" #include "BKE_fcurve.h" -#include "BKE_utildefines.h" #include "BKE_context.h" -#include "BKE_report.h" -#include "BKE_key.h" -#include "BKE_material.h" - -#include "ED_anim_api.h" -#include "ED_keyframing.h" -#include "ED_keyframes_edit.h" -#include "ED_screen.h" -#include "ED_util.h" #include "UI_interface.h" @@ -74,7 +47,6 @@ #include "RNA_access.h" #include "RNA_define.h" -#include "RNA_types.h" /* ************************************************** */ /* Animation Data Validation */ diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 651ce34a2f2..5cc5deb2eae 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -30,66 +30,40 @@ * This file defines the (C-Coded) templates + editing callbacks needed * by the interface stuff or F-Modifiers, as used by F-Curves in the Graph Editor, * and NLA-Strips in the NLA Editor. + * + * Copy/Paste Buffer for F-Modifiers: + * For now, this is also defined in this file so that it can be shared between the */ #include <string.h> -#include <stdio.h> -#include <math.h> -#include <float.h> #include "DNA_anim_types.h" -#include "DNA_action_types.h" -#include "DNA_object_types.h" -#include "DNA_space_types.h" #include "DNA_scene_types.h" -#include "DNA_screen_types.h" -#include "DNA_userdef_types.h" #include "MEM_guardedalloc.h" -#include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" -#include "BLI_rand.h" -#include "BKE_animsys.h" -#include "BKE_action.h" #include "BKE_context.h" -#include "BKE_curve.h" -#include "BKE_customdata.h" -#include "BKE_depsgraph.h" #include "BKE_fcurve.h" -#include "BKE_object.h" -#include "BKE_global.h" -#include "BKE_nla.h" -#include "BKE_scene.h" -#include "BKE_screen.h" -#include "BKE_utildefines.h" - -#include "BIF_gl.h" #include "WM_api.h" #include "WM_types.h" #include "RNA_access.h" -#include "RNA_define.h" #include "ED_anim_api.h" -#include "ED_keyframing.h" -#include "ED_screen.h" -#include "ED_types.h" -#include "ED_util.h" #include "UI_interface.h" #include "UI_resources.h" -#include "UI_view2d.h" + +/* ********************************************** */ +/* UI STUFF */ // XXX! -------------------------------- /* temporary definition for limits of float number buttons (FLT_MAX tends to infinity with old system) */ #define UI_FLT_MAX 10000.0f -/* ********************************************** */ - #define B_REDR 1 #define B_FMODIFIER_REDRAW 20 @@ -280,15 +254,15 @@ static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, shor /* before range */ col= uiLayoutColumn(split, 1); - uiItemL(col, "Before:", 0); - uiItemR(col, "", 0, &ptr, "before_mode", 0); - uiItemR(col, NULL, 0, &ptr, "before_cycles", 0); + uiItemL(col, "Before:", 0); + uiItemR(col, "", 0, &ptr, "before_mode", 0); + uiItemR(col, NULL, 0, &ptr, "before_cycles", 0); /* after range */ col= uiLayoutColumn(split, 1); - uiItemL(col, "After:", 0); - uiItemR(col, "", 0, &ptr, "after_mode", 0); - uiItemR(col, NULL, 0, &ptr, "after_cycles", 0); + uiItemL(col, "After:", 0); + uiItemR(col, "", 0, &ptr, "after_mode", 0); + uiItemR(col, NULL, 0, &ptr, "after_cycles", 0); } /* --------------- */ @@ -310,13 +284,13 @@ static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short /* col 1 */ col= uiLayoutColumn(split, 0); - uiItemR(col, NULL, 0, &ptr, "size", 0); - uiItemR(col, NULL, 0, &ptr, "strength", 0); + uiItemR(col, NULL, 0, &ptr, "size", 0); + uiItemR(col, NULL, 0, &ptr, "strength", 0); /* col 2 */ col= uiLayoutColumn(split, 0); - uiItemR(col, NULL, 0, &ptr, "phase", 0); - uiItemR(col, NULL, 0, &ptr, "depth", 0); + uiItemR(col, NULL, 0, &ptr, "phase", 0); + uiItemR(col, NULL, 0, &ptr, "depth", 0); } /* --------------- */ @@ -553,16 +527,16 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor /* x-minimum */ col= uiLayoutColumn(split, 1); - uiItemR(col, NULL, 0, &ptr, "use_minimum_x", 0); - uiItemR(col, NULL, 0, &ptr, "minimum_x", 0); + uiItemR(col, NULL, 0, &ptr, "use_minimum_x", 0); + uiItemR(col, NULL, 0, &ptr, "minimum_x", 0); /* y-minimum*/ col= uiLayoutColumn(split, 1); - uiItemR(col, NULL, 0, &ptr, "use_minimum_y", 0); - uiItemR(col, NULL, 0, &ptr, "minimum_y", 0); + uiItemR(col, NULL, 0, &ptr, "use_minimum_y", 0); + uiItemR(col, NULL, 0, &ptr, "minimum_y", 0); } - /* row 2: minimum */ + /* row 2: maximum */ { row= uiLayoutRow(layout, 0); @@ -571,18 +545,50 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor /* x-minimum */ col= uiLayoutColumn(split, 1); - uiItemR(col, NULL, 0, &ptr, "use_maximum_x", 0); - uiItemR(col, NULL, 0, &ptr, "maximum_x", 0); + uiItemR(col, NULL, 0, &ptr, "use_maximum_x", 0); + uiItemR(col, NULL, 0, &ptr, "maximum_x", 0); /* y-minimum*/ col= uiLayoutColumn(split, 1); - uiItemR(col, NULL, 0, &ptr, "use_maximum_y", 0); - uiItemR(col, NULL, 0, &ptr, "maximum_y", 0); + uiItemR(col, NULL, 0, &ptr, "use_maximum_y", 0); + uiItemR(col, NULL, 0, &ptr, "maximum_y", 0); } } /* --------------- */ +/* draw settings for stepped interpolation modifier */ +static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, short width) +{ + uiLayout *col, *subcol; + PointerRNA ptr; + + /* init the RNA-pointer */ + RNA_pointer_create(id, &RNA_FModifierStepped, fcm, &ptr); + + /* block 1: "stepping" settings */ + col= uiLayoutColumn(layout, 0); + uiItemR(col, NULL, 0, &ptr, "step_size", 0); + uiItemR(col, NULL, 0, &ptr, "offset", 0); + + /* block 2: start range settings */ + col= uiLayoutColumn(layout, 1); + uiItemR(col, NULL, 0, &ptr, "use_start_frame", 0); + + subcol = uiLayoutColumn(col, 1); + uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_start_frame")); + uiItemR(subcol, NULL, 0, &ptr, "start_frame", 0); + + /* block 3: end range settings */ + col= uiLayoutColumn(layout, 1); + uiItemR(col, NULL, 0, &ptr, "use_end_frame", 0); + + subcol = uiLayoutColumn(col, 1); + uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_end_frame")); + uiItemR(subcol, NULL, 0, &ptr, "end_frame", 0); +} + +/* --------------- */ void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm) { @@ -669,6 +675,10 @@ void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifie case FMODIFIER_TYPE_NOISE: /* Noise */ draw_modifier__noise(box, id, fcm, width); break; + + case FMODIFIER_TYPE_STEPPED: /* Stepped */ + draw_modifier__stepped(box, id, fcm, width); + break; default: /* unknown type */ break; @@ -677,3 +687,81 @@ void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifie } /* ********************************************** */ +/* COPY/PASTE BUFFER STUFF */ + +/* Copy/Paste Buffer itself (list of FModifier 's) */ +static ListBase fmodifier_copypaste_buf = {NULL, NULL}; + +/* ---------- */ + +/* free the copy/paste buffer */ +void free_fmodifiers_copybuf (void) +{ + /* just free the whole buffer */ + free_fmodifiers(&fmodifier_copypaste_buf); +} + +/* copy the given F-Modifiers to the buffer, returning whether anything was copied or not + * assuming that the buffer has been cleared already with free_fmodifiers_copybuf() + * - active: only copy the active modifier + */ +short ANIM_fmodifiers_copy_to_buf (ListBase *modifiers, short active) +{ + short ok = 1; + + /* sanity checks */ + if ELEM(NULL, modifiers, modifiers->first) + return 0; + + /* copy the whole list, or just the active one? */ + if (active) { + FModifier *fcm = find_active_fmodifier(modifiers); + + if (fcm) { + FModifier *fcmN = copy_fmodifier(fcm); + BLI_addtail(&fmodifier_copypaste_buf, fcmN); + } + else + ok = 0; + } + else + copy_fmodifiers(&fmodifier_copypaste_buf, modifiers); + + /* did we succeed? */ + return ok; +} + +/* 'Paste' the F-Modifier(s) from the buffer to the specified list + * - replace: free all the existing modifiers to leave only the pasted ones + */ +short ANIM_fmodifiers_paste_from_buf (ListBase *modifiers, short replace) +{ + FModifier *fcm; + short ok = 0; + + /* sanity checks */ + if (modifiers == NULL) + return 0; + + /* if replacing the list, free the existing modifiers */ + if (replace) + free_fmodifiers(modifiers); + + /* now copy over all the modifiers in the buffer to the end of the list */ + for (fcm= fmodifier_copypaste_buf.first; fcm; fcm= fcm->next) { + /* make a copy of it */ + FModifier *fcmN = copy_fmodifier(fcm); + + /* make sure the new one isn't active, otherwise the list may get several actives */ + fcmN->flag &= ~FMODIFIER_FLAG_ACTIVE; + + /* now add it to the end of the list */ + BLI_addtail(modifiers, fcmN); + ok = 1; + } + + /* did we succeed? */ + return ok; +} + +/* ********************************************** */ diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 011422eb65c..69f9583ed33 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -86,10 +86,7 @@ #include "UI_view2d.h" #include "ED_anim_api.h" -#include "ED_keyframing.h" #include "ED_keyframes_draw.h" -#include "ED_screen.h" -#include "ED_space_api.h" /* *************************** Keyframe Processing *************************** */ diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index ca1df14e14c..45a0ee295e7 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index 1784c6ef32c..53a3648713e 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index d0675dc42ba..eaebab2efab 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1073,7 +1073,6 @@ static int modify_key_op_poll(bContext *C) static int insert_key_exec (bContext *C, wmOperator *op) { - ListBase dsources = {NULL, NULL}; Scene *scene= CTX_data_scene(C); KeyingSet *ks= NULL; int type= RNA_int_get(op->ptr, "type"); @@ -1098,22 +1097,17 @@ static int insert_key_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - /* get context info for relative Keying Sets */ - if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) { - /* exit if no suitable data obtained */ - if (modifykey_get_context_data(C, &dsources, ks) == 0) { - BKE_report(op->reports, RPT_ERROR, "No suitable context info for active Keying Set"); - return OPERATOR_CANCELLED; - } - } - /* try to insert keyframes for the channels specified by KeyingSet */ - success= modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); + success= ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); if (G.f & G_DEBUG) BKE_reportf(op->reports, RPT_INFO, "KeyingSet '%s' - Successfully added %d Keyframes \n", ks->name, success); /* report failure or do updates? */ - if (success) { + if (success == MODIFYKEY_INVALID_CONTEXT) { + BKE_report(op->reports, RPT_ERROR, "No suitable context info for active Keying Set"); + return OPERATOR_CANCELLED; + } + else if (success) { /* if the appropriate properties have been set, make a note that we've inserted something */ if (RNA_boolean_get(op->ptr, "confirm_success")) BKE_reportf(op->reports, RPT_INFO, "Successfully added %d Keyframes for KeyingSet '%s'", success, ks->name); @@ -1123,13 +1117,6 @@ static int insert_key_exec (bContext *C, wmOperator *op) } else BKE_report(op->reports, RPT_WARNING, "Keying Set failed to insert any keyframes"); - - - /* free temp context-data if available */ - if (dsources.first) { - /* we assume that there is no extra data that needs to be freed from here... */ - BLI_freelistN(&dsources); - } /* send updates */ DAG_ids_flush_update(0); @@ -1191,8 +1178,10 @@ static void insert_key_menu_prompt (bContext *C) * - these are listed in the order in which they were defined for the active scene */ if (scene->keyingsets.first) { - for (ks= scene->keyingsets.first; ks; ks= ks->next) - uiItemIntO(layout, ks->name, 0, "ANIM_OT_keyframe_insert_menu", "type", i++); + for (ks= scene->keyingsets.first; ks; ks= ks->next) { + if (ANIM_keyingset_context_ok_poll(C, ks)) + uiItemIntO(layout, ks->name, 0, "ANIM_OT_keyframe_insert_menu", "type", i++); + } uiItemS(layout); } @@ -1200,9 +1189,8 @@ static void insert_key_menu_prompt (bContext *C) i= -1; for (ks= builtin_keyingsets.first; ks; ks= ks->next) { /* only show KeyingSet if context is suitable */ - if (keyingset_context_ok_poll(C, ks)) { + if (ANIM_keyingset_context_ok_poll(C, ks)) uiItemIntO(layout, ks->name, 0, "ANIM_OT_keyframe_insert_menu", "type", i--); - } } uiPupMenuEnd(C, pup); @@ -1261,7 +1249,6 @@ void ANIM_OT_keyframe_insert_menu (wmOperatorType *ot) static int delete_key_exec (bContext *C, wmOperator *op) { - ListBase dsources = {NULL, NULL}; Scene *scene= CTX_data_scene(C); KeyingSet *ks= NULL; int type= RNA_int_get(op->ptr, "type"); @@ -1286,22 +1273,17 @@ static int delete_key_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - /* get context info for relative Keying Sets */ - if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) { - /* exit if no suitable data obtained */ - if (modifykey_get_context_data(C, &dsources, ks) == 0) { - BKE_report(op->reports, RPT_ERROR, "No suitable context info for active Keying Set"); - return OPERATOR_CANCELLED; - } - } - /* try to insert keyframes for the channels specified by KeyingSet */ - success= modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_DELETE, cfra); + success= ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_DELETE, cfra); if (G.f & G_DEBUG) printf("KeyingSet '%s' - Successfully removed %d Keyframes \n", ks->name, success); /* report failure or do updates? */ - if (success) { + if (success == MODIFYKEY_INVALID_CONTEXT) { + BKE_report(op->reports, RPT_ERROR, "No suitable context info for active Keying Set"); + return OPERATOR_CANCELLED; + } + else if (success) { /* if the appropriate properties have been set, make a note that we've inserted something */ if (RNA_boolean_get(op->ptr, "confirm_success")) BKE_reportf(op->reports, RPT_INFO, "Successfully removed %d Keyframes for KeyingSet '%s'", success, ks->name); @@ -1312,12 +1294,6 @@ static int delete_key_exec (bContext *C, wmOperator *op) else BKE_report(op->reports, RPT_WARNING, "Keying Set failed to remove any keyframes"); - /* free temp context-data if available */ - if (dsources.first) { - /* we assume that there is no extra data that needs to be freed from here... */ - BLI_freelistN(&dsources); - } - /* send updates */ DAG_ids_flush_update(0); diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 63323a8519d..a93220aeb67 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -256,14 +256,8 @@ static int remove_active_ks_path_exec (bContext *C, wmOperator *op) KS_Path *ksp= BLI_findlink(&ks->paths, ks->active_path-1); if (ksp) { - /* NOTE: sync this code with BKE_keyingset_free() */ - { - /* free RNA-path info */ - MEM_freeN(ksp->rna_path); - - /* free path itself */ - BLI_freelinkN(&ks->paths, ksp); - } + /* remove the active path from the KeyingSet */ + BKE_keyingset_free_path(ks, ksp); /* the active path should now be the previously second-to-last active one */ ks->active_path--; @@ -467,663 +461,136 @@ void ANIM_OT_keyingset_button_remove (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -/* ************************************************** */ -/* KEYING SETS - EDITING API */ - -/* UI API --------------------------------------------- */ - -/* Build menu-string of available keying-sets (allocates memory for string) - * NOTE: mode must not be longer than 64 chars - */ -char *ANIM_build_keyingsets_menu (ListBase *list, short for_edit) -{ - DynStr *pupds= BLI_dynstr_new(); - KeyingSet *ks; - char buf[64]; - char *str; - int i; - - /* add title first */ - BLI_dynstr_append(pupds, "Keying Sets%t|"); - - /* add dummy entries for none-active */ - if (for_edit) { - BLI_dynstr_append(pupds, "Add New%x-1|"); - BLI_dynstr_append(pupds, " %x0|"); - } - else - BLI_dynstr_append(pupds, "No Keying Set%x0|"); - - /* loop through keyingsets, adding them */ - for (ks=list->first, i=1; ks; ks=ks->next, i++) { - if (for_edit == 0) - BLI_dynstr_append(pupds, "KS: "); - - BLI_dynstr_append(pupds, ks->name); - BLI_snprintf( buf, 64, "%%x%d%s", i, ((ks->next)?"|":"") ); - BLI_dynstr_append(pupds, buf); - } - - /* convert to normal MEM_malloc'd string */ - str= BLI_dynstr_get_cstring(pupds); - BLI_dynstr_free(pupds); - - return str; -} - - /* ******************************************* */ -/* KEYING SETS - BUILTIN */ +/* REGISTERED KEYING SETS */ -#if 0 // XXX old keyingsets code based on adrcodes... to be restored in due course +/* Keying Set Type Info declarations */ +ListBase keyingset_type_infos = {NULL, NULL}; -/* ------------- KeyingSet Defines ------------ */ -/* Note: these must all be named with the defks_* prefix, otherwise the template macro will not work! */ - -/* macro for defining keyingset contexts */ -#define KSC_TEMPLATE(ctx_name) {&defks_##ctx_name[0], NULL, sizeof(defks_##ctx_name)/sizeof(bKeyingSet)} - -/* --- */ - -/* check if option not available for deleting keys */ -static short incl_non_del_keys (bKeyingSet *ks, const char mode[]) -{ - /* as optimisation, assume that it is sufficient to check only first letter - * of mode (int comparison should be faster than string!) - */ - //if (strcmp(mode, "Delete")==0) - if (mode && mode[0]=='D') - return 0; - - return 1; -} +/* Built-In Keying Sets (referencing type infos)*/ +ListBase builtin_keyingsets = {NULL, NULL}; -/* Object KeyingSets ------ */ +/* --------------- */ -/* check if include shapekey entry */ -static short incl_v3d_ob_shapekey (bKeyingSet *ks, const char mode[]) +/* Find KeyingSet type info given a name */ +KeyingSetInfo *ANIM_keyingset_info_find_named (const char name[]) { - //Object *ob= (G.obedit)? (G.obedit) : (OBACT); // XXX - Object *ob= NULL; - char *newname= NULL; - - if(ob==NULL) - return 0; + KeyingSetInfo *ksi; - /* not available for delete mode */ - if (strcmp(mode, "Delete")==0) - return 0; - - /* check if is geom object that can get shapekeys */ - switch (ob->type) { - /* geometry? */ - case OB_MESH: newname= "Mesh"; break; - case OB_CURVE: newname= "Curve"; break; - case OB_SURF: newname= "Surface"; break; - case OB_LATTICE: newname= "Lattice"; break; + /* sanity checks */ + if ((name == NULL) || (name[0] == 0)) + return NULL; - /* not geometry! */ - default: - return 0; + /* search by comparing names */ + for (ksi = keyingset_type_infos.first; ksi; ksi = ksi->next) { + if (strcmp(ksi->name, name) == 0) + return ksi; } - /* if ks is shapekey entry (this could be callled for separator before too!) */ - if (ks->flag == -3) - BLI_strncpy(ks->name, newname, sizeof(ks->name)); - - /* if it gets here, it's ok */ - return 1; + /* no matches found */ + return NULL; } -/* array for object keyingset defines */ -bKeyingSet defks_v3d_object[] = +/* Find builtin KeyingSet by name */ +KeyingSet *ANIM_builtin_keyingset_get_named (KeyingSet *prevKS, const char name[]) { - /* include_cb, adrcode-getter, name, blocktype, flag, chan_num, adrcodes */ - {NULL, "Loc", ID_OB, 0, 3, {OB_LOC_X,OB_LOC_Y,OB_LOC_Z}}, - {NULL, "Rot", ID_OB, 0, 3, {OB_ROT_X,OB_ROT_Y,OB_ROT_Z}}, - {NULL, "Scale", ID_OB, 0, 3, {OB_SIZE_X,OB_SIZE_Y,OB_SIZE_Z}}, - - {NULL, "%l", 0, -1, 0, {0}}, // separator - - {NULL, "LocRot", ID_OB, 0, 6, - {OB_LOC_X,OB_LOC_Y,OB_LOC_Z, - OB_ROT_X,OB_ROT_Y,OB_ROT_Z}}, - - {NULL, "LocScale", ID_OB, 0, 6, - {OB_LOC_X,OB_LOC_Y,OB_LOC_Z, - OB_SIZE_X,OB_SIZE_Y,OB_SIZE_Z}}, - - {NULL, "LocRotScale", ID_OB, 0, 9, - {OB_LOC_X,OB_LOC_Y,OB_LOC_Z, - OB_ROT_X,OB_ROT_Y,OB_ROT_Z, - OB_SIZE_X,OB_SIZE_Y,OB_SIZE_Z}}, - - {NULL, "RotScale", ID_OB, 0, 6, - {OB_ROT_X,OB_ROT_Y,OB_ROT_Z, - OB_SIZE_X,OB_SIZE_Y,OB_SIZE_Z}}, - - {incl_non_del_keys, "%l", 0, -1, 0, {0}}, // separator - - {incl_non_del_keys, "VisualLoc", ID_OB, INSERTKEY_MATRIX, 3, {OB_LOC_X,OB_LOC_Y,OB_LOC_Z}}, - {incl_non_del_keys, "VisualRot", ID_OB, INSERTKEY_MATRIX, 3, {OB_ROT_X,OB_ROT_Y,OB_ROT_Z}}, - - {incl_non_del_keys, "VisualLocRot", ID_OB, INSERTKEY_MATRIX, 6, - {OB_LOC_X,OB_LOC_Y,OB_LOC_Z, - OB_ROT_X,OB_ROT_Y,OB_ROT_Z}}, - - {NULL, "%l", 0, -1, 0, {0}}, // separator - - {NULL, "Layer", ID_OB, 0, 1, {OB_LAY}}, // icky option... - {NULL, "Available", ID_OB, -2, 0, {0}}, - - {incl_v3d_ob_shapekey, "%l%l", 0, -1, 0, {0}}, // separator (linked to shapekey entry) - {incl_v3d_ob_shapekey, "<ShapeKey>", ID_OB, -3, 0, {0}} -}; - -/* PoseChannel KeyingSets ------ */ - -/* array for posechannel keyingset defines */ -bKeyingSet defks_v3d_pchan[] = -{ - /* include_cb, name, blocktype, flag, chan_num, adrcodes */ - {NULL, "Loc", ID_PO, 0, 3, {AC_LOC_X,AC_LOC_Y,AC_LOC_Z}}, - {NULL, "Rot", ID_PO, COMMONKEY_PCHANROT, 1, {KAG_CHAN_EXTEND}}, - {NULL, "Scale", ID_PO, 0, 3, {AC_SIZE_X,AC_SIZE_Y,AC_SIZE_Z}}, - - {NULL, "%l", 0, -1, 0, {0}}, // separator - - {NULL, "LocRot", ID_PO, COMMONKEY_PCHANROT, 4, - {AC_LOC_X,AC_LOC_Y,AC_LOC_Z, - KAG_CHAN_EXTEND}}, - - {NULL, "LocScale", ID_PO, 0, 6, - {AC_LOC_X,AC_LOC_Y,AC_LOC_Z, - AC_SIZE_X,AC_SIZE_Y,AC_SIZE_Z}}, - - {NULL, "LocRotScale", ID_PO, COMMONKEY_PCHANROT, 7, - {AC_LOC_X,AC_LOC_Y,AC_LOC_Z,AC_SIZE_X,AC_SIZE_Y,AC_SIZE_Z, - KAG_CHAN_EXTEND}}, - - {NULL, "RotScale", ID_PO, 0, 4, - {AC_SIZE_X,AC_SIZE_Y,AC_SIZE_Z, - KAG_CHAN_EXTEND}}, - - {incl_non_del_keys, "%l", 0, -1, 0, {0}}, // separator - - {incl_non_del_keys, "VisualLoc", ID_PO, INSERTKEY_MATRIX, 3, {AC_LOC_X,AC_LOC_Y,AC_LOC_Z}}, - {incl_non_del_keys, "VisualRot", ID_PO, INSERTKEY_MATRIX|COMMONKEY_PCHANROT, 1, {KAG_CHAN_EXTEND}}, - - {incl_non_del_keys, "VisualLocRot", ID_PO, INSERTKEY_MATRIX|COMMONKEY_PCHANROT, 4, - {AC_LOC_X,AC_LOC_Y,AC_LOC_Z, KAG_CHAN_EXTEND}}, - - {NULL, "%l", 0, -1, 0, {0}}, // separator - - {NULL, "Available", ID_PO, -2, 0, {0}} -}; - -/* Material KeyingSets ------ */ - -/* array for material keyingset defines */ -bKeyingSet defks_buts_shading_mat[] = -{ - /* include_cb, name, blocktype, flag, chan_num, adrcodes */ - {NULL, "RGB", ID_MA, 0, 3, {MA_COL_R,MA_COL_G,MA_COL_B}}, - {NULL, "Alpha", ID_MA, 0, 1, {MA_ALPHA}}, - {NULL, "Halo Size", ID_MA, 0, 1, {MA_HASIZE}}, - {NULL, "Mode", ID_MA, 0, 1, {MA_MODE}}, // evil bitflags - - {NULL, "%l", 0, -1, 0, {0}}, // separator - - {NULL, "All Color", ID_MA, 0, 18, - {MA_COL_R,MA_COL_G,MA_COL_B, - MA_ALPHA,MA_HASIZE, MA_MODE, - MA_SPEC_R,MA_SPEC_G,MA_SPEC_B, - MA_REF,MA_EMIT,MA_AMB,MA_SPEC,MA_HARD, - MA_MODE,MA_TRANSLU,MA_ADD}}, - - {NULL, "All Mirror", ID_MA, 0, 5, - {MA_RAYM,MA_FRESMIR,MA_FRESMIRI, - MA_FRESTRA,MA_FRESTRAI}}, - - {NULL, "%l", 0, -1, 0, {0}}, // separator - - {NULL, "Ofs", ID_MA, COMMONKEY_ADDMAP, 3, {MAP_OFS_X,MAP_OFS_Y,MAP_OFS_Z}}, - {NULL, "Size", ID_MA, COMMONKEY_ADDMAP, 3, {MAP_SIZE_X,MAP_SIZE_Y,MAP_SIZE_Z}}, - - {NULL, "All Mapping", ID_MA, COMMONKEY_ADDMAP, 14, - {MAP_OFS_X,MAP_OFS_Y,MAP_OFS_Z, - MAP_SIZE_X,MAP_SIZE_Y,MAP_SIZE_Z, - MAP_R,MAP_G,MAP_B,MAP_DVAR, - MAP_COLF,MAP_NORF,MAP_VARF,MAP_DISP}}, - - {NULL, "%l", 0, -1, 0, {0}}, // separator - - {NULL, "Available", ID_MA, -2, 0, {0}} -}; - -/* World KeyingSets ------ */ - -/* array for world keyingset defines */ -bKeyingSet defks_buts_shading_wo[] = -{ - /* include_cb, name, blocktype, flag, chan_num, adrcodes */ - {NULL, "Zenith RGB", ID_WO, 0, 3, {WO_ZEN_R,WO_ZEN_G,WO_ZEN_B}}, - {NULL, "Horizon RGB", ID_WO, 0, 3, {WO_HOR_R,WO_HOR_G,WO_HOR_B}}, - - {NULL, "%l", 0, -1, 0, {0}}, // separator - - {NULL, "Mist", ID_WO, 0, 4, {WO_MISI,WO_MISTDI,WO_MISTSTA,WO_MISTHI}}, - {NULL, "Stars", ID_WO, 0, 5, {WO_STAR_R,WO_STAR_G,WO_STAR_B,WO_STARDIST,WO_STARSIZE}}, - - - {NULL, "%l", 0, -1, 0, {0}}, // separator - - {NULL, "Ofs", ID_WO, COMMONKEY_ADDMAP, 3, {MAP_OFS_X,MAP_OFS_Y,MAP_OFS_Z}}, - {NULL, "Size", ID_WO, COMMONKEY_ADDMAP, 3, {MAP_SIZE_X,MAP_SIZE_Y,MAP_SIZE_Z}}, - - {NULL, "All Mapping", ID_WO, COMMONKEY_ADDMAP, 14, - {MAP_OFS_X,MAP_OFS_Y,MAP_OFS_Z, - MAP_SIZE_X,MAP_SIZE_Y,MAP_SIZE_Z, - MAP_R,MAP_G,MAP_B,MAP_DVAR, - MAP_COLF,MAP_NORF,MAP_VARF,MAP_DISP}}, - - {NULL, "%l", 0, -1, 0, {0}}, // separator - - {NULL, "Available", ID_WO, -2, 0, {0}} -}; - -/* Lamp KeyingSets ------ */ - -/* array for lamp keyingset defines */ -bKeyingSet defks_buts_shading_la[] = -{ - /* include_cb, name, blocktype, flag, chan_num, adrcodes */ - {NULL, "RGB", ID_LA, 0, 3, {LA_COL_R,LA_COL_G,LA_COL_B}}, - {NULL, "Energy", ID_LA, 0, 1, {LA_ENERGY}}, - {NULL, "Spot Size", ID_LA, 0, 1, {LA_SPOTSI}}, - - {NULL, "%l", 0, -1, 0, {0}}, // separator - - {NULL, "Ofs", ID_LA, COMMONKEY_ADDMAP, 3, {MAP_OFS_X,MAP_OFS_Y,MAP_OFS_Z}}, - {NULL, "Size", ID_LA, COMMONKEY_ADDMAP, 3, {MAP_SIZE_X,MAP_SIZE_Y,MAP_SIZE_Z}}, - - {NULL, "All Mapping", ID_LA, COMMONKEY_ADDMAP, 14, - {MAP_OFS_X,MAP_OFS_Y,MAP_OFS_Z, - MAP_SIZE_X,MAP_SIZE_Y,MAP_SIZE_Z, - MAP_R,MAP_G,MAP_B,MAP_DVAR, - MAP_COLF,MAP_NORF,MAP_VARF,MAP_DISP}}, + KeyingSet *ks, *first=NULL; - {NULL, "%l", 0, -1, 0, {0}}, // separator + /* sanity checks any name to check? */ + if (name[0] == 0) + return NULL; - {NULL, "Available", ID_LA, -2, 0, {0}} -}; - -/* Texture KeyingSets ------ */ - -/* array for texture keyingset defines */ -bKeyingSet defks_buts_shading_tex[] = -{ - /* include_cb, name, blocktype, flag, chan_num, adrcodes */ - {NULL, "Clouds", ID_TE, 0, 5, - {TE_NSIZE,TE_NDEPTH,TE_NTYPE, - TE_MG_TYP,TE_N_BAS1}}, - - {NULL, "Marble", ID_TE, 0, 7, - {TE_NSIZE,TE_NDEPTH,TE_NTYPE, - TE_TURB,TE_MG_TYP,TE_N_BAS1,TE_N_BAS2}}, - - {NULL, "Stucci", ID_TE, 0, 5, - {TE_NSIZE,TE_NTYPE,TE_TURB, - TE_MG_TYP,TE_N_BAS1}}, - - {NULL, "Wood", ID_TE, 0, 6, - {TE_NSIZE,TE_NTYPE,TE_TURB, - TE_MG_TYP,TE_N_BAS1,TE_N_BAS2}}, - - {NULL, "Magic", ID_TE, 0, 2, {TE_NDEPTH,TE_TURB}}, - - {NULL, "Blend", ID_TE, 0, 1, {TE_MG_TYP}}, - - {NULL, "Musgrave", ID_TE, 0, 6, - {TE_MG_TYP,TE_MGH,TE_MG_LAC, - TE_MG_OCT,TE_MG_OFF,TE_MG_GAIN}}, - - {NULL, "Voronoi", ID_TE, 0, 9, - {TE_VNW1,TE_VNW2,TE_VNW3,TE_VNW4, - TE_VNMEXP,TE_VN_DISTM,TE_VN_COLT, - TE_ISCA,TE_NSIZE}}, + /* get first KeyingSet to use */ + if (prevKS && prevKS->next) + first= prevKS->next; + else + first= builtin_keyingsets.first; - {NULL, "Distorted Noise", ID_TE, 0, 4, - {TE_MG_OCT,TE_MG_OFF,TE_MG_GAIN,TE_DISTA}}, - - {NULL, "Color Filter", ID_TE, 0, 5, - {TE_COL_R,TE_COL_G,TE_COL_B,TE_BRIGHT,TE_CONTRA}}, - - {NULL, "%l", 0, -1, 0, {0}}, // separator - - {NULL, "Available", ID_TE, -2, 0, {0}} -}; - -/* Object Buttons KeyingSets ------ */ - -/* check if include particles entry */ -static short incl_buts_ob (bKeyingSet *ks, const char mode[]) -{ - //Object *ob= OBACT; // xxx - Object *ob= NULL; - /* only if object is mesh type */ - - if(ob==NULL) return 0; - return (ob->type == OB_MESH); -} - -/* array for texture keyingset defines */ -bKeyingSet defks_buts_object[] = -{ - /* include_cb, name, blocktype, flag, chan_num, adrcodes */ - {incl_buts_ob, "Surface Damping", ID_OB, 0, 1, {OB_PD_SDAMP}}, - {incl_buts_ob, "Random Damping", ID_OB, 0, 1, {OB_PD_RDAMP}}, - {incl_buts_ob, "Permeability", ID_OB, 0, 1, {OB_PD_PERM}}, - - {NULL, "%l", 0, -1, 0, {0}}, // separator - - {NULL, "Force Strength", ID_OB, 0, 1, {OB_PD_FSTR}}, - {NULL, "Force Falloff", ID_OB, 0, 1, {OB_PD_FFALL}}, - - {NULL, "%l", 0, -1, 0, {0}}, // separator + /* loop over KeyingSets checking names */ + for (ks= first; ks; ks= ks->next) { + if (strcmp(name, ks->name) == 0) + return ks; + } - {NULL, "Available", ID_OB, -2, 0, {0}} // this will include ob-transforms too! -}; - -/* Camera Buttons KeyingSets ------ */ - -/* check if include internal-renderer entry */ -static short incl_buts_cam1 (bKeyingSet *ks, const char mode[]) -{ - Scene *scene= NULL; // FIXME this will cause a crash, but we need an extra arg first! - /* only if renderer is internal renderer */ - return (scene->r.renderer==R_INTERN); + /* no matches found */ + return NULL; } -/* check if include external-renderer entry */ -static short incl_buts_cam2 (bKeyingSet *ks, const char mode[]) -{ - Scene *scene= NULL; // FIXME this will cause a crash, but we need an extra arg first! - /* only if renderer is internal renderer */ - return (scene->r.renderer!=R_INTERN); -} +/* --------------- */ -/* array for camera keyingset defines */ -bKeyingSet defks_buts_cam[] = +/* Add the given KeyingSetInfo to the list of type infos, and create an appropriate builtin set too */ +void ANIM_keyingset_info_register (const bContext *C, KeyingSetInfo *ksi) { - /* include_cb, name, blocktype, flag, chan_num, adrcodes */ - {NULL, "Lens", ID_CA, 0, 1, {CAM_LENS}}, - {NULL, "Clipping", ID_CA, 0, 2, {CAM_STA,CAM_END}}, - {NULL, "Focal Distance", ID_CA, 0, 1, {CAM_YF_FDIST}}, - - {NULL, "%l", 0, -1, 0, {0}}, // separator + Scene *scene = CTX_data_scene(C); + ListBase *list = NULL; + KeyingSet *ks; + /* determine the KeyingSet list to include the new KeyingSet in */ + if (ksi->builtin==0 && scene) + list = &scene->keyingsets; + else + list = &builtin_keyingsets; - {incl_buts_cam2, "Aperture", ID_CA, 0, 1, {CAM_YF_APERT}}, - {incl_buts_cam1, "Viewplane Shift", ID_CA, 0, 2, {CAM_SHIFT_X,CAM_SHIFT_Y}}, + /* create a new KeyingSet + * - inherit name and keyframing settings from the typeinfo + */ + ks = BKE_keyingset_add(list, ksi->name, ksi->builtin, ksi->keyingflag); - {NULL, "%l", 0, -1, 0, {0}}, // separator + /* link this KeyingSet with its typeinfo */ + memcpy(&ks->typeinfo, ksi->name, sizeof(ks->typeinfo)); - {NULL, "Available", ID_CA, -2, 0, {0}} -}; - -/* --- */ + /* add type-info to the list */ + BLI_addtail(&keyingset_type_infos, ksi); +} -/* Keying Context Defines - Must keep in sync with enumeration (eKS_Contexts) */ -bKeyingContext ks_contexts[] = +/* Remove the given KeyingSetInfo from the list of type infos, and also remove the builtin set if appropriate */ +void ANIM_keyingset_info_unregister (const bContext *C, KeyingSetInfo *ksi) { - KSC_TEMPLATE(v3d_object), - KSC_TEMPLATE(v3d_pchan), + Scene *scene = CTX_data_scene(C); + KeyingSet *ks, *ksn; - KSC_TEMPLATE(buts_shading_mat), - KSC_TEMPLATE(buts_shading_wo), - KSC_TEMPLATE(buts_shading_la), - KSC_TEMPLATE(buts_shading_tex), - - KSC_TEMPLATE(buts_object), - KSC_TEMPLATE(buts_cam) -}; - -/* Keying Context Enumeration - Must keep in sync with definitions*/ -typedef enum eKS_Contexts { - KSC_V3D_OBJECT = 0, - KSC_V3D_PCHAN, - - KSC_BUTS_MAT, - KSC_BUTS_WO, - KSC_BUTS_LA, - KSC_BUTS_TEX, - - KSC_BUTS_OB, - KSC_BUTS_CAM, - - /* make sure this last one remains untouched! */ - KSC_TOT_TYPES -} eKS_Contexts; - - -#endif // XXX old keyingsets code based on adrcodes... to be restored in due course - -/* Macros for Declaring KeyingSets ------------------- */ - -/* A note about this system for declaring built-in Keying Sets: - * One may ask, "What is the purpose of all of these macros and static arrays?" and - * "Why not call the KeyingSets API defined in BKE_animsys.h?". The answer is two-fold. - * - * 1) Firstly, we use static arrays of struct definitions instead of function calls, as - * it reduces the start-up overhead and allocated-memory footprint of Blender. If we called - * the KeyingSets API to build these sets, the overhead of checking for unique names, allocating - * memory for each and every path and KeyingSet, scattered around in RAM, all of which would increase - * the startup time (which is totally unacceptable) and could lead to fragmentation+slower access times. - * 2) Since we aren't using function calls, we need a nice way of defining these KeyingSets in a way which - * is easily readable and less prone to breakage from changes to the underlying struct definitions. Further, - * adding additional entries SHOULD NOT require custom code to be written to access these new entries/sets. - * Therefore, here we have a system with nice, human-readable statements via macros, and static arrays which - * are linked together using more special macros + struct definitions, allowing for such a generic + simple - * initialisation function (init_builtin_keyingsets()) compared with that of something like the Nodes system. - * - * -- Joshua Leung, April 2009 - */ - -/* Struct type for declaring builtin KeyingSets in as entries in static arrays*/ -typedef struct bBuiltinKeyingSet { - KeyingSet ks; /* the KeyingSet to build */ - int tot; /* the total number of paths defined */ - KS_Path paths[64]; /* the paths for the KeyingSet to use */ -} bBuiltinKeyingSet; - - /* WARNING: the following macros must be kept in sync with the - * struct definitions in DNA_anim_types.h! - */ - -/* macro for defining a builtin KeyingSet */ -#define BI_KS_DEFINE_BEGIN(name, keyingflag) \ - {{NULL, NULL, {NULL, NULL}, name, KEYINGSET_BUILTIN, keyingflag}, - -/* macro to finish defining a builtin KeyingSet */ -#define BI_KS_DEFINE_END \ - } - -/* macro to start defining paths for a builtin KeyingSet */ -#define BI_KS_PATHS_BEGIN(tot) \ - tot, { - -/* macro to finish defining paths for a builtin KeyingSet */ -#define BI_KS_PATHS_END \ + /* find relevant scene KeyingSets which use this, and remove them */ + for (ks= scene->keyingsets.first; ks; ks= ksn) { + ksn = ks->next; + + /* remove if matching typeinfo name */ + if (strcmp(ks->typeinfo, ksi->name) == 0) { + BKE_keyingset_free(ks); + BLI_freelinkN(&scene->keyingsets, ks); + } } -/* macro for defining a builtin KeyingSet's path */ -#define BI_KSP_DEFINE(id_type, templates, prop_path, array_index, flag, groupflag) \ - {NULL, NULL, NULL, "", id_type, templates, prop_path, array_index, flag, groupflag} + /* do the same with builtin sets? */ + // TODO: this isn't done now, since unregister is really only used atm when we + // reload the scripts, which kindof defeats the purpose of "builtin"? -/* macro for defining a builtin KeyingSet with no paths (use in place of BI_KS_PAHTS_BEGIN/END block) */ -#define BI_KS_PATHS_NONE \ - 0, {0} -/* ---- */ - -/* Struct type for finding all the arrays of builtin KeyingSets */ -typedef struct bBuiltinKSContext { - bBuiltinKeyingSet *bks; /* array of KeyingSet definitions */ - int tot; /* number of KeyingSets in this array */ -} bBuiltinKSContext; - -/* macro for defining builtin KeyingSet sets - * NOTE: all the arrays of sets must follow this naming convention! - */ -#define BKSC_TEMPLATE(ctx_name) {&def_builtin_keyingsets_##ctx_name[0], sizeof(def_builtin_keyingsets_##ctx_name)/sizeof(bBuiltinKeyingSet)} - - -/* 3D-View Builtin KeyingSets ------------------------ */ - -static bBuiltinKeyingSet def_builtin_keyingsets_v3d[] = -{ - /* Simple Keying Sets ************************************* */ - /* Keying Set - "Location" ---------- */ - BI_KS_DEFINE_BEGIN("Location", 0) - BI_KS_PATHS_BEGIN(1) - BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "location", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM) - BI_KS_PATHS_END - BI_KS_DEFINE_END, - - /* Keying Set - "Rotation" ---------- */ - BI_KS_DEFINE_BEGIN("Rotation", 0) - BI_KS_PATHS_BEGIN(1) - BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN|KSP_TEMPLATE_ROT, "rotation", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM) - BI_KS_PATHS_END - BI_KS_DEFINE_END, - - /* Keying Set - "Scaling" ---------- */ - BI_KS_DEFINE_BEGIN("Scaling", 0) - BI_KS_PATHS_BEGIN(1) - BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "scale", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM) - BI_KS_PATHS_END - BI_KS_DEFINE_END, - - /* Compound Keying Sets *********************************** */ - /* Keying Set - "LocRot" ---------- */ - BI_KS_DEFINE_BEGIN("LocRot", 0) - BI_KS_PATHS_BEGIN(2) - BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "location", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM), - BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN|KSP_TEMPLATE_ROT, "rotation", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM) - BI_KS_PATHS_END - BI_KS_DEFINE_END, - - /* Keying Set - "LocRotScale" ---------- */ - BI_KS_DEFINE_BEGIN("LocRotScale", 0) - BI_KS_PATHS_BEGIN(3) - BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "location", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM), - BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN|KSP_TEMPLATE_ROT, "rotation", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM), - BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "scale", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM) - BI_KS_PATHS_END - BI_KS_DEFINE_END, - - /* Keying Sets with Keying Flags ************************* */ - /* Keying Set - "VisualLoc" ---------- */ - BI_KS_DEFINE_BEGIN("VisualLoc", INSERTKEY_MATRIX) - BI_KS_PATHS_BEGIN(1) - BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "location", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM) - BI_KS_PATHS_END - BI_KS_DEFINE_END, - - /* Keying Set - "Rotation" ---------- */ - BI_KS_DEFINE_BEGIN("VisualRot", INSERTKEY_MATRIX) - BI_KS_PATHS_BEGIN(1) - BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN|KSP_TEMPLATE_ROT, "rotation", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM) - BI_KS_PATHS_END - BI_KS_DEFINE_END, - - /* Keying Set - "VisualLocRot" ---------- */ - BI_KS_DEFINE_BEGIN("VisualLocRot", INSERTKEY_MATRIX) - BI_KS_PATHS_BEGIN(2) - BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "location", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM), - BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN|KSP_TEMPLATE_ROT, "rotation", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM) - BI_KS_PATHS_END - BI_KS_DEFINE_END -}; - -/* All Builtin KeyingSets ------------------------ */ - -/* total number of builtin KeyingSet contexts */ -#define MAX_BKSC_TYPES 1 - -/* array containing all the available builtin KeyingSets definition sets - * - size of this is MAX_BKSC_TYPES+1 so that we don't smash the stack - */ -static bBuiltinKSContext def_builtin_keyingsets[MAX_BKSC_TYPES+1] = -{ - BKSC_TEMPLATE(v3d) - /* add more contexts above this line... */ -}; - - -/* ListBase of these KeyingSets chained up ready for usage - * NOTE: this is exported to keyframing.c for use... - */ -ListBase builtin_keyingsets = {NULL, NULL}; - -/* Utility API ------------------------ */ - -/* Link up all of the builtin Keying Sets when starting up Blender - * This is called from WM_init() in wm_init_exit.c - */ -void init_builtin_keyingsets (void) -{ - bBuiltinKSContext *bksc; - bBuiltinKeyingSet *bks; - int bksc_i, bks_i; - - /* loop over all the sets of KeyingSets, setting them up, and chaining them to the builtins list */ - for (bksc_i= 0, bksc= &def_builtin_keyingsets[0]; bksc_i < MAX_BKSC_TYPES; bksc_i++, bksc++) - { - /* for each set definitions for a builtin KeyingSet, chain the paths to that KeyingSet and add */ - for (bks_i= 0, bks= bksc->bks; bks_i < bksc->tot; bks_i++, bks++) - { - KeyingSet *ks= &bks->ks; - KS_Path *ksp; - int pIndex; - - /* loop over paths, linking them to the KeyingSet and each other */ - for (pIndex= 0, ksp= &bks->paths[0]; pIndex < bks->tot; pIndex++, ksp++) - BLI_addtail(&ks->paths, ksp); - - /* add KeyingSet to builtin sets list */ - BLI_addtail(&builtin_keyingsets, ks); - } - } + /* free the type info */ + BLI_freelinkN(&keyingset_type_infos, ksi); } +/* --------------- */ -/* Get the first builtin KeyingSet with the given name, which occurs after the given one (or start of list if none given) */ -KeyingSet *ANIM_builtin_keyingset_get_named (KeyingSet *prevKS, char name[]) +void ANIM_keyingset_infos_exit () { - KeyingSet *ks, *first=NULL; + KeyingSetInfo *ksi, *next; - /* sanity checks - any name to check? */ - if (name[0] == 0) - return NULL; - - /* get first KeyingSet to use */ - if (prevKS && prevKS->next) - first= prevKS->next; - else - first= builtin_keyingsets.first; + /* free type infos */ + for (ksi=keyingset_type_infos.first; ksi; ksi=next) { + next= ksi->next; - /* loop over KeyingSets checking names */ - for (ks= first; ks; ks= ks->next) { - if (strcmp(name, ks->name) == 0) - return ks; + /* free extra RNA data, and remove from list */ + if (ksi->ext.free) + ksi->ext.free(ksi->ext.data); + BLI_freelinkN(&keyingset_type_infos, ksi); } - /* no matches found */ - return NULL; + /* free builtin sets */ + BKE_keyingsets_free(&builtin_keyingsets); } +/* ******************************************* */ +/* KEYING SETS API (for UI) */ /* Get the active Keying Set for the Scene provided */ KeyingSet *ANIM_scene_get_active_keyingset (Scene *scene) @@ -1142,127 +609,77 @@ KeyingSet *ANIM_scene_get_active_keyingset (Scene *scene) return NULL; } -/* ******************************************* */ -/* KEYFRAME MODIFICATION */ - -/* KeyingSet Menu Helpers ------------ */ - -/* Extract the maximum set of requirements from the KeyingSet */ -static int keyingset_relative_get_templates (KeyingSet *ks) +/* Check if KeyingSet can be used in the current context */ +short ANIM_keyingset_context_ok_poll (bContext *C, KeyingSet *ks) { - KS_Path *ksp; - int templates= 0; - - /* loop over the paths (could be slow to do for a number of KeyingSets)? */ - for (ksp= ks->paths.first; ksp; ksp= ksp->next) { - /* add the destination's templates to the set of templates required for the set */ - templates |= ksp->templates; + if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) { + KeyingSetInfo *ksi = ANIM_keyingset_info_find_named(ks->typeinfo); + + /* get the associated 'type info' for this KeyingSet */ + if (ksi == NULL) + return 0; + // TODO: check for missing callbacks! + + /* check if it can be used in the current context */ + return (ksi->poll(ksi, C)); } - return templates; -} - -/* Check if context data is suitable for the given Keying Set */ -short keyingset_context_ok_poll (bContext *C, KeyingSet *ks) -{ - // TODO: - // For 'relative' keyingsets (i.e. py-keyingsets), add a call here - // which basically gets a listing of all the paths to be used for this - // set. - - return 1; } -/* KeyingSet Context Operations ------------ */ +/* ******************************************* */ +/* KEYFRAME MODIFICATION */ + +/* Special 'Overrides' Iterator for Relative KeyingSets ------ */ + +/* 'Data Sources' for relative Keying Set 'overrides' + * - this is basically a wrapper for PointerRNA's in a linked list + * - do not allow this to be accessed from outside for now + */ +typedef struct tRKS_DSource { + struct tRKS_DSource *next, *prev; + PointerRNA ptr; /* the whole point of this exercise! */ +} tRKS_DSource; + -/* Get list of data-sources from context (in 3D-View) for inserting keyframes using the given relative Keying Set */ -static short modifykey_get_context_v3d_data (bContext *C, ListBase *dsources, KeyingSet *ks) +/* Iterator used for overriding the behaviour of iterators defined for + * relative Keying Sets, with the main usage of this being operators + * requiring Auto Keyframing. Internal Use Only! + */ +static void RKS_ITER_overrides_list (KeyingSetInfo *ksi, bContext *C, KeyingSet *ks, ListBase *dsources) { - bCommonKeySrc *cks; - Object *obact= CTX_data_active_object(C); - int templates; - short ok= 0; - - /* get the templates in use in this KeyingSet which we should supply data for */ - templates = keyingset_relative_get_templates(ks); - - /* 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->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 */ - - /* loop through posechannels */ - //for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) { - // if (pchan->flag & POSE_KEY) { - // } - //} -#endif - - CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones) - { - /* add a new keying-source */ - cks= MEM_callocN(sizeof(bCommonKeySrc), "bCommonKeySrc"); - BLI_addtail(dsources, cks); - - /* set necessary info */ - cks->id= &obact->id; - cks->pchan= pchan; - - if (templates & KSP_TEMPLATE_CONSTRAINT) - cks->con= constraints_get_active(&pchan->constraints); - - ok= 1; - } - CTX_DATA_END; - } - else { - /* Object Mode: Selected objects */ - CTX_DATA_BEGIN(C, Object*, ob, selected_objects) - { - /* add a new keying-source */ - cks= MEM_callocN(sizeof(bCommonKeySrc), "bCommonKeySrc"); - BLI_addtail(dsources, cks); - - /* set necessary info */ - cks->id= &ob->id; - - if (templates & KSP_TEMPLATE_CONSTRAINT) - cks->con= constraints_get_active(&ob->constraints); - - ok= 1; - } - CTX_DATA_END; - } + tRKS_DSource *ds; - /* return whether any data was extracted */ - return ok; + for (ds = dsources->first; ds; ds = ds->next) { + /* run generate callback on this data */ + ksi->generate(ksi, C, ks, &ds->ptr); + } } -/* Get list of data-sources from context for inserting keyframes using the given relative Keying Set */ -short modifykey_get_context_data (bContext *C, ListBase *dsources, KeyingSet *ks) +/* Add new data source for relative Keying Sets */ +void ANIM_relative_keyingset_add_source (ListBase *dsources, ID *id, StructRNA *srna, void *data) { - ScrArea *sa= CTX_wm_area(C); - - /* for now, the active area is used to determine what set of contexts apply */ - if (sa == NULL) - return 0; - -#if 0 - switch (sa->spacetype) { - case SPACE_VIEW3D: /* 3D-View: Selected Objects or Bones */ - return modifykey_get_context_v3d_data(C, dsources, ks); - } + tRKS_DSource *ds; - /* nothing happened */ - return 0; -#endif - - /* looking into this code, it doesnt use the 3D view - Campbell */ - return modifykey_get_context_v3d_data(C, dsources, ks); -} + /* sanity checks + * - we must have somewhere to output the data + * - we must have both srna+data (and with id too optionally), or id by itself only + */ + if (dsources == NULL) + return; + if (ELEM(NULL, srna, data) && (id == NULL)) + return; + + /* allocate new elem, and add to the list */ + ds = MEM_callocN(sizeof(tRKS_DSource), "tRKS_DSource"); + BLI_addtail(dsources, ds); + + /* depending on what data we have, create using ID or full pointer call */ + if (srna && data) + RNA_pointer_create(id, srna, data, &ds->ptr); + else + RNA_id_pointer_create(id, &ds->ptr); +} /* KeyingSet Operations (Insert/Delete Keyframes) ------------ */ @@ -1270,8 +687,9 @@ short modifykey_get_context_data (bContext *C, ListBase *dsources, KeyingSet *ks * by the KeyingSet. This takes into account many of the different combinations of using KeyingSets. * Returns the number of channels that keyframes were added to */ -int modify_keyframes (Scene *scene, ListBase *dsources, bAction *act, KeyingSet *ks, short mode, float cfra) +int ANIM_apply_keyingset (bContext *C, ListBase *dsources, bAction *act, KeyingSet *ks, short mode, float cfra) { + Scene *scene= CTX_data_scene(C); KS_Path *ksp; int kflag=0, success= 0; char *groupname= NULL; @@ -1291,201 +709,101 @@ int modify_keyframes (Scene *scene, ListBase *dsources, bAction *act, KeyingSet else if (mode == MODIFYKEY_MODE_DELETE) kflag= 0; - /* check if the KeyingSet is absolute or not (i.e. does it requires sources info) */ - if (ks->flag & KEYINGSET_ABSOLUTE) { - /* Absolute KeyingSets are simpler to use, as all the destination info has already been - * provided by the user, and is stored, ready to use, in the KeyingSet paths. + /* if relative Keying Sets, poll and build up the paths */ + if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) { + KeyingSetInfo *ksi = ANIM_keyingset_info_find_named(ks->typeinfo); + + /* clear all existing paths + * NOTE: BKE_keyingset_free() frees all of the paths for the KeyingSet, but not the set itself */ - for (ksp= ks->paths.first; ksp; ksp= ksp->next) { - int arraylen, i; - - /* get pointer to name of group to add channels to */ - if (ksp->groupmode == KSP_GROUP_NONE) - groupname= NULL; - else if (ksp->groupmode == KSP_GROUP_KSNAME) - groupname= ks->name; - else - groupname= ksp->group; - - /* init arraylen and i - arraylen should be greater than i so that - * normal non-array entries get keyframed correctly - */ - i= ksp->array_index; - arraylen= i; - - /* get length of array if whole array option is enabled */ - if (ksp->flag & KSP_FLAG_WHOLE_ARRAY) { - PointerRNA id_ptr, ptr; - PropertyRNA *prop; - - RNA_id_pointer_create(ksp->id, &id_ptr); - if (RNA_path_resolve(&id_ptr, ksp->rna_path, &ptr, &prop) && prop) - arraylen= RNA_property_array_length(&ptr, prop); - } - - /* we should do at least one step */ - if (arraylen == i) - arraylen++; - - /* for each possible index, perform operation - * - assume that arraylen is greater than index + BKE_keyingset_free(ks); + + /* get the associated 'type info' for this KeyingSet */ + if (ksi == NULL) + return MODIFYKEY_MISSING_TYPEINFO; + // TODO: check for missing callbacks! + + /* check if it can be used in the current context */ + if (ksi->poll(ksi, C)) { + /* if a list of data sources are provided, run a special iterator over them, + * otherwise, just continue per normal */ - for (; i < arraylen; i++) { - /* action to take depends on mode */ - if (mode == MODIFYKEY_MODE_INSERT) - success += insert_keyframe(ksp->id, act, groupname, ksp->rna_path, i, cfra, kflag); - else if (mode == MODIFYKEY_MODE_DELETE) - success += delete_keyframe(ksp->id, act, groupname, ksp->rna_path, i, cfra, kflag); - } - - /* set recalc-flags */ - if (ksp->id) { - switch (GS(ksp->id->name)) { - case ID_OB: /* Object (or Object-Related) Keyframes */ - { - Object *ob= (Object *)ksp->id; - - ob->recalc |= OB_RECALC; - } - break; - } + if (dsources) + RKS_ITER_overrides_list(ksi, C, ks, dsources); + else + ksi->iter(ksi, C, ks); - /* send notifiers for updates (this doesn't require context to work!) */ - WM_main_add_notifier(NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); - } + /* if we don't have any paths now, then this still qualifies as invalid context */ + if (ks->paths.first == NULL) + return MODIFYKEY_INVALID_CONTEXT; + } + else { + /* poll callback tells us that KeyingSet is useless in current context */ + return MODIFYKEY_INVALID_CONTEXT; } } - else if (dsources && dsources->first) { - /* for each one of the 'sources', resolve the template markers and expand arrays, then insert keyframes */ - bCommonKeySrc *cks; + + /* apply the paths as specified in the KeyingSet now */ + for (ksp= ks->paths.first; ksp; ksp= ksp->next) { + int arraylen, i; + short kflag2; - /* for each 'source' for keyframe data, resolve each of the paths from the KeyingSet */ - for (cks= dsources->first; cks; cks= cks->next) { - /* for each path in KeyingSet, construct a path using the templates */ - for (ksp= ks->paths.first; ksp; ksp= ksp->next) { - DynStr *pathds= BLI_dynstr_new(); - char *path = NULL; - int arraylen, i; - - /* set initial group name */ - if (cks->id == NULL) { - printf("ERROR: Skipping 'Common-Key' Source. No valid ID present.\n"); - continue; - } - else - groupname= cks->id->name+2; - - /* construct the path */ - // FIXME: this currently only works with a few hardcoded cases - if ((ksp->templates & KSP_TEMPLATE_PCHAN) && (cks->pchan)) { - /* add basic pose-channel path access */ - BLI_dynstr_append(pathds, "pose.bones[\""); - BLI_dynstr_append(pathds, cks->pchan->name); - BLI_dynstr_append(pathds, "\"]"); - - /* override default group name */ - groupname= cks->pchan->name; - } - if ((ksp->templates & KSP_TEMPLATE_CONSTRAINT) && (cks->con)) { - /* add basic constraint path access */ - BLI_dynstr_append(pathds, "constraints[\""); - BLI_dynstr_append(pathds, cks->con->name); - BLI_dynstr_append(pathds, "\"]"); - - /* override default group name */ - groupname= cks->con->name; - } + /* since keying settings can be defined on the paths too, extend the path before using it */ + kflag2 = (kflag | ksp->keyingflag); + + /* get pointer to name of group to add channels to */ + if (ksp->groupmode == KSP_GROUP_NONE) + groupname= NULL; + else if (ksp->groupmode == KSP_GROUP_KSNAME) + groupname= ks->name; + else + groupname= ksp->group; + + /* init arraylen and i - arraylen should be greater than i so that + * normal non-array entries get keyframed correctly + */ + i= ksp->array_index; + arraylen= i; + + /* get length of array if whole array option is enabled */ + if (ksp->flag & KSP_FLAG_WHOLE_ARRAY) { + PointerRNA id_ptr, ptr; + PropertyRNA *prop; + + RNA_id_pointer_create(ksp->id, &id_ptr); + if (RNA_path_resolve(&id_ptr, ksp->rna_path, &ptr, &prop) && prop) + arraylen= RNA_property_array_length(&ptr, prop); + } + + /* we should do at least one step */ + if (arraylen == i) + arraylen++; + + /* for each possible index, perform operation + * - assume that arraylen is greater than index + */ + for (; i < arraylen; i++) { + /* action to take depends on mode */ + if (mode == MODIFYKEY_MODE_INSERT) + success += insert_keyframe(ksp->id, act, groupname, ksp->rna_path, i, cfra, kflag2); + else if (mode == MODIFYKEY_MODE_DELETE) + success += delete_keyframe(ksp->id, act, groupname, ksp->rna_path, i, cfra, kflag2); + } + + /* set recalc-flags */ + if (ksp->id) { + switch (GS(ksp->id->name)) { + case ID_OB: /* Object (or Object-Related) Keyframes */ { - /* add property stored in KeyingSet Path */ - if (BLI_dynstr_get_len(pathds)) - BLI_dynstr_append(pathds, "."); - - /* apply some further templates? */ - if (ksp->templates & KSP_TEMPLATE_ROT) { - /* for builtin Keying Sets, this template makes the best fitting path for the - * current rotation mode of the Object / PoseChannel to be used - */ - if (strcmp(ksp->rna_path, "rotation")==0) { - /* get rotation mode */ - short rotmode= (cks->pchan)? (cks->pchan->rotmode) : - (GS(cks->id->name)==ID_OB)? ( ((Object *)cks->id)->rotmode ) : - (0); - - /* determine path to build */ - if (rotmode == ROT_MODE_QUAT) - BLI_dynstr_append(pathds, "rotation_quaternion"); - else if (rotmode == ROT_MODE_AXISANGLE) - BLI_dynstr_append(pathds, "rotation_axis_angle"); - else - BLI_dynstr_append(pathds, "rotation_euler"); - } - } - else { - /* just directly use the path */ - BLI_dynstr_append(pathds, ksp->rna_path); - } - - /* convert to C-string */ - path= BLI_dynstr_get_cstring(pathds); - BLI_dynstr_free(pathds); - } - - /* get pointer to name of group to add channels to - * - KSP_GROUP_TEMPLATE_ITEM is handled above while constructing the paths - */ - if (ksp->groupmode == KSP_GROUP_NONE) - groupname= NULL; - else if (ksp->groupmode == KSP_GROUP_KSNAME) - groupname= ks->name; - else if (ksp->groupmode == KSP_GROUP_NAMED) - groupname= ksp->group; - - /* init arraylen and i - arraylen should be greater than i so that - * normal non-array entries get keyframed correctly - */ - i= ksp->array_index; - arraylen= i+1; - - /* get length of array if whole array option is enabled */ - if (ksp->flag & KSP_FLAG_WHOLE_ARRAY) { - PointerRNA id_ptr, ptr; - PropertyRNA *prop; + Object *ob= (Object *)ksp->id; - RNA_id_pointer_create(cks->id, &id_ptr); - if (RNA_path_resolve(&id_ptr, path, &ptr, &prop) && prop) - arraylen= RNA_property_array_length(&ptr, prop); - } - - /* for each possible index, perform operation - * - assume that arraylen is greater than index - */ - for (; i < arraylen; i++) { - /* action to take depends on mode */ - if (mode == MODIFYKEY_MODE_INSERT) - success+= insert_keyframe(cks->id, act, groupname, path, i, cfra, kflag); - else if (mode == MODIFYKEY_MODE_DELETE) - success+= delete_keyframe(cks->id, act, groupname, path, i, cfra, kflag); + ob->recalc |= OB_RECALC; } - - /* free the path */ - MEM_freeN(path); + break; } - /* set recalc-flags */ - if (cks->id) { - switch (GS(cks->id->name)) { - case ID_OB: /* Object (or Object-Related) Keyframes */ - { - Object *ob= (Object *)cks->id; - - ob->recalc |= OB_RECALC; - } - break; - } - - /* send notifiers for updates (this doesn't require context to work!) */ - WM_main_add_notifier(NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); - } + /* send notifiers for updates (this doesn't require context to work!) */ + WM_main_add_notifier(NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); } } diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 9d0db52d007..099cfeddad7 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index ba2c6597e43..508ab19ca17 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 4a3ef38daa6..5d9531e6b37 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -545,7 +545,7 @@ static void applyarmature_fix_boneparents (Scene *scene, Object *armob) /* apply current transform from parent (not yet destroyed), * then calculate new parent inverse matrix */ - ED_object_apply_obmat(ob); + object_apply_mat4(ob, ob->obmat); what_does_parent(scene, ob, &workob); invert_m4_m4(ob->parentinv, workob.obmat); @@ -4867,12 +4867,7 @@ static int pose_clear_scale_exec(bContext *C, wmOperator *op) Object *ob= CTX_data_active_object(C); KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Scaling"); - bCommonKeySrc cks; - ListBase dsources = {&cks, &cks}; - - /* init common-key-source for use by KeyingSets */ - memset(&cks, 0, sizeof(bCommonKeySrc)); - cks.id= &ob->id; + short autokey = 0; /* only clear those channels that are not locked */ CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones) { @@ -4885,13 +4880,12 @@ static int pose_clear_scale_exec(bContext *C, wmOperator *op) /* do auto-keyframing as appropriate */ if (autokeyframe_cfra_can_key(scene, &ob->id)) { - /* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */ - cks.pchan= pchan; - modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); - /* clear any unkeyed tags */ if (pchan->bone) pchan->bone->flag &= ~BONE_UNKEYED; + + /* tag for autokeying later */ + autokey = 1; } else { /* add unkeyed tags */ @@ -4901,6 +4895,16 @@ static int pose_clear_scale_exec(bContext *C, wmOperator *op) } CTX_DATA_END; + /* perform autokeying on the bones if needed */ + if (autokey) { + /* insert keyframes */ + ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); + + /* now recalculate paths */ + if ((ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) + ED_pose_recalculate_paths(C, scene, ob); + } + DAG_id_flush_update(&ob->id, OB_RECALC_DATA); /* note, notifier might evolve */ @@ -4930,12 +4934,7 @@ static int pose_clear_loc_exec(bContext *C, wmOperator *op) Object *ob= CTX_data_active_object(C); KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Location"); - bCommonKeySrc cks; - ListBase dsources = {&cks, &cks}; - - /* init common-key-source for use by KeyingSets */ - memset(&cks, 0, sizeof(bCommonKeySrc)); - cks.id= &ob->id; + short autokey = 0; /* only clear those channels that are not locked */ CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones) { @@ -4949,13 +4948,12 @@ static int pose_clear_loc_exec(bContext *C, wmOperator *op) /* do auto-keyframing as appropriate */ if (autokeyframe_cfra_can_key(scene, &ob->id)) { - /* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */ - cks.pchan= pchan; - modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); - /* clear any unkeyed tags */ if (pchan->bone) pchan->bone->flag &= ~BONE_UNKEYED; + + /* tag for autokeying later */ + autokey = 1; } else { /* add unkeyed tags */ @@ -4965,6 +4963,16 @@ static int pose_clear_loc_exec(bContext *C, wmOperator *op) } CTX_DATA_END; + /* perform autokeying on the bones if needed */ + if (autokey) { + /* insert keyframes */ + ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); + + /* now recalculate paths */ + if ((ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) + ED_pose_recalculate_paths(C, scene, ob); + } + DAG_id_flush_update(&ob->id, OB_RECALC_DATA); /* note, notifier might evolve */ @@ -4994,12 +5002,7 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op) Object *ob= CTX_data_active_object(C); KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Rotation"); - bCommonKeySrc cks; - ListBase dsources = {&cks, &cks}; - - /* init common-key-source for use by KeyingSets */ - memset(&cks, 0, sizeof(bCommonKeySrc)); - cks.id= &ob->id; + short autokey = 0; /* only clear those channels that are not locked */ CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones) { @@ -5097,13 +5100,12 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op) /* do auto-keyframing as appropriate */ if (autokeyframe_cfra_can_key(scene, &ob->id)) { - /* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */ - cks.pchan= pchan; - modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); - /* clear any unkeyed tags */ if (pchan->bone) pchan->bone->flag &= ~BONE_UNKEYED; + + /* tag for autokeying later */ + autokey = 1; } else { /* add unkeyed tags */ @@ -5113,6 +5115,16 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op) } CTX_DATA_END; + /* perform autokeying on the bones if needed */ + if (autokey) { + /* insert keyframes */ + ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); + + /* now recalculate paths */ + if ((ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) + ED_pose_recalculate_paths(C, scene, ob); + } + DAG_id_flush_update(&ob->id, OB_RECALC_DATA); /* note, notifier might evolve */ @@ -5528,7 +5540,7 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep) // TODO: should we be using the database wide version instead (since drivers may break) if (ob->adt) { /* posechannels only... */ - BKE_animdata_fix_paths_rename(&ob->id, ob->adt, "pose.bones", oldname, newname); + BKE_animdata_fix_paths_rename(&ob->id, ob->adt, "pose.bones", oldname, newname, 0, 0, 1); } } } diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index b3960c3cfd5..6eaa76d6422 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/armature/poseUtils.c b/source/blender/editors/armature/poseUtils.c index e2fc2bd4088..d40f3f30bb2 100644 --- a/source/blender/editors/armature/poseUtils.c +++ b/source/blender/editors/armature/poseUtils.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -229,27 +229,28 @@ void poseAnim_mapping_autoKeyframe (bContext *C, Scene *scene, Object *ob, ListB /* insert keyframes as necessary if autokeyframing */ if (autokeyframe_cfra_can_key(scene, &ob->id)) { - bCommonKeySrc cks; - ListBase dsources = {&cks, &cks}; tPChanFCurveLink *pfl; - /* init common-key-source for use by KeyingSets */ - memset(&cks, 0, sizeof(bCommonKeySrc)); - cks.id= &ob->id; - /* iterate over each pose-channel affected, applying the changes */ for (pfl= pfLinks->first; pfl; pfl= pfl->next) { + ListBase dsources = {NULL, NULL}; bPoseChannel *pchan= pfl->pchan; - /* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */ - cks.pchan= pchan; - /* insert keyframes */ + /* add datasource override for the PoseChannel so KeyingSet will do right thing */ + ANIM_relative_keyingset_add_source(&dsources, &ob->id, &RNA_PoseBone, pchan); + + /* insert keyframes + * - these keyingsets here use dsources, since we need to specify exactly which keyframes get affected + */ if (pchan->flag & POSE_LOC) - modify_keyframes(scene, &dsources, NULL, ks_loc, MODIFYKEY_MODE_INSERT, cframe); + ANIM_apply_keyingset(C, &dsources, NULL, ks_loc, MODIFYKEY_MODE_INSERT, cframe); if (pchan->flag & POSE_ROT) - modify_keyframes(scene, &dsources, NULL, ks_rot, MODIFYKEY_MODE_INSERT, cframe); + ANIM_apply_keyingset(C, &dsources, NULL, ks_rot, MODIFYKEY_MODE_INSERT, cframe); if (pchan->flag & POSE_SIZE) - modify_keyframes(scene, &dsources, NULL, ks_scale, MODIFYKEY_MODE_INSERT, cframe); + ANIM_apply_keyingset(C, &dsources, NULL, ks_scale, MODIFYKEY_MODE_INSERT, cframe); + + /* free the temp info */ + BLI_freelistN(&dsources); } } } diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 02194035ee9..8d38d0530ce 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -331,19 +331,14 @@ static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt) static int poselib_add_exec (bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); bAction *act = poselib_validate(ob); bArmature *arm= (ob) ? ob->data : NULL; bPose *pose= (ob) ? ob->pose : NULL; - bPoseChannel *pchan; TimeMarker *marker; int frame= RNA_int_get(op->ptr, "frame"); char name[64]; - bCommonKeySrc cks; - ListBase dsources = {&cks, &cks}; - /* sanity check (invoke should have checked this anyway) */ if (ELEM3(NULL, ob, arm, pose)) return OPERATOR_CANCELLED; @@ -373,25 +368,12 @@ static int poselib_add_exec (bContext *C, wmOperator *op) /* validate name */ BLI_uniquename(&act->markers, marker, "Pose", '.', offsetof(TimeMarker, name), sizeof(marker->name)); - /* init common-key-source for use by KeyingSets */ - memset(&cks, 0, sizeof(bCommonKeySrc)); - cks.id= &ob->id; - - /* loop through selected posechannels, keying their pose to the action */ - for (pchan= pose->chanbase.first; pchan; pchan= pchan->next) { - /* check if available */ - if ((pchan->bone) && (arm->layer & pchan->bone->layer)) { - if (pchan->bone->flag & BONE_SELECTED || pchan->bone==arm->act_bone) { - /* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */ - cks.pchan= pchan; - - /* KeyingSet to use depends on rotation mode (but that's handled by the templates code) */ - if (poselib_ks_locrotscale == NULL) - poselib_ks_locrotscale= ANIM_builtin_keyingset_get_named(NULL, "LocRotScale"); - modify_keyframes(scene, &dsources, act, poselib_ks_locrotscale, MODIFYKEY_MODE_INSERT, (float)frame); - } - } - } + /* KeyingSet to use depends on rotation mode (but that's handled by the templates code) */ + if (poselib_ks_locrotscale == NULL) + poselib_ks_locrotscale= ANIM_builtin_keyingset_get_named(NULL, "LocRotScale"); + + /* make the keyingset use context info to determine where to add keyframes */ + ANIM_apply_keyingset(C, NULL, act, poselib_ks_locrotscale, MODIFYKEY_MODE_INSERT, (float)frame); /* store new 'active' pose number */ act->active_marker= BLI_countlist(&act->markers); @@ -784,13 +766,6 @@ static void poselib_keytag_pose (bContext *C, Scene *scene, tPoseLib_PreviewData bAction *act= pld->act; bActionGroup *agrp; - bCommonKeySrc cks; - ListBase dsources = {&cks, &cks}; - - /* init common-key-source for use by KeyingSets */ - memset(&cks, 0, sizeof(bCommonKeySrc)); - cks.id= &pld->ob->id; - /* start tagging/keying */ for (agrp= act->groups.first; agrp; agrp= agrp->next) { /* only for selected action channels */ @@ -798,21 +773,23 @@ static void poselib_keytag_pose (bContext *C, Scene *scene, tPoseLib_PreviewData pchan= get_pose_channel(pose, agrp->name); if (pchan) { - // TODO: use a standard autokeying function in future (to allow autokeying-editkeys to work) - if (IS_AUTOKEY_MODE(scene, NORMAL)) { - /* Set keys on pose - * - KeyingSet to use depends on rotation mode - * (but that's handled by the templates code) - */ + if (autokeyframe_cfra_can_key(scene, &pld->ob->id)) { + ListBase dsources = {NULL, NULL}; + + /* get KeyingSet to use */ // TODO: for getting the KeyingSet used, we should really check which channels were affected + // TODO: this should get modified so that custom props are taken into account too! if (poselib_ks_locrotscale == NULL) poselib_ks_locrotscale= ANIM_builtin_keyingset_get_named(NULL, "LocRotScale"); - /* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */ - cks.pchan= pchan; - - /* now insert the keyframe */ - modify_keyframes(scene, &dsources, NULL, poselib_ks_locrotscale, MODIFYKEY_MODE_INSERT, (float)CFRA); + /* now insert the keyframe(s) using the Keying Set + * 1) add datasource override for the PoseChannel + * 2) insert keyframes + * 3) free the extra info + */ + ANIM_relative_keyingset_add_source(&dsources, &pld->ob->id, &RNA_PoseBone, pchan); + ANIM_apply_keyingset(C, &dsources, NULL, poselib_ks_locrotscale, MODIFYKEY_MODE_INSERT, (float)CFRA); + BLI_freelistN(&dsources); /* clear any unkeyed tags */ if (pchan->bone) diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index a162c8eb21a..f20c79da17e 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -849,14 +849,14 @@ void free_posebuf(void) { if (g_posebuf) { bPoseChannel *pchan; - + for (pchan= g_posebuf->chanbase.first; pchan; pchan= pchan->next) { if(pchan->prop) { IDP_FreeProperty(pchan->prop); MEM_freeN(pchan->prop); } } - + /* was copied without constraints */ BLI_freelistN(&g_posebuf->chanbase); MEM_freeN(g_posebuf); @@ -908,9 +908,6 @@ void POSE_OT_copy (wmOperatorType *ot) /* Pointers to the builtin KeyingSets that we want to use */ static KeyingSet *posePaste_ks_locrotscale = NULL; /* the only keyingset we'll need */ -/* transform.h */ -extern void autokeyframe_pose_cb_func(struct bContext *C, struct Scene *scene, struct View3D *v3d, struct Object *ob, int tmode, short targetless_ik); - static int pose_paste_exec (bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); @@ -919,13 +916,6 @@ static int pose_paste_exec (bContext *C, wmOperator *op) char name[32]; int flip= RNA_boolean_get(op->ptr, "flipped"); - bCommonKeySrc cks; - ListBase dsources = {&cks, &cks}; - - /* init common-key-source for use by KeyingSets */ - memset(&cks, 0, sizeof(bCommonKeySrc)); - cks.id= &ob->id; - /* sanity checks */ if ELEM(NULL, ob, ob->pose) return OPERATOR_CANCELLED; @@ -974,14 +964,14 @@ static int pose_paste_exec (bContext *C, wmOperator *op) else if (pchan->rotmode == ROT_MODE_AXISANGLE) { /* quat/euler to axis angle */ if (chan->rotmode > 0) - eulO_to_axis_angle( pchan->rotAxis, &pchan->rotAngle,chan->eul, chan->rotmode); + eulO_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, chan->eul, chan->rotmode); else - quat_to_axis_angle( pchan->rotAxis, &pchan->rotAngle,chan->quat); + quat_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, chan->quat); } else { /* euler/axis-angle to quat */ if (chan->rotmode > 0) - eulO_to_quat( pchan->quat,chan->eul, chan->rotmode); + eulO_to_quat(pchan->quat, chan->eul, chan->rotmode); else axis_angle_to_quat(pchan->quat, chan->rotAxis, pchan->rotAngle); } @@ -998,10 +988,10 @@ static int pose_paste_exec (bContext *C, wmOperator *op) else if (pchan->rotmode == ROT_MODE_AXISANGLE) { float eul[3]; - axis_angle_to_eulO( eul, EULER_ORDER_DEFAULT,pchan->rotAxis, pchan->rotAngle); + axis_angle_to_eulO(eul, EULER_ORDER_DEFAULT, pchan->rotAxis, pchan->rotAngle); eul[1]*= -1; eul[2]*= -1; - eulO_to_axis_angle( pchan->rotAxis, &pchan->rotAngle,eul, EULER_ORDER_DEFAULT); + eulO_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, eul, EULER_ORDER_DEFAULT); // experimental method (uncomment to test): #if 0 @@ -1013,62 +1003,55 @@ static int pose_paste_exec (bContext *C, wmOperator *op) else { float eul[3]; - quat_to_eul( eul,pchan->quat); + quat_to_eul(eul, pchan->quat); eul[1]*= -1; eul[2]*= -1; - eul_to_quat( pchan->quat,eul); + eul_to_quat(pchan->quat, eul); } } /* ID property */ - if(pchan->prop) { + if (pchan->prop) { IDP_FreeProperty(pchan->prop); MEM_freeN(pchan->prop); pchan->prop= NULL; } - - if(chan->prop) { + + if (chan->prop) pchan->prop= IDP_CopyProperty(chan->prop); + + /* keyframing tagging */ + if (autokeyframe_cfra_can_key(scene, &ob->id)) { + ListBase dsources = {NULL, NULL}; + + /* get KeyingSet to use */ + // TODO: for getting the KeyingSet used, we should really check which channels were affected + // TODO: this should get modified so that custom props are taken into account too! + if (posePaste_ks_locrotscale == NULL) + posePaste_ks_locrotscale= ANIM_builtin_keyingset_get_named(NULL, "LocRotScale"); + + /* now insert the keyframe(s) using the Keying Set + * 1) add datasource override for the PoseChannel + * 2) insert keyframes + * 3) free the extra info + */ + ANIM_relative_keyingset_add_source(&dsources, &ob->id, &RNA_PoseBone, pchan); + ANIM_apply_keyingset(C, &dsources, NULL, posePaste_ks_locrotscale, MODIFYKEY_MODE_INSERT, (float)CFRA); + BLI_freelistN(&dsources); + + /* clear any unkeyed tags */ + if (chan->bone) + chan->bone->flag &= ~BONE_UNKEYED; } - - /* auto key, TODO, fix up this INSERTAVAIL vs all other cases */ - if (IS_AUTOKEY_FLAG(INSERTAVAIL) == 0) { /* deal with this case later */ - if (autokeyframe_cfra_can_key(scene, &ob->id)) { - - /* Set keys on pose - * - KeyingSet to use depends on rotation mode - * (but that's handled by the templates code) - */ - // TODO: for getting the KeyingSet used, we should really check which channels were affected - if (posePaste_ks_locrotscale == NULL) - posePaste_ks_locrotscale= ANIM_builtin_keyingset_get_named(NULL, "LocRotScale"); - - /* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */ - cks.pchan= pchan; - - modify_keyframes(scene, &dsources, NULL, posePaste_ks_locrotscale, MODIFYKEY_MODE_INSERT, (float)CFRA); - - /* clear any unkeyed tags */ - if (chan->bone) - chan->bone->flag &= ~BONE_UNKEYED; - } - else { - /* add unkeyed tags */ - if (chan->bone) - chan->bone->flag |= BONE_UNKEYED; - } + else { + /* add unkeyed tags */ + if (chan->bone) + chan->bone->flag |= BONE_UNKEYED; } } } } - - if (IS_AUTOKEY_FLAG(INSERTAVAIL)) { - View3D *v3d= CTX_wm_view3d(C); - autokeyframe_pose_cb_func(C, scene, v3d, ob, TFM_TRANSLATION, 0); - autokeyframe_pose_cb_func(C, scene, v3d, ob, TFM_ROTATION, 0); - autokeyframe_pose_cb_func(C, scene, v3d, ob, TFM_TIME_SCALE, 0); - } - + /* Update event for pose and deformation children */ DAG_id_flush_update(&ob->id, OB_RECALC_DATA); @@ -1077,13 +1060,13 @@ static int pose_paste_exec (bContext *C, wmOperator *op) } else { /* need to trick depgraph, action is not allowed to execute on pose */ + // XXX: this is probably not an issue anymore where_is_pose(scene, ob); ob->recalc= 0; } /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob); - WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); // XXX not really needed, but here for completeness... return OPERATOR_FINISHED; } @@ -1754,13 +1737,7 @@ static int pose_flip_quats_exec (bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); - - bCommonKeySrc cks; - ListBase dsources = {&cks, &cks}; - - /* init common-key-source for use by KeyingSets */ - memset(&cks, 0, sizeof(bCommonKeySrc)); - cks.id= &ob->id; + KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, "LocRotScale"); /* loop through all selected pchans, flipping and keying (as needed) */ CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones) @@ -1773,20 +1750,18 @@ static int pose_flip_quats_exec (bContext *C, wmOperator *op) pchan->quat[2]= -pchan->quat[2]; pchan->quat[3]= -pchan->quat[3]; - /* perform auto-keying - * NOTE: paths don't need recalculation here, since the orientations shouldn't have changed - */ + /* tagging */ if (autokeyframe_cfra_can_key(scene, &ob->id)) { - /* Set keys on pose - * - KeyingSet to use depends on rotation mode - * (but that's handled by the templates code) - */ - KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Rotation"); + ListBase dsources = {NULL, NULL}; - /* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */ - cks.pchan= pchan; - - modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); + /* now insert the keyframe(s) using the Keying Set + * 1) add datasource override for the PoseChannel + * 2) insert keyframes + * 3) free the extra info + */ + ANIM_relative_keyingset_add_source(&dsources, &ob->id, &RNA_PoseBone, pchan); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); + BLI_freelistN(&dsources); /* clear any unkeyed tags */ if (pchan->bone) diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index 03d1408b7fc..ef5d566d0e8 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/armature/reeb.h b/source/blender/editors/armature/reeb.h index a4fc74bdd0d..3bebc423235 100644 --- a/source/blender/editors/armature/reeb.h +++ b/source/blender/editors/armature/reeb.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h index a9a9b5619ff..5b24407a53c 100644 --- a/source/blender/editors/curve/curve_intern.h +++ b/source/blender/editors/curve/curve_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index e672e7148b8..3f4498e83fe 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -203,7 +203,7 @@ void ED_keymap_curve(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "CURVE_OT_extrude", EKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "CURVE_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "CURVE_OT_make_segment", FKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "CURVE_OT_cyclic_toggle", CKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "CURVE_OT_cyclic_toggle", CKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "CURVE_OT_delete", XKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "CURVE_OT_delete", DELKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 8534e250885..dfc76aff3dd 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -929,9 +929,9 @@ static void adduplicateflagNurb(Object *obedit, short flag) bezt1++; } - if(nu->flagu & CU_CYCLIC) { + if(nu->flagu & CU_NURB_CYCLIC) { if(starta!=0 || enda!=nu->pntsu-1) { - newnu->flagu &= ~CU_CYCLIC; + newnu->flagu &= ~CU_NURB_CYCLIC; } } } @@ -966,9 +966,9 @@ static void adduplicateflagNurb(Object *obedit, short flag) bp1++; } - if(nu->flagu & CU_CYCLIC) { + if(nu->flagu & CU_NURB_CYCLIC) { if(starta!=0 || enda!=nu->pntsu-1) { - newnu->flagu &= ~CU_CYCLIC; + newnu->flagu &= ~CU_NURB_CYCLIC; } } @@ -1904,7 +1904,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) newly created. Old points are discarded. */ /* count */ - if(nu->flagu & CU_CYCLIC) { + if(nu->flagu & CU_NURB_CYCLIC) { a= nu->pntsu; bezt= nu->bezt; prevbezt= bezt+(a-1); @@ -1925,7 +1925,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) beztnew = (BezTriple*)MEM_mallocN((amount + nu->pntsu) * sizeof(BezTriple), "subdivNurb"); beztn= beztnew; - if(nu->flagu & CU_CYCLIC) { + if(nu->flagu & CU_NURB_CYCLIC) { a= nu->pntsu; bezt= nu->bezt; prevbezt= bezt+(a-1); @@ -1957,7 +1957,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) mid_v3_v3v3(beztn->vec[1], vec+9, vec+12); VECCOPY(beztn->vec[2], vec+12); /* handle of next bezt */ - if(a==0 && (nu->flagu & CU_CYCLIC)) {VECCOPY(beztnew->vec[0], vec+6);} + if(a==0 && (nu->flagu & CU_NURB_CYCLIC)) {VECCOPY(beztnew->vec[0], vec+6);} else {VECCOPY(bezt->vec[0], vec+6);} beztn->radius = (prevbezt->radius + bezt->radius)/2.0f; @@ -1970,7 +1970,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) bezt++; } /* last point */ - if((nu->flagu & CU_CYCLIC)==0) memcpy(beztn, prevbezt, sizeof(BezTriple)); + if((nu->flagu & CU_NURB_CYCLIC)==0) memcpy(beztn, prevbezt, sizeof(BezTriple)); MEM_freeN(nu->bezt); nu->bezt= beztnew; @@ -1987,7 +1987,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) stable... nzc 30-5-'00 */ /* count */ - if(nu->flagu & CU_CYCLIC) { + if(nu->flagu & CU_NURB_CYCLIC) { a= nu->pntsu; bp= nu->bp; prevbp= bp+(a-1); @@ -2009,7 +2009,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) (BPoint*)MEM_mallocN((amount + nu->pntsu) * sizeof(BPoint), "subdivNurb2"); bpn= bpnew; - if(nu->flagu & CU_CYCLIC) { + if(nu->flagu & CU_NURB_CYCLIC) { a= nu->pntsu; bp= nu->bp; prevbp= bp+(a-1); @@ -2036,7 +2036,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) prevbp= bp; bp++; } - if((nu->flagu & CU_CYCLIC)==0) memcpy(bpn, prevbp, sizeof(BPoint)); /* last point */ + if((nu->flagu & CU_NURB_CYCLIC)==0) memcpy(bpn, prevbp, sizeof(BPoint)); /* last point */ MEM_freeN(nu->bp); nu->bp= bpnew; @@ -2423,8 +2423,8 @@ static int convertspline(short type, Nurb *nu) else if(type==CU_NURBS) { nu->type = CU_NURBS; nu->orderu= 4; - nu->flagu &= CU_CYCLIC; /* disable all flags except for cyclic */ - nu->flagu += 4; + nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */ + nu->flagu |= CU_NURB_BEZIER; makeknots(nu, 1); a= nu->pntsu*nu->pntsv; bp= nu->bp; @@ -2473,11 +2473,11 @@ static int convertspline(short type, Nurb *nu) nu->orderu= 4; nu->orderv= 1; nu->type = type; - if(nu->flagu & CU_CYCLIC) c= nu->orderu-1; + if(nu->flagu & CU_NURB_CYCLIC) c= nu->orderu-1; else c= 0; if(type== CU_NURBS) { - nu->flagu &= CU_CYCLIC; /* disable all flags except for cyclic */ - nu->flagu += 4; + nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */ + nu->flagu |= CU_NURB_BEZIER; makeknots(nu, 1); } } @@ -2992,7 +2992,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) /* find both nurbs and points, nu1 will be put behind nu2 */ for(nu= editnurb->first; nu; nu= nu->next) { - if((nu->flagu & CU_CYCLIC)==0) { /* not cyclic */ + if((nu->flagu & CU_NURB_CYCLIC)==0) { /* not cyclic */ if(nu->type == CU_BEZIER) { bezt= nu->bezt; if(nu1==0) { @@ -3284,7 +3284,7 @@ static int spin_nurb(bContext *C, Scene *scene, Object *obedit, float *dvec, flo for(nu= editnurb->first; nu; nu= nu->next) { if(isNurbsel(nu)) { nu->orderv= 4; - nu->flagv |= CU_CYCLIC; + nu->flagv |= CU_NURB_CYCLIC; makeknots(nu, 2); } } @@ -3587,7 +3587,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) bp= nu->bp; while(a--) { if( bp->f1 & SELECT ) { - nu->flagu ^= CU_CYCLIC; + nu->flagu ^= CU_NURB_CYCLIC; break; } bp++; @@ -3598,7 +3598,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) bezt= nu->bezt; while(a--) { if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { - nu->flagu ^= CU_CYCLIC; + nu->flagu ^= CU_NURB_CYCLIC; break; } bezt++; @@ -3611,7 +3611,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) bp= nu->bp; while(a--) { if( bp->f1 & SELECT ) { - nu->flagu ^= CU_CYCLIC; + nu->flagu ^= CU_NURB_CYCLIC; makeknots(nu, 1); /* 1==u type is ignored for cyclic curves */ break; } @@ -3626,11 +3626,11 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) if( bp->f1 & SELECT) { if(direction==0 && nu->pntsu>1) { - nu->flagu ^= CU_CYCLIC; + nu->flagu ^= CU_NURB_CYCLIC; makeknots(nu, 1); /* 1==u type is ignored for cyclic curves */ } if(direction==1 && nu->pntsv>1) { - nu->flagv ^= CU_CYCLIC; + nu->flagv ^= CU_NURB_CYCLIC; makeknots(nu, 2); /* 2==v type is ignored for cyclic curves */ } break; @@ -4255,6 +4255,7 @@ static int duplicate_exec(bContext *C, wmOperator *op) Object *obedit= CTX_data_edit_object(C); adduplicateflagNurb(obedit, 1); + WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); return OPERATOR_FINISHED; } @@ -4429,10 +4430,10 @@ static int delete_exec(bContext *C, wmOperator *op) bezt2= bezt+1; if( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) ; else { /* maybe do not make cyclic */ - if(a==0 && (nu->flagu & CU_CYCLIC) ) { + if(a==0 && (nu->flagu & CU_NURB_CYCLIC) ) { bezt2= bezt+(nu->pntsu-1); if( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) { - nu->flagu &= ~CU_CYCLIC; + nu->flagu &= ~CU_NURB_CYCLIC; WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); DAG_id_flush_update(obedit->data, OB_RECALC_DATA); } @@ -4455,10 +4456,10 @@ static int delete_exec(bContext *C, wmOperator *op) bp2= bp+1; if( bp2->f1 & 1 ) ; else { /* maybe do not make cyclic */ - if(a==0 && (nu->flagu & CU_CYCLIC) ) { + if(a==0 && (nu->flagu & CU_NURB_CYCLIC) ) { bp2= bp+(nu->pntsu-1); if( bp2->f1 & SELECT ) { - nu->flagu &= ~CU_CYCLIC; + nu->flagu &= ~CU_NURB_CYCLIC; WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); DAG_id_flush_update(obedit->data, OB_RECALC_DATA); } @@ -4483,14 +4484,14 @@ static int delete_exec(bContext *C, wmOperator *op) BLI_remlink(editnurb, nu); freeNurb(nu); nu = NULL; } - else if(nu1->flagu & CU_CYCLIC) { /* cyclic */ + else if(nu1->flagu & CU_NURB_CYCLIC) { /* cyclic */ bezt = (BezTriple*)MEM_mallocN((cut+1) * sizeof(BezTriple), "delNurb1"); memcpy(bezt, nu1->bezt,(cut+1)*sizeof(BezTriple)); a= nu1->pntsu-cut-1; memcpy(nu1->bezt, bezt2, a*sizeof(BezTriple)); memcpy(nu1->bezt+a, bezt, (cut+1)*sizeof(BezTriple)); - nu1->flagu &= ~CU_CYCLIC; + nu1->flagu &= ~CU_NURB_CYCLIC; MEM_freeN(bezt); calchandlesNurb(nu); } @@ -4525,14 +4526,14 @@ static int delete_exec(bContext *C, wmOperator *op) BLI_remlink(editnurb, nu); freeNurb(nu); nu= NULL; } - else if(nu1->flagu & CU_CYCLIC) { /* cyclic */ + else if(nu1->flagu & CU_NURB_CYCLIC) { /* cyclic */ bp = (BPoint*)MEM_mallocN((cut+1) * sizeof(BPoint), "delNurb5"); memcpy(bp, nu1->bp,(cut+1)*sizeof(BPoint)); a= nu1->pntsu-cut-1; memcpy(nu1->bp, bp2, a*sizeof(BPoint)); memcpy(nu1->bp+a, bp, (cut+1)*sizeof(BPoint)); - nu1->flagu &= ~CU_CYCLIC; + nu1->flagu &= ~CU_NURB_CYCLIC; MEM_freeN(bp); } else { /* add new curve */ @@ -4848,7 +4849,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) nu->pntsu= 5; nu->pntsv= 1; nu->orderu= 5; - nu->flagu= 2; /* endpoint */ + nu->flagu= CU_NURB_ENDPOINT; /* endpoint */ nu->resolu= 8; nu->bp= callocstructN(BPoint, 5, "addNurbprim3"); @@ -4887,7 +4888,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) if (!force_3d) nu->flag |= CU_2D; nu->pntsu= 4; nu->bezt= callocstructN(BezTriple, 4, "addNurbprim1"); - nu->flagu= CU_CYCLIC; + nu->flagu= CU_NURB_CYCLIC; bezt= nu->bezt; bezt->h1= bezt->h2= HD_AUTO; @@ -4924,7 +4925,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) nu->pntsv= 1; nu->orderu= 4; nu->bp= callocstructN(BPoint, 8, "addNurbprim6"); - nu->flagu= CU_CYCLIC; + nu->flagu= CU_NURB_CYCLIC; bp= nu->bp; for(a=0; a<8; a++) { @@ -5046,7 +5047,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) mul_m4_v3(mat,bp->vec); bp++; } - nu->flagu= 4; + nu->flagu= CU_NURB_BEZIER; makeknots(nu, 1); BLI_addtail(editnurb, nu); /* temporal for spin */ diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 7bcfc81bf26..5c9b939aa1f 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -423,7 +423,7 @@ static void gp_stroke_to_path (bContext *C, bGPDlayer *gpl, bGPDstroke *gps, Cur nu->pntsu= gps->totpoints; nu->pntsv= 1; nu->orderu= gps->totpoints; - nu->flagu= 2; /* endpoint */ + nu->flagu= CU_NURB_ENDPOINT; nu->resolu= 32; nu->bp= (BPoint *)MEM_callocN(sizeof(BPoint)*gps->totpoints, "bpoints"); diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index c2a8f339e14..1bfe65eb36c 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index 99fb25e336d..8f37baf9af1 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -1,5 +1,5 @@ /** - * $Id: BIF_glutil.h + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 2f089a41a3f..c331702a9ee 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -452,9 +452,28 @@ void ANIM_draw_previewrange(const struct bContext *C, struct View2D *v2d); /* ************************************************* */ /* F-MODIFIER TOOLS */ +/* ------------- UI Panel Drawing -------------- */ + /* draw a given F-Modifier for some layout/UI-Block */ void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *id, ListBase *modifiers, struct FModifier *fcm); +/* ------------- Copy/Paste Buffer -------------- */ + + +/* free the copy/paste buffer */ +void free_fmodifiers_copybuf(void); + +/* copy the given F-Modifiers to the buffer, returning whether anything was copied or not + * assuming that the buffer has been cleared already with free_fmodifiers_copybuf() + * - active: only copy the active modifier + */ +short ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, short active); + +/* 'Paste' the F-Modifier(s) from the buffer to the specified list + * - replace: free all the existing modifiers to leave only the pasted ones + */ +short ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, short replace); + /* ************************************************* */ /* ASSORTED TOOLS */ diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index 95d0c4cfaca..81ceaffaa5e 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h index d1bba6bf796..3710d4bc4cc 100644 --- a/source/blender/editors/include/ED_curve.h +++ b/source/blender/editors/include/ED_curve.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h index 52d6fe479fa..5001323cb61 100644 --- a/source/blender/editors/include/ED_fileselect.h +++ b/source/blender/editors/include/ED_fileselect.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -83,7 +83,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar); FileLayout* ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *ar); int ED_fileselect_layout_numfiles(FileLayout* layout, struct ARegion *ar); -int ED_fileselect_layout_offset(FileLayout* layout, int x, int y); +int ED_fileselect_layout_offset(FileLayout* layout, int clamp_bounds, int x, int y); void ED_fileselect_layout_tilepos(FileLayout* layout, int tile, int *x, int *y); diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index 7bf0c284c9b..1d674112b8d 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_info.h b/source/blender/editors/include/ED_info.h index 2132ef96709..33b890cea60 100644 --- a/source/blender/editors/include/ED_info.h +++ b/source/blender/editors/include/ED_info.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h index 1219cee3a11..805b86ea534 100644 --- a/source/blender/editors/include/ED_keyframes_edit.h +++ b/source/blender/editors/include/ED_keyframes_edit.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index 2c58d9e3ff5..c0821b3ff55 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -47,6 +47,8 @@ struct wmOperatorType; struct PointerRNA; struct PropertyRNA; +#include "RNA_types.h" + /* ************ Keyframing Management **************** */ /* Get the active settings for keyframing settings from context (specifically the given scene) @@ -89,8 +91,6 @@ int insert_vert_fcurve(struct FCurve *fcu, float x, float y, short flag); */ short insert_keyframe_direct(struct PointerRNA ptr, struct PropertyRNA *prop, struct FCurve *fcu, float cfra, short flag); - - /* -------- */ /* Main Keyframing API calls: @@ -106,48 +106,93 @@ short delete_keyframe(struct ID *id, struct bAction *act, const char group[], co /* ************ Keying Sets ********************** */ -/* temporary struct to gather data combos to keyframe - * (is used by modify_keyframes for 'relative' KeyingSets, provided via the dsources arg) - */ -typedef struct bCommonKeySrc { - struct bCommonKeySrc *next, *prev; - - /* general data/destination-source settings */ - struct ID *id; /* id-block this comes from */ +/* forward decl. for this struct which is declared a bit later... */ +struct KeyingSetInfo; +struct ExtensionRNA; + +/* Polling Callback for KeyingSets */ +typedef int (*cbKeyingSet_Poll)(struct KeyingSetInfo *ksi, struct bContext *C); +/* Context Iterator Callback for KeyingSets */ +typedef void (*cbKeyingSet_Iterator)(struct KeyingSetInfo *ksi, struct bContext *C, struct KeyingSet *ks); +/* Property Specifier Callback for KeyingSets (called from iterators) */ +typedef void (*cbKeyingSet_Generate)(struct KeyingSetInfo *ksi, struct bContext *C, struct KeyingSet *ks, struct PointerRNA *ptr); + + +/* Callback info for 'Procedural' KeyingSets to use */ +typedef struct KeyingSetInfo { + struct KeyingSetInfo *next, *prev; + + /* info */ + /* identifier so that user can hook this up to a KeyingSet */ + char name[64]; + /* keying settings */ + short keyingflag; + /* builtin? */ + short builtin; - /* specific cases */ - struct bPoseChannel *pchan; - struct bConstraint *con; -} bCommonKeySrc; + /* polling callbacks */ + /* callback for polling the context for whether the right data is available */ + cbKeyingSet_Poll poll; + + /* generate callbacks */ + /* iterator to use to go through collections of data in context + * - this callback is separate from the 'adding' stage, allowing + * BuiltIn KeyingSets to be manually specified to use + */ + cbKeyingSet_Iterator iter; + /* generator to use to add properties based on the data found by iterator */ + cbKeyingSet_Generate generate; + + /* RNA integration */ + struct ExtensionRNA ext; +} KeyingSetInfo; /* -------- */ +/* Add another data source for Relative Keying Sets to be evaluated with */ +void ANIM_relative_keyingset_add_source(ListBase *dsources, struct ID *id, struct StructRNA *srna, void *data); + + /* mode for modify_keyframes */ typedef enum eModifyKey_Modes { MODIFYKEY_MODE_INSERT = 0, MODIFYKEY_MODE_DELETE, } eModifyKey_Modes; -/* Keyframing Helper Call - use the provided Keying Set to Add/Remove Keyframes */ -int modify_keyframes(struct Scene *scene, struct ListBase *dsources, struct bAction *act, struct KeyingSet *ks, short mode, float cfra); +/* return codes for errors (with Relative KeyingSets) */ +typedef enum eModifyKey_Returns { + /* context info was invalid for using the Keying Set */ + MODIFYKEY_INVALID_CONTEXT = -1, + /* there isn't any typeinfo for generating paths from context */ + MODIFYKEY_MISSING_TYPEINFO = -2, +} eModifyKey_Returns; -/* -------- */ +/* use the specified KeyingSet to add/remove various Keyframes on the specified frame */ +int ANIM_apply_keyingset(struct bContext *C, ListBase *dsources, struct bAction *act, struct KeyingSet *ks, short mode, float cfra); -/* Generate menu of KeyingSets */ -char *ANIM_build_keyingsets_menu(struct ListBase *list, short for_edit); +/* -------- */ /* Get the first builtin KeyingSet with the given name, which occurs after the given one (or start of list if none given) */ -struct KeyingSet *ANIM_builtin_keyingset_get_named(struct KeyingSet *prevKS, char name[]); +struct KeyingSet *ANIM_builtin_keyingset_get_named(struct KeyingSet *prevKS, const char name[]); -/* Initialise builtin KeyingSets on startup */ -void init_builtin_keyingsets(void); +/* Find KeyingSet type info given a name */ +KeyingSetInfo *ANIM_keyingset_info_find_named(const char name[]); +/* for RNA type registrations... */ +void ANIM_keyingset_info_register(const struct bContext *C, KeyingSetInfo *ksi); +void ANIM_keyingset_info_unregister(const struct bContext *C, KeyingSetInfo *ksi); + +/* cleanup on exit */ +void ANIM_keyingset_infos_exit(void); /* -------- */ /* Get the active KeyingSet for the given scene */ struct KeyingSet *ANIM_scene_get_active_keyingset(struct Scene *scene); +/* Check if KeyingSet can be used in the current context */ +short ANIM_keyingset_context_ok_poll(struct bContext *C, struct KeyingSet *ks); + /* ************ Drivers ********************** */ /* Returns whether there is a driver in the copy/paste buffer to paste */ diff --git a/source/blender/editors/include/ED_markers.h b/source/blender/editors/include/ED_markers.h index 06434d70656..e5e1f3cef10 100644 --- a/source/blender/editors/include/ED_markers.h +++ b/source/blender/editors/include/ED_markers.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index cc875e5156f..d3e40551194 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index b7dc9bf73b5..6e42b772bef 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -40,6 +40,7 @@ void ED_init_node_butfuncs(void); /* node_draw.c */ void ED_node_changed_update(struct ID *id, struct bNode *node); +void ED_node_generic_update(struct Main *bmain, struct Scene *scene, struct bNodeTree *ntree, struct bNode *node); /* node_edit.c */ void ED_node_shader_default(struct Material *ma); diff --git a/source/blender/editors/include/ED_numinput.h b/source/blender/editors/include/ED_numinput.h index ca5dc4797de..4f3918625d9 100644 --- a/source/blender/editors/include/ED_numinput.h +++ b/source/blender/editors/include/ED_numinput.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 8045f2a9130..92d0406dd58 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -62,7 +62,6 @@ void ED_base_object_activate(struct bContext *C, struct Base *base); void ED_base_object_free_and_unlink(struct Scene *scene, struct Base *base); -void ED_object_apply_obmat(struct Object *ob); /* single object duplicate, if dupflag==0, fully linked, else it uses the flags given */ struct Base *ED_object_add_duplicate(struct Scene *scene, struct Base *base, int dupflag); diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 2a4f70959a3..4a4c546ec92 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h index 8580dcc33c9..03ea9a8f976 100644 --- a/source/blender/editors/include/ED_screen_types.h +++ b/source/blender/editors/include/ED_screen_types.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h index 61267ef1c93..1167d116df7 100644 --- a/source/blender/editors/include/ED_sculpt.h +++ b/source/blender/editors/include/ED_sculpt.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_sequencer.h b/source/blender/editors/include/ED_sequencer.h index f996956c15d..d99187afce9 100644 --- a/source/blender/editors/include/ED_sequencer.h +++ b/source/blender/editors/include/ED_sequencer.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h index 3529eddd6d9..69a3d1f758a 100644 --- a/source/blender/editors/include/ED_space_api.h +++ b/source/blender/editors/include/ED_space_api.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_text.h b/source/blender/editors/include/ED_text.h index 156d1030063..081e83b1844 100644 --- a/source/blender/editors/include/ED_text.h +++ b/source/blender/editors/include/ED_text.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_types.h b/source/blender/editors/include/ED_types.h index 92de24fa33e..96a5d5857fa 100644 --- a/source/blender/editors/include/ED_types.h +++ b/source/blender/editors/include/ED_types.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h index bbc52bf41c8..cc4f906ad37 100644 --- a/source/blender/editors/include/ED_util.h +++ b/source/blender/editors/include/ED_util.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h index 6a3c980fb1c..1710a8439d1 100644 --- a/source/blender/editors/include/ED_uvedit.h +++ b/source/blender/editors/include/ED_uvedit.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index dfae3e6dda6..842b66a1f6f 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -161,7 +161,7 @@ void ED_view3d_draw_offscreen(struct Scene *scene, struct View3D *v3d, struct AR int winx, int winy, float viewmat[][4], float winmat[][4]); struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey); -struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height); +struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, int drawtype); void view3d_clipping_local(struct RegionView3D *rv3d, float mat[][4]); diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h index 7b84c7054b0..745073fd235 100644 --- a/source/blender/editors/include/UI_icons.h +++ b/source/blender/editors/include/UI_icons.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index 2f908559c6c..46c8a446a03 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -164,6 +164,22 @@ enum { TH_FACE_DOT, TH_FACEDOT_SIZE, TH_CFRAME, + TH_NURB_ULINE, + TH_NURB_VLINE, + TH_NURB_SEL_ULINE, + TH_NURB_SEL_VLINE, + + /* this eight colors should be in one block */ + TH_HANDLE_FREE, + TH_HANDLE_AUTO, + TH_HANDLE_VECT, + TH_HANDLE_ALIGN, + TH_HANDLE_SEL_FREE, + TH_HANDLE_SEL_AUTO, + TH_HANDLE_SEL_VECT, + TH_HANDLE_SEL_ALIGN, + + TH_ACTIVE_SPLINE, TH_SYNTAX_B, TH_SYNTAX_V, diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index ea7e89f5102..c1d47f2ec7c 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -648,10 +648,6 @@ void uiEndBlock(const bContext *C, uiBlock *block) CTX_store_set((bContext*)C, NULL); } - /* only update soft range while not editing */ - if(but->rnaprop && !(but->editval || but->editstr || but->editvec)) - ui_set_but_soft_range(but, ui_get_but_val(but)); - ui_but_anim_flag(but, (scene)? scene->r.cfra: 0.0f); } @@ -1940,6 +1936,10 @@ void ui_check_but(uiBut *but) // if(but->type==TEX || but->type==IDPOIN) transopts= 0; + /* only update soft range while not editing */ + if(but->rnaprop && !(but->editval || but->editstr || but->editvec)) + ui_set_but_soft_range(but, ui_get_but_val(but)); + /* test for min and max, icon sliders, etc */ switch( but->type ) { case NUM: diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index bc03be84b65..e12db3674d4 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -413,6 +413,15 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); data->linedark[data->totline]= 1; data->totline++; + + if(but->rnapoin.id.data) { + ID *id= but->rnapoin.id.data; + if(id->lib && id->lib->name) { + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Library: %s", id->lib->name); + data->linedark[data->totline]= 1; + data->totline++; + } + } } else if (but->optype) { PointerRNA *opptr; @@ -1568,9 +1577,19 @@ void ui_update_block_buts_rgb(uiBlock *block, float *rgb) } else if(strcmp(bt->str, "Hex: ")==0) { + float rgb_gamma[3]; char col[16]; - sprintf(col, "%02X%02X%02X", (unsigned int)(rgb[0]*255.0), (unsigned int)(rgb[1]*255.0), (unsigned int)(rgb[2]*255.0)); + /* Hex code is assumed to be in sRGB space (coming from other applications, web, etc) */ + + if (block->color_profile == BLI_PR_NONE) { + copy_v3_v3(rgb_gamma, rgb); + } else { + /* make an sRGB version, for Hex code */ + linearrgb_to_srgb_v3_v3(rgb_gamma, rgb); + } + + sprintf(col, "%02X%02X%02X", (unsigned int)(rgb_gamma[0]*255.0), (unsigned int)(rgb_gamma[1]*255.0), (unsigned int)(rgb_gamma[2]*255.0)); strcpy(bt->poin, col); } @@ -1640,6 +1659,12 @@ static void do_hex_rna_cb(bContext *C, void *bt1, void *hexcl) hex_to_rgb(hexcol, rgb, rgb+1, rgb+2); + /* Hex code is assumed to be in sRGB space (coming from other applications, web, etc) */ + if (but->block->color_profile != BLI_PR_NONE) { + /* so we need to linearise it for Blender */ + srgb_to_linearrgb_v3_v3(rgb, rgb); + } + ui_update_block_buts_rgb(but->block, rgb); if(popup) @@ -1662,6 +1687,13 @@ static void picker_new_hide_reveal(uiBlock *block, short colormode) /* tag buttons */ for(bt= block->buttons.first; bt; bt= bt->next) { + if (bt->type == LABEL) { + if( bt->str[1]=='G') { + if(colormode==2) bt->flag &= ~UI_HIDDEN; + else bt->flag |= UI_HIDDEN; + } + } + if(bt->type==NUMSLI || bt->type==TEX) { if( bt->str[1]=='e') { if(colormode==2) bt->flag &= ~UI_HIDDEN; @@ -1735,16 +1767,21 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR static char tip[50]; static float hsv[3]; static char hexcol[128]; + float rgb_gamma[3]; const char *propname = RNA_property_identifier(prop); width= PICKER_TOTAL_W; butwidth = width - UI_UNIT_X - 10; /* existence of profile means storage is in linear colour space, with display correction */ - if (block->color_profile == BLI_PR_NONE) + if (block->color_profile == BLI_PR_NONE) { sprintf(tip, "Value in Display Color Space"); - else + copy_v3_v3(rgb_gamma, rgb); + } else { sprintf(tip, "Value in Linear RGB Color Space"); + /* make an sRGB version, for Hex code */ + linearrgb_to_srgb_v3_v3(rgb_gamma, rgb); + } RNA_property_float_get_array(ptr, prop, rgb); rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); @@ -1799,10 +1836,12 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR uiBlockEndAlign(block); rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); - sprintf(hexcol, "%02X%02X%02X", (unsigned int)(rgb[0]*255.0), (unsigned int)(rgb[1]*255.0), (unsigned int)(rgb[2]*255.0)); + + sprintf(hexcol, "%02X%02X%02X", (unsigned int)(rgb_gamma[0]*255.0), (unsigned int)(rgb_gamma[1]*255.0), (unsigned int)(rgb_gamma[2]*255.0)); bt= uiDefBut(block, TEX, 0, "Hex: ", 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)"); uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol); + uiDefBut(block, LABEL, 0, "(Gamma Corrected)", 0, -80, butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); picker_new_hide_reveal(block, colormode); } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index efd741a12f6..b7761da76c0 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -31,6 +31,7 @@ #include "DNA_color_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" +#include "DNA_userdef_types.h" #include "BLI_string.h" @@ -164,9 +165,15 @@ static void id_search_cb(const bContext *C, void *arg_template, char *str, uiSea /* ID listbase */ for(id= lb->first; id; id= id->next) { if(!((flag & PROP_ID_SELF_CHECK) && id == id_from)) { + + /* hide dot-datablocks */ + if(U.uiflag & USER_HIDE_DOT) + if ((id->name[2]=='.') && (str[0] != '.')) + continue; + if(BLI_strcasestr(id->name+2, str)) { iconid= ui_id_icon_get((bContext*)C, id, 0); - + if(!uiSearchItemAdd(items, id->name+2, id, iconid)) break; } diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index f86ffe657cc..fb44685ceff 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -305,7 +305,33 @@ char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) cp= ts->strip_select; break; case TH_CFRAME: cp= ts->cframe; break; - + case TH_NURB_ULINE: + cp= ts->nurb_uline; break; + case TH_NURB_VLINE: + cp= ts->nurb_vline; break; + case TH_NURB_SEL_ULINE: + cp= ts->nurb_sel_uline; break; + case TH_NURB_SEL_VLINE: + cp= ts->nurb_sel_vline; break; + case TH_ACTIVE_SPLINE: + cp= ts->act_spline; break; + case TH_HANDLE_FREE: + cp= ts->handle_free; break; + case TH_HANDLE_AUTO: + cp= ts->handle_auto; break; + case TH_HANDLE_VECT: + cp= ts->handle_vect; break; + case TH_HANDLE_ALIGN: + cp= ts->handle_align; break; + case TH_HANDLE_SEL_FREE: + cp= ts->handle_sel_free; break; + case TH_HANDLE_SEL_AUTO: + cp= ts->handle_sel_auto; break; + case TH_HANDLE_SEL_VECT: + cp= ts->handle_sel_vect; break; + case TH_HANDLE_SEL_ALIGN: + cp= ts->handle_sel_align; break; + case TH_SYNTAX_B: cp= ts->syntaxb; break; case TH_SYNTAX_V: @@ -495,6 +521,22 @@ void ui_theme_init_userdef(void) btheme->tv3d.facedot_size= 4; SETCOL(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255); + SETCOL(btheme->tv3d.nurb_uline, 0x90, 0x90, 0x00, 255); + SETCOL(btheme->tv3d.nurb_vline, 0x80, 0x30, 0x60, 255); + SETCOL(btheme->tv3d.nurb_sel_uline, 0xf0, 0xff, 0x40, 255); + SETCOL(btheme->tv3d.nurb_sel_vline, 0xf0, 0x90, 0xa0, 255); + + SETCOL(btheme->tv3d.handle_free, 0, 0, 0, 255); + SETCOL(btheme->tv3d.handle_auto, 0x90, 0x90, 0x00, 255); + SETCOL(btheme->tv3d.handle_vect, 0x40, 0x90, 0x30, 255); + SETCOL(btheme->tv3d.handle_align, 0x80, 0x30, 0x60, 255); + SETCOL(btheme->tv3d.handle_sel_free, 0, 0, 0, 255); + SETCOL(btheme->tv3d.handle_sel_auto, 0xf0, 0xff, 0x40, 255); + SETCOL(btheme->tv3d.handle_sel_vect, 0x40, 0xc0, 0x30, 255); + SETCOL(btheme->tv3d.handle_sel_align, 0xf0, 0x90, 0xa0, 255); + + SETCOL(btheme->tv3d.act_spline, 0xdb, 0x25, 0x12, 255); + SETCOL(btheme->tv3d.bone_solid, 200, 200, 200, 255); SETCOL(btheme->tv3d.bone_pose, 80, 200, 255, 80); // alpha 80 is not meant editable, used for wire+action draw diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 2e6a9d7a646..de4230b8891 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c index 44c23bff38b..06d9301072e 100644 --- a/source/blender/editors/mesh/editmesh_lib.c +++ b/source/blender/editors/mesh/editmesh_lib.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c index 887af0af4c5..f2a099ca6a5 100644 --- a/source/blender/editors/mesh/editmesh_loop.c +++ b/source/blender/editors/mesh/editmesh_loop.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index ecdd4c184df..d0201f1c6ab 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 304bf0da577..2fa6acf8d00 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -1,4 +1,4 @@ - /* $Id: + /* $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -3734,7 +3734,6 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed, int dir) free_editface(em, face[1]); } -// XXX ton please check /* only accepts 1 selected edge, or 2 selected faces */ static int edge_rotate_selected(bContext *C, wmOperator *op) { @@ -3742,7 +3741,7 @@ static int edge_rotate_selected(bContext *C, wmOperator *op) EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); EditEdge *eed; EditFace *efa; - int dir = RNA_int_get(op->ptr, "direction"); // dir == 2 when clockwise and ==1 for counter CW. + int dir = RNA_enum_get(op->ptr, "direction"); // dir == 2 when clockwise and ==1 for counter CW. short edgeCount = 0; /*clear new flag for new edges, count selected edges */ @@ -3822,7 +3821,7 @@ void MESH_OT_edge_rotate(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* props */ - RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "direction", "direction to rotate edge around."); + RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "Direction", "Direction to rotate the edge around."); } diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c index 012c552241a..1a37832d0cd 100644 --- a/source/blender/editors/mesh/loopcut.c +++ b/source/blender/editors/mesh/loopcut.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index b18f19885be..2db229e8325 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -697,7 +697,7 @@ static void mesh_add_faces(Mesh *mesh, int len) /* set default flags */ mface= &mesh->mface[mesh->totface]; for(i=0; i<len; i++, mface++) - mface->flag= SELECT; + mface->flag= ME_FACE_SEL; mesh->totface= totface; } diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index df3ac960b7c..ed3ffcd987c 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 90419b6dd62..34577b7349e 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index a56b6e47ad9..df67868d2ad 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 2a0d6e6c046..484a67b94db 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -92,6 +92,7 @@ #include "ED_render.h" #include "ED_screen.h" #include "ED_transform.h" +#include "ED_view3d.h" #include "UI_interface.h" #include "UI_resources.h" @@ -104,15 +105,11 @@ void ED_object_location_from_view(bContext *C, float *loc) { View3D *v3d= CTX_wm_view3d(C); Scene *scene= CTX_data_scene(C); + float *cursor; - if (v3d) { - if (v3d->localvd) - copy_v3_v3(loc, v3d->cursor); - else - copy_v3_v3(loc, scene->cursor); - } else { - copy_v3_v3(loc, scene->cursor); - } + cursor = give_cursor(scene, v3d); + + copy_v3_v3(loc, cursor); } void ED_object_rotation_from_view(bContext *C, float *rot) @@ -503,11 +500,14 @@ static int object_add_curve_exec(bContext *C, wmOperator *op) ED_object_add_generic_get_opts(op, loc, rot, &enter_editmode, &layer); if(obedit==NULL || obedit->type!=OB_CURVE) { + Curve *cu; obedit= ED_object_add_type(C, OB_CURVE, loc, rot, TRUE, layer); newob = 1; + cu= (Curve*)obedit->data; + cu->flag |= CU_DEFORM_FILL; if(type & CU_PRIM_PATH) - ((Curve*)obedit->data)->flag |= CU_PATH|CU_3D; + cu->flag |= CU_PATH|CU_3D; } else DAG_id_flush_update(&obedit->id, OB_RECALC_DATA); @@ -1118,7 +1118,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base) ob->lay= base->lay; copy_m4_m4(ob->obmat, dob->mat); - ED_object_apply_obmat(ob); + object_apply_mat4(ob, ob->obmat); } copy_object_set_idnew(C, 0); diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index a4f419cf996..1c8b71f5e44 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -203,7 +203,7 @@ static void bake_startjob(void *bkv, short *stop, short *do_update) RE_test_break_cb(bkr->re, NULL, thread_break); G.afbreek= 0; /* blender_test_break uses this global */ - RE_Database_Baking(bkr->re, scene, scene->r.bake_mode, bkr->actob); + RE_Database_Baking(bkr->re, scene, scene->lay, scene->r.bake_mode, bkr->actob); /* baking itself is threaded, cannot use test_break in threads. we also update optional imagewindow */ bkr->tot= RE_bake_shade_all_selected(bkr->re, scene->r.bake_mode, bkr->actob, bkr->do_update); @@ -301,7 +301,7 @@ static int bake_image_exec(bContext *C, wmOperator *op) RE_test_break_cb(bkr.re, NULL, thread_break); G.afbreek= 0; /* blender_test_break uses this global */ - RE_Database_Baking(bkr.re, scene, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE)? OBACT: NULL); + RE_Database_Baking(bkr.re, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE)? OBACT: NULL); /* baking itself is threaded, cannot use test_break in threads */ BLI_init_threads(&threads, do_bake_render, 1); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 96ba419704a..045ff3d5620 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -864,6 +864,7 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o case CONSTRAINT_TYPE_LOCLIMIT: case CONSTRAINT_TYPE_ROTLIMIT: case CONSTRAINT_TYPE_SIZELIMIT: + case CONSTRAINT_TYPE_SAMEVOL: return 0; /* restricted target-type constraints -------------- */ diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 807fa00d806..65e8fbeeb8f 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -150,34 +150,6 @@ static int pupmenu(const char *msg) {return 0;} static bContext *C; static void error_libdata() {} -/* ********************************** */ - -/* --------------------------------- */ - -void ED_object_apply_obmat(Object *ob) -{ - float mat[3][3], imat[3][3], tmat[3][3]; - - /* from obmat to loc rot size */ - - if(ob==NULL) return; - copy_m3_m4(mat, ob->obmat); - - VECCOPY(ob->loc, ob->obmat[3]); - - mat3_to_eul( ob->rot,mat); - eul_to_mat3( tmat,ob->rot); - - invert_m3_m3(imat, tmat); - - mul_m3_m3m3(tmat, imat, mat); - - ob->size[0]= tmat[0][0]; - ob->size[1]= tmat[1][1]; - ob->size[2]= tmat[2][2]; - -} - /* ********* clear/set restrict view *********/ static int object_restrictview_clear_exec(bContext *C, wmOperator *op) { diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 5331de02560..23f5d0c1475 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index ab50bd4c37c..bbc5bcd8035 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index f55e7594c24..94eae2a7ab9 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -430,7 +430,7 @@ static int parent_clear_exec(bContext *C, wmOperator *op) else if(type == 1) { ob->parent= NULL; ob->track= NULL; - ED_object_apply_obmat(ob); + object_apply_mat4(ob, ob->obmat); } else if(type == 2) unit_m4(ob->parentinv); @@ -572,7 +572,7 @@ static int parent_set_exec(bContext *C, wmOperator *op) Object workob; /* apply transformation of previous parenting */ - ED_object_apply_obmat(ob); + object_apply_mat4(ob, ob->obmat); /* set the parent (except for follow-path constraint option) */ if(partype != PAR_PATH_CONST) @@ -887,7 +887,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op) } if(type == 1) - ED_object_apply_obmat(ob); + object_apply_mat4(ob, ob->obmat); } CTX_DATA_END; diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 30df347bc60..ca6feabdf80 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -75,32 +75,35 @@ static int object_location_clear_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - + Scene *scene = CTX_data_scene(C); KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Location"); - bCommonKeySrc cks; - ListBase dsources = {&cks, &cks}; - - /* init common-key-source for use by KeyingSets */ - memset(&cks, 0, sizeof(bCommonKeySrc)); /* clear location of selected objects if not in weight-paint mode */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { - if(!(ob->mode & OB_MODE_WEIGHT_PAINT)) { - if((ob->protectflag & OB_LOCK_LOCX)==0) + if (!(ob->mode & OB_MODE_WEIGHT_PAINT)) { + /* clear location if not locked */ + if ((ob->protectflag & OB_LOCK_LOCX)==0) ob->loc[0]= ob->dloc[0]= 0.0f; - if((ob->protectflag & OB_LOCK_LOCY)==0) + if ((ob->protectflag & OB_LOCK_LOCY)==0) ob->loc[1]= ob->dloc[1]= 0.0f; - if((ob->protectflag & OB_LOCK_LOCZ)==0) + if ((ob->protectflag & OB_LOCK_LOCZ)==0) ob->loc[2]= ob->dloc[2]= 0.0f; - /* do auto-keyframing as appropriate */ + /* auto keyframing */ if (autokeyframe_cfra_can_key(scene, &ob->id)) { - /* init cks for this object, then use the relative KeyingSets to keyframe it */ - cks.id= &ob->id; - modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); + ListBase dsources = {NULL, NULL}; + + /* now insert the keyframe(s) using the Keying Set + * 1) add datasource override for the PoseChannel + * 2) insert keyframes + * 3) free the extra info + */ + ANIM_relative_keyingset_add_source(&dsources, &ob->id, NULL, NULL); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); + BLI_freelistN(&dsources); } } + ob->recalc |= OB_RECALC_OB; } CTX_DATA_END; @@ -131,17 +134,12 @@ void OBJECT_OT_location_clear(wmOperatorType *ot) static int object_rotation_clear_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Rotation"); - bCommonKeySrc cks; - ListBase dsources = {&cks, &cks}; - - /* init common-key-source for use by KeyingSets */ - memset(&cks, 0, sizeof(bCommonKeySrc)); /* clear rotation of selected objects if not in weight-paint mode */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { if(!(ob->mode & OB_MODE_WEIGHT_PAINT)) { + /* clear rotations that aren't locked */ if (ob->protectflag & (OB_LOCK_ROTX|OB_LOCK_ROTY|OB_LOCK_ROTZ|OB_LOCK_ROTW)) { if (ob->protectflag & OB_LOCK_ROT4D) { /* perform clamping on a component by component basis */ @@ -233,13 +231,21 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op) } } - /* do auto-keyframing as appropriate */ + /* auto keyframing */ if (autokeyframe_cfra_can_key(scene, &ob->id)) { - /* init cks for this object, then use the relative KeyingSets to keyframe it */ - cks.id= &ob->id; - modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); + ListBase dsources = {NULL, NULL}; + + /* now insert the keyframe(s) using the Keying Set + * 1) add datasource override for the PoseChannel + * 2) insert keyframes + * 3) free the extra info + */ + ANIM_relative_keyingset_add_source(&dsources, &ob->id, NULL, NULL); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); + BLI_freelistN(&dsources); } } + ob->recalc |= OB_RECALC_OB; } CTX_DATA_END; @@ -270,35 +276,37 @@ void OBJECT_OT_rotation_clear(wmOperatorType *ot) static int object_scale_clear_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Scaling"); - bCommonKeySrc cks; - ListBase dsources = {&cks, &cks}; - - /* init common-key-source for use by KeyingSets */ - memset(&cks, 0, sizeof(bCommonKeySrc)); /* clear scales of selected objects if not in weight-paint mode */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { if(!(ob->mode & OB_MODE_WEIGHT_PAINT)) { - if((ob->protectflag & OB_LOCK_SCALEX)==0) { + /* clear scale factors which are not locked */ + if ((ob->protectflag & OB_LOCK_SCALEX)==0) { ob->dsize[0]= 0.0f; ob->size[0]= 1.0f; } - if((ob->protectflag & OB_LOCK_SCALEY)==0) { + if ((ob->protectflag & OB_LOCK_SCALEY)==0) { ob->dsize[1]= 0.0f; ob->size[1]= 1.0f; } - if((ob->protectflag & OB_LOCK_SCALEZ)==0) { + if ((ob->protectflag & OB_LOCK_SCALEZ)==0) { ob->dsize[2]= 0.0f; ob->size[2]= 1.0f; } - /* do auto-keyframing as appropriate */ + /* auto keyframing */ if (autokeyframe_cfra_can_key(scene, &ob->id)) { - /* init cks for this object, then use the relative KeyingSets to keyframe it */ - cks.id= &ob->id; - modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); + ListBase dsources = {NULL, NULL}; + + /* now insert the keyframe(s) using the Keying Set + * 1) add datasource override for the PoseChannel + * 2) insert keyframes + * 3) free the extra info + */ + ANIM_relative_keyingset_add_source(&dsources, &ob->id, NULL, NULL); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); + BLI_freelistN(&dsources); } } ob->recalc |= OB_RECALC_OB; @@ -384,7 +392,7 @@ static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob ) /* a change was made, adjust the children to compensate */ for(ob_child=bmain->object.first; ob_child; ob_child=ob_child->id.next) { if(ob_child->parent == ob) { - ED_object_apply_obmat(ob_child); + object_apply_mat4(ob_child, ob_child->obmat); what_does_parent(scene, ob_child, &workob); invert_m4_m4(ob_child->parentinv, workob.obmat); } diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c index e738aa34d07..7fa35d8c8ee 100644 --- a/source/blender/editors/physics/particle_boids.c +++ b/source/blender/editors/physics/particle_boids.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 9fc9131ffb2..744ef285179 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -831,9 +831,12 @@ static void PE_apply_mirror(Object *ob, ParticleSystem *psys) edit= psys->edit; psmd= psys_get_modifier(ob, psys); - if(!edit->mirror_cache || !psmd->dm) + if(!psmd->dm) return; + if(!edit->mirror_cache) + PE_update_mirror_cache(ob, psys); + /* we delay settings the PARS_EDIT_RECALC for mirrored particles * to avoid doing mirror twice */ LOOP_POINTS { diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 0a2c8a5b4a7..049f09f9901 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c index 55568c89e75..1425fdc10cf 100644 --- a/source/blender/editors/physics/physics_ops.c +++ b/source/blender/editors/physics/physics_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/render/render_intern.h b/source/blender/editors/render/render_intern.h index 020aab03d7a..d8b21f3eb36 100644 --- a/source/blender/editors/render/render_intern.h +++ b/source/blender/editors/render/render_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 22c4f9e729c..44d3b2bec7f 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -405,6 +405,8 @@ static int screen_render_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Render *re= RE_GetRender(scene->id.name, RE_SLOT_VIEW); + View3D *v3d= CTX_wm_view3d(C); + int lay= (v3d)? v3d->lay|scene->lay: scene->lay; if(re==NULL) { re= RE_NewRender(scene->id.name, RE_SLOT_VIEW); @@ -412,9 +414,9 @@ static int screen_render_exec(bContext *C, wmOperator *op) RE_test_break_cb(re, NULL, (int (*)(void *)) blender_test_break); if(RNA_boolean_get(op->ptr, "animation")) - RE_BlenderAnim(re, scene, scene->r.sfra, scene->r.efra, scene->r.frame_step, op->reports); + RE_BlenderAnim(re, scene, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step, op->reports); else - RE_BlenderFrame(re, scene, NULL, scene->r.cfra); + RE_BlenderFrame(re, scene, NULL, lay, scene->r.cfra); // no redraw needed, we leave state as we entered it ED_update_for_newframe(C, 1); @@ -429,6 +431,7 @@ typedef struct RenderJob { Render *re; wmWindow *win; SceneRenderLayer *srl; + int lay; int anim; Image *image; ImageUser iuser; @@ -531,9 +534,9 @@ static void render_startjob(void *rjv, short *stop, short *do_update) rj->do_update= do_update; if(rj->anim) - RE_BlenderAnim(rj->re, rj->scene, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step, rj->reports); + RE_BlenderAnim(rj->re, rj->scene, rj->lay, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step, rj->reports); else - RE_BlenderFrame(rj->re, rj->scene, rj->srl, rj->scene->r.cfra); + RE_BlenderFrame(rj->re, rj->scene, rj->srl, rj->lay, rj->scene->r.cfra); // if(mainp) // free_main(mainp); @@ -573,6 +576,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event) /* new render clears all callbacks */ Scene *scene= CTX_data_scene(C); SceneRenderLayer *srl=NULL; + View3D *v3d= CTX_wm_view3d(C); Render *re; wmJob *steve; RenderJob *rj; @@ -624,6 +628,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event) rj->scene= scene; rj->win= CTX_wm_window(C); rj->srl = srl; + rj->lay = (v3d)? v3d->lay|scene->lay: scene->lay; rj->anim= RNA_boolean_get(op->ptr, "animation"); rj->iuser.scene= scene; rj->iuser.ok= 1; diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index ae0d67626cf..196c6aa87e4 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/render/render_ops.c b/source/blender/editors/render/render_ops.c index dbaec48de06..61157ab74dc 100644 --- a/source/blender/editors/render/render_ops.c +++ b/source/blender/editors/render/render_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 44ca80867e4..1eac01a1fa1 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -752,11 +752,10 @@ void BIF_view3d_previewrender(Scene *scene, ScrArea *sa) /* allow localview render for objects with lights in normal layers */ if(v3d->lay & 0xFF000000) - scene->lay |= v3d->lay; - else scene->lay= v3d->lay; + lay |= v3d->lay; + else lay= v3d->lay; - RE_Database_FromScene(re, scene, 0); // 0= dont use camera view - scene->lay= lay; + RE_Database_FromScene(re, scene, lay, 0); // 0= dont use camera view rstats= RE_GetStats(re); if(rstats->convertdone) @@ -934,7 +933,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs /* entire cycle for render engine */ RE_SetCamera(re, sce->camera); - RE_Database_FromScene(re, sce, 1); + RE_Database_FromScene(re, sce, sce->lay, 1); RE_TileProcessor(re, 0, 1); // actual render engine RE_Database_Free(re); diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index e60c5dac008..ce72a5c7f2f 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -40,6 +40,7 @@ #include "DNA_space_types.h" #include "DNA_world_types.h" +#include "BKE_animsys.h" #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_font.h" @@ -819,6 +820,7 @@ void SCENE_OT_freestyle_module_move_down(wmOperatorType *ot) static int texture_slot_move(bContext *C, wmOperator *op) { ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data; + Material *ma = (Material *)id; if(id) { MTex **mtex_ar, *mtexswap; @@ -832,6 +834,10 @@ static int texture_slot_move(bContext *C, wmOperator *op) mtexswap = mtex_ar[act]; mtex_ar[act] = mtex_ar[act-1]; mtex_ar[act-1] = mtexswap; + + BKE_animdata_fix_paths_rename(id, ma->adt, "texture_slots", NULL, NULL, act-1, -1, 0); + BKE_animdata_fix_paths_rename(id, ma->adt, "texture_slots", NULL, NULL, act, act-1, 0); + BKE_animdata_fix_paths_rename(id, ma->adt, "texture_slots", NULL, NULL, -1, act, 0); if(GS(id->name)==ID_MA) { Material *ma= (Material *)id; @@ -841,7 +847,7 @@ static int texture_slot_move(bContext *C, wmOperator *op) ma->septex &= ~(1<<(act-1)); ma->septex |= mtexuse >> 1; } - + set_active_mtex(id, act-1); } } @@ -850,6 +856,10 @@ static int texture_slot_move(bContext *C, wmOperator *op) mtexswap = mtex_ar[act]; mtex_ar[act] = mtex_ar[act+1]; mtex_ar[act+1] = mtexswap; + + BKE_animdata_fix_paths_rename(id, ma->adt, "texture_slots", NULL, NULL, act+1, -1, 0); + BKE_animdata_fix_paths_rename(id, ma->adt, "texture_slots", NULL, NULL, act, act+1, 0); + BKE_animdata_fix_paths_rename(id, ma->adt, "texture_slots", NULL, NULL, -1, act, 0); if(GS(id->name)==ID_MA) { Material *ma= (Material *)id; @@ -859,7 +869,7 @@ static int texture_slot_move(bContext *C, wmOperator *op) ma->septex &= ~(1<<(act+1)); ma->septex |= mtexuse << 1; } - + set_active_mtex(id, act+1); } } @@ -909,27 +919,35 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int dx= env->cube[1]->x; - ibuf = IMB_allocImBuf(3*dx, 2*dx, 24, IB_rectfloat, 0); + if (env->type == ENV_CUBE) { + ibuf = IMB_allocImBuf(3*dx, 2*dx, 24, IB_rectfloat, 0); + + IMB_rectcpy(ibuf, env->cube[0], 0, 0, 0, 0, dx, dx); + IMB_rectcpy(ibuf, env->cube[1], dx, 0, 0, 0, dx, dx); + IMB_rectcpy(ibuf, env->cube[2], 2*dx, 0, 0, 0, dx, dx); + IMB_rectcpy(ibuf, env->cube[3], 0, dx, 0, 0, dx, dx); + IMB_rectcpy(ibuf, env->cube[4], dx, dx, 0, 0, dx, dx); + IMB_rectcpy(ibuf, env->cube[5], 2*dx, dx, 0, 0, dx, dx); + } + else if (env->type == ENV_PLANE) { + ibuf = IMB_allocImBuf(dx, dx, 24, IB_rectfloat, 0); + IMB_rectcpy(ibuf, env->cube[1], 0, 0, 0, 0, dx, dx); + } if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) ibuf->profile = IB_PROFILE_LINEAR_RGB; - IMB_rectcpy(ibuf, env->cube[0], 0, 0, 0, 0, dx, dx); - IMB_rectcpy(ibuf, env->cube[1], dx, 0, 0, 0, dx, dx); - IMB_rectcpy(ibuf, env->cube[2], 2*dx, 0, 0, 0, dx, dx); - IMB_rectcpy(ibuf, env->cube[3], 0, dx, 0, 0, dx, dx); - IMB_rectcpy(ibuf, env->cube[4], dx, dx, 0, 0, dx, dx); - IMB_rectcpy(ibuf, env->cube[5], 2*dx, dx, 0, 0, dx, dx); - - if (BKE_write_ibuf(scene, ibuf, str, imtype, scene->r.subimtype, scene->r.quality)) + if (BKE_write_ibuf(scene, ibuf, str, imtype, scene->r.subimtype, scene->r.quality)) { retval = OPERATOR_FINISHED; + } else { BKE_reportf(op->reports, RPT_ERROR, "Error saving environment map to %s.", str); retval = OPERATOR_CANCELLED; } + IMB_freeImBuf(ibuf); ibuf = NULL; - + return retval; } @@ -984,8 +1002,6 @@ static int envmap_save_poll(bContext *C) return 0; if (!tex->env || !tex->env->ok) return 0; - if (tex->env->type==ENV_PLANE) - return 0; if (tex->env->cube[1]==NULL) return 0; @@ -1060,7 +1076,8 @@ static int envmap_clear_all_exec(bContext *C, wmOperator *op) Tex *tex; for (tex=bmain->tex.first; tex; tex=tex->id.next) - BKE_free_envmapdata(tex->env); + if (tex->env) + BKE_free_envmapdata(tex->env); WM_event_add_notifier(C, NC_TEXTURE|NA_EDITED, tex); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 2c7d9f6ce0c..45a64af6dbd 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 2b55fc2ca6d..4223a401b0e 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -428,10 +428,9 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, int ltexid= glaGetOneInteger(GL_TEXTURE_2D); int lrowlength= glaGetOneInteger(GL_UNPACK_ROW_LENGTH); int subpart_x, subpart_y, tex_w, tex_h; + int seamless, offset_x, offset_y, nsubparts_x, nsubparts_y; int texid= get_cached_work_texture(&tex_w, &tex_h); - int nsubparts_x= (img_w+(tex_w-1))/tex_w; - int nsubparts_y= (img_h+(tex_h-1))/tex_h; - + /* Specify the color outside this function, and tex will modulate it. * This is useful for changing alpha without using glPixelTransferf() */ @@ -448,31 +447,67 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, glPixelZoom(1.f, 1.f); #endif + /* setup seamless 2=on, 0=off */ + seamless= ((tex_w<img_w || tex_h<img_h) && tex_w>2 && tex_h>2)? 2: 0; + + offset_x= tex_w - seamless; + offset_y= tex_h - seamless; + + nsubparts_x= (img_w + (offset_x - 1))/(offset_x); + nsubparts_y= (img_h + (offset_y - 1))/(offset_y); + for (subpart_y=0; subpart_y<nsubparts_y; subpart_y++) { for (subpart_x=0; subpart_x<nsubparts_x; subpart_x++) { - int subpart_w= (subpart_x==nsubparts_x-1)?(img_w-subpart_x*tex_w):tex_w; - int subpart_h= (subpart_y==nsubparts_y-1)?(img_h-subpart_y*tex_h):tex_h; - float rast_x= x+subpart_x*tex_w*xzoom; - float rast_y= y+subpart_y*tex_h*yzoom; + int remainder_x= img_w-subpart_x*offset_x; + int remainder_y= img_h-subpart_y*offset_y; + int subpart_w= (remainder_x<tex_w)? remainder_x: tex_w; + int subpart_h= (remainder_y<tex_h)? remainder_y: tex_h; + int offset_left= (seamless && subpart_x!=0)? 1: 0; + int offset_bot= (seamless && subpart_y!=0)? 1: 0; + int offset_right= (seamless && remainder_x>tex_w)? 1: 0; + int offset_top= (seamless && remainder_y>tex_h)? 1: 0; + float rast_x= x+subpart_x*offset_x*xzoom; + float rast_y= y+subpart_y*offset_y*yzoom; - if(format==GL_FLOAT) - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_FLOAT, &f_rect[(subpart_y*tex_w)*img_w*4 + (subpart_x*tex_w)*4]); - else - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[(subpart_y*tex_w)*img_w*4 + (subpart_x*tex_w)*4]); - + /* check if we already got these because we always get 2 more when doing seamless*/ + if(subpart_w<=seamless || subpart_h<=seamless) + continue; + + if(format==GL_FLOAT) { + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_FLOAT, &f_rect[subpart_y*offset_y*img_w*4 + subpart_x*offset_x*4]); + + /* add an extra border of pixels so linear looks ok at edges of full image. */ + if(subpart_w<tex_w) + glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, 0, 1, subpart_h, GL_RGBA, GL_FLOAT, &f_rect[subpart_y*offset_y*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]); + if(subpart_h<tex_h) + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, subpart_h, subpart_w, 1, GL_RGBA, GL_FLOAT, &f_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + subpart_x*offset_x*4]); + if(subpart_w<tex_w && subpart_h<tex_h) + glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, GL_RGBA, GL_FLOAT, &f_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]); + } + else { + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[subpart_y*offset_y*img_w*4 + subpart_x*offset_x*4]); + + if(subpart_w<tex_w) + glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, 0, 1, subpart_h, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[subpart_y*offset_y*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]); + if(subpart_h<tex_h) + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, subpart_h, subpart_w, 1, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + subpart_x*offset_x*4]); + if(subpart_w<tex_w && subpart_h<tex_h) + glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]); + } + glEnable(GL_TEXTURE_2D); glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(rast_x, rast_y); + glTexCoord2f((float)(0 + offset_left)/tex_w, (float)(0 + offset_bot)/tex_h); + glVertex2f(rast_x + (float)offset_left*xzoom, rast_y + (float)offset_bot*xzoom); - glTexCoord2f((float) (subpart_w-1)/tex_w, 0); - glVertex2f(rast_x+subpart_w*xzoom*scaleX, rast_y); + glTexCoord2f((float)(subpart_w - offset_right)/tex_w, (float)(0 + offset_bot)/tex_h); + glVertex2f(rast_x + (float)(subpart_w - offset_right)*xzoom*scaleX, rast_y + (float)offset_bot*xzoom); - glTexCoord2f((float) (subpart_w-1)/tex_w, (float) (subpart_h-1)/tex_h); - glVertex2f(rast_x+subpart_w*xzoom*scaleX, rast_y+subpart_h*yzoom*scaleY); + glTexCoord2f((float)(subpart_w - offset_right)/tex_w, (float)(subpart_h - offset_top)/tex_h); + glVertex2f(rast_x + (float)(subpart_w - offset_right)*xzoom*scaleX, rast_y + (float)(subpart_h - offset_top)*yzoom*scaleY); - glTexCoord2f(0, (float) (subpart_h-1)/tex_h); - glVertex2f(rast_x, rast_y+subpart_h*yzoom*scaleY); + glTexCoord2f((float)(0 + offset_left)/tex_w, (float)(subpart_h - offset_top)/tex_h); + glVertex2f(rast_x + (float)offset_left*xzoom, rast_y + (float)(subpart_h - offset_top)*yzoom*scaleY); glEnd(); glDisable(GL_TEXTURE_2D); } diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 6d61c8c5819..902570f8717 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 8dc06c4f3b8..6dbde4cf73c 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index 96b547eff21..5c104521a60 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 1c4631837df..11a7ac119a4 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -2401,16 +2401,15 @@ static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event) ScreenAnimData *sad= wt->customdata; ScrArea *sa; int sync; - + float time; + /* 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->flag & SCE_FRAME_DROP); - if((scene->audio.flag & AUDIO_SYNC) && !(sad->flag & ANIMPLAY_FLAG_REVERSE)) - { - scene->r.cfra = floor(sound_sync_scene(scene) * FPS); - } + if((scene->audio.flag & AUDIO_SYNC) && !(sad->flag & ANIMPLAY_FLAG_REVERSE) && finite(time = sound_sync_scene(scene))) + scene->r.cfra = floor(time * FPS); else { if(sync) { @@ -3021,7 +3020,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf) RNA_boolean_set(WM_keymap_add_item(keymap, "RENDER_OT_render", F12KEY, KM_PRESS, KM_CTRL, 0)->ptr, "animation", 1); WM_keymap_add_item(keymap, "RENDER_OT_view_cancel", ESCKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "RENDER_OT_view_show", F11KEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "SCREEN_OT_play_rendered_anim", F11KEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "RENDER_OT_play_rendered_anim", F11KEY, KM_PRESS, KM_CTRL, 0); /* user prefs */ #ifdef __APPLE__ diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index bcfb2fedb12..9fc858a191f 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -2871,6 +2871,7 @@ static void project_paint_begin(ProjPaintState *ps) if (ps->dm_mtface_clone==NULL || ps->dm_mtface_clone==ps->dm_mtface) { ps->do_layer_clone = 0; ps->dm_mtface_clone= NULL; + printf("ACK!\n"); } } @@ -3704,6 +3705,7 @@ static void *do_projectpaint_thread(void *ph_v) float mask = 1.0f; /* airbrush wont use mask */ unsigned short mask_short; float size_half = ((float)ps->brush->size) * 0.5f; + short lock_alpha= ELEM(ps->brush->blend, IMB_BLEND_ERASE_ALPHA, IMB_BLEND_ADD_ALPHA) ? 0 : ps->brush->flag & BRUSH_LOCK_ALPHA; LinkNode *smearPixels = NULL; LinkNode *smearPixels_f = NULL; @@ -3832,6 +3834,12 @@ static void *do_projectpaint_thread(void *ph_v) break; } } + + if(lock_alpha) { + if (is_floatbuf) projPixel->pixel.f_pt[3]= projPixel->origColor.f[3]; + else projPixel->pixel.ch_pt[3]= projPixel->origColor.ch[3]; + } + /* done painting */ } } @@ -4567,7 +4575,16 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps) { Scene *scene= CTX_data_scene(C); ToolSettings *settings= scene->toolsettings; - Brush *brush; + Brush *brush= paint_brush(&settings->imapaint.paint); + + /* brush */ + ps->brush = brush; + ps->tool = brush->imagepaint_tool; + ps->blend = brush->blend; + + ps->is_airbrush = (brush->flag & BRUSH_AIRBRUSH) ? 1 : 0; + ps->is_texbrush = (brush->mtex.tex) ? 1 : 0; + /* these can be NULL */ ps->v3d= CTX_wm_view3d(C); @@ -4607,16 +4624,6 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps) if(ps->normal_angle_range <= 0.0f) ps->do_mask_normal = 0; /* no need to do blending */ - - - /* brush */ - brush= paint_brush(&settings->imapaint.paint); - ps->brush = brush; - ps->tool = brush->imagepaint_tool; - ps->blend = brush->blend; - - ps->is_airbrush = (brush->flag & BRUSH_AIRBRUSH) ? 1 : 0; - ps->is_texbrush = (brush->mtex.tex) ? 1 : 0; } static int texture_paint_init(bContext *C, wmOperator *op) diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index 4bd030459e0..2b94ce01c6d 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index b20394ae938..d2c4e386fe7 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -193,12 +193,18 @@ static void projectf(bglMats *mats, const float v[3], float p[2]) int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d, Object *ob, rcti *rect) { + /* can't use ob->sculpt->tree, only valid during sculpt */ + DerivedMesh *dm= ob->derivedFinal; + PBVH *tree= (dm)? dm->getPBVH(ob, dm): NULL; float bb_min[3], bb_max[3], pmat[4][4]; int i, j, k; view3d_get_object_project_mat(rv3d, ob, pmat); - BLI_pbvh_redraw_BB(ob->sculpt->tree, bb_min, bb_max); + if(!tree) + return 0; + + BLI_pbvh_redraw_BB(tree, bb_min, bb_max); rect->xmin = rect->ymin = INT_MAX; rect->xmax = rect->ymax = INT_MIN; @@ -228,6 +234,8 @@ int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d, void sculpt_get_redraw_planes(float planes[4][4], ARegion *ar, RegionView3D *rv3d, Object *ob) { + DerivedMesh *dm= ob->derivedFinal; + PBVH *tree= (dm)? dm->getPBVH(ob, dm): NULL; BoundBox *bb = MEM_callocN(sizeof(BoundBox), "sculpt boundbox"); bglMats mats; rcti rect; @@ -256,7 +264,8 @@ void sculpt_get_redraw_planes(float planes[4][4], ARegion *ar, MEM_freeN(bb); /* clear redraw flag from nodes */ - BLI_pbvh_update(ob->sculpt->tree, PBVH_UpdateRedraw, NULL); + if(tree) + BLI_pbvh_update(tree, PBVH_UpdateRedraw, NULL); } /************************** Undo *************************/ diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h index 3ad7d3e24ff..ecbde7f4a21 100644 --- a/source/blender/editors/space_action/action_intern.h +++ b/source/blender/editors/space_action/action_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c index 429c1cc63cd..d570da2fd62 100644 --- a/source/blender/editors/space_action/action_ops.c +++ b/source/blender/editors/space_action/action_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 111e500c6f5..beca03b1625 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_api/space.c b/source/blender/editors/space_api/space.c index c61e5d93160..89436c37a0a 100644 --- a/source/blender/editors/space_api/space.c +++ b/source/blender/editors/space_api/space.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index a3fe29536a3..b81fd384a6a 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -1,5 +1,5 @@ /** - * $Id: spacetypes.c + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 572176a256a..c0195fa71fb 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h index 28d52fd55cc..f28d77159a5 100644 --- a/source/blender/editors/space_buttons/buttons_intern.h +++ b/source/blender/editors/space_buttons/buttons_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 7b59f6aafa9..3ef111144de 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index b828a1e664c..dff11c62b4d 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h index 48159f2607c..c74d39f25e3 100644 --- a/source/blender/editors/space_console/console_intern.h +++ b/source/blender/editors/space_console/console_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 6d55acf35ec..beabc033d7e 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index a2b4dcbac60..1359b5125fa 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -298,6 +298,9 @@ static int get_file_icon(struct direntry *file) if ( strcmp(file->relname, "..") == 0) { return ICON_FILE_PARENT; } + if(file->flags & BLENDERFILE) { + return ICON_FILE_BLEND; + } return ICON_FILE_FOLDER; } else if (file->flags & BLENDERFILE) @@ -515,7 +518,7 @@ void file_draw_list(const bContext *C, ARegion *ar) draw_dividers(layout, v2d); } - offset = ED_fileselect_layout_offset(layout, ar->v2d.cur.xmin, -ar->v2d.cur.ymax); + offset = ED_fileselect_layout_offset(layout, 0, ar->v2d.cur.xmin, -ar->v2d.cur.ymax); if (offset<0) offset=0; numfiles_layout = ED_fileselect_layout_numfiles(layout, ar); diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h index 8c6709e762c..a7aeaa1d365 100644 --- a/source/blender/editors/space_file/file_intern.h +++ b/source/blender/editors/space_file/file_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index ab259f1e1cb..1e9a7e1a706 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -69,7 +69,7 @@ /* ---------- FILE SELECTION ------------ */ -static int find_file_mouse(SpaceFile *sfile, struct ARegion* ar, int x, int y) +static int find_file_mouse(SpaceFile *sfile, struct ARegion* ar, int clamp_bounds, int x, int y) { float fx,fy; int active_file = -1; @@ -77,7 +77,7 @@ static int find_file_mouse(SpaceFile *sfile, struct ARegion* ar, int x, int y) UI_view2d_region_to_view(v2d, x, y, &fx, &fy); - active_file = ED_fileselect_layout_offset(sfile->layout, v2d->tot.xmin + fx, v2d->tot.ymax - fy); + active_file = ED_fileselect_layout_offset(sfile->layout, clamp_bounds, v2d->tot.xmin + fx, v2d->tot.ymax - fy); return active_file; } @@ -138,10 +138,10 @@ static FileSelect file_select(bContext* C, const rcti* rect, short selecting, sh // FileLayout *layout = ED_fileselect_get_layout(sfile, ar); int numfiles = filelist_numfiles(sfile->files); - + params->selstate = NOTACTIVE; - first_file = find_file_mouse(sfile, ar, rect->xmin, rect->ymax); - last_file = find_file_mouse(sfile, ar, rect->xmax, rect->ymin); + first_file = find_file_mouse(sfile, ar, 1, rect->xmin, rect->ymax); + last_file = find_file_mouse(sfile, ar, 1, rect->xmax, rect->ymin); clamp_to_filelist(numfiles, &first_file, &last_file); @@ -206,10 +206,9 @@ static FileSelect file_select(bContext* C, const rcti* rect, short selecting, sh static int file_border_select_exec(bContext *C, wmOperator *op) { ARegion *ar= CTX_wm_region(C); - SpaceFile *sfile= CTX_wm_space_file(C); short selecting; rcti rect; - + selecting= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT); rect.xmin= RNA_int_get(op->ptr, "xmin"); rect.ymin= RNA_int_get(op->ptr, "ymin"); @@ -452,7 +451,7 @@ int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my) my -= ar->winrct.ymin; if(BLI_in_rcti(&ar->v2d.mask, mx, my)) { - actfile = find_file_mouse(sfile, ar, mx , my); + actfile = find_file_mouse(sfile, ar, 0, mx , my); if((actfile >= 0) && (actfile < numfiles)) params->active_file=actfile; @@ -662,8 +661,6 @@ void FILE_OT_parent(struct wmOperatorType *ot) int file_refresh_exec(bContext *C, wmOperator *unused) { - SpaceFile *sfile= CTX_wm_space_file(C); - file_change_dir(C, 1); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index b90bb47e6ce..226cd50669a 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -135,7 +135,8 @@ typedef struct FileList struct BlendHandle *libfiledata; short hide_parent; - void (*read)(struct FileList *); + void (*readf)(struct FileList *); + int (*filterf)(struct FileList *, struct direntry* file, unsigned int filter, short hide_dot); } FileList; @@ -292,63 +293,91 @@ static int compare_extension(const void *a1, const void *a2) { return (BLI_strcasecmp(sufix1, sufix2)); } +static int is_hidden_file(const char* filename, short hide_dot) +{ + int is_hidden=0; + + if (hide_dot) { + if(filename[0]=='.' && filename[1]!='.' && filename[1]!=0) { + is_hidden=1; /* ignore .file */ + } else if (((filename[0] == '.') && (filename[1] == 0) )) { + is_hidden=1; /* ignore . */ + } else { + int len=strlen(filename); + if( (len>0) && (filename[len-1]=='~') ) { + is_hidden=1; /* ignore file~ */ + } + } + } else { + if (((filename[0] == '.') && (filename[1] == 0) )) { + is_hidden=1; /* ignore . */ + } + } + return is_hidden; +} + +static int is_filtered_file(struct direntry* file, const char* dir, unsigned int filter, short hide_dot) +{ + int is_filtered=0; + if (filter) { + if (file->flags & filter) { + is_filtered=1; + } else if (file->type & S_IFDIR) { + if (filter & FOLDERFILE) { + is_filtered = 1; + } + } + } else { + is_filtered = 1; + } + return is_filtered && !is_hidden_file(file->relname, hide_dot); +} + +static int is_filtered_lib(struct direntry* file, const char* dir, unsigned int filter, short hide_dot) +{ + int is_filtered=0; + char tdir[FILE_MAX], tgroup[GROUP_MAX]; + if (BLO_is_a_library(dir, tdir, tgroup)) { + is_filtered = !is_hidden_file(file->relname, hide_dot); + } else { + is_filtered = is_filtered_file(file, dir, filter, hide_dot); + } + return is_filtered; +} + +static int is_filtered_main(struct direntry* file, const char* dir, unsigned int filter, short hide_dot) +{ + return !is_hidden_file(file->relname, hide_dot); +} + void filelist_filter(FileList* filelist) { - /* char dir[FILE_MAX], group[GROUP_MAX]; XXXXX */ int num_filtered = 0; int i, j; if (!filelist->filelist) return; - - /* XXXXX TODO: check if the filter can be handled outside the filelist - if ( ( (filelist->type == FILE_LOADLIB) && BIF_filelist_islibrary(filelist, dir, group)) - || (filelist->type == FILE_MAIN) ) { - filelist->filter = 0; - } - */ - - if (!filelist->filter) { - if (filelist->fidx) { - MEM_freeN(filelist->fidx); - filelist->fidx = NULL; - } - filelist->fidx = (int *)MEM_callocN(filelist->numfiles*sizeof(int), "filteridx"); - for (i = 0; i < filelist->numfiles; ++i) { - filelist->fidx[i] = i; - } - filelist->numfiltered = filelist->numfiles; - return; - } // How many files are left after filter ? for (i = 0; i < filelist->numfiles; ++i) { - if (filelist->filelist[i].flags & filelist->filter) { + struct direntry *file = &filelist->filelist[i]; + if ( filelist->filterf(file, filelist->dir, filelist->filter, filelist->hide_dot) ) { num_filtered++; } - else if (filelist->filelist[i].type & S_IFDIR) { - if (filelist->filter & FOLDERFILE) { - num_filtered++; - } - } } if (filelist->fidx) { - MEM_freeN(filelist->fidx); - filelist->fidx = NULL; + MEM_freeN(filelist->fidx); + filelist->fidx = NULL; } filelist->fidx = (int *)MEM_callocN(num_filtered*sizeof(int), "filteridx"); filelist->numfiltered = num_filtered; for (i = 0, j=0; i < filelist->numfiles; ++i) { - if (filelist->filelist[i].flags & filelist->filter) { + struct direntry *file = &filelist->filelist[i]; + if ( filelist->filterf(file, filelist->dir, filelist->filter, filelist->hide_dot) ) { filelist->fidx[j++] = i; } - else if (filelist->filelist[i].type & S_IFDIR) { - if (filelist->filter & FOLDERFILE) { - filelist->fidx[j++] = i; - } - } } } @@ -491,13 +520,16 @@ struct FileList* filelist_new(short type) FileList* p = MEM_callocN( sizeof(FileList), "filelist" ); switch(type) { case FILE_MAIN: - p->read = filelist_read_main; + p->readf = filelist_read_main; + p->filterf = is_filtered_main; break; case FILE_LOADLIB: - p->read = filelist_read_library; + p->readf = filelist_read_library; + p->filterf = is_filtered_lib; break; default: - p->read = filelist_read_dir; + p->readf = filelist_read_dir; + p->filterf = is_filtered_file; } return p; @@ -627,13 +659,13 @@ struct ImBuf * filelist_geticon(struct FileList* filelist, int index) fidx = filelist->fidx[index]; file = &filelist->filelist[fidx]; if (file->type & S_IFDIR) { - if ( strcmp(filelist->filelist[fidx].relname, "..") == 0) { - ibuf = gSpecialFileImages[SPECIAL_IMG_PARENT]; - } else if ( strcmp(filelist->filelist[fidx].relname, ".") == 0) { - ibuf = gSpecialFileImages[SPECIAL_IMG_REFRESH]; - } else { - ibuf = gSpecialFileImages[SPECIAL_IMG_FOLDER]; - } + if ( strcmp(filelist->filelist[fidx].relname, "..") == 0) { + ibuf = gSpecialFileImages[SPECIAL_IMG_PARENT]; + } else if ( strcmp(filelist->filelist[fidx].relname, ".") == 0) { + ibuf = gSpecialFileImages[SPECIAL_IMG_REFRESH]; + } else { + ibuf = gSpecialFileImages[SPECIAL_IMG_FOLDER]; + } } else { ibuf = gSpecialFileImages[SPECIAL_IMG_UNKNOWNFILE]; } @@ -716,7 +748,6 @@ static void filelist_read_dir(struct FileList* filelist) BLI_getwdN(wdir); BLI_cleanup_dir(G.sce, filelist->dir); - BLI_hide_dot_files(filelist->hide_dot); filelist->numfiles = BLI_getdir(filelist->dir, &(filelist->filelist)); if(!chdir(wdir)) /* fix warning about not checking return value */; @@ -761,7 +792,7 @@ static void filelist_read_library(struct FileList* filelist) void filelist_readdir(struct FileList* filelist) { - filelist->read(filelist); + filelist->readf(filelist); } int filelist_empty(struct FileList* filelist) @@ -788,8 +819,12 @@ void filelist_setfiletypes(struct FileList* filelist, short has_quicktime) file->type= file->s.st_mode; /* restore the mess below */ /* Don't check extensions for directories */ - if (file->type & S_IFDIR) + if (file->type & S_IFDIR) { + if(BLO_has_bfile_extension(file->relname)) { + file->flags |= BLENDERFILE; + } continue; + } if(BLO_has_bfile_extension(file->relname)) { file->flags |= BLENDERFILE; diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 868e28207c5..cce821f3f21 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -55,6 +55,8 @@ #include "BLI_storage_types.h" #include "BLI_dynstr.h" +#include "BLO_readfile.h" + #include "BKE_context.h" #include "BKE_screen.h" #include "BKE_global.h" @@ -192,7 +194,6 @@ short ED_fileselect_set_params(SpaceFile *sfile) params->filter = 0; params->sort = FILE_SORT_ALPHA; } - return 1; } @@ -218,7 +219,7 @@ int ED_fileselect_layout_numfiles(FileLayout* layout, struct ARegion *ar) } } -int ED_fileselect_layout_offset(FileLayout* layout, int x, int y) +int ED_fileselect_layout_offset(FileLayout* layout, int clamp_bounds, int x, int y) { int offsetx, offsety; int active_file; @@ -229,9 +230,14 @@ int ED_fileselect_layout_offset(FileLayout* layout, int x, int y) offsetx = (x)/(layout->tile_w + 2*layout->tile_border_x); offsety = (y)/(layout->tile_h + 2*layout->tile_border_y); - if (offsetx > layout->columns-1) return -1 ; - if (offsety > layout->rows-1) return -1 ; - + if (clamp_bounds) { + CLAMP(offsetx, 0, layout->columns-1); + CLAMP(offsety, 0, layout->rows-1); + } else { + if (offsetx > layout->columns-1) return -1 ; + if (offsety > layout->rows-1) return -1 ; + } + if (layout->flag & FILE_LAYOUT_HOR) active_file = layout->rows*offsetx + offsety; else @@ -404,7 +410,7 @@ void file_change_dir(bContext *C, int checkdir) /* could return but just refresh the current dir */ } filelist_setdir(sfile->files, sfile->params->dir); - + if(folderlist_clear_next(sfile)) folderlist_free(sfile->folders_next); diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 105ece8e95f..de3b016988d 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -140,8 +140,6 @@ static void file_free(SpaceLink *sl) } if (sfile->params) { - if(sfile->params->pupmenu) - MEM_freeN(sfile->params->pupmenu); MEM_freeN(sfile->params); sfile->params= NULL; } @@ -208,6 +206,8 @@ static void file_refresh(const bContext *C, ScrArea *sa) filelist_readdir(sfile->files); thumbnails_start(sfile->files, C); BLI_strncpy(params->dir, filelist_dir(sfile->files), FILE_MAX); + } else { + filelist_filter(sfile->files); } if(params->sort!=FILE_SORT_NONE) filelist_sort(sfile->files, params->sort); @@ -227,7 +227,7 @@ static void file_refresh(const bContext *C, ScrArea *sa) static void file_listener(ScrArea *sa, wmNotifier *wmn) { - SpaceFile* sfile = (SpaceFile*)sa->spacedata.first; + /* SpaceFile* sfile = (SpaceFile*)sa->spacedata.first; */ /* context changes */ switch(wmn->category) { diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 3975c88fe5c..c2cf3233f67 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -610,8 +610,13 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa) row= uiLayoutRow(pa->layout, 0); block= uiLayoutGetBlock(row); - // XXX for now, this will be a operator button which calls a temporary 'add modifier' operator + // XXX for now, this will be a operator button which calls a 'add modifier' operator uiDefButO(block, BUT, "GRAPH_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, "Add Modifier", 10, 0, 150, 20, "Adds a new F-Curve Modifier for the active F-Curve"); + + /* copy/paste (as sub-row)*/ + row= uiLayoutRow(row, 1); + uiItemO(row, "", ICON_COPYDOWN, "GRAPH_OT_fmodifier_copy"); + uiItemO(row, "", ICON_PASTEDOWN, "GRAPH_OT_fmodifier_paste"); } /* draw each modifier */ diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 19288bae2a2..8315ee740cd 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -357,7 +357,6 @@ static int draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu) * note: draw_fcurve_handles_check must be checked before running this. */ static void draw_fcurve_handles (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu) { - extern unsigned int nurbcol[]; int sel, b; /* a single call to GL_LINES here around these calls should be sufficient to still @@ -371,8 +370,9 @@ static void draw_fcurve_handles (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, */ for (sel= 0; sel < 2; sel++) { BezTriple *bezt=fcu->bezt, *prevbezt=NULL; - unsigned int *col= (sel)? (nurbcol+4) : (nurbcol); + int basecol= (sel)? TH_HANDLE_SEL_FREE : TH_HANDLE_FREE; float *fp; + char col[4]; /* if only selected keyframes have handles shown, skip the first round */ if ((sel == 0) && (sipo->flag & SIPO_SELVHANDLESONLY)) @@ -390,19 +390,24 @@ static void draw_fcurve_handles (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, /* draw handle with appropriate set of colors if selection is ok */ if ((bezt->f2 & SELECT)==sel) { fp= bezt->vec[0]; - + /* only draw first handle if previous segment had handles */ if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) { - cpackA(col[(unsigned char)bezt->h1], drawFCurveFade(fcu)); + UI_GetThemeColor3ubv(basecol + bezt->h1, col); + col[3]= drawFCurveFade(fcu) * 255; + glColor4ubv((GLubyte *)col); glVertex2fv(fp); glVertex2fv(fp+3); } - + /* only draw second handle if this segment is bezier */ if (bezt->ipo == BEZT_IPO_BEZ) { - cpackA(col[(unsigned char)bezt->h2], drawFCurveFade(fcu)); + UI_GetThemeColor3ubv(basecol + bezt->h2, col); + col[3]= drawFCurveFade(fcu) * 255; + glColor4ubv((GLubyte *)col); + glVertex2fv(fp+3); glVertex2fv(fp+6); } } @@ -412,8 +417,10 @@ static void draw_fcurve_handles (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) ) { fp= bezt->vec[0]; - cpackA(col[(unsigned char)bezt->h1], drawFCurveFade(fcu)); - + UI_GetThemeColor3ubv(basecol + bezt->h1, col); + col[3]= drawFCurveFade(fcu) * 255; + glColor4ubv((GLubyte *)col); + glVertex2fv(fp); glVertex2fv(fp+3); } @@ -422,8 +429,10 @@ static void draw_fcurve_handles (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, (bezt->ipo == BEZT_IPO_BEZ) ) { fp= bezt->vec[1]; - cpackA(col[(unsigned char)bezt->h2], drawFCurveFade(fcu)); - + UI_GetThemeColor3ubv(basecol + bezt->h2, col); + col[3]= drawFCurveFade(fcu) * 255; + glColor4ubv((GLubyte *)col); + glVertex2fv(fp); glVertex2fv(fp+3); } } diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 485c9ab8bf4..d23bafbc001 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1971,7 +1971,7 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op) filter |= (ANIMFILTER_SEL|ANIMFILTER_CURVEVISIBLE); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); - /* smooth keyframes */ + /* add f-modifier to each curve */ for (ale= anim_data.first; ale; ale= ale->next) { FCurve *fcu= (FCurve *)ale->data; FModifier *fcm; @@ -2017,4 +2017,119 @@ void GRAPH_OT_fmodifier_add (wmOperatorType *ot) RNA_def_boolean(ot->srna, "only_active", 1, "Only Active", "Only add F-Modifier to active F-Curve."); } +/* ******************** Copy F-Modifiers Operator *********************** */ + +static int graph_fmodifier_copy_exec(bContext *C, wmOperator *op) +{ + bAnimContext ac; + bAnimListElem *ale; + short ok = 0; + + /* get editor data */ + if (ANIM_animdata_get_context(C, &ac) == 0) + return OPERATOR_CANCELLED; + + /* clear buffer first */ + free_fmodifiers_copybuf(); + + /* get the active F-Curve */ + ale= get_active_fcurve_channel(&ac); + + /* if this exists, call the copy F-Modifiers API function */ + if (ale && ale->data) { + FCurve *fcu= (FCurve *)ale->data; + + // TODO: when 'active' vs 'all' boolean is added, change last param! + ok= ANIM_fmodifiers_copy_to_buf(&fcu->modifiers, 0); + + /* free temp data now */ + MEM_freeN(ale); + } + + /* successful or not? */ + if (ok == 0) { + BKE_report(op->reports, RPT_ERROR, "No F-Modifiers available to be copied"); + return OPERATOR_CANCELLED; + } + else + return OPERATOR_FINISHED; +} + +void GRAPH_OT_fmodifier_copy (wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Copy F-Modifiers"; + ot->idname= "GRAPH_OT_fmodifier_copy"; + ot->description= "Copy the F-Modifier(s) of the active F-Curve."; + + /* api callbacks */ + ot->exec= graph_fmodifier_copy_exec; + ot->poll= graphop_active_fcurve_poll; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + /* id-props */ + //ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All F-Modifiers", "Copy all the F-Modifiers, instead of just the active one"); +} + +/* ******************** Paste F-Modifiers Operator *********************** */ + +static int graph_fmodifier_paste_exec(bContext *C, wmOperator *op) +{ + bAnimContext ac; + ListBase anim_data = {NULL, NULL}; + bAnimListElem *ale; + int filter, ok=0; + + /* get editor data */ + if (ANIM_animdata_get_context(C, &ac) == 0) + return OPERATOR_CANCELLED; + + /* filter data */ + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + + /* paste modifiers */ + for (ale = anim_data.first; ale; ale = ale->next) { + FCurve *fcu= (FCurve *)ale->data; + + // TODO: do we want to replace existing modifiers? add user pref for that! + ok += ANIM_fmodifiers_paste_from_buf(&fcu->modifiers, 0); + } + + /* clean up */ + BLI_freelistN(&anim_data); + + /* successful or not? */ + if (ok) { + /* validate keyframes after editing */ + ANIM_editkeyframes_refresh(&ac); + + /* set notifier that keyframes have changed */ + WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); + + return OPERATOR_FINISHED; + } + else { + BKE_report(op->reports, RPT_ERROR, "No F-Modifiers to paste"); + return OPERATOR_CANCELLED; + } +} + +void GRAPH_OT_fmodifier_paste (wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Paste F-Modifiers"; + ot->idname= "GRAPH_OT_fmodifier_paste"; + ot->description= "Add copied F-Modifiers to the selected F-Curves"; + + /* api callbacks */ + ot->exec= graph_fmodifier_paste_exec; + ot->poll= graphop_editable_keyframes_poll; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + /* ************************************************************************** */ diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h index 696d31e22e1..a875558d6ef 100644 --- a/source/blender/editors/space_graph/graph_intern.h +++ b/source/blender/editors/space_graph/graph_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -139,6 +139,8 @@ enum { /* ----------- */ void GRAPH_OT_fmodifier_add(struct wmOperatorType *ot); +void GRAPH_OT_fmodifier_copy(struct wmOperatorType *ot); +void GRAPH_OT_fmodifier_paste(struct wmOperatorType *ot); /* ----------- */ diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 7c1ac14027a..e56a758f2b0 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -262,8 +262,9 @@ void graphedit_operatortypes(void) WM_operatortype_append(GRAPH_OT_click_insert); /* F-Curve Modifiers */ - // XXX temporary? WM_operatortype_append(GRAPH_OT_fmodifier_add); + WM_operatortype_append(GRAPH_OT_fmodifier_copy); + WM_operatortype_append(GRAPH_OT_fmodifier_paste); } /* ************************** registration - keymaps **********************************/ diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c index 3d1f0b49826..b0280e682cc 100644 --- a/source/blender/editors/space_graph/graph_utils.c +++ b/source/blender/editors/space_graph/graph_utils.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -141,6 +141,8 @@ short fcurve_needs_draw_fmodifier_controls (FCurve *fcu, FModifier *fcm) /* clearly harmless */ case FMODIFIER_TYPE_CYCLES: return 0; + case FMODIFIER_TYPE_STEPPED: + return 0; /* borderline... */ case FMODIFIER_TYPE_NOISE: diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 31197f49002..7d34a91d6fa 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index cb942472b9e..797bb20ddf9 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -653,7 +653,7 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene) draw_image_paint_helpers(sima, ar, scene, zoomx, zoomy); /* render info */ - if(ibuf && ima && show_render) + if(ima && show_render) draw_render_info(ima, ar); /* XXX integrate this code */ diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h index f5d84d7487f..09bd9edc86d 100644 --- a/source/blender/editors/space_image/image_intern.h +++ b/source/blender/editors/space_image/image_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index ed75b6dcef0..3aa766c32d0 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1182,6 +1182,9 @@ static int new_exec(bContext *C, wmOperator *op) uvtestgrid= RNA_boolean_get(op->ptr, "uv_test_grid"); RNA_float_get_array(op->ptr, "color", color); color[3]= RNA_float_get(op->ptr, "alpha"); + + if (!floatbuf && scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) + linearrgb_to_srgb_v3_v3(color, color); ima = BKE_add_image_size(width, height, name, floatbuf, uvtestgrid, color); @@ -1518,7 +1521,7 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event) info->colf[0]= fp[0]; info->colf[1]= fp[1]; info->colf[2]= fp[2]; - info->colf[3]= fp[4]; + info->colf[3]= fp[3]; info->colfp= info->colf; } diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index e0ff29986ac..6cb369a72f2 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -560,6 +560,9 @@ static void image_refresh(const bContext *C, ScrArea *sa) ima= ED_space_image(sima); + if(sima->iuser.flag & IMA_ANIM_ALWAYS) + BKE_image_user_calc_frame(&sima->iuser, CTX_data_scene(C)->r.cfra, 0); + /* check if we have to set the image from the editmesh */ if(ima && (ima->source==IMA_SRC_VIEWER || sima->pin)); else if(obedit && obedit->type == OB_MESH) { @@ -593,13 +596,14 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn) switch(wmn->category) { case NC_SCENE: switch(wmn->data) { + case ND_FRAME: case ND_MODE: case ND_RENDER_RESULT: case ND_COMPO_RESULT: if (ED_space_image_show_render(sima)) image_histogram_tag_refresh(sa); ED_area_tag_refresh(sa); - ED_area_tag_redraw(sa); + ED_area_tag_redraw(sa); break; } break; diff --git a/source/blender/editors/space_info/info_intern.h b/source/blender/editors/space_info/info_intern.h index 939d984a0d8..128c0dace20 100644 --- a/source/blender/editors/space_info/info_intern.h +++ b/source/blender/editors/space_info/info_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_logic/logic_intern.h b/source/blender/editors/space_logic/logic_intern.h index 6a4888c3bf1..4d19a16ee9c 100644 --- a/source/blender/editors/space_logic/logic_intern.h +++ b/source/blender/editors/space_logic/logic_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index ab37cad2bd8..8c5ccdd9a5d 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 4f944d1b855..957529942c0 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -379,7 +379,7 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa) { PointerRNA strip_ptr; uiLayout *layout= pa->layout; - uiLayout *column, *subcolumn; + uiLayout *column, *subcolumn, *subrow; uiBlock *block; /* check context and also validity of pointer */ @@ -398,10 +398,13 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa) column= uiLayoutColumn(layout, 1); - uiItemR(column, NULL, 0, &strip_ptr, "animated_time", 0); - + subrow= uiLayoutRow(column, 0); + uiItemR(subrow, NULL, 0, &strip_ptr, "animated_time", 0); + uiItemR(subrow, NULL, 0, &strip_ptr, "animated_time_cyclic", 0); + subcolumn= uiLayoutColumn(column, 1); - uiLayoutSetEnabled(subcolumn, RNA_boolean_get(&strip_ptr, "animated_time")); + subrow= uiLayoutRow(subcolumn, 0); + uiLayoutSetEnabled(subrow, RNA_boolean_get(&strip_ptr, "animated_time")); uiItemR(subcolumn, NULL, 0, &strip_ptr, "strip_time", 0); } @@ -430,6 +433,11 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa) // XXX for now, this will be a operator button which calls a temporary 'add modifier' operator // FIXME: we need to set the only-active property so that this will only add modifiers for the active strip (not all selected) uiDefButO(block, BUT, "NLA_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, "Add Modifier", 10, 0, 150, 20, "Adds a new F-Modifier for the active NLA Strip"); + + /* copy/paste (as sub-row)*/ + row= uiLayoutRow(row, 1); + uiItemO(row, "", ICON_COPYDOWN, "NLA_OT_fmodifier_copy"); + uiItemO(row, "", ICON_PASTEDOWN, "NLA_OT_fmodifier_paste"); } /* draw each modifier */ diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index 9708e12e738..1bc07811bf8 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 3a9d668e7f8..5b9b5331223 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 543fa1dfed7..a26d6b84e08 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -1633,8 +1633,7 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op) BLI_freelistN(&anim_data); /* set notifier that things have changed */ - // FIXME: this doesn't really do it justice... - WM_event_add_notifier(C, NC_ANIMATION, NULL); + WM_event_add_notifier(C, NC_ANIMATION|ND_NLA_EDIT, NULL); /* done */ return OPERATOR_FINISHED; @@ -1659,4 +1658,125 @@ void NLA_OT_fmodifier_add (wmOperatorType *ot) RNA_def_boolean(ot->srna, "only_active", 0, "Only Active", "Only add F-Modifier of the specified type to the active strip."); } +/* ******************** Copy F-Modifiers Operator *********************** */ + +static int nla_fmodifier_copy_exec(bContext *C, wmOperator *op) +{ + bAnimContext ac; + ListBase anim_data = {NULL, NULL}; + bAnimListElem *ale; + int filter, ok=0; + + /* get editor data */ + if (ANIM_animdata_get_context(C, &ac) == 0) + return OPERATOR_CANCELLED; + + /* clear buffer first */ + free_fmodifiers_copybuf(); + + /* get a list of the editable tracks being shown in the NLA */ + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_NLATRACKS | ANIMFILTER_FOREDIT); + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + + /* for each NLA-Track, add the specified modifier to all selected strips */ + for (ale= anim_data.first; ale; ale= ale->next) { + NlaTrack *nlt= (NlaTrack *)ale->data; + NlaStrip *strip; + + for (strip= nlt->strips.first; strip; strip=strip->next) { + /* only add F-Modifier if on active strip? */ + if ((strip->flag & NLASTRIP_FLAG_ACTIVE)==0) + continue; + + // TODO: when 'active' vs 'all' boolean is added, change last param! + ok += ANIM_fmodifiers_copy_to_buf(&strip->modifiers, 0); + } + } + + /* successful or not? */ + if (ok == 0) { + BKE_report(op->reports, RPT_ERROR, "No F-Modifiers available to be copied"); + return OPERATOR_CANCELLED; + } + else + return OPERATOR_FINISHED; +} + +void NLA_OT_fmodifier_copy (wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Copy F-Modifiers"; + ot->idname= "NLA_OT_fmodifier_copy"; + ot->description= "Copy the F-Modifier(s) of the active NLA-Strip."; + + /* api callbacks */ + ot->exec= nla_fmodifier_copy_exec; + ot->poll= nlaop_poll_tweakmode_off; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + /* id-props */ + //ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All F-Modifiers", "Copy all the F-Modifiers, instead of just the active one"); +} + +/* ******************** Paste F-Modifiers Operator *********************** */ + +static int nla_fmodifier_paste_exec(bContext *C, wmOperator *op) +{ + bAnimContext ac; + ListBase anim_data = {NULL, NULL}; + bAnimListElem *ale; + int filter, ok=0; + + /* 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_NLATRACKS | ANIMFILTER_SEL | ANIMFILTER_FOREDIT); + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + + /* for each NLA-Track, add the specified modifier to all selected strips */ + for (ale= anim_data.first; ale; ale= ale->next) { + NlaTrack *nlt= (NlaTrack *)ale->data; + NlaStrip *strip; + + for (strip= nlt->strips.first; strip; strip=strip->next) { + // TODO: do we want to replace existing modifiers? add user pref for that! + ok += ANIM_fmodifiers_paste_from_buf(&strip->modifiers, 0); + } + } + + /* clean up */ + BLI_freelistN(&anim_data); + + /* successful or not? */ + if (ok) { + /* set notifier that things have changed */ + /* set notifier that things have changed */ + WM_event_add_notifier(C, NC_ANIMATION|ND_NLA_EDIT, NULL); + return OPERATOR_FINISHED; + } + else { + BKE_report(op->reports, RPT_ERROR, "No F-Modifiers to paste"); + return OPERATOR_CANCELLED; + } +} + +void NLA_OT_fmodifier_paste (wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Paste F-Modifiers"; + ot->idname= "NLA_OT_fmodifier_paste"; + ot->description= "Add copied F-Modifiers to the selected NLA-Strips"; + + /* api callbacks */ + ot->exec= nla_fmodifier_paste_exec; + ot->poll= nlaop_poll_tweakmode_off; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + /* *********************************************** */ diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h index 1af2d2a1635..7570969158b 100644 --- a/source/blender/editors/space_nla/nla_intern.h +++ b/source/blender/editors/space_nla/nla_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -111,6 +111,8 @@ void NLA_OT_clear_scale(wmOperatorType *ot); void NLA_OT_snap(wmOperatorType *ot); void NLA_OT_fmodifier_add(wmOperatorType *ot); +void NLA_OT_fmodifier_copy(wmOperatorType *ot); +void NLA_OT_fmodifier_paste(wmOperatorType *ot); /* **************************************** */ diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c index 10ff10f46fd..0880c71059e 100644 --- a/source/blender/editors/space_nla/nla_ops.c +++ b/source/blender/editors/space_nla/nla_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -165,6 +165,8 @@ void nla_operatortypes(void) WM_operatortype_append(NLA_OT_snap); WM_operatortype_append(NLA_OT_fmodifier_add); + WM_operatortype_append(NLA_OT_fmodifier_copy); + WM_operatortype_append(NLA_OT_fmodifier_paste); } /* ************************** registration - keymaps **********************************/ diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index 7729573070d..deb7fd5cd79 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index 6ea843a00de..4b3dc72a089 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index a110e7a5c4b..88cb9f6e81a 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -803,10 +803,26 @@ static void node_composit_buts_color_spill(uiLayout *layout, bContext *C, Pointe { uiLayout *row, *col; - col =uiLayoutColumn(layout, 0); - uiItemR(col, NULL, 0, ptr, "factor", 0); - row= uiLayoutRow(col, 0); + uiItemL(layout, "Despill Channel:", 0); + row =uiLayoutRow(layout,0); uiItemR(row, NULL, 0, ptr, "channel", UI_ITEM_R_EXPAND); + + col= uiLayoutColumn(layout, 0); + uiItemR(col, NULL, 0, ptr, "algorithm", 0); + + if(RNA_enum_get(ptr, "algorithm")==0) { + uiItemL(col, "Limiting Channel:", 0); + row=uiLayoutRow(col,0); + uiItemR(row, NULL, 0, ptr, "limit_channel", UI_ITEM_R_EXPAND); + } + + uiItemR(col, NULL, 0, ptr, "ratio", UI_ITEM_R_SLIDER); + uiItemR(col, NULL, 0, ptr, "unspill", 0); + if (RNA_enum_get(ptr, "unspill")== 1) { + uiItemR(col, NULL, 0, ptr, "unspill_red", UI_ITEM_R_SLIDER); + uiItemR(col, NULL, 0, ptr, "unspill_green", UI_ITEM_R_SLIDER); + uiItemR(col, NULL, 0, ptr, "unspill_blue", UI_ITEM_R_SLIDER); + } } static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) @@ -837,13 +853,24 @@ static void node_composit_buts_channel_matte(uiLayout *layout, bContext *C, Poin { uiLayout *col, *row; + uiItemL(layout, "Color Space:", 0); row= uiLayoutRow(layout, 0); uiItemR(row, NULL, 0, ptr, "color_space", UI_ITEM_R_EXPAND); - row= uiLayoutRow(layout, 0); + col=uiLayoutColumn(layout, 0); + uiItemL(col, "Key Channel:", 0); + row= uiLayoutRow(col, 0); uiItemR(row, NULL, 0, ptr, "channel", UI_ITEM_R_EXPAND); - col =uiLayoutColumn(layout, 1); + col =uiLayoutColumn(layout, 0); + + uiItemR(col, NULL, 0, ptr, "algorithm", 0); + if(RNA_enum_get(ptr, "algorithm")==0) { + uiItemL(col, "Limiting Channel:", 0); + row=uiLayoutRow(col,0); + uiItemR(row, NULL, 0, ptr, "limit_channel", UI_ITEM_R_EXPAND); + } + uiItemR(col, NULL, 0, ptr, "high", UI_ITEM_R_SLIDER); uiItemR(col, NULL, 0, ptr, "low", UI_ITEM_R_SLIDER); } @@ -894,6 +921,11 @@ static void node_composit_buts_scale(uiLayout *layout, bContext *C, PointerRNA * uiItemR(layout, "", 0, ptr, "space", 0); } +static void node_composit_buts_rotate(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + uiItemR(layout, "", 0, ptr, "filter", 0); +} + static void node_composit_buts_invert(uiLayout *layout, bContext *C, PointerRNA *ptr) { uiLayout *col; @@ -1071,6 +1103,9 @@ static void node_composit_set_butfunc(bNodeType *ntype) case CMP_NODE_SCALE: ntype->uifunc= node_composit_buts_scale; break; + case CMP_NODE_ROTATE: + ntype->uifunc=node_composit_buts_rotate; + break; case CMP_NODE_CHANNEL_MATTE: ntype->uifunc= node_composit_buts_channel_matte; break; diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index cbd3ad73024..317bce16f07 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 5928e5cf20e..3f53b80bd22 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -121,6 +121,41 @@ void ED_node_changed_update(ID *id, bNode *node) } } +static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup) +{ + bNode *node; + + if(ntree == lookup) + return 1; + + for(node=ntree->nodes.first; node; node=node->next) + if(node->type == NODE_GROUP && node->id) + if(has_nodetree((bNodeTree*)node->id, lookup)) + return 1; + + return 0; +} + +void ED_node_generic_update(Main *bmain, Scene *scene, bNodeTree *ntree, bNode *node) +{ + Material *ma; + Tex *tex; + Scene *sce; + + /* look through all datablocks, to support groups */ + for(ma=bmain->mat.first; ma; ma=ma->id.next) + if(ma->nodetree && ma->use_nodes && has_nodetree(ma->nodetree, ntree)) + ED_node_changed_update(&ma->id, node); + + for(tex=bmain->tex.first; tex; tex=tex->id.next) + if(tex->nodetree && tex->use_nodes && has_nodetree(tex->nodetree, ntree)) + ED_node_changed_update(&tex->id, node); + + for(sce=bmain->scene.first; sce; sce=sce->id.next) + if(sce->nodetree && sce->use_nodes && has_nodetree(sce->nodetree, ntree)) + ED_node_changed_update(&sce->id, node); +} + static void do_node_internal_buttons(bContext *C, void *node_v, int event) { if(event==B_NODE_EXEC) { diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 473f706f6f8..ce0b3f3fd59 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -401,11 +401,13 @@ void snode_set_context(SpaceNode *snode, Scene *scene) snode->from= (ID*)give_current_material(ob, ob->actcol); /* from is not set fully for material nodes, should be ID + Node then */ + snode->id= &tx->id; } } else if(snode->texfrom==SNODE_TEX_WORLD) { tx= give_current_world_texture(scene->world); snode->from= (ID *)scene->world; + snode->id= &tx->id; } else { Brush *brush= NULL; @@ -415,11 +417,12 @@ void snode_set_context(SpaceNode *snode, Scene *scene) else brush= paint_brush(&scene->toolsettings->imapaint.paint); - snode->from= (ID *)brush; - tx= give_current_brush_texture(brush); + if (brush) { + snode->from= (ID *)brush; + tx= give_current_brush_texture(brush); + snode->id= &tx->id; + } } - - snode->id= &tx->id; } if(snode->id) diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 3a9a2e8ad83..ade31ee525a 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index 4ce56f96146..171333946d1 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index 055290fbb66..9235a0547ca 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c index e754903efc5..0d7c182bc9e 100644 --- a/source/blender/editors/space_node/node_state.c +++ b/source/blender/editors/space_node/node_state.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index fb36c53e9fa..112a2bc49b6 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index a3432f9dd00..797efefd669 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -511,10 +511,19 @@ static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, Sc te->name= "Refraction"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_RADIO); - te->name= "Radiosity"; + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_INDIRECT); + te->name= "Indirect"; te->directdata= &srl->passflag; - + + /* TODO SCE_PASS_ENVIRONMENT/EMIT overflow short.. + + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_ENVIRONMENT); + te->name= "Environment"; + te->directdata= &srl->passflag; + + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_EMIT); + te->name= "Emit"; + te->directdata= &srl->passflag;*/ } @@ -4941,7 +4950,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); layflag++; /* is lay_xor */ - if(ELEM6(tselem->nr, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_RADIO)) + if(ELEM8(tselem->nr, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_INDIRECT, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT)) bt= uiDefIconButBitI(block, TOG, tselem->nr, 0, (*layflag & tselem->nr)?ICON_DOT:ICON_BLANK1, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (short)te->ys, 17, OL_H-1, layflag, 0, 0, 0, 0, "Exclude this Pass from Combined"); uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index c3a0165f945..1c34cb5ef87 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -45,7 +45,8 @@ typedef struct TreeElement { ListBase subtree; float xs, ys; // do selection int store_index; // offset in tree store - short flag, index; // flag for non-saved stuff, index for data arrays + short flag; // flag for non-saved stuff + short index; // index for data arrays short idcode; // from TreeStore id short xend; // width of item display, for select char *name; diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c index fdfb89d32e3..adcacbe55c8 100644 --- a/source/blender/editors/space_outliner/outliner_ops.c +++ b/source/blender/editors/space_outliner/outliner_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c index cc90330459b..5a1ca49e79d 100644 --- a/source/blender/editors/space_script/script_edit.c +++ b/source/blender/editors/space_script/script_edit.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_script/script_intern.h b/source/blender/editors/space_script/script_intern.h index c24aae600c8..57e4cc6c793 100644 --- a/source/blender/editors/space_script/script_intern.h +++ b/source/blender/editors/space_script/script_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_script/script_ops.c b/source/blender/editors/space_script/script_ops.c index e6d2990677f..b3b0c40df07 100644 --- a/source/blender/editors/space_script/script_ops.c +++ b/source/blender/editors/space_script/script_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c index 4f7c0dc364b..cca9e0efbd1 100644 --- a/source/blender/editors/space_script/space_script.c +++ b/source/blender/editors/space_script/space_script.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 7a809f7b668..439fd6c13d1 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -191,7 +191,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) start_frame= RNA_int_get(op->ptr, "start_frame"); channel= RNA_int_get(op->ptr, "channel"); - sce_seq= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "type")); + sce_seq= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene")); if (sce_seq==NULL) { BKE_report(op->reports, RPT_ERROR, "Scene not found"); @@ -215,6 +215,8 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) else strcpy(seq->name+2, sce_seq->id.name+2); + seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + strip->len, 0); + calc_sequence_disp(scene, seq); sort_seq(scene); @@ -232,6 +234,11 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) static int sequencer_add_scene_strip_invoke(bContext *C, wmOperator *op, wmEvent *event) { + if(!ED_operator_sequencer_active(C)) { + BKE_report(op->reports, RPT_ERROR, "Sequencer area not active"); + return OPERATOR_CANCELLED; + } + sequencer_generic_invoke_xy__internal(C, op, event, 0); return sequencer_add_scene_strip_exec(C, op); // needs a menu @@ -252,14 +259,15 @@ void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot) ot->invoke= sequencer_add_scene_strip_invoke; ot->exec= sequencer_add_scene_strip_exec; - ot->poll= ED_operator_sequencer_active; + ot->poll= ED_operator_scene_editable; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME); - prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, 0, "Type", ""); + prop= RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", ""); RNA_def_enum_funcs(prop, RNA_scene_itemf); + ot->prop= prop; } static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoadFunc seq_load_func) @@ -318,7 +326,12 @@ static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op) static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, wmEvent *event) -{ +{ + if(!ED_operator_sequencer_active(C)) { + BKE_report(op->reports, RPT_ERROR, "Sequencer area not active"); + return OPERATOR_CANCELLED; + } + sequencer_generic_invoke_xy__internal(C, op, event, 0); return WM_operator_filesel(C, op, event); //return sequencer_add_movie_strip_exec(C, op); @@ -337,7 +350,7 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot) ot->invoke= sequencer_add_movie_strip_invoke; ot->exec= sequencer_add_movie_strip_exec; - ot->poll= ED_operator_sequencer_active; + ot->poll= ED_operator_scene_editable; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -355,7 +368,12 @@ static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op) } static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent *event) -{ +{ + if(!ED_operator_sequencer_active(C)) { + BKE_report(op->reports, RPT_ERROR, "Sequencer area not active"); + return OPERATOR_CANCELLED; + } + sequencer_generic_invoke_xy__internal(C, op, event, 0); return WM_operator_filesel(C, op, event); //return sequencer_add_sound_strip_exec(C, op); @@ -374,7 +392,7 @@ void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot) ot->invoke= sequencer_add_sound_strip_invoke; ot->exec= sequencer_add_sound_strip_exec; - ot->poll= ED_operator_sequencer_active; + ot->poll= ED_operator_scene_editable; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -442,6 +460,11 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) static int sequencer_add_image_strip_invoke(bContext *C, wmOperator *op, wmEvent *event) { + if(!ED_operator_sequencer_active(C)) { + BKE_report(op->reports, RPT_ERROR, "Sequencer area not active"); + return OPERATOR_CANCELLED; + } + sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME); return WM_operator_filesel(C, op, event); //return sequencer_add_image_strip_exec(C, op); @@ -460,7 +483,7 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot) ot->invoke= sequencer_add_image_strip_invoke; ot->exec= sequencer_add_image_strip_exec; - ot->poll= ED_operator_sequencer_active; + ot->poll= ED_operator_scene_editable; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -581,6 +604,11 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) /* add color */ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEvent *event) { + if(!ED_operator_sequencer_active(C)) { + BKE_report(op->reports, RPT_ERROR, "Sequencer area not active"); + return OPERATOR_CANCELLED; + } + sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME); if (RNA_property_is_set(op->ptr, "type") && RNA_enum_get(op->ptr, "type")==SEQ_PLUGIN) { @@ -603,7 +631,7 @@ void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot) ot->invoke= sequencer_add_effect_strip_invoke; ot->exec= sequencer_add_effect_strip_exec; - ot->poll= ED_operator_sequencer_active; + ot->poll= ED_operator_scene_editable; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 1cc2a935a32..dfc78eedf2a 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -828,6 +828,8 @@ static Sequence *dupli_seq(struct Scene *scene, Sequence *seq) /* - recurs_dupli_seq(&seq->seqbase,&seqn->seqbase);*/ } else if(seq->type == SEQ_SCENE) { seqn->strip->stripdata = 0; + if(seq->scene_sound) + seqn->scene_sound = sound_scene_add_scene_sound(scene, seqn, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs); } else if(seq->type == SEQ_MOVIE) { seqn->strip->stripdata = MEM_dupallocN(seq->strip->stripdata); diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index e9f7da95a81..557402ded92 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 787d5712640..b09dd1a9a1e 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -1,6 +1,6 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 05e802ad60f..b6a099807dd 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_sound/sound_intern.h b/source/blender/editors/space_sound/sound_intern.h index fd64ccb22b1..7117e7d6df9 100644 --- a/source/blender/editors/space_sound/sound_intern.h +++ b/source/blender/editors/space_sound/sound_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_sound/space_sound.c b/source/blender/editors/space_sound/space_sound.c index f0ec9b3ebb9..c64ea7c6693 100644 --- a/source/blender/editors/space_sound/space_sound.c +++ b/source/blender/editors/space_sound/space_sound.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 44aeb9158f0..43849fda7f8 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h index e8cecab8404..46820a54e36 100644 --- a/source/blender/editors/space_text/text_intern.h +++ b/source/blender/editors/space_text/text_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_time/time_intern.h b/source/blender/editors/space_time/time_intern.h index 5fe55444d45..31164d0c27a 100644 --- a/source/blender/editors/space_time/time_intern.h +++ b/source/blender/editors/space_time/time_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c index 08e84140f0e..9b391db0086 100644 --- a/source/blender/editors/space_time/time_ops.c +++ b/source/blender/editors/space_time/time_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c index 0a8eee1c7dd..d1a8c4e9ff9 100644 --- a/source/blender/editors/space_userpref/space_userpref.c +++ b/source/blender/editors/space_userpref/space_userpref.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_userpref/userpref_intern.h b/source/blender/editors/space_userpref/userpref_intern.h index 8c84cfdede4..206c8efe70e 100644 --- a/source/blender/editors/space_userpref/userpref_intern.h +++ b/source/blender/editors/space_userpref/userpref_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index b9522b89394..3ed8fdc3eab 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -2406,7 +2406,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in bArmature *arm= ob->data; int retval= 0; - if(G.f & G_RENDER_SHADOW) + if(v3d->flag2 & V3D_RENDER_OVERRIDE) return 1; if(dt>OB_WIRE && arm->drawtype!=ARM_LINE) { diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 09cbdd0c221..5a495488afa 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -339,9 +339,6 @@ void drawaxes(float size, int flag, char drawtype) float v1[3]= {0.0, 0.0, 0.0}; float v2[3]= {0.0, 0.0, 0.0}; float v3[3]= {0.0, 0.0, 0.0}; - - if(G.f & G_RENDER_SHADOW) - return; switch(drawtype) { @@ -864,9 +861,6 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, float imat[4][4], curcol[4]; char col[4]; int drawcone= (dt>OB_WIRE && !(G.f & G_PICKSEL) && la->type == LA_SPOT && (la->mode & LA_SHOW_CONE)); - - if(G.f & G_RENDER_SHADOW) - return; if(drawcone && !v3d->transp) { /* in this case we need to draw delayed */ @@ -1164,9 +1158,6 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob float nobmat[4][4], vec[8][4], fac, facx, facy, depth; int i; - if(G.f & G_RENDER_SHADOW) - return; - cam= ob->data; glDisable(GL_LIGHTING); @@ -2004,7 +1995,8 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E 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)) + + if(v3d->flag2 & V3D_RENDER_OVERRIDE) return; /* make the precision of the pronted value proportionate to the gridsize */ @@ -2425,8 +2417,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D CHECK_OB_DRAWTEXTURE(v3d, dt)) { int faceselect= (ob==OBACT && paint_facesel_test(ob)); - - if ((v3d->flag&V3D_SELECT_OUTLINE) && (base->flag&SELECT) && !(G.f&G_PICKSEL || paint_facesel_test(ob)) && !draw_wire) { + if ((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !(G.f&G_PICKSEL || paint_facesel_test(ob)) && !draw_wire) { draw_mesh_object_outline(v3d, ob, dm); } @@ -2481,7 +2472,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D else { Paint *p; - if((v3d->flag&V3D_SELECT_OUTLINE) && (base->flag&SELECT) && !draw_wire && !ob->sculpt) + if((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !draw_wire && !ob->sculpt) draw_mesh_object_outline(v3d, ob, dm); glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED ); @@ -2565,7 +2556,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D dm= mesh_get_derived_final(scene, ob, v3d->customdata_mask); } - if ((v3d->flag&V3D_SELECT_OUTLINE) && (base->flag&SELECT) && !draw_wire) { + if ((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !draw_wire) { draw_mesh_object_outline(v3d, ob, dm); } @@ -2854,8 +2845,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl) case DL_POLY: if(ob->type==OB_SURF) { int nr; - - UI_ThemeColor(TH_WIRE); + glDisable(GL_LIGHTING); /* for some reason glDrawArrays crashes here in half of the platforms (not osx) */ @@ -3735,7 +3725,8 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv setlinestyle(0); } - if((part->draw & PART_DRAW_NUM || part->draw & PART_DRAW_HEALTH) && !(G.f & G_RENDER_SHADOW)){ + + if((part->draw & PART_DRAW_NUM || part->draw & PART_DRAW_HEALTH) && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0){ float vec_txt[3]; char *val_pos= val; val[0]= '\0'; @@ -4254,23 +4245,21 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float } /*place to add drawers */ -unsigned int nurbcol[8]= { - 0, 0x9090, 0x409030, 0x603080, 0, 0x40fff0, 0x40c033, 0xA090F0 }; static void tekenhandlesN(Nurb *nu, short sel, short hide_handles) { BezTriple *bezt; float *fp; - unsigned int *col; + int basecol; int a; if(nu->hide || hide_handles) return; - + glBegin(GL_LINES); if(nu->type == CU_BEZIER) { - if(sel) col= nurbcol+4; - else col= nurbcol; + if(sel) basecol= TH_HANDLE_SEL_FREE; + else basecol= TH_HANDLE_FREE; bezt= nu->bezt; a= nu->pntsu; @@ -4278,26 +4267,26 @@ static void tekenhandlesN(Nurb *nu, short sel, short hide_handles) if(bezt->hide==0) { if( (bezt->f2 & SELECT)==sel) { fp= bezt->vec[0]; - - cpack(col[(int)bezt->h1]); + + UI_ThemeColor(basecol + bezt->h1); glVertex3fv(fp); glVertex3fv(fp+3); - cpack(col[(int)bezt->h2]); + UI_ThemeColor(basecol + bezt->h2); glVertex3fv(fp+3); glVertex3fv(fp+6); } else if( (bezt->f1 & SELECT)==sel) { fp= bezt->vec[0]; - - cpack(col[(int)bezt->h1]); + + UI_ThemeColor(basecol + bezt->h1); glVertex3fv(fp); glVertex3fv(fp+3); } else if( (bezt->f3 & SELECT)==sel) { fp= bezt->vec[1]; - - cpack(col[(int)bezt->h2]); + + UI_ThemeColor(basecol + bezt->h2); glVertex3fv(fp); glVertex3fv(fp+3); } @@ -4308,6 +4297,41 @@ static void tekenhandlesN(Nurb *nu, short sel, short hide_handles) glEnd(); } +static void tekenhandlesN_active(Nurb *nu) +{ + BezTriple *bezt; + float *fp; + int a; + + if(nu->hide) return; + + UI_ThemeColor(TH_ACTIVE_SPLINE); + glLineWidth(2); + + glBegin(GL_LINES); + + if(nu->type == CU_BEZIER) { + bezt= nu->bezt; + a= nu->pntsu; + while(a--) { + if(bezt->hide==0) { + fp= bezt->vec[0]; + + glVertex3fv(fp); + glVertex3fv(fp+3); + + glVertex3fv(fp+3); + glVertex3fv(fp+6); + } + bezt++; + } + } + glEnd(); + + glColor3ub(0,0,0); + glLineWidth(1); +} + static void tekenvertsN(Nurb *nu, short sel, short hide_handles) { BezTriple *bezt; @@ -4357,18 +4381,94 @@ static void tekenvertsN(Nurb *nu, short sel, short hide_handles) glPointSize(1.0); } +static void editnurb_draw_active_poly(Nurb *nu) +{ + BPoint *bp; + int a, b; + + UI_ThemeColor(TH_ACTIVE_SPLINE); + glLineWidth(2); + + bp= nu->bp; + for(b=0; b<nu->pntsv; b++) { + if(nu->flagu & 1) glBegin(GL_LINE_LOOP); + else glBegin(GL_LINE_STRIP); + + for(a=0; a<nu->pntsu; a++, bp++) { + glVertex3fv(bp->vec); + } + + glEnd(); + } + + glColor3ub(0,0,0); + glLineWidth(1); +} + +static void editnurb_draw_active_nurbs(Nurb *nu) +{ + BPoint *bp, *bp1; + int a, b, ofs; + + UI_ThemeColor(TH_ACTIVE_SPLINE); + glLineWidth(2); + + glBegin(GL_LINES); + bp= nu->bp; + for(b=0; b<nu->pntsv; b++) { + bp1= bp; + bp++; + + for(a=nu->pntsu-1; a>0; a--, bp++) { + if(bp->hide==0 && bp1->hide==0) { + glVertex3fv(bp->vec); + glVertex3fv(bp1->vec); + } + bp1= bp; + } + } + + if(nu->pntsv > 1) { /* surface */ + + ofs= nu->pntsu; + for(b=0; b<nu->pntsu; b++) { + bp1= nu->bp+b; + bp= bp1+ofs; + for(a=nu->pntsv-1; a>0; a--, bp+=ofs) { + if(bp->hide==0 && bp1->hide==0) { + glVertex3fv(bp->vec); + glVertex3fv(bp1->vec); + } + bp1= bp; + } + } + } + + glEnd(); + + glColor3ub(0,0,0); + glLineWidth(1); +} + static void draw_editnurb(Object *ob, Nurb *nurb, int sel) { Nurb *nu; BPoint *bp, *bp1; - int a, b, ofs; - + int a, b, ofs, index; + Curve *cu= (Curve*)ob->data; + + index= 0; nu= nurb; while(nu) { if(nu->hide==0) { switch(nu->type) { case CU_POLY: - cpack(nurbcol[3]); + if (!sel && index== cu->actnu) { + /* we should draw active spline highlight below everything */ + editnurb_draw_active_poly(nu); + } + + UI_ThemeColor(TH_NURB_ULINE); bp= nu->bp; for(b=0; b<nu->pntsv; b++) { if(nu->flagu & 1) glBegin(GL_LINE_LOOP); @@ -4382,6 +4482,10 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel) } break; case CU_NURBS: + if (!sel && index== cu->actnu) { + /* we should draw active spline highlight below everything */ + editnurb_draw_active_nurbs(nu); + } bp= nu->bp; for(b=0; b<nu->pntsv; b++) { @@ -4391,7 +4495,7 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel) if(bp->hide==0 && bp1->hide==0) { if(sel) { if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT ) ) { - cpack(nurbcol[5]); + UI_ThemeColor(TH_NURB_SEL_ULINE); glBegin(GL_LINE_STRIP); glVertex3fv(bp->vec); @@ -4402,7 +4506,7 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel) else { if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) ); else { - cpack(nurbcol[1]); + UI_ThemeColor(TH_NURB_ULINE); glBegin(GL_LINE_STRIP); glVertex3fv(bp->vec); @@ -4424,7 +4528,7 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel) if(bp->hide==0 && bp1->hide==0) { if(sel) { if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) ) { - cpack(nurbcol[7]); + UI_ThemeColor(TH_NURB_SEL_VLINE); glBegin(GL_LINE_STRIP); glVertex3fv(bp->vec); @@ -4435,7 +4539,7 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel) else { if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) ); else { - cpack(nurbcol[3]); + UI_ThemeColor(TH_NURB_VLINE); glBegin(GL_LINE_STRIP); glVertex3fv(bp->vec); @@ -4452,6 +4556,8 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel) break; } } + + ++index; nu= nu->next; } } @@ -4464,6 +4570,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, Nurb *nu; BevList *bl; short hide_handles = (cu->drawflag & CU_HIDE_HANDLES); + int index; // XXX retopo_matrix_update(v3d); @@ -4473,11 +4580,15 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, if(v3d->zbuf) glDisable(GL_DEPTH_TEST); - /* first non-selected handles */ + /* first non-selected and active handles */ + index= 0; for(nu=nurb; nu; nu=nu->next) { if(nu->type == CU_BEZIER) { + if (index == cu->actnu && !hide_handles) + tekenhandlesN_active(nu); tekenhandlesN(nu, 0, hide_handles); } + ++index; } draw_editnurb(ob, nurb, 0); draw_editnurb(ob, nurb, 1); @@ -4826,9 +4937,6 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d) int curcol; float size; - if(G.f & G_RENDER_SHADOW) - return; - /* XXX why? */ if(ob!=scene->obedit && (ob->flag & SELECT)) { if(ob==OBACT) curcol= TH_ACTIVE; @@ -5256,9 +5364,6 @@ void drawRBpivot(bRigidBodyJointConstraint *data) float eu[3]= {radsPerDeg*data->axX, radsPerDeg*data->axY, radsPerDeg*data->axZ}; float mat[4][4]; - if(G.f & G_RENDER_SHADOW) - return; - eul_to_mat4(mat,eu); glLineWidth (4.0f); setlinestyle(2); @@ -5524,7 +5629,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } /* draw outline for selected solid objects, mesh does itself */ - if((v3d->flag & V3D_SELECT_OUTLINE) && ob->type!=OB_MESH) { + if((v3d->flag & V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && ob->type!=OB_MESH) { if(dt>OB_WIRE && dt<OB_TEXTURE && (ob->mode & OB_MODE_EDIT)==0 && (flag & DRAW_SCENESET)==0) { if (!(ob->dtx&OB_DRAWWIRE) && (ob->flag&SELECT) && !(flag&DRAW_PICKING)) { @@ -5658,44 +5763,60 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) break; } case OB_EMPTY: - drawaxes(ob->empty_drawsize, flag, ob->empty_drawtype); + if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) + drawaxes(ob->empty_drawsize, flag, ob->empty_drawtype); break; case OB_LAMP: - drawlamp(scene, v3d, rv3d, base, dt, flag); - if(dtx || (base->flag & SELECT)) glMultMatrixf(ob->obmat); + if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { + drawlamp(scene, v3d, rv3d, base, dt, flag); + if(dtx || (base->flag & SELECT)) glMultMatrixf(ob->obmat); + } break; case OB_CAMERA: - drawcamera(scene, v3d, rv3d, ob, flag); + if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0 || (rv3d->persp==RV3D_CAMOB && v3d->camera==ob)) /* special exception for active camera */ + drawcamera(scene, v3d, rv3d, ob, flag); break; case OB_LATTICE: - drawlattice(scene, v3d, ob); + if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { + drawlattice(scene, v3d, ob); + } break; case OB_ARMATURE: - if(dt>OB_WIRE) GPU_enable_material(0, NULL); // we use default material - empty_object= draw_armature(scene, v3d, ar, base, dt, flag); - if(dt>OB_WIRE) GPU_disable_material(); + if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { + if(dt>OB_WIRE) GPU_enable_material(0, NULL); // we use default material + empty_object= draw_armature(scene, v3d, ar, base, dt, flag); + if(dt>OB_WIRE) GPU_disable_material(); + } break; default: - drawaxes(1.0, flag, OB_ARROWS); + if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { + drawaxes(1.0, flag, OB_ARROWS); + } } - if(ob->soft /*&& flag & OB_SBMOTION*/){ - float mrt[3][3],msc[3][3],mtr[3][3]; - SoftBody *sb = 0; - float tipw = 0.5f, tiph = 0.5f,drawsize = 4.0f; - if ((sb= ob->soft)){ - if(sb->solverflags & SBSO_ESTIMATEIPO){ - glLoadMatrixf(rv3d->viewmat); - copy_m3_m3(msc,sb->lscale); - copy_m3_m3(mrt,sb->lrot); - mul_m3_m3m3(mtr,mrt,msc); - ob_draw_RE_motion(sb->lcom,mtr,tipw,tiph,drawsize); - glMultMatrixf(ob->obmat); + if((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { + + if(ob->soft /*&& flag & OB_SBMOTION*/){ + float mrt[3][3],msc[3][3],mtr[3][3]; + SoftBody *sb = 0; + float tipw = 0.5f, tiph = 0.5f,drawsize = 4.0f; + if ((sb= ob->soft)){ + if(sb->solverflags & SBSO_ESTIMATEIPO){ + + glLoadMatrixf(rv3d->viewmat); + copy_m3_m3(msc,sb->lscale); + copy_m3_m3(mrt,sb->lrot); + mul_m3_m3m3(mtr,mrt,msc); + ob_draw_RE_motion(sb->lcom,mtr,tipw,tiph,drawsize); + glMultMatrixf(ob->obmat); + } } } - } - if(ob->pd && ob->pd->forcefield) draw_forcefield(scene, ob, rv3d); + if(ob->pd && ob->pd->forcefield) { + draw_forcefield(scene, ob, rv3d); + } + } /* code for new particle system */ if( (warning_recursive==0) && @@ -5852,7 +5973,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } } - { + if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { + bConstraint *con; for(con=ob->constraints.first; con; con= con->next) { @@ -5863,24 +5985,25 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) drawRBpivot(data); } } - } - /* draw extra: after normal draw because of makeDispList */ - if(dtx && !(G.f & (G_RENDER_OGL|G_RENDER_SHADOW))) { - if(dtx & OB_AXIS) { - drawaxes(1.0f, flag, OB_ARROWS); - } - if(dtx & OB_BOUNDBOX) draw_bounding_volume(scene, ob); - if(dtx & OB_TEXSPACE) drawtexspace(ob); - if(dtx & OB_DRAWNAME) { - /* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */ - /* but, we also dont draw names for sets or duplicators */ - if(flag == 0) { - view3d_cached_text_draw_add(0.0f, 0.0f, 0.0f, ob->id.name+2, 10, 0); - } - } - /*if(dtx & OB_DRAWIMAGE) drawDispListwire(&ob->disp);*/ - if((dtx & OB_DRAWWIRE) && dt>=OB_SOLID) drawWireExtra(scene, rv3d, ob); + /* draw extra: after normal draw because of makeDispList */ + if(dtx && (G.f & G_RENDER_OGL)==0) { + + if(dtx & OB_AXIS) { + drawaxes(1.0f, flag, OB_ARROWS); + } + if(dtx & OB_BOUNDBOX) draw_bounding_volume(scene, ob); + if(dtx & OB_TEXSPACE) drawtexspace(ob); + if(dtx & OB_DRAWNAME) { + /* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */ + /* but, we also dont draw names for sets or duplicators */ + if(flag == 0) { + view3d_cached_text_draw_add(0.0f, 0.0f, 0.0f, ob->id.name+2, 10, 0); + } + } + /*if(dtx & OB_DRAWIMAGE) drawDispListwire(&ob->disp);*/ + if((dtx & OB_DRAWWIRE) && dt>=OB_SOLID) drawWireExtra(scene, rv3d, ob); + } } if(dt<OB_SHADED) { @@ -5906,13 +6029,15 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(warning_recursive) return; if(base->flag & OB_FROMDUPLI) return; - if(G.f & G_RENDER_SHADOW) return; + if(v3d->flag2 & V3D_RENDER_OVERRIDE) return; /* object centers, need to be drawn in viewmat space for speed, but OK for picking select */ 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) + if(v3d->flag2 & V3D_RENDER_OVERRIDE) { + /* dont draw */ + } else if((scene->basact)==base) do_draw_center= ACTIVE; else if(base->flag & SELECT) do_draw_center= SELECT; @@ -5937,7 +6062,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } /* not for sets, duplicators or picking */ - if(flag==0 && (!(v3d->flag & V3D_HIDE_HELPLINES))) { + if(flag==0 && (v3d->flag & V3D_HIDE_HELPLINES)== 0 && (v3d->flag2 & V3D_RENDER_OVERRIDE)== 0) { ListBase *list; /* draw hook center and offset line */ diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index f726b771fb3..bcfc0071237 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index f1668190ea8..82ed635cc0d 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -146,7 +146,7 @@ typedef struct { float ob_scale[3]; // need temp space due to linked values float ob_dims[3]; short link_scale; - float ve_median[5]; + float ve_median[6]; int curdef; float *defweightp; } TransformProperties; @@ -158,12 +158,12 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d uiBlock *block= (layout)? uiLayoutAbsoluteBlock(layout): NULL; MDeformVert *dvert=NULL; TransformProperties *tfp= v3d->properties_storage; - float median[5], ve_median[5]; - int tot, totw, totweight, totedge; + float median[6], ve_median[6]; + int tot, totw, totweight, totedge, totradius; char defstr[320]; - median[0]= median[1]= median[2]= median[3]= median[4]= 0.0; - tot= totw= totweight= totedge= 0; + median[0]= median[1]= median[2]= median[3]= median[4]= median[5]= 0.0; + tot= totw= totweight= totedge= totradius= 0; defstr[0]= 0; if(ob->type==OB_MESH) { @@ -237,6 +237,8 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d tot++; median[4]+= bezt->weight; totweight++; + median[5]+= bezt->radius; + totradius++; } else { if(bezt->f1 & SELECT) { @@ -262,6 +264,8 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d tot++; median[4]+= bp->weight; totweight++; + median[5]+= bp->radius; + totradius++; } bp++; } @@ -295,6 +299,7 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d if(totedge) median[3] /= (float)totedge; else if(totw) median[3] /= (float)totw; if(totweight) median[4] /= (float)totweight; + if(totradius) median[5] /= (float)totradius; if(v3d->flag & V3D_GLOBAL_STATS) mul_m4_v3(ob->obmat, median); @@ -324,6 +329,8 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d uiBlockEndAlign(block); if(totweight) uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 0, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, ""); + if(totradius) + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 0, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs"); } else { uiBlockBeginAlign(block); @@ -332,6 +339,8 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d uiBlockEndAlign(block); if(totweight) uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 20, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, ""); + if(totradius) + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs"); } } else { @@ -349,6 +358,8 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d uiBlockEndAlign(block); if(totweight) uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 0, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, "Weight is used for SoftBody Goal"); + if(totradius) + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 0, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs"); uiBlockEndAlign(block); } else { @@ -358,6 +369,8 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d uiBlockEndAlign(block); if(totweight) uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 20, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, "Weight is used for SoftBody Goal"); + if(totradius) + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 0, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs"); uiBlockEndAlign(block); } } @@ -379,6 +392,7 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d sub_v3_v3v3(median, ve_median, median); median[3]= ve_median[3]-median[3]; median[4]= ve_median[4]-median[4]; + median[5]= ve_median[5]-median[5]; if(ob->type==OB_MESH) { Mesh *me= ob->data; @@ -428,6 +442,7 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d add_v3_v3v3(bezt->vec[1], bezt->vec[1], median); add_v3_v3v3(bezt->vec[2], bezt->vec[2], median); bezt->weight+= median[4]; + bezt->radius+= median[5]; } else { if(bezt->f1 & SELECT) { @@ -448,6 +463,7 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d add_v3_v3v3(bp->vec, bp->vec, median); bp->vec[3]+= median[3]; bp->weight+= median[4]; + bp->radius+= median[5]; } bp++; } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index c5e0f096c04..ce3bf293051 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -1362,7 +1362,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d) int mip= 0; if(ibuf->mipmap[0]==NULL) - IMB_makemipmap(ibuf, 0, 0); + IMB_makemipmap(ibuf, 0); while(tzoom < 1.0f && mip<8 && ibuf->mipmap[mip]) { tzoom*= 2.0f; @@ -2078,7 +2078,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in } /* creates own 3d views, used by the sequencer */ -ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height) +ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, int drawtype) { View3D v3d; ARegion ar; @@ -2095,7 +2095,8 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height v3d.camera= scene->camera; v3d.lay= scene->lay; - v3d.drawtype = OB_SOLID; /* should be able to configure */ + v3d.drawtype = drawtype; + v3d.flag2 = V3D_RENDER_OVERRIDE; rv3d.persp= RV3D_CAMOB; @@ -2223,29 +2224,32 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) // needs to be done always, gridview is adjusted in drawgrid() now rv3d->gridview= v3d->grid; - if(rv3d->view==0 || rv3d->persp!=0) { - drawfloor(scene, v3d); - if(rv3d->persp==2) { - if(scene->world) { - if(scene->world->mode & WO_STARS) { - RE_make_stars(NULL, scene, star_stuff_init_func, star_stuff_vertex_func, - star_stuff_term_func); + if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { + + if(rv3d->view==0 || rv3d->persp != RV3D_ORTHO) { + drawfloor(scene, v3d); + if(rv3d->persp==RV3D_CAMOB) { + if(scene->world) { + if(scene->world->mode & WO_STARS) { + RE_make_stars(NULL, scene, star_stuff_init_func, star_stuff_vertex_func, + star_stuff_term_func); + } } + if(v3d->flag & V3D_DISPBGPICS) draw_bgpic(scene, ar, v3d); } - if(v3d->flag & V3D_DISPBGPICS) draw_bgpic(scene, ar, v3d); } - } - else { - ED_region_pixelspace(ar); - drawgrid(&scene->unit, ar, v3d, &grid_unit); - /* XXX make function? replaces persp(1) */ - glMatrixMode(GL_PROJECTION); - glLoadMatrixf(rv3d->winmat); - glMatrixMode(GL_MODELVIEW); - glLoadMatrixf(rv3d->viewmat); - - if(v3d->flag & V3D_DISPBGPICS) { - draw_bgpic(scene, ar, v3d); + else { + ED_region_pixelspace(ar); + drawgrid(&scene->unit, ar, v3d, &grid_unit); + /* XXX make function? replaces persp(1) */ + glMatrixMode(GL_PROJECTION); + glLoadMatrixf(rv3d->winmat); + glMatrixMode(GL_MODELVIEW); + glLoadMatrixf(rv3d->viewmat); + + if(v3d->flag & V3D_DISPBGPICS) { + draw_bgpic(scene, ar, v3d); + } } } @@ -2333,12 +2337,14 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) glDisable(GL_DEPTH_TEST); } - /* draw grease-pencil stuff (3d-space strokes) */ - //if (v3d->flag2 & V3D_DISPGP) - draw_gpencil_3dview((bContext *)C, 1); - - BDR_drawSketch(C); - + if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { + /* draw grease-pencil stuff (3d-space strokes) */ + //if (v3d->flag2 & V3D_DISPGP) + draw_gpencil_3dview((bContext *)C, 1); + + BDR_drawSketch(C); + } + ED_region_pixelspace(ar); // retopo_paint_view_update(v3d); @@ -2346,14 +2352,17 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) /* Draw particle edit brush XXX (removed) */ - if(rv3d->persp>1) drawviewborder(scene, ar, v3d); + + if(rv3d->persp==RV3D_CAMOB) drawviewborder(scene, ar, v3d); if(rv3d->rflag & RV3D_FLYMODE) drawviewborder_flymode(ar); - - /* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */ -// if (v3d->flag2 & V3D_DISPGP) - draw_gpencil_3dview((bContext *)C, 0); - drawcursor(scene, ar, v3d); + if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { + /* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */ + // if (v3d->flag2 & V3D_DISPGP) + draw_gpencil_3dview((bContext *)C, 0); + + drawcursor(scene, ar, v3d); + } if(U.uiflag & USER_SHOW_ROTVIEWICON) draw_view_axis(rv3d); @@ -2381,5 +2390,3 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) v3d->flag |= V3D_INVALID_BACKBUF; } - - diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 51e8f9e43b2..6b9a65d60a2 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -1353,11 +1353,12 @@ static int viewselected_exec(bContext *C, wmOperator *op) /* like a localview wi for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { if(pchan->bone->flag & BONE_SELECTED) { if(pchan->bone->layer & arm->layer) { + bPoseChannel *pchan_tx= pchan->custom_tx ? pchan->custom_tx : pchan; ok= 1; - VECCOPY(vec, pchan->pose_head); + VECCOPY(vec, pchan_tx->pose_head); mul_m4_v3(ob->obmat, vec); DO_MINMAX(vec, min, max); - VECCOPY(vec, pchan->pose_tail); + VECCOPY(vec, pchan_tx->pose_tail); mul_m4_v3(ob->obmat, vec); DO_MINMAX(vec, min, max); } diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index d56d70d1fbc..301a88b6674 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index 792153cab08..6d75d1d0b81 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 26214715805..2eecede4907 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 4a103da6d3c..11e5975cabb 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index be974cf0050..fd7e2c22137 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -540,7 +540,7 @@ void viewline(ARegion *ar, View3D *v3d, float mval[2], float ray_start[3], float float vec[4]; int a; - if(rv3d->persp != RV3D_ORTHO){ + if(!get_view3d_ortho(v3d, rv3d)) { vec[0]= 2.0f * mval[0] / ar->winx - 1; vec[1]= 2.0f * mval[1] / ar->winy - 1; vec[2]= -1.0f; @@ -2288,12 +2288,12 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) break; case FLY_MODAL_DIR_UP: - if (fly->speed < 0.0f) fly->speed= -fly->speed; + if (fly->speed > 0.0f) fly->speed= -fly->speed; fly->axis= 1; break; case FLY_MODAL_DIR_DOWN: - if (fly->speed > 0.0f) fly->speed= -fly->speed; + if (fly->speed < 0.0f) fly->speed= -fly->speed; fly->axis= 1; break; @@ -2323,7 +2323,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) } } -static int flyApply(FlyInfo *fly) +static int flyApply(bContext *C, FlyInfo *fly) { /* fly mode - Shift+F @@ -2606,13 +2606,10 @@ static int flyApply(FlyInfo *fly) /* record the motion */ if (autokeyframe_cfra_can_key(scene, id_key)) { - bCommonKeySrc cks; - ListBase dsources = {&cks, &cks}; - int cfra = CFRA; + ListBase dsources = {NULL, NULL}; - /* init common-key-source for use by KeyingSets */ - memset(&cks, 0, sizeof(bCommonKeySrc)); - cks.id= id_key; + /* add datasource override for the camera object */ + ANIM_relative_keyingset_add_source(&dsources, id_key, NULL, NULL); /* insert keyframes * 1) on the first frame @@ -2621,12 +2618,15 @@ static int flyApply(FlyInfo *fly) */ if (fly->xlock || fly->zlock || moffset[0] || moffset[1]) { KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Rotation"); - modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); } if (fly->speed) { KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Location"); - modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); } + + /* free temp data */ + BLI_freelistN(&dsources); } } } else @@ -2689,7 +2689,7 @@ static int fly_modal(bContext *C, wmOperator *op, wmEvent *event) flyEvent(fly, event); if(event->type==TIMER && event->customdata == fly->timer) - flyApply(fly); + flyApply(C, fly); if(fly->redraw) { ED_region_tag_redraw(CTX_wm_region(C)); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 3e394169a0b..b14bd03df19 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1043,7 +1043,7 @@ int transformEvent(TransInfo *t, wmEvent *event) /* confirm transform if launch key is released after mouse move */ /* XXX Keyrepeat bug in Xorg fucks this up, will test when fixed */ - if (event->type == LEFTMOUSE /*t->launch_event*/ && t->state != TRANS_STARTING) + if (event->type == t->launch_event && (t->launch_event == LEFTMOUSE || t->launch_event == RIGHTMOUSE) && t->state != TRANS_STARTING) { t->state = TRANS_CONFIRM; } @@ -1453,6 +1453,26 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int t->launch_event = event ? event->type : -1; + if (U.flag & USER_DRAGIMMEDIATE) + { + if (t->launch_event == EVT_TWEAK_R) + { + t->launch_event = RIGHTMOUSE; + } + else if (t->launch_event == EVT_TWEAK_L) + { + t->launch_event = LEFTMOUSE; + } + } + + // XXX Remove this when wm_operator_call_internal doesn't use window->eventstate (which can have type = 0) + // For manipulator only, so assume LEFTMOUSE + if (t->launch_event == 0) + { + t->launch_event = LEFTMOUSE; + } + + if (!initTransInfo(C, t, op, event)) // internal data, mouse, vectors { return 0; @@ -1483,6 +1503,28 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int return 0; } + /* Stupid code to have Ctrl-Click on manipulator work ok */ + if(event) + { + wmKeyMap *keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap); + wmKeyMapItem *kmi; + + for (kmi = keymap->items.first; kmi; kmi = kmi->next) + { + if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS) + { + if ((ELEM(kmi->type, LEFTCTRLKEY, RIGHTCTRLKEY) && event->ctrl) || + (ELEM(kmi->type, LEFTSHIFTKEY, RIGHTSHIFTKEY) && event->shift) || + (ELEM(kmi->type, LEFTALTKEY, RIGHTALTKEY) && event->alt) || + (kmi->type == COMMANDKEY && event->oskey)) { + t->modifiers |= MOD_SNAP_INVERT; + } + break; + } + } + + } + initSnapping(t, op); // Initialize snapping data AFTER mode flags /* EVIL! posemode code can switch translation to rotate when 1 bone is selected. will be removed (ton) */ diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 372aa42bac3..4e4fd0c24ae 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -102,20 +102,7 @@ #include "BKE_report.h" #include "BKE_scene.h" -//#include "BIF_editview.h" -//#include "BIF_editlattice.h" -//#include "BIF_editconstraint.h" -//#include "BIF_editmesh.h" -//#include "BIF_editsima.h" -//#include "BIF_editparticle.h" #include "BIF_gl.h" -//#include "BIF_poseobject.h" -//#include "BIF_meshtools.h" -//#include "BIF_mywindow.h" -//#include "BIF_resources.h" -//#include "BIF_screen.h" -//#include "BIF_space.h" -//#include "BIF_toolbox.h" #include "ED_anim_api.h" #include "ED_armature.h" @@ -132,19 +119,11 @@ #include "UI_view2d.h" -//#include "BSE_edit.h" -//#include "BDR_editobject.h" // reset_slowparents() -//#include "BDR_gpencil.h" - #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_editVert.h" -//#include "editmesh.h" -// -//#include "blendef.h" -// -//#include "mydevice.h" +#include "RNA_access.h" extern ListBase editelems; @@ -3868,6 +3847,8 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count } } else { + t->frame_side= 'B'; + /* *** Normal Transform *** */ if (seq->depth == 0) { @@ -4484,20 +4465,21 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, // TODO: this should probably be done per channel instead... if (autokeyframe_cfra_can_key(scene, id)) { KeyingSet *active_ks = ANIM_scene_get_active_keyingset(scene); - bCommonKeySrc cks; - ListBase dsources = {&cks, &cks}; + ListBase dsources = {NULL, NULL}; float cfra= (float)CFRA; // xxx this will do for now short flag = 0; - /* init common-key-source for use by KeyingSets */ - memset(&cks, 0, sizeof(bCommonKeySrc)); - cks.id= &ob->id; - + /* get flags used for inserting keyframes */ flag = ANIM_get_keyframing_flags(scene, 1); + /* add datasource override for the camera object */ + ANIM_relative_keyingset_add_source(&dsources, id, NULL, NULL); + if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (active_ks)) { - /* only insert into active keyingset */ - modify_keyframes(scene, &dsources, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra); + /* only insert into active keyingset + * NOTE: we assume here that the active Keying Set does not need to have its iterator overridden spe + */ + ANIM_apply_keyingset(C, NULL, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra); } else if (IS_AUTOKEY_FLAG(INSERTAVAIL)) { AnimData *adt= ob->adt; @@ -4543,22 +4525,25 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, /* insert keyframes for the affected sets of channels using the builtin KeyingSets found */ if (doLoc) { KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Location"); - modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); } if (doRot) { KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Rotation"); - modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); } if (doScale) { KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Scale"); - modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); } } /* insert keyframe in all (transform) channels */ else { KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "LocRotScale"); - modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); } + + /* free temp info */ + BLI_freelistN(&dsources); } } @@ -4579,15 +4564,9 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o // TODO: this should probably be done per channel instead... if (autokeyframe_cfra_can_key(scene, id)) { KeyingSet *active_ks = ANIM_scene_get_active_keyingset(scene); - bCommonKeySrc cks; - ListBase dsources = {&cks, &cks}; float cfra= (float)CFRA; short flag= 0; - /* init common-key-source for use by KeyingSets */ - memset(&cks, 0, sizeof(bCommonKeySrc)); - cks.id= &ob->id; - /* flag is initialised from UserPref keyframing settings * - special exception for targetless IK - INSERTKEY_MATRIX keyframes should get * visual keyframes even if flag not set, as it's not that useful otherwise @@ -4600,14 +4579,18 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) { if (pchan->bone->flag & BONE_TRANSFORM) { + ListBase dsources = {NULL, NULL}; + /* clear any 'unkeyed' flag it may have */ pchan->bone->flag &= ~BONE_UNKEYED; + /* add datasource override for the camera object */ + ANIM_relative_keyingset_add_source(&dsources, id, &RNA_PoseBone, pchan); + /* only insert into active keyingset? */ + // TODO: move this first case out of the loop if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (active_ks)) { - /* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */ - cks.pchan= pchan; - modify_keyframes(scene, &dsources, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra); + ANIM_apply_keyingset(C, NULL, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra); } /* only insert into available channels? */ else if (IS_AUTOKEY_FLAG(INSERTAVAIL)) { @@ -4656,34 +4639,25 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o if (doLoc) { KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Location"); - - /* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */ - cks.pchan= pchan; - modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); } if (doRot) { KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Rotation"); - - /* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */ - cks.pchan= pchan; - modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); } if (doScale) { KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Scale"); - - /* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */ - cks.pchan= pchan; - modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); } } /* insert keyframe in all (transform) channels */ else { KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "LocRotScale"); - - /* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */ - cks.pchan= pchan; - modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); } + + /* free temp info */ + BLI_freelistN(&dsources); } } @@ -4736,6 +4710,24 @@ void special_aftertrans_update(bContext *C, TransInfo *t) if (t->spacetype == SPACE_SEQ) { /* freeSeqData in transform_conversions.c does this * keep here so the else at the end wont run... */ + + SpaceSeq *sseq= (SpaceSeq *)t->sa->spacedata.first; + + /* marker transform, not especially nice but we may want to move markers + * at the same time as keyframes in the dope sheet. */ + if ((sseq->flag & SEQ_MARKER_TRANS) && (cancelled == 0)) { + /* cant use , TFM_TIME_EXTEND + * for some reason EXTEND is changed into TRANSLATE, so use frame_side instead */ + + if(t->mode == TFM_SEQ_SLIDE) { + if(t->frame_side == 'B') + scene_marker_tfm_translate(t->scene, floor(t->values[0] + 0.5f), SELECT); + } + else if (ELEM(t->frame_side, 'L', 'R')) { + scene_marker_tfm_extend(t->scene, floor(t->vec[0] + 0.5f), SELECT, t->scene->r.cfra, t->frame_side); + } + } + } else if (t->spacetype == SPACE_NODE) { /* pass */ diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index e152cc65bf3..754ad8ad9a3 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -1,5 +1,5 @@ /** -* $Id: +* $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/transform/transform_ndofinput.c b/source/blender/editors/transform/transform_ndofinput.c index fa872339196..a6171723752 100644 --- a/source/blender/editors/transform/transform_ndofinput.c +++ b/source/blender/editors/transform/transform_ndofinput.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 2e60db8048e..805afa4fb95 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 5d16b87d7db..71952579b32 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index fde5df2ca14..ff982e9d133 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c index a61fc5232d0..60f8385a5db 100644 --- a/source/blender/editors/util/editmode_undo.c +++ b/source/blender/editors/util/editmode_undo.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index cf60490055f..4c7831c589c 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -140,6 +140,8 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) undo_editmode_name(C, undoname); else undo_editmode_step(C, step); + + WM_event_add_notifier(C, NC_GEOM|ND_DATA, NULL); } } else { diff --git a/source/blender/editors/util/util_intern.h b/source/blender/editors/util/util_intern.h index 75475f4abef..73675ab4ef9 100644 --- a/source/blender/editors/util/util_intern.h +++ b/source/blender/editors/util/util_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h index 5dabaf91b1a..25e2aa2a26f 100644 --- a/source/blender/editors/uvedit/uvedit_intern.h +++ b/source/blender/editors/uvedit/uvedit_intern.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 8998b59b353..bc63d412046 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3223,7 +3223,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "UV_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "UV_OT_select_pinned", PKEY, KM_PRESS, KM_SHIFT, 0); - WM_keymap_add_item(keymap, "UV_OT_weld", WKEY, KM_PRESS, 0, 0); + WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_weldalign", WKEY, KM_PRESS, 0, 0); /* uv operations */ WM_keymap_add_item(keymap, "UV_OT_stitch", VKEY, KM_PRESS, 0, 0); diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index a77ef54b0b6..14c58496352 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -317,7 +317,7 @@ void IMB_antialias(struct ImBuf * ibuf); void IMB_filter(struct ImBuf *ibuf); void IMB_filterN(struct ImBuf *out, struct ImBuf *in); void IMB_filter_extend(struct ImBuf *ibuf, char *mask); -void IMB_makemipmap(struct ImBuf *ibuf, int use_filter, int SAT); +void IMB_makemipmap(struct ImBuf *ibuf, int use_filter); /** * diff --git a/source/blender/imbuf/intern/IMB_radiance_hdr.h b/source/blender/imbuf/intern/IMB_radiance_hdr.h index 18e8f0df376..325715906a0 100644 --- a/source/blender/imbuf/intern/IMB_radiance_hdr.h +++ b/source/blender/imbuf/intern/IMB_radiance_hdr.h @@ -1,7 +1,7 @@ /* * IMB_radiance_hdr.h * - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index 76ed0e2c61f..5692686a9bc 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -371,114 +371,21 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask) } } -#if 0 void IMB_makemipmap(ImBuf *ibuf, int use_filter) { - ImBuf *hbuf= ibuf; - int minsize, curmap=0; - - minsize= ibuf->x<ibuf->y?ibuf->x:ibuf->y; - - while(minsize>10 && curmap<IB_MIPMAP_LEVELS) { - if(use_filter) { + ImBuf *hbuf = ibuf; + int curmap = 0; + while (curmap < IB_MIPMAP_LEVELS) { + if (use_filter) { ImBuf *nbuf= IMB_allocImBuf(hbuf->x, hbuf->y, 32, IB_rect, 0); IMB_filterN(nbuf, hbuf); - ibuf->mipmap[curmap]= IMB_onehalf(nbuf); + ibuf->mipmap[curmap] = IMB_onehalf(nbuf); IMB_freeImBuf(nbuf); } - else { - ibuf->mipmap[curmap]= IMB_onehalf(hbuf); - } - hbuf= ibuf->mipmap[curmap]; - + else ibuf->mipmap[curmap] = IMB_onehalf(hbuf); + hbuf = ibuf->mipmap[curmap]; + if (hbuf->x == 1 && hbuf->y == 1) break; curmap++; - minsize= hbuf->x<hbuf->y?hbuf->x:hbuf->y; } } -#endif -void IMB_makemipmap(ImBuf *ibuf, int use_filter, int SAT) -{ - if (SAT) { - // to maximize precision subtract image average, use intermediate double SAT, - // only convert to float at the end - const double dv = 1.0/255.0; - double avg[4] = {0, 0, 0, 0}; - const int x4 = ibuf->x << 2; - int x, y, i; - ImBuf* sbuf = IMB_allocImBuf(ibuf->x, ibuf->y, 32, IB_rectfloat, 0); - double *satp, *satbuf = MEM_callocN(sizeof(double)*ibuf->x*ibuf->y*4, "tmp SAT buf"); - const double mf = ibuf->x*ibuf->y; - float* fp; - ibuf->mipmap[0] = sbuf; - if (ibuf->rect_float) { - fp = ibuf->rect_float; - for (y=0; y<ibuf->y; ++y) - for (x=0; x<ibuf->x; ++x) { - avg[0] += *fp++; - avg[1] += *fp++; - avg[2] += *fp++; - avg[3] += *fp++; - } - } - else { - char* cp = (char*)ibuf->rect; - for (y=0; y<ibuf->y; ++y) - for (x=0; x<ibuf->x; ++x) { - avg[0] += *cp++ * dv; - avg[1] += *cp++ * dv; - avg[2] += *cp++ * dv; - avg[3] += *cp++ * dv; - } - } - avg[0] /= mf; - avg[1] /= mf; - avg[2] /= mf; - avg[3] /= mf; - for (y=0; y<ibuf->y; ++y) - for (x=0; x<ibuf->x; ++x) { - const unsigned int p = (x + y*ibuf->x) << 2; - char* cp = (char*)ibuf->rect + p; - fp = ibuf->rect_float + p; - satp = satbuf + p; - for (i=0; i<4; ++i, ++cp, ++fp, ++satp) { - double sv = (ibuf->rect_float ? (double)*fp : (double)(*cp)*dv) - avg[i]; - if (x > 0) sv += satp[-4]; - if (y > 0) sv += satp[-x4]; - if (x > 0 && y > 0) sv -= satp[-x4 - 4]; - *satp = sv; - } - } - fp = sbuf->rect_float; - satp = satbuf; - for (y=0; y<ibuf->y; ++y) - for (x=0; x<ibuf->x; ++x) { - *fp++ = (float)*satp++; - *fp++ = (float)*satp++; - *fp++ = (float)*satp++; - *fp++ = (float)*satp++; - } - MEM_freeN(satbuf); - fp = &sbuf->rect_float[(sbuf->x - 1 + (sbuf->y - 1)*sbuf->x) << 2]; - fp[0] = avg[0]; - fp[1] = avg[1]; - fp[2] = avg[2]; - fp[3] = avg[3]; - } - else { - ImBuf *hbuf = ibuf; - int curmap = 0; - while (curmap < IB_MIPMAP_LEVELS) { - if (use_filter) { - ImBuf *nbuf= IMB_allocImBuf(hbuf->x, hbuf->y, 32, IB_rect, 0); - IMB_filterN(nbuf, hbuf); - ibuf->mipmap[curmap] = IMB_onehalf(nbuf); - IMB_freeImBuf(nbuf); - } - else ibuf->mipmap[curmap] = IMB_onehalf(hbuf); - hbuf = ibuf->mipmap[curmap]; - if (hbuf->x == 1 && hbuf->y == 1) break; - curmap++; - } - } -} diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c index 5352f17b49e..570d8961758 100644 --- a/source/blender/imbuf/intern/radiance_hdr.c +++ b/source/blender/imbuf/intern/radiance_hdr.c @@ -1,7 +1,7 @@ /* * radiance_hdr.c * - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 7ee31ff7d9a..5a31a705591 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -62,13 +62,13 @@ * Local declarations. * ***********************/ /* Reading and writing of an in-memory TIFF file. */ -tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n); -tsize_t imb_tiff_WriteProc(thandle_t handle, tdata_t data, tsize_t n); -toff_t imb_tiff_SeekProc(thandle_t handle, toff_t ofs, int whence); -int imb_tiff_CloseProc(thandle_t handle); -toff_t imb_tiff_SizeProc(thandle_t handle); -int imb_tiff_DummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize); -void imb_tiff_DummyUnmapProc(thandle_t fd, tdata_t base, toff_t size); +static tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n); +static tsize_t imb_tiff_WriteProc(thandle_t handle, tdata_t data, tsize_t n); +static toff_t imb_tiff_SeekProc(thandle_t handle, toff_t ofs, int whence); +static int imb_tiff_CloseProc(thandle_t handle); +static toff_t imb_tiff_SizeProc(thandle_t handle); +static int imb_tiff_DummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize); +static void imb_tiff_DummyUnmapProc(thandle_t fd, tdata_t base, toff_t size); /* Structure for in-memory TIFF file. */ @@ -86,11 +86,11 @@ struct ImbTIFFMemFile { *****************************/ -void imb_tiff_DummyUnmapProc(thandle_t fd, tdata_t base, toff_t size) +static void imb_tiff_DummyUnmapProc(thandle_t fd, tdata_t base, toff_t size) { } -int imb_tiff_DummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize) +static int imb_tiff_DummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize) { return (0); } @@ -105,7 +105,7 @@ int imb_tiff_DummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize) * @return: Number of bytes actually read. * 0 = EOF. */ -tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n) +static tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n) { tsize_t nRemaining, nCopy; struct ImbTIFFMemFile* mfile; @@ -147,7 +147,7 @@ tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n) * NOTE: The current Blender implementation should not need this function. It * is simply a stub. */ -tsize_t imb_tiff_WriteProc(thandle_t handle, tdata_t data, tsize_t n) +static tsize_t imb_tiff_WriteProc(thandle_t handle, tdata_t data, tsize_t n) { printf("imb_tiff_WriteProc: this function should not be called.\n"); return (-1); @@ -169,7 +169,7 @@ tsize_t imb_tiff_WriteProc(thandle_t handle, tdata_t data, tsize_t n) * @return: Resulting offset location within the file, measured in bytes from * the beginning of the file. (-1) indicates an error. */ -toff_t imb_tiff_SeekProc(thandle_t handle, toff_t ofs, int whence) +static toff_t imb_tiff_SeekProc(thandle_t handle, toff_t ofs, int whence) { struct ImbTIFFMemFile *mfile; toff_t new_offset; @@ -216,7 +216,7 @@ toff_t imb_tiff_SeekProc(thandle_t handle, toff_t ofs, int whence) * * @return: 0 */ -int imb_tiff_CloseProc(thandle_t handle) +static int imb_tiff_CloseProc(thandle_t handle) { struct ImbTIFFMemFile *mfile; @@ -242,7 +242,7 @@ int imb_tiff_CloseProc(thandle_t handle) * * @return: Size of file (in bytes). */ -toff_t imb_tiff_SizeProc(thandle_t handle) +static toff_t imb_tiff_SizeProc(thandle_t handle) { struct ImbTIFFMemFile* mfile; diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index d2755f71fa3..8c2fc7db390 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -73,6 +73,7 @@ typedef enum eFModifier_Types { FMODIFIER_TYPE_FILTER, /* unimplemented - for applying: fft, high/low pass filters, etc. */ FMODIFIER_TYPE_PYTHON, FMODIFIER_TYPE_LIMITS, + FMODIFIER_TYPE_STEPPED, /* NOTE: all new modifiers must be added above this line */ FMODIFIER_NUM_TYPES @@ -211,6 +212,7 @@ typedef enum eFMod_Limit_Flags { FCM_LIMIT_YMAX = (1<<3), } eFMod_Limit_Flags; + /* noise modifier data */ typedef struct FMod_Noise { float size; @@ -230,6 +232,24 @@ typedef enum eFMod_Noise_Modifications { FCM_NOISE_MODIF_MULTIPLY, /* Multiply the curve by noise */ } eFMod_Noise_Modifications; + +/* stepped modifier data */ +typedef struct FMod_Stepped { + float step_size; /* Number of frames each interpolated value should be held */ + float offset; /* Reference frame number that stepping starts from */ + + float start_frame; /* start frame of the frame range that modifier works in */ + float end_frame; /* end frame of the frame range that modifier works in */ + + int flag; /* various settings */ +} FMod_Stepped; + +/* stepped modifier range flags */ +typedef enum eFMod_Stepped_Flags { + FCM_STEPPED_NO_BEFORE = (1<<0), /* don't affect frames before the start frame */ + FCM_STEPPED_NO_AFTER = (1<<1), /* don't affect frames after the end frame */ +} eFMod_Stepped_Flags; + /* Drivers -------------------------------------- */ /* Driver Target (dtar) @@ -581,6 +601,7 @@ typedef enum eNlaStrip_Flag { /* strip influence is controlled by local F-Curve */ NLASTRIP_FLAG_USR_INFLUENCE = (1<<5), NLASTRIP_FLAG_USR_TIME = (1<<6), + NLASTRIP_FLAG_USR_TIME_CYCLIC = (1<<7), /* NLA strip length is synced to the length of the referenced action */ NLASTRIP_FLAG_SYNC_LENGTH = (1<<9), @@ -663,20 +684,19 @@ typedef enum eNlaTrack_Flag { typedef struct KS_Path { struct KS_Path *next, *prev; - /* absolute paths only */ ID *id; /* ID block that keyframes are for */ char group[64]; /* name of the group to add to */ - /* relative paths only */ int idtype; /* ID-type that path can be used on */ - int templates; /* Templates that will be encountered in the path (as set of bitflags) */ - /* all paths */ + short groupmode; /* group naming (eKSP_Grouping) */ + short pad; + char *rna_path; /* dynamically (or statically in the case of predefined sets) path */ int array_index; /* index that path affects */ short flag; /* various settings, etc. */ - short groupmode; /* group naming (eKSP_Grouping) */ + short keyingflag; /* settings to supply insertkey() with */ } KS_Path; /* KS_Path->flag */ @@ -734,6 +754,7 @@ typedef struct KeyingSet { ListBase paths; /* (KS_Path) paths to keyframe to */ char name[64]; /* user-viewable name for KeyingSet (for menus, etc.) */ + char typeinfo[64]; /* name of the typeinfo data used for the relative paths */ short flag; /* settings for KeyingSet */ short keyingflag; /* settings to supply insertkey() with */ diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index 163c8122fb7..14930f85e63 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -86,6 +86,7 @@ typedef struct Brush { #define BRUSH_SMOOTH_STROKE 2048 #define BRUSH_PERSISTENT 4096 #define BRUSH_ACCUMULATE 8192 +#define BRUSH_LOCK_ALPHA 16384 /* Brush.sculpt_tool */ #define SCULPT_TOOL_DRAW 1 diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 6e837588f0c..358cbb6e34c 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -208,6 +208,12 @@ typedef struct bSizeLikeConstraint { char subtarget[32]; } bSizeLikeConstraint; +/* Maintain Volume Constraint */ +typedef struct bSameVolumeConstraint { + int flag; + float volume; +} bSameVolumeConstraint; + /* Copy Transform Constraint */ typedef struct bTransLikeConstraint { Object *tar; @@ -412,6 +418,7 @@ typedef enum eBConstraint_Types { CONSTRAINT_TYPE_DAMPTRACK, /* New Tracking constraint that minimises twisting */ CONSTRAINT_TYPE_SPLINEIK, /* Spline-IK - Align 'n' bones to a curve */ CONSTRAINT_TYPE_TRANSLIKE, /* Copy transform matrix */ + CONSTRAINT_TYPE_SAMEVOL, /* Maintain volume during scaling */ /* NOTE: no constraints are allowed to be added after this */ NUM_CONSTRAINT_TYPES @@ -499,6 +506,13 @@ typedef enum eCopyScale_Flags { SIZELIKE_OFFSET = (1<<3), } eCopyScale_Flags; +/* bSameVolumeConstraint.flag */ +typedef enum eSameVolume_Modes { + SAMEVOL_X = 0, + SAMEVOL_Y, + SAMEVOL_Z, +} eSameVolume_Modes; + /* Locked-Axis Values (Locked Track) */ typedef enum eLockAxis_Modes { LOCK_X = 0, diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index cd002894c5d..82418899172 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -243,6 +243,7 @@ typedef struct Curve { #define CU_RETOPO 1024 #define CU_DS_EXPAND 2048 #define CU_PATH_RADIUS 4096 /* make use of the path radius if this is enabled (default for new curves) */ +#define CU_DEFORM_FILL 8192 /* fill 2d curve after deformation */ /* twist mode */ #define CU_TWIST_Z_UP 0 @@ -287,7 +288,9 @@ typedef struct Curve { /* flagu flagv (nurb) */ -#define CU_CYCLIC 1 +#define CU_NURB_CYCLIC 1 +#define CU_NURB_ENDPOINT 2 +#define CU_NURB_BEZIER 4 /* *************** BEZTRIPLE **************** */ diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 4dd089949e9..c587b2106ff 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -22,7 +22,7 @@ * * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): Bob Holcomb, Xavier Thomas * * ***** END GPL LICENSE BLOCK ***** */ @@ -250,6 +250,7 @@ typedef struct NodeChroma { float t1,t2,t3; float fsize,fstrength,falpha; float key[4]; + short algorithm, channel; } NodeChroma; typedef struct NodeTwoXYs { @@ -312,6 +313,12 @@ typedef struct NodeColorBalance { float gain[3]; } NodeColorBalance; +typedef struct NodeColorspill { + short limchan, unspill; + float limscale; + float uspillr, uspillg, uspillb; +}NodeColorspill; + /* TEX_output */ typedef struct TexNodeOutput { char name[32]; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 817e97819bb..bae6a1f1c8a 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -188,12 +188,11 @@ typedef struct SceneRenderLayer { #define SCE_PASS_REFRACT 1024 #define SCE_PASS_INDEXOB 2048 #define SCE_PASS_UV 4096 -#define SCE_PASS_RADIO 8192 /* Radio removed, can use for new GI? */ +#define SCE_PASS_INDIRECT 8192 #define SCE_PASS_MIST 16384 #define SCE_PASS_RAYHITS 32768 #define SCE_PASS_EMIT 65536 #define SCE_PASS_ENVIRONMENT 131072 -#define SCE_PASS_INDIRECT 262144 /* note, srl->passflag is treestore element 'nr' in outliner, short still... */ @@ -366,6 +365,12 @@ typedef struct RenderData { float fg_stamp[4]; float bg_stamp[4]; + /* sequencer options */ + char seq_prev_type; + char seq_rend_type; + char seq_flag; /* flag use for sequence render/draw */ + char pad5[5]; + /* render simplify */ int simplify_flag; short simplify_subsurf; @@ -845,6 +850,10 @@ typedef struct Scene { #define R_SIMPLIFY 0x1000000 #define R_EDGE_FRS 0x2000000 /* R_EDGE for Freestyle */ +/* seq_flag */ +#define R_SEQ_GL_PREV 1 +#define R_SEQ_GL_REND 2 + /* displaymode */ #define R_OUTPUT_SCREEN 0 @@ -986,6 +995,9 @@ typedef struct Scene { /* simplify_flag */ #define R_SIMPLE_NO_TRIANGULATE 1 +/* sequencer seq_prev_type seq_rend_type */ + + /* **************** SCENE ********************* */ /* for general use */ diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 56d949e9d34..1a73588d6eb 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -275,8 +275,6 @@ typedef struct SpeedControlVars { #define SEQ_USE_PROXY_CUSTOM_FILE 2097152 #define SEQ_USE_EFFECT_DEFAULT_FADE 4194304 -#define SEQ_USE_SCENE_OPENGL 8388608 - /* deprecated, dont use a flag anymore*/ /*#define SEQ_ACTIVE 1048576*/ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 293eac3c5a5..0ea64765198 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -168,15 +168,16 @@ typedef struct FileSelectParams { /* XXX - temporary, better move to filelist */ short active_bookmark; + int active_file; int selstate; /* short */ /* XXX --- still unused -- */ short f_fp; /* show font preview */ - short menu; /* currently selected option in pupmenu */ + short pad; char fp_str[8]; /* string to use for font preview */ - char *pupmenu; /* allows menu for save options - result stored in menup */ + /* XXX --- end unused -- */ } FileSelectParams; diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index 3212ff7b534..5d80936d2cc 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -335,8 +335,6 @@ typedef struct TexMapping { #define TXF_EWA 1 #define TXF_FELINE 2 #define TXF_AREA 3 -// TXF_SAT only available when mipmaps disabled -#define TXF_SAT 4 /* imaflag unused, only for version check */ #define TEX_FIELDS_ 8 diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 24d7837b6ed..4ebc2594c8f 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -200,13 +200,17 @@ typedef struct ThemeSpace { char bone_solid[4], bone_pose[4]; char strip[4], strip_select[4]; char cframe[4]; + char nurb_uline[4], nurb_vline[4]; + char act_spline[4], nurb_sel_uline[4], nurb_sel_vline[4]; + char handle_free[4], handle_auto[4], handle_vect[4], handle_align[4]; + char handle_sel_free[4], handle_sel_auto[4], handle_sel_vect[4], handle_sel_align[4]; char ds_channel[4], ds_subchannel[4]; // dopesheet char console_output[4], console_input[4], console_info[4], console_error[4]; char console_cursor[4]; char vertex_size, facedot_size; - char bpad[2]; + char bpad[6]; char syntaxl[4], syntaxn[4], syntaxb[4]; // syntax for textwindow and nodes char syntaxv[4], syntaxc[4]; @@ -450,6 +454,7 @@ extern UserDef U; /* from blenkernel blender.c */ #define USER_CONTINUOUS_MOUSE (1 << 24) #define USER_ZOOM_INVERT (1 << 25) #define USER_ZOOM_DOLLY_HORIZ (1 << 26) +#define USER_SPLASH_DISABLE (1 << 27) /* Auto-Keying mode */ /* AUTOKEY_ON is a bitflag */ diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 12849d02d97..60aba105ff4 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -247,6 +247,7 @@ typedef struct View3D { #define RV3D_VIEW_CAMERA 8 /* View3d->flag2 (short) */ +#define V3D_RENDER_OVERRIDE 4 #define V3D_SOLID_TEX 8 #define V3D_DISPGP 16 diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 9b762ed930a..f9e3b0620b6 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -217,6 +217,7 @@ extern StructRNA RNA_FModifierGenerator; extern StructRNA RNA_FModifierLimits; extern StructRNA RNA_FModifierNoise; extern StructRNA RNA_FModifierPython; +extern StructRNA RNA_FModifierStepped; extern StructRNA RNA_FollowPathConstraint; extern StructRNA RNA_FreestyleModuleSettings; extern StructRNA RNA_Function; @@ -258,6 +259,7 @@ extern StructRNA RNA_KeyConfig; extern StructRNA RNA_Keyframe; extern StructRNA RNA_KeyingSet; extern StructRNA RNA_KeyingSetPath; +extern StructRNA RNA_KeyingSetInfo; extern StructRNA RNA_KeyMap; extern StructRNA RNA_KeyMapItem; extern StructRNA RNA_KinematicConstraint; diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index 231ab766d6c..9ccab8394e9 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -84,6 +84,8 @@ extern EnumPropertyItem wm_report_items[]; extern EnumPropertyItem property_type_items[]; extern EnumPropertyItem property_unit_items[]; +extern EnumPropertyItem viewport_shading_items[]; + struct bContext; struct PointerRNA; EnumPropertyItem *rna_TransformOrientation_itemf(struct bContext *C, struct PointerRNA *ptr, int *free); diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 178cdacf3c3..77eff6ad4c5 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -334,6 +334,7 @@ typedef struct ExtensionRNA { #define MainMaterials Main #define MainMeshes Main #define MainLamps Main +#define MainImages Main #define MainObjects Main #define MainTexts Main #define MainActions Main diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 15d5658160d..6d3d78907f1 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -846,6 +846,98 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA * return func; } +static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc, char *nextfunc) +{ + char *func; + + if(prop->flag & PROP_IDPROPERTY) + return NULL; + + if(!manualfunc) { + if(!dp->dnastructname || !dp->dnaname) + return NULL; + + /* only supported in case of standard next functions */ + if(strcmp(nextfunc, "rna_iterator_array_next") == 0); + else if(strcmp(nextfunc, "rna_iterator_listbase_next") == 0); + else return NULL; + } + + func= rna_alloc_function_name(srna->identifier, prop->identifier, "lookup_int"); + + fprintf(f, "PointerRNA %s(PointerRNA *ptr, int index)\n", func); + fprintf(f, "{\n"); + + if(manualfunc) { + fprintf(f, "\n return %s(ptr, index);\n", manualfunc); + fprintf(f, "}\n\n"); + return func; + } + + fprintf(f, " PointerRNA r_ptr;\n"); + fprintf(f, " CollectionPropertyIterator iter;\n\n"); + + fprintf(f, " %s_%s_begin(&iter, ptr);\n\n", srna->identifier, prop->identifier); + fprintf(f, " {\n"); + + if(strcmp(nextfunc, "rna_iterator_array_next") == 0) { + fprintf(f, " ArrayIterator *internal= iter.internal;\n"); + fprintf(f, " if(internal->skip) {\n"); + fprintf(f, " while(index-- > 0) {\n"); + fprintf(f, " do {\n"); + fprintf(f, " internal->ptr += internal->itemsize;\n"); + fprintf(f, " } while(internal->skip(&iter, internal->ptr));\n"); + fprintf(f, " }\n"); + fprintf(f, " }\n"); + fprintf(f, " else {\n"); + fprintf(f, " internal->ptr += internal->itemsize*index;\n"); + fprintf(f, " }\n"); + } + else if(strcmp(nextfunc, "rna_iterator_listbase_next") == 0) { + fprintf(f, " ListBaseIterator *internal= iter.internal;\n"); + fprintf(f, " if(internal->skip) {\n"); + fprintf(f, " while(index-- > 0) {\n"); + fprintf(f, " do {\n"); + fprintf(f, " internal->link= internal->link->next;\n"); + fprintf(f, " } while(internal->skip(&iter, internal->link));\n"); + fprintf(f, " }\n"); + fprintf(f, " }\n"); + fprintf(f, " else {\n"); + fprintf(f, " while(index-- > 0)\n"); + fprintf(f, " internal->link= internal->link->next;\n"); + fprintf(f, " }\n"); + } + + fprintf(f, " }\n\n"); + + fprintf(f, " r_ptr = %s_%s_get(&iter);\n", srna->identifier, prop->identifier); + fprintf(f, " %s_%s_end(&iter);\n\n", srna->identifier, prop->identifier); + + fprintf(f, " return r_ptr;\n"); + +#if 0 + rna_print_data_get(f, dp); + item_type= (cprop->item_type)? (char*)cprop->item_type: "UnknownType"; + + if(dp->dnalengthname || dp->dnalengthfixed) { + if(dp->dnalengthname) + fprintf(f, "\n rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), data->%s, index);\n", item_type, dp->dnaname, dp->dnaname, dp->dnalengthname); + else + fprintf(f, "\n rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), %d, index);\n", item_type, dp->dnaname, dp->dnaname, dp->dnalengthfixed); + } + else { + if(dp->dnapointerlevel == 0) + fprintf(f, "\n return rna_listbase_lookup_int(ptr, &RNA_%s, &data->%s, index);\n", item_type, dp->dnaname); + else + fprintf(f, "\n return rna_listbase_lookup_int(ptr, &RNA_%s, data->%s, index);\n", item_type, dp->dnaname); + } +#endif + + fprintf(f, "}\n\n"); + + return func; +} + static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc) { char *func, *getfunc; @@ -1015,6 +1107,7 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) } case PROP_COLLECTION: { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; + char *nextfunc= (char*)cprop->next; if(dp->dnatype && strcmp(dp->dnatype, "ListBase")==0); else if(dp->dnalengthname || dp->dnalengthfixed) @@ -1031,6 +1124,7 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) cprop->begin= (void*)rna_def_property_begin_func(f, srna, prop, dp, (char*)cprop->begin); cprop->next= (void*)rna_def_property_next_func(f, srna, prop, dp, (char*)cprop->next); cprop->end= (void*)rna_def_property_end_func(f, srna, prop, dp, (char*)cprop->end); + cprop->lookupint= (void*)rna_def_property_lookup_int_func(f, srna, prop, dp, (char*)cprop->lookupint, nextfunc); if(!(prop->flag & PROP_IDPROPERTY)) { if(!cprop->begin) { diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 6bd99793933..672ca5d7b90 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -2736,6 +2736,12 @@ void rna_iterator_listbase_end(CollectionPropertyIterator *iter) iter->internal= NULL; } +PointerRNA rna_listbase_lookup_int(PointerRNA *ptr, StructRNA *type, struct ListBase *lb, int index) +{ + void *data= BLI_findlink(lb, index); + return rna_pointer_inherit_refine(ptr, type, data); +} + void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length, int free_ptr, IteratorSkipFunc skip) { ArrayIterator *internal; @@ -2800,6 +2806,14 @@ void rna_iterator_array_end(CollectionPropertyIterator *iter) iter->internal= NULL; } +PointerRNA rna_array_lookup_int(PointerRNA *ptr, StructRNA *type, void *data, int itemsize, int length, int index) +{ + if(index < 0 || index >= length) + return PointerRNA_NULL; + + return rna_pointer_inherit_refine(ptr, type, ((char*)data) + index*itemsize); +} + /* RNA Path - Experiment */ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int bracket) diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 0cb8ff39a89..c24b6b99c59 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -542,7 +542,7 @@ static void rna_def_property_actuator(BlenderRNA *brna) static void rna_def_constraint_actuator(BlenderRNA *brna) { StructRNA *srna; - PropertyRNA *prop; + /*PropertyRNA *prop; static EnumPropertyItem prop_type_items[] ={ {ACT_CONST_TYPE_LOC, "LOC", 0, "Location Constraint", ""}, @@ -550,7 +550,7 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) {ACT_CONST_TYPE_ORI, "ORI", 0, "Orientation Constraint", ""}, {ACT_CONST_TYPE_FH, "FH", 0, "Force Field Constraint", ""}, {0, NULL, 0, NULL, NULL} - }; + };*/ srna= RNA_def_struct(brna, "ConstraintActuator", "Actuator"); RNA_def_struct_ui_text(srna, "Constraint Actuator", "Actuator to .."); diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 453d9b9a844..ebb251c32ca 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -37,12 +37,13 @@ #include "MEM_guardedalloc.h" +#include "ED_keyframing.h" + /* exported for use in API */ EnumPropertyItem keyingset_path_grouping_items[] = { {KSP_GROUP_NAMED, "NAMED", 0, "Named Group", ""}, {KSP_GROUP_NONE, "NONE", 0, "None", ""}, {KSP_GROUP_KSNAME, "KEYINGSET", 0, "Keying Set Name", ""}, - {KSP_GROUP_TEMPLATE_ITEM, "TEMPLATE", 0, "Innermost Context-Item Name", ""}, {0, NULL, 0, NULL, NULL}}; #ifdef RNA_RUNTIME @@ -66,6 +67,152 @@ static void rna_AnimData_action_set(PointerRNA *ptr, PointerRNA value) /* ****************************** */ +/* wrapper for poll callback */ +static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C) +{ + PointerRNA ptr; + ParameterList list; + FunctionRNA *func; + void *ret; + int ok; + + RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr); + func= RNA_struct_find_function(&ptr, "poll"); + + RNA_parameter_list_create(&list, &ptr, func); + /* hook up arguments */ + RNA_parameter_set_lookup(&list, "ksi", &ksi); + RNA_parameter_set_lookup(&list, "context", &C); + + /* execute the function */ + ksi->ext.call(&ptr, func, &list); + + /* read the result */ + RNA_parameter_get_lookup(&list, "ok", &ret); + ok= *(int*)ret; + RNA_parameter_list_free(&list); + + return ok; +} + +/* wrapper for iterator callback */ +static void RKS_ITER_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks) +{ + PointerRNA ptr; + ParameterList list; + FunctionRNA *func; + + RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr); + func= RNA_struct_find_function(&ptr, "iterator"); + + RNA_parameter_list_create(&list, &ptr, func); + /* hook up arguments */ + RNA_parameter_set_lookup(&list, "ksi", &ksi); + RNA_parameter_set_lookup(&list, "context", &C); + RNA_parameter_set_lookup(&list, "ks", &ks); + + /* execute the function */ + ksi->ext.call(&ptr, func, &list); + RNA_parameter_list_free(&list); +} + +/* wrapper for generator callback */ +static void RKS_GEN_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks, PointerRNA *data) +{ + PointerRNA ptr; + ParameterList list; + FunctionRNA *func; + + RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr); + func= RNA_struct_find_function(&ptr, "generate"); + + RNA_parameter_list_create(&list, &ptr, func); + /* hook up arguments */ + RNA_parameter_set_lookup(&list, "ksi", &ksi); + RNA_parameter_set_lookup(&list, "context", &C); + RNA_parameter_set_lookup(&list, "ks", &ks); + RNA_parameter_set_lookup(&list, "data", data); + + /* execute the function */ + ksi->ext.call(&ptr, func, &list); + RNA_parameter_list_free(&list); +} + +/* ------ */ + +// XXX: the exact purpose of this is not too clear... maybe we want to revise this at some point? +static StructRNA *rna_KeyingSetInfo_refine(PointerRNA *ptr) +{ + KeyingSetInfo *ksi= (KeyingSetInfo *)ptr->data; + return (ksi->ext.srna)? ksi->ext.srna: &RNA_KeyingSetInfo; +} + +static void rna_KeyingSetInfo_unregister(const bContext *C, StructRNA *type) +{ + KeyingSetInfo *ksi= RNA_struct_blender_type_get(type); + + if (ksi == NULL) + return; + + /* free RNA data referencing this */ + RNA_struct_free_extension(type, &ksi->ext); + RNA_struct_free(&BLENDER_RNA, type); + + /* unlink Blender-side data */ + ANIM_keyingset_info_unregister(C, ksi); +} + +static StructRNA *rna_KeyingSetInfo_register(const bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +{ + KeyingSetInfo dummyksi = {0}; + KeyingSetInfo *ksi; + PointerRNA dummyptr; + int have_function[3]; + + /* setup dummy type info to store static properties in */ + // TODO: perhaps we want to get users to register as if they're using 'KeyingSet' directly instead? + RNA_pointer_create(NULL, &RNA_KeyingSetInfo, &dummyksi, &dummyptr); + + /* validate the python class */ + if (validate(&dummyptr, data, have_function) != 0) + return NULL; + + if (strlen(identifier) >= sizeof(dummyksi.name)) { + BKE_reportf(reports, RPT_ERROR, "registering keying set info class: '%s' is too long, maximum length is %d.", identifier, sizeof(dummyksi.name)); + return NULL; + } + + /* check if we have registered this info before, and remove it */ + ksi = ANIM_keyingset_info_find_named(dummyksi.name); + if (ksi && ksi->ext.srna) + rna_KeyingSetInfo_unregister(C, ksi->ext.srna); + + /* create a new KeyingSetInfo type */ + ksi= MEM_callocN(sizeof(KeyingSetInfo), "python keying set info"); + memcpy(ksi, &dummyksi, sizeof(KeyingSetInfo)); + + /* set RNA-extensions info */ + ksi->ext.srna= RNA_def_struct(&BLENDER_RNA, ksi->name, "KeyingSetInfo"); + ksi->ext.data= data; + ksi->ext.call= call; + ksi->ext.free= free; + RNA_struct_blender_type_set(ksi->ext.srna, ksi); + + /* set callbacks */ + // NOTE: we really should have all of these... + ksi->poll= (have_function[0])? RKS_POLL_rna_internal: NULL; + ksi->iter= (have_function[1])? RKS_ITER_rna_internal: NULL; + ksi->generate= (have_function[2])? RKS_GEN_rna_internal: NULL; + + /* add and register with other info as needed */ + ANIM_keyingset_info_register(C, ksi); + + /* return the struct-rna added */ + return ksi->ext.srna; +} + +/* ****************************** */ + static StructRNA *rna_ksPath_id_typef(PointerRNA *ptr) { KS_Path *ksp= (KS_Path*)ptr->data; @@ -123,6 +270,14 @@ static void rna_ksPath_RnaPath_set(PointerRNA *ptr, const char *value) /* ****************************** */ +static int rna_KeyingSet_typeinfo_name_editable(PointerRNA *ptr) +{ + KeyingSet *ks= (KeyingSet *)ptr->data; + + /* only editable if we're using relative paths */ + return ((ks->flag & KEYINGSET_ABSOLUTE)==0); +} + static int rna_KeyingSet_active_ksPath_editable(PointerRNA *ptr) { KeyingSet *ks= (KeyingSet *)ptr->data; @@ -167,6 +322,91 @@ static void rna_KeyingSet_active_ksPath_index_range(PointerRNA *ptr, int *min, i #else +/* helper function for Keying Set -> keying settings */ +static void rna_def_common_keying_flags(StructRNA *srna, short reg) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, "insertkey_needed", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_NEEDED); + RNA_def_property_ui_text(prop, "Insert Keyframes - Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves"); + if (reg) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + + prop= RNA_def_property(srna, "insertkey_visual", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_MATRIX); + RNA_def_property_ui_text(prop, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'"); + if (reg) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + + prop= RNA_def_property(srna, "insertkey_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_XYZ2RGB); + RNA_def_property_ui_text(prop, "F-Curve Colors - XYZ to RGB", "Color for newly added transformation F-Curves (Location, Rotation, Scale) and also Color is based on the transform axis"); + if (reg) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); +} + +/* --- */ + +static void rna_def_keyingset_info(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + FunctionRNA *func; + PropertyRNA *parm; + + srna= RNA_def_struct(brna, "KeyingSetInfo", NULL); + RNA_def_struct_sdna(srna, "KeyingSetInfo"); + RNA_def_struct_ui_text(srna, "Keying Set Info", "Callback function defines for relative Keying Sets"); + RNA_def_struct_refine_func(srna, "rna_KeyingSetInfo_refine"); + RNA_def_struct_register_funcs(srna, "rna_KeyingSetInfo_register", "rna_KeyingSetInfo_unregister"); + + /* Properties --------------------- */ + + RNA_define_verify_sdna(0); // not in sdna + + /* Name */ + prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_ui_text(prop, "Name", ""); + RNA_def_struct_name_property(srna, prop); + RNA_def_property_flag(prop, PROP_REGISTER); + + prop= RNA_def_property(srna, "bl_builtin", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "builtin", 1); + RNA_def_property_ui_text(prop, "BuiltIn", "Keying Set type is required internally."); + RNA_def_property_flag(prop, PROP_REGISTER); + + rna_def_common_keying_flags(srna, 1); /* '1' arg here is to indicate that we need these to be set on registering */ + + RNA_define_verify_sdna(1); + + /* Function Callbacks ------------- */ + /* poll */ + func= RNA_def_function(srna, "poll", NULL); + RNA_def_function_ui_description(func, "Test if Keying Set can be used or not"); + RNA_def_function_flag(func, FUNC_REGISTER); + RNA_def_function_return(func, RNA_def_boolean(func, "ok", 1, "", "")); + parm= RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + + /* iterator */ + func= RNA_def_function(srna, "iterator", NULL); + RNA_def_function_ui_description(func, "Call generate() on the structs which have properties to be keyframed"); + RNA_def_function_flag(func, FUNC_REGISTER); + parm= RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_pointer(func, "ks", "KeyingSet", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + + /* generate */ + func= RNA_def_function(srna, "generate", NULL); + RNA_def_function_ui_description(func, "Add Paths to the Keying Set to keyframe the properties of the given data"); + RNA_def_function_flag(func, FUNC_REGISTER); + parm= RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_pointer(func, "ks", "KeyingSet", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_pointer(func, "data", "AnyType", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); +} static void rna_def_keyingset_path(BlenderRNA *brna) { @@ -215,6 +455,9 @@ static void rna_def_keyingset_path(BlenderRNA *brna) prop= RNA_def_property(srna, "entire_array", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", KSP_FLAG_WHOLE_ARRAY); RNA_def_property_ui_text(prop, "Entire Array", "When an 'array/vector' type is chosen (Location, Rotation, Color, etc.), entire array is to be used"); + + /* Keyframing Settings */ + rna_def_common_keying_flags(srna, 0); } static void rna_def_keyingset(BlenderRNA *brna) @@ -230,6 +473,13 @@ static void rna_def_keyingset(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Name", ""); RNA_def_struct_name_property(srna, prop); + /* TypeInfo associated with Relative KeyingSet (only) */ + prop= RNA_def_property(srna, "typeinfo_name", PROP_STRING, PROP_NONE); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_string_sdna(prop, NULL, "typeinfo"); + RNA_def_property_editable_func(prop, "rna_KeyingSet_typeinfo_name_editable"); + RNA_def_property_ui_text(prop, "TypeInfo Name", ""); + /* Paths */ prop= RNA_def_property(srna, "paths", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "paths", NULL); @@ -249,28 +499,13 @@ static void rna_def_keyingset(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Active Path Index", "Current Keying Set index"); /* Flags */ - // XXX: depreceated - prop= RNA_def_property(srna, "builtin", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYINGSET_BUILTIN); - RNA_def_property_ui_text(prop, "Built-In", "Keying Set is a built-in to Blender"); - prop= RNA_def_property(srna, "absolute", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYINGSET_ABSOLUTE); RNA_def_property_ui_text(prop, "Absolute", "Keying Set defines specific paths/settings to be keyframed (i.e. is not reliant on context info)"); /* Keyframing Flags */ - prop= RNA_def_property(srna, "insertkey_needed", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_NEEDED); - RNA_def_property_ui_text(prop, "Insert Keyframes - Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves"); - - prop= RNA_def_property(srna, "insertkey_visual", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_MATRIX); - RNA_def_property_ui_text(prop, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'"); + rna_def_common_keying_flags(srna, 0); - prop= RNA_def_property(srna, "insertkey_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_XYZ2RGB); - RNA_def_property_ui_text(prop, "F-Curve Colors - XYZ to RGB", "Color for newly added transformation F-Curves (Location, Rotation, Scale) and also Color is based on the transform axis"); /* Keying Set API */ RNA_api_keyingset(srna); @@ -347,6 +582,7 @@ void RNA_def_animation(BlenderRNA *brna) rna_def_keyingset(brna); rna_def_keyingset_path(brna); + rna_def_keyingset_info(brna); } #endif diff --git a/source/blender/makesrna/intern/rna_animation_api.c b/source/blender/makesrna/intern/rna_animation_api.c index b07f147ac96..659a30792bb 100644 --- a/source/blender/makesrna/intern/rna_animation_api.c +++ b/source/blender/makesrna/intern/rna_animation_api.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -41,10 +41,11 @@ #include "BKE_animsys.h" -static void rna_KeyingSet_add_path(KeyingSet *keyingset, ReportList *reports, +static KS_Path *rna_KeyingSet_add_path(KeyingSet *keyingset, ReportList *reports, ID *id, char rna_path[], int array_index, int entire_array, int grouping_method, char group_name[]) { + KS_Path *ksp = NULL; short flag = 0; /* validate flags */ @@ -53,12 +54,31 @@ static void rna_KeyingSet_add_path(KeyingSet *keyingset, ReportList *reports, /* if data is valid, call the API function for this */ if (keyingset) { - BKE_keyingset_add_path(keyingset, id, group_name, rna_path, array_index, flag, grouping_method); + ksp= BKE_keyingset_add_path(keyingset, id, group_name, rna_path, array_index, flag, grouping_method); keyingset->active_path= BLI_countlist(&keyingset->paths); } else { BKE_report(reports, RPT_ERROR, "Keying Set Path could not be added."); } + + /* return added path */ + return ksp; +} + +static void rna_KeyingSet_remove_path(KeyingSet *keyingset, ReportList *reports, KS_Path *ksp) +{ + /* if data is valid, call the API function for this */ + if (keyingset && ksp) { + /* remove the active path from the KeyingSet */ + BKE_keyingset_free_path(keyingset, ksp); + + /* the active path number will most likely have changed */ + // TODO: we should get more fancy and actually check if it was removed, but this will do for now + keyingset->active_path = 0; + } + else { + BKE_report(reports, RPT_ERROR, "Keying Set Path could not be removed."); + } } #else @@ -68,10 +88,13 @@ void RNA_api_keyingset(StructRNA *srna) FunctionRNA *func; PropertyRNA *parm; - /* Add Destination */ + /* Add Path */ func= RNA_def_function(srna, "add_path", "rna_KeyingSet_add_path"); - RNA_def_function_ui_description(func, "Add a new destination for the Keying Set."); + RNA_def_function_ui_description(func, "Add a new path for the Keying Set."); RNA_def_function_flag(func, FUNC_USE_REPORTS); + /* return arg */ + parm= RNA_def_pointer(func, "ksp", "KeyingSetPath", "New Path", "Path created and added to the Keying Set"); + RNA_def_function_return(func, parm); /* ID-block for target */ parm= RNA_def_pointer(func, "target_id", "ID", "Target ID", "ID-Datablock for the destination."); RNA_def_property_flag(parm, PROP_REQUIRED); @@ -84,6 +107,14 @@ void RNA_api_keyingset(StructRNA *srna) /* grouping */ parm=RNA_def_enum(func, "grouping_method", keyingset_path_grouping_items, KSP_GROUP_KSNAME, "Grouping Method", "Method used to define which Group-name to use."); parm=RNA_def_string(func, "group_name", "", 64, "Group Name", "Name of Action Group to assign destination to (only if grouping mode is to use this name)."); + + /* Remove Path */ + func= RNA_def_function(srna, "remove_path", "rna_KeyingSet_remove_path"); + RNA_def_function_ui_description(func, "Remove the given path from the Keying Set."); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + /* path to remove */ + parm= RNA_def_pointer(func, "path", "KeyingSetPath", "Path", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } #endif diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 2d81a9d66c1..df08dc7b861 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -279,6 +279,12 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FIXED_TEX); RNA_def_property_ui_text(prop, "Fixed Texture", "Keep texture origin in fixed position"); RNA_def_property_update(prop, 0, "rna_Brush_update"); */ + + /* only for projection paint, TODO, other paint modes */ + prop= RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BRUSH_LOCK_ALPHA); + RNA_def_property_ui_text(prop, "Alpha", "When this is disabled, lock alpha while painting"); + RNA_def_property_update(prop, 0, "rna_Brush_update"); prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index ee19bce6435..dc395e6ccc3 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -32,7 +32,21 @@ #ifdef RNA_RUNTIME +#include "RNA_access.h" + +#include "DNA_material_types.h" +#include "DNA_node_types.h" + +#include "MEM_guardedalloc.h" + #include "BKE_colortools.h" +#include "BKE_depsgraph.h" +#include "BKE_node.h" + +#include "WM_api.h" +#include "WM_types.h" + +#include "ED_node.h" static int rna_CurveMapping_curves_length(PointerRNA *ptr) { @@ -113,6 +127,150 @@ static void rna_CurveMapping_clipmaxy_range(PointerRNA *ptr, float *min, float * *max= 100.0f; } + +static char *rna_ColorRamp_path(PointerRNA *ptr) +{ + /* handle the cases where a single datablock may have 2 ramp types */ + if (ptr->id.data) { + ID *id= ptr->id.data; + + switch (GS(id->name)) { + case ID_MA: /* material has 2 cases - diffuse and specular */ + { + Material *ma= (Material*)id; + + if (ptr->data == ma->ramp_col) + return BLI_strdup("diffuse_ramp"); + else if (ptr->data == ma->ramp_spec) + return BLI_strdup("specular_ramp"); + } + break; + } + } + + /* everything else just uses 'color_ramp' */ + return BLI_strdup("color_ramp"); +} + +static char *rna_ColorRampElement_path(PointerRNA *ptr) +{ + PointerRNA ramp_ptr; + PropertyRNA *prop; + char *path = NULL; + int index; + + /* helper macro for use here to try and get the path + * - this calls the standard code for getting a path to a texture... + */ +#define COLRAMP_GETPATH \ +{ \ +prop= RNA_struct_find_property(&ramp_ptr, "elements"); \ +if (prop) { \ +index= RNA_property_collection_lookup_index(&ramp_ptr, prop, ptr); \ +if (index >= 0) { \ +char *texture_path= rna_ColorRamp_path(&ramp_ptr); \ +path= BLI_sprintfN("%s.elements[%d]", texture_path, index); \ +MEM_freeN(texture_path); \ +} \ +} \ +} + + /* determine the path from the ID-block to the ramp */ + // FIXME: this is a very slow way to do it, but it will have to suffice... + if (ptr->id.data) { + ID *id= ptr->id.data; + + switch (GS(id->name)) { + case ID_MA: /* 2 cases for material - diffuse and spec */ + { + Material *ma= (Material *)id; + + /* try diffuse first */ + if (ma->ramp_col) { + RNA_pointer_create(id, &RNA_ColorRamp, ma->ramp_col, &ramp_ptr); + COLRAMP_GETPATH; + } + /* try specular if not diffuse */ + if (!path && ma->ramp_spec) { + RNA_pointer_create(id, &RNA_ColorRamp, ma->ramp_spec, &ramp_ptr); + COLRAMP_GETPATH; + } + } + break; + + // TODO: node trees need special attention + case ID_NT: + { + bNodeTree *ntree = (bNodeTree *)id; + bNode *node; + + for(node=ntree->nodes.first; node; node=node->next) { + if (ELEM3(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) { + RNA_pointer_create(id, &RNA_ColorRamp, node->storage, &ramp_ptr); + COLRAMP_GETPATH; + } + } + } + break; + + default: /* everything else should have a "color_ramp" property */ + { + /* create pointer to the ID block, and try to resolve "color_ramp" pointer */ + RNA_id_pointer_create(id, &ramp_ptr); + if (RNA_path_resolve(&ramp_ptr, "color_ramp", &ramp_ptr, &prop)) { + COLRAMP_GETPATH; + } + } + } + } + + /* cleanup the macro we defined */ +#undef COLRAMP_GETPATH + + return path; +} + +static void rna_ColorRamp_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + if (ptr->id.data) { + ID *id= ptr->id.data; + + switch (GS(id->name)) { + case ID_MA: + { + Material *ma= ptr->id.data; + + DAG_id_flush_update(&ma->id, 0); + WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, ma); + } + break; + case ID_NT: + { + bNodeTree *ntree = (bNodeTree *)id; + bNode *node; + + for(node=ntree->nodes.first; node; node=node->next) { + if (ELEM3(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) { + ED_node_generic_update(bmain, scene, ntree, node); + } + } + } + break; + case ID_TE: + { + Tex *tex= ptr->id.data; + + DAG_id_flush_update(&tex->id, 0); + WM_main_add_notifier(NC_TEXTURE, tex); + } + break; + default: + break; + } + } +} + + #else static void rna_def_curvemappoint(BlenderRNA *brna) @@ -229,6 +387,60 @@ static void rna_def_curvemapping(BlenderRNA *brna) RNA_def_property_float_funcs(prop, NULL, "rna_CurveMapping_white_level_set", NULL); } +static void rna_def_color_ramp_element(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "ColorRampElement", NULL); + RNA_def_struct_sdna(srna, "CBData"); + RNA_def_struct_path_func(srna, "rna_ColorRampElement_path"); + RNA_def_struct_ui_text(srna, "Color Ramp Element", "Element defining a color at a position in the color ramp"); + + prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "r"); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Color", ""); + RNA_def_property_update(prop, 0, "rna_ColorRamp_update"); + + prop= RNA_def_property(srna, "position", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "pos"); + RNA_def_property_range(prop, 0, 1); + RNA_def_property_ui_text(prop, "Position", ""); + RNA_def_property_update(prop, 0, "rna_ColorRamp_update"); +} + +static void rna_def_color_ramp(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem prop_interpolation_items[] = { + {1, "EASE", 0, "Ease", ""}, + {3, "CARDINAL", 0, "Cardinal", ""}, + {0, "LINEAR", 0, "Linear", ""}, + {2, "B_SPLINE", 0, "B-Spline", ""}, + {4, "CONSTANT", 0, "Constant", ""}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "ColorRamp", NULL); + RNA_def_struct_sdna(srna, "ColorBand"); + RNA_def_struct_path_func(srna, "rna_ColorRamp_path"); + RNA_def_struct_ui_text(srna, "Color Ramp", "Color ramp mapping a scalar value to a color"); + + prop= RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_COLOR); + RNA_def_property_collection_sdna(prop, NULL, "data", "tot"); + RNA_def_property_struct_type(prop, "ColorRampElement"); + RNA_def_property_ui_text(prop, "Elements", ""); + RNA_def_property_update(prop, 0, "rna_ColorRamp_update"); + + prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "ipotype"); + RNA_def_property_enum_items(prop, prop_interpolation_items); + RNA_def_property_ui_text(prop, "Interpolation", ""); + RNA_def_property_update(prop, 0, "rna_ColorRamp_update"); +} + static void rna_def_histogram(BlenderRNA *brna) { StructRNA *srna; @@ -243,6 +455,8 @@ void RNA_def_color(BlenderRNA *brna) rna_def_curvemappoint(brna); rna_def_curvemap(brna); rna_def_curvemapping(brna); + rna_def_color_ramp_element(brna); + rna_def_color_ramp(brna); rna_def_histogram(brna); } diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 65114804a3f..68a29fe9c83 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -50,6 +50,7 @@ EnumPropertyItem constraint_type_items[] ={ {CONSTRAINT_TYPE_LOCLIMIT, "LIMIT_LOCATION", ICON_CONSTRAINT_DATA, "Limit Location", ""}, {CONSTRAINT_TYPE_ROTLIMIT, "LIMIT_ROTATION", ICON_CONSTRAINT_DATA, "Limit Rotation", ""}, {CONSTRAINT_TYPE_SIZELIMIT, "LIMIT_SCALE", ICON_CONSTRAINT_DATA, "Limit Scale", ""}, + {CONSTRAINT_TYPE_SAMEVOL, "MAINTAIN_VOLUME", ICON_CONSTRAINT_DATA, "Maintain Volume", ""}, {CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", ICON_CONSTRAINT_DATA, "Transformation", ""}, {0, "", 0, "Tracking", ""}, {CONSTRAINT_TYPE_CLAMPTO, "CLAMP_TO", ICON_CONSTRAINT_DATA, "Clamp To", ""}, @@ -124,6 +125,8 @@ static StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr) return &RNA_CopyLocationConstraint; case CONSTRAINT_TYPE_SIZELIKE: return &RNA_CopyScaleConstraint; + case CONSTRAINT_TYPE_SAMEVOL: + return &RNA_MaintainVolumeConstraint; case CONSTRAINT_TYPE_PYTHON: return &RNA_PythonConstraint; case CONSTRAINT_TYPE_ACTION: @@ -813,6 +816,34 @@ static void rna_def_constraint_size_like(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } +static void rna_def_constraint_same_volume(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem volume_items[] = { + {SAMEVOL_X, "SAMEVOL_X", 0, "X", ""}, + {SAMEVOL_Y, "SAMEVOL_Y", 0, "Y", ""}, + {SAMEVOL_Z, "SAMEVOL_Z", 0, "Z", ""}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "MaintainVolumeConstraint", "Constraint"); + RNA_def_struct_ui_text(srna, "Maintain Volume Constraint", "Maintains a constant volume along a single scaling axis"); + RNA_def_struct_sdna_from(srna, "bSameVolumeConstraint", "data"); + + prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "flag"); + RNA_def_property_enum_items(prop, volume_items); + RNA_def_property_ui_text(prop, "Free Axis", "The free scaling axis of the object"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + + prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_range(prop, 0.001, 100.f); + RNA_def_property_ui_text(prop, "Volume", "Volume of the bone at rest"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + +} + static void rna_def_constraint_transform_like(BlenderRNA *brna) { StructRNA *srna; @@ -1897,6 +1928,7 @@ void RNA_def_constraint(BlenderRNA *brna) rna_def_constraint_locked_track(brna); rna_def_constraint_action(brna); rna_def_constraint_size_like(brna); + rna_def_constraint_same_volume(brna); rna_def_constraint_locate_like(brna); rna_def_constraint_rotate_like(brna); rna_def_constraint_transform_like(brna); diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 499423276ab..579ebfc9332 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -50,6 +50,14 @@ EnumPropertyItem beztriple_interpolation_mode_items[] = { {BEZT_IPO_BEZ, "BEZIER", 0, "Bezier", ""}, {0, NULL, 0, NULL, NULL}}; +EnumPropertyItem curve_type_items[] = { + {CU_POLY, "POLY", 0, "Poly", ""}, + {CU_BEZIER, "BEZIER", 0, "Bezier", ""}, + {CU_BSPLINE, "BSPLINE", 0, "BSpline", ""}, + {CU_CARDINAL, "CARDINAL", 0, "Cardinal", ""}, + {CU_NURBS, "NURBS", 0, "Ease", ""}, + {0, NULL, 0, NULL, NULL}}; + #ifdef RNA_RUNTIME #include "DNA_object_types.h" @@ -72,22 +80,6 @@ static StructRNA *rna_Curve_refine(PointerRNA *ptr) else return &RNA_Curve; } - -static PointerRNA rna_Curve_active_nurb_get(PointerRNA *ptr) -{ - Curve *cu= (Curve*)ptr->data; - Nurb *nu= NULL; - - if(cu->editnurb) - nu = BLI_findlink(cu->editnurb, cu->actnu); - - if(nu) - return rna_pointer_inherit_refine(ptr, &RNA_Spline, nu); - - return rna_pointer_inherit_refine(ptr, NULL, NULL); -} - - static void rna_BezTriple_handle1_get(PointerRNA *ptr, float *values) { BezTriple *bt= (BezTriple*)ptr->data; @@ -208,14 +200,17 @@ static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA rna_iterator_array_begin(iter, (void*)nu->bp, sizeof(BPoint), nu->pntsv>0 ? nu->pntsu*nu->pntsv : nu->pntsu, 0, NULL); } -static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Curve_update_data_id(Main *bmain, Scene *scene, ID *id) { - ID *id= ptr->id.data; - DAG_id_flush_update(id, OB_RECALC_DATA); WM_main_add_notifier(NC_GEOM|ND_DATA, id); } +static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + rna_Curve_update_data_id(bmain, scene, ptr->id.data); +} + static void rna_Curve_update_deps(Main *bmain, Scene *scene, PointerRNA *ptr) { DAG_scene_sort(scene); @@ -316,6 +311,119 @@ static void rna_Nurb_update_knot_v(Main *bmain, Scene *scene, PointerRNA *ptr) rna_Curve_update_data(bmain, scene, ptr); } +static void rna_Curve_spline_points_add(ID *id, Nurb *nu, bContext *C, ReportList *reports, int number) +{ + if(nu->type == CU_BEZIER) { + BKE_report(reports, RPT_ERROR, "Bezier spline can't have points added"); + } + else if(number==0) { + // do nothing + } else { + + addNurbPoints(nu, number); + + /* update */ + makeknots(nu, 1); + + rna_Curve_update_data_id(CTX_data_main(C), CTX_data_scene(C), id); + } +} + +static void rna_Curve_spline_bezpoints_add(ID *id, Nurb *nu, bContext *C, ReportList *reports, int number) +{ + if(nu->type != CU_BEZIER) { + BKE_report(reports, RPT_ERROR, "Only bezier splines can be added"); + } + else if(number==0) { + // do nothing + } else { + addNurbPointsBezier(nu, number); + + /* update */ + makeknots(nu, 1); + + rna_Curve_update_data_id(CTX_data_main(C), CTX_data_scene(C), id); + } +} + +static Nurb *rna_Curve_spline_new(Curve *cu, int type) +{ + Nurb *nu= ( Nurb * ) MEM_callocN( sizeof( Nurb ), "spline.new" ); + + if(type==CU_BEZIER) { + BezTriple *bezt= (BezTriple *)MEM_callocN(sizeof(BezTriple), "spline.new.bezt"); + bezt->radius= 1.0; + nu->bezt= bezt; + } + else { + BPoint *bp= (BPoint *)MEM_callocN(sizeof(BPoint), "spline.new.bp"); + bp->radius= 1.0f; + nu->bp= bp; + } + + nu->type= type; + nu->pntsu= 1; + nu->pntsv= 1; + + nu->orderu= nu->orderv= 4; + nu->resolu= nu->resolv= 12; + nu->flag= CU_SMOOTH; + + BLI_addtail(&cu->nurb, nu); + + return nu; +} + +static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, Nurb *nu) +{ + /* todo, check we're in the list */ + int found= 0; + if(cu->editnurb) { + found= BLI_remlink_safe(cu->editnurb, nu); + } + else { + found= BLI_remlink_safe(&cu->nurb, nu); + } + + if(!found) { + BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" does not contain spline given", cu->id.name+2); + return; + } + + freeNurb(nu); + /* invalidate pointer!, no can do */ +} + +static PointerRNA rna_Curve_active_spline_get(PointerRNA *ptr) +{ + Curve *cu= (Curve*)ptr->data; + Nurb *nu; + + if(cu->editnurb) + nu= BLI_findlink(cu->editnurb, cu->actnu); + else + nu= BLI_findlink(&cu->nurb, cu->actnu); // currently set to -1, should be changed to be allowed outside of editmode. + + if(nu) + return rna_pointer_inherit_refine(ptr, &RNA_Spline, nu); + + return rna_pointer_inherit_refine(ptr, NULL, NULL); +} + +static void rna_Curve_active_spline_set(PointerRNA *ptr, PointerRNA value) +{ + Curve *cu= (Curve*)ptr->data; + Nurb *nu= value.data; + + /* -1 is ok for an unset index */ + if(nu==NULL) + cu->actnu= -1; + else if(cu->editnurb) + cu->actnu= BLI_findindex(cu->editnurb, nu); + else + cu->actnu= BLI_findindex(&cu->nurb, nu); +} + #else static void rna_def_bpoint(BlenderRNA *brna) @@ -725,6 +833,100 @@ static void rna_def_text(BlenderRNA *brna) rna_def_nurbs(brna, srna); } + +/* curve.splines[0].points */ +static void rna_def_curve_spline_points(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + //PropertyRNA *prop; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "SplinePoints"); + srna= RNA_def_struct(brna, "SplinePoints", NULL); + RNA_def_struct_sdna(srna, "Nurb"); + RNA_def_struct_ui_text(srna, "Spline Points", "Collection of spline points"); + + func= RNA_def_function(srna, "add", "rna_Curve_spline_points_add"); + RNA_def_function_ui_description(func, "Add a number of points to this spline."); + RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_SELF_ID|FUNC_USE_REPORTS); + parm= RNA_def_int(func, "number", 1, INT_MIN, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX); + + /* + func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove"); + RNA_def_function_ui_description(func, "Remove a spline from a curve."); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED); + */ +} + +static void rna_def_curve_spline_bezpoints(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + //PropertyRNA *prop; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "SplineBezierPoints"); + srna= RNA_def_struct(brna, "SplineBezierPoints", NULL); + RNA_def_struct_sdna(srna, "Nurb"); + RNA_def_struct_ui_text(srna, "Spline Bezier Points", "Collection of spline bezirt points"); + + func= RNA_def_function(srna, "add", "rna_Curve_spline_bezpoints_add"); + RNA_def_function_ui_description(func, "Add a number of points to this spline."); + RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_SELF_ID|FUNC_USE_REPORTS); + parm= RNA_def_int(func, "number", 1, INT_MIN, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX); + + /* + func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove"); + RNA_def_function_ui_description(func, "Remove a spline from a curve."); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED); + */ +} + +/* curve.splines */ +static void rna_def_curve_splines(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + PropertyRNA *prop; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "CurveSplines"); + srna= RNA_def_struct(brna, "CurveSplines", NULL); + RNA_def_struct_sdna(srna, "Curve"); + RNA_def_struct_ui_text(srna, "Curve Splines", "Collection of curve splines"); + + func= RNA_def_function(srna, "new", "rna_Curve_spline_new"); + RNA_def_function_ui_description(func, "Add a new spline to the curve."); + parm= RNA_def_enum(func, "type", curve_type_items, CU_POLY, "", "type for the new spline."); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_pointer(func, "spline", "Spline", "", "The newly created spline."); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove"); + RNA_def_function_ui_description(func, "Remove a spline from a curve."); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_pointer_funcs(prop, "rna_Curve_active_spline_get", "rna_Curve_active_spline_set", NULL); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Active Spline", "Active curve spline"); + /* Could call: ED_base_object_activate(C, scene->basact); + * but would be a bad level call and it seems the notifier is enough */ + RNA_def_property_update(prop, NC_SCENE|ND_OB_ACTIVE, NULL); +} + + static void rna_def_curve(BlenderRNA *brna) { StructRNA *srna; @@ -757,12 +959,7 @@ static void rna_def_curve(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "nurb", NULL); RNA_def_property_struct_type(prop, "Spline"); RNA_def_property_ui_text(prop, "Splines", "Collection of splines in this curve data object"); - - prop= RNA_def_property(srna, "active_spline", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Spline"); - RNA_def_property_pointer_funcs(prop, "rna_Curve_active_nurb_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Active Spline", "The active editmode spline"); - + rna_def_curve_splines(brna, prop); prop= RNA_def_property(srna, "draw_handles", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", CU_HIDE_HANDLES); @@ -880,18 +1077,14 @@ static void rna_def_curve(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Twist Smooth", "Smoothing iteration for tangents"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); + prop= RNA_def_property(srna, "use_deform_fill", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_DEFORM_FILL); + RNA_def_property_ui_text(prop, "Fill deformed", "Fill curve after applying deformation"); + RNA_def_property_update(prop, 0, "rna_Curve_update_data"); } static void rna_def_curve_nurb(BlenderRNA *brna) { - static EnumPropertyItem curve_type_items[] = { - {CU_POLY, "POLY", 0, "Poly", ""}, - {CU_BEZIER, "BEZIER", 0, "Bezier", ""}, - {CU_BSPLINE, "BSPLINE", 0, "BSpline", ""}, - {CU_CARDINAL, "CARDINAL", 0, "Cardinal", ""}, - {CU_NURBS, "NURBS", 0, "Ease", ""}, - {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem spline_interpolation_items[] = { {BEZT_IPO_CONST, "LINEAR", 0, "Linear", ""}, {BEZT_IPO_LIN, "CARDINAL", 0, "Cardinal", ""}, @@ -911,11 +1104,13 @@ static void rna_def_curve_nurb(BlenderRNA *brna) RNA_def_property_struct_type(prop, "SplinePoint"); RNA_def_property_collection_funcs(prop, "rna_BPoint_array_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_Nurb_length", 0, 0); RNA_def_property_ui_text(prop, "Points", "Collection of points that make up this poly or nurbs spline"); + rna_def_curve_spline_points(brna, prop); prop= RNA_def_property(srna, "bezier_points", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "BezierSplinePoint"); RNA_def_property_collection_sdna(prop, NULL, "bezt", "pntsu"); RNA_def_property_ui_text(prop, "Bezier Points", "Collection of points for bezier curves only"); + rna_def_curve_spline_bezpoints(brna, prop); prop= RNA_def_property(srna, "tilt_interpolation", PROP_ENUM, PROP_NONE); @@ -978,34 +1173,34 @@ static void rna_def_curve_nurb(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Curve_update_data"); prop= RNA_def_property(srna, "cyclic_u", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_CYCLIC); + RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_CYCLIC); RNA_def_property_ui_text(prop, "Cyclic U", "Make this curve or surface a closed loop in the U direction"); RNA_def_property_update(prop, 0, "rna_Nurb_update_handle_data"); /* only needed for cyclic_u because cyclic_v cant do bezier */ prop= RNA_def_property(srna, "cyclic_v", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_CYCLIC); + RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_CYCLIC); RNA_def_property_ui_text(prop, "Cyclic V", "Make this surface a closed loop in the V direction"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); /* Note, endpoint and bezier flags should never be on at the same time! */ prop= RNA_def_property(srna, "endpoint_u", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flagu", 2); + RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_ENDPOINT); RNA_def_property_ui_text(prop, "Endpoint U", "Make this nurbs curve or surface meet the endpoints in the U direction (Cyclic U must be disabled)"); RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u"); prop= RNA_def_property(srna, "endpoint_v", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flagv", 2); + RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_ENDPOINT); RNA_def_property_ui_text(prop, "Endpoint V", "Make this nurbs surface meet the endpoints in the V direction (Cyclic V must be disabled)"); RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v"); prop= RNA_def_property(srna, "bezier_u", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flagu", 4); + RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_BEZIER); RNA_def_property_ui_text(prop, "Bezier U", "Make this nurbs curve or surface act like a bezier spline in the U direction (Order U must be 3 or 4, Cyclic U must be disabled)"); RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u"); prop= RNA_def_property(srna, "bezier_v", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flagv", 4); + RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_BEZIER); RNA_def_property_ui_text(prop, "Bezier V", "Make this nurbs surface act like a bezier spline in the V direction (Order V must be 3 or 4, Cyclic V must be disabled)"); RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v"); diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index d5d28ac83ae..fcd5bb858c7 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -51,6 +51,7 @@ EnumPropertyItem fmodifier_type_items[] = { {FMODIFIER_TYPE_FILTER, "FILTER", 0, "Filter", ""}, {FMODIFIER_TYPE_PYTHON, "PYTHON", 0, "Python", ""}, {FMODIFIER_TYPE_LIMITS, "LIMITS", 0, "Limits", ""}, + {FMODIFIER_TYPE_STEPPED, "STEPPED", 0, "Stepped Interpolation", ""}, {0, NULL, 0, NULL, NULL}}; EnumPropertyItem beztriple_keyframe_type_items[] = { @@ -84,6 +85,8 @@ static StructRNA *rna_FModifierType_refine(struct PointerRNA *ptr) return &RNA_FModifierPython; case FMODIFIER_TYPE_LIMITS: return &RNA_FModifierLimits; + case FMODIFIER_TYPE_STEPPED: + return &RNA_FModifierStepped; default: return &RNA_UnknownType; } @@ -403,6 +406,61 @@ static void rna_FModifierGenerator_coefficients_set(PointerRNA *ptr, const float memcpy(gen->coefficients, values, gen->arraysize * sizeof(float)); } +static void rna_FModifierLimits_minx_range(PointerRNA *ptr, float *min, float *max) +{ + FModifier *fcm= (FModifier*)ptr->data; + FMod_Limits *data= fcm->data; + + *min= MINAFRAMEF; + *max= (data->flag & FCM_LIMIT_XMAX)? data->rect.xmax : MAXFRAMEF; +} + +static void rna_FModifierLimits_maxx_range(PointerRNA *ptr, float *min, float *max) +{ + FModifier *fcm= (FModifier*)ptr->data; + FMod_Limits *data= fcm->data; + + *min= (data->flag & FCM_LIMIT_XMIN)? data->rect.xmin : MINAFRAMEF; + *max= MAXFRAMEF; +} + +static void rna_FModifierLimits_miny_range(PointerRNA *ptr, float *min, float *max) +{ + FModifier *fcm= (FModifier*)ptr->data; + FMod_Limits *data= fcm->data; + + *min= -FLT_MAX; + *max= (data->flag & FCM_LIMIT_YMAX)? data->rect.ymax : FLT_MAX; +} + +static void rna_FModifierLimits_maxy_range(PointerRNA *ptr, float *min, float *max) +{ + FModifier *fcm= (FModifier*)ptr->data; + FMod_Limits *data= fcm->data; + + *min= (data->flag & FCM_LIMIT_YMIN)? data->rect.ymin : -FLT_MAX; + *max= FLT_MAX; +} + + +static void rna_FModifierStepped_start_frame_range(PointerRNA *ptr, float *min, float *max) +{ + FModifier *fcm= (FModifier*)ptr->data; + FMod_Stepped *data= fcm->data; + + *min= MINAFRAMEF; + *max= (data->flag & FCM_STEPPED_NO_AFTER)? data->end_frame : MAXFRAMEF; +} + +static void rna_FModifierStepped_end_frame_range(PointerRNA *ptr, float *min, float *max) +{ + FModifier *fcm= (FModifier*)ptr->data; + FMod_Stepped *data= fcm->data; + + *min= (data->flag & FCM_STEPPED_NO_BEFORE)? data->start_frame : MINAFRAMEF; + *max= MAXFRAMEF; +} + #else static void rna_def_fmodifier_generator(BlenderRNA *brna) @@ -648,21 +706,25 @@ static void rna_def_fmodifier_limits(BlenderRNA *brna) prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rect.xmin"); + RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierLimits_minx_range"); RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rect.ymin"); + RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierLimits_miny_range"); RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rect.xmax"); + RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierLimits_maxx_range"); RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rect.ymax"); + RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierLimits_maxy_range"); RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); } @@ -712,9 +774,51 @@ static void rna_def_fmodifier_noise(BlenderRNA *brna) } +/* --------- */ + +static void rna_def_fmodifier_stepped(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "FModifierStepped", "FModifier"); + RNA_def_struct_ui_text(srna, "Stepped Interpolation F-Modifier", "Holds each interpolated value from the F-Curve for several frames without changing the timing"); + RNA_def_struct_sdna_from(srna, "FMod_Stepped", "data"); + + /* properties */ + prop= RNA_def_property(srna, "step_size", PROP_FLOAT, PROP_NONE); + RNA_def_property_ui_text(prop, "Step Size", "Number of frames to hold each value"); + RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); + + prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "offset"); + RNA_def_property_ui_text(prop, "Offset", "Reference number of frames before frames get held. Use to get hold for '1-3' vs '5-7' holding patterns"); + RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); + + prop= RNA_def_property(srna, "use_start_frame", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_STEPPED_NO_BEFORE); + RNA_def_property_ui_text(prop, "Use Start Frame", "Restrict modifier to only act after its 'start' frame"); + RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); + + prop= RNA_def_property(srna, "use_end_frame", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_STEPPED_NO_AFTER); + RNA_def_property_ui_text(prop, "Use End Frame", "Restrict modifier to only act before its 'end' frame"); + RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); + + prop= RNA_def_property(srna, "start_frame", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierStepped_start_frame_range"); + RNA_def_property_ui_text(prop, "Start Frame", "Frame that modifier's influence starts (if applicable)"); + RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); + + prop= RNA_def_property(srna, "end_frame", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierStepped_end_frame_range"); + RNA_def_property_ui_text(prop, "End Frame", "Frame that modifier's influence ends (if applicable)"); + RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); +} /* --------- */ + static void rna_def_fmodifier(BlenderRNA *brna) { StructRNA *srna; @@ -1209,6 +1313,7 @@ void RNA_def_fcurve(BlenderRNA *brna) rna_def_fmodifier_python(brna); rna_def_fmodifier_limits(brna); rna_def_fmodifier_noise(brna); + rna_def_fmodifier_stepped(brna); } diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 1657ad00cdd..fdd79781d79 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -278,7 +278,8 @@ static void rna_def_image(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static const EnumPropertyItem prop_generated_type_items[]= { {0, "BLANK", 0, "Blank", "Generate a blank image"}, - {1, "UVGRID", 0, "UV Grid", "Generated grid to test UV mappings"}, + {1, "UV_GRID", 0, "UV Grid", "Generated grid to test UV mappings"}, + {2, "COLOR_GRID", 0, "Color Grid", "Generated improved UV grid to test UV mappings"}, {0, NULL, 0, NULL, NULL}}; static const EnumPropertyItem prop_mapping_items[]= { {0, "UV", 0, "UV Coordinates", "Use UV coordinates for mapping the image"}, diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 06e0a96deed..68a7ca29a1f 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -297,6 +297,7 @@ void rna_iterator_listbase_begin(struct CollectionPropertyIterator *iter, struct void rna_iterator_listbase_next(struct CollectionPropertyIterator *iter); void *rna_iterator_listbase_get(struct CollectionPropertyIterator *iter); void rna_iterator_listbase_end(struct CollectionPropertyIterator *iter); +PointerRNA rna_listbase_lookup_int(PointerRNA *ptr, StructRNA *type, struct ListBase *lb, int index); typedef struct ArrayIterator { char *ptr; @@ -311,6 +312,7 @@ void rna_iterator_array_next(struct CollectionPropertyIterator *iter); void *rna_iterator_array_get(struct CollectionPropertyIterator *iter); void *rna_iterator_array_dereference_get(struct CollectionPropertyIterator *iter); void rna_iterator_array_end(struct CollectionPropertyIterator *iter); +PointerRNA rna_array_lookup_int(PointerRNA *ptr, StructRNA *type, void *data, int itemsize, int length, int index); /* Duplicated code since we can't link in blenlib */ diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 56c0819680d..9433294fdd3 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -69,11 +69,6 @@ Tex *rna_Main_add_texture(Main *bmain, char *name) return add_texture(name); } -Image *rna_Main_add_image(Main *bmain, char *filename) -{ - return BKE_add_image_file(filename, 0); -} - Camera *rna_Main_cameras_new(Main *bmain, char* name) { return add_camera(name); @@ -156,6 +151,8 @@ Object *rna_Main_objects_new(Main *bmain, ReportList *reports, char* name, ID *d ob->id.us--; ob->data= data; + test_object_materials(ob->data); + return ob; } @@ -225,6 +222,27 @@ void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp) /* XXX python now has invalid pointer? */ } +Image *rna_Main_images_new(Main *bmain, char* name, int width, int height, int float_buffer) +{ + float color[4]= {0.0, 0.0, 0.0, 1.0}; + Image *image= BKE_add_image_size(width, height, name, float_buffer, 0, color); + image->id.us--; + return image; +} +Image *rna_Main_images_load(Main *bmain, char *filename) +{ + return BKE_add_image_file(filename, 0); +} +void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image) +{ + if(ID_REAL_USERS(image) <= 0) + free_libblock(&bmain->image, image); + else + BKE_reportf(reports, RPT_ERROR, "Image \"%s\" must have zero users to be removed, found %d.", image->id.name+2, ID_REAL_USERS(image)); + + /* XXX python now has invalid pointer? */ +} + Tex *rna_Main_textures_new(Main *bmain, char* name) { Tex *tex= add_texture(name); @@ -307,15 +325,20 @@ void rna_Main_actions_remove(Main *bmain, ReportList *reports, bAction *act) void RNA_api_main(StructRNA *srna) { + /* FunctionRNA *func; PropertyRNA *parm; - + */ + /* maybe we want to add functions in 'bpy.data' still? + * for now they are all in collections bpy.data.images.new(...) */ + /* func= RNA_def_function(srna, "add_image", "rna_Main_add_image"); RNA_def_function_ui_description(func, "Add a new image."); parm= RNA_def_string(func, "filename", "", 0, "", "Filename to load image from."); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_pointer(func, "image", "Image", "", "New image."); RNA_def_function_return(func, parm); + */ } @@ -489,8 +512,40 @@ void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop) } void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop) { + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + RNA_def_property_srna(cprop, "MainImages"); + srna= RNA_def_struct(brna, "MainImages", NULL); + RNA_def_struct_ui_text(srna, "Main Images", "Collection of images"); + + func= RNA_def_function(srna, "new", "rna_Main_images_new"); + RNA_def_function_ui_description(func, "Add a new image to the main database"); + parm= RNA_def_string(func, "name", "Image", 0, "", "New name for the datablock."); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image.", 0, INT_MAX); + parm= RNA_def_int(func, "height", 1024, 1, INT_MAX, "", "Height of the image.", 0, INT_MAX); + parm= RNA_def_boolean(func, "float_buffer", 0, "Float Buffer", "Create an image with floating point color"); + /* return type */ + parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock."); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "load", "rna_Main_images_load"); + RNA_def_function_ui_description(func, "Load a new image into the main database"); + parm= RNA_def_string(func, "filename", "File Name", 0, "", "path of the file to load."); + RNA_def_property_flag(parm, PROP_REQUIRED); + /* return type */ + parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock."); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "remove", "rna_Main_images_remove"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_ui_description(func, "Remove an image from the current blendfile."); + parm= RNA_def_pointer(func, "image", "Image", "", "Image to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED); } + void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop) { diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index 9cbe46dac58..b3f4aab7599 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -411,6 +411,11 @@ static void rna_def_nlastrip(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_TIME); RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaStrip_animated_time_set"); RNA_def_property_ui_text(prop, "Animated Strip Time", "Strip time is controlled by an F-Curve rather than automatically determined"); + + prop= RNA_def_property(srna, "animated_time_cyclic", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_TIME_CYCLIC); + RNA_def_property_ui_text(prop, "Cyclic Strip Time", "Cycle the animated time within the action start & end"); + RNA_def_property_update(prop, 0, "rna_NlaStrip_transform_update"); // is there a better update flag? /* settings */ prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index d8c5c796fa3..81579293402 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Contributor(s): Blender Foundation (2008), Nathan Letwory, Robin Allen + * Contributor(s): Blender Foundation (2008), Nathan Letwory, Robin Allen, Bob Holcomb * * ***** END GPL LICENSE BLOCK ***** */ @@ -118,21 +118,6 @@ static char *rna_NodeSocket_path(PointerRNA *ptr) return NULL; } -static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup) -{ - bNode *node; - - if(ntree == lookup) - return 1; - - for(node=ntree->nodes.first; node; node=node->next) - if(node->type == NODE_GROUP && node->id) - if(has_nodetree((bNodeTree*)node->id, lookup)) - return 1; - - return 0; -} - /* Button Set Funcs for Matte Nodes */ static void rna_Matte_t1_set(PointerRNA *ptr, float value) { @@ -158,22 +143,7 @@ static void rna_Matte_t2_set(PointerRNA *ptr, float value) static void node_update(Main *bmain, Scene *scene, bNodeTree *ntree, bNode *node) { - Material *ma; - Tex *tex; - Scene *sce; - - /* look through all datablocks, to support groups */ - for(ma=bmain->mat.first; ma; ma=ma->id.next) - if(ma->nodetree && ma->use_nodes && has_nodetree(ma->nodetree, ntree)) - ED_node_changed_update(&ma->id, node); - - for(tex=bmain->tex.first; tex; tex=tex->id.next) - if(tex->nodetree && tex->use_nodes && has_nodetree(tex->nodetree, ntree)) - ED_node_changed_update(&tex->id, node); - - for(sce=bmain->scene.first; sce; sce=sce->id.next) - if(sce->nodetree && sce->use_nodes && has_nodetree(sce->nodetree, ntree)) - ED_node_changed_update(&sce->id, node); + ED_node_generic_update(bmain, scene, ntree, node); } static void rna_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -1217,6 +1187,23 @@ static void def_cmp_scale(StructRNA *srna) RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } +static void def_cmp_rotate(StructRNA *srna) +{ + PropertyRNA *prop; + + static EnumPropertyItem rotate_items[] = { + {0, "NEAREST", 0, "Nearest", ""}, + {1, "BILINEAR", 0, "Bilinear", ""}, + {2, "BICUBIC", 0, "Bicubic", ""}, + {0, NULL, 0, NULL, NULL}}; + + prop = RNA_def_property(srna, "filter", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "custom1"); + RNA_def_property_enum_items(prop, rotate_items); + RNA_def_property_ui_text(prop, "Filter", "Method to use to filter rotation"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); +} + static void def_cmp_diff_matte(StructRNA *srna) { PropertyRNA *prop; @@ -1287,12 +1274,23 @@ static void def_cmp_distance_matte(StructRNA *srna) static void def_cmp_color_spill(StructRNA *srna) { PropertyRNA *prop; - + static EnumPropertyItem channel_items[] = { {1, "R", 0, "R", "Red Spill Suppression"}, {2, "G", 0, "G", "Green Spill Suppression"}, {3, "B", 0, "B", "Blue Spill Suppression"}, {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem limit_channel_items[] = { + {1, "R", 0, "R", "Limit by Red"}, + {2, "G", 0, "G", "Limit by Green"}, + {3, "B", 0, "B", "Limit by Blue"}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem algorithm_items[] = { + {0, "SIMPLE", 0, "Simple", "Simple Limit Algorithm"}, + {1, "AVERAGE", 0, "Average", "Average Limit Algorithm"}, + {0, NULL, 0, NULL, NULL}}; prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "custom1"); @@ -1300,12 +1298,47 @@ static void def_cmp_color_spill(StructRNA *srna) RNA_def_property_ui_text(prop, "Channel", ""); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); - RNA_def_struct_sdna_from(srna, "NodeChroma", "storage"); - - prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "t1"); - RNA_def_property_range(prop, 0.0f, 0.5f); - RNA_def_property_ui_text(prop, "Amount", "How much the selected channel is affected by"); + prop = RNA_def_property(srna, "algorithm", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "custom2"); + RNA_def_property_enum_items(prop, algorithm_items); + RNA_def_property_ui_text(prop, "Algorithm", ""); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); + + RNA_def_struct_sdna_from(srna, "NodeColorspill", "storage"); + + prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "limchan"); + RNA_def_property_enum_items(prop, limit_channel_items); + RNA_def_property_ui_text(prop, "Limit Channel", ""); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "limscale"); + RNA_def_property_range(prop, 0.5f, 1.5f); + RNA_def_property_ui_text(prop, "Ratio", "Scale limit by value"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "unspill", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "unspill", 0); + RNA_def_property_ui_text(prop, "Unspill", "Compensate all channels (diffenrently) by hand"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "unspill_red", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "uspillr"); + RNA_def_property_range(prop, 0.0f, 1.5f); + RNA_def_property_ui_text(prop, "R", "Red spillmap scale"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "unspill_green", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "uspillg"); + RNA_def_property_range(prop, 0.0f, 1.5f); + RNA_def_property_ui_text(prop, "G", "Green spillmap scale"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "unspill_blue", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "uspillb"); + RNA_def_property_range(prop, 0.0f, 1.5f); + RNA_def_property_ui_text(prop, "B", "Blue spillmap scale"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } @@ -1379,6 +1412,11 @@ static void def_cmp_channel_matte(StructRNA *srna) {CMP_NODE_CHANNEL_MATTE_CS_YUV, "YUV", 0, "YUV", "YUV Color Space"}, {CMP_NODE_CHANNEL_MATTE_CS_YCC, "YCC", 0, "YCbCr", "YCbCr Color Space"}, {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem algorithm_items[] = { + {0, "SINGLE", 0, "Single", "Limit by single channel"}, + {1, "MAX", 0, "Max", "Limit by max of other channels "}, + {0, NULL, 0, NULL, NULL}}; prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "custom1"); @@ -1386,15 +1424,27 @@ static void def_cmp_channel_matte(StructRNA *srna) RNA_def_property_ui_text(prop, "Color Space", ""); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); - prop= RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "custom2"); RNA_def_property_enum_items(prop, prop_tri_channel_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_channel_itemf"); RNA_def_property_ui_text(prop, "Channel", "Channel used to determine matte"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); - + RNA_def_struct_sdna_from(srna, "NodeChroma", "storage"); + + prop = RNA_def_property(srna, "algorithm", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "algorithm"); + RNA_def_property_enum_items(prop, algorithm_items); + RNA_def_property_ui_text(prop, "Algorithm", "Algorithm to use to limit channel"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "channel"); + RNA_def_property_enum_items(prop, prop_tri_channel_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_channel_itemf"); + RNA_def_property_ui_text(prop, "Limit Channel", "Limit by this channels value"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "high", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "t1"); diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h index b31751a8ce7..f824f6f20ce 100644 --- a/source/blender/makesrna/intern/rna_nodetree_types.h +++ b/source/blender/makesrna/intern/rna_nodetree_types.h @@ -74,7 +74,7 @@ DefNode( CompositorNode, CMP_NODE_TRANSLATE, 0, "TRANS DefNode( CompositorNode, CMP_NODE_ZCOMBINE, 0, "ZCOMBINE", Zcombine, "Z Combine", "" ) DefNode( CompositorNode, CMP_NODE_COMBRGBA, 0, "COMBRGBA", CombRGBA, "Combine RGBA", "" ) DefNode( CompositorNode, CMP_NODE_DILATEERODE, def_cmp_dilate_erode, "DILATEERODE", DilateErode, "Dilate/Erode", "" ) -DefNode( CompositorNode, CMP_NODE_ROTATE, 0, "ROTATE", Rotate, "Rotate", "" ) +DefNode( CompositorNode, CMP_NODE_ROTATE, def_cmp_rotate, "ROTATE", Rotate, "Rotate", "" ) DefNode( CompositorNode, CMP_NODE_SCALE, def_cmp_scale, "SCALE", Scale, "Scale", "" ) DefNode( CompositorNode, CMP_NODE_SEPYCCA, 0, "SEPYCCA", SepYCCA, "Separate YCCA", "" ) DefNode( CompositorNode, CMP_NODE_COMBYCCA, 0, "COMBYCCA", CombYCCA, "Combine YCCA", "" ) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 117a1d5bc60..21a1b7994a5 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -125,7 +125,7 @@ void rna_Object_update(Main *bmain, Scene *scene, PointerRNA *ptr) void rna_Object_matrix_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - ED_object_apply_obmat(ptr->id.data); + object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat); rna_Object_update(bmain, scene, ptr); } diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index aa41878a0c5..9fb17c82fa3 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -1414,7 +1414,7 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "nodemass"); RNA_def_property_range(prop, 0.0f, 50000.0f); - RNA_def_property_ui_text(prop, "Mass", ""); + RNA_def_property_ui_text(prop, "Mass", "General Mass value"); RNA_def_property_update(prop, 0, "rna_softbody_update"); prop= RNA_def_property(srna, "mass_vertex_group", PROP_STRING, PROP_NONE); @@ -1423,6 +1423,7 @@ static void rna_def_softbody(BlenderRNA *brna) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoftBodySettings_mass_vgroup_set"); RNA_def_property_update(prop, 0, "rna_softbody_update"); + /* no longer used */ prop= RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION); RNA_def_property_float_sdna(prop, NULL, "grav"); RNA_def_property_range(prop, -10.0f, 10.0f); @@ -1439,23 +1440,25 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "goal_vertex_group", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "vertgroup"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not impossible .. but not supported yet */ RNA_def_property_string_funcs(prop, "rna_SoftBodySettings_goal_vgroup_get", "rna_SoftBodySettings_goal_vgroup_length", "rna_SoftBodySettings_goal_vgroup_set"); RNA_def_property_ui_text(prop, "Goal Vertex Group", "Control point weight values"); prop= RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "mingoal"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Goal Minimum", "Goal minimum, vertex group weights are scaled to match this range"); + RNA_def_property_ui_text(prop, "Goal Minimum", "Goal minimum, vertex weights are scaled to match this range"); RNA_def_property_update(prop, 0, "rna_softbody_update"); prop= RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "maxgoal"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Goal Maximum", "Goal maximum, vertex group weights are scaled to match this range"); + RNA_def_property_ui_text(prop, "Goal Maximum", "Goal maximum, vertex weights are scaled to match this range"); RNA_def_property_update(prop, 0, "rna_softbody_update"); prop= RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "defgoal"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Goal Default", "Default Goal (vertex target position) value, when no Vertex Group used"); RNA_def_property_update(prop, 0, "rna_softbody_update"); @@ -1532,11 +1535,13 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "sbc_mode"); RNA_def_property_enum_items(prop, collision_type_items); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Collision Type", "Choose Collision Type"); RNA_def_property_update(prop, 0, "rna_softbody_update"); prop= RNA_def_property(srna, "ball_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "colball"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* code is not ready for that yet */ RNA_def_property_range(prop, -10.0f, 10.0f); RNA_def_property_ui_text(prop, "Ball Size", "Absolute ball size or factor if not manual adjusted"); RNA_def_property_update(prop, 0, "rna_softbody_update"); @@ -1625,16 +1630,19 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "use_goal", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_use_goal_get", "rna_SoftBodySettings_use_goal_set"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use Goal", "Define forces for vertices to stick to animated position"); RNA_def_property_update(prop, 0, "rna_softbody_update"); prop= RNA_def_property(srna, "use_edges", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_use_edges_get", "rna_SoftBodySettings_use_edges_set"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use Edges", "Use Edges as springs"); RNA_def_property_update(prop, 0, "rna_softbody_update"); prop= RNA_def_property(srna, "stiff_quads", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_stiff_quads_get", "rna_SoftBodySettings_stiff_quads_set"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Stiff Quads", "Adds diagonal springs on 4-gons"); RNA_def_property_update(prop, 0, "rna_softbody_update"); @@ -1655,6 +1663,7 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "self_collision", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_self_collision_get", "rna_SoftBodySettings_self_collision_set"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Self Collision", "Enable naive vertex ball self collision"); RNA_def_property_update(prop, 0, "rna_softbody_update"); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index c52d60f5d41..b10df075121 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -364,7 +364,7 @@ static void rna_def_render_pass(BlenderRNA *brna) {SCE_PASS_AO, "AO", 0, "AO", ""}, {SCE_PASS_REFLECT, "REFLECTION", 0, "Reflection", ""}, {SCE_PASS_NORMAL, "NORMAL", 0, "Normal", ""}, - {SCE_PASS_VECTOR, "VECTOR", 0, "Vecotr", ""}, + {SCE_PASS_VECTOR, "VECTOR", 0, "Vector", ""}, {SCE_PASS_REFRACT, "REFRACTION", 0, "Refraction", ""}, {SCE_PASS_INDEXOB, "OBJECT_INDEX", 0, "Object Index", ""}, {SCE_PASS_UV, "UV", 0, "UV", ""}, diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 67bbf11c8ab..02e56e92a8d 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -26,6 +26,7 @@ #include "RNA_define.h" #include "RNA_types.h" +#include "RNA_enum_types.h" #include "rna_internal.h" @@ -99,22 +100,22 @@ EnumPropertyItem image_type_items[] = { #endif {R_BMP, "BMP", ICON_FILE_IMAGE, "BMP", ""}, {R_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", ""}, - {R_RAWTGA, "RAWTARGA", ICON_FILE_IMAGE, "Targa Raw", ""}, + {R_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", ""}, //{R_DDS, "DDS", ICON_FILE_IMAGE, "DDS", ""}, // XXX not yet implemented {R_HAMX, "HAMX", ICON_FILE_IMAGE, "HamX", ""}, {R_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", ""}, {0, "", 0, " ", NULL}, #ifdef WITH_OPENEXR - {R_OPENEXR, "OPENEXR", ICON_FILE_IMAGE, "OpenEXR", ""}, + {R_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", ""}, {R_MULTILAYER, "MULTILAYER", ICON_FILE_IMAGE, "MultiLayer", ""}, #endif {R_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", ""}, // XXX only with G.have_libtiff - {R_RADHDR, "RADHDR", ICON_FILE_IMAGE, "Radiance HDR", ""}, + {R_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", ""}, {R_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", ""}, {R_DPX, "DPX", ICON_FILE_IMAGE, "DPX", ""}, {0, "", 0, "Movie", NULL}, - {R_AVIRAW, "AVIRAW", ICON_FILE_MOVIE, "AVI Raw", ""}, - {R_AVIJPEG, "AVIJPEG", ICON_FILE_MOVIE, "AVI JPEG", ""}, + {R_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", ""}, + {R_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", ""}, #ifdef _WIN32 {R_AVICODEC, "AVICODEC", ICON_FILE_MOVIE, "AVI Codec", ""}, #endif @@ -132,7 +133,7 @@ EnumPropertyItem image_type_items[] = { {R_H264, "H264", ICON_FILE_MOVIE, "H.264", ""}, {R_XVID, "XVID", ICON_FILE_MOVIE, "Xvid", ""}, {R_THEORA, "THEORA", ICON_FILE_MOVIE, "Ogg Theora", ""}, - {R_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "FFMpeg", ""}, + {R_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "MPEG", ""}, #endif {R_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", ""}, {0, NULL, 0, NULL, NULL}}; @@ -177,12 +178,12 @@ static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter) return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((Base*)internal->link)->object); } -static Base *rna_Scene_link_object(Scene *scene, ReportList *reports, Object *ob) +static Base *rna_Scene_object_link(Scene *scene, ReportList *reports, Object *ob) { Base *base; if (ob->type != OB_EMPTY && ob->data==NULL) { - BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is not an Empty type and has no Object Data set."); + BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is not an Empty type and has no Object Data set.", ob->id.name+2); return NULL; } @@ -203,7 +204,7 @@ static Base *rna_Scene_link_object(Scene *scene, ReportList *reports, Object *ob return base; } -static void rna_Scene_unlink_object(Scene *scene, bContext *C, ReportList *reports, Object *ob) +static void rna_Scene_object_unlink(Scene *scene, bContext *C, ReportList *reports, Object *ob) { Base *base= object_in_scene(ob, scene); if (!base) { @@ -1788,22 +1789,15 @@ static void rna_def_scene_render_data(BlenderRNA *brna) static EnumPropertyItem bake_qyad_split_items[] ={ {0, "AUTO", 0, "Automatic", "Split quads to give the least distortion while baking"}, - {1, "FIXED", 0, "Fixed", "Split quads pradictably (0,1,2) (0,2,3)"}, - {2, "FIXED_ALT", 0, "Fixed Alternate", "Split quads pradictably (1,2,3) (1,3,0)"}, - {0, NULL, 0, NULL, NULL}}; - - static EnumPropertyItem bake_aa_items[] ={ - {5, "AA_5", 0, "5", ""}, - {8, "AA_8", 0, "8", ""}, - {11, "AA_11", 0, "11", ""}, - {16, "AA_16", 0, "16", ""}, + {1, "FIXED", 0, "Fixed", "Split quads predictably (0,1,2) (0,2,3)"}, + {2, "FIXED_ALT", 0, "Fixed Alternate", "Split quads predictably (1,2,3) (1,3,0)"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem octree_resolution_items[] = { - {64, "OCTREE_RES_64", 0, "64", ""}, - {128, "OCTREE_RES_128", 0, "128", ""}, - {256, "OCTREE_RES_256", 0, "256", ""}, - {512, "OCTREE_RES_512", 0, "512", ""}, + {64, "64", 0, "64", ""}, + {128, "128", 0, "128", ""}, + {256, "256", 0, "256", ""}, + {512, "512", 0, "512", ""}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem raytrace_structure_items[] = { @@ -1817,20 +1811,20 @@ static void rna_def_scene_render_data(BlenderRNA *brna) }; static EnumPropertyItem fixed_oversample_items[] = { - {5, "OVERSAMPLE_5", 0, "5", ""}, - {8, "OVERSAMPLE_8", 0, "8", ""}, - {11, "OVERSAMPLE_11", 0, "11", ""}, - {16, "OVERSAMPLE_16", 0, "16", ""}, + {5, "5", 0, "5", ""}, + {8, "8", 0, "8", ""}, + {11, "11", 0, "11", ""}, + {16, "16", 0, "16", ""}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem field_order_items[] = { - {0, "FIELDS_EVENFIRST", 0, "Upper First", "Upper field first"}, - {R_ODDFIELD, "FIELDS_ODDFIRST", 0, "Lower First", "Lower field first"}, + {0, "EVEN_FIRST", 0, "Upper First", "Upper field first"}, + {R_ODDFIELD, "ODD_FIRST", 0, "Lower First", "Lower field first"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem threads_mode_items[] = { - {0, "THREADS_AUTO", 0, "Auto-detect", "Automatically determine the number of threads, based on CPUs"}, - {R_FIXED_THREADS, "THREADS_FIXED", 0, "Fixed", "Manually determine the number of threads"}, + {0, "AUTO", 0, "Auto-detect", "Automatically determine the number of threads, based on CPUs"}, + {R_FIXED_THREADS, "FIXED", 0, "Fixed", "Manually determine the number of threads"}, {0, NULL, 0, NULL, NULL}}; #ifdef WITH_OPENEXR @@ -1971,7 +1965,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) /* JPEG and AVI JPEG */ - prop= RNA_def_property(srna, "quality", PROP_INT, PROP_PERCENTAGE); + prop= RNA_def_property(srna, "file_quality", PROP_INT, PROP_PERCENTAGE); RNA_def_property_int_sdna(prop, NULL, "quality"); RNA_def_property_range(prop, 1, 100); RNA_def_property_ui_text(prop, "Quality", "Quality of JPEG images, AVI Jpeg and SGI movies"); @@ -2466,7 +2460,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "bake_aa_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "bake_osa"); - RNA_def_property_enum_items(prop, bake_aa_items); + RNA_def_property_enum_items(prop, fixed_oversample_items); RNA_def_property_ui_text(prop, "Anti-Aliasing Level", ""); prop= RNA_def_property(srna, "bake_active", PROP_BOOLEAN, PROP_NONE); @@ -2582,6 +2576,27 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Stamp Background", "Color to use behind stamp text"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + /* sequencer draw options */ + + prop= RNA_def_property(srna, "use_sequencer_gl_preview", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "seq_flag", R_SEQ_GL_PREV); + RNA_def_property_ui_text(prop, "Sequencer OpenGL", ""); + + prop= RNA_def_property(srna, "use_sequencer_gl_render", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "seq_flag", R_SEQ_GL_REND); + RNA_def_property_ui_text(prop, "Sequencer OpenGL", ""); + + + prop= RNA_def_property(srna, "sequencer_gl_preview", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "seq_prev_type"); + RNA_def_property_enum_items(prop, viewport_shading_items); + RNA_def_property_ui_text(prop, "Sequencer Preview Shading", "Method to draw in the sequencer view"); + + prop= RNA_def_property(srna, "sequencer_gl_render", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "seq_rend_type"); + RNA_def_property_enum_items(prop, viewport_shading_items); + RNA_def_property_ui_text(prop, "Sequencer Preview Shading", "Method to draw in the sequencer view"); + /* layers */ prop= RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE); @@ -2667,7 +2682,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_struct_sdna(srna, "Scene"); RNA_def_struct_ui_text(srna, "Scene Objects", "Collection of scene objects"); - func= RNA_def_function(srna, "link", "rna_Scene_link_object"); + func= RNA_def_function(srna, "link", "rna_Scene_object_link"); RNA_def_function_ui_description(func, "Link object to scene."); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm= RNA_def_pointer(func, "object", "Object", "", "Object to add to scene."); @@ -2675,7 +2690,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) parm= RNA_def_pointer(func, "base", "ObjectBase", "", "The newly created base."); RNA_def_function_return(func, parm); - func= RNA_def_function(srna, "unlink", "rna_Scene_unlink_object"); + func= RNA_def_function(srna, "unlink", "rna_Scene_object_unlink"); RNA_def_function_ui_description(func, "Unlink object from scene."); RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove from scene."); @@ -2753,8 +2768,8 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_struct_type(prop, "Scene"); RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK); RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_set_set", NULL); - RNA_def_property_ui_text(prop, "Set Scene", "Background set scene"); - RNA_def_property_update(prop, NC_SCENE, NULL); + RNA_def_property_ui_text(prop, "Background Scene", "Background set scene"); + RNA_def_property_update(prop, NC_SCENE|NA_EDITED, NULL); prop= RNA_def_property(srna, "world", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 83295331d9a..3b07643a0ad 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -342,7 +342,7 @@ static int rna_Sequence_filepath_length(PointerRNA *ptr) return strlen(path)+1; } -static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value) +/*static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value) { Sequence *seq= (Sequence*)(ptr->data); char dir[FILE_MAX], name[FILE_MAX]; @@ -359,7 +359,7 @@ static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value) BLI_split_dirfile(value, NULL, name); BLI_strncpy(elem->name, name, sizeof(elem->name)); -} +}*/ static void rna_Sequence_update(Main *bmain, Scene *scene, PointerRNA *ptr) { @@ -447,7 +447,7 @@ static void rna_def_strip_transform(BlenderRNA *brna) prop= RNA_def_property(srna, "offset_x", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "xofs"); - RNA_def_property_ui_text(prop, "Offset Y", ""); + RNA_def_property_ui_text(prop, "Offset X", ""); RNA_def_property_ui_range(prop, -4096, 4096, 1, 0); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); @@ -926,11 +926,6 @@ static void rna_def_scene(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Camera Override", "Override the scenes active camera"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - prop= RNA_def_property(srna, "use_opengl", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_SCENE_OPENGL); - RNA_def_property_ui_text(prop, "Use OpenGL", "Use OpenGL preview rather then rendering the scene"); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - rna_def_filter_video(srna); rna_def_proxy(srna); rna_def_input(srna); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 9b7e6b5bc05..2c9bc945618 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -90,12 +90,22 @@ EnumPropertyItem autosnap_items[] = { {SACTSNAP_MARKER, "MARKER", 0, "Nearest Marker", "Snap to nearest marker"}, {0, NULL, 0, NULL, NULL}}; +EnumPropertyItem viewport_shading_items[] = { + {OB_BOUNDBOX, "BOUNDBOX", ICON_BBOX, "Bounding Box", "Display the object's local bounding boxes only"}, + {OB_WIRE, "WIREFRAME", ICON_WIRE, "Wireframe", "Display the object as wire edges"}, + {OB_SOLID, "SOLID", ICON_SOLID, "Solid", "Display the object solid, lit with default OpenGL lights"}, + //{OB_SHADED, "SHADED", ICON_SMOOTH, "Shaded", "Display the object solid, with preview shading interpolated at vertices"}, + {OB_TEXTURE, "TEXTURED", ICON_POTATO, "Textured", "Display the object solid, with face-assigned textures"}, + {0, NULL, 0, NULL, NULL}}; + #ifdef RNA_RUNTIME #include "DNA_anim_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" +#include "BLI_math.h" + #include "BKE_animsys.h" #include "BKE_brush.h" #include "BKE_colortools.h" @@ -270,6 +280,26 @@ static void rna_Space3DView_lock_camera_and_layers_set(PointerRNA *ptr, int valu } } +static void rna_View3D_CursorLocation_get(PointerRNA *ptr, float *values) +{ + View3D *v3d= (View3D*)(ptr->data); + bScreen *sc= (bScreen*)ptr->id.data; + Scene *scene= (Scene *)sc->scene; + float *loc = give_cursor(scene, v3d); + + copy_v3_v3(values, loc); +} + +static void rna_View3D_CursorLocation_set(PointerRNA *ptr, const float *values) +{ + View3D *v3d= (View3D*)(ptr->data); + bScreen *sc= (bScreen*)ptr->id.data; + Scene *scene= (Scene *)sc->scene; + float *cursor = give_cursor(scene, v3d); + + copy_v3_v3(cursor, values); +} + static void rna_Space3DView_layer_set(PointerRNA *ptr, const int *values) { View3D *v3d= (View3D*)(ptr->data); @@ -806,14 +836,6 @@ static void rna_def_space_3dview(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; int matrix_dimsize[]= {4, 4}; - - static EnumPropertyItem viewport_shading_items[] = { - {OB_BOUNDBOX, "BOUNDBOX", ICON_BBOX, "Bounding Box", "Display the object's local bounding boxes only"}, - {OB_WIRE, "WIREFRAME", ICON_WIRE, "Wireframe", "Display the object as wire edges"}, - {OB_SOLID, "SOLID", ICON_SOLID, "Solid", "Display the object solid, lit with default OpenGL lights"}, - //{OB_SHADED, "SHADED", ICON_SMOOTH, "Shaded", "Display the object solid, with preview shading interpolated at vertices"}, - {OB_TEXTURE, "TEXTURED", ICON_POTATO, "Textured", "Display the object solid, with face-assigned textures"}, - {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem pivot_items[] = { {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", ""}, @@ -853,7 +875,14 @@ static void rna_def_space_3dview(BlenderRNA *brna) prop= RNA_def_property(srna, "local_view", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "localvd"); RNA_def_property_ui_text(prop, "Local View", "Display an isolated sub-set of objects, apart from the scene visibility"); - + + prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ|PROP_UNIT_LENGTH); + RNA_def_property_array(prop, 3); + RNA_def_property_float_funcs(prop, "rna_View3D_CursorLocation_get", "rna_View3D_CursorLocation_set", NULL); + RNA_def_property_ui_text(prop, "3D Cursor Location", "3D cursor location for this view (dependent on local view setting)"); + RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + prop= RNA_def_property(srna, "lens", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "lens"); RNA_def_property_ui_text(prop, "Lens", "Lens angle (mm) in perspective view"); @@ -929,6 +958,11 @@ static void rna_def_space_3dview(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SOLID_TEX); RNA_def_property_ui_text(prop, "Textured Solid", "Display face-assigned textures in solid view"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + + prop= RNA_def_property(srna, "display_render_override", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_RENDER_OVERRIDE); + RNA_def_property_ui_text(prop, "Only Render", "Display only objects which will be rendered"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); prop= RNA_def_property(srna, "occlude_geometry", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_ZBUF_SELECT); @@ -1263,7 +1297,7 @@ static void rna_def_space_sequencer(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Draw Frames", "Draw frames rather then seconds"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); - prop= RNA_def_property(srna, "transform_markers", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_marker_sync", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MARKER_TRANS); RNA_def_property_ui_text(prop, "Transform Markers", "Transform markers as well as strips"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); @@ -1843,7 +1877,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna) prop= RNA_def_property(srna, "hide_dot", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FILE_HIDE_DOT); RNA_def_property_ui_text(prop, "Hide Dot Files", "Hide hidden dot files"); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_LIST , NULL); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS , NULL); prop= RNA_def_property(srna, "sort", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "sort"); diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 01545735bb3..bdd1b710db5 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -43,12 +43,11 @@ #include "BKE_node.h" -static EnumPropertyItem texture_filter_items[] = { +EnumPropertyItem texture_filter_items[] = { {TXF_BOX, "BOX", 0, "Box", ""}, {TXF_EWA, "EWA", 0, "EWA", ""}, {TXF_FELINE, "FELINE", 0, "FELINE", ""}, {TXF_AREA, "AREA", 0, "Area", ""}, - {TXF_SAT, "SAT", 0, "SAT (4x mem)", ""}, {0, NULL, 0, NULL, NULL}}; EnumPropertyItem texture_type_items[] = { @@ -327,26 +326,18 @@ static void rna_ImageTexture_mipmap_set(PointerRNA *ptr, int value) if(value) tex->imaflag |= TEX_MIPMAP; else tex->imaflag &= ~TEX_MIPMAP; - if((tex->imaflag & TEX_MIPMAP) && tex->texfilter == TXF_SAT) + if(tex->imaflag & TEX_MIPMAP) tex->texfilter = TXF_EWA; } -static EnumPropertyItem *rna_ImageTexture_filter_itemf(bContext *C, PointerRNA *ptr, int *free) +static void rna_Envmap_source_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - Tex *tex= (Tex*)ptr->data; - EnumPropertyItem *item= NULL; - int totitem= 0; - - RNA_enum_items_add_value(&item, &totitem, texture_filter_items, TXF_BOX); - RNA_enum_items_add_value(&item, &totitem, texture_filter_items, TXF_EWA); - RNA_enum_items_add_value(&item, &totitem, texture_filter_items, TXF_FELINE); - RNA_enum_items_add_value(&item, &totitem, texture_filter_items, TXF_AREA); - if(tex->imaflag & TEX_MIPMAP) - RNA_enum_items_add_value(&item, &totitem, texture_filter_items, TXF_SAT); + Tex *tex= ptr->id.data; - *free= 1; - - return item; + if (tex->env) + BKE_free_envmapdata(tex->env); + + rna_Texture_update(bmain, scene, ptr); } static PointerRNA rna_PointDensity_psys_get(PointerRNA *ptr) @@ -372,156 +363,8 @@ static void rna_PointDensity_psys_set(PointerRNA *ptr, PointerRNA value) pd->psys= BLI_findindex(&ob->particlesystem, value.data) + 1; } -static char *rna_ColorRamp_path(PointerRNA *ptr) -{ - /* handle the cases where a single datablock may have 2 ramp types */ - if (ptr->id.data) { - ID *id= ptr->id.data; - - switch (GS(id->name)) { - case ID_MA: /* material has 2 cases - diffuse and specular */ - { - Material *ma= (Material*)id; - - if (ptr->data == ma->ramp_col) - return BLI_strdup("diffuse_ramp"); - else if (ptr->data == ma->ramp_spec) - return BLI_strdup("specular_ramp"); - } - break; - } - } - - /* everything else just uses 'color_ramp' */ - return BLI_strdup("color_ramp"); -} - -static char *rna_ColorRampElement_path(PointerRNA *ptr) -{ - PointerRNA ramp_ptr; - PropertyRNA *prop; - char *path = NULL; - int index; - - /* helper macro for use here to try and get the path - * - this calls the standard code for getting a path to a texture... - */ -#define COLRAMP_GETPATH \ - { \ - prop= RNA_struct_find_property(&ramp_ptr, "elements"); \ - if (prop) { \ - index= RNA_property_collection_lookup_index(&ramp_ptr, prop, ptr); \ - if (index >= 0) { \ - char *texture_path= rna_ColorRamp_path(&ramp_ptr); \ - path= BLI_sprintfN("%s.elements[%d]", texture_path, index); \ - MEM_freeN(texture_path); \ - } \ - } \ - } - - /* determine the path from the ID-block to the ramp */ - // FIXME: this is a very slow way to do it, but it will have to suffice... - if (ptr->id.data) { - ID *id= ptr->id.data; - - switch (GS(id->name)) { - case ID_MA: /* 2 cases for material - diffuse and spec */ - { - Material *ma= (Material *)id; - - /* try diffuse first */ - if (ma->ramp_col) { - RNA_pointer_create(id, &RNA_ColorRamp, ma->ramp_col, &ramp_ptr); - COLRAMP_GETPATH; - } - /* try specular if not diffuse */ - if (!path && ma->ramp_spec) { - RNA_pointer_create(id, &RNA_ColorRamp, ma->ramp_spec, &ramp_ptr); - COLRAMP_GETPATH; - } - } - break; - - // TODO: node trees need special attention - case ID_NT: - { - // FIXME: we'll probably have to loop over nodes until we find one that uses the color ramp - } - break; - - default: /* everything else should have a "color_ramp" property */ - { - /* create pointer to the ID block, and try to resolve "color_ramp" pointer */ - RNA_id_pointer_create(id, &ramp_ptr); - if (RNA_path_resolve(&ramp_ptr, "color_ramp", &ramp_ptr, &prop)) { - COLRAMP_GETPATH; - } - } - } - } - - /* cleanup the macro we defined */ -#undef COLRAMP_GETPATH - - return path; -} - #else -static void rna_def_color_ramp_element(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna= RNA_def_struct(brna, "ColorRampElement", NULL); - RNA_def_struct_sdna(srna, "CBData"); - RNA_def_struct_path_func(srna, "rna_ColorRampElement_path"); - RNA_def_struct_ui_text(srna, "Color Ramp Element", "Element defining a color at a position in the color ramp"); - - prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); - RNA_def_property_float_sdna(prop, NULL, "r"); - RNA_def_property_array(prop, 4); - RNA_def_property_ui_text(prop, "Color", ""); - RNA_def_property_update(prop, 0, "rna_Texture_update"); - - prop= RNA_def_property(srna, "position", PROP_FLOAT, PROP_COLOR); - RNA_def_property_float_sdna(prop, NULL, "pos"); - RNA_def_property_range(prop, 0, 1); - RNA_def_property_ui_text(prop, "Position", ""); - RNA_def_property_update(prop, 0, "rna_Texture_update"); -} - -static void rna_def_color_ramp(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static EnumPropertyItem prop_interpolation_items[] = { - {1, "EASE", 0, "Ease", ""}, - {3, "CARDINAL", 0, "Cardinal", ""}, - {0, "LINEAR", 0, "Linear", ""}, - {2, "B_SPLINE", 0, "B-Spline", ""}, - {4, "CONSTANT", 0, "Constant", ""}, - {0, NULL, 0, NULL, NULL}}; - - srna= RNA_def_struct(brna, "ColorRamp", NULL); - RNA_def_struct_sdna(srna, "ColorBand"); - RNA_def_struct_path_func(srna, "rna_ColorRamp_path"); - RNA_def_struct_ui_text(srna, "Color Ramp", "Color ramp mapping a scalar value to a color"); - - prop= RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_COLOR); - RNA_def_property_collection_sdna(prop, NULL, "data", "tot"); - RNA_def_property_struct_type(prop, "ColorRampElement"); - RNA_def_property_ui_text(prop, "Elements", ""); - RNA_def_property_update(prop, 0, "rna_Texture_update"); - - prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "ipotype"); - RNA_def_property_enum_items(prop, prop_interpolation_items); - RNA_def_property_ui_text(prop, "Interpolation", ""); - RNA_def_property_update(prop, 0, "rna_Texture_update"); -} - static void rna_def_texmapping(BlenderRNA *brna) { StructRNA *srna; @@ -685,7 +528,6 @@ static void rna_def_filter_common(StructRNA *srna) prop= RNA_def_property(srna, "filter", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "texfilter"); RNA_def_property_enum_items(prop, texture_filter_items); - RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageTexture_filter_itemf"); RNA_def_property_ui_text(prop, "Filter", "Texture filter to use for sampling image"); RNA_def_property_update(prop, 0, "rna_Texture_update"); @@ -738,7 +580,7 @@ static void rna_def_environment_map(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "stype"); RNA_def_property_enum_items(prop, prop_source_items); RNA_def_property_ui_text(prop, "Source", ""); - RNA_def_property_update(prop, 0, "rna_Texture_update"); + RNA_def_property_update(prop, 0, "rna_Envmap_source_update"); prop= RNA_def_property(srna, "viewpoint_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "object"); @@ -1922,8 +1764,6 @@ void RNA_def_texture(BlenderRNA *brna) rna_def_texture(brna); rna_def_mtex(brna); rna_def_environment_map(brna); - rna_def_color_ramp(brna); - rna_def_color_ramp_element(brna); rna_def_texmapping(brna); } diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 07c4d9c826e..6415f04a39f 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 7fd15e0e136..2e1352eaa8e 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -228,7 +228,12 @@ static void rna_userdef_addon_remove(bAddon *bext) BLI_freelinkN(&U.addons, bext); } - +static void rna_userdef_temp_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + extern char btempdir[]; + UserDef *userdef = (UserDef*)ptr->data; + strncpy(btempdir, userdef->tempdir, FILE_MAXDIR+FILE_MAXFILE); +} #else @@ -715,6 +720,89 @@ static void rna_def_userdef_theme_spaces_face(StructRNA *srna) RNA_def_property_update(prop, 0, "rna_userdef_update"); } +static void rna_def_userdef_theme_spaces_curves(StructRNA *srna) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, "nurb_uline", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "nurb_uline"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Nurb U-lines", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "nurb_vline", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "nurb_vline"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Nurb V-lines", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "nurb_sel_uline", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "nurb_sel_uline"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Nurb active U-lines", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "nurb_sel_vline", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "nurb_sel_vline"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Nurb active V-lines", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "act_spline", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "act_spline"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Active spline", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "handle_free", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "handle_free"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Free handle color", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "handle_auto", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "handle_auto"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Auto handle color", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "handle_vect", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "handle_vect"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Vector handle color", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "handle_align", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "handle_align"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Align handle color", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "handle_sel_free", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "handle_sel_free"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Free handle selected color", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "handle_sel_auto", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "handle_sel_auto"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Auto handle selected color", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "handle_sel_vect", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "handle_sel_vect"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Vector handle selected color", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "handle_sel_align", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "handle_sel_align"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Align handle selected color", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); +} + static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna) { StructRNA *srna; @@ -780,6 +868,7 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna) rna_def_userdef_theme_spaces_vertex(srna); rna_def_userdef_theme_spaces_edge(srna); rna_def_userdef_theme_spaces_face(srna); + rna_def_userdef_theme_spaces_curves(srna); prop= RNA_def_property(srna, "editmesh_active", PROP_FLOAT, PROP_COLOR); RNA_def_property_array(prop, 4); @@ -1811,6 +1900,10 @@ static void rna_def_userdef_view(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_VIEWPORTNAME); RNA_def_property_ui_text(prop, "Show View Name", "Show the name of the view's direction in each 3D View"); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "show_splash", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_SPLASH_DISABLE); + RNA_def_property_ui_text(prop, "Show Splash", "Display splash screen on startup"); prop= RNA_def_property(srna, "show_playback_fps", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_FPS); @@ -2621,6 +2714,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) prop= RNA_def_property(srna, "temporary_directory", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "tempdir"); RNA_def_property_ui_text(prop, "Temporary Directory", "The directory for storing temporary save files"); + RNA_def_property_update(prop, 0, "rna_userdef_temp_update"); prop= RNA_def_property(srna, "image_editor", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "image_editor"); diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 6817f7a0fc6..66b620b106b 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -158,7 +158,11 @@ static int rna_event_add_modal_handler(struct bContext *C, struct wmOperator *op #else -static void rna_generic_op_invoke(FunctionRNA *func, int use_event, int use_ret) +#define WM_GEN_INVOKE_EVENT (1<<0) +#define WM_GEN_INVOKE_SIZE (1<<1) +#define WM_GEN_INVOKE_RETURN (1<<2) + +static void rna_generic_op_invoke(FunctionRNA *func, int flag) { PropertyRNA *parm; @@ -166,12 +170,17 @@ static void rna_generic_op_invoke(FunctionRNA *func, int use_event, int use_ret) parm= RNA_def_pointer(func, "operator", "Operator", "", "Operator to call."); RNA_def_property_flag(parm, PROP_REQUIRED); - if(use_event) { + if(flag & WM_GEN_INVOKE_EVENT) { parm= RNA_def_pointer(func, "event", "Event", "", "Event."); RNA_def_property_flag(parm, PROP_REQUIRED); } - if(use_ret) { + if(flag & WM_GEN_INVOKE_SIZE) { + parm= RNA_def_int(func, "width", 300, 0, INT_MAX, "", "Width of the popup.", 0, INT_MAX); + parm= RNA_def_int(func, "height", 20, 0, INT_MAX, "", "Height of the popup.", 0, INT_MAX); + } + + if(flag & WM_GEN_INVOKE_RETURN) { parm= RNA_def_enum(func, "result", operator_return_items, 0, "result", ""); RNA_def_property_flag(parm, PROP_ENUM_FLAG); RNA_def_function_return(func, parm); @@ -185,7 +194,7 @@ void RNA_api_wm(StructRNA *srna) func= RNA_def_function(srna, "add_fileselect", "WM_event_add_fileselect"); RNA_def_function_ui_description(func, "Show up the file selector."); - rna_generic_op_invoke(func, 0, 0); + rna_generic_op_invoke(func, 0); func= RNA_def_function(srna, "add_keyconfig", "WM_keyconfig_add_user"); parm= RNA_def_string(func, "name", "", 0, "Name", ""); @@ -206,18 +215,21 @@ void RNA_api_wm(StructRNA *srna) /* invoke functions, for use with python */ func= RNA_def_function(srna, "invoke_props_popup", "WM_operator_props_popup"); RNA_def_function_ui_description(func, "Operator popup invoke."); - rna_generic_op_invoke(func, 1, 1); + rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT|WM_GEN_INVOKE_RETURN); + + /* invoked dialog opens popup with OK button, does not auto-exec operator. */ + func= RNA_def_function(srna, "invoke_props_dialog", "WM_operator_props_dialog_popup"); + RNA_def_function_ui_description(func, "Operator dialog (non-autoexec popup) invoke."); + rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE|WM_GEN_INVOKE_RETURN); /* invoke enum */ func= RNA_def_function(srna, "invoke_search_popup", "rna_Operator_enum_search_invoke"); - rna_generic_op_invoke(func, 0, 0); + rna_generic_op_invoke(func, 0); /* invoke functions, for use with python */ func= RNA_def_function(srna, "invoke_popup", "WM_operator_ui_popup"); RNA_def_function_ui_description(func, "Operator popup invoke."); - rna_generic_op_invoke(func, 0, 0); - parm= RNA_def_int(func, "width", 300, 0, INT_MAX, "", "Width of the popup.", 0, INT_MAX); - parm= RNA_def_int(func, "height", 20, 0, INT_MAX, "", "Height of the popup.", 0, INT_MAX); + rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE|WM_GEN_INVOKE_RETURN); } void RNA_api_operator(StructRNA *srna) diff --git a/source/blender/nodes/Makefile b/source/blender/nodes/Makefile index 400064f24b8..a173908aeb1 100644 --- a/source/blender/nodes/Makefile +++ b/source/blender/nodes/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c index cda6cf06681..701fe688f5f 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c @@ -66,30 +66,36 @@ static void do_normalized_ycca_to_rgba2(bNode *node, float *out, float *in) static void do_channel_matte(bNode *node, float *out, float *in) { NodeChroma *c=(NodeChroma *)node->storage; - float alpha=0.0; - - /* Alpha=G-MAX(R, B) */ - - switch(node->custom2) - { - case 1: - { - alpha=in[0]-MAX2(in[1],in[2]); - break; - } - case 2: - { - alpha=in[1]-MAX2(in[0],in[2]); - break; - } - case 3: - { - alpha=in[2]-MAX2(in[0],in[1]); - break; - } - default: - break; - } + float alpha=0.0; + + switch(c->algorithm) { + case 0: { /* Alpha=key_channel-limit channel */ + int key_channel=node->custom2-1; + int limit_channel=c->channel-1; + alpha=in[key_channel]-in[limit_channel]; + break; + } + case 1: { /* Alpha=G-MAX(R, B) */ + switch(node->custom2) { + case 1: { + alpha=in[0]-MAX2(in[1],in[2]); + break; + } + case 2: { + alpha=in[1]-MAX2(in[0],in[2]); + break; + } + case 3: { + alpha=in[2]-MAX2(in[0],in[1]); + break; + } + default: + break; + } + } + default: + break; + } /*flip because 0.0 is transparent, not 1.0*/ alpha=1-alpha; @@ -131,24 +137,24 @@ static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack /*convert to colorspace*/ switch(node->custom1) { - case CMP_NODE_CHANNEL_MATTE_CS_RGB: - break; - case CMP_NODE_CHANNEL_MATTE_CS_HSV: /*HSV*/ - composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_rgba_to_hsva, CB_RGBA); - break; - case CMP_NODE_CHANNEL_MATTE_CS_YUV: /*YUV*/ - composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_rgba_to_yuva, CB_RGBA); - break; - case CMP_NODE_CHANNEL_MATTE_CS_YCC: /*YCC*/ - composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_normalized_rgba_to_ycca2, CB_RGBA); - break; - default: - break; + case CMP_NODE_CHANNEL_MATTE_CS_RGB: + break; + case CMP_NODE_CHANNEL_MATTE_CS_HSV: /*HSV*/ + composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_rgba_to_hsva, CB_RGBA); + break; + case CMP_NODE_CHANNEL_MATTE_CS_YUV: /*YUV*/ + composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_rgba_to_yuva, CB_RGBA); + break; + case CMP_NODE_CHANNEL_MATTE_CS_YCC: /*YCC*/ + composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_normalized_rgba_to_ycca2, CB_RGBA); + break; + default: + break; } /*use the selected channel information to do the key */ composit1_pixel_processor(node, outbuf, outbuf, in[1]->vec, do_channel_matte, CB_RGBA); - + /*convert back to RGB colorspace in place*/ switch(node->custom1) { case CMP_NODE_CHANNEL_MATTE_CS_RGB: /*RGB*/ @@ -185,6 +191,8 @@ static void node_composit_init_channel_matte(bNode *node) c->t3= 0.0f; c->fsize= 0.0f; c->fstrength= 0.0f; + c->algorithm=1; /*max channel limiting */ + c->channel=1; /* limit by red */ node->custom1= 1; /* RGB channel */ node->custom2= 2; /* Green Channel */ } diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c index 5fcbcd0b854..23a5b719e5b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c @@ -22,7 +22,7 @@ * * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): Bob Holcomb, Xavier Thomas * * ***** END GPL LICENSE BLOCK ***** */ @@ -30,6 +30,7 @@ #include "../CMP_util.h" +#define avg(a,b) ((a+b)/2) /* ******************* Color Spill Supression ********************************* */ static bNodeSocketType cmp_node_color_spill_in[]={ @@ -42,33 +43,93 @@ static bNodeSocketType cmp_node_color_spill_out[]={ {-1,0,""} }; -static void do_reduce_red(bNode *node, float* out, float *in) +static void do_simple_spillmap_red(bNode *node, float* out, float *in) { - NodeChroma *c; - c=node->storage; - - if(in[0] > in[1] && in[0] > in[2]) { - out[0]=((in[1]+in[2])/2)*(1-c->t1); + NodeColorspill *ncs; + ncs=node->storage; + out[0]=in[0]-( ncs->limscale * in[ncs->limchan] ); +} + +static void do_simple_spillmap_green(bNode *node, float* out, float *in) +{ + NodeColorspill *ncs; + ncs=node->storage; + out[0]=in[1]-( ncs->limscale * in[ncs->limchan] ); +} + +static void do_simple_spillmap_blue(bNode *node, float* out, float *in) +{ + NodeColorspill *ncs; + ncs=node->storage; + out[0]=in[2]-( ncs->limscale * in[ncs->limchan] ); +} + +static void do_average_spillmap_red(bNode *node, float* out, float *in) +{ + NodeColorspill *ncs; + ncs=node->storage; + out[0]=in[0]-(ncs->limscale * avg(in[1], in[2]) ); +} + +static void do_average_spillmap_green(bNode *node, float* out, float *in) +{ + NodeColorspill *ncs; + ncs=node->storage; + out[0]=in[1]-(ncs->limscale * avg(in[0], in[2]) ); +} + +static void do_average_spillmap_blue(bNode *node, float* out, float *in) +{ + NodeColorspill *ncs; + ncs=node->storage; + out[0]=in[2]-(ncs->limscale * avg(in[0], in[1]) ); +} + +static void do_apply_spillmap_red(bNode *node, float* out, float *in, float *map) +{ + NodeColorspill *ncs; + ncs=node->storage; + if(map[0]>0) { + out[0]=in[0]-(ncs->uspillr*map[0]); + out[1]=in[1]+(ncs->uspillg*map[0]); + out[2]=in[2]+(ncs->uspillb*map[0]); + } + else { + out[0]=in[0]; + out[1]=in[1]; + out[2]=in[2]; } } -static void do_reduce_green(bNode *node, float* out, float *in) +static void do_apply_spillmap_green(bNode *node, float* out, float *in, float *map) { - NodeChroma *c; - c=node->storage; - - if(in[1] > in[0] && in[1] > in[2]) { - out[1]=((in[0]+in[2])/2)*(1-c->t1); + NodeColorspill *ncs; + ncs=node->storage; + if(map[0]>0) { + out[0]=in[0]+(ncs->uspillr*map[0]); + out[1]=in[1]-(ncs->uspillg*map[0]); + out[2]=in[2]+(ncs->uspillb*map[0]); + } + else { + out[0]=in[0]; + out[1]=in[1]; + out[2]=in[2]; } } -static void do_reduce_blue(bNode *node, float* out, float *in) +static void do_apply_spillmap_blue(bNode *node, float* out, float *in, float *map) { - NodeChroma *c; - c=node->storage; - - if(in[2] > in[1] && in[2] > in[1]) { - out[2]=((in[1]+in[0])/2)*(1-c->t1); + NodeColorspill *ncs; + ncs=node->storage; + if(map[0]>0) { + out[0]=in[0]+(ncs->uspillr*map[0]); + out[1]=in[1]+(ncs->uspillg*map[0]); + out[2]=in[2]-(ncs->uspillb*map[0]); + } + else { + out[0]=in[0]; + out[1]=in[1]; + out[2]=in[2]; } } @@ -79,28 +140,86 @@ static void node_composit_exec_color_spill(void *data, bNode *node, bNodeStack * discussions from vfxtalk.com.*/ CompBuf *cbuf; CompBuf *rgbbuf; + CompBuf *spillmap; + NodeColorspill *ncs; + ncs=node->storage; if(out[0]->hasoutput==0 || in[0]->hasinput==0) return; if(in[0]->data==NULL) return; cbuf=typecheck_compbuf(in[0]->data, CB_RGBA); + spillmap=alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1); rgbbuf=dupalloc_compbuf(cbuf); switch(node->custom1) { case 1: /*red spill*/ { - composit1_pixel_processor(node, rgbbuf, cbuf, in[1]->vec, do_reduce_red, CB_RGBA); + switch(node->custom2) + { + case 0: /* simple limit */ + { + composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_red, CB_RGBA); + break; + } + case 1: /* average limit */ + { + composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_red, CB_RGBA); + break; + } + } + if(ncs->unspill==0) { + ncs->uspillr=1.0f; + ncs->uspillg=0.0f; + ncs->uspillb=0.0f; + } + composit2_pixel_processor(node, rgbbuf, cbuf, in[0]->vec, spillmap, NULL, do_apply_spillmap_red, CB_RGBA, CB_VAL); break; } case 2: /*green spill*/ { - composit1_pixel_processor(node, rgbbuf, cbuf, in[1]->vec, do_reduce_green, CB_RGBA); + switch(node->custom2) + { + case 0: /* simple limit */ + { + composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_green, CB_RGBA); + break; + } + case 1: /* average limit */ + { + composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_green, CB_RGBA); + break; + } + } + if(ncs->unspill==0) { + ncs->uspillr=0.0f; + ncs->uspillg=1.0f; + ncs->uspillb=0.0f; + } + composit2_pixel_processor(node, rgbbuf, cbuf, in[0]->vec, spillmap, NULL, do_apply_spillmap_green, CB_RGBA, CB_VAL); break; } case 3: /*blue spill*/ { - composit1_pixel_processor(node, rgbbuf, cbuf, in[1]->vec, do_reduce_blue, CB_RGBA); + switch(node->custom2) + { + case 0: /* simple limit */ + { + composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_blue, CB_RGBA); + break; + } + case 1: /* average limit */ + { + composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_blue, CB_RGBA); + break; + } + } + if(ncs->unspill==0) { + ncs->uspillr=0.0f; + ncs->uspillg=0.0f; + ncs->uspillb=1.0f; + } + composit2_pixel_processor(node, rgbbuf, cbuf, in[0]->vec, spillmap, NULL, do_apply_spillmap_blue, CB_RGBA, CB_VAL); break; } default: @@ -111,18 +230,19 @@ static void node_composit_exec_color_spill(void *data, bNode *node, bNodeStack * if(cbuf!=in[0]->data) free_compbuf(cbuf); + + free_compbuf(spillmap); } static void node_composit_init_color_spill(bNode *node) { - NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma"); - node->storage=c; - c->t1= 0.0f; - c->t2= 0.0f; - c->t3= 0.0f; - c->fsize= 0.0f; - c->fstrength= 0.0f; + NodeColorspill *ncs= MEM_callocN(sizeof(NodeColorspill), "node colorspill"); + node->storage=ncs; node->custom1= 2; /* green channel */ + node->custom2= 0; /* simple limit algo*/ + ncs->limchan= 0; /* limit by red */ + ncs->limscale= 1.0f; /* limit scaling factor */ + ncs->unspill=0; /* do not use unspill */ } bNodeType cmp_node_color_spill={ @@ -133,7 +253,7 @@ bNodeType cmp_node_color_spill={ /* class+opts */ NODE_CLASS_MATTE, NODE_OPTIONS, /* input sock */ cmp_node_color_spill_in, /* output sock */ cmp_node_color_spill_out, - /* storage */ "NodeChroma", + /* storage */ "NodeColorspill", /* execfunc */ node_composit_exec_color_spill, /* butfunc */ NULL, /* initfunc */ node_composit_init_color_spill, diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c index 76a78e46e3a..9a302527a61 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c @@ -80,10 +80,10 @@ static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **i outbuf->malloc= 0; free_compbuf(outbuf); - RE_ReleaseResult(re); - /* signal for imageviewer to refresh (it converts to byte rects...) */ BKE_image_signal(BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result"), NULL, IMA_SIGNAL_FREE); + + RE_ReleaseResult(re); return; } else diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c index f1b39587e2a..aa282a78af1 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c @@ -42,9 +42,7 @@ static bNodeSocketType cmp_node_diff_matte_out[]={ {-1,0,""} }; -/* note, keyvals is passed on from caller as stack array */ -/* might have been nicer as temp struct though... */ -static void do_diff_matte(bNode *node, float *colorbuf, float *imbuf1, float *imbuf2) +static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float *inColor2) { NodeChroma *c= (NodeChroma *)node->storage; float tolerence=c->t1; @@ -52,52 +50,57 @@ static void do_diff_matte(bNode *node, float *colorbuf, float *imbuf1, float *im float difference; float alpha; - difference=fabs(imbuf2[0]-imbuf1[0])+ - fabs(imbuf2[1]-imbuf1[1])+ - fabs(imbuf2[2]-imbuf1[2]); + difference=fabs(inColor2[0]-inColor1[0])+ + fabs(inColor2[1]-inColor1[1])+ + fabs(inColor2[2]-inColor1[2]); /*average together the distances*/ difference=difference/3.0; - VECCOPY(colorbuf, imbuf1); + VECCOPY(outColor, inColor1); /*make 100% transparent*/ if(difference < tolerence){ - colorbuf[3]=0.0; + outColor[3]=0.0; } /*in the falloff region, make partially transparent */ else if(difference < falloff+tolerence){ difference=difference-tolerence; alpha=difference/falloff; /*only change if more transparent than before */ - if(alpha < imbuf1[3]) { - colorbuf[3]=alpha; + if(alpha < inColor1[3]) { + outColor[3]=alpha; } else { /* leave as before */ - colorbuf[3]=imbuf1[3]; + outColor[3]=inColor1[3]; } } else { /*foreground object*/ - colorbuf[3]= imbuf1[3]; + outColor[3]= inColor1[3]; } } static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { - CompBuf *outbuf; - CompBuf *imbuf1; - CompBuf *imbuf2; + CompBuf *outbuf=0; + CompBuf *imbuf1=0; + CompBuf *imbuf2=0; NodeChroma *c; /*is anything connected?*/ if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return; + /*must have an image imput*/ if(in[0]->data==NULL) return; - if(in[1]->data==NULL) return; + imbuf1=typecheck_compbuf(in[0]->data, CB_RGBA); - imbuf2=typecheck_compbuf(in[1]->data, CB_RGBA); + + /* if there's an image, use that, if not use the color */ + if(in[1]->data) { + imbuf2=typecheck_compbuf(in[1]->data, CB_RGBA); + } c=node->storage; outbuf=dupalloc_compbuf(imbuf1); diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_image.c b/source/blender/nodes/intern/CMP_nodes/CMP_image.c index aa3fa9db412..a5063702365 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_image.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_image.c @@ -46,9 +46,11 @@ static bNodeSocketType cmp_node_rlayers_out[]= { { SOCK_RGBA, 0, "AO", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 0, "Reflect", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 0, "Refract", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_RGBA, 0, "Radio", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_RGBA, 0, "Indirect", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_VALUE, 0, "IndexOB", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_VALUE, 0, "Mist", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_RGBA, 0, "Emit", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_RGBA, 0, "Environment",0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { -1, 0, "" } }; @@ -176,13 +178,16 @@ void outputs_multilayer_get(RenderData *rd, RenderLayer *rl, bNodeStack **out, I out[RRES_OUT_REFLECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_REFLECT); if(out[RRES_OUT_REFRACT]->hasoutput) out[RRES_OUT_REFRACT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_REFRACT); - if(out[RRES_OUT_RADIO]->hasoutput) - out[RRES_OUT_RADIO]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_RADIO); + if(out[RRES_OUT_INDIRECT]->hasoutput) + out[RRES_OUT_INDIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDIRECT); if(out[RRES_OUT_INDEXOB]->hasoutput) out[RRES_OUT_INDEXOB]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDEXOB); if(out[RRES_OUT_MIST]->hasoutput) out[RRES_OUT_MIST]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_MIST); - + if(out[RRES_OUT_EMIT]->hasoutput) + out[RRES_OUT_EMIT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_EMIT); + if(out[RRES_OUT_ENV]->hasoutput) + out[RRES_OUT_ENV]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_ENVIRONMENT); }; @@ -334,13 +339,16 @@ void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStack **out out[RRES_OUT_REFLECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_REFLECT); if(out[RRES_OUT_REFRACT]->hasoutput) out[RRES_OUT_REFRACT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_REFRACT); - if(out[RRES_OUT_RADIO]->hasoutput) - out[RRES_OUT_RADIO]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_RADIO); + if(out[RRES_OUT_INDIRECT]->hasoutput) + out[RRES_OUT_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDIRECT); if(out[RRES_OUT_INDEXOB]->hasoutput) out[RRES_OUT_INDEXOB]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXOB); if(out[RRES_OUT_MIST]->hasoutput) out[RRES_OUT_MIST]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_MIST); - + if(out[RRES_OUT_EMIT]->hasoutput) + out[RRES_OUT_EMIT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_EMIT); + if(out[RRES_OUT_ENV]->hasoutput) + out[RRES_OUT_ENV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_ENVIRONMENT); }; static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **in, bNodeStack **out) diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c index 0a2fe906eb6..4da0b20c6f8 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c @@ -41,46 +41,6 @@ static bNodeSocketType cmp_node_rotate_out[]= { { -1, 0, "" } }; -/* function assumes out to be zero'ed, only does RGBA */ -static void bilinear_interpolation_rotate(CompBuf *in, float *out, float u, float v) -{ - float *row1, *row2, *row3, *row4, a, b; - float a_b, ma_b, a_mb, ma_mb; - float empty[4]= {0.0f, 0.0f, 0.0f, 0.0f}; - int y1, y2, x1, x2; - - x1= (int)floor(u); - x2= (int)ceil(u); - y1= (int)floor(v); - y2= (int)ceil(v); - - /* sample area entirely outside image? */ - if(x2<0 || x1>in->x-1 || y2<0 || y1>in->y-1) - return; - - /* sample including outside of edges of image */ - if(x1<0 || y1<0) row1= empty; - else row1= in->rect + in->x * y1 * in->type + in->type*x1; - - if(x1<0 || y2>in->y-1) row2= empty; - else row2= in->rect + in->x * y2 * in->type + in->type*x1; - - if(x2>in->x-1 || y1<0) row3= empty; - else row3= in->rect + in->x * y1 * in->type + in->type*x2; - - if(x2>in->x-1 || y2>in->y-1) row4= empty; - else row4= in->rect + in->x * y2 * in->type + in->type*x2; - - a= u-floor(u); - b= v-floor(v); - a_b= a*b; ma_b= (1.0f-a)*b; a_mb= a*(1.0f-b); ma_mb= (1.0f-a)*(1.0f-b); - - out[0]= ma_mb*row1[0] + a_mb*row3[0] + ma_b*row2[0]+ a_b*row4[0]; - out[1]= ma_mb*row1[1] + a_mb*row3[1] + ma_b*row2[1]+ a_b*row4[1]; - out[2]= ma_mb*row1[2] + a_mb*row3[2] + ma_b*row2[2]+ a_b*row4[2]; - out[3]= ma_mb*row1[3] + a_mb*row3[3] + ma_b*row2[3]+ a_b*row4[3]; -} - /* only supports RGBA nodes now */ static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { @@ -91,8 +51,9 @@ static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in, if(in[0]->data) { CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA); CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* note, this returns zero'd image */ - float *ofp, rad, u, v, s, c, centx, centy, miny, maxy, minx, maxx; - int x, y, yo; + float rad, u, v, s, c, centx, centy, miny, maxy, minx, maxx; + int x, y, yo, xo; + ImBuf *ibuf, *obuf; rad= (M_PI*in[1]->vec[0])/180.0f; @@ -106,32 +67,56 @@ static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in, miny= -centy; maxy= -centy + (float)cbuf->y; - for(y=miny; y<maxy; y++) { - yo= y+(int)centy; - ofp= stackbuf->rect + 4*yo*stackbuf->x; - - for(x=minx; x<maxx; x++, ofp+=4) { - u= c*x + y*s + centx; - v= -s*x + c*y + centy; - - bilinear_interpolation_rotate(cbuf, ofp, u, v); + + ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0); + obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0, 0); + + if(ibuf){ + ibuf->rect_float=cbuf->rect; + obuf->rect_float=stackbuf->rect; + + for(y=miny; y<maxy; y++) { + yo= y+(int)centy; + + for(x=minx; x<maxx;x++) { + u=c*x + y*s + centx; + v=-s*x + c*y + centy; + xo= x+(int)centx; + + switch(node->custom1) { + case 0: + neareast_interpolation(ibuf, obuf, u, v, xo, yo); + break ; + case 1: + bilinear_interpolation(ibuf, obuf, u, v, xo, yo); + break; + case 2: + bicubic_interpolation(ibuf, obuf, u, v, xo, yo); + } + + } } + + /* rotate offset vector too, but why negative rad, ehh?? Has to be replaced with [3][3] matrix once (ton) */ + s= sin(-rad); + c= cos(-rad); + centx= (float)cbuf->xof; centy= (float)cbuf->yof; + stackbuf->xof= (int)( c*centx + s*centy); + stackbuf->yof= (int)(-s*centx + c*centy); } - /* rotate offset vector too, but why negative rad, ehh?? Has to be replaced with [3][3] matrix once (ton) */ - s= sin(-rad); - c= cos(-rad); - centx= (float)cbuf->xof; centy= (float)cbuf->yof; - stackbuf->xof= (int)( c*centx + s*centy); - stackbuf->yof= (int)(-s*centx + c*centy); /* pass on output and free */ out[0]->data= stackbuf; if(cbuf!=in[0]->data) free_compbuf(cbuf); - } } +static void node_composit_init_rotate(bNode *node) +{ + node->custom1= 1; /* Bilinear Filter*/ +} + bNodeType cmp_node_rotate= { /* *next,*prev */ NULL, NULL, /* type code */ CMP_NODE_ROTATE, @@ -143,7 +128,7 @@ bNodeType cmp_node_rotate= { /* storage */ "", /* execfunc */ node_composit_exec_rotate, /* butfunc */ NULL, - /* initfunc */ NULL, + /* initfunc */ node_composit_init_rotate, /* freestoragefunc */ NULL, /* copystoragefunc */ NULL, /* id */ NULL diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c index e62a7462702..80200ad9ce6 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c @@ -50,13 +50,15 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, ImBuf *ibuf; CompBuf *cbuf, *tbuf; int rectx, recty; + void *lock; BKE_image_user_calc_frame(node->storage, rd->cfra, 0); /* always returns for viewer image, but we check nevertheless */ - ibuf= BKE_image_get_ibuf(ima, node->storage); + ibuf= BKE_image_acquire_ibuf(ima, node->storage, &lock); if(ibuf==NULL) { printf("node_composit_exec_viewer error\n"); + BKE_image_release_ibuf(ima, lock); return; } @@ -106,6 +108,8 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, free_compbuf(zbuf); } + BKE_image_release_ibuf(ima, lock); + generate_preview(data, node, cbuf); free_compbuf(cbuf); diff --git a/source/blender/python/doc/sphinx_doc_gen.py b/source/blender/python/doc/sphinx_doc_gen.py index 701aad651cf..944dbb082a6 100644 --- a/source/blender/python/doc/sphinx_doc_gen.py +++ b/source/blender/python/doc/sphinx_doc_gen.py @@ -277,6 +277,8 @@ def rna2sphinx(BASEPATH): fw("\n") fw("An introduction to blender and python can be found at <http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro>\n") fw("\n") + fw("`A PDF version of this document is also available <blender_python_reference_250.pdf>`__\n") + fw("\n") fw(".. warning:: The Python API in Blender is **UNSTABLE**, It should only be used for testing, any script written now may break in future releases.\n") fw(" \n") fw(" The following areas are subject to change.\n") diff --git a/source/blender/python/doc/sphinx_doc_gen.sh b/source/blender/python/doc/sphinx_doc_gen.sh new file mode 100755 index 00000000000..3f5460a0626 --- /dev/null +++ b/source/blender/python/doc/sphinx_doc_gen.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# run from the blender source dir +# bash source/blender/python/doc/sphinx_doc_gen.sh +# ssh upload means you need a login into the server + +BLENDER="./blender.bin" +SSH_HOST="ideasman42@emo.blender.org" +SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation/250PythonDoc" + +# clear doc dir +rm -rf ./source/blender/python/doc/sphinx-in ./source/blender/python/doc/sphinx-out +$BLENDER -b -P ./source/blender/python/doc/sphinx_doc_gen.py + +# html +sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out +cp source/blender/python/doc/sphinx-out/contents.html source/blender/python/doc/sphinx-out/index.html +ssh ideasman42@emo.blender.org 'rm -rf '$SSH_UPLOAD'/*' +rsync --progress -avze "ssh -p 22" /b/source/blender/python/doc/sphinx-out/* $SSH_HOST:$SSH_UPLOAD/ + +# pdf +sphinx-build -b latex source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out +cd source/blender/python/doc/sphinx-out +make +cd ../../../../../ +rsync --progress -avze "ssh -p 22" source/blender/python/doc/sphinx-out/contents.pdf $SSH_HOST:$SSH_UPLOAD/blender_python_reference_250.pdf diff --git a/source/blender/python/generic/Geometry.c b/source/blender/python/generic/Geometry.c index fecad5904d2..f204fa62904 100644 --- a/source/blender/python/generic/Geometry.c +++ b/source/blender/python/generic/Geometry.c @@ -29,11 +29,6 @@ #include "Geometry.h" -/* - Not needed for now though other geometry functions will probably need them -#include "BLI_math.h" -#include "BKE_utildefines.h" -*/ - /* Used for PolyFill */ #include "BKE_displist.h" #include "MEM_guardedalloc.h" diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index decc28198ff..ba563f9fcbf 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -1,5 +1,5 @@ /** - * $Id: IDProp.c + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -23,17 +23,10 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include "DNA_ID.h" - #include "BKE_idprop.h" - #include "IDProp.h" -// #include "gen_utils.h" - #include "MEM_guardedalloc.h" -#define BSTR_EQ(a, b) (*(a) == *(b) && !strcmp(a, b)) - /*** Function to wrap ID properties ***/ PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent); diff --git a/source/blender/python/generic/IDProp.h b/source/blender/python/generic/IDProp.h index 6a8cb7db3c4..c0a07879c1d 100644 --- a/source/blender/python/generic/IDProp.h +++ b/source/blender/python/generic/IDProp.h @@ -1,5 +1,5 @@ /** - * $Id: IDProp.h + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/python/generic/Mathutils.c b/source/blender/python/generic/Mathutils.c index fc21c26dd74..1cf4d2254ea 100644 --- a/source/blender/python/generic/Mathutils.c +++ b/source/blender/python/generic/Mathutils.c @@ -50,8 +50,6 @@ #include "Mathutils.h" #include "BLI_math.h" -#include "PIL_time.h" -#include "BKE_utildefines.h" //-------------------------DOC STRINGS --------------------------- static char M_Mathutils_doc[] = diff --git a/source/blender/python/generic/blf.c b/source/blender/python/generic/blf.c index 52fe860f988..f703cfac2a9 100644 --- a/source/blender/python/generic/blf.c +++ b/source/blender/python/generic/blf.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/python/generic/blf.h b/source/blender/python/generic/blf.h index 0a0e97934e2..fae20ace996 100644 --- a/source/blender/python/generic/blf.h +++ b/source/blender/python/generic/blf.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index 873398e7763..fc0cd3fc18b 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -28,7 +28,6 @@ #include "bpy_internal_import.h" #include "DNA_text_types.h" -#include "DNA_ID.h" #include "MEM_guardedalloc.h" #include "BKE_text.h" /* txt_to_buf */ diff --git a/source/blender/python/generic/euler.c b/source/blender/python/generic/euler.c index 84360a76e61..3c20d341c7b 100644 --- a/source/blender/python/generic/euler.c +++ b/source/blender/python/generic/euler.c @@ -30,9 +30,10 @@ #include "BLI_math.h" #include "BKE_utildefines.h" -#include "BLI_blenlib.h" +#ifndef int32_t #include "BLO_sys_types.h" +#endif //----------------------------------Mathutils.Euler() ------------------- //makes a new euler for you to play with diff --git a/source/blender/python/generic/quat.c b/source/blender/python/generic/quat.c index 3a9617c05c4..b08383cb508 100644 --- a/source/blender/python/generic/quat.c +++ b/source/blender/python/generic/quat.c @@ -30,7 +30,6 @@ #include "BLI_math.h" #include "BKE_utildefines.h" -#include "BLI_blenlib.h" //-----------------------------METHODS------------------------------ static char Quaternion_ToEuler_doc[] = diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index da7a8857f6e..eed9f4174c2 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -25,7 +25,6 @@ /* This file defines the '_bpy' module which is used by python's 'bpy' package. * a script writer should never directly access this module */ -#include <Python.h> #include "bpy_util.h" #include "bpy_rna.h" @@ -36,7 +35,6 @@ #include "BLI_path_util.h" /* external util modules */ -#include "../generic/Mathutils.h" #include "../generic/Geometry.h" #include "../generic/bgl.h" #include "../generic/blf.h" diff --git a/source/blender/python/intern/bpy.h b/source/blender/python/intern/bpy.h index 024986b99a6..114d0f9a43d 100644 --- a/source/blender/python/intern/bpy.h +++ b/source/blender/python/intern/bpy.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 59c1c0bf7c2..15c6ad09e69 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -23,7 +23,6 @@ */ #include "bpy_app.h" -#include "bpy_util.h" #include "BLI_path_util.h" @@ -32,11 +31,11 @@ #include "structseq.h" #ifdef BUILD_DATE -extern const char * build_date; -extern const char * build_time; -extern const char * build_rev; -extern const char * build_platform; -extern const char * build_type; +extern char build_date[]; +extern char build_time[]; +extern char build_rev[]; +extern char build_platform[]; +extern char build_type[]; #endif static PyTypeObject BlenderAppType; @@ -64,24 +63,9 @@ static PyStructSequence_Desc app_info_desc = { 10 }; -static char *strip_quotes(char *buf, const char *input) -{ - int i; - strcpy(buf, input); - if(buf[0]=='\0') return buf; - while(buf[1] && (buf[0]=='"' || buf[0]=='\'')) buf++; - if(buf[0]=='\0') return buf; - i= strlen(buf) - 1; - while(i>=0 && (buf[i]=='"' || buf[i]=='\'')) i--; - buf[i+1]= '\0'; - - return buf; -} - static PyObject *make_app_info(void) { extern char bprogname[]; /* argv[0] from creator.c */ - char buf[256]; PyObject *app_info; int pos = 0; @@ -106,17 +90,17 @@ static PyObject *make_app_info(void) /* build info */ #ifdef BUILD_DATE - SetStrItem(strip_quotes(buf, build_date)); - SetStrItem(strip_quotes(buf, build_time)); - SetStrItem(strip_quotes(buf, build_rev)); - SetStrItem(strip_quotes(buf, build_platform)); - SetStrItem(strip_quotes(buf, build_type)); + SetStrItem(build_date); + SetStrItem(build_time); + SetStrItem(build_rev); + SetStrItem(build_platform); + SetStrItem(build_type); #else - SetStrItem(strip_quotes(buf, "Unknown")); - SetStrItem(strip_quotes(buf, "Unknown")); - SetStrItem(strip_quotes(buf, "Unknown")); - SetStrItem(strip_quotes(buf, "Unknown")); - SetStrItem(strip_quotes(buf, "Unknown")); + SetStrItem("Unknown"); + SetStrItem("Unknown"); + SetStrItem("Unknown"); + SetStrItem("Unknown"); + SetStrItem("Unknown"); #endif #undef SetIntItem diff --git a/source/blender/python/intern/bpy_array.c b/source/blender/python/intern/bpy_array.c index bb1826d231d..a20a7f54e22 100644 --- a/source/blender/python/intern/bpy_array.c +++ b/source/blender/python/intern/bpy_array.c @@ -22,14 +22,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include "Python.h" - #include "bpy_rna.h" - -#include "RNA_access.h" - -#include "BLI_string.h" - #include "BKE_global.h" #define MAX_ARRAY_DIMENSION 10 diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index f628e7e8569..eab4d352225 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -27,8 +27,8 @@ #include "DNA_anim_types.h" #include "BLI_listbase.h" +#include "BLI_math_base.h" -#include "BPY_extern.h" #include "BKE_fcurve.h" #include "BKE_global.h" @@ -153,22 +153,19 @@ float BPY_pydriver_eval (ChannelDriver *driver) PyGILState_STATE gilstate; DriverVar *dvar; - float result = 0.0f; /* default return */ + double result = 0.0; /* default return */ char *expr = NULL; short targets_ok= 1; int i; - /* sanity checks - should driver be executed? */ - /*if (G.f & G_SCRIPT_AUTOEXEC)==0) return result; */ - /* get the py expression to be evaluated */ expr = driver->expression; if ((expr == NULL) || (expr[0]=='\0')) - return result; + return 0.0f; if(!(G.f & G_SCRIPT_AUTOEXEC)) { printf("skipping driver '%s', automatic scripts are disabled\n", driver->expression); - return result; + return 0.0f; } gilstate = PyGILState_Ensure(); @@ -178,7 +175,7 @@ float BPY_pydriver_eval (ChannelDriver *driver) if (bpy_pydriver_create_dict() != 0) { fprintf(stderr, "Pydriver error: couldn't create Python dictionary"); PyGILState_Release(gilstate); - return result; + return 0.0f; } } @@ -239,7 +236,7 @@ float BPY_pydriver_eval (ChannelDriver *driver) targets_ok= 0; } - fprintf(stderr, "\tBPY_pydriver_eval() - couldn't add variable '%s' to namespace \n", dvar->name); + fprintf(stderr, "\tBPY_pydriver_eval() - couldn't add variable '%s' to namespace\n", dvar->name); // BPy_errors_to_report(NULL); // TODO - reports PyErr_Print(); PyErr_Clear(); @@ -261,12 +258,10 @@ float BPY_pydriver_eval (ChannelDriver *driver) /* process the result */ if (retval == NULL) { pydriver_error(driver); - result = 0.0f; - } else if((result= (float)PyFloat_AsDouble(retval)) == -1.0f && PyErr_Occurred()) { + } else if((result= PyFloat_AsDouble(retval)) == -1.0 && PyErr_Occurred()) { pydriver_error(driver); Py_DECREF(retval); - result = 0.0f; - + result = 0.0; } else { /* all fine, make sure the "invalid expression" flag is cleared */ @@ -275,5 +270,12 @@ float BPY_pydriver_eval (ChannelDriver *driver) } PyGILState_Release(gilstate); - return result; + + if(finite(result)) { + return (float)result; + } + else { + fprintf(stderr, "\tBPY_pydriver_eval() - driver '%s' evaluates to '%f'\n", dvar->name, result); + return 0.0f; + } } diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 4160d56ba25..285dbb78874 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -23,10 +23,6 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> /* grr, python redefines */ @@ -34,33 +30,20 @@ #undef _POSIX_C_SOURCE #endif -#include <Python.h> -#include "compile.h" /* for the PyCodeObject */ -#include "eval.h" /* for PyEval_EvalCode */ #include "bpy.h" #include "bpy_rna.h" #include "bpy_util.h" -#ifndef WIN32 -#include <dirent.h> -#else -#include "BLI_winstuff.h" -#endif - #include "DNA_space_types.h" #include "DNA_text_types.h" #include "MEM_guardedalloc.h" - -#include "BLI_storage.h" -#include "BLI_fileops.h" -#include "BLI_string.h" #include "BLI_path_util.h" +#include "BLI_math_base.h" #include "BKE_context.h" #include "BKE_text.h" -#include "BKE_context.h" #include "BKE_main.h" #include "BKE_global.h" /* only for script checking */ @@ -544,12 +527,6 @@ int BPY_run_python_script_space(const char *modulename, const char *func) } #endif -// #define TIME_REGISTRATION - -#ifdef TIME_REGISTRATION -#include "PIL_time.h" -#endif - int BPY_button_eval(bContext *C, char *expr, double *value) { @@ -604,6 +581,9 @@ int BPY_button_eval(bContext *C, char *expr, double *value) if(val==-1 && PyErr_Occurred()) { error_ret= -1; } + else if (!finite(val)) { + *value= 0.0; + } else { *value= val; } diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index b2a8f5be097..0e54f158ac4 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -39,7 +39,6 @@ #include "MEM_guardedalloc.h" #include "BKE_report.h" -#include "BKE_utildefines.h" static PyObject *pyop_call( PyObject * self, PyObject * args) diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c index 21ba815d95f..0c1eafb4948 100644 --- a/source/blender/python/intern/bpy_operator_wrap.c +++ b/source/blender/python/intern/bpy_operator_wrap.c @@ -24,15 +24,12 @@ */ #include "bpy_operator_wrap.h" -#include "BKE_context.h" #include "WM_api.h" #include "WM_types.h" #include "RNA_define.h" #include "bpy_rna.h" -#include "bpy_props.h" -#include "bpy_util.h" static void operator_properties_init(wmOperatorType *ot) { @@ -114,7 +111,7 @@ PyObject *PYOP_wrap_macro_define(PyObject *self, PyObject *args) } /* identifiers */ - srna= srna_from_self(macro); + srna= srna_from_self(macro, "Macro Define:"); macroname = RNA_struct_identifier(srna); ot = WM_operatortype_exists(macroname); diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 154f20e57c7..c23ff2f2951 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -26,14 +26,11 @@ #include "bpy_rna.h" #include "bpy_util.h" -#include "RNA_access.h" #include "RNA_define.h" /* for defining our own rna */ #include "RNA_enum_types.h" #include "MEM_guardedalloc.h" -#include "float.h" /* FLT_MIN/MAX */ - EnumPropertyItem property_flag_items[] = { {PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""}, {PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""}, @@ -118,7 +115,7 @@ PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) return NULL; } - srna= srna_from_self(self); + srna= srna_from_self(self, "BoolProperty(...):"); if(srna==NULL && PyErr_Occurred()) { return NULL; /* self's type was compatible but error getting the srna */ } @@ -184,7 +181,7 @@ PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject *kw) return NULL; } - srna= srna_from_self(self); + srna= srna_from_self(self, "BoolVectorProperty(...):"); if(srna==NULL && PyErr_Occurred()) { return NULL; /* self's type was compatible but error getting the srna */ } @@ -261,7 +258,7 @@ PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) return NULL; } - srna= srna_from_self(self); + srna= srna_from_self(self, "IntProperty(...):"); if(srna==NULL && PyErr_Occurred()) { return NULL; /* self's type was compatible but error getting the srna */ } @@ -328,7 +325,7 @@ PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw) return NULL; } - srna= srna_from_self(self); + srna= srna_from_self(self, "IntVectorProperty(...):"); if(srna==NULL && PyErr_Occurred()) { return NULL; /* self's type was compatible but error getting the srna */ } @@ -409,7 +406,7 @@ PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) return NULL; } - srna= srna_from_self(self); + srna= srna_from_self(self, "FloatProperty(...):"); if(srna==NULL && PyErr_Occurred()) { return NULL; /* self's type was compatible but error getting the srna */ } @@ -484,7 +481,7 @@ PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw) return NULL; } - srna= srna_from_self(self); + srna= srna_from_self(self, "FloatVectorProperty(...):"); if(srna==NULL && PyErr_Occurred()) { return NULL; /* self's type was compatible but error getting the srna */ } @@ -562,7 +559,7 @@ PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw) return NULL; } - srna= srna_from_self(self); + srna= srna_from_self(self, "StringProperty(...):"); if(srna==NULL && PyErr_Occurred()) { return NULL; /* self's type was compatible but error getting the srna */ } @@ -674,7 +671,7 @@ PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) return NULL; } - srna= srna_from_self(self); + srna= srna_from_self(self, "EnumProperty(...):"); if(srna==NULL && PyErr_Occurred()) { return NULL; /* self's type was compatible but error getting the srna */ } @@ -719,18 +716,22 @@ PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) } } -static StructRNA *pointer_type_from_py(PyObject *value) +static StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix) { StructRNA *srna; - srna= srna_from_self(value); + srna= srna_from_self(value, "BoolProperty(...):"); if(!srna) { - PyErr_SetString(PyExc_SystemError, "expected an RNA type derived from IDPropertyGroup"); + + PyObject *msg= BPY_exception_buffer(); + char *msg_char= _PyUnicode_AsString(msg); + PyErr_Format(PyExc_TypeError, "%.200s expected an RNA type derived from IDPropertyGroup, failed with: %s", error_prefix, msg_char); + Py_DECREF(msg); return NULL; } if(!RNA_struct_is_a(srna, &RNA_IDPropertyGroup)) { - PyErr_SetString(PyExc_SystemError, "expected an RNA type derived from IDPropertyGroup"); + PyErr_Format(PyExc_SystemError, "%.200s expected an RNA type derived from IDPropertyGroup", error_prefix); return NULL; } @@ -755,7 +756,7 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) return NULL; } - srna= srna_from_self(self); + srna= srna_from_self(self, "PointerProperty(...):"); if(srna==NULL && PyErr_Occurred()) { return NULL; /* self's type was compatible but error getting the srna */ } @@ -780,7 +781,7 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "PointerProperty(options={...}):")) return NULL; - ptype= pointer_type_from_py(type); + ptype= pointer_type_from_py(type, "PointerProperty(...):"); if(!ptype) return NULL; @@ -816,7 +817,7 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw) return NULL; } - srna= srna_from_self(self); + srna= srna_from_self(self, "CollectionProperty(...):"); if(srna==NULL && PyErr_Occurred()) { return NULL; /* self's type was compatible but error getting the srna */ } @@ -841,7 +842,7 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw) if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "CollectionProperty(options={...}):")) return NULL; - ptype= pointer_type_from_py(type); + ptype= pointer_type_from_py(type, "CollectionProperty(...):"); if(!ptype) return NULL; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 552b187d097..dcbdc6d64d4 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -30,11 +30,8 @@ //#include "blendef.h" #include "BLI_dynstr.h" #include "BLI_listbase.h" -#include "BLI_string.h" #include "float.h" /* FLT_MIN/MAX */ -#include "RNA_access.h" -#include "RNA_define.h" /* for defining our own rna */ #include "RNA_enum_types.h" #include "MEM_guardedalloc.h" @@ -57,7 +54,6 @@ #include "../generic/Mathutils.h" /* so we can have mathutils callbacks */ #include "../generic/IDProp.h" /* for IDprop lookups */ -#include <string.h> static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length); static Py_ssize_t pyrna_prop_array_length(BPy_PropertyRNA *self); @@ -363,7 +359,7 @@ static PyObject *pyrna_struct_repr( BPy_StructRNA *self ) return pyob; } - return PyUnicode_FromFormat( "<bpy_struct, %.200s>", RNA_struct_identifier(self->ptr.type)); + return PyUnicode_FromFormat( "<bpy_struct, %.200s at %p>", RNA_struct_identifier(self->ptr.type), self->ptr.data); } static PyObject *pyrna_prop_repr( BPy_PropertyRNA *self ) @@ -772,7 +768,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v } else /* continue... */ #endif if (!PySequence_Check(value)) { - PyErr_Format(PyExc_TypeError, "%.200s RNA array assignment expected a sequence instead of %.200s instance.", error_prefix, Py_TYPE(value)->tp_name); + PyErr_Format(PyExc_TypeError, "%.200s RNA array assignment to %.200s.%.200s expected a sequence instead of %.200s instance.", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), Py_TYPE(value)->tp_name); return -1; } /* done getting the length */ @@ -800,7 +796,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v param = PyLong_AsSsize_t( value ); if( param < 0 || param > 1) { - PyErr_Format(PyExc_TypeError, "%.200s expected True/False or 0/1", error_prefix); + PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected True/False or 0/1", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop)); return -1; } else { if(data) *((int*)data)= param; @@ -812,7 +808,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v { int param = PyLong_AsSsize_t(value); if (param==-1 && PyErr_Occurred()) { - PyErr_Format(PyExc_TypeError, "%.200s expected an int type", error_prefix); + PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected an int type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop)); return -1; } else { RNA_property_int_clamp(ptr, prop, ¶m); @@ -825,7 +821,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v { float param = PyFloat_AsDouble(value); if (PyErr_Occurred()) { - PyErr_Format(PyExc_TypeError, "%.200s expected a float type", error_prefix); + PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a float type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop)); return -1; } else { RNA_property_float_clamp(ptr, prop, (float *)¶m); @@ -839,7 +835,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v char *param = _PyUnicode_AsString(value); if (param==NULL) { - PyErr_Format(PyExc_TypeError, "%.200s expected a string type", error_prefix); + PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a string type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop)); return -1; } else { if(data) *((char**)data)= param; @@ -868,7 +864,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v } else { char *enum_str= pyrna_enum_as_string(ptr, prop); - PyErr_Format(PyExc_TypeError, "%.200s expected a string enum or a set of strings in (%.200s)", error_prefix, enum_str); + PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a string enum or a set of strings in (%.2000s)", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), enum_str); MEM_freeN(enum_str); return -1; } @@ -890,13 +886,13 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v } if(!BPy_StructRNA_Check(value) && value != Py_None) { - PyErr_Format(PyExc_TypeError, "%.200s expected a %.200s type", error_prefix, RNA_struct_identifier(ptype)); + PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a %.200s type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(ptype)); return -1; } else if((flag & PROP_NEVER_NULL) && value == Py_None) { - PyErr_Format(PyExc_TypeError, "%.200s does not support a 'None' assignment %.200s type", error_prefix, RNA_struct_identifier(ptype)); + PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s does not support a 'None' assignment %.200s type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(ptype)); return -1; } else if(value != Py_None && ((flag & PROP_ID_SELF_CHECK) && ptr->id.data == ((BPy_StructRNA*)value)->ptr.id.data)) { - PyErr_Format(PyExc_TypeError, "%.200s ID type does not support assignment to its self", error_prefix); + PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s ID type does not support assignment to its self", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop)); return -1; } else { BPy_StructRNA *param= (BPy_StructRNA*)value; @@ -932,7 +928,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v else { PointerRNA tmp; RNA_pointer_create(NULL, ptype, NULL, &tmp); - PyErr_Format(PyExc_TypeError, "%.200s expected a %.200s type", error_prefix, RNA_struct_identifier(tmp.type)); + PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a %.200s type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(tmp.type)); return -1; } } @@ -940,7 +936,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v if(raise_error) { PointerRNA tmp; RNA_pointer_create(NULL, ptype, NULL, &tmp); - PyErr_Format(PyExc_TypeError, "%.200s expected a %.200s type", error_prefix, RNA_struct_identifier(tmp.type)); + PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a %.200s type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(tmp.type)); return -1; } } @@ -958,15 +954,22 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v /* convert a sequence of dict's into a collection */ if(!PySequence_Check(value)) { - PyErr_Format(PyExc_TypeError, "%.200s expected a sequence of dicts for an RNA collection", error_prefix); + PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a sequence for an RNA collection, found a '%.200s' instead", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), Py_TYPE(value)->tp_name); return -1; } - + seq_len = PySequence_Length(value); for(i=0; i<seq_len; i++) { item= PySequence_GetItem(value, i); - if(item==NULL || PyDict_Check(item)==0) { - PyErr_Format(PyExc_TypeError, "%.200s expected a sequence of dicts for an RNA collection", error_prefix); + + if(item==NULL) { + PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s failed to get sequence index '%d' for an RNA collection", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), i); + Py_XDECREF(item); + return -1; + } + + if(PyDict_Check(item)==0) { + PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a each sequence member to be a dict for an RNA collection, found a '%.200s' instead", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), Py_TYPE(item)->tp_name); Py_XDECREF(item); return -1; } @@ -980,7 +983,13 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v RNA_property_collection_add(ptr, prop, &itemptr); if(pyrna_pydict_to_props(&itemptr, item, 1, "Converting a python list to an RNA collection")==-1) { + PyObject *msg= BPY_exception_buffer(); + char *msg_char= _PyUnicode_AsString(msg); + + PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s error converting a member of a collection from a dicts into an RNA collection, failed with: %s", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), msg_char); + Py_DECREF(item); + Py_DECREF(msg); return -1; } Py_DECREF(item); @@ -989,7 +998,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v break; } default: - PyErr_Format(PyExc_AttributeError, "%.200s unknown property type (pyrna_py_to_prop)", error_prefix); + PyErr_Format(PyExc_AttributeError, "%.200s %.200s.%.200s unknown property type (pyrna_py_to_prop)", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop)); return -1; break; } @@ -1654,8 +1663,9 @@ int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, char *error_pre { char *path; PropertyRNA *prop; + int array_len; - if (!PyArg_ParseTuple(args, "s|if", &path, &index, &cfra)) { + if (!PyArg_ParseTuple(args, "s|if", &path, index, cfra)) { PyErr_Format(PyExc_TypeError, "%.200s expected a string and optionally an int and float arguments", error_prefix); return -1; } @@ -1684,6 +1694,12 @@ int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, char *error_pre return -1; } + array_len= RNA_property_array_length(ptr, prop); + if((*index) != -1 && (*index) >= array_len) { + PyErr_Format( PyExc_TypeError, "%.200s index out of range \"%s\", given %d, array length is %d", error_prefix, path, *index, array_len); + return -1; + } + if(*cfra==FLT_MAX) *cfra= CTX_data_scene(BPy_GetContext())->r.cfra; @@ -1859,7 +1875,7 @@ static PyObject *pyrna_struct_path_to_id(BPy_StructRNA *self, PyObject *args) if(path==NULL) { if(name) PyErr_Format(PyExc_TypeError, "%.200s.path_to_id(\"%s\") found but does not support path creation", RNA_struct_identifier(self->ptr.type), name); - else PyErr_Format(PyExc_TypeError, "%.200s.path_to_id() does not support path creation for this type", name); + else PyErr_Format(PyExc_TypeError, "%.200s.path_to_id() does not support path creation for this type", RNA_struct_identifier(self->ptr.type)); return NULL; } @@ -3528,26 +3544,6 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna) } } -/* -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 PyObject* pyrna_srna_Subtype(StructRNA *srna); /* return a borrowed reference */ @@ -3888,7 +3884,7 @@ PyObject *BPY_rna_types(void) return (PyObject *)self; } -StructRNA *pyrna_struct_as_srna(PyObject *self) +StructRNA *pyrna_struct_as_srna(PyObject *self, int parent, const char *error_prefix) { BPy_StructRNA *py_srna = NULL; StructRNA *srna; @@ -3898,23 +3894,27 @@ StructRNA *pyrna_struct_as_srna(PyObject *self) py_srna = (BPy_StructRNA *)PyDict_GetItemString(((PyTypeObject *)self)->tp_dict, "bl_rna"); Py_XINCREF(py_srna); } - - if(py_srna==NULL) - py_srna = (BPy_StructRNA*)PyObject_GetAttrString(self, "bl_rna"); + + if(parent) { + /* be very careful with this since it will return a parent classes srna. + * modifying this will do confusing stuff! */ + if(py_srna==NULL) + py_srna = (BPy_StructRNA*)PyObject_GetAttrString(self, "bl_rna"); + } if(py_srna==NULL) { - PyErr_SetString(PyExc_SystemError, "internal error, self had no bl_rna attribute, should never happen."); + PyErr_Format(PyExc_SystemError, "%.200s internal error, self of type '%.200s' had no bl_rna attribute, should never happen", error_prefix, Py_TYPE(self)->tp_name); return NULL; } if(!BPy_StructRNA_Check(py_srna)) { - PyErr_Format(PyExc_SystemError, "internal error, bl_rna was of type %.200s, instead of %.200s instance.", Py_TYPE(py_srna)->tp_name, pyrna_struct_Type.tp_name); + PyErr_Format(PyExc_SystemError, "%.200s internal error, bl_rna was of type '%.200s', instead of %.200s instance", error_prefix, 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, bl_rna was not a RNA_Struct type of rna struct."); + PyErr_Format(PyExc_SystemError, "%.200s internal error, bl_rna was not a RNA_Struct type of rna struct", error_prefix); Py_DECREF(py_srna); return NULL; } @@ -3928,7 +3928,7 @@ StructRNA *pyrna_struct_as_srna(PyObject *self) /* Orphan functions, not sure where they should go */ /* get the srna for methods attached to types */ /* */ -StructRNA *srna_from_self(PyObject *self) +StructRNA *srna_from_self(PyObject *self, const char *error_prefix) { /* a bit sloppy but would cause a very confusing bug if * an error happened to be set here */ @@ -3946,7 +3946,7 @@ 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 */ - return pyrna_struct_as_srna(self); + return pyrna_struct_as_srna(self, 0, error_prefix); } static int deferred_register_prop(StructRNA *srna, PyObject *item, PyObject *key, PyObject *dummy_args) @@ -4442,11 +4442,12 @@ PyObject *pyrna_basetype_register(PyObject *self, PyObject *py_class) const char *identifier= ""; if(PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "bl_rna")) { - PyErr_SetString(PyExc_AttributeError, "bpy.types.register(): already registered as a subclass."); + PyErr_SetString(PyExc_AttributeError, "bpy.types.register(...): already registered as a subclass."); return NULL; } - srna= pyrna_struct_as_srna(py_class); + /* warning: gets parent classes srna, only for the register function */ + srna= pyrna_struct_as_srna(py_class, 1, "bpy.types.register(...):"); if(srna==NULL) return NULL; @@ -4454,7 +4455,7 @@ PyObject *pyrna_basetype_register(PyObject *self, PyObject *py_class) reg= RNA_struct_register(srna); if(!reg) { - PyErr_SetString(PyExc_ValueError, "bpy.types.register(): expected a Type subclassed from a registerable rna type (no register supported)."); + PyErr_SetString(PyExc_ValueError, "bpy.types.register(...): expected a Type subclassed from a registerable rna type (no register supported)."); return NULL; } @@ -4517,7 +4518,7 @@ PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *py_class) return NULL; }*/ - srna= pyrna_struct_as_srna(py_class); + srna= pyrna_struct_as_srna(py_class, 0, "bpy.types.unregister(...):"); if(srna==NULL) return NULL; @@ -4525,7 +4526,7 @@ PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *py_class) unreg= RNA_struct_unregister(srna); if(!unreg) { - PyErr_SetString(PyExc_ValueError, "bpy.types.unregister(): expected a Type subclassed from a registerable rna type (no unregister supported)."); + PyErr_SetString(PyExc_ValueError, "bpy.types.unregister(...): expected a Type subclassed from a registerable rna type (no unregister supported)."); return NULL; } diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index 770e88e1a1d..9892ed6989b 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -64,8 +64,8 @@ typedef struct { /* cheap trick */ #define BPy_BaseTypeRNA BPy_PropertyRNA -StructRNA *srna_from_self(PyObject *self); -StructRNA *pyrna_struct_as_srna(PyObject *self); +StructRNA *srna_from_self(PyObject *self, const char *error_prefix); +StructRNA *pyrna_struct_as_srna(PyObject *self, int parent, const char *error_prefix); void BPY_rna_init( void ); PyObject *BPY_rna_module( void ); diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c index c71429a76af..2404442dc18 100644 --- a/source/blender/python/intern/bpy_rna_callback.c +++ b/source/blender/python/intern/bpy_rna_callback.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -22,12 +22,10 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include "Python.h" #include "bpy_rna.h" #include "bpy_util.h" -#include "BLI_path_util.h" #include "DNA_screen_types.h" #include "BKE_context.h" #include "ED_space_api.h" diff --git a/source/blender/python/intern/bpy_rna_callback.h b/source/blender/python/intern/bpy_rna_callback.h index b6d771b23b2..d846b388c25 100644 --- a/source/blender/python/intern/bpy_rna_callback.h +++ b/source/blender/python/intern/bpy_rna_callback.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c index bd80b89cdc1..38462d1b176 100644 --- a/source/blender/python/intern/bpy_util.c +++ b/source/blender/python/intern/bpy_util.c @@ -22,8 +22,6 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include "DNA_listBase.h" -#include "RNA_access.h" #include "bpy_util.h" #include "BLI_dynstr.h" #include "MEM_guardedalloc.h" @@ -245,8 +243,8 @@ PyObject *BPY_exception_buffer(void) PyErr_Clear(); - /* import StringIO / io - * string_io = StringIO.StringIO() + /* import io + * string_io = io.StringIO() */ if(! (string_io_mod= PyImport_ImportModule("io")) ) { diff --git a/source/blender/python/intern/stubs.c b/source/blender/python/intern/stubs.c index 580ceefe9cb..d6dc5059342 100644 --- a/source/blender/python/intern/stubs.c +++ b/source/blender/python/intern/stubs.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 0218f7458cb..09d190b836f 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -198,7 +198,7 @@ void RE_SetPixelSize(struct Render *re, float pixsize); void RE_SetView (struct Render *re, float mat[][4]); /* make or free the dbase */ -void RE_Database_FromScene(struct Render *re, struct Scene *scene, int use_camera_view); +void RE_Database_FromScene(struct Render *re, struct Scene *scene, unsigned int lay, int use_camera_view); void RE_Database_Free (struct Render *re); /* project dbase again, when viewplane/perspective changed */ @@ -214,8 +214,8 @@ void RE_init_threadcount(Render *re); void RE_TileProcessor(struct Render *re, int firsttile, int threaded); /* only RE_NewRender() needed, main Blender render calls */ -void RE_BlenderFrame(struct Render *re, struct Scene *scene, struct SceneRenderLayer *srl, int frame); -void RE_BlenderAnim(struct Render *re, struct Scene *scene, int sfra, int efra, int tfra, struct ReportList *reports); +void RE_BlenderFrame(struct Render *re, struct Scene *scene, struct SceneRenderLayer *srl, unsigned int lay, int frame); +void RE_BlenderAnim(struct Render *re, struct Scene *scene, unsigned int lay, int sfra, int efra, int tfra, struct ReportList *reports); void RE_RenderFreestyleStrokes(struct Render *re, struct Scene *scene); void RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode); @@ -252,7 +252,7 @@ void RE_zbuf_accumulate_vecblur(struct NodeBlurData *nbd, int xsize, int ysize, #define RE_BAKE_DISPLACEMENT 5 #define RE_BAKE_SHADOW 6 -void RE_Database_Baking(struct Render *re, struct Scene *scene, int type, struct Object *actob); +void RE_Database_Baking(struct Render *re, struct Scene *scene, unsigned int lay, int type, struct Object *actob); void RE_DataBase_GetView(struct Render *re, float mat[][4]); void RE_GetCameraWindow(struct Render *re, struct Object *camera, int frame, float mat[][4]); diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index e093c1a6c99..0b0ea075d79 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -174,6 +174,7 @@ struct Render Scene *scene; RenderData r; World wrld; + unsigned int lay; ListBase parts; diff --git a/source/blender/render/intern/include/renderdatabase.h b/source/blender/render/intern/include/renderdatabase.h index 9ed12a8fe60..2a0086b436c 100644 --- a/source/blender/render/intern/include/renderdatabase.h +++ b/source/blender/render/intern/include/renderdatabase.h @@ -137,7 +137,7 @@ void RE_set_customdata_names(struct ObjectRen *obr, struct CustomData *data); /* convertblender.c */ void init_render_world(Render *re); -void RE_Database_FromScene_Vectors(Render *re, struct Scene *sce); +void RE_Database_FromScene_Vectors(Render *re, struct Scene *sce, unsigned int lay); #endif /* RENDERDATABASE_H */ diff --git a/source/blender/render/intern/include/shading.h b/source/blender/render/intern/include/shading.h index 247400487ac..8250c5631dd 100644 --- a/source/blender/render/intern/include/shading.h +++ b/source/blender/render/intern/include/shading.h @@ -1,5 +1,5 @@ /** -* $Id: +* $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 6e098186748..c756a135048 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -3859,7 +3859,7 @@ static void add_lightgroup(Render *re, Group *group, int exclusive) for(go= group->gobject.first; go; go= go->next) { go->lampren= NULL; - if(go->ob->lay & re->scene->lay) { + if(go->ob->lay & re->lay) { if(go->ob && go->ob->type==OB_LAMP) { for(gol= re->lights.first; gol; gol= gol->next) { if(gol->ob==go->ob) { @@ -4226,7 +4226,7 @@ static void finalize_render_object(Render *re, ObjectRen *obr, int timeoffset) /* Baking lets us define a quad split order */ split_quads(obr, re->r.bake_quad_split); } else { - if((re->r.simplify_flag & R_SIMPLE_NO_TRIANGULATE) == 0) + if((re->r.mode & R_SIMPLIFY && re->r.simplify_flag & R_SIMPLE_NO_TRIANGULATE) == 0) check_non_flat_quads(obr); } @@ -4674,8 +4674,7 @@ static int allow_render_dupli_instance(Render *re, DupliObject *dob, Object *obd /* don't allow lamp, animated duplis, or radio render */ return (render_object_type(obd->type) && - (!(dob->type == OB_DUPLIGROUP) || !dob->animated) && - !(re->r.mode & R_RADIO)); + (!(dob->type == OB_DUPLIGROUP) || !dob->animated)); } static void dupli_render_particle_set(Render *re, Object *ob, int timeoffset, int level, int enable) @@ -4722,7 +4721,7 @@ static void dupli_render_particle_set(Render *re, Object *ob, int timeoffset, in static int get_vector_renderlayers(Scene *sce) { SceneRenderLayer *srl; - int lay= 0; + unsigned int lay= 0; for(srl= sce->r.layers.first; srl; srl= srl->next) if(srl->passflag & SCE_PASS_VECTOR) @@ -4806,7 +4805,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp } } } - else if((base->lay & lay) || (ob->type==OB_LAMP && (base->lay & re->scene->lay)) ) { + else if((base->lay & lay) || (ob->type==OB_LAMP && (base->lay & re->lay)) ) { if((ob->transflag & OB_DUPLI) && (ob->type!=OB_MBALL)) { DupliObject *dob; ListBase *lb; @@ -4933,15 +4932,15 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp } /* used to be 'rotate scene' */ -void RE_Database_FromScene(Render *re, Scene *scene, int use_camera_view) +void RE_Database_FromScene(Render *re, Scene *scene, unsigned int lay, int use_camera_view) { extern int slurph_opt; /* key.c */ Scene *sce; float mat[4][4]; float amb[3]; - unsigned int lay; re->scene= scene; + re->lay= lay; /* per second, per object, stats print this */ re->i.infostr= "Preparing Scene data"; @@ -4959,8 +4958,8 @@ void RE_Database_FromScene(Render *re, Scene *scene, int use_camera_view) re->i.partsdone= 0; /* signal now in use for previewrender */ /* in localview, lamps are using normal layers, objects only local bits */ - if(re->scene->lay & 0xFF000000) lay= re->scene->lay & 0xFF000000; - else lay= re->scene->lay; + if(re->lay & 0xFF000000) + lay &= 0xFF000000; /* applies changes fully */ if((re->r.scemode & R_PREVIEWBUTS)==0) @@ -5027,11 +5026,6 @@ void RE_Database_FromScene(Render *re, Scene *scene, int use_camera_view) /* yafray: 'direct' radiosity, environment maps and raytree init not needed for yafray render */ /* although radio mode could be useful at some point, later */ if (re->r.renderer==R_INTERN) { -#if 0 /* RADIO was removed */ - /* RADIO (uses no R anymore) */ - if(!re->test_break(re->tbh)) - if(re->r.mode & R_RADIO) do_radio_render(re); -#endif /* raytree */ if(!re->test_break(re->tbh)) { if(re->r.mode & R_RAYTRACE) { @@ -5095,13 +5089,13 @@ void RE_DataBase_GetView(Render *re, float mat[][4]) /* Speed Vectors */ /* ------------------------------------------------------------------------- */ -static void database_fromscene_vectors(Render *re, Scene *scene, int timeoffset) +static void database_fromscene_vectors(Render *re, Scene *scene, unsigned int lay, int timeoffset) { extern int slurph_opt; /* key.c */ float mat[4][4]; - unsigned int lay; re->scene= scene; + re->lay= lay; /* XXX add test if dbase was filled already? */ @@ -5113,8 +5107,8 @@ static void database_fromscene_vectors(Render *re, Scene *scene, int timeoffset) slurph_opt= 0; /* in localview, lamps are using normal layers, objects only local bits */ - if(re->scene->lay & 0xFF000000) lay= re->scene->lay & 0xFF000000; - else lay= re->scene->lay; + if(re->lay & 0xFF000000) + lay &= 0xFF000000; /* applies changes fully */ scene->r.cfra += timeoffset; @@ -5477,7 +5471,7 @@ static void free_dbase_object_vectors(ListBase *lb) BLI_freelistN(lb); } -void RE_Database_FromScene_Vectors(Render *re, Scene *sce) +void RE_Database_FromScene_Vectors(Render *re, Scene *sce, unsigned int lay) { ObjectInstanceRen *obi, *oldobi; StrandSurface *mesh; @@ -5492,7 +5486,7 @@ void RE_Database_FromScene_Vectors(Render *re, Scene *sce) speedvector_project(re, NULL, NULL, NULL); /* initializes projection code */ /* creates entire dbase */ - database_fromscene_vectors(re, sce, -1); + database_fromscene_vectors(re, sce, lay, -1); /* copy away vertex info */ copy_dbase_object_vectors(re, &oldtable); @@ -5507,7 +5501,7 @@ void RE_Database_FromScene_Vectors(Render *re, Scene *sce) /* creates entire dbase */ re->i.infostr= "Calculating next frame vectors"; - database_fromscene_vectors(re, sce, +1); + database_fromscene_vectors(re, sce, lay, +1); } /* copy away vertex info */ copy_dbase_object_vectors(re, &newtable); @@ -5519,7 +5513,7 @@ void RE_Database_FromScene_Vectors(Render *re, Scene *sce) re->strandsurface= strandsurface; if(!re->test_break(re->tbh)) - RE_Database_FromScene(re, sce, 1); + RE_Database_FromScene(re, sce, lay, 1); if(!re->test_break(re->tbh)) { for(step= 0; step<2; step++) { @@ -5608,14 +5602,14 @@ void RE_Database_FromScene_Vectors(Render *re, Scene *sce) RE_BAKE_DISPLACEMENT:for baking, no lamps, only selected objects RE_BAKE_SHADOW: for baking, only shadows, but all objects */ -void RE_Database_Baking(Render *re, Scene *scene, int type, Object *actob) +void RE_Database_Baking(Render *re, Scene *scene, unsigned int lay, int type, Object *actob) { float mat[4][4]; float amb[3]; - unsigned int lay; int onlyselected, nolamps; re->scene= scene; + re->lay= lay; /* renderdata setup and exceptions */ re->r= scene->r; @@ -5648,8 +5642,8 @@ void RE_Database_Baking(Render *re, Scene *scene, int type, Object *actob) re->lampren.first= re->lampren.last= NULL; /* in localview, lamps are using normal layers, objects only local bits */ - if(re->scene->lay & 0xFF000000) lay= re->scene->lay & 0xFF000000; - else lay= re->scene->lay; + if(re->lay & 0xFF000000) + lay &= 0xFF000000; /* if no camera, set unit */ if(re->scene->camera) { diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index c455a229d63..73c9aaf6642 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -74,15 +74,23 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf) dx= ibuf->y; dx/= 2; - if(3*dx != ibuf->x) { + if (3*dx == ibuf->x) { + env->type = ENV_CUBE; + } else if (ibuf->x == ibuf->y) { + env->type = ENV_PLANE; + } else { printf("Incorrect envmap size\n"); env->ok= 0; env->ima->ok= 0; + return; } - else { + + if (env->type == ENV_CUBE) { for(part=0; part<6; part++) { env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect|IB_rectfloat, 0); } + IMB_float_from_rect(ibuf); + IMB_rectcpy(env->cube[0], ibuf, 0, 0, 0, 0, dx, dx); IMB_rectcpy(env->cube[1], ibuf, @@ -97,6 +105,12 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf) 0, 0, 2*dx, dx, dx, dx); env->ok= ENV_OSA; } + else { /* ENV_PLANE */ + env->cube[1]= IMB_dupImBuf(ibuf); + IMB_float_from_rect(env->cube[1]); + + env->ok= ENV_OSA; + } } /* ------------------------------------------------------------------------- */ @@ -129,6 +143,7 @@ static Render *envmap_render_copy(Render *re, EnvMap *env) RE_InitState(envre, NULL, &envre->r, NULL, cuberes, cuberes, NULL); envre->scene= re->scene; /* unsure about this... */ + envre->lay= re->lay; /* view stuff in env render */ envre->lens= 16.0f; @@ -499,7 +514,7 @@ void make_envmaps(Render *re) if(tex->env && tex->env->object) { EnvMap *env= tex->env; - if(env->object->lay & re->scene->lay) { + if(env->object->lay & re->lay) { if(env->stype==ENV_LOAD) { float orthmat[4][4], mat[4][4], tmat[4][4]; @@ -658,10 +673,11 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe texres->tin= 0.0; return 0; } + if(env->stype==ENV_LOAD) { env->ima= tex->ima; if(env->ima && env->ima->ok) { - if(env->cube[0]==NULL) { + if(env->cube[1]==NULL) { ImBuf *ibuf= BKE_image_get_ibuf(env->ima, NULL); if(ibuf) envmap_split_ima(env, ibuf); @@ -672,7 +688,6 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe } if(env->ok==0) { - texres->tin= 0.0; return 0; } diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c index cf0a01576d8..4f0e21a9fbb 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/source/imagetexture.c @@ -1,6 +1,6 @@ /** * - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -417,107 +417,6 @@ static float clipy_rctf(rctf *rf, float y1, float y2) } -// used in SAT_get_color_bilerp() below -static void SAT_getcol(float* col, ImBuf* ibuf, int x, int y) -{ - if ((x == (ibuf->x - 1)) && (y == (ibuf->y - 1))) { // avg val pos - col[0] = col[1] = col[2] = col[3] = 0.f; - return; - } - ibuf_get_color(col, ibuf, x, y); -} - -// used in boxsampleclip_SAT() below -static void SAT_get_color_bilerp(float *col, ImBuf *ibuf, float u, float v) -{ - float c00[4], c01[4], c10[4], c11[4]; - const float ufl = floorf(u -= 0.5f), vfl = floorf(v -= 0.5f); - const float uf = u - ufl, vf = v - vfl; - const float w00=(1.f-uf)*(1.f-vf), w10=uf*(1.f-vf), w01=(1.f-uf)*vf, w11=uf*vf; - int x1 = (int)ufl, y1 = (int)vfl, x2 = x1 + 1, y2 = y1 + 1; - x1 = (x1 < 0) ? 0 : (x1 >= ibuf->x ? ibuf->x - 1 : x1); - x2 = (x2 < 0) ? 0 : (x2 >= ibuf->x ? ibuf->x - 1 : x2); - y1 = (y1 < 0) ? 0 : (y1 >= ibuf->y ? ibuf->y - 1 : y1); - y2 = (y2 < 0) ? 0 : (y2 >= ibuf->y ? ibuf->y - 1 : y2); - SAT_getcol(c00, ibuf, x1, y1); - SAT_getcol(c10, ibuf, x2, y1); - SAT_getcol(c01, ibuf, x1, y2); - SAT_getcol(c11, ibuf, x2, y2); - col[0] = w00*c00[0] + w10*c10[0] + w01*c01[0] + w11*c11[0]; - col[1] = w00*c00[1] + w10*c10[1] + w01*c01[1] + w11*c11[1]; - col[2] = w00*c00[2] + w10*c10[2] + w01*c01[2] + w11*c11[2]; - col[3] = w00*c00[3] + w10*c10[3] + w01*c01[3] + w11*c11[3]; -} - -static void boxsampleclip_SAT(ImBuf *ibuf, rctf *rf, TexResult *texres, int intpol) -{ - float div, col[4]; - if (intpol) { - div = 1.f/((rf->xmax - rf->xmin + 1.f)*(rf->ymax - rf->ymin + 1.f)); - SAT_get_color_bilerp(&texres->tr, ibuf, rf->xmax, rf->ymax); - if (rf->ymin >= 1.f) { - SAT_get_color_bilerp(col, ibuf, rf->xmax, rf->ymin - 1.f); - texres->tr -= col[0]; - texres->tg -= col[1]; - texres->tb -= col[2]; - texres->ta -= col[3]; - } - if (rf->xmin >= 1.f) { - SAT_get_color_bilerp(col, ibuf, rf->xmin - 1.f, rf->ymax); - texres->tr -= col[0]; - texres->tg -= col[1]; - texres->tb -= col[2]; - texres->ta -= col[3]; - } - if (rf->xmin >= 1.f && rf->ymin >= 1.f) { - SAT_get_color_bilerp(col, ibuf, rf->xmin - 1.f, rf->ymin - 1.f); - texres->tr += col[0]; - texres->tg += col[1]; - texres->tb += col[2]; - texres->ta += col[3]; - } - } - else { - int startx = (int)floorf(rf->xmin); - int endx = (int)floorf(rf->xmax); - int starty = (int)floorf(rf->ymin); - int endy = (int)floorf(rf->ymax); - if (startx < 0) startx = 0; - if (starty < 0) starty = 0; - if (endx >= ibuf->x) endx = ibuf->x - 1; - if (endy >= ibuf->y) endy = ibuf->y - 1; - div = 1.f/((endx - startx + 1)*(endy - starty + 1)); - SAT_getcol(&texres->tr, ibuf, endx, endy); - if (starty >= 1) { - SAT_getcol(col, ibuf, endx, starty - 1); - texres->tr -= col[0]; - texres->tg -= col[1]; - texres->tb -= col[2]; - texres->ta -= col[3]; - } - if (startx >= 1) { - SAT_getcol(col, ibuf, startx - 1, endy); - texres->tr -= col[0]; - texres->tg -= col[1]; - texres->tb -= col[2]; - texres->ta -= col[3]; - } - if (startx >=1 && starty >= 1) { - SAT_getcol(col, ibuf, startx - 1, starty - 1); - texres->tr += col[0]; - texres->tg += col[1]; - texres->tb += col[2]; - texres->ta += col[3]; - } - } - // avg - ibuf_get_color(col, ibuf, ibuf->x - 1, ibuf->y - 1); - texres->tr = texres->tr*div + col[0]; - texres->tg = texres->tg*div + col[1]; - texres->tb = texres->tb*div + col[2]; - texres->ta = texres->ta*div + col[3]; -} - static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres) { /* sample box, is clipped already, and minx etc. have been set at ibuf size. @@ -601,7 +500,7 @@ static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres) } } -static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float maxy, TexResult *texres, int imaprepeat, int imapextend, int SAT, int intpol) +static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float maxy, TexResult *texres, int imaprepeat, int imapextend, int intpol) { /* Sample box, performs clip. minx etc are in range 0.0 - 1.0 . * Enlarge with antialiased edges of pixels. @@ -655,10 +554,7 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max if(count>1) { tot= texres->tr= texres->tb= texres->tg= texres->ta= 0.0; while(count--) { - if (SAT) - boxsampleclip_SAT(ibuf, rf, &texr, intpol); - else - boxsampleclip(ibuf, rf, &texr); + boxsampleclip(ibuf, rf, &texr); opp= square_rctf(rf); tot+= opp; @@ -676,12 +572,8 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max if(texres->talpha) texres->ta/= tot; } } - else { - if (SAT) - boxsampleclip_SAT(ibuf, rf, texres, intpol); - else - boxsampleclip(ibuf, rf, texres); - } + else + boxsampleclip(ibuf, rf, texres); if(texres->talpha==0) texres->ta= 1.0; @@ -707,7 +599,7 @@ void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *res if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) ibuf->rect+= (ibuf->x*ibuf->y); - boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1, 0, 0); + boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1, 0); result[0]= texres.tr; result[1]= texres.tg; result[2]= texres.tb; @@ -726,7 +618,7 @@ void ibuf_sample(ImBuf *ibuf, float fx, float fy, float dx, float dy, float *res } memset(&texres, 0, sizeof(texres)); - boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1, 0, 0); + boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1, 0); result[0]= texres.tr; result[1]= texres.tg; result[2]= texres.tb; @@ -1148,7 +1040,7 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, if (tex->imaflag & TEX_MIPMAP) { if (((ibuf->flags & IB_fields) == 0) && (ibuf->mipmap[0] == NULL)) { BLI_lock_thread(LOCK_IMAGE); - if (ibuf->mipmap[0] == NULL) IMB_makemipmap(ibuf, tex->imaflag & TEX_GAUSS_MIP, 0); + if (ibuf->mipmap[0] == NULL) IMB_makemipmap(ibuf, tex->imaflag & TEX_GAUSS_MIP); BLI_unlock_thread(LOCK_IMAGE); } } @@ -1505,7 +1397,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f TexResult texr; float fx, fy, minx, maxx, miny, maxy, dx, dy, dxt[3], dyt[3]; float maxd, pixsize, val1, val2, val3; - int curmap, retval, imaprepeat, imapextend, SAT = (tex->texfilter == TXF_SAT); + int curmap, retval, imaprepeat, imapextend; // TXF: since dxt/dyt might be modified here and since they might be needed after imagewraposa() call, // make a local copy here so that original vecs remain untouched @@ -1513,7 +1405,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f VECCOPY(dyt, DYT); // anisotropic filtering - if (!SAT && (tex->texfilter != TXF_BOX)) + if (tex->texfilter != TXF_BOX) return imagewraposa_aniso(tex, ima, ibuf, texvec, dxt, dyt, texres); texres->tin= texres->ta= texres->tr= texres->tg= texres->tb= 0.0f; @@ -1536,13 +1428,13 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f return retval; /* mipmap test */ - if (SAT || tex->imaflag & TEX_MIPMAP) { + if (tex->imaflag & TEX_MIPMAP) { if(ibuf->flags & IB_fields); else if(ibuf->mipmap[0]==NULL) { BLI_lock_thread(LOCK_IMAGE); if(ibuf->mipmap[0]==NULL) - IMB_makemipmap(ibuf, tex->imaflag & TEX_GAUSS_MIP, SAT); + IMB_makemipmap(ibuf, tex->imaflag & TEX_GAUSS_MIP); BLI_unlock_thread(LOCK_IMAGE); } @@ -1754,11 +1646,11 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f //minx*= 1.35f; //miny*= 1.35f; - boxsample(curibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0, 0); + boxsample(curibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0); val1= texres->tr+texres->tg+texres->tb; - boxsample(curibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0, 0); + boxsample(curibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0); val2= texr.tr + texr.tg + texr.tb; - boxsample(curibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0, 0); + boxsample(curibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0); val3= texr.tr + texr.tg + texr.tb; /* don't switch x or y! */ @@ -1767,7 +1659,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f if(previbuf!=curibuf) { /* interpolate */ - boxsample(previbuf, fx-minx, fy-miny, fx+minx, fy+miny, &texr, imaprepeat, imapextend, 0, 0); + boxsample(previbuf, fx-minx, fy-miny, fx+minx, fy+miny, &texr, imaprepeat, imapextend, 0); /* calc rgb */ dx= 2.0f*(pixsize-maxd)/pixsize; @@ -1784,9 +1676,9 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f } val1= dy*val1+ dx*(texr.tr + texr.tg + texr.tb); - boxsample(previbuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0, 0); + boxsample(previbuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0); val2= dy*val2+ dx*(texr.tr + texr.tg + texr.tb); - boxsample(previbuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0, 0); + boxsample(previbuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0); val3= dy*val3+ dx*(texr.tr + texr.tg + texr.tb); texres->nor[0]= (val1-val2); /* vals have been interpolated above! */ @@ -1809,10 +1701,10 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f maxy= fy+miny; miny= fy-miny; - boxsample(curibuf, minx, miny, maxx, maxy, texres, imaprepeat, imapextend, 0, 0); + boxsample(curibuf, minx, miny, maxx, maxy, texres, imaprepeat, imapextend, 0); if(previbuf!=curibuf) { /* interpolate */ - boxsample(previbuf, minx, miny, maxx, maxy, &texr, imaprepeat, imapextend, 0, 0); + boxsample(previbuf, minx, miny, maxx, maxy, &texr, imaprepeat, imapextend, 0); fx= 2.0f*(pixsize-maxd)/pixsize; @@ -1831,39 +1723,26 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f } else { const int intpol = tex->imaflag & TEX_INTERPOL; - if (intpol && !SAT) { + if (intpol) { /* sample 1 pixel minimum */ if (minx < 0.5f / ibuf->x) minx = 0.5f / ibuf->x; if (miny < 0.5f / ibuf->y) miny = 0.5f / ibuf->y; } if(texres->nor && (tex->imaflag & TEX_NORMALMAP)==0) { - if (SAT) { - boxsample(ibuf->mipmap[0], fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 1, intpol); - val1 = texres->tr + texres->tg + texres->tb; - boxsample(ibuf->mipmap[0], fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 1, intpol); - val2 = texr.tr + texr.tg + texr.tb; - boxsample(ibuf->mipmap[0], fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 1, intpol); - val3 = texr.tr + texr.tg + texr.tb; - } - else { - boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0, 0); - val1= texres->tr+texres->tg+texres->tb; - boxsample(ibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0, 0); - val2= texr.tr + texr.tg + texr.tb; - boxsample(ibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0, 0); - val3= texr.tr + texr.tg + texr.tb; - } + boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0); + val1= texres->tr+texres->tg+texres->tb; + boxsample(ibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0); + val2= texr.tr + texr.tg + texr.tb; + boxsample(ibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0); + val3= texr.tr + texr.tg + texr.tb; + /* don't switch x or y! */ texres->nor[0]= (val1-val2); texres->nor[1]= (val1-val3); } - else { - if (SAT) - boxsample(ibuf->mipmap[0], fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 1, intpol); - else - boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0, 0); - } + else + boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0); } BRICONTRGB; diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c index 7c52857a94b..39faf22fb31 100644 --- a/source/blender/render/intern/source/occlusion.c +++ b/source/blender/render/intern/source/occlusion.c @@ -213,7 +213,7 @@ static void occ_build_shade(Render *re, OcclusionTree *tree) /* setup shade sample with correct passes */ memset(&ssamp, 0, sizeof(ShadeSample)); - ssamp.shi[0].lay= re->scene->lay; + ssamp.shi[0].lay= re->lay; ssamp.shi[0].passflag= SCE_PASS_DIFFUSE|SCE_PASS_RGBA; ssamp.shi[0].combinedflag= ~(SCE_PASS_SPEC); ssamp.tot= 1; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 244efaf8d05..9c35451bca0 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -141,11 +141,6 @@ static void int_nothing(void *unused, int val) {} static void print_error(void *unused, char *str) {printf("ERROR: %s\n", str);} static int default_break(void *unused) {return G.afbreek == 1;} -int RE_RenderInProgress(Render *re) -{ - return re->result_ok==0; -} - static void stats_background(void *unused, RenderStats *rs) { uintptr_t mem_in_use= MEM_get_memory_in_use(); @@ -348,10 +343,10 @@ static char *get_pass_name(int passtype, int channel) return "AO.B"; } if(passtype == SCE_PASS_ENVIRONMENT) { - if(channel==-1) return "Environment"; - if(channel==0) return "Environment.R"; - if(channel==1) return "Environment.G"; - return "Environment.B"; + if(channel==-1) return "Env"; + if(channel==0) return "Env.R"; + if(channel==1) return "Env.G"; + return "Env.B"; } if(passtype == SCE_PASS_INDIRECT) { if(channel==-1) return "Indirect"; @@ -371,12 +366,6 @@ static char *get_pass_name(int passtype, int channel) if(channel==1) return "Refract.G"; return "Refract.B"; } - if(passtype == SCE_PASS_RADIO) { - if(channel==-1) return "Radio"; - if(channel==0) return "Radio.R"; - if(channel==1) return "Radio.G"; - return "Radio.B"; - } if(passtype == SCE_PASS_INDEXOB) { if(channel==-1) return "IndexOB"; return "IndexOB.X"; @@ -431,7 +420,7 @@ static int passtype_from_name(char *str) if(strcmp(str, "AO")==0) return SCE_PASS_AO; - if(strcmp(str, "Environment")==0) + if(strcmp(str, "Env")==0) return SCE_PASS_ENVIRONMENT; if(strcmp(str, "Indirect")==0) @@ -443,9 +432,6 @@ static int passtype_from_name(char *str) if(strcmp(str, "Refract")==0) return SCE_PASS_REFRACT; - if(strcmp(str, "Radio")==0) - return SCE_PASS_RADIO; - if(strcmp(str, "IndexOB")==0) return SCE_PASS_INDEXOB; @@ -625,8 +611,6 @@ static RenderResult *new_render_result(Render *re, rcti *partrct, int crop, int render_layer_add_pass(rr, rl, 3, SCE_PASS_REFLECT); if(srl->passflag & SCE_PASS_REFRACT) render_layer_add_pass(rr, rl, 3, SCE_PASS_REFRACT); - if(srl->passflag & SCE_PASS_RADIO) - render_layer_add_pass(rr, rl, 3, SCE_PASS_RADIO); if(srl->passflag & SCE_PASS_INDEXOB) render_layer_add_pass(rr, rl, 1, SCE_PASS_INDEXOB); if(srl->passflag & SCE_PASS_MIST) @@ -1106,6 +1090,8 @@ void RE_AcquireResultImage(Render *re, RenderResult *rr) if(rr->rectz==NULL) rr->rectz= RE_RenderLayerGetPass(rl, SCE_PASS_Z); } + + rr->layers= re->result->layers; } } } @@ -1864,9 +1850,9 @@ static void do_render_3d(Render *re) /* make render verts/faces/halos/lamps */ if(render_scene_needs_vector(re)) - RE_Database_FromScene_Vectors(re, re->scene); + RE_Database_FromScene_Vectors(re, re->scene, re->lay); else - RE_Database_FromScene(re, re->scene, 1); + RE_Database_FromScene(re, re->scene, re->lay, 1); threaded_tile_processor(re); @@ -2488,7 +2474,7 @@ static void do_render_composite_fields_blur_3d(Render *re) R.stats_draw= re->stats_draw; if (update_newframe) - scene_update_for_newframe(re->scene, re->scene->lay); + scene_update_for_newframe(re->scene, re->lay); if(re->r.scemode & R_FULL_SAMPLE) do_merge_fullsample(re, ntree); @@ -2749,7 +2735,7 @@ static void update_physics_cache(Render *re, Scene *scene, int anim_init) BKE_ptcache_make_cache(&baker); } /* evaluating scene options for general Blender render */ -static int render_initialize_from_scene(Render *re, Scene *scene, SceneRenderLayer *srl, int anim, int anim_init) +static int render_initialize_from_scene(Render *re, Scene *scene, SceneRenderLayer *srl, unsigned int lay, int anim, int anim_init) { int winx, winy; rcti disprect; @@ -2776,6 +2762,7 @@ static int render_initialize_from_scene(Render *re, Scene *scene, SceneRenderLay } re->scene= scene; + re->lay= lay; /* not too nice, but it survives anim-border render */ if(anim) { @@ -2816,21 +2803,19 @@ static int render_initialize_from_scene(Render *re, Scene *scene, SceneRenderLay } /* general Blender frame render call */ -void RE_BlenderFrame(Render *re, Scene *scene, SceneRenderLayer *srl, int frame) +void RE_BlenderFrame(Render *re, Scene *scene, SceneRenderLayer *srl, unsigned int lay, int frame) { /* ugly global still... is to prevent preview events and signal subsurfs etc to make full resol */ RenderGlobal.renderingslot= re->slot; - re->result_ok= 0; G.rendering= 1; scene->r.cfra= frame; - if(render_initialize_from_scene(re, scene, srl, 0, 0)) { + if(render_initialize_from_scene(re, scene, srl, lay, 0, 0)) { do_render_all_options(re); } /* UGLY WARNING */ - re->result_ok= 1; G.rendering= 0; RenderGlobal.renderingslot= RenderGlobal.viewslot; } @@ -2839,7 +2824,7 @@ void RE_RenderFreestyleStrokes(Render *re, Scene *scene) { re->result_ok= 0; scene->r.cfra= 1; - if(render_initialize_from_scene(re, scene, NULL, 0, 0)) { + if(render_initialize_from_scene(re, scene, NULL, scene->lay, 0, 0)) { do_render_all_options(re); } re->result_ok= 1; @@ -2932,22 +2917,20 @@ static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, R } /* saves images to disk */ -void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra, int tfra, ReportList *reports) +void RE_BlenderAnim(Render *re, Scene *scene, unsigned int lay, int sfra, int efra, int tfra, ReportList *reports) { bMovieHandle *mh= BKE_get_movie_handle(scene->r.imtype); - unsigned int lay; int cfrao= scene->r.cfra; int nfra; /* do not fully call for each frame, it initializes & pops output window */ - if(!render_initialize_from_scene(re, scene, NULL, 0, 1)) + if(!render_initialize_from_scene(re, scene, NULL, lay, 0, 1)) return; /* ugly global still... is to prevent renderwin events and signal subsurfs etc to make full resol */ /* is also set by caller renderwin.c */ G.rendering= 1; RenderGlobal.renderingslot= re->slot; - re->result_ok= 0; if(BKE_imtype_is_movie(scene->r.imtype)) if(!mh->start_movie(scene, &re->r, re->rectx, re->recty, reports)) @@ -2975,7 +2958,7 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra, int tfra, Repo char name[FILE_MAX]; /* only border now, todo: camera lens. (ton) */ - render_initialize_from_scene(re, scene, NULL, 1, 0); + render_initialize_from_scene(re, scene, NULL, lay, 1, 0); if(nfra!=scene->r.cfra) { /* @@ -2983,12 +2966,14 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra, int tfra, Repo * From convertblender.c: * in localview, lamps are using normal layers, objects only local bits. */ - if(scene->lay & 0xFF000000) - lay= scene->lay & 0xFF000000; + unsigned int updatelay; + + if(re->lay & 0xFF000000) + updatelay= re->lay & 0xFF000000; else - lay= scene->lay; + updatelay= re->lay; - scene_update_for_newframe(scene, lay); + scene_update_for_newframe(scene, updatelay); continue; } else @@ -3042,7 +3027,6 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra, int tfra, Repo /* UGLY WARNING */ G.rendering= 0; - re->result_ok= 1; RenderGlobal.renderingslot= RenderGlobal.viewslot; } diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 52dee6ba954..d0a334f039e 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -486,9 +486,6 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset, case SCE_PASS_REFRACT: col= shr->refr; break; - case SCE_PASS_RADIO: - col= NULL; // removed shr->rad; - break; case SCE_PASS_NORMAL: col= shr->nor; break; @@ -593,9 +590,6 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult case SCE_PASS_REFRACT: col= shr->refr; break; - case SCE_PASS_RADIO: - col= NULL; // removed shr->rad; - break; case SCE_PASS_NORMAL: col= shr->nor; break; @@ -2658,7 +2652,7 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up /* get the threads running */ for(a=0; a<re->r.threads; a++) { /* set defaults in handles */ - handles[a].ssamp.shi[0].lay= re->scene->lay; + handles[a].ssamp.shi[0].lay= re->lay; if (type==RE_BAKE_SHADOW) { handles[a].ssamp.shi[0].passflag= SCE_PASS_SHADOW; diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index bbb056648f6..d0e1450a3a0 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -1,5 +1,5 @@ /** -* $Id: +* $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -176,7 +176,7 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr) } /* copy additional passes */ - if(shi->passflag & (SCE_PASS_VECTOR|SCE_PASS_NORMAL|SCE_PASS_RADIO)) { + if(shi->passflag & (SCE_PASS_VECTOR|SCE_PASS_NORMAL)) { QUATCOPY(shr->winspeed, shi->winspeed); VECCOPY(shr->nor, shi->vn); } diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 809de09a5b9..8d44fa1b175 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -1,5 +1,5 @@ /** -* $Id: +* $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -1773,13 +1773,6 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) shr->combined[0]+= shi->ambr; 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]; - }*/ if(ma->mode & MA_RAMP_COL) ramp_diffuse_result(shr->combined, shi); } diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index f7e2861f124..c754ed1eab9 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -240,8 +240,6 @@ 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); - /* 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/volume_precache.c b/source/blender/render/intern/source/volume_precache.c index 75ad292c003..0af05c3cdee 100644 --- a/source/blender/render/intern/source/volume_precache.c +++ b/source/blender/render/intern/source/volume_precache.c @@ -494,7 +494,7 @@ static void precache_setup_shadeinput(Render *re, ObjectInstanceRen *obi, Materi shi->har= shi->mat->har; shi->obi= obi; shi->obr= obi->obr; - shi->lay = re->scene->lay; + shi->lay = re->lay; } static void precache_init_parts(Render *re, RayObject *tree, ShadeInput *shi, ObjectInstanceRen *obi, int totthread, int *parts) diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index dc87170842b..1a4b469cc6f 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -3273,8 +3273,8 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase * zspan->mask= 1<<zsample; if(jit) { - zspan->zofsx= -pa->disprect.xmin + jit[zsample][0]; - zspan->zofsy= -pa->disprect.ymin + jit[zsample][1]; + zspan->zofsx= -pa->disprect.xmin - jit[zsample][0]; + zspan->zofsy= -pa->disprect.ymin - jit[zsample][1]; } else { zspan->zofsx= -pa->disprect.xmin; @@ -3539,9 +3539,6 @@ void merge_transp_passes(RenderLayer *rl, ShadeResult *shr) case SCE_PASS_REFLECT: col= shr->refl; break; - case SCE_PASS_RADIO: - col= NULL; // removed shr->rad; - break; case SCE_PASS_REFRACT: col= shr->refr; break; @@ -3650,9 +3647,6 @@ void add_transp_passes(RenderLayer *rl, int offset, ShadeResult *shr, float alph case SCE_PASS_REFRACT: col= shr->refr; break; - case SCE_PASS_RADIO: - col= NULL; // removed shr->rad; - break; case SCE_PASS_NORMAL: col= shr->nor; break; @@ -3900,9 +3894,6 @@ static int addtosamp_shr(ShadeResult *samp_shr, ShadeSample *ssamp, int addpassf if(addpassflag & SCE_PASS_REFRACT) addvecmul(samp_shr->refr, shr->refr, 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/Makefile b/source/blender/windowmanager/Makefile index ad574aa0d4c..90621f66057 100644 --- a/source/blender/windowmanager/Makefile +++ b/source/blender/windowmanager/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 07f1368db23..343ee737c82 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -190,8 +190,9 @@ int WM_operator_filesel (struct bContext *C, struct wmOperator *op, struct wm int WM_operator_winactive (struct bContext *C); /* invoke callback, exec + redo popup */ int WM_operator_props_popup (struct bContext *C, struct wmOperator *op, struct wmEvent *event); +int WM_operator_props_dialog_popup (struct bContext *C, struct wmOperator *op, int width, int height); int WM_operator_redo_popup (struct bContext *C, struct wmOperator *op); -void WM_operator_ui_popup (struct bContext *C, struct wmOperator *op, int width, int height); +int WM_operator_ui_popup (struct bContext *C, struct wmOperator *op, int width, int height); int WM_operator_confirm_message(struct bContext *C, struct wmOperator *op, char *message); diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index bb4a7452e08..936b6550b0d 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 048487fcd68..f0c8a1cb978 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/windowmanager/intern/wm_apple.c b/source/blender/windowmanager/intern/wm_apple.c index 7853abc059c..67c49c4717f 100644 --- a/source/blender/windowmanager/intern/wm_apple.c +++ b/source/blender/windowmanager/intern/wm_apple.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index 5879e0f82d6..a84eb74be33 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -1,5 +1,5 @@ /** -* $Id: wm_cursors.c +* $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index 372ef107c15..6f093b2b3a9 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 6bbce386bd3..513e93d9e3d 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index b72bc02aca6..5de01a6259f 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -108,6 +108,17 @@ void wm_event_free_all(wmWindow *win) /* ********************* notifiers, listeners *************** */ +static int wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, void *reference) +{ + wmNotifier *note; + + for(note=wm->queue.first; note; note=note->next) + if((note->category|note->data|note->subtype|note->action) == type && note->reference == reference) + return 1; + + return 0; +} + /* XXX: in future, which notifiers to send to other windows? */ void WM_event_add_notifier(const bContext *C, unsigned int type, void *reference) { @@ -134,7 +145,7 @@ void WM_main_add_notifier(unsigned int type, void *reference) Main *bmain= G.main; wmWindowManager *wm= bmain->wm.first; - if(wm) { + if(wm && !wm_test_duplicate_notifier(wm, type, reference)) { wmNotifier *note= MEM_callocN(sizeof(wmNotifier), "notifier"); note->wm= wm; @@ -217,7 +228,7 @@ void wm_event_do_notifiers(bContext *C) } } - if(ELEM4(note->category, NC_SCENE, NC_OBJECT, NC_GEOM, NC_SCENE)) { + if(ELEM5(note->category, NC_SCENE, NC_OBJECT, NC_GEOM, NC_SCENE, NC_WM)) { ED_info_stats_clear(CTX_data_scene(C)); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_INFO, NULL); } diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 2a8091c1aa2..80226b8fa56 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1,5 +1,5 @@ /** - * $Id: wm_files.c + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -238,6 +238,8 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist) /* in case UserDef was read, we re-initialize all, and do versioning */ static void wm_init_userdef(bContext *C) { + extern char btempdir[]; + UI_init_userdef(); MEM_CacheLimiter_set_maximum(U.memcachelimit * 1024 * 1024); sound_init(CTX_data_main(C)); @@ -245,6 +247,8 @@ static void wm_init_userdef(bContext *C) /* set the python auto-execute setting from user prefs */ if (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) G.f &= ~G_SCRIPT_AUTOEXEC; else G.f |= G_SCRIPT_AUTOEXEC; + + if(U.tempdir[0]) strncpy(btempdir, U.tempdir, FILE_MAXDIR+FILE_MAXFILE); } void WM_read_file(bContext *C, char *name, ReportList *reports) diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index 9674bbe51b7..856894aa74b 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index f825bb28547..af001aa9627 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -128,8 +128,6 @@ void WM_init(bContext *C, int argc, char **argv) BLF_init(11, U.dpi); BLF_lang_init(); - init_builtin_keyingsets(); /* editors/animation/keyframing.c */ - /* get the default database, plus a wm */ WM_read_homefile(C, NULL); @@ -151,6 +149,7 @@ void WM_init(bContext *C, int argc, char **argv) if (!G.background) { GPU_extensions_init(); + GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP)); UI_init(); } @@ -159,9 +158,7 @@ void WM_init(bContext *C, int argc, char **argv) clear_mat_mtex_copybuf(); // glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); - -// init_node_butfuncs(); - + ED_preview_init_dbase(); G.ndofdevice = -1; /* XXX bad initializer, needs set otherwise buttons show! */ @@ -173,13 +170,15 @@ void WM_init(bContext *C, int argc, char **argv) void WM_init_splash(bContext *C) { - wmWindowManager *wm= CTX_wm_manager(C); - wmWindow *prevwin= CTX_wm_window(C); - - if(wm->windows.first) { - CTX_wm_window_set(C, wm->windows.first); - WM_operator_name_call(C, "WM_OT_splash", WM_OP_INVOKE_DEFAULT, NULL); - CTX_wm_window_set(C, prevwin); + if((U.uiflag & USER_SPLASH_DISABLE) == 0) { + wmWindowManager *wm= CTX_wm_manager(C); + wmWindow *prevwin= CTX_wm_window(C); + + if(wm->windows.first) { + CTX_wm_window_set(C, wm->windows.first); + WM_operator_name_call(C, "WM_OT_splash", WM_OP_INVOKE_DEFAULT, NULL); + CTX_wm_window_set(C, prevwin); + } } } @@ -218,6 +217,7 @@ extern wchar_t *copybufinfo; // XXX copy/paste buffer stuff... extern void free_anim_copybuf(); extern void free_anim_drivers_copybuf(); +extern void free_fmodifiers_copybuf(); extern void free_posebuf(); /* called in creator.c even... tsk, split this! */ @@ -273,6 +273,7 @@ void WM_exit(bContext *C) // free_matcopybuf(); free_anim_copybuf(); free_anim_drivers_copybuf(); + free_fmodifiers_copybuf(); free_posebuf(); // free_vertexpaint(); // free_imagepaint(); @@ -280,7 +281,9 @@ void WM_exit(bContext *C) // fsmenu_free(); BLF_exit(); - + + ANIM_keyingset_infos_exit(); + RE_FreeAllRender(); RE_engines_exit(); diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c index cb229c301b2..dd1d41c082a 100644 --- a/source/blender/windowmanager/intern/wm_jobs.c +++ b/source/blender/windowmanager/intern/wm_jobs.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 81bef5336e8..1ec131dd73a 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index f45d3dfb6cb..e3d71951b7c 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -910,6 +910,60 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op) return block; } +/* Only invoked by OK button in popups created with wm_block_create_dialog() */ +static void dialog_exec_cb(bContext *C, void *arg1, void *arg2) +{ + wmOperator *op= arg1; + uiBlock *block= arg2; + + WM_operator_call(C, op); + + uiPupBlockClose(C, block); +} + +/* Dialogs are popups that require user verification (click OK) before exec */ +static uiBlock *wm_block_create_dialog(bContext *C, ARegion *ar, void *userData) +{ + struct { wmOperator *op; int width; int height; } * data = userData; + wmWindowManager *wm= CTX_wm_manager(C); + wmOperator *op= data->op; + PointerRNA ptr; + uiBlock *block; + uiLayout *layout; + uiBut *btn; + uiStyle *style= U.uistyles.first; + int columns= 2; + + block = uiBeginBlock(C, ar, "operator dialog", UI_EMBOSS); + uiBlockClearFlag(block, UI_BLOCK_LOOP); + uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT); + + if (!op->properties) { + IDPropertyTemplate val = {0}; + op->properties= IDP_New(IDP_GROUP, val, "wmOperatorProperties"); + } + + RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); + layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, style); + uiItemL(layout, op->type->name, 0); + + if (op->type->ui) { + op->layout= layout; + op->type->ui((bContext*)C, op); + op->layout= NULL; + } + else + uiDefAutoButsRNA(C, layout, &ptr, columns); + + /* Create OK button, the callback of which will execute op */ + btn= uiDefBut(block, BUT, 0, "OK", 0, 0, 0, 20, NULL, 0, 0, 0, 0, ""); + uiButSetFunc(btn, dialog_exec_cb, op, block); + + uiPopupBoundsBlock(block, 4.0f, 0, 0); + uiEndBlock(C, block); + + return block; +} static uiBlock *wm_operator_create_ui(bContext *C, ARegion *ar, void *userData) { @@ -958,13 +1012,28 @@ int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *event) return retval; } -void WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height) +int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, int height) +{ + struct { wmOperator *op; int width; int height; } data; + + data.op= op; + data.width= width; + data.height= height; + + /* op is not executed until popup OK but is clicked */ + uiPupBlock(C, wm_block_create_dialog, &data); + + return OPERATOR_RUNNING_MODAL; +} + +int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height) { struct { wmOperator *op; int width; int height; } data; data.op = op; data.width = width; data.height = height; uiPupBlock(C, wm_operator_create_ui, &data); + return OPERATOR_RUNNING_MODAL; } int WM_operator_redo_popup(bContext *C, wmOperator *op) @@ -1060,7 +1129,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse char *revision_str = NULL; char version_buf[128]; char revision_buf[128]; - extern char * build_rev; + extern char build_rev[]; char *cp; version_str = &version_buf[0]; @@ -1069,16 +1138,6 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse sprintf(version_str, "%d.%02d.%d", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION); sprintf(revision_str, "r%s", build_rev); - /* here on my system I get ugly double quotes around the revision number. - * if so, clip it off: */ - cp = strchr(revision_str, '"'); - if (cp) { - memmove(cp, cp+1, strlen(cp+1)); - cp = strchr(revision_str, '"'); - if (cp) - *cp = 0; - } - BLF_size(style->widgetlabel.points, U.dpi); ver_width = BLF_width(version_str)+5; rev_width = BLF_width(revision_str)+5; @@ -1120,10 +1179,8 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse else display_name= recent->filename; uiItemStringO(col, display_name, ICON_FILE_BLEND, "WM_OT_open_mainfile", "path", recent->filename); } - uiItemL(col, "Recovery", 0); - uiItemO(col, NULL, ICON_FILE_BLEND, "WM_OT_recover_last_session"); - uiItemO(col, NULL, ICON_FILE_BLEND, "WM_OT_recover_auto_save"); - + uiItemS(col); + uiItemO(col, NULL, ICON_HELP, "WM_OT_recover_last_session"); uiItemL(col, "", 0); uiCenteredBoundsBlock(block, 0.0f); @@ -1236,7 +1293,7 @@ static int wm_search_menu_poll(bContext *C) if(CTX_wm_window(C)==NULL) return 0; if(CTX_wm_area(C) && CTX_wm_area(C)->spacetype==SPACE_CONSOLE) return 0; // XXX - so we can use the shortcut in the console if(CTX_wm_area(C) && CTX_wm_area(C)->spacetype==SPACE_TEXT) return 0; // XXX - so we can use the spacebar in the text editor - if(CTX_data_edit_object(C) && CTX_data_edit_object(C)->type==OB_CURVE) return 0; // XXX - so we can use the spacebar for entering text + if(CTX_data_edit_object(C) && CTX_data_edit_object(C)->type==OB_FONT) return 0; // XXX - so we can use the spacebar for entering text return 1; } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 0664c5ab8bb..ea41f03d864 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -1,5 +1,5 @@ /** - * $Id: wm_window.c + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h index bf07ee0c884..7228a6dcd93 100644 --- a/source/blender/windowmanager/wm.h +++ b/source/blender/windowmanager/wm.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/windowmanager/wm_draw.h b/source/blender/windowmanager/wm_draw.h index fdece6efc00..42d3ec7e8bc 100644 --- a/source/blender/windowmanager/wm_draw.h +++ b/source/blender/windowmanager/wm_draw.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h index 2f4519d57ba..8fd650fb184 100644 --- a/source/blender/windowmanager/wm_event_system.h +++ b/source/blender/windowmanager/wm_event_system.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h index b71ccd430c0..5f6af878976 100644 --- a/source/blender/windowmanager/wm_event_types.h +++ b/source/blender/windowmanager/wm_event_types.h @@ -1,5 +1,5 @@ /* - * $Id: wm_event_types.h + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/windowmanager/wm_files.h b/source/blender/windowmanager/wm_files.h index b70e4551069..c633ed8388e 100644 --- a/source/blender/windowmanager/wm_files.h +++ b/source/blender/windowmanager/wm_files.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h index 9b996baa7ef..fa244036645 100644 --- a/source/blender/windowmanager/wm_window.h +++ b/source/blender/windowmanager/wm_window.h @@ -1,5 +1,5 @@ /** - * $Id: wm_window.h + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index dfdfec217aa..4f9218cc887 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -121,6 +121,7 @@ struct Render *RE_NewRender(const char *name){return (struct Render*) NULL;} void RE_BlenderFrame(struct Render *re, struct Scene *scene, int frame){} /* rna */ +float *give_cursor(struct Scene *scene, struct View3D *v3d){return NULL;} void WM_menutype_free(void){} void WM_menutype_freelink(struct MenuType* mt){} int WM_menutype_add(struct MenuType *mt) {return 0;} @@ -178,6 +179,9 @@ int WM_keymap_item_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2){ret /* rna editors */ +struct KeyingSetInfo *ANIM_keyingset_info_find_named (const char name[]){return NULL;} +void ANIM_keyingset_info_register (const struct bContext *C, struct KeyingSetInfo *ksi){} +void ANIM_keyingset_info_unregister (const struct bContext *C, struct KeyingSetInfo *ksi){} short ANIM_add_driver(struct ID *id, const char rna_path[], int array_index, short flag, int type){return 0;} void ED_space_image_release_buffer(struct SpaceImage *sima, void *lock){} struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **lock_r){return (struct ImBuf *) NULL;} @@ -189,6 +193,7 @@ void WM_event_add_fileselect(struct bContext *C, struct wmOperator *op){} void WM_cursor_wait (int val) {} void ED_node_texture_default(struct Tex *tx){} void ED_node_changed_update(struct bContext *C, struct bNode *node){} +void ED_node_generic_update(struct Main *bmain, struct Scene *scene, struct bNodeTree *ntree, struct bNode *node){} void ED_view3d_scene_layers_update(struct Main *bmain, struct Scene *scene){} int ED_view3d_scene_layer_set(int lay, const int *values){return 0;} void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar){} @@ -220,7 +225,6 @@ void ED_mesh_transform(struct Mesh *me, float *mat){} void ED_mesh_update(struct Mesh *mesh, struct bContext *C){} int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me){return 0;} int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me){return 0;} -void ED_object_apply_obmat(struct Object *ob){} void ED_object_constraint_dependency_update(struct Scene *scene, struct Object *ob){} void ED_object_constraint_update(struct Object *ob){} struct bDeformGroup *ED_vgroup_add_name(struct Object *ob, char *name){return (struct bDeformGroup *) NULL;} diff --git a/source/creator/buildinfo.c b/source/creator/buildinfo.c index d50a99e8850..8b02dde1a5f 100644 --- a/source/creator/buildinfo.c +++ b/source/creator/buildinfo.c @@ -35,9 +35,9 @@ #define XSTRINGIFY(x) #x #ifdef BUILD_DATE -const char * build_date=STRINGIFY(BUILD_DATE); -const char * build_time=STRINGIFY(BUILD_TIME); -const char * build_rev=STRINGIFY(BUILD_REV); -const char * build_platform=STRINGIFY(BUILD_PLATFORM); -const char * build_type=STRINGIFY(BUILD_TYPE); +char build_date[]= STRINGIFY(BUILD_DATE); +char build_time[]= STRINGIFY(BUILD_TIME); +char build_rev[]= STRINGIFY(BUILD_REV); +char build_platform[]= STRINGIFY(BUILD_PLATFORM); +char build_type[]= STRINGIFY(BUILD_TYPE); #endif diff --git a/source/creator/creator.c b/source/creator/creator.c index 9afb2e52823..d6fa4e586ad 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -109,11 +109,11 @@ // from buildinfo.c #ifdef BUILD_DATE -extern const char * build_date; -extern const char * build_time; -extern const char * build_rev; -extern const char * build_platform; -extern const char * build_type; +extern char build_date[]; +extern char build_time[]; +extern char build_rev[]; +extern char build_platform[]; +extern char build_type[]; #endif /* Local Function prototypes */ @@ -163,6 +163,20 @@ static void blender_esc(int sig) } } +/* buildinfo can have quotes */ +#ifdef BUILD_DATE +static void strip_quotes(char *str) +{ + if(str[0] == '"') { + int len= strlen(str) - 1; + memmove(str, str+1, len); + if(str[len-1] == '"') { + str[len-1]= '\0'; + } + } +} +#endif + static int print_version(int argc, char **argv, void *data) { #ifdef BUILD_DATE @@ -186,7 +200,7 @@ static int print_help(int argc, char **argv, void *data) printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION); printf ("Usage: blender [args ...] [file] [args ...]\n"); printf ("\nRender options:\n"); - printf (" -b <file>\tRender <file> in background (doesn't load the user defaults .B.blend file)\n"); + printf (" -b <file>\tLoad <file> in background (often used for background rendering)\n"); printf (" -a render frames from start to end (inclusive), only works when used after -b\n"); printf (" -S <name>\tSet scene <name>\n"); printf (" -f <frame>\tRender frame <frame> and save it\n"); @@ -675,7 +689,7 @@ static int render_frame(int argc, char **argv, void *data) frame = MIN2(MAXFRAME, MAX2(MINAFRAME, frame)); - RE_BlenderAnim(re, scene, frame, frame, scene->r.frame_step, &reports); + RE_BlenderAnim(re, scene, scene->lay, frame, frame, scene->r.frame_step, &reports); return 1; } else { printf("\nError: frame number must follow '-f'.\n"); @@ -695,7 +709,7 @@ static int render_animation(int argc, char **argv, void *data) Render *re= RE_NewRender(scene->id.name, RE_SLOT_DEFAULT); ReportList reports; BKE_reports_init(&reports, RPT_PRINT); - RE_BlenderAnim(re, scene, scene->r.sfra, scene->r.efra, scene->r.frame_step, &reports); + RE_BlenderAnim(re, scene, scene->lay, scene->r.sfra, scene->r.efra, scene->r.frame_step, &reports); } else { printf("\nError: no blend loaded. cannot use '-a'.\n"); } @@ -720,7 +734,7 @@ static int set_start_frame(int argc, char **argv, void *data) Scene *scene= CTX_data_scene(C); if (argc > 1) { int frame = atoi(argv[1]); - (scene->r.sfra) = MIN2(MAXFRAME, MAX2(1, frame)); + (scene->r.sfra) = CLAMPIS(frame, MINFRAME, MAXFRAME); return 1; } else { printf("\nError: frame number must follow '-s'.\n"); @@ -739,7 +753,7 @@ static int set_end_frame(int argc, char **argv, void *data) Scene *scene= CTX_data_scene(C); if (argc > 1) { int frame = atoi(argv[1]); - (scene->r.efra) = MIN2(MAXFRAME, MAX2(1, frame)); + (scene->r.efra) = CLAMPIS(frame, MINFRAME, MAXFRAME); return 1; } else { printf("\nError: frame number must follow '-e'.\n"); @@ -758,10 +772,10 @@ static int set_skip_frame(int argc, char **argv, void *data) Scene *scene= CTX_data_scene(C); if (argc > 1) { int frame = atoi(argv[1]); - (scene->r.frame_step) = MIN2(MAXFRAME, MAX2(1, frame)); + (scene->r.frame_step) = CLAMPIS(frame, 1, MAXFRAME); return 1; } else { - printf("\nError: number of frames must follow '-j'.\n"); + printf("\nError: number of frames to step must follow '-j'.\n"); return 0; } } else { @@ -938,7 +952,15 @@ int main(int argc, char **argv) if(blender_path_env) BLI_strncpy(blender_path, blender_path_env, sizeof(blender_path)); } - + +#ifdef BUILD_DATE + strip_quotes(build_date); + strip_quotes(build_time); + strip_quotes(build_rev); + strip_quotes(build_platform); + strip_quotes(build_type); +#endif + RNA_init(); RE_engines_init(); @@ -982,7 +1004,7 @@ int main(int argc, char **argv) WM_init(C, argc, argv); - // XXX BRECHT SOLVE + /* this is properly initialized with user defs, but this is default */ BLI_where_is_temp( btempdir, 1 ); /* call after loading the .B.blend so we can read U.tempdir */ #ifndef DISABLE_SDL @@ -1010,7 +1032,7 @@ int main(int argc, char **argv) * Update: now this function also inits the bpymenus, which also depend * on U.pythondir. */ - + // TODO - U.pythondir #endif diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index 3ee4248343c..3a5bb92b4fa 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -80,17 +80,14 @@ extern "C" #include "DNA_material_types.h" #include "BLI_blenlib.h" #include "MEM_guardedalloc.h" -//XXX #include "BSE_editipo.h" -//XXX #include "BSE_editipo_types.h" -// #include "DNA_ipo_types.h" #include "BKE_global.h" #include "BKE_animsys.h" #include "BKE_library.h" -#include "BKE_ipo.h" // eval_icu #include "BKE_material.h" // copy_material #include "BKE_mesh.h" // copy_mesh #include "DNA_space_types.h" #include "DNA_anim_types.h" +#include "RNA_define.h" #include "../../blender/editors/include/ED_keyframing.h" } diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp index 2edebf1ac98..f28c9518ac4 100644 --- a/source/gameengine/Ketsji/KX_PythonSeq.cpp +++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/gameengine/Ketsji/KX_PythonSeq.h b/source/gameengine/Ketsji/KX_PythonSeq.h index ac011d822f7..ca8f667852a 100644 --- a/source/gameengine/Ketsji/KX_PythonSeq.h +++ b/source/gameengine/Ketsji/KX_PythonSeq.h @@ -1,5 +1,5 @@ /** - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp index b8ed38c435d..f97ceb1fa67 100644 --- a/source/gameengine/VideoTexture/Texture.cpp +++ b/source/gameengine/VideoTexture/Texture.cpp @@ -357,6 +357,12 @@ PyObject * Texture_refresh (Texture * self, PyObject * args) Py_RETURN_NONE; } +// get OpenGL Bind Id +PyObject * Texture_getBindId (Texture * self, void * closure) +{ + unsigned int id = self->m_actTex; + return Py_BuildValue("h", id); +} // get mipmap value PyObject * Texture_getMipmap (Texture * self, void * closure) @@ -430,6 +436,7 @@ static PyGetSetDef textureGetSets[] = { {(char*)"source", (getter)Texture_getSource, (setter)Texture_setSource, (char*)"source of texture", NULL}, {(char*)"mipmap", (getter)Texture_getMipmap, (setter)Texture_setMipmap, (char*)"mipmap texture", NULL}, + {(char*)"bindId", (getter)Texture_getBindId, NULL, (char*)"OpenGL Bind Name", NULL}, {NULL} }; |