Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Samarin <nicks1987@bigmir.net>2010-07-22 00:54:53 +0400
committerNick Samarin <nicks1987@bigmir.net>2010-07-22 00:54:53 +0400
commitc6ea23c77c441e49ba171b6d58f1601971d3f222 (patch)
tree0855d60a3ac9bf1699313ab2633cdde502d4e75a /source/blender/blenkernel
parentb7819807b33ded7c20956c52bcaf1ee93bf428f7 (diff)
parent969c0fd718ed500fedfdeb1b4a5c0026febdb975 (diff)
synched with trunk at revision 30597
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_blender.h6
-rw-r--r--source/blender/blenkernel/BKE_brush.h13
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h2
-rw-r--r--source/blender/blenkernel/BKE_object.h1
-rw-r--r--source/blender/blenkernel/BKE_paint.h4
-rw-r--r--source/blender/blenkernel/BKE_particle.h2
-rw-r--r--source/blender/blenkernel/BKE_scene.h2
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h4
-rw-r--r--source/blender/blenkernel/BKE_sound.h2
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c2
-rw-r--r--source/blender/blenkernel/intern/action.c2
-rw-r--r--source/blender/blenkernel/intern/anim.c2
-rw-r--r--source/blender/blenkernel/intern/blender.c5
-rw-r--r--source/blender/blenkernel/intern/brush.c118
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c2
-rw-r--r--source/blender/blenkernel/intern/cloth.c3
-rw-r--r--source/blender/blenkernel/intern/collision.c2
-rw-r--r--source/blender/blenkernel/intern/colortools.c56
-rw-r--r--source/blender/blenkernel/intern/curve.c106
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c4
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c2
-rw-r--r--source/blender/blenkernel/intern/font.c134
-rw-r--r--source/blender/blenkernel/intern/icons.c12
-rw-r--r--source/blender/blenkernel/intern/image.c10
-rw-r--r--source/blender/blenkernel/intern/ipo.c2
-rw-r--r--source/blender/blenkernel/intern/library.c2
-rw-r--r--source/blender/blenkernel/intern/material.c2
-rw-r--r--source/blender/blenkernel/intern/mball.c16
-rw-r--r--source/blender/blenkernel/intern/object.c11
-rw-r--r--source/blender/blenkernel/intern/particle.c8
-rw-r--r--source/blender/blenkernel/intern/particle_system.c86
-rw-r--r--source/blender/blenkernel/intern/pointcache.c12
-rw-r--r--source/blender/blenkernel/intern/sca.c2
-rw-r--r--source/blender/blenkernel/intern/scene.c35
-rw-r--r--source/blender/blenkernel/intern/sequencer.c145
-rw-r--r--source/blender/blenkernel/intern/softbody.c2
-rw-r--r--source/blender/blenkernel/intern/sound.c15
-rw-r--r--source/blender/blenkernel/intern/world.c14
38 files changed, 523 insertions, 325 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 7ac5815943a..4e299accffc 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -43,9 +43,9 @@ struct bContext;
struct ReportList;
struct Scene;
struct Main;
-
-#define BLENDER_VERSION 252
-#define BLENDER_SUBVERSION 5
+
+#define BLENDER_VERSION 253
+#define BLENDER_SUBVERSION 0
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h
index fcc636215c9..75fdb719a62 100644
--- a/source/blender/blenkernel/BKE_brush.h
+++ b/source/blender/blenkernel/BKE_brush.h
@@ -44,6 +44,9 @@ struct Brush *copy_brush(struct Brush *brush);
void make_local_brush(struct Brush *brush);
void free_brush(struct Brush *brush);
+/* image icon function */
+struct ImBuf *get_brush_icon(struct Brush *brush);
+
/* brush library operations used by different paint panels */
int brush_set_nr(struct Brush **current_brush, int nr, const char *name);
int brush_delete(struct Brush **current_brush);
@@ -84,5 +87,15 @@ unsigned int *brush_gen_texture_cache(struct Brush *br, int half_side);
void brush_radial_control_invoke(struct wmOperator *op, struct Brush *br, float size_weight);
int brush_radial_control_exec(struct wmOperator *op, struct Brush *br, float size_weight);
+/* unified strength and size */
+int sculpt_get_brush_size(struct Brush *brush);
+void sculpt_set_brush_size(struct Brush *brush, int size);
+int sculpt_get_lock_brush_size(struct Brush *brush);
+float sculpt_get_brush_unprojected_radius(struct Brush *brush);
+void sculpt_set_brush_unprojected_radius(struct Brush *brush, float unprojected_radius);
+float sculpt_get_brush_alpha(struct Brush *brush);
+void sculpt_set_brush_alpha(struct Brush *brush, float alpha);
+
+
#endif
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index 835e2ed80c8..6de0c55af3b 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -143,7 +143,7 @@ typedef enum eFMI_Action_Types {
typedef enum eFMI_Requirement_Flags {
/* modifier requires original data-points (kindof beats the purpose of a modifier stack?) */
FMI_REQUIRES_ORIGINAL_DATA = (1<<0),
- /* modifier doesn't require on any preceeding data (i.e. it will generate a curve).
+ /* modifier doesn't require on any preceding data (i.e. it will generate a curve).
* Use in conjunction with FMI_TYPE_GENRATE_CURVE
*/
FMI_REQUIRES_NOTHING = (1<<1),
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 07c3da48792..2a7ba4f98c9 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -83,7 +83,6 @@ struct Lamp *copy_lamp(struct Lamp *la);
void make_local_lamp(struct Lamp *la);
void free_camera(struct Camera *ca);
void free_lamp(struct Lamp *la);
-void *add_wave(void);
struct Object *add_only_object(int type, char *name);
struct Object *add_object(struct Scene *scene, int type);
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index cd412ca5a74..f9954b3d55d 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -28,6 +28,8 @@
#ifndef BKE_PAINT_H
#define BKE_PAINT_H
+#include "DNA_vec_types.h"
+
struct Brush;
struct MFace;
struct MultireModifierData;
@@ -96,6 +98,8 @@ typedef struct SculptSession {
struct GPUDrawObject *drawobject;
int modifiers_active;
+
+ rcti previous_r;
} SculptSession;
void free_sculptsession(struct Object *ob);
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index 33a41821fe2..fcef00ae9b3 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -255,11 +255,9 @@ void psys_threads_free(ParticleThread *threads);
void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3], float zvec[3], float center[3]);
/* particle_system.c */
-void psys_update_path_cache(struct ParticleSimulationData *sim, float cfra);
struct ParticleSystem *psys_get_target_system(struct Object *ob, struct ParticleTarget *pt);
void psys_count_keyed_targets(struct ParticleSimulationData *sim);
void psys_update_particle_tree(struct ParticleSystem *psys, float cfra);
-void psys_update_children(struct ParticleSimulationData *sim);
void psys_make_temp_pointcache(struct Object *ob, struct ParticleSystem *psys);
void psys_get_pointcache_start_end(struct Scene *scene, ParticleSystem *psys, int *sfra, int *efra);
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index b5b0a72d2d8..f0fb2a65673 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -63,7 +63,7 @@ struct Scene *set_scene_name(char *name);
struct Scene *copy_scene(struct Main *bmain, struct Scene *sce, int type);
void unlink_scene(struct Main *bmain, struct Scene *sce, struct Scene *newsce);
-int next_object(struct Scene *scene, int val, struct Base **base, struct Object **ob);
+int next_object(struct Scene **scene, int val, struct Base **base, struct Object **ob);
struct Object *scene_find_camera(struct Scene *sc);
struct Object *scene_camera_switch_find(struct Scene *scene); // DURIAN_CAMERA_SWITCH
int scene_camera_switch_update(struct Scene *scene);
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 002a1958a13..c5417e04780 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -191,13 +191,13 @@ void seq_dupe_animdata(struct Scene *scene, char *name_from, char *name_to);
int shuffle_seq(struct ListBase * seqbasep, struct Sequence *test, struct Scene *evil_scene);
int shuffle_seq_time(ListBase * seqbasep, struct Scene *evil_scene);
int seqbase_isolated_sel_check(struct ListBase *seqbase);
-void free_imbuf_seq(struct Scene *scene, struct ListBase * seqbasep, int check_mem_usage);
+void free_imbuf_seq(struct Scene *scene, struct ListBase * seqbasep, int check_mem_usage, int keep_file_handles);
struct Sequence *seq_dupli_recursive(struct Scene *scene, struct Sequence * seq, int dupe_flag);
int seq_swap(struct Sequence *seq_a, struct Sequence *seq_b);
void seq_update_sound(struct Scene* scene, struct Sequence *seq);
void seq_update_muting(struct Scene* scene, struct Editing *ed);
-void seqbase_sound_reload(Scene *scene, ListBase *seqbase);
+void seqbase_sound_reload(struct Scene *scene, ListBase *seqbase);
void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq);
void seqbase_dupli_recursive(struct Scene *scene, ListBase *nseqbase, ListBase *seqbase, int dupe_flag);
diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h
index 50c86e80b08..190b0400aff 100644
--- a/source/blender/blenkernel/BKE_sound.h
+++ b/source/blender/blenkernel/BKE_sound.h
@@ -94,6 +94,6 @@ float sound_sync_scene(struct Scene *scene);
int sound_scene_playing(struct Scene *scene);
-int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length);
+int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length, float start, float end);
#endif
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index d5ece6ae31f..8b1443403a3 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -59,7 +59,7 @@
#include "BIF_gl.h"
#include "BIF_glutil.h"
-#include "gpu_buffers.h"
+#include "GPU_buffers.h"
#include "GPU_draw.h"
#include "GPU_extensions.h"
#include "GPU_material.h"
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 6c8e5c48745..228860c9287 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -301,7 +301,7 @@ void action_groups_add_channel (bAction *act, bActionGroup *agrp, FCurve *fcurve
/* firstly, link this F-Curve to the group */
agrp->channels.first = agrp->channels.last = fcurve;
- /* step through the groups preceeding this one, finding the F-Curve there to attach this one after */
+ /* step through the groups preceding this one, finding the F-Curve there to attach this one after */
for (grp= agrp->prev; grp; grp= grp->prev) {
/* if this group has F-Curves, we want weave the given one in right after the last channel there,
* but via the Action's list not this group's list
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index fa0ddc5f1d3..157c0743c50 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -741,7 +741,7 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, i
if(go->ob->transflag & OB_DUPLI) {
copy_m4_m4(dob->ob->obmat, dob->mat);
- object_duplilist_recursive((ID *)group, scene, go->ob, lb, ob->obmat, level+1, animated);
+ object_duplilist_recursive(&group->id, scene, go->ob, lb, ob->obmat, level+1, animated);
copy_m4_m4(dob->ob->obmat, dob->omat);
}
}
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 57e72fc5671..101c7a3bbbd 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -313,8 +313,6 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
/* baseflags, groups, make depsgraph, etc */
set_scene_bg(CTX_data_scene(C));
-
- DAG_on_load_update();
MEM_freeN(bfd);
}
@@ -478,6 +476,9 @@ static int read_undosave(bContext *C, UndoElem *uel)
strcpy(G.sce, scestr);
G.fileflags= fileflags;
+ if(success)
+ DAG_on_load_update();
+
return success;
}
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 538012ccc41..8e3cc0751b5 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -53,8 +53,7 @@
#include "BKE_main.h"
#include "BKE_paint.h"
#include "BKE_texture.h"
-
-
+#include "BKE_icons.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
@@ -70,29 +69,57 @@ Brush *add_brush(const char *name)
brush= alloc_libblock(&G.main->brush, ID_BR, name);
- brush->rgb[0]= 1.0f;
+ /* BRUSH SCULPT TOOL SETTINGS */
+ brush->sculpt_tool = SCULPT_TOOL_DRAW; /* sculpting defaults to the draw tool for new brushes */
+ brush->size= 35; /* radius of the brush in pixels */
+ brush->alpha= 0.5f; /* brush strength/intensity probably variable should be renamed? */
+ brush->autosmooth_factor= 0.0f;
+ brush->crease_pinch_factor= 0.5f;
+ brush->sculpt_plane = SCULPT_DISP_DIR_VIEW;
+ brush->plane_offset= 0.0f; /* how far above or below the plane that is found by averaging the faces */
+ brush->plane_trim= 0.5f;
+ brush->clone.alpha= 0.5f;
+ brush->normal_weight= 0.0f;
+
+ /* BRUSH PAINT TOOL SETTINGS */
+ brush->rgb[0]= 1.0f; /* default rgb color of the brush when painting - white */
brush->rgb[1]= 1.0f;
brush->rgb[2]= 1.0f;
- brush->alpha= 0.2f;
- brush->size= 25;
- brush->spacing= 3.5f;
+
+ /* BRUSH STROKE SETTINGS */
+ brush->flag |= (BRUSH_SPACE|BRUSH_SPACE_ATTEN);
+ brush->spacing= 10; /* how far each brush dot should be spaced as a percentage of brush diameter */
+
brush->smooth_stroke_radius= 75;
- brush->smooth_stroke_factor= 0.9;
- brush->rate= 0.1f;
+ brush->smooth_stroke_factor= 0.9f;
+
+ brush->rate= 0.1f; /* time delay between dots of paint or sculpting when doing airbrush mode */
+
brush->jitter= 0.0f;
- brush->clone.alpha= 0.5;
- brush->sculpt_tool = SCULPT_TOOL_DRAW;
- brush->flag |= BRUSH_SPACE;
- brush_curve_preset(brush, CURVE_PRESET_SMOOTH);
-
+ /* BRUSH TEXTURE SETTINGS */
default_mtex(&brush->mtex);
+ brush->texture_sample_bias= 0; /* value to added to texture samples */
+
+ /* brush appearance */
+
+ brush->add_col[0]= 1.00; /* add mode color is light red */
+ brush->add_col[1]= 0.39;
+ brush->add_col[2]= 0.39;
+
+ brush->sub_col[0]= 0.39; /* subtract mode color is light blue */
+ brush->sub_col[1]= 0.39;
+ brush->sub_col[2]= 1.00;
+
+ /* the default alpha falloff curve */
+ brush_curve_preset(brush, CURVE_PRESET_SMOOTH);
+
/* enable fake user by default */
brush->id.flag |= LIB_FAKEUSER;
brush_toggled_fake_user(brush);
-
- return brush;
+
+ return brush;
}
Brush *copy_brush(Brush *brush)
@@ -101,8 +128,12 @@ Brush *copy_brush(Brush *brush)
brushn= copy_libblock(brush);
- if(brush->mtex.tex) id_us_plus((ID*)brush->mtex.tex);
-
+ if (brush->mtex.tex)
+ id_us_plus((ID*)brush->mtex.tex);
+
+ if (brush->icon_imbuf)
+ brushn->icon_imbuf= IMB_dupImBuf(brush->icon_imbuf);
+
brushn->curve= curvemapping_copy(brush->curve);
/* enable fake user by default */
@@ -117,8 +148,14 @@ Brush *copy_brush(Brush *brush)
/* not brush itself */
void free_brush(Brush *brush)
{
- if(brush->mtex.tex) brush->mtex.tex->id.us--;
-
+ if (brush->mtex.tex)
+ brush->mtex.tex->id.us--;
+
+ if (brush->icon_imbuf)
+ IMB_freeImBuf(brush->icon_imbuf);
+
+ BKE_previewimg_free(&(brush->preview));
+
curvemapping_free(brush->curve);
}
@@ -147,7 +184,7 @@ void make_local_brush(Brush *brush)
if(scene->id.lib) lib= 1;
else local= 1;
}
-
+
if(local && lib==0) {
brush->id.lib= 0;
brush->id.flag= LIB_LOCAL;
@@ -731,11 +768,19 @@ static void brush_apply_pressure(BrushPainter *painter, Brush *brush, float pres
brush->spacing = MAX2(1.0, painter->startspacing*(1.5f-pressure));
}
-static void brush_jitter_pos(Brush *brush, float *pos, float *jitterpos)
+void brush_jitter_pos(Brush *brush, float *pos, float *jitterpos)
{
if(brush->jitter){
- jitterpos[0] = pos[0] + ((BLI_frand()-0.5f) * brush->size * brush->jitter * 2);
- jitterpos[1] = pos[1] + ((BLI_frand()-0.5f) * brush->size * brush->jitter * 2);
+ float rand_pos[2];
+
+ // find random position within a circle of diameter 1
+ do {
+ rand_pos[0] = BLI_frand()-0.5f;
+ rand_pos[1] = BLI_frand()-0.5f;
+ } while (len_v2(rand_pos) > 0.5f);
+
+ jitterpos[0] = pos[0] + 2*rand_pos[0]*brush->size*brush->jitter;
+ jitterpos[1] = pos[1] + 2*rand_pos[1]*brush->size*brush->jitter;
}
else {
VECCOPY2D(jitterpos, pos);
@@ -887,7 +932,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
/* Uses the brush curve control to find a strength value between 0 and 1 */
float brush_curve_strength_clamp(Brush *br, float p, const float len)
{
- if(p >= len) p= 1.0f;
+ if(p >= len) return 0;
else p= p/len;
p= curvemapping_evaluateF(br->curve, 0, p);
@@ -899,9 +944,12 @@ float brush_curve_strength_clamp(Brush *br, float p, const float len)
* used for sculpt only */
float brush_curve_strength(Brush *br, float p, const float len)
{
- if(p >= len) p= 1.0f;
- else p= p/len;
- return curvemapping_evaluateF(br->curve, 0, p);
+ if(p >= len)
+ p= 1.0f;
+ else
+ p= p/len;
+
+ return curvemapping_evaluateF(br->curve, 0, p);
}
/* TODO: should probably be unified with BrushPainter stuff? */
@@ -915,7 +963,7 @@ unsigned int *brush_gen_texture_cache(Brush *br, int half_side)
memset(&texres, 0, sizeof(TexResult));
- if(mtex && mtex->tex) {
+ if(mtex->tex) {
float x, y, step = 2.0 / side, co[3];
texcache = MEM_callocN(sizeof(int) * side * side, "Brush texture cache");
@@ -993,9 +1041,9 @@ void brush_radial_control_invoke(wmOperator *op, Brush *br, float size_weight)
float original_value= 0;
if(mode == WM_RADIALCONTROL_SIZE)
- original_value = br->size * size_weight;
+ original_value = sculpt_get_brush_size(br) * size_weight;
else if(mode == WM_RADIALCONTROL_STRENGTH)
- original_value = br->alpha;
+ original_value = sculpt_get_brush_alpha(br);
else if(mode == WM_RADIALCONTROL_ANGLE) {
MTex *mtex = brush_active_texture(br);
if(mtex)
@@ -1013,9 +1061,15 @@ int brush_radial_control_exec(wmOperator *op, Brush *br, float size_weight)
const float conv = 0.017453293;
if(mode == WM_RADIALCONTROL_SIZE)
- br->size = new_value * size_weight;
+ if (sculpt_get_lock_brush_size(br)) {
+ float initial_value = RNA_float_get(op->ptr, "initial_value");
+ const float unprojected_radius = sculpt_get_brush_unprojected_radius(br);
+ sculpt_set_brush_unprojected_radius(br, unprojected_radius * new_value/initial_value * size_weight);
+ }
+ else
+ sculpt_set_brush_size(br, new_value * size_weight);
else if(mode == WM_RADIALCONTROL_STRENGTH)
- br->alpha = new_value;
+ sculpt_set_brush_alpha(br, new_value);
else if(mode == WM_RADIALCONTROL_ANGLE) {
MTex *mtex = brush_active_texture(br);
if(mtex)
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index a586ca57966..41e33002999 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -54,7 +54,7 @@
#include "MEM_guardedalloc.h"
-#include "gpu_buffers.h"
+#include "GPU_buffers.h"
#include "GPU_draw.h"
#include "GPU_extensions.h"
#include "GPU_material.h"
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index ce5bca1da56..b9b1c16c0c4 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -144,6 +144,9 @@ void cloth_init ( ClothModifierData *clmd )
if(!clmd->sim_parms->effector_weights)
clmd->sim_parms->effector_weights = BKE_add_effector_weights(NULL);
+
+ if(clmd->point_cache)
+ clmd->point_cache->step = 1;
}
static BVHTree *bvhselftree_build_from_cloth (ClothModifierData *clmd, float epsilon)
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 9b49ac9c6ff..54adc648539 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -591,7 +591,7 @@ int cloth_collision_response_static ( ClothModifierData *clmd, CollisionModifier
return result;
}
-//Determines collisions on overlap, collisions are writen to collpair[i] and collision+number_collision_found is returned
+//Determines collisions on overlap, collisions are written to collpair[i] and collision+number_collision_found is returned
CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTreeOverlap *overlap, CollPair *collpair )
{
ClothModifierData *clmd = ( ClothModifierData * ) md1;
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index c8a01b1c12f..a07c18f42f3 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -126,6 +126,9 @@ CurveMapping *curvemapping_add(int tot, float minx, float miny, float maxx, floa
cumap->cm[a].curve[1].x= maxx;
cumap->cm[a].curve[1].y= maxy;
}
+
+ cumap->changed_timestamp = 0;
+
return cumap;
}
@@ -240,10 +243,12 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset)
switch(preset) {
case CURVE_PRESET_LINE: cuma->totpoint= 2; break;
- case CURVE_PRESET_SHARP: cuma->totpoint= 3; break;
+ case CURVE_PRESET_SHARP: cuma->totpoint= 4; break;
case CURVE_PRESET_SMOOTH: cuma->totpoint= 4; break;
case CURVE_PRESET_MAX: cuma->totpoint= 2; break;
- case CURVE_PRESET_MID9: cuma->totpoint= 9;
+ case CURVE_PRESET_MID9: cuma->totpoint= 9; break;
+ case CURVE_PRESET_ROUND: cuma->totpoint= 4; break;
+ case CURVE_PRESET_ROOT: cuma->totpoint= 4; break;
}
cuma->curve= MEM_callocN(cuma->totpoint*sizeof(CurveMapPoint), "curve points");
@@ -251,27 +256,29 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset)
switch(preset) {
case CURVE_PRESET_LINE:
cuma->curve[0].x= clipr->xmin;
- cuma->curve[0].y= clipr->ymin;
+ cuma->curve[0].y= clipr->ymax;
cuma->curve[0].flag= 0;
cuma->curve[1].x= clipr->xmax;
- cuma->curve[1].y= clipr->ymax;
+ cuma->curve[1].y= clipr->ymin;
cuma->curve[1].flag= 0;
break;
case CURVE_PRESET_SHARP:
cuma->curve[0].x= 0;
cuma->curve[0].y= 1;
- cuma->curve[1].x= 0.33;
- cuma->curve[1].y= 0.33;
- cuma->curve[2].x= 1;
- cuma->curve[2].y= 0;
+ cuma->curve[1].x= 0.25;
+ cuma->curve[1].y= 0.50;
+ cuma->curve[2].x= 0.75;
+ cuma->curve[2].y= 0.04;
+ cuma->curve[3].x= 1;
+ cuma->curve[3].y= 0;
break;
case CURVE_PRESET_SMOOTH:
cuma->curve[0].x= 0;
cuma->curve[0].y= 1;
cuma->curve[1].x= 0.25;
- cuma->curve[1].y= 0.92;
+ cuma->curve[1].y= 0.94;
cuma->curve[2].x= 0.75;
- cuma->curve[2].y= 0.08;
+ cuma->curve[2].y= 0.06;
cuma->curve[3].x= 1;
cuma->curve[3].y= 0;
break;
@@ -290,8 +297,29 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset)
cuma->curve[i].y= 0.5;
}
}
+ break;
+ case CURVE_PRESET_ROUND:
+ cuma->curve[0].x= 0;
+ cuma->curve[0].y= 1;
+ cuma->curve[1].x= 0.5;
+ cuma->curve[1].y= 0.90;
+ cuma->curve[2].x= 0.86;
+ cuma->curve[2].y= 0.5;
+ cuma->curve[3].x= 1;
+ cuma->curve[3].y= 0;
+ break;
+ case CURVE_PRESET_ROOT:
+ cuma->curve[0].x= 0;
+ cuma->curve[0].y= 1;
+ cuma->curve[1].x= 0.25;
+ cuma->curve[1].y= 0.95;
+ cuma->curve[2].x= 0.75;
+ cuma->curve[2].y= 0.44;
+ cuma->curve[3].x= 1;
+ cuma->curve[3].y= 0;
+ break;
}
-
+
if(cuma->table) {
MEM_freeN(cuma->table);
cuma->table= NULL;
@@ -619,7 +647,9 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles)
float thresh= 0.01f*(clipr->xmax - clipr->xmin);
float dx= 0.0f, dy= 0.0f;
int a;
-
+
+ cumap->changed_timestamp++;
+
/* clamp with clip */
if(cumap->flag & CUMA_DO_CLIP) {
for(a=0; a<cuma->totpoint; a++) {
@@ -701,7 +731,7 @@ float curvemapping_evaluateF(CurveMapping *cumap, int cur, float value)
if(cuma->table==NULL) {
curvemap_make_table(cuma, &cumap->clipr);
if(cuma->table==NULL)
- return value;
+ return 1.0f-value;
}
return curvemap_evaluateF(cuma, value);
}
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index a01ee15dde1..d355a520a8c 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -138,6 +138,7 @@ Curve *add_curve(char *name, int type)
cu->fsize= 1.0;
cu->ulheight = 0.05;
cu->texflag= CU_AUTOSPACE;
+ cu->smallcaps_scale= 0.75f;
cu->twist_mode= CU_TWIST_MINIMUM; // XXX: this one seems to be the best one in most cases, at least for curve deform...
cu->bb= unit_boundbox();
@@ -147,7 +148,7 @@ Curve *add_curve(char *name, int type)
cu->vfont->id.us+=4;
cu->str= MEM_mallocN(12, "str");
strcpy(cu->str, "Text");
- cu->pos= 4;
+ cu->len= cu->pos= 4;
cu->strinfo= MEM_callocN(12*sizeof(CharInfo), "strinfo new");
cu->totbox= cu->actbox= 1;
cu->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "textbox");
@@ -1317,30 +1318,33 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
short dnr;
/* bevel now in three parts, for proper vertex normals */
- /* part 1 */
- dnr= nr= 2+ cu->bevresol;
- if( (cu->flag & (CU_FRONT|CU_BACK))==0)
- nr= 3+ 2*cu->bevresol;
-
- dl= MEM_callocN(sizeof(DispList), "makebevelcurve p1");
- dl->verts= MEM_mallocN(nr*3*sizeof(float), "makebevelcurve p1");
- BLI_addtail(disp, dl);
- dl->type= DL_SEGM;
- dl->parts= 1;
- dl->flag= DL_BACK_CURVE;
- dl->nr= nr;
+ /* part 1, back */
- /* half a circle */
- fp= dl->verts;
- dangle= (0.5*M_PI/(dnr-1));
- angle= -(nr-1)*dangle;
-
- for(a=0; a<nr; a++) {
- fp[0]= 0.0;
- fp[1]= (float)(cos(angle)*(cu->ext2));
- fp[2]= (float)(sin(angle)*(cu->ext2)) - cu->ext1;
- angle+= dangle;
- fp+= 3;
+ if((cu->flag & CU_BACK) || !(cu->flag & CU_FRONT)) {
+ dnr= nr= 2+ cu->bevresol;
+ if( (cu->flag & (CU_FRONT|CU_BACK))==0)
+ nr= 3+ 2*cu->bevresol;
+
+ dl= MEM_callocN(sizeof(DispList), "makebevelcurve p1");
+ dl->verts= MEM_mallocN(nr*3*sizeof(float), "makebevelcurve p1");
+ BLI_addtail(disp, dl);
+ dl->type= DL_SEGM;
+ dl->parts= 1;
+ dl->flag= DL_BACK_CURVE;
+ dl->nr= nr;
+
+ /* half a circle */
+ fp= dl->verts;
+ dangle= (0.5*M_PI/(dnr-1));
+ angle= -(nr-1)*dangle;
+
+ for(a=0; a<nr; a++) {
+ fp[0]= 0.0;
+ fp[1]= (float)(cos(angle)*(cu->ext2));
+ fp[2]= (float)(sin(angle)*(cu->ext2)) - cu->ext1;
+ angle+= dangle;
+ fp+= 3;
+ }
}
/* part 2, sidefaces */
@@ -1373,30 +1377,32 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
}
}
- /* part 3 */
- dnr= nr= 2+ cu->bevresol;
- if( (cu->flag & (CU_FRONT|CU_BACK))==0)
- nr= 3+ 2*cu->bevresol;
-
- dl= MEM_callocN(sizeof(DispList), "makebevelcurve p3");
- dl->verts= MEM_mallocN(nr*3*sizeof(float), "makebevelcurve p3");
- BLI_addtail(disp, dl);
- dl->type= DL_SEGM;
- dl->flag= DL_FRONT_CURVE;
- dl->parts= 1;
- dl->nr= nr;
-
- /* half a circle */
- fp= dl->verts;
- angle= 0.0;
- dangle= (0.5*M_PI/(dnr-1));
-
- for(a=0; a<nr; a++) {
- fp[0]= 0.0;
- fp[1]= (float)(cos(angle)*(cu->ext2));
- fp[2]= (float)(sin(angle)*(cu->ext2)) + cu->ext1;
- angle+= dangle;
- fp+= 3;
+ /* part 3, front */
+ if((cu->flag & CU_FRONT) || !(cu->flag & CU_BACK)) {
+ dnr= nr= 2+ cu->bevresol;
+ if( (cu->flag & (CU_FRONT|CU_BACK))==0)
+ nr= 3+ 2*cu->bevresol;
+
+ dl= MEM_callocN(sizeof(DispList), "makebevelcurve p3");
+ dl->verts= MEM_mallocN(nr*3*sizeof(float), "makebevelcurve p3");
+ BLI_addtail(disp, dl);
+ dl->type= DL_SEGM;
+ dl->flag= DL_FRONT_CURVE;
+ dl->parts= 1;
+ dl->nr= nr;
+
+ /* half a circle */
+ fp= dl->verts;
+ angle= 0.0;
+ dangle= (0.5*M_PI/(dnr-1));
+
+ for(a=0; a<nr; a++) {
+ fp[0]= 0.0;
+ fp[1]= (float)(cos(angle)*(cu->ext2));
+ fp[2]= (float)(sin(angle)*(cu->ext2)) + cu->ext1;
+ angle+= dangle;
+ fp+= 3;
+ }
}
}
}
@@ -3072,7 +3078,7 @@ int clamp_nurb_order_u( struct Nurb *nu )
nu->orderu= nu->pntsu;
change= 1;
}
- if(((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagu & CU_NURB_BEZIER)) {
+ if(((nu->flagu & CU_NURB_CYCLIC)==0) && (nu->flagu & CU_NURB_BEZIER)) {
CLAMP(nu->orderu, 3,4);
change= 1;
}
@@ -3086,7 +3092,7 @@ int clamp_nurb_order_v( struct Nurb *nu)
nu->orderv= nu->pntsv;
change= 1;
}
- if(((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagv & CU_NURB_BEZIER)) {
+ if(((nu->flagv & CU_NURB_CYCLIC)==0) && (nu->flagv & CU_NURB_BEZIER)) {
CLAMP(nu->orderv, 3,4);
change= 1;
}
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 1a1ca8a8d3e..142f80a350e 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -2217,7 +2217,7 @@ static void dag_current_scene_layers(Main *bmain, Scene **sce, unsigned int *lay
*sce= bmain->scene.first;
if(*sce) *lay= (*sce)->lay;
- /* XXX for background mode, we should get the scen
+ /* XXX for background mode, we should get the scene
from somewhere, for the -S option, but it's in
the context, how to get it here? */
}
@@ -2248,7 +2248,7 @@ void DAG_on_load_update(void)
dag_current_scene_layers(bmain, &scene, &lay);
- if(scene) {
+ if(scene && scene->theDag) {
/* derivedmeshes and displists are not saved to file so need to be
remade, tag them so they get remade in the scene update loop,
note armature poses or object matrices are preserved and do not
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 6fcc49f9ec1..3271749643a 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -1193,7 +1193,7 @@ short list_has_suitable_fmodifier (ListBase *modifiers, int mtype, short acttype
* - this step acts as an optimisation to prevent the F-Curve stack being evaluated
* several times by modifiers requesting the time be modified, as the final result
* would have required using the modified time
- * - modifiers only ever recieve the unmodified time, as subsequent modifiers should be
+ * - modifiers only ever receive the unmodified time, as subsequent modifiers should be
* working on the 'global' result of the modified curve, not some localised segment,
* so nevaltime gets set to whatever the last time-modifying modifier likes...
* - we start from the end of the stack, as only the last one matters for now
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 01f2b57de71..a99f2599f66 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -1,4 +1,4 @@
-/* font.c
+/* font.c
*
*
* $Id$
@@ -34,6 +34,7 @@
#include <math.h>
#include <stdlib.h>
#include <wchar.h>
+#include <wctype.h>
#include "MEM_guardedalloc.h"
@@ -426,12 +427,12 @@ VFont *load_vfont(char *name)
static VFont *which_vfont(Curve *cu, CharInfo *info)
{
- switch(info->flag & CU_STYLE) {
- case CU_BOLD:
+ switch(info->flag & (CU_CHINFO_BOLD|CU_CHINFO_ITALIC)) {
+ case CU_CHINFO_BOLD:
if (cu->vfontb) return(cu->vfontb); else return(cu->vfont);
- case CU_ITALIC:
+ case CU_CHINFO_ITALIC:
if (cu->vfonti) return(cu->vfonti); else return(cu->vfont);
- case (CU_BOLD|CU_ITALIC):
+ case (CU_CHINFO_BOLD|CU_CHINFO_ITALIC):
if (cu->vfontbi) return(cu->vfontbi); else return(cu->vfont);
default:
return(cu->vfont);
@@ -449,6 +450,17 @@ VFont *get_builtin_font(void)
return load_vfont("<builtin>");
}
+static VChar *find_vfont_char(VFontData *vfd, intptr_t character)
+{
+ VChar *che= NULL;
+
+ for(che = vfd->characters.first; che; che = che->next) {
+ if(che->index == character)
+ break;
+ }
+ return che; /* NULL if not found */
+}
+
static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, int charidx, short mat_nr)
{
Nurb *nu2;
@@ -523,14 +535,7 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float
si= (float)sin(rot);
co= (float)cos(rot);
- // Find the correct character from the font
- che = vfd->characters.first;
- while(che)
- {
- if(che->index == character)
- break;
- che = che->next;
- }
+ che= find_vfont_char(vfd, character);
// Select the glyph data
if(che)
@@ -597,9 +602,23 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float
}
bezt2 = nu2->bezt;
+ if(info->flag & CU_CHINFO_SMALLCAPS_CHECK) {
+ const float sca= cu->smallcaps_scale;
+ for (i= nu2->pntsu; i > 0; i--) {
+ fp= bezt2->vec[0];
+ fp[0] *= sca;
+ fp[1] *= sca;
+ fp[3] *= sca;
+ fp[4] *= sca;
+ fp[6] *= sca;
+ fp[7] *= sca;
+ bezt2++;
+ }
+ }
+ bezt2 = nu2->bezt;
+
for (i= nu2->pntsu; i > 0; i--) {
fp= bezt2->vec[0];
-
fp[0]= (fp[0]+ofsx)*fsize;
fp[1]= (fp[1]+ofsy)*fsize;
fp[3]= (fp[3]+ofsx)*fsize;
@@ -635,6 +654,20 @@ int BKE_font_getselection(Object *ob, int *start, int *end)
}
}
+static float char_width(Curve *cu, VChar *che, CharInfo *info)
+{
+ // The character wasn't found, propably ascii = 0, then the width shall be 0 as well
+ if(che == NULL) {
+ return 0.0f;
+ }
+ else if(info->flag & CU_CHINFO_SMALLCAPS_CHECK) {
+ return che->width * cu->smallcaps_scale;
+ }
+ else {
+ return che->width;
+ }
+}
+
struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
{
VFont *vfont, *oldvfont;
@@ -716,7 +749,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
oldvfont = NULL;
- for (i=0; i<slen; i++) custrinfo[i].flag &= ~CU_WRAP;
+ for (i=0; i<slen; i++) custrinfo[i].flag &= ~(CU_CHINFO_WRAP|CU_CHINFO_SMALLCAPS_CHECK);
if (cu->selboxes) MEM_freeN(cu->selboxes);
cu->selboxes = NULL;
@@ -729,18 +762,21 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
makebreak:
// Characters in the list
che = vfd->characters.first;
- ascii = mem[i];
info = &(custrinfo[i]);
+ ascii = mem[i];
+ if(info->flag & CU_CHINFO_SMALLCAPS) {
+ ascii = towupper(ascii);
+ if(mem[i] != ascii) {
+ mem[i]= ascii;
+ info->flag |= CU_CHINFO_SMALLCAPS_CHECK;
+ }
+ }
+
vfont = which_vfont(cu, info);
if(vfont==NULL) break;
-
- // Find the character
- while(che) {
- if(che->index == ascii)
- break;
- che = che->next;
- }
+
+ che= find_vfont_char(vfd, ascii);
/*
* The character wasn't in the current curve base so load it
@@ -752,12 +788,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
}
/* Try getting the character again from the list */
- che = vfd->characters.first;
- while(che) {
- if(che->index == ascii)
- break;
- che = che->next;
- }
+ che= find_vfont_char(vfd, ascii);
/* No VFont found */
if (vfont==0) {
@@ -780,11 +811,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
return 0;
}
- // The character wasn't found, propably ascii = 0, then the width shall be 0 as well
- if(!che)
- twidth = 0;
- else
- twidth = che->width;
+ twidth = char_width(cu, che, info);
// Calculate positions
if((tb->w != 0.0) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w) {
@@ -798,13 +825,13 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
i = j-1;
xof = ct->xof;
ct[1].dobreak = 1;
- custrinfo[i+1].flag |= CU_WRAP;
+ custrinfo[i+1].flag |= CU_CHINFO_WRAP;
goto makebreak;
}
if (chartransdata[j].dobreak) {
// fprintf(stderr, "word too long: %c%c%c...\n", mem[j], mem[j+1], mem[j+2]);
ct->dobreak= 1;
- custrinfo[i+1].flag |= CU_WRAP;
+ custrinfo[i+1].flag |= CU_CHINFO_WRAP;
ct -= 1;
cnr -= 1;
i--;
@@ -881,10 +908,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
else wsfac = 1.0;
// Set the width of the character
- if(!che)
- twidth = 0;
- else
- twidth = che->width;
+ twidth = char_width(cu, che, info);
xof += (twidth*wsfac*(1.0+(info->kern/40.0)) ) + xtrax;
@@ -1015,19 +1039,10 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
/* rotate around center character */
ascii = mem[i];
-
- // Find the character
- che = vfd->characters.first;
- while(che) {
- if(che->index == ascii)
- break;
- che = che->next;
- }
+
+ che= find_vfont_char(vfd, ascii);
- if(che)
- twidth = che->width;
- else
- twidth = 0;
+ twidth = char_width(cu, che, info);
dtime= distfac*0.35f*twidth; /* why not 0.5? */
dtime= distfac*0.5f*twidth; /* why not 0.5? */
@@ -1151,24 +1166,19 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
if(cha != '\n' && cha != '\r')
buildchar(cu, cha, info, ct->xof, ct->yof, ct->rot, i);
- if ((info->flag & CU_UNDERLINE) && (cu->textoncurve == NULL) && (cha != '\n') && (cha != '\r')) {
+ if ((info->flag & CU_CHINFO_UNDERLINE) && (cu->textoncurve == NULL) && (cha != '\n') && (cha != '\r')) {
float ulwidth, uloverlap= 0.0f;
if ( (i<(slen-1)) && (mem[i+1] != '\n') && (mem[i+1] != '\r') &&
- ((mem[i+1] != ' ') || (custrinfo[i+1].flag & CU_UNDERLINE)) && ((custrinfo[i+1].flag & CU_WRAP)==0)
+ ((mem[i+1] != ' ') || (custrinfo[i+1].flag & CU_CHINFO_UNDERLINE)) && ((custrinfo[i+1].flag & CU_CHINFO_WRAP)==0)
) {
uloverlap = xtrax + 0.1;
}
// Find the character, the characters has to be in the memory already
// since character checking has been done earlier already.
- che = vfd->characters.first;
- while(che) {
- if(che->index == cha)
- break;
- che = che->next;
- }
-
- if(!che) twidth =0; else twidth=che->width;
+ che= find_vfont_char(vfd, cha);
+
+ twidth = char_width(cu, che, info);
ulwidth = cu->fsize * ((twidth* (1.0+(info->kern/40.0)))+uloverlap);
build_underline(cu, ct->xof*cu->fsize, ct->yof*cu->fsize + (cu->ulpos-0.05)*cu->fsize,
ct->xof*cu->fsize + ulwidth,
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index 29314fb4865..c1e00e091e8 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -38,6 +38,7 @@
#include "DNA_material_types.h"
#include "DNA_texture_types.h"
#include "DNA_world_types.h"
+#include "DNA_brush_types.h"
#include "BLI_ghash.h"
@@ -120,6 +121,7 @@ struct PreviewImage* BKE_previewimg_create()
for (i=0; i<PREVIEW_MIPMAPS; ++i) {
prv_img->changed[i] = 1;
+ prv_img->changed_timestamp[i] = 0;
}
return prv_img;
}
@@ -175,6 +177,9 @@ void BKE_previewimg_free_id(ID *id)
} else if (GS(id->name) == ID_IM) {
Image *img = (Image*)id;
BKE_previewimg_free(&img->preview);
+ } else if (GS(id->name) == ID_BR) {
+ Brush *br = (Brush*)br;
+ BKE_previewimg_free(&br->preview);
}
}
@@ -202,7 +207,11 @@ PreviewImage* BKE_previewimg_get(ID *id)
Image *img = (Image*)id;
if (!img->preview) img->preview = BKE_previewimg_create();
prv_img = img->preview;
- }
+ } else if (GS(id->name) == ID_BR) {
+ Brush *br = (Brush*)id;
+ if (!br->preview) br->preview = BKE_previewimg_create();
+ prv_img = br->preview;
+ }
return prv_img;
}
@@ -224,6 +233,7 @@ void BKE_icon_changed(int id)
int i;
for (i=0; i<PREVIEW_MIPMAPS; ++i) {
prv->changed[i] = 1;
+ prv->changed_timestamp[i]++;
}
}
}
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index dc78dac04dd..ffd0b378f07 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -200,9 +200,9 @@ void free_image(Image *ima)
}
BKE_icon_delete(&ima->id);
ima->id.icon_id = 0;
- if (ima->preview) {
- BKE_previewimg_free(&ima->preview);
- }
+
+ BKE_previewimg_free(&ima->preview);
+
for(a=0; a<IMA_MAX_RENDER_SLOT; a++) {
if(ima->renders[a]) {
RE_FreeRenderResult(ima->renders[a]);
@@ -1180,6 +1180,10 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, char *name, int imtype, int subimt
}
else if (ELEM5(imtype, R_PNG, R_FFMPEG, R_H264, R_THEORA, R_XVID)) {
ibuf->ftype= PNG;
+
+ if(imtype==R_PNG)
+ ibuf->ftype |= quality; /* quality is actually compression 0-100 --> 0-9 */
+
}
#ifdef WITH_DDS
else if ((imtype==R_DDS)) {
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index cd8ab8290e5..64c9bf4bd07 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -906,7 +906,7 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
*array_index= dummy_index;
}
- /* append preceeding bits to path */
+ /* append preceding bits to path */
if ((actname && actname[0]) && (constname && constname[0])) {
/* Constraint in Pose-Channel */
sprintf(buf, "pose.bones[\"%s\"].constraints[\"%s\"]", actname, constname);
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 8d859a2f712..fdc98d9ed29 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1303,7 +1303,7 @@ void all_local(Library *lib, int untagged_only)
/* The check on the second line (LIB_PRE_EXISTING) is done so its
* possible to tag data you dont want to be made local, used for
- * appending data, so any libdata alredy linked wont become local
+ * appending data, so any libdata already linked wont become local
* (very nasty to discover all your links are lost after appending)
* */
if(id->flag & (LIB_EXTERN|LIB_INDIRECT|LIB_NEW) &&
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 3b6a10c0872..11c96e9a347 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -210,7 +210,7 @@ Material *copy_material(Material *ma)
#if 0 // XXX old animation system
id_us_plus((ID *)man->ipo);
#endif // XXX old animation system
- id_us_plus((ID *)man->group);
+ id_lib_extern((ID *)man->group);
for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a]) {
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index c41dcfa9588..e35d8bce886 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -296,6 +296,7 @@ int is_mball_basis_for(Object *ob1, Object *ob2)
* because this metaball influence polygonisation of metaballs. */
void copy_mball_properties(Scene *scene, Object *active_object)
{
+ Scene *sce_iter= scene;
Base *base;
Object *ob;
MetaBall *active_mball = (MetaBall*)active_object->data;
@@ -305,10 +306,10 @@ void copy_mball_properties(Scene *scene, Object *active_object)
splitIDname(active_object->id.name+2, basisname, &basisnr);
/* XXX recursion check, see scene.c, just too simple code this next_object() */
- if(F_ERROR==next_object(scene, 0, 0, 0))
+ if(F_ERROR==next_object(&sce_iter, 0, 0, 0))
return;
- while(next_object(scene, 1, &base, &ob)) {
+ while(next_object(&sce_iter, 1, &base, &ob)) {
if (ob->type==OB_MBALL) {
if(ob!=active_object){
splitIDname(ob->id.name+2, obname, &obnr);
@@ -338,6 +339,7 @@ void copy_mball_properties(Scene *scene, Object *active_object)
*/
Object *find_basis_mball(Scene *scene, Object *basis)
{
+ Scene *sce_iter= scene;
Base *base;
Object *ob,*bob= basis;
MetaElem *ml=NULL;
@@ -348,10 +350,10 @@ Object *find_basis_mball(Scene *scene, Object *basis)
totelem= 0;
/* XXX recursion check, see scene.c, just too simple code this next_object() */
- if(F_ERROR==next_object(scene, 0, 0, 0))
+ if(F_ERROR==next_object(&sce_iter, 0, 0, 0))
return NULL;
- while(next_object(scene, 1, &base, &ob)) {
+ while(next_object(&sce_iter, 1, &base, &ob)) {
if (ob->type==OB_MBALL) {
if(ob==bob){
@@ -1507,6 +1509,7 @@ void polygonize(PROCESS *mbproc, MetaBall *mb)
float init_meta(Scene *scene, Object *ob) /* return totsize */
{
+ Scene *sce_iter= scene;
Base *base;
Object *bob;
MetaBall *mb;
@@ -1523,9 +1526,8 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
splitIDname(ob->id.name+2, obname, &obnr);
/* make main array */
-
- next_object(scene, 0, 0, 0);
- while(next_object(scene, 1, &base, &bob)) {
+ next_object(&sce_iter, 0, 0, 0);
+ while(next_object(&sce_iter, 1, &base, &bob)) {
if(bob->type==OB_MBALL) {
zero_size= 0;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 278cb8efae5..4fa4ecf444d 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -283,7 +283,6 @@ void free_object(Object *ob)
ob->path= 0;
if(ob->adt) BKE_free_animdata((ID *)ob);
if(ob->poselib) ob->poselib->id.us--;
- if(ob->dup_group) ob->dup_group->id.us--;
if(ob->gpd) ob->gpd->id.us--;
if(ob->defbase.first)
BLI_freelistN(&ob->defbase);
@@ -949,12 +948,6 @@ void free_lamp(Lamp *la)
la->id.icon_id = 0;
}
-void *add_wave()
-{
- return 0;
-}
-
-
/* *************************************************** */
static void *add_obdata_from_type(int type)
@@ -968,7 +961,6 @@ static void *add_obdata_from_type(int type)
case OB_CAMERA: return add_camera("Camera");
case OB_LAMP: return add_lamp("Lamp");
case OB_LATTICE: return add_lattice("Lattice");
- case OB_WAVE: return add_wave();
case OB_ARMATURE: return add_armature("Armature");
case OB_EMPTY: return NULL;
default:
@@ -988,7 +980,6 @@ static char *get_obdata_defname(int type)
case OB_CAMERA: return "Camera";
case OB_LAMP: return "Lamp";
case OB_LATTICE: return "Lattice";
- case OB_WAVE: return "Wave";
case OB_ARMATURE: return "Armature";
case OB_EMPTY: return "Empty";
default:
@@ -1321,7 +1312,7 @@ Object *copy_object(Object *ob)
/* increase user numbers */
id_us_plus((ID *)obn->data);
- id_us_plus((ID *)obn->dup_group);
+ id_lib_extern((ID *)obn->dup_group);
for(a=0; a<obn->totcol; a++) id_us_plus((ID *)obn->mat[a]);
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 96c0afedfb0..3791d808d01 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -433,7 +433,7 @@ void free_keyed_keys(ParticleSystem *psys)
}
}
}
-void psys_free_child_path_cache(ParticleSystem *psys)
+static void free_child_path_cache(ParticleSystem *psys)
{
psys_free_path_cache_buffers(psys->childcache, &psys->childcachebufs);
psys->childcache = NULL;
@@ -451,7 +451,7 @@ void psys_free_path_cache(ParticleSystem *psys, PTCacheEdit *edit)
psys->pathcache= NULL;
psys->totcached= 0;
- psys_free_child_path_cache(psys);
+ free_child_path_cache(psys);
}
}
void psys_free_children(ParticleSystem *psys)
@@ -462,7 +462,7 @@ void psys_free_children(ParticleSystem *psys)
psys->totchild=0;
}
- psys_free_child_path_cache(psys);
+ free_child_path_cache(psys);
}
void psys_free_particles(ParticleSystem *psys)
{
@@ -2721,7 +2721,7 @@ void psys_cache_child_paths(ParticleSimulationData *sim, float cfra, int editupd
}
else {
/* clear out old and create new empty path cache */
- psys_free_child_path_cache(sim->psys);
+ free_child_path_cache(sim->psys);
sim->psys->childcache= psys_alloc_path_cache_buffers(&sim->psys->childcachebufs, totchild, ctx->steps+1);
sim->psys->totchildcache = totchild;
}
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 33ea9f5ba6e..181d8fee4ba 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -3075,18 +3075,66 @@ static void deflect_particle(ParticleSimulationData *sim, int p, float dfra, flo
/* Hair */
/************************************************/
/* check if path cache or children need updating and do it if needed */
-void psys_update_path_cache(ParticleSimulationData *sim, float cfra)
+static void psys_update_path_cache(ParticleSimulationData *sim, float cfra)
{
ParticleSystem *psys = sim->psys;
ParticleSettings *part = psys->part;
-
- /* only hair, keyed and baked stuff can have paths */
- if(part->type==PART_HAIR || psys->flag&PSYS_KEYED || psys->pointcache->mem_cache.first) {
+ ParticleEditSettings *pset = &sim->scene->toolsettings->particle;
+ int distr=0, alloc=0, skip=0;
+
+ if((psys->part->childtype && psys->totchild != get_psys_tot_child(sim->scene, psys)) || psys->recalc&PSYS_RECALC_RESET)
+ alloc=1;
+
+ if(alloc || psys->recalc&PSYS_RECALC_CHILD || (psys->vgroup[PSYS_VG_DENSITY] && (sim->ob && sim->ob->mode & OB_MODE_WEIGHT_PAINT)))
+ distr=1;
+
+ if(distr){
+ if(alloc)
+ realloc_particles(sim, sim->psys->totpart);
+
+ if(get_psys_tot_child(sim->scene, psys)) {
+ /* don't generate children while computing the hair keys */
+ if(!(psys->part->type == PART_HAIR) || (psys->flag & PSYS_HAIR_DONE)) {
+ distribute_particles(sim, PART_FROM_CHILD);
+
+ if(part->from!=PART_FROM_PARTICLE && part->childtype==PART_CHILD_FACES && part->parents!=0.0)
+ psys_find_parents(sim);
+ }
+ }
+ else
+ psys_free_children(psys);
+ }
+
+ if((part->type==PART_HAIR || psys->flag&PSYS_KEYED || psys->pointcache->flag & PTCACHE_BAKED)==0)
+ skip = 1; /* only hair, keyed and baked stuff can have paths */
+ else if(part->ren_as != PART_DRAW_PATH && !(part->type==PART_HAIR && ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)))
+ skip = 1; /* particle visualization must be set as path */
+ else if(!psys->renderdata) {
+ if(part->draw_as != PART_DRAW_REND)
+ skip = 1; /* draw visualization */
+ else if(psys->pointcache->flag & PTCACHE_BAKING)
+ skip = 1; /* no need to cache paths while baking dynamics */
+ else if(psys_in_edit_mode(sim->scene, psys)) {
+ if((pset->flag & PE_DRAW_PART)==0)
+ skip = 1;
+ else if(part->childtype==0 && (psys->flag & PSYS_HAIR_DYNAMICS && psys->pointcache->flag & PTCACHE_BAKED)==0)
+ skip = 1; /* in edit mode paths are needed for child particles and dynamic hair */
+ }
+ }
+
+ if(!skip) {
psys_cache_paths(sim, cfra);
/* for render, child particle paths are computed on the fly */
- if(part->childtype && psys->totchild)
- psys_cache_child_paths(sim, cfra, 0);
+ if(part->childtype) {
+ if(!psys->totchild)
+ skip = 1;
+ else if(psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DONE)==0)
+ skip = 1;
+
+ if(!skip)
+ psys_cache_child_paths(sim, cfra, 0);
+ }
}
else if(psys->pathcache)
psys_free_path_cache(psys, NULL);
@@ -3201,8 +3249,6 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
psys->hair_out_dm = clothModifier_do(psys->clmd, sim->scene, sim->ob, dm, 0, 0);
psys->clmd->sim_parms->effector_weights = NULL;
-
- psys_free_path_cache(psys, NULL);
}
static void hair_step(ParticleSimulationData *sim, float cfra)
{
@@ -3454,19 +3500,14 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
}
free_collider_cache(&sim->colliders);
-
- if(psys->pathcache)
- psys_free_path_cache(psys, NULL);
}
-void psys_update_children(ParticleSimulationData *sim)
+static void update_children(ParticleSimulationData *sim)
{
if((sim->psys->part->type == PART_HAIR) && (sim->psys->flag & PSYS_HAIR_DONE)==0)
/* don't generate children while growing hair - waste of time */
psys_free_children(sim->psys);
- else if(sim->psys->part->childtype) {
- if(sim->psys->totchild != get_psys_tot_child(sim->scene, sim->psys))
- distribute_particles(sim, PART_FROM_CHILD);
- }
+ else if(sim->psys->part->childtype && sim->psys->totchild != get_psys_tot_child(sim->scene, sim->psys))
+ distribute_particles(sim, PART_FROM_CHILD);
else
psys_free_children(sim->psys);
}
@@ -3721,6 +3762,8 @@ static void system_step(ParticleSimulationData *sim, float cfra)
if(ELEM(cache_result, PTCACHE_READ_EXACT, PTCACHE_READ_INTERPOLATED)) {
cached_step(sim, cfra);
+ update_children(sim);
+ psys_update_path_cache(sim, cfra);
BKE_ptcache_validate(cache, framenr);
@@ -3784,6 +3827,9 @@ static void system_step(ParticleSimulationData *sim, float cfra)
BKE_ptcache_write_cache(use_cache, framenr);
}
+ if(init)
+ update_children(sim);
+
/* cleanup */
if(psys->lattice){
end_latt_deform(psys->lattice);
@@ -3946,13 +3992,6 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
/* execute drivers only, as animation has already been done */
BKE_animsys_evaluate_animdata(&part->id, part->adt, cfra, ADT_RECALC_DRIVERS);
- /* TODO: only free child paths in case of PSYS_RECALC_CHILD */
- if(psys->recalc & PSYS_RECALC || ob->recalc & OB_RECALC_ALL)
- psys_free_path_cache(psys, NULL);
-
- if(psys->recalc & PSYS_RECALC_CHILD)
- psys_free_children(psys);
-
if(psys->recalc & PSYS_RECALC_TYPE)
psys_changed_type(&sim);
else if(psys->recalc & PSYS_RECALC_PHYS)
@@ -4009,6 +4048,7 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
if(part->phystype == PART_PHYS_KEYED) {
psys_count_keyed_targets(&sim);
set_keyed_keys(&sim);
+ psys_update_path_cache(&sim,(int)cfra);
}
break;
}
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index e14828d0f20..5295a496d2b 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -1067,20 +1067,20 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
static int ptcache_path(PTCacheID *pid, char *filename)
{
- Library *lib;
+ Library *lib= (pid)? pid->ob->id.lib: NULL;
+ const char *blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.sce;
size_t i;
- lib= (pid)? pid->ob->id.lib: NULL;
-
if(pid->cache->flag & PTCACHE_EXTERNAL) {
strcpy(filename, pid->cache->path);
+
+ if(strncmp(filename, "//", 2)==0)
+ BLI_path_abs(filename, blendfilename);
+
return BLI_add_slash(filename); /* new strlen() */
}
else if (G.relbase_valid || lib) {
char file[MAX_PTCACHE_PATH]; /* we dont want the dir, only the file */
- char *blendfilename;
-
- blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.sce;
BLI_split_dirfile(blendfilename, NULL, file);
i = strlen(file);
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index 257b34cb246..6ff15b31cc0 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -814,7 +814,7 @@ void link_logicbricks(void **poin, void ***ppoin, short *tot, short size)
(*tot) ++;
*ppoin = MEM_callocN((*tot)*size, "new link");
- for (ibrick=0; ibrick < *tot - 1; ibrick++) {
+ for (ibrick=0; ibrick < *(tot) - 1; ibrick++) {
(*ppoin)[ibrick] = old_links[ibrick];
}
(*ppoin)[ibrick] = *poin;
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 8c950fb69c6..429cbfe4712 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -610,7 +610,7 @@ void unlink_scene(Main *bmain, Scene *sce, Scene *newsce)
/* used by metaballs
* doesnt return the original duplicated object, only dupli's
*/
-int next_object(Scene *scene, int val, Base **base, Object **ob)
+int next_object(Scene **scene, int val, Base **base, Object **ob)
{
static ListBase *duplilist= NULL;
static DupliObject *dupob;
@@ -639,17 +639,21 @@ int next_object(Scene *scene, int val, Base **base, Object **ob)
/* the first base */
if(fase==F_START) {
- *base= scene->base.first;
+ *base= (*scene)->base.first;
if(*base) {
*ob= (*base)->object;
fase= F_SCENE;
}
else {
/* exception: empty scene */
- if(scene->set && scene->set->base.first) {
- *base= scene->set->base.first;
- *ob= (*base)->object;
- fase= F_SET;
+ while((*scene)->set) {
+ (*scene)= (*scene)->set;
+ if((*scene)->base.first) {
+ *base= (*scene)->base.first;
+ *ob= (*base)->object;
+ fase= F_SCENE;
+ break;
+ }
}
}
}
@@ -659,11 +663,14 @@ int next_object(Scene *scene, int val, Base **base, Object **ob)
if(*base) *ob= (*base)->object;
else {
if(fase==F_SCENE) {
- /* scene is finished, now do the set */
- if(scene->set && scene->set->base.first) {
- *base= scene->set->base.first;
- *ob= (*base)->object;
- fase= F_SET;
+ /* (*scene) is finished, now do the set */
+ while((*scene)->set) {
+ (*scene)= (*scene)->set;
+ if((*scene)->base.first) {
+ *base= (*scene)->base.first;
+ *ob= (*base)->object;
+ break;
+ }
}
}
}
@@ -678,7 +685,7 @@ int next_object(Scene *scene, int val, Base **base, Object **ob)
this enters eternal loop because of
makeDispListMBall getting called inside of group_duplilist */
if((*base)->object->dup_group == NULL) {
- duplilist= object_duplilist(scene, (*base)->object);
+ duplilist= object_duplilist((*scene), (*base)->object);
dupob= duplilist->first;
@@ -714,6 +721,10 @@ int next_object(Scene *scene, int val, Base **base, Object **ob)
}
}
+ /* if(ob && *ob) {
+ printf("Scene: '%s', '%s'\n", (*scene)->id.name+2, (*ob)->id.name+2);
+ } */
+
/* reset recursion test */
in_next_object= 0;
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 1ab4e75ee06..61415eb4a52 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -55,6 +55,7 @@
#include "BLI_listbase.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
+#include "BLI_threads.h"
#include <pthread.h>
#include "IMB_imbuf.h"
@@ -247,9 +248,9 @@ void seq_free_sequence(Scene *scene, Sequence *seq)
if(seq->scene_sound)
sound_remove_scene_sound(scene, seq->scene_sound);
- }
- seq_free_animdata(scene, seq);
+ seq_free_animdata(scene, seq);
+ }
MEM_freeN(seq);
}
@@ -517,6 +518,31 @@ void calc_sequence_disp(Scene *scene, Sequence *seq)
seq_update_sound(scene, seq);
}
+static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq)
+{
+ Sequence *seq;
+
+ /* for sound we go over full meta tree to update bounds of the sound strips,
+ since sound is played outside of evaluating the imbufs, */
+ for(seq=metaseq->seqbase.first; seq; seq=seq->next) {
+ if(seq->type == SEQ_META) {
+ seq_update_sound_bounds_recursive(scene, seq);
+ }
+ else if((seq->type == SEQ_SOUND) || (seq->type == SEQ_SCENE)) {
+ if(seq->scene_sound) {
+ int startofs = seq->startofs;
+ int endofs = seq->endofs;
+ if(seq->startofs + seq->start < metaseq->start + metaseq->startofs)
+ startofs = metaseq->start + metaseq->startofs - seq->start;
+
+ if(seq->start + seq->len - seq->endofs > metaseq->start + metaseq->len - metaseq->endofs)
+ endofs = seq->start + seq->len - metaseq->start - metaseq->len + metaseq->endofs;
+ sound_move_scene_sound(scene, seq->scene_sound, seq->start + startofs, seq->start+seq->len - endofs, startofs);
+ }
+ }
+ }
+}
+
void calc_sequence(Scene *scene, Sequence *seq)
{
Sequence *seqm;
@@ -576,6 +602,7 @@ void calc_sequence(Scene *scene, Sequence *seq)
new_tstripdata(seq);
}
}
+ seq_update_sound_bounds_recursive(scene, seq);
}
calc_sequence_disp(scene, seq);
}
@@ -769,7 +796,7 @@ static void seqbase_unique_name(ListBase *seqbasep, SeqUniqueInfo *sui)
Sequence *seq;
for(seq=seqbasep->first; seq; seq= seq->next) {
if (sui->seq != seq && strcmp(sui->name_dest, seq->name+2)==0) {
- sprintf(sui->name_dest, "%.18s.%03d", sui->name_src, sui->count++);
+ sprintf(sui->name_dest, "%.17s.%03d", sui->name_src, sui->count++); /*24 - 2 for prefix, -1 for \0 */
sui->match= 1; /* be sure to re-scan */
}
}
@@ -790,12 +817,17 @@ void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq)
strcpy(sui.name_src, seq->name+2);
strcpy(sui.name_dest, seq->name+2);
+ sui.count= 1;
+ sui.match= 1; /* assume the worst to start the loop */
+
/* Strip off the suffix */
- if ((dot=strrchr(sui.name_src, '.')))
+ if ((dot=strrchr(sui.name_src, '.'))) {
*dot= '\0';
+ dot++;
- sui.count= 1;
- sui.match= 1; /* assume the worst to start the loop */
+ if(*dot)
+ sui.count= atoi(dot) + 1;
+ }
while(sui.match) {
sui.match= 0;
@@ -1111,7 +1143,7 @@ static TStripElem *give_tstripelem(Sequence *seq, int cfra)
Strip * s = seq->strip;
if (cfra < seq->start) {
se = s->tstripdata_startstill;
- if (seq->startstill > s->startstill) {
+ if (seq->startstill != s->startstill) {
free_tstripdata(s->startstill,
s->tstripdata_startstill);
se = 0;
@@ -1128,7 +1160,7 @@ static TStripElem *give_tstripelem(Sequence *seq, int cfra)
} else if (cfra > seq->start + seq->len-1) {
se = s->tstripdata_endstill;
- if (seq->endstill > s->endstill) {
+ if (seq->endstill != s->endstill) {
free_tstripdata(s->endstill,
s->tstripdata_endstill);
se = 0;
@@ -1769,12 +1801,35 @@ static void input_preprocess(Scene *scene, Sequence *seq, TStripElem *se, int cf
if(seq->flag & SEQ_FLIPX) {
IMB_flipx(se->ibuf);
}
+
if(seq->flag & SEQ_FLIPY) {
IMB_flipy(se->ibuf);
}
- if(seq->mul == 0.0) {
- seq->mul = 1.0;
+ if(seq->sat != 1.0f) {
+ /* inline for now, could become an imbuf function */
+ int i;
+ char *rct= (char *)se->ibuf->rect;
+ float *rctf= se->ibuf->rect_float;
+ const float sat= seq->sat;
+ float hsv[3];
+
+ if(rct) {
+ float rgb[3];
+ for (i = se->ibuf->x * se->ibuf->y; i > 0; i--, rct+=4) {
+ rgb_byte_to_float(rct, rgb);
+ rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+ hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rgb, rgb+1, rgb+2);
+ rgb_float_to_byte(rgb, rct);
+ }
+ }
+
+ if(rctf) {
+ for (i = se->ibuf->x * se->ibuf->y; i > 0; i--, rctf+=4) {
+ rgb_to_hsv(rctf[0], rctf[1], rctf[2], hsv, hsv+1, hsv+2);
+ hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rctf, rctf+1, rctf+2);
+ }
+ }
}
mul = seq->mul;
@@ -2204,7 +2259,7 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int
seq->scene->markers.first= seq->scene->markers.last= NULL;
#endif
- if(sequencer_view3d_cb && doseq_gl && (seq->scene == scene || have_seq==0) && seq->scene->camera) {
+ if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (seq->scene == scene || have_seq==0) && seq->scene->camera) {
/* opengl offscreen render */
scene_update_for_newframe(seq->scene, seq->scene->lay);
se->ibuf= sequencer_view3d_cb(seq->scene, seqrectx, seqrecty, scene->r.seq_prev_type);
@@ -2229,6 +2284,13 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int
addzbuffloatImBuf(se->ibuf);
memcpy(se->ibuf->zbuf_float, rres.rectz, sizeof(float)*rres.rectx*rres.recty);
}
+
+ /* {
+ ImBuf *imb= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat, 0);
+ IMB_saveiff(imb, "/tmp/foo.image", IB_rect | IB_metadata);
+ IMB_freeImBuf(imb);
+ } */
+
} else if (rres.rect32) {
se->ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect, 0);
memcpy(se->ibuf->rect, rres.rect32, 4*rres.rectx*rres.recty);
@@ -3206,59 +3268,8 @@ static void free_anim_seq(Sequence *seq)
}
}
-#if 0
-static void free_imbuf_seq_except(Scene *scene, int cfra)
-{
- Editing *ed= seq_give_editing(scene, FALSE);
- Sequence *seq;
- TStripElem *se;
- int a;
-
- if(ed==NULL) return;
-
- SEQ_BEGIN(ed, seq) {
- if(seq->strip) {
- TStripElem * curelem = give_tstripelem(seq, cfra);
-
- for(a = 0, se = seq->strip->tstripdata;
- a < seq->strip->len && se; a++, se++) {
- if(se != curelem) {
- free_imbuf_strip_elem(se);
- }
- }
- for(a = 0, se = seq->strip->tstripdata_startstill;
- a < seq->strip->startstill && se; a++, se++) {
- if(se != curelem) {
- free_imbuf_strip_elem(se);
- }
- }
- for(a = 0, se = seq->strip->tstripdata_endstill;
- a < seq->strip->endstill && se; a++, se++) {
- if(se != curelem) {
- free_imbuf_strip_elem(se);
- }
- }
- if(seq->strip->ibuf_startstill) {
- IMB_freeImBuf(seq->strip->ibuf_startstill);
- seq->strip->ibuf_startstill = 0;
- }
-
- if(seq->strip->ibuf_endstill) {
- IMB_freeImBuf(seq->strip->ibuf_endstill);
- seq->strip->ibuf_endstill = 0;
- }
-
- if(seq->type==SEQ_MOVIE)
- if(seq->startdisp > cfra || seq->enddisp < cfra)
- free_anim_seq(seq);
- free_proxy_seq(seq);
- }
- }
- SEQ_END
-}
-#endif
-
-void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage)
+void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage,
+ int keep_file_handles)
{
Sequence *seq;
TStripElem *se;
@@ -3313,14 +3324,15 @@ void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage)
seq->strip->ibuf_endstill = 0;
}
- if(seq->type==SEQ_MOVIE)
+ if(seq->type==SEQ_MOVIE && !keep_file_handles)
free_anim_seq(seq);
if(seq->type==SEQ_SPEED) {
sequence_effect_speed_rebuild_map(scene, seq, 1);
}
}
if(seq->type==SEQ_META) {
- free_imbuf_seq(scene, &seq->seqbase, FALSE);
+ free_imbuf_seq(scene, &seq->seqbase, FALSE,
+ keep_file_handles);
}
if(seq->type==SEQ_SCENE) {
/* FIXME: recurs downwards,
@@ -4043,6 +4055,7 @@ Sequence *alloc_sequence(ListBase *lb, int cfra, int machine)
seq->flag= SELECT;
seq->start= cfra;
seq->machine= machine;
+ seq->sat= 1.0;
seq->mul= 1.0;
seq->blend_opacity = 100.0;
seq->volume = 1.0f;
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index b44fe1ad1d0..c82595ee2b2 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -251,7 +251,7 @@ static float _final_mass(Object *ob,BodyPoint *bp)
/********************
for each target object/face the axis aligned bounding box (AABB) is stored
-faces paralell to global axes
+faces parallel to global axes
so only simple "value" in [min,max] ckecks are used
float operations still
*/
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 6402f908422..ca39355976b 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -122,10 +122,15 @@ struct bSound* sound_new_file(struct Main *bmain, char* filename)
bSound* sound = NULL;
char str[FILE_MAX];
+ char *path;
+
int len;
strcpy(str, filename);
- BLI_path_abs(str, bmain->name);
+
+ path = /*bmain ? bmain->name :*/ G.sce;
+
+ BLI_path_abs(str, path);
len = strlen(filename);
while(len > 0 && filename[len-1] != '/' && filename[len-1] != '\\')
@@ -258,7 +263,7 @@ void sound_load(struct Main *bmain, struct bSound* sound)
if(sound->id.lib)
path = sound->id.lib->filepath;
else
- path = bmain ? bmain->name : G.sce;
+ path = /*bmain ? bmain->name :*/ G.sce;
BLI_path_abs(fullpath, path);
@@ -468,7 +473,9 @@ int sound_scene_playing(struct Scene *scene)
return -1;
}
-int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length)
+int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length, float start, float end)
{
- return AUD_readSound(sound->cache, buffer, length);
+ AUD_Sound* limiter = AUD_limitSound(sound->cache, start, end);
+ return AUD_readSound(limiter, buffer, length);
+ AUD_unload(limiter);
}
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index fa8c8188f54..6fb1c5ff70c 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -72,12 +72,12 @@ World *add_world(char *name)
wrld= alloc_libblock(&G.main->world, ID_WO, name);
- wrld->horr= 0.25f;
- wrld->horg= 0.25f;
- wrld->horb= 0.25f;
- wrld->zenr= 0.1f;
- wrld->zeng= 0.1f;
- wrld->zenb= 0.1f;
+ wrld->horr= 0.05f;
+ wrld->horg= 0.05f;
+ wrld->horb= 0.05f;
+ wrld->zenr= 0.01f;
+ wrld->zeng= 0.01f;
+ wrld->zenb= 0.01f;
wrld->skytype= 0;
wrld->stardist= 15.0f;
wrld->starsize= 2.0f;
@@ -96,6 +96,8 @@ World *add_world(char *name)
wrld->ao_approx_error= 0.25f;
wrld->preview = NULL;
+ wrld->miststa = 5.0f;
+ wrld->mistdist = 25.0f;
return wrld;
}