diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-12-06 04:23:18 +0300 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-12-06 04:23:18 +0300 |
commit | 8a2eb1f590c40cc9831d46d95434d9a63f31629b (patch) | |
tree | 7a0043da9546186d1a434c95485136ca600a654d /source/blender/blenkernel | |
parent | ad608f30e019b0184ec626942a42ceba4e2e6487 (diff) | |
parent | 2f366d1544ecc5618d7190b779ccc75f2f144d0a (diff) |
* Merged changes in the trunk up to revision 33492.
* Fixed a bug in listing all style modules in source/blender/blenlib/intern/bpath.c.
Diffstat (limited to 'source/blender/blenkernel')
68 files changed, 622 insertions, 506 deletions
diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index 07ab0e7ec2c..3952b6066d3 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -95,7 +95,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, int oldSubscript, int newSubscript, int verify_paths); +void BKE_animdata_fix_paths_rename(struct ID *owner_id, struct AnimData *adt, const 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_blender.h b/source/blender/blenkernel/BKE_blender.h index 01a26329f29..a97c5fd8d9e 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -45,7 +45,7 @@ struct Scene; struct Main; #define BLENDER_VERSION 255 -#define BLENDER_SUBVERSION 0 +#define BLENDER_SUBVERSION 1 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index 19f6ab4b0a8..83af573bd42 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -252,7 +252,7 @@ typedef enum */ typedef struct { - char *name; + const char *name; CM_SOLVER_ID id; int ( *init ) ( struct Object *ob, struct ClothModifierData *clmd ); int ( *solver ) ( struct Object *ob, float framenr, struct ClothModifierData *clmd, struct ListBase *effectors ); diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index 742c5049ed8..1b103890e06 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -225,7 +225,7 @@ struct Main *CTX_data_main(const bContext *C); struct Scene *CTX_data_scene(const bContext *C); struct ToolSettings *CTX_data_tool_settings(const bContext *C); -char *CTX_data_mode_string(const bContext *C); +const char *CTX_data_mode_string(const bContext *C); int CTX_data_mode_enum(const bContext *C); void CTX_data_main_set(bContext *C, struct Main *bmain); diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index 3c04d6ec643..fb079d44bb5 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -266,7 +266,7 @@ void CustomData_from_bmesh_block(const struct CustomData *source, /* query info over types */ -void CustomData_file_write_info(int type, char **structname, int *structnum); +void CustomData_file_write_info(int type, const char **structname, int *structnum); int CustomData_sizeof(int type); /* get the name of a layer type */ diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h index 53f474aa972..39df877f67b 100644 --- a/source/blender/blenkernel/BKE_deform.h +++ b/source/blender/blenkernel/BKE_deform.h @@ -49,8 +49,8 @@ int defgroup_flip_index(struct Object *ob, int index, int use_default); int defgroup_name_index(struct Object *ob, const char *name); void defgroup_unique_name(struct bDeformGroup *dg, struct Object *ob); -struct MDeformWeight *defvert_find_index(const struct MDeformVert *dv, int defgroup); -struct MDeformWeight *defvert_verify_index(struct MDeformVert *dv, int defgroup); +struct MDeformWeight *defvert_find_index(const struct MDeformVert *dv, const int defgroup); +struct MDeformWeight *defvert_verify_index(struct MDeformVert *dv, const int defgroup); float defvert_find_weight(const struct MDeformVert *dvert, int group_num); float defvert_array_find_weight_safe(const struct MDeformVert *dvert, int index, int group_num); diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h index 5b2dca5299c..e612d00f936 100644 --- a/source/blender/blenkernel/BKE_depsgraph.h +++ b/source/blender/blenkernel/BKE_depsgraph.h @@ -110,15 +110,14 @@ void DAG_scene_flush_update(struct Main *bmain, struct Scene *sce, unsigned int /* tag objects for update on file load */ void DAG_on_load_update(struct Main *bmain); - /* flag all IDs that need recalc because they're animated, influencing - this ID only. only for objects currently */ -void DAG_id_update_flags(struct ID *id); - /* flushes all recalc flags for this object down the dependency tree, - but note the DAG only supports objects and object data currently */ -void DAG_id_flush_update(struct ID *id, short flag); /* when setting manual RECALC flags, call this afterwards */ void DAG_ids_flush_update(struct Main *bmain, int time); + /* tag datablock to get updated for the next redraw */ +void DAG_id_tag_update(struct ID *id, short flag); + /* flush all tagged updates */ +void DAG_ids_flush_tagged(struct Main *bmain); + /* (re)-create dependency graph for armature pose */ void DAG_pose_sort(struct Object *ob); diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index 46392c2c8ea..5fbb7f37d15 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -140,7 +140,7 @@ typedef enum eFMI_Action_Types { /* modifier only modifies the values of points (but times stay the same) */ FMI_TYPE_REPLACE_VALUES, /* modifier generates a curve regardless of what came before */ - FMI_TYPE_GENERATE_CURVE, + FMI_TYPE_GENERATE_CURVE } eFMI_Action_Types; /* Flags for the requirements of a FModifier Type */ @@ -152,7 +152,7 @@ typedef enum eFMI_Requirement_Flags { */ FMI_REQUIRES_NOTHING = (1<<1), /* refer to modifier instance */ - FMI_REQUIRES_RUNTIME_CHECK = (1<<2), + FMI_REQUIRES_RUNTIME_CHECK = (1<<2) } eFMI_Requirement_Flags; /* Function Prototypes for FModifierTypeInfo's */ @@ -193,7 +193,7 @@ struct FCurve *list_find_fcurve(ListBase *list, const char rna_path[], const int struct FCurve *iter_step_fcurve (struct FCurve *fcu_iter, const char rna_path[]); /* high level function to get an fcurve from C without having the rna */ -struct FCurve *id_data_find_fcurve(ID *id, void *data, struct StructRNA *type, char *prop_name, int index); +struct FCurve *id_data_find_fcurve(ID *id, void *data, struct StructRNA *type, const char *prop_name, int index); /* Get list of LinkData's containing pointers to the F-Curves which control the types of data indicated * e.g. numMatches = list_find_data_fcurves(matches, &act->curves, "pose.bones[", "MyFancyBone"); diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h index 65bcb54408b..898538c6820 100644 --- a/source/blender/blenkernel/BKE_gpencil.h +++ b/source/blender/blenkernel/BKE_gpencil.h @@ -42,7 +42,7 @@ void free_gpencil_data(struct bGPdata *gpd); struct bGPDframe *gpencil_frame_addnew(struct bGPDlayer *gpl, int cframe); struct bGPDlayer *gpencil_layer_addnew(struct bGPdata *gpd); -struct bGPdata *gpencil_data_addnew(char name[]); +struct bGPdata *gpencil_data_addnew(const char name[]); struct bGPDframe *gpencil_frame_duplicate(struct bGPDframe *src); struct bGPDlayer *gpencil_layer_duplicate(struct bGPDlayer *src); diff --git a/source/blender/blenkernel/BKE_icons.h b/source/blender/blenkernel/BKE_icons.h index 252191803f2..42cbd22d9f1 100644 --- a/source/blender/blenkernel/BKE_icons.h +++ b/source/blender/blenkernel/BKE_icons.h @@ -68,7 +68,7 @@ void BKE_icon_delete(struct ID* id); void BKE_icon_changed(int icon_id); /* free all icons */ -void BKE_icons_free(); +void BKE_icons_free(void); /* free the preview image */ void BKE_previewimg_free(struct PreviewImage **prv); @@ -77,7 +77,7 @@ void BKE_previewimg_free(struct PreviewImage **prv); void BKE_previewimg_free_id(ID *id); /* create a new preview image */ -struct PreviewImage* BKE_previewimg_create() ; +struct PreviewImage* BKE_previewimg_create(void) ; /* create a copy of the preview image */ struct PreviewImage* BKE_previewimg_copy(struct PreviewImage *prv); diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index 7a801c0ef0a..46c7cd89ecf 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -46,6 +46,7 @@ void free_image(struct Image *me); void BKE_stamp_info(struct Scene *scene, struct ImBuf *ibuf); void BKE_stamp_buf(struct Scene *scene, unsigned char *rect, float *rectf, int width, int height, int channels); +int BKE_alphatest_ibuf(struct ImBuf *ibuf); int BKE_write_ibuf(struct Scene *scene, struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality); void BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames); int BKE_add_image_extension(char *string, int imtype); diff --git a/source/blender/blenkernel/BKE_ipo.h b/source/blender/blenkernel/BKE_ipo.h index 3bc707a674a..e700f263011 100644 --- a/source/blender/blenkernel/BKE_ipo.h +++ b/source/blender/blenkernel/BKE_ipo.h @@ -44,10 +44,6 @@ void do_versions_ipos_to_animato(struct Main *main); void free_ipo(struct Ipo *ipo); -// xxx perhaps this should be in curve api not in anim api -void correct_bezpart(float *v1, float *v2, float *v3, float *v4); - - #ifdef __cplusplus }; #endif diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index d7cc6590f94..83c35cc9799 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -67,17 +67,17 @@ void free_libblock_us(struct ListBase *lb, void *idv); void free_main(struct Main *mainvar); void tag_main(struct Main *mainvar, int tag); -void rename_id(struct ID *id, char *name); +void rename_id(struct ID *id, const char *name); void name_uiprefix_id(char *name, struct ID *id); void test_idbutton(char *name); void text_idbutton(struct ID *id, char *text); void all_local(struct Library *lib, int untagged_only); -struct ID *find_id(char *type, const char *name); +struct ID *find_id(const char *type, const char *name); void clear_id_newpoins(void); -void IDnames_to_pupstring(char **str, char *title, char *extraops, struct ListBase *lb,struct ID* link, short *nr); -void IMAnames_to_pupstring(char **str, char *title, char *extraops, struct ListBase *lb, struct ID *link, short *nr); -void IPOnames_to_pupstring(char **str, char *title, char *extraops, struct ListBase *lb, struct ID* link, short *nr, int blocktype); +void IDnames_to_pupstring(const char **str, const char *title, const char *extraops, struct ListBase *lb,struct ID* link, short *nr); +void IMAnames_to_pupstring(const char **str, const char *title, const char *extraops, struct ListBase *lb, struct ID *link, short *nr); +void IPOnames_to_pupstring(const char **str, const char *title, const char *extraops, struct ListBase *lb, struct ID* link, short *nr, int blocktype); void flag_listbase_ids(ListBase *lb, short flag, short value); void flag_all_listbases_ids(short flag, short value); diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index 3de2893fb56..934c39505cc 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -82,6 +82,8 @@ typedef struct Main { ListBase wm; ListBase gpencil; ListBase linestyle; + + char id_tag_update[256]; } Main; diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index e5b5118deb0..6f36c26dd3f 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -127,12 +127,7 @@ struct pgn_elements { char *data; }; -void calc_mballco(struct MetaElem *ml, float *vec); -float densfunc(struct MetaElem *ball, float x, float y, float z); octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z, short depth); -float metaball(float x, float y, float z); -void accum_mballfaces(int i1, int i2, int i3, int i4); -void *new_pgn_element(int size); void freepolygonize(PROCESS *p); void docube(CUBE *cube, PROCESS *p, struct MetaBall *mb); diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 0225a402fb8..97bef6ab565 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -294,7 +294,11 @@ int modifier_couldBeCage(struct Scene *scene, struct ModifierData *md) int modifier_isCorrectableDeformed(struct ModifierData *md); int modifier_sameTopology(ModifierData *md); int modifier_isEnabled(struct Scene *scene, struct ModifierData *md, int required_mode); -void modifier_setError(struct ModifierData *md, char *format, ...); +void modifier_setError(struct ModifierData *md, const char *format, ...) +#ifdef __GNUC__ +__attribute__ ((format (printf, 2, 3))); +#endif +; void modifiers_foreachObjectLink(struct Object *ob, ObjectWalkFunc walk, diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 7b4925b7a46..857150cf873 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -61,7 +61,7 @@ struct uiLayout; typedef struct bNodeSocketType { int type, limit; - char *name; + const char *name; float val1, val2, val3, val4; /* default alloc value for inputs */ float min, max; /* default range for inputs */ @@ -75,7 +75,7 @@ typedef struct bNodeSocketType { typedef struct bNodeType { void *next,*prev; int type; - char *name; + const char *name; /* can be allocated too */ float width, minwidth, maxwidth; short nclass, flag; @@ -129,7 +129,7 @@ typedef struct bNodeType { void ntreeVerifyTypes(struct bNodeTree *ntree); -struct bNodeTree *ntreeAddTree(int type); +struct bNodeTree *ntreeAddTree(const char *name, int type, const short is_group); void ntreeInitTypes(struct bNodeTree *ntree); void ntreeMakeOwnType(struct bNodeTree *ntree); @@ -399,7 +399,6 @@ int ntreeCompositTagAnimated(struct bNodeTree *ntree); void ntreeCompositTagGenerators(struct bNodeTree *ntree); void ntreeCompositForceHidden(struct bNodeTree *ntree, struct Scene *scene); -void free_compbuf(struct CompBuf *cbuf); /* internal...*/ /* ************** TEXTURE NODES *************** */ diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 45bdb83e090..100b5111717 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -90,6 +90,7 @@ struct Object *add_object(struct Scene *scene, int type); struct Object *copy_object(struct Object *ob); void expand_local_object(struct Object *ob); void make_local_object(struct Object *ob); +int object_is_libdata(struct Object *ob); int object_data_is_libdata(struct Object *ob); void set_mblur_offs(float blur); void set_field_offs(float field); diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index 52536e10e56..aba22df0fe3 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -32,6 +32,7 @@ #include "DNA_ID.h" #include "DNA_object_force.h" #include "DNA_boid_types.h" +#include <stdio.h> /* for FILE */ /* Point cache clearing option, for BKE_ptcache_id_clear, before * and after are non inclusive (they wont remove the cfra) */ @@ -234,7 +235,6 @@ void BKE_ptcache_id_from_softbody(PTCacheID *pid, struct Object *ob, struct Soft void BKE_ptcache_id_from_particles(PTCacheID *pid, struct Object *ob, struct ParticleSystem *psys); void BKE_ptcache_id_from_cloth(PTCacheID *pid, struct Object *ob, struct ClothModifierData *clmd); void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeModifierData *smd); -void BKE_ptcache_id_from_smoke_turbulence(PTCacheID *pid, struct Object *ob, struct SmokeModifierData *smd); void BKE_ptcache_ids_from_object(struct ListBase *lb, struct Object *ob, struct Scene *scene, int duplis); @@ -300,6 +300,9 @@ void BKE_ptcache_mem_to_disk(struct PTCacheID *pid); /* Convert disk cache to memory cache and vice versa. Clears the cache that was converted. */ void BKE_ptcache_toggle_disk_cache(struct PTCacheID *pid); +/* Rename all disk cache files with a new name. Doesn't touch the actual content of the files. */ +void BKE_ptcache_disk_cache_rename(struct PTCacheID *pid, char *from, char *to); + /* Loads simulation from external (disk) cache files. */ void BKE_ptcache_load_external(struct PTCacheID *pid); diff --git a/source/blender/blenkernel/BKE_property.h b/source/blender/blenkernel/BKE_property.h index b9cca612846..5fab97b35e5 100644 --- a/source/blender/blenkernel/BKE_property.h +++ b/source/blender/blenkernel/BKE_property.h @@ -42,7 +42,7 @@ void copy_properties(struct ListBase *lbn, struct ListBase *lbo); void init_property(struct bProperty *prop); struct bProperty *new_property(int type); void unique_property(struct bProperty *first, struct bProperty *prop, int force); -struct bProperty *get_ob_property(struct Object *ob, char *name); +struct bProperty *get_ob_property(struct Object *ob, const char *name); void set_ob_property(struct Object *ob, struct bProperty *propc); int compare_property(struct bProperty *prop, char *str); void set_property(struct bProperty *prop, char *str); diff --git a/source/blender/blenkernel/BKE_report.h b/source/blender/blenkernel/BKE_report.h index d7b7801d697..b84808a7ddd 100644 --- a/source/blender/blenkernel/BKE_report.h +++ b/source/blender/blenkernel/BKE_report.h @@ -45,7 +45,11 @@ void BKE_reports_init(ReportList *reports, int flag); void BKE_reports_clear(ReportList *reports); void BKE_report(ReportList *reports, ReportType type, const char *message); -void BKE_reportf(ReportList *reports, ReportType type, const char *format, ...); +void BKE_reportf(ReportList *reports, ReportType type, const char *format, ...) +#ifdef __GNUC__ +__attribute__ ((format (printf, 3, 4))); +#endif +; void BKE_reports_prepend(ReportList *reports, const char *prepend); void BKE_reports_prependf(ReportList *reports, const char *prepend, ...); diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 1a9fb2d7404..d8d4c75a74b 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -97,8 +97,8 @@ SeqRenderData seq_new_render_data( struct Main * bmain, struct Scene * scene, int rectx, int recty, int preview_render_size); -int seq_cmp_render_data(SeqRenderData * a, SeqRenderData * b); -unsigned int seq_hash_render_data(SeqRenderData * a); +int seq_cmp_render_data(const SeqRenderData * a, const SeqRenderData * b); +unsigned int seq_hash_render_data(const SeqRenderData * a); /* Wipe effect */ enum {DO_SINGLE_WIPE, DO_DOUBLE_WIPE, DO_BOX_WIPE, DO_CROSS_WIPE, @@ -113,7 +113,7 @@ struct SeqEffectHandle { /* number of input strips needed (called directly after construction) */ - int (*num_inputs)(); + int (*num_inputs)(void); /* load is called first time after readblenfile in get_sequence_effect automatically */ @@ -177,7 +177,7 @@ void seq_free_strip(struct Strip *strip); void seq_free_editing(struct Scene *scene); void seq_free_clipboard(void); struct Editing *seq_give_editing(struct Scene *scene, int alloc); -char *give_seqname(struct Sequence *seq); +const char *give_seqname(struct Sequence *seq); void calc_sequence(struct Scene *scene, struct Sequence *seq); void calc_sequence_disp(struct Scene *scene, struct Sequence *seq); void new_tstripdata(struct Sequence *seq); @@ -208,10 +208,10 @@ typedef enum { SEQ_STRIPELEM_IBUF_ENDSTILL } seq_stripelem_ibuf_t; -void seq_stripelem_cache_init(); -void seq_stripelem_cache_destruct(); +void seq_stripelem_cache_init(void); +void seq_stripelem_cache_destruct(void); -void seq_stripelem_cache_cleanup(); +void seq_stripelem_cache_cleanup(void); struct ImBuf * seq_stripelem_cache_get( SeqRenderData context, struct Sequence * seq, diff --git a/source/blender/blenkernel/BKE_sketch.h b/source/blender/blenkernel/BKE_sketch.h index c46604f09f0..a59464bb7ba 100644 --- a/source/blender/blenkernel/BKE_sketch.h +++ b/source/blender/blenkernel/BKE_sketch.h @@ -113,12 +113,12 @@ typedef struct SK_Gesture { /************************************************/ void freeSketch(SK_Sketch *sketch); -SK_Sketch* createSketch(); +SK_Sketch* createSketch(void); void sk_removeStroke(SK_Sketch *sketch, SK_Stroke *stk); void sk_freeStroke(SK_Stroke *stk); -SK_Stroke* sk_createStroke(); +SK_Stroke* sk_createStroke(void); SK_Point *sk_lastStrokePoint(SK_Stroke *stk); diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index fb1a3c43006..2d4ea812f57 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -38,11 +38,11 @@ struct ListBase; struct Main; struct Sequence; -void sound_init_once(); +void sound_init_once(void); void sound_init(struct Main *main); -void sound_exit(); +void sound_exit(void); void sound_force_device(int device); int sound_define_from_str(char *str); diff --git a/source/blender/blenkernel/BKE_suggestions.h b/source/blender/blenkernel/BKE_suggestions.h index 59369d6ac14..9eb8897e0e0 100644 --- a/source/blender/blenkernel/BKE_suggestions.h +++ b/source/blender/blenkernel/BKE_suggestions.h @@ -64,27 +64,27 @@ typedef struct SuggList { } SuggList; /* Free all text tool memory */ -void free_texttools(); +void free_texttools(void); /* Used to identify which Text object the current tools should appear against */ void texttool_text_set_active(Text *text); -void texttool_text_clear(); +void texttool_text_clear(void); short texttool_text_is_active(Text *text); /* Suggestions */ void texttool_suggest_add(const char *name, char type); void texttool_suggest_prefix(const char *prefix); -void texttool_suggest_clear(); -SuggItem *texttool_suggest_first(); -SuggItem *texttool_suggest_last(); +void texttool_suggest_clear(void); +SuggItem *texttool_suggest_first(void); +SuggItem *texttool_suggest_last(void); void texttool_suggest_select(SuggItem *sel); -SuggItem *texttool_suggest_selected(); -int *texttool_suggest_top(); +SuggItem *texttool_suggest_selected(void); +int *texttool_suggest_top(void); /* Documentation */ void texttool_docs_show(const char *docs); -char *texttool_docs_get(); -void texttool_docs_clear(); +char *texttool_docs_get(void); +void texttool_docs_clear(void); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 7722b3bc6f9..013f6104fcc 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -140,6 +140,91 @@ SET(SRC intern/writeavi.c intern/writeffmpeg.c intern/writeframeserver.c + + BKE_DerivedMesh.h + BKE_action.h + BKE_anim.h + BKE_animsys.h + BKE_armature.h + BKE_blender.h + BKE_bmesh.h + BKE_bmeshCustomData.h + BKE_bmfont.h + BKE_bmfont_types.h + BKE_boids.h + BKE_booleanops_mesh.h + BKE_brush.h + BKE_bullet.h + BKE_bvhutils.h + BKE_cdderivedmesh.h + BKE_cloth.h + BKE_collision.h + BKE_colortools.h + BKE_constraint.h + BKE_context.h + BKE_curve.h + BKE_customdata.h + BKE_customdata_file.h + BKE_deform.h + BKE_depsgraph.h + BKE_displist.h + BKE_effect.h + BKE_endian.h + BKE_exotic.h + BKE_fcurve.h + BKE_fluidsim.h + BKE_font.h + BKE_global.h + BKE_gpencil.h + BKE_group.h + BKE_icons.h + BKE_idcode.h + BKE_idprop.h + BKE_image.h + BKE_ipo.h + BKE_key.h + BKE_lattice.h + BKE_library.h + BKE_main.h + BKE_material.h + BKE_mball.h + BKE_mesh.h + BKE_modifier.h + BKE_multires.h + BKE_nla.h + BKE_node.h + BKE_object.h + BKE_packedFile.h + BKE_paint.h + BKE_particle.h + BKE_plugin_types.h + BKE_pointcache.h + BKE_property.h + BKE_report.h + BKE_sca.h + BKE_scene.h + BKE_screen.h + BKE_script.h + BKE_sequencer.h + BKE_shrinkwrap.h + BKE_sketch.h + BKE_smoke.h + BKE_softbody.h + BKE_sound.h + BKE_subsurf.h + BKE_suggestions.h + BKE_text.h + BKE_texture.h + BKE_unit.h + BKE_utildefines.h + BKE_world.h + BKE_writeavi.h + BKE_writeffmpeg.h + BKE_writeframeserver.h + depsgraph_private.h + intern/CCGSubSurf.h + intern/bmesh_private.h + nla_private.h ) ADD_DEFINITIONS(-DGLEW_STATIC) @@ -173,15 +258,15 @@ IF(WITH_IMAGE_HDR) ADD_DEFINITIONS(-DWITH_HDR) ENDIF(WITH_IMAGE_HDR) -IF(WITH_QUICKTIME) +IF(WITH_CODEC_QUICKTIME) LIST(APPEND INC ../quicktime ${QUICKTIME_INC}) ADD_DEFINITIONS(-DWITH_QUICKTIME) -ENDIF(WITH_QUICKTIME) +ENDIF(WITH_CODEC_QUICKTIME) -IF(WITH_FFMPEG) +IF(WITH_CODEC_FFMPEG) LIST(APPEND INC ${FFMPEG_INC}) ADD_DEFINITIONS(-DWITH_FFMPEG) -ENDIF(WITH_FFMPEG) +ENDIF(WITH_CODEC_FFMPEG) IF(WITH_LCMS) LIST(APPEND INC ${LCMS_INCLUDE_DIR}) diff --git a/source/blender/blenkernel/depsgraph_private.h b/source/blender/blenkernel/depsgraph_private.h index 0527fe406bc..808ce661628 100644 --- a/source/blender/blenkernel/depsgraph_private.h +++ b/source/blender/blenkernel/depsgraph_private.h @@ -51,7 +51,7 @@ typedef struct DagAdjList short type; int count; // number of identical arcs unsigned int lay; // for flushing redraw/rebuild events - char *name; + const char *name; struct DagAdjList *next; } DagAdjList; @@ -117,7 +117,7 @@ DagNode * dag_find_node (DagForest *forest,void * fob); DagNode * dag_add_node (DagForest *forest,void * fob); DagNode * dag_get_node (DagForest *forest,void * fob); DagNode * dag_get_sub_node (DagForest *forest,void * fob); -void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name); +void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, const char *name); void graph_bfs(void); diff --git a/source/blender/blenkernel/intern/BME_Customdata.c b/source/blender/blenkernel/intern/BME_Customdata.c index 1087b3a873c..b64efa811de 100644 --- a/source/blender/blenkernel/intern/BME_Customdata.c +++ b/source/blender/blenkernel/intern/BME_Customdata.c @@ -43,7 +43,7 @@ /********************* Layer type information **********************/ typedef struct BME_LayerTypeInfo { int size; - char *defaultname; + const char *defaultname; void (*copy)(const void *source, void *dest, int count); void (*free)(void *data, int count, int size); void (*interp)(void **sources, float *weights, float *sub_weights, int count, void *dest); diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 205d23ea829..0d5142f7f14 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -295,7 +295,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, int verify_paths) +static char *rna_path_rename_fix (ID *owner_id, const char *prefix, char *oldName, char *newName, char *oldpath, int verify_paths) { char *prefixPtr= strstr(oldpath, prefix); char *oldNamePtr= strstr(oldpath, oldName); @@ -353,7 +353,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, int verify_paths) +static void fcurves_path_rename_fix (ID *owner_id, const char *prefix, char *oldName, char *newName, ListBase *curves, int verify_paths) { FCurve *fcu; @@ -366,7 +366,7 @@ static void fcurves_path_rename_fix (ID *owner_id, char *prefix, char *oldName, } /* Check RNA-Paths for a list of Drivers */ -static void drivers_path_rename_fix (ID *owner_id, char *prefix, char *oldName, char *newName, char *oldKey, char *newKey, ListBase *curves, int verify_paths) +static void drivers_path_rename_fix (ID *owner_id, const char *prefix, char *oldName, char *newName, char *oldKey, char *newKey, ListBase *curves, int verify_paths) { FCurve *fcu; @@ -406,7 +406,7 @@ static void drivers_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, int verify_paths) +static void nlastrips_path_rename_fix (ID *owner_id, const char *prefix, char *oldName, char *newName, ListBase *strips, int verify_paths) { NlaStrip *strip; @@ -426,7 +426,7 @@ 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, int oldSubscript, int newSubscript, int verify_paths) +void BKE_animdata_fix_paths_rename (ID *owner_id, AnimData *adt, const char *prefix, char *oldName, char *newName, int oldSubscript, int newSubscript, int verify_paths) { NlaTrack *nlt; char *oldN, *newN; diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index d2861a8942c..b4bdb516ab3 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -590,7 +590,7 @@ static void pchan_b_bone_defmats(bPoseChannel *pchan, bPoseChanDeform *pdef_info Mat4 *b_bone_rest= b_bone_spline_setup(pchan, 1); Mat4 *b_bone_mats; DualQuat *b_bone_dual_quats= NULL; - float tmat[4][4]; + float tmat[4][4]= MAT4_UNITY; int a; /* allocate b_bone matrices and dual quats */ @@ -611,7 +611,6 @@ static void pchan_b_bone_defmats(bPoseChannel *pchan, bPoseChanDeform *pdef_info - translate over the curve to the bbone mat space - transform with b_bone matrix - transform back into global space */ - unit_m4(tmat); for(a=0; a<bone->segments; a++) { invert_m4_m4(tmat, b_bone_rest[a].mat); @@ -1104,11 +1103,10 @@ void armature_mat_world_to_pose(Object *ob, float inmat[][4], float outmat[][4]) */ void armature_loc_world_to_pose(Object *ob, float *inloc, float *outloc) { - float xLocMat[4][4]; + float xLocMat[4][4]= MAT4_UNITY; float nLocMat[4][4]; /* build matrix for location */ - unit_m4(xLocMat); VECCOPY(xLocMat[3], inloc); /* get bone-space cursor matrix and extract location */ @@ -1184,11 +1182,10 @@ void armature_mat_pose_to_bone(bPoseChannel *pchan, float inmat[][4], float outm */ void armature_loc_pose_to_bone(bPoseChannel *pchan, float *inloc, float *outloc) { - float xLocMat[4][4]; + float xLocMat[4][4]= MAT4_UNITY; float nLocMat[4][4]; /* build matrix for location */ - unit_m4(xLocMat); VECCOPY(xLocMat[3], inloc); /* get bone-space cursor matrix and extract location */ diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index f8772cd802f..7473ff6875a 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -49,7 +49,7 @@ void tstart ( void ) void tend ( void ) { } -double tval() +double tval( void ) { return 0; } @@ -65,7 +65,7 @@ void tend ( void ) { gettimeofday ( &_tend,&tz ); } -double tval() +double tval(void) { double t1, t2; t1 = ( double ) _tstart.tv_sec + ( double ) _tstart.tv_usec/ ( 1000*1000 ); @@ -468,10 +468,10 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, BKE_ptcache_invalidate(cache); /* do simulation */ - if(!do_init_cloth(ob, clmd, result, framenr)) + if(!do_init_cloth(ob, clmd, dm, framenr)) return result; - do_step_cloth(ob, clmd, result, framenr); + do_step_cloth(ob, clmd, dm, framenr); cloth_to_object(ob, clmd, result); return result; @@ -492,12 +492,12 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, framedelta= -1; /* initialize simulation data if it didn't exist already */ - if(!do_init_cloth(ob, clmd, result, framenr)) + if(!do_init_cloth(ob, clmd, dm, framenr)) return result; if((framenr == startframe) && (clmd->sim_parms->preroll == 0)) { BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED); - do_init_cloth(ob, clmd, result, framenr); + do_init_cloth(ob, clmd, dm, framenr); BKE_ptcache_validate(cache, framenr); cache->flag &= ~PTCACHE_REDO_NEEDED; return result; @@ -535,7 +535,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, /* do simulation */ BKE_ptcache_validate(cache, framenr); - if(!do_step_cloth(ob, clmd, result, framenr)) { + if(!do_step_cloth(ob, clmd, dm, framenr)) { BKE_ptcache_invalidate(cache); } else @@ -936,7 +936,7 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm ) { unsigned int numverts = dm->getNumVerts ( dm ); unsigned int numfaces = dm->getNumFaces ( dm ); - MFace *mface = CDDM_get_faces(dm); + MFace *mface = dm->getFaceArray( dm ); unsigned int i = 0; /* Allocate our vertices. */ @@ -1049,8 +1049,8 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) unsigned int numverts = (unsigned int)dm->getNumVerts ( dm ); unsigned int numedges = (unsigned int)dm->getNumEdges ( dm ); unsigned int numfaces = (unsigned int)dm->getNumFaces ( dm ); - MEdge *medge = CDDM_get_edges ( dm ); - MFace *mface = CDDM_get_faces ( dm ); + MEdge *medge = dm->getEdgeArray ( dm ); + MFace *mface = dm->getFaceArray ( dm ); int index2 = 0; // our second vertex index LinkNode **edgelist = NULL; EdgeHash *edgehash = NULL; diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 86d7cbf0133..1b3d100c3f8 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -43,7 +43,7 @@ #include "BKE_colortools.h" #include "BKE_curve.h" -#include "BKE_ipo.h" +#include "BKE_fcurve.h" #include "BKE_utildefines.h" #include "BLI_blenlib.h" @@ -956,13 +956,11 @@ void curvemapping_table_RGBA(CurveMapping *cumap, float **array, int *size) DO_INLINE int get_bin_float(float f) { - int bin= (int)(f*255); + int bin= (int)((f*255) + 0.5); /* 0.5 to prevent quantisation differences */ /* note: clamp integer instead of float to avoid problems with NaN */ CLAMP(bin, 0, 255); - - //return (int) (((f + 0.25) / 1.5) * 255); - + return bin; } diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 076dae41e6a..f92f2326aeb 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1202,12 +1202,11 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr if (VALID_CONS_TARGET(ct)) { Curve *cu= ct->tar->data; float vec[4], dir[3], radius; - float totmat[4][4]; + float totmat[4][4]= MAT4_UNITY; float curvetime; - - unit_m4(totmat); + unit_m4(ct->matrix); - + /* note: when creating constraints that follow path, the curve gets the CU_PATH set now, * currently for paths to work it needs to go through the bevlist/displist system (ton) */ @@ -2997,6 +2996,7 @@ static void rbj_id_looper (bConstraint *con, ConstraintIDFunc func, void *userda /* target only */ func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->child, userdata); } static int rbj_get_tars (bConstraint *con, ListBase *list) @@ -3106,11 +3106,11 @@ static void clampto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta /* only evaluate if there is a target and it is a curve */ if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_CURVE)) { Curve *cu= data->tar->data; - float obmat[4][4], targetMatrix[4][4], ownLoc[3]; + float obmat[4][4], ownLoc[3]; float curveMin[3], curveMax[3]; + float targetMatrix[4][4]= MAT4_UNITY; copy_m4_m4(obmat, cob->matrix); - unit_m4(targetMatrix); copy_v3_v3(ownLoc, obmat[3]); INIT_MINMAX(curveMin, curveMax) @@ -3903,7 +3903,7 @@ static bConstraintTypeInfo *constraintsTypeInfo[NUM_CONSTRAINT_TYPES]; static short CTI_INIT= 1; /* when non-zero, the list needs to be updated */ /* This function only gets called when CTI_INIT is non-zero */ -static void constraints_init_typeinfo () { +static void constraints_init_typeinfo (void) { constraintsTypeInfo[0]= NULL; /* 'Null' Constraint */ constraintsTypeInfo[1]= &CTI_CHILDOF; /* ChildOf Constraint */ constraintsTypeInfo[2]= &CTI_TRACKTO; /* TrackTo Constraint */ diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index fe010d812b1..96dbe727505 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -773,7 +773,7 @@ int CTX_data_mode_enum(const bContext *C) /* would prefer if we can use the enum version below over this one - Campbell */ /* must be aligned with above enum */ -static char *data_mode_strings[] = { +static const char *data_mode_strings[] = { "mesh_edit", "curve_edit", "surface_edit", @@ -790,7 +790,7 @@ static char *data_mode_strings[] = { "objectmode", 0 }; -char *CTX_data_mode_string(const bContext *C) +const char *CTX_data_mode_string(const bContext *C) { return data_mode_strings[CTX_data_mode_enum(C)]; } diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 42d1c13c9ac..9be64e27d20 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2906,38 +2906,41 @@ void switchdirectionNurb(Nurb *nu) bp2--; } if(nu->type == CU_NURBS) { - /* inverse knots */ - a= KNOTSU(nu); - fp1= nu->knotsu; - fp2= fp1+(a-1); - a/= 2; - while(fp1!=fp2 && a>0) { - SWAP(float, *fp1, *fp2); - a--; - fp1++; - fp2--; - } - /* and make in increasing order again */ - a= KNOTSU(nu); - fp1= nu->knotsu; - fp2=tempf= MEM_mallocN(sizeof(float)*a, "switchdirect"); - while(a--) { - fp2[0]= fabs(fp1[1]-fp1[0]); - fp1++; - fp2++; - } - - a= KNOTSU(nu)-1; - fp1= nu->knotsu; - fp2= tempf; - fp1[0]= 0.0; - fp1++; - while(a--) { - fp1[0]= fp1[-1]+fp2[0]; + /* no knots for too short paths */ + if(nu->knotsu) { + /* inverse knots */ + a= KNOTSU(nu); + fp1= nu->knotsu; + fp2= fp1+(a-1); + a/= 2; + while(fp1!=fp2 && a>0) { + SWAP(float, *fp1, *fp2); + a--; + fp1++; + fp2--; + } + /* and make in increasing order again */ + a= KNOTSU(nu); + fp1= nu->knotsu; + fp2=tempf= MEM_mallocN(sizeof(float)*a, "switchdirect"); + while(a--) { + fp2[0]= fabs(fp1[1]-fp1[0]); + fp1++; + fp2++; + } + + a= KNOTSU(nu)-1; + fp1= nu->knotsu; + fp2= tempf; + fp1[0]= 0.0; fp1++; - fp2++; + while(a--) { + fp1[0]= fp1[-1]+fp2[0]; + fp1++; + fp2++; + } + MEM_freeN(tempf); } - MEM_freeN(tempf); } } else { @@ -3056,7 +3059,7 @@ void curve_applyKeyVertexTilts(Curve *UNUSED(cu), ListBase *lb, float *key) for(i=0; i<nu->pntsu; i++,bezt++) { key+=3*3; bezt->alfa= *key; - key++; + key+=3; } } else { diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 1ef1cefa120..1a3d31bdcf8 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -60,9 +60,9 @@ /********************* Layer type information **********************/ typedef struct LayerTypeInfo { int size; /* the memory size of one element of this layer's data */ - char *structname; /* name of the struct used, for file writing */ + const char *structname; /* name of the struct used, for file writing */ int structnum; /* number of structs per element, for file writing */ - char *defaultname; /* default layer name */ + const char *defaultname; /* default layer name */ /* a function to copy count elements of this layer's data * (deep copy if appropriate) @@ -2212,7 +2212,7 @@ void CustomData_from_bmesh_block(const CustomData *source, CustomData *dest, } -void CustomData_file_write_info(int type, char **structname, int *structnum) +void CustomData_file_write_info(int type, const char **structname, int *structnum) { const LayerTypeInfo *typeInfo = layerType_getInfo(type); diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 2eecc6d5c1b..ad797736a85 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -463,7 +463,7 @@ float defvert_array_find_weight_safe(const struct MDeformVert *dvert, int index, } -MDeformWeight *defvert_find_index(const MDeformVert *dvert, int defgroup) +MDeformWeight *defvert_find_index(const MDeformVert *dvert, const int defgroup) { if(dvert && defgroup >= 0) { MDeformWeight *dw = dvert->dw; @@ -479,7 +479,7 @@ MDeformWeight *defvert_find_index(const MDeformVert *dvert, int defgroup) /* Ensures that mv has a deform weight entry for the specified defweight group */ /* Note this function is mirrored in editmesh_tools.c, for use for editvertices */ -MDeformWeight *defvert_verify_index(MDeformVert *dv, int defgroup) +MDeformWeight *defvert_verify_index(MDeformVert *dv, const int defgroup) { MDeformWeight *newdw; diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index c4ee97c21c5..fe6b320d0bd 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -52,6 +52,7 @@ #include "BKE_global.h" #include "BKE_group.h" #include "BKE_key.h" +#include "BKE_library.h" #include "BKE_main.h" #include "BKE_mball.h" #include "BKE_modifier.h" @@ -846,7 +847,7 @@ DagNode * dag_get_sub_node (DagForest *forest,void * fob) return node; } -static void dag_add_parent_relation(DagForest *UNUSED(forest), DagNode *fob1, DagNode *fob2, short rel, char *name) +static void dag_add_parent_relation(DagForest *UNUSED(forest), DagNode *fob1, DagNode *fob2, short rel, const char *name) { DagAdjList *itA = fob2->parent; @@ -868,7 +869,7 @@ static void dag_add_parent_relation(DagForest *UNUSED(forest), DagNode *fob1, Da fob2->parent = itA; } -void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name) +void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, const char *name) { DagAdjList *itA = fob1->child; @@ -893,7 +894,7 @@ void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel fob1->child = itA; } -static char *dag_node_name(DagNode *node) +static const char *dag_node_name(DagNode *node) { if(node->ob == NULL) return "null"; @@ -938,7 +939,7 @@ static int dag_node_print_dependency_recurs(DagNode *node, DagNode *endnode) return 0; } -static void dag_node_print_dependency_cycle(DagForest *dag, DagNode *startnode, DagNode *endnode, char *name) +static void dag_node_print_dependency_cycle(DagForest *dag, DagNode *startnode, DagNode *endnode, const char *name) { DagNode *node; @@ -2290,26 +2291,21 @@ static void dag_id_flush_update__isDependentTexture(void *userData, Object *UNUS } } -void DAG_id_flush_update(ID *id, short flag) +static void dag_id_flush_update(Scene *sce, ID *id) { Main *bmain= G.main; - Scene *sce; Object *obt, *ob= NULL; short idtype; - unsigned int lay; - dag_current_scene_layers(bmain, &sce, &lay); - - if(!id || !sce || !sce->theDag) - return; + /* here we flush a few things before actual scene wide flush, mostly + due to only objects and not other datablocks being in the depsgraph */ /* set flags & pointcache for object */ if(GS(id->name) == ID_OB) { ob= (Object*)id; - ob->recalc |= (flag & OB_RECALC_ALL); BKE_ptcache_object_reset(sce, ob, PTCACHE_RESET_DEPSGRAPH); - if(flag & OB_RECALC_DATA) { + if(ob->recalc & OB_RECALC_DATA) { /* all users of this ob->data should be checked */ id= ob->data; @@ -2374,25 +2370,93 @@ void DAG_id_flush_update(ID *id, short flag) /* set flags based on particle settings */ if(idtype == ID_PA) { ParticleSystem *psys; - for(obt=bmain->object.first; obt; obt= obt->id.next) { - for(psys=obt->particlesystem.first; psys; psys=psys->next) { - if(&psys->part->id == id) { + for(obt=bmain->object.first; obt; obt= obt->id.next) + for(psys=obt->particlesystem.first; psys; psys=psys->next) + if(&psys->part->id == id) BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH); - obt->recalc |= (flag & OB_RECALC_ALL); - psys->recalc |= (flag & PSYS_RECALC); - } - } - } } /* update editors */ dag_editors_update(bmain, id); } +} + +void DAG_ids_flush_tagged(Main *bmain) +{ + ListBase *lbarray[MAX_LIBARRAY]; + Scene *sce; + unsigned int lay; + int a, have_tag = 0; + + dag_current_scene_layers(bmain, &sce, &lay); + + if(!sce || !sce->theDag) + return; + + /* loop over all ID types */ + a = set_listbasepointers(bmain, lbarray); + + while(a--) { + ListBase *lb = lbarray[a]; + ID *id = lb->first; + + /* we tag based on first ID type character to avoid + looping over all ID's in case there are no tags */ + if(id && bmain->id_tag_update[id->name[0]]) { + for(; id; id=id->next) { + if(id->flag & LIB_ID_RECALC) { + dag_id_flush_update(sce, id); + id->flag &= ~LIB_ID_RECALC; + } + } + + have_tag = 1; + } + } + + if(have_tag) { + /* clear tags */ + memset(bmain->id_tag_update, 0, sizeof(bmain->id_tag_update)); + + /* flush changes to other objects */ + DAG_scene_flush_update(bmain, sce, lay, 0); + } +} + +void DAG_id_tag_update(ID *id, short flag) +{ + Main *bmain= G.main; - /* flush to other objects that depend on this one */ - DAG_scene_flush_update(bmain, sce, lay, 0); + /* tag ID for update */ + id->flag |= LIB_ID_RECALC; + bmain->id_tag_update[id->name[0]] = 1; + + /* flag is for objects and particle systems */ + if(flag) { + Object *ob; + ParticleSystem *psys; + short idtype = GS(id->name); + + if(idtype == ID_OB) { + /* only quick tag */ + ob = (Object*)id; + ob->recalc |= (flag & OB_RECALC_ALL); + } + else if(idtype == ID_PA) { + /* this is weak still, should be done delayed as well */ + for(ob=bmain->object.first; ob; ob=ob->id.next) { + for(psys=ob->particlesystem.first; psys; psys=psys->next) { + if(&psys->part->id == id) { + ob->recalc |= (flag & OB_RECALC_ALL); + psys->recalc |= (flag & PSYS_RECALC); + } + } + } + } + } } +#if 0 // UNUSED /* recursively descends tree, each node only checked once */ /* node is checked to be of type object */ static int parent_check_node(DagNode *node, int curtime) @@ -2422,68 +2486,7 @@ static int parent_check_node(DagNode *node, int curtime) return DAG_WHITE; } - -/* all nodes that influence this object get tagged, for calculating the exact - position of this object at a given timeframe */ -void DAG_id_update_flags(ID *id) -{ - Main *bmain= G.main; - Scene *sce; - DagNode *node; - DagAdjList *itA; - Object *ob; - unsigned int lay; - - dag_current_scene_layers(bmain, &sce, &lay); - - if(!id || !sce || !sce->theDag) - return; - - /* objects only currently */ - if(GS(id->name) != ID_OB) - return; - - ob= (Object*)id; - - /* tag nodes unchecked */ - for(node = sce->theDag->DagNode.first; node; node= node->next) - node->color = DAG_WHITE; - - node= dag_find_node(sce->theDag, ob); - - /* object not in scene? then handle group exception. needs to be dagged once too */ - if(node==NULL) { - Group *group= NULL; - while( (group = find_group(ob, group)) ) { - GroupObject *go; - /* primitive; tag all... this call helps building groups for particles */ - for(go= group->gobject.first; go; go= go->next) - go->ob->recalc= OB_RECALC_ALL; - } - } - else { - - node->color = DAG_GRAY; - - sce->theDag->time++; - node= sce->theDag->DagNode.first; - for(itA = node->child; itA; itA= itA->next) { - if(itA->node->type==ID_OB && itA->node->lasttime!=sce->theDag->time) - itA->node->color= parent_check_node(itA->node, sce->theDag->time); - } - - /* set recalcs and flushes */ - DAG_scene_update_flags(bmain, sce, lay); - - /* now we clear recalcs, unless color is set */ - for(node = sce->theDag->DagNode.first; node; node= node->next) { - if(node->type==ID_OB && node->color==DAG_WHITE) { - Object *ob= node->ob; - ob->recalc= 0; - } - } - } -} +#endif /* ******************* DAG FOR ARMATURE POSE ***************** */ diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c index c16d566c7c5..51fd5e1e4c6 100644 --- a/source/blender/blenkernel/intern/exotic.c +++ b/source/blender/blenkernel/intern/exotic.c @@ -1171,10 +1171,10 @@ static void dxf_get_mesh(Scene *scene, Mesh** m, Object** o, int noob) *o = add_object(scene, OB_MESH); ob = *o; - if (strlen(entname)) new_id(&G.main->object, (ID *)ob, entname); - else if (strlen(layname)) new_id(&G.main->object, (ID *)ob, layname); + if (entname[0]) new_id(&G.main->object, (ID *)ob, entname); + else if (layname[0]) new_id(&G.main->object, (ID *)ob, layname); - if (strlen(layname)) ob->lay= dxf_get_layer_num(scene, layname); + if (layname[0]) ob->lay= dxf_get_layer_num(scene, layname); else ob->lay= scene->lay; // not nice i know... but add_object() sets active base, which needs layer setting too (ton) scene->basact->lay= ob->lay; @@ -1193,8 +1193,8 @@ static void dxf_get_mesh(Scene *scene, Mesh** m, Object** o, int noob) ((ID *)me)->us=0; - if (strlen(entname)) new_id(&G.main->mesh, (ID *)me, entname); - else if (strlen(layname)) new_id(&G.main->mesh, (ID *)me, layname); + if (entname[0]) new_id(&G.main->mesh, (ID *)me, entname); + else if (layname[0]) new_id(&G.main->mesh, (ID *)me, layname); vcenter = zerovec; } @@ -2395,7 +2395,7 @@ static void dxf_read(Scene *scene, const char *filename) I leave it commented out here as warning (ton) */ //for (i=0; i<ob->totcol; i++) ob->mat[i]= ((Mesh*)ob->data)->mat[i]; - if (strlen(layname)) ob->lay= dxf_get_layer_num(scene, layname); + if (layname[0]) ob->lay= dxf_get_layer_num(scene, layname); else ob->lay= scene->lay; /* link to scene */ diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 888eae3ed78..325e64bf768 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -166,7 +166,7 @@ void copy_fcurves (ListBase *dst, ListBase *src) /* ----------------- Finding F-Curves -------------------------- */ /* high level function to get an fcurve from C without having the rna */ -FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, char *prop_name, int index) +FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *prop_name, int index) { /* anim vars */ AnimData *adt= BKE_animdata_from_id(id); @@ -884,7 +884,7 @@ typedef struct DriverVarTypeInfo { /* allocation of target slots */ int num_targets; /* number of target slots required */ - char *target_names[MAX_DRIVER_TARGETS]; /* UI names that should be given to the slots */ + const char *target_names[MAX_DRIVER_TARGETS]; /* UI names that should be given to the slots */ int target_flags[MAX_DRIVER_TARGETS]; /* flags defining the requirements for each slot */ } DriverVarTypeInfo; diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 5ef41d17d63..1ed8241325e 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -932,7 +932,7 @@ static FModifierTypeInfo *fmodifiersTypeInfo[FMODIFIER_NUM_TYPES]; static short FMI_INIT= 1; /* when non-zero, the list needs to be updated */ /* This function only gets called when FMI_INIT is non-zero */ -static void fmods_init_typeinfo () +static void fmods_init_typeinfo (void) { fmodifiersTypeInfo[0]= NULL; /* 'Null' F-Curve Modifier */ fmodifiersTypeInfo[1]= &FMI_GENERATOR; /* Generator F-Curve Modifier */ diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 5612d69ed76..80f26277689 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -190,7 +190,7 @@ bGPDlayer *gpencil_layer_addnew (bGPdata *gpd) } /* add a new gp-datablock */ -bGPdata *gpencil_data_addnew (char name[]) +bGPdata *gpencil_data_addnew (const char name[]) { bGPdata *gpd; diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index 78306705d6b..30e4318e256 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -76,7 +76,7 @@ static void icon_free(void *val) /* create an id for a new icon and make sure that ids from deleted icons get reused after the integer number range is used up */ -static int get_next_free_id() +static int get_next_free_id(void) { int startId = gFirstIconId; diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c index 680866e6001..0745fd5bdfd 100644 --- a/source/blender/blenkernel/intern/idcode.c +++ b/source/blender/blenkernel/intern/idcode.c @@ -35,7 +35,7 @@ typedef struct { unsigned short code; - char *name, *plural; + const char *name, *plural; int flags; #define IDTYPE_FLAGS_ISLINKABLE (1<<0) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index b624feeaf9d..5c48569575e 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -607,15 +607,21 @@ void BKE_image_free_all_textures(void) for(ima= G.main->image.first; ima; ima= ima->id.next) { if(ima->ibufs.first && (ima->id.flag & LIB_DOIT)) { - /* ImBuf *ibuf; + for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next) { - if(ibuf->mipmap[0]) + /* escape when image is painted on */ + if(ibuf->userflags & IB_BITMAPDIRTY) + break; + + /* if(ibuf->mipmap[0]) totsize+= 1.33*ibuf->x*ibuf->y*4; else - totsize+= ibuf->x*ibuf->y*4; - } */ - image_free_buffers(ima); + totsize+= ibuf->x*ibuf->y*4;*/ + + } + if(ibuf==NULL) + image_free_buffers(ima); } } /* printf("freed total %d MB\n", totsize/(1024*1024)); */ @@ -760,7 +766,7 @@ int BKE_imtype_is_movie(int imtype) int BKE_add_image_extension(char *string, int imtype) { - char *extension= NULL; + const char *extension= NULL; if(imtype== R_IRIS) { if(!BLI_testextensie(string, ".rgb")) @@ -1188,6 +1194,29 @@ void BKE_stamp_info(Scene *scene, struct ImBuf *ibuf) if (stamp_data.rendertime[0]) IMB_metadata_change_field (ibuf, "RenderTime", stamp_data.rendertime); } +int BKE_alphatest_ibuf(ImBuf *ibuf) +{ + int tot; + if(ibuf->rect_float) { + float *buf= ibuf->rect_float; + for(tot= ibuf->x * ibuf->y; tot--; buf+=4) { + if(buf[3] < 1.0f) { + return TRUE; + } + } + } + else if (ibuf->rect) { + unsigned char *buf= (unsigned char *)ibuf->rect; + for(tot= ibuf->x * ibuf->y; tot--; buf+=4) { + if(buf[3] != 255) { + return TRUE; + } + } + } + + return FALSE; +} + int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality) { int ok; diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index bdf71a8c6f0..e19f36a2a0b 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -63,7 +63,7 @@ static void itend(void) { QueryPerformanceCounter(&_itend); } -double itval() +double itval(void) { return ((double)_itend.QuadPart - (double)_itstart.QuadPart)/((double)ifreq.QuadPart); @@ -85,7 +85,7 @@ static void itend(void) { gettimeofday(&_itend,&itz); } -double itval() +double itval(void) { double t1, t2; t1 = (double)_itstart.tv_sec + (double)_itstart.tv_usec/(1000*1000); diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 5dc1cc2d746..5be8bda4cd9 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -102,7 +102,7 @@ void free_ipo (Ipo *ipo) /* Mapping Table for bitflag <-> RNA path */ typedef struct AdrBit2Path { int bit; - char *path; + const char *path; int array_index; } AdrBit2Path; @@ -171,7 +171,7 @@ static AdrBit2Path *adrcode_bitmaps_to_paths (int blocktype, int adrcode, int *t /* ADRCODE to RNA-Path Conversion Code - Standard */ /* Object types */ -static char *ob_adrcodes_to_paths (int adrcode, int *array_index) +static const char *ob_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -252,7 +252,7 @@ static char *ob_adrcodes_to_paths (int adrcode, int *array_index) /* PoseChannel types * NOTE: pchan name comes from 'actname' added earlier... */ -static char *pchan_adrcodes_to_paths (int adrcode, int *array_index) +static const char *pchan_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -296,7 +296,7 @@ static char *pchan_adrcodes_to_paths (int adrcode, int *array_index) } /* Constraint types */ -static char *constraint_adrcodes_to_paths (int adrcode, int *array_index) +static const char *constraint_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -330,9 +330,9 @@ static char *shapekey_adrcodes_to_paths (int adrcode, int *UNUSED(array_index)) } /* MTex (Texture Slot) types */ -static char *mtex_adrcodes_to_paths (int adrcode, int *UNUSED(array_index)) +static const char *mtex_adrcodes_to_paths (int adrcode, int *UNUSED(array_index)) { - char *base=NULL, *prop=NULL; + const char *base=NULL, *prop=NULL; static char buf[128]; /* base part of path */ @@ -400,7 +400,7 @@ static char *mtex_adrcodes_to_paths (int adrcode, int *UNUSED(array_index)) } /* Texture types */ -static char *texture_adrcodes_to_paths (int adrcode, int *array_index) +static const char *texture_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -480,7 +480,7 @@ static char *texture_adrcodes_to_paths (int adrcode, int *array_index) } /* Material Types */ -static char *material_adrcodes_to_paths (int adrcode, int *array_index) +static const char *material_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -564,7 +564,7 @@ static char *material_adrcodes_to_paths (int adrcode, int *array_index) } /* Camera Types */ -static char *camera_adrcodes_to_paths (int adrcode, int *array_index) +static const char *camera_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -604,7 +604,7 @@ static char *camera_adrcodes_to_paths (int adrcode, int *array_index) } /* Lamp Types */ -static char *lamp_adrcodes_to_paths (int adrcode, int *array_index) +static const char *lamp_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -646,7 +646,7 @@ static char *lamp_adrcodes_to_paths (int adrcode, int *array_index) } /* Sound Types */ -static char *sound_adrcodes_to_paths (int adrcode, int *array_index) +static const char *sound_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -669,7 +669,7 @@ static char *sound_adrcodes_to_paths (int adrcode, int *array_index) } /* World Types */ -static char *world_adrcodes_to_paths (int adrcode, int *array_index) +static const char *world_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -722,7 +722,7 @@ static char *world_adrcodes_to_paths (int adrcode, int *array_index) } /* Particle Types */ -static char *particle_adrcodes_to_paths (int adrcode, int *array_index) +static const char *particle_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -800,7 +800,8 @@ static char *particle_adrcodes_to_paths (int adrcode, int *array_index) static char *get_rna_access (int blocktype, int adrcode, char actname[], char constname[], Sequence * seq, int *array_index) { DynStr *path= BLI_dynstr_new(); - char *propname=NULL, *rpath=NULL; + const char *propname=NULL; + char *rpath=NULL; char buf[512]; int dummy_index= 0; @@ -1196,7 +1197,7 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve * fcurve= fcu; /* set path */ - fcurve->rna_path= BLI_strdupn(abp->path, strlen(abp->path)); + fcurve->rna_path= BLI_strdup(abp->path); fcurve->array_index= abp->array_index; /* convert keyframes diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index ed9a02918f1..657b63c5c3d 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -866,7 +866,7 @@ void free_main(Main *mainvar) /* ***************** ID ************************ */ -ID *find_id(char *type, const char *name) /* type: "OB" or "MA" etc */ +ID *find_id(const char *type, const char *name) /* type: "OB" or "MA" etc */ { ListBase *lb= which_libbase(G.main, GS(type)); return BLI_findstring(lb, name, offsetof(ID, name) + 2); @@ -955,7 +955,7 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor /* used by headerbuttons.c buttons.c editobject.c editseq.c */ /* if nr==NULL no MAX_IDPUP, this for non-header browsing */ -void IDnames_to_pupstring(char **str, char *title, char *extraops, ListBase *lb, ID *link, short *nr) +void IDnames_to_pupstring(const char **str, const char *title, const char *extraops, ListBase *lb, ID *link, short *nr) { DynStr *pupds= BLI_dynstr_new(); @@ -977,7 +977,7 @@ void IDnames_to_pupstring(char **str, char *title, char *extraops, ListBase *lb, } /* skips viewer images */ -void IMAnames_to_pupstring(char **str, char *title, char *extraops, ListBase *lb, ID *link, short *nr) +void IMAnames_to_pupstring(const char **str, const char *title, const char *extraops, ListBase *lb, ID *link, short *nr) { DynStr *pupds= BLI_dynstr_new(); @@ -1375,7 +1375,7 @@ void text_idbutton(struct ID *id, char *text) } } -void rename_id(ID *id, char *name) +void rename_id(ID *id, const char *name) { ListBase *lb; diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index e31e2df4698..251a57a4fc1 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1403,7 +1403,7 @@ void paste_matcopybuf(Material *ma) MEM_freeN(ma->nodetree); } - GPU_materials_free(ma); + GPU_material_free(ma); id= (ma->id); memcpy(ma, &matcopybuf, sizeof(Material)); diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index eb413187544..7a72207ff69 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1222,8 +1222,6 @@ void mesh_set_smooth_flag(Object *meshOb, int enableSmooth) mf->flag &= ~ME_SMOOTH; } } - -// XXX do this in caller DAG_id_flush_update(&me->id, OB_RECALC_DATA); } void mesh_calc_normals(MVert *mverts, int numVerts, MFace *mfaces, int numFaces, float **faceNors_r) @@ -1483,8 +1481,6 @@ void mesh_pmv_revert(Mesh *me) me->pv->edge_map= NULL; MEM_freeN(me->pv->vert_map); me->pv->vert_map= NULL; - -// XXX do this in caller DAG_id_flush_update(&me->id, OB_RECALC_DATA); } } diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index dc2992662c9..6381315a8ca 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -216,7 +216,7 @@ int modifier_sameTopology(ModifierData *md) return ( mti->type == eModifierTypeType_OnlyDeform || mti->type == eModifierTypeType_Nonconstructive); } -void modifier_setError(ModifierData *md, char *format, ...) +void modifier_setError(ModifierData *md, const char *format, ...) { char buffer[2048]; va_list ap; diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 7b25c38648d..8db64e190a2 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -496,9 +496,7 @@ bNode *nodeMakeGroupFromSelected(bNodeTree *ntree) return NULL; /* OK! new nodetree */ - ngroup= alloc_libblock(&G.main->nodetree, ID_NT, "NodeGroup"); - ngroup->type= ntree->type; - ngroup->alltypes= ntree->alltypes; + ngroup= ntreeAddTree("NodeGroup", ntree->type, TRUE); /* move nodes over */ for(node= ntree->nodes.first; node; node= nextn) { @@ -884,6 +882,11 @@ bNode *nodeAddNodeType(bNodeTree *ntree, int type, bNodeTree *ngroup, ID *id) bNode *node= NULL; bNodeType *ntype= NULL; + if (ngroup && BLI_findindex(&G.main->nodetree, ngroup)==-1) { + printf("nodeAddNodeType() error: '%s' not in main->nodetree\n", ngroup->id.name); + return NULL; + } + if(type>=NODE_DYNAMIC_MENU) { int a=0, idx= type-NODE_DYNAMIC_MENU; ntype= ntree->alltypes.first; @@ -1034,21 +1037,22 @@ void nodeRemSocketLinks(bNodeTree *ntree, bNodeSocket *sock) } -bNodeTree *ntreeAddTree(int type) +bNodeTree *ntreeAddTree(const char *name, int type, const short is_group) { - bNodeTree *ntree= MEM_callocN(sizeof(bNodeTree), "new node tree"); + bNodeTree *ntree; + + if (is_group) + ntree= alloc_libblock(&G.main->nodetree, ID_NT, name); + else { + ntree= MEM_callocN(sizeof(bNodeTree), "new node tree"); + *( (short *)ntree->id.name )= type; + BLI_strncpy(ntree->id.name+2, name, sizeof(ntree->id.name)); + } + ntree->type= type; ntree->alltypes.first = NULL; ntree->alltypes.last = NULL; - /* this helps RNA identify ID pointers as nodetree */ - if(ntree->type==NTREE_SHADER) - BLI_strncpy(ntree->id.name, "NTShader Nodetree", sizeof(ntree->id.name)); - else if(ntree->type==NTREE_COMPOSIT) - BLI_strncpy(ntree->id.name, "NTCompositing Nodetree", sizeof(ntree->id.name)); - else if(ntree->type==NTREE_TEXTURE) - BLI_strncpy(ntree->id.name, "NTTexture Nodetree", sizeof(ntree->id.name)); - ntreeInitTypes(ntree); return ntree; } @@ -1968,7 +1972,6 @@ static void composit_begin_exec(bNodeTree *ntree, int is_group) /* copy stack compbufs to sockets */ static void composit_end_exec(bNodeTree *ntree, int is_group) { - extern void print_compbuf(char *str, struct CompBuf *cbuf); bNode *node; bNodeStack *ns; int a; @@ -2907,6 +2910,8 @@ void ntreeCompositTagRender(Scene *curscene) for(node= sce->nodetree->nodes.first; node; node= node->next) { if(node->id==(ID *)curscene || node->type==CMP_NODE_COMPOSITE) NodeTagChanged(sce->nodetree, node); + else if(node->type==CMP_NODE_TEXTURE) /* uses scene sizex/sizey */ + NodeTagChanged(sce->nodetree, node); } } } @@ -3214,7 +3219,7 @@ static void remove_dynamic_typeinfos(ListBase *list) if(ntype->inputs) { bNodeSocketType *sock= ntype->inputs; while(sock->type!=-1) { - MEM_freeN(sock->name); + MEM_freeN((void *)sock->name); sock++; } MEM_freeN(ntype->inputs); @@ -3222,13 +3227,13 @@ static void remove_dynamic_typeinfos(ListBase *list) if(ntype->outputs) { bNodeSocketType *sock= ntype->outputs; while(sock->type!=-1) { - MEM_freeN(sock->name); + MEM_freeN((void *)sock->name); sock++; } MEM_freeN(ntype->outputs); } if(ntype->name) { - MEM_freeN(ntype->name); + MEM_freeN((void *)ntype->name); } MEM_freeN(ntype); } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 79818ba6799..52dcc478e46 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -979,7 +979,7 @@ static void *add_obdata_from_type(int type) } } -static char *get_obdata_defname(int type) +static const char *get_obdata_defname(int type) { switch (type) { case OB_MESH: return "Mesh"; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 2eff81b96a6..6fec4775769 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3425,7 +3425,7 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n psys->cfra=bsystem_time(scene,ob,scene->r.cfra+1,0.0); DAG_scene_sort(G.main, scene); - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); return md; } @@ -3462,7 +3462,7 @@ void object_remove_particle_system(Scene *scene, Object *ob) ob->mode &= ~OB_MODE_PARTICLE_EDIT; DAG_scene_sort(G.main, scene); - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } static void default_particle_settings(ParticleSettings *part) { @@ -4359,7 +4359,7 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa normalize_v3(side); cross_v3_v3v3(nor, vec, side); - unit_m4(mat); + unit_m4(mat); VECCOPY(mat[0], vec); VECCOPY(mat[1], side); VECCOPY(mat[2], nor); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 63f2d692c6d..931339d90b4 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -340,6 +340,11 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm, ParticleSystem *psys) /* cache the verts/faces! */ LOOP_PARTICLES { + if(pa->num < 0) { + pa->num_dmcache = -1; + continue; + } + if(psys->part->from == PART_FROM_VERT) { if(nodearray[pa->num]) pa->num_dmcache= GET_INT_FROM_POINTER(nodearray[pa->num]->link); @@ -3620,8 +3625,8 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) FluidsimSettings *fss= fluidmd->fss; ParticleSettings *part = psys->part; ParticleData *pa=0; - char *suffix = "fluidsurface_particles_####"; - char *suffix2 = ".gz"; + const char *suffix = "fluidsurface_particles_####"; + const char *suffix2 = ".gz"; char filename[256]; char debugStrBuffer[256]; int curFrame = sim->scene->r.cfra -1; // warning - sync with derived mesh fsmesh loading @@ -3959,7 +3964,7 @@ static void fluid_default_settings(ParticleSettings *part){ fluid->buoyancy = 0.f; } -static void psys_changed_physics(ParticleSimulationData *sim) +static void psys_prepare_physics(ParticleSimulationData *sim) { ParticleSettings *part = sim->psys->part; @@ -4042,8 +4047,9 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) if(psys->recalc & PSYS_RECALC_TYPE) psys_changed_type(&sim); - else if(psys->recalc & PSYS_RECALC_PHYS) - psys_changed_physics(&sim); + + /* setup necessary physics type dependent additional data if it doesn't yet exist */ + psys_prepare_physics(&sim); switch(part->type) { case PART_HAIR: diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 4d22b22ae31..cd45a39f2c9 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -652,6 +652,7 @@ static int ptcache_totpoint_smoke(void *smoke_v, int UNUSED(cfra)) } /* Smoke functions */ +#if 0 static int ptcache_totpoint_smoke_turbulence(void *smoke_v, int UNUSED(cfra)) { SmokeModifierData *smd= (SmokeModifierData *)smoke_v; @@ -663,6 +664,7 @@ static int ptcache_totpoint_smoke_turbulence(void *smoke_v, int UNUSED(cfra)) else return 0; } +#endif // forward decleration static int ptcache_file_write(PTCacheFile *pf, void *f, size_t tot, int size); @@ -725,6 +727,7 @@ static int ptcache_write_smoke(PTCacheFile *pf, void *smoke_v) { SmokeModifierData *smd= (SmokeModifierData *)smoke_v; SmokeDomainSettings *sds = smd->domain; + int ret = 0; if(sds->fluid) { size_t res = sds->res[0]*sds->res[1]*sds->res[2]; @@ -755,16 +758,9 @@ static int ptcache_write_smoke(PTCacheFile *pf, void *smoke_v) MEM_freeN(out); - return 1; + ret = 1; } - return 0; -} -static int ptcache_write_smoke_turbulence(PTCacheFile *pf, void *smoke_v) -{ - SmokeModifierData *smd= (SmokeModifierData *)smoke_v; - SmokeDomainSettings *sds = smd->domain; - if(sds->wt) { int res_big_array[3]; int res_big; @@ -796,11 +792,13 @@ static int ptcache_write_smoke_turbulence(PTCacheFile *pf, void *smoke_v) ptcache_compress_write(pf, (unsigned char *)tcw, in_len, out, mode); MEM_freeN(out); - return 1; + ret = 1; } - return 0; + + return ret; } + // forward decleration static int ptcache_file_read(PTCacheFile *pf, void *f, size_t tot, int size); @@ -877,33 +875,27 @@ static void ptcache_read_smoke(PTCacheFile *pf, void *smoke_v) ptcache_compress_read(pf, (unsigned char*)obstacles, (unsigned int)res); ptcache_file_read(pf, &dt, 1, sizeof(float)); ptcache_file_read(pf, &dx, 1, sizeof(float)); - } -} -static void ptcache_read_smoke_turbulence(PTCacheFile *pf, void *smoke_v) -{ - SmokeModifierData *smd= (SmokeModifierData *)smoke_v; - SmokeDomainSettings *sds = smd->domain; - - if(sds->fluid) { - int res = sds->res[0]*sds->res[1]*sds->res[2]; - int res_big, res_big_array[3]; - float *dens, *densold, *tcu, *tcv, *tcw; - unsigned int out_len = sizeof(float)*(unsigned int)res; - unsigned int out_len_big; + if(pf->data_types & (1<<BPHYS_DATA_SMOKE_HIGH) && sds->wt) { + int res = sds->res[0]*sds->res[1]*sds->res[2]; + int res_big, res_big_array[3]; + float *dens, *densold, *tcu, *tcv, *tcw; + unsigned int out_len = sizeof(float)*(unsigned int)res; + unsigned int out_len_big; - smoke_turbulence_get_res(sds->wt, res_big_array); - res_big = res_big_array[0]*res_big_array[1]*res_big_array[2]; - out_len_big = sizeof(float) * (unsigned int)res_big; + smoke_turbulence_get_res(sds->wt, res_big_array); + res_big = res_big_array[0]*res_big_array[1]*res_big_array[2]; + out_len_big = sizeof(float) * (unsigned int)res_big; - smoke_turbulence_export(sds->wt, &dens, &densold, &tcu, &tcv, &tcw); + smoke_turbulence_export(sds->wt, &dens, &densold, &tcu, &tcv, &tcw); - ptcache_compress_read(pf, (unsigned char*)dens, out_len_big); - ptcache_compress_read(pf, (unsigned char*)densold, out_len_big); + ptcache_compress_read(pf, (unsigned char*)dens, out_len_big); + ptcache_compress_read(pf, (unsigned char*)densold, out_len_big); - ptcache_compress_read(pf, (unsigned char*)tcu, out_len); - ptcache_compress_read(pf, (unsigned char*)tcv, out_len); - ptcache_compress_read(pf, (unsigned char*)tcw, out_len); + ptcache_compress_read(pf, (unsigned char*)tcu, out_len); + ptcache_compress_read(pf, (unsigned char*)tcv, out_len); + ptcache_compress_read(pf, (unsigned char*)tcw, out_len); + } } } @@ -936,41 +928,13 @@ void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeMo pid->write_header= ptcache_write_basic_header; pid->read_header= ptcache_read_basic_header; - pid->data_types= (1<<BPHYS_DATA_LOCATION); // bogus values to make pointcache happy + pid->data_types= 0; pid->info_types= 0; -} -void BKE_ptcache_id_from_smoke_turbulence(PTCacheID *pid, struct Object *ob, struct SmokeModifierData *smd) -{ - SmokeDomainSettings *sds = smd->domain; - - memset(pid, 0, sizeof(PTCacheID)); - - pid->ob= ob; - pid->calldata= smd; - - pid->type= PTCACHE_TYPE_SMOKE_HIGHRES; - pid->stack_index= sds->point_cache[1]->index; - - pid->cache= sds->point_cache[1]; - pid->cache_ptr= &sds->point_cache[1]; - pid->ptcaches= &sds->ptcaches[1]; - - pid->totpoint= pid->totwrite= ptcache_totpoint_smoke_turbulence; - - pid->write_elem= NULL; - pid->read_elem= NULL; - - pid->read_stream = ptcache_read_smoke_turbulence; - pid->write_stream = ptcache_write_smoke_turbulence; - - pid->interpolate_elem= NULL; - - pid->write_header= ptcache_write_basic_header; - pid->read_header= ptcache_read_basic_header; - - pid->data_types= (1<<BPHYS_DATA_LOCATION); // bogus values tot make pointcache happy - pid->info_types= 0; + if(sds->fluid) + pid->data_types |= (1<<BPHYS_DATA_SMOKE_LOW); + if(sds->wt) + pid->data_types |= (1<<BPHYS_DATA_SMOKE_HIGH); } void BKE_ptcache_id_from_cloth(PTCacheID *pid, Object *ob, ClothModifierData *clmd) @@ -1046,10 +1010,6 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID"); BKE_ptcache_id_from_smoke(pid, ob, (SmokeModifierData*)md); BLI_addtail(lb, pid); - - pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID"); - BKE_ptcache_id_from_smoke_turbulence(pid, ob, (SmokeModifierData*)md); - BLI_addtail(lb, pid); } } } @@ -1273,7 +1233,7 @@ static int ptcache_file_read_header_begin(PTCacheFile *pf) static int ptcache_file_write_header_begin(PTCacheFile *pf) { - char *bphysics = "BPHYSICS"; + const char *bphysics = "BPHYSICS"; if(fwrite(bphysics, sizeof(char), 8, pf->fp) != 8) return 0; @@ -2289,9 +2249,6 @@ int BKE_ptcache_object_reset(Scene *scene, Object *ob, int mode) { BKE_ptcache_id_from_smoke(&pid, ob, (SmokeModifierData*)md); reset |= BKE_ptcache_id_reset(scene, &pid, mode); - - BKE_ptcache_id_from_smoke_turbulence(&pid, ob, (SmokeModifierData*)md); - reset |= BKE_ptcache_id_reset(scene, &pid, mode); } } } @@ -2356,7 +2313,7 @@ void BKE_ptcache_set_continue_physics(Main *bmain, Scene *scene, int enable) if(CONTINUE_PHYSICS == 0) { for(ob=bmain->object.first; ob; ob=ob->id.next) if(BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_OUTDATED)) - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } } } @@ -2841,6 +2798,61 @@ void BKE_ptcache_toggle_disk_cache(PTCacheID *pid) BKE_ptcache_update_info(pid); } +void BKE_ptcache_disk_cache_rename(PTCacheID *pid, char *from, char *to) +{ + char old_name[80]; + int len; /* store the length of the string */ + /* mode is same as fopen's modes */ + DIR *dir; + struct dirent *de; + char path[MAX_PTCACHE_PATH]; + char old_filename[MAX_PTCACHE_FILE]; + char new_path_full[MAX_PTCACHE_FILE]; + char old_path_full[MAX_PTCACHE_FILE]; + char ext[MAX_PTCACHE_PATH]; + + /* save old name */ + strcpy(old_name, pid->cache->name); + + /* get "from" filename */ + strcpy(pid->cache->name, from); + + len = BKE_ptcache_id_filename(pid, old_filename, 0, 0, 0); /* no path */ + + ptcache_path(pid, path); + dir = opendir(path); + if(dir==NULL) { + strcpy(pid->cache->name, old_name); + return; + } + + snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, pid->stack_index); + + /* put new name into cache */ + strcpy(pid->cache->name, to); + + while ((de = readdir(dir)) != NULL) { + if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ + if (strncmp(old_filename, de->d_name, len ) == 0) { /* do we have the right prefix */ + /* read the number of the file */ + int frame, len2 = (int)strlen(de->d_name); + char num[7]; + + if (len2 > 15) { /* could crash if trying to copy a string out of this range*/ + BLI_strncpy(num, de->d_name + (strlen(de->d_name) - 15), sizeof(num)); + frame = atoi(num); + + BLI_join_dirfile(old_path_full, path, de->d_name); + BKE_ptcache_id_filename(pid, new_path_full, frame, 1, 1); + BLI_rename(old_path_full, new_path_full); + } + } + } + } + + strcpy(pid->cache->name, old_name); +} + void BKE_ptcache_load_external(PTCacheID *pid) { /*todo*/ @@ -2965,14 +2977,25 @@ void BKE_ptcache_update_info(PTCacheID *pid) } if(cache->flag & PTCACHE_DISK_CACHE) { - int cfra = cache->startframe; + if(pid->type == PTCACHE_TYPE_SMOKE_DOMAIN) + { + int totpoint = pid->totpoint(pid->calldata, 0); - for(; cfra<=cache->endframe; cfra++) { - if(BKE_ptcache_id_exist(pid, cfra)) - totframes++; + if(cache->totpoint > totpoint) + sprintf(mem_info, "%i cells + High Resolution cached", totpoint); + else + sprintf(mem_info, "%i cells cached", totpoint); } + else { + int cfra = cache->startframe; - sprintf(mem_info, "%i frames on disk", totframes); + for(; cfra<=cache->endframe; cfra++) { + if(BKE_ptcache_id_exist(pid, cfra)) + totframes++; + } + + sprintf(mem_info, "%i frames on disk", totframes); + } } else { PTCacheMem *pm = cache->mem_cache.first; diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c index d8001572b4f..dd57fef50c5 100644 --- a/source/blender/blenkernel/intern/property.c +++ b/source/blender/blenkernel/intern/property.c @@ -179,7 +179,7 @@ void unique_property(bProperty *first, bProperty *prop, int force) } } -bProperty *get_ob_property(Object *ob, char *name) +bProperty *get_ob_property(Object *ob, const char *name) { return BLI_findstring(&ob->prop, name, offsetof(bProperty, name)); } diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c index f69547fd1da..5df912c871d 100644 --- a/source/blender/blenkernel/intern/report.c +++ b/source/blender/blenkernel/intern/report.c @@ -44,7 +44,7 @@ #endif #endif -static char *report_type_str(int type) +static const char *report_type_str(int type) { switch(type) { case RPT_DEBUG: return "Debug"; @@ -82,7 +82,7 @@ void BKE_reports_clear(ReportList *reports) while (report) { report_next= report->next; - MEM_freeN(report->message); + MEM_freeN((void *)report->message); MEM_freeN(report); report= report_next; } @@ -105,13 +105,15 @@ void BKE_report(ReportList *reports, ReportType type, const char *message) } if(reports && (reports->flag & RPT_STORE) && (type >= reports->storelevel)) { + char *message_alloc; report= MEM_callocN(sizeof(Report), "Report"); report->type= type; report->typestr= report_type_str(type); len= strlen(message); - report->message= MEM_callocN(sizeof(char)*(len+1), "ReportMessage"); - memcpy(report->message, message, sizeof(char)*(len+1)); + message_alloc= MEM_callocN(sizeof(char)*(len+1), "ReportMessage"); + memcpy(message_alloc, message, sizeof(char)*(len+1)); + report->message= message_alloc; report->len= len; BLI_addtail(&reports->list, report); } @@ -163,7 +165,7 @@ void BKE_reports_prepend(ReportList *reports, const char *prepend) BLI_dynstr_append(ds, prepend); BLI_dynstr_append(ds, report->message); - MEM_freeN(report->message); + MEM_freeN((void *)report->message); report->message= BLI_dynstr_get_cstring(ds); report->len= BLI_dynstr_get_len(ds); @@ -188,7 +190,7 @@ void BKE_reports_prependf(ReportList *reports, const char *prepend, ...) va_end(args); BLI_dynstr_append(ds, report->message); - MEM_freeN(report->message); + MEM_freeN((void *)report->message); report->message= BLI_dynstr_get_cstring(ds); report->len= BLI_dynstr_get_len(ds); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 8947d91988d..3eeff4a4a52 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -975,6 +975,8 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen /* this is called in main loop, doing tagged updates before redraw */ void scene_update_tagged(Main *bmain, Scene *scene) { + DAG_ids_flush_tagged(bmain); + scene->physics_settings.quick_cache_step= 0; /* update all objects: drivers, matrices, displists, etc. flags set diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c index 73351edbdd5..b25c533ad4c 100644 --- a/source/blender/blenkernel/intern/seqcache.c +++ b/source/blender/blenkernel/intern/seqcache.c @@ -60,9 +60,9 @@ static struct BLI_mempool * keypool = 0; static int ibufs_in = 0; static int ibufs_rem = 0; -static unsigned int HashHash(void *key_) +static unsigned int HashHash(const void *key_) { - seqCacheKey * key = (seqCacheKey*) key_; + const seqCacheKey *key = (seqCacheKey*) key_; unsigned int rval = seq_hash_render_data(&key->context); rval ^= *(unsigned int*) &key->cfra; @@ -72,10 +72,10 @@ static unsigned int HashHash(void *key_) return rval; } -static int HashCmp(void *a_, void *b_) +static int HashCmp(const void *a_, const void *b_) { - seqCacheKey * a = (seqCacheKey*) a_; - seqCacheKey * b = (seqCacheKey*) b_; + const seqCacheKey * a = (seqCacheKey*) a_; + const seqCacheKey * b = (seqCacheKey*) b_; if (a->seq < b->seq) { return -1; diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 2efef52ed3e..c11b51b9dd4 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -119,8 +119,8 @@ static struct ImBuf * prepare_effect_imbufs( static void open_plugin_seq(PluginSeq *pis, const char *seqname) { - int (*version)(); - void* (*alloc_private)(); + int (*version)(void); + void* (*alloc_private)(void); char *cp; /* to be sure: (is tested for) */ @@ -143,7 +143,7 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname) if (pis->handle != 0) { /* find the address of the version function */ - version= (int (*)())PIL_dynlib_find_symbol(pis->handle, "plugin_seq_getversion"); + version= (int (*)(void))PIL_dynlib_find_symbol(pis->handle, "plugin_seq_getversion"); if (test_dlerr(pis->name, "plugin_seq_getversion")) return; if (version != 0) { @@ -177,7 +177,7 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname) return; } } - alloc_private = (void* (*)())PIL_dynlib_find_symbol( + alloc_private = (void* (*)(void))PIL_dynlib_find_symbol( pis->handle, "plugin_seq_alloc_private_data"); if (alloc_private) { pis->instance_private_data = alloc_private(); @@ -246,7 +246,7 @@ static void init_plugin(Sequence * seq, const char * fname) /* * FIXME: should query plugin! Could be generator, that needs zero inputs... */ -static int num_inputs_plugin() +static int num_inputs_plugin(void) { return 1; } @@ -969,7 +969,7 @@ static void gamtabs(float gamma) } -static void build_gammatabs() +static void build_gammatabs(void) { if (gamma_tabs_init == FALSE) { gamtabs(2.0f); @@ -1860,7 +1860,7 @@ static void init_wipe_effect(Sequence *seq) seq->effectdata = MEM_callocN(sizeof(struct WipeVars), "wipevars"); } -static int num_inputs_wipe() +static int num_inputs_wipe(void) { return 1; } @@ -2044,7 +2044,7 @@ static void init_transform_effect(Sequence *seq) transform->uniform_scale=0; } -static int num_inputs_transform() +static int num_inputs_transform(void) { return 1; } @@ -2613,7 +2613,7 @@ static void init_glow_effect(Sequence *seq) glow->bNoComp = 0; } -static int num_inputs_glow() +static int num_inputs_glow(void) { return 1; } @@ -2700,7 +2700,7 @@ static void init_solid_color(Sequence *seq) cv->col[0] = cv->col[1] = cv->col[2] = 0.5; } -static int num_inputs_color() +static int num_inputs_color(void) { return 0; } @@ -2809,7 +2809,7 @@ static struct ImBuf * do_solid_color( ********************************************************************** */ /* no effect inputs for multicam, we use give_ibuf_seq */ -static int num_inputs_multicam() +static int num_inputs_multicam(void) { return 0; } @@ -2884,7 +2884,7 @@ static void load_speed_effect(Sequence * seq) v->length = 0; } -static int num_inputs_speed() +static int num_inputs_speed(void) { return 1; } @@ -3059,7 +3059,7 @@ static void free_noop(struct Sequence *UNUSED(seq)) } -static int num_inputs_default() +static int num_inputs_default(void) { return 2; } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index b98976729c4..fac773b2c6f 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -263,7 +263,7 @@ SeqRenderData seq_new_render_data( return rval; } -int seq_cmp_render_data(SeqRenderData * a, SeqRenderData * b) +int seq_cmp_render_data(const SeqRenderData * a, const SeqRenderData * b) { if (a->preview_render_size < b->preview_render_size) { return -1; @@ -317,7 +317,7 @@ int seq_cmp_render_data(SeqRenderData * a, SeqRenderData * b) return 0; } -unsigned int seq_hash_render_data(SeqRenderData * a) +unsigned int seq_hash_render_data(const SeqRenderData * a) { unsigned int rval = a->rectx + a->recty; @@ -875,7 +875,7 @@ void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq) strcpy(seq->name+2, sui.name_dest); } -static char *give_seqname_by_type(int type) +static const char *give_seqname_by_type(int type) { switch(type) { case SEQ_META: return "Meta"; @@ -902,9 +902,9 @@ static char *give_seqname_by_type(int type) } } -char *give_seqname(Sequence *seq) +const char *give_seqname(Sequence *seq) { - char * name = give_seqname_by_type(seq->type); + const char *name = give_seqname_by_type(seq->type); if (!name) { if(seq->type<SEQ_EFFECT) { @@ -1558,9 +1558,6 @@ static ImBuf * input_preprocess( { float mul; - seq->strip->orx= ibuf->x; - seq->strip->ory= ibuf->y; - if((seq->flag & SEQ_FILTERY) && seq->type != SEQ_MOVIE) { IMB_filtery(ibuf); } @@ -2054,6 +2051,9 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr IMB_convert_profile(ibuf, IB_PROFILE_NONE); copy_to_ibuf_still(context, seq, nr, ibuf); + + s_elem->orig_width = ibuf->x; + s_elem->orig_height = ibuf->y; } break; } @@ -2073,7 +2073,10 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr /* we don't need both (speed reasons)! */ if (ibuf && ibuf->rect_float && ibuf->rect) imb_freerectImBuf(ibuf); - + if (ibuf) { + seq->strip->stripdata->orig_width = ibuf->x; + seq->strip->stripdata->orig_height = ibuf->y; + } } copy_to_ibuf_still(context, seq, nr, ibuf); break; @@ -2082,6 +2085,9 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr { // scene can be NULL after deletions ibuf = seq_render_scene_strip_impl(context, seq, nr); + /* Scene strips update all animation, so we need to restore original state.*/ + BKE_animsys_evaluate_all_animation(context.bmain, cfra); + copy_to_ibuf_still(context, seq, nr, ibuf); break; } diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 8822d0cb4c9..1833cc4eeac 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -94,7 +94,7 @@ static void tend ( void ) { QueryPerformanceCounter ( &liCurrentTime ); } -static double tval() +static double tval( void ) { return ((double)( (liCurrentTime.QuadPart - liStartTime.QuadPart)* (double)1000.0/(double)liFrequency.QuadPart )); } @@ -110,6 +110,8 @@ static void tend ( void ) { gettimeofday ( &_tend,&tz ); } + +#if 0 // unused static double tval() { double t1, t2; @@ -118,6 +120,7 @@ static double tval() return t2-t1; } #endif +#endif struct Object; struct Scene; @@ -554,8 +557,6 @@ static void smokeModifier_freeDomain(SmokeModifierData *smd) BKE_ptcache_free_list(&(smd->domain->ptcaches[0])); smd->domain->point_cache[0] = NULL; - BKE_ptcache_free_list(&(smd->domain->ptcaches[1])); - smd->domain->point_cache[1] = NULL; MEM_freeN(smd->domain); smd->domain = NULL; @@ -695,10 +696,9 @@ void smokeModifier_createType(struct SmokeModifierData *smd) smd->domain->point_cache[0]->flag |= PTCACHE_DISK_CACHE; smd->domain->point_cache[0]->step = 1; - smd->domain->point_cache[1] = BKE_ptcache_add(&(smd->domain->ptcaches[1])); - smd->domain->point_cache[1]->flag |= PTCACHE_DISK_CACHE; - smd->domain->point_cache[1]->step = 1; - + /* Deprecated */ + smd->domain->point_cache[1] = NULL; + smd->domain->ptcaches[1].first = smd->domain->ptcaches[1].last = NULL; /* set some standard values */ smd->domain->fluid = NULL; smd->domain->wt = NULL; @@ -776,6 +776,9 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData tsmd->domain->viewsettings = smd->domain->viewsettings; tsmd->domain->fluid_group = smd->domain->fluid_group; tsmd->domain->coll_group = smd->domain->coll_group; + tsmd->domain->vorticity = smd->domain->vorticity; + tsmd->domain->time_scale = smd->domain->time_scale; + tsmd->domain->border_collisions = smd->domain->border_collisions; MEM_freeN(tsmd->domain->effector_weights); tsmd->domain->effector_weights = MEM_dupallocN(smd->domain->effector_weights); @@ -784,6 +787,8 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData tsmd->flow->temp = smd->flow->temp; tsmd->flow->psys = smd->flow->psys; tsmd->flow->type = smd->flow->type; + tsmd->flow->flags = smd->flow->flags; + tsmd->flow->vel_multi = smd->flow->vel_multi; } else if (tsmd->coll) { ; /* leave it as initialised, collision settings is mostly caches */ @@ -1323,35 +1328,22 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM float light[3]; PointCache *cache = NULL; PTCacheID pid; - PointCache *cache_wt = NULL; - PTCacheID pid_wt; int startframe, endframe, framenr; float timescale; - int cache_result = 0, cache_result_wt = 0; - int did_init = 0; framenr = scene->r.cfra; - printf("time: %d\n", scene->r.cfra); + //printf("time: %d\n", scene->r.cfra); cache = sds->point_cache[0]; BKE_ptcache_id_from_smoke(&pid, ob, smd); BKE_ptcache_id_time(&pid, scene, framenr, &startframe, &endframe, ×cale); - cache_wt = sds->point_cache[1]; - BKE_ptcache_id_from_smoke_turbulence(&pid_wt, ob, smd); - if(!smd->domain->fluid || framenr == startframe) { BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED); BKE_ptcache_validate(cache, framenr); cache->flag &= ~PTCACHE_REDO_NEEDED; - - BKE_ptcache_id_reset(scene, &pid_wt, PTCACHE_RESET_OUTDATED); - if(cache_wt) { - BKE_ptcache_validate(cache_wt, framenr); - cache_wt->flag &= ~PTCACHE_REDO_NEEDED; - } } if(!smd->domain->fluid && (framenr != startframe) && (smd->domain->flags & MOD_SMOKE_FILE_LOAD)==0 && (cache->flag & PTCACHE_BAKED)==0) @@ -1359,11 +1351,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM smd->domain->flags &= ~MOD_SMOKE_FILE_LOAD; - if(framenr < startframe) - framenr = startframe; - - if(framenr > endframe) - framenr = endframe; + CLAMP(framenr, startframe, endframe); /* If already viewing a pre/after frame, no need to reload */ if ((smd->time == framenr) && (framenr != scene->r.cfra)) @@ -1371,42 +1359,21 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM // printf("startframe: %d, framenr: %d\n", startframe, framenr); - if(!(did_init = smokeModifier_init(smd, ob, scene, dm))) + if(smokeModifier_init(smd, ob, scene, dm)==0) { printf("bad smokeModifier_init\n"); return; } /* try to read from cache */ - cache_result = BKE_ptcache_read_cache(&pid, (float)framenr, scene->r.frs_sec); - // printf("cache_result: %d\n", cache_result); - - if(cache_result == PTCACHE_READ_EXACT) - { + if(BKE_ptcache_read_cache(&pid, (float)framenr, scene->r.frs_sec) == PTCACHE_READ_EXACT) { BKE_ptcache_validate(cache, framenr); smd->time = framenr; - - if(sds->wt) - { - cache_result_wt = BKE_ptcache_read_cache(&pid_wt, (float)framenr, scene->r.frs_sec); - - if(cache_result_wt == PTCACHE_READ_EXACT) - { - BKE_ptcache_validate(cache_wt, framenr); - - return; - } - else - { - ; /* don't return in the case we only got low res cache but no high res cache */ - /* we still need to calculate the high res cache */ - } - } - else - return; + return; } + /* only calculate something when we advanced a single frame */ - else if(framenr != (int)smd->time+1) + if(framenr != (int)smd->time+1) return; /* don't simulate if viewing start frame, but scene frame is not real start frame */ @@ -1418,15 +1385,19 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM smoke_calc_domain(scene, ob, smd); /* if on second frame, write cache for first frame */ - /* this needs to be done for smoke too so that pointcache works properly */ if((int)smd->time == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0)) { // create shadows straight after domain initialization so we get nice shadows for startframe, too if(get_lamp(scene, light)) smoke_calc_transparency(sds->shadow, smoke_get_density(sds->fluid), sds->p0, sds->p1, sds->res, sds->dx, light, calc_voxel_transp, -7.0*sds->dx); - BKE_ptcache_write_cache(&pid, startframe); if(sds->wt) - BKE_ptcache_write_cache(&pid_wt, startframe); + { + if(sds->flags & MOD_SMOKE_DISSOLVE) + smoke_dissolve_wavelet(sds->wt, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG); + smoke_turbulence_step(sds->wt, sds->fluid); + } + + BKE_ptcache_write_cache(&pid, startframe); } // set new time @@ -1444,39 +1415,24 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM smoke_dissolve(sds->fluid, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG); smoke_step(sds->fluid, smd->time, scene->r.frs_sec / scene->r.frs_sec_base); } - else - { - /* Smoke did not load cache and was not reset but we're on startframe */ - /* So now reinit the smoke since it was not done yet */ - if(did_init == 2) - { - smokeModifier_reset(smd); - smokeModifier_init(smd, ob, scene, dm); - } - } // create shadows before writing cache so they get stored if(get_lamp(scene, light)) smoke_calc_transparency(sds->shadow, smoke_get_density(sds->fluid), sds->p0, sds->p1, sds->res, sds->dx, light, calc_voxel_transp, -7.0*sds->dx); - - BKE_ptcache_validate(cache, framenr); - BKE_ptcache_write_cache(&pid, framenr); if(sds->wt) { - if(framenr!=startframe) - { - if(sds->flags & MOD_SMOKE_DISSOLVE) - smoke_dissolve_wavelet(sds->wt, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG); - smoke_turbulence_step(sds->wt, sds->fluid); - } - - BKE_ptcache_validate(cache_wt, framenr); - BKE_ptcache_write_cache(&pid_wt, framenr); + if(sds->flags & MOD_SMOKE_DISSOLVE) + smoke_dissolve_wavelet(sds->wt, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG); + smoke_turbulence_step(sds->wt, sds->fluid); } + + BKE_ptcache_validate(cache, framenr); + if(framenr != startframe) + BKE_ptcache_write_cache(&pid, framenr); tend(); - printf ( "Frame: %d, Time: %f\n", (int)smd->time, ( float ) tval() ); + //printf ( "Frame: %d, Time: %f\n", (int)smd->time, ( float ) tval() ); } } diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 978b3c9864f..ceee544d1b8 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -1659,7 +1659,7 @@ static void *exec_scan_for_ext_spring_forces(void *data) return 0; } -static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,int totsprings,int *UNUSED(ptr_to_break_func())) +static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,int totsprings,int *UNUSED(ptr_to_break_func(void))) { ListBase *do_effector = NULL; ListBase threads; @@ -2175,7 +2175,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN /* since this is definitely the most CPU consuming task here .. try to spread it */ /* core function _softbody_calc_forces_slice_in_a_thread */ /* result is int to be able to flag user break */ -static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, float forcetime, float timenow,int ifirst,int ilast,int *UNUSED(ptr_to_break_func()),ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor) +static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, float forcetime, float timenow,int ifirst,int ilast,int *UNUSED(ptr_to_break_func(void)),ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor) { float iks; int bb,do_selfcollision,do_springcollision,do_aero; @@ -2386,7 +2386,7 @@ static void *exec_softbody_calc_forces(void *data) return 0; } -static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float timenow,int totpoint,int *UNUSED(ptr_to_break_func()),struct ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor) +static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float timenow,int totpoint,int *UNUSED(ptr_to_break_func(void)),struct ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor) { ListBase threads; SB_thread_context *sb_threads; diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c index 1b720c1adaa..7d39203cefc 100644 --- a/source/blender/blenkernel/intern/suggestions.c +++ b/source/blender/blenkernel/intern/suggestions.c @@ -54,7 +54,7 @@ static int txttl_cmp(const char *first, const char *second, int len) { return cmp; } -static void txttl_free_suggest() { +static void txttl_free_suggest(void) { SuggItem *item, *prev; for (item = suggestions.last; item; item=prev) { prev = item->prev; @@ -66,7 +66,7 @@ static void txttl_free_suggest() { suggestions.top = 0; } -static void txttl_free_docs() { +static void txttl_free_docs(void) { if (documentation) { MEM_freeN(documentation); documentation = NULL; diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index bdb8d11945c..6e0289e907b 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -93,7 +93,7 @@ TMARK_EDITALL is set the group ID defines which other markers should be edited. The mrk->clr field is used to visually group markers where the flags may not match. A template system, for example, may allow editing of repeating tokens (in one group) but include other marked positions (in another group) all in the -same template with the same colour. +same template with the same color. Undo -- @@ -521,7 +521,7 @@ void unlink_text(Main *bmain, Text *text) } if(update) - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } /* pynodes */ @@ -585,7 +585,7 @@ static void make_new_line (TextLine *line, char *newline) line->format= NULL; } -static TextLine *txt_new_line(char *str) +static TextLine *txt_new_line(const char *str) { TextLine *tmp; @@ -1431,7 +1431,7 @@ void txt_print_undo(Text *text) { int i= 0; int op; - char *ops; + const char *ops; int linep, charp; dump_buffer(text); @@ -2470,7 +2470,7 @@ void indent(Text *text) int len, num; char *tmp; - char *add = "\t"; + const char *add = "\t"; int indentlen = 1; /* hardcoded: TXT_TABSIZE = 4 spaces: */ @@ -2531,7 +2531,7 @@ void indent(Text *text) void unindent(Text *text) { int num = 0; - char *remove = "\t"; + const char *remove = "\t"; int indent = 1; /* hardcoded: TXT_TABSIZE = 4 spaces: */ @@ -2694,7 +2694,7 @@ int setcurr_tab_spaces (Text *text, int space) const char *word = ":"; const char *comm = "#"; const char indent= (text->flags & TXT_TABSTOSPACES) ? ' ' : '\t'; - static char *back_words[]= {"return", "break", "continue", "pass", "yield", NULL}; + static const char *back_words[]= {"return", "break", "continue", "pass", "yield", NULL}; if (!text) return 0; if (!text->curl) return 0; diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 0ec38a035aa..bb00e6de5ce 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -69,7 +69,7 @@ #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" -extern void do_init_ffmpeg(); +extern void do_init_ffmpeg(void); static int ffmpeg_type = 0; static int ffmpeg_codec = CODEC_ID_MPEG4; diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c index bbc441f3622..dd63c266491 100644 --- a/source/blender/blenkernel/intern/writeframeserver.c +++ b/source/blender/blenkernel/intern/writeframeserver.c @@ -62,31 +62,31 @@ static int render_height; #if defined(_WIN32) -static int startup_socket_system() +static int startup_socket_system(void) { WSADATA wsa; return (WSAStartup(MAKEWORD(2,0),&wsa) == 0); } -static void shutdown_socket_system() +static void shutdown_socket_system(void) { WSACleanup(); } -static int select_was_interrupted_by_signal() +static int select_was_interrupted_by_signal(void) { return (WSAGetLastError() == WSAEINTR); } #else -static int startup_socket_system() +static int startup_socket_system(void) { return 1; } -static void shutdown_socket_system() +static void shutdown_socket_system(void) { } -static int select_was_interrupted_by_signal() +static int select_was_interrupted_by_signal(void) { return (errno == EINTR); } @@ -367,7 +367,7 @@ int append_frameserver(RenderData *UNUSED(rd), int frame, int *pixels, int rectx return 0; } -void end_frameserver() +void end_frameserver(void) { if (connsock != -1) { closesocket(connsock); |