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:
authorDaniel Genrich <daniel.genrich@gmx.net>2008-10-01 20:22:28 +0400
committerDaniel Genrich <daniel.genrich@gmx.net>2008-10-01 20:22:28 +0400
commit76658ef1a86f0ca5fd208a840bd87f86290c3295 (patch)
treebcd47443f20a61ef5342a94356ae6cc9576d6640 /source/blender
parent2745517ecda2a72603fa7c8ec5a44f2b857c5782 (diff)
parent0caa92a49c0cf182c64bfc7729fa89b5d56b5670 (diff)
svn merge -r 16741:16866 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/BKE_bullet.h43
-rw-r--r--source/blender/blenkernel/BKE_ipo.h53
-rw-r--r--source/blender/blenkernel/BKE_object.h5
-rw-r--r--source/blender/blenkernel/BKE_particle.h5
-rw-r--r--source/blender/blenkernel/BKE_simple_deform.h39
-rw-r--r--source/blender/blenkernel/BKE_writeframeserver.h2
-rw-r--r--source/blender/blenkernel/CMakeLists.txt3
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c92
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.h28
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c28
-rw-r--r--source/blender/blenkernel/intern/armature.c19
-rw-r--r--source/blender/blenkernel/intern/bullet.c95
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c2
-rw-r--r--source/blender/blenkernel/intern/collision.c4
-rw-r--r--source/blender/blenkernel/intern/curve.c48
-rw-r--r--source/blender/blenkernel/intern/customdata.c7
-rw-r--r--source/blender/blenkernel/intern/displist.c10
-rw-r--r--source/blender/blenkernel/intern/effect.c2
-rw-r--r--source/blender/blenkernel/intern/idprop.c2
-rw-r--r--source/blender/blenkernel/intern/image.c2
-rw-r--r--source/blender/blenkernel/intern/ipo.c3685
-rw-r--r--source/blender/blenkernel/intern/modifier.c198
-rw-r--r--source/blender/blenkernel/intern/object.c72
-rw-r--r--source/blender/blenkernel/intern/particle.c471
-rw-r--r--source/blender/blenkernel/intern/particle_system.c39
-rw-r--r--source/blender/blenkernel/intern/scene.c1
-rw-r--r--source/blender/blenkernel/intern/simple_deform.c248
-rw-r--r--source/blender/blenkernel/intern/softbody.c44
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c204
-rw-r--r--source/blender/blenkernel/intern/text.c24
-rw-r--r--source/blender/blenkernel/intern/writeframeserver.c2
-rw-r--r--source/blender/blenlib/intern/arithb.c65
-rw-r--r--source/blender/blenlib/intern/bpath.c6
-rw-r--r--source/blender/blenlib/intern/psfont.c12
-rw-r--r--source/blender/blenlib/intern/util.c20
-rw-r--r--source/blender/blenloader/BLO_soundfile.h2
-rw-r--r--source/blender/blenloader/intern/readfile.c58
-rw-r--r--source/blender/blenloader/intern/writefile.c9
-rw-r--r--source/blender/include/BDR_editobject.h2
-rw-r--r--source/blender/include/BIF_drawtext.h1
-rw-r--r--source/blender/include/BIF_editarmature.h3
-rw-r--r--source/blender/include/BIF_editmesh.h4
-rw-r--r--source/blender/include/BIF_editparticle.h2
-rw-r--r--source/blender/include/BIF_keyframing.h24
-rw-r--r--source/blender/include/BIF_retopo.h18
-rw-r--r--source/blender/include/blendef.h2
-rw-r--r--source/blender/makesdna/DNA_actuator_types.h2
-rw-r--r--source/blender/makesdna/DNA_constraint_types.h2
-rw-r--r--source/blender/makesdna/DNA_ipo_types.h2
-rw-r--r--source/blender/makesdna/DNA_lamp_types.h4
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h29
-rw-r--r--source/blender/makesdna/DNA_object_force.h52
-rw-r--r--source/blender/makesdna/DNA_object_types.h4
-rw-r--r--source/blender/makesdna/DNA_scene_types.h4
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h4
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h6
-rw-r--r--source/blender/python/BPY_interface.c39
-rw-r--r--source/blender/python/api2_2x/Armature.c6
-rw-r--r--source/blender/python/api2_2x/Draw.c4
-rw-r--r--source/blender/python/api2_2x/Geometry.c36
-rw-r--r--source/blender/python/api2_2x/Group.c8
-rw-r--r--source/blender/python/api2_2x/IDProp.c48
-rw-r--r--source/blender/python/api2_2x/Ipo.c4
-rw-r--r--source/blender/python/api2_2x/Material.c8
-rw-r--r--source/blender/python/api2_2x/Mesh.c10
-rw-r--r--source/blender/python/api2_2x/NLA.c4
-rw-r--r--source/blender/python/api2_2x/NMesh.c4
-rw-r--r--source/blender/python/api2_2x/Object.c3
-rw-r--r--source/blender/python/api2_2x/Scene.c8
-rw-r--r--source/blender/python/api2_2x/Sys.c4
-rw-r--r--source/blender/python/api2_2x/Window.c3
-rw-r--r--source/blender/python/api2_2x/bpy_data.c12
-rw-r--r--source/blender/python/api2_2x/constant.c6
-rw-r--r--source/blender/python/api2_2x/doc/Geometry.py12
-rw-r--r--source/blender/python/api2_2x/matrix.c2
-rw-r--r--source/blender/python/api2_2x/sceneRender.c164
-rw-r--r--source/blender/python/api2_2x/sceneSequence.c8
-rw-r--r--source/blender/radiosity/intern/source/radfactors.c12
-rw-r--r--source/blender/radiosity/intern/source/radnode.c16
-rw-r--r--source/blender/radiosity/intern/source/radpreprocess.c2
-rw-r--r--source/blender/render/intern/include/pixelshading.h2
-rw-r--r--source/blender/render/intern/include/sunsky.h5
-rw-r--r--source/blender/render/intern/source/convertblender.c17
-rw-r--r--source/blender/render/intern/source/initrender.c7
-rw-r--r--source/blender/render/intern/source/occlusion.c4
-rw-r--r--source/blender/render/intern/source/pipeline.c3
-rw-r--r--source/blender/render/intern/source/pixelshading.c70
-rw-r--r--source/blender/render/intern/source/rayshade.c57
-rw-r--r--source/blender/render/intern/source/shadeoutput.c4
-rw-r--r--source/blender/render/intern/source/sunsky.c24
-rw-r--r--source/blender/render/intern/source/texture.c10
-rw-r--r--source/blender/src/CMakeLists.txt3
-rw-r--r--source/blender/src/buttons_editing.c33
-rw-r--r--source/blender/src/buttons_logic.c311
-rw-r--r--source/blender/src/buttons_object.c6
-rw-r--r--source/blender/src/buttons_shading.c88
-rw-r--r--source/blender/src/drawaction.c12
-rw-r--r--source/blender/src/drawarmature.c3
-rw-r--r--source/blender/src/drawgpencil.c18
-rw-r--r--source/blender/src/drawimage.c4
-rw-r--r--source/blender/src/drawipo.c21
-rw-r--r--source/blender/src/drawobject.c4
-rw-r--r--source/blender/src/drawtext.c211
-rw-r--r--source/blender/src/drawview.c4
-rw-r--r--source/blender/src/edit.c8
-rw-r--r--source/blender/src/editaction.c41
-rw-r--r--source/blender/src/editarmature.c137
-rw-r--r--source/blender/src/editcurve.c25
-rw-r--r--source/blender/src/editface.c4
-rw-r--r--source/blender/src/editipo.c7
-rw-r--r--source/blender/src/editmesh.c2
-rw-r--r--source/blender/src/editmesh_add.c7
-rw-r--r--source/blender/src/editmesh_loop.c1
-rw-r--r--source/blender/src/editmesh_tools.c8
-rw-r--r--source/blender/src/editnla.c21
-rw-r--r--source/blender/src/editobject.c85
-rw-r--r--source/blender/src/editparticle.c6
-rw-r--r--source/blender/src/editsima.c8
-rw-r--r--source/blender/src/editsound.c11
-rw-r--r--source/blender/src/gpencil.c279
-rw-r--r--source/blender/src/header_action.c2
-rw-r--r--source/blender/src/header_ipo.c2
-rw-r--r--source/blender/src/header_nla.c2
-rw-r--r--source/blender/src/header_seq.c2
-rw-r--r--source/blender/src/header_text.c208
-rw-r--r--source/blender/src/header_time.c28
-rw-r--r--source/blender/src/interface.c110
-rw-r--r--source/blender/src/keyframing.c261
-rw-r--r--source/blender/src/meshtools.c12
-rw-r--r--source/blender/src/parametrizer.c20
-rw-r--r--source/blender/src/poseobject.c3
-rw-r--r--source/blender/src/resources.c1
-rw-r--r--source/blender/src/retopo.c26
-rw-r--r--source/blender/src/sculptmode.c26
-rw-r--r--source/blender/src/seqaudio.c4
-rw-r--r--source/blender/src/space.c52
-rw-r--r--source/blender/src/toets.c19
-rw-r--r--source/blender/src/transform_conversions.c58
-rw-r--r--source/blender/src/transform_ndofinput.c8
-rw-r--r--source/blender/src/unwrapper.c3
-rw-r--r--source/blender/src/view.c5
-rw-r--r--source/blender/src/vpaint.c6
143 files changed, 5137 insertions, 3531 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index f123c14fddf..0105587c5b4 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -41,7 +41,7 @@ struct ListBase;
struct MemFile;
#define BLENDER_VERSION 247
-#define BLENDER_SUBVERSION 6
+#define BLENDER_SUBVERSION 9
#define BLENDER_MINVERSION 245
#define BLENDER_MINSUBVERSION 15
diff --git a/source/blender/blenkernel/BKE_bullet.h b/source/blender/blenkernel/BKE_bullet.h
new file mode 100644
index 00000000000..1c3bb175d66
--- /dev/null
+++ b/source/blender/blenkernel/BKE_bullet.h
@@ -0,0 +1,43 @@
+/**
+ *
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef BKE_BULLET_H
+#define BKE_BULLET_H
+
+struct BulletSoftBody;
+
+
+/* allocates and initializes general main data */
+extern struct BulletSoftBody *bsbNew(void);
+
+/* frees internal data and softbody itself */
+extern void bsbFree(struct BulletSoftBody *sb);
+
+#endif
+
diff --git a/source/blender/blenkernel/BKE_ipo.h b/source/blender/blenkernel/BKE_ipo.h
index 5b209cb8f5b..fdd176e0e64 100644
--- a/source/blender/blenkernel/BKE_ipo.h
+++ b/source/blender/blenkernel/BKE_ipo.h
@@ -54,41 +54,71 @@ struct bPoseChannel;
struct bActionChannel;
struct rctf;
+/* ------------ Time Management ------------ */
+
float frame_to_float(int cfra);
+/* ------------ IPO Management ---------- */
+
void free_ipo_curve(struct IpoCurve *icu);
void free_ipo(struct Ipo *ipo);
+
void ipo_default_v2d_cur(int blocktype, struct rctf *cur);
+
struct Ipo *add_ipo(char *name, int idcode);
struct Ipo *copy_ipo(struct Ipo *ipo);
+
void ipo_idnew(struct Ipo *ipo);
+
+struct IpoCurve *find_ipocurve(struct Ipo *ipo, int adrcode);
+short has_ipo_code(struct Ipo *ipo, int code);
+
+/* -------------- Make Local -------------- */
+
void make_local_obipo(struct Ipo *ipo);
void make_local_matipo(struct Ipo *ipo);
void make_local_keyipo(struct Ipo *ipo);
void make_local_ipo(struct Ipo *ipo);
-struct IpoCurve *find_ipocurve(struct Ipo *ipo, int adrcode);
+
+/* ------------ IPO-Curve Sanity ---------------- */
void calchandles_ipocurve(struct IpoCurve *icu);
void testhandles_ipocurve(struct IpoCurve *icu);
void sort_time_ipocurve(struct IpoCurve *icu);
int test_time_ipocurve(struct IpoCurve *icu);
+
+/* -------- IPO-Curve (Bezier) Calculations ---------- */
+
void correct_bezpart(float *v1, float *v2, float *v3, float *v4);
int findzero(float x, float q0, float q1, float q2, float q3, float *o);
void berekeny(float f1, float f2, float f3, float f4, float *o, int b);
void berekenx(float *f, float *o, int b);
+
+/* -------- IPO Curve Calculation and Evaluation --------- */
+
float eval_icu(struct IpoCurve *icu, float ipotime);
void calc_icu(struct IpoCurve *icu, float ctime);
float calc_ipo_time(struct Ipo *ipo, float ctime);
void calc_ipo(struct Ipo *ipo, float ctime);
+
+/* ------------ Keyframe Column Tools -------------- */
+
+void add_to_cfra_elem(struct ListBase *lb, struct BezTriple *bezt);
+void make_cfra_list(struct Ipo *ipo, struct ListBase *elems);
+
+/* ---------------- IPO DataAPI ----------------- */
+
void write_ipo_poin(void *poin, int type, float val);
float read_ipo_poin(void *poin, int type);
-void *give_mtex_poin(struct MTex *mtex, int adrcode );
-void *get_ipo_poin(struct ID *id, struct IpoCurve *icu, int *type);
+void *give_mtex_poin(struct MTex *mtex, int adrcode );
void *get_pchan_ipo_poin(struct bPoseChannel *pchan, int adrcode);
+void *get_ipo_poin(struct ID *id, struct IpoCurve *icu, int *type);
void set_icu_vars(struct IpoCurve *icu);
+/* ---------------- IPO Execution --------------- */
+
void execute_ipo(struct ID *id, struct Ipo *ipo);
void execute_action_ipo(struct bActionChannel *achan, struct bPoseChannel *pchan);
@@ -99,21 +129,16 @@ void do_ob_ipo(struct Object *ob);
void do_seq_ipo(struct Sequence *seq, int cfra);
void do_ob_ipodrivers(struct Object *ob, struct Ipo *ipo, float ctime);
-int has_ipo_code(struct Ipo *ipo, int code);
void do_all_data_ipos(void);
-int calc_ipo_spec(struct Ipo *ipo, int adrcode, float *ctime);
+short calc_ipo_spec(struct Ipo *ipo, int adrcode, float *ctime);
void clear_delta_obipo(struct Ipo *ipo);
-void add_to_cfra_elem(struct ListBase *lb, struct BezTriple *bezt);
-void make_cfra_list(struct Ipo *ipo, struct ListBase *elems);
-/* the sort is an IPO_Channel... */
-int IPO_GetChannels(struct Ipo *ipo, short *channels);
+/* ----------- IPO <-> GameEngine API ---------------- */
+
+/* the short is an IPO_Channel... */
-float IPO_GetFloatValue(struct Ipo *ipo,
-/* struct IPO_Channel channel, */
- /* channels are shorts... bit ugly for now*/
- short c,
- float ctime);
+short IPO_GetChannels(struct Ipo *ipo, short *channels);
+float IPO_GetFloatValue(struct Ipo *ipo, short c, float ctime);
#ifdef __cplusplus
};
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 116a59fa97e..a4a06b704bc 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -41,6 +41,7 @@ struct Camera;
struct BoundBox;
struct View3D;
struct SoftBody;
+struct BulletSoftBody;
struct Group;
struct bAction;
@@ -48,10 +49,12 @@ void clear_workob(void);
void copy_baseflags(void);
void copy_objectflags(void);
struct SoftBody *copy_softbody(struct SoftBody *sb);
+struct BulletSoftBody *copy_bulletsoftbody(struct BulletSoftBody *sb);
void copy_object_particlesystems(struct Object *obn, struct Object *ob);
void copy_object_softbody(struct Object *obn, struct Object *ob);
void object_free_particlesystems(struct Object *ob);
void object_free_softbody(struct Object *ob);
+void object_free_bulletsoftbody(struct Object *ob);
void update_base_layer(struct Object *ob);
void free_object(struct Object *ob);
@@ -85,6 +88,8 @@ void set_field_offs(float field);
void disable_speed_curve(int val);
float bsystem_time(struct Object *ob, float cfra, float ofs);
+void object_scale_to_mat3(struct Object *ob, float mat[][3]);
+void object_rot_to_mat3(struct Object *ob, float mat[][3]);
void object_to_mat3(struct Object *ob, float mat[][3]);
void object_to_mat4(struct Object *ob, float mat[][4]);
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index a1a9a883c4f..caba63ef8ce 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -226,7 +226,7 @@ void psys_interpolate_mcol(struct MCol *mcol, int quad, float *uv, struct MCol *
void copy_particle_key(struct ParticleKey *to, struct ParticleKey *from, int time);
-void psys_particle_on_emitter(struct Object *ob, struct ParticleSystemModifierData *psmd, int distr, int index, int index_dmcache, float *fuv, float foffset, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor);
+void psys_particle_on_emitter(struct ParticleSystemModifierData *psmd, int distr, int index, int index_dmcache, float *fuv, float foffset, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor);
struct ParticleSystemModifierData *psys_get_modifier(struct Object *ob, struct ParticleSystem *psys);
struct ParticleSettings *psys_new_settings(char *name, struct Main *main);
@@ -284,11 +284,12 @@ void psys_mat_hair_to_orco(struct Object *ob, struct DerivedMesh *dm, short from
float *psys_cache_vgroup(struct DerivedMesh *dm, struct ParticleSystem *psys, int vgroup);
void psys_get_texture(struct Object *ob, struct Material *ma, struct ParticleSystemModifierData *psmd, struct ParticleSystem *psys, struct ParticleData *pa, struct ParticleTexture *ptex, int event);
void psys_interpolate_face(struct MVert *mvert, struct MFace *mface, struct MTFace *tface, float (*orcodata)[3], float *uv, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor);
+float psys_particle_value_from_verts(struct DerivedMesh *dm, short from, struct ParticleData *pa, float *values);
float psys_interpolate_value_from_verts(struct DerivedMesh *dm, short from, int index, float *fw, float *values);
void psys_get_from_key(struct ParticleKey *key, float *loc, float *vel, float *rot, float *time);
int psys_intersect_dm(struct Object *ob, struct DerivedMesh *dm, float *vert_cos, float *co1, float* co2, float *min_d, int *min_face, float *min_uv, float *face_minmax, float *pa_minmax, float radius, float *ipoint);
-void psys_particle_on_dm(struct Object *ob, struct DerivedMesh *dm, int from, int index, int index_dmcache, float *fw, float foffset, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor);
+void psys_particle_on_dm(struct DerivedMesh *dm, int from, int index, int index_dmcache, float *fw, float foffset, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor);
/* particle_system.c */
void initialize_particle(struct ParticleData *pa, int p, struct Object *ob, struct ParticleSystem *psys, struct ParticleSystemModifierData *psmd);
diff --git a/source/blender/blenkernel/BKE_simple_deform.h b/source/blender/blenkernel/BKE_simple_deform.h
new file mode 100644
index 00000000000..161871a64bc
--- /dev/null
+++ b/source/blender/blenkernel/BKE_simple_deform.h
@@ -0,0 +1,39 @@
+/**
+ * BKE_shrinkwrap.h
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef BKE_SIMPLE_DEFORM_H
+#define BKE_SIMPLE_DEFORM_H
+
+struct Object;
+struct DerivedMesh;
+struct SimpleDeformModifierData;
+
+void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object *ob, struct DerivedMesh *dm, float (*vertexCos)[3], int numVerts);
+
+#endif
+
diff --git a/source/blender/blenkernel/BKE_writeframeserver.h b/source/blender/blenkernel/BKE_writeframeserver.h
index a6ece63bc56..4774906a2fa 100644
--- a/source/blender/blenkernel/BKE_writeframeserver.h
+++ b/source/blender/blenkernel/BKE_writeframeserver.h
@@ -37,7 +37,7 @@ struct RenderData;
extern void start_frameserver(struct RenderData *rd, int rectx, int recty);
extern void end_frameserver(void);
extern void append_frameserver(int frame, int *pixels, int rectx, int recty);
-extern int frameserver_loop();
+extern int frameserver_loop(void);
#ifdef __cplusplus
}
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 0345711c9c3..c3cbc36a94f 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -73,3 +73,6 @@ IF(WITH_INTERNATIONAL)
ADD_DEFINITIONS(-DWITH_FREETYPE2)
ENDIF(WITH_INTERNATIONAL)
+IF(NOT WITH_ELBEEM)
+ ADD_DEFINITIONS(-DDISABLE_ELBEEM)
+ENDIF(NOT WITH_ELBEEM)
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 1652b24e1e5..ce4458b4307 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -201,21 +201,21 @@ static CCGAllocatorIFC *_getStandardAllocatorIFC(void) {
static int VertDataEqual(float *a, float *b) {
return a[0]==b[0] && a[1]==b[1] && a[2]==b[2];
}
-#define VertDataZero(av) { float *a = (float*) av; a[0] = a[1] = a[2] = 0.0f; }
-#define VertDataCopy(av, bv) { float *a = (float*) av, *b = (float*) bv; a[0] =b[0]; a[1] =b[1]; a[2] =b[2]; }
-#define VertDataAdd(av, bv) { float *a = (float*) av, *b = (float*) bv; a[0]+=b[0]; a[1]+=b[1]; a[2]+=b[2]; }
-#define VertDataSub(av, bv) { float *a = (float*) av, *b = (float*) bv; a[0]-=b[0]; a[1]-=b[1]; a[2]-=b[2]; }
-#define VertDataMulN(av, n) { float *a = (float*) av; a[0]*=n; a[1]*=n; a[2]*=n; }
+#define VertDataZero(av) { float *_a = (float*) av; _a[0] = _a[1] = _a[2] = 0.0f; }
+#define VertDataCopy(av, bv) { float *_a = (float*) av, *_b = (float*) bv; _a[0] =_b[0]; _a[1] =_b[1]; _a[2] =_b[2]; }
+#define VertDataAdd(av, bv) { float *_a = (float*) av, *_b = (float*) bv; _a[0]+=_b[0]; _a[1]+=_b[1]; _a[2]+=_b[2]; }
+#define VertDataSub(av, bv) { float *_a = (float*) av, *_b = (float*) bv; _a[0]-=_b[0]; _a[1]-=_b[1]; _a[2]-=_b[2]; }
+#define VertDataMulN(av, n) { float *_a = (float*) av; _a[0]*=n; _a[1]*=n; _a[2]*=n; }
#define VertDataAvg4(tv, av, bv, cv, dv) \
{ \
- float *t = (float*) tv, *a = (float*) av, *b = (float*) bv, *c = (float*) cv, *d = (float*) dv; \
- t[0] = (a[0]+b[0]+c[0]+d[0])*.25; \
- t[1] = (a[1]+b[1]+c[1]+d[1])*.25; \
- t[2] = (a[2]+b[2]+c[2]+d[2])*.25; \
+ float *_t = (float*) tv, *_a = (float*) av, *_b = (float*) bv, *_c = (float*) cv, *_d = (float*) dv; \
+ _t[0] = (_a[0]+_b[0]+_c[0]+_d[0])*.25; \
+ _t[1] = (_a[1]+_b[1]+_c[1]+_d[1])*.25; \
+ _t[2] = (_a[2]+_b[2]+_c[2]+_d[2])*.25; \
}
-#define NormZero(av) { float *a = (float*) av; a[0] = a[1] = a[2] = 0.0f; }
-#define NormCopy(av, bv) { float *a = (float*) av, *b = (float*) bv; a[0] =b[0]; a[1] =b[1]; a[2] =b[2]; }
-#define NormAdd(av, bv) { float *a = (float*) av, *b = (float*) bv; a[0]+=b[0]; a[1]+=b[1]; a[2]+=b[2]; }
+#define NormZero(av) { float *_a = (float*) av; _a[0] = _a[1] = _a[2] = 0.0f; }
+#define NormCopy(av, bv) { float *_a = (float*) av, *_b = (float*) bv; _a[0] =_b[0]; _a[1] =_b[1]; _a[2] =_b[2]; }
+#define NormAdd(av, bv) { float *_a = (float*) av, *_b = (float*) bv; _a[0]+=_b[0]; _a[1]+=_b[1]; _a[2]+=_b[2]; }
static int _edge_isBoundary(CCGEdge *e);
@@ -330,7 +330,7 @@ struct _CCGSubSurf {
/***/
-static CCGVert *_vert_new(CCGVertHDL vHDL, int levels, int dataSize, CCGSubSurf *ss) {
+static CCGVert *_vert_new(CCGVertHDL vHDL, CCGSubSurf *ss) {
CCGVert *v = CCGSUBSURF_alloc(ss, sizeof(CCGVert) + ss->meshIFC.vertDataSize * (ss->subdivLevels+1) + ss->meshIFC.vertUserSize);
byte *userData;
@@ -346,7 +346,7 @@ static CCGVert *_vert_new(CCGVertHDL vHDL, int levels, int dataSize, CCGSubSurf
return v;
}
-static void _vert_remEdge(CCGVert *v, CCGEdge *e, CCGSubSurf *ss) {
+static void _vert_remEdge(CCGVert *v, CCGEdge *e) {
int i;
for (i=0; i<v->numEdges; i++) {
if (v->edges[i]==e) {
@@ -355,7 +355,7 @@ static void _vert_remEdge(CCGVert *v, CCGEdge *e, CCGSubSurf *ss) {
}
}
}
-static void _vert_remFace(CCGVert *v, CCGFace *f, CCGSubSurf *ss) {
+static void _vert_remFace(CCGVert *v, CCGFace *f) {
int i;
for (i=0; i<v->numFaces; i++) {
if (v->faces[i]==f) {
@@ -403,13 +403,13 @@ static void _vert_free(CCGVert *v, CCGSubSurf *ss) {
CCGSUBSURF_free(ss, v);
}
-static int VERT_seam(CCGVert *v, CCGSubSurf *ss) {
+static int VERT_seam(CCGVert *v) {
return ((v->flags & Vert_eSeam) != 0);
}
/***/
-static CCGEdge *_edge_new(CCGEdgeHDL eHDL, CCGVert *v0, CCGVert *v1, float crease, int levels, int dataSize, CCGSubSurf *ss) {
+static CCGEdge *_edge_new(CCGEdgeHDL eHDL, CCGVert *v0, CCGVert *v1, float crease, CCGSubSurf *ss) {
CCGEdge *e = CCGSUBSURF_alloc(ss, sizeof(CCGEdge) + ss->meshIFC.vertDataSize *((ss->subdivLevels+1) + (1<<(ss->subdivLevels+1))-1) + ss->meshIFC.edgeUserSize);
byte *userData;
@@ -429,7 +429,7 @@ static CCGEdge *_edge_new(CCGEdgeHDL eHDL, CCGVert *v0, CCGVert *v1, float creas
return e;
}
-static void _edge_remFace(CCGEdge *e, CCGFace *f, CCGSubSurf *ss) {
+static void _edge_remFace(CCGEdge *e, CCGFace *f) {
int i;
for (i=0; i<e->numFaces; i++) {
if (e->faces[i]==f) {
@@ -478,8 +478,8 @@ static void _edge_free(CCGEdge *e, CCGSubSurf *ss) {
CCGSUBSURF_free(ss, e);
}
static void _edge_unlinkMarkAndFree(CCGEdge *e, CCGSubSurf *ss) {
- _vert_remEdge(e->v0, e, ss);
- _vert_remEdge(e->v1, e, ss);
+ _vert_remEdge(e->v0, e);
+ _vert_remEdge(e->v1, e);
e->v0->flags |= Vert_eEffected;
e->v1->flags |= Vert_eEffected;
_edge_free(e, ss);
@@ -496,7 +496,7 @@ static float EDGE_getSharpness(CCGEdge *e, int lvl) {
return e->crease - lvl;
}
-static CCGFace *_face_new(CCGFaceHDL fHDL, CCGVert **verts, CCGEdge **edges, int numVerts, int levels, int dataSize, CCGSubSurf *ss) {
+static CCGFace *_face_new(CCGFaceHDL fHDL, CCGVert **verts, CCGEdge **edges, int numVerts, CCGSubSurf *ss) {
int maxGridSize = 1 + (1<<(ss->subdivLevels-1));
CCGFace *f = CCGSUBSURF_alloc(ss, sizeof(CCGFace) + sizeof(CCGVert*)*numVerts + sizeof(CCGEdge*)*numVerts + ss->meshIFC.vertDataSize *(1 + numVerts*maxGridSize + numVerts*maxGridSize*maxGridSize) + ss->meshIFC.faceUserSize);
byte *userData;
@@ -610,8 +610,8 @@ static void _face_free(CCGFace *f, CCGSubSurf *ss) {
static void _face_unlinkMarkAndFree(CCGFace *f, CCGSubSurf *ss) {
int j;
for (j=0; j<f->numVerts; j++) {
- _vert_remFace(FACE_getVerts(f)[j], f, ss);
- _edge_remFace(FACE_getEdges(f)[j], f, ss);
+ _vert_remFace(FACE_getVerts(f)[j], f);
+ _edge_remFace(FACE_getEdges(f)[j], f);
FACE_getVerts(f)[j]->flags |= Vert_eEffected;
}
_face_free(f, ss);
@@ -884,7 +884,7 @@ CCGError ccgSubSurf_syncVert(CCGSubSurf *ss, CCGVertHDL vHDL, void *vertData, in
if (ss->syncState==eSyncState_Partial) {
v = _ehash_lookupWithPrev(ss->vMap, vHDL, &prevp);
if (!v) {
- v = _vert_new(vHDL, ss->subdivLevels, ss->meshIFC.vertDataSize, ss);
+ v = _vert_new(vHDL, ss);
VertDataCopy(_vert_getCo(v,0,ss->meshIFC.vertDataSize), vertData);
_ehash_insert(ss->vMap, (EHEntry*) v);
v->flags = Vert_eEffected|seamflag;
@@ -913,7 +913,7 @@ CCGError ccgSubSurf_syncVert(CCGSubSurf *ss, CCGVertHDL vHDL, void *vertData, in
v = _ehash_lookupWithPrev(ss->oldVMap, vHDL, &prevp);
if (!v) {
- v = _vert_new(vHDL, ss->subdivLevels, ss->meshIFC.vertDataSize, ss);
+ v = _vert_new(vHDL, ss);
VertDataCopy(_vert_getCo(v,0,ss->meshIFC.vertDataSize), vertData);
_ehash_insert(ss->vMap, (EHEntry*) v);
v->flags = Vert_eEffected|seamflag;
@@ -943,7 +943,7 @@ CCGError ccgSubSurf_syncEdge(CCGSubSurf *ss, CCGEdgeHDL eHDL, CCGVertHDL e_vHDL0
CCGVert *v0 = _ehash_lookup(ss->vMap, e_vHDL0);
CCGVert *v1 = _ehash_lookup(ss->vMap, e_vHDL1);
- eNew = _edge_new(eHDL, v0, v1, crease, ss->subdivLevels, ss->meshIFC.vertDataSize, ss);
+ eNew = _edge_new(eHDL, v0, v1, crease, ss);
if (e) {
*prevp = eNew;
@@ -968,7 +968,7 @@ CCGError ccgSubSurf_syncEdge(CCGSubSurf *ss, CCGEdgeHDL eHDL, CCGVertHDL e_vHDL0
if (!e || e->v0->vHDL!=e_vHDL0 || e->v1->vHDL!=e_vHDL1|| e->crease!=crease) {
CCGVert *v0 = _ehash_lookup(ss->vMap, e_vHDL0);
CCGVert *v1 = _ehash_lookup(ss->vMap, e_vHDL1);
- e = _edge_new(eHDL, v0, v1, crease, ss->subdivLevels, ss->meshIFC.vertDataSize, ss);
+ e = _edge_new(eHDL, v0, v1, crease, ss);
_ehash_insert(ss->eMap, (EHEntry*) e);
e->v0->flags |= Vert_eEffected;
e->v1->flags |= Vert_eEffected;
@@ -1017,7 +1017,7 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV
}
if (!f || topologyChanged) {
- fNew = _face_new(fHDL, ss->tempVerts, ss->tempEdges, numVerts, ss->subdivLevels, ss->meshIFC.vertDataSize, ss);
+ fNew = _face_new(fHDL, ss->tempVerts, ss->tempEdges, numVerts, ss);
if (f) {
ss->numGrids += numVerts - f->numVerts;
@@ -1054,7 +1054,7 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV
if (!ss->tempEdges[k]) {
if (ss->allowEdgeCreation) {
- CCGEdge *e = ss->tempEdges[k] = _edge_new((CCGEdgeHDL) -1, ss->tempVerts[k], ss->tempVerts[(k+1)%numVerts], ss->defaultCreaseValue, ss->subdivLevels, ss->meshIFC.vertDataSize, ss);
+ CCGEdge *e = ss->tempEdges[k] = _edge_new((CCGEdgeHDL) -1, ss->tempVerts[k], ss->tempVerts[(k+1)%numVerts], ss->defaultCreaseValue, ss);
_ehash_insert(ss->eMap, (EHEntry*) e);
e->v0->flags |= Vert_eEffected;
e->v1->flags |= Vert_eEffected;
@@ -1075,7 +1075,7 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV
}
if (!f || topologyChanged) {
- f = _face_new(fHDL, ss->tempVerts, ss->tempEdges, numVerts, ss->subdivLevels, ss->meshIFC.vertDataSize, ss);
+ f = _face_new(fHDL, ss->tempVerts, ss->tempEdges, numVerts, ss);
_ehash_insert(ss->fMap, (EHEntry*) f);
ss->numGrids += numVerts;
@@ -1228,7 +1228,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) {
void *nCo = VERT_getCo(v, nextLvl);
int sharpCount = 0, allSharp = 1;
float avgSharpness = 0.0;
- int seam = VERT_seam(v, ss), seamEdges = 0;
+ int seam = VERT_seam(v), seamEdges = 0;
for (i=0; i<v->numEdges; i++) {
CCGEdge *e = v->edges[i];
@@ -1526,7 +1526,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) {
void *nCo = VERT_getCo(v, nextLvl);
int sharpCount = 0, allSharp = 1;
float avgSharpness = 0.0;
- int seam = VERT_seam(v, ss), seamEdges = 0;
+ int seam = VERT_seam(v), seamEdges = 0;
for (i=0; i<v->numEdges; i++) {
CCGEdge *e = v->edges[i];
@@ -2071,7 +2071,7 @@ int ccgSubSurf_getGridLevelSize(CCGSubSurf *ss, int level) {
/* Vert accessors */
-CCGVertHDL ccgSubSurf_getVertVertHandle(CCGSubSurf *ss, CCGVert *v) {
+CCGVertHDL ccgSubSurf_getVertVertHandle(CCGVert *v) {
return v->vHDL;
}
int ccgSubSurf_getVertAge(CCGSubSurf *ss, CCGVert *v) {
@@ -2085,20 +2085,20 @@ int ccgSubSurf_getVertAge(CCGSubSurf *ss, CCGVert *v) {
void *ccgSubSurf_getVertUserData(CCGSubSurf *ss, CCGVert *v) {
return VERT_getLevelData(v) + ss->meshIFC.vertDataSize*(ss->subdivLevels+1);
}
-int ccgSubSurf_getVertNumFaces(CCGSubSurf *ss, CCGVert *v) {
+int ccgSubSurf_getVertNumFaces(CCGVert *v) {
return v->numFaces;
}
-CCGFace *ccgSubSurf_getVertFace(CCGSubSurf *ss, CCGVert *v, int index) {
+CCGFace *ccgSubSurf_getVertFace(CCGVert *v, int index) {
if (index<0 || index>=v->numFaces) {
return NULL;
} else {
return v->faces[index];
}
}
-int ccgSubSurf_getVertNumEdges(CCGSubSurf *ss, CCGVert *v) {
+int ccgSubSurf_getVertNumEdges(CCGVert *v) {
return v->numEdges;
}
-CCGEdge *ccgSubSurf_getVertEdge(CCGSubSurf *ss, CCGVert *v, int index) {
+CCGEdge *ccgSubSurf_getVertEdge(CCGVert *v, int index) {
if (index<0 || index>=v->numEdges) {
return NULL;
} else {
@@ -2118,7 +2118,7 @@ void *ccgSubSurf_getVertLevelData(CCGSubSurf *ss, CCGVert *v, int level) {
/* Edge accessors */
-CCGEdgeHDL ccgSubSurf_getEdgeEdgeHandle(CCGSubSurf *ss, CCGEdge *e) {
+CCGEdgeHDL ccgSubSurf_getEdgeEdgeHandle(CCGEdge *e) {
return e->eHDL;
}
int ccgSubSurf_getEdgeAge(CCGSubSurf *ss, CCGEdge *e) {
@@ -2132,20 +2132,20 @@ int ccgSubSurf_getEdgeAge(CCGSubSurf *ss, CCGEdge *e) {
void *ccgSubSurf_getEdgeUserData(CCGSubSurf *ss, CCGEdge *e) {
return EDGE_getLevelData(e) + ss->meshIFC.vertDataSize *((ss->subdivLevels+1) + (1<<(ss->subdivLevels+1))-1);
}
-int ccgSubSurf_getEdgeNumFaces(CCGSubSurf *ss, CCGEdge *e) {
+int ccgSubSurf_getEdgeNumFaces(CCGEdge *e) {
return e->numFaces;
}
-CCGFace *ccgSubSurf_getEdgeFace(CCGSubSurf *ss, CCGEdge *e, int index) {
+CCGFace *ccgSubSurf_getEdgeFace(CCGEdge *e, int index) {
if (index<0 || index>=e->numFaces) {
return NULL;
} else {
return e->faces[index];
}
}
-CCGVert *ccgSubSurf_getEdgeVert0(CCGSubSurf *ss, CCGEdge *e) {
+CCGVert *ccgSubSurf_getEdgeVert0(CCGEdge *e) {
return e->v0;
}
-CCGVert *ccgSubSurf_getEdgeVert1(CCGSubSurf *ss, CCGEdge *e) {
+CCGVert *ccgSubSurf_getEdgeVert1(CCGEdge *e) {
return e->v1;
}
void *ccgSubSurf_getEdgeDataArray(CCGSubSurf *ss, CCGEdge *e) {
@@ -2161,7 +2161,7 @@ void *ccgSubSurf_getEdgeLevelData(CCGSubSurf *ss, CCGEdge *e, int x, int level)
return _edge_getCo(e, level, x, ss->meshIFC.vertDataSize);
}
}
-float ccgSubSurf_getEdgeCrease(CCGSubSurf *ss, CCGEdge *e) {
+float ccgSubSurf_getEdgeCrease(CCGEdge *e) {
return e->crease;
}
@@ -2182,7 +2182,7 @@ void *ccgSubSurf_getFaceUserData(CCGSubSurf *ss, CCGFace *f) {
int maxGridSize = 1 + (1<<(ss->subdivLevels-1));
return FACE_getCenterData(f) + ss->meshIFC.vertDataSize *(1 + f->numVerts*maxGridSize + f->numVerts*maxGridSize*maxGridSize);
}
-int ccgSubSurf_getFaceNumVerts(CCGSubSurf *ss, CCGFace *f) {
+int ccgSubSurf_getFaceNumVerts(CCGFace *f) {
return f->numVerts;
}
CCGVert *ccgSubSurf_getFaceVert(CCGSubSurf *ss, CCGFace *f, int index) {
@@ -2199,7 +2199,7 @@ CCGEdge *ccgSubSurf_getFaceEdge(CCGSubSurf *ss, CCGFace *f, int index) {
return FACE_getEdges(f)[index];
}
}
-int ccgSubSurf_getFaceEdgeIndex(CCGSubSurf *ss, CCGFace *f, CCGEdge *e) {
+int ccgSubSurf_getFaceEdgeIndex(CCGFace *f, CCGEdge *e) {
int i;
for (i=0; i<f->numVerts; i++)
@@ -2208,7 +2208,7 @@ int ccgSubSurf_getFaceEdgeIndex(CCGSubSurf *ss, CCGFace *f, CCGEdge *e) {
return -1;
}
-void *ccgSubSurf_getFaceCenterData(CCGSubSurf *ss, CCGFace *f) {
+void *ccgSubSurf_getFaceCenterData(CCGFace *f) {
return FACE_getCenterData(f);
}
void *ccgSubSurf_getFaceGridEdgeDataArray(CCGSubSurf *ss, CCGFace *f, int gridIndex) {
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.h b/source/blender/blenkernel/intern/CCGSubSurf.h
index 91f3ffab43b..fbd0aecc0a5 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.h
+++ b/source/blender/blenkernel/intern/CCGSubSurf.h
@@ -82,11 +82,11 @@ int ccgSubSurf_getGridSize (CCGSubSurf *ss);
int ccgSubSurf_getGridLevelSize (CCGSubSurf *ss, int level);
CCGVert* ccgSubSurf_getVert (CCGSubSurf *ss, CCGVertHDL v);
-CCGVertHDL ccgSubSurf_getVertVertHandle (CCGSubSurf *ss, CCGVert *v);
-int ccgSubSurf_getVertNumFaces (CCGSubSurf *ss, CCGVert *v);
-CCGFace* ccgSubSurf_getVertFace (CCGSubSurf *ss, CCGVert *v, int index);
-int ccgSubSurf_getVertNumEdges (CCGSubSurf *ss, CCGVert *v);
-CCGEdge* ccgSubSurf_getVertEdge (CCGSubSurf *ss, CCGVert *v, int index);
+CCGVertHDL ccgSubSurf_getVertVertHandle (CCGVert *v);
+int ccgSubSurf_getVertNumFaces (CCGVert *v);
+CCGFace* ccgSubSurf_getVertFace (CCGVert *v, int index);
+int ccgSubSurf_getVertNumEdges (CCGVert *v);
+CCGEdge* ccgSubSurf_getVertEdge (CCGVert *v, int index);
int ccgSubSurf_getVertAge (CCGSubSurf *ss, CCGVert *v);
void* ccgSubSurf_getVertUserData (CCGSubSurf *ss, CCGVert *v);
@@ -94,12 +94,12 @@ void* ccgSubSurf_getVertData (CCGSubSurf *ss, CCGVert *v);
void* ccgSubSurf_getVertLevelData (CCGSubSurf *ss, CCGVert *v, int level);
CCGEdge* ccgSubSurf_getEdge (CCGSubSurf *ss, CCGEdgeHDL e);
-CCGEdgeHDL ccgSubSurf_getEdgeEdgeHandle (CCGSubSurf *ss, CCGEdge *e);
-int ccgSubSurf_getEdgeNumFaces (CCGSubSurf *ss, CCGEdge *e);
-CCGFace* ccgSubSurf_getEdgeFace (CCGSubSurf *ss, CCGEdge *e, int index);
-CCGVert* ccgSubSurf_getEdgeVert0 (CCGSubSurf *ss, CCGEdge *e);
-CCGVert* ccgSubSurf_getEdgeVert1 (CCGSubSurf *ss, CCGEdge *e);
-float ccgSubSurf_getEdgeCrease (CCGSubSurf *ss, CCGEdge *e);
+CCGEdgeHDL ccgSubSurf_getEdgeEdgeHandle (CCGEdge *e);
+int ccgSubSurf_getEdgeNumFaces (CCGEdge *e);
+CCGFace* ccgSubSurf_getEdgeFace (CCGEdge *e, int index);
+CCGVert* ccgSubSurf_getEdgeVert0 (CCGEdge *e);
+CCGVert* ccgSubSurf_getEdgeVert1 (CCGEdge *e);
+float ccgSubSurf_getEdgeCrease (CCGEdge *e);
int ccgSubSurf_getEdgeAge (CCGSubSurf *ss, CCGEdge *e);
void* ccgSubSurf_getEdgeUserData (CCGSubSurf *ss, CCGEdge *e);
@@ -109,14 +109,14 @@ void* ccgSubSurf_getEdgeLevelData (CCGSubSurf *ss, CCGEdge *e, int x, int lev
CCGFace* ccgSubSurf_getFace (CCGSubSurf *ss, CCGFaceHDL f);
CCGFaceHDL ccgSubSurf_getFaceFaceHandle (CCGSubSurf *ss, CCGFace *f);
-int ccgSubSurf_getFaceNumVerts (CCGSubSurf *ss, CCGFace *f);
+int ccgSubSurf_getFaceNumVerts (CCGFace *f);
CCGVert* ccgSubSurf_getFaceVert (CCGSubSurf *ss, CCGFace *f, int index);
CCGEdge* ccgSubSurf_getFaceEdge (CCGSubSurf *ss, CCGFace *f, int index);
-int ccgSubSurf_getFaceEdgeIndex (CCGSubSurf *ss, CCGFace *f, CCGEdge *e);
+int ccgSubSurf_getFaceEdgeIndex (CCGFace *f, CCGEdge *e);
int ccgSubSurf_getFaceAge (CCGSubSurf *ss, CCGFace *f);
void* ccgSubSurf_getFaceUserData (CCGSubSurf *ss, CCGFace *f);
-void* ccgSubSurf_getFaceCenterData (CCGSubSurf *ss, CCGFace *f);
+void* ccgSubSurf_getFaceCenterData (CCGFace *f);
void* ccgSubSurf_getFaceGridEdgeDataArray (CCGSubSurf *ss, CCGFace *f, int gridIndex);
void* ccgSubSurf_getFaceGridEdgeData (CCGSubSurf *ss, CCGFace *f, int gridIndex, int x);
void* ccgSubSurf_getFaceGridDataArray (CCGSubSurf *ss, CCGFace *f, int gridIndex);
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 569229cb8ab..d4b17f97ad9 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -94,7 +94,7 @@
///////////////////////////////////
///////////////////////////////////
-MVert *dm_getVertArray(DerivedMesh *dm)
+static MVert *dm_getVertArray(DerivedMesh *dm)
{
MVert *mvert = CustomData_get_layer(&dm->vertData, CD_MVERT);
@@ -108,7 +108,7 @@ MVert *dm_getVertArray(DerivedMesh *dm)
return mvert;
}
-MEdge *dm_getEdgeArray(DerivedMesh *dm)
+static MEdge *dm_getEdgeArray(DerivedMesh *dm)
{
MEdge *medge = CustomData_get_layer(&dm->edgeData, CD_MEDGE);
@@ -122,7 +122,7 @@ MEdge *dm_getEdgeArray(DerivedMesh *dm)
return medge;
}
-MFace *dm_getFaceArray(DerivedMesh *dm)
+static MFace *dm_getFaceArray(DerivedMesh *dm)
{
MFace *mface = CustomData_get_layer(&dm->faceData, CD_MFACE);
@@ -136,7 +136,7 @@ MFace *dm_getFaceArray(DerivedMesh *dm)
return mface;
}
-MVert *dm_dupVertArray(DerivedMesh *dm)
+static MVert *dm_dupVertArray(DerivedMesh *dm)
{
MVert *tmp = MEM_callocN(sizeof(*tmp) * dm->getNumVerts(dm),
"dm_dupVertArray tmp");
@@ -146,7 +146,7 @@ MVert *dm_dupVertArray(DerivedMesh *dm)
return tmp;
}
-MEdge *dm_dupEdgeArray(DerivedMesh *dm)
+static MEdge *dm_dupEdgeArray(DerivedMesh *dm)
{
MEdge *tmp = MEM_callocN(sizeof(*tmp) * dm->getNumEdges(dm),
"dm_dupEdgeArray tmp");
@@ -156,7 +156,7 @@ MEdge *dm_dupEdgeArray(DerivedMesh *dm)
return tmp;
}
-MFace *dm_dupFaceArray(DerivedMesh *dm)
+static MFace *dm_dupFaceArray(DerivedMesh *dm)
{
MFace *tmp = MEM_callocN(sizeof(*tmp) * dm->getNumFaces(dm),
"dm_dupFaceArray tmp");
@@ -912,8 +912,8 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
glVertexAttrib3fvARB(attribs.orco.glIndex, orco); \
} \
for(b = 0; b < attribs.tottface; b++) { \
- MTFace *tf = (MTFace*)((char*)efa->data + attribs.tface[b].emOffset); \
- glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]); \
+ MTFace *_tf = (MTFace*)((char*)efa->data + attribs.tface[b].emOffset); \
+ glVertexAttrib2fvARB(attribs.tface[b].glIndex, _tf->uv[vert]); \
} \
for(b = 0; b < attribs.totmcol; b++) { \
MCol *cp = (MCol*)((char*)efa->data + attribs.mcol[b].emOffset); \
@@ -1069,7 +1069,7 @@ static int emDM_getNumFaces(DerivedMesh *dm)
return BLI_countlist(&emdm->em->faces);
}
-void emDM_getVert(DerivedMesh *dm, int index, MVert *vert_r)
+static void emDM_getVert(DerivedMesh *dm, int index, MVert *vert_r)
{
EditVert *ev = ((EditMeshDerivedMesh *)dm)->em->verts.first;
int i;
@@ -1087,7 +1087,7 @@ void emDM_getVert(DerivedMesh *dm, int index, MVert *vert_r)
vert_r->bweight = (unsigned char) (ev->bweight*255.0f);
}
-void emDM_getEdge(DerivedMesh *dm, int index, MEdge *edge_r)
+static void emDM_getEdge(DerivedMesh *dm, int index, MEdge *edge_r)
{
EditMesh *em = ((EditMeshDerivedMesh *)dm)->em;
EditEdge *ee = em->edges.first;
@@ -1122,7 +1122,7 @@ void emDM_getEdge(DerivedMesh *dm, int index, MEdge *edge_r)
}
}
-void emDM_getFace(DerivedMesh *dm, int index, MFace *face_r)
+static void emDM_getFace(DerivedMesh *dm, int index, MFace *face_r)
{
EditMesh *em = ((EditMeshDerivedMesh *)dm)->em;
EditFace *ef = em->faces.first;
@@ -1164,7 +1164,7 @@ void emDM_getFace(DerivedMesh *dm, int index, MFace *face_r)
test_index_face(face_r, NULL, 0, ef->v4?4:3);
}
-void emDM_copyVertArray(DerivedMesh *dm, MVert *vert_r)
+static void emDM_copyVertArray(DerivedMesh *dm, MVert *vert_r)
{
EditVert *ev = ((EditMeshDerivedMesh *)dm)->em->verts.first;
@@ -1182,7 +1182,7 @@ void emDM_copyVertArray(DerivedMesh *dm, MVert *vert_r)
}
}
-void emDM_copyEdgeArray(DerivedMesh *dm, MEdge *edge_r)
+static void emDM_copyEdgeArray(DerivedMesh *dm, MEdge *edge_r)
{
EditMesh *em = ((EditMeshDerivedMesh *)dm)->em;
EditEdge *ee = em->edges.first;
@@ -1210,7 +1210,7 @@ void emDM_copyEdgeArray(DerivedMesh *dm, MEdge *edge_r)
}
}
-void emDM_copyFaceArray(DerivedMesh *dm, MFace *face_r)
+static void emDM_copyFaceArray(DerivedMesh *dm, MFace *face_r)
{
EditMesh *em = ((EditMeshDerivedMesh *)dm)->em;
EditFace *ef = em->faces.first;
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 720ed0513ed..155d5a7d21c 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1573,21 +1573,16 @@ static void initialize_posetree(struct Object *ob, bPoseChannel *pchan_tip)
/* find IK constraint, and validate it */
for(con= pchan_tip->constraints.first; con; con= con->next) {
- if(con->type==CONSTRAINT_TYPE_KINEMATIC) break;
+ if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
+ data=(bKinematicConstraint*)con->data;
+ if (data->flag & CONSTRAINT_IK_AUTO) break;
+ if (data->tar==NULL) continue;
+ if (data->tar->type==OB_ARMATURE && data->subtarget[0]==0) continue;
+ if ((con->flag & CONSTRAINT_DISABLE)==0 && (con->enforce!=0.0)) break;
+ }
}
if(con==NULL) return;
- data=(bKinematicConstraint*)con->data;
-
- /* two types of targets */
- if(data->flag & CONSTRAINT_IK_AUTO);
- else {
- if(con->flag & CONSTRAINT_DISABLE) return; /* checked in editconstraint.c */
- if(con->enforce == 0.0f) return;
- if(data->tar==NULL) return;
- if(data->tar->type==OB_ARMATURE && data->subtarget[0]==0) return;
- }
-
/* exclude tip from chain? */
if(!(data->flag & CONSTRAINT_IK_TIP))
pchan_tip= pchan_tip->parent;
diff --git a/source/blender/blenkernel/intern/bullet.c b/source/blender/blenkernel/intern/bullet.c
new file mode 100644
index 00000000000..eeec4d0bd4e
--- /dev/null
+++ b/source/blender/blenkernel/intern/bullet.c
@@ -0,0 +1,95 @@
+/*
+ *
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) Blender Foundation
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "MEM_guardedalloc.h"
+
+/* types */
+#include "DNA_object_force.h" /* here is the softbody struct */
+
+#include "BKE_bullet.h"
+
+
+/* ************ Object level, exported functions *************** */
+
+/* allocates and initializes general main data */
+BulletSoftBody *bsbNew(void)
+{
+ BulletSoftBody *bsb;
+
+ bsb= MEM_callocN(sizeof(BulletSoftBody), "bulletsoftbody");
+
+ bsb->flag = OB_BSB_BENDING_CONSTRAINTS | OB_BSB_SHAPE_MATCHING | OB_BSB_AERO_VPOINT;
+ bsb->linStiff = 0.5f;
+ bsb->angStiff = 1.0f;
+ bsb->volume = 1.0f;
+
+
+ bsb->viterations = 0;
+ bsb->piterations = 2;
+ bsb->diterations = 0;
+ bsb->citerations = 4;
+
+ bsb->kSRHR_CL = 0.1f;
+ bsb->kSKHR_CL = 1.f;
+ bsb->kSSHR_CL = 0.5f;
+ bsb->kSR_SPLT_CL = 0.5f;
+
+ bsb->kSK_SPLT_CL = 0.5f;
+ bsb->kSS_SPLT_CL = 0.5f;
+ bsb->kVCF = 1;
+ bsb->kDP = 0;
+
+ bsb->kDG = 0;
+ bsb->kLF = 0;
+ bsb->kPR = 0;
+ bsb->kVC = 0;
+
+ bsb->kDF = 0.2f;
+ bsb->kMT = 0.05;
+ bsb->kCHR = 1.0f;
+ bsb->kKHR = 0.1f;
+
+ bsb->kSHR = 1.0f;
+ bsb->kAHR = 0.7f;
+ bsb->collisionflags = 0;
+ //bsb->collisionflags = OB_BSB_COL_CL_RS + OB_BSB_COL_CL_SS;
+ bsb->numclusteriterations = 64;
+
+ return bsb;
+}
+
+/* frees all */
+void bsbFree(BulletSoftBody *bsb)
+{
+ /* no internal data yet */
+ MEM_freeN(bsb);
+}
+
+
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index c30d86431b1..2c1b5ced614 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -121,7 +121,7 @@ static void cdDM_copyEdgeArray(DerivedMesh *dm, MEdge *edge_r)
memcpy(edge_r, cddm->medge, sizeof(*edge_r) * dm->numEdgeData);
}
-void cdDM_copyFaceArray(DerivedMesh *dm, MFace *face_r)
+static void cdDM_copyFaceArray(DerivedMesh *dm, MFace *face_r)
{
CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
memcpy(face_r, cddm->mface, sizeof(*face_r) * dm->numFaceData);
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index b5e09d551f0..b8f5b467c11 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -1307,6 +1307,10 @@ CollisionModifierData **get_collisionobjects(Object *self, int *numcollobj)
// check all collision objects
for ( base = G.scene->base.first; base; base = base->next )
{
+ /*Only proceed for mesh object in same layer */
+ if(!(base->object->type==OB_MESH && (base->lay & self->lay)))
+ continue;
+
coll_ob = base->object;
if(coll_ob->pd && coll_ob->pd->deflect)
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 457bfe20915..6ece16deb4b 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -658,23 +658,23 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride)
float u, v, ustart, uend, ustep, vstart, vend, vstep, sumdiv;
int i, j, iofs, jofs, cycl, len, resolu, resolv;
int istart, iend, jsta, jen, *jstart, *jend, ratcomp;
-
+
+ int totu = nu->pntsu*nu->resolu, totv = nu->pntsv*nu->resolv;
+
if(nu->knotsu==NULL || nu->knotsv==NULL) return;
if(nu->orderu>nu->pntsu) return;
if(nu->orderv>nu->pntsv) return;
if(coord_array==NULL) return;
-
+
/* allocate and initialize */
- len= nu->pntsu*nu->pntsv;
+ len = totu * totv;
if(len==0) return;
sum= (float *)MEM_callocN(sizeof(float)*len, "makeNurbfaces1");
-
- resolu= nu->resolu;
- resolv= nu->resolv;
- len= resolu*resolv;
+
+ len= totu*totv;
if(len==0) {
MEM_freeN(sum);
return;
@@ -690,12 +690,13 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride)
}
bp++;
}
-
+
fp= nu->knotsu;
ustart= fp[nu->orderu-1];
if(nu->flagu & CU_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
else uend= fp[nu->pntsu];
- ustep= (uend-ustart)/(resolu-1+(nu->flagu & CU_CYCLIC));
+ ustep= (uend-ustart)/((nu->flagu & CU_CYCLIC) ? totu : totu - 1);
+
basisu= (float *)MEM_mallocN(sizeof(float)*KNOTSU(nu), "makeNurbfaces3");
fp= nu->knotsv;
@@ -703,17 +704,19 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride)
if(nu->flagv & CU_CYCLIC) vend= fp[nu->pntsv+nu->orderv-1];
else vend= fp[nu->pntsv];
- vstep= (vend-vstart)/(resolv-1+(nu->flagv & CU_CYCLIC));
+ vstep= (vend-vstart)/((nu->flagv & CU_CYCLIC) ? totv : totv - 1);
+
len= KNOTSV(nu);
- basisv= (float *)MEM_mallocN(sizeof(float)*len*resolv, "makeNurbfaces3");
- jstart= (int *)MEM_mallocN(sizeof(float)*resolv, "makeNurbfaces4");
- jend= (int *)MEM_mallocN(sizeof(float)*resolv, "makeNurbfaces5");
+ basisv= (float *)MEM_mallocN(sizeof(float)*len*totv, "makeNurbfaces3");
+ jstart= (int *)MEM_mallocN(sizeof(float)*totv, "makeNurbfaces4");
+ jend= (int *)MEM_mallocN(sizeof(float)*totv, "makeNurbfaces5");
/* precalculation of basisv and jstart,jend */
if(nu->flagv & CU_CYCLIC) cycl= nu->orderv-1;
else cycl= 0;
v= vstart;
basis= basisv;
+ resolv= totv;
while(resolv--) {
basisNurb(v, nu->orderv, (short)(nu->pntsv+cycl), nu->knotsv, basis, jstart+resolv, jend+resolv);
basis+= KNOTSV(nu);
@@ -724,12 +727,13 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride)
else cycl= 0;
in= coord_array;
u= ustart;
+ resolu= totu;
while(resolu--) {
basisNurb(u, nu->orderu, (short)(nu->pntsu+cycl), nu->knotsu, basisu, &istart, &iend);
basis= basisv;
- resolv= nu->resolv;
+ resolv= totv;
while(resolv--) {
jsta= jstart[resolv];
@@ -798,7 +802,7 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride)
basis+= KNOTSV(nu);
}
u+= ustep;
- if (rowstride!=0) in = (float*) (((unsigned char*) in) + (rowstride - 3*nu->resolv*sizeof(*in)));
+ if (rowstride!=0) in = (float*) (((unsigned char*) in) + (rowstride - 3*totv*sizeof(*in)));
}
/* free */
@@ -954,8 +958,8 @@ float *make_orco_surf(Object *ob)
See also convertblender.c: init_render_surf()
*/
- sizeu = nu->resolu;
- sizev = nu->resolv;
+ sizeu = nu->pntsu*nu->resolu;
+ sizev = nu->pntsv*nu->resolv;
if (nu->flagu & CU_CYCLIC) sizeu++;
if (nu->flagv & CU_CYCLIC) sizev++;
if(nu->pntsv>1) tot+= sizeu * sizev;
@@ -968,8 +972,8 @@ float *make_orco_surf(Object *ob)
nu= cu->nurb.first;
while(nu) {
if(nu->pntsv>1) {
- sizeu = nu->resolu;
- sizev = nu->resolv;
+ sizeu = nu->pntsu*nu->resolu;
+ sizev = nu->pntsv*nu->resolv;
if (nu->flagu & CU_CYCLIC) sizeu++;
if (nu->flagv & CU_CYCLIC) sizev++;
@@ -990,7 +994,7 @@ float *make_orco_surf(Object *ob)
}
}
else {
- float *_tdata= MEM_callocN(nu->resolu*nu->resolv*3*sizeof(float), "temp data");
+ float *_tdata= MEM_callocN((nu->pntsu*nu->resolu) * (nu->pntsv*nu->resolv) *3*sizeof(float), "temp data");
float *tdata= _tdata;
makeNurbfaces(nu, tdata, 0);
@@ -1005,7 +1009,7 @@ float *make_orco_surf(Object *ob)
if (a==sizev-1 && (nu->flagv & CU_CYCLIC))
use_a= 0;
- tdata = _tdata + 3 * (use_b * nu->resolv + use_a);
+ tdata = _tdata + 3 * (use_b * (nu->pntsv*nu->resolv) + use_a);
fp[0]= (tdata[0]-cu->loc[0])/cu->size[0];
fp[1]= (tdata[1]-cu->loc[1])/cu->size[1];
@@ -1505,7 +1509,7 @@ void makeBevelList(Object *ob)
BevList *bl, *blnew, *blnext;
BevPoint *bevp, *bevp2, *bevp1 = NULL, *bevp0;
float min, inp, x1, x2, y1, y2, vec[3];
- float *coord_array, *tilt_array=NULL, *radius_array=NULL, *coord_fp, *tilt_fp=NULL, *radius_fp;
+ float *coord_array, *tilt_array=NULL, *radius_array=NULL, *coord_fp, *tilt_fp=NULL, *radius_fp=NULL;
float *v1, *v2;
struct bevelsort *sortdata, *sd, *sd1;
int a, b, nr, poly, resolu, len=0;
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 2c1f6bb84c1..e93266c85f3 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -265,9 +265,9 @@ static void layerSwap_tface(void *data, int *corner_indices)
{
MTFace *tf = data;
float uv[4][2];
- const static short pin_flags[4] =
+ static const short pin_flags[4] =
{ TF_PIN1, TF_PIN2, TF_PIN3, TF_PIN4 };
- const static char sel_flags[4] =
+ static const char sel_flags[4] =
{ TF_SEL1, TF_SEL2, TF_SEL3, TF_SEL4 };
short unwrap = tf->unwrap & ~(TF_PIN1 | TF_PIN2 | TF_PIN3 | TF_PIN4);
char flag = tf->flag & ~(TF_SEL1 | TF_SEL2 | TF_SEL3 | TF_SEL4);
@@ -926,12 +926,9 @@ void *CustomData_add_layer_named(CustomData *data, int type, int alloctype,
int CustomData_free_layer(CustomData *data, int type, int totelem, int index)
{
int i;
- CustomDataLayer *layer;
if (index < 0) return 0;
- layer = &data->layers[index];
-
customData_free_layer__internal(&data->layers[index], totelem);
for (i=index+1; i < data->totlayer; ++i)
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 598973d6974..be24d1d2474 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -1234,7 +1234,7 @@ void curve_calc_modifiers_pre(Object *ob, ListBase *nurb, int forRender, float (
*numVerts_r = numVerts;
}
-void curve_calc_modifiers_post(Object *ob, ListBase *nurb, ListBase *dispbase, int forRender, float (*originalVerts)[3], float (*deformedVerts)[3])
+static void curve_calc_modifiers_post(Object *ob, ListBase *nurb, ListBase *dispbase, int forRender, float (*originalVerts)[3], float (*deformedVerts)[3])
{
int editmode = (!forRender && ob==G.obedit);
ModifierData *md = modifiers_getVirtualModifierList(ob);
@@ -1342,7 +1342,7 @@ void makeDispListSurf(Object *ob, ListBase *dispbase, int forRender)
makeNurbcurve(nu, data, NULL, NULL, nu->resolu);
}
else {
- len= nu->resolu*nu->resolv;
+ len= (nu->pntsu*nu->resolu) * (nu->pntsv*nu->resolv);
dl= MEM_callocN(sizeof(DispList), "makeDispListsurf");
dl->verts= MEM_callocN(len*3*sizeof(float), "dlverts");
@@ -1354,9 +1354,9 @@ void makeDispListSurf(Object *ob, ListBase *dispbase, int forRender)
data= dl->verts;
dl->type= DL_SURF;
-
- dl->parts= nu->resolu; /* in reverse, because makeNurbfaces works that way */
- dl->nr= nu->resolv;
+
+ dl->parts= (nu->pntsu*nu->resolu); /* in reverse, because makeNurbfaces works that way */
+ dl->nr= (nu->pntsv*nu->resolv);
if(nu->flagv & CU_CYCLIC) dl->flag|= DL_CYCL_U; /* reverse too! */
if(nu->flagu & CU_CYCLIC) dl->flag|= DL_CYCL_V;
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 327008c60de..122c6c71a6c 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -526,8 +526,6 @@ void pdDoEffectors(ListBase *lb, float *opco, float *force, float *speed, float
Object *ob;
pEffectorCache *ec;
PartDeflect *pd;
- float vect_to_vert[3];
- float *obloc;
float distance, vec_to_part[3];
float falloff;
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index b16f52571f6..0a140ebaba1 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -317,7 +317,7 @@ void IDP_FreeIterBeforeEnd(void *vself)
This is because all ID Property freeing functions free only direct data (not the ID Property
struct itself), but for Groups the child properties *are* considered
direct data.*/
-void IDP_FreeGroup(IDProperty *prop)
+static void IDP_FreeGroup(IDProperty *prop)
{
IDProperty *loop, *next;
for (loop=prop->data.group.first; loop; loop=next)
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 27fa00ac239..18570515057 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -585,7 +585,7 @@ void tag_image_time(Image *ima)
ima->lastused = (int)PIL_check_seconds_timer();
}
-void tag_all_images_time()
+static void tag_all_images_time()
{
Image *ima;
int ctime = (int)PIL_check_seconds_timer();
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 1448ff8e417..a115ac39e1a 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -23,7 +23,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): 2008, Joshua Leung (IPO System cleanup)
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -77,11 +77,16 @@
#define SMALL -1.0e-10
+/* ***************************** Adrcode Blocktype Defines ********************************* */
+
/* This array concept was meant to make sure that defines such as OB_LOC_X
don't have to be enumerated, also for backward compatibility, future changes,
and to enable it all can be accessed with a for-next loop.
+
+ This should whole adrcode system should eventually be replaced by a proper Data API
*/
+
int co_ar[CO_TOTIPO]= {
CO_ENFORCE, CO_HEADTAIL
};
@@ -151,9 +156,9 @@ int wo_ar[WO_TOTIPO]= {
};
int la_ar[LA_TOTIPO]= {
- LA_ENERGY, LA_COL_R, LA_COL_G, LA_COL_B,
+ LA_ENERGY, LA_COL_R, LA_COL_G, LA_COL_B,
LA_DIST, LA_SPOTSI, LA_SPOTBL,
- LA_QUAD1, LA_QUAD2, LA_HALOINT,
+ LA_QUAD1, LA_QUAD2, LA_HALOINT,
MA_MAP1+MAP_OFS_X, MA_MAP1+MAP_OFS_Y, MA_MAP1+MAP_OFS_Z,
MA_MAP1+MAP_SIZE_X, MA_MAP1+MAP_SIZE_Y, MA_MAP1+MAP_SIZE_Z,
@@ -187,450 +192,605 @@ int part_ar[PART_TOTIPO]= {
PART_BB_TILT, PART_PD_FSTR, PART_PD_FFALL, PART_PD_FMAXD, PART_PD2_FSTR, PART_PD2_FFALL, PART_PD2_FMAXD
};
+/* ************************** Data-Level Functions ************************* */
+
+/* ---------------------- Freeing --------------------------- */
-float frame_to_float(int cfra) /* see also bsystem_time in object.c */
+/* frees the ipo curve itself too */
+void free_ipo_curve (IpoCurve *icu)
{
- extern float bluroffs; /* bad stuff borrowed from object.c */
- extern float fieldoffs;
- float ctime;
+ if (icu == NULL)
+ return;
- ctime= (float)cfra;
- ctime+= bluroffs+fieldoffs;
- ctime*= G.scene->r.framelen;
+ if (icu->bezt)
+ MEM_freeN(icu->bezt);
+ if (icu->driver)
+ MEM_freeN(icu->driver);
- return ctime;
-}
-
-/* includes ipo curve itself */
-void free_ipo_curve(IpoCurve *icu)
-{
- if(icu->bezt) MEM_freeN(icu->bezt);
- if(icu->bp) MEM_freeN(icu->bp);
- if(icu->driver) MEM_freeN(icu->driver);
MEM_freeN(icu);
}
/* do not free ipo itself */
-void free_ipo(Ipo *ipo)
+void free_ipo (Ipo *ipo)
{
- IpoCurve *icu;
+ IpoCurve *icu, *icn;
- while( (icu= ipo->curve.first) ) {
+ if (ipo == NULL)
+ return;
+
+ for (icu= ipo->curve.first; icu; icu= icn) {
+ icn= icu->next;
+
+ /* must remove the link before freeing, as the curve is freed too */
BLI_remlink(&ipo->curve, icu);
free_ipo_curve(icu);
}
}
+/* ---------------------- Init --------------------------- */
+
/* on adding new ipos, or for empty views */
-void ipo_default_v2d_cur(int blocktype, rctf *cur)
+void ipo_default_v2d_cur (int blocktype, rctf *cur)
{
- if(blocktype==ID_CA) {
+ switch (blocktype) {
+ case ID_CA:
cur->xmin= G.scene->r.sfra;
cur->xmax= G.scene->r.efra;
cur->ymin= 0.0;
cur->ymax= 100.0;
- }
- else if ELEM5(blocktype, ID_MA, ID_CU, ID_WO, ID_LA, ID_CO) {
+ break;
+
+ case ID_MA: case ID_WO: case ID_LA:
+ case ID_CU: case ID_CO:
cur->xmin= (float)G.scene->r.sfra-0.1;
cur->xmax= G.scene->r.efra;
cur->ymin= (float)-0.1;
cur->ymax= (float)+1.1;
- }
- else if(blocktype==ID_TE) {
+ break;
+
+ case ID_TE:
cur->xmin= (float)G.scene->r.sfra-0.1;
cur->xmax= G.scene->r.efra;
cur->ymin= (float)-0.1;
cur->ymax= (float)+1.1;
- }
- else if(blocktype==ID_SEQ) {
+ break;
+
+ case ID_SEQ:
cur->xmin= -5.0;
cur->xmax= 105.0;
cur->ymin= (float)-0.1;
cur->ymax= (float)+1.1;
- }
- else if(blocktype==ID_KE) {
+ break;
+
+ case ID_KE:
cur->xmin= (float)G.scene->r.sfra-0.1;
cur->xmax= G.scene->r.efra;
cur->ymin= (float)-0.1;
cur->ymax= (float)+2.1;
- }
- else { /* ID_OB and everything else */
+ break;
+
+ default: /* ID_OB and everything else */
cur->xmin= G.scene->r.sfra;
cur->xmax= G.scene->r.efra;
cur->ymin= -5.0;
cur->ymax= +5.0;
+ break;
}
}
-
-Ipo *add_ipo(char *name, int idcode)
+/* create a new IPO block (allocates the block) */
+Ipo *add_ipo (char name[], int blocktype)
{
Ipo *ipo;
ipo= alloc_libblock(&G.main->ipo, ID_IP, name);
- ipo->blocktype= idcode;
- ipo_default_v2d_cur(idcode, &ipo->cur);
+ ipo->blocktype= blocktype;
+ ipo_default_v2d_cur(blocktype, &ipo->cur);
return ipo;
}
-Ipo *copy_ipo(Ipo *ipo)
+/* ---------------------- Copy --------------------------- */
+
+/* duplicate an IPO block and all its data */
+Ipo *copy_ipo (Ipo *src)
{
- Ipo *ipon;
+ Ipo *dst;
IpoCurve *icu;
- if(ipo==NULL) return 0;
-
- ipon= copy_libblock(ipo);
+ if (src == NULL)
+ return NULL;
- duplicatelist(&(ipon->curve), &(ipo->curve));
+ dst= copy_libblock(src);
+ duplicatelist(&dst->curve, &src->curve);
- for(icu= ipo->curve.first; icu; icu= icu->next) {
+ for (icu= src->curve.first; icu; icu= icu->next) {
icu->bezt= MEM_dupallocN(icu->bezt);
- if(icu->driver) icu->driver= MEM_dupallocN(icu->driver);
+
+ if (icu->driver)
+ icu->driver= MEM_dupallocN(icu->driver);
}
- return ipon;
+ return dst;
}
-/* uses id->newid to match pointers with other copied data */
-void ipo_idnew(Ipo *ipo)
+/* ---------------------- Relink --------------------------- */
+
+/* uses id->newid to match pointers with other copied data
+ * - called after single-user or other such
+ */
+void ipo_idnew (Ipo *ipo)
{
- if(ipo) {
+ if (ipo) {
IpoCurve *icu;
- for(icu= ipo->curve.first; icu; icu= icu->next) {
- if(icu->driver) {
+ for (icu= ipo->curve.first; icu; icu= icu->next) {
+ if (icu->driver)
ID_NEW(icu->driver->ob);
- }
}
}
}
-void make_local_obipo(Ipo *ipo)
+/* --------------------- Find + Check ----------------------- */
+
+/* find the IPO-curve within a given IPO-block with the adrcode of interest */
+IpoCurve *find_ipocurve (Ipo *ipo, int adrcode)
+{
+ if (ipo) {
+ IpoCurve *icu;
+
+ for (icu= ipo->curve.first; icu; icu= icu->next) {
+ if (icu->adrcode == adrcode)
+ return icu;
+ }
+ }
+ return NULL;
+}
+
+/* return whether the given IPO block has a IPO-curve with the given adrcode */
+short has_ipo_code(Ipo *ipo, int adrcode)
+{
+ /* return success of faliure from trying to find such an IPO-curve */
+ return (find_ipocurve(ipo, adrcode) != NULL);
+}
+
+/* ---------------------- Make Local --------------------------- */
+
+
+/* make the given IPO local (for Objects)
+ * - only lib users: do nothing
+ * - only local users: set flag
+ * - mixed: make copy
+ */
+void make_local_obipo (Ipo *src)
{
Object *ob;
- Ipo *ipon;
+ Ipo *dst;
int local=0, lib=0;
- /* - only lib users: do nothing
- * - only local users: set flag
- * - mixed: make copy
- */
-
- ob= G.main->object.first;
- while(ob) {
- if(ob->ipo==ipo) {
- if(ob->id.lib) lib= 1;
+ /* check if only local and/or lib */
+ for (ob= G.main->object.first; ob; ob= ob->id.next) {
+ if (ob->ipo == src) {
+ if (ob->id.lib) lib= 1;
else local= 1;
}
- ob= ob->id.next;
}
- if(local && lib==0) {
- ipo->id.lib= 0;
- ipo->id.flag= LIB_LOCAL;
- new_id(0, (ID *)ipo, 0);
+ /* only local - set flag */
+ if (local && lib==0) {
+ src->id.lib= 0;
+ src->id.flag= LIB_LOCAL;
+ new_id(0, (ID *)src, 0);
}
- else if(local && lib) {
- ipon= copy_ipo(ipo);
- ipon->id.us= 0;
+ /* mixed: make copy */
+ else if (local && lib) {
+ dst= copy_ipo(src);
+ dst->id.us= 0;
- ob= G.main->object.first;
- while(ob) {
- if(ob->ipo==ipo) {
-
- if(ob->id.lib==NULL) {
- ob->ipo= ipon;
- ipon->id.us++;
- ipo->id.us--;
+ for (ob= G.main->object.first; ob; ob= ob->id.next) {
+ if (ob->ipo == src) {
+ if (ob->id.lib == NULL) {
+ ob->ipo= dst;
+ dst->id.us++;
+ src->id.us--;
}
}
- ob= ob->id.next;
}
}
}
-void make_local_matipo(Ipo *ipo)
+/* make the given IPO local (for Materials)
+ * - only lib users: do nothing
+ * - only local users: set flag
+ * - mixed: make copy
+ */
+void make_local_matipo (Ipo *src)
{
Material *ma;
- Ipo *ipon;
+ Ipo *dst;
int local=0, lib=0;
-
- /* - only lib users: do nothing
- * - only local users: set flag
- * - mixed: make copy
- */
- ma= G.main->mat.first;
- while(ma) {
- if(ma->ipo==ipo) {
- if(ma->id.lib) lib= 1;
+ /* check if only local and/or lib */
+ for (ma= G.main->mat.first; ma; ma= ma->id.next) {
+ if (ma->ipo == src) {
+ if (ma->id.lib) lib= 1;
else local= 1;
}
- ma= ma->id.next;
}
- if(local && lib==0) {
- ipo->id.lib= 0;
- ipo->id.flag= LIB_LOCAL;
- new_id(0, (ID *)ipo, 0);
+ /* only local - set flag */
+ if (local && lib==0) {
+ src->id.lib= 0;
+ src->id.flag= LIB_LOCAL;
+ new_id(0, (ID *)src, 0);
}
- else if(local && lib) {
- ipon= copy_ipo(ipo);
- ipon->id.us= 0;
+ /* mixed: make copy */
+ else if (local && lib) {
+ dst= copy_ipo(src);
+ dst->id.us= 0;
- ma= G.main->mat.first;
- while(ma) {
- if(ma->ipo==ipo) {
-
- if(ma->id.lib==NULL) {
- ma->ipo= ipon;
- ipon->id.us++;
- ipo->id.us--;
+ for (ma= G.main->mat.first; ma; ma= ma->id.next) {
+ if (ma->ipo == src) {
+ if (ma->id.lib == NULL) {
+ ma->ipo= dst;
+ dst->id.us++;
+ src->id.us--;
}
}
- ma= ma->id.next;
}
}
}
-void make_local_keyipo(Ipo *ipo)
+/* make the given IPO local (for ShapeKeys)
+ * - only lib users: do nothing
+ * - only local users: set flag
+ * - mixed: make copy
+ */
+void make_local_keyipo (Ipo *src)
{
Key *key;
- Ipo *ipon;
+ Ipo *dst;
int local=0, lib=0;
-
- /* - only lib users: do nothing
- * - only local users: set flag
- * - mixed: make copy
- */
- key= G.main->key.first;
- while(key) {
- if(key->ipo==ipo) {
- if(key->id.lib) lib= 1;
+ /* check if only local and/or lib */
+ for (key= G.main->key.first; key; key= key->id.next) {
+ if (key->ipo == src) {
+ if (key->id.lib) lib= 1;
else local= 1;
}
- key= key->id.next;
}
- if(local && lib==0) {
- ipo->id.lib= 0;
- ipo->id.flag= LIB_LOCAL;
- new_id(0, (ID *)ipo, 0);
+ /* only local - set flag */
+ if (local && lib==0) {
+ src->id.lib= 0;
+ src->id.flag= LIB_LOCAL;
+ new_id(0, (ID *)src, 0);
}
- else if(local && lib) {
- ipon= copy_ipo(ipo);
- ipon->id.us= 0;
+ /* mixed: make copy */
+ else if (local && lib) {
+ dst= copy_ipo(src);
+ dst->id.us= 0;
- key= G.main->key.first;
- while(key) {
- if(key->ipo==ipo) {
-
- if(key->id.lib==NULL) {
- key->ipo= ipon;
- ipon->id.us++;
- ipo->id.us--;
+ for (key= G.main->key.first; key; key= key->id.next) {
+ if (key->ipo == src) {
+ if (key->id.lib == NULL) {
+ key->ipo= dst;
+ dst->id.us++;
+ src->id.us--;
}
}
- key= key->id.next;
}
}
}
-void make_local_ipo(Ipo *ipo)
+/* generic call to make IPO's local */
+void make_local_ipo (Ipo *ipo)
{
-
- if(ipo->id.lib==NULL) return;
- if(ipo->id.us==1) {
+ /* can't touch lib-linked data */
+ if (ipo->id.lib == NULL)
+ return;
+
+ /* with only one user, just set local flag */
+ if (ipo->id.us == 1) {
ipo->id.lib= 0;
ipo->id.flag= LIB_LOCAL;
new_id(0, (ID *)ipo, 0);
return;
}
- if(ipo->blocktype==ID_OB) make_local_obipo(ipo);
- else if(ipo->blocktype==ID_MA) make_local_matipo(ipo);
- else if(ipo->blocktype==ID_KE) make_local_keyipo(ipo);
-
+ /* when more than 1 user, can only make local for certain blocktypes */
+ switch (ipo->blocktype) {
+ case ID_OB:
+ make_local_obipo(ipo);
+ break;
+ case ID_MA:
+ make_local_matipo(ipo);
+ break;
+ case ID_KE:
+ make_local_keyipo(ipo);
+ break;
+ }
}
-IpoCurve *find_ipocurve(Ipo *ipo, int adrcode)
+/* ***************************** Keyframe Column Tools ********************************* */
+
+/* add a BezTriple to a column */
+void add_to_cfra_elem(ListBase *lb, BezTriple *bezt)
{
- if(ipo) {
- IpoCurve *icu;
- for(icu= ipo->curve.first; icu; icu= icu->next) {
- if(icu->adrcode==adrcode) return icu;
+ CfraElem *ce, *cen;
+
+ for (ce= lb->first; ce; ce= ce->next) {
+ /* double key? */
+ if (ce->cfra == bezt->vec[1][0]) {
+ if (bezt->f2 & SELECT) ce->sel= bezt->f2;
+ return;
}
+ /* should key be inserted before this column? */
+ else if (ce->cfra > bezt->vec[1][0]) break;
}
- return NULL;
+
+ /* create a new column */
+ cen= MEM_callocN(sizeof(CfraElem), "add_to_cfra_elem");
+ if (ce) BLI_insertlinkbefore(lb, ce, cen);
+ else BLI_addtail(lb, cen);
+
+ cen->cfra= bezt->vec[1][0];
+ cen->sel= bezt->f2;
}
-void calchandles_ipocurve(IpoCurve *icu)
+/* make a list of keyframe 'columns' in an IPO block */
+void make_cfra_list (Ipo *ipo, ListBase *elems)
{
- BezTriple *bezt, *prev, *next;
+ IpoCurve *icu;
+ BezTriple *bezt;
int a;
+
+ for (icu= ipo->curve.first; icu; icu= icu->next) {
+ if (icu->flag & IPO_VISIBLE) {
+ /* ... removed old checks for adrcode types from here ...
+ * - (was this used for IpoKeys in the past?)
+ */
+
+ bezt= icu->bezt;
+ if (bezt) {
+ for (a=0; a < icu->totvert; a++, bezt++) {
+ add_to_cfra_elem(elems, bezt);
+ }
+ }
+ }
+ }
+}
+
+/* ***************************** Timing Stuff ********************************* */
- a= icu->totvert;
+/* This (evil) function is needed to cope with two legacy Blender rendering features
+ * mblur (motion blur that renders 'subframes' and blurs them together), and fields
+ * rendering. Thus, the use of ugly globals from object.c
+ */
+// BAD... EVIL... JUJU...!!!!
+float frame_to_float (int cfra) /* see also bsystem_time in object.c */
+{
+ extern float bluroffs; /* bad stuff borrowed from object.c */
+ extern float fieldoffs;
+ float ctime;
- /* IPO_CONST doesn't have handles */
- if(a<2 || icu->ipo==IPO_CONST) return;
+ ctime= (float)cfra;
+ ctime+= bluroffs+fieldoffs;
+ ctime*= G.scene->r.framelen;
- bezt= icu->bezt;
- prev= 0;
- next= bezt+1;
+ return ctime;
+}
- while(a--) {
+/* ***************************** IPO Curve Sanity ********************************* */
+/* The functions here are used in various parts of Blender, usually after some editing
+ * of keyframe data has occurred. They ensure that keyframe data is properly ordered and
+ * that the handles are correctly
+ */
- if(bezt->vec[0][0]>bezt->vec[1][0]) bezt->vec[0][0]= bezt->vec[1][0];
- if(bezt->vec[2][0]<bezt->vec[1][0]) bezt->vec[2][0]= bezt->vec[1][0];
+/* This function recalculates the handles of an IPO-Curve
+ * If the BezTriples have been rearranged, sort them first before using this.
+ */
+void calchandles_ipocurve (IpoCurve *icu)
+{
+ BezTriple *bezt, *prev, *next;
+ int a= icu->totvert;
- if(icu->flag & IPO_AUTO_HORIZ)
+ /* Error checking:
+ * - need at least two points
+ * - need bezier keys
+ * - only bezier-interpolation has handles (for now)
+ */
+ if (ELEM(NULL, icu, icu->bezt) || (a < 2) || ELEM(icu->ipo, IPO_CONST, IPO_LIN))
+ return;
+
+ /* get initial pointers */
+ bezt= icu->bezt;
+ prev= NULL;
+ next= (bezt + 1);
+
+ /* loop over all beztriples, adjusting handles */
+ while (a--) {
+ /* clamp timing of handles to be on either side of beztriple */
+ if (bezt->vec[0][0] > bezt->vec[1][0]) bezt->vec[0][0]= bezt->vec[1][0];
+ if (bezt->vec[2][0] < bezt->vec[1][0]) bezt->vec[2][0]= bezt->vec[1][0];
+
+ /* calculate autohandles */
+ if (icu->flag & IPO_AUTO_HORIZ)
calchandleNurb(bezt, prev, next, 2); /* 2==special autohandle && keep extrema horizontal */
else
calchandleNurb(bezt, prev, next, 1); /* 1==special autohandle */
-
- prev= bezt;
- if(a==1) {
- next= 0;
- }
- else next++;
-
+
/* for automatic ease in and out */
- if(bezt->h1==HD_AUTO && bezt->h2==HD_AUTO) {
- if(a==0 || a==icu->totvert-1) {
- if(icu->extrap==IPO_HORIZ) {
+ if ((bezt->h1==HD_AUTO) && (bezt->h2==HD_AUTO)) {
+ /* only do this on first or last beztriple */
+ if ((a==0) || (a==icu->totvert-1)) {
+ /* set both handles to have same horizontal value as keyframe */
+ if (icu->extrap==IPO_HORIZ) {
bezt->vec[0][1]= bezt->vec[2][1]= bezt->vec[1][1];
}
}
}
+ /* advance pointers for next iteration */
+ prev= bezt;
+ if (a == 1) next= NULL;
+ else next++;
bezt++;
}
}
-void testhandles_ipocurve(IpoCurve *icu)
+/* Use when IPO-Curve with handles has changed
+ * It treats all BezTriples with the following rules:
+ * - PHASE 1: do types have to be altered?
+ * -> Auto handles: become aligned when selection status is NOT(000 || 111)
+ * -> Vector handles: become 'nothing' when (one half selected AND other not)
+ * - PHASE 2: recalculate handles
+*/
+void testhandles_ipocurve (IpoCurve *icu)
{
- /* use when something has changed with handles.
- it treats all BezTriples with the following rules:
- PHASE 1: do types have to be altered?
- Auto handles: become aligned when selection status is NOT(000 || 111)
- Vector handles: become 'nothing' when (one half selected AND other not)
- PHASE 2: recalculate handles
- */
- BezTriple *bezt;
- int flag, a;
+ BezTriple *bezt;
+ int a;
- bezt= icu->bezt;
- if(bezt==NULL) return;
+ /* only beztriples have handles (bpoints don't though) */
+ if (ELEM(NULL, icu, icu->bezt))
+ return;
- a= icu->totvert;
- while(a--) {
- flag= 0;
- if(bezt->f1 & SELECT) flag++;
- if(bezt->f2 & SELECT) flag += 2;
- if(bezt->f3 & SELECT) flag += 4;
-
- if( !(flag==0 || flag==7) ) {
- if(bezt->h1==HD_AUTO) { /* auto */
+ /* loop over beztriples */
+ for (a=0, bezt=icu->bezt; a < icu->totvert; a++, bezt++) {
+ short flag= 0;
+
+ /* flag is initialised as selection status
+ * of beztriple control-points (labelled 0,1,2)
+ */
+ if (bezt->f1 & SELECT) flag |= (1<<0); // == 1
+ if (bezt->f2 & SELECT) flag |= (1<<1); // == 2
+ if (bezt->f3 & SELECT) flag |= (1<<2); // == 4
+
+ /* one or two handles selected only */
+ if (ELEM(flag, 0, 7)==0) {
+ /* auto handles become aligned */
+ if (bezt->h1==HD_AUTO)
bezt->h1= HD_ALIGN;
- }
- if(bezt->h2==HD_AUTO) { /* auto */
+ if(bezt->h2==HD_AUTO)
bezt->h2= HD_ALIGN;
+
+ /* vector handles become 'free' when only one half selected */
+ if(bezt->h1==HD_VECT) {
+ /* only left half (1 or 2 or 1+2) */
+ if (flag < 4)
+ bezt->h1= 0;
}
-
- if(bezt->h1==HD_VECT) { /* vector */
- if(flag < 4) bezt->h1= 0;
- }
- if(bezt->h2==HD_VECT) { /* vector */
- if( flag > 3) bezt->h2= 0;
+ if(bezt->h2==HD_VECT) {
+ /* only right half (4 or 2+4) */
+ if (flag > 3)
+ bezt->h2= 0;
}
}
- bezt++;
}
+ /* recalculate handles */
calchandles_ipocurve(icu);
}
-
+/* This function sorts BezTriples so that they are arranged in chronological order,
+ * as tools working on IPO-Curves expect that the BezTriples are in order.
+ */
void sort_time_ipocurve(IpoCurve *icu)
{
- BezTriple *bezt;
- int a, ok= 1;
+ short ok= 1;
- while(ok) {
+ /* keep adjusting order of beztriples until nothing moves (bubble-sort) */
+ while (ok) {
ok= 0;
-
- if(icu->bezt) {
- bezt= icu->bezt;
- a= icu->totvert;
- while(a--) {
- if(a>0) {
- if( bezt->vec[1][0] > (bezt+1)->vec[1][0]) {
+
+ /* currently, will only be needed when there are beztriples */
+ if (icu->bezt) {
+ BezTriple *bezt;
+ int a;
+
+ /* loop over ALL points to adjust position in array and recalculate handles */
+ for (a=0, bezt=icu->bezt; a < icu->totvert; a++, bezt++) {
+ /* check if thee's a next beztriple which we could try to swap with current */
+ if (a < (icu->totvert-1)) {
+ /* swap if one is after the other (and indicate that order has changed) */
+ if (bezt->vec[1][0] > (bezt+1)->vec[1][0]) {
SWAP(BezTriple, *bezt, *(bezt+1));
ok= 1;
}
+
+ /* if either one of both of the points exceeds crosses over the keyframe time... */
+ if ( (bezt->vec[0][0] > bezt->vec[1][0]) && (bezt->vec[2][0] < bezt->vec[1][0]) ) {
+ /* swap handles if they have switched sides for some reason */
+ SWAP(float, bezt->vec[0][0], bezt->vec[2][0]);
+ SWAP(float, bezt->vec[0][1], bezt->vec[2][1]);
+ }
+ else {
+ /* clamp handles */
+ if (bezt->vec[0][0] > bezt->vec[1][0])
+ bezt->vec[0][0]= bezt->vec[1][0];
+ if (bezt->vec[2][0] < bezt->vec[1][0])
+ bezt->vec[2][0]= bezt->vec[1][0];
+ }
}
- if(bezt->vec[0][0]>bezt->vec[1][0] && bezt->vec[2][0]<bezt->vec[1][0]) {
- SWAP(float, bezt->vec[0][0], bezt->vec[2][0]);
- SWAP(float, bezt->vec[0][1], bezt->vec[2][1]);
- }
- else {
- if(bezt->vec[0][0]>bezt->vec[1][0]) bezt->vec[0][0]= bezt->vec[1][0];
- if(bezt->vec[2][0]<bezt->vec[1][0]) bezt->vec[2][0]= bezt->vec[1][0];
- }
- bezt++;
}
}
- else {
-
- }
}
}
-int test_time_ipocurve(IpoCurve *icu)
+/* This function tests if any BezTriples are out of order, thus requiring a sort */
+int test_time_ipocurve (IpoCurve *icu)
{
- BezTriple *bezt;
int a;
- if(icu->bezt) {
- bezt= icu->bezt;
- a= icu->totvert-1;
- while(a--) {
- if( bezt->vec[1][0] > (bezt+1)->vec[1][0]) {
- return 1;
- }
- bezt++;
- }
- }
- else {
+ /* currently, only need to test beztriples */
+ if (icu->bezt) {
+ BezTriple *bezt;
+ /* loop through all beztriples, stopping when one exceeds the one after it */
+ for (a=0, bezt= icu->bezt; a < (icu->totvert - 1); a++, bezt++) {
+ if (bezt->vec[1][0] > (bezt+1)->vec[1][0])
+ return 1;
+ }
}
-
+
+ /* none need any swapping */
return 0;
}
-void correct_bezpart(float *v1, float *v2, float *v3, float *v4)
+/* --------- */
+
+/* The total length of the handles is not allowed to be more
+ * than the horizontal distance between (v1-v4).
+ * This is to prevent curve loops.
+*/
+void correct_bezpart (float *v1, float *v2, float *v3, float *v4)
{
- /* the total length of the handles is not allowed to be more
- * than the horizontal distance between (v1-v4)
- * this to prevent curve loops
- */
float h1[2], h2[2], len1, len2, len, fac;
+ /* calculate handle deltas */
h1[0]= v1[0]-v2[0];
h1[1]= v1[1]-v2[1];
h2[0]= v4[0]-v3[0];
h2[1]= v4[1]-v3[1];
+ /* calculate distances:
+ * - len = span of time between keyframes
+ * - len1 = length of handle of start key
+ * - len2 = length of handle of end key
+ */
len= v4[0]- v1[0];
len1= (float)fabs(h1[0]);
len2= (float)fabs(h2[0]);
- if(len1+len2==0.0) return;
- if(len1+len2 > len) {
+ /* if the handles have no length, no need to do any corrections */
+ if ((len1+len2) == 0.0)
+ return;
+
+ /* the two handles cross over each other, so force them
+ * apart using the proportion they overlap
+ */
+ if ((len1+len2) > len) {
fac= len/(len1+len2);
v2[0]= (v1[0]-fac*h1[0]);
@@ -638,57 +798,86 @@ void correct_bezpart(float *v1, float *v2, float *v3, float *v4)
v3[0]= (v4[0]-fac*h2[0]);
v3[1]= (v4[1]-fac*h2[1]);
-
}
}
-/* *********************** ARITH *********************** */
+#if 0 // TODO: enable when we have per-segment interpolation
+/* This function sets the interpolation mode for an entire Ipo-Curve.
+ * It is primarily used for patching old files, but is also used in the interface
+ * to make sure that all segments of the curve use the same interpolation.
+ */
+void set_interpolation_ipocurve (IpoCurve *icu, short ipo)
+{
+ BezTriple *bezt;
+ int a;
+
+ /* validate arguments */
+ if (icu == NULL) return;
+ if (ELEM3(ipo, IPO_CONST, IPO_LIN, IPO_BEZ)==0) return;
-int findzero(float x, float q0, float q1, float q2, float q3, float *o)
+ /* set interpolation mode for whole curve */
+ icu->ipo= ipo;
+
+ /* set interpolation mode of all beztriples */
+ for (a=0, bezt=icu->bezt; a<icu->totvert; a++, bezt++)
+ bezt->ipo= ipo;
+}
+#endif // TODO: enable when we have per-segment interpolation
+
+/* ***************************** Curve Calculations ********************************* */
+
+/* find root/zero */
+int findzero (float x, float q0, float q1, float q2, float q3, float *o)
{
double c0, c1, c2, c3, a, b, c, p, q, d, t, phi;
int nr= 0;
- c0= q0-x;
- c1= 3*(q1-q0);
- c2= 3*(q0-2*q1+q2);
- c3= q3-q0+3*(q1-q2);
+ c0= q0 - x;
+ c1= 3 * (q1 - q0);
+ c2= 3 * (q0 - 2*q1 + q2);
+ c3= q3 - q0 + 3 * (q1 - q2);
- if(c3!=0.0) {
+ if (c3 != 0.0) {
a= c2/c3;
b= c1/c3;
c= c0/c3;
a= a/3;
-
- p= b/3-a*a;
- q= (2*a*a*a-a*b+c)/2;
- d= q*q+p*p*p;
-
- if(d>0.0) {
+
+ p= b/3 - a*a;
+ q= (2*a*a*a - a*b + c) / 2;
+ d= q*q + p*p*p;
+
+ if (d > 0.0) {
t= sqrt(d);
- o[0]= (float)(Sqrt3d(-q+t)+Sqrt3d(-q-t)-a);
- if(o[0]>= SMALL && o[0]<=1.000001) return 1;
+ o[0]= (float)(Sqrt3d(-q+t) + Sqrt3d(-q-t) - a);
+
+ if ((o[0] >= SMALL) && (o[0] <= 1.000001)) return 1;
else return 0;
}
- else if(d==0.0) {
+ else if (d == 0.0) {
t= Sqrt3d(-q);
- o[0]= (float)(2*t-a);
- if(o[0]>=SMALL && o[0]<=1.000001) nr++;
+ o[0]= (float)(2*t - a);
+
+ if ((o[0] >= SMALL) && (o[0] <= 1.000001)) nr++;
o[nr]= (float)(-t-a);
- if(o[nr]>=SMALL && o[nr]<=1.000001) return nr+1;
+
+ if ((o[nr] >= SMALL) && (o[nr] <= 1.000001)) return nr+1;
else return nr;
}
else {
- phi= acos(-q/sqrt(-(p*p*p)));
+ phi= acos(-q / sqrt(-(p*p*p)));
t= sqrt(-p);
p= cos(phi/3);
- q= sqrt(3-3*p*p);
- o[0]= (float)(2*t*p-a);
- if(o[0]>=SMALL && o[0]<=1.000001) nr++;
- o[nr]= (float)(-t*(p+q)-a);
- if(o[nr]>=SMALL && o[nr]<=1.000001) nr++;
- o[nr]= (float)(-t*(p-q)-a);
- if(o[nr]>=SMALL && o[nr]<=1.000001) return nr+1;
+ q= sqrt(3 - 3*p*p);
+ o[0]= (float)(2*t*p - a);
+
+ if ((o[0] >= SMALL) && (o[0] <= 1.000001)) nr++;
+ o[nr]= (float)(-t * (p + q) - a);
+
+ if ((o[nr] >= SMALL) && (o[nr] <= 1.000001)) nr++;
+ o[nr]= (float)(-t * (p - q) - a);
+
+ if ((o[nr] >= SMALL) && (o[nr] <= 1.000001)) return nr+1;
else return nr;
}
}
@@ -697,83 +886,97 @@ int findzero(float x, float q0, float q1, float q2, float q3, float *o)
b=c1;
c=c0;
- if(a!=0.0) {
- p=b*b-4*a*c;
- if(p>0) {
+ if (a != 0.0) {
+ // discriminant
+ p= b*b - 4*a*c;
+
+ if (p > 0) {
p= sqrt(p);
- o[0]= (float)((-b-p)/(2*a));
- if(o[0]>=SMALL && o[0]<=1.000001) nr++;
+ o[0]= (float)((-b-p) / (2 * a));
+
+ if ((o[0] >= SMALL) && (o[0] <= 1.000001)) nr++;
o[nr]= (float)((-b+p)/(2*a));
- if(o[nr]>=SMALL && o[nr]<=1.000001) return nr+1;
+
+ if ((o[nr] >= SMALL) && (o[nr] <= 1.000001)) return nr+1;
else return nr;
}
- else if(p==0) {
- o[0]= (float)(-b/(2*a));
- if(o[0]>=SMALL && o[0]<=1.000001) return 1;
+ else if (p == 0) {
+ o[0]= (float)(-b / (2 * a));
+ if ((o[0] >= SMALL) && (o[0] <= 1.000001)) return 1;
else return 0;
}
}
- else if(b!=0.0) {
+ else if (b != 0.0) {
o[0]= (float)(-c/b);
- if(o[0]>=SMALL && o[0]<=1.000001) return 1;
+
+ if ((o[0] >= SMALL) && (o[0] <= 1.000001)) return 1;
else return 0;
}
- else if(c==0.0) {
+ else if (c == 0.0) {
o[0]= 0.0;
return 1;
}
+
return 0;
}
}
-void berekeny(float f1, float f2, float f3, float f4, float *o, int b)
+void berekeny (float f1, float f2, float f3, float f4, float *o, int b)
{
float t, c0, c1, c2, c3;
int a;
c0= f1;
- c1= 3.0f*(f2 - f1);
- c2= 3.0f*(f1 - 2.0f*f2 + f3);
- c3= f4 - f1 + 3.0f*(f2-f3);
+ c1= 3.0f * (f2 - f1);
+ c2= 3.0f * (f1 - 2.0f*f2 + f3);
+ c3= f4 - f1 + 3.0f * (f2 - f3);
- for(a=0; a<b; a++) {
+ for (a=0; a < b; a++) {
t= o[a];
- o[a]= c0+t*c1+t*t*c2+t*t*t*c3;
+ o[a]= c0 + t*c1 + t*t*c2 + t*t*t*c3;
}
}
-void berekenx(float *f, float *o, int b)
+void berekenx (float *f, float *o, int b)
{
float t, c0, c1, c2, c3;
int a;
c0= f[0];
- c1= 3*(f[3]-f[0]);
- c2= 3*(f[0]-2*f[3]+f[6]);
- c3= f[9]-f[0]+3*(f[3]-f[6]);
- for(a=0; a<b; a++) {
+ c1= 3 * (f[3] - f[0]);
+ c2= 3 * (f[0] - 2*f[3] + f[6]);
+ c3= f[9] - f[0] + 3 * (f[3] - f[6]);
+
+ for (a=0; a < b; a++) {
t= o[a];
- o[a]= c0+t*c1+t*t*c2+t*t*t*c3;
+ o[a]= c0 + t*c1 + t*t*c2 + t*t*t*c3;
}
}
-/* we need the local transform = current transform - (parent transform + bone transform) */
-/* (local transform is on action channel level) */
-static void posechannel_get_local_transform(bPoseChannel *pchan, float *loc, float *eul, float *size)
+/* ***************************** IPO - Calculations ********************************* */
+
+/* ---------------------- Curve Evaluation --------------------------- */
+
+/* helper function for evaluating drivers:
+ * - we need the local transform = current transform - (parent transform + bone transform)
+ * - (local transform is on action channel level)
+ */
+static void posechannel_get_local_transform (bPoseChannel *pchan, float loc[], float eul[], float size[])
{
- float diff_mat[4][4];
float parmat[4][4], offs_bone[4][4], imat[4][4];
+ float diff_mat[4][4];
+ /* get first the parent + bone transform in parmat */
if (pchan->parent) {
- /* get first the parent + bone transform in parmat */
-
/* bone transform itself */
Mat4CpyMat3(offs_bone, pchan->bone->bone_mat);
+
/* The bone's root offset (is in the parent's coordinate system) */
VECCOPY(offs_bone[3], pchan->bone->head);
+
/* Get the length translation of parent (length along y axis) */
offs_bone[3][1]+= pchan->parent->bone->length;
-
+
Mat4MulSerie(parmat, pchan->parent->pose_mat, offs_bone, NULL, NULL, NULL, NULL, NULL, NULL);
/* invert it */
@@ -782,63 +985,78 @@ static void posechannel_get_local_transform(bPoseChannel *pchan, float *loc, flo
else {
Mat4CpyMat3(offs_bone, pchan->bone->bone_mat);
VECCOPY(offs_bone[3], pchan->bone->head);
-
+
/* invert it */
Mat4Invert(imat, offs_bone);
-
}
/* difference: current transform - (parent transform + bone transform) */
Mat4MulMat4(diff_mat, pchan->pose_mat, imat);
- if(loc)
+ /* extract relevant components */
+ if (loc)
VECCOPY(loc, diff_mat[3]);
- if(eul)
+ if (eul)
Mat4ToEul(diff_mat, eul);
- if(size)
+ if (size)
Mat4ToSize(diff_mat, size);
-
}
-/* has to return a float value */
-static float eval_driver(IpoDriver *driver, float ipotime)
+/* evaluate an IPO-driver to get a 'time' value to use instead of "ipotime"
+ * - "ipotime" is the frame at which IPO-curve is being evaluated
+ * - has to return a float value
+ */
+static float eval_driver (IpoDriver *driver, float ipotime)
{
-
- if(driver->type == IPO_DRIVER_TYPE_PYTHON) {
+ /* currently, drivers are either PyDrivers (evaluating a PyExpression, or Object/Pose-Channel transforms) */
+ if (driver->type == IPO_DRIVER_TYPE_PYTHON) {
/* check for empty or invalid expression */
- if ((driver->name[0] == '\0') ||
- (driver->flag & IPO_DRIVER_FLAG_INVALID))
+ if ( (driver->name[0] == '\0') ||
+ (driver->flag & IPO_DRIVER_FLAG_INVALID) )
+ {
return 0.0f;
- /* this evals the expression and returns its result:
- * (on errors it reports, then returns 0.0f) */
+ }
+
+ /* this evaluates the expression using Python,and returns its result:
+ * - on errors it reports, then returns 0.0f
+ */
return BPY_pydriver_eval(driver);
}
else {
Object *ob= driver->ob;
-
- if(ob==NULL) return 0.0f;
- if(ob->proxy_from)
+
+ /* must have an object to evaluate */
+ if (ob == NULL)
+ return 0.0f;
+
+ /* if a proxy, use the proxy source*/
+ if (ob->proxy_from)
ob= ob->proxy_from;
- if(driver->blocktype==ID_OB) {
- /* depsgraph failure; ob ipos are calculated in where_is_object, this might get called too late */
- if(ob->ipo && ob->ctime!=ipotime) {
+ /* use given object as driver */
+ if (driver->blocktype == ID_OB) {
+ /* depsgraph failure: ob ipos are calculated in where_is_object, this might get called too late */
+ if ((ob->ipo) && (ob->ctime != ipotime)) {
+ /* calculate the value of relevant channel on the Object, but do not write the value
+ * calculated on to the Object but onto "ipotime" instead
+ */
calc_ipo_spec(ob->ipo, driver->adrcode, &ipotime);
return ipotime;
}
- switch(driver->adrcode) {
+ /* return the value of the relevant channel */
+ switch (driver->adrcode) {
case OB_LOC_X:
return ob->loc[0];
case OB_LOC_Y:
return ob->loc[1];
case OB_LOC_Z:
return ob->loc[2];
- case OB_ROT_X:
+ case OB_ROT_X: /* hack: euler rotations are divided by 10 deg to fit on same axes as other channels */
return ob->rot[0]/(M_PI_2/9.0);
- case OB_ROT_Y:
+ case OB_ROT_Y: /* hack: euler rotations are divided by 10 deg to fit on same axes as other channels */
return ob->rot[1]/(M_PI_2/9.0);
- case OB_ROT_Z:
+ case OB_ROT_Z: /* hack: euler rotations are divided by 10 deg to fit on same axes as other channels */
return ob->rot[2]/(M_PI_2/9.0);
case OB_SIZE_X:
return ob->size[0];
@@ -848,14 +1066,20 @@ static float eval_driver(IpoDriver *driver, float ipotime)
return ob->size[2];
}
}
+
+ /* use given pose-channel as driver */
else { /* ID_AR */
bPoseChannel *pchan= get_pose_channel(ob->pose, driver->name);
- if(pchan && pchan->bone) {
-
- /* rotation difference is not a simple driver (i.e. value drives value), but the angle between 2 bones is driving stuff... which is useful */
- if(driver->adrcode==OB_ROT_DIFF) {
+
+ /* must have at least 1 bone to use */
+ if (pchan && pchan->bone) {
+ /* rotation difference is not a simple driver (i.e. value drives value), but the angle between 2 bones is driving stuff...
+ * - the name of the second pchan is also stored in driver->name, but packed after the other one by DRIVER_NAME_OFFS chars
+ */
+ if (driver->adrcode == OB_ROT_DIFF) {
bPoseChannel *pchan2= get_pose_channel(ob->pose, driver->name+DRIVER_NAME_OFFS);
- if(pchan2 && pchan2->bone) {
+
+ if (pchan2 && pchan2->bone) {
float q1[4], q2[4], quat[4], angle;
Mat4ToQuat(pchan->pose_mat, q1);
@@ -866,26 +1090,32 @@ static float eval_driver(IpoDriver *driver, float ipotime)
angle = 2.0f * (saacos(quat[0]));
angle= ABS(angle);
- return angle>M_PI?2.0f*M_PI-angle:angle;
+ return (angle > M_PI) ? ((2.0f * M_PI) - angle) : (angle);
}
}
+
+ /* standard driver */
else {
float loc[3], eul[3], size[3];
+ /* retrieve local transforms to return
+ * - we use eulers here NOT quats, so that Objects can be driven by bones easily
+ * also, this way is more understandable for users
+ */
posechannel_get_local_transform(pchan, loc, eul, size);
-
- switch(driver->adrcode) {
+
+ switch (driver->adrcode) {
case OB_LOC_X:
return loc[0];
case OB_LOC_Y:
return loc[1];
case OB_LOC_Z:
return loc[2];
- case OB_ROT_X:
+ case OB_ROT_X: /* hack: euler rotations are divided by 10 deg to fit on same axes as other channels */
return eul[0]/(M_PI_2/9.0);
- case OB_ROT_Y:
+ case OB_ROT_Y: /* hack: euler rotations are divided by 10 deg to fit on same axes as other channels */
return eul[1]/(M_PI_2/9.0);
- case OB_ROT_Z:
+ case OB_ROT_Z: /* hack: euler rotations are divided by 10 deg to fit on same axes as other channels */
return eul[2]/(M_PI_2/9.0);
case OB_SIZE_X:
return size[0];
@@ -898,227 +1128,722 @@ static float eval_driver(IpoDriver *driver, float ipotime)
}
}
}
+
+ /* return 0.0f, as couldn't find relevant data to use */
return 0.0f;
}
-float eval_icu(IpoCurve *icu, float ipotime)
+/* evaluate and return the value of the given IPO-curve at the specified frame ("evaltime") */
+float eval_icu(IpoCurve *icu, float evaltime)
{
- BezTriple *bezt, *prevbezt;
- float v1[2], v2[2], v3[2], v4[2], opl[32], dx, fac;
- float cycdx, cycdy, ofs, cycyofs, cvalue = 0.0;
- int a, b;
-
- cycyofs= 0.0;
+ float cvalue = 0.0f;
- if(icu->driver) {
+ /* if there is a driver, evaluate it to find value to use as "evaltime"
+ * - this value will also be returned as the value of the 'curve', if there are no keyframes
+ */
+ if (icu->driver) {
/* ipotime now serves as input for the curve */
- ipotime= cvalue= eval_driver(icu->driver, ipotime);
+ evaltime= cvalue= eval_driver(icu->driver, evaltime);
}
- if(icu->bezt) {
+
+ /* there are keyframes (in the form of BezTriples) which can be interpolated between */
+ if (icu->bezt) {
+ /* get pointers */
+ BezTriple *bezt, *prevbezt, *lastbezt;
+ float v1[2], v2[2], v3[2], v4[2], opl[32], dx, fac;
+ float cycdx, cycdy, ofs, cycyofs= 0.0;
+ int a, b;
+
+ /* get pointers */
+ a= icu->totvert-1;
prevbezt= icu->bezt;
bezt= prevbezt+1;
- a= icu->totvert-1;
+ lastbezt= prevbezt + a;
- /* cyclic? */
- if(icu->extrap & IPO_CYCL) {
- ofs= icu->bezt->vec[1][0];
- cycdx= (icu->bezt+icu->totvert-1)->vec[1][0] - ofs;
- cycdy= (icu->bezt+icu->totvert-1)->vec[1][1] - icu->bezt->vec[1][1];
- if(cycdx!=0.0) {
-
- if(icu->extrap & IPO_DIR) {
- cycyofs= (float)floor((ipotime-ofs)/cycdx);
- cycyofs*= cycdy;
+ /* extrapolation mode is 'cyclic' - find relative place within a cycle */
+ if (icu->extrap & IPO_CYCL) {
+ /* ofs is start frame of cycle */
+ ofs= prevbezt->vec[1][0];
+
+ /* calculate period and amplitude (total height) of a cycle */
+ cycdx= lastbezt->vec[1][0] - prevbezt->vec[1][0];
+ cycdy= lastbezt->vec[1][1] - prevbezt->vec[1][1];
+
+ /* cycle occurs over some period of time (cycdx should be positive all the time) */
+ if (cycdx) {
+ /* check if 'cyclic extrapolation', and thus calculate y-offset for this cycle
+ * - IPO_CYCLX = (IPO_CYCL + IPO_DIR)
+ */
+ if (icu->extrap & IPO_DIR) {
+ cycyofs = (float)floor((evaltime - ofs) / cycdx);
+ cycyofs *= cycdy;
}
-
- ipotime= (float)(fmod(ipotime-ofs, cycdx)+ofs);
- if(ipotime<ofs) ipotime+= cycdx;
+
+ /* calculate where in the cycle we are (overwrite evaltime to reflect this) */
+ evaltime= (float)(fmod(evaltime-ofs, cycdx) + ofs);
+ if (evaltime < ofs) evaltime += cycdx;
}
}
- /* endpoints? */
-
- if(prevbezt->vec[1][0]>=ipotime) {
- if( (icu->extrap & IPO_DIR) && icu->ipo!=IPO_CONST) {
- dx= prevbezt->vec[1][0]-ipotime;
- fac= prevbezt->vec[1][0]-prevbezt->vec[0][0];
- if(fac!=0.0) {
- fac= (prevbezt->vec[1][1]-prevbezt->vec[0][1])/fac;
- cvalue= prevbezt->vec[1][1]-fac*dx;
+ /* evaluation time at or past endpoints? */
+ // TODO: for per-bezt interpolation, replace all icu->ipo with (bezt)->ipo
+ if (prevbezt->vec[1][0] >= evaltime) {
+ /* before or on first keyframe */
+ if ((icu->extrap & IPO_DIR) && (icu->ipo != IPO_CONST)) {
+ /* linear or bezier interpolation */
+ if (icu->ipo==IPO_LIN) {
+ /* Use the next center point instead of our own handle for
+ * linear interpolated extrapolate
+ */
+ if (icu->totvert == 1)
+ cvalue= prevbezt->vec[1][1];
+ else {
+ bezt = prevbezt+1;
+ dx= prevbezt->vec[1][0] - evaltime;
+ fac= bezt->vec[1][0] - prevbezt->vec[1][0];
+
+ /* prevent division by zero */
+ if (fac) {
+ fac= (bezt->vec[1][1] - prevbezt->vec[1][1]) / fac;
+ cvalue= prevbezt->vec[1][1] - (fac * dx);
+ }
+ else
+ cvalue= prevbezt->vec[1][1];
+ }
+ }
+ else {
+ /* Use the first handle (earlier) of first BezTriple to calculate the
+ * gradient and thus the value of the curve at evaltime
+ */
+ dx= prevbezt->vec[1][0] - evaltime;
+ fac= prevbezt->vec[1][0] - prevbezt->vec[0][0];
+
+ /* prevent division by zero */
+ if (fac) {
+ fac= (prevbezt->vec[1][1] - prevbezt->vec[0][1]) / fac;
+ cvalue= prevbezt->vec[1][1] - (fac * dx);
+ }
+ else
+ cvalue= prevbezt->vec[1][1];
}
- else cvalue= prevbezt->vec[1][1];
}
- else cvalue= prevbezt->vec[1][1];
-
- cvalue+= cycyofs;
+ else {
+ /* constant (IPO_HORIZ) extrapolation or constant interpolation,
+ * so just extend first keyframe's value
+ */
+ cvalue= prevbezt->vec[1][1];
+ }
}
- else if( (prevbezt+a)->vec[1][0]<=ipotime) {
- if( (icu->extrap & IPO_DIR) && icu->ipo!=IPO_CONST) {
- prevbezt+= a;
- dx= ipotime-prevbezt->vec[1][0];
- fac= prevbezt->vec[2][0]-prevbezt->vec[1][0];
-
- if(fac!=0) {
- fac= (prevbezt->vec[2][1]-prevbezt->vec[1][1])/fac;
- cvalue= prevbezt->vec[1][1]+fac*dx;
+ else if (lastbezt->vec[1][0] <= evaltime) {
+ /* after or on last keyframe */
+ if( (icu->extrap & IPO_DIR) && (icu->ipo != IPO_CONST)) {
+ /* linear or bezier interpolation */
+ if (icu->ipo==IPO_LIN) {
+ /* Use the next center point instead of our own handle for
+ * linear interpolated extrapolate
+ */
+ if (icu->totvert == 1)
+ cvalue= lastbezt->vec[1][1];
+ else {
+ prevbezt = lastbezt - 1;
+ dx= evaltime - lastbezt->vec[1][0];
+ fac= lastbezt->vec[1][0] - prevbezt->vec[1][0];
+
+ /* prevent division by zero */
+ if (fac) {
+ fac= (lastbezt->vec[1][1] - prevbezt->vec[1][1]) / fac;
+ cvalue= lastbezt->vec[1][1] + (fac * dx);
+ }
+ else
+ cvalue= lastbezt->vec[1][1];
+ }
+ }
+ else {
+ /* Use the gradient of the second handle (later) of last BezTriple to calculate the
+ * gradient and thus the value of the curve at evaltime
+ */
+ dx= evaltime - lastbezt->vec[1][0];
+ fac= lastbezt->vec[2][0] - lastbezt->vec[1][0];
+
+ /* prevent division by zero */
+ if (fac) {
+ fac= (lastbezt->vec[2][1] - lastbezt->vec[1][1]) / fac;
+ cvalue= lastbezt->vec[1][1] + (fac * dx);
+ }
+ else
+ cvalue= lastbezt->vec[1][1];
}
- else cvalue= prevbezt->vec[1][1];
}
- else cvalue= (prevbezt+a)->vec[1][1];
-
- cvalue+= cycyofs;
+ else {
+ /* constant (IPO_HORIZ) extrapolation or constant interpolation,
+ * so just extend last keyframe's value
+ */
+ cvalue= lastbezt->vec[1][1];
+ }
}
else {
- while(a--) {
- if(prevbezt->vec[1][0]<=ipotime && bezt->vec[1][0]>=ipotime) {
- if(icu->ipo==IPO_CONST) {
- cvalue= prevbezt->vec[1][1]+cycyofs;
+ /* evaltime occurs somewhere in the middle of the curve */
+ // TODO: chould be optimised by using a binary search instead???
+ for (a=0; prevbezt && bezt && (a < icu->totvert-1); a++, prevbezt=bezt, bezt++) {
+ /* evaltime occurs within the interval defined by these two keyframes */
+ if ((prevbezt->vec[1][0] <= evaltime) && (bezt->vec[1][0] >= evaltime)) {
+ /* value depends on interpolation mode */
+ if (icu->ipo == IPO_CONST) {
+ /* constant (evaltime not relevant, so no interpolation needed) */
+ cvalue= prevbezt->vec[1][1];
}
- else if(icu->ipo==IPO_LIN) {
- fac= bezt->vec[1][0]-prevbezt->vec[1][0];
- if(fac==0) cvalue= cycyofs+prevbezt->vec[1][1];
- else {
- fac= (ipotime-prevbezt->vec[1][0])/fac;
- cvalue= cycyofs+prevbezt->vec[1][1]+ fac*(bezt->vec[1][1]-prevbezt->vec[1][1]);
+ else if (icu->ipo == IPO_LIN) {
+ /* linear - interpolate between values of the two keyframes */
+ fac= bezt->vec[1][0] - prevbezt->vec[1][0];
+
+ /* prevent division by zero */
+ if (fac) {
+ fac= (evaltime - prevbezt->vec[1][0]) / fac;
+ cvalue= prevbezt->vec[1][1] + (fac * (bezt->vec[1][1] - prevbezt->vec[1][1]));
}
+ else
+ cvalue= prevbezt->vec[1][1];
}
else {
+ /* bezier interpolation */
+ /* v1,v2 are the first keyframe and its 2nd handle */
v1[0]= prevbezt->vec[1][0];
v1[1]= prevbezt->vec[1][1];
v2[0]= prevbezt->vec[2][0];
v2[1]= prevbezt->vec[2][1];
-
+ /* v3,v4 are the last keyframe's 1st handle + the last keyframe */
v3[0]= bezt->vec[0][0];
v3[1]= bezt->vec[0][1];
v4[0]= bezt->vec[1][0];
v4[1]= bezt->vec[1][1];
-
+
+ /* adjust handles so that they don't overlap (forming a loop) */
correct_bezpart(v1, v2, v3, v4);
- b= findzero(ipotime, v1[0], v2[0], v3[0], v4[0], opl);
- if(b) {
+ /* try to get a value for this position - if failure, try another set of points */
+ b= findzero(evaltime, v1[0], v2[0], v3[0], v4[0], opl);
+ if (b) {
berekeny(v1[1], v2[1], v3[1], v4[1], opl, 1);
- cvalue= opl[0]+cycyofs;
+ cvalue= opl[0];
break;
}
}
}
- prevbezt= bezt;
- bezt++;
}
}
+
+ /* apply y-offset (for 'cyclic extrapolation') to calculated value */
+ cvalue+= cycyofs;
}
-
- if(icu->ymin < icu->ymax) {
- if(cvalue < icu->ymin) cvalue= icu->ymin;
- else if(cvalue > icu->ymax) cvalue= icu->ymax;
+
+ /* clamp evaluated value to lie within allowable value range for this channel */
+ if (icu->ymin < icu->ymax) {
+ CLAMP(cvalue, icu->ymin, icu->ymax);
}
+ /* return evaluated value */
return cvalue;
}
-void calc_icu(IpoCurve *icu, float ctime)
+/* ------------------- IPO-Block/Curve Calculation - General API ----------------------- */
+
+/* calculate the value of the given IPO-curve at the current frame, and set its curval */
+void calc_icu (IpoCurve *icu, float ctime)
{
+ /* calculate and set curval (evaluates driver too) */
icu->curval= eval_icu(icu, ctime);
}
-float calc_ipo_time(Ipo *ipo, float ctime)
+/* calculate for the current frame, all IPO-curves in IPO-block that can be evaluated
+ * - icu->curval is set for all IPO-curves which are evaluated!
+ */
+void calc_ipo (Ipo *ipo, float ctime)
{
+ IpoCurve *icu;
+
+ /* if there is no IPO block to evaluate, or whole block is "muted" */
+ if (ipo == NULL) return;
+ if (ipo->muteipo) return;
+
+ /* loop over all curves */
+ for (icu= ipo->curve.first; icu; icu= icu->next) {
+ /* only evaluated curve if allowed to:
+ * - Muted channels should not be evaluated as they shouldn't have any effect
+ * --> user explictly turned them off!
+ * - Drivers should be evaluated at all updates
+ * --> TODO Note: drivers should be separated from standard channels
+ * - IPO_LOCK is not set, as it is set by some internal mechanisms to prevent
+ * IPO-curve from overwriting data (currently only used for IPO-Record).
+ */
+ if ((icu->driver) || (icu->flag & IPO_LOCK)==0) {
+ if ((icu->flag & IPO_MUTE)==0)
+ calc_icu(icu, ctime);
+ }
+ }
+}
- if(ipo && ipo->blocktype==ID_OB) {
- IpoCurve *icu= ipo->curve.first;
+/* ------------------- IPO-Block/Curve Calculation - Special Hacks ----------------------- */
- while(icu) {
- if (icu->adrcode==OB_TIME) {
- calc_icu(icu, ctime);
- return 10.0f*icu->curval;
- }
- icu= icu->next;
- }
+/* Calculate and return the value of the 'Time' Ipo-Curve from an Object,
+ * OR return the current time if not found
+ * - used in object.c -> bsystem_time()
+ */
+float calc_ipo_time (Ipo *ipo, float ctime)
+{
+ /* only Time IPO from Object IPO-blocks are relevant */
+ if ((ipo) && (ipo->blocktype == ID_OB)) {
+ IpoCurve *icu= find_ipocurve(ipo, OB_TIME);
+
+ /* only calculate (and set icu->curval) for time curve */
+ if (icu) {
+ calc_icu(icu, ctime);
+ return (10.0f * icu->curval);
+ }
}
+ /* no appropriate time-curve found */
return ctime;
}
-void calc_ipo(Ipo *ipo, float ctime)
+/* Evaluate the specified channel in the given IPO block on the specified frame (ctime),
+ * writing the value into that channel's icu->curval, but ALSO dumping it in ctime.
+ * - Returns success and modifies ctime!
+ */
+short calc_ipo_spec (Ipo *ipo, int adrcode, float *ctime)
+{
+ IpoCurve *icu= find_ipocurve(ipo, adrcode);
+
+ /* only evaluate if found */
+ if (icu) {
+ /* only calculate if allowed to (not locked and not muted)
+ * - drivers not taken into account, because this may be called when calculating a driver
+ */
+ if ((icu->flag & (IPO_LOCK|IPO_MUTE))==0)
+ calc_icu(icu, *ctime);
+
+ /* value resulting from calculations is written into ctime! */
+ *ctime= icu->curval;
+ return 1;
+ }
+
+ /* couldn't evaluate */
+ return 0;
+}
+
+/* ***************************** IPO - DataAPI ********************************* */
+
+/* --------------------- Flush/Execute IPO Values ----------------------------- */
+
+/* Flush IpoCurve->curvals to the data they affect (defined by ID)
+ * - not for Actions or Constraints! (those have their own special handling)
+ */
+void execute_ipo (ID *id, Ipo *ipo)
{
IpoCurve *icu;
+ void *poin;
+ int type;
- if(ipo==NULL) return;
- if(ipo->muteipo) return;
+ /* don't do anything without an IPO block */
+ if (ipo == NULL)
+ return;
- for(icu= ipo->curve.first; icu; icu= icu->next) {
- if(icu->driver || (icu->flag & IPO_LOCK)==0) {
- if((icu->flag & IPO_MUTE)==0)
- calc_icu(icu, ctime);
+ /* loop over IPO Curves, getting pointer to var to affect, and write into that pointer */
+ for (icu= ipo->curve.first; icu; icu= icu->next) {
+ poin= get_ipo_poin(id, icu, &type);
+ if (poin) write_ipo_poin(poin, type, icu->curval);
+ }
+}
+
+/* Flush Action-Channel IPO data to Pose Channel */
+void execute_action_ipo (bActionChannel *achan, bPoseChannel *pchan)
+{
+ /* only do this if there's an Action Channel and Pose Channel to use */
+ if (achan && achan->ipo && pchan) {
+ IpoCurve *icu;
+
+ /* loop over IPO-curves, getting a pointer to pchan var to write to
+ * - assume for now that only 'float' channels will ever get written into
+ */
+ for (icu= achan->ipo->curve.first; icu; icu= icu->next) {
+ void *poin= get_pchan_ipo_poin(pchan, icu->adrcode);
+ if (poin) write_ipo_poin(poin, IPO_FLOAT, icu->curval);
}
}
}
-/* ************************************** */
-/* DO THE IPO! */
-/* ************************************** */
-void write_ipo_poin(void *poin, int type, float val)
+/* --------------------- Force Calculation + Flush IPO Values ----------------------------- */
+
+/* Calculate values for given IPO block, then flush to all of block's users
+ * - for general usage
+ */
+void do_ipo (Ipo *ipo)
{
+ if (ipo) {
+ float ctime= frame_to_float(G.scene->r.cfra);
+
+ /* calculate values, then flush to all users of this IPO block */
+ calc_ipo(ipo, ctime);
+ do_ipo_nocalc(ipo);
+ }
+}
- switch(type) {
- case IPO_FLOAT:
- *( (float *)poin)= val;
- break;
- case IPO_FLOAT_DEGR:
- *( (float *)poin)= (float)(val*M_PI_2/9.0);
- break;
- case IPO_INT:
- case IPO_INT_BIT:
- case IPO_LONG:
- *( (int *)poin)= (int)val;
- break;
- case IPO_SHORT:
- case IPO_SHORT_BIT:
- *( (short *)poin)= (short)val;
- break;
- case IPO_CHAR:
- case IPO_CHAR_BIT:
- *( (char *)poin)= (char)val;
- break;
+/* Calculate values for given Material's IPO block, then flush to given Material only */
+void do_mat_ipo (Material *ma)
+{
+ float ctime;
+
+ if (ELEM(NULL, ma, ma->ipo))
+ return;
+
+ ctime= frame_to_float(G.scene->r.cfra);
+ /* if(ob->ipoflag & OB_OFFS_OB) ctime-= ob->sf; */
+
+ /* calculate values for current time, then flush values to given material only */
+ calc_ipo(ma->ipo, ctime);
+ execute_ipo((ID *)ma, ma->ipo);
+}
+
+/* Calculate values for given Object's IPO block, then flush to given Object only
+ * - there's also some funky stuff that looks like it's for scene layers
+ */
+void do_ob_ipo (Object *ob)
+{
+ float ctime;
+ unsigned int lay;
+
+ if (ob->ipo == NULL)
+ return;
+
+ /* do not set ob->ctime here: for example when parent in invisible layer */
+ ctime= bsystem_time(ob, (float) G.scene->r.cfra, 0.0);
+
+ /* calculate values of */
+ calc_ipo(ob->ipo, ctime);
+
+ /* Patch: remember localview */
+ lay= ob->lay & 0xFF000000;
+
+ /* flush IPO values to this object only */
+ execute_ipo((ID *)ob, ob->ipo);
+
+ /* hack: for layer animation??? - is this what this is? (Aligorith, 28Sep2008) */
+ ob->lay |= lay;
+ if ((ob->id.name[2]=='S') && (ob->id.name[3]=='C') && (ob->id.name[4]=='E')) {
+ if (strcmp(G.scene->id.name+2, ob->id.name+6)==0) {
+ G.scene->lay= ob->lay;
+ copy_view3d_lock(0);
+ /* no redraw here! creates too many calls */
+ }
}
}
-float read_ipo_poin(void *poin, int type)
+/* Only execute those IPO-Curves with drivers, on the current frame, for the given Object
+ * - TODO: Drivers should really be made separate from standard anim channels
+ */
+void do_ob_ipodrivers (Object *ob, Ipo *ipo, float ctime)
{
- float val = 0.0;
+ IpoCurve *icu;
+ void *poin;
+ int type;
- switch(type) {
- case IPO_FLOAT:
- val= *( (float *)poin);
+ for (icu= ipo->curve.first; icu; icu= icu->next) {
+ if (icu->driver) {
+ icu->curval= eval_icu(icu, ctime);
+
+ poin= get_ipo_poin((ID *)ob, icu, &type);
+ if (poin) write_ipo_poin(poin, type, icu->curval);
+ }
+ }
+}
+
+/* Special variation to calculate IPO values for Sequence + perform other stuff */
+void do_seq_ipo (Sequence *seq, int cfra)
+{
+ float ctime, div;
+
+ /* seq_ipo has an exception: calc both fields immediately */
+ if (seq->ipo) {
+ if ((seq->flag & SEQ_IPO_FRAME_LOCKED) != 0) {
+ ctime = frame_to_float(cfra);
+ div = 1.0;
+ }
+ else {
+ ctime= frame_to_float(cfra - seq->startdisp);
+ div= (seq->enddisp - seq->startdisp) / 100.0f;
+ if (div == 0.0) return;
+ }
+
+ /* 2nd field */
+ calc_ipo(seq->ipo, (ctime+0.5f)/div);
+ execute_ipo((ID *)seq, seq->ipo);
+ seq->facf1= seq->facf0;
+
+ /* 1st field */
+ calc_ipo(seq->ipo, ctime/div);
+ execute_ipo((ID *)seq, seq->ipo);
+ }
+ else
+ seq->facf1= seq->facf0= 1.0f;
+}
+
+/* --------- */
+
+
+/* exception: it does calc for objects...
+ * now find out why this routine was used anyway!
+ */
+void do_ipo_nocalc (Ipo *ipo)
+{
+ Object *ob;
+ Material *ma;
+ Tex *tex;
+ World *wo;
+ Lamp *la;
+ Camera *ca;
+ bSound *snd;
+
+ if (ipo == NULL)
+ return;
+
+ /* only flush IPO values (without calculating first/again) on
+ * to the datablocks that use the given IPO block
+ */
+ switch (ipo->blocktype) {
+ case ID_OB:
+ for (ob= G.main->object.first; ob; ob= ob->id.next) {
+ if (ob->ipo == ipo) do_ob_ipo(ob);
+ }
break;
- case IPO_FLOAT_DEGR:
- val= *( (float *)poin);
- val = (float)(val/(M_PI_2/9.0));
+ case ID_MA:
+ for (ma= G.main->mat.first; ma; ma= ma->id.next) {
+ if (ma->ipo == ipo) execute_ipo((ID *)ma, ipo);
+ }
break;
- case IPO_INT:
- case IPO_INT_BIT:
- case IPO_LONG:
- val= (float)(*( (int *)poin));
+ case ID_TE:
+ for (tex= G.main->tex.first; tex; tex= tex->id.next) {
+ if (tex->ipo == ipo) execute_ipo((ID *)tex, ipo);
+ }
break;
- case IPO_SHORT:
- case IPO_SHORT_BIT:
- val= *( (short *)poin);
+ case ID_WO:
+ for (wo= G.main->world.first; wo; wo= wo->id.next) {
+ if (wo->ipo == ipo) execute_ipo((ID *)wo, ipo);
+ }
break;
- case IPO_CHAR:
- case IPO_CHAR_BIT:
- val= *( (char *)poin);
+ case ID_LA:
+ for (la= G.main->lamp.first; la; la= la->id.next) {
+ if (la->ipo == ipo) execute_ipo((ID *)la, ipo);
+ }
+ break;
+ case ID_CA:
+ for (ca= G.main->camera.first; ca; ca= ca->id.next) {
+ if (ca->ipo == ipo) execute_ipo((ID *)ca, ipo);
+ }
+ break;
+ case ID_SO:
+ for (snd= G.main->sound.first; snd; snd= snd->id.next) {
+ if (snd->ipo == ipo) execute_ipo((ID *)snd, ipo);
+ }
break;
}
- return val;
}
-static void *give_tex_poin(Tex *tex, int adrcode, int *type )
+/* Executes IPO's for whole database on frame change, in a specified order,
+ * with datablocks being calculated in alphabetical order
+ * - called on scene_update_for_newframe() only
+ */
+void do_all_data_ipos ()
{
- void *poin=0;
+ Material *ma;
+ Tex *tex;
+ World *wo;
+ Ipo *ipo;
+ Lamp *la;
+ Key *key;
+ Camera *ca;
+ bSound *snd;
+ Sequence *seq;
+ Editing *ed;
+ Base *base;
+ float ctime;
+
+ ctime= frame_to_float(G.scene->r.cfra);
+
+ /* this exception cannot be depgraphed yet... what todo with objects in other layers?... */
+ for (base= G.scene->base.first; base; base= base->next) {
+ Object *ob= base->object;
+
+ /* only update layer when an ipo */
+ if (has_ipo_code(ob->ipo, OB_LAY)) {
+ do_ob_ipo(ob);
+ base->lay= ob->lay;
+ }
+ }
+
+ /* layers for the set...*/
+ if (G.scene->set) {
+ for (base= G.scene->set->base.first; base; base= base->next) {
+ Object *ob= base->object;
+
+ if (has_ipo_code(ob->ipo, OB_LAY)) {
+ do_ob_ipo(ob);
+ base->lay= ob->lay;
+ }
+ }
+ }
+
+ /* Calculate all IPO blocks in use, execept those for Objects */
+ for (ipo= G.main->ipo.first; ipo; ipo= ipo->id.next) {
+ if ((ipo->id.us) && (ipo->blocktype != ID_OB)) {
+ calc_ipo(ipo, ctime);
+ }
+ }
+
+ /* Texture Blocks */
+ for (tex= G.main->tex.first; tex; tex= tex->id.next) {
+ if (tex->ipo) execute_ipo((ID *)tex, tex->ipo);
+ }
+
+ /* Material Blocks */
+ for (ma= G.main->mat.first; ma; ma= ma->id.next) {
+ if (ma->ipo) execute_ipo((ID *)ma, ma->ipo);
+ }
+
+ /* World Blocks */
+ for (wo= G.main->world.first; wo; wo= wo->id.next) {
+ if (wo->ipo) execute_ipo((ID *)wo, wo->ipo);
+ }
+
+ /* ShapeKey Blocks */
+ for (key= G.main->key.first; key; key= key->id.next) {
+ if (key->ipo) execute_ipo((ID *)key, key->ipo);
+ }
+
+ /* Lamp Blocks */
+ for (la= G.main->lamp.first; la; la= la->id.next) {
+ if (la->ipo) execute_ipo((ID *)la, la->ipo);
+ }
+
+ /* Camera Blocks */
+ for (ca= G.main->camera.first; ca; ca= ca->id.next) {
+ if (ca->ipo) execute_ipo((ID *)ca, ca->ipo);
+ }
+
+ /* Sound Blocks (Old + Unused) */
+ for (snd= G.main->sound.first; snd; snd= snd->id.next) {
+ if (snd->ipo) execute_ipo((ID *)snd, snd->ipo);
+ }
+
+ /* Sequencer: process FAC Ipos used as volume envelopes */
+ ed= G.scene->ed;
+ if (ed) {
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
+ if ( ((seq->type == SEQ_RAM_SOUND) || (seq->type == SEQ_HD_SOUND)) &&
+ (seq->startdisp <= G.scene->r.cfra+2) &&
+ (seq->enddisp>G.scene->r.cfra) &&
+ (seq->ipo) )
+ {
+ do_seq_ipo(seq, G.scene->r.cfra);
+ }
+ }
+ }
+}
+
+
+/* --------------------- Assorted ----------------------------- */
+
+/* clear delta-transforms on all Objects which use the given IPO block */
+void clear_delta_obipo(Ipo *ipo)
+{
+ Object *ob;
+
+ /* only search if there's an IPO */
+ if (ipo == NULL)
+ return;
+
+ /* search through all objects in database */
+ for (ob= G.main->object.first; ob; ob= ob->id.next) {
+ /* can only update if not a library */
+ if (ob->id.lib == NULL) {
+ if (ob->ipo == ipo) {
+ memset(&ob->dloc, 0, 12);
+ memset(&ob->drot, 0, 12);
+ memset(&ob->dsize, 0, 12);
+ }
+ }
+ }
+}
+
+/* ***************************** IPO - DataAPI ********************************* */
+
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!! FIXME - BAD CRUFT WARNING !!!!!!!!!!!!!!!!!!!!!!!
+
+/* These functions here should be replaced eventually by the Data API, as this is
+ * inflexible duplication...
+ */
- switch(adrcode) {
+/* --------------------- Get Pointer API ----------------------------- */
+
+/* get pointer to pose-channel's channel, but set appropriate flags first */
+void *get_pchan_ipo_poin (bPoseChannel *pchan, int adrcode)
+{
+ void *poin= NULL;
+
+ switch (adrcode) {
+ case AC_QUAT_W:
+ poin= &(pchan->quat[0]);
+ pchan->flag |= POSE_ROT;
+ break;
+ case AC_QUAT_X:
+ poin= &(pchan->quat[1]);
+ pchan->flag |= POSE_ROT;
+ break;
+ case AC_QUAT_Y:
+ poin= &(pchan->quat[2]);
+ pchan->flag |= POSE_ROT;
+ break;
+ case AC_QUAT_Z:
+ poin= &(pchan->quat[3]);
+ pchan->flag |= POSE_ROT;
+ break;
+
+ case AC_LOC_X:
+ poin= &(pchan->loc[0]);
+ pchan->flag |= POSE_LOC;
+ break;
+ case AC_LOC_Y:
+ poin= &(pchan->loc[1]);
+ pchan->flag |= POSE_LOC;
+ break;
+ case AC_LOC_Z:
+ poin= &(pchan->loc[2]);
+ pchan->flag |= POSE_LOC;
+ break;
+
+ case AC_SIZE_X:
+ poin= &(pchan->size[0]);
+ pchan->flag |= POSE_SIZE;
+ break;
+ case AC_SIZE_Y:
+ poin= &(pchan->size[1]);
+ pchan->flag |= POSE_SIZE;
+ break;
+ case AC_SIZE_Z:
+ poin= &(pchan->size[2]);
+ pchan->flag |= POSE_SIZE;
+ break;
+ }
+
+ /* return pointer */
+ return poin;
+}
+
+/* get texture channel */
+static void *give_tex_poin (Tex *tex, int adrcode, int *type )
+{
+ void *poin= NULL;
+
+ switch (adrcode) {
case TE_NSIZE:
poin= &(tex->noisesize); break;
case TE_TURB:
@@ -1171,17 +1896,18 @@ static void *give_tex_poin(Tex *tex, int adrcode, int *type )
poin= &(tex->bright); break;
case TE_CONTRA:
poin= &(tex->contrast); break;
-
}
+ /* return pointer */
return poin;
}
-void *give_mtex_poin(MTex *mtex, int adrcode )
+/* get texture-slot/mapping channel */
+void *give_mtex_poin (MTex *mtex, int adrcode)
{
- void *poin=0;
-
- switch(adrcode) {
+ void *poin= NULL;
+
+ switch (adrcode) {
case MAP_OFS_X:
poin= &(mtex->ofs[0]); break;
case MAP_OFS_Y:
@@ -1212,6 +1938,7 @@ void *give_mtex_poin(MTex *mtex, int adrcode )
poin= &(mtex->dispfac); break;
}
+ /* return pointer */
return poin;
}
@@ -1228,1321 +1955,909 @@ void *give_mtex_poin(MTex *mtex, int adrcode )
/* from misc_util: flip the bytes from x */
/* #define GS(x) (((unsigned char *)(x))[0] << 8 | ((unsigned char *)(x))[1]) */
-void *get_ipo_poin(ID *id, IpoCurve *icu, int *type)
+
+/* general function to get pointer to source/destination data */
+void *get_ipo_poin (ID *id, IpoCurve *icu, int *type)
{
void *poin= NULL;
- Object *ob;
- Material *ma;
- MTex *mtex;
- Tex *tex;
- Lamp *la;
- Sequence *seq;
- World *wo;
- ParticleSettings *part;
+ MTex *mtex= NULL;
+ /* most channels will have float data, but those with other types will override this */
*type= IPO_FLOAT;
- if( GS(id->name)==ID_OB) {
-
- ob= (Object *)id;
-
- switch(icu->adrcode) {
- case OB_LOC_X:
- poin= &(ob->loc[0]); break;
- case OB_LOC_Y:
- poin= &(ob->loc[1]); break;
- case OB_LOC_Z:
- poin= &(ob->loc[2]); break;
- case OB_DLOC_X:
- poin= &(ob->dloc[0]); break;
- case OB_DLOC_Y:
- poin= &(ob->dloc[1]); break;
- case OB_DLOC_Z:
- poin= &(ob->dloc[2]); break;
-
- case OB_ROT_X:
- poin= &(ob->rot[0]); *type= IPO_FLOAT_DEGR; break;
- case OB_ROT_Y:
- poin= &(ob->rot[1]); *type= IPO_FLOAT_DEGR; break;
- case OB_ROT_Z:
- poin= &(ob->rot[2]); *type= IPO_FLOAT_DEGR; break;
- case OB_DROT_X:
- poin= &(ob->drot[0]); *type= IPO_FLOAT_DEGR; break;
- case OB_DROT_Y:
- poin= &(ob->drot[1]); *type= IPO_FLOAT_DEGR; break;
- case OB_DROT_Z:
- poin= &(ob->drot[2]); *type= IPO_FLOAT_DEGR; break;
+ /* data is divided into 'blocktypes' based on ID-codes */
+ switch (GS(id->name)) {
+ case ID_OB: /* object channels ----------------------------- */
+ {
+ Object *ob= (Object *)id;
- case OB_SIZE_X:
- poin= &(ob->size[0]); break;
- case OB_SIZE_Y:
- poin= &(ob->size[1]); break;
- case OB_SIZE_Z:
- poin= &(ob->size[2]); break;
- case OB_DSIZE_X:
- poin= &(ob->dsize[0]); break;
- case OB_DSIZE_Y:
- poin= &(ob->dsize[1]); break;
- case OB_DSIZE_Z:
- poin= &(ob->dsize[2]); break;
-
- case OB_LAY:
- poin= &(ob->lay); *type= IPO_INT_BIT; break;
+ switch (icu->adrcode) {
+ case OB_LOC_X:
+ poin= &(ob->loc[0]); break;
+ case OB_LOC_Y:
+ poin= &(ob->loc[1]); break;
+ case OB_LOC_Z:
+ poin= &(ob->loc[2]); break;
+ case OB_DLOC_X:
+ poin= &(ob->dloc[0]); break;
+ case OB_DLOC_Y:
+ poin= &(ob->dloc[1]); break;
+ case OB_DLOC_Z:
+ poin= &(ob->dloc[2]); break;
- case OB_COL_R:
- poin= &(ob->col[0]);
- break;
- case OB_COL_G:
- poin= &(ob->col[1]);
- break;
- case OB_COL_B:
- poin= &(ob->col[2]);
- break;
- case OB_COL_A:
- poin= &(ob->col[3]);
- break;
- case OB_PD_FSTR:
- if(ob->pd) poin= &(ob->pd->f_strength);
- break;
- case OB_PD_FFALL:
- if(ob->pd) poin= &(ob->pd->f_power);
- break;
- case OB_PD_SDAMP:
- if(ob->pd) poin= &(ob->pd->pdef_damp);
- break;
- case OB_PD_RDAMP:
- if(ob->pd) poin= &(ob->pd->pdef_rdamp);
- break;
- case OB_PD_PERM:
- if(ob->pd) poin= &(ob->pd->pdef_perm);
- break;
- case OB_PD_FMAXD:
- if(ob->pd) poin= &(ob->pd->maxdist);
- break;
- }
- }
- else if( GS(id->name)==ID_MA) {
-
- ma= (Material *)id;
-
- switch(icu->adrcode) {
- case MA_COL_R:
- poin= &(ma->r); break;
- case MA_COL_G:
- poin= &(ma->g); break;
- case MA_COL_B:
- poin= &(ma->b); break;
- case MA_SPEC_R:
- poin= &(ma->specr); break;
- case MA_SPEC_G:
- poin= &(ma->specg); break;
- case MA_SPEC_B:
- poin= &(ma->specb); break;
- case MA_MIR_R:
- poin= &(ma->mirr); break;
- case MA_MIR_G:
- poin= &(ma->mirg); break;
- case MA_MIR_B:
- poin= &(ma->mirb); break;
- case MA_REF:
- poin= &(ma->ref); break;
- case MA_ALPHA:
- poin= &(ma->alpha); break;
- case MA_EMIT:
- poin= &(ma->emit); break;
- case MA_AMB:
- poin= &(ma->amb); break;
- case MA_SPEC:
- poin= &(ma->spec); break;
- case MA_HARD:
- poin= &(ma->har); *type= IPO_SHORT; break;
- case MA_SPTR:
- poin= &(ma->spectra); break;
- case MA_IOR:
- poin= &(ma->ang); break;
- case MA_MODE:
- poin= &(ma->mode); *type= IPO_INT_BIT; break;
- case MA_HASIZE:
- poin= &(ma->hasize); break;
- case MA_TRANSLU:
- poin= &(ma->translucency); break;
- case MA_RAYM:
- poin= &(ma->ray_mirror); break;
- case MA_FRESMIR:
- poin= &(ma->fresnel_mir); break;
- case MA_FRESMIRI:
- poin= &(ma->fresnel_mir_i); break;
- case MA_FRESTRA:
- poin= &(ma->fresnel_tra); break;
- case MA_FRESTRAI:
- poin= &(ma->fresnel_tra_i); break;
- case MA_ADD:
- poin= &(ma->add); break;
- }
-
- if(poin==NULL) {
- mtex= 0;
- if(icu->adrcode & MA_MAP1) mtex= ma->mtex[0];
- else if(icu->adrcode & MA_MAP2) mtex= ma->mtex[1];
- else if(icu->adrcode & MA_MAP3) mtex= ma->mtex[2];
- else if(icu->adrcode & MA_MAP4) mtex= ma->mtex[3];
- else if(icu->adrcode & MA_MAP5) mtex= ma->mtex[4];
- else if(icu->adrcode & MA_MAP6) mtex= ma->mtex[5];
- else if(icu->adrcode & MA_MAP7) mtex= ma->mtex[6];
- else if(icu->adrcode & MA_MAP8) mtex= ma->mtex[7];
- else if(icu->adrcode & MA_MAP9) mtex= ma->mtex[8];
- else if(icu->adrcode & MA_MAP10) mtex= ma->mtex[9];
- else if(icu->adrcode & MA_MAP12) mtex= ma->mtex[11];
- else if(icu->adrcode & MA_MAP11) mtex= ma->mtex[10];
- else if(icu->adrcode & MA_MAP13) mtex= ma->mtex[12];
- else if(icu->adrcode & MA_MAP14) mtex= ma->mtex[13];
- else if(icu->adrcode & MA_MAP15) mtex= ma->mtex[14];
- else if(icu->adrcode & MA_MAP16) mtex= ma->mtex[15];
- else if(icu->adrcode & MA_MAP17) mtex= ma->mtex[16];
- else if(icu->adrcode & MA_MAP18) mtex= ma->mtex[17];
+ case OB_ROT_X:
+ poin= &(ob->rot[0]); *type= IPO_FLOAT_DEGR; break;
+ case OB_ROT_Y:
+ poin= &(ob->rot[1]); *type= IPO_FLOAT_DEGR; break;
+ case OB_ROT_Z:
+ poin= &(ob->rot[2]); *type= IPO_FLOAT_DEGR; break;
+ case OB_DROT_X:
+ poin= &(ob->drot[0]); *type= IPO_FLOAT_DEGR; break;
+ case OB_DROT_Y:
+ poin= &(ob->drot[1]); *type= IPO_FLOAT_DEGR; break;
+ case OB_DROT_Z:
+ poin= &(ob->drot[2]); *type= IPO_FLOAT_DEGR; break;
+
+ case OB_SIZE_X:
+ poin= &(ob->size[0]); break;
+ case OB_SIZE_Y:
+ poin= &(ob->size[1]); break;
+ case OB_SIZE_Z:
+ poin= &(ob->size[2]); break;
+ case OB_DSIZE_X:
+ poin= &(ob->dsize[0]); break;
+ case OB_DSIZE_Y:
+ poin= &(ob->dsize[1]); break;
+ case OB_DSIZE_Z:
+ poin= &(ob->dsize[2]); break;
- if(mtex) {
- poin= give_mtex_poin(mtex, icu->adrcode & (MA_MAP1-1) );
- }
- }
- }
- else if( GS(id->name)==ID_TE) {
- tex= (Tex *)id;
-
- if(tex) poin= give_tex_poin(tex, icu->adrcode, type);
- }
- else if( GS(id->name)==ID_SEQ) {
- seq= (Sequence *)id;
-
- switch(icu->adrcode) {
- case SEQ_FAC1:
- poin= &(seq->facf0); break;
- }
- }
- else if( GS(id->name)==ID_CU) {
-
- poin= &(icu->curval);
-
- }
- else if( GS(id->name)==ID_KE) {
- KeyBlock *kb= ((Key *)id)->block.first;
-
- for(; kb; kb= kb->next)
- if(kb->adrcode==icu->adrcode)
+ case OB_LAY:
+ poin= &(ob->lay); *type= IPO_INT_BIT; break;
+
+ case OB_COL_R:
+ poin= &(ob->col[0]); break;
+ case OB_COL_G:
+ poin= &(ob->col[1]); break;
+ case OB_COL_B:
+ poin= &(ob->col[2]); break;
+ case OB_COL_A:
+ poin= &(ob->col[3]); break;
+
+ case OB_PD_FSTR:
+ if (ob->pd) poin= &(ob->pd->f_strength);
+ break;
+ case OB_PD_FFALL:
+ if (ob->pd) poin= &(ob->pd->f_power);
+ break;
+ case OB_PD_SDAMP:
+ if (ob->pd) poin= &(ob->pd->pdef_damp);
+ break;
+ case OB_PD_RDAMP:
+ if (ob->pd) poin= &(ob->pd->pdef_rdamp);
+ break;
+ case OB_PD_PERM:
+ if (ob->pd) poin= &(ob->pd->pdef_perm);
+ break;
+ case OB_PD_FMAXD:
+ if (ob->pd) poin= &(ob->pd->maxdist);
break;
- if(kb)
- poin= &(kb->curval);
-
- }
- else if(GS(id->name)==ID_WO) {
-
- wo= (World *)id;
-
- switch(icu->adrcode) {
- case WO_HOR_R:
- poin= &(wo->horr); break;
- case WO_HOR_G:
- poin= &(wo->horg); break;
- case WO_HOR_B:
- poin= &(wo->horb); break;
- case WO_ZEN_R:
- poin= &(wo->zenr); break;
- case WO_ZEN_G:
- poin= &(wo->zeng); break;
- case WO_ZEN_B:
- poin= &(wo->zenb); break;
-
- case WO_EXPOS:
- poin= &(wo->exposure); break;
-
- case WO_MISI:
- poin= &(wo->misi); break;
- case WO_MISTDI:
- poin= &(wo->mistdist); break;
- case WO_MISTSTA:
- poin= &(wo->miststa); break;
- case WO_MISTHI:
- poin= &(wo->misthi); break;
-
- case WO_STAR_R:
- poin= &(wo->starr); break;
- case WO_STAR_G:
- poin= &(wo->starg); break;
- case WO_STAR_B:
- poin= &(wo->starb); break;
-
- case WO_STARDIST:
- poin= &(wo->stardist); break;
- case WO_STARSIZE:
- poin= &(wo->starsize); break;
- }
-
- if(poin==NULL) {
- mtex= 0;
- if(icu->adrcode & MA_MAP1) mtex= wo->mtex[0];
- else if(icu->adrcode & MA_MAP2) mtex= wo->mtex[1];
- else if(icu->adrcode & MA_MAP3) mtex= wo->mtex[2];
- else if(icu->adrcode & MA_MAP4) mtex= wo->mtex[3];
- else if(icu->adrcode & MA_MAP5) mtex= wo->mtex[4];
- else if(icu->adrcode & MA_MAP6) mtex= wo->mtex[5];
- else if(icu->adrcode & MA_MAP7) mtex= wo->mtex[6];
- else if(icu->adrcode & MA_MAP8) mtex= wo->mtex[7];
- else if(icu->adrcode & MA_MAP9) mtex= wo->mtex[8];
- else if(icu->adrcode & MA_MAP10) mtex= wo->mtex[9];
- else if(icu->adrcode & MA_MAP11) mtex= wo->mtex[10];
- else if(icu->adrcode & MA_MAP12) mtex= wo->mtex[11];
- else if(icu->adrcode & MA_MAP13) mtex= wo->mtex[12];
- else if(icu->adrcode & MA_MAP14) mtex= wo->mtex[13];
- else if(icu->adrcode & MA_MAP15) mtex= wo->mtex[14];
- else if(icu->adrcode & MA_MAP16) mtex= wo->mtex[15];
- else if(icu->adrcode & MA_MAP17) mtex= wo->mtex[16];
- else if(icu->adrcode & MA_MAP18) mtex= wo->mtex[17];
- if(mtex) {
- poin= give_mtex_poin(mtex, icu->adrcode & (MA_MAP1-1) );
- }
- }
- }
- else if( GS(id->name)==ID_LA) {
-
- la= (Lamp *)id;
-
- switch(icu->adrcode) {
- case LA_ENERGY:
- poin= &(la->energy); break;
- case LA_COL_R:
- poin= &(la->r); break;
- case LA_COL_G:
- poin= &(la->g); break;
- case LA_COL_B:
- poin= &(la->b); break;
- case LA_DIST:
- poin= &(la->dist); break;
- case LA_SPOTSI:
- poin= &(la->spotsize); break;
- case LA_SPOTBL:
- poin= &(la->spotblend); break;
- case LA_QUAD1:
- poin= &(la->att1); break;
- case LA_QUAD2:
- poin= &(la->att2); break;
- case LA_HALOINT:
- poin= &(la->haint); break;
- }
-
- if(poin==NULL) {
- mtex= 0;
- if(icu->adrcode & MA_MAP1) mtex= la->mtex[0];
- else if(icu->adrcode & MA_MAP2) mtex= la->mtex[1];
- else if(icu->adrcode & MA_MAP3) mtex= la->mtex[2];
- else if(icu->adrcode & MA_MAP4) mtex= la->mtex[3];
- else if(icu->adrcode & MA_MAP5) mtex= la->mtex[4];
- else if(icu->adrcode & MA_MAP6) mtex= la->mtex[5];
- else if(icu->adrcode & MA_MAP7) mtex= la->mtex[6];
- else if(icu->adrcode & MA_MAP8) mtex= la->mtex[7];
- else if(icu->adrcode & MA_MAP9) mtex= la->mtex[8];
- else if(icu->adrcode & MA_MAP10) mtex= la->mtex[9];
- else if(icu->adrcode & MA_MAP11) mtex= la->mtex[10];
- else if(icu->adrcode & MA_MAP12) mtex= la->mtex[11];
- else if(icu->adrcode & MA_MAP13) mtex= la->mtex[12];
- else if(icu->adrcode & MA_MAP14) mtex= la->mtex[13];
- else if(icu->adrcode & MA_MAP15) mtex= la->mtex[14];
- else if(icu->adrcode & MA_MAP16) mtex= la->mtex[15];
- else if(icu->adrcode & MA_MAP17) mtex= la->mtex[16];
- else if(icu->adrcode & MA_MAP18) mtex= la->mtex[17];
-
- if(mtex) {
- poin= give_mtex_poin(mtex, icu->adrcode & (MA_MAP1-1) );
}
}
- }
- else if(GS(id->name)==ID_CA) {
- Camera *ca= (Camera *)id;
-
- /* yafray: aperture & focal distance params */
- switch(icu->adrcode) {
- case CAM_LENS:
- if(ca->type==CAM_ORTHO)
- poin= &(ca->ortho_scale);
- else
- poin= &(ca->lens);
break;
- case CAM_STA:
- poin= &(ca->clipsta); break;
- case CAM_END:
- poin= &(ca->clipend); break;
- case CAM_YF_APERT:
- poin= &(ca->YF_aperture); break;
- case CAM_YF_FDIST:
- poin= &(ca->YF_dofdist); break;
- case CAM_SHIFT_X:
- poin= &(ca->shiftx); break;
- case CAM_SHIFT_Y:
- poin= &(ca->shifty); break;
- }
- }
- else if(GS(id->name)==ID_SO) {
- bSound *snd= (bSound *)id;
-
- switch(icu->adrcode) {
- case SND_VOLUME:
- poin= &(snd->volume); break;
- case SND_PITCH:
- poin= &(snd->pitch); break;
- case SND_PANNING:
- poin= &(snd->panning); break;
- case SND_ATTEN:
- poin= &(snd->attenuation); break;
- }
- }
- else if( GS(id->name)==ID_PA) {
-
- part= (ParticleSettings *)id;
-
- switch(icu->adrcode) {
- case PART_EMIT_FREQ:
- case PART_EMIT_LIFE:
- case PART_EMIT_VEL:
- case PART_EMIT_AVE:
- case PART_EMIT_SIZE:
- poin= NULL; break;
- case PART_CLUMP:
- poin= &(part->clumpfac); break;
- case PART_AVE:
- poin= &(part->avefac); break;
- case PART_SIZE:
- poin= &(part->size); break;
- case PART_DRAG:
- poin= &(part->dragfac); break;
- case PART_BROWN:
- poin= &(part->brownfac); break;
- case PART_DAMP:
- poin= &(part->dampfac); break;
- case PART_LENGTH:
- poin= &(part->length); break;
- case PART_GRAV_X:
- poin= &(part->acc[0]); break;
- case PART_GRAV_Y:
- poin= &(part->acc[1]); break;
- case PART_GRAV_Z:
- poin= &(part->acc[2]); break;
- case PART_KINK_AMP:
- poin= &(part->kink_amp); break;
- case PART_KINK_FREQ:
- poin= &(part->kink_freq); break;
- case PART_KINK_SHAPE:
- poin= &(part->kink_shape); break;
- case PART_BB_TILT:
- poin= &(part->bb_tilt); break;
- case PART_PD_FSTR:
- poin= (part->pd?(&(part->pd->f_strength)):NULL); break;
- case PART_PD_FFALL:
- poin= (part->pd?(&(part->pd->f_power)):NULL); break;
- case PART_PD_FMAXD:
- poin= (part->pd?(&(part->pd->maxdist)):NULL); break;
- case PART_PD2_FSTR:
- poin= (part->pd2?(&(part->pd2->f_strength)):NULL); break;
- case PART_PD2_FFALL:
- poin= (part->pd2?(&(part->pd2->f_power)):NULL); break;
- case PART_PD2_FMAXD:
- poin= (part->pd2?(&(part->pd2->maxdist)):NULL); break;
- }
- }
-
- return poin;
-}
-
-void set_icu_vars(IpoCurve *icu)
-{
- /* defaults. 0.0 for y-extents makes these ignored */
- icu->ymin= icu->ymax= 0.0;
- icu->ipo= IPO_BEZ;
-
- if(icu->blocktype==ID_OB) {
-
- if(icu->adrcode==OB_LAY) {
- icu->ipo= IPO_CONST;
- icu->vartype= IPO_BITS;
- }
-
- }
- else if(icu->blocktype==ID_MA) {
-
- if(icu->adrcode < MA_MAP1) {
- switch(icu->adrcode) {
- case MA_HASIZE:
- icu->ymax= 10000.0; break;
- case MA_HARD:
- icu->ymax= 511.0; break;
+ case ID_MA: /* material channels ----------------------------- */
+ {
+ Material *ma= (Material *)id;
+
+ switch (icu->adrcode) {
+ case MA_COL_R:
+ poin= &(ma->r); break;
+ case MA_COL_G:
+ poin= &(ma->g); break;
+ case MA_COL_B:
+ poin= &(ma->b); break;
+ case MA_SPEC_R:
+ poin= &(ma->specr); break;
+ case MA_SPEC_G:
+ poin= &(ma->specg); break;
+ case MA_SPEC_B:
+ poin= &(ma->specb); break;
+ case MA_MIR_R:
+ poin= &(ma->mirr); break;
+ case MA_MIR_G:
+ poin= &(ma->mirg); break;
+ case MA_MIR_B:
+ poin= &(ma->mirb); break;
+ case MA_REF:
+ poin= &(ma->ref); break;
+ case MA_ALPHA:
+ poin= &(ma->alpha); break;
+ case MA_EMIT:
+ poin= &(ma->emit); break;
+ case MA_AMB:
+ poin= &(ma->amb); break;
case MA_SPEC:
- icu->ymax= 2.0; break;
+ poin= &(ma->spec); break;
+ case MA_HARD:
+ poin= &(ma->har); *type= IPO_SHORT; break;
+ case MA_SPTR:
+ poin= &(ma->spectra); break;
+ case MA_IOR:
+ poin= &(ma->ang); break;
case MA_MODE:
- icu->ipo= IPO_CONST;
- icu->vartype= IPO_BITS; break;
- case MA_RAYM:
- icu->ymax= 1.0; break;
+ poin= &(ma->mode); *type= IPO_INT_BIT; break; // evil... dumping bitflags directly to user!
+ case MA_HASIZE:
+ poin= &(ma->hasize); break;
case MA_TRANSLU:
- icu->ymax= 1.0; break;
- case MA_IOR:
- icu->ymin= 1.0;
- icu->ymax= 3.0; break;
+ poin= &(ma->translucency); break;
+ case MA_RAYM:
+ poin= &(ma->ray_mirror); break;
case MA_FRESMIR:
- icu->ymax= 5.0; break;
+ poin= &(ma->fresnel_mir); break;
case MA_FRESMIRI:
- icu->ymin= 1.0;
- icu->ymax= 5.0; break;
+ poin= &(ma->fresnel_mir_i); break;
case MA_FRESTRA:
- icu->ymax= 5.0; break;
+ poin= &(ma->fresnel_tra); break;
case MA_FRESTRAI:
- icu->ymin= 1.0;
- icu->ymax= 5.0; break;
+ poin= &(ma->fresnel_tra_i); break;
case MA_ADD:
- icu->ymax= 1.0; break;
- case MA_EMIT:
- icu->ymax= 2.0; break;
- default:
- icu->ymax= 1.0; break;
+ poin= &(ma->add); break;
+ }
+
+ if (poin == NULL) {
+ if (icu->adrcode & MA_MAP1) mtex= ma->mtex[0];
+ else if (icu->adrcode & MA_MAP2) mtex= ma->mtex[1];
+ else if (icu->adrcode & MA_MAP3) mtex= ma->mtex[2];
+ else if (icu->adrcode & MA_MAP4) mtex= ma->mtex[3];
+ else if (icu->adrcode & MA_MAP5) mtex= ma->mtex[4];
+ else if (icu->adrcode & MA_MAP6) mtex= ma->mtex[5];
+ else if (icu->adrcode & MA_MAP7) mtex= ma->mtex[6];
+ else if (icu->adrcode & MA_MAP8) mtex= ma->mtex[7];
+ else if (icu->adrcode & MA_MAP9) mtex= ma->mtex[8];
+ else if (icu->adrcode & MA_MAP10) mtex= ma->mtex[9];
+ else if (icu->adrcode & MA_MAP12) mtex= ma->mtex[11];
+ else if (icu->adrcode & MA_MAP11) mtex= ma->mtex[10];
+ else if (icu->adrcode & MA_MAP13) mtex= ma->mtex[12];
+ else if (icu->adrcode & MA_MAP14) mtex= ma->mtex[13];
+ else if (icu->adrcode & MA_MAP15) mtex= ma->mtex[14];
+ else if (icu->adrcode & MA_MAP16) mtex= ma->mtex[15];
+ else if (icu->adrcode & MA_MAP17) mtex= ma->mtex[16];
+ else if (icu->adrcode & MA_MAP18) mtex= ma->mtex[17];
+
+ if (mtex)
+ poin= give_mtex_poin(mtex, (icu->adrcode & (MA_MAP1-1)));
}
}
- else {
- switch(icu->adrcode & (MA_MAP1-1)) {
- case MAP_OFS_X:
- case MAP_OFS_Y:
- case MAP_OFS_Z:
- case MAP_SIZE_X:
- case MAP_SIZE_Y:
- case MAP_SIZE_Z:
- icu->ymax= 1000.0;
- icu->ymin= -1000.0;
+ break;
+ case ID_TE: /* texture channels ----------------------------- */
+ {
+ Tex *tex= (Tex *)id;
- break;
- case MAP_R:
- case MAP_G:
- case MAP_B:
- case MAP_DVAR:
- case MAP_COLF:
- case MAP_VARF:
- case MAP_DISP:
- icu->ymax= 1.0;
- break;
- case MAP_NORF:
- icu->ymax= 25.0;
- break;
+ if (tex)
+ poin= give_tex_poin(tex, icu->adrcode, type);
+ }
+ break;
+ case ID_SEQ: /* sequence channels ----------------------------- */
+ {
+ Sequence *seq= (Sequence *)id;
+
+ switch (icu->adrcode) {
+ case SEQ_FAC1:
+ poin= &(seq->facf0); break;
}
}
- }
- else if(icu->blocktype==ID_TE) {
- switch(icu->adrcode & (MA_MAP1-1)) {
- case TE_NSIZE:
- icu->ymin= 0.0001;
- icu->ymax= 2.0; break;
- case TE_NDEPTH:
- icu->vartype= IPO_SHORT;
- icu->ipo= IPO_CONST;
- icu->ymax= 6.0; break;
- case TE_NTYPE:
- icu->vartype= IPO_SHORT;
- icu->ipo= IPO_CONST;
- icu->ymax= 1.0; break;
- case TE_TURB:
- icu->ymax= 200.0; break;
- case TE_VNW1:
- case TE_VNW2:
- case TE_VNW3:
- case TE_VNW4:
- icu->ymax= 2.0;
- icu->ymin= -2.0; break;
- case TE_VNMEXP:
- icu->ymax= 10.0;
- icu->ymin= 0.01; break;
- case TE_VN_DISTM:
- icu->vartype= IPO_SHORT;
- icu->ipo= IPO_CONST;
- icu->ymax= 6.0; break;
- case TE_VN_COLT:
- icu->vartype= IPO_SHORT;
- icu->ipo= IPO_CONST;
- icu->ymax= 3.0; break;
- case TE_ISCA:
- icu->ymax= 10.0;
- icu->ymin= 0.01; break;
- case TE_DISTA:
- icu->ymax= 10.0; break;
- case TE_MG_TYP:
- icu->vartype= IPO_SHORT;
- icu->ipo= IPO_CONST;
- icu->ymax= 6.0; break;
- case TE_MGH:
- icu->ymin= 0.0001;
- icu->ymax= 2.0; break;
- case TE_MG_LAC:
- case TE_MG_OFF:
- case TE_MG_GAIN:
- icu->ymax= 6.0; break;
- case TE_MG_OCT:
- icu->ymax= 8.0; break;
- case TE_N_BAS1:
- case TE_N_BAS2:
- icu->vartype= IPO_SHORT;
- icu->ipo= IPO_CONST;
- icu->ymax= 8.0; break;
- case TE_COL_R:
- icu->ymax= 0.0; break;
- case TE_COL_G:
- icu->ymax= 2.0; break;
- case TE_COL_B:
- icu->ymax= 2.0; break;
- case TE_BRIGHT:
- icu->ymax= 2.0; break;
- case TE_CONTRA:
- icu->ymax= 5.0; break;
-
+ break;
+ case ID_CU: /* curve channels ----------------------------- */
+ {
+ poin= &(icu->curval);
}
- }
- else if(icu->blocktype==ID_SEQ) {
-
- icu->ymax= 1.0;
-
- }
- else if(icu->blocktype==ID_CU) {
-
- icu->ymax= 1.0;
-
- }
- else if(icu->blocktype==ID_WO) {
-
- if(icu->adrcode < MA_MAP1) {
- switch(icu->adrcode) {
+ break;
+ case ID_KE: /* shapekey channels ----------------------------- */
+ {
+ Key *key= (Key *)id;
+ KeyBlock *kb;
+
+ for(kb= key->block.first; kb; kb= kb->next) {
+ if (kb->adrcode == icu->adrcode)
+ break;
+ }
+
+ if (kb)
+ poin= &(kb->curval);
+ }
+ break;
+ case ID_WO: /* world channels ----------------------------- */
+ {
+ World *wo= (World *)id;
+
+ switch (icu->adrcode) {
+ case WO_HOR_R:
+ poin= &(wo->horr); break;
+ case WO_HOR_G:
+ poin= &(wo->horg); break;
+ case WO_HOR_B:
+ poin= &(wo->horb); break;
+ case WO_ZEN_R:
+ poin= &(wo->zenr); break;
+ case WO_ZEN_G:
+ poin= &(wo->zeng); break;
+ case WO_ZEN_B:
+ poin= &(wo->zenb); break;
+
case WO_EXPOS:
- icu->ymax= 5.0; break;
+ poin= &(wo->exposure); break;
+
+ case WO_MISI:
+ poin= &(wo->misi); break;
case WO_MISTDI:
+ poin= &(wo->mistdist); break;
case WO_MISTSTA:
+ poin= &(wo->miststa); break;
case WO_MISTHI:
+ poin= &(wo->misthi); break;
+
+ case WO_STAR_R:
+ poin= &(wo->starr); break;
+ case WO_STAR_G:
+ poin= &(wo->starg); break;
+ case WO_STAR_B:
+ poin= &(wo->starb); break;
+
case WO_STARDIST:
+ poin= &(wo->stardist); break;
case WO_STARSIZE:
- break;
-
- default:
- icu->ymax= 1.0;
- break;
+ poin= &(wo->starsize); break;
}
- }
- else {
- switch(icu->adrcode & (MA_MAP1-1)) {
- case MAP_OFS_X:
- case MAP_OFS_Y:
- case MAP_OFS_Z:
- case MAP_SIZE_X:
- case MAP_SIZE_Y:
- case MAP_SIZE_Z:
- icu->ymax= 100.0;
- icu->ymin= -100.0;
- break;
- case MAP_R:
- case MAP_G:
- case MAP_B:
- case MAP_DVAR:
- case MAP_COLF:
- case MAP_NORF:
- case MAP_VARF:
- case MAP_DISP:
- icu->ymax= 1.0;
+ if (poin == NULL) {
+ if (icu->adrcode & MA_MAP1) mtex= wo->mtex[0];
+ else if (icu->adrcode & MA_MAP2) mtex= wo->mtex[1];
+ else if (icu->adrcode & MA_MAP3) mtex= wo->mtex[2];
+ else if (icu->adrcode & MA_MAP4) mtex= wo->mtex[3];
+ else if (icu->adrcode & MA_MAP5) mtex= wo->mtex[4];
+ else if (icu->adrcode & MA_MAP6) mtex= wo->mtex[5];
+ else if (icu->adrcode & MA_MAP7) mtex= wo->mtex[6];
+ else if (icu->adrcode & MA_MAP8) mtex= wo->mtex[7];
+ else if (icu->adrcode & MA_MAP9) mtex= wo->mtex[8];
+ else if (icu->adrcode & MA_MAP10) mtex= wo->mtex[9];
+ else if (icu->adrcode & MA_MAP11) mtex= wo->mtex[10];
+ else if (icu->adrcode & MA_MAP12) mtex= wo->mtex[11];
+ else if (icu->adrcode & MA_MAP13) mtex= wo->mtex[12];
+ else if (icu->adrcode & MA_MAP14) mtex= wo->mtex[13];
+ else if (icu->adrcode & MA_MAP15) mtex= wo->mtex[14];
+ else if (icu->adrcode & MA_MAP16) mtex= wo->mtex[15];
+ else if (icu->adrcode & MA_MAP17) mtex= wo->mtex[16];
+ else if (icu->adrcode & MA_MAP18) mtex= wo->mtex[17];
+
+ if (mtex)
+ poin= give_mtex_poin(mtex, (icu->adrcode & (MA_MAP1-1)));
}
}
- }
- else if(icu->blocktype==ID_LA) {
- if(icu->adrcode < MA_MAP1) {
- switch(icu->adrcode) {
+ break;
+ case ID_LA: /* lamp channels ----------------------------- */
+ {
+ Lamp *la= (Lamp *)id;
+
+ switch (icu->adrcode) {
case LA_ENERGY:
- case LA_DIST:
- break;
-
+ poin= &(la->energy); break;
case LA_COL_R:
+ poin= &(la->r); break;
case LA_COL_G:
+ poin= &(la->g); break;
case LA_COL_B:
+ poin= &(la->b); break;
+ case LA_DIST:
+ poin= &(la->dist); break;
+ case LA_SPOTSI:
+ poin= &(la->spotsize); break;
case LA_SPOTBL:
+ poin= &(la->spotblend); break;
case LA_QUAD1:
+ poin= &(la->att1); break;
case LA_QUAD2:
- icu->ymax= 1.0; break;
- case LA_SPOTSI:
- icu->ymax= 180.0; break;
+ poin= &(la->att2); break;
case LA_HALOINT:
- icu->ymax= 5.0; break;
+ poin= &(la->haint); break;
+ }
+
+ if (poin == NULL) {
+ if (icu->adrcode & MA_MAP1) mtex= la->mtex[0];
+ else if (icu->adrcode & MA_MAP2) mtex= la->mtex[1];
+ else if (icu->adrcode & MA_MAP3) mtex= la->mtex[2];
+ else if (icu->adrcode & MA_MAP4) mtex= la->mtex[3];
+ else if (icu->adrcode & MA_MAP5) mtex= la->mtex[4];
+ else if (icu->adrcode & MA_MAP6) mtex= la->mtex[5];
+ else if (icu->adrcode & MA_MAP7) mtex= la->mtex[6];
+ else if (icu->adrcode & MA_MAP8) mtex= la->mtex[7];
+ else if (icu->adrcode & MA_MAP9) mtex= la->mtex[8];
+ else if (icu->adrcode & MA_MAP10) mtex= la->mtex[9];
+ else if (icu->adrcode & MA_MAP11) mtex= la->mtex[10];
+ else if (icu->adrcode & MA_MAP12) mtex= la->mtex[11];
+ else if (icu->adrcode & MA_MAP13) mtex= la->mtex[12];
+ else if (icu->adrcode & MA_MAP14) mtex= la->mtex[13];
+ else if (icu->adrcode & MA_MAP15) mtex= la->mtex[14];
+ else if (icu->adrcode & MA_MAP16) mtex= la->mtex[15];
+ else if (icu->adrcode & MA_MAP17) mtex= la->mtex[16];
+ else if (icu->adrcode & MA_MAP18) mtex= la->mtex[17];
+
+ if (mtex)
+ poin= give_mtex_poin(mtex, (icu->adrcode & (MA_MAP1-1)));
}
}
- else {
- switch(icu->adrcode & (MA_MAP1-1)) {
- case MAP_OFS_X:
- case MAP_OFS_Y:
- case MAP_OFS_Z:
- case MAP_SIZE_X:
- case MAP_SIZE_Y:
- case MAP_SIZE_Z:
- icu->ymax= 100.0;
- icu->ymin= -100.0;
+ break;
+ case ID_CA: /* camera channels ----------------------------- */
+ {
+ Camera *ca= (Camera *)id;
+
+ switch (icu->adrcode) {
+ case CAM_LENS:
+ if (ca->type == CAM_ORTHO)
+ poin= &(ca->ortho_scale);
+ else
+ poin= &(ca->lens);
break;
- case MAP_R:
- case MAP_G:
- case MAP_B:
- case MAP_DVAR:
- case MAP_COLF:
- case MAP_NORF:
- case MAP_VARF:
- case MAP_DISP:
- icu->ymax= 1.0;
+ case CAM_STA:
+ poin= &(ca->clipsta); break;
+ case CAM_END:
+ poin= &(ca->clipend); break;
+
+ case CAM_YF_APERT:
+ poin= &(ca->YF_aperture); break;
+ case CAM_YF_FDIST:
+ poin= &(ca->YF_dofdist); break;
+
+ case CAM_SHIFT_X:
+ poin= &(ca->shiftx); break;
+ case CAM_SHIFT_Y:
+ poin= &(ca->shifty); break;
}
}
- }
- else if(icu->blocktype==ID_CA) {
-
- /* yafray: aperture & focal distance params */
- switch(icu->adrcode) {
- case CAM_LENS:
- icu->ymin= 1.0;
- icu->ymax= 1000.0;
- break;
- case CAM_STA:
- icu->ymin= 0.001f;
- break;
- case CAM_END:
- icu->ymin= 0.1f;
- break;
- case CAM_YF_APERT:
- icu->ymin = 0.0;
- icu->ymax = 2.0;
- break;
- case CAM_YF_FDIST:
- icu->ymin = 0.0;
- icu->ymax = 5000.0;
break;
+ case ID_SO: /* sound channels ----------------------------- */
+ {
+ bSound *snd= (bSound *)id;
- case CAM_SHIFT_X:
- case CAM_SHIFT_Y:
- icu->ymin= -2.0f;
- icu->ymax= 2.0f;
- break;
+ switch (icu->adrcode) {
+ case SND_VOLUME:
+ poin= &(snd->volume); break;
+ case SND_PITCH:
+ poin= &(snd->pitch); break;
+ case SND_PANNING:
+ poin= &(snd->panning); break;
+ case SND_ATTEN:
+ poin= &(snd->attenuation); break;
+ }
}
- }
- else if(icu->blocktype==ID_SO) {
-
- switch(icu->adrcode) {
- case SND_VOLUME:
- icu->ymin= 0.0;
- icu->ymax= 1.0;
- break;
- case SND_PITCH:
- icu->ymin= -12.0;
- icu->ymin= 12.0;
- break;
- case SND_PANNING:
- icu->ymin= 0.0;
- icu->ymax= 1.0;
- break;
- case SND_ATTEN:
- icu->ymin= 0.0;
- icu->ymin= 1.0;
break;
+ case ID_PA: /* particle channels ----------------------------- */
+ {
+ ParticleSettings *part= (ParticleSettings *)id;
+
+ switch (icu->adrcode) {
+ case PART_EMIT_FREQ:
+ case PART_EMIT_LIFE:
+ case PART_EMIT_VEL:
+ case PART_EMIT_AVE:
+ case PART_EMIT_SIZE:
+ poin= NULL;
+ break;
+
+ case PART_CLUMP:
+ poin= &(part->clumpfac); break;
+ case PART_AVE:
+ poin= &(part->avefac); break;
+ case PART_SIZE:
+ poin= &(part->size); break;
+ case PART_DRAG:
+ poin= &(part->dragfac); break;
+ case PART_BROWN:
+ poin= &(part->brownfac); break;
+ case PART_DAMP:
+ poin= &(part->dampfac); break;
+ case PART_LENGTH:
+ poin= &(part->length); break;
+ case PART_GRAV_X:
+ poin= &(part->acc[0]); break;
+ case PART_GRAV_Y:
+ poin= &(part->acc[1]); break;
+ case PART_GRAV_Z:
+ poin= &(part->acc[2]); break;
+ case PART_KINK_AMP:
+ poin= &(part->kink_amp); break;
+ case PART_KINK_FREQ:
+ poin= &(part->kink_freq); break;
+ case PART_KINK_SHAPE:
+ poin= &(part->kink_shape); break;
+ case PART_BB_TILT:
+ poin= &(part->bb_tilt); break;
+
+ case PART_PD_FSTR:
+ if (part->pd) poin= &(part->pd->f_strength);
+ break;
+ case PART_PD_FFALL:
+ if (part->pd) poin= &(part->pd->f_power);
+ break;
+ case PART_PD_FMAXD:
+ if (part->pd) poin= &(part->pd->maxdist);
+ break;
+ case PART_PD2_FSTR:
+ if (part->pd2) poin= &(part->pd2->f_strength);
+ break;
+ case PART_PD2_FFALL:
+ if (part->pd2) poin= &(part->pd2->f_power);
+ break;
+ case PART_PD2_FMAXD:
+ if (part->pd2) poin= &(part->pd2->maxdist);
+ break;
+ }
}
- }
- else if(icu->blocktype==ID_PA){
-
- switch(icu->adrcode) {
- case PART_EMIT_LIFE:
- case PART_SIZE:
- case PART_KINK_FREQ:
- case PART_EMIT_VEL:
- case PART_EMIT_AVE:
- case PART_EMIT_SIZE:
- icu->ymin= 0.0;
- break;
- case PART_CLUMP:
- icu->ymin= -1.0;
- icu->ymax= 1.0;
- break;
- case PART_DRAG:
- case PART_DAMP:
- case PART_LENGTH:
- icu->ymin= 0.0;
- icu->ymax= 1.0;
- break;
- case PART_KINK_SHAPE:
- icu->ymin= -0.999;
- icu->ymax= 0.999;
break;
- }
- }
- else if(icu->blocktype==ID_CO) {
- icu->ymin= 0.0;
- icu->ymax= 1.0f;
}
-
- /* by default, slider limits will be icu->ymin and icu->ymax */
- icu->slide_min= icu->ymin;
- icu->slide_max= icu->ymax;
-}
-/* not for actions or constraints! */
-void execute_ipo(ID *id, Ipo *ipo)
-{
- IpoCurve *icu;
- void *poin;
- int type;
-
- if(ipo==NULL) return;
-
- for(icu= ipo->curve.first; icu; icu= icu->next) {
- poin= get_ipo_poin(id, icu, &type);
- if(poin) write_ipo_poin(poin, type, icu->curval);
- }
+ /* return pointer */
+ return poin;
}
-void *get_pchan_ipo_poin(bPoseChannel *pchan, int adrcode)
+/* --------------------- IPO-Curve Limits ----------------------------- */
+
+/* set limits for IPO-curve
+ * Note: must be synced with UI and PyAPI
+ */
+void set_icu_vars (IpoCurve *icu)
{
- void *poin= NULL;
+ /* defaults. 0.0 for y-extents makes these ignored */
+ icu->ymin= icu->ymax= 0.0;
+ icu->ipo= IPO_BEZ;
- switch (adrcode) {
- case AC_QUAT_W:
- poin= &(pchan->quat[0]);
- pchan->flag |= POSE_ROT;
+ switch (icu->blocktype) {
+ case ID_OB: /* object channels ----------------------------- */
+ {
+ if (icu->adrcode == OB_LAY) {
+ icu->ipo= IPO_CONST;
+ icu->vartype= IPO_BITS;
+ }
+ }
break;
- case AC_QUAT_X:
- poin= &(pchan->quat[1]);
- pchan->flag |= POSE_ROT;
+ case ID_MA: /* material channels ----------------------------- */
+ {
+ if (icu->adrcode < MA_MAP1) {
+ switch (icu->adrcode) {
+ case MA_HASIZE:
+ icu->ymax= 10000.0; break;
+ case MA_HARD:
+ icu->ymax= 511.0; break;
+ case MA_SPEC:
+ icu->ymax= 2.0; break;
+ case MA_MODE:
+ icu->ipo= IPO_CONST;
+ icu->vartype= IPO_BITS; break;
+ case MA_RAYM:
+ icu->ymax= 1.0; break;
+ case MA_TRANSLU:
+ icu->ymax= 1.0; break;
+ case MA_IOR:
+ icu->ymin= 1.0;
+ icu->ymax= 3.0; break;
+ case MA_FRESMIR:
+ icu->ymax= 5.0; break;
+ case MA_FRESMIRI:
+ icu->ymin= 1.0;
+ icu->ymax= 5.0; break;
+ case MA_FRESTRA:
+ icu->ymax= 5.0; break;
+ case MA_FRESTRAI:
+ icu->ymin= 1.0;
+ icu->ymax= 5.0; break;
+ case MA_ADD:
+ icu->ymax= 1.0; break;
+ case MA_EMIT:
+ icu->ymax= 2.0; break;
+ default:
+ icu->ymax= 1.0; break;
+ }
+ }
+ else {
+ switch (icu->adrcode & (MA_MAP1-1)) {
+ case MAP_OFS_X:
+ case MAP_OFS_Y:
+ case MAP_OFS_Z:
+ case MAP_SIZE_X:
+ case MAP_SIZE_Y:
+ case MAP_SIZE_Z:
+ icu->ymax= 1000.0;
+ icu->ymin= -1000.0;
+ break;
+ case MAP_R:
+ case MAP_G:
+ case MAP_B:
+ case MAP_DVAR:
+ case MAP_COLF:
+ case MAP_VARF:
+ case MAP_DISP:
+ icu->ymax= 1.0;
+ break;
+ case MAP_NORF:
+ icu->ymax= 25.0;
+ break;
+ }
+ }
+ }
break;
- case AC_QUAT_Y:
- poin= &(pchan->quat[2]);
- pchan->flag |= POSE_ROT;
+ case ID_TE: /* texture channels ----------------------------- */
+ {
+ switch (icu->adrcode & (MA_MAP1-1)) {
+ case TE_NSIZE:
+ icu->ymin= 0.0001;
+ icu->ymax= 2.0; break;
+ case TE_NDEPTH:
+ icu->vartype= IPO_SHORT;
+ icu->ipo= IPO_CONST;
+ icu->ymax= 6.0; break;
+ case TE_NTYPE:
+ icu->vartype= IPO_SHORT;
+ icu->ipo= IPO_CONST;
+ icu->ymax= 1.0; break;
+ case TE_TURB:
+ icu->ymax= 200.0; break;
+ case TE_VNW1:
+ case TE_VNW2:
+ case TE_VNW3:
+ case TE_VNW4:
+ icu->ymax= 2.0;
+ icu->ymin= -2.0; break;
+ case TE_VNMEXP:
+ icu->ymax= 10.0;
+ icu->ymin= 0.01; break;
+ case TE_VN_DISTM:
+ icu->vartype= IPO_SHORT;
+ icu->ipo= IPO_CONST;
+ icu->ymax= 6.0; break;
+ case TE_VN_COLT:
+ icu->vartype= IPO_SHORT;
+ icu->ipo= IPO_CONST;
+ icu->ymax= 3.0; break;
+ case TE_ISCA:
+ icu->ymax= 10.0;
+ icu->ymin= 0.01; break;
+ case TE_DISTA:
+ icu->ymax= 10.0; break;
+ case TE_MG_TYP:
+ icu->vartype= IPO_SHORT;
+ icu->ipo= IPO_CONST;
+ icu->ymax= 6.0; break;
+ case TE_MGH:
+ icu->ymin= 0.0001;
+ icu->ymax= 2.0; break;
+ case TE_MG_LAC:
+ case TE_MG_OFF:
+ case TE_MG_GAIN:
+ icu->ymax= 6.0; break;
+ case TE_MG_OCT:
+ icu->ymax= 8.0; break;
+ case TE_N_BAS1:
+ case TE_N_BAS2:
+ icu->vartype= IPO_SHORT;
+ icu->ipo= IPO_CONST;
+ icu->ymax= 8.0; break;
+ case TE_COL_R:
+ icu->ymax= 0.0; break;
+ case TE_COL_G:
+ icu->ymax= 2.0; break;
+ case TE_COL_B:
+ icu->ymax= 2.0; break;
+ case TE_BRIGHT:
+ icu->ymax= 2.0; break;
+ case TE_CONTRA:
+ icu->ymax= 5.0; break;
+ }
+ }
break;
- case AC_QUAT_Z:
- poin= &(pchan->quat[3]);
- pchan->flag |= POSE_ROT;
+ case ID_SEQ: /* sequence channels ----------------------------- */
+ {
+ icu->ymax= 1.0;
+ }
break;
- case AC_LOC_X:
- poin= &(pchan->loc[0]);
- pchan->flag |= POSE_LOC;
+ case ID_CU: /* curve channels ----------------------------- */
+ {
+ icu->ymax= 1.0;
+ }
break;
- case AC_LOC_Y:
- poin= &(pchan->loc[1]);
- pchan->flag |= POSE_LOC;
+ case ID_WO: /* world channels ----------------------------- */
+ {
+ if (icu->adrcode < MA_MAP1) {
+ switch (icu->adrcode) {
+ case WO_EXPOS:
+ icu->ymax= 5.0; break;
+ case WO_MISTDI:
+ case WO_MISTSTA:
+ case WO_MISTHI:
+ case WO_STARDIST:
+ case WO_STARSIZE:
+ break;
+
+ default:
+ icu->ymax= 1.0;
+ break;
+ }
+ }
+ else {
+ switch (icu->adrcode & (MA_MAP1-1)) {
+ case MAP_OFS_X:
+ case MAP_OFS_Y:
+ case MAP_OFS_Z:
+ case MAP_SIZE_X:
+ case MAP_SIZE_Y:
+ case MAP_SIZE_Z:
+ icu->ymax= 100.0;
+ icu->ymin= -100.0;
+ break;
+ case MAP_R:
+ case MAP_G:
+ case MAP_B:
+ case MAP_DVAR:
+ case MAP_COLF:
+ case MAP_NORF:
+ case MAP_VARF:
+ case MAP_DISP:
+ icu->ymax= 1.0;
+ }
+ }
+ }
break;
- case AC_LOC_Z:
- poin= &(pchan->loc[2]);
- pchan->flag |= POSE_LOC;
- break;
- case AC_SIZE_X:
- poin= &(pchan->size[0]);
- pchan->flag |= POSE_SIZE;
+ case ID_LA: /* lamp channels ----------------------------- */
+ {
+ if (icu->adrcode < MA_MAP1) {
+ switch (icu->adrcode) {
+ case LA_ENERGY:
+ case LA_DIST:
+ break;
+
+ case LA_COL_R:
+ case LA_COL_G:
+ case LA_COL_B:
+ case LA_SPOTBL:
+ case LA_QUAD1:
+ case LA_QUAD2:
+ icu->ymax= 1.0; break;
+
+ case LA_SPOTSI:
+ icu->ymax= 180.0; break;
+
+ case LA_HALOINT:
+ icu->ymax= 5.0; break;
+ }
+ }
+ else {
+ switch (icu->adrcode & (MA_MAP1-1)) {
+ case MAP_OFS_X:
+ case MAP_OFS_Y:
+ case MAP_OFS_Z:
+ case MAP_SIZE_X:
+ case MAP_SIZE_Y:
+ case MAP_SIZE_Z:
+ icu->ymax= 100.0;
+ icu->ymin= -100.0;
+ break;
+ case MAP_R:
+ case MAP_G:
+ case MAP_B:
+ case MAP_DVAR:
+ case MAP_COLF:
+ case MAP_NORF:
+ case MAP_VARF:
+ case MAP_DISP:
+ icu->ymax= 1.0;
+ }
+ }
+ }
break;
- case AC_SIZE_Y:
- poin= &(pchan->size[1]);
- pchan->flag |= POSE_SIZE;
+ case ID_CA: /* camera channels ----------------------------- */
+ {
+ switch (icu->adrcode) {
+ case CAM_LENS:
+ icu->ymin= 1.0;
+ icu->ymax= 1000.0;
+ break;
+ case CAM_STA:
+ icu->ymin= 0.001f;
+ break;
+ case CAM_END:
+ icu->ymin= 0.1f;
+ break;
+
+ case CAM_YF_APERT:
+ icu->ymin = 0.0;
+ icu->ymax = 2.0;
+ break;
+ case CAM_YF_FDIST:
+ icu->ymin = 0.0;
+ icu->ymax = 5000.0;
+ break;
+
+ case CAM_SHIFT_X:
+ case CAM_SHIFT_Y:
+ icu->ymin= -2.0f;
+ icu->ymax= 2.0f;
+ break;
+ }
+ }
break;
- case AC_SIZE_Z:
- poin= &(pchan->size[2]);
- pchan->flag |= POSE_SIZE;
+ case ID_SO: /* sound channels ----------------------------- */
+ {
+ switch (icu->adrcode) {
+ case SND_VOLUME:
+ icu->ymin= 0.0;
+ icu->ymax= 1.0;
+ break;
+ case SND_PITCH:
+ icu->ymin= -12.0;
+ icu->ymin= 12.0;
+ break;
+ case SND_PANNING:
+ icu->ymin= 0.0;
+ icu->ymax= 1.0;
+ break;
+ case SND_ATTEN:
+ icu->ymin= 0.0;
+ icu->ymin= 1.0;
+ break;
+ }
+ }
break;
- }
- return poin;
-}
-
-void execute_action_ipo(bActionChannel *achan, bPoseChannel *pchan)
-{
-
- if(achan && achan->ipo) {
- IpoCurve *icu;
- for(icu= achan->ipo->curve.first; icu; icu= icu->next) {
- void *poin= get_pchan_ipo_poin(pchan, icu->adrcode);
- if(poin) {
- write_ipo_poin(poin, IPO_FLOAT, icu->curval);
- //printf("execute_action_ipo wrote_ipo_poin: %f\n", icu->curval);
- //printf("%s has poin %p value %f\n", achan->name, poin, icu->curval);
+ case ID_PA: /* particle channels ----------------------------- */
+ {
+ switch (icu->adrcode) {
+ case PART_EMIT_LIFE:
+ case PART_SIZE:
+ case PART_KINK_FREQ:
+ case PART_EMIT_VEL:
+ case PART_EMIT_AVE:
+ case PART_EMIT_SIZE:
+ icu->ymin= 0.0;
+ break;
+ case PART_CLUMP:
+ icu->ymin= -1.0;
+ icu->ymax= 1.0;
+ break;
+ case PART_DRAG:
+ case PART_DAMP:
+ case PART_LENGTH:
+ icu->ymin= 0.0;
+ icu->ymax= 1.0;
+ break;
+ case PART_KINK_SHAPE:
+ icu->ymin= -0.999;
+ icu->ymax= 0.999;
+ break;
}
}
+ break;
+ case ID_CO: /* constraint channels ----------------------------- */
+ {
+ icu->ymin= 0.0;
+ icu->ymax= 1.0f;
+ }
+ break;
}
+
+ /* by default, slider limits will be icu->ymin and icu->ymax */
+ icu->slide_min= icu->ymin;
+ icu->slide_max= icu->ymax;
}
-/* exception: it does calc for objects...
- * now find out why this routine was used anyway!
- */
-void do_ipo_nocalc(Ipo *ipo)
+/* --------------------- Pointer I/O API ----------------------------- */
+
+/* write the given value directly into the given pointer */
+void write_ipo_poin (void *poin, int type, float val)
{
- Object *ob;
- Material *ma;
- Tex *tex;
- World *wo;
- Lamp *la;
- Camera *ca;
- bSound *snd;
-
- if(ipo==NULL) return;
-
- switch(ipo->blocktype) {
- case ID_OB:
- ob= G.main->object.first;
- while(ob) {
- if(ob->ipo==ipo) {
- do_ob_ipo(ob);
- /* execute_ipo((ID *)ob, ipo); */
- }
- ob= ob->id.next;
- }
- break;
- case ID_MA:
- ma= G.main->mat.first;
- while(ma) {
- if(ma->ipo==ipo) execute_ipo((ID *)ma, ipo);
- ma= ma->id.next;
- }
- break;
- case ID_TE:
- tex= G.main->tex.first;
- while(tex) {
- if(tex->ipo==ipo) execute_ipo((ID *)tex, ipo);
- tex=tex->id.next;
- }
+ /* Note: we only support a limited number of types, with the value
+ * to set needing to be cast to the appropriate type first
+ * -> (float to integer conversions could be slow)
+ */
+ switch(type) {
+ case IPO_FLOAT:
+ *((float *)poin)= val;
break;
- case ID_WO:
- wo= G.main->world.first;
- while(wo) {
- if(wo->ipo==ipo) execute_ipo((ID *)wo, ipo);
- wo= wo->id.next;
- }
+
+ case IPO_FLOAT_DEGR: /* special hack for rotation so that it fits on same axis as other transforms */
+ *((float *)poin)= (float)(val * M_PI_2 / 9.0);
break;
- case ID_LA:
- la= G.main->lamp.first;
- while(la) {
- if(la->ipo==ipo) execute_ipo((ID *)la, ipo);
- la= la->id.next;
- }
+
+ case IPO_INT:
+ case IPO_INT_BIT: // fixme... directly revealing bitflag combinations is evil!
+ case IPO_LONG:
+ *((int *)poin)= (int)val;
break;
- case ID_CA:
- ca= G.main->camera.first;
- while(ca) {
- if(ca->ipo==ipo) execute_ipo((ID *)ca, ipo);
- ca= ca->id.next;
- }
+
+ case IPO_SHORT:
+ case IPO_SHORT_BIT: // fixme... directly revealing bitflag combinations is evil!
+ *((short *)poin)= (short)val;
break;
- case ID_SO:
- snd= G.main->sound.first;
- while(snd) {
- if(snd->ipo==ipo) execute_ipo((ID *)snd, ipo);
- snd= snd->id.next;
- }
+
+ case IPO_CHAR:
+ case IPO_CHAR_BIT: // fixme... directly revealing bitflag combinations is evil!
+ *((char *)poin)= (char)val;
break;
}
}
-void do_ipo(Ipo *ipo)
+/* read the value from the pointer that was obtained */
+float read_ipo_poin (void *poin, int type)
{
- if(ipo) {
- float ctime= frame_to_float(G.scene->r.cfra);
- calc_ipo(ipo, ctime);
-
- do_ipo_nocalc(ipo);
- }
-}
-
-
-
-void do_mat_ipo(Material *ma)
-{
- float ctime;
-
- if(ma==NULL || ma->ipo==NULL) return;
-
- ctime= frame_to_float(G.scene->r.cfra);
- /* if(ob->ipoflag & OB_OFFS_OB) ctime-= ob->sf; */
-
- calc_ipo(ma->ipo, ctime);
-
- execute_ipo((ID *)ma, ma->ipo);
-}
-
-void do_ob_ipo(Object *ob)
-{
- float ctime;
- unsigned int lay;
-
- if(ob->ipo==NULL) return;
-
- /* do not set ob->ctime here: for example when parent in invisible layer */
-
- ctime= bsystem_time(ob, (float) G.scene->r.cfra, 0.0);
-
- calc_ipo(ob->ipo, ctime);
-
- /* Patch: remember localview */
- lay= ob->lay & 0xFF000000;
-
- execute_ipo((ID *)ob, ob->ipo);
-
- ob->lay |= lay;
- if(ob->id.name[2]=='S' && ob->id.name[3]=='C' && ob->id.name[4]=='E') {
- if(strcmp(G.scene->id.name+2, ob->id.name+6)==0) {
- G.scene->lay= ob->lay;
- copy_view3d_lock(0);
- /* no redraw here! creates too many calls */
- }
- }
-}
-
-void do_ob_ipodrivers(Object *ob, Ipo *ipo, float ctime)
-{
- IpoCurve *icu;
- void *poin;
- int type;
-
- for(icu= ipo->curve.first; icu; icu= icu->next) {
- if(icu->driver) {
- icu->curval= eval_icu(icu, ctime);
- poin= get_ipo_poin((ID *)ob, icu, &type);
- if(poin) write_ipo_poin(poin, type, icu->curval);
- }
- }
-}
-
-void do_seq_ipo(Sequence *seq, int cfra)
-{
- float ctime, div;
-
- /* seq_ipo has an exception: calc both fields immediately */
+ float val = 0.0;
- if(seq->ipo) {
- if((seq->flag & SEQ_IPO_FRAME_LOCKED) != 0) {
- ctime = frame_to_float(cfra);
- div = 1.0;
- } else {
- ctime= frame_to_float(cfra - seq->startdisp);
- div= (seq->enddisp - seq->startdisp)/100.0f;
- if(div==0.0) return;
- }
+ /* Note: we only support a limited number of types, with the value
+ * to set needing to be cast to the appropriate type first
+ * -> (int to float conversions may loose accuracy in rare cases)
+ */
+ switch (type) {
+ case IPO_FLOAT:
+ val= *((float *)poin);
+ break;
- /* 2nd field */
- calc_ipo(seq->ipo, (ctime+0.5f)/div);
- execute_ipo((ID *)seq, seq->ipo);
- seq->facf1= seq->facf0;
-
- /* 1st field */
- calc_ipo(seq->ipo, ctime/div);
- execute_ipo((ID *)seq, seq->ipo);
-
- }
- else seq->facf1= seq->facf0= 1.0f;
-}
-
-int has_ipo_code(Ipo *ipo, int code)
-{
- IpoCurve *icu;
-
- if(ipo==NULL) return 0;
-
- for(icu= ipo->curve.first; icu; icu= icu->next) {
- if(icu->adrcode==code) return 1;
- }
- return 0;
-}
-
-void do_all_data_ipos()
-{
- Material *ma;
- Tex *tex;
- World *wo;
- Ipo *ipo;
- Lamp *la;
- Key *key;
- Camera *ca;
- bSound *snd;
- Sequence *seq;
- Editing *ed;
- Base *base;
- float ctime;
-
- ctime= frame_to_float(G.scene->r.cfra);
-
- /* this exception cannot be depgraphed yet... what todo with objects in other layers?... */
- for(base= G.scene->base.first; base; base= base->next) {
- /* only update layer when an ipo */
- if( has_ipo_code(base->object->ipo, OB_LAY) ) {
- do_ob_ipo(base->object);
- base->lay= base->object->lay;
- }
- }
-
- /* layers for the set...*/
- if(G.scene->set) {
- for(base= G.scene->set->base.first; base; base= base->next) {
- if( has_ipo_code(base->object->ipo, OB_LAY) ) {
- do_ob_ipo(base->object);
- base->lay= base->object->lay;
- }
- }
- }
-
-
- ipo= G.main->ipo.first;
- while(ipo) {
- if(ipo->id.us && ipo->blocktype!=ID_OB) {
- calc_ipo(ipo, ctime);
- }
- ipo= ipo->id.next;
- }
-
- for(tex= G.main->tex.first; tex; tex= tex->id.next) {
- if(tex->ipo) execute_ipo((ID *)tex, tex->ipo);
- }
-
- for(ma= G.main->mat.first; ma; ma= ma->id.next) {
- if(ma->ipo) execute_ipo((ID *)ma, ma->ipo);
- }
-
- for(wo= G.main->world.first; wo; wo= wo->id.next) {
- if(wo->ipo) execute_ipo((ID *)wo, wo->ipo);
- }
-
- for(key= G.main->key.first; key; key= key->id.next) {
- if(key->ipo) execute_ipo((ID *)key, key->ipo);
- }
-
- la= G.main->lamp.first;
- while(la) {
- if(la->ipo) execute_ipo((ID *)la, la->ipo);
- la= la->id.next;
- }
-
- ca= G.main->camera.first;
- while(ca) {
- if(ca->ipo) execute_ipo((ID *)ca, ca->ipo);
- ca= ca->id.next;
- }
-
- snd= G.main->sound.first;
- while(snd) {
- if(snd->ipo) execute_ipo((ID *)snd, snd->ipo);
- snd= snd->id.next;
- }
-
- /* process FAC Ipos used as volume envelopes */
- ed= G.scene->ed;
- if (ed) {
- seq= ed->seqbasep->first;
- while(seq) {
- if ((seq->type == SEQ_RAM_SOUND
- || seq->type == SEQ_HD_SOUND) && (seq->ipo) &&
- (seq->startdisp<=G.scene->r.cfra+2) &&
- (seq->enddisp>G.scene->r.cfra))
- do_seq_ipo(seq, G.scene->r.cfra);
- seq= seq->next;
- }
- }
-
-}
-
-
-int calc_ipo_spec(Ipo *ipo, int adrcode, float *ctime)
-{
- IpoCurve *icu;
-
- if(ipo==NULL) return 0;
-
- for(icu= ipo->curve.first; icu; icu= icu->next) {
- if(icu->adrcode == adrcode) {
- if(icu->flag & IPO_LOCK);
- else calc_icu(icu, *ctime);
-
- *ctime= icu->curval;
- return 1;
- }
- }
-
- return 0;
-}
-
-
-/* ************************** */
-
-void clear_delta_obipo(Ipo *ipo)
-{
- Object *ob;
+ case IPO_FLOAT_DEGR: /* special hack for rotation so that it fits on same axis as other transforms */
+ val= *( (float *)poin);
+ val = (float)(val / (M_PI_2/9.0));
+ break;
- if(ipo==NULL) return;
+ case IPO_INT:
+ case IPO_INT_BIT: // fixme... directly revealing bitflag combinations is evil!
+ case IPO_LONG:
+ val= (float)( *((int *)poin) );
+ break;
+
+ case IPO_SHORT:
+ case IPO_SHORT_BIT: // fixme... directly revealing bitflag combinations is evil!
+ val= *((short *)poin);
+ break;
- ob= G.main->object.first;
- while(ob) {
- if(ob->id.lib==NULL) {
- if(ob->ipo==ipo) {
- memset(&ob->dloc, 0, 12);
- memset(&ob->drot, 0, 12);
- memset(&ob->dsize, 0, 12);
- }
- }
- ob= ob->id.next;
+ case IPO_CHAR:
+ case IPO_CHAR_BIT: // fixme... directly revealing bitflag combinations is evil
+ val= *((char *)poin);
+ break;
}
-}
-
-void add_to_cfra_elem(ListBase *lb, BezTriple *bezt)
-{
- CfraElem *ce, *cen;
-
- ce= lb->first;
- while(ce) {
-
- if( ce->cfra==bezt->vec[1][0] ) {
- /* do because of double keys */
- if(bezt->f2 & SELECT) ce->sel= bezt->f2;
- return;
- }
- else if(ce->cfra > bezt->vec[1][0]) break;
-
- ce= ce->next;
- }
- cen= MEM_callocN(sizeof(CfraElem), "add_to_cfra_elem");
- if(ce) BLI_insertlinkbefore(lb, ce, cen);
- else BLI_addtail(lb, cen);
-
- cen->cfra= bezt->vec[1][0];
- cen->sel= bezt->f2;
+ /* return value */
+ return val;
}
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!! FIXME - BAD CRUFT WARNING !!!!!!!!!!!!!!!!!!!!!!!
-void make_cfra_list(Ipo *ipo, ListBase *elems)
-{
- IpoCurve *icu;
- BezTriple *bezt;
- int a;
-
- if(ipo->blocktype==ID_OB) {
- for(icu= ipo->curve.first; icu; icu= icu->next) {
- if(icu->flag & IPO_VISIBLE) {
- switch(icu->adrcode) {
- case OB_DLOC_X:
- case OB_DLOC_Y:
- case OB_DLOC_Z:
- case OB_DROT_X:
- case OB_DROT_Y:
- case OB_DROT_Z:
- case OB_DSIZE_X:
- case OB_DSIZE_Y:
- case OB_DSIZE_Z:
-
- case OB_LOC_X:
- case OB_LOC_Y:
- case OB_LOC_Z:
- case OB_ROT_X:
- case OB_ROT_Y:
- case OB_ROT_Z:
- case OB_SIZE_X:
- case OB_SIZE_Y:
- case OB_SIZE_Z:
- case OB_PD_FSTR:
- case OB_PD_FFALL:
- case OB_PD_SDAMP:
- case OB_PD_RDAMP:
- case OB_PD_PERM:
- case OB_PD_FMAXD:
- bezt= icu->bezt;
- if(bezt) {
- a= icu->totvert;
- while(a--) {
- add_to_cfra_elem(elems, bezt);
- bezt++;
- }
- }
- break;
- }
- }
- }
- }
- else if(ipo->blocktype==ID_AC) {
- for(icu= ipo->curve.first; icu; icu= icu->next) {
- if(icu->flag & IPO_VISIBLE) {
- switch(icu->adrcode) {
- case AC_LOC_X:
- case AC_LOC_Y:
- case AC_LOC_Z:
- case AC_SIZE_X:
- case AC_SIZE_Y:
- case AC_SIZE_Z:
- case AC_QUAT_W:
- case AC_QUAT_X:
- case AC_QUAT_Y:
- case AC_QUAT_Z:
- bezt= icu->bezt;
- if(bezt) {
- a= icu->totvert;
- while(a--) {
- add_to_cfra_elem(elems, bezt);
- bezt++;
- }
- }
- break;
- }
- }
- }
- }
- else {
- for(icu= ipo->curve.first; icu; icu= icu->next) {
- if(icu->flag & IPO_VISIBLE) {
- bezt= icu->bezt;
- if(bezt) {
- a= icu->totvert;
- while(a--) {
- add_to_cfra_elem(elems, bezt);
- bezt++;
- }
- }
- }
- }
- }
-
- /* what's the point of this little block of code? */
-#if 0
- if(ipo->showkey==0) {
- /* deselect all keys */
- ce= elems->first;
- while(ce) {
- ce->sel= 0;
- ce= ce->next;
- }
- }
-#endif
-}
-
-/* *********************** INTERFACE FOR KETSJI ********** */
-
+/* ***************************** IPO <--> GameEngine Interface ********************************* */
-int IPO_GetChannels(Ipo *ipo, IPO_Channel *channels)
+/* channels is max 32 items, allocated by calling function */
+short IPO_GetChannels (Ipo *ipo, IPO_Channel *channels)
{
- /* channels is max 32 items, allocated by calling function */
-
IpoCurve *icu;
- int total=0;
+ int total = 0;
- if(ipo==NULL) return 0;
+ /* don't do anything with no IPO-block */
+ if (ipo == NULL)
+ return 0;
- for(icu= ipo->curve.first; icu; icu= icu->next) {
+ /* store the IPO-curve's adrcode in the relevant channel slot */
+ for (icu=ipo->curve.first; (icu) && (total < 31); icu=icu->next, total++)
channels[total]= icu->adrcode;
- total++;
- if(total>31) break;
- }
+ /* return the number of channels stored */
return total;
}
-
-
/* Get the float value for channel 'channel' at time 'ctime' */
-
-float IPO_GetFloatValue(Ipo *ipo, IPO_Channel channel, float ctime)
+float IPO_GetFloatValue (Ipo *ipo, IPO_Channel channel, float ctime)
{
- if(ipo==NULL) return 0;
+ /* don't evaluate if no IPO to use */
+ if (ipo == NULL)
+ return 0;
+ /* only calculate the specified channel */
calc_ipo_spec(ipo, channel, &ctime);
- if (OB_ROT_X <= channel && channel <= OB_DROT_Z) {
+ /* unapply rotation hack, as gameengine doesn't use it */
+ if ((OB_ROT_X <= channel) && (channel <= OB_DROT_Z))
ctime *= (float)(M_PI_2/9.0);
- }
+ /* return the value of this channel */
return ctime;
}
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index be18c0a873a..b9a60ca9329 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -105,6 +105,7 @@
#include "depsgraph_private.h"
#include "BKE_deform.h"
#include "BKE_shrinkwrap.h"
+#include "BKE_simple_deform.h"
#include "LOD_DependKludge.h"
#include "LOD_decimation.h"
@@ -2138,6 +2139,8 @@ typedef struct SmoothMesh {
DerivedMesh *dm;
float threshold; /* the cosine of the smoothing angle */
int flags;
+ MemArena *arena;
+ ListBase propagatestack, reusestack;
} SmoothMesh;
static SmoothVert *smoothvert_copy(SmoothVert *vert, SmoothMesh *mesh)
@@ -2220,6 +2223,9 @@ static void smoothmesh_free(SmoothMesh *mesh)
for(i = 0; i < mesh->num_edges; ++i)
BLI_linklist_free(mesh->edges[i].faces, NULL);
+
+ if(mesh->arena)
+ BLI_memarena_free(mesh->arena);
MEM_freeN(mesh->verts);
MEM_freeN(mesh->edges);
@@ -2871,6 +2877,49 @@ static void split_single_vert(SmoothVert *vert, SmoothFace *face,
face_replace_vert(face, &repdata);
}
+typedef struct PropagateEdge {
+ struct PropagateEdge *next, *prev;
+ SmoothEdge *edge;
+ SmoothVert *vert;
+} PropagateEdge;
+
+static void push_propagate_stack(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh)
+{
+ PropagateEdge *pedge = mesh->reusestack.first;
+
+ if(pedge) {
+ BLI_remlink(&mesh->reusestack, pedge);
+ }
+ else {
+ if(!mesh->arena) {
+ mesh->arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+ BLI_memarena_use_calloc(mesh->arena);
+ }
+
+ pedge = BLI_memarena_alloc(mesh->arena, sizeof(PropagateEdge));
+ }
+
+ pedge->edge = edge;
+ pedge->vert = vert;
+ BLI_addhead(&mesh->propagatestack, pedge);
+}
+
+static void pop_propagate_stack(SmoothEdge **edge, SmoothVert **vert, SmoothMesh *mesh)
+{
+ PropagateEdge *pedge = mesh->propagatestack.first;
+
+ if(pedge) {
+ *edge = pedge->edge;
+ *vert = pedge->vert;
+ BLI_remlink(&mesh->propagatestack, pedge);
+ BLI_addhead(&mesh->reusestack, pedge);
+ }
+ else {
+ *edge = NULL;
+ *vert = NULL;
+ }
+}
+
static void split_edge(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh);
static void propagate_split(SmoothEdge *edge, SmoothVert *vert,
@@ -2948,7 +2997,7 @@ static void split_edge(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh)
if(!edge2) {
/* didn't find a sharp or loose edge, so try the other vert */
vert2 = other_vert(edge, vert);
- propagate_split(edge, vert2, mesh);
+ push_propagate_stack(edge, vert2, mesh);
} else if(!edge_is_loose(edge2)) {
/* edge2 is not loose, so it must be sharp */
SmoothEdge *copy_edge = smoothedge_copy(edge, mesh);
@@ -2977,11 +3026,11 @@ static void split_edge(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh)
/* all copying and replacing is done; the mesh should be consistent.
* now propagate the split to the vertices at either end
*/
- propagate_split(copy_edge, other_vert(copy_edge, vert2), mesh);
- propagate_split(copy_edge2, other_vert(copy_edge2, vert2), mesh);
+ push_propagate_stack(copy_edge, other_vert(copy_edge, vert2), mesh);
+ push_propagate_stack(copy_edge2, other_vert(copy_edge2, vert2), mesh);
if(smoothedge_has_vert(edge, vert))
- propagate_split(edge, vert, mesh);
+ push_propagate_stack(edge, vert, mesh);
} else {
/* edge2 is loose */
SmoothEdge *copy_edge = smoothedge_copy(edge, mesh);
@@ -3004,10 +3053,10 @@ static void split_edge(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh)
/* copying and replacing is done; the mesh should be consistent.
* now propagate the split to the vertex at the other end
*/
- propagate_split(copy_edge, other_vert(copy_edge, vert2), mesh);
+ push_propagate_stack(copy_edge, other_vert(copy_edge, vert2), mesh);
if(smoothedge_has_vert(edge, vert))
- propagate_split(edge, vert, mesh);
+ push_propagate_stack(edge, vert, mesh);
}
BLI_linklist_free(visited_faces, NULL);
@@ -3079,6 +3128,7 @@ static void tag_and_count_extra_edges(SmoothMesh *mesh, float split_angle,
static void split_sharp_edges(SmoothMesh *mesh, float split_angle, int flags)
{
+ SmoothVert *vert;
int i;
/* if normal1 dot normal2 < threshold, angle is greater, so split */
/* FIXME not sure if this always works */
@@ -3091,10 +3141,16 @@ static void split_sharp_edges(SmoothMesh *mesh, float split_angle, int flags)
for(i = 0; i < mesh->num_edges; i++) {
SmoothEdge *edge = &mesh->edges[i];
- if(edge_is_sharp(edge, flags, mesh->threshold))
+ if(edge_is_sharp(edge, flags, mesh->threshold)) {
split_edge(edge, edge->verts[0], mesh);
- }
+ do {
+ pop_propagate_stack(&edge, &vert, mesh);
+ if(edge && smoothedge_has_vert(edge, vert))
+ propagate_split(edge, vert, mesh);
+ } while(edge);
+ }
+ }
}
static int count_bridge_verts(SmoothMesh *mesh)
@@ -6542,7 +6598,7 @@ static void explodeModifier_createFacepa(ExplodeModifierData *emd,
/* make tree of emitter locations */
tree=BLI_kdtree_new(totpart);
for(p=0,pa=psys->particles; p<totpart; p++,pa++){
- psys_particle_on_dm(ob,psmd->dm,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,0,0,0,0,0);
+ psys_particle_on_dm(psmd->dm,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,0,0,0,0,0);
BLI_kdtree_insert(tree, p, co, NULL);
}
BLI_kdtree_balance(tree);
@@ -7062,7 +7118,6 @@ static DerivedMesh * explodeModifier_explodeMesh(ExplodeModifierData *emd,
{
DerivedMesh *explode, *dm=to_explode;
MFace *mf=0;
- MVert *dupvert=0;
ParticleSettings *part=psmd->psys->part;
ParticleData *pa=NULL, *pars=psmd->psys->particles;
ParticleKey state;
@@ -7117,7 +7172,7 @@ static DerivedMesh * explodeModifier_explodeMesh(ExplodeModifierData *emd,
/* the final duplicated vertices */
explode= CDDM_from_template(dm, totdup, 0,totface);
- dupvert= CDDM_get_verts(explode);
+ /*dupvert= CDDM_get_verts(explode);*/
/* getting back to object space */
Mat4Invert(imat,ob->obmat);
@@ -7146,7 +7201,7 @@ static DerivedMesh * explodeModifier_explodeMesh(ExplodeModifierData *emd,
pa= pars+i;
/* get particle state */
- psys_particle_on_emitter(ob, psmd,part->from,pa->num,-1,pa->fuv,pa->foffset,loc0,nor,0,0,0,0);
+ psys_particle_on_emitter(psmd,part->from,pa->num,-1,pa->fuv,pa->foffset,loc0,nor,0,0,0,0);
Mat4MulVecfl(ob->obmat,loc0);
state.time=cfra;
@@ -7743,7 +7798,7 @@ static void shrinkwrapModifier_deformVerts(ModifierData *md, Object *ob, Derived
CustomDataMask dataMask = shrinkwrapModifier_requiredDataMask(md);
/* We implement requiredDataMask but thats not really usefull since mesh_calc_modifiers pass a NULL derivedData or without the modified vertexs applied */
- if(shrinkwrapModifier_requiredDataMask(md))
+ if(dataMask)
{
if(derivedData) dm = CDDM_copy(derivedData);
else if(ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, ob);
@@ -7797,6 +7852,109 @@ static void shrinkwrapModifier_updateDepgraph(ModifierData *md, DagForest *fores
dag_add_relation(forest, dag_get_node(forest, smd->auxTarget), obNode, DAG_RL_OB_DATA | DAG_RL_DATA_DATA, "Shrinkwrap Modifier");
}
+/* SimpleDeform */
+static void simpledeformModifier_initData(ModifierData *md)
+{
+ SimpleDeformModifierData *smd = (SimpleDeformModifierData*) md;
+
+ smd->mode = MOD_SIMPLEDEFORM_MODE_TWIST;
+ smd->axis = 0;
+
+ smd->origin = NULL;
+ smd->factor = 0.35f;
+ smd->limit[0] = 0.0f;
+ smd->limit[1] = 1.0f;
+}
+
+static void simpledeformModifier_copyData(ModifierData *md, ModifierData *target)
+{
+ SimpleDeformModifierData *smd = (SimpleDeformModifierData*)md;
+ SimpleDeformModifierData *tsmd = (SimpleDeformModifierData*)target;
+
+ tsmd->mode = smd->mode;
+ tsmd->axis = smd->axis;
+ tsmd->origin= smd->origin;
+ tsmd->factor= smd->factor;
+ memcpy(tsmd->limit, smd->limit, sizeof(tsmd->limit));
+}
+
+static CustomDataMask simpledeformModifier_requiredDataMask(ModifierData *md)
+{
+ SimpleDeformModifierData *smd = (SimpleDeformModifierData *)md;
+ CustomDataMask dataMask = 0;
+
+ /* ask for vertexgroups if we need them */
+ if(smd->vgroup_name[0])
+ dataMask |= (1 << CD_MDEFORMVERT);
+
+ return dataMask;
+}
+
+static void simpledeformModifier_foreachObjectLink(ModifierData *md, Object *ob, void (*walk)(void *userData, Object *ob, Object **obpoin), void *userData)
+{
+ SimpleDeformModifierData *smd = (SimpleDeformModifierData*)md;
+ walk(userData, ob, &smd->origin);
+}
+
+static void simpledeformModifier_updateDepgraph(ModifierData *md, DagForest *forest, Object *ob, DagNode *obNode)
+{
+ SimpleDeformModifierData *smd = (SimpleDeformModifierData*)md;
+
+ if (smd->origin)
+ dag_add_relation(forest, dag_get_node(forest, smd->origin), obNode, DAG_RL_OB_DATA, "SimpleDeform Modifier");
+}
+
+static void simpledeformModifier_deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
+{
+ DerivedMesh *dm = NULL;
+ CustomDataMask dataMask = simpledeformModifier_requiredDataMask(md);
+
+ /* We implement requiredDataMask but thats not really usefull since mesh_calc_modifiers pass a NULL derivedData or without the modified vertexs applied */
+ if(dataMask)
+ {
+ if(derivedData) dm = CDDM_copy(derivedData);
+ else if(ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, ob);
+ else return;
+
+ if(dataMask & CD_MVERT)
+ {
+ CDDM_apply_vert_coords(dm, vertexCos);
+ CDDM_calc_normals(dm);
+ }
+ }
+
+ SimpleDeformModifier_do((SimpleDeformModifierData*)md, ob, dm, vertexCos, numVerts);
+
+ if(dm)
+ dm->release(dm);
+
+}
+
+static void simpledeformModifier_deformVertsEM(ModifierData *md, Object *ob, EditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
+{
+ DerivedMesh *dm = NULL;
+ CustomDataMask dataMask = simpledeformModifier_requiredDataMask(md);
+
+ /* We implement requiredDataMask but thats not really usefull since mesh_calc_modifiers pass a NULL derivedData or without the modified vertexs applied */
+ if(dataMask)
+ {
+ if(derivedData) dm = CDDM_copy(derivedData);
+ else if(ob->type==OB_MESH) dm = CDDM_from_editmesh(editData, ob->data);
+ else return;
+
+ if(dataMask & CD_MVERT)
+ {
+ CDDM_apply_vert_coords(dm, vertexCos);
+ CDDM_calc_normals(dm);
+ }
+ }
+
+ SimpleDeformModifier_do((SimpleDeformModifierData*)md, ob, dm, vertexCos, numVerts);
+
+ if(dm)
+ dm->release(dm);
+}
+
/***/
static ModifierTypeInfo typeArr[NUM_MODIFIER_TYPES];
@@ -8154,6 +8312,20 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
mti->deformVertsEM = shrinkwrapModifier_deformVertsEM;
mti->updateDepgraph = shrinkwrapModifier_updateDepgraph;
+ mti = INIT_TYPE(SimpleDeform);
+ mti->type = eModifierTypeType_OnlyDeform;
+ mti->flags = eModifierTypeFlag_AcceptsMesh
+ | eModifierTypeFlag_AcceptsCVs
+ | eModifierTypeFlag_SupportsEditmode
+ | eModifierTypeFlag_EnableInEditmode;
+ mti->initData = simpledeformModifier_initData;
+ mti->copyData = simpledeformModifier_copyData;
+ mti->requiredDataMask = simpledeformModifier_requiredDataMask;
+ mti->deformVerts = simpledeformModifier_deformVerts;
+ mti->deformVertsEM = simpledeformModifier_deformVertsEM;
+ mti->foreachObjectLink = simpledeformModifier_foreachObjectLink;
+ mti->updateDepgraph = simpledeformModifier_updateDepgraph;
+
typeArrInit = 0;
#undef INIT_TYPE
}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 7b53d770861..b6f6820ca73 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -70,6 +70,7 @@
#include "BKE_armature.h"
#include "BKE_action.h"
+#include "BKE_bullet.h"
#include "BKE_colortools.h"
#include "BKE_deform.h"
#include "BKE_DerivedMesh.h"
@@ -179,6 +180,14 @@ void object_free_softbody(Object *ob)
}
}
+void object_free_bulletsoftbody(Object *ob)
+{
+ if(ob->bsoft) {
+ bsbFree(ob->bsoft);
+ ob->bsoft= NULL;
+ }
+}
+
void object_free_modifiers(Object *ob)
{
while (ob->modifiers.first) {
@@ -269,6 +278,7 @@ void free_object(Object *ob)
MEM_freeN(ob->pd);
}
if(ob->soft) sbFree(ob->soft);
+ if(ob->bsoft) bsbFree(ob->bsoft);
if(ob->gpulamp.first) GPU_lamp_free(ob);
}
@@ -749,7 +759,9 @@ void *add_lamp(char *name)
la->sun_intensity = 1.0;
la->skyblendtype= MA_RAMP_ADD;
la->skyblendfac= 1.0f;
-
+ la->sky_colorspace= BLI_CS_CIE;
+ la->sky_exposure= 1.0f;
+
curvemapping_initialize(la->curfalloff);
return la;
}
@@ -1047,6 +1059,17 @@ SoftBody *copy_softbody(SoftBody *sb)
return sbn;
}
+BulletSoftBody *copy_bulletsoftbody(BulletSoftBody *bsb)
+{
+ BulletSoftBody *bsbn;
+
+ if (bsb == NULL)
+ return NULL;
+ bsbn = MEM_dupallocN(bsb);
+ /* no pointer in this structure yet */
+ return bsbn;
+}
+
ParticleSystem *copy_particlesystem(ParticleSystem *psys)
{
ParticleSystem *psysn;
@@ -1217,6 +1240,7 @@ Object *copy_object(Object *ob)
id_us_plus(&(obn->pd->tex->id));
}
obn->soft= copy_softbody(ob->soft);
+ obn->bsoft = copy_bulletsoftbody(ob->bsoft);
copy_object_particlesystems(obn, ob);
@@ -1456,22 +1480,42 @@ float bsystem_time(Object *ob, float cfra, float ofs)
return cfra;
}
-void object_to_mat3(Object *ob, float mat[][3]) /* no parent */
+void object_scale_to_mat3(Object *ob, float mat[][3])
{
- float smat[3][3], vec[3];
- float rmat[3][3];
- /*float q1[4];*/
-
- /* size */
+ float vec[3];
if(ob->ipo) {
vec[0]= ob->size[0]+ob->dsize[0];
vec[1]= ob->size[1]+ob->dsize[1];
vec[2]= ob->size[2]+ob->dsize[2];
- SizeToMat3(vec, smat);
+ SizeToMat3(vec, mat);
}
else {
- SizeToMat3(ob->size, smat);
+ SizeToMat3(ob->size, mat);
}
+}
+
+void object_rot_to_mat3(Object *ob, float mat[][3])
+{
+ float vec[3];
+ if(ob->ipo) {
+ vec[0]= ob->rot[0]+ob->drot[0];
+ vec[1]= ob->rot[1]+ob->drot[1];
+ vec[2]= ob->rot[2]+ob->drot[2];
+ EulToMat3(vec, mat);
+ }
+ else {
+ EulToMat3(ob->rot, mat);
+ }
+}
+
+void object_to_mat3(Object *ob, float mat[][3]) /* no parent */
+{
+ float smat[3][3];
+ float rmat[3][3];
+ /*float q1[4];*/
+
+ /* size */
+ object_scale_to_mat3(ob, smat);
/* rot */
/* Quats arnt used yet */
@@ -1485,15 +1529,7 @@ void object_to_mat3(Object *ob, float mat[][3]) /* no parent */
}
}
else {*/
- if(ob->ipo) {
- vec[0]= ob->rot[0]+ob->drot[0];
- vec[1]= ob->rot[1]+ob->drot[1];
- vec[2]= ob->rot[2]+ob->drot[2];
- EulToMat3(vec, rmat);
- }
- else {
- EulToMat3(ob->rot, rmat);
- }
+ object_rot_to_mat3(ob, rmat);
/*}*/
Mat3MulMat3(mat, rmat, smat);
}
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 878cb08c950..44ee5c236fa 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -1117,8 +1117,8 @@ static void psys_origspace_to_w(OrigSpaceFace *osface, int quad, float *w, float
}
}
-/* find the derived mesh face for a particle, set the mf passed.
-This is slow, can be optimized but only for many lookups, return the face lookup index*/
+/* find the derived mesh face for a particle, set the mf passed. this is slow
+ * and can be optimized but only for many lookups. returns the face index. */
int psys_particle_dm_face_lookup(Object *ob, DerivedMesh *dm, int index, float *fw, struct LinkNode *node)
{
Mesh *me= (Mesh*)ob->data;
@@ -1186,168 +1186,142 @@ int psys_particle_dm_face_lookup(Object *ob, DerivedMesh *dm, int index, float *
return DMCACHE_NOTFOUND;
}
-/* interprets particle data to get a point on a mesh in object space */
-#define PARTICLE_ON_DM_ERROR \
- { if(vec) { vec[0]=vec[1]=vec[2]=0.0; } \
- if(nor) { nor[0]=nor[1]=0.0; nor[2]=1.0; } \
- if(orco) { orco[0]=orco[1]=orco[2]=0.0; } \
- if(ornor) { ornor[0]=ornor[1]=0.0; ornor[2]=1.0; } \
- if(utan) { utan[0]=utan[1]=utan[2]=0.0; } \
- if(vtan) { vtan[0]=vtan[1]=vtan[2]=0.0; } }
-
-void psys_particle_on_dm(Object *ob, DerivedMesh *dm, int from, int index, int index_dmcache, float *fw, float foffset, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor)
+static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache, float *fw, float foffset, int *mapindex, float *mapfw)
{
- float temp1[3];
- float (*orcodata)[3];
-
- if(index < 0) { /* 'no dm' error has happened! */
- PARTICLE_ON_DM_ERROR;
- return;
- }
- orcodata= dm->getVertDataArray(dm, CD_ORCO);
+ if(index < 0)
+ return 0;
if (dm->deformedOnly || index_dmcache == DMCACHE_ISCHILD) {
- /* this works for meshes with deform verts only - constructive modifiers wont work properly*/
+ /* for meshes that are either only defined or for child particles, the
+ * index and fw do not require any mapping, so we can directly use it */
if(from == PART_FROM_VERT) {
- if(index >= dm->getNumVerts(dm)) {
- PARTICLE_ON_DM_ERROR;
- return;
- }
-
- dm->getVertCo(dm,index,vec);
- if(nor){
- dm->getVertNo(dm,index,nor);
- Normalize(nor);
- }
- if(orco)
- VECCOPY(orco, orcodata[index])
- if(ornor) {
- dm->getVertNo(dm,index,nor);
- Normalize(nor);
- }
- }
- else { /* PART_FROM_FACE / PART_FROM_VOLUME */
- MFace *mface;
- MTFace *mtface=0;
- MVert *mvert;
- int uv_index;
-
- if(index >= dm->getNumFaces(dm)) {
- PARTICLE_ON_DM_ERROR;
- return;
- }
-
- mface=dm->getFaceData(dm,index,CD_MFACE);
- mvert=dm->getVertDataArray(dm,CD_MVERT);
- uv_index=CustomData_get_active_layer_index(&dm->faceData,CD_MTFACE);
+ if(index >= dm->getNumVerts(dm))
+ return 0;
- if(uv_index>=0){
- CustomDataLayer *layer=&dm->faceData.layers[uv_index];
- mtface= &((MTFace*)layer->data)[index];
- }
+ *mapindex = index;
+ }
+ else { /* FROM_FACE/FROM_VOLUME */
+ if(index >= dm->getNumFaces(dm))
+ return 0;
- if(from==PART_FROM_VOLUME){
- psys_interpolate_face(mvert,mface,mtface,orcodata,fw,vec,temp1,utan,vtan,orco,ornor);
- if(nor)
- VECCOPY(nor,temp1);
- Normalize(temp1);
- VecMulf(temp1,-foffset);
- VECADD(vec,vec,temp1);
- }
- else
- psys_interpolate_face(mvert,mface,mtface,orcodata,fw,vec,nor,utan,vtan,orco,ornor);
+ *mapindex = index;
+ QUATCOPY(mapfw, fw);
}
} else {
- /* Need to support constructive modifiers, this is a bit more tricky
- we need a customdata layer like UV's so we can position the particle */
-
- /* Only face supported at the moment */
- if(ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME)) {
+ /* for other meshes that have been modified, we try to map the particle
+ * to their new location, which means a different index, and for faces
+ * also a new face interpolation weights */
+ if(from == PART_FROM_VERT) {
+ if (index_dmcache == DMCACHE_NOTFOUND || index_dmcache > dm->getNumVerts(dm))
+ return 0;
+
+ *mapindex = index_dmcache;
+ }
+ else { /* FROM_FACE/FROM_VOLUME */
/* find a face on the derived mesh that uses this face */
- Mesh *me= (Mesh*)ob->data;
- MVert *mvert;
MFace *mface;
- MTFace *mtface;
OrigSpaceFace *osface;
- int *origindex;
- float fw_mod[4];
- int i, totface;
-
- mvert= dm->getVertDataArray(dm,CD_MVERT);
+ int i;
+
+ i = index_dmcache;
+
+ if(i== DMCACHE_NOTFOUND || i >= dm->getNumFaces(dm))
+ return 0;
+ *mapindex = i;
+
+ /* modify the original weights to become
+ * weights for the derived mesh face */
osface= dm->getFaceDataArray(dm, CD_ORIGSPACE);
- origindex= dm->getFaceDataArray(dm, CD_ORIGINDEX);
+ mface= dm->getFaceData(dm, i, CD_MFACE);
- /* For this to work we need origindex and OrigSpace coords */
- if(origindex==NULL || osface==NULL || index>=me->totface) {
- PARTICLE_ON_DM_ERROR;
- return;
- }
-
- if (index_dmcache == DMCACHE_NOTFOUND)
- i = psys_particle_dm_face_lookup(ob, dm, index, fw, (LinkNode*)NULL);
+ if(osface == NULL)
+ mapfw[0]= mapfw[1]= mapfw[2]= mapfw[3]= 0.0f;
else
- i = index_dmcache;
+ psys_origspace_to_w(&osface[i], mface->v4, fw, mapfw);
+ }
+ }
- totface = dm->getNumFaces(dm);
+ return 1;
+}
- /* Any time this happens, and the face has not been removed,
- * its a BUG watch out for this error! */
- if (i==-1) {
- printf("Cannot find original face %i\n", index);
- PARTICLE_ON_DM_ERROR;
- return;
- }
- else if(i >= totface)
- return;
+/* interprets particle data to get a point on a mesh in object space */
+void psys_particle_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache, float *fw, float foffset, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor)
+{
+ float tmpnor[3], mapfw[4];
+ float (*orcodata)[3];
+ int mapindex;
- mface= dm->getFaceData(dm, i, CD_MFACE);
- mtface= dm->getFaceData(dm, i, CD_MTFACE);
- osface += i;
-
- /* we need to modify the original weights to become weights for
- * the derived mesh face */
- psys_origspace_to_w(osface, mface->v4, fw, fw_mod);
-
- if(from==PART_FROM_VOLUME){
- psys_interpolate_face(mvert,mface,mtface,orcodata,fw_mod,vec,temp1,utan,vtan,orco,ornor);
- if(nor)
- VECCOPY(nor,temp1);
- Normalize(temp1);
- VecMulf(temp1,-foffset);
- VECADD(vec,vec,temp1);
- }
- else
- psys_interpolate_face(mvert,mface,mtface,orcodata,fw_mod,vec,nor,utan,vtan,orco,ornor);
+ if(!psys_map_index_on_dm(dm, from, index, index_dmcache, fw, foffset, &mapindex, mapfw)) {
+ if(vec) { vec[0]=vec[1]=vec[2]=0.0; }
+ if(nor) { nor[0]=nor[1]=0.0; nor[2]=1.0; }
+ if(orco) { orco[0]=orco[1]=orco[2]=0.0; }
+ if(ornor) { ornor[0]=ornor[1]=0.0; ornor[2]=1.0; }
+ if(utan) { utan[0]=utan[1]=utan[2]=0.0; }
+ if(vtan) { vtan[0]=vtan[1]=vtan[2]=0.0; }
+
+ return;
+ }
+
+ orcodata= dm->getVertDataArray(dm, CD_ORCO);
+
+ if(from == PART_FROM_VERT) {
+ dm->getVertCo(dm,mapindex,vec);
+
+ if(nor) {
+ dm->getVertNo(dm,mapindex,nor);
+ Normalize(nor);
}
- else if(from == PART_FROM_VERT) {
- if (index_dmcache == DMCACHE_NOTFOUND || index_dmcache > dm->getNumVerts(dm)) {
- PARTICLE_ON_DM_ERROR;
- return;
- }
- dm->getVertCo(dm,index_dmcache,vec);
- if(nor) {
- dm->getVertNo(dm,index_dmcache,nor);
- Normalize(nor);
- }
- if(orco)
- VECCOPY(orco, orcodata[index])
- if(ornor) {
- dm->getVertNo(dm,index_dmcache,nor);
- Normalize(nor);
- }
- if(utan && vtan) {
- utan[0]= utan[1]= utan[2]= 0.0f;
- vtan[0]= vtan[1]= vtan[2]= 0.0f;
- }
+ if(orco)
+ VECCOPY(orco, orcodata[mapindex])
+
+ if(ornor) {
+ dm->getVertNo(dm,mapindex,nor);
+ Normalize(nor);
}
- else {
- PARTICLE_ON_DM_ERROR;
+
+ if(utan && vtan) {
+ utan[0]= utan[1]= utan[2]= 0.0f;
+ vtan[0]= vtan[1]= vtan[2]= 0.0f;
}
}
+ else { /* PART_FROM_FACE / PART_FROM_VOLUME */
+ MFace *mface;
+ MTFace *mtface;
+ MVert *mvert;
+
+ mface=dm->getFaceData(dm,mapindex,CD_MFACE);
+ mvert=dm->getVertDataArray(dm,CD_MVERT);
+ mtface=CustomData_get_layer(&dm->faceData,CD_MTFACE);
+
+ if(mtface)
+ mtface += mapindex;
+
+ if(from==PART_FROM_VOLUME) {
+ psys_interpolate_face(mvert,mface,mtface,orcodata,mapfw,vec,tmpnor,utan,vtan,orco,ornor);
+ if(nor)
+ VECCOPY(nor,tmpnor);
+
+ Normalize(tmpnor);
+ VecMulf(tmpnor,-foffset);
+ VECADD(vec,vec,tmpnor);
+ }
+ else
+ psys_interpolate_face(mvert,mface,mtface,orcodata,mapfw,vec,nor,utan,vtan,orco,ornor);
+ }
+}
+
+float psys_particle_value_from_verts(DerivedMesh *dm, short from, ParticleData *pa, float *values)
+{
+ float mapfw[4];
+ int mapindex;
+
+ if(!psys_map_index_on_dm(dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, &mapindex, mapfw))
+ return 0.0f;
+
+ return psys_interpolate_value_from_verts(dm, from, mapindex, mapfw, values);
}
-#undef PARTICLE_ON_DM_ERROR
ParticleSystemModifierData *psys_get_modifier(Object *ob, ParticleSystem *psys)
{
@@ -1368,7 +1342,7 @@ ParticleSystemModifierData *psys_get_modifier(Object *ob, ParticleSystem *psys)
/* Particles on a shape */
/************************************************/
/* ready for future use */
-void psys_particle_on_shape(int distr, int index, float *fuv, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor)
+static void psys_particle_on_shape(int distr, int index, float *fuv, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor)
{
/* TODO */
float zerovec[3]={0.0f,0.0f,0.0f};
@@ -1394,7 +1368,7 @@ void psys_particle_on_shape(int distr, int index, float *fuv, float *vec, float
/************************************************/
/* Particles on emitter */
/************************************************/
-void psys_particle_on_emitter(Object *ob, ParticleSystemModifierData *psmd, int from, int index, int index_dmcache, float *fuv, float foffset, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor){
+void psys_particle_on_emitter(ParticleSystemModifierData *psmd, int from, int index, int index_dmcache, float *fuv, float foffset, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor){
if(psmd){
if(psmd->psys->part->distr==PART_DISTR_GRID && psmd->psys->part->from != PART_FROM_VERT){
if(vec){
@@ -1403,7 +1377,7 @@ void psys_particle_on_emitter(Object *ob, ParticleSystemModifierData *psmd, int
return;
}
/* we cant use the num_dmcache */
- psys_particle_on_dm(ob, psmd->dm,from,index,index_dmcache,fuv,foffset,vec,nor,utan,vtan,orco,ornor);
+ psys_particle_on_dm(psmd->dm,from,index,index_dmcache,fuv,foffset,vec,nor,utan,vtan,orco,ornor);
}
else
psys_particle_on_shape(from,index,fuv,vec,nor,utan,vtan,orco,ornor);
@@ -1834,14 +1808,14 @@ void psys_find_parents(Object *ob, ParticleSystemModifierData *psmd, ParticleSys
tree=BLI_kdtree_new(totparent);
for(p=0,cpa=psys->child; p<totparent; p++,cpa++){
- psys_particle_on_emitter(ob,psmd,from,cpa->num,-1,cpa->fuv,cpa->foffset,co,0,0,0,orco,0);
+ psys_particle_on_emitter(psmd,from,cpa->num,-1,cpa->fuv,cpa->foffset,co,0,0,0,orco,0);
BLI_kdtree_insert(tree, p, orco, NULL);
}
BLI_kdtree_balance(tree);
for(; p<totchild; p++,cpa++){
- psys_particle_on_emitter(ob,psmd,from,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co,0,0,0,orco,0);
+ psys_particle_on_emitter(psmd,from,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co,0,0,0,orco,0);
cpa->parent=BLI_kdtree_find_nearest(tree, orco, NULL, NULL);
}
@@ -2033,7 +2007,7 @@ void psys_thread_create_path(ParticleThread *thread, struct ChildParticle *cpa,
cpa_fuv = cpa->fuv;
cpa_from = PART_FROM_FACE;
- psys_particle_on_emitter(ob,ctx->psmd,cpa_from,cpa_num,DMCACHE_ISCHILD,cpa->fuv,foffset,co,ornor,0,0,orco,0);
+ psys_particle_on_emitter(ctx->psmd,cpa_from,cpa_num,DMCACHE_ISCHILD,cpa->fuv,foffset,co,ornor,0,0,orco,0);
/* we need to save the actual root position of the child for positioning it accurately to the surface of the emitter */
VECCOPY(cpa_1st,co);
@@ -2059,7 +2033,7 @@ void psys_thread_create_path(ParticleThread *thread, struct ChildParticle *cpa,
cpa_num=pa->num;
cpa_fuv=pa->fuv;
- psys_particle_on_emitter(ob,ctx->psmd,cpa_from,cpa_num,DMCACHE_ISCHILD,cpa_fuv,pa->foffset,co,ornor,0,0,orco,0);
+ psys_particle_on_emitter(ctx->psmd,cpa_from,cpa_num,DMCACHE_ISCHILD,cpa_fuv,pa->foffset,co,ornor,0,0,orco,0);
}
keys->steps = ctx->steps;
@@ -2268,7 +2242,7 @@ void psys_thread_create_path(ParticleThread *thread, struct ChildParticle *cpa,
}
}
-void *exec_child_path_cache(void *data)
+static void *exec_child_path_cache(void *data)
{
ParticleThread *thread= (ParticleThread*)data;
ParticleThreadContext *ctx= thread->ctx;
@@ -2437,7 +2411,7 @@ void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupda
if(!edit && !psys->totchild) {
pa_length = part->length * (1.0f - part->randlength*pa->r_ave[0]);
if(vg_length)
- pa_length *= psys_interpolate_value_from_verts(psmd->dm,part->from,pa->num,pa->fuv,vg_length);
+ pa_length *= psys_particle_value_from_verts(psmd->dm,part->from,pa,vg_length);
}
cache[i]->steps = steps;
@@ -2598,7 +2572,7 @@ void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupda
effector= 1.0f;
if(vg_effector)
- effector*= psys_interpolate_value_from_verts(psmd->dm,psys->part->from,pa->num,pa->fuv,vg_effector);
+ effector*= psys_particle_value_from_verts(psmd->dm,psys->part->from,pa,vg_effector);
for(k=0, ca=cache[i]; k<=steps; k++, ca++) {
/* apply effectors */
@@ -2839,7 +2813,7 @@ void psys_mat_hair_to_object(Object *ob, DerivedMesh *dm, short from, ParticleDa
float vec[3];
psys_face_mat(0, dm, pa, hairmat, 0);
- psys_particle_on_dm(ob, dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, vec, 0, 0, 0, 0, 0);
+ psys_particle_on_dm(dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, vec, 0, 0, 0, 0, 0);
VECCOPY(hairmat[3],vec);
}
@@ -2848,62 +2822,14 @@ void psys_mat_hair_to_orco(Object *ob, DerivedMesh *dm, short from, ParticleData
float vec[3], orco[3];
psys_face_mat(ob, dm, pa, hairmat, 1);
- psys_particle_on_dm(ob, dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, vec, 0, 0, 0, orco, 0);
+ psys_particle_on_dm(dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, vec, 0, 0, 0, orco, 0);
/* see psys_face_mat for why this function is called */
transform_mesh_orco_verts(ob->data, &orco, 1, 1);
VECCOPY(hairmat[3],orco);
}
-/*
-void psys_key_to_geometry(DerivedMesh *dm, ParticleData *pa, ParticleKey *key)
-{
- float q[4], v1[3], v2[3], v3[3];
-
- dm->getVertCo(dm,pa->verts[0],v1);
- dm->getVertCo(dm,pa->verts[1],v2);
- dm->getVertCo(dm,pa->verts[2],v3);
-
- triatoquat(v1, v2, v3, q);
-
- QuatInv(q);
-
- VECSUB(key->co,key->co,v1);
-
- VECADD(key->vel,key->vel,key->co);
-
- QuatMulVecf(q, key->co);
- QuatMulVecf(q, key->vel);
-
- VECSUB(key->vel,key->vel,key->co);
-
- QuatMul(key->rot,q,key->rot);
-}
-
-void psys_key_from_geometry(DerivedMesh *dm, ParticleData *pa, ParticleKey *key)
-{
- float q[4], v1[3], v2[3], v3[3];
-
- dm->getVertCo(dm,pa->verts[0],v1);
- dm->getVertCo(dm,pa->verts[1],v2);
- dm->getVertCo(dm,pa->verts[2],v3);
-
- triatoquat(v1, v2, v3, q);
-
- VECADD(key->vel,key->vel,key->co);
-
- QuatMulVecf(q, key->co);
- QuatMulVecf(q, key->vel);
-
- VECSUB(key->vel,key->vel,key->co);
-
- VECADD(key->co,key->co,v1);
-
- QuatMul(key->rot,q,key->rot);
-}
-*/
-
-void psys_vec_rot_to_face(DerivedMesh *dm, ParticleData *pa, float *vec)//to_geometry(DerivedMesh *dm, ParticleData *pa, float *vec)
+void psys_vec_rot_to_face(DerivedMesh *dm, ParticleData *pa, float *vec)
{
float mat[4][4];
@@ -2912,36 +2838,6 @@ void psys_vec_rot_to_face(DerivedMesh *dm, ParticleData *pa, float *vec)//to_geo
Mat4Mul3Vecfl(mat, vec);
}
-/* unused */
-#if 0
-static void psys_vec_rot_from_face(DerivedMesh *dm, ParticleData *pa, float *vec)//from_geometry(DerivedMesh *dm, ParticleData *pa, float *vec)
-{
- float q[4], v1[3], v2[3], v3[3];
- /*
- dm->getVertCo(dm,pa->verts[0],v1);
- dm->getVertCo(dm,pa->verts[1],v2);
- dm->getVertCo(dm,pa->verts[2],v3);
- */
- /* replace with this */
- MFace *mface;
- int i; // = psys_particle_dm_face_lookup(dm, pa->num, pa->fuv, pa->foffset, (LinkNode*)NULL);
- i = pa->num_dmcache==DMCACHE_NOTFOUND ? pa->num : pa->num_dmcache;
- if (i==-1 || i >= dm->getNumFaces(dm)) { vec[0] = vec[1] = 0; vec[2] = 1; return; }
- mface=dm->getFaceData(dm,i,CD_MFACE);
-
- dm->getVertCo(dm,mface->v1,v1);
- dm->getVertCo(dm,mface->v2,v2);
- dm->getVertCo(dm,mface->v3,v3);
- /* done */
-
- triatoquat(v1, v2, v3, q);
-
- QuatMulVecf(q, vec);
-
- //VECADD(vec,vec,v1);
-}
-#endif
-
void psys_mat_hair_to_global(Object *ob, DerivedMesh *dm, short from, ParticleData *pa, float hairmat[][4])
{
float facemat[4][4];
@@ -3191,6 +3087,47 @@ LinkNode *psys_using_settings(ParticleSettings *part, int flush_update)
/************************************************/
/* Textures */
/************************************************/
+
+static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, float *fuv, char *name, float *texco)
+{
+ MFace *mf;
+ MTFace *tf;
+ int i;
+
+ tf= CustomData_get_layer_named(&dm->faceData, CD_MTFACE, name);
+
+ if(tf == NULL)
+ tf= CustomData_get_layer(&dm->faceData, CD_MTFACE);
+
+ if(tf == NULL)
+ return 0;
+
+ if(pa) {
+ i= (pa->num_dmcache==DMCACHE_NOTFOUND)? pa->num: pa->num_dmcache;
+ if(i >= dm->getNumFaces(dm))
+ i = -1;
+ }
+ else
+ i= face_index;
+
+ if (i==-1) {
+ texco[0]= 0.0f;
+ texco[1]= 0.0f;
+ texco[2]= 0.0f;
+ }
+ else {
+ mf= dm->getFaceData(dm, i, CD_MFACE);
+
+ psys_interpolate_uvs(&tf[i], mf->v4, fuv, texco);
+
+ texco[0]= texco[0]*2.0f - 1.0f;
+ texco[1]= texco[1]*2.0f - 1.0f;
+ texco[2]= 0.0f;
+ }
+
+ return 1;
+}
+
static void get_cpa_texture(DerivedMesh *dm, Material *ma, int face_index, float *fw, float *orco, ParticleTexture *ptex, int event)
{
MTex *mtex;
@@ -3205,27 +3142,13 @@ static void get_cpa_texture(DerivedMesh *dm, Material *ma, int face_index, float
short blend=mtex->blendtype;
short neg=mtex->pmaptoneg;
- if(mtex->texco & TEXCO_UV && fw){
- int uv_index=CustomData_get_named_layer_index(&dm->faceData,CD_MTFACE,mtex->uvname);
- if(uv_index<0){
- uv_index=CustomData_get_active_layer_index(&dm->faceData,CD_MTFACE);
- }
- if(uv_index>=0){
- CustomDataLayer *layer=&dm->faceData.layers[uv_index];
- MTFace *mtface= &((MTFace*)layer->data)[face_index];
- MFace *mf=dm->getFaceData(dm,face_index,CD_MFACE);
- psys_interpolate_uvs(mtface,mf->v4,fw,texco);
- texco[0]*=2.0;
- texco[1]*=2.0;
- texco[0]-=1.0;
- texco[1]-=1.0;
- }
- else
+ if((mtex->texco & TEXCO_UV) && fw) {
+ if(!get_particle_uv(dm, NULL, face_index, fw, mtex->uvname, texco))
VECCOPY(texco,orco);
}
- else{
+ else
VECCOPY(texco,orco);
- }
+
externtex(mtex, texco, &value, rgba, rgba+1, rgba+2, rgba+3);
if((event & mtex->pmapto) & MAP_PA_TIME){
if((setvars&MAP_PA_TIME)==0){
@@ -3265,33 +3188,16 @@ void psys_get_texture(Object *ob, Material *ma, ParticleSystemModifierData *psmd
short blend=mtex->blendtype;
short neg=mtex->pmaptoneg;
- if(mtex->texco & TEXCO_UV){
- int uv_index=CustomData_get_named_layer_index(&psmd->dm->faceData,CD_MTFACE,mtex->uvname);
- if(uv_index<0){
- uv_index=CustomData_get_active_layer_index(&psmd->dm->faceData,CD_MTFACE);
+ if((mtex->texco & TEXCO_UV) && ELEM(psys->part->from, PART_FROM_FACE, PART_FROM_VOLUME)) {
+ if(!get_particle_uv(psmd->dm, pa, 0, pa->fuv, mtex->uvname, texco)) {
+ /* failed to get uv's, let's try orco's */
+ psys_particle_on_emitter(psmd,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,0,0,0,texco, 0);
}
- if(uv_index>=0){
- CustomDataLayer *layer=&psmd->dm->faceData.layers[uv_index];
- MTFace *mtface= &((MTFace*)layer->data)[pa->num];
- MFace *mf=psmd->dm->getFaceData(psmd->dm,pa->num,CD_MFACE);
- psys_interpolate_uvs(mtface,mf->v4,pa->fuv,texco);
- texco[0]*=2.0;
- texco[1]*=2.0;
- texco[0]-=1.0;
- texco[1]-=1.0;
- }
- else
- //psys_particle_on_emitter(ob,psmd,psys->part->from,pa->num,pa->fuv,pa->foffset,texco,0,0,0);
- /* <jahka> anyways I think it will be too small a difference to notice, so psys_get_texture should only know about the original mesh structure.. no dm needed anywhere */
- /* <brecht> the code only does dm based lookup now, so passing num_dmcache anyway to avoid^
- * massive slowdown here */
- psys_particle_on_emitter(ob,psmd,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,0,0,0,texco, 0);
}
- else{
- //psys_particle_on_emitter(ob,psmd,psys->part->from,pa->num,pa->fuv,pa->offset,texco,0,0,0);
- /* ditto above */
- psys_particle_on_emitter(ob,psmd,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,0,0,0,texco, 0);
+ else {
+ psys_particle_on_emitter(psmd,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,0,0,0,texco, 0);
}
+
externtex(mtex, texco, &value, rgba, rgba+1, rgba+2, rgba+3);
if((event & mtex->pmapto) & MAP_PA_TIME){
@@ -3356,7 +3262,7 @@ float psys_get_size(Object *ob, Material *ma, ParticleSystemModifierData *psmd,
}
if(vg_size)
- size*=psys_interpolate_value_from_verts(psmd->dm,part->from,pa->num,pa->fuv,vg_size);
+ size*=psys_particle_value_from_verts(psmd->dm,part->from,pa,vg_size);
if(part->randsize!=0.0)
size*= 1.0f - part->randsize*pa->sizemul;
@@ -3603,7 +3509,7 @@ void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, Particle
cpa_fuv = cpa->fuv;
cpa_from = PART_FROM_FACE;
- psys_particle_on_emitter(ob,psmd,cpa_from,cpa_num,DMCACHE_ISCHILD,cpa->fuv,foffset,co,0,0,0,orco,0);
+ psys_particle_on_emitter(psmd,cpa_from,cpa_num,DMCACHE_ISCHILD,cpa->fuv,foffset,co,0,0,0,orco,0);
/* we need to save the actual root position of the child for positioning it accurately to the surface of the emitter */
//VECCOPY(cpa_1st,co);
@@ -3625,7 +3531,7 @@ void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, Particle
cpa_num=pa->num;
cpa_fuv=pa->fuv;
- psys_particle_on_emitter(ob,psmd,cpa_from,cpa_num,DMCACHE_ISCHILD,cpa_fuv,pa->foffset,co,0,0,0,orco,0);
+ psys_particle_on_emitter(psmd,cpa_from,cpa_num,DMCACHE_ISCHILD,cpa_fuv,pa->foffset,co,0,0,0,orco,0);
}
/* correct child ipo timing */
@@ -3796,7 +3702,7 @@ int psys_get_particle_state(Object *ob, ParticleSystem *psys, int p, ParticleKey
}
else{
if (pa) { /* TODO PARTICLE - should this ever be NULL? - Campbell */
- if(pa->state.time==state->time)
+ if(pa->state.time==state->time || ELEM(part->phystype,PART_PHYS_NO,PART_PHYS_KEYED))
copy_particle_key(state, &pa->state, 1);
else if(pa->prev_state.time==state->time)
copy_particle_key(state, &pa->prev_state, 1);
@@ -3828,6 +3734,9 @@ int psys_get_particle_state(Object *ob, ParticleSystem *psys, int p, ParticleKey
/* convert back to real velocity */
VecMulf(state->vel, frs_sec / dfra);
+
+ VecLerpf(state->ave, keys[1].ave, keys[2].ave, keytime);
+ QuatInterpol(state->rot, keys[1].rot, keys[2].rot, keytime);
}
}
else {
@@ -3870,7 +3779,7 @@ void psys_get_dupli_texture(Object *ob, ParticleSettings *part, ParticleSystemMo
else
uv[0]= uv[1]= 0.0f;
- psys_particle_on_emitter(ob, psmd,
+ psys_particle_on_emitter(psmd,
(part->childtype == PART_CHILD_FACES)? PART_FROM_FACE: PART_FROM_PARTICLE,
cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,0,0,0,orco,0);
}
@@ -3894,7 +3803,7 @@ void psys_get_dupli_texture(Object *ob, ParticleSettings *part, ParticleSystemMo
else
uv[0]= uv[1]= 0.0f;
- psys_particle_on_emitter(ob,psmd,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,0,0,0,orco,0);
+ psys_particle_on_emitter(psmd,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,0,0,0,orco,0);
}
}
@@ -3907,9 +3816,9 @@ void psys_get_dupli_path_transform(Object *ob, ParticleSystem *psys, ParticleSys
len= Normalize(vec);
if(pa)
- psys_particle_on_emitter(ob,psmd,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0);
+ psys_particle_on_emitter(psmd,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0);
else
- psys_particle_on_emitter(ob, psmd,
+ psys_particle_on_emitter(psmd,
(psys->part->childtype == PART_CHILD_FACES)? PART_FROM_FACE: PART_FROM_PARTICLE,
cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,nor,0,0,0,0);
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index e4b8077cd4e..8f7a90625ba 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -622,7 +622,7 @@ void psys_thread_distribute_particle(ParticleThread *thread, ParticleData *pa, C
KDTreeNearest ptn[3];
int w, maxw;
- psys_particle_on_dm(ctx->ob,ctx->dm,from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co1,0,0,0,orco1,0);
+ psys_particle_on_dm(ctx->dm,from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co1,0,0,0,orco1,0);
transform_mesh_orco_verts((Mesh*)ob->data, &orco1, 1, 1);
maxw = BLI_kdtree_find_n_nearest(ctx->tree,3,orco1,NULL,ptn);
@@ -766,7 +766,7 @@ void psys_thread_distribute_particle(ParticleThread *thread, ParticleData *pa, C
do_seams= (part->flag&PART_CHILD_SEAMS && ctx->seams);
- psys_particle_on_dm(ob,dm,cfrom,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co1,nor1,0,0,orco1,ornor1);
+ psys_particle_on_dm(dm,cfrom,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co1,nor1,0,0,orco1,ornor1);
transform_mesh_orco_verts((Mesh*)ob->data, &orco1, 1, 1);
maxw = BLI_kdtree_find_n_nearest(ctx->tree,(do_seams)?10:4,orco1,ornor1,ptn);
@@ -864,7 +864,7 @@ void psys_thread_distribute_particle(ParticleThread *thread, ParticleData *pa, C
}
}
-void *exec_distribution(void *data)
+static void *exec_distribution(void *data)
{
ParticleThread *thread= (ParticleThread*)data;
ParticleSystem *psys= thread->ctx->psys;
@@ -980,7 +980,7 @@ int psys_threads_init_distribution(ParticleThread *threads, DerivedMesh *finaldm
tree=BLI_kdtree_new(totpart);
for(p=0,pa=psys->particles; p<totpart; p++,pa++){
- psys_particle_on_dm(ob,dm,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,nor,0,0,orco,ornor);
+ psys_particle_on_dm(dm,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,nor,0,0,orco,ornor);
transform_mesh_orco_verts((Mesh*)ob->data, &orco, 1, 1);
BLI_kdtree_insert(tree, p, orco, ornor);
}
@@ -1741,7 +1741,7 @@ void reset_particle(ParticleData *pa, ParticleSystem *psys, ParticleSystemModifi
where_is_object_time(ob,pa->time);
/* get birth location from object */
- psys_particle_on_emitter(ob,psmd,part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,utan,vtan,0,0);
+ psys_particle_on_emitter(psmd,part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,utan,vtan,0,0);
/* save local coordinates for later */
VECCOPY(tloc,loc);
@@ -1750,7 +1750,7 @@ void reset_particle(ParticleData *pa, ParticleSystem *psys, ParticleSystemModifi
psys_get_texture(ob,give_current_material(ob,part->omat),psmd,psys,pa,&ptex,MAP_PA_IVEL);
if(vg_vel && pa->num != -1)
- ptex.ivel*=psys_interpolate_value_from_verts(psmd->dm,part->from,pa->num,pa->fuv,vg_vel);
+ ptex.ivel*=psys_particle_value_from_verts(psmd->dm,part->from,pa,vg_vel);
/* particles live in global space so */
/* let's convert: */
@@ -1765,7 +1765,7 @@ void reset_particle(ParticleData *pa, ParticleSystem *psys, ParticleSystemModifi
/* -tangent */
if(part->tanfac!=0.0){
- float phase=vg_rot?2.0f*(psys_interpolate_value_from_verts(psmd->dm,part->from,pa->num,pa->fuv,vg_rot)-0.5f):0.0f;
+ float phase=vg_rot?2.0f*(psys_particle_value_from_verts(psmd->dm,part->from,pa,vg_rot)-0.5f):0.0f;
VecMulf(vtan,-(float)cos(M_PI*(part->tanphase+phase)));
fac=-(float)sin(M_PI*(part->tanphase+phase));
VECADDFAC(vtan,vtan,utan,fac);
@@ -1825,7 +1825,7 @@ void reset_particle(ParticleData *pa, ParticleSystem *psys, ParticleSystemModifi
/* *emitter tangent */
if(part->tanfac!=0.0)
- VECADDFAC(vel,vel,vtan,part->tanfac*(vg_tan?psys_interpolate_value_from_verts(psmd->dm,part->from,pa->num,pa->fuv,vg_tan):1.0f));
+ VECADDFAC(vel,vel,vtan,part->tanfac*(vg_tan?psys_particle_value_from_verts(psmd->dm,part->from,pa,vg_tan):1.0f));
/* *texture */
/* TODO */
@@ -2458,7 +2458,7 @@ static void precalc_effectors(Object *ob, ParticleSystem *psys, ParticleSystemMo
ParticleSettings *part=psys->part;
ParticleData *pa;
float vec2[3],loc[3],*co=0;
- int p,totpart,totvert;
+ int p,totpart;
for(ec= lb->first; ec; ec= ec->next) {
PartDeflect *pd= ec->ob->pd;
@@ -2483,7 +2483,7 @@ static void precalc_effectors(Object *ob, ParticleSystem *psys, ParticleSystemMo
ec->locations=MEM_callocN(totpart*3*sizeof(float),"particle locations");
for(p=0,pa=psys->particles; p<totpart; p++, pa++){
- psys_particle_on_emitter(ob,psmd,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,0,0,0,0,0);
+ psys_particle_on_emitter(psmd,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,0,0,0,0,0);
Mat4MulVecfl(ob->obmat,loc);
ec->distances[p]=VecLenf(loc,vec);
VECSUB(loc,loc,vec);
@@ -2991,8 +2991,7 @@ static void particle_intersect_face(void *userdata, int index, const BVHTreeRay
MFace *face = col->md->mfaces + index;
MVert *x = col->md->x;
MVert *v = col->md->current_v;
- float dir[3], vel[3], co1[3], co2[3], uv[2], ipoint[3], temp[3], dist, t, threshold;
- int ret=0;
+ float vel[3], co1[3], co2[3], uv[2], ipoint[3], temp[3], t;
float *t0, *t1, *t2, *t3;
t0 = x[ face->v1 ].co;
@@ -3061,12 +3060,11 @@ static void particle_intersect_face(void *userdata, int index, const BVHTreeRay
/* 1. check for all possible deflectors for closest intersection on particle path */
/* 2. if deflection was found kill the particle or calculate new coordinates */
static void deflect_particle(Object *pob, ParticleSystemModifierData *psmd, ParticleSystem *psys, ParticleSettings *part, ParticleData *pa, int p, float timestep, float dfra, float cfra){
- Object *ob;
+ Object *ob = NULL;
ListBase *lb=&psys->effectors;
ParticleEffectorCache *ec;
ParticleKey reaction_state;
ParticleCollision col;
- CollisionModifierData *collmd;
BVHTreeRayHit hit;
float ray_dir[3], zerovec[3]={0.0,0.0,0.0};
float radius = ((part->flag & PART_SIZE_DEFL)?pa->size:0.0f);
@@ -3114,7 +3112,6 @@ static void deflect_particle(Object *pob, ParticleSystemModifierData *psmd, Part
int through = (BLI_frand() < pd->pdef_perm) ? 1 : 0;
float co[3]; /* point of collision */
float vec[3]; /* movement through collision */
- float vel[3]; /* velocity after collision */
float t = hit.dist/col.ray_len; /* time of collision between this iteration */
float dt = col.t + t * (1.0f - col.t); /* time of collision between frame change*/
@@ -3880,7 +3877,7 @@ static void boid_body(BoidVecFunc *bvf, ParticleData *pa, ParticleSystem *psys,
/************************************************/
/* Hair */
/************************************************/
-void save_hair(Object *ob, ParticleSystem *psys, ParticleSystemModifierData *psmd, float cfra){
+static void save_hair(Object *ob, ParticleSystem *psys, ParticleSystemModifierData *psmd, float cfra){
ParticleData *pa;
HairKey *key;
int totpart;
@@ -4157,7 +4154,7 @@ static void psys_update_path_cache(Object *ob, ParticleSystemModifierData *psmd,
}
if((part->type==PART_HAIR || psys->flag&PSYS_KEYED) && (psys_in_edit_mode(psys)
- || (part->type==PART_HAIR || part->draw_as==PART_DRAW_PATH) || part->draw&PART_DRAW_KEYS)){
+ || (part->type==PART_HAIR || part->draw_as==PART_DRAW_PATH))){
psys_cache_paths(ob, psys, cfra, 0);
/* for render, child particle paths are computed on the fly */
@@ -4467,10 +4464,8 @@ static void system_step(Object *ob, ParticleSystem *psys, ParticleSystemModifier
return;
}
- /* cache shouldn't be used for hair or "none" or "first keyed" physics */
- if(part->type == PART_HAIR || part->phystype == PART_PHYS_NO)
- usecache= 0;
- else if(part->type == PART_PHYS_KEYED && (psys->flag & PSYS_FIRST_KEYED))
+ /* cache shouldn't be used for hair or "none" or "keyed" physics */
+ if(part->type == PART_HAIR || ELEM(part->phystype, PART_PHYS_NO, PART_PHYS_KEYED))
usecache= 0;
else if(BKE_ptcache_get_continue_physics())
usecache= 0;
@@ -4648,7 +4643,7 @@ static void system_step(Object *ob, ParticleSystem *psys, ParticleSystemModifier
}
}
-void psys_to_softbody(Object *ob, ParticleSystem *psys)
+static void psys_to_softbody(Object *ob, ParticleSystem *psys)
{
SoftBody *sb;
short softflag;
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 701e8ecb311..dea36a69643 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -188,6 +188,7 @@ Scene *add_scene(char *name)
sce->lay= 1;
sce->selectmode= SCE_SELECT_VERTEX;
sce->editbutsize= 0.1;
+ sce->autokey_mode= U.autokey_mode;
sce->r.mode= R_GAMMA;
sce->r.cfra= 1;
diff --git a/source/blender/blenkernel/intern/simple_deform.c b/source/blender/blenkernel/intern/simple_deform.c
new file mode 100644
index 00000000000..0eb710fa48e
--- /dev/null
+++ b/source/blender/blenkernel/intern/simple_deform.c
@@ -0,0 +1,248 @@
+/**
+ * deform_simple.c
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): André Pinto
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#include "DNA_object_types.h"
+#include "DNA_modifier_types.h"
+#include "DNA_meshdata_types.h"
+
+#include "BKE_simple_deform.h"
+#include "BKE_DerivedMesh.h"
+#include "BKE_deform.h"
+#include "BKE_utildefines.h"
+#include "BLI_arithb.h"
+#include "BKE_shrinkwrap.h"
+
+#include <string.h>
+#include <math.h>
+
+
+//Clamps/Limits the given coordinate to: limits[0] <= co[axis] <= limits[1]
+//The ammount of clamp is saved on dcut
+static void axis_limit(int axis, const float limits[2], float co[3], float dcut[3])
+{
+ float val = co[axis];
+ if(limits[0] > val) val = limits[0];
+ if(limits[1] < val) val = limits[1];
+
+ dcut[axis] = co[axis] - val;
+ co[axis] = val;
+}
+
+static void simpleDeform_taper(const float factor, const float dcut[3], float *co)
+{
+ float x = co[0], y = co[1], z = co[2];
+ float scale = z*factor;
+
+ co[0] = x + x*scale;
+ co[1] = y + y*scale;
+ co[2] = z;
+
+ if(dcut)
+ {
+ co[0] += dcut[0];
+ co[1] += dcut[1];
+ co[2] += dcut[2];
+ }
+}
+
+static void simpleDeform_stretch(const float factor, const float dcut[3], float *co)
+{
+ float x = co[0], y = co[1], z = co[2];
+ float scale;
+
+ scale = (z*z*factor-factor + 1.0);
+
+ co[0] = x*scale;
+ co[1] = y*scale;
+ co[2] = z*(1.0+factor);
+
+
+ if(dcut)
+ {
+ co[0] += dcut[0];
+ co[1] += dcut[1];
+ co[2] += dcut[2];
+ }
+}
+
+static void simpleDeform_twist(const float factor, const float *dcut, float *co)
+{
+ float x = co[0], y = co[1], z = co[2];
+ float theta, sint, cost;
+
+ theta = z*factor;
+ sint = sin(theta);
+ cost = cos(theta);
+
+ co[0] = x*cost - y*sint;
+ co[1] = x*sint + y*cost;
+ co[2] = z;
+
+ if(dcut)
+ {
+ co[0] += dcut[0];
+ co[1] += dcut[1];
+ co[2] += dcut[2];
+ }
+}
+
+static void simpleDeform_bend(const float factor, const float dcut[3], float *co)
+{
+ float x = co[0], y = co[1], z = co[2];
+ float theta, sint, cost;
+
+ theta = x*factor;
+ sint = sin(theta);
+ cost = cos(theta);
+
+ if(fabs(factor) > 1e-7f)
+ {
+ co[0] = -(y-1.0f/factor)*sint;
+ co[1] = (y-1.0f/factor)*cost + 1.0f/factor;
+ co[2] = z;
+ }
+
+
+ if(dcut)
+ {
+ co[0] += cost*dcut[0];
+ co[1] += sint*dcut[0];
+ co[2] += dcut[2];
+ }
+
+}
+
+
+/* simple deform modifier */
+void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object *ob, struct DerivedMesh *dm, float (*vertexCos)[3], int numVerts)
+{
+ static const float lock_axis[2] = {0.0f, 0.0f};
+
+ int i;
+ int limit_axis = 0;
+ float smd_limit[2], smd_factor;
+ SpaceTransform *transf = NULL, tmp_transf;
+ void (*simpleDeform_callback)(const float factor, const float dcut[3], float *co) = NULL; //Mode callback
+ int vgroup = get_named_vertexgroup_num(ob, smd->vgroup_name);
+ MDeformVert *dvert = NULL;
+
+ //Safe-check
+ if(smd->origin == ob) smd->origin = NULL; //No self references
+
+ if(smd->limit[0] < 0.0) smd->limit[0] = 0.0f;
+ if(smd->limit[0] > 1.0) smd->limit[0] = 1.0f;
+
+ smd->limit[0] = MIN2(smd->limit[0], smd->limit[1]); //Upper limit >= than lower limit
+
+ //Calculate matrixs do convert between coordinate spaces
+ if(smd->origin)
+ {
+ transf = &tmp_transf;
+
+ if(smd->originOpts & MOD_SIMPLEDEFORM_ORIGIN_LOCAL)
+ {
+ space_transform_from_matrixs(transf, ob->obmat, smd->origin->obmat);
+ }
+ else
+ {
+ Mat4CpyMat4(transf->local2target, smd->origin->obmat);
+ Mat4Invert(transf->target2local, transf->local2target);
+ }
+ }
+
+ //Setup vars
+ limit_axis = (smd->mode == MOD_SIMPLEDEFORM_MODE_BEND) ? 0 : 2; //Bend limits on X.. all other modes limit on Z
+
+ //Update limits if needed
+ {
+ float lower = FLT_MAX;
+ float upper = -FLT_MAX;
+
+ for(i=0; i<numVerts; i++)
+ {
+ float tmp[3];
+ VECCOPY(tmp, vertexCos[i]);
+
+ if(transf) space_transform_apply(transf, tmp);
+
+ lower = MIN2(lower, tmp[limit_axis]);
+ upper = MAX2(upper, tmp[limit_axis]);
+ }
+
+
+ //SMD values are normalized to the BV, calculate the absolut values
+ smd_limit[1] = lower + (upper-lower)*smd->limit[1];
+ smd_limit[0] = lower + (upper-lower)*smd->limit[0];
+
+ smd_factor = smd->factor / MAX2(FLT_EPSILON, smd_limit[1]-smd_limit[0]);
+ }
+
+
+ if(dm)
+ dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
+
+
+ switch(smd->mode)
+ {
+ case MOD_SIMPLEDEFORM_MODE_TWIST: simpleDeform_callback = simpleDeform_twist; break;
+ case MOD_SIMPLEDEFORM_MODE_BEND: simpleDeform_callback = simpleDeform_bend; break;
+ case MOD_SIMPLEDEFORM_MODE_TAPER: simpleDeform_callback = simpleDeform_taper; break;
+ case MOD_SIMPLEDEFORM_MODE_STRETCH: simpleDeform_callback = simpleDeform_stretch; break;
+ default:
+ return; //No simpledeform mode?
+ }
+
+ for(i=0; i<numVerts; i++)
+ {
+ float weight = vertexgroup_get_vertex_weight(dvert, i, vgroup);
+
+ if(weight != 0.0f)
+ {
+ float co[3], dcut[3] = {0.0f, 0.0f, 0.0f};
+
+ if(transf) space_transform_apply(transf, vertexCos[i]);
+
+ VECCOPY(co, vertexCos[i]);
+
+ //Apply axis limits
+ if(smd->mode != MOD_SIMPLEDEFORM_MODE_BEND) //Bend mode shoulnt have any lock axis
+ {
+ if(smd->axis & MOD_SIMPLEDEFORM_LOCK_AXIS_X) axis_limit(0, lock_axis, co, dcut);
+ if(smd->axis & MOD_SIMPLEDEFORM_LOCK_AXIS_Y) axis_limit(1, lock_axis, co, dcut);
+ }
+ axis_limit(limit_axis, smd_limit, co, dcut);
+
+ simpleDeform_callback(smd_factor, dcut, co); //Apply deform
+ VecLerpf(vertexCos[i], vertexCos[i], co, weight); //Use vertex weight has coef of linear interpolation
+
+ if(transf) space_transform_invert(transf, vertexCos[i]);
+ }
+ }
+}
+
+
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 508b2233536..5d93f10526a 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -236,7 +236,7 @@ typedef struct ccd_Mesh {
-ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
+static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
{
ccd_Mesh *pccd_M = NULL;
ccdf_minmax *mima =NULL;
@@ -333,7 +333,7 @@ ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
}
return pccd_M;
}
-void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
+static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
{
ccdf_minmax *mima =NULL;
MFace *mface=NULL;
@@ -472,7 +472,7 @@ void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
return ;
}
-void ccd_mesh_free(ccd_Mesh *ccdm)
+static void ccd_mesh_free(ccd_Mesh *ccdm)
{
if(ccdm && (ccdm->savety == CCD_SAVETY )){ /*make sure we're not nuking objects we don't know*/
MEM_freeN(ccdm->mface);
@@ -484,7 +484,7 @@ void ccd_mesh_free(ccd_Mesh *ccdm)
}
}
-void ccd_build_deflector_hache(Object *vertexowner,GHash *hash)
+static void ccd_build_deflector_hache(Object *vertexowner,GHash *hash)
{
Base *base;
Object *ob;
@@ -536,7 +536,7 @@ void ccd_build_deflector_hache(Object *vertexowner,GHash *hash)
} /* while (base) */
}
-void ccd_update_deflector_hache(Object *vertexowner,GHash *hash)
+static void ccd_update_deflector_hache(Object *vertexowner,GHash *hash)
{
Base *base;
Object *ob;
@@ -991,7 +991,7 @@ static int query_external_colliders(Object *me)
/* +++ the aabb "force" section*/
-int sb_detect_aabb_collisionCached( float force[3], unsigned int par_layer,struct Object *vertexowner,float time)
+static int sb_detect_aabb_collisionCached( float force[3], unsigned int par_layer,struct Object *vertexowner,float time)
{
Object *ob;
SoftBody *sb=vertexowner->soft;
@@ -1055,7 +1055,7 @@ int sb_detect_aabb_collisionCached( float force[3], unsigned int par_layer,struc
/* +++ the face external section*/
-int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float face_v3[3],float *damp,
+static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float face_v3[3],float *damp,
float force[3], unsigned int par_layer,struct Object *vertexowner,float time)
{
Object *ob;
@@ -1153,7 +1153,7 @@ int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float face_v3[3
}
-int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],float face_v3[3],float *damp,
+static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],float face_v3[3],float *damp,
float force[3], unsigned int par_layer,struct Object *vertexowner,float time)
{
Object *ob;
@@ -1291,7 +1291,7 @@ int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],float face_
-void scan_for_ext_face_forces(Object *ob,float timenow)
+static void scan_for_ext_face_forces(Object *ob,float timenow)
{
SoftBody *sb = ob->soft;
BodyFace *bf;
@@ -1379,7 +1379,7 @@ void scan_for_ext_face_forces(Object *ob,float timenow)
/* +++ the spring external section*/
-int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],float *damp,
+static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],float *damp,
float force[3], unsigned int par_layer,struct Object *vertexowner,float time)
{
Object *ob;
@@ -1530,7 +1530,7 @@ int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],float *damp
-void _scan_for_ext_spring_forces(Object *ob,float timenow,int ifirst,int ilast, struct ListBase *do_effector)
+static void _scan_for_ext_spring_forces(Object *ob,float timenow,int ifirst,int ilast, struct ListBase *do_effector)
{
SoftBody *sb = ob->soft;
int a;
@@ -1601,7 +1601,7 @@ void _scan_for_ext_spring_forces(Object *ob,float timenow,int ifirst,int ilast,
}
-void scan_for_ext_spring_forces(Object *ob,float timenow)
+static void scan_for_ext_spring_forces(Object *ob,float timenow)
{
SoftBody *sb = ob->soft;
ListBase *do_effector= NULL;
@@ -1613,14 +1613,14 @@ void scan_for_ext_spring_forces(Object *ob,float timenow)
pdEndEffectors(do_effector);
}
-void *exec_scan_for_ext_spring_forces(void *data)
+static void *exec_scan_for_ext_spring_forces(void *data)
{
SB_thread_context *pctx = (SB_thread_context*)data;
_scan_for_ext_spring_forces(pctx->ob,pctx->timenow,pctx->ifirst,pctx->ilast,pctx->do_effector);
return 0;
}
-void sb_sfesf_threads_run(struct Object *ob, float timenow,int totsprings,int *ptr_to_break_func())
+static void sb_sfesf_threads_run(struct Object *ob, float timenow,int totsprings,int *ptr_to_break_func())
{
ListBase *do_effector = NULL;
ListBase threads;
@@ -1682,7 +1682,7 @@ void sb_sfesf_threads_run(struct Object *ob, float timenow,int totsprings,int *p
/* --- the spring external section*/
-int choose_winner(float*w, float* pos,float*a,float*b,float*c,float*ca,float*cb,float*cc)
+static int choose_winner(float*w, float* pos,float*a,float*b,float*c,float*ca,float*cb,float*cc)
{
float mindist,cp;
int winner =1;
@@ -1709,7 +1709,7 @@ int choose_winner(float*w, float* pos,float*a,float*b,float*c,float*ca,float*cb,
-int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3], float *damp,
+static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3], float *damp,
float force[3], unsigned int par_layer,struct Object *vertexowner,
float time,float vel[3], float *intrusion)
{
@@ -2119,7 +2119,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float fo
/* 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 */
-int _softbody_calc_forces_slice_in_a_thread(Object *ob, float forcetime, float timenow,int ifirst,int ilast,int *ptr_to_break_func(),ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor)
+static int _softbody_calc_forces_slice_in_a_thread(Object *ob, float forcetime, float timenow,int ifirst,int ilast,int *ptr_to_break_func(),ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor)
{
float iks;
int bb,do_selfcollision,do_springcollision,do_aero;
@@ -2319,14 +2319,14 @@ int _softbody_calc_forces_slice_in_a_thread(Object *ob, float forcetime, float t
return 0; /*done fine*/
}
-void *exec_softbody_calc_forces(void *data)
+static void *exec_softbody_calc_forces(void *data)
{
SB_thread_context *pctx = (SB_thread_context*)data;
_softbody_calc_forces_slice_in_a_thread(pctx->ob,pctx->forcetime,pctx->timenow,pctx->ifirst,pctx->ilast,NULL,pctx->do_effector,pctx->do_deflector,pctx->fieldfactor,pctx->windfactor);
return 0;
}
-void sb_cf_threads_run(struct Object *ob, float forcetime, float timenow,int totpoint,int *ptr_to_break_func(),struct ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor)
+static void sb_cf_threads_run(struct Object *ob, float forcetime, float timenow,int totpoint,int *ptr_to_break_func(),struct ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor)
{
ListBase threads;
SB_thread_context *sb_threads;
@@ -3067,7 +3067,7 @@ static void softbody_apply_goalsnap(Object *ob)
}
-void apply_spring_memory(Object *ob)
+static void apply_spring_memory(Object *ob)
{
SoftBody *sb = ob->soft;
BodySpring *bs;
@@ -3293,7 +3293,7 @@ static void mesh_faces_to_scratch(Object *ob)
helper function to get proper spring length
when object is rescaled
*/
-float globallen(float *v1,float *v2,Object *ob)
+static float globallen(float *v1,float *v2,Object *ob)
{
float p1[3],p2[3];
VECCOPY(p1,v1);
@@ -3711,7 +3711,7 @@ static int softbody_read_cache(Object *ob, float framenr)
}
/* +++ ************ maintaining scratch *************** */
-void sb_new_scratch(SoftBody *sb)
+static void sb_new_scratch(SoftBody *sb)
{
if (!sb) return;
sb->scratch = MEM_callocN(sizeof(SBScratch), "SBScratch");
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index e6797186b53..f79009e673d 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -86,9 +86,9 @@ struct CCGDerivedMesh {
typedef struct CCGDerivedMesh CCGDerivedMesh;
-static int ccgDM_getVertMapIndex(CCGDerivedMesh *ccgdm, CCGSubSurf *ss, CCGVert *v);
-static int ccgDM_getEdgeMapIndex(CCGDerivedMesh *ccgdm, CCGSubSurf *ss, CCGEdge *e);
-static int ccgDM_getFaceMapIndex(CCGDerivedMesh *ccgdm, CCGSubSurf *ss, CCGFace *f);
+static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v);
+static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e);
+static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f);
///
@@ -161,8 +161,8 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, int useAgin
}
static int getEdgeIndex(CCGSubSurf *ss, CCGEdge *e, int x, int edgeSize) {
- CCGVert *v0 = ccgSubSurf_getEdgeVert0(ss, e);
- CCGVert *v1 = ccgSubSurf_getEdgeVert1(ss, e);
+ CCGVert *v0 = ccgSubSurf_getEdgeVert0(e);
+ CCGVert *v1 = ccgSubSurf_getEdgeVert1(e);
int v0idx = *((int*) ccgSubSurf_getVertUserData(ss, v0));
int v1idx = *((int*) ccgSubSurf_getVertUserData(ss, v1));
int edgeBase = *((int*) ccgSubSurf_getEdgeUserData(ss, e));
@@ -177,7 +177,7 @@ static int getEdgeIndex(CCGSubSurf *ss, CCGEdge *e, int x, int edgeSize) {
}
static int getFaceIndex(CCGSubSurf *ss, CCGFace *f, int S, int x, int y, int edgeSize, int gridSize) {
int faceBase = *((int*) ccgSubSurf_getFaceUserData(ss, f));
- int numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ int numVerts = ccgSubSurf_getFaceNumVerts(f);
if (x==gridSize-1 && y==gridSize-1) {
CCGVert *v = ccgSubSurf_getFaceVert(ss, f, S);
@@ -186,7 +186,7 @@ static int getFaceIndex(CCGSubSurf *ss, CCGFace *f, int S, int x, int y, int edg
CCGVert *v = ccgSubSurf_getFaceVert(ss, f, S);
CCGEdge *e = ccgSubSurf_getFaceEdge(ss, f, S);
int edgeBase = *((int*) ccgSubSurf_getEdgeUserData(ss, e));
- if (v==ccgSubSurf_getEdgeVert0(ss, e)) {
+ if (v==ccgSubSurf_getEdgeVert0(e)) {
return edgeBase + (gridSize-1-y)-1;
} else {
return edgeBase + (edgeSize-2-1)-((gridSize-1-y)-1);
@@ -195,7 +195,7 @@ static int getFaceIndex(CCGSubSurf *ss, CCGFace *f, int S, int x, int y, int edg
CCGVert *v = ccgSubSurf_getFaceVert(ss, f, S);
CCGEdge *e = ccgSubSurf_getFaceEdge(ss, f, (S+numVerts-1)%numVerts);
int edgeBase = *((int*) ccgSubSurf_getEdgeUserData(ss, e));
- if (v==ccgSubSurf_getEdgeVert0(ss, e)) {
+ if (v==ccgSubSurf_getEdgeVert0(e)) {
return edgeBase + (gridSize-1-x)-1;
} else {
return edgeBase + (edgeSize-2-1)-((gridSize-1-x)-1);
@@ -300,7 +300,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
if ((mv0->flag&mv1->flag) & ME_VERT_MERGED)
crease = creaseFactor;
else
- crease = ccgSubSurf_getEdgeCrease(origss, orige);
+ crease = ccgSubSurf_getEdgeCrease(orige);
ccgSubSurf_syncEdge(ss, ehdl, fverts[j], fverts[(j+1)%nverts], crease, &e);
BLI_edgehash_insert(ehash, v0, v1, NULL);
@@ -368,7 +368,7 @@ static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result,
for(index = 0; index < totface; index++) {
CCGFace *f = faceMap[index];
- int numVerts = ccgSubSurf_getFaceNumVerts(uvss, f);
+ int numVerts = ccgSubSurf_getFaceNumVerts(f);
for (S=0; S<numVerts; S++) {
VertData *faceGridData= ccgSubSurf_getFaceGridDataArray(uvss, f, S);
@@ -399,12 +399,12 @@ static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result,
static unsigned int ss_getEdgeFlags(CCGSubSurf *ss, CCGEdge *e, int ssFromEditmesh, DispListMesh *dlm, MEdge *medge, MTFace *tface)
{
unsigned int flags = 0;
- int N = ccgSubSurf_getEdgeNumFaces(ss, e);
+ int N = ccgSubSurf_getEdgeNumFaces(e);
if (!N) flags |= ME_LOOSEEDGE;
if (ssFromEditmesh) {
- EditEdge *eed = ccgSubSurf_getEdgeEdgeHandle(ss, e);
+ EditEdge *eed = ccgSubSurf_getEdgeEdgeHandle(e);
flags |= ME_EDGEDRAW|ME_EDGERENDER;
if (eed->seam) {
@@ -470,7 +470,7 @@ static void calc_ss_weights(int gridFaces,
}
}
-DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh,
+static DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh,
int drawInteriorEdges, int useSubsurfUv,
DerivedMesh *dm)
{
@@ -480,7 +480,6 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh,
int gridFaces = gridSize - 1;
int edgeBase, faceBase;
int i, j, k, S, x, y, index;
- int vertBase = 0;
CCGVertIterator *vi;
CCGEdgeIterator *ei;
CCGFaceIterator *fi;
@@ -503,7 +502,7 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh,
for(; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) {
CCGVert *v = ccgVertIterator_getCurrent(vi);
- vertMap2[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v))] = v;
+ vertMap2[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v))] = v;
}
ccgVertIterator_free(vi);
@@ -513,7 +512,7 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh,
for(; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) {
CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
- edgeMap2[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ss, e))] = e;
+ edgeMap2[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))] = e;
}
totface = ccgSubSurf_getNumFaces(ss);
@@ -543,18 +542,18 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh,
for(index = 0; index < totface; index++) {
CCGFace *f = faceMap2[index];
- int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
FaceVertWeight *weight = (numVerts == 4) ? qweight : tweight;
int vertIdx[4];
for(S = 0; S < numVerts; S++) {
CCGVert *v = ccgSubSurf_getFaceVert(ss, f, S);
- vertIdx[S] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v));
+ vertIdx[S] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
}
DM_interp_vert_data(dm, result, vertIdx, weight[0][0], numVerts, i);
- VecCopyf(mvert->co, ccgSubSurf_getFaceCenterData(ss, f));
+ VecCopyf(mvert->co, ccgSubSurf_getFaceCenterData(f));
*origIndex = ORIGINDEX_NONE;
++mvert;
++origIndex;
@@ -613,10 +612,10 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh,
int vertIdx[2];
CCGVert *v;
- v = ccgSubSurf_getEdgeVert0(ss, e);
- vertIdx[0] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v));
- v = ccgSubSurf_getEdgeVert1(ss, e);
- vertIdx[1] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v));
+ v = ccgSubSurf_getEdgeVert0(e);
+ vertIdx[0] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
+ v = ccgSubSurf_getEdgeVert1(e);
+ vertIdx[1] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
for(x = 1; x < edgeSize - 1; x++) {
float w[2];
@@ -634,18 +633,17 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh,
edgeBase += edgeSize-2;
}
- vertBase = i;
for(index = 0; index < totvert; index++) {
CCGVert *v = vertMap2[index];
int vertIdx;
- vertIdx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v));
+ vertIdx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
DM_copy_vert_data(dm, result, vertIdx, i, 1);
VecCopyf(mvert->co, ccgSubSurf_getVertData(ss, v));
*((int*)ccgSubSurf_getVertUserData(ss, v)) = i;
- *origIndex = ccgDM_getVertMapIndex(NULL, ss, v);
+ *origIndex = ccgDM_getVertMapIndex(ss, v);
++mvert;
++origIndex;
i++;
@@ -658,7 +656,7 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh,
for(index = 0; index < totface; index++) {
CCGFace *f = faceMap2[index];
- int numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ int numVerts = ccgSubSurf_getFaceNumVerts(f);
for(k = 0; k < numVerts; k++) {
for(x = 0; x < gridFaces; x++) {
@@ -701,9 +699,9 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh,
CCGEdge *e = edgeMap2[index];
unsigned int flags = 0;
char bweight = 0;
- int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ss, e));
+ int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e));
- if(!ccgSubSurf_getEdgeNumFaces(ss, e)) flags |= ME_LOOSEEDGE;
+ if(!ccgSubSurf_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE;
if(edgeIdx != -1 && dm) {
@@ -719,7 +717,7 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh,
med->v2 = getEdgeIndex(ss, e, x + 1, edgeSize);
med->flag = flags;
med->bweight = bweight;
- *origIndex = ccgDM_getEdgeMapIndex(NULL, ss, e);
+ *origIndex = ccgDM_getEdgeMapIndex(ss, e);
++med;
++origIndex;
i++;
@@ -733,10 +731,10 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh,
for(index = 0; index < totface; index++) {
CCGFace *f = faceMap2[index];
- int numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ int numVerts = ccgSubSurf_getFaceNumVerts(f);
int mat_nr;
int flag;
- int mapIndex = ccgDM_getFaceMapIndex(NULL, ss, f);
+ int mapIndex = ccgDM_getFaceMapIndex(ss, f);
int faceIdx = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f));
if(!ssFromEditmesh) {
@@ -900,15 +898,15 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
/***/
-static int ccgDM_getVertMapIndex(CCGDerivedMesh *ccgdm, CCGSubSurf *ss, CCGVert *v) {
+static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v) {
return ((int*) ccgSubSurf_getVertUserData(ss, v))[1];
}
-static int ccgDM_getEdgeMapIndex(CCGDerivedMesh *ccgdm, CCGSubSurf *ss, CCGEdge *e) {
+static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e) {
return ((int*) ccgSubSurf_getEdgeUserData(ss, e))[1];
}
-static int ccgDM_getFaceMapIndex(CCGDerivedMesh *ccgdm, CCGSubSurf *ss, CCGFace *f) {
+static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f) {
return ((int*) ccgSubSurf_getFaceUserData(ss, f))[1];
}
@@ -941,7 +939,7 @@ static void ccgDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3]) {
for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(fi);
- int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
for (S=0; S<numVerts; S++) {
VertData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
@@ -997,7 +995,7 @@ static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv)
++i;
f = ccgdm->faceMap[i].face;
- numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ numVerts = ccgSubSurf_getFaceNumVerts(f);
gridSideVerts = gridSize - 2;
gridInternalVerts = gridSideVerts * gridSideVerts;
@@ -1007,7 +1005,7 @@ static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv)
offset = vertNum - ccgdm->faceMap[i].startVert;
if(offset < 1) {
- VecCopyf(mv->co, ccgSubSurf_getFaceCenterData(ss, f));
+ VecCopyf(mv->co, ccgSubSurf_getFaceCenterData(f));
} else if(offset < gridSideEnd) {
offset -= 1;
grid = offset / gridSideVerts;
@@ -1069,7 +1067,7 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med)
++i;
f = ccgdm->faceMap[i].face;
- numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ numVerts = ccgSubSurf_getFaceNumVerts(f);
gridSideEdges = gridSize - 1;
gridInternalEdges = (gridSideEdges - 1) * gridSideEdges * 2;
@@ -1105,7 +1103,7 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med)
e = ccgdm->edgeMap[i].edge;
- if(!ccgSubSurf_getEdgeNumFaces(ss, e)) flags |= ME_LOOSEEDGE;
+ if(!ccgSubSurf_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE;
x = edgeNum - ccgdm->edgeMap[i].startEdge;
@@ -1147,7 +1145,7 @@ static void ccgDM_getFinalFace(DerivedMesh *dm, int faceNum, MFace *mf)
++i;
f = ccgdm->faceMap[i].face;
- numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ numVerts = ccgSubSurf_getFaceNumVerts(f);
offset = faceNum - ccgdm->faceMap[i].startFace;
grid = offset / gridFaces;
@@ -1177,9 +1175,9 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert)
totface = ccgSubSurf_getNumFaces(ss);
for(index = 0; index < totface; index++) {
CCGFace *f = ccgdm->faceMap[index].face;
- int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
- VecCopyf(mvert[i++].co, ccgSubSurf_getFaceCenterData(ss, f));
+ VecCopyf(mvert[i++].co, ccgSubSurf_getFaceCenterData(f));
for(S = 0; S < numVerts; S++) {
for(x = 1; x < gridSize - 1; x++) {
@@ -1232,7 +1230,7 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
totface = ccgSubSurf_getNumFaces(ss);
for(index = 0; index < totface; index++) {
CCGFace *f = ccgdm->faceMap[index].face;
- int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
for(S = 0; S < numVerts; S++) {
for(x = 0; x < gridSize - 1; x++) {
@@ -1276,9 +1274,9 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
CCGEdge *e = ccgdm->edgeMap[index].edge;
unsigned int flags = 0;
int x;
- int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ss, e));
+ int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e));
- if(!ccgSubSurf_getEdgeNumFaces(ss, e)) flags |= ME_LOOSEEDGE;
+ if(!ccgSubSurf_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE;
if(edgeFlags) {
if(edgeIdx != -1) {
@@ -1313,7 +1311,7 @@ static void ccgDM_copyFinalFaceArray(DerivedMesh *dm, MFace *mface)
totface = ccgSubSurf_getNumFaces(ss);
for(index = 0; index < totface; index++) {
CCGFace *f = ccgdm->faceMap[index].face;
- int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
int mat_nr = 0;
int flag = ME_SMOOTH; /* assume face is smooth by default */
@@ -1360,7 +1358,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) {
for (; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) {
CCGVert *v = ccgVertIterator_getCurrent(vi);
- vertMap2[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v))] = v;
+ vertMap2[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v))] = v;
}
ccgVertIterator_free(vi);
@@ -1370,7 +1368,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) {
for (i=0; !ccgEdgeIterator_isStopped(ei); i++,ccgEdgeIterator_next(ei)) {
CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
- edgeMap2[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ss, e))] = e;
+ edgeMap2[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))] = e;
}
totface = ccgSubSurf_getNumFaces(ss);
@@ -1386,9 +1384,9 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) {
i = 0;
for (index=0; index<totface; index++) {
CCGFace *f = faceMap2[index];
- int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
- VecCopyf(cos[i++], ccgSubSurf_getFaceCenterData(ss, f));
+ VecCopyf(cos[i++], ccgSubSurf_getFaceCenterData(f));
for (S=0; S<numVerts; S++) {
for (x=1; x<gridSize-1; x++) {
@@ -1430,7 +1428,7 @@ static void ccgDM_foreachMappedVert(DerivedMesh *dm, void (*func)(void *userData
for (; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) {
CCGVert *v = ccgVertIterator_getCurrent(vi);
VertData *vd = ccgSubSurf_getVertData(ccgdm->ss, v);
- int index = ccgDM_getVertMapIndex(ccgdm, ccgdm->ss, v);
+ int index = ccgDM_getVertMapIndex(ccgdm->ss, v);
if (index!=-1)
func(userData, index, vd->co, vd->no, NULL);
@@ -1447,7 +1445,7 @@ static void ccgDM_foreachMappedEdge(DerivedMesh *dm, void (*func)(void *userData
for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) {
CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
- int index = ccgDM_getEdgeMapIndex(ccgdm, ss, e);
+ int index = ccgDM_getEdgeMapIndex(ss, e);
if (index!=-1) {
for (i=0; i<edgeSize-1; i++)
@@ -1488,9 +1486,9 @@ static void ccgDM_drawVerts(DerivedMesh *dm) {
fi = ccgSubSurf_getFaceIterator(ss);
for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(fi);
- int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
- glVertex3fv(ccgSubSurf_getFaceCenterData(ss, f));
+ glVertex3fv(ccgSubSurf_getFaceCenterData(f));
for (S=0; S<numVerts; S++)
for (x=1; x<gridSize-1; x++)
glVertex3fv(ccgSubSurf_getFaceGridEdgeData(ss, f, S, x));
@@ -1517,7 +1515,7 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges) {
CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
- if (!drawLooseEdges && !ccgSubSurf_getEdgeNumFaces(ss, e))
+ if (!drawLooseEdges && !ccgSubSurf_getEdgeNumFaces(e))
continue;
if (useAging && !(G.f&G_BACKBUFSEL)) {
@@ -1540,7 +1538,7 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges) {
if (ccgdm->drawInteriorEdges) {
for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(fi);
- int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
for (S=0; S<numVerts; S++) {
VertData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
@@ -1578,7 +1576,7 @@ static void ccgDM_drawLooseEdges(DerivedMesh *dm) {
CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
- if (!ccgSubSurf_getEdgeNumFaces(ss, e)) {
+ if (!ccgSubSurf_getEdgeNumFaces(e)) {
glBegin(GL_LINE_STRIP);
for (i=0; i<edgeSize-1; i++) {
glVertex3fv(edgeData[i].co);
@@ -1615,7 +1613,7 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, int (*setMaterial)(int, void *
for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(fi);
- int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f));
int drawSmooth, mat_nr;
@@ -1723,9 +1721,9 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, v
CCGFace *f = ccgdm->faceMap[i].face;
int S, x, y, drawSmooth;
int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f));
- int origIndex = ccgDM_getFaceMapIndex(ccgdm, ss, f);
+ int origIndex = ccgDM_getFaceMapIndex(ss, f);
- numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ numVerts = ccgSubSurf_getFaceNumVerts(f);
if(faceFlags) {
drawSmooth = (faceFlags[index*4] & ME_SMOOTH);
@@ -1858,7 +1856,7 @@ static void ccgDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned ch
glBegin(GL_QUADS);
for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(fi);
- int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
for (S=0; S<numVerts; S++) {
VertData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
@@ -1916,8 +1914,8 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
totface = ccgSubSurf_getNumFaces(ss);
for(i = 0; i < totface; i++) {
CCGFace *f = ccgdm->faceMap[i].face;
- int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
- int drawSmooth, index = ccgDM_getFaceMapIndex(ccgdm, ss, f);
+ int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
+ int drawSmooth, index = ccgDM_getFaceMapIndex(ss, f);
int origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f));
unsigned char *cp= NULL;
int mat_nr;
@@ -1999,28 +1997,28 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
glBegin(GL_QUADS);
for (y=0; y<gridFaces; y++) {
for (x=0; x<gridFaces; x++) {
- float *a = faceGridData[(y+0)*gridSize + x].co;
- float *b = faceGridData[(y+0)*gridSize + x + 1].co;
- float *c = faceGridData[(y+1)*gridSize + x + 1].co;
- float *d = faceGridData[(y+1)*gridSize + x].co;
+ float *a_co = faceGridData[(y+0)*gridSize + x].co;
+ float *b_co = faceGridData[(y+0)*gridSize + x + 1].co;
+ float *c_co = faceGridData[(y+1)*gridSize + x + 1].co;
+ float *d_co = faceGridData[(y+1)*gridSize + x].co;
- ccgDM_glNormalFast(a, b, c, d);
+ ccgDM_glNormalFast(a_co, b_co, c_co, d_co);
if(tf) glTexCoord2fv(tf->uv[1]);
if(cp) glColor3ub(cp[7], cp[6], cp[5]);
- glVertex3fv(d);
+ glVertex3fv(d_co);
if(tf) glTexCoord2fv(tf->uv[2]);
if(cp) glColor3ub(cp[11], cp[10], cp[9]);
- glVertex3fv(c);
+ glVertex3fv(c_co);
if(tf) glTexCoord2fv(tf->uv[3]);
if(cp) glColor3ub(cp[15], cp[14], cp[13]);
- glVertex3fv(b);
+ glVertex3fv(b_co);
if(tf) glTexCoord2fv(tf->uv[0]);
if(cp) glColor3ub(cp[3], cp[2], cp[1]);
- glVertex3fv(a);
+ glVertex3fv(a_co);
if(tf) tf++;
if(cp) cp += 16;
@@ -2084,8 +2082,8 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *u
for (i=0; !ccgFaceIterator_isStopped(fi); i++,ccgFaceIterator_next(fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(fi);
- int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
- int drawSmooth, index = ccgDM_getFaceMapIndex(ccgdm, ss, f);
+ int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
+ int drawSmooth, index = ccgDM_getFaceMapIndex(ss, f);
int origIndex;
origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f));
@@ -2166,7 +2164,7 @@ static void ccgDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *u
for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) {
CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
- int index = ccgDM_getEdgeMapIndex(ccgdm, ss, e);
+ int index = ccgDM_getEdgeMapIndex(ss, e);
glBegin(GL_LINE_STRIP);
if (index!=-1 && (!setDrawOptions || setDrawOptions(userData, index))) {
@@ -2196,7 +2194,7 @@ static void ccgDM_drawMappedEdgesInterp(DerivedMesh *dm, int (*setDrawOptions)(v
for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) {
CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
- int index = ccgDM_getEdgeMapIndex(ccgdm, ss, e);
+ int index = ccgDM_getEdgeMapIndex(ss, e);
glBegin(GL_LINE_STRIP);
if (index!=-1 && (!setDrawOptions || setDrawOptions(userData, index))) {
@@ -2223,7 +2221,7 @@ static void ccgDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *us
for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(fi);
- int index = ccgDM_getFaceMapIndex(ccgdm, ss, f);
+ int index = ccgDM_getFaceMapIndex(ss, f);
if (index!=-1) {
/* Face center data normal isn't updated atm. */
@@ -2259,17 +2257,17 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
int index, totvert, totedge, totface;
int i;
int vertNum, edgeNum, faceNum;
- int *vertOrigIndex, *edgeOrigIndex, *faceOrigIndex;
+ int *vertOrigIndex, *faceOrigIndex; /* *edgeOrigIndex - as yet, unused */
int *edgeFlags;
char *faceFlags;
int edgeSize;
int gridSize;
int gridFaces;
int gridSideVerts;
- int gridInternalVerts;
+ /*int gridInternalVerts; - as yet unused */
int gridSideEdges;
int gridInternalEdges;
- MVert *mvert = NULL;
+ /* MVert *mvert = NULL; - as yet unused */
MEdge *medge = NULL;
MFace *mface = NULL;
FaceVertWeight *qweight, *tweight;
@@ -2333,7 +2331,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
for(; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) {
CCGVert *v = ccgVertIterator_getCurrent(vi);
- ccgdm->vertMap[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v))].vert = v;
+ ccgdm->vertMap[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v))].vert = v;
}
ccgVertIterator_free(vi);
@@ -2343,7 +2341,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
for(; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) {
CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
- ccgdm->edgeMap[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ss, e))].edge = e;
+ ccgdm->edgeMap[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))].edge = e;
}
totface = ccgSubSurf_getNumFaces(ss);
@@ -2360,7 +2358,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
gridSize = ccgSubSurf_getGridSize(ss);
gridFaces = gridSize - 1;
gridSideVerts = gridSize - 2;
- gridInternalVerts = gridSideVerts * gridSideVerts;
+ /*gridInternalVerts = gridSideVerts * gridSideVerts; - as yet, unused */
gridSideEdges = gridSize - 1;
gridInternalEdges = (gridSideEdges - 1) * gridSideEdges * 2;
@@ -2370,21 +2368,21 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
edgeNum = 0;
faceNum = 0;
- mvert = dm->getVertArray(dm);
+ /* mvert = dm->getVertArray(dm); - as yet unused */
medge = dm->getEdgeArray(dm);
mface = dm->getFaceArray(dm);
vertOrigIndex = DM_get_vert_data_layer(&ccgdm->dm, CD_ORIGINDEX);
- edgeOrigIndex = DM_get_edge_data_layer(&ccgdm->dm, CD_ORIGINDEX);
+ /*edgeOrigIndex = DM_get_edge_data_layer(&ccgdm->dm, CD_ORIGINDEX);*/
faceOrigIndex = DM_get_face_data_layer(&ccgdm->dm, CD_ORIGINDEX);
faceFlags = DM_get_face_data_layer(&ccgdm->dm, CD_FLAGS);
for(index = 0; index < totface; ++index) {
CCGFace *f = ccgdm->faceMap[index].face;
- int numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+ int numVerts = ccgSubSurf_getFaceNumVerts(f);
int numFinalEdges = numVerts * (gridSideEdges + gridInternalEdges);
- int mapIndex = ccgDM_getFaceMapIndex(ccgdm, ss, f);
+ int mapIndex = ccgDM_getFaceMapIndex(ss, f);
int origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f));
FaceVertWeight *weight = (numVerts == 4) ? qweight : tweight;
int S, x, y;
@@ -2400,7 +2398,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
for(S = 0; S < numVerts; S++) {
CCGVert *v = ccgSubSurf_getFaceVert(ss, f, S);
- vertIdx[S] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v));
+ vertIdx[S] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
}
DM_interp_vert_data(dm, &ccgdm->dm, vertIdx, weight[0][0],
@@ -2503,16 +2501,16 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
for(index = 0; index < totedge; ++index) {
CCGEdge *e = ccgdm->edgeMap[index].edge;
int numFinalEdges = edgeSize - 1;
- int mapIndex = ccgDM_getEdgeMapIndex(ccgdm, ss, e);
+ int mapIndex = ccgDM_getEdgeMapIndex(ss, e);
int x;
int vertIdx[2];
- int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ss, e));
+ int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e));
CCGVert *v;
- v = ccgSubSurf_getEdgeVert0(ss, e);
- vertIdx[0] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v));
- v = ccgSubSurf_getEdgeVert1(ss, e);
- vertIdx[1] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v));
+ v = ccgSubSurf_getEdgeVert0(e);
+ vertIdx[0] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
+ v = ccgSubSurf_getEdgeVert1(e);
+ vertIdx[1] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
ccgdm->edgeMap[index].startVert = vertNum;
ccgdm->edgeMap[index].startEdge = edgeNum;
@@ -2543,10 +2541,10 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
for(index = 0; index < totvert; ++index) {
CCGVert *v = ccgdm->vertMap[index].vert;
- int mapIndex = ccgDM_getVertMapIndex(ccgdm, ccgdm->ss, v);
+ int mapIndex = ccgDM_getVertMapIndex(ccgdm->ss, v);
int vertIdx;
- vertIdx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v));
+ vertIdx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
ccgdm->vertMap[index].startVert = vertNum;
@@ -2679,9 +2677,9 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3])
vi = ccgSubSurf_getVertIterator(ss);
for (; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) {
CCGVert *v = ccgVertIterator_getCurrent(vi);
- int idx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v));
- int N = ccgSubSurf_getVertNumEdges(ss, v);
- int numFaces = ccgSubSurf_getVertNumFaces(ss, v);
+ int idx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
+ int N = ccgSubSurf_getVertNumEdges(v);
+ int numFaces = ccgSubSurf_getVertNumFaces(v);
float *co;
int i;
@@ -2689,12 +2687,12 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3])
face_sum[0]= face_sum[1]= face_sum[2]= 0.0;
for (i=0; i<N; i++) {
- CCGEdge *e = ccgSubSurf_getVertEdge(ss, v, i);
+ CCGEdge *e = ccgSubSurf_getVertEdge(v, i);
VecAddf(edge_sum, edge_sum, ccgSubSurf_getEdgeData(ss, e, 1));
}
for (i=0; i<numFaces; i++) {
- CCGFace *f = ccgSubSurf_getVertFace(ss, v, i);
- VecAddf(face_sum, face_sum, ccgSubSurf_getFaceCenterData(ss, f));
+ CCGFace *f = ccgSubSurf_getVertFace(v, i);
+ VecAddf(face_sum, face_sum, ccgSubSurf_getFaceCenterData(f));
}
/* ad-hoc correction for boundary vertices, to at least avoid them
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 5f1a1e63da4..9e6efa59d71 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -577,13 +577,14 @@ static void txt_make_dirty (Text *text)
/* 0:whitespace, 1:punct, 2:alphanumeric */
static short txt_char_type (char ch)
{
- if (ch <= ' ') return 0;
- if (ch <= '/') return 1;
- if (ch <= '9') return 2;
- if (ch <= '@') return 1;
- if (ch <= 'Z') return 2;
- if (ch <= '`') return 1;
- if (ch <= 'z') return 2;
+ if (ch <= ' ') return 0; /* 32 */
+ if (ch <= '/') return 1; /* 47 */
+ if (ch <= '9') return 2; /* 57 */
+ if (ch <= '@') return 1; /* 64 */
+ if (ch <= 'Z') return 2; /* 90 */
+ if (ch == '_') return 2; /* 95, dont delimit '_' */
+ if (ch <= '`') return 1; /* 96 */
+ if (ch <= 'z') return 2; /* 122 */
return 1;
}
@@ -2243,7 +2244,6 @@ void txt_delete_char (Text *text)
if ((mrk->flags & TMARK_TEMP) && !(mrk->flags & TMARK_EDITALL)) {
txt_clear_markers(text, mrk->group, TMARK_TEMP);
} else {
- //TextMarker *nxt= mrk->next;
BLI_freelinkN(&text->markers, mrk);
}
return;
@@ -2308,7 +2308,6 @@ void txt_backspace_char (Text *text)
if ((mrk->flags & TMARK_TEMP) && !(mrk->flags & TMARK_EDITALL)) {
txt_clear_markers(text, mrk->group, TMARK_TEMP);
} else {
- //TextMarker *nxt= mrk->next;
BLI_freelinkN(&text->markers, mrk);
}
return;
@@ -2681,13 +2680,6 @@ int setcurr_tab (Text *text)
/* Text marker utility functions */
/*********************************/
-static int color_match(TextMarker *a, TextMarker *b) {
- return (a->color[0]==b->color[0] &&
- a->color[1]==b->color[1] &&
- a->color[2]==b->color[2] &&
- a->color[3]==b->color[3]);
-}
-
/* Creates and adds a marker to the list maintaining sorted order */
void txt_add_marker(Text *text, TextLine *line, int start, int end, char color[4], int group, int flags) {
TextMarker *tmp, *marker;
diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c
index 6b38d7deadb..40e1dc1bb03 100644
--- a/source/blender/blenkernel/intern/writeframeserver.c
+++ b/source/blender/blenkernel/intern/writeframeserver.c
@@ -251,7 +251,7 @@ static int handle_request(char * req)
return -1;
}
-int frameserver_loop()
+int frameserver_loop(void)
{
fd_set readfds;
struct timeval tv;
diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c
index 9c3c561ac84..bf7e3473d1f 100644
--- a/source/blender/blenlib/intern/arithb.c
+++ b/source/blender/blenlib/intern/arithb.c
@@ -2510,7 +2510,7 @@ short IsectLL2Df(float *v1, float *v2, float *v3, float *v4)
1: intersection
*/
-short IsectLLPt2Df(float x0,float y0,float x1,float y1,
+static short IsectLLPt2Df(float x0,float y0,float x1,float y1,
float x2,float y2,float x3,float y3, float *xi,float *yi)
{
@@ -2560,29 +2560,47 @@ short IsectLLPt2Df(float x0,float y0,float x1,float y1,
} // end Intersect_Lines
#define SIDE_OF_LINE(pa,pb,pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1]))
-#define ISECT_EPSILON 1e-6
-
/* point in tri */
int IsectPT2Df(float pt[2], float v1[2], float v2[2], float v3[2])
{
- if ((SIDE_OF_LINE(v1,v2,pt)>=-ISECT_EPSILON) &&
- (SIDE_OF_LINE(v2,v3,pt)>=-ISECT_EPSILON) &&
- (SIDE_OF_LINE(v3,v1,pt)>=-ISECT_EPSILON))
- return 1;
- else {
- return 0;
+ if (SIDE_OF_LINE(v1,v2,pt)>=0.0) {
+ if (SIDE_OF_LINE(v2,v3,pt)>=0.0) {
+ if (SIDE_OF_LINE(v3,v1,pt)>=0.0) {
+ return 1;
+ }
+ }
+ } else {
+ if (! (SIDE_OF_LINE(v2,v3,pt)>=0.0) ) {
+ if (! (SIDE_OF_LINE(v3,v1,pt)>=0.0)) {
+ return -1;
+ }
+ }
}
+
+ return 0;
}
/* point in quad - only convex quads */
int IsectPQ2Df(float pt[2], float v1[2], float v2[2], float v3[2], float v4[2])
{
- if ((SIDE_OF_LINE(v1,v2,pt)>=-ISECT_EPSILON) &&
- (SIDE_OF_LINE(v2,v3,pt)>=-ISECT_EPSILON) &&
- (SIDE_OF_LINE(v3,v4,pt)>=-ISECT_EPSILON) &&
- (SIDE_OF_LINE(v4,v1,pt)>=-ISECT_EPSILON))
- return 1;
- else
- return 0;
+ if (SIDE_OF_LINE(v1,v2,pt)>=0.0) {
+ if (SIDE_OF_LINE(v2,v3,pt)>=0.0) {
+ if (SIDE_OF_LINE(v3,v4,pt)>=0.0) {
+ if (SIDE_OF_LINE(v4,v1,pt)>=0.0) {
+ return 1;
+ }
+ }
+ }
+ } else {
+ if (! (SIDE_OF_LINE(v2,v3,pt)>=0.0) ) {
+ if (! (SIDE_OF_LINE(v3,v4,pt)>=0.0)) {
+ if (! (SIDE_OF_LINE(v4,v1,pt)>=0.0)) {
+ return -1;
+ }
+ }
+ }
+ }
+
+ return 0;
}
@@ -3521,7 +3539,7 @@ int constrain_rgb(float *r, float *g, float *b)
Parameter Values for the HDTV Standard for the Studio and
for International Programme Exchange'', formerly CCIR Rec.
709.*/
-void gamma_correct(float *c)
+static void gamma_correct(float *c)
{
/* Rec. 709 gamma correction. */
float cc = 0.018;
@@ -3627,6 +3645,8 @@ void spheremap(float x, float y, float z, float *u, float *v)
/* ------------------------------------------------------------------------- */
+/* proposed api by ton and zr, not used yet */
+#if 0
/* ***************** m1 = m2 ***************** */
void cpy_m3_m3(float m1[][3], float m2[][3])
{
@@ -3650,7 +3670,6 @@ void ident_m4(float m[][4])
m[3][0]= m[3][1]= m[3][2]= 0.0;
}
-
/* ***************** m1 = m2 (pre) * m3 (post) ***************** */
void mul_m3_m3m3(float m1[][3], float m2[][3], float m3[][3])
{
@@ -3788,6 +3807,8 @@ void mul_v3_v3m4(float *v1, float *v2, float mat[][4])
}
+#endif
+
/* moved from effect.c
test if the line starting at p1 ending at p2 intersects the triangle v0..v2
return non zero if it does
@@ -4235,7 +4256,7 @@ float lambda_cp_line_ex(float p[3], float l1[3], float l2[3], float cp[3])
}
/* little sister we only need to know lambda */
-float lambda_cp_line(float p[3], float l1[3], float l2[3])
+static float lambda_cp_line(float p[3], float l1[3], float l2[3])
{
float h[3],u[3];
VecSubf(u, l2, l1);
@@ -4394,7 +4415,7 @@ void VecfCubicInterpol(float *x1, float *v1, float *x2, float *v2, float t, floa
v[2]= 3*a[2]*t2 + 2*b[2]*t + v1[2];
}
-int point_in_slice(float p[3], float v1[3], float l1[3], float l2[3])
+static int point_in_slice(float p[3], float v1[3], float l1[3], float l2[3])
{
/*
what is a slice ?
@@ -4421,7 +4442,7 @@ but see a 'spat' which is a deformed cube with paired parallel planes needs only
/*adult sister defining the slice planes by the origin and the normal
NOTE |normal| may not be 1 but defining the thickness of the slice*/
-int point_in_slice_as(float p[3],float origin[3],float normal[3])
+static int point_in_slice_as(float p[3],float origin[3],float normal[3])
{
float h,rp[3];
VecSubf(rp,p,origin);
@@ -4431,7 +4452,7 @@ int point_in_slice_as(float p[3],float origin[3],float normal[3])
}
/*mama (knowing the squared lenght of the normal)*/
-int point_in_slice_m(float p[3],float origin[3],float normal[3],float lns)
+static int point_in_slice_m(float p[3],float origin[3],float normal[3],float lns)
{
float h,rp[3];
VecSubf(rp,p,origin);
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c
index 898ad6ddd67..e23c2658399 100644
--- a/source/blender/blenlib/intern/bpath.c
+++ b/source/blender/blenlib/intern/bpath.c
@@ -254,7 +254,7 @@ static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int st
return NULL;
}
-void seq_getpath(struct BPathIterator *bpi, char *path) {
+static void seq_getpath(struct BPathIterator *bpi, char *path) {
Sequence *seq = (Sequence *)bpi->data;
@@ -275,7 +275,7 @@ void seq_getpath(struct BPathIterator *bpi, char *path) {
}
}
-void seq_setpath(struct BPathIterator *bpi, char *path) {
+static void seq_setpath(struct BPathIterator *bpi, char *path) {
Sequence *seq = (Sequence *)bpi->data;
if (seq==NULL) return;
@@ -456,7 +456,6 @@ void checkMissingFiles( char *txtname ) {
/* be sure there is low chance of the path being too short */
char filepath_expanded[FILE_MAXDIR*2];
- int files_missing = 0;
BLI_bpathIterator_init(&bpi);
while (!BLI_bpathIterator_isDone(&bpi)) {
@@ -470,7 +469,6 @@ void checkMissingFiles( char *txtname ) {
}
}
bpathToText(btxt, &bpi);
- files_missing = 1;
}
BLI_bpathIterator_step(&bpi);
}
diff --git a/source/blender/blenlib/intern/psfont.c b/source/blender/blenlib/intern/psfont.c
index 216246dcdd7..54d7f8ec1af 100644
--- a/source/blender/blenlib/intern/psfont.c
+++ b/source/blender/blenlib/intern/psfont.c
@@ -977,7 +977,7 @@ static void applymat(float mat[][2], float *x, float *y)
static void setcharlist(void)
{
- char *name, found;
+ char *name; /*found;*/
int i, j;
for(i=0; i<NASCII; i++) ISOcharlist[i].prog = -1;
@@ -985,11 +985,11 @@ static void setcharlist(void)
for(j=0; j<my_nchars; j++) {
name = my_charname[j];
if(name) {
- found = 0;
+ /*found = 0;*/
for(i=0; i<NASCII; i++) {
if(ISOcharlist[i].name && (strcmp(name,ISOcharlist[i].name) == 0)){
ISOcharlist[i].prog = j;
- found = 1;
+ /*found = 1;*/
}
}
/*if (found == 0) printf("no match found for: %s\n", name);*/
@@ -1258,10 +1258,10 @@ static void subr0(void)
int x1, y1;
int x2, y2;
int x3, y3;
- int xpos, ypos, noise;
+ int noise;
- ypos = pop();
- xpos = pop();
+ pop(); /* xpos, unused */
+ pop(); /* ypos, unused */
noise = pop();
if(coordpos!=7) {
fprintf(stderr,"subr0: bad poop\n");
diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c
index d65fe8a476a..442a629b12d 100644
--- a/source/blender/blenlib/intern/util.c
+++ b/source/blender/blenlib/intern/util.c
@@ -1149,15 +1149,13 @@ int BLI_convertstringframe(char *path, int frame)
int BLI_convertstringcode(char *path, const char *basepath)
{
- int wasrelative;
+ int wasrelative = (strncmp(path, "//", 2)==0);
char tmp[FILE_MAX];
char base[FILE_MAX];
+#ifdef WIN32
char vol[3] = {'\0', '\0', '\0'};
BLI_strncpy(vol, path, 3);
- wasrelative= (vol[0]=='/' && vol[1]=='/');
-
-#ifdef WIN32
/* we are checking here if we have an absolute path that is not in the current
blend file as a lib main - we are basically checking for the case that a
UNIX root '/' is passed.
@@ -1176,6 +1174,20 @@ int BLI_convertstringcode(char *path, const char *basepath)
}
#else
BLI_strncpy(tmp, path, FILE_MAX);
+
+ /* Check for loading a windows path on a posix system
+ * in this case, there is no use in trying C:/ since it
+ * will never exist on a unix os.
+ *
+ * Add a / prefix and lowercase the driveletter, remove the :
+ * C:\foo.JPG -> /c/foo.JPG */
+
+ if (tmp[1] == ':' && isalpha(tmp[0]) && (tmp[2]=='\\' || tmp[2]=='/') ) {
+ tmp[1] = tolower(tmp[0]); /* replace ':' with driveletter */
+ tmp[0] = '/';
+ /* '\' the slash will be converted later */
+ }
+
#endif
BLI_strncpy(base, basepath, FILE_MAX);
diff --git a/source/blender/blenloader/BLO_soundfile.h b/source/blender/blenloader/BLO_soundfile.h
index 3d133b2d3bd..a239c7d8965 100644
--- a/source/blender/blenloader/BLO_soundfile.h
+++ b/source/blender/blenloader/BLO_soundfile.h
@@ -35,7 +35,5 @@
struct bSound;
struct PackedFile;
-//void sound_read_wav_data(bSound * sound, PackedFile * pf);
-
#endif
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 555a7455c60..568513650e0 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -141,6 +141,7 @@
#include "BKE_sca.h" // for init_actuator
#include "BKE_scene.h"
#include "BKE_softbody.h" // sbNew()
+#include "BKE_bullet.h" // bsbNew()
#include "BKE_sculpt.h"
#include "BKE_texture.h" // for open_plugin_tex
#include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER TEST REND
@@ -1346,7 +1347,7 @@ static void test_pointer_array(FileData *fd, void **mat)
void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, void *fd);
void IDP_LibLinkProperty(IDProperty *prop, int switch_endian, void *fd);
-void IDP_DirectLinkArray(IDProperty *prop, int switch_endian, void *fd)
+static void IDP_DirectLinkArray(IDProperty *prop, int switch_endian, void *fd)
{
int i;
@@ -1367,14 +1368,14 @@ void IDP_DirectLinkArray(IDProperty *prop, int switch_endian, void *fd)
}
}
-void IDP_DirectLinkString(IDProperty *prop, int switch_endian, void *fd)
+static void IDP_DirectLinkString(IDProperty *prop, int switch_endian, void *fd)
{
/*since we didn't save the extra string buffer, set totallen to len.*/
prop->totallen = prop->len;
prop->data.pointer = newdataadr(fd, prop->data.pointer);
}
-void IDP_DirectLinkGroup(IDProperty *prop, int switch_endian, void *fd)
+static void IDP_DirectLinkGroup(IDProperty *prop, int switch_endian, void *fd)
{
ListBase *lb = &prop->data.group;
IDProperty *loop;
@@ -3339,6 +3340,7 @@ static void direct_link_object(FileData *fd, Object *ob)
if(sb->pointcache)
direct_link_pointcache(fd, sb->pointcache);
}
+ ob->bsoft= newdataadr(fd, ob->bsoft);
ob->fluidsimSettings= newdataadr(fd, ob->fluidsimSettings); /* NT */
link_list(fd, &ob->particlesystem);
@@ -4877,7 +4879,7 @@ static void ntree_version_245(FileData *fd, Library *lib, bNodeTree *ntree)
}
}
-void idproperties_fix_groups_lengths_recurse(IDProperty *prop)
+static void idproperties_fix_groups_lengths_recurse(IDProperty *prop)
{
IDProperty *loop;
int i;
@@ -4892,7 +4894,7 @@ void idproperties_fix_groups_lengths_recurse(IDProperty *prop)
}
}
-void idproperties_fix_group_lengths(ListBase idlist)
+static void idproperties_fix_group_lengths(ListBase idlist)
{
ID *id;
@@ -4903,7 +4905,7 @@ void idproperties_fix_group_lengths(ListBase idlist)
}
}
-void alphasort_version_246(FileData *fd, Library *lib, Mesh *me)
+static void alphasort_version_246(FileData *fd, Library *lib, Mesh *me)
{
Material *ma;
MFace *mf;
@@ -7902,11 +7904,55 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for(nu= cu->nurb.first; nu; nu= nu->next) {
if (nu) {
nu->radius_interp = 3;
+
+ /* resolu and resolv are now used differently for surfaces
+ * rather then using the resolution to define the entire number of divisions,
+ * use it for the number of divisions per segment
+ */
+ if (nu->pntsv > 1) {
+ nu->resolu = MAX2( 1, (int)(((float)nu->resolu / (float)nu->pntsu)+0.5f) );
+ nu->resolv = MAX2( 1, (int)(((float)nu->resolv / (float)nu->pntsv)+0.5f) );
+ }
}
}
}
}
+ /* direction constraint actuators were always local in previous version */
+ if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 7)) {
+ bActuator *act;
+ Object *ob;
+
+ for(ob = main->object.first; ob; ob= ob->id.next) {
+ for(act= ob->actuators.first; act; act= act->next) {
+ if (act->type == ACT_CONSTRAINT) {
+ bConstraintActuator *coa = act->data;
+ if (coa->type == ACT_CONST_TYPE_DIST) {
+ coa->flag |= ACT_CONST_LOCAL;
+ }
+ }
+ }
+ }
+ }
+ /* autokey mode settings now used from scene, but need to be initialised off userprefs */
+ if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 8)) {
+ Scene *sce;
+
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ if (sce->autokey_mode == 0)
+ sce->autokey_mode= U.autokey_mode;
+ }
+ }
+
+ if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 9)) {
+ Lamp *la= main->lamp.first;
+ for(; la; la= la->id.next) {
+ la->sky_exposure= 1.0f;
+ }
+ }
+
+
+
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index c4ae6ef858b..7249090dfa7 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -399,7 +399,7 @@ static void writedata(WriteData *wd, int filecode, int len, void *adr) /* do not
void IDP_WriteProperty_OnlyData(IDProperty *prop, void *wd);
void IDP_WriteProperty(IDProperty *prop, void *wd);
-void IDP_WriteArray(IDProperty *prop, void *wd)
+static void IDP_WriteArray(IDProperty *prop, void *wd)
{
/*REMEMBER to set totalen to len in the linking code!!*/
if (prop->data.pointer) {
@@ -407,13 +407,13 @@ void IDP_WriteArray(IDProperty *prop, void *wd)
}
}
-void IDP_WriteString(IDProperty *prop, void *wd)
+static void IDP_WriteString(IDProperty *prop, void *wd)
{
/*REMEMBER to set totalen to len in the linking code!!*/
writedata(wd, DATA, prop->len+1, prop->data.pointer);
}
-void IDP_WriteGroup(IDProperty *prop, void *wd)
+static void IDP_WriteGroup(IDProperty *prop, void *wd)
{
IDProperty *loop;
@@ -922,6 +922,7 @@ static void write_objects(WriteData *wd, ListBase *idbase)
writestruct(wd, DATA, "PartDeflect", 1, ob->pd);
writestruct(wd, DATA, "SoftBody", 1, ob->soft);
if(ob->soft) writestruct(wd, DATA, "PointCache", 1, ob->soft->pointcache);
+ writestruct(wd, DATA, "BulletSoftBody", 1, ob->bsoft);
write_particlesystems(wd, &ob->particlesystem);
write_modifiers(wd, &ob->modifiers);
@@ -1065,7 +1066,7 @@ static void write_mballs(WriteData *wd, ListBase *idbase)
}
}
-int amount_of_chars(char *str)
+static int amount_of_chars(char *str)
{
// Since the data is saved as UTF-8 to the cu->str
// The cu->len is not same as the strlen(cu->str)
diff --git a/source/blender/include/BDR_editobject.h b/source/blender/include/BDR_editobject.h
index ac60aece344..bc95c221b51 100644
--- a/source/blender/include/BDR_editobject.h
+++ b/source/blender/include/BDR_editobject.h
@@ -77,6 +77,8 @@ void make_links_menu(void);
void make_links(short event);
void make_duplilist_real(void);
void apply_objects_locrot(void);
+void apply_objects_scale(void);
+void apply_objects_rot(void);
void apply_objects_visual_tx(void);
void apply_object(void);
diff --git a/source/blender/include/BIF_drawtext.h b/source/blender/include/BIF_drawtext.h
index 51000f8c81a..db2889d4e9d 100644
--- a/source/blender/include/BIF_drawtext.h
+++ b/source/blender/include/BIF_drawtext.h
@@ -39,7 +39,6 @@ void unlink_text(struct Text *text);
void free_textspace(struct SpaceText *st);
-int txt_file_modified(struct Text *text);
void txt_write_file(struct Text *text);
void add_text_fs(char *file);
diff --git a/source/blender/include/BIF_editarmature.h b/source/blender/include/BIF_editarmature.h
index fdd00a67465..d390b96f61f 100644
--- a/source/blender/include/BIF_editarmature.h
+++ b/source/blender/include/BIF_editarmature.h
@@ -139,6 +139,8 @@ void hide_selected_armature_bones(void);
void hide_unselected_armature_bones(void);
void show_all_armature_bones(void);
+void align_selected_bones(void);
+
#define BONESEL_ROOT 0x10000000
#define BONESEL_TIP 0x20000000
#define BONESEL_BONE 0x40000000
@@ -157,3 +159,4 @@ void show_all_armature_bones(void);
#endif
+
diff --git a/source/blender/include/BIF_editmesh.h b/source/blender/include/BIF_editmesh.h
index 9354a577ac1..30e9e16355e 100644
--- a/source/blender/include/BIF_editmesh.h
+++ b/source/blender/include/BIF_editmesh.h
@@ -73,7 +73,7 @@ extern void add_primitiveMesh(int type);
extern void adduplicate_mesh(void);
extern void add_click_mesh(void);
extern void addedgeface_mesh(void);
-void addfaces_from_edgenet();
+void addfaces_from_edgenet(void);
/* ******************* editmesh_lib.c */
@@ -221,7 +221,7 @@ extern void beauty_fill(void);
extern void join_triangles(void);
extern void edge_flip(void);
extern void fill_mesh(void);
-extern void bevel_menu();
+extern void bevel_menu(void);
void mesh_set_face_flags(short mode);
extern void mesh_set_smooth_faces(short event);
extern void mesh_rotate_uvs(void);
diff --git a/source/blender/include/BIF_editparticle.h b/source/blender/include/BIF_editparticle.h
index 41d86565b13..aecaee31d53 100644
--- a/source/blender/include/BIF_editparticle.h
+++ b/source/blender/include/BIF_editparticle.h
@@ -54,7 +54,7 @@ short PE_get_current_num(struct Object *ob);
int PE_minmax(float *min, float *max);
void PE_get_colors(char sel[4], char nosel[4]);
struct ParticleEditSettings *PE_settings(void);
-struct RadialControl **PE_radialcontrol();
+struct RadialControl **PE_radialcontrol(void);
/* update calls */
void PE_hide_keys_time(struct ParticleSystem *psys, float cfra);
diff --git a/source/blender/include/BIF_keyframing.h b/source/blender/include/BIF_keyframing.h
index eeaef957b90..5d43a50efec 100644
--- a/source/blender/include/BIF_keyframing.h
+++ b/source/blender/include/BIF_keyframing.h
@@ -49,13 +49,17 @@ int insert_bezt_icu(struct IpoCurve *icu, struct BezTriple *bezt);
void insert_vert_icu(struct IpoCurve *icu, float x, float y, short flag);
-/* flags for use in insert_key(), and insert_vert_icu() */
+/* flags for use by keyframe creation/deletion calls */
enum {
+ /* used by isnertkey() and insert_vert_icu() */
INSERTKEY_NEEDED = (1<<0), /* only insert keyframes where they're needed */
INSERTKEY_MATRIX = (1<<1), /* insert 'visual' keyframes where possible/needed */
INSERTKEY_FAST = (1<<2), /* don't recalculate handles,etc. after adding key */
INSERTKEY_FASTR = (1<<3), /* don't realloc mem (or increase count, as array has already been set out) */
INSERTKEY_REPLACE = (1<<4), /* only replace an existing keyframe (this overrides INSERTKEY_NEEDED) */
+
+ /* used by common_*key() functions */
+ COMMONKEY_ADDMAP = (1<<10), /* common key: add texture-slot offset bitflag to adrcode before use */
} eInsertKeyFlags;
/* -------- */
@@ -80,6 +84,24 @@ short deletekey(struct ID *id, int blocktype, char *actname, char *constname, in
void common_insertkey(void);
void common_deletekey(void);
+/* ************ Auto-Keyframing ********************** */
+/* Notes:
+ * - All the defines for this (User-Pref settings and Per-Scene settings)
+ * are defined in DNA_userdef_types.h
+ * - Scene settings take presidence over those for userprefs, with old files
+ * inheriting userpref settings for the scene settings
+ * - "On/Off + Mode" are stored per Scene, but "settings" are currently stored
+ * as userprefs
+ */
+
+/* Auto-Keying macros for use by various tools */
+ /* check if auto-keyframing is enabled (per scene takes presidence) */
+#define IS_AUTOKEY_ON ((G.scene) ? (G.scene->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON))
+ /* check the mode for auto-keyframing (per scene takes presidence) */
+#define IS_AUTOKEY_MODE(mode) ((G.scene) ? (G.scene->autokey_mode == AUTOKEY_MODE_##mode) : (U.autokey_mode == AUTOKEY_MODE_##mode))
+ /* check if a flag is set for auto-keyframing (as userprefs only!) */
+#define IS_AUTOKEY_FLAG(flag) (U.autokey_flag & AUTOKEY_FLAG_##flag)
+
/* ************ Keyframe Checking ******************** */
/* Checks whether a keyframe exists for the given ID-block one the given frame */
diff --git a/source/blender/include/BIF_retopo.h b/source/blender/include/BIF_retopo.h
index 5d39923a398..cc2fda56b07 100644
--- a/source/blender/include/BIF_retopo.h
+++ b/source/blender/include/BIF_retopo.h
@@ -79,27 +79,27 @@ typedef struct RetopoPaintData {
struct View3D *paint_v3d;
} RetopoPaintData;
-RetopoPaintData *get_retopo_paint_data();
+RetopoPaintData *get_retopo_paint_data(void);
-char retopo_mesh_check();
-char retopo_curve_check();
+char retopo_mesh_check(void);
+char retopo_curve_check(void);
-void retopo_end_okee();
+void retopo_end_okee(void);
void retopo_free_paint_data(RetopoPaintData *rpd);
-void retopo_free_paint();
+void retopo_free_paint(void);
-char retopo_mesh_paint_check();
+char retopo_mesh_paint_check(void);
void retopo_paint_view_update(struct View3D *v3d);
-void retopo_force_update();
+void retopo_force_update(void);
void retopo_paint_toggle(void*,void*);
char retopo_paint(const unsigned short event);
-void retopo_draw_paint_lines();
+void retopo_draw_paint_lines(void);
RetopoPaintData *retopo_paint_data_copy(RetopoPaintData *rpd);
void retopo_toggle(void*,void*);
void retopo_do_vert(struct View3D *v3d, float *v);
-void retopo_do_all();
+void retopo_do_all(void);
void retopo_do_all_cb(void *, void *);
void retopo_queue_updates(struct View3D *v3d);
diff --git a/source/blender/include/blendef.h b/source/blender/include/blendef.h
index 7f1b0f234dd..50179325609 100644
--- a/source/blender/include/blendef.h
+++ b/source/blender/include/blendef.h
@@ -406,6 +406,8 @@
#define B_TL_NEXTKEY 755
#define B_TL_STOP 756
#define B_TL_PREVIEWON 757
+#define B_TL_INSERTKEY 758
+#define B_TL_DELETEKEY 759
/* NLA: 801-850 */
#define B_NLAHOME 801
diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h
index 750bdf2cfff..2487216f764 100644
--- a/source/blender/makesdna/DNA_actuator_types.h
+++ b/source/blender/makesdna/DNA_actuator_types.h
@@ -368,6 +368,8 @@ typedef struct FreeCamera {
#define ACT_CONST_MATERIAL 128
#define ACT_CONST_PERMANENT 256
#define ACT_CONST_DISTANCE 512
+#define ACT_CONST_LOCAL 1024
+
/* constraint mode */
#define ACT_CONST_DIRPX 1
#define ACT_CONST_DIRPY 2
diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h
index fa5b5a75941..ecfb7dc7a90 100644
--- a/source/blender/makesdna/DNA_constraint_types.h
+++ b/source/blender/makesdna/DNA_constraint_types.h
@@ -463,7 +463,9 @@ typedef enum B_CONSTRAINTCHANNEL_FLAG {
/* bKinematicConstraint->flag */
#define CONSTRAINT_IK_TIP 1
#define CONSTRAINT_IK_ROT 2
+ /* targetless */
#define CONSTRAINT_IK_AUTO 4
+ /* autoik */
#define CONSTRAINT_IK_TEMP 8
#define CONSTRAINT_IK_STRETCH 16
#define CONSTRAINT_IK_POS 32
diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h
index 5be6dd727c0..432399e3581 100644
--- a/source/blender/makesdna/DNA_ipo_types.h
+++ b/source/blender/makesdna/DNA_ipo_types.h
@@ -201,6 +201,8 @@ typedef struct Ipo {
#define MA_MAP17 (1<<21)
#define MA_MAP18 (1<<22)
+/* ********** Texture Slots (MTex) ********** */
+
#define TEX_TOTNAM 14
#define MAP_OFS_X 1
diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_lamp_types.h
index 217e3ed1463..f8f2255c1a7 100644
--- a/source/blender/makesdna/DNA_lamp_types.h
+++ b/source/blender/makesdna/DNA_lamp_types.h
@@ -91,7 +91,9 @@ typedef struct Lamp {
float atm_extinction_factor;
float atm_distance_factor;
float skyblendfac;
-
+ float sky_exposure;
+ short sky_colorspace, pad4;
+
/* yafray: photonlight params */
int YF_numphotons, YF_numsearch;
short YF_phdepth, YF_useqmc, YF_bufsize, YF_pad;
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 3e8f8702003..ae07434a37f 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -38,6 +38,7 @@ typedef enum ModifierType {
eModifierType_Shrinkwrap,
eModifierType_Fluidsim,
eModifierType_Mask,
+ eModifierType_SimpleDeform,
NUM_MODIFIER_TYPES
} ModifierType;
@@ -560,4 +561,32 @@ typedef struct ShrinkwrapModifierData {
#define MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS (1<<2)
#define MOD_SHRINKWRAP_PROJECT_OVER_NORMAL 0 /* projection over normal is used if no axis is selected */
+
+typedef struct SimpleDeformModifierData {
+ ModifierData modifier;
+
+ struct Object *origin; /* object to control the origin of modifier space coordinates */
+ char vgroup_name[32]; /* optional vertexgroup name */
+ float factor; /* factors to control simple deforms */
+ float limit[2]; /* lower and upper limit */
+
+ char mode; /* deform function */
+ char axis; /* lock axis (for taper and strech) */
+ char originOpts; /* originOptions */
+ char pad;
+
+} SimpleDeformModifierData;
+
+#define MOD_SIMPLEDEFORM_MODE_TWIST 1
+#define MOD_SIMPLEDEFORM_MODE_BEND 2
+#define MOD_SIMPLEDEFORM_MODE_TAPER 3
+#define MOD_SIMPLEDEFORM_MODE_STRETCH 4
+
+#define MOD_SIMPLEDEFORM_LOCK_AXIS_X (1<<0)
+#define MOD_SIMPLEDEFORM_LOCK_AXIS_Y (1<<1)
+
+/* indicates whether simple deform should use the local
+ coordinates or global coordinates of origin */
+#define MOD_SIMPLEDEFORM_ORIGIN_LOCAL (1<<0)
+
#endif
diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h
index 5900e16d5e8..21c5242a703 100644
--- a/source/blender/makesdna/DNA_object_force.h
+++ b/source/blender/makesdna/DNA_object_force.h
@@ -84,6 +84,58 @@ typedef struct SBVertex {
float vec[4];
} SBVertex;
+typedef struct BulletSoftBody {
+ int flag; /* various boolean options */
+ float linStiff; /* linear stiffness 0..1 */
+ float angStiff; /* angular stiffness 0..1 */
+ float volume; /* volume preservation 0..1 */
+
+ int viterations; /* Velocities solver iterations */
+ int piterations; /* Positions solver iterations */
+ int diterations; /* Drift solver iterations */
+ int citerations; /* Cluster solver iterations */
+
+ float kSRHR_CL; /* Soft vs rigid hardness [0,1] (cluster only) */
+ float kSKHR_CL; /* Soft vs kinetic hardness [0,1] (cluster only) */
+ float kSSHR_CL; /* Soft vs soft hardness [0,1] (cluster only) */
+ float kSR_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
+
+ float kSK_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
+ float kSS_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
+ float kVCF; /* Velocities correction factor (Baumgarte) */
+ float kDP; /* Damping coefficient [0,1] */
+
+ float kDG; /* Drag coefficient [0,+inf] */
+ float kLF; /* Lift coefficient [0,+inf] */
+ float kPR; /* Pressure coefficient [-inf,+inf] */
+ float kVC; /* Volume conversation coefficient [0,+inf] */
+
+ float kDF; /* Dynamic friction coefficient [0,1] */
+ float kMT; /* Pose matching coefficient [0,1] */
+ float kCHR; /* Rigid contacts hardness [0,1] */
+ float kKHR; /* Kinetic contacts hardness [0,1] */
+
+ float kSHR; /* Soft contacts hardness [0,1] */
+ float kAHR; /* Anchors hardness [0,1] */
+ int collisionflags; /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */
+ int numclusteriterations; /* number of iterations to refine collision clusters*/
+
+} BulletSoftBody;
+
+/* BulletSoftBody.flag */
+#define OB_BSB_SHAPE_MATCHING 2
+#define OB_BSB_UNUSED 4
+#define OB_BSB_BENDING_CONSTRAINTS 8
+#define OB_BSB_AERO_VPOINT 16 /* aero model, Vertex normals are oriented toward velocity*/
+#define OB_BSB_AERO_VTWOSIDE 32 /* aero model, Vertex normals are flipped to match velocity */
+
+/* BulletSoftBody.collisionflags */
+#define OB_BSB_COL_SDF_RS 2 /* SDF based rigid vs soft */
+#define OB_BSB_COL_CL_RS 4 /* Cluster based rigid vs soft */
+#define OB_BSB_COL_CL_SS 8 /* Cluster based soft vs soft */
+#define OB_BSB_COL_VF_SS 16 /* Vertex/Face based soft vs soft */
+
+
typedef struct SoftBody {
struct ParticleSystem *particles; /* particlesystem softbody */
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index c12da6b0194..fad5c020727 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -193,7 +193,9 @@ typedef struct Object {
* bit 15: Always ignore activity culling
*/
int gameflag2;
- short softflag; /* softboday settings */
+ struct BulletSoftBody *bsoft; /* settings for game engine bullet soft body */
+
+ short softflag; /* softbody settings */
short recalc; /* dependency flag */
float anisotropicFriction[3];
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 3888cb48520..a5eaf222941 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -520,7 +520,9 @@ typedef struct Scene {
float editbutsize; /* size of normals */
short selectmode; /* for mesh only! */
short proportional, prop_mode;
- short automerge, pad5, pad6, pad7;
+ short automerge, pad5, pad6;
+
+ short autokey_mode; /* mode for autokeying (defines in DNA_userdef_types.h */
short use_nodes;
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 5d36d5ca973..ead1df4ddac 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -290,10 +290,6 @@ extern UserDef U; /* from usiblender.c !!!! */
#define AUTOKEY_FLAG_INSERTNEEDED (1<<1)
#define AUTOKEY_FLAG_AUTOMATKEY (1<<2)
-/* Auto-Keying macros */
-#define IS_AUTOKEY_ON (U.autokey_mode & AUTOKEY_ON)
-#define IS_AUTOKEY_MODE(mode) (U.autokey_mode == AUTOKEY_MODE_##mode)
-#define IS_AUTOKEY_FLAG(flag) (U.autokey_flag & AUTOKEY_FLAG_##flag)
/* transopts */
#define USER_TR_TOOLTIPS (1 << 0)
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index b30a7162b93..777a5dc8eca 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -144,6 +144,12 @@ typedef struct View3D {
void *properties_storage; /* Nkey panel stores stuff here, not in file */
struct bGPdata *gpd; /* Grease-Pencil Data (annotation layers) */
+
+ /* last view */
+ float lviewquat[4];
+ short lpersp, lview;
+ short lastview_set;
+ short pad5;
} View3D;
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c
index 31609970f6f..59b72702c50 100644
--- a/source/blender/python/BPY_interface.c
+++ b/source/blender/python/BPY_interface.c
@@ -100,7 +100,7 @@ PyObject *bpy_orig_syspath_List = NULL;
* creates list in __main__ module dict
*/
-int setup_armature_weakrefs()
+static int setup_armature_weakrefs()
{
PyObject *maindict;
PyObject *main_module;
@@ -159,19 +159,18 @@ ScriptError g_script_error;
/***************************************************************************
* Function prototypes
***************************************************************************/
-PyObject *RunPython( Text * text, PyObject * globaldict );
-PyObject *CreateGlobalDictionary( void );
-void ReleaseGlobalDictionary( PyObject * dict );
-void DoAllScriptsFromList( ListBase * list, short event );
+static PyObject *RunPython( Text * text, PyObject * globaldict );
+static PyObject *CreateGlobalDictionary( void );
+static void ReleaseGlobalDictionary( PyObject * dict );
+static void DoAllScriptsFromList( ListBase * list, short event );
static PyObject *importText( char *name );
-void init_ourImport( void );
-void init_ourReload( void );
-PyObject *blender_import( PyObject * self, PyObject * args );
-PyObject *RunPython2( Text * text, PyObject * globaldict, PyObject *localdict );
+static void init_ourImport( void );
+static void init_ourReload( void );
+static PyObject *blender_import( PyObject * self, PyObject * args );
-void BPY_Err_Handle( char *script_name );
-PyObject *traceback_getFilename( PyObject * tb );
+static void BPY_Err_Handle( char *script_name );
+static PyObject *traceback_getFilename( PyObject * tb );
/****************************************************************************
* Description: This function will start the interpreter and load all modules
@@ -507,7 +506,7 @@ const char *BPY_Err_getFilename( void )
/*****************************************************************************/
/* Description: Return PyString filename from a traceback object */
/*****************************************************************************/
-PyObject *traceback_getFilename( PyObject * tb )
+static PyObject *traceback_getFilename( PyObject * tb )
{
PyObject *v = NULL;
@@ -531,7 +530,7 @@ PyObject *traceback_getFilename( PyObject * tb )
* Description: Blender Python error handler. This catches the error and
* stores filename and line number in a global
*****************************************************************************/
-void BPY_Err_Handle( char *script_name )
+static void BPY_Err_Handle( char *script_name )
{
PyObject *exception, *err, *tb, *v;
@@ -2713,7 +2712,7 @@ int BPY_call_importloader( char *name )
* The Python dictionary containing global variables needs to
* be passed in globaldict.
*****************************************************************************/
-PyObject *RunPython( Text * text, PyObject * globaldict )
+static PyObject *RunPython( Text * text, PyObject * globaldict )
{
char *buf = NULL;
@@ -2741,7 +2740,7 @@ PyObject *RunPython( Text * text, PyObject * globaldict )
/*****************************************************************************
* Description: This function creates a new Python dictionary object.
*****************************************************************************/
-PyObject *CreateGlobalDictionary( void )
+static PyObject *CreateGlobalDictionary( void )
{
PyObject *dict = PyDict_New( );
@@ -2755,7 +2754,7 @@ PyObject *CreateGlobalDictionary( void )
/*****************************************************************************
* Description: This function deletes a given Python dictionary object.
*****************************************************************************/
-void ReleaseGlobalDictionary( PyObject * dict )
+static void ReleaseGlobalDictionary( PyObject * dict )
{
PyDict_Clear( dict );
Py_DECREF( dict ); /* Release dictionary. */
@@ -2768,7 +2767,7 @@ void ReleaseGlobalDictionary( PyObject * dict )
* list argument. The event by which the function has been
* called, is passed in the event argument.
*****************************************************************************/
-void DoAllScriptsFromList( ListBase * list, short event )
+static void DoAllScriptsFromList( ListBase * list, short event )
{
ID *id;
@@ -2821,7 +2820,7 @@ static PyMethodDef bimport[] = {
{"blimport", blender_import, METH_VARARGS, "our own import"}
};
-PyObject *blender_import( PyObject * self, PyObject * args )
+static PyObject *blender_import( PyObject * self, PyObject * args )
{
PyObject *exception, *err, *tb;
char *name;
@@ -2852,7 +2851,7 @@ PyObject *blender_import( PyObject * self, PyObject * args )
return m;
}
-void init_ourImport( void )
+static void init_ourImport( void )
{
PyObject *m, *d;
PyObject *import = PyCFunction_New( bimport, NULL );
@@ -2953,7 +2952,7 @@ static PyMethodDef breload[] = {
{"blreload", blender_reload, METH_VARARGS, "our own reload"}
};
-void init_ourReload( void )
+static void init_ourReload( void )
{
PyObject *m, *d;
PyObject *reload = PyCFunction_New( breload, NULL );
diff --git a/source/blender/python/api2_2x/Armature.c b/source/blender/python/api2_2x/Armature.c
index 0db87c00dd2..acf18ac6058 100644
--- a/source/blender/python/api2_2x/Armature.c
+++ b/source/blender/python/api2_2x/Armature.c
@@ -57,9 +57,9 @@ static const char sArmatureBadArgs[] = "ArmatureType - Bad Arguments: ";
static const char sModuleError[] = "Blender.Armature - Error: ";
static const char sModuleBadArgs[] = "Blender.Armature - Bad Arguments: ";
-PyObject * arm_weakref_callback_weakref_dealloc(PyObject *self, PyObject *weakref);
+static PyObject * arm_weakref_callback_weakref_dealloc(PyObject *self, PyObject *weakref);
/* python callable */
-PyObject * arm_weakref_callback_weakref_dealloc__pyfunc;
+static PyObject * arm_weakref_callback_weakref_dealloc__pyfunc;
//################## BonesDict_Type (internal) ########################
/*This is an internal psuedo-dictionary type that allows for manipulation
@@ -1323,7 +1323,7 @@ PyObject *Armature_RebuildBones(PyObject *pyarmature)
}
/* internal func to remove weakref from weakref list */
-PyObject * arm_weakref_callback_weakref_dealloc(PyObject *self, PyObject *weakref)
+static PyObject * arm_weakref_callback_weakref_dealloc(PyObject *self, PyObject *weakref)
{
char *list_name = ARM_WEAKREF_LIST_NAME;
PyObject *maindict = NULL, *armlist = NULL;
diff --git a/source/blender/python/api2_2x/Draw.c b/source/blender/python/api2_2x/Draw.c
index b04366d5579..c942657fbd0 100644
--- a/source/blender/python/api2_2x/Draw.c
+++ b/source/blender/python/api2_2x/Draw.c
@@ -1156,10 +1156,12 @@ static PyObject *Method_UIBlock( PyObject * self, PyObject * args )
Py_RETURN_NONE;
}
-void Set_uiBlock(uiBlock *block)
+#if 0 /* not used yet */
+static void Set_uiBlock(uiBlock *block)
{
uiblock = block;
}
+#endif
static uiBlock *Get_uiBlock( void )
{
diff --git a/source/blender/python/api2_2x/Geometry.c b/source/blender/python/api2_2x/Geometry.c
index c800adee30b..89c63870d59 100644
--- a/source/blender/python/api2_2x/Geometry.c
+++ b/source/blender/python/api2_2x/Geometry.c
@@ -54,6 +54,7 @@ static PyObject *M_Geometry_PolyFill( PyObject * self, PyObject * polyLineSeq );
static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args );
static PyObject *M_Geometry_ClosestPointOnLine( PyObject * self, PyObject * args );
static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args );
+static PyObject *M_Geometry_PointInQuad2D( PyObject * self, PyObject * args );
static PyObject *M_Geometry_BoxPack2D( PyObject * self, PyObject * args );
@@ -62,7 +63,8 @@ static char M_Geometry_doc[] = "The Blender Geometry module\n\n";
static char M_Geometry_PolyFill_doc[] = "(veclist_list) - takes a list of polylines (each point a vector) and returns the point indicies for a polyline filled with triangles";
static char M_Geometry_LineIntersect2D_doc[] = "(lineA_p1, lineA_p2, lineB_p1, lineB_p2) - takes 2 lines (as 4 vectors) and returns a vector for their point of intersection or None";
static char M_Geometry_ClosestPointOnLine_doc[] = "(pt, line_p1, line_p2) - takes a point and a line and returns a (Vector, Bool) for the point on the line, and the bool so you can know if the point was between the 2 points";
-static char M_Geometry_PointInTriangle2D_doc[] = "(pt, tri_p1, tri_p2, tri_p3) - takes 4 vectors, one is the point and the next 3 define the triabgle, only the x and y are used from the vectors";
+static char M_Geometry_PointInTriangle2D_doc[] = "(pt, tri_p1, tri_p2, tri_p3) - takes 4 vectors, one is the point and the next 3 define the triangle, only the x and y are used from the vectors";
+static char M_Geometry_PointInQuad2D_doc[] = "(pt, quad_p1, quad_p2, quad_p3, quad_p4) - takes 5 vectors, one is the point and the next 4 define the quad, only the x and y are used from the vectors";
static char M_Geometry_BoxPack2D_doc[] = "";
/*-----------------------METHOD DEFINITIONS ----------------------*/
struct PyMethodDef M_Geometry_methods[] = {
@@ -70,6 +72,7 @@ struct PyMethodDef M_Geometry_methods[] = {
{"LineIntersect2D", ( PyCFunction ) M_Geometry_LineIntersect2D, METH_VARARGS, M_Geometry_LineIntersect2D_doc},
{"ClosestPointOnLine", ( PyCFunction ) M_Geometry_ClosestPointOnLine, METH_VARARGS, M_Geometry_ClosestPointOnLine_doc},
{"PointInTriangle2D", ( PyCFunction ) M_Geometry_PointInTriangle2D, METH_VARARGS, M_Geometry_PointInTriangle2D_doc},
+ {"PointInQuad2D", ( PyCFunction ) M_Geometry_PointInQuad2D, METH_VARARGS, M_Geometry_PointInQuad2D_doc},
{"BoxPack2D", ( PyCFunction ) M_Geometry_BoxPack2D, METH_O, M_Geometry_BoxPack2D_doc},
{NULL, NULL, 0, NULL}
};
@@ -313,9 +316,6 @@ static PyObject *M_Geometry_ClosestPointOnLine( PyObject * self, PyObject * args
return ret;
}
-#define SIDE_OF_LINE(pa,pb,pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1]))
-#define POINT_IN_TRI(p0,p1,p2,p3) ((SIDE_OF_LINE(p1,p2,p0)>=0) && (SIDE_OF_LINE(p2,p3,p0)>=0) && (SIDE_OF_LINE(p3,p1,p0)>=0))
-
static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args )
{
VectorObject *pt_vec, *tri_p1, *tri_p2, *tri_p3;
@@ -329,13 +329,27 @@ static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args
return ( EXPP_ReturnPyObjError
( PyExc_TypeError, "expected 4 vector types\n" ) );
- if POINT_IN_TRI(pt_vec->vec, tri_p1->vec, tri_p2->vec, tri_p3->vec)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
+ return PyInt_FromLong(IsectPT2Df(pt_vec->vec, tri_p1->vec, tri_p2->vec, tri_p3->vec));
+}
+
+static PyObject *M_Geometry_PointInQuad2D( PyObject * self, PyObject * args )
+{
+ VectorObject *pt_vec, *quad_p1, *quad_p2, *quad_p3, *quad_p4;
+
+ if( !PyArg_ParseTuple ( args, "O!O!O!O!O!",
+ &vector_Type, &pt_vec,
+ &vector_Type, &quad_p1,
+ &vector_Type, &quad_p2,
+ &vector_Type, &quad_p3,
+ &vector_Type, &quad_p4)
+ )
+ return ( EXPP_ReturnPyObjError
+ ( PyExc_TypeError, "expected 5 vector types\n" ) );
+
+ return PyInt_FromLong(IsectPQ2Df(pt_vec->vec, quad_p1->vec, quad_p2->vec, quad_p3->vec, quad_p4->vec));
}
-int boxPack_FromPyObject(PyObject * value, boxPack **boxarray )
+static int boxPack_FromPyObject(PyObject * value, boxPack **boxarray )
{
int len, i;
PyObject *list_item, *item_1, *item_2;
@@ -379,7 +393,7 @@ int boxPack_FromPyObject(PyObject * value, boxPack **boxarray )
return 0;
}
-void boxPack_ToPyObject(PyObject * value, boxPack **boxarray)
+static void boxPack_ToPyObject(PyObject * value, boxPack **boxarray)
{
int len, i;
PyObject *list_item;
@@ -399,7 +413,7 @@ void boxPack_ToPyObject(PyObject * value, boxPack **boxarray)
static PyObject *M_Geometry_BoxPack2D( PyObject * self, PyObject * boxlist )
{
- boxPack *boxarray;
+ boxPack *boxarray = NULL;
float tot_width, tot_height;
int len;
int error;
diff --git a/source/blender/python/api2_2x/Group.c b/source/blender/python/api2_2x/Group.c
index 3152d3a973f..0998053e7e1 100644
--- a/source/blender/python/api2_2x/Group.c
+++ b/source/blender/python/api2_2x/Group.c
@@ -56,8 +56,8 @@
/* Python API function prototypes for the Blender module. */
/*****************************************************************************/
static PyObject *M_Group_New( PyObject * self, PyObject * args );
-PyObject *M_Group_Get( PyObject * self, PyObject * args );
-PyObject *M_Group_Unlink( PyObject * self, BPy_Group * pygrp );
+static PyObject *M_Group_Get( PyObject * self, PyObject * args );
+static PyObject *M_Group_Unlink( PyObject * self, BPy_Group * pygrp );
/* internal */
static PyObject *GroupObSeq_CreatePyObject( BPy_Group *self, GroupObject *iter );
@@ -405,7 +405,7 @@ PyObject *M_Group_New( PyObject * self, PyObject * args )
/* Function: M_Group_Get */
/* Python equivalent: Blender.Group.Get */
/*****************************************************************************/
-PyObject *M_Group_Get( PyObject * self, PyObject * args )
+static PyObject *M_Group_Get( PyObject * self, PyObject * args )
{
char *name = NULL;
Group *group_iter;
@@ -475,7 +475,7 @@ PyObject *M_Group_Get( PyObject * self, PyObject * args )
/* Function: M_Group_Unlink */
/* Python equivalent: Blender.Group.Unlink */
/*****************************************************************************/
-PyObject *M_Group_Unlink( PyObject * self, BPy_Group * pygrp )
+static PyObject *M_Group_Unlink( PyObject * self, BPy_Group * pygrp )
{
Group *group;
if( !BPy_Group_Check(pygrp) )
diff --git a/source/blender/python/api2_2x/IDProp.c b/source/blender/python/api2_2x/IDProp.c
index 4a51619aec4..07269e54c7c 100644
--- a/source/blender/python/api2_2x/IDProp.c
+++ b/source/blender/python/api2_2x/IDProp.c
@@ -154,7 +154,7 @@ PyObject *BPy_IDGroup_GetName(BPy_IDProperty *self, void *bleh)
return PyString_FromString(self->prop->name);
}
-int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *bleh)
+static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *bleh)
{
char *st;
if (!PyString_Check(value))
@@ -168,7 +168,7 @@ int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *bleh)
return 0;
}
-PyObject *BPy_IDGroup_GetType(BPy_IDProperty *self)
+static PyObject *BPy_IDGroup_GetType(BPy_IDProperty *self)
{
return PyInt_FromLong((long)self->prop->type);
}
@@ -181,7 +181,7 @@ static PyGetSetDef BPy_IDGroup_getseters[] = {
{NULL, NULL, NULL, NULL, NULL}
};
-int BPy_IDGroup_Map_Len(BPy_IDProperty *self)
+static int BPy_IDGroup_Map_Len(BPy_IDProperty *self)
{
if (self->prop->type != IDP_GROUP)
return EXPP_ReturnIntError( PyExc_TypeError,
@@ -190,7 +190,7 @@ int BPy_IDGroup_Map_Len(BPy_IDProperty *self)
return self->prop->len;
}
-PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
+static PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
{
IDProperty *loop;
char *st;
@@ -212,7 +212,7 @@ PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
}
/*returns NULL on success, error string on failure*/
-char *BPy_IDProperty_Map_ValidateAndCreate(char *name, IDProperty *group, PyObject *ob)
+static char *BPy_IDProperty_Map_ValidateAndCreate(char *name, IDProperty *group, PyObject *ob)
{
IDProperty *prop = NULL;
IDPropertyTemplate val = {0};
@@ -297,7 +297,7 @@ char *BPy_IDProperty_Map_ValidateAndCreate(char *name, IDProperty *group, PyObje
return NULL;
}
-int BPy_IDGroup_Map_SetItem(BPy_IDProperty *self, PyObject *key, PyObject *val)
+static int BPy_IDGroup_Map_SetItem(BPy_IDProperty *self, PyObject *key, PyObject *val)
{
char *err;
@@ -325,7 +325,7 @@ int BPy_IDGroup_Map_SetItem(BPy_IDProperty *self, PyObject *key, PyObject *val)
return 0;
}
-PyObject *BPy_IDGroup_SpawnIterator(BPy_IDProperty *self)
+static PyObject *BPy_IDGroup_SpawnIterator(BPy_IDProperty *self)
{
BPy_IDGroup_Iter *iter = PyObject_New(BPy_IDGroup_Iter, &IDGroup_Iter_Type);
@@ -339,7 +339,7 @@ PyObject *BPy_IDGroup_SpawnIterator(BPy_IDProperty *self)
return (PyObject*) iter;
}
-PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
+static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
{
switch (prop->type) {
case IDP_STRING:
@@ -401,7 +401,7 @@ PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
"eek!! a property exists with a bad type code!!!" );
}
-PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value)
+static PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value)
{
IDProperty *loop;
PyObject *pyform;
@@ -431,7 +431,7 @@ PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value)
"item not in group" );
}
-PyObject *BPy_IDGroup_IterItems(BPy_IDProperty *self)
+static PyObject *BPy_IDGroup_IterItems(BPy_IDProperty *self)
{
BPy_IDGroup_Iter *iter = PyObject_New(BPy_IDGroup_Iter, &IDGroup_Iter_Type);
@@ -446,7 +446,7 @@ PyObject *BPy_IDGroup_IterItems(BPy_IDProperty *self)
return (PyObject*) iter;
}
-PyObject *BPy_IDGroup_GetKeys(BPy_IDProperty *self)
+static PyObject *BPy_IDGroup_GetKeys(BPy_IDProperty *self)
{
PyObject *seq = PyList_New(self->prop->len);
IDProperty *loop;
@@ -481,7 +481,7 @@ PyObject *BPy_IDGroup_GetKeys(BPy_IDProperty *self)
return seq;
}
-PyObject *BPy_IDGroup_GetValues(BPy_IDProperty *self)
+static PyObject *BPy_IDGroup_GetValues(BPy_IDProperty *self)
{
PyObject *seq = PyList_New(self->prop->len);
IDProperty *loop;
@@ -517,7 +517,7 @@ PyObject *BPy_IDGroup_GetValues(BPy_IDProperty *self)
return seq;
}
-PyObject *BPy_IDGroup_HasKey(BPy_IDProperty *self, PyObject *value)
+static PyObject *BPy_IDGroup_HasKey(BPy_IDProperty *self, PyObject *value)
{
IDProperty *loop;
char *name = PyString_AsString(value);
@@ -533,7 +533,7 @@ PyObject *BPy_IDGroup_HasKey(BPy_IDProperty *self, PyObject *value)
Py_RETURN_FALSE;
}
-PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *vars)
+static PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *vars)
{
PyObject *pyob, *pkey, *pval;
Py_ssize_t i=0;
@@ -555,7 +555,7 @@ PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *vars)
Py_RETURN_NONE;
}
-PyObject *BPy_IDGroup_ConvertToPy(BPy_IDProperty *self)
+static PyObject *BPy_IDGroup_ConvertToPy(BPy_IDProperty *self)
{
return BPy_IDGroup_MapDataToPy(self->prop);
}
@@ -665,18 +665,18 @@ PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent)
/********Array Wrapper********/
-PyObject *IDArray_repr(BPy_IDArray *self)
+static PyObject *IDArray_repr(BPy_IDArray *self)
{
return PyString_FromString("(ID Array)");
}
-PyObject *BPy_IDArray_GetType(BPy_IDArray *self)
+static PyObject *BPy_IDArray_GetType(BPy_IDArray *self)
{
return PyInt_FromLong( (long)self->prop->subtype );
}
-PyObject *BPy_IDArray_GetLen(BPy_IDArray *self)
+static PyObject *BPy_IDArray_GetLen(BPy_IDArray *self)
{
return PyInt_FromLong( (long)self->prop->len );
}
@@ -693,12 +693,12 @@ static PyGetSetDef BPy_IDArray_getseters[] = {
{NULL, NULL, NULL, NULL, NULL},
};
-int BPy_IDArray_Len(BPy_IDArray *self)
+static int BPy_IDArray_Len(BPy_IDArray *self)
{
return self->prop->len;
}
-PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index)
+static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index)
{
if (index < 0 || index >= self->prop->len)
return EXPP_ReturnPyObjError( PyExc_IndexError,
@@ -719,7 +719,7 @@ PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index)
"invalid/corrupt array type!");
}
-int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *val)
+static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *val)
{
int i;
float f;
@@ -865,18 +865,18 @@ PyTypeObject IDArray_Type = {
/*********** ID Property Group iterator ********/
-PyObject *IDGroup_Iter_iterself(PyObject *self)
+static PyObject *IDGroup_Iter_iterself(PyObject *self)
{
Py_XINCREF(self);
return self;
}
-PyObject *IDGroup_Iter_repr(BPy_IDGroup_Iter *self)
+static PyObject *IDGroup_Iter_repr(BPy_IDGroup_Iter *self)
{
return PyString_FromString("(ID Property Group)");
}
-PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self)
+static PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self)
{
IDProperty *cur=NULL;
PyObject *tmpval;
diff --git a/source/blender/python/api2_2x/Ipo.c b/source/blender/python/api2_2x/Ipo.c
index 7c2e18bcdf6..e6c67534a36 100644
--- a/source/blender/python/api2_2x/Ipo.c
+++ b/source/blender/python/api2_2x/Ipo.c
@@ -1027,7 +1027,6 @@ static PyObject *Ipo_getCurveNames( BPy_Ipo * self )
{
namefunc lookup_name;
int size;
- PyObject *dict;
int *vals = NULL;
char name[32];
PyObject *attr = Py_None;
@@ -1131,7 +1130,6 @@ static PyObject *Ipo_getCurveNames( BPy_Ipo * self )
* with string as key and adrcode as value
*/
- dict = PyModule_GetDict( submodule );
attr = PyConstant_New();
while( size-- ) {
@@ -1148,7 +1146,7 @@ static PyObject *Ipo_getCurveNames( BPy_Ipo * self )
return attr;
}
-void generate_curveconsts( PyObject* module )
+static void generate_curveconsts( PyObject* module )
{
namefunc lookup_name = NULL;
int size = 0;
diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c
index d3bb6c8d158..ef19fab462a 100644
--- a/source/blender/python/api2_2x/Material.c
+++ b/source/blender/python/api2_2x/Material.c
@@ -699,7 +699,7 @@ static PyObject *Material_clearScriptLinks(BPy_Material *self, PyObject *args);
static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args );
static PyObject *Material_getColorband( BPy_Material * self, void * type);
-int Material_setColorband( BPy_Material * self, PyObject * value, void * type);
+static int Material_setColorband( BPy_Material * self, PyObject * value, void * type);
static PyObject *Material_copy( BPy_Material * self );
static PyObject *Material_freeNodes( BPy_Material * self );
@@ -2782,10 +2782,10 @@ int EXPP_Colorband_fromPyList( ColorBand **coba, PyObject * value )
for (i=0; i<5; i++) {
pyflt = PySequence_GetItem( colseq, i );
if (!PyNumber_Check(pyflt)) {
- return ( EXPP_ReturnIntError( PyExc_ValueError,
- "Colorband colors must be sequences of 5 floats" ) );
Py_DECREF ( pyflt );
Py_DECREF ( colseq );
+ return ( EXPP_ReturnIntError( PyExc_ValueError,
+ "Colorband colors must be sequences of 5 floats" ) );
}
Py_DECREF ( pyflt );
}
@@ -3038,7 +3038,7 @@ static PyObject *Material_getColorband( BPy_Material * self, void * type)
Py_RETURN_NONE;
}
-int Material_setColorband( BPy_Material * self, PyObject * value, void * type)
+static int Material_setColorband( BPy_Material * self, PyObject * value, void * type)
{
switch( (long)type ) {
case 0: /* these are backwards, but that how it works */
diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c
index 6471fb16e92..d513a8be4db 100644
--- a/source/blender/python/api2_2x/Mesh.c
+++ b/source/blender/python/api2_2x/Mesh.c
@@ -160,7 +160,7 @@ typedef struct FaceEdges {
* compare edges by vertex indices
*/
-int medge_comp( const void *va, const void *vb )
+static int medge_comp( const void *va, const void *vb )
{
const unsigned int *a = ((SrchEdges *)va)->v;
const unsigned int *b = ((SrchEdges *)vb)->v;
@@ -180,7 +180,7 @@ int medge_comp( const void *va, const void *vb )
* compare edges by insert list indices
*/
-int medge_index_comp( const void *va, const void *vb )
+static int medge_index_comp( const void *va, const void *vb )
{
const SrchEdges *a = (SrchEdges *)va;
const SrchEdges *b = (SrchEdges *)vb;
@@ -196,7 +196,7 @@ int medge_index_comp( const void *va, const void *vb )
* compare faces by vertex indices
*/
-int mface_comp( const void *va, const void *vb )
+static int mface_comp( const void *va, const void *vb )
{
const SrchFaces *a = va;
const SrchFaces *b = vb;
@@ -231,7 +231,7 @@ int mface_comp( const void *va, const void *vb )
* compare faces by insert list indices
*/
-int mface_index_comp( const void *va, const void *vb )
+static int mface_index_comp( const void *va, const void *vb )
{
const SrchFaces *a = va;
const SrchFaces *b = vb;
@@ -248,7 +248,7 @@ int mface_index_comp( const void *va, const void *vb )
* compare edges by vertex indices
*/
-int faceedge_comp( const void *va, const void *vb )
+static int faceedge_comp( const void *va, const void *vb )
{
const unsigned int *a = ((FaceEdges *)va)->v;
const unsigned int *b = ((FaceEdges *)vb)->v;
diff --git a/source/blender/python/api2_2x/NLA.c b/source/blender/python/api2_2x/NLA.c
index cc477c7b5cf..18eef7c1a2f 100644
--- a/source/blender/python/api2_2x/NLA.c
+++ b/source/blender/python/api2_2x/NLA.c
@@ -1438,7 +1438,11 @@ static PyObject *ActionStrips_append( BPy_ActionStrips *self, PyObject * args )
strip->flag = ACTSTRIP_LOCK_ACTION;
find_stridechannel(ob, strip);
+ if(ob->nlastrips.first == NULL)
+ ob->nlaflag |= OB_NLA_OVERRIDE;
+
strip->repeat = 1.0;
+ strip->scale = 1.0;
act->id.us++;
BLI_addtail(&ob->nlastrips, strip);
diff --git a/source/blender/python/api2_2x/NMesh.c b/source/blender/python/api2_2x/NMesh.c
index e7ed89573fb..28407f174da 100644
--- a/source/blender/python/api2_2x/NMesh.c
+++ b/source/blender/python/api2_2x/NMesh.c
@@ -88,9 +88,6 @@ extern void countall(void);
#define NMESH_SUBDIV_MIN 0
#define NMESH_SUBDIV_MAX 6
-/* Globals */
-static PyObject *g_nmeshmodule = NULL;
-
static int unlink_existingMeshData( Mesh * mesh );
static int convert_NMeshToMesh( Mesh *mesh, BPy_NMesh *nmesh );
static void check_dverts(Mesh *me, int old_totverts);
@@ -3321,7 +3318,6 @@ PyObject *NMesh_Init( void )
if( EdgeFlags )
PyModule_AddObject( submodule, "EdgeFlags", EdgeFlags );
- g_nmeshmodule = submodule;
return submodule;
}
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c
index 1e5445cbd80..4495dc6c655 100644
--- a/source/blender/python/api2_2x/Object.c
+++ b/source/blender/python/api2_2x/Object.c
@@ -1698,11 +1698,9 @@ static PyObject *Object_getBoundBox( BPy_Object * self, PyObject *args )
"This object isn't linked to any object data (mesh, curve, etc) yet" );
if( !self->object->bb ) { /* if no ob bbox, we look in obdata */
- Mesh *me;
Curve *curve;
switch ( self->object->type ) {
case OB_MESH:
- me = self->object->data;
vec = (float*) mesh_get_bb(self->object)->vec;
break;
case OB_CURVE:
@@ -3150,7 +3148,6 @@ static PyObject *Object_copyAllPropertiesTo( BPy_Object * self,
PyObject *dest;
Object *dest_ob;
bProperty *prop = NULL;
- bProperty *propn = NULL;
if( !PyArg_ParseTuple( args, "O!", &Object_Type, &dest ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c
index 662656663c1..8a2be2391a4 100644
--- a/source/blender/python/api2_2x/Scene.c
+++ b/source/blender/python/api2_2x/Scene.c
@@ -591,7 +591,7 @@ PyObject *Scene_CreatePyObject( Scene * scene )
}
/*-----------------------FromPyObject-----------------------------------*/
-Scene *Scene_FromPyObject( PyObject * pyobj )
+static Scene *Scene_FromPyObject( PyObject * pyobj )
{
return ( ( BPy_Scene * ) pyobj )->scene;
}
@@ -1221,7 +1221,7 @@ static PyObject *SceneObSeq_getObjects( BPy_SceneObSeq *self, void *mode)
return SceneObSeq_CreatePyObject(self->bpyscene, NULL, (int)((long)mode));
}
-int SceneObSeq_setObjects( BPy_SceneObSeq *self, PyObject *value, void *_mode_)
+static int SceneObSeq_setObjects( BPy_SceneObSeq *self, PyObject *value, void *_mode_)
{
/*
ONLY SUPPORTS scn.objects.selected and scn.objects.context
@@ -1642,7 +1642,7 @@ static PyObject *SceneObSeq_unlink( BPy_SceneObSeq * self, PyObject *args )
Py_RETURN_FALSE;
}
-PyObject *SceneObSeq_getActive(BPy_SceneObSeq *self)
+static PyObject *SceneObSeq_getActive(BPy_SceneObSeq *self)
{
Base *base;
SCENE_DEL_CHECK_PY(self->bpyscene);
@@ -1687,7 +1687,7 @@ static int SceneObSeq_setActive(BPy_SceneObSeq *self, PyObject *value)
return 0;
}
-PyObject *SceneObSeq_getCamera(BPy_SceneObSeq *self)
+static PyObject *SceneObSeq_getCamera(BPy_SceneObSeq *self)
{
SCENE_DEL_CHECK_PY(self->bpyscene);
diff --git a/source/blender/python/api2_2x/Sys.c b/source/blender/python/api2_2x/Sys.c
index baae2220143..16d879c3032 100644
--- a/source/blender/python/api2_2x/Sys.c
+++ b/source/blender/python/api2_2x/Sys.c
@@ -149,16 +149,12 @@ struct PyMethodDef M_sys_methods[] = {
/* Module Functions */
-static PyObject *g_sysmodule = NULL; /* pointer to Blender.sys module */
-
PyObject *sys_Init( void )
{
PyObject *submodule, *dict;
submodule = Py_InitModule3( "Blender.sys", M_sys_methods, M_sys_doc );
- g_sysmodule = submodule;
-
dict = PyModule_GetDict( submodule );
EXPP_dict_set_item_str( dict, "dirsep", PyString_FromString(DIRSEP_STR) );
diff --git a/source/blender/python/api2_2x/Window.c b/source/blender/python/api2_2x/Window.c
index 41a4e4e215f..a4c7802ff34 100644
--- a/source/blender/python/api2_2x/Window.c
+++ b/source/blender/python/api2_2x/Window.c
@@ -1209,7 +1209,7 @@ static PyObject *M_Window_QHandle( PyObject * self, PyObject * args )
if( sa ) {
BWinEvent evt;
- short do_redraw = 0, do_change = 0;
+ short do_redraw = 0;
if( sa != curarea || sa->win != mywinget( ) ) {
oldsa = curarea;
@@ -1221,7 +1221,6 @@ static PyObject *M_Window_QHandle( PyObject * self, PyObject * args )
do_redraw = 1;
} else if( evt.event == CHANGED ) {
sa->win_swap = 0;
- do_change = 1;
do_redraw = 1;
} else {
scrarea_do_winhandle( sa, &evt );
diff --git a/source/blender/python/api2_2x/bpy_data.c b/source/blender/python/api2_2x/bpy_data.c
index 47232c6707a..d3499a79874 100644
--- a/source/blender/python/api2_2x/bpy_data.c
+++ b/source/blender/python/api2_2x/bpy_data.c
@@ -243,7 +243,7 @@ static PyObject *LibBlockSeq_nextIter( BPy_LibBlockSeq * self )
return object;
}
-PyObject *LibBlockSeq_getActive(BPy_LibBlockSeq *self)
+static PyObject *LibBlockSeq_getActive(BPy_LibBlockSeq *self)
{
switch (self->type) {
case ID_SCE:
@@ -382,7 +382,7 @@ static int LibBlockSeq_setTag(BPy_LibBlockSeq *self, PyObject *value)
/* New Data, internal functions */
-Mesh *add_mesh__internal(char *name)
+static Mesh *add_mesh__internal(char *name)
{
Mesh *mesh = add_mesh(name); /* doesn't return NULL now, but might someday */
@@ -453,8 +453,7 @@ PyObject *LibBlockSeq_new(BPy_LibBlockSeq *self, PyObject * args, PyObject *kwd)
return EXPP_ReturnPyObjError( PyExc_IOError,
"couldn't create pyobject on load, unknown error" );
if (name) {
- ID *id = ((BPy_GenericLib *)ret)->id;
- rename_id( id, name );
+ rename_id( ((BPy_GenericLib *)ret)->id, name );
}
return ret;
}
@@ -599,7 +598,7 @@ PyObject *LibBlockSeq_new(BPy_LibBlockSeq *self, PyObject * args, PyObject *kwd)
}
-PyObject *LibBlockSeq_unlink(BPy_LibBlockSeq *self, PyObject * value)
+static PyObject *LibBlockSeq_unlink(BPy_LibBlockSeq *self, PyObject * value)
{
switch (self->type) {
case ID_SCE:
@@ -790,15 +789,12 @@ PyTypeObject LibBlockSeq_Type = {
PyObject * Data_Init( void )
{
PyObject *module;
- PyObject *dict;
-
PyType_Ready( &LibBlockSeq_Type );
PyType_Ready( &Config_Type );
/*submodule = Py_InitModule3( "Blender.Main", NULL, M_Main_doc );*/
module = Py_InitModule3( "bpy.data", NULL, "The bpy.data submodule" );
- dict = PyModule_GetDict( module );
/* Python Data Types */
PyModule_AddObject( module, "scenes", LibBlockSeq_CreatePyObject(NULL, ID_SCE) );
diff --git a/source/blender/python/api2_2x/constant.c b/source/blender/python/api2_2x/constant.c
index 7cf6a83e602..2bf1d189961 100644
--- a/source/blender/python/api2_2x/constant.c
+++ b/source/blender/python/api2_2x/constant.c
@@ -37,19 +37,19 @@ PyTypeObject constant_Type;
//------------------METHOD IMPLEMENTATIONS-----------------------------
//------------------------constant.items()
//Returns a list of key:value pairs like dict.items()
-PyObject* constant_items(BPy_constant *self)
+static PyObject* constant_items(BPy_constant *self)
{
return PyDict_Items(self->dict);
}
//------------------------constant.keys()
//Returns a list of keys like dict.keys()
-PyObject* constant_keys(BPy_constant *self)
+static PyObject* constant_keys(BPy_constant *self)
{
return PyDict_Keys(self->dict);
}
//------------------------constant.values()
//Returns a list of values like dict.values()
-PyObject* constant_values(BPy_constant *self)
+static PyObject* constant_values(BPy_constant *self)
{
return PyDict_Values(self->dict);
}
diff --git a/source/blender/python/api2_2x/doc/Geometry.py b/source/blender/python/api2_2x/doc/Geometry.py
index f882f4b3b57..5d507956cdb 100644
--- a/source/blender/python/api2_2x/doc/Geometry.py
+++ b/source/blender/python/api2_2x/doc/Geometry.py
@@ -59,8 +59,16 @@ def PointInTriangle2D(pt, tri_pt1, tri_pt2, tri_pt3):
"""
Takes 4 vectors (one for the test point and 3 for the triangle)
This is a 2d function so only X and Y are used, Z and W will be ignored.
- @rtype: bool
- @return: True or False depending on the points intersection.
+ @rtype: int
+ @return: 1 for a clockwise intersection, -1 for counter clockwise intersection, 0 when there is no intersection.
+ """
+
+def PointInQuad2D(pt, quad_pt1, quad_pt2, quad_pt3):
+ """
+ Takes 5 vectors (one for the test point and 5 for the quad)
+ This is a 2d function so only X and Y are used, Z and W will be ignored.
+ @rtype: int
+ @return: 1 for a clockwise intersection, -1 for counter clockwise intersection, 0 when there is no intersection.
"""
def BoxPack2D(boxlist):
diff --git a/source/blender/python/api2_2x/matrix.c b/source/blender/python/api2_2x/matrix.c
index 9f5e49e8d88..79ca5e09b25 100644
--- a/source/blender/python/api2_2x/matrix.c
+++ b/source/blender/python/api2_2x/matrix.c
@@ -774,7 +774,7 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
return EXPP_ReturnPyObjError(PyExc_TypeError,
"Matrix multiplication: arguments not acceptable for this operation\n");
}
-PyObject* Matrix_inv(MatrixObject *self)
+static PyObject* Matrix_inv(MatrixObject *self)
{
return Matrix_Invert(self);
}
diff --git a/source/blender/python/api2_2x/sceneRender.c b/source/blender/python/api2_2x/sceneRender.c
index 7f88acd3a87..8e815b95ddf 100644
--- a/source/blender/python/api2_2x/sceneRender.c
+++ b/source/blender/python/api2_2x/sceneRender.c
@@ -397,13 +397,13 @@ static PyObject *M_Render_getInt( BPy_RenderData *self, int var )
/* Render Module Function Definitions */
/***************************************************************************/
-PyObject *M_Render_CloseRenderWindow( PyObject * self )
+static PyObject *M_Render_CloseRenderWindow( PyObject * self )
{
BIF_close_render_display( );
Py_RETURN_NONE;
}
-PyObject *M_Render_SetRenderWinPos( PyObject * self, PyObject * args )
+static PyObject *M_Render_SetRenderWinPos( PyObject * self, PyObject * args )
{
PyObject *list = NULL;
char *loc = NULL;
@@ -446,7 +446,7 @@ PyObject *M_Render_SetRenderWinPos( PyObject * self, PyObject * args )
Py_RETURN_NONE;
}
-PyObject *M_Render_EnableDispView( PyObject * self )
+static PyObject *M_Render_EnableDispView( PyObject * self )
{
G.displaymode = R_DISPLAYIMAGE;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
@@ -454,7 +454,7 @@ PyObject *M_Render_EnableDispView( PyObject * self )
Py_RETURN_NONE;
}
-PyObject *M_Render_EnableDispWin( PyObject * self )
+static PyObject *M_Render_EnableDispWin( PyObject * self )
{
G.displaymode = R_DISPLAYWIN;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
@@ -467,7 +467,7 @@ PyObject *M_Render_EnableDispWin( PyObject * self )
/* BPy_RenderData Function Definitions */
/***************************************************************************/
-PyObject *RenderData_Render( BPy_RenderData * self )
+static PyObject *RenderData_Render( BPy_RenderData * self )
{
Scene *oldsce;
/* unlock to prevent a deadlock when there are pynodes: */
@@ -511,7 +511,7 @@ PyObject *RenderData_Render( BPy_RenderData * self )
/* BPy_Bake Function Definitions */
/***************************************************************************/
-PyObject *RenderData_Bake( BPy_RenderData * self )
+static PyObject *RenderData_Bake( BPy_RenderData * self )
{
char *error_msg = NULL;
Scene *oldsce;
@@ -532,7 +532,7 @@ PyObject *RenderData_Bake( BPy_RenderData * self )
/*
* This will save the rendered image to an output file path already defined.
*/
-PyObject *RenderData_SaveRenderedImage ( BPy_RenderData * self, PyObject *args )
+static PyObject *RenderData_SaveRenderedImage ( BPy_RenderData * self, PyObject *args )
{
char dir[FILE_MAXDIR * 2], str[FILE_MAXFILE * 2];
char *name_str, filepath[FILE_MAXDIR+FILE_MAXFILE];
@@ -571,7 +571,7 @@ PyObject *RenderData_SaveRenderedImage ( BPy_RenderData * self, PyObject *args )
Py_RETURN_NONE;
}
-PyObject *RenderData_RenderAnim( BPy_RenderData * self )
+static PyObject *RenderData_RenderAnim( BPy_RenderData * self )
{
Scene *oldsce;
/* unlock to prevent a deadlock when there are pynodes: */
@@ -609,7 +609,7 @@ PyObject *RenderData_RenderAnim( BPy_RenderData * self )
Py_RETURN_NONE;
}
-PyObject *RenderData_Play( BPy_RenderData * self )
+static PyObject *RenderData_Play( BPy_RenderData * self )
{
char file[FILE_MAXDIR + FILE_MAXFILE];
extern char bprogname[];
@@ -668,46 +668,46 @@ PyObject *RenderData_Play( BPy_RenderData * self )
Py_RETURN_NONE;
}
-PyObject *RenderData_EnableBackbuf( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_EnableBackbuf( BPy_RenderData * self, PyObject * args )
{
return M_Render_BitToggleShort( args, 1,
&self->renderContext->bufflag );
}
-PyObject *RenderData_EnableExtensions( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_EnableExtensions( BPy_RenderData * self, PyObject * args )
{
return M_Render_BitToggleInt( args, R_EXTENSION,
&self->renderContext->scemode );
}
-PyObject *RenderData_EnableSequencer( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_EnableSequencer( BPy_RenderData * self, PyObject * args )
{
return M_Render_BitToggleInt( args, R_DOSEQ,
&self->renderContext->scemode );
}
-PyObject *RenderData_EnableRenderDaemon( BPy_RenderData * self,
+static PyObject *RenderData_EnableRenderDaemon( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_BG_RENDER,
&self->renderContext->scemode );
}
-PyObject *RenderData_EnableToonShading( BPy_RenderData * self,
+static PyObject *RenderData_EnableToonShading( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_EDGE,
&self->renderContext->mode );
}
-PyObject *RenderData_EdgeIntensity( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_EdgeIntensity( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeShort( args,
&self->renderContext->edgeint, 0,
255 );
}
-PyObject *RenderData_SetEdgeColor( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_SetEdgeColor( BPy_RenderData * self, PyObject * args )
{
float red, green, blue;
@@ -732,7 +732,7 @@ PyObject *RenderData_SetEdgeColor( BPy_RenderData * self, PyObject * args )
Py_RETURN_NONE;
}
-PyObject *RenderData_GetEdgeColor( BPy_RenderData * self )
+static PyObject *RenderData_GetEdgeColor( BPy_RenderData * self )
{
char rgb[24];
@@ -741,7 +741,7 @@ PyObject *RenderData_GetEdgeColor( BPy_RenderData * self )
return PyString_FromString( rgb );
}
-PyObject *RenderData_EnableOversampling( BPy_RenderData * self,
+static PyObject *RenderData_EnableOversampling( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_OSA,
@@ -768,34 +768,34 @@ static int RenderData_setOSALevel( BPy_RenderData * self,
return 0;
}
-PyObject *RenderData_EnableMotionBlur( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_EnableMotionBlur( BPy_RenderData * self, PyObject * args )
{
return M_Render_BitToggleInt( args, R_MBLUR,
&self->renderContext->mode );
}
-PyObject *RenderData_MotionBlurLevel( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_MotionBlurLevel( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeFloat( args,
&self->renderContext->blurfac,
0.01f, 5.0f );
}
-PyObject *RenderData_PartsX( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_PartsX( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeShort( args,
&self->renderContext->xparts, 1,
512 );
}
-PyObject *RenderData_PartsY( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_PartsY( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeShort( args,
&self->renderContext->yparts, 1,
64 );
}
-PyObject *RenderData_EnableSky( BPy_RenderData * self )
+static PyObject *RenderData_EnableSky( BPy_RenderData * self )
{
self->renderContext->alphamode = R_ADDSKY;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
@@ -803,7 +803,7 @@ PyObject *RenderData_EnableSky( BPy_RenderData * self )
Py_RETURN_NONE;
}
-PyObject *RenderData_EnablePremultiply( BPy_RenderData * self )
+static PyObject *RenderData_EnablePremultiply( BPy_RenderData * self )
{
self->renderContext->alphamode = R_ALPHAPREMUL;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
@@ -811,7 +811,7 @@ PyObject *RenderData_EnablePremultiply( BPy_RenderData * self )
Py_RETURN_NONE;
}
-PyObject *RenderData_EnableKey( BPy_RenderData * self )
+static PyObject *RenderData_EnableKey( BPy_RenderData * self )
{
self->renderContext->alphamode = R_ALPHAKEY;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
@@ -819,59 +819,59 @@ PyObject *RenderData_EnableKey( BPy_RenderData * self )
Py_RETURN_NONE;
}
-PyObject *RenderData_EnableShadow( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_EnableShadow( BPy_RenderData * self, PyObject * args )
{
return M_Render_BitToggleInt( args, R_SHADOW,
&self->renderContext->mode );
}
-PyObject *RenderData_EnableEnvironmentMap( BPy_RenderData * self,
+static PyObject *RenderData_EnableEnvironmentMap( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_ENVMAP,
&self->renderContext->mode );
}
-PyObject *RenderData_EnablePanorama( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_EnablePanorama( BPy_RenderData * self, PyObject * args )
{
return M_Render_BitToggleInt( args, R_PANORAMA,
&self->renderContext->mode );
}
-PyObject *RenderData_EnableRayTracing( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_EnableRayTracing( BPy_RenderData * self, PyObject * args )
{
return M_Render_BitToggleInt( args, R_RAYTRACE,
&self->renderContext->mode );
}
-PyObject *RenderData_EnableRadiosityRender( BPy_RenderData * self,
+static PyObject *RenderData_EnableRadiosityRender( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_RADIO,
&self->renderContext->mode );
}
-PyObject *RenderData_EnableFieldRendering( BPy_RenderData * self,
+static PyObject *RenderData_EnableFieldRendering( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_FIELDS,
&self->renderContext->mode );
}
-PyObject *RenderData_EnableOddFieldFirst( BPy_RenderData * self,
+static PyObject *RenderData_EnableOddFieldFirst( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_ODDFIELD,
&self->renderContext->mode );
}
-PyObject *RenderData_EnableFieldTimeDisable( BPy_RenderData * self,
+static PyObject *RenderData_EnableFieldTimeDisable( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_FIELDSTILL,
&self->renderContext->mode );
}
-PyObject *RenderData_EnableGaussFilter( BPy_RenderData * self,
+static PyObject *RenderData_EnableGaussFilter( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_GAUSS,
@@ -882,7 +882,7 @@ PyObject *RenderData_EnableGaussFilter( BPy_RenderData * self,
/* choices are listed in DNA_scene_types.h (search filtertype) */
}
-PyObject *RenderData_EnableBorderRender( BPy_RenderData * self,
+static PyObject *RenderData_EnableBorderRender( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_BORDER,
@@ -924,57 +924,57 @@ static PyObject *RenderData_getBorder( BPy_RenderData * self )
self->renderContext->border.ymax );
}
-PyObject *RenderData_EnableGammaCorrection( BPy_RenderData * self,
+static PyObject *RenderData_EnableGammaCorrection( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_GAMMA,
&self->renderContext->mode );
}
-PyObject *RenderData_GaussFilterSize( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_GaussFilterSize( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeFloat( args,
&self->renderContext->gauss,
0.5f, 1.5f );
}
-PyObject *RenderData_AspectRatioX( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_AspectRatioX( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeFloat( args, &self->renderContext->xasp,
1.0f, 200.0f );
}
-PyObject *RenderData_AspectRatioY( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_AspectRatioY( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeFloat( args, &self->renderContext->yasp,
1.0f, 200.0f );
}
-PyObject *RenderData_StartFrame( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_StartFrame( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeInt( args, &self->renderContext->sfra,
1, MAXFRAME );
}
-PyObject *RenderData_CurrentFrame( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_CurrentFrame( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeInt( args, &self->renderContext->cfra,
1, MAXFRAME );
}
-PyObject *RenderData_EndFrame( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_EndFrame( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeInt( args, &self->renderContext->efra,
1, MAXFRAME );
}
-PyObject *RenderData_ImageSizeX( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_ImageSizeX( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeShort( args, &self->renderContext->xsch,
4, 10000 );
}
-PyObject *RenderData_ImageSizeY( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_ImageSizeY( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeShort( args, &self->renderContext->ysch,
4, 10000 );
@@ -1001,7 +1001,7 @@ static int RenderData_setRenderer( BPy_RenderData * self, PyObject * value )
return 0;
}
-PyObject *RenderData_EnableCropping( void )
+static PyObject *RenderData_EnableCropping( void )
{
/* return M_Render_BitToggleInt( args, R_MOVIECROP,
&self->renderContext->mode );
@@ -1067,21 +1067,21 @@ static int RenderData_setImageType( BPy_RenderData *self, PyObject *value )
return 0;
}
-PyObject *RenderData_Quality( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_Quality( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeShort( args,
&self->renderContext->quality,
10, 100 );
}
-PyObject *RenderData_FramesPerSec( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_FramesPerSec( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeShort( args,
&self->renderContext->frs_sec, 1,
120 );
}
-PyObject *RenderData_EnableGrayscale( BPy_RenderData * self )
+static PyObject *RenderData_EnableGrayscale( BPy_RenderData * self )
{
self->renderContext->planes = R_PLANESBW;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
@@ -1089,7 +1089,7 @@ PyObject *RenderData_EnableGrayscale( BPy_RenderData * self )
Py_RETURN_NONE;
}
-PyObject *RenderData_EnableRGBColor( BPy_RenderData * self )
+static PyObject *RenderData_EnableRGBColor( BPy_RenderData * self )
{
self->renderContext->planes = R_PLANES24;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
@@ -1097,7 +1097,7 @@ PyObject *RenderData_EnableRGBColor( BPy_RenderData * self )
Py_RETURN_NONE;
}
-PyObject *RenderData_EnableRGBAColor( BPy_RenderData * self )
+static PyObject *RenderData_EnableRGBAColor( BPy_RenderData * self )
{
self->renderContext->planes = R_PLANES32;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
@@ -1105,7 +1105,7 @@ PyObject *RenderData_EnableRGBAColor( BPy_RenderData * self )
Py_RETURN_NONE;
}
-PyObject *RenderData_SizePreset( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_SizePreset( BPy_RenderData * self, PyObject * args )
{
int type;
@@ -1489,7 +1489,7 @@ static PyObject *RenderData_getYafrayGITunePhotons( BPy_RenderData * self )
/* (die) end */
-PyObject *RenderData_YafrayGIPower( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_YafrayGIPower( BPy_RenderData * self, PyObject * args )
{
if( self->renderContext->GImethod > 0 ) {
return M_Render_GetSetAttributeFloat( args,
@@ -1501,7 +1501,7 @@ PyObject *RenderData_YafrayGIPower( BPy_RenderData * self, PyObject * args )
"YafrayGIMethod must be set to 'SKYDOME' or 'FULL'" ) );
}
-PyObject *RenderData_YafrayGIIndirPower( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_YafrayGIIndirPower( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeFloat( args,
&self->renderContext->
@@ -1509,7 +1509,7 @@ PyObject *RenderData_YafrayGIIndirPower( BPy_RenderData * self, PyObject * args
100.00f );
}
-PyObject *RenderData_YafrayGIDepth( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_YafrayGIDepth( BPy_RenderData * self, PyObject * args )
{
if( self->renderContext->GImethod == 2 ) {
return M_Render_GetSetAttributeInt( args,
@@ -1520,7 +1520,7 @@ PyObject *RenderData_YafrayGIDepth( BPy_RenderData * self, PyObject * args )
"YafrayGIMethod must be set to 'FULL'" ) );
}
-PyObject *RenderData_YafrayGICDepth( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_YafrayGICDepth( BPy_RenderData * self, PyObject * args )
{
if( self->renderContext->GImethod == 2 ) {
return M_Render_GetSetAttributeInt( args,
@@ -1531,7 +1531,7 @@ PyObject *RenderData_YafrayGICDepth( BPy_RenderData * self, PyObject * args )
"YafrayGIMethod must be set to 'FULL'" ) );
}
-PyObject *RenderData_EnableYafrayGICache( BPy_RenderData * self,
+static PyObject *RenderData_EnableYafrayGICache( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2 ) {
@@ -1543,7 +1543,7 @@ PyObject *RenderData_EnableYafrayGICache( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL'" ) );
}
-PyObject *RenderData_EnableYafrayGIPhotons( BPy_RenderData * self,
+static PyObject *RenderData_EnableYafrayGIPhotons( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2 ) {
@@ -1555,7 +1555,7 @@ PyObject *RenderData_EnableYafrayGIPhotons( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL'" ) );
}
-PyObject *RenderData_YafrayGIPhotonCount( BPy_RenderData * self,
+static PyObject *RenderData_YafrayGIPhotonCount( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2
@@ -1569,7 +1569,7 @@ PyObject *RenderData_YafrayGIPhotonCount( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled" ) );
}
-PyObject *RenderData_YafrayGIPhotonRadius( BPy_RenderData * self,
+static PyObject *RenderData_YafrayGIPhotonRadius( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2
@@ -1583,7 +1583,7 @@ PyObject *RenderData_YafrayGIPhotonRadius( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled" ) );
}
-PyObject *RenderData_YafrayGIPhotonMixCount( BPy_RenderData * self,
+static PyObject *RenderData_YafrayGIPhotonMixCount( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2
@@ -1596,7 +1596,7 @@ PyObject *RenderData_YafrayGIPhotonMixCount( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled" ) );
}
-PyObject *RenderData_EnableYafrayGITunePhotons( BPy_RenderData * self,
+static PyObject *RenderData_EnableYafrayGITunePhotons( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2
@@ -1609,7 +1609,7 @@ PyObject *RenderData_EnableYafrayGITunePhotons( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled" ) );
}
-PyObject *RenderData_YafrayGIShadowQuality( BPy_RenderData * self,
+static PyObject *RenderData_YafrayGIShadowQuality( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2
@@ -1623,7 +1623,7 @@ PyObject *RenderData_YafrayGIShadowQuality( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL' and GICache must be enabled" ) );
}
-PyObject *RenderData_YafrayGIPixelsPerSample( BPy_RenderData * self,
+static PyObject *RenderData_YafrayGIPixelsPerSample( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2
@@ -1636,7 +1636,7 @@ PyObject *RenderData_YafrayGIPixelsPerSample( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL' and GICache must be enabled" ) );
}
-PyObject *RenderData_YafrayGIRefinement( BPy_RenderData * self,
+static PyObject *RenderData_YafrayGIRefinement( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2
@@ -1650,53 +1650,53 @@ PyObject *RenderData_YafrayGIRefinement( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL' and GICache must be enabled" ) );
}
-PyObject *RenderData_YafrayRayBias( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_YafrayRayBias( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeFloat( args,
&self->renderContext->YF_raybias,
0.0f, 10.0f );
}
-PyObject *RenderData_YafrayRayDepth( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_YafrayRayDepth( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeInt( args,
&self->renderContext->YF_raydepth,
1, 80 );
}
-PyObject *RenderData_YafrayGamma( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_YafrayGamma( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeFloat( args,
&self->renderContext->YF_gamma,
0.001f, 5.0f );
}
-PyObject *RenderData_YafrayExposure( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_YafrayExposure( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeFloat( args,
&self->renderContext->
YF_exposure, 0.0f, 10.0f );
}
-PyObject *RenderData_EnableGameFrameStretch( BPy_RenderData * self )
+static PyObject *RenderData_EnableGameFrameStretch( BPy_RenderData * self )
{
self->scene->framing.type = SCE_GAMEFRAMING_SCALE;
Py_RETURN_NONE;
}
-PyObject *RenderData_EnableGameFrameExpose( BPy_RenderData * self )
+static PyObject *RenderData_EnableGameFrameExpose( BPy_RenderData * self )
{
self->scene->framing.type = SCE_GAMEFRAMING_EXTEND;
Py_RETURN_NONE;
}
-PyObject *RenderData_EnableGameFrameBars( BPy_RenderData * self )
+static PyObject *RenderData_EnableGameFrameBars( BPy_RenderData * self )
{
self->scene->framing.type = SCE_GAMEFRAMING_BARS;
Py_RETURN_NONE;
}
-PyObject *RenderData_SetGameFrameColor( BPy_RenderData * self,
+static PyObject *RenderData_SetGameFrameColor( BPy_RenderData * self,
PyObject * args )
{
float red = 0.0f;
@@ -1724,7 +1724,7 @@ PyObject *RenderData_SetGameFrameColor( BPy_RenderData * self,
Py_RETURN_NONE;
}
-PyObject *RenderData_GetGameFrameColor( BPy_RenderData * self )
+static PyObject *RenderData_GetGameFrameColor( BPy_RenderData * self )
{
char rgb[24];
@@ -1734,33 +1734,33 @@ PyObject *RenderData_GetGameFrameColor( BPy_RenderData * self )
}
#ifdef __sgi
-PyObject *RenderData_SGIMaxsize( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_SGIMaxsize( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeShort( args,
&self->renderContext->maximsize,
0, 500 );
}
-PyObject *RenderData_EnableSGICosmo( BPy_RenderData *self, PyObject *args )
+static PyObject *RenderData_EnableSGICosmo( BPy_RenderData *self, PyObject *args )
{
return M_Render_BitToggleInt( args, R_COSMO,
&self->renderContext->mode );
}
#else
-PyObject *RenderData_SGIMaxsize( void )
+static PyObject *RenderData_SGIMaxsize( void )
{
return EXPP_ReturnPyObjError( PyExc_StandardError,
"SGI is not defined on this machine" );
}
-PyObject *RenderData_EnableSGICosmo( void )
+static PyObject *RenderData_EnableSGICosmo( void )
{
return EXPP_ReturnPyObjError( PyExc_StandardError,
"SGI is not defined on this machine" );
}
#endif
-PyObject *RenderData_OldMapValue( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_OldMapValue( BPy_RenderData * self, PyObject * args )
{
PyObject *tmp = M_Render_GetSetAttributeInt(args,
&self->renderContext->framapto, 1, 900);
@@ -1769,7 +1769,7 @@ PyObject *RenderData_OldMapValue( BPy_RenderData * self, PyObject * args )
return tmp;
}
-PyObject *RenderData_NewMapValue( BPy_RenderData * self, PyObject * args )
+static PyObject *RenderData_NewMapValue( BPy_RenderData * self, PyObject * args )
{
PyObject *tmp = M_Render_GetSetAttributeInt(args,
&self->renderContext->images, 1, 900);
@@ -1801,7 +1801,7 @@ static PyObject *RenderData_getTimeCode( BPy_RenderData * self) {
/***************************************************************************/
/* Render layer functions */
/***************************************************************************/
-PyObject *RenderData_getRenderLayers(BPy_RenderData * self)
+static PyObject *RenderData_getRenderLayers(BPy_RenderData * self)
{
PyObject *list, *layer;
SceneRenderLayer *srl;
@@ -1816,7 +1816,7 @@ PyObject *RenderData_getRenderLayers(BPy_RenderData * self)
return list;
}
-PyObject *RenderData_removeRenderLayer(BPy_RenderData * self, BPy_RenderLayer *value)
+static PyObject *RenderData_removeRenderLayer(BPy_RenderData * self, BPy_RenderLayer *value)
{
int index;
if (!BPy_RenderLayer_Check(value))
@@ -1853,7 +1853,7 @@ PyObject *RenderData_removeRenderLayer(BPy_RenderData * self, BPy_RenderLayer *v
Py_RETURN_NONE;
}
-PyObject *RenderData_addRenderLayer(BPy_RenderData * self ) {
+static PyObject *RenderData_addRenderLayer(BPy_RenderData * self ) {
scene_add_render_layer(self->scene);
return RenderLayer_CreatePyObject( self->scene, self->renderContext->layers.last );
diff --git a/source/blender/python/api2_2x/sceneSequence.c b/source/blender/python/api2_2x/sceneSequence.c
index ddc4eb6aea8..c7daea19fe7 100644
--- a/source/blender/python/api2_2x/sceneSequence.c
+++ b/source/blender/python/api2_2x/sceneSequence.c
@@ -305,16 +305,16 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce)
} else if (BPy_Scene_Check(py_data)) {
/* scene */
- Scene *sce = ((BPy_Scene *)py_data)->scene;
+ Scene *sceseq = ((BPy_Scene *)py_data)->scene;
seq->type= SEQ_SCENE;
- seq->scene= sce;
+ seq->scene= sceseq;
/*seq->sfra= sce->r.sfra;*/
- seq->len= sce->r.efra - sce->r.sfra + 1;
+ seq->len= sceseq->r.efra - sceseq->r.sfra + 1;
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strncpy(seq->name + 2, sce->id.name + 2,
+ strncpy(seq->name + 2, sceseq->id.name + 2,
sizeof(seq->name) - 2);
strip->len= seq->len;
strip->us= 1;
diff --git a/source/blender/radiosity/intern/source/radfactors.c b/source/blender/radiosity/intern/source/radfactors.c
index 8c89e806034..ba4dbf1b793 100644
--- a/source/blender/radiosity/intern/source/radfactors.c
+++ b/source/blender/radiosity/intern/source/radfactors.c
@@ -53,9 +53,9 @@
#include "RE_render_ext.h" /* for `RE_zbufferall_radio and RE_zbufferall_radio */
/* locals */
-void rad_setmatrices(RadView *vw);
-void clearsubflagelem(RNode *rn);
-void setsubflagelem(RNode *rn);
+static void rad_setmatrices(RadView *vw);
+static void clearsubflagelem(RNode *rn);
+static void setsubflagelem(RNode *rn);
RadView hemitop, hemiside;
@@ -254,7 +254,7 @@ void rad_make_hocos(RadView *vw)
/* } */
}
-void rad_setmatrices(RadView *vw) /* for hemi's */
+static void rad_setmatrices(RadView *vw) /* for hemi's */
{
float up1[3], len, twist;
@@ -628,7 +628,7 @@ void minmaxradelemfilt(RNode *rn, float *min, float *max, float *errmin, float *
}
}
-void setsubflagelem(RNode *rn)
+static void setsubflagelem(RNode *rn)
{
if(rn->down1) {
@@ -640,7 +640,7 @@ void setsubflagelem(RNode *rn)
}
}
-void clearsubflagelem(RNode *rn)
+static void clearsubflagelem(RNode *rn)
{
if(rn->down1) {
diff --git a/source/blender/radiosity/intern/source/radnode.c b/source/blender/radiosity/intern/source/radnode.c
index 042fe6840fc..ae246476e6d 100644
--- a/source/blender/radiosity/intern/source/radnode.c
+++ b/source/blender/radiosity/intern/source/radnode.c
@@ -57,10 +57,10 @@
#endif
/* locals */
-void *malloc_fast(int size);
-void *calloc_fast(int size);
-void free_fast(void *poin, int siz);
-void deleteTriNodes(RNode *node);
+static void *malloc_fast(int size);
+static void *calloc_fast(int size);
+static void free_fast(void *poin, int siz);
+static void deleteTriNodes(RNode *node);
/* lower because of local type define */
/* void check_mallocgroup(MallocGroup *mg); */
@@ -122,7 +122,7 @@ void check_mallocgroup(MallocGroup *mg)
printf("fastmalloc: shouldnt be here\n");
}
-void *malloc_fast(int size)
+static void *malloc_fast(int size)
{
MallocGroup *mg;
void *retval;
@@ -156,7 +156,7 @@ void *malloc_fast(int size)
return mg->data;
}
-void *calloc_fast(int size)
+static void *calloc_fast(int size)
{
void *poin;
@@ -166,7 +166,7 @@ void *calloc_fast(int size)
return poin;
}
-void free_fast(void *poin, int size)
+static void free_fast(void *poin, int size)
{
MallocGroup *mg;
intptr_t val;
@@ -958,7 +958,7 @@ int comparelevel(RNode *node, RNode *nb, int level)
return 1;
}
-void deleteTriNodes(RNode *node) /* both children of node */
+static void deleteTriNodes(RNode *node) /* both children of node */
{
RNode *n1, *n2;
diff --git a/source/blender/radiosity/intern/source/radpreprocess.c b/source/blender/radiosity/intern/source/radpreprocess.c
index 07b933b6db9..694cb261b08 100644
--- a/source/blender/radiosity/intern/source/radpreprocess.c
+++ b/source/blender/radiosity/intern/source/radpreprocess.c
@@ -289,7 +289,7 @@ void setedgepointers()
MEM_freeN(esblock);
}
-int materialIndex(Material *ma)
+static int materialIndex(Material *ma)
{
int i = 0;
for(i=0;i< RG.totmat; i++)
diff --git a/source/blender/render/intern/include/pixelshading.h b/source/blender/render/intern/include/pixelshading.h
index 15d696df89d..c6b11b4af9a 100644
--- a/source/blender/render/intern/include/pixelshading.h
+++ b/source/blender/render/intern/include/pixelshading.h
@@ -56,7 +56,7 @@ int shadeHaloFloat(HaloRen *har,
void shadeSkyPixel(float *collector, float fx, float fy);
void shadeSkyView(float *colf, float *rco, float *view, float *dxyview);
void shadeAtmPixel(struct SunSky *sunsky, float *collector, float fx, float fy, float distance);
-
+void shadeSunView(float *colf, float *view);
/* ------------------------------------------------------------------------- */
#endif
diff --git a/source/blender/render/intern/include/sunsky.h b/source/blender/render/intern/include/sunsky.h
index c5e547097d2..f61338bcf27 100644
--- a/source/blender/render/intern/include/sunsky.h
+++ b/source/blender/render/intern/include/sunsky.h
@@ -33,7 +33,7 @@
typedef struct SunSky
{
- short effect_type, skyblendtype;
+ short effect_type, skyblendtype, sky_colorspace;
float turbidity;
float theta, phi;
@@ -54,6 +54,7 @@ typedef struct SunSky
float sun_size;
float backscattered_light;
float skyblendfac;
+ float sky_exposure;
float atm_HGg;
@@ -86,7 +87,7 @@ typedef struct SunSky
* */
void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_brightness,
float spread,float sun_brightness, float sun_size, float back_scatter,
- float skyblendfac, short skyblendtype);
+ float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace);
/**
* GetSkyXYZRadiance:
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 40e9a32d003..07b2a5d3c82 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -1731,10 +1731,10 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
/* get orco */
if(tpsys && (part->from==PART_FROM_PARTICLE || part->phystype==PART_PHYS_NO)){
tpa=tpsys->particles+pa->num;
- psys_particle_on_emitter(ob, psmd,tpart->from,tpa->num,pa->num_dmcache,tpa->fuv,tpa->foffset,co,nor,0,0,orco,0);
+ psys_particle_on_emitter(psmd,tpart->from,tpa->num,pa->num_dmcache,tpa->fuv,tpa->foffset,co,nor,0,0,orco,0);
}
else
- psys_particle_on_emitter(ob, psmd,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,nor,0,0,orco,0);
+ psys_particle_on_emitter(psmd,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,nor,0,0,orco,0);
num= pa->num_dmcache;
@@ -1808,13 +1808,13 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
/* get orco */
if(part->childtype == PART_CHILD_FACES) {
- psys_particle_on_emitter(ob, psmd,
+ psys_particle_on_emitter(psmd,
PART_FROM_FACE, cpa->num,DMCACHE_ISCHILD,
cpa->fuv,cpa->foffset,co,nor,0,0,orco,0);
}
else {
ParticleData *par = psys->particles + cpa->parent;
- psys_particle_on_emitter(ob, psmd, part->from,
+ psys_particle_on_emitter(psmd, part->from,
par->num,DMCACHE_ISCHILD,par->fuv,
par->foffset,co,nor,0,0,orco,0);
}
@@ -2471,7 +2471,8 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
VertRen *v1, *v2, *v3, *v4, *ver;
VlakRen *vlr, *vlr1, *vlr2, *vlr3;
Curve *cu= ob->data;
- float *data, n1[3], flen;
+ float *data, n1[3];
+ /*float flen; - as yet unused */
int u, v, orcoret= 0;
int p1, p2, p3, p4, a;
int sizeu, nsizeu, sizev, nsizev;
@@ -2543,7 +2544,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
vlr= RE_findOrAddVlak(obr, obr->totvlak++);
vlr->v1= v1; vlr->v2= v2; vlr->v3= v3; vlr->v4= v4;
- flen= CalcNormFloat4(vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co, n1);
+ /* flen= CalcNormFloat4(vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co, n1); - as yet unused */
VECCOPY(vlr->n, n1);
vlr->mat= matar[ dl->col];
@@ -3042,7 +3043,6 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
int need_orco=0, need_stress=0, need_nmap_tangent=0, need_tangent=0;
int a, a1, ok, vertofs;
int end, do_autosmooth=0, totvert = 0;
- int useFluidmeshNormals= 0; // NT fluidsim, use smoothed normals?
int use_original_normals= 0;
me= ob->data;
@@ -3558,7 +3558,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
InitSunSky(lar->sunsky, la->atm_turbidity, vec, la->horizon_brightness,
la->spread, la->sun_brightness, la->sun_size, la->backscattered_light,
- la->skyblendfac, la->skyblendtype);
+ la->skyblendfac, la->skyblendtype, la->sky_exposure, la->sky_colorspace);
InitAtmosphere(lar->sunsky, la->sun_intensity, 1.0, 1.0, la->atm_inscattering_factor, la->atm_extinction_factor,
la->atm_distance_factor);
@@ -4821,6 +4821,7 @@ void RE_Database_FromScene(Render *re, Scene *scene, int use_camera_view)
Mat4Ortho(re->scene->camera->obmat);
Mat4Invert(mat, re->scene->camera->obmat);
RE_SetView(re, mat);
+ re->scene->camera->recalc= OB_RECALC_OB; /* force correct matrix for scaled cameras */
}
init_render_world(re); /* do first, because of ambient. also requires re->osa set correct */
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index e9035f29b3c..40c0edb6e5f 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -257,7 +257,7 @@ void make_sample_tables(Render *re)
{
static int firsttime= 1;
SampleTables *st;
- float flweight[32], fmask[256];
+ float flweight[32];
float weight[32], totw, val, *fpx1, *fpx2, *fpy1, *fpy2, *m3, *m4;
int i, j, a;
@@ -300,11 +300,6 @@ void make_sample_tables(Render *re)
st->centLut[a]= -0.45+((float)a)/16.0;
}
- val= 1.0/((float)re->osa);
- for(a=0; a<256; a++) {
- fmask[a]= ((float)st->cmask[a])*val;
- }
-
/* calculate totw */
totw= 0.0;
for(j= -1; j<2; j++) {
diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c
index 15c57eb9362..d2d2cf3fb77 100644
--- a/source/blender/render/intern/source/occlusion.c
+++ b/source/blender/render/intern/source/occlusion.c
@@ -402,7 +402,7 @@ static int occ_find_bbox_axis(OcclusionTree *tree, int begin, int end, float *mi
return axis;
}
-void occ_node_from_face(OccFace *face, OccNode *node)
+static void occ_node_from_face(OccFace *face, OccNode *node)
{
float n[3];
@@ -1143,7 +1143,7 @@ static float occ_quad_form_factor(float *p, float *n, float *q0, float *q1, floa
return result;
}
-float occ_form_factor(OccFace *face, float *p, float *n)
+static float occ_form_factor(OccFace *face, float *p, float *n)
{
ObjectInstanceRen *obi;
VlakRen *vlr;
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 6bdd57612c7..1dfcbc6e45d 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -2613,6 +2613,8 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra, int tfra)
scene_update_for_newframe(scene, lay);
continue;
}
+ else
+ nfra+= tfra;
if (scene->r.mode & (R_NO_OVERWRITE | R_TOUCH) ) {
BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype);
@@ -2643,7 +2645,6 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra, int tfra)
break;
}
- nfra+= tfra;
}
}
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index 9551a7b3227..60723963af9 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -570,33 +570,37 @@ void shadeSkyView(float *colf, float *rco, float *view, float *dxyview)
}
/* shade sky according to sun lamps, all parameters are like shadeSkyView except sunsky*/
-void shadeSunView(struct SunSky *sunsky, float *colf, float *rco, float *view, float *dxyview)
+void shadeSunView(float *colf, float *view)
{
- float colorxyz[3];
- float scale;
+ GroupObject *go;
+ LampRen *lar;
+ float sview[3];
+ int do_init= 1;
+
+ for(go=R.lights.first; go; go= go->next) {
+ lar= go->lampren;
+ if(lar->type==LA_SUN && lar->sunsky && (lar->sunsky->effect_type & LA_SUN_EFFECT_SKY)){
+ float sun_collector[3];
+ float colorxyz[3];
- /**
- sunAngle = sqrt(sunsky->sunSolidAngle / M_PI);
-
- sunDir[0] = sunsky->toSun[0];
- sunDir[1] = sunsky->toSun[1];
- sunDir[2] = sunsky->toSun[2];
- */
+ if(do_init) {
+
+ VECCOPY(sview, view);
+ Normalize(sview);
+ MTC_Mat3MulVecfl(R.imat, sview);
+ if (sview[2] < 0.0)
+ sview[2] = 0.0;
+ Normalize(sview);
+ do_init= 0;
+ }
- Normalize(view);
- MTC_Mat3MulVecfl(R.imat, view);
- if (view[2] < 0.0)
- view[2] = 0.0;
- Normalize(view);
- GetSkyXYZRadiancef(sunsky, view, colorxyz);
- scale = MAX3(colorxyz[0], colorxyz[1], colorxyz[2]);
- colorxyz[0] /= scale;
- colorxyz[1] /= scale;
- colorxyz[2] /= scale;
-
- xyz_to_rgb(colorxyz[0], colorxyz[1], colorxyz[2], &colf[0], &colf[1], &colf[2], BLI_CS_SMPTE);
-
- ClipColor(colf);
+ GetSkyXYZRadiancef(lar->sunsky, sview, colorxyz);
+ xyz_to_rgb(colorxyz[0], colorxyz[1], colorxyz[2], &sun_collector[0], &sun_collector[1], &sun_collector[2],
+ lar->sunsky->sky_colorspace);
+
+ ramp_blend(lar->sunsky->skyblendtype, colf, colf+1, colf+2, lar->sunsky->skyblendfac, sun_collector);
+ }
+ }
}
@@ -605,8 +609,6 @@ void shadeSunView(struct SunSky *sunsky, float *colf, float *rco, float *view, f
*/
void shadeSkyPixel(float *collector, float fx, float fy)
{
- GroupObject *go;
- LampRen *lar;
float view[3], dxyview[2];
/*
@@ -654,19 +656,9 @@ void shadeSkyPixel(float *collector, float fx, float fy)
shadeSkyView(collector, NULL, view, dxyview);
collector[3] = 0.0f;
}
-
- for(go=R.lights.first; go; go= go->next) {
- lar= go->lampren;
- if(lar->type==LA_SUN && lar->sunsky && (lar->sunsky->effect_type & LA_SUN_EFFECT_SKY)){
- float sun_collector[3];
-
- calc_view_vector(view, fx, fy);
- Normalize(view);
-
- shadeSunView(lar->sunsky, sun_collector, NULL, view, NULL);
- ramp_blend(lar->sunsky->skyblendtype, collector, collector+1, collector+2, lar->sunsky->skyblendfac, sun_collector);
- }
- }
+
+ calc_view_vector(view, fx, fy);
+ shadeSunView(collector, view);
}
/* aerial perspective */
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index 5e06b298bdb..453e8ddcd48 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -398,6 +398,7 @@ static void ray_fadeout_endcolor(float *col, ShadeInput *origshi, ShadeInput *sh
Normalize(shi->view);
shadeSkyView(col, isec->start, shi->view, NULL);
+ shadeSunView(col, shi->view);
}
}
@@ -634,24 +635,27 @@ void init_jitter_plane(LampRen *lar)
/* at least 4, or max threads+1 tables */
if(BLENDER_MAX_THREADS < 4) x= 4;
else x= BLENDER_MAX_THREADS+1;
- fp= lar->jitter= MEM_mallocN(x*tot*2*sizeof(float), "lamp jitter tab");
+ fp= lar->jitter= MEM_callocN(x*tot*2*sizeof(float), "lamp jitter tab");
- /* set per-lamp fixed seed */
- BLI_srandom(tot);
-
- /* fill table with random locations, area_size large */
- for(x=0; x<tot; x++, fp+=2) {
- fp[0]= (BLI_frand()-0.5)*lar->area_size;
- fp[1]= (BLI_frand()-0.5)*lar->area_sizey;
- }
-
- while(iter--) {
- fp= lar->jitter;
- for(x=tot; x>0; x--, fp+=2) {
- DP_energy(lar->jitter, fp, tot, lar->area_size, lar->area_sizey);
+ /* if 1 sample, we leave table to be zero's */
+ if(tot>1) {
+
+ /* set per-lamp fixed seed */
+ BLI_srandom(tot);
+
+ /* fill table with random locations, area_size large */
+ for(x=0; x<tot; x++, fp+=2) {
+ fp[0]= (BLI_frand()-0.5)*lar->area_size;
+ fp[1]= (BLI_frand()-0.5)*lar->area_sizey;
}
- }
-
+
+ while(iter--) {
+ fp= lar->jitter;
+ for(x=tot; x>0; x--, fp+=2) {
+ DP_energy(lar->jitter, fp, tot, lar->area_size, lar->area_sizey);
+ }
+ }
+ }
/* create the dithered tables (could just check lamp type!) */
jitter_plane_offset(lar->jitter, lar->jitter+2*tot, tot, lar->area_size, lar->area_sizey, 0.5f, 0.0f);
jitter_plane_offset(lar->jitter, lar->jitter+4*tot, tot, lar->area_size, lar->area_sizey, 0.5f, 0.5f);
@@ -734,7 +738,7 @@ static void hammersley_create(double *out, int n)
}
}
-struct QMCSampler *QMC_initSampler(int type, int tot)
+static struct QMCSampler *QMC_initSampler(int type, int tot)
{
QMCSampler *qsa = MEM_callocN(sizeof(QMCSampler), "qmc sampler");
qsa->samp2d = MEM_callocN(2*sizeof(double)*tot, "qmc sample table");
@@ -883,7 +887,7 @@ void init_render_qmcsampler(Render *re)
re->qmcsamplers= MEM_callocN(sizeof(ListBase)*BLENDER_MAX_THREADS, "QMCListBase");
}
-QMCSampler *get_thread_qmcsampler(Render *re, int thread, int type, int tot)
+static QMCSampler *get_thread_qmcsampler(Render *re, int thread, int type, int tot)
{
QMCSampler *qsa;
@@ -904,7 +908,7 @@ QMCSampler *get_thread_qmcsampler(Render *re, int thread, int type, int tot)
return qsa;
}
-void release_thread_qmcsampler(Render *re, int thread, QMCSampler *qsa)
+static void release_thread_qmcsampler(Render *re, int thread, QMCSampler *qsa)
{
qsa->used= 0;
}
@@ -1174,7 +1178,6 @@ static void trace_reflect(float *col, ShadeInput *shi, ShadeResult *shr, float f
/* extern call from render loop */
void ray_trace(ShadeInput *shi, ShadeResult *shr)
{
- VlakRen *vlr;
float i, f, f1, fr, fg, fb;
float mircol[4], tracol[4];
float diff[3];
@@ -1182,7 +1185,7 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
do_tra= ((shi->mat->mode & (MA_RAYTRANSP)) && shr->alpha!=1.0f);
do_mir= ((shi->mat->mode & MA_RAYMIRROR) && shi->ray_mirror!=0.0f);
- vlr= shi->vlr;
+
/* raytrace mirror amd refract like to separate the spec color */
if(shi->combinedflag & SCE_PASS_SPEC)
@@ -1525,7 +1528,7 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys)
}
}
-void ray_ao_qmc(ShadeInput *shi, float *shadfac)
+static void ray_ao_qmc(ShadeInput *shi, float *shadfac)
{
Isect isec;
QMCSampler *qsa=NULL;
@@ -1536,7 +1539,6 @@ void ray_ao_qmc(ShadeInput *shi, float *shadfac)
float fac=0.0f, prev=0.0f;
float adapt_thresh = G.scene->world->ao_adapt_thresh;
float adapt_speed_fac = G.scene->world->ao_adapt_speed_fac;
- float bias = G.scene->world->aobias;
int samples=0;
int max_samples = R.wrld.aosamp*R.wrld.aosamp;
@@ -1564,13 +1566,10 @@ void ray_ao_qmc(ShadeInput *shi, float *shadfac)
dxyview[2]= 0.0f;
}
- /* bias prevents smoothed faces to appear flat */
if(shi->vlr->flag & R_SMOOTH) {
- bias= G.scene->world->aobias;
VECCOPY(nrm, shi->vn);
}
else {
- bias= 0.0f;
VECCOPY(nrm, shi->facenor);
}
@@ -1630,6 +1629,7 @@ void ray_ao_qmc(ShadeInput *shi, float *shadfac)
}
else { /* WO_AOSKYTEX */
shadeSkyView(skycol, isec.start, view, dxyview);
+ shadeSunView(skycol, shi->view);
shadfac[0]+= skycol[0];
shadfac[1]+= skycol[1];
shadfac[2]+= skycol[2];
@@ -1665,7 +1665,7 @@ void ray_ao_qmc(ShadeInput *shi, float *shadfac)
}
/* extern call from shade_lamp_loop, ambient occlusion calculus */
-void ray_ao_spheresamp(ShadeInput *shi, float *shadfac)
+static void ray_ao_spheresamp(ShadeInput *shi, float *shadfac)
{
Isect isec;
float *vec, *nrm, div, bias, sh=0.0f;
@@ -1754,6 +1754,7 @@ void ray_ao_spheresamp(ShadeInput *shi, float *shadfac)
}
else { /* WO_AOSKYTEX */
shadeSkyView(skycol, isec.start, view, dxyview);
+ shadeSunView(skycol, shi->view);
shadfac[0]+= skycol[0];
shadfac[1]+= skycol[1];
shadfac[2]+= skycol[2];
@@ -2121,7 +2122,7 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac)
}
/* only when face points away from lamp, in direction of lamp, trace ray and find first exit point */
-void ray_translucent(ShadeInput *shi, LampRen *lar, float *distfac, float *co)
+static void ray_translucent(ShadeInput *shi, LampRen *lar, float *distfac, float *co)
{
Isect isec;
float lampco[3], maxsize;
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index 7a2a9ef7b6e..6e64479b88c 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -1460,10 +1460,10 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr)
LampRen *lar;
GroupObject *go;
float inpr, lv[3];
- float *vn, *view, shadfac[4];
+ float *view, shadfac[4];
float ir, accum, visifac, lampdist;
- vn= shi->vn;
+
view= shi->view;
accum= ir= 0.0f;
diff --git a/source/blender/render/intern/source/sunsky.c b/source/blender/render/intern/source/sunsky.c
index e1c7933cea1..2b490e71142 100644
--- a/source/blender/render/intern/source/sunsky.c
+++ b/source/blender/render/intern/source/sunsky.c
@@ -22,7 +22,7 @@
#include "sunsky.h"
#include "math.h"
#include "BLI_arithb.h"
-
+#include "BKE_global.h"
/**
* These macros are defined for vector operations
@@ -111,15 +111,14 @@ static void DirectionToThetaPhi(float *toSun, float *theta, float *phi)
float PerezFunction(struct SunSky *sunsky, const float *lam, float theta, float gamma, float lvz)
{
float den, num;
-
+
den = ((1 + lam[0] * exp(lam[1])) *
- (1 + lam[2] * exp(lam[3] * sunsky->theta) + lam[4] * cos(sunsky->theta) * cos(sunsky->theta)));
-
+ (1 + lam[2] * exp(lam[3] * sunsky->theta) + lam[4] * cos(sunsky->theta) * cos(sunsky->theta)));
+
num = ((1 + lam[0] * exp(lam[1] / cos(theta))) *
- (1 + lam[2] * exp(lam[3] * gamma) + lam[4] * cos(gamma) * cos(gamma)));
-
- return(lvz * num / den);
-}
+ (1 + lam[2] * exp(lam[3] * gamma) + lam[4] * cos(gamma) * cos(gamma)));
+
+ return(lvz * num / den);}
/**
* InitSunSky:
@@ -136,7 +135,7 @@ float PerezFunction(struct SunSky *sunsky, const float *lam, float theta, float
* */
void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_brightness,
float spread,float sun_brightness, float sun_size, float back_scatter,
- float skyblendfac, short skyblendtype)
+ float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace)
{
float theta2;
@@ -154,6 +153,8 @@ void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_b
sunsky->backscattered_light = back_scatter;
sunsky->skyblendfac= skyblendfac;
sunsky->skyblendtype= skyblendtype;
+ sunsky->sky_exposure= -sky_exposure;
+ sunsky->sky_colorspace= sky_colorspace;
sunsky->toSun[0] = toSun[0];
sunsky->toSun[1] = toSun[1];
@@ -262,8 +263,11 @@ void GetSkyXYZRadiance(struct SunSky* sunsky, float theta, float phi, float colo
// Compute xyY values
x = PerezFunction(sunsky, sunsky->perez_x, theta, gamma, sunsky->zenith_x);
y = PerezFunction(sunsky, sunsky->perez_y, theta, gamma, sunsky->zenith_y);
- Y = nfade * hfade * PerezFunction(sunsky, sunsky->perez_Y, theta, gamma, sunsky->zenith_Y);
+ Y = 6.666666667e-5 * nfade * hfade * PerezFunction(sunsky, sunsky->perez_Y, theta, gamma, sunsky->zenith_Y);
+ if(sunsky->sky_exposure!=0.0f)
+ Y = 1.0 - exp(Y*sunsky->sky_exposure);
+
X = (x / y) * Y;
Z = ((1 - x - y) / y) * Y;
diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c
index 3df53f7041a..dfeb775aca6 100644
--- a/source/blender/render/intern/source/texture.c
+++ b/source/blender/render/intern/source/texture.c
@@ -1873,18 +1873,18 @@ void do_material_tex(ShadeInput *shi)
texres.nor[2]= texres.tb;
}
else {
- float co= 0.5*cos(texres.tin-0.5);
+ float co_nor= 0.5*cos(texres.tin-0.5);
float si= 0.5*sin(texres.tin-0.5);
float f1, f2;
f1= shi->vn[0];
f2= shi->vn[1];
- texres.nor[0]= f1*co+f2*si;
- texres.nor[1]= f2*co-f1*si;
+ texres.nor[0]= f1*co_nor+f2*si;
+ texres.nor[1]= f2*co_nor-f1*si;
f1= shi->vn[1];
f2= shi->vn[2];
- texres.nor[1]= f1*co+f2*si;
- texres.nor[2]= f2*co-f1*si;
+ texres.nor[1]= f1*co_nor+f2*si;
+ texres.nor[2]= f2*co_nor-f1*si;
}
}
// warping, local space
diff --git a/source/blender/src/CMakeLists.txt b/source/blender/src/CMakeLists.txt
index d95551940f8..e2757dbc75d 100644
--- a/source/blender/src/CMakeLists.txt
+++ b/source/blender/src/CMakeLists.txt
@@ -80,3 +80,6 @@ IF(WITH_VERSE)
ADD_DEPENDENCIES(src mkprot verse)
ENDIF(WITH_VERSE)
+IF(NOT WITH_ELBEEM)
+ ADD_DEFINITIONS(-DDISABLE_ELBEEM)
+ENDIF(NOT WITH_ELBEEM)
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c
index 44e0008576a..ef6f5a97cee 100644
--- a/source/blender/src/buttons_editing.c
+++ b/source/blender/src/buttons_editing.c
@@ -1852,6 +1852,13 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
height += 19;
} else if (md->type == eModifierType_Mask) {
height = 66;
+ } else if (md->type==eModifierType_SimpleDeform) {
+ SimpleDeformModifierData *smd = (SimpleDeformModifierData*) md;
+ height += 19*5;
+ if(smd->origin != NULL) height += 19;
+ if(smd->mode == MOD_SIMPLEDEFORM_MODE_STRETCH
+ || smd->mode == MOD_SIMPLEDEFORM_MODE_TAPER )
+ height += 19;
}
/* roundbox 4 free variables: corner-rounding, nop, roundbox type, shade */
uiDefBut(block, ROUNDBOX, 0, "", x-10, y-height-2, width, height-2, NULL, 5.0, 0.0, 12, 40, "");
@@ -2548,6 +2555,30 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
uiBlockEndAlign(block);
+ } else if (md->type==eModifierType_SimpleDeform) {
+ SimpleDeformModifierData *smd = (SimpleDeformModifierData*) md;
+ char simpledeform_modemenu[] = "Deform type%t|Twist %x1|Bend %x2|Taper %x3|Strech %x4";
+
+ uiDefButC(block, MENU, B_MODIFIER_RECALC, simpledeform_modemenu, lx,(cy-=19),buttonWidth,19, &smd->mode, 0, 0, 0, 0, "Selects type of deform to apply to object.");
+
+ but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &smd->vgroup_name, 0, 31, 0, 0, "Vertex Group name");
+ uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
+
+ uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &smd->origin, "Origin of modifier space coordinates");
+ if(smd->origin != NULL)
+ uiDefButBitC(block, TOG, MOD_SIMPLEDEFORM_ORIGIN_LOCAL, B_MODIFIER_RECALC, "Relative",lx,(cy-=19),buttonWidth,19, &smd->originOpts, 0, 0, 0, 0, "Sets the origin of deform space to be relative to the object");
+
+ uiDefButF(block, NUM, B_MODIFIER_RECALC, "Factor:", lx,(cy-=19),buttonWidth,19, &smd->factor, -10.0f, 10.0f, 0.5f, 0, "Deform Factor");
+
+ uiDefButF(block, NUM, B_MODIFIER_RECALC, "Upper Limit:", lx,(cy-=19),buttonWidth,19, &smd->limit[1], 0.0f, 1.0f, 5.0f, 0, "Upper Limit for deform");
+ uiDefButF(block, NUM, B_MODIFIER_RECALC, "Lower Limit:", lx,(cy-=19),buttonWidth,19, &smd->limit[0], 0.0f, 1.0f, 5.0f, 0, "Lower Limit for deform");
+
+ if(smd->mode == MOD_SIMPLEDEFORM_MODE_STRETCH
+ || smd->mode == MOD_SIMPLEDEFORM_MODE_TAPER )
+ {
+ uiDefButBitC(block, TOG, MOD_SIMPLEDEFORM_LOCK_AXIS_X, B_MODIFIER_RECALC, "Loc X", lx, (cy-=19),buttonWidth/2,19, &smd->axis, 0, 0, 0, 0, "Disallow changes on the X coordinate");
+ uiDefButBitC(block, TOG, MOD_SIMPLEDEFORM_LOCK_AXIS_Y, B_MODIFIER_RECALC, "Loc Y", lx+(buttonWidth/2), (cy),buttonWidth/2,19, &smd->axis, 0, 0, 0, 0, "Disallow changes on the Y coordinate");
+ }
}
uiBlockEndAlign(block);
@@ -3722,11 +3753,9 @@ static void editing_panel_camera_yafraydof(Object *ob, Camera *cam)
void do_cambuts(unsigned short event)
{
Object *ob;
- Camera *cam;
ob= OBACT;
if (ob==0) return;
- cam= ob->data;
switch(event) {
case 0:
diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c
index a6f4acb8c68..ba8116dbc5b 100644
--- a/source/blender/src/buttons_logic.c
+++ b/source/blender/src/buttons_logic.c
@@ -67,6 +67,7 @@
#include "BKE_property.h"
#include "BKE_property.h"
#include "BKE_utildefines.h"
+#include "BKE_bullet.h"
#include "BIF_gl.h"
#include "BIF_resources.h"
@@ -92,9 +93,9 @@
#include "interface.h"
/* internals */
-void buttons_enji(uiBlock *, Object *);
-void buttons_ketsji(uiBlock *, Object *);
-void buttons_bullet(uiBlock *, Object *);
+static void buttons_enji(uiBlock *, Object *);
+static void buttons_ketsji(uiBlock *, Object *);
+static void buttons_bullet(uiBlock *, Object *);
/****/
@@ -2162,6 +2163,8 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh
uiDefButS(block, NUM, 0, "damp", xco+10, yco-45, 70, 19, &coa->damp, 0.0, 100.0, 0, 0, "Damping factor: time constant (in frame) of low pass filter");
uiDefBut(block, LABEL, 0, "Range", xco+80, yco-45, (width-115)/2, 19, NULL, 0.0, 0.0, 0, 0, "Set the maximum length of ray");
uiDefButBitS(block, TOG, ACT_CONST_DISTANCE, B_REDR, "Dist", xco+80+(width-115)/2, yco-45, (width-115)/2, 19, &coa->flag, 0.0, 0.0, 0, 0, "Force distance of object to point of impact of ray");
+ uiDefButBitS(block, TOG, ACT_CONST_LOCAL, 0, "L", xco+80+(width-115), yco-45, 25, 19,
+ &coa->flag, 0.0, 0.0, 0, 0, "Set ray along object's axis or global axis");
if(coa->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= coa->minloc;
else if(coa->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= coa->minloc+1;
@@ -2171,7 +2174,7 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh
if (coa->flag & ACT_CONST_DISTANCE)
uiDefButF(block, NUM, 0, "", xco+80+(width-115)/2, yco-65, (width-115)/2, 19, fp, -2000.0, 2000.0, 10, 0, "Keep this distance to target");
uiDefButBitS(block, TOG, ACT_CONST_NORMAL, 0, "N", xco+80+(width-115), yco-65, 25, 19,
- &coa->flag, 0.0, 0.0, 0, 0, "Set object axis along the normal at hit position");
+ &coa->flag, 0.0, 0.0, 0, 0, "Set object axis along (local axis) or parallel (global axis) to the normal at hit position");
uiDefButBitS(block, TOG, ACT_CONST_MATERIAL, B_REDR, "M/P", xco+10, yco-84, 40, 19,
&coa->flag, 0.0, 0.0, 0, 0, "Detect material instead of property");
if (coa->flag & ACT_CONST_MATERIAL)
@@ -2809,7 +2812,7 @@ static uiBlock *actuator_menu(void *arg_unused)
}
-void buttons_enji(uiBlock *block, Object *ob)
+static void buttons_enji(uiBlock *block, Object *ob)
{
uiDefButBitI(block, TOG, OB_SECTOR, B_SETSECTOR, "Sector",
10,205,65,19, &ob->gameflag, 0, 0, 0, 0,
@@ -2854,7 +2857,7 @@ void buttons_enji(uiBlock *block, Object *ob)
}
-void buttons_ketsji(uiBlock *block, Object *ob)
+static void buttons_ketsji(uiBlock *block, Object *ob)
{
uiDefButBitI(block, TOG, OB_COLLISION, B_REDR, "Physics",
10,205,70,19, &ob->gameflag, 0, 0, 0, 0,
@@ -2929,6 +2932,10 @@ void buttons_ketsji(uiBlock *block, Object *ob)
&ob->gameflag, 0, 0,0, 0,
"Specify a collision shape bounds type");
if (ob->gameflag & OB_BOUNDS) {
+ /* assume triangle mesh, if no bounds chosen for soft body */
+
+
+
uiDefButS(block, MENU, REDRAWVIEW3D, "Collision Type%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull%x5|Concave TriangleMesh %x4",
85, 105, 160, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type");
uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 250,105,100,19,
@@ -2937,17 +2944,10 @@ void buttons_ketsji(uiBlock *block, Object *ob)
}
uiBlockEndAlign(block);
}
+ uiBlockEndAlign(block);
}
}
-static void check_actor(void *arg1_but, void *arg2_object)
-{
- int *gameflag = arg2_object;
- /* force enabled ACTOR for body >= dynamic */
- if (*gameflag & OB_DYNAMIC)
- *gameflag |= OB_ACTOR;
-}
-
static void check_body_type(void *arg1_but, void *arg2_object)
{
Object *ob = arg2_object;
@@ -2972,6 +2972,15 @@ static void check_body_type(void *arg1_but, void *arg2_object)
case OB_BODY_TYPE_SOFT:
ob->gameflag |= OB_COLLISION|OB_DYNAMIC|OB_SOFT_BODY|OB_ACTOR;
ob->gameflag &= ~(OB_RIGID_BODY);
+
+ /* assume triangle mesh, if no bounds chosen for soft body */
+ if ((ob->gameflag & OB_BOUNDS) && (ob->boundtype<OB_BOUND_POLYH))
+ {
+ ob->boundtype=OB_BOUND_POLYH;
+ }
+ /* create a BulletSoftBody structure if not already existing */
+ if (!ob->bsoft)
+ ob->bsoft = bsbNew();
break;
}
}
@@ -2982,67 +2991,113 @@ static uiBlock *advanced_bullet_menu(void *arg_ob)
Object *ob = arg_ob;
short yco = 105, xco = 0;
+ /* create a BulletSoftBody structure if not already existing */
+ if ((ob->body_type & OB_BODY_TYPE_SOFT) && !ob->bsoft)
+ ob->bsoft = bsbNew();
+
block= uiNewBlock(&curarea->uiblocks, "advanced_bullet_options", UI_EMBOSS, UI_HELV, curarea->win);
/* use this for a fake extra empy space around the buttons */
uiDefBut(block, LABEL, 0, "", -5, -10, 255, 140, NULL, 0, 0, 0, 0, "");
- uiDefButBitI(block, TOG, OB_ACTOR, 0, "Sensor actor",
- xco, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0,
- "Objects that are detected by the Near and Radar sensor");
-
- if (ob->gameflag & OB_DYNAMIC) {
- uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, 0, "No sleeping",
- xco+=120, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0,
- "Disable auto (de)activation");
- }
+ if (ob->gameflag & OB_SOFT_BODY) {
- yco -= 25;
- xco = 0;
- if (ob->gameflag & OB_DYNAMIC) {
- if (ob->margin < 0.001f)
- ob->margin = 0.06f;
- uiDefButF(block, NUM, 0, "Margin",
- xco, yco, 118, 19, &ob->margin, 0.001, 1.0, 1, 0,
- "Collision margin");
- } else {
- uiDefButF(block, NUM, 0, "Margin",
- xco, yco, 118, 19, &ob->margin, 0.0, 1.0, 1, 0,
- "Collision margin");
- }
- if (ob->gameflag & OB_SOFT_BODY) {
- if (ob->soft)
+ if (ob->bsoft)
{
+ xco = 0;
+ uiDefButF(block, NUMSLI, 0, "LinStiff", xco, yco, 238, 19,
+ &ob->bsoft->linStiff, 0.0, 1.0, 1, 0,
+ "Linear stiffness of the soft body links");
+ yco -= 25;
+ xco = 0;
+
+ uiDefButBitI(block, TOG, OB_BSB_SHAPE_MATCHING, 0, "Shape matching",
+ xco, yco, 118, 19, &ob->bsoft->flag, 0, 0, 0, 0,
+ "Enable soft body shape matching goal");
- uiDefButBitI(block, TOG, OB_SB_GOAL, 0, "Shape matching",
- xco+=120, yco, 118, 19, &ob->softflag, 0, 0, 0, 0,
- "Enable soft body shape matching goal");
+ uiDefButBitI(block, TOG, OB_BSB_BENDING_CONSTRAINTS, 0, "Bending Constraints",
+ xco+=120, yco, 118, 19, &ob->bsoft->flag, 0, 0, 0, 0,
+ "Enable bending constraints");
+
yco -= 25;
xco = 0;
- uiDefButF(block, NUMSLI, 0, "LinStiff ", xco, yco, 238, 19,
- &ob->soft->inspring, 0.0, 1.0, 1, 0,
- "Linear stiffness of the soft body vertex spring");
- /*
+ uiDefButBitI(block, TOG, OB_BSB_COL_CL_RS, 0, "Cluster Col. RS",
+ xco, yco, 118, 19, &ob->bsoft->collisionflags, 0, 0, 0, 0,
+ "Enable cluster collision between soft and rigid body");
+ uiDefButBitI(block, TOG, OB_BSB_COL_CL_SS, 0, "Cluster Col. SS",
+ xco+=120, yco, 118, 19, &ob->bsoft->collisionflags, 0, 0, 0, 0,
+ "Enable cluster collision between soft and soft body");
yco -= 25;
- uiDefButF(block, NUMSLI, 0, "AngStiff ", xco, yco, 238, 19,
- &ob->angularStiffness, 0.0, 1.0, 1, 0,
- "Angular stiffness of the soft body vertex spring");
+ xco = 0;
+ uiDefButI(block, NUM, REDRAWVIEW3D, "Clus.It.",
+ xco, yco, 118, 19, &ob->bsoft->numclusteriterations, 1.0, 128.,
+ 0, 0, "Specify the number of cluster iterations");
+
+ uiDefButI(block, NUM, REDRAWVIEW3D, "piterations",
+ xco+=120, yco, 118, 19, &ob->bsoft->piterations, 0, 10,
+ 0, 0, "Position solver iterations");
+
yco -= 25;
- uiDefButF(block, NUMSLI, 0, "Volume ", xco, yco, 238, 19,
- &ob->volumePreservation, 0.0, 1.0, 1, 0,
- "Factor of soft body volume preservation");
- */
+ xco = 0;
+ uiDefButF(block, NUMSLI, REDRAWVIEW3D, "Friction",
+ xco, yco, 118, 19, &ob->bsoft->kDF, 0.0, 1.,
+ 0, 0, "Dynamic Friction");
+
+ uiDefButF(block, NUMSLI, REDRAWVIEW3D, "kMT",
+ xco+=120, yco, 118, 19, &ob->bsoft->kMT, 0, 1,
+ 0, 0, "Pose matching coefficient");
+
+ /*
+ //too complex tweaking, disable for now
+ uiDefButF(block, NUMSLI, REDRAWVIEW3D, "kVC",
+ xco+=80, yco, 80, 19, &ob->bsoft->kVC, 0, 100,
+ 0, 0, "Volume coefficient");
+ */
+
+ xco = 0;
+/*
+//would be a cool option, like leaves in the wind, need complex tweaking
+ uiDefButBitI(block, TOG, OB_BSB_AERO_VTWOSIDE, 0, "Aero model",
+ xco, yco, 118, 19, &ob->bsoft->flag, 0, 0, 0, 0,
+ "Enable aero model, vertex normals are flipped to match velocity");
+
+ yco -= 25;
+*/
}
- }
+ } else
+ {
+
+ xco = 0;
+
+ uiDefButBitI(block, TOG, OB_ACTOR, 0, "Sensor actor",
+ xco, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0,
+ "Objects that are detected by the Near and Radar sensor");
+
+ if (ob->gameflag & OB_DYNAMIC) {
+ if (ob->margin < 0.001f)
+ ob->margin = 0.06f;
+ uiDefButF(block, NUM, 0, "Margin",
+ xco+120, yco, 118, 19, &ob->margin, 0.001, 1.0, 1, 0,
+ "Collision margin");
+ } else {
+ uiDefButF(block, NUM, 0, "Margin",
+ xco+120, yco, 118, 19, &ob->margin, 0.0, 1.0, 1, 0,
+ "Collision margin");
+ }
+ yco -= 25;
+ xco = 0;
+
+
+ }
uiBlockSetDirection(block, UI_TOP);
return block;
}
-void buttons_bullet(uiBlock *block, Object *ob)
+static void buttons_bullet(uiBlock *block, Object *ob)
{
uiBut *but;
@@ -3058,67 +3113,131 @@ void buttons_bullet(uiBlock *block, Object *ob)
else
ob->body_type = OB_BODY_TYPE_SOFT;
+ uiBlockBeginAlign(block);
+
//only enable game soft body if Blender Soft Body exists
- if (ob->soft)
- {
- but = uiDefButS(block, MENU, REDRAWVIEW3D,
- "Object type%t|No collision%x0|Static%x1|Dynamic%x2|Rigid body%x3|Soft body%x4",
- 10, 205, 120, 19, &ob->body_type, 0, 0, 0, 0, "Selects the type of physical representation");
- uiButSetFunc(but, check_body_type, but, ob);
- } else
- {
- but = uiDefButS(block, MENU, REDRAWVIEW3D,
- "Object type%t|No collision%x0|Static%x1|Dynamic%x2|Rigid body%x3",
- 10, 205, 120, 19, &ob->body_type, 0, 0, 0, 0, "Selects the type of physical representation");
- uiButSetFunc(but, check_body_type, but, ob);
- }
-
+ but = uiDefButS(block, MENU, REDRAWVIEW3D,
+ "Object type%t|No collision%x0|Static%x1|Dynamic%x2|Rigid body%x3|Soft body%x4",
+ 10, 205, 120, 19, &ob->body_type, 0, 0, 0, 0, "Selects the type of physical representation");
+ uiButSetFunc(but, check_body_type, but, ob);
if (ob->gameflag & OB_COLLISION) {
- uiBlockSetCol(block, TH_BUT_SETTING1);
+
+
+ uiDefButBitI(block, TOG, OB_GHOST, B_REDR, "Ghost",
+ 135,205,55,19,
+ &ob->gameflag, 0, 0, 0, 0,
+ "Objects that don't restitute collisions (like a ghost)");
+
+ //uiBlockSetCol(block, TH_BUT_SETTING1);
uiDefBlockBut(block, advanced_bullet_menu, ob,
"Advanced Settings",
- 200, 205, 150, 20, "Display collision advanced settings");
- uiBlockSetCol(block, TH_BUT_SETTING2);
+ 200, 205, 150, 19, "Display collision advanced settings");
+ //uiBlockSetCol(block, TH_BUT_SETTING2);
+
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, OB_GHOST, 0, "Ghost", 10, 182, 60, 19,
- &ob->gameflag, 0, 0, 0, 0,
- "Objects that don't restitute collisions (like a ghost)");
- if ((ob->gameflag & OB_DYNAMIC) || ((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE))) {
- uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 70, 182, 140, 19,
- &ob->inertia, 0.01, 10.0, 10, 2,
- "Bounding sphere radius, not used for other bounding shapes");
- }
if(ob->gameflag & OB_DYNAMIC) {
- uiDefButF(block, NUM, B_DIFF, "Mass:", 210, 182, 140, 19,
- &ob->mass, 0.01, 10000.0, 10, 2,
- "The mass of the Object");
- uiDefButF(block, NUMSLI, B_DIFF, "Damp ", 10, 162, 150, 19,
- &ob->damping, 0.0, 1.0, 10, 0,
- "General movement damping");
- uiDefButF(block, NUMSLI, B_DIFF, "RotDamp ", 160, 162, 190, 19,
- &ob->rdamping, 0.0, 1.0, 10, 0,
- "General rotation damping");
- }
+ uiDefButF(block, NUM, B_DIFF, "Mass:", 10, 185, 130, 19,
+ &ob->mass, 0.01, 10000.0, 10, 2,
+ "The mass of the Object");
+
+ if (!(ob->gameflag & OB_SOFT_BODY))
+ {
+
+
+ uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 140, 185, 130, 19,
+ &ob->inertia, 0.01, 10.0, 10, 2,
+ "Radius for Bounding sphere and Fh/Fh Rot");
+
+ uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, B_REDR, "No sleeping", 270,185,80,19,
+ &ob->gameflag, 0, 0, 0, 0,
+ "Disable auto (de)activation");
+
+ uiDefButF(block, NUMSLI, B_DIFF, "Damp ", 10, 165, 150, 19,
+ &ob->damping, 0.0, 1.0, 10, 0,
+ "General movement damping");
+ uiDefButF(block, NUMSLI, B_DIFF, "RotDamp ", 160, 165, 190, 19,
+ &ob->rdamping, 0.0, 1.0, 10, 0,
+ "General rotation damping");
+
+ uiDefButBitI(block, TOG, OB_DO_FH, B_DIFF, "Do Fh", 10,145,50,19,
+ &ob->gameflag, 0, 0, 0, 0,
+ "Use Fh settings in Materials");
+ uiDefButBitI(block, TOG, OB_ROT_FH, B_DIFF, "Rot Fh", 60,145,50,19,
+ &ob->gameflag, 0, 0, 0, 0,
+ "Use face normal to rotate Object");
+ /* Form factor is hooked up in Bullet, to scale inertia tensor */
+
+ uiDefButF(block, NUM, B_DIFF, "Form:", 110, 145, 120, 19,
+ &ob->formfactor, 0.01, 100.0, 10, 0,
+ "Form factor scales the inertia tensor");
+ }
+
+
+ }
+
uiBlockEndAlign(block);
+ /* In Bullet, anisotripic friction can be applied to static objects as well, just not soft bodies */
+
+ if (!(ob->gameflag & OB_SOFT_BODY))
+ {
+ uiDefButBitI(block, TOG, OB_ANISOTROPIC_FRICTION, B_REDR, "Anisotropic",
+ 230, 145, 120, 19,
+ &ob->gameflag, 0.0, 1.0, 10, 0,
+ "Enable anisotropic friction");
+
+ if (ob->gameflag & OB_ANISOTROPIC_FRICTION) {
+ uiDefButF(block, NUM, B_DIFF, "x friction:", 10, 125, 114, 19,
+ &ob->anisotropicFriction[0], 0.0, 1.0, 10, 0,
+ "Relative friction coefficient in the x-direction.");
+ uiDefButF(block, NUM, B_DIFF, "y friction:", 124, 125, 113, 19,
+ &ob->anisotropicFriction[1], 0.0, 1.0, 10, 0,
+ "Relative friction coefficient in the y-direction.");
+ uiDefButF(block, NUM, B_DIFF, "z friction:", 237, 125, 113, 19,
+ &ob->anisotropicFriction[2], 0.0, 1.0, 10, 0,
+ "Relative friction coefficient in the z-direction.");
+ }
+
+
+ }
+
uiBlockBeginAlign(block);
uiDefButBitI(block, TOG, OB_BOUNDS, B_REDR, "Bounds", 10, 105, 80, 19,
&ob->gameflag, 0, 0, 0, 0,
"Specify a collision bounds type");
if (ob->gameflag & OB_BOUNDS) {
- uiDefButS(block, MENU, REDRAWVIEW3D, "Collision Bounds%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull%x5|Triangle Mesh%x4",
- //almost ready to enable this one: uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull Polytope%x5|Static TriangleMesh %x4|Dynamic Mesh %x5|",
- 90, 105, 150, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type");
- uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 240,105,110,19,
- &ob->gameflag, 0, 0, 0, 0,
- "Add Children");
+ //only allow convex hull/triangle mesh for soft bodies
+
+ if ((ob->body_type==OB_BODY_TYPE_SOFT) && (ob->gameflag & OB_BOUNDS) && (ob->boundtype<OB_BOUND_POLYH))
+ {
+ ob->boundtype=OB_BOUND_POLYH;
+ }
+
+ if (ob->body_type==OB_BODY_TYPE_SOFT)
+ {
+ uiDefButS(block, MENU, REDRAWVIEW3D, "Collision Bounds%t|Convex Hull%x5|Triangle Mesh%x4",
+ 90, 105, 150, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type");
+ } else
+ {
+ uiDefButS(block, MENU, REDRAWVIEW3D, "Collision Bounds%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull%x5|Triangle Mesh%x4",
+ 90, 105, 150, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type");
+ }
+ if (ob->body_type!=OB_BODY_TYPE_SOFT)
+ {
+ uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 240,105,110,19,
+ &ob->gameflag, 0, 0, 0, 0,
+ "Add Children");
+ }
}
+ uiBlockEndAlign(block);
}
+
uiBlockEndAlign(block);
+
+
}
static void check_controller_state_mask(void *arg1_but, void *arg2_mask)
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index 0b8102cc468..8ba56b84305 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -4960,7 +4960,7 @@ static void object_panel_particle_system(Object *ob)
}
/* NT - Panel for fluidsim settings */
-
+#ifndef DISABLE_ELBEEM
static int _can_fluidsim_at_all(Object *ob)
{
// list of Yes
@@ -5006,6 +5006,7 @@ static void object_fluidsim__enabletoggle(void *ob_v, void *arg2)
countall();
}
}
+#endif
static void object_panel_fluidsim(Object *ob)
{
@@ -5016,7 +5017,8 @@ static void object_panel_fluidsim(Object *ob)
const int separateHeight = 2;
const int objHeight = 20;
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
- int libdata = 0, val = 0;
+ int libdata = 0;
+ static int val = 0;
uiBut *but=NULL;
block= uiNewBlock(&curarea->uiblocks, "object_fluidsim", UI_EMBOSS, UI_HELV, curarea->win);
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
index c9df2f6d833..949487fc06f 100644
--- a/source/blender/src/buttons_shading.c
+++ b/source/blender/src/buttons_shading.c
@@ -2795,47 +2795,49 @@ static void lamp_panel_spot(Object *ob, Lamp *la)
}
}
- if(ELEM4(la->type, LA_AREA, LA_SPOT, LA_SUN, LA_LOCAL) && (la->mode & LA_SHAD_RAY)) {
+ if(ELEM4(la->type, LA_AREA, LA_SPOT, LA_SUN, LA_LOCAL)) {
- if (ELEM3(la->type, LA_SPOT, LA_SUN, LA_LOCAL)) {
- if (la->ray_samp_method == LA_SAMP_CONSTANT) la->ray_samp_method = LA_SAMP_HALTON;
-
- uiDefButS(block, MENU, B_REDR, "Adaptive QMC %x1|Constant QMC %x2",
- 100,110,200,19, &la->ray_samp_method, 0, 0, 0, 0, "Method for generating shadow samples: Adaptive QMC is fastest, Constant QMC is less noisy but slower");
-
- uiDefButF(block, NUM,B_LAMPREDRAW,"Soft Size", 100,80,200,19, &la->area_size, 0.01, 100.0, 10, 0, "Area light size, doesn't affect energy amount");
+ if(la->mode & LA_SHAD_RAY) {
+ if (ELEM3(la->type, LA_SPOT, LA_SUN, LA_LOCAL)) {
+ if (la->ray_samp_method == LA_SAMP_CONSTANT) la->ray_samp_method = LA_SAMP_HALTON;
+
+ uiDefButS(block, MENU, B_REDR, "Adaptive QMC %x1|Constant QMC %x2",
+ 100,110,200,19, &la->ray_samp_method, 0, 0, 0, 0, "Method for generating shadow samples: Adaptive QMC is fastest, Constant QMC is less noisy but slower");
+
+ uiDefButF(block, NUM,B_LAMPREDRAW,"Soft Size", 100,80,200,19, &la->area_size, 0.01, 100.0, 10, 0, "Area light size, doesn't affect energy amount");
+
+ uiDefButS(block, NUM,0,"Samples:", 100,60,200,19, &la->ray_samp, 1.0, 16.0, 100, 0, "Sets the amount of samples taken extra (samp x samp)");
+ if (la->ray_samp_method == LA_SAMP_HALTON)
+ uiDefButF(block, NUM,0,"Threshold:", 100,40,200,19, &la->adapt_thresh, 0.0, 1.0, 100, 0, "Threshold for adaptive sampling, to control what level is considered already in shadow");
+ }
+ else if (la->type == LA_AREA) {
+ uiDefButS(block, MENU, B_REDR, "Adaptive QMC %x1|Constant QMC %x2|Constant Jittered %x0",
+ 100,180,200,19, &la->ray_samp_method, 0, 0, 0, 0, "Method for generating shadow samples: Adaptive QMC is fastest");
- uiDefButS(block, NUM,0,"Samples:", 100,60,200,19, &la->ray_samp, 1.0, 16.0, 100, 0, "Sets the amount of samples taken extra (samp x samp)");
- if (la->ray_samp_method == LA_SAMP_HALTON)
- uiDefButF(block, NUM,0,"Threshold:", 100,40,200,19, &la->adapt_thresh, 0.0, 1.0, 100, 0, "Threshold for adaptive sampling, to control what level is considered already in shadow");
+ if (la->ray_samp_method == LA_SAMP_CONSTANT) {
+ uiBlockBeginAlign(block);
+ uiDefButBitS(block, TOG, LA_SAMP_UMBRA, 0,"Umbra", 100,90,200,19,&la->ray_samp_type, 0, 0, 0, 0, "Emphasis parts that are fully shadowed");
+ uiDefButBitS(block, TOG, LA_SAMP_DITHER, 0,"Dither", 100,70,100,19,&la->ray_samp_type, 0, 0, 0, 0, "Use 2x2 dithering for sampling");
+ uiDefButBitS(block, TOG, LA_SAMP_JITTER, 0,"Noise", 200,70,100,19,&la->ray_samp_type, 0, 0, 0, 0, "Use noise for sampling");
+ } else if (la->ray_samp_method == LA_SAMP_HALTON) {
+ uiDefButF(block, NUM,0,"Threshold:", 100,90,200,19, &la->adapt_thresh, 0.0, 1.0, 100, 0, "Threshold for adaptive sampling, to control what level is considered already in shadow");
+ }
+ }
}
- else if (la->type == LA_AREA) {
- uiDefButS(block, MENU, B_REDR, "Adaptive QMC %x1|Constant QMC %x2|Constant Jittered %x0",
- 100,180,200,19, &la->ray_samp_method, 0, 0, 0, 0, "Method for generating shadow samples: Adaptive QMC is fastest");
-
+ /* also for non-shadow case, it's using light samples */
+ if(la->type == LA_AREA) {
if(la->area_shape==LA_AREA_SQUARE)
uiDefButS(block, NUM,0,"Samples:", 100,150,200,19, &la->ray_samp, 1.0, 16.0, 100, 0, "Sets the amount of samples taken extra (samp x samp)");
else if(la->area_shape==LA_AREA_CUBE)
uiDefButS(block, NUM,0,"Samples:", 100,130,200,19, &la->ray_samp, 1.0, 16.0, 100, 0, "Sets the amount of samples taken extra (samp x samp x samp)");
-
+
if (ELEM(la->area_shape, LA_AREA_RECT, LA_AREA_BOX)) {
uiDefButS(block, NUM,0,"SamplesX:", 100,150,200,19, &la->ray_samp, 1.0, 16.0, 100, 0, "Sets the amount of X samples taken extra");
uiDefButS(block, NUM,0,"SamplesY:", 100,130,200,19, &la->ray_sampy, 1.0, 16.0, 100, 0, "Sets the amount of Y samples taken extra");
if(la->area_shape==LA_AREA_BOX)
uiDefButS(block, NUM,0,"SamplesZ:", 100,110,200,19, &la->ray_sampz, 1.0, 8.0, 100, 0, "Sets the amount of Z samples taken extra");
}
-
- if (la->ray_samp_method == LA_SAMP_CONSTANT) {
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LA_SAMP_UMBRA, 0,"Umbra", 100,90,200,19,&la->ray_samp_type, 0, 0, 0, 0, "Emphasis parts that are fully shadowed");
- uiDefButBitS(block, TOG, LA_SAMP_DITHER, 0,"Dither", 100,70,100,19,&la->ray_samp_type, 0, 0, 0, 0, "Use 2x2 dithering for sampling");
- uiDefButBitS(block, TOG, LA_SAMP_JITTER, 0,"Noise", 200,70,100,19,&la->ray_samp_type, 0, 0, 0, 0, "Use noise for sampling");
- } else if (la->ray_samp_method == LA_SAMP_HALTON) {
- uiDefButF(block, NUM,0,"Threshold:", 100,90,200,19, &la->adapt_thresh, 0.0, 1.0, 100, 0, "Threshold for adaptive sampling, to control what level is considered already in shadow");
- }
- }
-
-
+ }
}
else uiDefBut(block, LABEL,0," ", 100,180,200,19,NULL, 0, 0, 0, 0, "");
@@ -2963,23 +2965,29 @@ static void lamp_panel_atmosphere(Object *ob, Lamp *la)
uiDefButS(block, MENU, B_LAMPPRV, "Mix %x0|Add %x1|Subtract %x3|Multiply %x2|Screen %x4|Overlay %x9|Divide %x5|Difference %x6|Darken %x7|Lighten %x8|Dodge %x10|Burn %x11|Color %x15|Value %x14|Saturation %x13|Hue %x12",
10,y-25,BUTW2/2,19,
&la->skyblendtype, 0.0f, 0.0f, 0, 0, "Blend type for how it gets combined with sky");
- uiDefButF(block, NUM, B_LAMPPRV, "",10+BUTW2/2,y-25,BUTW2/2,19, &(la->skyblendfac), 0.0f, 1.0f, 10, 0, "Sets blending factor with sky color");
- uiBlockEndAlign(block);
+ uiDefButF(block, NUM, B_LAMPPRV, "",10+BUTW2/2,y-25,BUTW2/2,19, &(la->skyblendfac), 0.0f, 2.0f, 10, 0, "Sets blending factor with sky color");
- y -= 25;
- uiDefButF(block, NUM, B_LAMPPRV, "Hor.Bright:",10,y-25,BUTW2,19, &(la->horizon_brightness), 0.00f, 20.00f, 10, 0, "Sets horizon brightness.");
- uiDefButF(block, NUM, B_LAMPPRV, "Hor.Spread:",10,y-50,BUTW2,19, &(la->spread), 0.00f, 10.00f, 10, 0, "Sets horizon spread.");
- uiDefButF(block, NUM, B_LAMPPRV, "Sun Bright:",10,y-75,BUTW2,19, &(la->sun_brightness), 0.00f, 10.0f, 10, 0, "Sets sun brightness.");
- uiDefButF(block, NUM, B_LAMPPRV, "Sun Size:",10,y-100,BUTW2,19, &(la->sun_size), 0.00f, 10.00f, 10, 0, "Sets sun size.");
- uiDefButF(block, NUM, B_LAMPPRV, "Back Light:",10,y-125,BUTW2,19, &(la->backscattered_light), -1.00f, 1.00f, 10, 0, "Sets backscatter light.");
+ uiBlockBeginAlign(block);
+ uiDefButS(block, MENU, B_LAMPPRV, "SMPTE %x0|REC709 %x1|CIE %x2",
+ 10,126,60,22, &la->sky_colorspace, 0.0f, 0.0f, 0, 0, "Color space");
+
+ uiDefButF(block, NUM, B_LAMPPRV, "Exp:",70,126,BUTW2-60,22, &(la->sky_exposure), 0.00f, 20.00f, 10, 0, "Exposure correction, zero is no correction.");
+
+ uiBlockBeginAlign(block);
+ uiDefButF(block, NUM, B_LAMPPRV, "Hor.Bright:",10,98,BUTW2,22, &(la->horizon_brightness), 0.00f, 20.00f, 10, 0, "Sets horizon brightness.");
+ uiDefButF(block, NUM, B_LAMPPRV, "Hor.Spread:",10,76,BUTW2,22, &(la->spread), 0.00f, 10.00f, 10, 0, "Sets horizon spread.");
+ uiDefButF(block, NUM, B_LAMPPRV, "Sun Bright:",10,54,BUTW2,22, &(la->sun_brightness), 0.00f, 10.0f, 10, 0, "Sets sun brightness.");
+ uiDefButF(block, NUM, B_LAMPPRV, "Sun Size:",10,32,BUTW2,22, &(la->sun_size), 0.00f, 10.00f, 10, 0, "Sets sun size.");
+ uiDefButF(block, NUM, B_LAMPPRV, "Back Light:",10,10,BUTW2,22, &(la->backscattered_light), -1.00f, 1.00f, 10, 0, "Sets backscatter light.");
}
if(la->sun_effect_type & LA_SUN_EFFECT_AP)
{
- uiDefButF(block, NUM, B_LAMPREDRAW, "Sun Intens.:",20+BUTW2,y-25,BUTW2,19, &(la->sun_intensity), 0.00f, 10.00f, 10, 0, "Sets sun intensity.");
- uiDefButF(block, NUM, B_LAMPREDRAW, "Inscattering:",20+BUTW2,y-50,BUTW2,19, &(la->atm_inscattering_factor), 0.00f, 1.00f, 10, 0, "In Scattering Contribution Factor.");
- uiDefButF(block, NUM, B_LAMPREDRAW, "Extinction:",20+BUTW2,y-75,BUTW2,19, &(la->atm_extinction_factor), 0.00f, 1.00f, 10, 0, "Extinction Scattering Contribution Factor.");
- uiDefButF(block, NUM, B_LAMPREDRAW, "Distance:",20+BUTW2,y-100,BUTW2,19, &(la->atm_distance_factor), 0.000f, 500.0f, 10, 0, "Scale blender distance to real distance.");
+ uiBlockBeginAlign(block);
+ uiDefButF(block, NUM, B_LAMPREDRAW, "Sun Intens.:",20+BUTW2,76,BUTW2,22, &(la->sun_intensity), 0.00f, 10.00f, 10, 0, "Sets sun intensity.");
+ uiDefButF(block, NUM, B_LAMPREDRAW, "Inscattering:",20+BUTW2,54,BUTW2,22, &(la->atm_inscattering_factor), 0.00f, 1.00f, 10, 0, "In Scattering Contribution Factor.");
+ uiDefButF(block, NUM, B_LAMPREDRAW, "Extinction:",20+BUTW2,32,BUTW2,22, &(la->atm_extinction_factor), 0.00f, 1.00f, 10, 0, "Extinction Scattering Contribution Factor.");
+ uiDefButF(block, NUM, B_LAMPREDRAW, "Distance:",20+BUTW2,10,BUTW2,22, &(la->atm_distance_factor), 0.000f, 500.0f, 10, 0, "Scale blender distance to real distance.");
}
}
diff --git a/source/blender/src/drawaction.c b/source/blender/src/drawaction.c
index 64e85bfcd4e..0d2c8dce43d 100644
--- a/source/blender/src/drawaction.c
+++ b/source/blender/src/drawaction.c
@@ -647,7 +647,7 @@ static void draw_channel_names(void)
case SPACE_VIEW3D:
{
/* this shouldn't cause any overflow... */
- sprintf(name, "3DView: %s", view3d_get_name(sa->spacedata.first));
+ sprintf(name, "3DView[%02d]:%s", sa->win, view3d_get_name(sa->spacedata.first));
special= ICON_VIEW3D;
}
break;
@@ -660,7 +660,7 @@ static void draw_channel_names(void)
sprintf(treetype, "Composite");
else
sprintf(treetype, "Material");
- sprintf(name, "Nodes: %s", treetype);
+ sprintf(name, "Nodes[%02d]:%s", sa->win, treetype);
special= ICON_NODE;
}
@@ -678,7 +678,7 @@ static void draw_channel_names(void)
default: sprintf(imgpreview, "Sequence"); break;
}
- sprintf(name, "Sequencer: %s", imgpreview);
+ sprintf(name, "Sequencer[%02d]:%s", sa->win, imgpreview);
special= ICON_SEQUENCE;
}
@@ -688,9 +688,9 @@ static void draw_channel_names(void)
SpaceImage *sima= sa->spacedata.first;
if (sima->image)
- sprintf(name, "Image: %s", sima->image->id.name+2);
+ sprintf(name, "Image[%02d]:%s", sa->win, sima->image->id.name+2);
else
- sprintf(name, "Image: <None>");
+ sprintf(name, "Image[%02d]:<None>", sa->win);
special= ICON_IMAGE_COL;
}
@@ -698,7 +698,7 @@ static void draw_channel_names(void)
default:
{
- sprintf(name, "<Unknown GP-Data Source>");
+ sprintf(name, "[%02d]<Unknown GP-Data Source>", sa->win);
special= -1;
}
break;
diff --git a/source/blender/src/drawarmature.c b/source/blender/src/drawarmature.c
index c37eaf7986c..f050a730380 100644
--- a/source/blender/src/drawarmature.c
+++ b/source/blender/src/drawarmature.c
@@ -1301,7 +1301,7 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp)
bPoseChannel *parchan;
for (con= pchan->constraints.first; con; con= con->next) {
- if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
+ if (con->type == CONSTRAINT_TYPE_KINEMATIC && (con->enforce!=0.0)) {
bKinematicConstraint *data = (bKinematicConstraint*)con->data;
int segcount= 0;
@@ -2573,3 +2573,4 @@ int draw_armature(Base *base, int dt, int flag)
/* *************** END Armature drawing ******************* */
+
diff --git a/source/blender/src/drawgpencil.c b/source/blender/src/drawgpencil.c
index fb21d94f39a..b38bd6b2b63 100644
--- a/source/blender/src/drawgpencil.c
+++ b/source/blender/src/drawgpencil.c
@@ -80,7 +80,7 @@
#include "blendef.h"
#include "butspace.h"
-#include "PIL_time.h" /* sleep */
+#include "PIL_time.h"
#include "mydevice.h"
/* ************************************************** */
@@ -447,7 +447,7 @@ static void gp_draw_stroke_point (bGPDspoint *points, short thickness, short sfl
/* need to translate drawing position, but must reset after too! */
glTranslatef(co[0], co[1], 0.);
- gluDisk( qobj, 0.0, thickness, 32, 1);
+ gluDisk(qobj, 0.0, thickness, 32, 1);
glTranslatef(-co[0], -co[1], 0.);
gluDeleteQuadric(qobj);
@@ -524,7 +524,9 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness,
glEnd();
}
- /* tesselation code: currently only enabled with rt != 0 */
+ /* tesselation code - draw stroke as series of connected quads with connection
+ * edges rotated to minimise shrinking artifacts, and rounded endcaps
+ */
else
{
bGPDspoint *pt1, *pt2;
@@ -723,7 +725,7 @@ static void gp_draw_strokes (bGPDframe *gpf, int offsx, int offsy, int winx, int
glColor4f(color[0], color[1], color[2], color[3]);
for (gps= gpf->strokes.first; gps; gps= gps->next) {
- /* check if stroke can be drawn */
+ /* check if stroke can be drawn - checks here generally fall into pairs */
if ((dflag & GP_DRAWDATA_ONLY3D) && !(gps->flag & GP_STROKE_3DSPACE))
continue;
if (!(dflag & GP_DRAWDATA_ONLY3D) && (gps->flag & GP_STROKE_3DSPACE))
@@ -876,13 +878,13 @@ static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy
BIF_ThemeColor(TH_TEXT_HI);
if (actlay->actframe) {
- sprintf(printable, "GPencil: Layer ('%s'), Frame (%d) %s",
+ sprintf(printable, "GPencil: Layer ('%s'), Frame (%d)%s",
actlay->info, actlay->actframe->framenum,
- ((gpd->flag & GP_DATA_EDITPAINT)?", Draw Mode On":"") );
+ ((gpd->flag & GP_DATA_EDITPAINT)?" , Draw Mode On":"") );
}
else {
- sprintf(printable, "GPencil: Layer ('%s'), Frame <None> %s",
- actlay->info, ((gpd->flag & GP_DATA_EDITPAINT)?", Draw Mode On":"") );
+ sprintf(printable, "GPencil: Layer ('%s'), Frame <None>%s",
+ actlay->info, ((gpd->flag & GP_DATA_EDITPAINT)?" , Draw Mode On":"") );
}
}
else {
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c
index 97765690ceb..6db33a89adb 100644
--- a/source/blender/src/drawimage.c
+++ b/source/blender/src/drawimage.c
@@ -2455,12 +2455,12 @@ static void image_zoom_set_factor(float zoomfac)
void image_viewmove(int mode)
{
- short mval[2], mvalo[2], zoom0;
+ short mval[2], mvalo[2];
int oldcursor;
Window *win;
getmouseco_sc(mvalo);
- zoom0= G.sima->zoom;
+
oldcursor=get_cursor();
win=winlay_get_active_window();
diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c
index 1454c0d4f09..aee00baef8e 100644
--- a/source/blender/src/drawipo.c
+++ b/source/blender/src/drawipo.c
@@ -1451,8 +1451,14 @@ static void draw_ipocurves(int sel)
if( (icu->extrap & IPO_CYCL)==0) {
if(prevbezt->vec[1][0] > G.v2d->cur.xmin) {
v1[0]= G.v2d->cur.xmin;
- if(icu->extrap==IPO_HORIZ || icu->ipo==IPO_CONST) v1[1]= prevbezt->vec[1][1];
- else {
+ if(icu->extrap==IPO_HORIZ || icu->ipo==IPO_CONST || icu->totvert==1) {
+ v1[1]= prevbezt->vec[1][1];
+ } else if (icu->ipo==IPO_LIN) {
+ /* extrapolate linear dosnt use the handle, use the next points center instead */
+ fac= (prevbezt->vec[1][0]-bezt->vec[1][0])/(prevbezt->vec[1][0]-v1[0]);
+ if(fac!=0.0) fac= 1.0/fac;
+ v1[1]= prevbezt->vec[1][1]-fac*(prevbezt->vec[1][1]-bezt->vec[1][1]);
+ } else {
fac= (prevbezt->vec[0][0]-prevbezt->vec[1][0])/(prevbezt->vec[1][0]-v1[0]);
if(fac!=0.0) fac= 1.0/fac;
v1[1]= prevbezt->vec[1][1]-fac*(prevbezt->vec[0][1]-prevbezt->vec[1][1]);
@@ -1531,8 +1537,15 @@ static void draw_ipocurves(int sel)
if( (icu->extrap & IPO_CYCL)==0) {
if(prevbezt->vec[1][0] < G.v2d->cur.xmax) {
v1[0]= G.v2d->cur.xmax;
- if(icu->extrap==IPO_HORIZ || icu->ipo==IPO_CONST) v1[1]= prevbezt->vec[1][1];
- else {
+ if(icu->extrap==IPO_HORIZ || icu->ipo==IPO_CONST ||icu->totvert==1) {
+ v1[1]= prevbezt->vec[1][1];
+ } else if (icu->ipo==IPO_LIN) {
+ /* extrapolate linear dosnt use the handle, use the previous points center instead */
+ bezt = prevbezt-1;
+ fac= (prevbezt->vec[1][0]-bezt->vec[1][0])/(prevbezt->vec[1][0]-v1[0]);
+ if(fac!=0.0) fac= 1.0/fac;
+ v1[1]= prevbezt->vec[1][1]-fac*(prevbezt->vec[1][1]-bezt->vec[1][1]);
+ } else {
fac= (prevbezt->vec[2][0]-prevbezt->vec[1][0])/(prevbezt->vec[1][0]-v1[0]);
if(fac!=0.0) fac= 1.0/fac;
v1[1]= prevbezt->vec[1][1]-fac*(prevbezt->vec[2][1]-prevbezt->vec[1][1]);
diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c
index 83eeca5689f..b7aa29e2482 100644
--- a/source/blender/src/drawobject.c
+++ b/source/blender/src/drawobject.c
@@ -3999,7 +3999,6 @@ static void drawnurb(Base *base, Nurb *nurb, int dt)
BevPoint *bevp= (BevPoint *)(bl+1);
int nr= bl->nr;
int skip= nu->resolu/16;
- float fac;
while (nr-->0) { /* accounts for empty bevel lists */
float ox,oy,oz; // Offset perpendicular to the curve
@@ -4817,7 +4816,8 @@ void draw_object(Base *base, int flag)
warning_recursive= 1;
elems.first= elems.last= 0;
- make_cfra_list(ob->ipo, &elems);
+ // warning: no longer checks for certain ob-keys only... (so does this need to use the proper ipokeys then?)
+ make_cfra_list(ob->ipo, &elems);
cfraont= (G.scene->r.cfra);
drawtype= G.vd->drawtype;
diff --git a/source/blender/src/drawtext.c b/source/blender/src/drawtext.c
index 691da379b95..dbb3aaf7672 100644
--- a/source/blender/src/drawtext.c
+++ b/source/blender/src/drawtext.c
@@ -30,22 +30,12 @@
#include <stdlib.h>
#include <math.h>
#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifndef _WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#include "BLI_winstuff.h"
-#endif
#include "MEM_guardedalloc.h"
-#include "PIL_time.h"
#include "BMF_Api.h"
@@ -87,6 +77,9 @@
#include "mydevice.h"
#include "blendef.h"
#include "winlay.h"
+#include "PIL_time.h"
+#include <ctype.h> /* ispunct */
+#include <sys/stat.h>
/***********************/ /*
@@ -131,9 +124,10 @@ def wrap(line, view_width, wrap_chars):
void drawtextspace(ScrArea *sa, void *spacedata);
void winqreadtextspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
-void txt_copy_selectbuffer (Text *text);
-void draw_brackets(SpaceText *st);
+void redraw_alltext(void);
+static void txt_copy_selectbuffer(Text *text);
+static void draw_brackets(SpaceText *st);
static void get_selection_buffer(Text *text);
static int check_bracket(char ch);
static int check_delim(char ch);
@@ -142,7 +136,7 @@ static int check_identifier(char ch);
static int check_whitespace(char ch);
static int get_wrap_width(SpaceText *st);
-static int get_wrap_points(SpaceText *st, char *line);
+//static int get_wrap_points(SpaceText *st, char *line);
static void get_suggest_prefix(Text *text, int offset);
static void confirm_suggestion(Text *text, int skipleft);
@@ -152,7 +146,6 @@ static char *g_find_str= NULL;
static char *g_replace_str= NULL;
static int doc_scroll= 0;
-static double last_check_time= 0;
static int jump_to= 0;
static double last_jump= 0;
@@ -278,6 +271,7 @@ static int find_specialvar(char *string)
return i;
}
+#if 0 // not used
static void print_format(SpaceText *st, TextLine *line) {
int i, a;
char *s, *f;
@@ -292,6 +286,7 @@ static void print_format(SpaceText *st, TextLine *line) {
}
printf("\n%s [%#x]\n", line->format, (int) (f[strlen(f)+1]));
}
+#endif // not used
/* Ensures the format string for the given line is long enough, reallocating as needed */
static int check_format_len(TextLine *line, unsigned int len) {
@@ -684,6 +679,7 @@ static int get_wrap_width(SpaceText *st) {
return max>8 ? max : 8;
}
+#if 0 // not used
/* Returns the number of wrap points (or additional lines) in the given string */
static int get_wrap_points(SpaceText *st, char *line) {
int start, end, taboffs, i, max, count;
@@ -707,6 +703,7 @@ static int get_wrap_points(SpaceText *st, char *line) {
}
return count;
}
+#endif // not used
/* Sets (offl, offc) for transforming (line, curs) to its wrapped position */
static void wrap_offset(SpaceText *st, TextLine *linein, int cursin, int *offl, int *offc) {
@@ -1555,7 +1552,6 @@ void find_and_replace(SpaceText *st, short mode) {
static void do_find_buttons(val) {
Text *text;
SpaceText *st;
- int do_draw= 0;
char *tmp;
st= curarea->spacedata.first;
@@ -1569,26 +1565,21 @@ static void do_find_buttons(val) {
tmp= txt_sel_to_buf(text);
strncpy(g_find_str, tmp, TXT_MAXFINDSTR);
MEM_freeN(tmp);
- do_draw= 1;
break;
case B_PASTEREPLACE:
if (!g_replace_str) break;
tmp= txt_sel_to_buf(text);
strncpy(g_replace_str, tmp, TXT_MAXFINDSTR);
MEM_freeN(tmp);
- do_draw= 1;
break;
case B_TEXTFIND:
find_and_replace(st, 0);
- do_draw= 1;
break;
case B_TEXTREPLACE:
find_and_replace(st, 1);
- do_draw= 1;
break;
case B_TEXTMARKALL:
find_and_replace(st, 2);
- do_draw= 1;
break;
}
}
@@ -1645,7 +1636,7 @@ void drawtextspace(ScrArea *sa, void *spacedata)
else st->viewlines= 0;
if(st->showlinenrs) {
- cpack(0x8c787c);
+ BIF_ThemeColor(TH_GRID);
glRecti(23, 0, (st->lheight==15)?63:59, curarea->winy - 2);
}
@@ -1759,60 +1750,6 @@ void free_textspace(SpaceText *st)
st->text= NULL;
}
-/* returns 0 if file on disk is the same or Text is in memory only
- returns 1 if file has been modified on disk since last local edit
- returns 2 if file on disk has been deleted
- -1 is returned if an error occurs
-*/
-int txt_file_modified(Text *text)
-{
- struct stat st;
- int result;
- char file[FILE_MAXDIR+FILE_MAXFILE];
-
- if (!text || !text->name)
- return 0;
-
- BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE);
- BLI_convertstringcode(file, G.sce);
-
- if (!BLI_exists(file))
- return 2;
-
- result = stat(file, &st);
-
- if(result == -1)
- return -1;
-
- if((st.st_mode & S_IFMT) != S_IFREG)
- return -1;
-
- if (st.st_mtime > text->mtime)
- return 1;
-
- return 0;
-}
-
-void txt_ignore_modified(Text *text) {
- struct stat st;
- int result;
- char file[FILE_MAXDIR+FILE_MAXFILE];
-
- if (!text || !text->name) return;
-
- BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE);
- BLI_convertstringcode(file, G.sce);
-
- if (!BLI_exists(file)) return;
-
- result = stat(file, &st);
-
- if(result == -1 || (st.st_mode & S_IFMT) != S_IFREG)
- return;
-
- text->mtime= st.st_mtime;
-}
-
static void save_mem_text(char *str)
{
SpaceText *st= curarea->spacedata.first;
@@ -1940,7 +1877,7 @@ int jumptoline_interactive(SpaceText *st) {
int bufferlength;
static char *copybuffer = NULL;
-void txt_copy_selectbuffer (Text *text)
+static void txt_copy_selectbuffer (Text *text)
{
int length=0;
TextLine *tmp, *linef, *linel;
@@ -2455,18 +2392,9 @@ static short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short
}
}
- if (draw) {
- ScrArea *sa;
-
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- SpaceText *st= sa->spacedata.first;
-
- if (st && st->spacetype==SPACE_TEXT) {
- scrarea_queue_redraw(sa);
- }
- }
- }
-
+ if (draw)
+ redraw_alltext();
+
return swallow;
}
@@ -2628,80 +2556,12 @@ static short do_markers(SpaceText *st, char ascii, unsigned short evnt, short va
}
}
- if (draw) {
- ScrArea *sa;
-
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- SpaceText *st= sa->spacedata.first;
-
- if (st && st->spacetype==SPACE_TEXT) {
- scrarea_queue_redraw(sa);
- }
- }
- }
+ if (draw)
+ redraw_alltext();
+
return swallow;
}
-static short do_modification_check(SpaceText *st) {
- Text *text= st->text;
-
- if (last_check_time < PIL_check_seconds_timer() - 2.0) {
- switch (txt_file_modified(text)) {
- case 1:
- /* Modified locally and externally, ahhh. Offer more possibilites. */
- if (text->flags & TXT_ISDIRTY) {
- switch (pupmenu("File Modified Outside and Inside Blender %t|Load outside changes (ignore local changes) %x0|Save local changes (ignore outside changes) %x1|Make text internal (separate copy) %x2")) {
- case 0:
- reopen_text(text);
- if (st->showsyntax) txt_format_text(st);
- return 1;
- case 1:
- txt_write_file(text);
- return 1;
- case 2:
- text->flags |= TXT_ISMEM | TXT_ISDIRTY | TXT_ISTMP;
- MEM_freeN(text->name);
- text->name= NULL;
- return 1;
- }
- } else {
- switch (pupmenu("File Modified Outside Blender %t|Reload from disk %x0|Make text internal (separate copy) %x1|Ignore %x2")) {
- case 0:
- if (text->compiled) BPY_free_compiled_text(text);
- text->compiled = NULL;
- reopen_text(text);
- if (st->showsyntax) txt_format_text(st);
- return 1;
- case 1:
- text->flags |= TXT_ISMEM | TXT_ISDIRTY | TXT_ISTMP;
- MEM_freeN(text->name);
- text->name= NULL;
- return 1;
- case 2:
- txt_ignore_modified(text);
- return 1;
- }
- }
- break;
- case 2:
- switch (pupmenu("File Deleted Outside Blender %t|Make text internal %x0|Recreate file %x1")) {
- case 0:
- text->flags |= TXT_ISMEM | TXT_ISDIRTY | TXT_ISTMP;
- MEM_freeN(text->name);
- text->name= NULL;
- return 1;
- case 1:
- txt_write_file(text);
- return 1;
- }
- break;
- default:
- break;
- }
- last_check_time = PIL_check_seconds_timer();
- }
- return 0;
-}
void winqreadtextspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
{
@@ -3311,22 +3171,11 @@ void winqreadtextspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
}
}
- if (do_modification_check(st)) do_draw= 1;
-
- if (do_draw) {
- ScrArea *sa;
-
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- SpaceText *st= sa->spacedata.first;
-
- if (st && st->spacetype==SPACE_TEXT) {
- scrarea_queue_redraw(sa);
- }
- }
- }
+ if (do_draw)
+ redraw_alltext();
}
-void draw_brackets(SpaceText *st)
+static void draw_brackets(SpaceText *st)
{
char ch;
int b, c, startc, endc, find, stack;
@@ -3578,3 +3427,19 @@ void convert_tabs (struct SpaceText *st, int tab)
if (st->showsyntax) txt_format_text(st);
}
+
+void redraw_alltext(void)
+{
+ ScrArea *sa;
+
+ if(!G.curscreen)
+ return;
+
+ for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
+ SpaceText *st= sa->spacedata.first;
+
+ if (st && st->spacetype==SPACE_TEXT) {
+ scrarea_queue_redraw(sa);
+ }
+ }
+}
diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c
index 60d7ab599ab..b432d6edc34 100644
--- a/source/blender/src/drawview.c
+++ b/source/blender/src/drawview.c
@@ -181,7 +181,7 @@
#include "radio.h"
/* locals */
-void drawname(Object *ob);
+static void drawname(Object *ob);
static void star_stuff_init_func(void)
{
@@ -1199,7 +1199,7 @@ exit:
return index;
}
-void drawname(Object *ob)
+static void drawname(Object *ob)
{
cpack(0x404040);
glRasterPos3f(0.0, 0.0, 0.0);
diff --git a/source/blender/src/edit.c b/source/blender/src/edit.c
index a44bbc3af0f..87bb6f9e94e 100644
--- a/source/blender/src/edit.c
+++ b/source/blender/src/edit.c
@@ -136,10 +136,10 @@ extern void obedit_selectionCB(short selecting, Object *editobj,
extern void uvedit_selectionCB(short selecting, Object *editobj,
short *mval, float rad);
-void circle_selectCB(select_CBfunc func);
+static void circle_selectCB(select_CBfunc func);
/* local protos ---------------*/
-void snap_curs_to_firstsel(void);
+static void snap_curs_to_firstsel(void);
/* flag==2 only border, flag==3 cross+border
flag==5 cross + border + start&end frame
@@ -478,7 +478,7 @@ void draw_sel_circle(short *mval, short *mvalo, float rad, float rado, int selec
* it (hopefully) reusable for other windows than the 3D view.
*/
-void circle_selectCB(select_CBfunc callback)
+static void circle_selectCB(select_CBfunc callback)
{
static float rad= 40.0;
float rado= rad;
@@ -1548,7 +1548,7 @@ void snap_curs_to_active()
allqueue(REDRAWVIEW3D, 0);
}
-void snap_curs_to_firstsel()
+static void snap_curs_to_firstsel()
{
TransVert *tv;
Base *base;
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c
index 220265fcbaf..d10f354ed7a 100644
--- a/source/blender/src/editaction.c
+++ b/source/blender/src/editaction.c
@@ -436,7 +436,7 @@ static void actdata_filter_action (ListBase *act_data, bAction *act, int filter_
*/
if ( (!(filter_mode & ACTFILTER_VISIBLE) || EXPANDED_AGRP(agrp)) ||
( ((filter_mode & ACTFILTER_IPOKEYS) || (filter_mode & ACTFILTER_ONLYICU)) &&
- !(filter_mode & ACTFILTER_SEL) ) )
+ (!(filter_mode & ACTFILTER_SEL) || (SEL_AGRP(agrp))) ) )
{
if (!(filter_mode & ACTFILTER_FOREDIT) || EDITABLE_AGRP(agrp)) {
for (achan= agrp->channels.first; achan && achan->grp==agrp; achan= achan->next) {
@@ -2116,7 +2116,7 @@ void paste_actdata ()
/* check if we have a corresponding action channel */
if ((no_name) || (strcmp(achan->name, achant->name)==0)) {
- actname= achan->name;
+ actname= achant->name;
/* check if this is a constraint channel */
if (ale->type == ACTTYPE_CONCHAN) {
@@ -2125,7 +2125,7 @@ void paste_actdata ()
for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) {
if (strcmp(conchan->name, conchant->name)==0) {
- conname= conchan->name;
+ conname= conchant->name;
ipo_src= conchan->ipo;
break;
}
@@ -2141,7 +2141,7 @@ void paste_actdata ()
else if (ale->ownertype == ACTTYPE_SHAPEKEY) {
/* check if this action channel is "#ACP_ShapeKey" */
if ((no_name) || (strcmp(achan->name, "#ACP_ShapeKey")==0)) {
- actname= achan->name;
+ actname= NULL;
ipo_src= achan->ipo;
break;
}
@@ -5155,21 +5155,28 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
case DELKEY:
case XKEY:
- if (okee("Erase selected")) {
- if (mval[0] < NAMEWIDTH) {
- if (datatype == ACTCONT_ACTION)
- delete_action_channels();
- else if (datatype == ACTCONT_GPENCIL)
- delete_gpencil_layers();
+ /* markers are incorported under shift-modifier (it does go against conventions, but oh well :/) */
+ if (G.qual == LR_SHIFTKEY) {
+ if (okee("Erase selected marker(s)?")) {
+ if (mval[0] >= NAMEWIDTH)
+ remove_marker();
+ }
+ }
+ else {
+ if (okee("Erase selected?")) {
+ if (mval[0] < NAMEWIDTH) {
+ if (datatype == ACTCONT_ACTION)
+ delete_action_channels();
+ else if (datatype == ACTCONT_GPENCIL)
+ delete_gpencil_layers();
+ }
+ else
+ delete_action_keys();
}
- else
- delete_action_keys();
-
- if (mval[0] >= NAMEWIDTH)
- remove_marker();
-
- allqueue(REDRAWMARKER, 0);
}
+
+ allqueue(REDRAWMARKER, 0);
+
break;
case ACCENTGRAVEKEY:
diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c
index 5e50c8117cc..d5e5b5a1c4a 100644
--- a/source/blender/src/editarmature.c
+++ b/source/blender/src/editarmature.c
@@ -3310,6 +3310,143 @@ void switch_direction_armature (void)
BIF_undo_push("Switch Direction");
}
+/* editbone alignment */
+
+/* helper to fix a ebone position if its parent has moved due to alignment*/
+static void fix_connected_bone(EditBone *ebone)
+{
+ float diff[3];
+
+ if (!(ebone->parent) || !(ebone->flag & BONE_CONNECTED) || VecEqual(ebone->parent->tail, ebone->head))
+ return;
+
+ /* if the parent has moved we translate child's head and tail accordingly*/
+ VecSubf(diff, ebone->parent->tail, ebone->head);
+ VecAddf(ebone->head, ebone->head, diff);
+ VecAddf(ebone->tail, ebone->tail, diff);
+ return;
+}
+
+/* helper to recursively find chains of connected bones starting at ebone and fix their position */
+static void fix_editbone_connected_children(EditBone *ebone)
+{
+ EditBone *selbone;
+
+ for (selbone = G.edbo.first; selbone; selbone=selbone->next) {
+ if ((selbone->parent) && (selbone->parent == ebone) && (selbone->flag & BONE_CONNECTED)) {
+ fix_connected_bone(selbone);
+ fix_editbone_connected_children(selbone);
+ }
+ }
+ return;
+}
+
+static void bone_align_to_bone(EditBone *selbone, EditBone *actbone)
+{
+ float selboneaxis[3], actboneaxis[3], length;
+
+ VecSubf(actboneaxis, actbone->tail, actbone->head);
+ Normalize(actboneaxis);
+
+ VecSubf(selboneaxis, selbone->tail, selbone->head);
+ length = VecLength(selboneaxis);
+
+ VecMulf(actboneaxis, length);
+ VecAddf(selbone->tail, selbone->head, actboneaxis);
+ selbone->roll = actbone->roll;
+
+ /* if the bone being aligned has connected descendants they must be moved
+ according to their parent new position, otherwise they would be left
+ in an unconsistent state: connected but away from the parent*/
+ fix_editbone_connected_children(selbone);
+ return;
+}
+
+void align_selected_bones(void)
+{
+ bArmature *arm= G.obedit->data;
+ EditBone *actbone, *ebone, *selbone;
+ EditBone *flipbone, *flippar;
+ short allchildbones= 0, foundselbone= 0;
+
+ /* find active bone to align to */
+ for (actbone = G.edbo.first; actbone; actbone=actbone->next) {
+ if (arm->layer & actbone->layer) {
+ if (actbone->flag & BONE_ACTIVE)
+ break;
+ }
+ }
+ if (actbone == NULL) {
+ error("Needs an active bone");
+ return;
+ }
+
+ /* find selected bones */
+ for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
+ if (arm->layer & ebone->layer) {
+ if ((ebone->flag & BONE_SELECTED) && (ebone != actbone)) {
+ foundselbone++;
+ if (ebone->parent != actbone) allchildbones= 1;
+ }
+ }
+ }
+ /* abort if no selected bones, and active bone doesn't have a parent to work with instead */
+ if (foundselbone==0 && actbone->parent==NULL) {
+ error("Need selected bone(s)");
+ return;
+ }
+
+ if (foundselbone==0 && actbone->parent) {
+ /* When only the active bone is selected, and it has a parent,
+ * align it to the parent, as that is the only possible outcome.
+ */
+ bone_align_to_bone(actbone, actbone->parent);
+
+ if (arm->flag & ARM_MIRROR_EDIT) {
+ flipbone = armature_bone_get_mirrored(actbone);
+ if (flipbone)
+ bone_align_to_bone(flipbone, flipbone->parent);
+ }
+ }
+ else {
+ /* loop through all editbones, aligning all selected bones to the active bone */
+ for (selbone = G.edbo.first; selbone; selbone=selbone->next) {
+ if (arm->layer & selbone->layer) {
+ if ((selbone->flag & BONE_SELECTED) && (selbone!=actbone)) {
+ /* align selbone to actbone */
+ bone_align_to_bone(selbone, actbone);
+
+ if (arm->flag & ARM_MIRROR_EDIT) {
+ /* - if there's a mirrored copy of selbone, try to find a mirrored copy of actbone
+ * (i.e. selbone="child.L" and actbone="parent.L", find "child.R" and "parent.R").
+ * This is useful for arm-chains, for example parenting lower arm to upper arm
+ * - if there's no mirrored copy of actbone (i.e. actbone = "parent.C" or "parent")
+ * then just use actbone. Useful when doing upper arm to spine.
+ */
+ flipbone = armature_bone_get_mirrored(selbone);
+ flippar = armature_bone_get_mirrored(actbone);
+
+ if (flipbone) {
+ if (flippar)
+ bone_align_to_bone(flipbone, flippar);
+ else
+ bone_align_to_bone(flipbone, actbone);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ countall(); /* checks selection */
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWBUTSEDIT, 0);
+ allqueue(REDRAWOOPS, 0);
+ BIF_undo_push("Align bones");
+
+ return;
+}
+
/* ***************** Pose tools ********************* */
void clear_armature(Object *ob, char mode)
diff --git a/source/blender/src/editcurve.c b/source/blender/src/editcurve.c
index 1dee0837445..c26c44103c0 100644
--- a/source/blender/src/editcurve.c
+++ b/source/blender/src/editcurve.c
@@ -828,7 +828,6 @@ short extrudeflagNurb(int flag)
MEM_freeN(nu->bp);
nu->bp= newbp;
nu->pntsv++;
- if(nu->resolv<3) nu->resolv++;
makeknots(nu, 2, nu->flagv>>1);
}
else if(v==0 || v== nu->pntsu-1) { /* collumn in v-direction selected */
@@ -856,7 +855,6 @@ short extrudeflagNurb(int flag)
MEM_freeN(nu->bp);
nu->bp= newbp;
nu->pntsu++;
- if(nu->resolu<3) nu->resolu++;
makeknots(nu, 1, nu->flagu>>1);
}
}
@@ -2470,8 +2468,6 @@ void merge_2_nurb(Nurb *nu1, Nurb *nu2)
/* merge */
origu= nu1->pntsu;
nu1->pntsu+= nu2->pntsu;
- nu1->resolu+= nu2->pntsu;
- if(nu1->resolv < nu2->resolv) nu1->resolv= nu2->resolv;
if(nu1->orderu<3) nu1->orderu++;
if(nu1->orderv<3) nu1->orderv++;
temp= nu1->bp;
@@ -2997,7 +2993,6 @@ void addvert_Nurb(int mode)
if(bp) {
nu->pntsu++;
- if(nu->resolu<3) nu->resolu++;
makeknots(nu, 1, nu->flagu>>1);
if(mode=='e') {
@@ -4116,16 +4111,17 @@ Nurb *addNurbprim(int type, int stype, int newname)
Mat3One(imat);
cent[0]= cent[1]= cent[2]= 0.0;
}
-
+
if ELEM5(stype, 0, 1, 2, 4, 6) {
nu = (Nurb*)MEM_callocN(sizeof(Nurb), "addNurbprim");
nu->type= type;
- nu->resolu= 12;
- nu->resolv= 12;
+ nu->resolu= 4;
+ nu->resolv= 4;
}
switch(stype) {
case 0: /* curve */
+ nu->resolu= 12; /* set as 4 above */
if(newname) {
rename_id((ID *)G.obedit, "Curve");
rename_id((ID *)G.obedit->data, "Curve");
@@ -4203,7 +4199,7 @@ Nurb *addNurbprim(int type, int stype, int newname)
nu->pntsv= 1;
nu->orderu= 5;
nu->flagu= 2; /* endpoint */
- nu->resolu= 32;
+ nu->resolu= 8;
nu->bp= callocstructN(BPoint, 5, "addNurbprim3");
bp= nu->bp;
@@ -4233,6 +4229,7 @@ Nurb *addNurbprim(int type, int stype, int newname)
break;
case 1: /* circle */
+ nu->resolu= 12; /* set as 4 above */
if(newname) {
rename_id((ID *)G.obedit, "CurveCircle");
rename_id((ID *)G.obedit->data, "CurveCircle");
@@ -4361,7 +4358,7 @@ Nurb *addNurbprim(int type, int stype, int newname)
}
nu= addNurbprim(4, 1, newname); /* circle */
- nu->resolu= 32;
+ nu->resolu= 4;
nu->flag= CU_SMOOTH;
BLI_addtail(&editNurb, nu); /* temporal for extrude and translate */
vec[0]=vec[1]= 0.0;
@@ -4394,8 +4391,8 @@ Nurb *addNurbprim(int type, int stype, int newname)
nu->pntsu= 5;
nu->pntsv= 1;
nu->orderu= 3;
- nu->resolu= 24;
- nu->resolv= 32;
+ nu->resolu= 4;
+ nu->resolv= 4;
nu->flag= CU_SMOOTH;
nu->bp= callocstructN(BPoint, 5, "addNurbprim6");
nu->flagu= 0;
@@ -4441,8 +4438,8 @@ Nurb *addNurbprim(int type, int stype, int newname)
xzproj= 1;
nu= addNurbprim(4, 1, newname); /* circle */
xzproj= 0;
- nu->resolu= 24;
- nu->resolv= 32;
+ nu->resolu= 4;
+ nu->resolv= 4;
nu->flag= CU_SMOOTH;
BLI_addtail(&editNurb, nu); /* temporal for extrude and translate */
if(newname && (U.flag & USER_ADD_VIEWALIGNED) == 0)
diff --git a/source/blender/src/editface.c b/source/blender/src/editface.c
index 008ddf3b5f0..77c27dfa3db 100644
--- a/source/blender/src/editface.c
+++ b/source/blender/src/editface.c
@@ -312,7 +312,7 @@ static void uv_calc_shift_project(float *target, float *shift, float rotmat[][4]
}
}
-void correct_uv_aspect( void )
+static void correct_uv_aspect( void )
{
float aspx=1, aspy=1;
EditMesh *em = G.editMesh;
@@ -1050,7 +1050,7 @@ int edgetag_shortest_path(EditEdge *source, EditEdge *target)
return 1;
}
-void seam_edgehash_insert_face(EdgeHash *ehash, MFace *mf)
+static void seam_edgehash_insert_face(EdgeHash *ehash, MFace *mf)
{
BLI_edgehash_insert(ehash, mf->v1, mf->v2, NULL);
BLI_edgehash_insert(ehash, mf->v2, mf->v3, NULL);
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
index 9a7f8e652a7..617683a6ab4 100644
--- a/source/blender/src/editipo.c
+++ b/source/blender/src/editipo.c
@@ -2022,12 +2022,9 @@ IpoCurve *verify_ipocurve(ID *from, short blocktype, char *actname, char *constn
/* creates ipo too (if add) */
ipo= verify_ipo(from, blocktype, actname, constname, bonename, add);
- if (ipo && ipo->id.lib==NULL && from->lib==NULL) {
+ if ((ipo) && (ipo->id.lib==NULL) && (from->lib==NULL)) {
/* try to find matching curve */
- for (icu= ipo->curve.first; icu; icu= icu->next) {
- if (icu->adrcode==adrcode)
- break;
- }
+ icu= find_ipocurve(ipo, adrcode);
/* make a new one if none found (and can add) */
if ((icu==NULL) && (add)) {
diff --git a/source/blender/src/editmesh.c b/source/blender/src/editmesh.c
index 4c5afe0e6bc..25e7c50b07e 100644
--- a/source/blender/src/editmesh.c
+++ b/source/blender/src/editmesh.c
@@ -1342,7 +1342,7 @@ void load_editMesh(void)
{
Object *ob;
ModifierData *md;
- EditVert *eve, **vertMap = NULL;
+ EditVert **vertMap = NULL;
int i,j;
for (ob=G.main->object.first; ob; ob=ob->id.next) {
diff --git a/source/blender/src/editmesh_add.c b/source/blender/src/editmesh_add.c
index 71e04541643..4dc64b0f933 100644
--- a/source/blender/src/editmesh_add.c
+++ b/source/blender/src/editmesh_add.c
@@ -598,7 +598,7 @@ static void fix_new_face(EditFace *eface)
}
}
-void addfaces_from_edgenet()
+void addfaces_from_edgenet(void)
{
EditVert *eve1, *eve2, *eve3, *eve4;
EditMesh *em= G.editMesh;
@@ -1172,7 +1172,6 @@ void make_prim(int type, float imat[3][3], int tot, int seg,
//extern signed char monkeyf[][4];
//extern signed char monkeyv[][3];
EditVert **tv= MEM_mallocN(sizeof(*tv)*monkeynv*2, "tv");
- EditFace *efa;
int i;
for (i=0; i<monkeynv; i++) {
@@ -1184,8 +1183,8 @@ void make_prim(int type, float imat[3][3], int tot, int seg,
tv[monkeynv+i]->f |= SELECT;
}
for (i=0; i<monkeynf; i++) {
- efa= addfacelist(tv[monkeyf[i][0]+i-monkeyo], tv[monkeyf[i][1]+i-monkeyo], tv[monkeyf[i][2]+i-monkeyo], (monkeyf[i][3]!=monkeyf[i][2])?tv[monkeyf[i][3]+i-monkeyo]:NULL, NULL, NULL);
- efa= addfacelist(tv[monkeynv+monkeyf[i][2]+i-monkeyo], tv[monkeynv+monkeyf[i][1]+i-monkeyo], tv[monkeynv+monkeyf[i][0]+i-monkeyo], (monkeyf[i][3]!=monkeyf[i][2])?tv[monkeynv+monkeyf[i][3]+i-monkeyo]:NULL, NULL, NULL);
+ addfacelist(tv[monkeyf[i][0]+i-monkeyo], tv[monkeyf[i][1]+i-monkeyo], tv[monkeyf[i][2]+i-monkeyo], (monkeyf[i][3]!=monkeyf[i][2])?tv[monkeyf[i][3]+i-monkeyo]:NULL, NULL, NULL);
+ addfacelist(tv[monkeynv+monkeyf[i][2]+i-monkeyo], tv[monkeynv+monkeyf[i][1]+i-monkeyo], tv[monkeynv+monkeyf[i][0]+i-monkeyo], (monkeyf[i][3]!=monkeyf[i][2])?tv[monkeynv+monkeyf[i][3]+i-monkeyo]:NULL, NULL, NULL);
}
MEM_freeN(tv);
diff --git a/source/blender/src/editmesh_loop.c b/source/blender/src/editmesh_loop.c
index 138dd93e490..dfd18e208fb 100644
--- a/source/blender/src/editmesh_loop.c
+++ b/source/blender/src/editmesh_loop.c
@@ -538,7 +538,6 @@ static CutCurve *get_mouse_trail(int *len, char mode, char cutmode, struct GHash
bglFlush();
glDrawBuffer(GL_BACK);
return(NULL);
- break;
}
if (rubberband) { /* rubberband mode, undraw last rubberband */
diff --git a/source/blender/src/editmesh_tools.c b/source/blender/src/editmesh_tools.c
index ae4bc056964..76f1443616f 100644
--- a/source/blender/src/editmesh_tools.c
+++ b/source/blender/src/editmesh_tools.c
@@ -2433,7 +2433,11 @@ void esubdivideflag(int flag, float rad, int beauty, int numcuts, int seltype)
//Set faces f1 to 0 cause we need it later
for(ef=em->faces.first;ef;ef = ef->next) ef->f1 = 0;
- for(eve=em->verts.first; eve; eve=eve->next) eve->f1 = eve->f2 = 0;
+ for(eve=em->verts.first; eve; eve=eve->next) {
+ if(!(beauty & B_KNIFE)) /* knife sets this flag for vertex cuts */
+ eve->f1 = 0;
+ eve->f2 = 0;
+ }
for (; md; md=md->next) {
if (md->type==eModifierType_Mirror) {
@@ -4486,7 +4490,7 @@ static void bevel_mesh_recurs(float bsize, short recurs, int allfaces)
}
}
-void bevel_menu() {
+void bevel_menu(void) {
BME_Mesh *bm;
BME_TransData_Head *td;
TransInfo *t;
diff --git a/source/blender/src/editnla.c b/source/blender/src/editnla.c
index dbc0deecb2c..2c17b20735b 100644
--- a/source/blender/src/editnla.c
+++ b/source/blender/src/editnla.c
@@ -1940,15 +1940,20 @@ void winqreadnlaspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
case DELKEY:
case XKEY:
- if (mval[0]>=NLAWIDTH) {
- if (okee("Erase selected?")) {
- delete_nlachannel_keys();
- update_for_newframe_muted();
-
- remove_marker();
-
- allqueue(REDRAWMARKER, 0);
+ if (mval[0] >= NLAWIDTH) {
+ /* markers are incorported under shift-modifier (it does go against conventions, but oh well :/) */
+ if (G.qual == LR_SHIFTKEY) {
+ if (okee("Erase selected marker(s)?"))
+ remove_marker();
}
+ else {
+ if (okee("Erase selected?")) {
+ delete_nlachannel_keys();
+ update_for_newframe_muted();
+ }
+ }
+
+ allqueue(REDRAWMARKER, 0);
}
break;
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
index 6f926f7396e..250332c4afa 100644
--- a/source/blender/src/editobject.c
+++ b/source/blender/src/editobject.c
@@ -3529,10 +3529,8 @@ void copy_attr(short event)
base->object->boundtype = ob->boundtype;
}
base->object->margin= ob->margin;
- //base->object->linearStiffness= ob->linearStiffness;
- //base->object->angularStiffness= ob->angularStiffness;
- //base->object->volumePreservation= ob->volumePreservation;
- //base->object->gamesoftFlag= ob->gamesoftFlag;
+ base->object->bsoft= copy_bulletsoftbody(ob->bsoft);
+
}
else if(event==17) { /* tex space */
copy_texture_space(base->object, ob);
@@ -3940,7 +3938,7 @@ void make_links(short event)
BIF_undo_push("Create links");
}
-void apply_objects_locrot( void )
+static void apply_objects_internal( int apply_scale, int apply_rot )
{
Base *base, *basact;
Object *ob;
@@ -3954,7 +3952,11 @@ void apply_objects_locrot( void )
float mat[3][3];
int a, change = 0;
-
+ if (!apply_scale && !apply_rot) {
+ /* do nothing? */
+ error("Nothing to do!");
+ return;
+ }
/* first check if we can execute */
for (base= FIRSTBASE; base; base= base->next) {
if TESTBASELIB(base) {
@@ -4002,7 +4004,13 @@ void apply_objects_locrot( void )
ob= base->object;
if(ob->type==OB_MESH) {
- object_to_mat3(ob, mat);
+ if (apply_scale && apply_rot)
+ object_to_mat3(ob, mat);
+ else if (apply_scale)
+ object_scale_to_mat3(ob, mat);
+ else
+ object_rot_to_mat3(ob, mat);
+
me= ob->data;
/* see checks above */
@@ -4011,8 +4019,10 @@ void apply_objects_locrot( void )
for(a=0; a<me->totvert; a++, mvert++) {
Mat3MulVecfl(mat, mvert->co);
}
- ob->size[0]= ob->size[1]= ob->size[2]= 1.0;
- ob->rot[0]= ob->rot[1]= ob->rot[2]= 0.0;
+ if (apply_scale)
+ ob->size[0]= ob->size[1]= ob->size[2]= 1.0;
+ if (apply_rot)
+ ob->rot[0]= ob->rot[1]= ob->rot[2]= 0.0;
/*QuatOne(ob->quat);*/ /* Quats arnt used yet */
where_is_object(ob);
@@ -4027,15 +4037,22 @@ void apply_objects_locrot( void )
change = 1;
}
else if (ob->type==OB_ARMATURE) {
- object_to_mat3(ob, mat);
+ if (apply_scale && apply_rot)
+ object_to_mat3(ob, mat);
+ else if (apply_scale)
+ object_scale_to_mat3(ob, mat);
+ else
+ object_rot_to_mat3(ob, mat);
arm= ob->data;
/* see checks above */
apply_rot_armature(ob, mat);
/* Reset the object's transforms */
- ob->size[0]= ob->size[1]= ob->size[2]= 1.0;
- ob->rot[0]= ob->rot[1]= ob->rot[2]= 0.0;
+ if (apply_scale)
+ ob->size[0]= ob->size[1]= ob->size[2]= 1.0;
+ if (apply_rot)
+ ob->rot[0]= ob->rot[1]= ob->rot[2]= 0.0;
/*QuatOne(ob->quat); (not used anymore)*/
where_is_object(ob);
@@ -4044,7 +4061,12 @@ void apply_objects_locrot( void )
}
else if ELEM(ob->type, OB_CURVE, OB_SURF) {
float scale;
- object_to_mat3(ob, mat);
+ if (apply_scale && apply_rot)
+ object_to_mat3(ob, mat);
+ else if (apply_scale)
+ object_scale_to_mat3(ob, mat);
+ else
+ object_rot_to_mat3(ob, mat);
scale = Mat3ToScalef(mat);
cu= ob->data;
@@ -4073,9 +4095,10 @@ void apply_objects_locrot( void )
}
nu= nu->next;
}
-
- ob->size[0]= ob->size[1]= ob->size[2]= 1.0;
- ob->rot[0]= ob->rot[1]= ob->rot[2]= 0.0;
+ if (apply_scale)
+ ob->size[0]= ob->size[1]= ob->size[2]= 1.0;
+ if (apply_rot)
+ ob->rot[0]= ob->rot[1]= ob->rot[2]= 0.0;
/*QuatOne(ob->quat); (quats arnt used anymore)*/
where_is_object(ob);
@@ -4097,10 +4120,30 @@ void apply_objects_locrot( void )
}
if (change) {
allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Apply Objects Scale & Rotation");
+ if (apply_scale && apply_rot)
+ BIF_undo_push("Apply Objects Scale & Rotation");
+ else if (apply_scale)
+ BIF_undo_push("Apply Objects Scale");
+ else
+ BIF_undo_push("Apply Objects Rotation");
}
}
+void apply_objects_locrot(void)
+{
+ apply_objects_internal(1, 1);
+}
+
+void apply_objects_scale(void)
+{
+ apply_objects_internal(1, 0);
+}
+
+void apply_objects_rot(void)
+{
+ apply_objects_internal(0, 1);
+}
+
void apply_objects_visual_tx( void )
{
Base *base;
@@ -4156,7 +4199,7 @@ void apply_object( void )
if ((ob->pose) && (ob->flag & OB_POSEMODE))
evt = pupmenu("Apply Object%t|Current Pose as RestPose%x3");
else
- evt = pupmenu("Apply Object%t|Scale and Rotation to ObData%x1|Visual Transform to Objects Loc/Scale/Rot%x2");
+ evt = pupmenu("Apply Object%t|Scale and Rotation to ObData%x1|Visual Transform to Objects Loc/Scale/Rot%x2|Scale to ObData%x4|Rotation to ObData%x5");
if (evt==-1) return;
switch (evt) {
@@ -4169,6 +4212,12 @@ void apply_object( void )
case 3:
apply_armature_pose2bones();
break;
+ case 4:
+ apply_objects_scale();
+ break;
+ case 5:
+ apply_objects_rot();
+ break;
}
}
}
diff --git a/source/blender/src/editparticle.c b/source/blender/src/editparticle.c
index f420d46c827..21192d50333 100644
--- a/source/blender/src/editparticle.c
+++ b/source/blender/src/editparticle.c
@@ -2022,7 +2022,7 @@ static void PE_radialcontrol_callback(const int mode, const int val)
(*PE_radialcontrol()) = NULL;
}
-RadialControl **PE_radialcontrol()
+RadialControl **PE_radialcontrol(void)
{
static RadialControl *rc = NULL;
return &rc;
@@ -2408,7 +2408,7 @@ static void brush_add(Object *ob, ParticleSystem *psys, short *mval, short numbe
tree=BLI_kdtree_new(psys->totpart);
for(i=0, pa=psys->particles; i<totpart; i++, pa++) {
- psys_particle_on_dm(ob,psmd->dm,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,cur_co,0,0,0,0,0);
+ psys_particle_on_dm(psmd->dm,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,cur_co,0,0,0,0,0);
BLI_kdtree_insert(tree, i, cur_co, NULL);
}
@@ -2448,7 +2448,7 @@ static void brush_add(Object *ob, ParticleSystem *psys, short *mval, short numbe
int w, maxw;
float maxd, mind, dd, totw=0.0, weight[3];
- psys_particle_on_dm(ob,psmd->dm,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co1,0,0,0,0,0);
+ psys_particle_on_dm(psmd->dm,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co1,0,0,0,0,0);
maxw = BLI_kdtree_find_n_nearest(tree,3,co1,NULL,ptn);
maxd = ptn[maxw-1].dist;
diff --git a/source/blender/src/editsima.c b/source/blender/src/editsima.c
index 1762e49a2a2..7fc76dd5202 100644
--- a/source/blender/src/editsima.c
+++ b/source/blender/src/editsima.c
@@ -110,7 +110,7 @@
#include "editmesh.h"
/* local prototypes */
-void sel_uvco_inside_radius(short , EditFace *efa, MTFace *, int , float *, float *, short);
+static void sel_uvco_inside_radius(short , EditFace *efa, MTFace *, int , float *, float *, short);
void uvedit_selectionCB(short , Object *, short *, float ); /* used in edit.c*/
void object_uvs_changed(Object *ob)
@@ -1264,7 +1264,7 @@ void snap_menu_sima(void)
* Just for readability...
*/
-void sel_uvco_inside_radius(short sel, EditFace *efa, MTFace *tface, int index, float *offset, float *ell, short select_index)
+static void sel_uvco_inside_radius(short sel, EditFace *efa, MTFace *tface, int index, float *offset, float *ell, short select_index)
{
// normalized ellipse: ell[0] = scaleX,
// [1] = scaleY
@@ -1730,7 +1730,7 @@ void uvface_setsel__internal(short select)
} else if ((G.sima->flag & SI_SYNC_UVSEL)==0 && G.sima->sticky == SI_STICKY_LOC) {
EditFace *efa_vlist;
MTFace *tf_vlist;
- UvMapVert *vlist, *start_vlist=NULL, *vlist_iter;
+ UvMapVert *start_vlist=NULL, *vlist_iter;
struct UvVertMap *vmap;
float limit[2];
int efa_index;
@@ -1760,7 +1760,7 @@ void uvface_setsel__internal(short select)
simaUVSel_UnSet(efa, tf, i);
}
- vlist= vlist_iter= get_uv_map_vert_EM(vmap, (*(&efa->v1 + i))->tmp.l);
+ vlist_iter= get_uv_map_vert_EM(vmap, (*(&efa->v1 + i))->tmp.l);
while (vlist_iter) {
if (vlist_iter->separate)
diff --git a/source/blender/src/editsound.c b/source/blender/src/editsound.c
index 2d70525f971..c6ecc8d5865 100644
--- a/source/blender/src/editsound.c
+++ b/source/blender/src/editsound.c
@@ -91,15 +91,12 @@
/* this might move to the external header */
-void* sound_get_libraryinterface(void);
-
static SND_SceneHandle ghSoundScene=NULL;
static SND_AudioDeviceInterfaceHandle ghAudioDeviceInterface=NULL;
/* que? why only here? because of the type define? */
-bSound *sound_find_sound(char *id_name);
-void sound_read_wav_data(bSound * sound, PackedFile * pf);
-void sound_stop_sound(void *object, bSound *sound);
+static bSound *sound_find_sound(char *id_name);
+static void sound_read_wav_data(bSound * sound, PackedFile * pf);
void winqreadsoundspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
/* void sound_stop_all_sounds(void); already in BIF_editsound.h */
@@ -358,7 +355,7 @@ void sound_initialize_sample(bSound *sound)
}
-void sound_read_wav_data(bSound *sound, PackedFile *pf)
+static void sound_read_wav_data(bSound *sound, PackedFile *pf)
{
int i, temp;
short shortbuf, *temps;
@@ -1026,7 +1023,7 @@ void sound_play_sound(bSound *sound)
-bSound *sound_find_sound(char *id_name)
+static bSound *sound_find_sound(char *id_name)
{
bSound *sound;
diff --git a/source/blender/src/gpencil.c b/source/blender/src/gpencil.c
index 9245d2f95f3..b9488d20200 100644
--- a/source/blender/src/gpencil.c
+++ b/source/blender/src/gpencil.c
@@ -614,7 +614,6 @@ void gpencil_layer_delactive (bGPdata *gpd)
/* free layer */
free_gpencil_frames(gpl);
BLI_freelinkN(&gpd->layers, gpl);
-
}
/* ************************************************** */
@@ -1058,145 +1057,6 @@ static void gp_session_validatebuffer (tGPsdata *p)
gpd->sbuffer_sflag= 0;
}
-/* init new painting session */
-static void gp_session_initpaint (tGPsdata *p)
-{
- /* clear previous data (note: is on stack) */
- memset(p, 0, sizeof(tGPsdata));
-
- /* make sure the active view (at the starting time) is a 3d-view */
- if (curarea == NULL) {
- p->status= GP_STATUS_ERROR;
- if (G.f & G_DEBUG)
- printf("Error: No active view for painting \n");
- return;
- }
- switch (curarea->spacetype) {
- /* supported views first */
- case SPACE_VIEW3D:
- {
- View3D *v3d= curarea->spacedata.first;
-
- /* set current area */
- p->sa= curarea;
-
- /* check that gpencil data is allowed to be drawn */
- if ((v3d->flag2 & V3D_DISPGP)==0) {
- p->status= GP_STATUS_ERROR;
- if (G.f & G_DEBUG)
- printf("Error: In active view, Grease Pencil not shown \n");
- return;
- }
- }
- break;
- case SPACE_NODE:
- {
- SpaceNode *snode= curarea->spacedata.first;
-
- /* set current area */
- p->sa= curarea;
- p->v2d= &snode->v2d;
-
- /* check that gpencil data is allowed to be drawn */
- if ((snode->flag & SNODE_DISPGP)==0) {
- p->status= GP_STATUS_ERROR;
- if (G.f & G_DEBUG)
- printf("Error: In active view, Grease Pencil not shown \n");
- return;
- }
- }
- break;
- case SPACE_SEQ:
- {
- SpaceSeq *sseq= curarea->spacedata.first;
-
- /* set current area */
- p->sa= curarea;
- p->v2d= &sseq->v2d;
-
- /* check that gpencil data is allowed to be drawn */
- if (sseq->mainb == 0) {
- p->status= GP_STATUS_ERROR;
- if (G.f & G_DEBUG)
- printf("Error: In active view (sequencer), active mode doesn't support Grease Pencil \n");
- return;
- }
- if ((sseq->flag & SEQ_DRAW_GPENCIL)==0) {
- p->status= GP_STATUS_ERROR;
- if (G.f & G_DEBUG)
- printf("Error: In active view, Grease Pencil not shown \n");
- return;
- }
- }
- break;
- case SPACE_IMAGE:
- {
- SpaceImage *sima= curarea->spacedata.first;
-
- /* set the current area */
- p->sa= curarea;
- p->v2d= &sima->v2d;
- p->ibuf= BKE_image_get_ibuf(sima->image, &sima->iuser);
- }
- break;
- /* unsupported views */
- default:
- {
- p->status= GP_STATUS_ERROR;
- if (G.f & G_DEBUG)
- printf("Error: Active view not appropriate for Grease Pencil drawing \n");
- return;
- }
- break;
- }
-
- /* get gp-data */
- p->gpd= gpencil_data_getactive(p->sa);
- if (p->gpd == NULL) {
- short ok;
-
- p->gpd= gpencil_data_addnew();
- ok= gpencil_data_setactive(p->sa, p->gpd);
-
- /* most of the time, the following check isn't needed */
- if (ok == 0) {
- /* free gpencil data as it can't be used */
- free_gpencil_data(p->gpd);
- p->gpd= NULL;
- p->status= GP_STATUS_ERROR;
- if (G.f & G_DEBUG)
- printf("Error: Could not assign newly created Grease Pencil data to active area \n");
- return;
- }
- }
-
- /* set edit flags */
- G.f |= G_GREASEPENCIL;
-
- /* clear out buffer (stored in gp-data) in case something contaminated it */
- gp_session_validatebuffer(p);
-}
-
-/* cleanup after a painting session */
-static void gp_session_cleanup (tGPsdata *p)
-{
- bGPdata *gpd= p->gpd;
-
- /* error checking */
- if (gpd == NULL)
- return;
-
- /* free stroke buffer */
- if (gpd->sbuffer) {
- MEM_freeN(gpd->sbuffer);
- gpd->sbuffer= NULL;
- }
-
- /* clear flags */
- gpd->sbuffer_size= 0;
- gpd->sbuffer_sflag= 0;
-}
-
/* check if the current mouse position is suitable for adding a new point */
static short gp_stroke_filtermval (tGPsdata *p, short mval[2], short pmval[2])
{
@@ -1615,6 +1475,145 @@ static void gp_stroke_doeraser (tGPsdata *p)
/* ---------- 'Paint' Tool ------------ */
+/* init new painting session */
+static void gp_session_initpaint (tGPsdata *p)
+{
+ /* clear previous data (note: is on stack) */
+ memset(p, 0, sizeof(tGPsdata));
+
+ /* make sure the active view (at the starting time) is a 3d-view */
+ if (curarea == NULL) {
+ p->status= GP_STATUS_ERROR;
+ if (G.f & G_DEBUG)
+ printf("Error: No active view for painting \n");
+ return;
+ }
+ switch (curarea->spacetype) {
+ /* supported views first */
+ case SPACE_VIEW3D:
+ {
+ View3D *v3d= curarea->spacedata.first;
+
+ /* set current area */
+ p->sa= curarea;
+
+ /* check that gpencil data is allowed to be drawn */
+ if ((v3d->flag2 & V3D_DISPGP)==0) {
+ p->status= GP_STATUS_ERROR;
+ if (G.f & G_DEBUG)
+ printf("Error: In active view, Grease Pencil not shown \n");
+ return;
+ }
+ }
+ break;
+ case SPACE_NODE:
+ {
+ SpaceNode *snode= curarea->spacedata.first;
+
+ /* set current area */
+ p->sa= curarea;
+ p->v2d= &snode->v2d;
+
+ /* check that gpencil data is allowed to be drawn */
+ if ((snode->flag & SNODE_DISPGP)==0) {
+ p->status= GP_STATUS_ERROR;
+ if (G.f & G_DEBUG)
+ printf("Error: In active view, Grease Pencil not shown \n");
+ return;
+ }
+ }
+ break;
+ case SPACE_SEQ:
+ {
+ SpaceSeq *sseq= curarea->spacedata.first;
+
+ /* set current area */
+ p->sa= curarea;
+ p->v2d= &sseq->v2d;
+
+ /* check that gpencil data is allowed to be drawn */
+ if (sseq->mainb == 0) {
+ p->status= GP_STATUS_ERROR;
+ if (G.f & G_DEBUG)
+ printf("Error: In active view (sequencer), active mode doesn't support Grease Pencil \n");
+ return;
+ }
+ if ((sseq->flag & SEQ_DRAW_GPENCIL)==0) {
+ p->status= GP_STATUS_ERROR;
+ if (G.f & G_DEBUG)
+ printf("Error: In active view, Grease Pencil not shown \n");
+ return;
+ }
+ }
+ break;
+ case SPACE_IMAGE:
+ {
+ SpaceImage *sima= curarea->spacedata.first;
+
+ /* set the current area */
+ p->sa= curarea;
+ p->v2d= &sima->v2d;
+ p->ibuf= BKE_image_get_ibuf(sima->image, &sima->iuser);
+ }
+ break;
+ /* unsupported views */
+ default:
+ {
+ p->status= GP_STATUS_ERROR;
+ if (G.f & G_DEBUG)
+ printf("Error: Active view not appropriate for Grease Pencil drawing \n");
+ return;
+ }
+ break;
+ }
+
+ /* get gp-data */
+ p->gpd= gpencil_data_getactive(p->sa);
+ if (p->gpd == NULL) {
+ short ok;
+
+ p->gpd= gpencil_data_addnew();
+ ok= gpencil_data_setactive(p->sa, p->gpd);
+
+ /* most of the time, the following check isn't needed */
+ if (ok == 0) {
+ /* free gpencil data as it can't be used */
+ free_gpencil_data(p->gpd);
+ p->gpd= NULL;
+ p->status= GP_STATUS_ERROR;
+ if (G.f & G_DEBUG)
+ printf("Error: Could not assign newly created Grease Pencil data to active area \n");
+ return;
+ }
+ }
+
+ /* set edit flags */
+ G.f |= G_GREASEPENCIL;
+
+ /* clear out buffer (stored in gp-data) in case something contaminated it */
+ gp_session_validatebuffer(p);
+}
+
+/* cleanup after a painting session */
+static void gp_session_cleanup (tGPsdata *p)
+{
+ bGPdata *gpd= p->gpd;
+
+ /* error checking */
+ if (gpd == NULL)
+ return;
+
+ /* free stroke buffer */
+ if (gpd->sbuffer) {
+ MEM_freeN(gpd->sbuffer);
+ gpd->sbuffer= NULL;
+ }
+
+ /* clear flags */
+ gpd->sbuffer_size= 0;
+ gpd->sbuffer_sflag= 0;
+}
+
/* init new stroke */
static void gp_paint_initstroke (tGPsdata *p, short paintmode)
{
diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c
index 4bb7bb9677e..2834a41e9ec 100644
--- a/source/blender/src/header_action.c
+++ b/source/blender/src/header_action.c
@@ -1568,7 +1568,7 @@ static uiBlock *action_markermenu(void *arg_unused)
menuwidth, 19, NULL, 0.0, 0.0, 1, ACTMENU_MARKERS_ADD, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker|Ctrl Shift D", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, ACTMENU_MARKERS_DUPLICATE, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|X", 0, yco-=20,
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|Shift X", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, ACTMENU_MARKERS_DELETE, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
diff --git a/source/blender/src/header_ipo.c b/source/blender/src/header_ipo.c
index c2f84e1c444..27549a5b502 100644
--- a/source/blender/src/header_ipo.c
+++ b/source/blender/src/header_ipo.c
@@ -923,7 +923,7 @@ static uiBlock *ipo_markermenu(void *arg_unused)
menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker|Ctrl Shift D", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|X", 0, yco-=20,
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|Shift X", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
diff --git a/source/blender/src/header_nla.c b/source/blender/src/header_nla.c
index 13bbf0a3999..d0031b2db7c 100644
--- a/source/blender/src/header_nla.c
+++ b/source/blender/src/header_nla.c
@@ -441,7 +441,7 @@ static uiBlock *nla_markermenu(void *arg_unused)
menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker|Ctrl Shift D", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|X", 0, yco-=20,
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|Shift X", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
diff --git a/source/blender/src/header_seq.c b/source/blender/src/header_seq.c
index e5a63b9fe45..8138918877f 100644
--- a/source/blender/src/header_seq.c
+++ b/source/blender/src/header_seq.c
@@ -600,7 +600,7 @@ static uiBlock *seq_markermenu(void *arg_unused)
menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker|Ctrl Shift D", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker", 0, yco-=20,
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|Shift X", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
diff --git a/source/blender/src/header_text.c b/source/blender/src/header_text.c
index eeea43ec57a..9bb59a81192 100644
--- a/source/blender/src/header_text.c
+++ b/source/blender/src/header_text.c
@@ -36,6 +36,18 @@
#include <string.h>
#include <stdio.h>
+/* file time checking */
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#ifndef _WIN32
+#include <unistd.h>
+#else
+#include <io.h>
+#include "BLI_winstuff.h"
+#endif
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -70,12 +82,16 @@
#include "BSE_filesel.h"
+#include "BLI_blenlib.h"
+
#include "BPY_extern.h"
#include "BPY_menus.h"
#include "blendef.h"
#include "mydevice.h"
+extern void redraw_alltext(void); /* defined in drawtext.c */
+
void do_text_buttons(unsigned short event)
{
SpaceText *st= curarea->spacedata.first; /* bad but cant pass as an arg here */
@@ -283,7 +299,6 @@ static void do_text_filemenu(void *arg, int event)
{
SpaceText *st= curarea->spacedata.first; /* bad but cant pass as an arg here */
Text *text;
- ScrArea *sa;
if (st==NULL || st->spacetype != SPACE_TEXT) return;
@@ -362,12 +377,8 @@ static void do_text_filemenu(void *arg, int event)
default:
break;
}
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- SpaceText *st= sa->spacedata.first;
- if (st && st->spacetype==SPACE_TEXT) {
- scrarea_queue_redraw(sa);
- }
- }
+
+ redraw_alltext();
}
/* action executed after clicking in Edit menu */
@@ -375,7 +386,6 @@ static void do_text_editmenu(void *arg, int event)
{
SpaceText *st= curarea->spacedata.first; /* bad but cant pass as an arg here */
Text *text;
- ScrArea *sa;
if (st==NULL || st->spacetype != SPACE_TEXT) return;
@@ -428,12 +438,7 @@ static void do_text_editmenu(void *arg, int event)
break;
}
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- SpaceText *st= sa->spacedata.first;
- if (st && st->spacetype==SPACE_TEXT) {
- scrarea_queue_redraw(sa);
- }
- }
+ redraw_alltext();
}
/* action executed after clicking in View menu */
@@ -441,7 +446,6 @@ static void do_text_editmenu_viewmenu(void *arg, int event)
{
SpaceText *st= curarea->spacedata.first; /* bad but cant pass as an arg here */
Text *text;
- ScrArea *sa;
if (st==NULL || st->spacetype != SPACE_TEXT) return;
@@ -459,13 +463,8 @@ static void do_text_editmenu_viewmenu(void *arg, int event)
default:
break;
}
-
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- SpaceText *st= sa->spacedata.first;
- if (st && st->spacetype==SPACE_TEXT) {
- scrarea_queue_redraw(sa);
- }
- }
+
+ redraw_alltext();
}
/* action executed after clicking in Select menu */
@@ -473,7 +472,6 @@ static void do_text_editmenu_selectmenu(void *arg, int event)
{
SpaceText *st= curarea->spacedata.first; /* bad but cant pass as an arg here */
Text *text;
- ScrArea *sa;
if (st==NULL || st->spacetype != SPACE_TEXT) return;
@@ -490,12 +488,7 @@ static void do_text_editmenu_selectmenu(void *arg, int event)
break;
}
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- SpaceText *st= sa->spacedata.first;
- if (st && st->spacetype==SPACE_TEXT) {
- scrarea_queue_redraw(sa);
- }
- }
+ redraw_alltext();
}
/* action executed after clicking in Markers menu */
@@ -504,7 +497,6 @@ static void do_text_editmenu_markermenu(void *arg, int event)
SpaceText *st= curarea->spacedata.first; /* bad but cant pass as an arg here */
Text *text;
TextMarker *mrk;
- ScrArea *sa;
int lineno;
if (st==NULL || st->spacetype != SPACE_TEXT) return;
@@ -541,12 +533,7 @@ static void do_text_editmenu_markermenu(void *arg, int event)
break;
}
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- SpaceText *st= sa->spacedata.first;
- if (st && st->spacetype==SPACE_TEXT) {
- scrarea_queue_redraw(sa);
- }
- }
+ redraw_alltext();
}
/* action executed after clicking in Format menu */
@@ -554,7 +541,6 @@ static void do_text_formatmenu(void *arg, int event)
{
SpaceText *st= curarea->spacedata.first; /* bad but cant pass as an arg here */
Text *text;
- ScrArea *sa;
if (st==NULL || st->spacetype != SPACE_TEXT) return;
@@ -614,12 +600,7 @@ static void do_text_formatmenu(void *arg, int event)
break;
}
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- SpaceText *st= sa->spacedata.first;
- if (st && st->spacetype==SPACE_TEXT) {
- scrarea_queue_redraw(sa);
- }
- }
+ redraw_alltext();
}
/* View menu */
@@ -861,6 +842,128 @@ static uiBlock *text_filemenu(void *arg_unused)
return block;
}
+
+/* text sync functions */
+
+/* returns 0 if file on disk is the same or Text is in memory only
+ returns 1 if file has been modified on disk since last local edit
+ returns 2 if file on disk has been deleted
+ -1 is returned if an error occurs
+*/
+static int txt_file_modified(Text *text)
+{
+ struct stat st;
+ int result;
+ char file[FILE_MAXDIR+FILE_MAXFILE];
+
+ if (!text || !text->name)
+ return 0;
+
+ BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE);
+ BLI_convertstringcode(file, G.sce);
+
+ if (!BLI_exists(file))
+ return 2;
+
+ result = stat(file, &st);
+
+ if(result == -1)
+ return -1;
+
+ if((st.st_mode & S_IFMT) != S_IFREG)
+ return -1;
+
+ if (st.st_mtime > text->mtime)
+ return 1;
+
+ return 0;
+}
+
+static void txt_ignore_modified(Text *text) {
+ struct stat st;
+ int result;
+ char file[FILE_MAXDIR+FILE_MAXFILE];
+
+ if (!text || !text->name) return;
+
+ BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE);
+ BLI_convertstringcode(file, G.sce);
+
+ if (!BLI_exists(file)) return;
+
+ result = stat(file, &st);
+
+ if(result == -1 || (st.st_mode & S_IFMT) != S_IFREG)
+ return;
+
+ text->mtime= st.st_mtime;
+}
+
+static short do_modification_check(SpaceText *st_v) {
+ SpaceText *st = (SpaceText *)st_v;
+ Text *text= st->text;
+
+ switch (txt_file_modified(text)) {
+ case 1:
+ /* Modified locally and externally, ahhh. Offer more possibilites. */
+ if (text->flags & TXT_ISDIRTY) {
+ switch (pupmenu("File Modified Outside and Inside Blender %t|Load outside changes (ignore local changes) %x0|Save local changes (ignore outside changes) %x1|Make text internal (separate copy) %x2")) {
+ case 0:
+ reopen_text(text);
+ if (st->showsyntax) txt_format_text(st);
+ return 1;
+ case 1:
+ txt_write_file(text);
+ return 1;
+ case 2:
+ text->flags |= TXT_ISMEM | TXT_ISDIRTY | TXT_ISTMP;
+ MEM_freeN(text->name);
+ text->name= NULL;
+ return 1;
+ }
+ } else {
+ switch (pupmenu("File Modified Outside Blender %t|Reload from disk %x0|Make text internal (separate copy) %x1|Ignore %x2")) {
+ case 0:
+ if (text->compiled) BPY_free_compiled_text(text);
+ text->compiled = NULL;
+ reopen_text(text);
+ if (st->showsyntax) txt_format_text(st);
+ return 1;
+ case 1:
+ text->flags |= TXT_ISMEM | TXT_ISDIRTY | TXT_ISTMP;
+ MEM_freeN(text->name);
+ text->name= NULL;
+ return 1;
+ case 2:
+ txt_ignore_modified(text);
+ return 1;
+ }
+ }
+ break;
+ case 2:
+ switch (pupmenu("File Deleted Outside Blender %t|Make text internal %x0|Recreate file %x1")) {
+ case 0:
+ text->flags |= TXT_ISMEM | TXT_ISDIRTY | TXT_ISTMP;
+ MEM_freeN(text->name);
+ text->name= NULL;
+ return 1;
+ case 1:
+ txt_write_file(text);
+ return 1;
+ }
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
+
+static void do_modification_func(void *st_v, void *dummy)
+{
+ if (do_modification_check((SpaceText *)st_v))
+ redraw_alltext();
+}
+
/* header */
#define HEADER_PATH_MAX 260
void text_buttons(void)
@@ -905,8 +1008,8 @@ void text_buttons(void)
if((curarea->flag & HEADER_NO_PULLDOWN)==0) {
uiBlockSetEmboss(block, UI_EMBOSSP);
- xmax= GetButStringLength("File");
- uiDefPulldownBut(block,text_filemenu, NULL, "File", xco, 0, xmax, 20, "");
+ xmax= GetButStringLength("Text");
+ uiDefPulldownBut(block,text_filemenu, NULL, "Text", xco, 0, xmax, 20, "");
xco+=xmax;
if(text) {
@@ -933,10 +1036,21 @@ void text_buttons(void)
uiDefIconButI(block, ICONTOG, B_TEXTPLUGINS, ICON_PYTHON, xco+=XIC,0,XIC,YIC, &st->doplugins, 0, 0, 0, 0, "Enables Python text plugins");
uiBlockEndAlign(block);
+ /* Warning button if text is out of date*/
+ if (text && txt_file_modified(text)) {
+ uiBut *bt;
+ xco+= XIC;
+ uiBlockSetCol(block, TH_REDALERT);
+ bt= uiDefIconBut(block, BUT, B_NOP, ICON_HELP, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "External text is out of sync, click for options to resolve the conflict");
+ uiButSetFunc(bt, do_modification_func, (void *)st, NULL);
+ uiBlockSetCol(block, TH_AUTO);
+ }
+
/* STD TEXT BUTTONS */
xco+= 2*XIC;
xco= std_libbuttons(block, xco, 0, 0, NULL, B_TEXTBROWSE, ID_TXT, 0, (ID*)st->text, 0, &(st->menunr), 0, 0, B_TEXTDELETE, 0, 0);
-
+ xco+=XIC;
+
/*
if (st->text) {
if (st->text->flags & TXT_ISDIRTY && (st->text->flags & TXT_ISEXT || !(st->text->flags & TXT_ISMEM)))
@@ -949,7 +1063,7 @@ void text_buttons(void)
}
*/
- xco+=XIC;
+
if(st->font_id>1) st->font_id= 0;
uiDefButI(block, MENU, B_TEXTFONT, "Screen 12 %x0|Screen 15%x1", xco,0,100,YIC, &st->font_id, 0, 0, 0, 0, "Displays available fonts");
xco+=110;
diff --git a/source/blender/src/header_time.c b/source/blender/src/header_time.c
index 9a77a4c44eb..51f71e5bdab 100644
--- a/source/blender/src/header_time.c
+++ b/source/blender/src/header_time.c
@@ -45,6 +45,7 @@
#include "BIF_gl.h"
#include "BIF_interface.h"
+#include "BIF_keyframing.h"
#include "BIF_resources.h"
#include "BIF_screen.h"
#include "BIF_space.h"
@@ -130,6 +131,17 @@ void do_time_buttons(ScrArea *sa, unsigned short event)
BIF_undo_push("Set anim-preview range");
allqueue(REDRAWALL, 0);
break;
+
+ case B_TL_INSERTKEY:
+ /* insert keyframe */
+ common_insertkey();
+ allqueue(REDRAWTIME, 1);
+ break;
+ case B_TL_DELETEKEY:
+ /* delete keyframe */
+ common_deletekey();
+ allqueue(REDRAWTIME, 1);
+ break;
}
}
@@ -542,21 +554,31 @@ void time_buttons(ScrArea *sa)
xco+= XIC+8;
uiDefIconButBitS(block, TOG, AUTOKEY_ON, REDRAWINFO, ICON_REC,
- xco, 0, XIC, YIC, &(U.autokey_mode), 0, 0, 0, 0, "Automatic keyframe insertion for Objects and Bones");
+ xco, 0, XIC, YIC, &(G.scene->autokey_mode), 0, 0, 0, 0, "Automatic keyframe insertion for Objects and Bones");
xco+= XIC;
if (IS_AUTOKEY_ON) {
uiDefButS(block, MENU, REDRAWINFO,
"Auto-Keying Mode %t|Add/Replace Keys%x3|Replace Keys %x5",
- xco, 0, 3*XIC, YIC, &(U.autokey_mode), 0, 1, 0, 0,
+ xco, 0, 3.5*XIC, YIC, &(G.scene->autokey_mode), 0, 1, 0, 0,
"Mode of automatic keyframe insertion for Objects and Bones");
xco+= (4*XIC);
}
xco+= 16;
-
+
+ uiDefIconBut(block, BUT, B_TL_INSERTKEY, ICON_KEY_HLT,
+ xco, 0, XIC, YIC, 0, 0, 0, 0, 0, "Insert Keyframe for the context of the largest area (IKEY)");
+ xco+= XIC+4;
+ uiDefIconBut(block, BUT, B_TL_DELETEKEY, ICON_KEY_DEHLT,
+ xco, 0, XIC, YIC, 0, 0, 0, 0, 0, "Delete Keyframe for the context of the largest area (ALTKEY-IKEY)");
+ xco+= XIC+4;
+
+ xco+= 16;
+
uiDefIconButBitI(block, TOG, TIME_WITH_SEQ_AUDIO, B_DIFF, ICON_SPEAKER,
xco, 0, XIC, YIC, &(stime->redraws), 0, 0, 0, 0, "Play back and sync with audio from Sequence Editor");
+
/* always as last */
sa->headbutlen= xco+XIC+80; // +80 because the last button is not an icon
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index a2b2af05083..e77b477e6ce 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -131,9 +131,6 @@ static void *UIafterfunc_arg1, *UIafterfunc_arg2;
static uiFont UIfont[UI_ARRAY]; // no init needed
uiBut *UIbuttip;
-static char but_copypaste_str[256]="";
-static double but_copypaste_val=0.0;
-static float but_copypaste_rgb[3];
static ColorBand but_copypaste_coba;
/* ************* PROTOTYPES ***************** */
@@ -470,64 +467,92 @@ void ui_block_set_flush(uiBlock *block, uiBut *but)
static int ui_but_copy_paste(uiBut *but, char mode)
{
void *poin;
+ char buf[UI_MAX_DRAW_STR+1];
+ double val;
+ float f[3];
if(mode=='v' && but->lock) return 0;
poin= but->poin;
-
+
+ if(mode=='v') {
+ /* extract first line from clipboard in case of multi-line copies */
+ char *p = getClipboard(0);
+ int i = 0;
+ while (*p && *p!='\r' && *p!='\n' && i<UI_MAX_DRAW_STR) {
+ buf[i++]=*p;
+ p++;
+ }
+ buf[i]= 0;
+ }
+
+ /* numeric value */
if ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI) {
if(poin==NULL);
else if(mode=='c') {
- but_copypaste_val= ui_get_but_val(but);
+ sprintf(buf, "%f", ui_get_but_val(but));
+ putClipboard(buf, 0);
}
else {
- ui_set_but_val(but, but_copypaste_val);
- uibut_do_func(but);
- ui_check_but(but);
- return 1;
+ if (sscanf(buf, " %lf ", &val) == 1) {
+ ui_set_but_val(but, val);
+ uibut_do_func(but);
+ ui_check_but(but);
+ return 1;
+ }
}
}
+
+ /* RGB triple */
else if(but->type==COL) {
if(poin==NULL);
else if(mode=='c') {
if(but->pointype==FLO) {
float *fp= (float *) poin;
- but_copypaste_rgb[0]= fp[0];
- but_copypaste_rgb[1]= fp[1];
- but_copypaste_rgb[2]= fp[2];
+ sprintf(buf, "[%f, %f, %f]", fp[0], fp[1], fp[2]);
+ putClipboard(buf, 0);
}
else if (but->pointype==CHA) {
char *cp= (char *) poin;
- but_copypaste_rgb[0]= (float)(cp[0]/255.0);
- but_copypaste_rgb[1]= (float)(cp[1]/255.0);
- but_copypaste_rgb[2]= (float)(cp[2]/255.0);
+ f[0]= (float)(cp[0]/255.0);
+ f[1]= (float)(cp[1]/255.0);
+ f[2]= (float)(cp[2]/255.0);
+ sprintf(buf, "[%f, %f, %f]", f[0], f[1], f[2]);
+ putClipboard(buf, 0);
}
}
else {
if(but->pointype==FLO) {
float *fp= (float *) poin;
- fp[0] = but_copypaste_rgb[0];
- fp[1] = but_copypaste_rgb[1];
- fp[2] = but_copypaste_rgb[2];
- return 1;
+ if (sscanf(buf, "[%f, %f, %f]", &f[0], &f[1], &f[2]) == 3) {
+ fp[0]= f[0];
+ fp[1]= f[1];
+ fp[2]= f[2];
+ return 1;
+ }
}
else if (but->pointype==CHA) {
char *cp= (char *) poin;
- cp[0] = (char)(but_copypaste_rgb[0]*255.0);
- cp[1] = (char)(but_copypaste_rgb[1]*255.0);
- cp[2] = (char)(but_copypaste_rgb[2]*255.0);
-
- return 1;
+ if (sscanf(buf, "[%f, %f, %f]", &f[0], &f[1], &f[2]) == 3) {
+ cp[0]= (char)(f[0]*255.0);
+ cp[1]= (char)(f[1]*255.0);
+ cp[2]= (char)(f[2]*255.0);
+ return 1;
+ }
}
}
}
+
+ /* text/string data */
else if(but->type==TEX) {
if(poin==NULL);
else if(mode=='c') {
- strncpy(but_copypaste_str, but->poin, but->max);
+ strncpy(buf, but->poin, but->max);
+ buf[(int)but->max]= 0;
+ putClipboard(buf, 0);
}
else {
char backstr[UI_MAX_DRAW_STR];
@@ -537,23 +562,31 @@ static int ui_but_copy_paste(uiBut *but, char mode)
strncpy(backstr, but->poin, UI_MAX_DRAW_STR);
but->func_arg2= backstr;
}
- strncpy(but->poin, but_copypaste_str, but->max);
+ strncpy(but->poin, buf, but->max);
uibut_do_func(but);
ui_check_but(but);
return 1;
}
}
+
+ /* ID name string (eg. OB:Object = "Object") */
else if(but->type==IDPOIN) {
if(mode=='c') {
ID *id= *but->idpoin_idpp;
- if(id) strncpy(but_copypaste_str, id->name+2, 22);
+ if(id) {
+ strncpy(buf, id->name+2, 22);
+ buf[22]= 0;
+ putClipboard(buf, 0);
+ }
}
else {
- but->idpoin_func(but_copypaste_str, but->idpoin_idpp);
+ but->idpoin_func(buf, but->idpoin_idpp);
ui_check_but(but);
return 1;
}
}
+
+ /* colorband (not supported by system clipboard) */
else if(but->type==BUT_COLORBAND) {
if(mode=='c') {
if (!but->poin) {
@@ -1771,36 +1804,47 @@ static int ui_do_but_TEX(uiBut *but)
((G.qual & LR_COMMANDKEY) || (G.qual & LR_CTRLKEY)) &&
((dev==XKEY) || (dev==CKEY) || (dev==VKEY)) ) {
+ char buf[UI_MAX_DRAW_STR];
/* paste */
if (dev==VKEY) {
+
+ /* extract the first line from the clipboard */
+ char *p = getClipboard(0);
+ int i = 0;
+ while (*p && *p!='\r' && *p!='\n' && i<UI_MAX_DRAW_STR) {
+ buf[i++]=*p;
+ p++;
+ }
+ buf[i]= 0;
+
/* paste over the current selection */
if ((but->selend - but->selsta) > 0) {
len -= ui_delete_selection_edittext(but);
}
- for (y=0; y<strlen(but_copypaste_str); y++)
+ for (y=0; y<strlen(buf); y++)
{
/* add contents of buffer */
if(len < but->max) {
for(x= but->max; x>but->pos; x--)
str[x]= str[x-1];
- str[but->pos]= but_copypaste_str[y];
+ str[but->pos]= buf[y];
but->pos++;
len++;
str[len]= '\0';
}
}
- if (strlen(but_copypaste_str) > 0) dodraw= 1;
+ if (strlen(buf) > 0) dodraw= 1;
}
/* cut & copy */
else if ( (dev==XKEY) || (dev==CKEY) ) {
/* copy the contents to the copypaste buffer */
for(x= but->selsta; x <= but->selend; x++) {
if (x==but->selend)
- but_copypaste_str[x] = '\0';
+ buf[x] = '\0';
else
- but_copypaste_str[(x - but->selsta)] = str[x];
+ buf[(x - but->selsta)] = str[x];
}
/* for cut only, delete the selection afterwards */
diff --git a/source/blender/src/keyframing.c b/source/blender/src/keyframing.c
index c62032cd9d6..90a49ccbff3 100644
--- a/source/blender/src/keyframing.c
+++ b/source/blender/src/keyframing.c
@@ -334,7 +334,7 @@ void insert_vert_icu (IpoCurve *icu, float x, float y, short fast)
/* Get pointer to use to get values from */
// FIXME: this should not be possible with Data-API
-static void *get_context_ipo_poin(ID *id, int blocktype, char *actname, char *constname, IpoCurve *icu, int *vartype)
+static void *get_context_ipo_poin (ID *id, int blocktype, char *actname, char *constname, IpoCurve *icu, int *vartype)
{
switch (blocktype) {
case ID_PO: /* posechannel */
@@ -602,6 +602,9 @@ static short visualkey_can_use (ID *id, int blocktype, char *actname, char *cons
case CONSTRAINT_TYPE_ROTLIKE:
if (searchtype==VISUALKEY_ROT) return 1;
break;
+ case CONSTRAINT_TYPE_DISTLIMIT:
+ if (searchtype==VISUALKEY_LOC) return 1;
+ break;
case CONSTRAINT_TYPE_LOCLIKE:
if (searchtype==VISUALKEY_LOC) return 1;
break;
@@ -644,7 +647,7 @@ static float visualkey_get_value (ID *id, int blocktype, char *actname, char *co
/* parented objects are not supported, as the effects of the parent
* are included in the matrix, which kindof beats the point
*/
- if ((ob) && (ob->parent==NULL)) {
+ if (ob->parent == NULL) {
/* only Location or Rotation keyframes are supported now */
if (ELEM3(adrcode, OB_LOC_X, OB_LOC_Y, OB_LOC_Z)) {
/* assumes that OB_LOC_Z > OB_LOC_Y > OB_LOC_X */
@@ -690,7 +693,7 @@ static float visualkey_get_value (ID *id, int blocktype, char *actname, char *co
return tmat[3][index];
}
else if (ELEM4(adrcode, AC_QUAT_W, AC_QUAT_X, AC_QUAT_Y, AC_QUAT_Z)) {
- float tmat[4][4], trimat[3][3], quat[4];
+ float trimat[3][3], quat[4];
/* assumes that AC_QUAT_Z > AC_QUAT_Y > AC_QUAT_X > AC_QUAT_W */
index= adrcode - AC_QUAT_W;
@@ -732,8 +735,6 @@ short insertkey (ID *id, int blocktype, char *actname, char *constname, int adrc
if (icu) {
float cfra = frame_to_float(CFRA);
float curval= 0.0f;
- void *poin = NULL;
- int vartype;
/* apply special time tweaking */
if (GS(id->name) == ID_OB) {
@@ -750,10 +751,6 @@ short insertkey (ID *id, int blocktype, char *actname, char *constname, int adrc
}
}
- /* get pointer to data to read from */
- poin= get_context_ipo_poin(id, blocktype, actname, constname, icu, &vartype);
- if (poin == NULL) return 0;
-
/* obtain value to give keyframe */
if ( (flag & INSERTKEY_MATRIX) &&
(visualkey_can_use(id, blocktype, actname, constname, adrcode)) )
@@ -765,6 +762,16 @@ short insertkey (ID *id, int blocktype, char *actname, char *constname, int adrc
curval= visualkey_get_value(id, blocktype, actname, constname, adrcode, icu);
}
else {
+ void *poin;
+ int vartype;
+
+ /* get pointer to data to read from */
+ poin = get_context_ipo_poin(id, blocktype, actname, constname, icu, &vartype);
+ if (poin == NULL) {
+ printf("Insert Key: No pointer to variable obtained \n");
+ return 0;
+ }
+
/* use kt's read_poin function to extract value (kt->read_poin should
* exist in all cases, but it never hurts to check)
*/
@@ -779,7 +786,7 @@ short insertkey (ID *id, int blocktype, char *actname, char *constname, int adrc
insert_mode= new_key_needed(icu, cfra, curval);
/* insert new keyframe at current frame */
- if (insert_mode)
+ if (insert_mode)
insert_vert_icu(icu, cfra, curval, (flag & INSERTKEY_FAST));
/* delete keyframe immediately before/after newly added */
@@ -791,14 +798,18 @@ short insertkey (ID *id, int blocktype, char *actname, char *constname, int adrc
delete_icu_key(icu, 1, 1);
break;
}
+
+ /* only return success if keyframe added */
+ if (insert_mode)
+ return 1;
}
else {
/* just insert keyframe */
insert_vert_icu(icu, cfra, curval, (flag & INSERTKEY_FAST));
+
+ /* return success */
+ return 1;
}
-
- /* return success */
- return 1;
}
/* return failure */
@@ -878,6 +889,11 @@ short deletekey (ID *id, int blocktype, char *actname, char *constname, int adrc
/* ************************************************** */
/* COMMON KEYFRAME MANAGEMENT (common_insertkey/deletekey) */
+/* mode for common_modifykey */
+enum {
+ COMMONKEY_MODE_INSERT = 0,
+ COMMONKEY_MODE_DELETE,
+} eCommonModifyKey_Modes;
/* ------------- KeyingSet Defines ------------ */
/* Note: these must all be named with the defks_* prefix, otherwise the template macro will not work! */
@@ -1009,7 +1025,7 @@ bKeyingSet defks_v3d_pchan[] =
{incl_non_del_keys, "%l", 0, -1, 0, {0}}, // separator
{incl_non_del_keys, "VisualLoc", ID_PO, INSERTKEY_MATRIX, 3, {AC_LOC_X,AC_LOC_Y,AC_LOC_Z}},
- {incl_non_del_keys, "VisualRot", ID_PO, INSERTKEY_MATRIX, 3, {AC_QUAT_W,AC_QUAT_X,AC_QUAT_Y,AC_QUAT_Z}},
+ {incl_non_del_keys, "VisualRot", ID_PO, INSERTKEY_MATRIX, 4, {AC_QUAT_W,AC_QUAT_X,AC_QUAT_Y,AC_QUAT_Z}},
{incl_non_del_keys, "VisualLocRot", ID_PO, INSERTKEY_MATRIX, 7,
{AC_LOC_X,AC_LOC_Y,AC_LOC_Z,AC_QUAT_W,
@@ -1046,10 +1062,10 @@ bKeyingSet defks_buts_shading_mat[] =
{NULL, "%l", 0, -1, 0, {0}}, // separator
- {NULL, "Ofs", ID_MA, 0, 3, {MAP_OFS_X,MAP_OFS_Y,MAP_OFS_Z}},
- {NULL, "Size", ID_MA, 0, 3, {MAP_SIZE_X,MAP_SIZE_Y,MAP_SIZE_Z}},
+ {NULL, "Ofs", ID_MA, COMMONKEY_ADDMAP, 3, {MAP_OFS_X,MAP_OFS_Y,MAP_OFS_Z}},
+ {NULL, "Size", ID_MA, COMMONKEY_ADDMAP, 3, {MAP_SIZE_X,MAP_SIZE_Y,MAP_SIZE_Z}},
- {NULL, "All Mapping", ID_MA, 0, 14,
+ {NULL, "All Mapping", ID_MA, COMMONKEY_ADDMAP, 14,
{MAP_OFS_X,MAP_OFS_Y,MAP_OFS_Z,
MAP_SIZE_X,MAP_SIZE_Y,MAP_SIZE_Z,
MAP_R,MAP_G,MAP_B,MAP_DVAR,
@@ -1077,10 +1093,10 @@ bKeyingSet defks_buts_shading_wo[] =
{NULL, "%l", 0, -1, 0, {0}}, // separator
- {NULL, "Ofs", ID_WO, 0, 3, {MAP_OFS_X,MAP_OFS_Y,MAP_OFS_Z}},
- {NULL, "Size", ID_WO, 0, 3, {MAP_SIZE_X,MAP_SIZE_Y,MAP_SIZE_Z}},
+ {NULL, "Ofs", ID_WO, COMMONKEY_ADDMAP, 3, {MAP_OFS_X,MAP_OFS_Y,MAP_OFS_Z}},
+ {NULL, "Size", ID_WO, COMMONKEY_ADDMAP, 3, {MAP_SIZE_X,MAP_SIZE_Y,MAP_SIZE_Z}},
- {NULL, "All Mapping", ID_WO, 0, 14,
+ {NULL, "All Mapping", ID_WO, COMMONKEY_ADDMAP, 14,
{MAP_OFS_X,MAP_OFS_Y,MAP_OFS_Z,
MAP_SIZE_X,MAP_SIZE_Y,MAP_SIZE_Z,
MAP_R,MAP_G,MAP_B,MAP_DVAR,
@@ -1103,10 +1119,10 @@ bKeyingSet defks_buts_shading_la[] =
{NULL, "%l", 0, -1, 0, {0}}, // separator
- {NULL, "Ofs", ID_LA, 0, 3, {MAP_OFS_X,MAP_OFS_Y,MAP_OFS_Z}},
- {NULL, "Size", ID_LA, 0, 3, {MAP_SIZE_X,MAP_SIZE_Y,MAP_SIZE_Z}},
+ {NULL, "Ofs", ID_LA, COMMONKEY_ADDMAP, 3, {MAP_OFS_X,MAP_OFS_Y,MAP_OFS_Z}},
+ {NULL, "Size", ID_LA, COMMONKEY_ADDMAP, 3, {MAP_SIZE_X,MAP_SIZE_Y,MAP_SIZE_Z}},
- {NULL, "All Mapping", ID_LA, 0, 14,
+ {NULL, "All Mapping", ID_LA, COMMONKEY_ADDMAP, 14,
{MAP_OFS_X,MAP_OFS_Y,MAP_OFS_Z,
MAP_SIZE_X,MAP_SIZE_Y,MAP_SIZE_Z,
MAP_R,MAP_G,MAP_B,MAP_DVAR,
@@ -1359,71 +1375,79 @@ static void commonkey_context_getsbuts (ListBase *sources, bKeyingContext **ksc)
{
Material *ma= editnode_get_active_material(G.buts->lockpoin);
- /* add new keyframing destination */
- cks= MEM_callocN(sizeof(bCommonKeySrc), "bCommonKeySrc");
- BLI_addtail(sources, cks);
-
- /* set data */
- cks->id= (ID *)ma;
- cks->ipo= ma->ipo;
- cks->map= texchannel_to_adrcode(ma->texact);
-
- /* set keyingsets */
- *ksc= &ks_contexts[KSC_BUTS_MAT];
- return;
+ if (ma) {
+ /* add new keyframing destination */
+ cks= MEM_callocN(sizeof(bCommonKeySrc), "bCommonKeySrc");
+ BLI_addtail(sources, cks);
+
+ /* set data */
+ cks->id= (ID *)ma;
+ cks->ipo= ma->ipo;
+ cks->map= texchannel_to_adrcode(ma->texact);
+
+ /* set keyingsets */
+ *ksc= &ks_contexts[KSC_BUTS_MAT];
+ return;
+ }
}
break;
case TAB_SHADING_WORLD: /* >------------- World Tab -------------< */
{
World *wo= G.buts->lockpoin;
- /* add new keyframing destination */
- cks= MEM_callocN(sizeof(bCommonKeySrc), "bCommonKeySrc");
- BLI_addtail(sources, cks);
-
- /* set data */
- cks->id= (ID *)wo;
- cks->ipo= wo->ipo;
- cks->map= texchannel_to_adrcode(wo->texact);
-
- /* set keyingsets */
- *ksc= &ks_contexts[KSC_BUTS_WO];
- return;
+ if (wo) {
+ /* add new keyframing destination */
+ cks= MEM_callocN(sizeof(bCommonKeySrc), "bCommonKeySrc");
+ BLI_addtail(sources, cks);
+
+ /* set data */
+ cks->id= (ID *)wo;
+ cks->ipo= wo->ipo;
+ cks->map= texchannel_to_adrcode(wo->texact);
+
+ /* set keyingsets */
+ *ksc= &ks_contexts[KSC_BUTS_WO];
+ return;
+ }
}
break;
case TAB_SHADING_LAMP: /* >------------- Lamp Tab -------------< */
{
Lamp *la= G.buts->lockpoin;
- /* add new keyframing destination */
- cks= MEM_callocN(sizeof(bCommonKeySrc), "bCommonKeySrc");
- BLI_addtail(sources, cks);
-
- /* set data */
- cks->id= (ID *)la;
- cks->ipo= la->ipo;
- cks->map= texchannel_to_adrcode(la->texact);
-
- /* set keyingsets */
- *ksc= &ks_contexts[KSC_BUTS_LA];
- return;
+ if (la) {
+ /* add new keyframing destination */
+ cks= MEM_callocN(sizeof(bCommonKeySrc), "bCommonKeySrc");
+ BLI_addtail(sources, cks);
+
+ /* set data */
+ cks->id= (ID *)la;
+ cks->ipo= la->ipo;
+ cks->map= texchannel_to_adrcode(la->texact);
+
+ /* set keyingsets */
+ *ksc= &ks_contexts[KSC_BUTS_LA];
+ return;
+ }
}
break;
case TAB_SHADING_TEX: /* >------------- Texture Tab -------------< */
{
Tex *tex= G.buts->lockpoin;
- /* add new keyframing destination */
- cks= MEM_callocN(sizeof(bCommonKeySrc), "bCommonKeySrc");
- BLI_addtail(sources, cks);
-
- /* set data */
- cks->id= (ID *)tex;
- cks->ipo= tex->ipo;
-
- /* set keyingsets */
- *ksc= &ks_contexts[KSC_BUTS_TEX];
- return;
+ if (tex) {
+ /* add new keyframing destination */
+ cks= MEM_callocN(sizeof(bCommonKeySrc), "bCommonKeySrc");
+ BLI_addtail(sources, cks);
+
+ /* set data */
+ cks->id= (ID *)tex;
+ cks->ipo= tex->ipo;
+
+ /* set keyingsets */
+ *ksc= &ks_contexts[KSC_BUTS_TEX];
+ return;
+ }
}
break;
}
@@ -1478,18 +1502,66 @@ static void commonkey_context_getsbuts (ListBase *sources, bKeyingContext **ksc)
/* get keyingsets for appropriate context */
-static void commonkey_context_get (ListBase *sources, bKeyingContext **ksc)
+static void commonkey_context_get (ScrArea *sa, short mode, ListBase *sources, bKeyingContext **ksc)
{
/* check view type */
- switch (curarea->spacetype) {
+ switch (sa->spacetype) {
/* 3d view - first one tested as most often used */
case SPACE_VIEW3D:
+ {
commonkey_context_getv3d(sources, ksc);
+ }
break;
/* buttons view */
case SPACE_BUTS:
+ {
commonkey_context_getsbuts(sources, ksc);
+ }
+ break;
+
+ /* spaces with their own methods */
+ case SPACE_IPO:
+ if (mode == COMMONKEY_MODE_INSERT)
+ insertkey_editipo();
+ return;
+ case SPACE_ACTION:
+ if (mode == COMMONKEY_MODE_INSERT)
+ insertkey_action();
+ return;
+
+ /* timeline view - keyframe buttons */
+ case SPACE_TIME:
+ {
+ ScrArea *sab;
+ int bigarea= 0;
+
+ /* try to find largest 3d-view available
+ * (mostly of the time, this is what when user will want this,
+ * as it's a standard feature in all other apps)
+ */
+ sab= find_biggest_area_of_type(SPACE_VIEW3D);
+ if (sab) {
+ commonkey_context_getv3d(sources, ksc);
+ return;
+ }
+
+ /* if not found, sab is now NULL, so perform own biggest area test */
+ for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
+ int area= sa->winx * sa->winy;
+
+ if (sa->spacetype != SPACE_TIME) {
+ if ( (!sab) || (area > bigarea) ) {
+ sab= sa;
+ bigarea= area;
+ }
+ }
+ }
+
+ /* use whichever largest area was found (it shouldn't be a time window) */
+ if (sab)
+ commonkey_context_get(sab, mode, sources, ksc);
+ }
break;
}
}
@@ -1547,6 +1619,15 @@ static void commonkey_context_refresh (void)
allqueue(REDRAWMARKER, 0);
}
break;
+
+ /* buttons window */
+ case SPACE_BUTS:
+ {
+ allspace(REMAKEIPO, 0);
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWMARKER, 0);
+ }
+ break;
}
}
@@ -1618,12 +1699,6 @@ static bKeyingSet *get_keyingset_fromcontext (bKeyingContext *ksc, short index)
/* ---------------- Keyframe Management API -------------------- */
-/* mode for common_modifykey */
-enum {
- COMMONKEY_MODE_INSERT = 0,
- COMMONKEY_MODE_DELETE,
-} eCommonModifyKey_Modes;
-
/* Display a menu for handling the insertion of keyframes based on the active view */
// TODO: add back an option for repeating last keytype
void common_modifykey (short mode)
@@ -1639,26 +1714,10 @@ void common_modifykey (short mode)
if (ELEM(mode, COMMONKEY_MODE_INSERT, COMMONKEY_MODE_DELETE)==0)
return;
- /* delegate to other functions or get keyingsets to use */
- switch (curarea->spacetype) {
- /* spaces with their own methods */
- case SPACE_IPO:
- if (mode == COMMONKEY_MODE_INSERT)
- insertkey_editipo();
- return;
- case SPACE_ACTION:
- if (mode == COMMONKEY_MODE_INSERT)
- insertkey_action();
- return;
-
- /* TODO: based on UI elements? will that even be handled here??? */
-
- /* default - check per view */
- default:
- /* get the keyingsets and the data to add keyframes to */
- commonkey_context_get(&dsources, &ksc);
- break;
- }
+ /* delegate to other functions or get keyingsets to use
+ * - if the current area doesn't have its own handling, there will be data returned...
+ */
+ commonkey_context_get(curarea, mode, &dsources, &ksc);
/* check that there is data to operate on */
if (ELEM(NULL, dsources.first, ksc)) {
@@ -1713,7 +1772,7 @@ void common_modifykey (short mode)
if (achan && achan->ipo)
icu= achan->ipo->curve.first;
}
- else
+ else if(cks->ipo)
icu= cks->ipo->curve.first;
/* we get adrcodes directly from IPO curves (see method below...) */
@@ -1754,7 +1813,7 @@ void common_modifykey (short mode)
* - certain adrcodes (for MTEX channels need special offsets) // BAD CRUFT!!!
*/
adrcode= ks->adrcodes[i];
- if (ELEM3(ks->blocktype, ID_MA, ID_LA, ID_WO)) {
+ if (ELEM3(ks->blocktype, ID_MA, ID_LA, ID_WO) && (ks->flag & COMMONKEY_ADDMAP)) {
switch (adrcode) {
case MAP_OFS_X: case MAP_OFS_Y: case MAP_OFS_Z:
case MAP_SIZE_X: case MAP_SIZE_Y: case MAP_SIZE_Z:
@@ -1769,6 +1828,7 @@ void common_modifykey (short mode)
if (mode == COMMONKEY_MODE_DELETE) {
/* local flags only add on to global flags */
flag = 0;
+ //flag &= ~COMMONKEY_ADDMAP;
/* delete keyframe */
success += deletekey(cks->id, ks->blocktype, cks->actname, cks->constname, adrcode, flag);
@@ -1779,6 +1839,7 @@ void common_modifykey (short mode)
if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX;
if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED;
// if (IS_AUTOKEY_MODE(EDITKEYS)) flag |= INSERTKEY_REPLACE;
+ flag &= ~COMMONKEY_ADDMAP;
/* insert keyframe */
success += insertkey(cks->id, ks->blocktype, cks->actname, cks->constname, adrcode, flag);
diff --git a/source/blender/src/meshtools.c b/source/blender/src/meshtools.c
index eed7737c26d..66a484eb903 100644
--- a/source/blender/src/meshtools.c
+++ b/source/blender/src/meshtools.c
@@ -771,15 +771,15 @@ intptr_t mesh_octree_table(Object *ob, float *co, char mode)
}
else {
MVert *mvert;
- float *co;
+ float *vco;
int a, totvert;
MeshOctree.orco= mesh_getRefKeyCos(me, &totvert);
mesh_get_texspace(me, MeshOctree.orcoloc, NULL, NULL);
for(a=0, mvert= me->mvert; a<me->totvert; a++, mvert++) {
- co= (MeshOctree.orco)? MeshOctree.orco[a]: mvert->co;
- DO_MINMAX(co, min, max);
+ vco= (MeshOctree.orco)? MeshOctree.orco[a]: mvert->co;
+ DO_MINMAX(vco, min, max);
}
}
@@ -813,12 +813,12 @@ intptr_t mesh_octree_table(Object *ob, float *co, char mode)
}
else {
MVert *mvert;
- float *co;
+ float *vco;
int a;
for(a=0, mvert= me->mvert; a<me->totvert; a++, mvert++) {
- co= (MeshOctree.orco)? MeshOctree.orco[a]: mvert->co;
- mesh_octree_add_nodes(MeshOctree.table, co, MeshOctree.offs, MeshOctree.div, a+1);
+ vco= (MeshOctree.orco)? MeshOctree.orco[a]: mvert->co;
+ mesh_octree_add_nodes(MeshOctree.table, vco, MeshOctree.offs, MeshOctree.div, a+1);
}
}
}
diff --git a/source/blender/src/parametrizer.c b/source/blender/src/parametrizer.c
index 7aa27f99d77..1cf796d86bc 100644
--- a/source/blender/src/parametrizer.c
+++ b/source/blender/src/parametrizer.c
@@ -998,7 +998,7 @@ static float p_edge_boundary_angle(PEdge *e)
static void p_chart_fill_boundary(PChart *chart, PEdge *be, int nedges)
{
PEdge *e, *e1, *e2;
- PHashKey vkeys[3];
+
PFace *f;
struct Heap *heap = BLI_heap_new();
float angle;
@@ -1036,9 +1036,9 @@ static void p_chart_fill_boundary(PChart *chart, PEdge *be, int nedges)
e->flag |= PEDGE_FILLED;
e1->flag |= PEDGE_FILLED;
- vkeys[0] = e->vert->u.key;
- vkeys[1] = e1->vert->u.key;
- vkeys[2] = e2->vert->u.key;
+
+
+
f = p_face_add_fill(chart, e->vert, e1->vert, e2->vert);
f->flag |= PFACE_FILLED;
@@ -1078,11 +1078,11 @@ static void p_chart_fill_boundary(PChart *chart, PEdge *be, int nedges)
static void p_chart_fill_boundaries(PChart *chart, PEdge *outer)
{
- PEdge *e, *enext, *be;
+ PEdge *e, *be; /* *enext - as yet unused */
int nedges;
for (e=chart->edges; e; e=e->nextlink) {
- enext = e->nextlink;
+ /* enext = e->nextlink; - as yet unused */
if (e->pair || (e->flag & PEDGE_FILLED))
continue;
@@ -3199,7 +3199,7 @@ static PBool p_chart_convex_hull(PChart *chart, PVert ***verts, int *nverts, int
return P_TRUE;
}
-float p_rectangle_area(float *p1, float *dir, float *p2, float *p3, float *p4)
+static float p_rectangle_area(float *p1, float *dir, float *p2, float *p3, float *p4)
{
/* given 4 points on the rectangle edges and the direction of on edge,
compute the area of the rectangle */
@@ -3342,7 +3342,7 @@ static float p_chart_minimum_area_angle(PChart *chart)
return minangle;
}
-void p_chart_rotate_minimum_area(PChart *chart)
+static void p_chart_rotate_minimum_area(PChart *chart)
{
float angle = p_chart_minimum_area_angle(chart);
float sine = sin(angle);
@@ -3541,7 +3541,7 @@ static float p_smooth_distortion(PEdge *e, float avg2d, float avg3d)
return (len3d == 0.0f)? 0.0f: len2d/len3d;
}
-void p_smooth(PChart *chart)
+static void p_smooth(PChart *chart)
{
PEdge *e;
PVert *v;
@@ -3964,7 +3964,7 @@ void param_construct_end(ParamHandle *handle, ParamBool fill, ParamBool impl)
for (i = j = 0; i < phandle->ncharts; i++) {
PVert *v;
- PChart *chart = phandle->charts[i];
+ chart = phandle->charts[i];
p_chart_boundaries(chart, &nboundaries, &outer);
diff --git a/source/blender/src/poseobject.c b/source/blender/src/poseobject.c
index 19fb8dc2ecd..0f624d979d5 100644
--- a/source/blender/src/poseobject.c
+++ b/source/blender/src/poseobject.c
@@ -213,6 +213,8 @@ int pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan)
bConstraint *con;
Bone *bone;
+ /* No need to check if constraint is active (has influence),
+ * since all constraints with CONSTRAINT_IK_AUTO are active */
for(con= pchan->constraints.first; con; con= con->next) {
if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
bKinematicConstraint *data= con->data;
@@ -1733,3 +1735,4 @@ void pose_flipquats(void)
autokeyframe_pose_cb_func(ob, TFM_ROTATION, 0);
}
+
diff --git a/source/blender/src/resources.c b/source/blender/src/resources.c
index 1bef10d0415..5481f717971 100644
--- a/source/blender/src/resources.c
+++ b/source/blender/src/resources.c
@@ -774,6 +774,7 @@ char *BIF_ThemeColorsPup(int spacetype)
break;
case SPACE_TEXT:
str += sprintf(str, "Scroll Bar %%x%d|", TH_SHADE1);
+ str += sprintf(str, "Line Numbers Background %%x%d|", TH_GRID);
str += sprintf(str, "Selected Text %%x%d|", TH_SHADE2);
str += sprintf(str, "Cursor %%x%d|", TH_HILITE);
str += sprintf(str, "%%l|");
diff --git a/source/blender/src/retopo.c b/source/blender/src/retopo.c
index 47eee872a8a..5118744127c 100644
--- a/source/blender/src/retopo.c
+++ b/source/blender/src/retopo.c
@@ -85,18 +85,18 @@ typedef struct RetopoPaintHit {
float where;
} RetopoPaintHit;
-void retopo_do_2d(View3D *v3d, double proj[2], float *v, char adj);
-void retopo_paint_debug_print(RetopoPaintData *rpd);
+static void retopo_do_2d(View3D *v3d, double proj[2], float *v, char adj);
+static void retopo_paint_debug_print(RetopoPaintData *rpd);
/* Painting */
-RetopoPaintData *get_retopo_paint_data()
+RetopoPaintData *get_retopo_paint_data(void)
{
if(!retopo_mesh_paint_check()) return NULL;
if(!G.editMesh) return NULL;
return G.editMesh->retopo_paint_data;
}
-char retopo_mesh_paint_check()
+char retopo_mesh_paint_check(void)
{
return retopo_mesh_check() && G.scene->toolsettings->retopo_mode & RETOPO_PAINT;
}
@@ -117,7 +117,7 @@ void retopo_free_paint_data(RetopoPaintData *rpd)
}
}
-void retopo_free_paint()
+void retopo_free_paint(void)
{
retopo_free_paint_data(G.editMesh->retopo_paint_data);
G.editMesh->retopo_paint_data= NULL;
@@ -251,7 +251,7 @@ EditFace *addfaceif(EditMesh *em, EditVert *v1, EditVert *v2, EditVert *v3, Edit
return addfacelist(v1,v2,v3,v4,NULL,NULL);
}
-void retopo_paint_apply()
+void retopo_paint_apply(void)
{
RetopoPaintData *rpd= G.editMesh->retopo_paint_data;
EditVert *eve;
@@ -392,7 +392,7 @@ void retopo_paint_add_ellipse(RetopoPaintData *rpd, short mouse[2])
allqueue(REDRAWVIEW3D,0);
}
-void retopo_end_okee()
+void retopo_end_okee(void)
{
if(okee("Apply retopo paint?"))
retopo_paint_apply();
@@ -442,7 +442,7 @@ void retopo_paint_view_update(struct View3D *v3d)
}
}
-void retopo_force_update()
+void retopo_force_update(void)
{
RetopoPaintData *rpd= get_retopo_paint_data();
@@ -727,11 +727,11 @@ RetopoPaintData *retopo_paint_data_copy(RetopoPaintData *rpd)
return copy;
}
-char retopo_mesh_check()
+char retopo_mesh_check(void)
{
return G.obedit && G.obedit->type==OB_MESH && (G.scene->toolsettings->retopo_mode & RETOPO);
}
-char retopo_curve_check()
+char retopo_curve_check(void)
{
return G.obedit && (G.obedit->type==OB_CURVE ||
G.obedit->type==OB_SURF) && (((Curve*)G.obedit->data)->flag & CU_RETOPO);
@@ -751,7 +751,7 @@ void retopo_toggle(void *j1,void *j2)
allqueue(REDRAWVIEW3D, 0);
}
-void retopo_do_2d(View3D *v3d, double proj[2], float *v, char adj)
+static void retopo_do_2d(View3D *v3d, double proj[2], float *v, char adj)
{
/* Check to make sure vert is visible in window */
if(proj[0]>0 && proj[1]>0 && proj[0] < v3d->depths->w && proj[1] < v3d->depths->h) {
@@ -792,7 +792,7 @@ void retopo_do_vert(View3D *v3d, float *v)
retopo_do_2d(v3d,proj,v,0);
}
-void retopo_do_all()
+void retopo_do_all(void)
{
RetopoViewData *rvd= G.vd->retopo_view_data;
if(retopo_mesh_check()) {
@@ -905,7 +905,7 @@ void retopo_free_view_data(View3D *v3d)
}
}
-void retopo_paint_debug_print(RetopoPaintData *rpd)
+static void retopo_paint_debug_print(RetopoPaintData *rpd)
{
RetopoPaintLine *l;
RetopoPaintPoint *p;
diff --git a/source/blender/src/sculptmode.c b/source/blender/src/sculptmode.c
index 31d5ae4610d..c534a8b3cab 100644
--- a/source/blender/src/sculptmode.c
+++ b/source/blender/src/sculptmode.c
@@ -192,9 +192,9 @@ SculptData *sculpt_data(void)
return &G.scene->sculptdata;
}
-void sculpt_init_session(void);
-void init_brushaction(BrushAction *a, short *, short *);
-void sculpt_undo_push(const short);
+static void sculpt_init_session(void);
+static void init_brushaction(BrushAction *a, short *, short *);
+static void sculpt_undo_push(const short);
SculptSession *sculpt_session(void)
{
@@ -208,7 +208,7 @@ SculptSession *sculpt_session(void)
* Allocate/initialize/free data
*/
-void sculpt_init_session(void)
+static void sculpt_init_session(void)
{
if(sculpt_data()->session)
sculptsession_free(G.scene);
@@ -217,7 +217,7 @@ void sculpt_init_session(void)
/* vertex_users is an array of Lists that store all the faces that use a
particular vertex. vertex_users is in the same order as mesh.mvert */
-void calc_vertex_users()
+static void calc_vertex_users()
{
SculptSession *ss= sculpt_session();
int i,j;
@@ -865,14 +865,14 @@ float tex_strength(BrushAction *a, float *point, const float len,const unsigned
float fy= point_2d[1];
float angle= atan2(fy, fx) - rot;
- float len= sqrtf(fx*fx + fy*fy);
+ float flen= sqrtf(fx*fx + fy*fy);
if(rot<0.001 && rot>-0.001) {
px= point_2d[0];
py= point_2d[1];
} else {
- px= len * cos(angle) + 2000;
- py= len * sin(angle) + 2000;
+ px= flen * cos(angle) + 2000;
+ py= flen * sin(angle) + 2000;
}
if(sx != 1)
px %= sx-1;
@@ -884,10 +884,10 @@ float tex_strength(BrushAction *a, float *point, const float len,const unsigned
float fy= (point_2d[1] - a->mouse[1]) / bsize;
float angle= atan2(fy, fx) - rot;
- float len= sqrtf(fx*fx + fy*fy);
+ float flen= sqrtf(fx*fx + fy*fy);
- fx = len * cos(angle) + 0.5;
- fy = len * sin(angle) + 0.5;
+ fx = flen * cos(angle) + 0.5;
+ fy = flen * sin(angle) + 0.5;
avg= get_texcache_pixel_bilinear(ss, fx * TC_SIZE, fy * TC_SIZE);
}
@@ -1223,7 +1223,7 @@ void sculptmode_update_tex()
}
/* pr_mouse is only used for the grab brush, can be NULL otherwise */
-void init_brushaction(BrushAction *a, short *mouse, short *pr_mouse)
+static void init_brushaction(BrushAction *a, short *mouse, short *pr_mouse)
{
SculptData *sd = sculpt_data();
const float mouse_depth = get_depth(mouse[0], mouse[1]);
@@ -1809,7 +1809,7 @@ void sculpt(void)
allqueue(REDRAWVIEW3D, 0);
}
-void sculpt_undo_push(const short brush_type)
+static void sculpt_undo_push(const short brush_type)
{
switch(brush_type) {
case DRAW_BRUSH:
diff --git a/source/blender/src/seqaudio.c b/source/blender/src/seqaudio.c
index 2c86ac92c7f..1e0c8099dea 100644
--- a/source/blender/src/seqaudio.c
+++ b/source/blender/src/seqaudio.c
@@ -86,7 +86,7 @@
#include "blendef.h"
-void audio_fill(void *mixdown, Uint8 *sstream, int len);
+static void audio_fill(void *mixdown, Uint8 *sstream, int len);
/* ************ GLOBALS ************* */
static int audio_pos;
@@ -419,7 +419,7 @@ static void audio_fill_seq(Sequence * seq, void * mixdown,
#endif
#ifndef DISABLE_SDL
-void audio_fill(void *mixdown, Uint8 *sstream, int len)
+static void audio_fill(void *mixdown, Uint8 *sstream, int len)
{
Editing *ed;
Sequence *seq;
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index d4460e55a3e..0339747ec66 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -88,6 +88,7 @@
#include "BKE_multires.h"
#include "BKE_node.h"
#include "BKE_pointcache.h"
+#include "BKE_property.h"
#include "BKE_scene.h"
#include "BKE_sculpt.h"
#include "BKE_texture.h"
@@ -122,6 +123,7 @@
#include "BIF_imasel.h"
#include "BIF_interface.h"
#include "BIF_interface_icons.h"
+#include "BIF_keyframing.h"
#include "BIF_meshtools.h"
#include "BIF_mywindow.h"
#include "BIF_oops.h"
@@ -195,9 +197,9 @@ extern void StartKetsjiShellSimulation(ScrArea *area, char* startscenename, stru
* When the mipmap setting changes, we want to redraw the view right
* away to reflect this setting.
*/
-void space_mipmap_button_function(int event);
+static void space_mipmap_button_function(int event);
-void free_soundspace(SpaceSound *ssound);
+static void free_soundspace(SpaceSound *ssound);
/* *************************************** */
@@ -386,7 +388,11 @@ void space_set_commmandline_options(void) {
if ( (syshandle = SYS_GetSystem()) ) {
/* User defined settings */
a= (U.gameflags & USER_DISABLE_SOUND);
- SYS_WriteCommandLineInt(syshandle, "noaudio", a);
+ /* if user already disabled audio at the command-line, don't re-enable it */
+ if (a)
+ {
+ SYS_WriteCommandLineInt(syshandle, "noaudio", a);
+ }
a= (U.gameflags & USER_DISABLE_MIPMAP);
GPU_set_mipmap(!a);
@@ -1864,8 +1870,11 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break;
case AKEY:
- if (G.obedit == 0 && G.qual == (LR_CTRLKEY|LR_ALTKEY)) {
- alignmenu();
+ if(G.qual == (LR_CTRLKEY|LR_ALTKEY)) {
+ if(G.obedit == 0)
+ alignmenu();
+ else if(G.obedit->type==OB_ARMATURE)
+ align_selected_bones();
}
else if(G.qual & LR_CTRLKEY) { /* also with shift! */
apply_object();
@@ -3246,16 +3255,21 @@ static void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break;
case XKEY:
case DELKEY:
- if (okee("Erase selected")) {
- remove_marker();
- del_ipo(0);
-
- /* note: don't update the other spaces (in particular ipo)
- * or else curves disappear.
- */
- allqueue(REDRAWTIME, 0);
- allqueue(REDRAWSOUND, 0);
+ /* markers are incorported under shift-modifier (it does go against conventions, but oh well :/) */
+ if (G.qual == LR_SHIFTKEY) {
+ if (okee("Erase selected marker(s)?"))
+ remove_marker();
}
+ else {
+ if (okee("Erase selected?"))
+ del_ipo(0);
+ }
+
+ /* note: don't update the other spaces (in particular ipo)
+ * or else curves disappear.
+ */
+ allqueue(REDRAWTIME, 0);
+ allqueue(REDRAWSOUND, 0);
break;
case ACCENTGRAVEKEY:
if((G.qual==0)) {
@@ -3302,7 +3316,7 @@ void initipo(ScrArea *sa)
/* ******************** SPACE: INFO ********************** */
-void space_mipmap_button_function(int event) {
+static void space_mipmap_button_function(int event) {
GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP));
allqueue(REDRAWVIEW3D, 0);
@@ -4031,7 +4045,7 @@ void drawinfospace(ScrArea *sa, void *spacedata)
(xpos+edgsp+(2*mpref)+(2*midsp)),y5,mpref, buth,
&(U.autokey_mode), 0, 0, 0, 0, "Automatic keyframe insertion for Objects and Bones");
- if (IS_AUTOKEY_ON) {
+ if (U.autokey_mode & AUTOKEY_ON) {
uiDefButS(block, MENU, REDRAWTIME,
"Auto-Keying Mode %t|Add/Replace Keys%x3|Replace Keys %x5",
(xpos+edgsp+(2*mpref)+(2*midsp)),y4,mpref, buth,
@@ -5197,6 +5211,10 @@ static void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
if(sseq->mainb)
gpencil_delete_menu();
}
+ else if(G.qual==LR_SHIFTKEY) {
+ /* markers are incorported under shift-modifier (it does go against conventions, but oh well :/) */
+ remove_marker();
+ }
break;
case PAD1: case PAD2: case PAD4: case PAD8:
seq_viewzoom(event, (G.qual & LR_SHIFTKEY)==0);
@@ -5372,7 +5390,7 @@ static void init_soundspace(ScrArea *sa)
}
-void free_soundspace(SpaceSound *ssound)
+static void free_soundspace(SpaceSound *ssound)
{
/* don't free ssound itself */
diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c
index df0a2921578..bb2e83d8fa5 100644
--- a/source/blender/src/toets.c
+++ b/source/blender/src/toets.c
@@ -291,6 +291,20 @@ void persptoetsen(unsigned short event)
}
}
else if(event==PAD0) {
+ /* lastview - */
+ if(G.vd->lastview_set==0) {
+ /* store settings of current view before allowing overwriting with camera view */
+ QUATCOPY(G.vd->lviewquat, G.vd->viewquat);
+ G.vd->lview= G.vd->view;
+ G.vd->lpersp= G.vd->persp;
+ G.vd->lastview_set= 1;
+ }
+ else {
+ /* return to settings of last view */
+ axis_set_view(G.vd->lviewquat[0], G.vd->lviewquat[1], G.vd->lviewquat[2], G.vd->lviewquat[3], G.vd->lview, G.vd->lpersp);
+ G.vd->lastview_set= 0;
+ }
+
if(G.qual==LR_ALTKEY) {
if(oldcamera && is_an_active_object(oldcamera)) {
G.vd->camera= oldcamera;
@@ -313,6 +327,7 @@ void persptoetsen(unsigned short event)
handle_view3d_lock();
}
}
+
if(G.vd->camera==0) {
G.vd->camera= scene_find_camera(G.scene);
handle_view3d_lock();
@@ -342,8 +357,6 @@ void persptoetsen(unsigned short event)
VECCOPY(G.vd->ofs, orig_ofs);
G.vd->lens = orig_lens;
}
-
-
}
}
else if(event==PAD9) {
@@ -362,7 +375,6 @@ void persptoetsen(unsigned short event)
q1[1]= q1[2]= 0.0;
q1[3]= si;
QuatMul(G.vd->viewquat, G.vd->viewquat, q1);
- G.vd->view= 0;
}
if(event==PAD2 || event==PAD8) {
/* horizontal axis */
@@ -377,7 +389,6 @@ void persptoetsen(unsigned short event)
q1[2]*= si;
q1[3]*= si;
QuatMul(G.vd->viewquat, G.vd->viewquat, q1);
- G.vd->view= 0;
}
}
diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c
index 7a2ca3f088b..70dcb58b87c 100644
--- a/source/blender/src/transform_conversions.c
+++ b/source/blender/src/transform_conversions.c
@@ -397,7 +397,7 @@ static bKinematicConstraint *has_targetless_ik(bPoseChannel *pchan)
bConstraint *con= pchan->constraints.first;
for(;con; con= con->next) {
- if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
+ if(con->type==CONSTRAINT_TYPE_KINEMATIC && (con->enforce!=0.0)) {
bKinematicConstraint *data= con->data;
if(data->tar==NULL)
@@ -505,12 +505,17 @@ static short apply_targetless_ik(Object *ob)
Mat3ToQuat(rmat3, parchan->quat);
/* for size, remove rotation */
- QuatToMat3(parchan->quat, qmat);
- Mat3Inv(imat, qmat);
- Mat3MulMat3(smat, rmat3, imat);
- Mat3ToSize(smat, parchan->size);
+ /* causes problems with some constraints (so apply only if needed) */
+ if (data->flag & CONSTRAINT_IK_STRETCH) {
+ QuatToMat3(parchan->quat, qmat);
+ Mat3Inv(imat, qmat);
+ Mat3MulMat3(smat, rmat3, imat);
+ Mat3ToSize(smat, parchan->size);
+ }
- VECCOPY(parchan->loc, rmat[3]);
+ /* causes problems with some constraints (e.g. childof), so disable this */
+ /* as it is IK shouldn't affect location directly */
+ /* VECCOPY(parchan->loc, rmat[3]); */
}
}
@@ -711,7 +716,7 @@ static void pchan_autoik_adjust (bPoseChannel *pchan, short chainlen)
/* check if pchan has ik-constraint */
for (con= pchan->constraints.first; con; con= con->next) {
- if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
+ if (con->type == CONSTRAINT_TYPE_KINEMATIC && (con->enforce!=0.0)) {
bKinematicConstraint *data= con->data;
/* only accept if a temporary one (for auto-ik) */
@@ -763,6 +768,7 @@ static void pose_grab_with_ik_clear(Object *ob)
/* clear all temporary lock flags */
pchan->ikflag &= ~(BONE_IK_NO_XDOF_TEMP|BONE_IK_NO_YDOF_TEMP|BONE_IK_NO_ZDOF_TEMP);
+ pchan->constflag &= ~(PCHAN_HAS_IK|PCHAN_HAS_TARGET);
/* remove all temporary IK-constraints added */
for (con= pchan->constraints.first; con; con= con->next) {
if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
@@ -771,9 +777,11 @@ static void pose_grab_with_ik_clear(Object *ob)
BLI_remlink(&pchan->constraints, con);
MEM_freeN(con->data);
MEM_freeN(con);
- pchan->constflag &= ~(PCHAN_HAS_IK|PCHAN_HAS_TARGET);
- break;
+ continue;
}
+ pchan->constflag |= PCHAN_HAS_IK;
+ if(data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]==0))
+ pchan->constflag |= PCHAN_HAS_TARGET;
}
}
}
@@ -784,6 +792,7 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
{
bKinematicConstraint *data;
bConstraint *con;
+ bConstraint *targetless = 0;
/* Sanity check */
if (pchan == NULL)
@@ -791,23 +800,31 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
/* Rule: not if there's already an IK on this channel */
for (con= pchan->constraints.first; con; con= con->next) {
- if (con->type==CONSTRAINT_TYPE_KINEMATIC)
- break;
- }
-
- if (con) {
- /* but, if this is a targetless IK, we make it auto anyway (for the children loop) */
- data= has_targetless_ik(pchan);
- if (data)
- data->flag |= CONSTRAINT_IK_AUTO;
- return 0;
+ if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
+ bKinematicConstraint *data= con->data;
+ if(data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]==0)) {
+ targetless = con;
+ /* but, if this is a targetless IK, we make it auto anyway (for the children loop) */
+ if (con->enforce!=0.0) {
+ targetless->flag |= CONSTRAINT_IK_AUTO;
+ return 0;
+ }
+ }
+ if ((con->flag & CONSTRAINT_DISABLE)==0 && (con->enforce!=0.0))
+ return 0;
+ }
}
con = add_new_constraint(CONSTRAINT_TYPE_KINEMATIC);
BLI_addtail(&pchan->constraints, con);
pchan->constflag |= (PCHAN_HAS_IK|PCHAN_HAS_TARGET); /* for draw, but also for detecting while pose solving */
data= con->data;
- data->flag= CONSTRAINT_IK_TIP|CONSTRAINT_IK_TEMP|CONSTRAINT_IK_AUTO;
+ if (targetless) { /* if exists use values from last targetless IK-constraint as base */
+ *data = *((bKinematicConstraint*)targetless->data);
+ }
+ else
+ data->flag= CONSTRAINT_IK_TIP;
+ data->flag |= CONSTRAINT_IK_TEMP|CONSTRAINT_IK_AUTO;
VECCOPY(data->grabtarget, pchan->pose_tail);
data->rootbone= 1;
@@ -4279,3 +4296,4 @@ void createTransData(TransInfo *t)
+
diff --git a/source/blender/src/transform_ndofinput.c b/source/blender/src/transform_ndofinput.c
index b7362197423..a22c7ed6472 100644
--- a/source/blender/src/transform_ndofinput.c
+++ b/source/blender/src/transform_ndofinput.c
@@ -38,8 +38,8 @@
#include "transform.h"
-int updateNDofMotion(NDofInput *n); // return 0 when motion is null
-void resetNDofInput(NDofInput *n);
+static int updateNDofMotion(NDofInput *n); // return 0 when motion is null
+static void resetNDofInput(NDofInput *n);
void initNDofInput(NDofInput *n)
{
@@ -56,7 +56,7 @@ void initNDofInput(NDofInput *n)
}
}
-void resetNDofInput(NDofInput *n)
+static void resetNDofInput(NDofInput *n)
{
int i;
for(i = 0; i < 6; i++)
@@ -122,7 +122,7 @@ void applyNDofInput(NDofInput *n, float *vec)
}
-int updateNDofMotion(NDofInput *n)
+static int updateNDofMotion(NDofInput *n)
{
float fval[7];
int i;
diff --git a/source/blender/src/unwrapper.c b/source/blender/src/unwrapper.c
index ee5ce0c914e..612e068c6ca 100644
--- a/source/blender/src/unwrapper.c
+++ b/source/blender/src/unwrapper.c
@@ -202,8 +202,7 @@ ParamHandle *construct_param_handle(EditMesh *em, short implicit, short fill, sh
handle = param_construct_begin();
if ((G.scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT)==0) {
- EditMesh *em = G.editMesh;
- EditFace *efa = EM_get_actFace(1);
+ efa = EM_get_actFace(1);
if (efa) {
float aspx, aspy;
MTFace *tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
index d6bc9cea311..d5468342932 100644
--- a/source/blender/src/view.c
+++ b/source/blender/src/view.c
@@ -894,6 +894,11 @@ void viewmove(int mode)
return;
}
+ /* clear lastview flag (used to return to previous view when
+ * pressing Pad0 again after entering Camera view)
+ */
+ if (G.vd->lastview_set) G.vd->lastview_set= 0;
+
// dist correction from other movement devices
if((dz_flag)||G.vd->dist==0) {
dz_flag = 0;
diff --git a/source/blender/src/vpaint.c b/source/blender/src/vpaint.c
index 935c546a235..8da5e1b2572 100644
--- a/source/blender/src/vpaint.c
+++ b/source/blender/src/vpaint.c
@@ -740,7 +740,7 @@ static void vpaint_blend( unsigned int *col, unsigned int *colorig, unsigned int
}
-static int sample_backbuf_area(VPaint *vp, int *indexar, int totface, int x, int y, float size)
+static int sample_backbuf_area(int *indexar, int totface, int x, int y, float size)
{
unsigned int *rt;
struct ImBuf *ibuf;
@@ -1196,7 +1196,7 @@ void weight_paint(void)
/* which faces are involved */
if(Gwp.flag & VP_AREA) {
- totindex= sample_backbuf_area(&Gwp, indexar, me->totface, mval[0], mval[1], Gwp.size);
+ totindex= sample_backbuf_area(indexar, me->totface, mval[0], mval[1], Gwp.size);
}
else {
indexar[0]= sample_backbuf(mval[0], mval[1]);
@@ -1428,7 +1428,7 @@ void vertex_paint()
/* which faces are involved */
if(Gvp.flag & VP_AREA) {
- totindex= sample_backbuf_area(&Gvp, indexar, me->totface, mval[0], mval[1], Gvp.size);
+ totindex= sample_backbuf_area(indexar, me->totface, mval[0], mval[1], Gvp.size);
}
else {
indexar[0]= sample_backbuf(mval[0], mval[1]);