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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-09-17 08:59:14 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-09-17 08:59:14 +0400
commit1ff373ef5bb0c1462ad8b0f30cfb773e30cbb2bb (patch)
treeb6ec7b01b644cc8c0d4d743a4d3d94551b59f2b1 /source
parent594b0298c7a672fca44890d3afd1e5bf4f06c1da (diff)
parent2636be0ac0d3139b2c9cf54f6380b2e9a3d3ed51 (diff)
svn merge -r40166:40279 ^/trunk/blender
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenfont/intern/blf_font.c11
-rw-r--r--source/blender/blenkernel/BKE_curve.h13
-rw-r--r--source/blender/blenkernel/BKE_object.h2
-rw-r--r--source/blender/blenkernel/BKE_paint.h1
-rw-r--r--source/blender/blenkernel/CMakeLists.txt1
-rw-r--r--source/blender/blenkernel/SConscript2
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c8
-rw-r--r--source/blender/blenkernel/intern/action.c12
-rw-r--r--source/blender/blenkernel/intern/anim.c8
-rw-r--r--source/blender/blenkernel/intern/armature.c1
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c5
-rw-r--r--source/blender/blenkernel/intern/collision.c2
-rw-r--r--source/blender/blenkernel/intern/curve.c42
-rw-r--r--source/blender/blenkernel/intern/displist.c4
-rw-r--r--source/blender/blenkernel/intern/image.c2
-rw-r--r--source/blender/blenkernel/intern/ipo.c2
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.c2
-rw-r--r--source/blender/blenkernel/intern/navmesh_conversion.cpp27
-rw-r--r--source/blender/blenkernel/intern/node.c8
-rw-r--r--source/blender/blenkernel/intern/object.c74
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c5
-rw-r--r--source/blender/blenkernel/intern/unit.c2
-rw-r--r--source/blender/blenlib/BLI_string.h9
-rw-r--r--source/blender/blenlib/CMakeLists.txt1
-rw-r--r--source/blender/blenlib/intern/string.c116
-rw-r--r--source/blender/blenlib/intern/string_utf8.c185
-rw-r--r--source/blender/blenloader/intern/readfile.c7
-rw-r--r--source/blender/bmesh/editmesh_tools.c2
-rw-r--r--source/blender/editors/animation/anim_filter.c2
-rw-r--r--source/blender/editors/animation/keyframes_edit.c6
-rw-r--r--source/blender/editors/armature/editarmature.c12
-rw-r--r--source/blender/editors/armature/poseSlide.c5
-rw-r--r--source/blender/editors/armature/poselib.c9
-rw-r--r--source/blender/editors/armature/poseobject.c75
-rw-r--r--source/blender/editors/curve/curve_ops.c1
-rw-r--r--source/blender/editors/curve/editcurve.c127
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c2
-rw-r--r--source/blender/editors/include/ED_armature.h1
-rw-r--r--source/blender/editors/include/ED_curve.h2
-rw-r--r--source/blender/editors/include/ED_sculpt.h1
-rw-r--r--source/blender/editors/interface/interface_regions.c2
-rw-r--r--source/blender/editors/interface/interface_widgets.c14
-rw-r--r--source/blender/editors/mesh/bmesh_tools.c4
-rw-r--r--source/blender/editors/object/object_add.c2
-rw-r--r--source/blender/editors/object/object_constraint.c8
-rw-r--r--source/blender/editors/object/object_hook.c4
-rw-r--r--source/blender/editors/object/object_modifier.c2
-rw-r--r--source/blender/editors/object/object_navmesh.cpp2
-rw-r--r--source/blender/editors/object/object_relations.c2
-rw-r--r--source/blender/editors/render/render_shading.c27
-rw-r--r--source/blender/editors/screen/screen_context.c6
-rw-r--r--source/blender/editors/screen/screen_ops.c3
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c13
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c44
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c2
-rw-r--r--source/blender/editors/sound/sound_intern.h2
-rw-r--r--source/blender/editors/sound/sound_ops.c8
-rw-r--r--source/blender/editors/space_file/file_ops.c27
-rw-r--r--source/blender/editors/space_info/info_stats.c4
-rw-r--r--source/blender/editors/space_node/drawnode.c8
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c4
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c4
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c2
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c12
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c39
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c8
-rw-r--r--source/blender/editors/transform/transform.c4
-rw-r--r--source/blender/editors/transform/transform_conversions.c3
-rw-r--r--source/blender/editors/transform/transform_generics.c10
-rw-r--r--source/blender/editors/transform/transform_manipulator.c4
-rw-r--r--source/blender/editors/transform/transform_orientations.c5
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c6
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c3
-rw-r--r--source/blender/imbuf/intern/filter.c2
-rw-r--r--source/blender/imbuf/intern/indexer.c18
-rw-r--r--source/blender/imbuf/intern/iris.c13
-rw-r--r--source/blender/imbuf/intern/jp2.c4
-rw-r--r--source/blender/makesdna/DNA_action_types.h15
-rw-r--r--source/blender/makesrna/intern/makesrna.c14
-rw-r--r--source/blender/makesrna/intern/rna_ID.c2
-rw-r--r--source/blender/makesrna/intern/rna_action.c2
-rw-r--r--source/blender/makesrna/intern/rna_animation.c2
-rw-r--r--source/blender/makesrna/intern/rna_armature.c4
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c2
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c4
-rw-r--r--source/blender/makesrna/intern/rna_key.c2
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c4
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c2
-rw-r--r--source/blender/makesrna/intern/rna_nla.c2
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c4
-rw-r--r--source/blender/makesrna/intern/rna_object.c12
-rw-r--r--source/blender/makesrna/intern/rna_pose.c6
-rw-r--r--source/blender/makesrna/intern/rna_property.c2
-rw-r--r--source/blender/makesrna/intern/rna_scene.c6
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c2
-rw-r--r--source/blender/makesrna/intern/rna_text.c4
-rw-r--r--source/blender/makesrna/intern/rna_texture.c2
-rw-r--r--source/blender/makesrna/intern/rna_texture_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_wm.c22
-rw-r--r--source/blender/modifiers/intern/MOD_warp.c4
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.c142
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.h2
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgedit.c18
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgmix.c122
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgproximity.c38
-rw-r--r--source/blender/nodes/composite/node_composite_tree.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_diffMatte.c6
-rw-r--r--source/blender/python/generic/py_capi_utils.c38
-rw-r--r--source/blender/python/generic/py_capi_utils.h1
-rw-r--r--source/blender/python/intern/bpy_app_handlers.c4
-rw-r--r--source/blender/python/intern/bpy_rna.c33
-rw-r--r--source/blender/python/intern/gpu.c2
-rw-r--r--source/blender/render/intern/raytrace/rayobject_octree.cpp2
-rw-r--r--source/blender/render/intern/source/convertblender.c4
-rw-r--r--source/blender/render/intern/source/envmap.c4
-rw-r--r--source/blender/render/intern/source/pipeline.c2
-rw-r--r--source/blender/render/intern/source/rendercore.c12
-rw-r--r--source/blender/render/intern/source/shadeinput.c3
-rw-r--r--source/blender/render/intern/source/zbuf.c12
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c4
-rw-r--r--source/creator/CMakeLists.txt21
-rw-r--r--source/creator/creator.c2
-rw-r--r--source/gameengine/Converter/BL_ArmatureObject.cpp1
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp5
131 files changed, 944 insertions, 803 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 8a71c3de86b..3bec7dd2626 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -99,9 +99,10 @@ void blf_font_size(FontBLF *font, int size, int dpi)
static void blf_font_ensure_ascii_table(FontBLF *font)
{
+ GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
+
/* build ascii on demand */
- if(font->glyph_cache->glyph_ascii_table['0']==NULL) {
- GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
+ if(glyph_ascii_table['0']==NULL) {
GlyphBLF *g;
unsigned int i;
for(i=0; i<256; i++) {
@@ -125,7 +126,7 @@ static void blf_font_ensure_ascii_table(FontBLF *font)
#define BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table) \
if(((c)= (str)[i]) < 0x80) { \
- g= glyph_ascii_table[c]; \
+ g= (glyph_ascii_table)[c]; \
i++; \
} \
else if ((c= blf_utf8_next((unsigned char *)(str), &(i)))) { \
@@ -212,7 +213,7 @@ void blf_font_draw_ascii(FontBLF *font, const char *str, unsigned int len)
blf_font_ensure_ascii_table(font);
while ((c= *(str++)) && len--) {
- g= font->glyph_cache->glyph_ascii_table[c];
+ g= glyph_ascii_table[c];
/* if we don't found a glyph, skip it. */
if (!g)
@@ -401,7 +402,6 @@ void blf_font_boundbox(FontBLF *font, const char *str, rctf *box)
if (!font->glyph_cache)
return;
- glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
box->xmin= 32000.0f;
box->xmax= -32000.0f;
@@ -415,6 +415,7 @@ void blf_font_boundbox(FontBLF *font, const char *str, rctf *box)
g_prev= NULL;
blf_font_ensure_ascii_table(font);
+ glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
while (str[i]) {
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index 557ce417b14..02fc70e41e8 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -34,14 +34,16 @@
* \since March 2001
* \author nzc
*/
+
+struct BevList;
+struct BezTriple;
struct Curve;
+struct EditNurb;
struct ListBase;
+struct ListBase;
+struct Nurb;
struct Object;
struct Scene;
-struct Nurb;
-struct ListBase;
-struct BezTriple;
-struct BevList;
#define KNOTSU(nu) ( (nu)->orderu+ (nu)->pntsu+ (((nu)->flagu & CU_NURB_CYCLIC) ? ((nu)->orderu-1) : 0) )
#define KNOTSV(nu) ( (nu)->orderv+ (nu)->pntsv+ (((nu)->flagv & CU_NURB_CYCLIC) ? ((nu)->orderv-1) : 0) )
@@ -55,11 +57,14 @@ struct BevList;
void unlink_curve( struct Curve *cu);
+void free_curve_editNurb_keyIndex(struct EditNurb *editnurb);
+void free_curve_editNurb(struct Curve *cu);
void free_curve( struct Curve *cu);
void BKE_free_editfont(struct Curve *cu);
struct Curve *add_curve(const char *name, int type);
struct Curve *copy_curve( struct Curve *cu);
void make_local_curve( struct Curve *cu);
+struct ListBase *curve_editnurbs(struct Curve *cu);
short curve_type( struct Curve *cu);
void test_curve_type( struct Object *ob);
void tex_space_curve( struct Curve *cu);
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index a6b5c04b5c3..7e39461a032 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -108,6 +108,7 @@ void object_to_mat4(struct Object *ob, float mat[][4]);
void object_apply_mat4(struct Object *ob, float mat[][4], const short use_compat, const short use_parent);
void set_no_parent_ipo(int val);
+struct Object *object_pose_armature_get(struct Object *ob);
void where_is_object_time(struct Scene *scene, struct Object *ob, float ctime);
void where_is_object(struct Scene *scene, struct Object *ob);
@@ -128,6 +129,7 @@ void *object_tfm_backup(struct Object *ob);
void object_tfm_restore(struct Object *ob, void *obtfm_pt);
void object_handle_update(struct Scene *scene, struct Object *ob);
+void object_sculpt_modifiers_changed(struct Object *ob);
float give_timeoffset(struct Object *ob);
int give_obdata_texspace(struct Object *ob, short **texflag, float **loc, float **size, float **rot);
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 76f89b5e890..ad739c5d83c 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -97,5 +97,6 @@ typedef struct SculptSession {
} SculptSession;
void free_sculptsession(struct Object *ob);
+void free_sculptsession_deformMats(struct SculptSession *ss);
#endif
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 58f9c88ed21..89a00590bc5 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -35,7 +35,6 @@ set(INC
../blenfont
../blenlib
../blenloader
- ../editors/include
../gpu
../ikplugin
../imbuf
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index 5da24bc43be..5281e590cd5 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -4,7 +4,7 @@ import os
sources = env.Glob('intern/*.c') + env.Glob('intern/*.cpp')
-incs = '. #/intern/guardedalloc #/intern/memutil ../editors/include'
+incs = '. #/intern/guardedalloc #/intern/memutil'
incs += ' ../blenlib ../blenfont ../makesdna ../windowmanager'
incs += ' ../render/extern/include #/intern/decimation/extern ../makesrna'
incs += ' ../imbuf ../ikplugin ../avi #/intern/elbeem/extern ../nodes ../modifiers'
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 81e0d86214f..d579bc0d3c7 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -64,18 +64,16 @@
#include "BKE_tessmesh.h"
#include "BKE_bvhutils.h"
-
#include "BLO_sys_types.h" // for intptr_t support
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
+#include "GL/glew.h"
#include "GPU_buffers.h"
#include "GPU_draw.h"
#include "GPU_extensions.h"
#include "GPU_material.h"
-#include "ED_sculpt.h" /* for ED_sculpt_modifiers_changed */
+extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */
static void add_shapekey_layers(DerivedMesh *dm, Mesh *me, Object *ob);
static void shapekey_layers_to_keyblocks(DerivedMesh *dm, Mesh *me, int actshape_uid);
@@ -1642,7 +1640,7 @@ static void clear_mesh_caches(Object *ob)
}
if(ob->sculpt) {
- ED_sculpt_modifiers_changed(ob);
+ object_sculpt_modifiers_changed(ob);
}
}
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 9c2467505cd..73ddcbecf94 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -117,7 +117,7 @@ static void make_localact_apply_cb(ID *id, AnimData *adt, void *mlac_ptr)
tMakeLocalActionContext *mlac = (tMakeLocalActionContext *)mlac_ptr;
if (adt->action == mlac->act) {
- if (id->lib==0) {
+ if (id->lib == NULL) {
adt->action = mlac->actn;
id_us_plus(&mlac->actn->id);
@@ -524,7 +524,6 @@ void copy_pose (bPose **dst, bPose *src, int copycon)
if (copycon) {
copy_constraints(&listb, &pchan->constraints, TRUE); // copy_constraints NULLs listb
pchan->constraints= listb;
- pchan->path= NULL; // XXX remove this line when the new motionpaths are ready... (depreceated code)
pchan->mpath= NULL; /* motion paths should not get copied yet... */
}
@@ -595,17 +594,12 @@ void free_pose_channels_hash(bPose *pose)
void free_pose_channel(bPoseChannel *pchan)
{
- // XXX this case here will need to be removed when the new motionpaths are ready
- if (pchan->path) {
- MEM_freeN(pchan->path);
- pchan->path= NULL;
- }
-
+
if (pchan->mpath) {
animviz_free_motionpath(pchan->mpath);
pchan->mpath= NULL;
}
-
+
free_constraints(&pchan->constraints);
if (pchan->prop) {
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index d4721707dc7..232194b22b6 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -1140,11 +1140,11 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
w= (mv4)? 0.25f: 1.0f/3.0f;
if(orco) {
- VECADDFAC(dob->orco, dob->orco, orco[mv1], w);
- VECADDFAC(dob->orco, dob->orco, orco[mv2], w);
- VECADDFAC(dob->orco, dob->orco, orco[mv3], w);
+ madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv1], w);
+ madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv2], w);
+ madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv3], w);
if(mv4)
- VECADDFAC(dob->orco, dob->orco, orco[mv4], w);
+ madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv4], w);
}
if(mtface) {
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 62ce184a2d7..08a95477c2e 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1483,7 +1483,6 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
pchanw.next= pchan->next;
pchanw.parent= pchan->parent;
pchanw.child= pchan->child;
- pchanw.path= NULL;
/* this is freed so copy a copy, else undo crashes */
if(pchanw.prop) {
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index eadb9139d78..9d40b0980d5 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -36,10 +36,7 @@
* \ingroup bke
*/
-
-/* TODO maybe BIF_gl.h should include string.h? */
-#include <string.h>
-#include "BIF_gl.h"
+#include "GL/glew.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_global.h"
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 03405c28074..700c6693a24 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -2022,7 +2022,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
{
if(edgecollpair.p21==6 || edgecollpair.p22 == 6)
{
- printf("dist: %f, sol[k]: %lf, sol2[k]: %lf\n", distance, solution[k], solution2[k]);
+ printf("dist: %f, sol[k]: %f, sol2[k]: %f\n", distance, solution[k], solution2[k]);
printf("a1: %f, a2: %f, b1: %f, b2: %f\n", x1[0], x2[0], x3[0], v1[0]);
printf("b21: %d, b22: %d\n", edgecollpair.p21, edgecollpair.p22);
}
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index b8820fb24d1..3c693fd83a4 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -41,9 +41,10 @@
#include "MEM_guardedalloc.h"
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
+#include "BLI_blenlib.h"
+#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLI_ghash.h"
#include "DNA_curve_types.h"
#include "DNA_material_types.h"
@@ -67,9 +68,6 @@
#include "BKE_object.h"
#include "BKE_material.h"
-
-#include "ED_curve.h"
-
/* globals */
/* local */
@@ -119,6 +117,25 @@ void BKE_free_editfont(Curve *cu)
}
}
+void free_curve_editNurb_keyIndex(EditNurb *editnurb)
+{
+ if (!editnurb->keyindex) {
+ return;
+ }
+ BLI_ghash_free(editnurb->keyindex, NULL, (GHashValFreeFP)MEM_freeN);
+ editnurb->keyindex= NULL;
+}
+
+void free_curve_editNurb (Curve *cu)
+{
+ if(cu->editnurb) {
+ freeNurblist(&cu->editnurb->nurbs);
+ free_curve_editNurb_keyIndex(cu->editnurb);
+ MEM_freeN(cu->editnurb);
+ cu->editnurb= NULL;
+ }
+}
+
/* don't free curve itself */
void free_curve(Curve *cu)
{
@@ -282,6 +299,16 @@ void make_local_curve(Curve *cu)
}
}
+/* Get list of nurbs from editnurbs structure */
+ListBase *curve_editnurbs(Curve *cu)
+{
+ if (cu->editnurb) {
+ return &cu->editnurb->nurbs;
+ }
+
+ return NULL;
+}
+
short curve_type(Curve *cu)
{
Nurb *nu;
@@ -359,7 +386,6 @@ void tex_space_curve(Curve *cu)
}
}
-
int count_curveverts(ListBase *nurb)
{
Nurb *nu;
@@ -2050,7 +2076,7 @@ void makeBevelList(Object *ob)
BLI_freelistN(&(cu->bev));
if(cu->editnurb && ob->type!=OB_FONT) {
- ListBase *nurbs= ED_curve_editnurbs(cu);
+ ListBase *nurbs= curve_editnurbs(cu);
nu= nurbs->first;
} else nu= cu->nurb.first;
@@ -3158,7 +3184,7 @@ int clamp_nurb_order_v( struct Nurb *nu)
ListBase *BKE_curve_nurbs(Curve *cu)
{
if (cu->editnurb) {
- return ED_curve_editnurbs(cu);
+ return curve_editnurbs(cu);
}
return &cu->nurb;
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index ec8a59d51f0..8c7e17ca59b 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -67,8 +67,6 @@
#include "BLO_sys_types.h" // for intptr_t support
-#include "ED_curve.h" /* for BKE_curve_nurbs */
-
extern Material defmaterial; /* material.c */
static void boundbox_displist(Object *ob);
@@ -1104,7 +1102,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
float (*deformedVerts)[3];
if(!forRender && cu->editnurb)
- nubase= ED_curve_editnurbs(cu);
+ nubase= curve_editnurbs(cu);
else
nubase= &cu->nurb;
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 4ce5de78895..002cfdbf41a 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -592,7 +592,7 @@ void BKE_image_print_memlist(void)
for(ima= G.main->image.first; ima; ima= ima->id.next)
totsize += image_mem_size(ima);
- printf("\ntotal image memory len: %.3lf MB\n", (double)totsize/(double)(1024*1024));
+ printf("\ntotal image memory len: %.3f MB\n", (double)totsize/(double)(1024*1024));
for(ima= G.main->image.first; ima; ima= ima->id.next) {
size= image_mem_size(ima);
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 0d3f3cc5ae4..5acd6c169a0 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -942,7 +942,7 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
sprintf(buf, "sequence_editor.sequences_all[\"%s\"]", seq->name+2);
}
else
- strcpy(buf, ""); /* empty string */
+ buf[0]= '\0'; /* empty string */
BLI_dynstr_append(path, buf);
/* need to add dot before property if there was anything precceding this */
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index f936683bb31..e7cec669081 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -143,7 +143,7 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve
BLI_assert(!(do_fixes && me == NULL));
- PRINT("ED_mesh_validate: verts(%u), edges(%u), faces(%u)\n", totvert, totedge, totface);
+ PRINT("%s: verts(%u), edges(%u), faces(%u)\n", __func__, totvert, totedge, totface);
if(totedge == 0 && totface != 0) {
PRINT(" locical error, %u faces and 0 edges\n", totface);
diff --git a/source/blender/blenkernel/intern/navmesh_conversion.cpp b/source/blender/blenkernel/intern/navmesh_conversion.cpp
index cc3b926db75..fbc4775cf34 100644
--- a/source/blender/blenkernel/intern/navmesh_conversion.cpp
+++ b/source/blender/blenkernel/intern/navmesh_conversion.cpp
@@ -289,17 +289,15 @@ struct SortContext
const int* recastData;
const int* trisToFacesMap;
};
-#if defined(_MSC_VER)
-static int compareByData(void* data, const void * a, const void * b)
-#elif defined(__APPLE__) || defined(__FreeBSD__)
-static int compareByData(void* data, const void * a, const void * b)
-#else
-static int compareByData(const void * a, const void * b, void* data)
-#endif
+
+/* XXX: not thread-safe, but it's called only from modifiers stack
+ which isn't threaded. Anyway, better to avoid this in the future */
+static SortContext *_qsort_context;
+
+static int compareByData(const void * a, const void * b)
{
- const SortContext* context = (const SortContext*)data;
- return ( context->recastData[context->trisToFacesMap[*(int*)a]] -
- context->recastData[context->trisToFacesMap[*(int*)b]] );
+ return ( _qsort_context->recastData[_qsort_context->trisToFacesMap[*(int*)a]] -
+ _qsort_context->recastData[_qsort_context->trisToFacesMap[*(int*)b]] );
}
bool buildNavMeshData(const int nverts, const float* verts,
@@ -323,13 +321,8 @@ bool buildNavMeshData(const int nverts, const float* verts,
SortContext context;
context.recastData = recastData;
context.trisToFacesMap = trisToFacesMap;
-#if defined(_MSC_VER)
- qsort_s(trisMapping, ntris, sizeof(int), compareByData, &context);
-#elif defined(__APPLE__) || defined(__FreeBSD__)
- qsort_r(trisMapping, ntris, sizeof(int), &context, compareByData);
-#else
- qsort_r(trisMapping, ntris, sizeof(int), compareByData, &context);
-#endif
+ _qsort_context = &context;
+ qsort(trisMapping, ntris, sizeof(int), compareByData);
//search first valid triangle - triangle of convex polygon
int validTriStart = -1;
for (int i=0; i< ntris; i++)
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index d40b030c470..89fd3ff9c13 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1051,9 +1051,9 @@ void ntreeMakeLocal(bNodeTree *ntree)
if(ntree->id.lib==NULL) return;
if(ntree->id.us==1) {
- ntree->id.lib= 0;
+ ntree->id.lib= NULL;
ntree->id.flag= LIB_LOCAL;
- new_id(0, (ID *)ntree, 0);
+ new_id(NULL, (ID *)ntree, NULL);
return;
}
@@ -1069,7 +1069,7 @@ void ntreeMakeLocal(bNodeTree *ntree)
if(cd.local && cd.lib==0) {
ntree->id.lib= NULL;
ntree->id.flag= LIB_LOCAL;
- new_id(0, (ID *)ntree, 0);
+ new_id(NULL, (ID *)ntree, NULL);
}
else if(cd.local && cd.lib) {
/* this is the mixed case, we copy the tree and assign it to local users */
@@ -1438,7 +1438,7 @@ static void ntree_update_link_pointers(bNodeTree *ntree)
}
}
-void ntree_validate_links(bNodeTree *ntree)
+static void ntree_validate_links(bNodeTree *ntree)
{
bNodeTreeType *ntreetype = ntreeGetType(ntree->type);
bNodeLink *link;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 08c36d76b8e..8741caffe16 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -236,6 +236,17 @@ void object_free_display(Object *ob)
freedisplist(&ob->disp);
}
+void free_sculptsession_deformMats(SculptSession *ss)
+{
+ if(ss->orig_cos) MEM_freeN(ss->orig_cos);
+ if(ss->deform_cos) MEM_freeN(ss->deform_cos);
+ if(ss->deform_imats) MEM_freeN(ss->deform_imats);
+
+ ss->orig_cos = NULL;
+ ss->deform_cos = NULL;
+ ss->deform_imats = NULL;
+}
+
void free_sculptsession(Object *ob)
{
if(ob && ob->sculpt) {
@@ -266,6 +277,7 @@ void free_sculptsession(Object *ob)
}
}
+
/* do not free object itself */
void free_object(Object *ob)
{
@@ -407,7 +419,7 @@ void unlink_object(Object *ob)
for (ct= targets.first; ct; ct= ct->next) {
if (ct->tar == ob) {
ct->tar = NULL;
- strcpy(ct->subtarget, "");
+ ct->subtarget[0]= '\0';
obt->recalc |= OB_RECALC_DATA;
}
}
@@ -437,7 +449,7 @@ void unlink_object(Object *ob)
for (ct= targets.first; ct; ct= ct->next) {
if (ct->tar == ob) {
ct->tar = NULL;
- strcpy(ct->subtarget, "");
+ ct->subtarget[0]= '\0';
obt->recalc |= OB_RECALC_DATA;
}
}
@@ -1299,6 +1311,37 @@ static void copy_object_pose(Object *obn, Object *ob)
}
}
+static int object_pose_context(Object *ob)
+{
+ if( (ob) &&
+ (ob->type == OB_ARMATURE) &&
+ (ob->pose) &&
+ (ob->mode & OB_MODE_POSE)
+ ) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+
+//Object *object_pose_armature_get(Object *ob)
+Object *object_pose_armature_get(struct Object *ob)
+{
+ if(ob==NULL)
+ return NULL;
+
+ if(object_pose_context(ob))
+ return ob;
+
+ ob= modifiers_isDeformedByArmature(ob);
+
+ if(object_pose_context(ob))
+ return ob;
+
+ return NULL;
+}
+
static void copy_object_transform(Object *ob_tar, Object *ob_src)
{
copy_v3_v3(ob_tar->loc, ob_src->loc);
@@ -2769,6 +2812,33 @@ void object_handle_update(Scene *scene, Object *ob)
}
}
+void object_sculpt_modifiers_changed(Object *ob)
+{
+ SculptSession *ss= ob->sculpt;
+
+ if(!ss->cache) {
+ /* we free pbvh on changes, except during sculpt since it can't deal with
+ changing PVBH node organization, we hope topology does not change in
+ the meantime .. weak */
+ if(ss->pbvh) {
+ BLI_pbvh_free(ss->pbvh);
+ ss->pbvh= NULL;
+ }
+
+ free_sculptsession_deformMats(ob->sculpt);
+ } else {
+ PBVHNode **nodes;
+ int n, totnode;
+
+ BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
+
+ for(n = 0; n < totnode; n++)
+ BLI_pbvh_node_mark_update(nodes[n]);
+
+ MEM_freeN(nodes);
+ }
+}
+
float give_timeoffset(Object *ob) {
if ((ob->ipoflag & OB_OFFS_PARENTADD) && ob->parent) {
return ob->sf + give_timeoffset(ob->parent);
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 74c48128c9c..b2628159563 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -65,8 +65,7 @@
#include "PIL_time.h"
#include "BLI_array.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
+#include "GL/glew.h"
#include "GPU_draw.h"
#include "GPU_extensions.h"
@@ -74,6 +73,8 @@
#include "CCGSubSurf.h"
+extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */
+
static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
int drawInteriorEdges,
int useSubsurfUv,
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index 72fe1c19884..8aeef0d84b1 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -345,7 +345,7 @@ static int unit_as_string(char *str, int len_max, double value, int prec, bUnitC
/* Convert to a string */
{
- len= BLI_snprintf(str, len_max, "%.*lf", prec, value_conv);
+ len= BLI_snprintf(str, len_max, "%.*f", prec, value_conv);
if(len >= len_max)
len= len_max;
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index 4a0c2ab9482..c53ce9dced5 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -139,12 +139,15 @@ size_t BLI_strnlen(const char *str, size_t maxlen);
void BLI_timestr(double _time, char *str); /* time var is global */
-int BLI_utf8_invalid_byte(const char *str, int length);
-int BLI_utf8_invalid_strip(char *str, int length);
-
void BLI_ascii_strtolower(char *str, int len);
void BLI_ascii_strtoupper(char *str, int len);
+
+/* string_utf8.c - may move these into their own header some day - campbell */
+char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy);
+int BLI_utf8_invalid_byte(const char *str, int length);
+int BLI_utf8_invalid_strip(char *str, int length);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index 7ca1dba9cdc..e8de8f52655 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -82,6 +82,7 @@ set(SRC
intern/smallhash.c
intern/storage.c
intern/string.c
+ intern/string_utf8.c
intern/threads.c
intern/time.c
intern/uvproject.c
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index ae5fa40f3b9..8315161aeda 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -1,8 +1,4 @@
-/* util.c
- *
- * various string, file, list operations.
- *
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -399,116 +395,6 @@ size_t BLI_strnlen(const char *str, size_t maxlen)
return end ? (size_t) (end - str) : maxlen;
}
-/* from libswish3, originally called u8_isvalid(),
- * modified to return the index of the bad character (byte index not utf).
- * http://svn.swish-e.org/libswish3/trunk/src/libswish3/utf8.c r3044 - campbell */
-
-/* based on the valid_utf8 routine from the PCRE library by Philip Hazel
-
- length is in bytes, since without knowing whether the string is valid
- it's hard to know how many characters there are! */
-
-static const char trailingBytesForUTF8[256] = {
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
-};
-
-int BLI_utf8_invalid_byte(const char *str, int length)
-{
- const unsigned char *p, *pend = (unsigned char*)str + length;
- unsigned char c;
- int ab;
-
- for (p = (unsigned char*)str; p < pend; p++) {
- c = *p;
- if (c < 128)
- continue;
- if ((c & 0xc0) != 0xc0)
- goto utf8_error;
- ab = trailingBytesForUTF8[c];
- if (length < ab)
- goto utf8_error;
- length -= ab;
-
- p++;
- /* Check top bits in the second byte */
- if ((*p & 0xc0) != 0x80)
- goto utf8_error;
-
- /* Check for overlong sequences for each different length */
- switch (ab) {
- /* Check for xx00 000x */
- case 1:
- if ((c & 0x3e) == 0) goto utf8_error;
- continue; /* We know there aren't any more bytes to check */
-
- /* Check for 1110 0000, xx0x xxxx */
- case 2:
- if (c == 0xe0 && (*p & 0x20) == 0) goto utf8_error;
- break;
-
- /* Check for 1111 0000, xx00 xxxx */
- case 3:
- if (c == 0xf0 && (*p & 0x30) == 0) goto utf8_error;
- break;
-
- /* Check for 1111 1000, xx00 0xxx */
- case 4:
- if (c == 0xf8 && (*p & 0x38) == 0) goto utf8_error;
- break;
-
- /* Check for leading 0xfe or 0xff,
- and then for 1111 1100, xx00 00xx */
- case 5:
- if (c == 0xfe || c == 0xff ||
- (c == 0xfc && (*p & 0x3c) == 0)) goto utf8_error;
- break;
- }
-
- /* Check for valid bytes after the 2nd, if any; all must start 10 */
- while (--ab > 0) {
- if ((*(p+1) & 0xc0) != 0x80) goto utf8_error;
- p++; /* do this after so we get usable offset - campbell */
- }
- }
-
- return -1;
-
-utf8_error:
-
- return (int)((char *)p - (char *)str) - 1;
-}
-
-int BLI_utf8_invalid_strip(char *str, int length)
-{
- int bad_char, tot= 0;
-
- while((bad_char= BLI_utf8_invalid_byte(str, length)) != -1) {
- str += bad_char;
- length -= bad_char;
-
- if(length == 0) {
- /* last character bad, strip it */
- *str= '\0';
- tot++;
- break;
- }
- else {
- /* strip, keep looking */
- memmove(str, str + 1, length);
- tot++;
- }
- }
-
- return tot;
-}
-
void BLI_ascii_strtolower(char *str, int len)
{
int i;
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
new file mode 100644
index 00000000000..961a41690f7
--- /dev/null
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -0,0 +1,185 @@
+/*
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2011 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Campbell Barton.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
+
+ /** \file blender/blenlib/intern/string_utf8.c
+ * \ingroup bli
+ */
+
+#include <string.h>
+
+#include "BLI_string.h"
+
+/* from libswish3, originally called u8_isvalid(),
+ * modified to return the index of the bad character (byte index not utf).
+ * http://svn.swish-e.org/libswish3/trunk/src/libswish3/utf8.c r3044 - campbell */
+
+/* based on the valid_utf8 routine from the PCRE library by Philip Hazel
+
+ length is in bytes, since without knowing whether the string is valid
+ it's hard to know how many characters there are! */
+
+static const char trailingBytesForUTF8[256] = {
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
+};
+
+int BLI_utf8_invalid_byte(const char *str, int length)
+{
+ const unsigned char *p, *pend = (unsigned char*)str + length;
+ unsigned char c;
+ int ab;
+
+ for (p = (unsigned char*)str; p < pend; p++) {
+ c = *p;
+ if (c < 128)
+ continue;
+ if ((c & 0xc0) != 0xc0)
+ goto utf8_error;
+ ab = trailingBytesForUTF8[c];
+ if (length < ab)
+ goto utf8_error;
+ length -= ab;
+
+ p++;
+ /* Check top bits in the second byte */
+ if ((*p & 0xc0) != 0x80)
+ goto utf8_error;
+
+ /* Check for overlong sequences for each different length */
+ switch (ab) {
+ /* Check for xx00 000x */
+ case 1:
+ if ((c & 0x3e) == 0) goto utf8_error;
+ continue; /* We know there aren't any more bytes to check */
+
+ /* Check for 1110 0000, xx0x xxxx */
+ case 2:
+ if (c == 0xe0 && (*p & 0x20) == 0) goto utf8_error;
+ break;
+
+ /* Check for 1111 0000, xx00 xxxx */
+ case 3:
+ if (c == 0xf0 && (*p & 0x30) == 0) goto utf8_error;
+ break;
+
+ /* Check for 1111 1000, xx00 0xxx */
+ case 4:
+ if (c == 0xf8 && (*p & 0x38) == 0) goto utf8_error;
+ break;
+
+ /* Check for leading 0xfe or 0xff,
+ and then for 1111 1100, xx00 00xx */
+ case 5:
+ if (c == 0xfe || c == 0xff ||
+ (c == 0xfc && (*p & 0x3c) == 0)) goto utf8_error;
+ break;
+ }
+
+ /* Check for valid bytes after the 2nd, if any; all must start 10 */
+ while (--ab > 0) {
+ if ((*(p+1) & 0xc0) != 0x80) goto utf8_error;
+ p++; /* do this after so we get usable offset - campbell */
+ }
+ }
+
+ return -1;
+
+utf8_error:
+
+ return (int)((char *)p - (char *)str) - 1;
+}
+
+int BLI_utf8_invalid_strip(char *str, int length)
+{
+ int bad_char, tot= 0;
+
+ while((bad_char= BLI_utf8_invalid_byte(str, length)) != -1) {
+ str += bad_char;
+ length -= bad_char;
+
+ if(length == 0) {
+ /* last character bad, strip it */
+ *str= '\0';
+ tot++;
+ break;
+ }
+ else {
+ /* strip, keep looking */
+ memmove(str, str + 1, length);
+ tot++;
+ }
+ }
+
+ return tot;
+}
+
+
+/* compatible with BLI_strncpy, but esnure no partial utf8 chars */
+
+/* array copied from glib's gutf8.c,
+ * note: this looks to be at odd's with 'trailingBytesForUTF8',
+ * need to find out what gives here! - campbell */
+static const size_t utf8_skip_data[256] = {
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
+};
+
+char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy)
+{
+ char *dst_r= dst;
+ size_t utf8_size;
+
+ /* note: currently we dont attempt to deal with invalid utf8 chars */
+
+ while(*src != '\0' && (utf8_size= utf8_skip_data[*src]) < maxncpy) {
+ maxncpy -= utf8_size;
+ switch(utf8_size) {
+ case 6: *dst ++ = *src ++;
+ case 5: *dst ++ = *src ++;
+ case 4: *dst ++ = *src ++;
+ case 3: *dst ++ = *src ++;
+ case 2: *dst ++ = *src ++;
+ case 1: *dst ++ = *src ++;
+ }
+ }
+ *dst= '\0';
+ return dst_r;
+}
+
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 36048cef5b8..6099331b75b 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4033,7 +4033,6 @@ static void direct_link_pose(FileData *fd, bPose *pose)
direct_link_motionpath(fd, pchan->mpath);
pchan->iktree.first= pchan->iktree.last= NULL;
- pchan->path= NULL;
/* incase this value changes in future, clamp else we get undefined behavior */
CLAMP(pchan->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
@@ -9298,7 +9297,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
simasel->prv_w = 96;
simasel->flag = 7; /* ??? elubie */
strcpy (simasel->dir, U.textudir); /* TON */
- strcpy (simasel->file, "");
+ simasel->file[0]= '\0';
simasel->returnfunc = NULL;
simasel->title[0] = 0;
@@ -9528,7 +9527,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* clear old targets to avoid problems */
data->tar = NULL;
- strcpy(data->subtarget, "");
+ data->subtarget[0]= '\0';
}
}
else if (con->type == CONSTRAINT_TYPE_LOCLIKE) {
@@ -9558,7 +9557,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* clear old targets to avoid problems */
data->tar = NULL;
- strcpy(data->subtarget, "");
+ data->subtarget[0]= '\0';
}
}
else if (con->type == CONSTRAINT_TYPE_LOCLIKE) {
diff --git a/source/blender/bmesh/editmesh_tools.c b/source/blender/bmesh/editmesh_tools.c
index 4250a682866..b611a729f76 100644
--- a/source/blender/bmesh/editmesh_tools.c
+++ b/source/blender/bmesh/editmesh_tools.c
@@ -2477,7 +2477,7 @@ void esubdivideflag(int flag, float rad, int beauty, int numcuts, int seltype)
}
for (; md; md=md->next) {
- if (md->type==eModifierType_Mirror) {
+ if ((md->type==eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
MirrorModifierData *mmd = (MirrorModifierData*) md;
if(mmd->flag & MOD_MIR_CLIPPING) {
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index bb710a32794..bd5935c893c 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -893,7 +893,7 @@ static size_t skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner
*/
static short skip_fcurve_with_name (bDopeSheet *ads, FCurve *fcu, ID *owner_id)
{
- bAnimListElem ale_dummy = {0};
+ bAnimListElem ale_dummy = {NULL};
bAnimChannelType *acf;
/* create a dummy wrapper for the F-Curve */
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 2305848e7b3..fa619e4cf44 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -204,8 +204,8 @@ static short ob_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Object *o
int filter;
int ret=0;
- bAnimListElem dummychan = {0};
- Base dummybase = {0};
+ bAnimListElem dummychan = {NULL};
+ Base dummybase = {NULL};
if (ob == NULL)
return 0;
@@ -249,7 +249,7 @@ static short scene_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Scene
int filter;
int ret=0;
- bAnimListElem dummychan = {0};
+ bAnimListElem dummychan = {NULL};
if (sce == NULL)
return 0;
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 37a5d7bf603..77ab97b4d57 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -643,7 +643,7 @@ static void applyarmature_fix_boneparents (Scene *scene, Object *armob)
static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); // must be active object, not edit-object
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C)); // must be active object, not edit-object
bArmature *arm= get_armature(ob);
bPose *pose;
bPoseChannel *pchan;
@@ -745,7 +745,7 @@ void POSE_OT_armature_apply (wmOperatorType *ot)
/* set the current pose as the restpose */
static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); // must be active object, not edit-object
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C)); // must be active object, not edit-object
/* don't check if editmode (should be done by caller) */
if (ob->type!=OB_ARMATURE)
@@ -4887,7 +4887,7 @@ static int pose_clear_transform_generic_exec(bContext *C, wmOperator *op,
void (*clear_func)(bPoseChannel*), const char default_ksName[])
{
Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
short autokey = 0;
/* sanity checks */
@@ -5114,7 +5114,7 @@ void POSE_OT_select_all(wmOperatorType *ot)
static int pose_select_parent_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bPoseChannel *pchan,*parent;
/* Determine if there is an active bone */
@@ -5190,7 +5190,7 @@ static int hide_unselected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr
/* active object is armature in posemode, poll checked */
static int pose_hide_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm= ob->data;
if(RNA_boolean_get(op->ptr, "unselected"))
@@ -5239,7 +5239,7 @@ static int show_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
/* active object is armature in posemode, poll checked */
static int pose_reveal_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm= ob->data;
bone_looper(ob, arm->bonebase.first, NULL, show_pose_bone_cb);
diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c
index b0ff60455cf..16888908bab 100644
--- a/source/blender/editors/armature/poseSlide.c
+++ b/source/blender/editors/armature/poseSlide.c
@@ -51,6 +51,7 @@
#include "BKE_fcurve.h"
#include "BKE_context.h"
+#include "BKE_object.h"
#include "BKE_report.h"
#include "RNA_access.h"
@@ -129,7 +130,7 @@ static int pose_slide_init (bContext *C, wmOperator *op, short mode)
/* get info from context */
pso->scene= CTX_data_scene(C);
- pso->ob= ED_object_pose_armature(CTX_data_active_object(C));
+ pso->ob= object_pose_armature_get(CTX_data_active_object(C));
pso->arm= (pso->ob)? pso->ob->data : NULL;
pso->sa= CTX_wm_area(C); /* only really needed when doing modal() */
pso->ar= CTX_wm_region(C); /* only really needed when doing modal() */
@@ -1164,7 +1165,7 @@ static void pose_propagate_fcurve (wmOperator *op, Object *ob, FCurve *fcu,
static int pose_propagate_exec (bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bAction *act= (ob && ob->adt)? ob->adt->action : NULL;
ListBase pflinks = {NULL, NULL};
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index 864eaa3bdbd..67c93c4c906 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -54,6 +54,7 @@
#include "BKE_depsgraph.h"
#include "BKE_idprop.h"
#include "BKE_library.h"
+#include "BKE_object.h"
#include "BKE_context.h"
#include "BKE_report.h"
@@ -170,7 +171,7 @@ static Object *get_poselib_object (bContext *C)
if (sa && (sa->spacetype == SPACE_BUTS))
return CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- return ED_object_pose_armature(CTX_data_active_object(C));
+ return object_pose_armature_get(CTX_data_active_object(C));
}
/* Poll callback for operators that require existing PoseLib data (with poses) to work */
@@ -632,7 +633,7 @@ static int poselib_rename_invoke (bContext *C, wmOperator *op, wmEvent *evt)
static int poselib_rename_exec (bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bAction *act= (ob) ? ob->poselib : NULL;
TimeMarker *marker;
char newname[64];
@@ -1438,9 +1439,7 @@ static void poselib_preview_init_data (bContext *C, wmOperator *op)
pld->pose->flag &= ~POSE_DO_UNLOCK;
/* clear strings + search */
- strcpy(pld->headerstr, "");
- strcpy(pld->searchstr, "");
- strcpy(pld->searchold, "");
+ pld->headerstr[0]= pld->searchstr[0]= pld->searchold[0]= '\0';
pld->search_cursor= 0;
}
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index 3911be02fe7..83285d3634a 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -58,6 +58,7 @@
#include "BKE_depsgraph.h"
#include "BKE_fcurve.h"
#include "BKE_modifier.h"
+#include "BKE_object.h"
#include "BKE_report.h"
@@ -78,36 +79,6 @@
#include "armature_intern.h"
-static int object_pose_context(Object *ob)
-{
- if( (ob) &&
- (ob->type == OB_ARMATURE) &&
- (ob->pose) &&
- (ob->mode & OB_MODE_POSE)
- ) {
- return 1;
- }
- else {
- return 0;
- }
-}
-
-Object *ED_object_pose_armature(Object *ob)
-{
- if(ob==NULL)
- return NULL;
-
- if(object_pose_context(ob))
- return ob;
-
- ob= modifiers_isDeformedByArmature(ob);
-
- if(object_pose_context(ob))
- return ob;
-
- return NULL;
-}
-
/* This function is used to process the necessary updates for */
void ED_armature_enter_posemode(bContext *C, Base *base)
{
@@ -238,7 +209,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op))
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
if (ELEM(NULL, ob, ob->pose))
return OPERATOR_CANCELLED;
@@ -314,7 +285,7 @@ static int pose_clear_paths_exec (bContext *C, wmOperator *UNUSED(op))
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
/* only continue if there's an object */
if ELEM(NULL, ob, ob->pose)
@@ -348,7 +319,7 @@ void POSE_OT_paths_clear (wmOperatorType *ot)
static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bConstraint *con;
int found= 0;
@@ -408,7 +379,7 @@ void POSE_OT_select_constraint_target(wmOperatorType *ot)
static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm= ob->data;
Bone *curbone, *pabone, *chbone;
int direction = RNA_enum_get(op->ptr, "direction");
@@ -646,7 +617,7 @@ static int pose_select_same_keyingset(bContext *C, Object *ob, short extend)
static int pose_select_grouped_exec (bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
short extend= RNA_boolean_get(op->ptr, "extend");
short changed = 0;
@@ -713,7 +684,7 @@ void POSE_OT_select_grouped (wmOperatorType *ot)
static int pose_bone_flip_active_exec (bContext *C, wmOperator *UNUSED(op))
{
Object *ob_act= CTX_data_active_object(C);
- Object *ob= ED_object_pose_armature(ob_act);
+ Object *ob= object_pose_armature_get(ob_act);
if(ob && (ob->mode & OB_MODE_POSE)) {
bArmature *arm= ob->data;
@@ -1135,7 +1106,7 @@ static bPoseChannel *pose_bone_do_paste (Object *ob, bPoseChannel *chan, short s
static int pose_copy_exec (bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
/* sanity checking */
if ELEM(NULL, ob, ob->pose) {
@@ -1173,7 +1144,7 @@ void POSE_OT_copy (wmOperatorType *ot)
static int pose_paste_exec (bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
Scene *scene= CTX_data_scene(C);
bPoseChannel *chan;
int flip= RNA_boolean_get(op->ptr, "flipped");
@@ -1272,7 +1243,7 @@ static int pose_group_add_exec (bContext *C, wmOperator *UNUSED(op))
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
/* only continue if there's an object */
if (ob == NULL)
@@ -1312,7 +1283,7 @@ static int pose_group_remove_exec (bContext *C, wmOperator *UNUSED(op))
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
/* only continue if there's an object */
if (ob == NULL)
@@ -1360,7 +1331,7 @@ static int pose_groups_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
/* only continue if there's an object, and a pose there too */
if (ELEM(NULL, ob, ob->pose))
@@ -1409,7 +1380,7 @@ static int pose_group_assign_exec (bContext *C, wmOperator *op)
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
/* only continue if there's an object, and a pose there too */
if (ELEM(NULL, ob, ob->pose))
@@ -1472,7 +1443,7 @@ static int pose_group_unassign_exec (bContext *C, wmOperator *UNUSED(op))
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
/* only continue if there's an object, and a pose there too */
if (ELEM(NULL, ob, ob->pose))
@@ -1707,7 +1678,7 @@ static int pose_group_select_exec (bContext *C, wmOperator *UNUSED(op))
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
/* only continue if there's an object, and a pose there too */
if (ELEM(NULL, ob, ob->pose))
@@ -1745,7 +1716,7 @@ static int pose_group_deselect_exec (bContext *C, wmOperator *UNUSED(op))
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
/* only continue if there's an object, and a pose there too */
if (ELEM(NULL, ob, ob->pose))
@@ -1778,7 +1749,7 @@ void POSE_OT_group_deselect (wmOperatorType *ot)
static int pose_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm;
/* paranoia checks */
@@ -1823,7 +1794,7 @@ void POSE_OT_flip_names (wmOperatorType *ot)
static int pose_autoside_names_exec (bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm;
char newname[32];
short axis= RNA_enum_get(op->ptr, "axis");
@@ -1927,7 +1898,7 @@ static int pose_armature_layers_showall_poll (bContext *C)
static int pose_armature_layers_showall_exec (bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm = (ob)? ob->data : NULL;
PointerRNA ptr;
int maxLayers = (RNA_boolean_get(op->ptr, "all"))? 32 : 16;
@@ -1979,7 +1950,7 @@ void ARMATURE_OT_layers_show_all (wmOperatorType *ot)
/* Present a popup to get the layers that should be used */
static int pose_armature_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm= (ob)? ob->data : NULL;
PointerRNA ptr;
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
@@ -2000,7 +1971,7 @@ static int pose_armature_layers_invoke (bContext *C, wmOperator *op, wmEvent *ev
/* Set the visible layers for the active armature (edit and pose modes) */
static int pose_armature_layers_exec (bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
PointerRNA ptr;
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
@@ -2090,7 +2061,7 @@ static int pose_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt)
/* Set the visible layers for the active armature (edit and pose modes) */
static int pose_bone_layers_exec (bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
PointerRNA ptr;
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
@@ -2213,7 +2184,7 @@ void ARMATURE_OT_bone_layers (wmOperatorType *ot)
static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, "LocRotScale");
/* loop through all selected pchans, flipping and keying (as needed) */
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index 1c9ad8fe247..6b85523ac82 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -53,7 +53,6 @@
#include "curve_intern.h"
-
/************************* registration ****************************/
void ED_operatortypes_curve(void)
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index c6e290e56ef..c980499bbc2 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -117,7 +117,7 @@ static float nurbcircle[8][2]= {
{0.0, 1.0}, { 1.0, 1.0}, { 1.0, 0.0}, { 1.0, -1.0}
};
-ListBase *curve_get_editcurve(Object *ob)
+ListBase *object_editcurve_get(Object *ob)
{
if(ob && ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu= ob->data;
@@ -134,7 +134,7 @@ static void set_actNurb(Object *obedit, Nurb *nu)
if(nu==NULL)
cu->actnu = -1;
else {
- ListBase *nurbs= ED_curve_editnurbs(cu);
+ ListBase *nurbs= curve_editnurbs(cu);
cu->actnu = BLI_findindex(nurbs, nu);
}
}
@@ -142,7 +142,7 @@ static void set_actNurb(Object *obedit, Nurb *nu)
static Nurb *get_actNurb(Object *obedit)
{
Curve *cu= obedit->data;
- ListBase *nurbs= ED_curve_editnurbs(cu);
+ ListBase *nurbs= curve_editnurbs(cu);
return BLI_findlink(nurbs, cu->actnu);
}
@@ -268,7 +268,7 @@ static int isNurbsel_count(Curve *cu, Nurb *nu)
void printknots(Object *obedit)
{
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
int a, num;
@@ -302,11 +302,6 @@ static CVKeyIndex *init_cvKeyIndex(void *cv, int key_index, int nu_index, int pt
return cvIndex;
}
-static void free_cvKeyIndex(CVKeyIndex *pointIndex)
-{
- MEM_freeN(pointIndex);
-}
-
static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
{
Nurb *nu= editnurb->nurbs.first;
@@ -358,15 +353,6 @@ static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
editnurb->keyindex= gh;
}
-static void free_editNurb_keyIndex(EditNurb *editnurb)
-{
- if (!editnurb->keyindex) {
- return;
- }
- BLI_ghash_free(editnurb->keyindex, NULL, (GHashValFreeFP)free_cvKeyIndex);
- editnurb->keyindex= NULL;
-}
-
static CVKeyIndex *getCVKeyIndex(EditNurb *editnurb, void *cv)
{
return BLI_ghash_lookup(editnurb->keyindex, cv);
@@ -411,7 +397,7 @@ static void keyIndex_delCV(EditNurb *editnurb, void *cv)
return;
}
- BLI_ghash_remove(editnurb->keyindex, cv, NULL, (GHashValFreeFP)free_cvKeyIndex);
+ BLI_ghash_remove(editnurb->keyindex, cv, NULL, (GHashValFreeFP)MEM_freeN);
}
static void keyIndex_delBezt(EditNurb *editnurb, BezTriple *bezt)
@@ -437,7 +423,7 @@ static void keyIndex_delNurb(EditNurb *editnurb, Nurb *nu)
a= nu->pntsu;
while (a--) {
- BLI_ghash_remove(editnurb->keyindex, bezt, NULL, (GHashValFreeFP)free_cvKeyIndex);
+ BLI_ghash_remove(editnurb->keyindex, bezt, NULL, (GHashValFreeFP)MEM_freeN);
++bezt;
}
} else {
@@ -445,7 +431,7 @@ static void keyIndex_delNurb(EditNurb *editnurb, Nurb *nu)
a= nu->pntsu * nu->pntsv;
while (a--) {
- BLI_ghash_remove(editnurb->keyindex, bp, NULL, (GHashValFreeFP)free_cvKeyIndex);
+ BLI_ghash_remove(editnurb->keyindex, bp, NULL, (GHashValFreeFP)MEM_freeN);
++bp;
}
}
@@ -1198,7 +1184,7 @@ int ED_curve_updateAnimPaths(Object *obedit)
/* load editNurb in object */
void load_editNurb(Object *obedit)
{
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
if(obedit==NULL) return;
@@ -1251,7 +1237,7 @@ void make_editNurb(Object *obedit)
if(editnurb) {
freeNurblist(&editnurb->nurbs);
- free_editNurb_keyIndex(editnurb);
+ free_curve_editNurb_keyIndex(editnurb);
editnurb->keyindex= NULL;
} else {
editnurb= MEM_callocN(sizeof(EditNurb), "editnurb");
@@ -1283,16 +1269,6 @@ void make_editNurb(Object *obedit)
}
}
-void free_curve_editNurb (Curve *cu)
-{
- if(cu->editnurb) {
- freeNurblist(&cu->editnurb->nurbs);
- free_editNurb_keyIndex(cu->editnurb);
- MEM_freeN(cu->editnurb);
- cu->editnurb= NULL;
- }
-}
-
void free_editNurb(Object *obedit)
{
Curve *cu= obedit->data;
@@ -1302,7 +1278,7 @@ void free_editNurb(Object *obedit)
void CU_deselect_all(Object *obedit)
{
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
if (editnurb) {
selectend_nurb(obedit, FIRST, 0, DESELECT); /* set first control points as unselected */
@@ -1312,7 +1288,7 @@ void CU_deselect_all(Object *obedit)
void CU_select_all(Object *obedit)
{
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
if (editnurb) {
selectend_nurb(obedit, FIRST, 0, SELECT); /* set first control points as unselected */
@@ -1322,7 +1298,7 @@ void CU_select_all(Object *obedit)
void CU_select_swap(Object *obedit)
{
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
if (editnurb) {
Curve *cu= obedit->data;
@@ -1397,7 +1373,7 @@ static int separate_exec(bContext *C, wmOperator *op)
make_editNurb(newob);
newedit= newcu->editnurb;
freeNurblist(&newedit->nurbs);
- free_editNurb_keyIndex(newedit);
+ free_curve_editNurb_keyIndex(newedit);
/* 3. move over parts from old object */
for(nu= oldedit->nurbs.first; nu; nu=nu1) {
@@ -1588,7 +1564,7 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
{
Object *obedit= CTX_data_edit_object(C);
Curve *cu= obedit->data;
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu, *next;
BPoint *bp, *bpn, *newbp;
int a, b, newu, newv, sel;
@@ -1835,7 +1811,7 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
static void adduplicateflagNurb(Object *obedit, short flag)
{
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu, *newnu;
BezTriple *bezt, *bezt1;
BPoint *bp, *bp1;
@@ -2051,7 +2027,7 @@ void CURVE_OT_switch_direction(wmOperatorType *ot)
static int set_goal_weight_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
BezTriple *bezt;
BPoint *bp;
@@ -2103,7 +2079,7 @@ void CURVE_OT_spline_weight_set(wmOperatorType *ot)
static int set_radius_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
BezTriple *bezt;
BPoint *bp;
@@ -2155,7 +2131,7 @@ void CURVE_OT_radius_set(wmOperatorType *ot)
static int smooth_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
BezTriple *bezt, *beztOrig;
BPoint *bp, *bpOrig;
@@ -2228,7 +2204,7 @@ void CURVE_OT_smooth(wmOperatorType *ot)
static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
BezTriple *bezt;
BPoint *bp;
@@ -2461,7 +2437,7 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short
/* selstatus: selection status in case doswap is false */
void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatus)
{
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
@@ -2603,7 +2579,7 @@ static short nurb_has_selected_cps(ListBase *editnurb)
static int de_select_all_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
int action = RNA_enum_get(op->ptr, "action");
if (action == SEL_TOGGLE) {
@@ -2652,7 +2628,7 @@ static int hide_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
Curve *cu= obedit->data;
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
@@ -2725,7 +2701,7 @@ void CURVE_OT_hide(wmOperatorType *ot)
static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
@@ -2783,7 +2759,7 @@ static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
Curve *cu= obedit->data;
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
@@ -3542,7 +3518,7 @@ void ED_nurb_set_spline_type(Nurb *nu, int type)
static int set_spline_type_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
int changed=0, type= RNA_enum_get(op->ptr, "type");
@@ -3606,7 +3582,7 @@ void CURVE_OT_spline_type_set(wmOperatorType *ot)
static int set_handle_type_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
sethandlesNurb(editnurb, RNA_enum_get(op->ptr, "type"));
@@ -3928,7 +3904,7 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
static int merge_nurb(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
NurbSort *nus1, *nus2;
int ok= 1;
@@ -3984,7 +3960,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
/* joins 2 curves */
Object *obedit= CTX_data_edit_object(C);
Curve *cu= obedit->data;
- ListBase *nubase= curve_get_editcurve(obedit);
+ ListBase *nubase= object_editcurve_get(obedit);
Nurb *nu, *nu1=NULL, *nu2=NULL;
BPoint *bp;
float *fp, offset;
@@ -4180,7 +4156,7 @@ int mouse_nurb(bContext *C, const int mval[2], int extend)
{
Object *obedit= CTX_data_edit_object(C);
Curve *cu= obedit->data;
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
ViewContext vc;
Nurb *nu;
BezTriple *bezt=NULL;
@@ -4264,7 +4240,7 @@ int mouse_nurb(bContext *C, const int mval[2], int extend)
static int spin_nurb(float viewmat[][4], Object *obedit, float *axis, float *cent)
{
Curve *cu= (Curve*)obedit->data;
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
float si,phi,n[3],q[4],cmat[3][3],tmat[3][3],imat[3][3];
float bmat[3][3], rotmat[3][3], scalemat1[3][3], scalemat2[3][3];
@@ -4786,7 +4762,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
Curve *cu= obedit->data;
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
BezTriple *bezt;
BPoint *bp;
@@ -4863,7 +4839,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
static int toggle_cyclic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Object *obedit= CTX_data_edit_object(C);
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
uiPopupMenu *pup;
uiLayout *layout;
Nurb *nu;
@@ -5050,7 +5026,7 @@ static int select_row_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
Curve *cu= obedit->data;
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
static BPoint *last= NULL;
static int direction=0;
Nurb *nu;
@@ -5124,7 +5100,7 @@ void CURVE_OT_select_row(wmOperatorType *ot)
static int select_next_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
select_adjacent_cp(editnurb, 1, 0, SELECT);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
@@ -5151,7 +5127,7 @@ void CURVE_OT_select_next(wmOperatorType *ot)
static int select_previous_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
select_adjacent_cp(editnurb, -1, 0, SELECT);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
@@ -5178,7 +5154,7 @@ void CURVE_OT_select_previous(wmOperatorType *ot)
static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
BPoint *bp, *tempbp;
int a;
@@ -5266,7 +5242,7 @@ void CURVE_OT_select_more(wmOperatorType *ot)
static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
@@ -5458,7 +5434,7 @@ static void selectrandom_curve(ListBase *editnurb, float randfac)
static int select_random_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
if(!RNA_boolean_get(op->ptr, "extend"))
CU_deselect_all(obedit);
@@ -5550,7 +5526,7 @@ static void select_nth_bp(Nurb *nu, BPoint *bp, int nth)
int CU_select_nth(Object *obedit, int nth)
{
Curve *cu= (Curve*)obedit->data;
- ListBase *nubase= ED_curve_editnurbs(cu);
+ ListBase *nubase= curve_editnurbs(cu);
Nurb *nu;
int ok=0;
@@ -6024,7 +6000,7 @@ void CURVE_OT_delete(wmOperatorType *ot)
static int shade_smooth_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
int clear= (strcmp(op->idname, "CURVE_OT_shade_flat") == 0);
@@ -6196,7 +6172,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
{
static int xzproj= 0; /* this function calls itself... */
Object *obedit= CTX_data_edit_object(C);
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
View3D *v3d= CTX_wm_view3d(C);
RegionView3D *rv3d= ED_view3d_context_rv3d(C);
Nurb *nu = NULL;
@@ -6612,7 +6588,7 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
ED_object_new_primitive_matrix(C, obedit, loc, rot, mat);
nu= add_nurbs_primitive(C, mat, type, newob);
- editnurb= curve_get_editcurve(obedit);
+ editnurb= object_editcurve_get(obedit);
BLI_addtail(editnurb, nu);
/* userdef */
@@ -6895,7 +6871,7 @@ static int clear_tilt_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
Curve *cu= obedit->data;
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
BezTriple *bezt;
BPoint *bp;
@@ -6965,7 +6941,7 @@ static void undoCurve_to_editCurve(void *ucu, void *UNUSED(edata), void *obe)
Curve *cu= (Curve*)obedit->data;
UndoCurve *undoCurve= ucu;
ListBase *undobase= &undoCurve->nubase;
- ListBase *editbase= ED_curve_editnurbs(cu);
+ ListBase *editbase= curve_editnurbs(cu);
Nurb *nu, *newnu;
EditNurb *editnurb= cu->editnurb;
void *lastsel= NULL;
@@ -6974,7 +6950,7 @@ static void undoCurve_to_editCurve(void *ucu, void *UNUSED(edata), void *obe)
freeNurblist(editbase);
if (undoCurve->undoIndex) {
- BLI_ghash_free(editnurb->keyindex, NULL, (GHashValFreeFP)free_cvKeyIndex);
+ BLI_ghash_free(editnurb->keyindex, NULL, (GHashValFreeFP)MEM_freeN);
editnurb->keyindex= dupli_keyIndexHash(undoCurve->undoIndex);
}
@@ -7012,7 +6988,7 @@ static void undoCurve_to_editCurve(void *ucu, void *UNUSED(edata), void *obe)
static void *editCurve_to_undoCurve(void *UNUSED(edata), void *obdata)
{
Curve *cu= obdata;
- ListBase *nubase= ED_curve_editnurbs(cu);
+ ListBase *nubase= curve_editnurbs(cu);
UndoCurve *undoCurve;
EditNurb *editnurb= cu->editnurb, tmpEditnurb;
Nurb *nu, *newnu;
@@ -7061,7 +7037,7 @@ static void free_undoCurve(void *ucv)
freeNurblist(&undoCurve->nubase);
if(undoCurve->undoIndex)
- BLI_ghash_free(undoCurve->undoIndex, NULL, (GHashValFreeFP)free_cvKeyIndex);
+ BLI_ghash_free(undoCurve->undoIndex, NULL, (GHashValFreeFP)MEM_freeN);
free_fcurves(&undoCurve->fcurves);
free_fcurves(&undoCurve->drivers);
@@ -7081,15 +7057,6 @@ void undo_push_curve(bContext *C, const char *name)
undo_editmode_push(C, name, get_data, free_undoCurve, undoCurve_to_editCurve, editCurve_to_undoCurve, NULL);
}
-/* Get list of nurbs from editnurbs structure */
-ListBase *ED_curve_editnurbs(Curve *cu)
-{
- if (cu->editnurb) {
- return &cu->editnurb->nurbs;
- }
-
- return NULL;
-}
void ED_curve_beztcpy(EditNurb *editnurb, BezTriple *dst, BezTriple *src, int count)
{
memcpy(dst, src, count*sizeof(BezTriple));
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 0f4e381b71d..a7dc5409685 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1877,7 +1877,7 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
static EnumPropertyItem prop_gpencil_drawmodes[] = {
{GP_PAINTMODE_DRAW, "DRAW", 0, "Draw Freehand", ""},
{GP_PAINTMODE_DRAW_STRAIGHT, "DRAW_STRAIGHT", 0, "Draw Straight Lines", ""},
- {GP_PAINTMODE_DRAW_POLY, "DRAW_POLY", 0, "Dtaw Poly Line", ""},
+ {GP_PAINTMODE_DRAW_POLY, "DRAW_POLY", 0, "Draw Poly Line", ""},
{GP_PAINTMODE_ERASER, "ERASER", 0, "Eraser", ""},
{0, NULL, 0, NULL, NULL}
};
diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h
index a029c5c1f12..b73684d43d8 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -148,7 +148,6 @@ void ED_armature_bone_rename(struct bArmature *arm, char *oldnamep, char *newnam
void undo_push_armature(struct bContext *C, const char *name);
/* poseobject.c */
-struct Object *ED_object_pose_armature(struct Object *ob);
void ED_armature_exit_posemode(struct bContext *C, struct Base *base);
void ED_armature_enter_posemode(struct bContext *C, struct Base *base);
int ED_pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan);
diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h
index d78d2846572..b4782a5919b 100644
--- a/source/blender/editors/include/ED_curve.h
+++ b/source/blender/editors/include/ED_curve.h
@@ -58,7 +58,7 @@ void CU_select_swap(struct Object *obedit);
void undo_push_curve (struct bContext *C, const char *name);
-ListBase *curve_get_editcurve(struct Object *ob);
+ListBase *object_editcurve_get(struct Object *ob);
void load_editNurb (struct Object *obedit);
void make_editNurb (struct Object *obedit);
diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h
index 33d2dfcf4c5..85a8d8945bb 100644
--- a/source/blender/editors/include/ED_sculpt.h
+++ b/source/blender/editors/include/ED_sculpt.h
@@ -44,7 +44,6 @@ void ED_operatortypes_sculpt(void);
void sculpt_get_redraw_planes(float planes[4][4], struct ARegion *ar,
struct RegionView3D *rv3d, struct Object *ob);
void ED_sculpt_force_update(struct bContext *C);
-void ED_sculpt_modifiers_changed(struct Object *ob);
/* paint_ops.c */
void ED_operatortypes_paint(void);
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index a55ee01202c..f31c16cd020 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1235,7 +1235,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
ysize= block->maxy - block->miny+4;
/*aspect/= (float)xsize;*/ /*UNUSED*/
- if(but) {
+ {
int left=0, right=0, top=0, down=0;
int winx, winy;
// int offscreen;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index c36742f7c4d..45829646145 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -588,20 +588,6 @@ static void shadecolors4(char *coltop, char *coldown, const char *color, short s
coldown[3]= color[3];
}
-static void round_box_shade_col4(const char col1[4], const char col2[4], const float fac)
-{
- unsigned char col[4];
- const int faci= FTOCHAR(fac);
- const int facm= 255-faci;
-
- col[0]= (faci*col1[0] + facm*col2[0])>>8;
- col[1]= (faci*col1[1] + facm*col2[1])>>8;
- col[2]= (faci*col1[2] + facm*col2[2])>>8;
- col[3]= (faci*col1[3] + facm*col2[3])>>8;
-
- glColor4ubv(col);
-}
-
static void round_box_shade_col4_r(unsigned char col_r[4], const char col1[4], const char col2[4], const float fac)
{
const int faci= FTOCHAR(fac);
diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c
index 8d86c7fd097..e87d2ea770d 100644
--- a/source/blender/editors/mesh/bmesh_tools.c
+++ b/source/blender/editors/mesh/bmesh_tools.c
@@ -434,7 +434,7 @@ static short EDBM_Extrude_edge(Object *obedit, BMEditMesh *em, int flag, float *
*/
md = obedit->modifiers.first;
for (; md; md=md->next) {
- if (md->type==eModifierType_Mirror) {
+ if ((md->type==eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
MirrorModifierData *mmd = (MirrorModifierData*) md;
if(mmd->flag & MOD_MIR_CLIPPING) {
@@ -1758,7 +1758,7 @@ static int do_smooth_vertex(bContext *C, wmOperator *op)
* are within tolerance of the plane(s) of reflection
*/
for(md=obedit->modifiers.first; md; md=md->next) {
- if(md->type==eModifierType_Mirror) {
+ if(md->type==eModifierType_Mirror && (md->mode & eModifierMode_Realtime)) {
MirrorModifierData *mmd = (MirrorModifierData*) md;
if(mmd->flag & MOD_MIR_CLIPPING) {
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 45888b1486b..152fcae4d57 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -404,7 +404,7 @@ static Object *effector_add_type(bContext *C, wmOperator *op, int type)
((Curve*)ob->data)->flag |= CU_PATH|CU_3D;
ED_object_enter_editmode(C, 0);
ED_object_new_primitive_matrix(C, ob, loc, rot, mat);
- BLI_addtail(curve_get_editcurve(ob), add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_PATH, 1));
+ BLI_addtail(object_editcurve_get(ob), add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_PATH, 1));
if(!enter_editmode)
ED_object_exit_editmode(C, EM_FREEDATA);
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 2055c906b41..66db7db5171 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -987,7 +987,7 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
/* free constraints for all selected bones */
CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
@@ -1423,7 +1423,7 @@ static int object_constraint_add_exec(bContext *C, wmOperator *op)
/* dummy operator callback */
static int pose_constraint_add_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(ED_object_active_context(C));
+ Object *ob= object_pose_armature_get(ED_object_active_context(C));
int type= RNA_enum_get(op->ptr, "type");
short with_targets= 0;
@@ -1526,7 +1526,7 @@ void POSE_OT_constraint_add_with_targets(wmOperatorType *ot)
/* present menu with options + validation for targets to use */
static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bPoseChannel *pchan= get_active_posechannel(ob);
bConstraint *con= NULL;
@@ -1610,7 +1610,7 @@ void POSE_OT_ik_add(wmOperatorType *ot)
/* remove IK constraints from selected bones */
static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
/* only remove IK Constraints */
CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 01fab0813d4..8559611cad1 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -222,7 +222,7 @@ static void select_editlattice_hook(Object *obedit, HookModifierData *hmd)
static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, float *cent)
{
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
@@ -332,7 +332,7 @@ static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char
static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
{
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 4361f53ab85..a78c3f3105f 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -736,7 +736,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
- int mode_orig = ob->mode;
+ int mode_orig = ob ? ob->mode : 0;
if(!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md))
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/object/object_navmesh.cpp b/source/blender/editors/object/object_navmesh.cpp
index d0768d30236..ae97b40eb49 100644
--- a/source/blender/editors/object/object_navmesh.cpp
+++ b/source/blender/editors/object/object_navmesh.cpp
@@ -575,7 +575,7 @@ static int findFreeNavPolyIndex(EditMesh* em)
else if (indices[i]>freeIdx)
break;
}
- delete indices;
+ delete [] indices;
return freeIdx;
}
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 0eac6f6ff37..34496fa3f3a 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -138,7 +138,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
}
}
else if(ELEM(obedit->type, OB_SURF, OB_CURVE)) {
- ListBase *editnurb= curve_get_editcurve(obedit);
+ ListBase *editnurb= object_editcurve_get(obedit);
cu= obedit->data;
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 97089c403b4..0076ef9c9a5 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -52,6 +52,7 @@
#include "BKE_animsys.h"
#include "BKE_context.h"
+#include "BKE_curve.h"
#include "BKE_depsgraph.h"
#include "BKE_font.h"
#include "BKE_global.h"
@@ -179,7 +180,7 @@ static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op))
}
else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
Nurb *nu;
- ListBase *nurbs= ED_curve_editnurbs((Curve*)ob->data);
+ ListBase *nurbs= curve_editnurbs((Curve*)ob->data);
if(nurbs) {
for(nu= nurbs->first; nu; nu= nu->next)
@@ -234,7 +235,7 @@ static int material_slot_de_select(bContext *C, int select)
}
}
else if ELEM(ob->type, OB_CURVE, OB_SURF) {
- ListBase *nurbs= ED_curve_editnurbs((Curve*)ob->data);
+ ListBase *nurbs= curve_editnurbs((Curve*)ob->data);
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
@@ -529,7 +530,7 @@ void SCENE_OT_render_layer_add(wmOperatorType *ot)
static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C), *sce;
SceneRenderLayer *rl;
int act= scene->r.actlay;
@@ -541,15 +542,17 @@ static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
MEM_freeN(rl);
scene->r.actlay= 0;
-
- if(scene->nodetree) {
- bNode *node;
- for(node= scene->nodetree->nodes.first; node; node= node->next) {
- if(node->type==CMP_NODE_R_LAYERS && node->id==NULL) {
- if(node->custom1==act)
- node->custom1= 0;
- else if(node->custom1>act)
- node->custom1--;
+
+ for(sce = CTX_data_main(C)->scene.first; sce; sce = sce->id.next) {
+ if(sce->nodetree) {
+ bNode *node;
+ for(node = sce->nodetree->nodes.first; node; node = node->next) {
+ if(node->type==CMP_NODE_R_LAYERS && (Scene*)node->id==scene) {
+ if(node->custom1==act)
+ node->custom1= 0;
+ else if(node->custom1>act)
+ node->custom1--;
+ }
}
}
}
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index f73ede19724..2e8dc32ad6d 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -238,7 +238,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
}
else if(CTX_data_equals(member, "visible_pose_bones")) {
- Object *obpose= ED_object_pose_armature(obact);
+ Object *obpose= object_pose_armature_get(obact);
bArmature *arm= (obpose) ? obpose->data : NULL;
bPoseChannel *pchan;
@@ -254,7 +254,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
}
else if(CTX_data_equals(member, "selected_pose_bones")) {
- Object *obpose= ED_object_pose_armature(obact);
+ Object *obpose= object_pose_armature_get(obact);
bArmature *arm= (obpose) ? obpose->data : NULL;
bPoseChannel *pchan;
@@ -289,7 +289,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
else if(CTX_data_equals(member, "active_pose_bone")) {
bPoseChannel *pchan;
- Object *obpose= ED_object_pose_armature(obact);
+ Object *obpose= object_pose_armature_get(obact);
pchan= get_active_posechannel(obpose);
if (pchan) {
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 48f7f049b23..1e79ae8f874 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -52,6 +52,7 @@
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
+#include "BKE_object.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
@@ -347,7 +348,7 @@ int ED_operator_posemode(bContext *C)
if (obact && !(obact->mode & OB_MODE_EDIT)) {
Object *obpose;
- if((obpose= ED_object_pose_armature(obact))) {
+ if((obpose= object_pose_armature_get(obact))) {
if((obact == obpose) || (obact->mode & OB_MODE_WEIGHT_PAINT)) {
return 1;
}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 4e11a89ce0e..8da693a5166 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -749,7 +749,7 @@ static int project_paint_occlude_ptv(float pt[3], float v1[3], float v2[3], floa
static int project_paint_occlude_ptv_clip(
const ProjPaintState *ps, const MFace *mf,
- float pt[3], float v1[3], float v2[3], float v3[3],
+ float pt[3], float v1[4], float v2[4], float v3[4],
const int side )
{
float w[3], wco[3];
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 9500c7f663c..73a6e4fad20 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -683,7 +683,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev
/* TODO: as sculpt and other paint modes are unified, this
separation will go away */
if(stroke->vc.obact->sculpt) {
- float delta[3];
+ float delta[2];
brush_jitter_pos(brush, mouse_in, mouse);
@@ -691,13 +691,14 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev
brush_jitter_pos isn't written in the best way to
be reused here */
if(brush->flag & BRUSH_JITTER_PRESSURE) {
- sub_v3_v3v3(delta, mouse, mouse_in);
- mul_v3_fl(delta, pressure);
- add_v3_v3v3(mouse, mouse_in, delta);
+ sub_v2_v2v2(delta, mouse, mouse_in);
+ mul_v2_fl(delta, pressure);
+ add_v2_v2v2(mouse, mouse_in, delta);
}
}
- else
- copy_v3_v3(mouse, mouse_in);
+ else {
+ copy_v2_v2(mouse, mouse_in);
+ }
/* TODO: can remove the if statement once all modes have this */
if(stroke->get_location)
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 587c7161382..7595a6a7683 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -102,33 +102,6 @@ void ED_sculpt_force_update(bContext *C)
multires_force_update(ob);
}
-void ED_sculpt_modifiers_changed(Object *ob)
-{
- SculptSession *ss= ob->sculpt;
-
- if(!ss->cache) {
- /* we free pbvh on changes, except during sculpt since it can't deal with
- changing PVBH node organization, we hope topology does not change in
- the meantime .. weak */
- if(ss->pbvh) {
- BLI_pbvh_free(ss->pbvh);
- ss->pbvh= NULL;
- }
-
- sculpt_free_deformMats(ob->sculpt);
- } else {
- PBVHNode **nodes;
- int n, totnode;
-
- BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
-
- for(n = 0; n < totnode; n++)
- BLI_pbvh_node_mark_update(nodes[n]);
-
- MEM_freeN(nodes);
- }
-}
-
/* Sculpt mode handles multires differently from regular meshes, but only if
it's the last modifier on the stack and it is not on the first level */
struct MultiresModifierData *sculpt_multires_active(Scene *scene, Object *ob)
@@ -2712,17 +2685,6 @@ static void sculpt_update_tex(Sculpt *sd, SculptSession *ss)
}
}
-void sculpt_free_deformMats(SculptSession *ss)
-{
- if(ss->orig_cos) MEM_freeN(ss->orig_cos);
- if(ss->deform_cos) MEM_freeN(ss->deform_cos);
- if(ss->deform_imats) MEM_freeN(ss->deform_imats);
-
- ss->orig_cos = NULL;
- ss->deform_cos = NULL;
- ss->deform_imats = NULL;
-}
-
void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_fmap)
{
DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
@@ -2759,7 +2721,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_
if(!ss->orig_cos) {
int a;
- sculpt_free_deformMats(ss);
+ free_sculptsession_deformMats(ss);
if(ss->kb) ss->orig_cos = key_to_vertcos(ob, ss->kb);
else ss->orig_cos = mesh_getVertexCos(ob->data, NULL);
@@ -2770,7 +2732,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_
for(a = 0; a < ((Mesh*)ob->data)->totvert; ++a)
invert_m3(ss->deform_imats[a]);
}
- } else sculpt_free_deformMats(ss);
+ } else free_sculptsession_deformMats(ss);
/* if pbvh is deformed, key block is already applied to it */
if (ss->kb && !BLI_pbvh_isDeformed(ss->pbvh)) {
@@ -3057,7 +3019,7 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush)
copy_v3_v3(cache->true_location, cache->orig_grab_location);
sd->draw_anchored = 1;
- copy_v3_v3(sd->anchored_initial_mouse, cache->initial_mouse);
+ copy_v2_v2(sd->anchored_initial_mouse, cache->initial_mouse);
sd->anchored_size = cache->pixel_radius;
}
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 33970ea0179..c1da29aeb27 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -67,7 +67,7 @@ int sculpt_poll(struct bContext *C);
void sculpt_update_mesh_elements(struct Scene *scene, struct Sculpt *sd, struct Object *ob, int need_fmap);
/* Deformed mesh sculpt */
-void sculpt_free_deformMats(struct SculptSession *ss);
+void free_sculptsession_deformMats(struct SculptSession *ss);
/* Stroke */
struct SculptStroke *sculpt_stroke_new(const int max);
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 12bfd96bb69..9a974c638a3 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -199,7 +199,7 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
Mesh *mesh= ob->data;
mesh_calc_normals(mesh->mvert, mesh->totvert, mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, NULL, NULL, 0, NULL, NULL);
- sculpt_free_deformMats(ss);
+ free_sculptsession_deformMats(ss);
tag_update|= 1;
}
diff --git a/source/blender/editors/sound/sound_intern.h b/source/blender/editors/sound/sound_intern.h
index b17ef99132f..cde0b3c4479 100644
--- a/source/blender/editors/sound/sound_intern.h
+++ b/source/blender/editors/sound/sound_intern.h
@@ -36,7 +36,5 @@
struct wmOperatorType;
-void SOUND_OT_open(wmOperatorType *ot);
-
#endif /* ED_SOUND_INTERN_H */
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index 19cae6aa67d..60d665de94c 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -175,7 +175,7 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
return WM_operator_filesel(C, op, event);
}
-void SOUND_OT_open(wmOperatorType *ot)
+static void SOUND_OT_open(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Open Sound";
@@ -196,7 +196,7 @@ void SOUND_OT_open(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "mono", FALSE, "Mono", "Mixdown the sound to mono.");
}
-void SOUND_OT_open_mono(wmOperatorType *ot)
+static void SOUND_OT_open_mono(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Open Sound Mono";
@@ -659,7 +659,7 @@ static int update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void SOUND_OT_update_animation_flags(wmOperatorType *ot)
+static void SOUND_OT_update_animation_flags(wmOperatorType *ot)
{
/*
This operator is needed to set a correct state of the sound animation
@@ -703,7 +703,7 @@ static int bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void SOUND_OT_bake_animation(wmOperatorType *ot)
+static void SOUND_OT_bake_animation(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Update animation cache";
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 1b0893e50e0..43d5a5c9b4b 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -164,22 +164,26 @@ static FileSelect file_select_do(bContext* C, int selected_idx)
SpaceFile *sfile= CTX_wm_space_file(C);
FileSelectParams *params = ED_fileselect_get_params(sfile);
int numfiles = filelist_numfiles(sfile->files);
+ struct direntry* file;
/* make the selected file active */
- if ( (selected_idx >= 0) && (selected_idx < numfiles)) {
- struct direntry* file = filelist_file(sfile->files, selected_idx);
+ if ( (selected_idx >= 0) &&
+ (selected_idx < numfiles) &&
+ (file= filelist_file(sfile->files, selected_idx)))
+ {
params->active_file = selected_idx;
- if(file && S_ISDIR(file->type)) {
+ if(S_ISDIR(file->type)) {
/* the path is too long and we are not going up! */
- if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX )
- {
+ if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX ) {
// XXX error("Path too long, cannot enter this directory");
- } else {
- if (strcmp(file->relname, "..")==0) {
- /* avoids /../../ */
- BLI_parent_dir(params->dir);
- } else {
+ }
+ else {
+ if (strcmp(file->relname, "..")==0) {
+ /* avoids /../../ */
+ BLI_parent_dir(params->dir);
+ }
+ else {
BLI_cleanup_dir(G.main->name, params->dir);
strcat(params->dir, file->relname);
BLI_add_slash(params->dir);
@@ -189,8 +193,7 @@ static FileSelect file_select_do(bContext* C, int selected_idx)
retval = FILE_SELECT_DIR;
}
}
- else if (file)
- {
+ else {
if (file->relname) {
BLI_strncpy(params->file, file->relname, FILE_MAXFILE);
}
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index 0a384018c8a..ef4bc2cf003 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -42,6 +42,7 @@
#include "BLI_utildefines.h"
#include "BKE_anim.h"
+#include "BKE_curve.h"
#include "BKE_displist.h"
#include "BKE_DerivedMesh.h"
#include "BKE_key.h"
@@ -52,7 +53,6 @@
#include "ED_info.h"
#include "ED_armature.h"
#include "ED_mesh.h"
-#include "ED_curve.h" /* for ED_curve_editnurbs */
#include "BLI_editVert.h"
@@ -184,7 +184,7 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
BezTriple *bezt;
BPoint *bp;
int a;
- ListBase *nurbs= ED_curve_editnurbs(cu);
+ ListBase *nurbs= curve_editnurbs(cu);
for(nu=nurbs->first; nu; nu=nu->next) {
if(nu->type == CU_BEZIER) {
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 9ea1e8ee877..cd521f7e8c7 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -97,7 +97,7 @@ static void node_sync_cb(bContext *UNUSED(C), void *snode_v, void *node_v)
}
}
-void node_socket_button_default(const bContext *C, uiBlock *block,
+static void node_socket_button_default(const bContext *C, uiBlock *block,
bNodeTree *ntree, bNode *node, bNodeSocket *sock,
const char *name, int x, int y, int width)
{
@@ -135,7 +135,7 @@ static uiBlock *socket_component_menu(bContext *C, ARegion *ar, void *args_v)
return block;
}
-void node_socket_button_components(const bContext *C, uiBlock *block,
+static void node_socket_button_components(const bContext *C, uiBlock *block,
bNodeTree *ntree, bNode *node, bNodeSocket *sock,
const char *name, int x, int y, int width)
{
@@ -157,7 +157,7 @@ void node_socket_button_components(const bContext *C, uiBlock *block,
uiDefBlockButN(block, socket_component_menu, args, name, x, y+1, width, NODE_DY-2, "");
}
-void node_socket_button_color(const bContext *C, uiBlock *block,
+static void node_socket_button_color(const bContext *C, uiBlock *block,
bNodeTree *ntree, bNode *node, bNodeSocket *sock,
const char *name, int x, int y, int width)
{
@@ -179,7 +179,7 @@ void node_socket_button_color(const bContext *C, uiBlock *block,
/* ****************** BASE DRAW FUNCTIONS FOR NEW OPERATOR NODES ***************** */
-void node_draw_socket_new(bNodeSocket *sock, float size)
+static void node_draw_socket_new(bNodeSocket *sock, float size)
{
float x=sock->locx, y=sock->locy;
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 357730aff39..65ce2e71d8d 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1008,6 +1008,10 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
UI_icon_draw(x, y, ICON_MOD_SOLIDIFY); break;
case eModifierType_Screw:
UI_icon_draw(x, y, ICON_MOD_SCREW); break;
+ case eModifierType_WeightVGEdit:
+ case eModifierType_WeightVGMix:
+ case eModifierType_WeightVGProximity:
+ UI_icon_draw(x, y, ICON_MOD_VERTEX_WEIGHT); break;
default:
UI_icon_draw(x, y, ICON_DOT); break;
}
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 05eace0d4ef..6172273f7e1 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -218,7 +218,7 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot)
/* Rename --------------------------------------------------- */
-void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports)
+static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports)
{
/* can't rename rna datablocks entries */
if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))
@@ -765,7 +765,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
}
else {
/* pop up panel - no previous, or user didn't want search after previous */
- strcpy(name, "");
+ name[0]= '\0';
// XXX if (sbutton(name, 0, sizeof(name)-1, "Find: ") && name[0]) {
// te= outliner_find_named(soops, &soops->tree, name, flags, NULL, &prevFound);
// }
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index b2fdd34aab2..efbfbd51fb5 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -342,7 +342,7 @@ static void singleuser_action_cb(bContext *C, Scene *UNUSED(scene), TreeElement
if (id) {
IdAdtTemplate *iat = (IdAdtTemplate *)tsep->id;
- PointerRNA ptr = {{0}};
+ PointerRNA ptr = {{NULL}};
PropertyRNA *prop;
RNA_pointer_create(&iat->id, &RNA_AnimData, iat->adt, &ptr);
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 7e9eabc08db..0a1f7a3599d 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -473,7 +473,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSE_CHANNEL, a);
ten->name= pchan->name;
ten->directdata= pchan;
- pchan->prev= (bPoseChannel *)ten;
+ pchan->temp= (void *)ten;
if(pchan->constraints.first) {
//Object *target;
@@ -506,19 +506,13 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
pchan= (bPoseChannel *)ten->directdata;
if(pchan->parent) {
BLI_remlink(&tenla->subtree, ten);
- par= (TreeElement *)pchan->parent->prev;
+ par= (TreeElement *)pchan->parent->temp;
BLI_addtail(&par->subtree, ten);
ten->parent= par;
}
}
ten= nten;
}
- /* restore prev pointers */
- pchan= ob->pose->chanbase.first;
- if(pchan) pchan->prev= NULL;
- for(; pchan; pchan= pchan->next) {
- if(pchan->next) pchan->next->prev= pchan;
- }
}
/* Pose Groups */
@@ -775,7 +769,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
ebone->temp= ten;
}
/* make hierarchy */
- ten= te->subtree.first;
+ ten= arm->edbo->first ? ((EditBone *)arm->edbo->first)->temp : NULL;
while(ten) {
TreeElement *nten= ten->next, *par;
ebone= (EditBone *)ten->directdata;
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index e7673651546..c3165adaf49 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -188,7 +188,7 @@ static void proxy_endjob(void *UNUSED(customdata))
}
-void seq_proxy_build_job(const bContext *C, Sequence * seq)
+static void seq_proxy_build_job(const bContext *C, Sequence * seq)
{
wmJob * steve;
ProxyJob *pj;
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index fd0a19ca288..f3ccf796493 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -59,6 +59,7 @@
#include "BKE_anim.h" //for the where_on_path function
#include "BKE_constraint.h" // for the get_constraint_target function
+#include "BKE_curve.h"
#include "BKE_DerivedMesh.h"
#include "BKE_deform.h"
#include "BKE_displist.h"
@@ -95,7 +96,7 @@
#include "ED_screen.h"
#include "ED_sculpt.h"
#include "ED_types.h"
-#include "ED_curve.h" /* for ED_curve_editnurbs */
+#include "ED_curve.h" /* for curve_editnurbs */
#include "UI_resources.h"
@@ -1812,7 +1813,7 @@ void nurbs_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, Nurb
short s[2] = {IS_CLIPPED, 0};
Nurb *nu;
int i;
- ListBase *nurbs= ED_curve_editnurbs(cu);
+ ListBase *nurbs= curve_editnurbs(cu);
ED_view3d_local_clipping(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
@@ -5109,7 +5110,7 @@ static void curve_draw_speed(Scene *scene, Object *ob)
#endif // XXX old animation system stuff
-static void draw_textcurs(float textcurs[][2])
+static void draw_textcurs(float textcurs[4][2])
{
cpack(0);
@@ -5126,12 +5127,14 @@ static void draw_textcurs(float textcurs[][2])
static void drawspiral(const float cent[3], float rad, float tmat[][4], int start)
{
float vec[3], vx[3], vy[3];
- int a, tot=32;
- char inverse=0;
-
+ const int tot=32;
+ const float tot_inv= (1.0f / 32.0f);
+ int a;
+ char inverse= FALSE;
+
if (start < 0) {
- inverse = 1;
- start *= -1;
+ inverse = TRUE;
+ start= -start;
}
mul_v3_v3fl(vx, tmat[0], rad);
@@ -5145,26 +5148,26 @@ static void drawspiral(const float cent[3], float rad, float tmat[][4], int star
start=-a + 1;
glBegin(GL_LINES);
glVertex3fv(vec);
- vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)a/(float)tot) + *(cosval+a+start) * (vy[0] * (float)a/(float)tot);
- vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)a/(float)tot) + *(cosval+a+start) * (vy[1] * (float)a/(float)tot);
- vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)a/(float)tot) + *(cosval+a+start) * (vy[2] * (float)a/(float)tot);
+ vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)a * tot_inv) + *(cosval+a+start) * (vy[0] * (float)a * tot_inv);
+ vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)a * tot_inv) + *(cosval+a+start) * (vy[1] * (float)a * tot_inv);
+ vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)a * tot_inv) + *(cosval+a+start) * (vy[2] * (float)a * tot_inv);
glVertex3fv(vec);
glEnd();
}
}
else {
a=0;
- vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[0] * (float)(-a+31)/(float)tot);
- vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[1] * (float)(-a+31)/(float)tot);
- vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[2] * (float)(-a+31)/(float)tot);
+ vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)(-a+31) * tot_inv) + *(cosval+a+start) * (vy[0] * (float)(-a+31) * tot_inv);
+ vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)(-a+31) * tot_inv) + *(cosval+a+start) * (vy[1] * (float)(-a+31) * tot_inv);
+ vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)(-a+31) * tot_inv) + *(cosval+a+start) * (vy[2] * (float)(-a+31) * tot_inv);
for(a=0; a<tot; a++) {
if (a+start>31)
start=-a + 1;
glBegin(GL_LINES);
glVertex3fv(vec);
- vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[0] * (float)(-a+31)/(float)tot);
- vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[1] * (float)(-a+31)/(float)tot);
- vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[2] * (float)(-a+31)/(float)tot);
+ vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)(-a+31) * tot_inv) + *(cosval+a+start) * (vy[0] * (float)(-a+31) * tot_inv);
+ vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)(-a+31) * tot_inv) + *(cosval+a+start) * (vy[1] * (float)(-a+31) * tot_inv);
+ vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)(-a+31) * tot_inv) + *(cosval+a+start) * (vy[2] * (float)(-a+31) * tot_inv);
glVertex3fv(vec);
glEnd();
}
@@ -6153,7 +6156,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
cu= ob->data;
if(cu->editnurb) {
- ListBase *nurbs= ED_curve_editnurbs(cu);
+ ListBase *nurbs= curve_editnurbs(cu);
drawnurb(scene, v3d, rv3d, base, nurbs->first, dt);
}
else if(dt==OB_BOUNDBOX) {
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 64a3e473975..ec3e6ea93bd 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -210,7 +210,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BPoint *bp;
BezTriple *bezt;
int a;
- ListBase *nurbs= ED_curve_editnurbs(cu);
+ ListBase *nurbs= curve_editnurbs(cu);
nu= nurbs->first;
while(nu) {
@@ -467,7 +467,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BPoint *bp;
BezTriple *bezt;
int a;
- ListBase *nurbs= ED_curve_editnurbs(cu);
+ ListBase *nurbs= curve_editnurbs(cu);
nu= nurbs->first;
while(nu) {
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index ad10c703b80..a843c67849b 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -68,7 +68,7 @@
#include "ED_armature.h"
#include "ED_mesh.h"
#include "ED_screen.h"
-#include "ED_curve.h" /* for ED_curve_editnurbs */
+#include "ED_curve.h" /* for curve_editnurbs */
#include "view3d_intern.h"
@@ -105,7 +105,7 @@ static void special_transvert_update(Object *obedit)
}
else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
Curve *cu= obedit->data;
- ListBase *nurbs= ED_curve_editnurbs(cu);
+ ListBase *nurbs= curve_editnurbs(cu);
Nurb *nu= nurbs->first;
while(nu) {
@@ -363,7 +363,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
Curve *cu= obedit->data;
int totmalloc= 0;
- ListBase *nurbs= ED_curve_editnurbs(cu);
+ ListBase *nurbs= curve_editnurbs(cu);
for(nu= nurbs->first; nu; nu= nu->next) {
if(nu->type == CU_BEZIER)
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 9d4607420e2..925be568bd2 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -525,8 +525,8 @@ void ED_view3d_win_to_segment_clip(ARegion *ar, View3D *v3d, const float mval[2]
ED_view3d_win_to_vector(ar, mval, vec);
copy_v3_v3(ray_start, rv3d->viewinv[3]);
- VECADDFAC(ray_start, rv3d->viewinv[3], vec, v3d->near);
- VECADDFAC(ray_end, rv3d->viewinv[3], vec, v3d->far);
+ madd_v3_v3v3fl(ray_start, rv3d->viewinv[3], vec, v3d->near);
+ madd_v3_v3v3fl(ray_end, rv3d->viewinv[3], vec, v3d->far);
}
else {
float vec[4];
@@ -537,8 +537,8 @@ void ED_view3d_win_to_segment_clip(ARegion *ar, View3D *v3d, const float mval[2]
mul_m4_v4(rv3d->persinv, vec);
- VECADDFAC(ray_start, vec, rv3d->viewinv[2], 1000.0f);
- VECADDFAC(ray_end, vec, rv3d->viewinv[2], -1000.0f);
+ madd_v3_v3v3fl(ray_start, vec, rv3d->viewinv[2], 1000.0f);
+ madd_v3_v3v3fl(ray_end, vec, rv3d->viewinv[2], -1000.0f);
}
/* clipping */
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 88a44b6cd8a..1066624220a 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -3375,10 +3375,10 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) {
if(chainlen)
sprintf(autoik, "AutoIK-Len: %d", chainlen);
else
- strcpy(autoik, "");
+ autoik[0]= '\0';
}
else
- strcpy(autoik, "");
+ autoik[0]= '\0';
if (t->con.mode & CON_APPLY) {
switch(t->num.idx_max) {
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index f12e6e518b2..f2ba4871475 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -91,7 +91,6 @@
#include "ED_node.h"
#include "ED_types.h"
#include "ED_uvedit.h"
-#include "ED_curve.h" /* for ED_curve_editnurbs */
#include "ED_util.h" /* for crazyspace correction */
#include "UI_view2d.h"
@@ -1404,7 +1403,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
if(cu->editnurb==NULL) return;
/* count total of vertices, check identical as in 2nd loop for making transdata! */
- nurbs= ED_curve_editnurbs(cu);
+ nurbs= curve_editnurbs(cu);
for(nu= nurbs->first; nu; nu= nu->next) {
if(nu->type == CU_BEZIER) {
for(a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 7cd7b362f77..7fe2675c7c0 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -85,7 +85,7 @@
#include "ED_space_api.h"
#include "ED_uvedit.h"
#include "ED_view3d.h"
-#include "ED_curve.h" /* for ED_curve_editnurbs */
+#include "ED_curve.h" /* for curve_editnurbs */
//#include "BDR_unwrapper.h"
@@ -145,7 +145,7 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
int axis = 0;
for (; md; md=md->next) {
- if (md->type==eModifierType_Mirror) {
+ if ((md->type==eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
MirrorModifierData *mmd = (MirrorModifierData*) md;
if(mmd->flag & MOD_MIR_CLIPPING) {
@@ -626,7 +626,7 @@ static void recalcData_view3d(TransInfo *t)
if (t->obedit) {
if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
Curve *cu= t->obedit->data;
- ListBase *nurbs= ED_curve_editnurbs(cu);
+ ListBase *nurbs= curve_editnurbs(cu);
Nurb *nu= nurbs->first;
if(t->state != TRANS_CANCEL) {
@@ -1668,13 +1668,13 @@ void calculatePropRatio(TransInfo *t)
strcpy(t->proptext, "(Random)");
break;
default:
- strcpy(t->proptext, "");
+ t->proptext[0]= '\0';
}
}
else {
for(i = 0 ; i < t->total; i++, td++) {
td->factor = 1.0;
}
- strcpy(t->proptext, "");
+ t->proptext[0]= '\0';
}
}
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 794958335df..a23fb140650 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -57,6 +57,7 @@
#include "BKE_action.h"
#include "BKE_context.h"
+#include "BKE_curve.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_particle.h"
@@ -76,7 +77,6 @@
#include "ED_mesh.h"
#include "ED_particle.h"
#include "ED_view3d.h"
-#include "ED_curve.h" /* for ED_curve_editnurbs */
#include "UI_resources.h"
@@ -387,7 +387,7 @@ int calc_manipulator_stats(const bContext *C)
Nurb *nu;
BezTriple *bezt;
BPoint *bp;
- ListBase *nurbs= ED_curve_editnurbs(cu);
+ ListBase *nurbs= curve_editnurbs(cu);
nu= nurbs->first;
while(nu) {
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 9059060fbb0..c7b4f19b1b0 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -41,6 +41,7 @@
#include "BKE_armature.h"
+#include "BKE_curve.h"
#include "BKE_context.h"
#include "BKE_tessmesh.h"
#include "BKE_report.h"
@@ -57,8 +58,6 @@
#include "ED_armature.h"
#include "ED_mesh.h"
-#include "ED_curve.h" /* for ED_curve_editnurbs */
-
#include "RNA_define.h"
@@ -726,7 +725,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
Nurb *nu;
BezTriple *bezt;
int a;
- ListBase *nurbs= ED_curve_editnurbs(cu);
+ ListBase *nurbs= curve_editnurbs(cu);
for (nu = nurbs->first; nu; nu = nu->next)
{
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 68e0134b2b4..31fee038df0 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -240,7 +240,7 @@ GPUBuffer *GPU_buffer_alloc(int size)
size */
glGenBuffersARB(1, &buf->id);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, buf->id);
- glBufferDataARB(GL_ARRAY_BUFFER_ARB, size, 0, GL_STATIC_DRAW_ARB);
+ glBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STATIC_DRAW_ARB);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
}
else {
@@ -493,7 +493,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
/* nothing to do for legacy mode */
if(dm->drawObject->legacy)
- return 0;
+ return NULL;
cur_index_per_mat = MEM_mallocN(sizeof(int)*object->totmaterial,
"GPU_buffer_setup.cur_index_per_mat");
@@ -513,7 +513,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
/* bind the buffer and discard previous data,
avoids stalling gpu */
glBindBufferARB(target, buffer->id);
- glBufferDataARB(target, buffer->size, 0, GL_STATIC_DRAW_ARB);
+ glBufferDataARB(target, buffer->size, NULL, GL_STATIC_DRAW_ARB);
/* attempt to map the buffer */
if(!(varray = glMapBufferARB(target, GL_WRITE_ONLY_ARB))) {
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index fb9f21cde8c..9cd6240d37d 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -514,8 +514,7 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels)
if (pixels)
MEM_freeN(pixels);
- if (tex)
- GPU_texture_unbind(tex);
+ GPU_texture_unbind(tex);
return tex;
}
diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c
index 2677913caed..3719242aaba 100644
--- a/source/blender/imbuf/intern/filter.c
+++ b/source/blender/imbuf/intern/filter.c
@@ -518,7 +518,7 @@ void IMB_makemipmap(ImBuf *ibuf, int use_filter)
hbuf= ibuf->mipmap[curmap];
hbuf->miplevel= curmap+1;
- if(!hbuf || (hbuf->x <= 2 && hbuf->y <= 2))
+ if(hbuf->x <= 2 && hbuf->y <= 2)
break;
curmap++;
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index 3528318ba81..2e45c0eb07a 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -159,24 +159,24 @@ struct anim_index * IMB_indexer_open(const char * name)
int i;
if (!fp) {
- return 0;
+ return NULL;
}
if (fread(header, 12, 1, fp) != 1) {
fclose(fp);
- return 0;
+ return NULL;
}
header[12] = 0;
if (memcmp(header, magic, 8) != 0) {
fclose(fp);
- return 0;
+ return NULL;
}
if (atoi(header+9) != INDEX_FILE_VERSION) {
fclose(fp);
- return 0;
+ return NULL;
}
idx = MEM_callocN( sizeof(struct anim_index), "anim_index");
@@ -916,7 +916,7 @@ static AviMovie * alloc_proxy_output_avi(
if (AVI_open_compress (filename, avi, 1, format) != AVI_ERROR_NONE) {
MEM_freeN(avi);
- return 0;
+ return NULL;
}
AVI_set_compress_option (avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_WIDTH, &x);
@@ -1000,7 +1000,7 @@ static void index_rebuild_fallback(struct anim * anim,
s_ibuf->rect, x * y * 4);
/* note that libavi free's the buffer... */
- s_ibuf->rect = 0;
+ s_ibuf->rect = NULL;
IMB_freeImBuf(s_ibuf);
}
@@ -1056,14 +1056,14 @@ void IMB_free_indices(struct anim * anim)
for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) {
if (anim->proxy_anim[i]) {
IMB_close_anim(anim->proxy_anim[i]);
- anim->proxy_anim[i] = 0;
+ anim->proxy_anim[i] = NULL;
}
}
for (i = 0; i < IMB_TC_MAX_SLOT; i++) {
if (anim->curr_idx[i]) {
IMB_indexer_close(anim->curr_idx[i]);
- anim->curr_idx[i] = 0;
+ anim->curr_idx[i] = NULL;
}
}
@@ -1116,7 +1116,7 @@ struct anim_index * IMB_anim_open_index(
}
if (anim->indices_tried & tc) {
- return 0;
+ return NULL;
}
get_tc_filename(anim, tc, fname);
diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c
index adbf3659d3a..c6aaf336fb7 100644
--- a/source/blender/imbuf/intern/iris.c
+++ b/source/blender/imbuf/intern/iris.c
@@ -515,14 +515,15 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
}
- ibuf->ftype = IMAGIC;
- ibuf->profile = IB_PROFILE_SRGB;
-
- test_endian_zbuf(ibuf);
-
if (ibuf) {
- if (ibuf->rect)
+ ibuf->ftype = IMAGIC;
+ ibuf->profile = IB_PROFILE_SRGB;
+
+ test_endian_zbuf(ibuf);
+
+ if (ibuf->rect) {
IMB_convert_rgba_to_abgr(ibuf);
+ }
}
return(ibuf);
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c
index a4eae492a58..af7f098585e 100644
--- a/source/blender/imbuf/intern/jp2.c
+++ b/source/blender/imbuf/intern/jp2.c
@@ -97,7 +97,7 @@ static void info_callback(const char *msg, void *client_data) {
struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
{
- struct ImBuf *ibuf = 0;
+ struct ImBuf *ibuf = NULL;
int use_float = 0; /* for precision higher then 8 use float */
long signed_offsets[4]= {0, 0, 0, 0};
@@ -117,7 +117,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */
opj_cio_t *cio = NULL;
- if (check_jp2(mem) == 0) return(0);
+ if (check_jp2(mem) == 0) return(NULL);
/* configure the event callbacks (not required) */
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index a820e59779f..492dd34caa6 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -188,18 +188,13 @@ typedef struct bPoseChannel {
char name[32]; /* Channels need longer names than normal blender objects */
short flag; /* dynamic, for detecting transform changes */
- short constflag; /* for quick detecting which constraints affect this channel */
short ikflag; /* settings for IK bones */
- short selectflag; /* copy of bone flag, so you can work with library armatures, not for runtime use */
short protectflag; /* protect channels from being transformed */
short agrp_index; /* index of action-group this bone belongs to (0 = default/no group) */
-
-// XXX depreceated.... old animation system (armature only viz) ----
- int pathlen; /* for drawing paths, the amount of frames */
- int pathsf; /* for drawing paths, the start frame number */
- int pathef; /* for drawing paths, the end frame number */
-// XXX end of depreceated code -------------------------------------
-
+ char constflag; /* for quick detecting which constraints affect this channel */
+ char selectflag; /* copy of bone flag, so you can work with library armatures, not for runtime use */
+ char pad0[6];
+
struct Bone *bone; /* set on read file or rebuild pose */
struct bPoseChannel *parent; /* set on read file or rebuild pose */
struct bPoseChannel *child; /* set on read file or rebuild pose, the 'ik' child, for b-bones */
@@ -233,7 +228,7 @@ typedef struct bPoseChannel {
float ikrotweight; /* weight of joint rotation constraint */
float iklinweight; /* weight of joint stretch constraint */
- float *path; /* totpath x 3 x float */ // XXX depreceated... old animation system (armature only viz)
+ void *temp; /* use for outliner */
} bPoseChannel;
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index bc30210bfbb..23100fa8bd7 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -522,11 +522,14 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, " %s(ptr, value);\n", manualfunc);
}
else {
+ const PropertySubType subtype= prop->subtype;
+ const char *string_copy_func= (subtype==PROP_FILEPATH || subtype==PROP_DIRPATH || subtype==PROP_FILENAME) ? "BLI_strncpy" : "BLI_strncpy_utf8";
+
rna_print_data_get(f, dp);
if(sprop->maxlength)
- fprintf(f, " BLI_strncpy(value, data->%s, %d);\n", dp->dnaname, sprop->maxlength);
+ fprintf(f, " %s(value, data->%s, %d);\n", string_copy_func, dp->dnaname, sprop->maxlength);
else
- fprintf(f, " BLI_strncpy(value, data->%s, sizeof(data->%s));\n", dp->dnaname, dp->dnaname);
+ fprintf(f, " %s(value, data->%s, sizeof(data->%s));\n", string_copy_func, dp->dnaname, dp->dnaname);
}
fprintf(f, "}\n\n");
break;
@@ -734,11 +737,14 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, " %s(ptr, value);\n", manualfunc);
}
else {
+ const PropertySubType subtype= prop->subtype;
+ const char *string_copy_func= (subtype==PROP_FILEPATH || subtype==PROP_DIRPATH || subtype==PROP_FILENAME) ? "BLI_strncpy" : "BLI_strncpy_utf8";
+
rna_print_data_get(f, dp);
if(sprop->maxlength)
- fprintf(f, " BLI_strncpy(data->%s, value, %d);\n", dp->dnaname, sprop->maxlength);
+ fprintf(f, " %s(data->%s, value, %d);\n", string_copy_func, dp->dnaname, sprop->maxlength);
else
- fprintf(f, " BLI_strncpy(data->%s, value, sizeof(data->%s));\n", dp->dnaname, dp->dnaname);
+ fprintf(f, " %s(data->%s, value, sizeof(data->%s));\n", string_copy_func, dp->dnaname, dp->dnaname);
}
fprintf(f, "}\n\n");
break;
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 82217cdc3e4..05786cedeac 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -99,7 +99,7 @@ int rna_ID_name_length(PointerRNA *ptr)
void rna_ID_name_set(PointerRNA *ptr, const char *value)
{
ID *id= (ID*)ptr->data;
- BLI_strncpy(id->name+2, value, sizeof(id->name)-2);
+ BLI_strncpy_utf8(id->name+2, value, sizeof(id->name)-2);
test_idbutton(id->name+2);
}
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 815a9c92968..53e1bf7e6f6 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -137,7 +137,7 @@ static TimeMarker *rna_Action_pose_markers_new(bAction *act, ReportList *reports
TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
marker->flag= 1;
marker->frame= 1;
- BLI_strncpy(marker->name, name, sizeof(marker->name));
+ BLI_strncpy_utf8(marker->name, name, sizeof(marker->name));
BLI_addtail(&act->markers, marker);
return marker;
}
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 0395a54be8e..2f5f22c52d5 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -252,7 +252,7 @@ static void rna_ksPath_RnaPath_get(PointerRNA *ptr, char *value)
if (ksp->rna_path)
strcpy(value, ksp->rna_path);
else
- strcpy(value, "");
+ value[0]= '\0';
}
static int rna_ksPath_RnaPath_length(PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index e2399b5b57c..4ed5d2a125a 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -253,7 +253,7 @@ static void rna_EditBone_name_set(PointerRNA *ptr, const char *value)
char oldname[sizeof(ebone->name)], newname[sizeof(ebone->name)];
/* need to be on the stack */
- BLI_strncpy(newname, value, sizeof(ebone->name));
+ BLI_strncpy_utf8(newname, value, sizeof(ebone->name));
BLI_strncpy(oldname, ebone->name, sizeof(ebone->name));
ED_armature_bone_rename(arm, oldname, newname);
@@ -266,7 +266,7 @@ static void rna_Bone_name_set(PointerRNA *ptr, const char *value)
char oldname[sizeof(bone->name)], newname[sizeof(bone->name)];
/* need to be on the stack */
- BLI_strncpy(newname, value, sizeof(bone->name));
+ BLI_strncpy_utf8(newname, value, sizeof(bone->name));
BLI_strncpy(oldname, bone->name, sizeof(bone->name));
ED_armature_bone_rename(arm, oldname, newname);
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 22d9a19f933..fdbb4f09f93 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -170,7 +170,7 @@ static void rna_Constraint_name_set(PointerRNA *ptr, const char *value)
BLI_strncpy(oldname, con->name, sizeof(con->name));
/* copy the new name into the name slot */
- BLI_strncpy(con->name, value, sizeof(con->name));
+ BLI_strncpy_utf8(con->name, value, sizeof(con->name));
/* make sure name is unique */
if (ptr->id.data) {
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index e922a007249..c0c8ac6b88a 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -215,7 +215,7 @@ static void rna_DriverTarget_RnaPath_get(PointerRNA *ptr, char *value)
if (dtar->rna_path)
strcpy(value, dtar->rna_path);
else
- strcpy(value, "");
+ value[0]= '\0';
}
static int rna_DriverTarget_RnaPath_length(PointerRNA *ptr)
@@ -309,7 +309,7 @@ static void rna_FCurve_RnaPath_get(PointerRNA *ptr, char *value)
if (fcu->rna_path)
strcpy(value, fcu->rna_path);
else
- strcpy(value, "");
+ value[0]= '\0';
}
static int rna_FCurve_RnaPath_length(PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c
index 3e65eb8665e..ad6f67cddaf 100644
--- a/source/blender/makesrna/intern/rna_key.c
+++ b/source/blender/makesrna/intern/rna_key.c
@@ -76,7 +76,7 @@ void rna_ShapeKey_name_set(PointerRNA *ptr, const char *value)
BLI_strncpy(oldname, kb->name, sizeof(kb->name));
/* copy the new name into the name slot */
- BLI_strncpy(kb->name, value, sizeof(kb->name));
+ BLI_strncpy_utf8(kb->name, value, sizeof(kb->name));
/* make sure the name is truly unique */
if (ptr->id.data) {
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 7d6fcd1d006..74615010539 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -616,7 +616,7 @@ static void rna_MeshTextureFaceLayer_name_set(PointerRNA *ptr, const char *value
Mesh *me= (Mesh*)ptr->id.data;
/* CustomData *fdata= rna_mesh_pdata(me); */ /* UNUSED */
CustomDataLayer *cdl= (CustomDataLayer*)ptr->data;
- BLI_strncpy(cdl->name, value, sizeof(cdl->name));
+ BLI_strncpy_utf8(cdl->name, value, sizeof(cdl->name));
CustomData_set_layer_unique_name(&me->pdata, cdl - rna_mesh_pdata(me)->layers);
}
@@ -733,7 +733,7 @@ static void rna_MeshColorLayer_name_set(PointerRNA *ptr, const char *value)
Mesh *me= (Mesh*)ptr->id.data;
/* CustomData *fdata= rna_mesh_pdata(me); */ /* UNUSED */
CustomDataLayer *cdl= (CustomDataLayer*)ptr->data;
- BLI_strncpy(cdl->name, value, sizeof(cdl->name));
+ BLI_strncpy_utf8(cdl->name, value, sizeof(cdl->name));
CustomData_set_layer_unique_name(&me->ldata, cdl - rna_mesh_ldata(me)->layers);
}
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 2fc9daeabbf..df44ab58455 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -214,7 +214,7 @@ void rna_Modifier_name_set(PointerRNA *ptr, const char *value)
BLI_strncpy(oldname, md->name, sizeof(md->name));
/* copy the new name into the name slot */
- BLI_strncpy(md->name, value, sizeof(md->name));
+ BLI_strncpy_utf8(md->name, value, sizeof(md->name));
/* make sure the name is truly unique */
if (ptr->id.data) {
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index ef4adde6fb4..2a234dfaa61 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -59,7 +59,7 @@ static void rna_NlaStrip_name_set(PointerRNA *ptr, const char *value)
NlaStrip *data= (NlaStrip *)ptr->data;
/* copy the name first */
- BLI_strncpy(data->name, value, sizeof(data->name));
+ BLI_strncpy_utf8(data->name, value, sizeof(data->name));
/* validate if there's enough info to do so */
if (ptr->id.data) {
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 49a0458977a..61947977fee 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -361,7 +361,7 @@ static void rna_Node_name_set(PointerRNA *ptr, const char *value)
/* make a copy of the old name first */
BLI_strncpy(oldname, node->name, sizeof(node->name));
/* set new name */
- BLI_strncpy(node->name, value, sizeof(node->name));
+ BLI_strncpy_utf8(node->name, value, sizeof(node->name));
nodeUniqueName(ntree, node);
@@ -922,7 +922,7 @@ static void def_whileloop(StructRNA *srna)
prop = RNA_def_property(srna, "max_iterations", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "custom1");
- RNA_def_property_range(prop, 0.0f, 10000000.0f);
+ RNA_def_property_range(prop, 0.0f, SHRT_MAX);
RNA_def_property_ui_text(prop, "Max. Iterations", "Limit for number of iterations");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeGroup_update");
}
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 0319fbcef99..e03f011959d 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -467,7 +467,7 @@ void rna_VertexGroup_name_set(PointerRNA *ptr, const char *value)
{
Object *ob= (Object *)ptr->id.data;
bDeformGroup *dg= (bDeformGroup *)ptr->data;
- BLI_strncpy(dg->name, value, sizeof(dg->name));
+ BLI_strncpy_utf8(dg->name, value, sizeof(dg->name));
defgroup_unique_name(dg, ob);
}
@@ -513,7 +513,7 @@ void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
dg= BLI_findlink(&ob->defbase, index-1);
if(dg) BLI_strncpy(value, dg->name, sizeof(dg->name));
- else BLI_strncpy(value, "", sizeof(dg->name));
+ else value[0]= '\0';
}
int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index)
@@ -536,7 +536,7 @@ void rna_object_vgroup_name_set(PointerRNA *ptr, const char *value, char *result
Object *ob= (Object*)ptr->id.data;
bDeformGroup *dg= defgroup_find_name(ob, value);
if(dg) {
- BLI_strncpy(result, value, maxlen);
+ BLI_strncpy(result, value, maxlen); /* no need for BLI_strncpy_utf8, since this matches an existing group */
return;
}
@@ -563,7 +563,7 @@ void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *resul
}
}
- BLI_strncpy(result, "", maxlen);
+ result[0]= '\0';
}
void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
@@ -586,7 +586,7 @@ void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *res
}
}
- BLI_strncpy(result, "", maxlen);
+ result[0]= '\0';
}
static int rna_Object_active_material_index_get(PointerRNA *ptr)
@@ -837,7 +837,7 @@ static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str)
if(ma)
strcpy(str, ma->id.name+2);
else
- strcpy(str, "");
+ str[0]= '\0';
}
static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 0dd8218d1b9..434634f6b10 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -222,7 +222,7 @@ static void rna_PoseChannel_name_set(PointerRNA *ptr, const char *value)
char oldname[sizeof(pchan->name)], newname[sizeof(pchan->name)];
/* need to be on the stack */
- BLI_strncpy(newname, value, sizeof(pchan->name));
+ BLI_strncpy_utf8(newname, value, sizeof(pchan->name));
BLI_strncpy(oldname, pchan->name, sizeof(pchan->name));
ED_armature_bone_rename(ob->data, oldname, newname);
@@ -411,7 +411,7 @@ static void rna_pose_bgroup_name_index_get(PointerRNA *ptr, char *value, int ind
grp= BLI_findlink(&pose->agroups, index-1);
if(grp) BLI_strncpy(value, grp->name, sizeof(grp->name));
- else BLI_strncpy(value, "", sizeof(grp->name)); // XXX if invalid pointer, won't this crash?
+ else value[0]= '\0';
}
static int rna_pose_bgroup_name_index_length(PointerRNA *ptr, int index)
@@ -451,7 +451,7 @@ static void rna_pose_pgroup_name_set(PointerRNA *ptr, const char *value, char *r
}
}
- BLI_strncpy(result, "", maxlen);
+ result[0]= '\0';
}
#endif
diff --git a/source/blender/makesrna/intern/rna_property.c b/source/blender/makesrna/intern/rna_property.c
index 9fd5610a577..e2b886b8d38 100644
--- a/source/blender/makesrna/intern/rna_property.c
+++ b/source/blender/makesrna/intern/rna_property.c
@@ -88,7 +88,7 @@ static void rna_GameProperty_type_set(PointerRNA *ptr, int value)
static void rna_GameProperty_name_set(PointerRNA *ptr, const char *value)
{
bProperty *prop= (bProperty*)(ptr->data);
- BLI_strncpy(prop->name, value, sizeof(prop->name));
+ BLI_strncpy_utf8(prop->name, value, sizeof(prop->name));
unique_property(NULL, prop, 1);
}
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index e89e5906db5..c50519479eb 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -739,7 +739,7 @@ static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value)
RenderEngineType *type= BLI_findlink(&R_engines, value);
if(type)
- BLI_strncpy(rd->engine, type->idname, sizeof(rd->engine));
+ BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine));
}
static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
@@ -812,7 +812,7 @@ static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value)
Scene *scene= (Scene*)ptr->id.data;
SceneRenderLayer *rl= (SceneRenderLayer*)ptr->data;
- BLI_strncpy(rl->name, value, sizeof(rl->name));
+ BLI_strncpy_utf8(rl->name, value, sizeof(rl->name));
if(scene->nodetree) {
bNode *node;
@@ -1013,7 +1013,7 @@ static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[])
TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
marker->flag= SELECT;
marker->frame= 1;
- BLI_strncpy(marker->name, name, sizeof(marker->name));
+ BLI_strncpy_utf8(marker->name, name, sizeof(marker->name));
BLI_addtail(&scene->markers, marker);
return marker;
}
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 627c2274965..79724adf91c 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -359,7 +359,7 @@ static void rna_Sequence_name_set(PointerRNA *ptr, const char *value)
BLI_strncpy(oldname, seq->name+2, sizeof(seq->name)-2);
/* copy the new name into the name slot */
- BLI_strncpy(seq->name+2, value, sizeof(seq->name)-2);
+ BLI_strncpy_utf8(seq->name+2, value, sizeof(seq->name)-2);
/* make sure the name is unique */
seqbase_unique_name_recursive(&scene->ed->seqbase, seq);
diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c
index 959f9db851b..6a1e93fce41 100644
--- a/source/blender/makesrna/intern/rna_text.c
+++ b/source/blender/makesrna/intern/rna_text.c
@@ -53,7 +53,7 @@ static void rna_Text_filename_get(PointerRNA *ptr, char *value)
if(text->name)
strcpy(value, text->name);
else
- strcpy(value, "");
+ value[0]= '\0';
}
static int rna_Text_filename_length(PointerRNA *ptr)
@@ -88,7 +88,7 @@ static void rna_TextLine_body_get(PointerRNA *ptr, char *value)
if(line->line)
strcpy(value, line->line);
else
- strcpy(value, "");
+ value[0]= '\0';
}
static int rna_TextLine_body_length(PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index 890be76c49a..608a7326d79 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -260,7 +260,7 @@ static void rna_TextureSlot_name_get(PointerRNA *ptr, char *str)
if(mtex->tex)
strcpy(str, mtex->tex->id.name+2);
else
- strcpy(str, "");
+ str[0]= '\0';
}
static int rna_TextureSlot_output_node_get(PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c
index 8c63d5da8fd..4941c75c400 100644
--- a/source/blender/makesrna/intern/rna_texture_api.c
+++ b/source/blender/makesrna/intern/rna_texture_api.c
@@ -68,7 +68,7 @@ void clear_envmap(struct EnvMap *env, bContext *C)
}
}
-void texture_evaluate(struct Tex *tex, float value[3], float color_r[3])
+void texture_evaluate(struct Tex *tex, float value[3], float color_r[4])
{
TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
multitex_ext(tex, value, NULL, NULL, 1, &texres);
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 7ce1e1ab88f..a259f84ff1a 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -348,20 +348,20 @@ EnumPropertyItem keymap_modifiers_items[] = {
{0, NULL, 0, NULL, NULL}};
EnumPropertyItem operator_flag_items[] = {
- {OPTYPE_REGISTER, "REGISTER", 0, "Register", ""},
- {OPTYPE_UNDO, "UNDO", 0, "Undo", ""},
- {OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", ""},
- {OPTYPE_MACRO, "MACRO", 0, "Macro", ""},
- {OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer", ""},
- {OPTYPE_PRESET, "PRESET", 0, "Preset", ""},
- {OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", ""},
+ {OPTYPE_REGISTER, "REGISTER", 0, "Register", "Display in the info window and support the redo toolbar panel"},
+ {OPTYPE_UNDO, "UNDO", 0, "Undo", "Push an undo event (needed for operator redo)"},
+ {OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", "Block anything else from using the cursor"},
+ {OPTYPE_MACRO, "MACRO", 0, "Macro", "Use to check if an operator is a macro"},
+ {OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer", "Use so the operator grabs the mouse focus, enables wrapping when continuous grab is enabled"},
+ {OPTYPE_PRESET, "PRESET", 0, "Preset", "Display a preset button with the operators settings"},
+ {OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", "Removes the operator from search results"},
{0, NULL, 0, NULL, NULL}};
EnumPropertyItem operator_return_items[] = {
- {OPERATOR_RUNNING_MODAL, "RUNNING_MODAL", 0, "Running Modal", ""},
- {OPERATOR_CANCELLED, "CANCELLED", 0, "Cancelled", ""},
- {OPERATOR_FINISHED, "FINISHED", 0, "Finished", ""},
- {OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", ""}, // used as a flag
+ {OPERATOR_RUNNING_MODAL, "RUNNING_MODAL", 0, "Running Modal", "Keep the operator running with blender"},
+ {OPERATOR_CANCELLED, "CANCELLED", 0, "Cancelled", "When no action has been taken, operator exits"},
+ {OPERATOR_FINISHED, "FINISHED", 0, "Finished", "When the operator is complete, operator exits"},
+ {OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", "Do nothing and pass the event on"}, // used as a flag
{0, NULL, 0, NULL, NULL}};
/* flag/enum */
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c
index e6e9c347e6d..8eb1bace229 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -232,8 +232,8 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
dv = &dvert[i];
if(dv) {
- weight = defvert_find_weight(dv, defgrp_index) * wmd->strength;
- if(weight <= 0.0f)
+ weight = defvert_find_weight(dv, defgrp_index) * strength;
+ if(weight <= 0.0f) /* Should never occure... */
continue;
}
}
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index 98615c70553..128e888ca90 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -212,7 +212,7 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne
/* For each weight (vertex), make the mix between org and new weights. */
for (i = 0; i < num; i++) {
int idx = indices ? indices[i] : i;
- const float f= defvert_find_weight(&dvert[idx], ref_didx) * fact;
+ const float f = defvert_find_weight(&dvert[idx], ref_didx) * fact;
org_w[i] = (new_w[i] * f) + (org_w[i] * (1.0f-f));
/* If that vertex is not in ref vgroup, assume null factor, and hence do nothing! */
}
@@ -220,87 +220,107 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne
else {
/* Default "influence" behavior. */
/* For each weight (vertex), make the mix between org and new weights. */
- const float ifact= 1.0f - fact;
+ const float ifact = 1.0f - fact;
for (i = 0; i < num; i++) {
org_w[i] = (new_w[i] * fact) + (org_w[i] * ifact);
}
}
}
+/* Adds the given vertex to the specified vertex group, with given weight. */
+static void defvert_add_to_group(MDeformVert *dv, int defgrp_idx, const float weight) {
+ /* TODO, move into deform.c as a generic function. This assumes the vertex
+ * groups have already been checked, so this has to remain low level. */
+ MDeformWeight *newdw;
+
+ newdw = MEM_callocN(sizeof(MDeformWeight)*(dv->totweight+1), "defvert_add_to group, new deformWeight");
+ if(dv->dw) {
+ memcpy(newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight);
+ MEM_freeN(dv->dw);
+ }
+ dv->dw = newdw;
+ dv->dw[dv->totweight].weight = weight;
+ dv->dw[dv->totweight].def_nr = defgrp_idx;
+ dv->totweight++;
+}
+
+/* Removes the given vertex from the vertex group, specified either by its defgrp_idx,
+ * or directly by its MDeformWeight pointer, if dw is not NULL.
+ * WARNING: This function frees the given MDeformWeight, do not use it afterward! */
+static void defvert_remove_from_group(MDeformVert *dv, int defgrp_idx, MDeformWeight *dw) {
+ /* TODO, move this into deform.c as a generic function. */
+ MDeformWeight *newdw;
+ int i;
+
+ /* Get index of removed MDeformWeight. */
+ if(dw == NULL) {
+ dw = dv->dw;
+ for (i = dv->totweight; i > 0; i--, dw++) {
+ if (dw->def_nr == defgrp_idx)
+ break;
+ }
+ i--;
+ }
+ else {
+ i = dw - dv->dw;
+ /* Security check! */
+ if(i < 0 || i >= dv->totweight)
+ return;
+ }
+
+ dv->totweight--;
+ /* If there are still other deform weights attached to this vert then remove
+ * this deform weight, and reshuffle the others.
+ */
+ if(dv->totweight) {
+ newdw = MEM_mallocN(sizeof(MDeformWeight)*(dv->totweight), "defvert_remove_from_group, new deformWeight");
+ if(dv->dw){
+ memcpy(newdw, dv->dw, sizeof(MDeformWeight)*i);
+ memcpy(newdw+i, dv->dw+i+1, sizeof(MDeformWeight)*(dv->totweight-i));
+ MEM_freeN(dv->dw);
+ }
+ dv->dw = newdw;
+ }
+ /* If there are no other deform weights left then just remove this one. */
+ else {
+ MEM_freeN(dv->dw);
+ dv->dw = NULL;
+ }
+}
+
+
/* Applies weights to given vgroup (defgroup), and optionnaly add/remove vertices from the group.
- * If indices is not NULL, it must be a table of same length as weights, mapping to the real
- * vertex index (in case the weight table does not cover the whole vertices...).
+ * If dws is not NULL, it must be an array of MDeformWeight pointers of same length as weights (and
+ * defgrp_idx can then have any value).
+ * If indices is not NULL, it must be an array of same length as weights, mapping to the real
+ * vertex index (in case the weight array does not cover the whole vertices...).
*/
-void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, int num,
+void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, MDeformWeight **dws, int num,
const int *indices, const float *weights, int do_add,
float add_thresh, int do_rem, float rem_thresh)
{
int i;
- for (i = 0; i < num; i++) {
- int j;
- int add2vg = do_add;
+ for(i = 0; i < num; i++) {
float w = weights[i];
MDeformVert *dv = &dvert[indices ? indices[i] : i];
- MDeformWeight *newdw;
+ MDeformWeight *dw = dws ? dws[i] : defvert_find_index(dv, defgrp_idx);
/* Never allow weights out of [0.0, 1.0] range. */
CLAMP(w, 0.0f, 1.0f);
- /* Let's first check to see if this vert is already in the weight group – if so
- * let's update it, or remove it if needed.
- */
- for (j = 0; j < dv->totweight; j++) {
- /* If this weight corresponds to the deform group, update the value or,
- * if lower than rem_threshold, remove the vertex from the vgroup.
- */
- if (dv->dw[j].def_nr == defgrp_idx) {
- /* Remove the vertex from this vgroup if needed. */
- if (do_rem && w < rem_thresh) {
- /* TODO, move this into deform.c to make into a generic function */
-
- dv->totweight--;
- /* If there are still other deform weights attached to this vert then remove
- * this deform weight, and reshuffle the others.
- */
- if(dv->totweight) {
- newdw = MEM_mallocN(sizeof(MDeformWeight)*(dv->totweight), "deformWeight");
- if(dv->dw){
- memcpy(newdw, dv->dw, sizeof(MDeformWeight)*j);
- memcpy(newdw+j, dv->dw+j+1, sizeof(MDeformWeight)*(dv->totweight-j));
- MEM_freeN(dv->dw);
- }
- dv->dw = newdw;
- }
- /* If there are no other deform weights left then just remove this one. */
- else {
- MEM_freeN(dv->dw);
- dv->dw = NULL;
- }
- }
- /* Else, just set the new computed weight. */
- else {
- dv->dw[j].weight = w;
- }
- add2vg = FALSE;
- break;
+ /* If the vertex is in this vgroup, remove it if needed, or just update it. */
+ if(dw != NULL) {
+ if(do_rem && w < rem_thresh) {
+ defvert_remove_from_group(dv, defgrp_idx, dw);
}
- }
-
- /* If the vert wasn't in the deform group, add it if needed!
- */
- if ((add2vg == TRUE) && w > add_thresh) {
- /* TODO, mvoe into deform.c and make into a generic function, this assumes the vertex
- * groups have already been checked, so this has to remain low level */
- newdw = MEM_callocN(sizeof(MDeformWeight)*(dv->totweight+1), "WeightVGEdit Modifier, deformWeight");
- if(dv->dw) {
- memcpy(newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight);
- MEM_freeN(dv->dw);
+ else {
+ dw->weight = w;
}
- dv->dw = newdw;
- dv->dw[dv->totweight].weight = w;
- dv->dw[dv->totweight].def_nr = defgrp_idx;
- dv->totweight++;
+ }
+ /* Else, add it if needed! */
+ else if(do_add && w > add_thresh) {
+ defvert_add_to_group(dv, defgrp_idx, w);
}
}
}
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h
index ce3520f1900..a327bdf969b 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.h
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.h
@@ -83,7 +83,7 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne
* If indices is not NULL, it must be a table of same length as weights, mapping to the real
* vertex index (in case the weight table does not cover the whole vertices...).
*/
-void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, int num,
+void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, MDeformWeight **dws, int num,
const int *indices, const float *weights, int do_add,
float add_thresh, int do_rem, float rem_thresh);
diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c
index fffb3c6de2f..8e609ad5929 100644
--- a/source/blender/modifiers/intern/MOD_weightvgedit.c
+++ b/source/blender/modifiers/intern/MOD_weightvgedit.c
@@ -187,6 +187,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
Mesh *ob_m = NULL;
#endif
MDeformVert *dvert = NULL;
+ MDeformWeight **dw = NULL;
float *org_w; /* Array original weights. */
float *new_w; /* Array new weights. */
int numVerts;
@@ -257,13 +258,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
/* Get org weights, assuming 0.0 for vertices not in given vgroup. */
org_w = MEM_mallocN(sizeof(float) * numVerts, "WeightVGEdit Modifier, org_w");
- new_w = MEM_mallocN(sizeof(float) * numVerts, "WeightVGEdit Modifier, org_w");
+ new_w = MEM_mallocN(sizeof(float) * numVerts, "WeightVGEdit Modifier, new_w");
+ dw = MEM_mallocN(sizeof(MDeformWeight*) * numVerts, "WeightVGEdit Modifier, dw");
for (i = 0; i < numVerts; i++) {
- MDeformWeight *dw= defvert_find_index(&dvert[i], defgrp_idx);
- org_w[i] = new_w[i] = wmd->default_weight;
-
- if(dw) {
- org_w[i] = new_w[i] = dw->weight;
+ dw[i] = defvert_find_index(&dvert[i], defgrp_idx);
+ if(dw[i]) {
+ org_w[i] = new_w[i] = dw[i]->weight;
+ }
+ else {
+ org_w[i] = new_w[i] = wmd->default_weight;
}
}
@@ -278,12 +281,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
wmd->mask_tex_mapping, wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
/* Update/add/remove from vgroup. */
- weightvg_update_vg(dvert, defgrp_idx, numVerts, NULL, org_w, do_add, wmd->add_threshold,
+ weightvg_update_vg(dvert, defgrp_idx, dw, numVerts, NULL, org_w, do_add, wmd->add_threshold,
do_rem, wmd->rem_threshold);
/* Freeing stuff. */
MEM_freeN(org_w);
MEM_freeN(new_w);
+ MEM_freeN(dw);
/* Return the vgroup-modified mesh. */
return ret;
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c
index 8093683a098..f30a2deb576 100644
--- a/source/blender/modifiers/intern/MOD_weightvgmix.c
+++ b/source/blender/modifiers/intern/MOD_weightvgmix.c
@@ -229,13 +229,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
Mesh *ob_m = NULL;
#endif
MDeformVert *dvert = NULL;
+ MDeformWeight **dw1, **tdw1, **dw2, **tdw2;
int numVerts;
int defgrp_idx, defgrp_idx2 = -1;
float *org_w;
float *new_w;
int *tidx, *indices = NULL;
int numIdx = 0;
- int i, j;
+ int i;
char rel_ret = 0; /* Boolean, whether we have to release ret dm or not, when not using it! */
/* Get number of verts. */
@@ -304,78 +305,91 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
/* Find out which vertices to work on. */
tidx = MEM_mallocN(sizeof(int) * numVerts, "WeightVGMix Modifier, tidx");
+ tdw1 = MEM_mallocN(sizeof(MDeformWeight*) * numVerts, "WeightVGMix Modifier, tdw1");
+ tdw2 = MEM_mallocN(sizeof(MDeformWeight*) * numVerts, "WeightVGMix Modifier, tdw2");
switch (wmd->mix_set) {
case MOD_WVG_SET_A:
/* All vertices in first vgroup. */
for (i = 0; i < numVerts; i++) {
- for (j = 0; j < dvert[i].totweight; j++) {
- if(dvert[i].dw[j].def_nr == defgrp_idx) {
- tidx[numIdx++] = i;
- break;
- }
+ MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_idx);
+ if(dw) {
+ tdw1[numIdx] = dw;
+ tdw2[numIdx] = defvert_find_index(&dvert[i], defgrp_idx2);
+ tidx[numIdx++] = i;
}
}
break;
case MOD_WVG_SET_B:
/* All vertices in second vgroup. */
for (i = 0; i < numVerts; i++) {
- for (j = 0; j < dvert[i].totweight; j++) {
- if(dvert[i].dw[j].def_nr == defgrp_idx2) {
- tidx[numIdx++] = i;
- break;
- }
+ MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_idx2);
+ if(dw) {
+ tdw1[numIdx] = defvert_find_index(&dvert[i], defgrp_idx);
+ tdw2[numIdx] = dw;
+ tidx[numIdx++] = i;
}
}
break;
case MOD_WVG_SET_OR:
/* All vertices in one vgroup or the other. */
for (i = 0; i < numVerts; i++) {
- for (j = 0; j < dvert[i].totweight; j++) {
- if(dvert[i].dw[j].def_nr == defgrp_idx || dvert[i].dw[j].def_nr == defgrp_idx2) {
- tidx[numIdx++] = i;
- break;
- }
+ MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_idx);
+ MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_idx2);
+ if(adw || bdw) {
+ tdw1[numIdx] = adw;
+ tdw2[numIdx] = bdw;
+ tidx[numIdx++] = i;
}
}
break;
case MOD_WVG_SET_AND:
/* All vertices in both vgroups. */
for (i = 0; i < numVerts; i++) {
- int idx1 = FALSE;
- int idx2 = FALSE;
- for (j = 0; j < dvert[i].totweight; j++) {
- if(dvert[i].dw[j].def_nr == defgrp_idx) {
- if (idx2 == TRUE) {
- tidx[numIdx++] = i;
- break;
- }
- else {
- idx1 = TRUE;
- }
- }
- else if(dvert[i].dw[j].def_nr == defgrp_idx2) {
- if (idx1 == TRUE) {
- tidx[numIdx++] = i;
- break;
- }
- else {
- idx2 = TRUE;
- }
- }
+ MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_idx);
+ MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_idx2);
+ if(adw && bdw) {
+ tdw1[numIdx] = adw;
+ tdw2[numIdx] = bdw;
+ tidx[numIdx++] = i;
}
}
break;
case MOD_WVG_SET_ALL:
default:
- /* Use all vertices, no need to do anything here. */
+ /* Use all vertices. */
+ for (i = 0; i < numVerts; i++) {
+ tdw1[i] = defvert_find_index(&dvert[i], defgrp_idx);
+ tdw2[i] = defvert_find_index(&dvert[i], defgrp_idx2);
+ }
+ numIdx = -1;
break;
}
- if (numIdx) {
+ if(numIdx == 0) {
+ /* Use no vertices! Hence, return org data. */
+ MEM_freeN(tdw1);
+ MEM_freeN(tdw2);
+ MEM_freeN(tidx);
+ if (rel_ret)
+ ret->release(ret);
+ return dm;
+ }
+ if (numIdx != -1) {
indices = MEM_mallocN(sizeof(int) * numIdx, "WeightVGMix Modifier, indices");
memcpy(indices, tidx, sizeof(int) * numIdx);
+ dw1 = MEM_mallocN(sizeof(MDeformWeight*) * numIdx, "WeightVGMix Modifier, dw1");
+ memcpy(dw1, tdw1, sizeof(MDeformWeight*) * numIdx);
+ MEM_freeN(tdw1);
+ dw2 = MEM_mallocN(sizeof(MDeformWeight*) * numIdx, "WeightVGMix Modifier, dw2");
+ memcpy(dw2, tdw2, sizeof(MDeformWeight*) * numIdx);
+ MEM_freeN(tdw2);
}
- else
+ else {
+ /* Use all vertices. */
numIdx = numVerts;
+ /* Just copy MDeformWeight pointers arrays, they will be freed at the end. */
+ dw1 = tdw1;
+ dw2 = tdw2;
+ }
MEM_freeN(tidx);
org_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGMix Modifier, org_w");
@@ -384,27 +398,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
/* Mix weights. */
for (i = 0; i < numIdx; i++) {
float weight2 = 0.0;
- int w1 = FALSE;
- int w2 = FALSE;
- int idx = indices ? indices[i] : i;
- for (j = 0; j < dvert[idx].totweight; j++) {
- if(dvert[idx].dw[j].def_nr == defgrp_idx) {
- org_w[i] = dvert[idx].dw[j].weight;
- w1 = TRUE;
- if (w2 == TRUE)
- break;
- }
- else if(dvert[idx].dw[j].def_nr == defgrp_idx2) {
- weight2 = dvert[idx].dw[j].weight;
- w2 = TRUE;
- if (w1 == TRUE)
- break;
- }
- }
- if (w1 == FALSE)
- org_w[i] = wmd->default_weight_a;
- if (w2 == FALSE)
- weight2 = wmd->default_weight_b;
+ org_w[i] = dw1[i] ? dw1[i]->weight : wmd->default_weight_a;
+ weight2 = dw2[i] ? dw2[i]->weight : wmd->default_weight_b;
+
new_w[i] = mix_weight(org_w[i], weight2, wmd->mix_mode);
}
@@ -416,11 +412,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
/* Update (add to) vgroup.
* XXX Depending on the MOD_WVG_SET_xxx option chosen, we might have to add vertices to vgroup.
*/
- weightvg_update_vg(dvert, defgrp_idx, numIdx, indices, org_w, TRUE, -FLT_MAX, 0, 0.0f);
+ weightvg_update_vg(dvert, defgrp_idx, dw1, numIdx, indices, org_w, TRUE, -FLT_MAX, FALSE, 0.0f);
/* Freeing stuff. */
MEM_freeN(org_w);
MEM_freeN(new_w);
+ MEM_freeN(dw1);
+ MEM_freeN(dw2);
if (indices)
MEM_freeN(indices);
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index 896b0d86c85..6242c6d0f5e 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -344,6 +344,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
Mesh *ob_m = NULL;
#endif
MDeformVert *dvert = NULL;
+ MDeformWeight **dw, **tdw;
int numVerts;
float (*v_cos)[3] = NULL; /* The vertices coordinates. */
Object *obr = NULL; /* Our target object. */
@@ -353,7 +354,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
float *new_w =NULL;
int *tidx, *indices = NULL;
int numIdx = 0;
- int i, j;
+ int i;
char rel_ret = 0; /* Boolean, whether we have to release ret dm or not, when not using it! */
/* Get number of verts. */
@@ -423,22 +424,34 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
*/
tidx = MEM_mallocN(sizeof(int) * numVerts, "WeightVGProximity Modifier, tidx");
tw = MEM_mallocN(sizeof(float) * numVerts, "WeightVGProximity Modifier, tw");
+ tdw = MEM_mallocN(sizeof(MDeformWeight*) * numVerts, "WeightVGProximity Modifier, tdw");
for (i = 0; i < numVerts; i++) {
- for (j = 0; j < dvert[i].totweight; j++) {
- if(dvert[i].dw[j].def_nr == defgrp_idx) {
- tidx[numIdx] = i;
- tw[numIdx++] = dvert[i].dw[j].weight;
- break;
- }
+ MDeformWeight *_dw = defvert_find_index(&dvert[i], defgrp_idx);
+ if(_dw) {
+ tidx[numIdx] = i;
+ tw[numIdx] = _dw->weight;
+ tdw[numIdx++] = _dw;
}
}
+ /* If no vertices found, return org data! */
+ if(numIdx == 0) {
+ MEM_freeN(tidx);
+ MEM_freeN(tw);
+ MEM_freeN(tdw);
+ if (rel_ret)
+ ret->release(ret);
+ return dm;
+ }
indices = MEM_mallocN(sizeof(int) * numIdx, "WeightVGProximity Modifier, indices");
memcpy(indices, tidx, sizeof(int) * numIdx);
org_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGProximity Modifier, org_w");
new_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGProximity Modifier, new_w");
memcpy(org_w, tw, sizeof(float) * numIdx);
+ dw = MEM_mallocN(sizeof(MDeformWeight*) * numIdx, "WeightVGProximity Modifier, dw");
+ memcpy(dw, tdw, sizeof(MDeformWeight*) * numIdx);
MEM_freeN(tidx);
MEM_freeN(tw);
+ MEM_freeN(tdw);
/* Get our vertex coordinates. */
v_cos = MEM_mallocN(sizeof(float[3]) * numIdx, "WeightVGProximity Modifier, v_cos");
@@ -447,7 +460,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
/* Compute wanted distances. */
if (wmd->proximity_mode == MOD_WVG_PROXIMITY_OBJECT) {
- float dist = get_ob2ob_distance(ob, obr);
+ const float dist = get_ob2ob_distance(ob, obr);
for(i = 0; i < numIdx; i++)
new_w[i] = dist;
}
@@ -482,8 +495,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
target_dm, &loc2trgt);
for(i = 0; i < numIdx; i++) {
new_w[i] = dists_v ? dists_v[i] : FLT_MAX;
- new_w[i] = dists_e ? minf(dists_e[i], new_w[i]) : new_w[i];
- new_w[i] = dists_f ? minf(dists_f[i], new_w[i]) : new_w[i];
+ if(dists_e)
+ new_w[i] = minf(dists_e[i], new_w[i]);
+ if(dists_f)
+ new_w[i] = minf(dists_f[i], new_w[i]);
}
if(dists_v) MEM_freeN(dists_v);
if(dists_e) MEM_freeN(dists_e);
@@ -508,11 +523,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
wmd->mask_tex_mapping, wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
/* Update vgroup. Note we never add nor remove vertices from vgroup here. */
- weightvg_update_vg(dvert, defgrp_idx, numIdx, indices, org_w, 0, 0.0f, 0, 0.0f);
+ weightvg_update_vg(dvert, defgrp_idx, dw, numIdx, indices, org_w, FALSE, 0.0f, FALSE, 0.0f);
/* Freeing stuff. */
MEM_freeN(org_w);
MEM_freeN(new_w);
+ MEM_freeN(dw);
MEM_freeN(indices);
MEM_freeN(v_cos);
diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c
index 01e46ed3df9..5c58070be9d 100644
--- a/source/blender/nodes/composite/node_composite_tree.c
+++ b/source/blender/nodes/composite/node_composite_tree.c
@@ -337,7 +337,7 @@ static void *exec_composite_node(void *nodeexec_v)
node->typeinfo->newexecfunc(thd->rd, 0, node, nodeexec->data, nsin, nsout);
node->exec |= NODE_READY;
- return 0;
+ return NULL;
}
/* return total of executable nodes, for timecursor */
diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
index 23bcf57e2bc..9f4af0e0d33 100644
--- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
@@ -88,9 +88,9 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float *
static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
- CompBuf *outbuf=0;
- CompBuf *imbuf1=0;
- CompBuf *imbuf2=0;
+ CompBuf *outbuf= NULL;
+ CompBuf *imbuf1= NULL;
+ CompBuf *imbuf2= NULL;
NodeChroma *c;
/*is anything connected?*/
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index a1571dc028c..d5bd44fc288 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -208,6 +208,44 @@ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
return item;
}
+/* similar to PyErr_Format(),
+ *
+ * implimentation - we cant actually preprend the existing exception,
+ * because it could have _any_ argiments given to it, so instead we get its
+ * __str__ output and raise our own exception including it.
+ */
+PyObject *PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...)
+{
+ PyObject *error_value_prefix;
+ va_list args;
+
+ va_start(args, format);
+ error_value_prefix= PyUnicode_FromFormatV(format, args); /* can fail and be NULL */
+ va_end(args);
+
+ if(PyErr_Occurred()) {
+ PyObject *error_type, *error_value, *error_traceback;
+ PyErr_Fetch(&error_type, &error_value, &error_traceback);
+ PyErr_Format(exception_type_prefix,
+ "%S, %.200s(%S)",
+ error_value_prefix,
+ Py_TYPE(error_value)->tp_name,
+ error_value
+ );
+ }
+ else {
+ PyErr_SetObject(exception_type_prefix,
+ error_value_prefix
+ );
+ }
+
+ Py_XDECREF(error_value_prefix);
+
+ /* dumb to always return NULL but matches PyErr_Format */
+ return NULL;
+}
+
+
/* returns the exception string as a new PyUnicode object, depends on external traceback module */
#if 0
diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h
index 96c93ab71f8..03a8637710e 100644
--- a/source/blender/python/generic/py_capi_utils.h
+++ b/source/blender/python/generic/py_capi_utils.h
@@ -34,6 +34,7 @@ void PyC_ObSpit(const char *name, PyObject *var);
void PyC_LineSpit(void);
PyObject * PyC_ExceptionBuffer(void);
PyObject * PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
+PyObject * PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...);
void PyC_FileAndNum(const char **filename, int *lineno);
int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObject *type, const short is_double, const char *error_prefix);
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index eeb2adb3cf2..5dcaf9e5423 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -63,7 +63,7 @@ static PyStructSequence_Desc app_cb_info_desc= {
#endif
*/
-static PyObject *py_cb_array[BLI_CB_EVT_TOT]= {0};
+static PyObject *py_cb_array[BLI_CB_EVT_TOT]= {NULL};
static PyObject *make_app_cb_info(void)
{
@@ -102,7 +102,7 @@ PyObject *BPY_app_handlers_struct(void)
/* assign the C callbacks */
if(ret) {
- static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT]= {{0}};
+ static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT]= {{NULL}};
bCallbackFuncStore *funcstore;
int pos= 0;
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 4c382efdda3..a63cee4e505 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1525,10 +1525,22 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
#endif // USE_STRING_COERCE
if (param==NULL) {
- PyErr_Format(PyExc_TypeError,
- "%.200s %.200s.%.200s expected a string type, not %.200s",
- error_prefix, RNA_struct_identifier(ptr->type),
- RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
+ if(PyUnicode_Check(value)) {
+ /* there was an error assigning a string type,
+ * rather than setting a new error, prefix the existing one
+ */
+ PyC_Err_Format_Prefix(PyExc_TypeError,
+ "%.200s %.200s.%.200s error assigning string",
+ error_prefix, RNA_struct_identifier(ptr->type),
+ RNA_property_identifier(prop));
+ }
+ else {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s %.200s.%.200s expected a string type, not %.200s",
+ error_prefix, RNA_struct_identifier(ptr->type),
+ RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
+ }
+
return -1;
}
else {
@@ -6427,14 +6439,11 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
* no line number since the func has finished calling on error,
* re-raise the exception with more info since it would be slow to
* create prefix on every call (when there are no errors) */
- if(err == -1 && PyErr_Occurred()) {
- PyObject *error_type, *error_value, *error_traceback;
- PyErr_Fetch(&error_type, &error_value, &error_traceback);
-
- PyErr_Format(error_type,
- "class %.200s, function %.200s: incompatible return value%S",
- RNA_struct_identifier(ptr->type), RNA_function_identifier(func),
- error_value);
+ if(err == -1) {
+ PyC_Err_Format_Prefix(PyExc_RuntimeError,
+ "class %.200s, function %.200s: incompatible return value ",
+ RNA_struct_identifier(ptr->type), RNA_function_identifier(func)
+ );
}
}
else if (ret_len > 1) {
diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c
index 334bb1f725a..8fa6a7b0629 100644
--- a/source/blender/python/intern/gpu.c
+++ b/source/blender/python/intern/gpu.c
@@ -55,6 +55,8 @@
#include "bpy_rna.h"
+#include "gpu.h"
+
#define PY_MODULE_ADD_CONSTANT(module, name) PyModule_AddIntConstant(module, #name, name)
PyDoc_STRVAR(M_gpu_doc,
diff --git a/source/blender/render/intern/raytrace/rayobject_octree.cpp b/source/blender/render/intern/raytrace/rayobject_octree.cpp
index e35fcbc2df7..5fa0b836f4f 100644
--- a/source/blender/render/intern/raytrace/rayobject_octree.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_octree.cpp
@@ -264,7 +264,7 @@ static int face_in_node(RayFace *face, short x, short y, short z, float rtf[][3]
return 0;
}
-static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short z, float rtf[][3])
+static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short z, float rtf[4][3])
{
Branch *br;
Node *no;
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index e1706ac25b2..7ca7a85a7d0 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -1488,8 +1488,8 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re
if(part->draw & PART_DRAW_VEL_LENGTH)
mul_v3_fl(vel, len_v3(state->vel));
- VECADDFAC(loc0, loc, vel, -part->draw_line[0]);
- VECADDFAC(loc1, loc, vel, part->draw_line[1]);
+ madd_v3_v3v3fl(loc0, loc, vel, -part->draw_line[0]);
+ madd_v3_v3v3fl(loc1, loc, vel, part->draw_line[1]);
particle_curve(re, obr, dm, ma, sd, loc0, loc1, seed, pa_co);
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c
index 66a73b47790..e2b3b23b9c9 100644
--- a/source/blender/render/intern/source/envmap.c
+++ b/source/blender/render/intern/source/envmap.c
@@ -240,8 +240,8 @@ static void envmap_transmatrix(float mat[][4], int part)
copy_m4_m4(tmat, mat);
eul_to_mat4( rotmat,eul);
mul_serie_m4(mat, tmat, rotmat,
- 0, 0, 0,
- 0, 0, 0);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
}
/* ------------------------------------------------------------------------- */
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 49e5e7b989d..05bcc32a90a 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -1452,10 +1452,12 @@ void RE_test_break_cb(Render *re, void *handle, int (*f)(void *handle))
/* object is considered fully prepared on correct time etc */
/* includes lights */
+#if 0
void RE_AddObject(Render *UNUSED(re), Object *UNUSED(ob))
{
}
+#endif
/* *************************************** */
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index 16bbe1ca5c2..59a505a3195 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -2234,21 +2234,17 @@ static int bake_intersect_tree(RayObject* raytree, Isect* isect, float *start, f
maxdist= R.r.bake_maxdist;
else
maxdist= RE_RAYTRACE_MAXDIST + R.r.bake_biasdist;
-
+
/* 'dir' is always normalized */
- VECADDFAC(isect->start, start, dir, -R.r.bake_biasdist);
+ madd_v3_v3v3fl(isect->start, start, dir, -R.r.bake_biasdist);
- isect->dir[0] = dir[0]*sign;
- isect->dir[1] = dir[1]*sign;
- isect->dir[2] = dir[2]*sign;
+ mul_v3_v3fl(isect->dir, dir, sign);
isect->dist = maxdist;
hit = RE_rayobject_raycast(raytree, isect);
if(hit) {
- hitco[0] = isect->start[0] + isect->dist*isect->dir[0];
- hitco[1] = isect->start[1] + isect->dist*isect->dir[1];
- hitco[2] = isect->start[2] + isect->dist*isect->dir[2];
+ madd_v3_v3v3fl(hitco, isect->start, isect->dir, isect->dist);
*dist= isect->dist;
}
diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c
index 128900d1fd2..d8231c7e7d4 100644
--- a/source/blender/render/intern/source/shadeinput.c
+++ b/source/blender/render/intern/source/shadeinput.c
@@ -1165,8 +1165,9 @@ void shade_input_set_shade_texco(ShadeInput *shi)
shi->vcol[2]= 1.0f;
shi->vcol[3]= 1.0f;
}
- if(tface && tface->tpage)
+ if(tface->tpage) {
render_realtime_texture(shi, tface->tpage);
+ }
}
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index ba922620ee1..ac56304bdcb 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -239,7 +239,7 @@ static short cliptestf(float p, float q, float *u1, float *u2)
return 1;
}
-int testclip(const float v[3])
+int testclip(const float v[4])
{
float abs4; /* WATCH IT: this function should do the same as cliptestf, otherwise troubles in zbufclip()*/
short c=0;
@@ -843,7 +843,7 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), flo
}
-static int clipline(float *v1, float *v2) /* return 0: do not draw */
+static int clipline(float v1[4], float v2[4]) /* return 0: do not draw */
{
float dz,dw, u1=0.0, u2=1.0;
float dx, dy, v13;
@@ -893,7 +893,7 @@ static int clipline(float *v1, float *v2) /* return 0: do not draw */
return 0;
}
-void hoco_to_zco(ZSpan *zspan, float *zco, float *hoco)
+void hoco_to_zco(ZSpan *zspan, float zco[3], const float hoco[4])
{
float div;
@@ -998,7 +998,7 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h
}
-void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, float *ho1, float *ho2)
+void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, const float ho1[4], const float ho2[4])
{
float f1[4], f2[4];
int c1, c2;
@@ -1008,8 +1008,8 @@ void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, float *ho1, float *ho2)
if(c1 | c2) { /* not in the middle */
if(!(c1 & c2)) { /* not out completely */
- QUATCOPY(f1, ho1);
- QUATCOPY(f2, ho2);
+ copy_v4_v4(f1, ho1);
+ copy_v4_v4(f2, ho2);
if(clipline(f1, f2)) {
hoco_to_zco(zspan, f1, f1);
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index c435a94c6f4..d66cbabb96b 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -81,6 +81,7 @@ struct SculptSession;
struct ShadeInput;
struct ShadeResult;
struct SpaceImage;
+struct SpaceNode;
struct Tex;
struct TexResult;
struct Text;
@@ -202,7 +203,6 @@ void ED_area_headerprint(struct ScrArea *sa, char *str){}
struct EditBone *ED_armature_bone_get_mirrored(struct ListBase *edbo, struct EditBone *ebo){return (struct EditBone *) NULL;}
struct EditBone *ED_armature_edit_bone_add(struct bArmature *arm, char *name){return (struct EditBone*) NULL;}
-struct Object *ED_object_pose_armature(struct Object *ob){ return (struct Object *)NULL; }
struct ListBase *get_active_constraints (struct Object *ob){return (struct ListBase *) NULL;}
struct ListBase *get_constraint_lb(struct Object *ob, struct bConstraint *con, struct bPoseChannel **pchan_r){return (struct ListBase *) NULL;}
int ED_pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan){return 0;}
@@ -316,8 +316,6 @@ void ED_sequencer_update_view(struct bContext *C, int view){}
float ED_rollBoneToVector(struct EditBone *bone, float new_up_axis[3]){return 0.0f;}
void ED_space_image_size(struct SpaceImage *sima, int *width, int *height){}
-struct ListBase *ED_curve_editnurbs(struct Curve *cu){return NULL;}
-void free_curve_editNurb (struct Curve *cu){}
void ED_nurb_set_spline_type(struct Nurb *nu, int type){}
void EM_selectmode_set(struct EditMesh *em){}
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index f790e213b57..22fe0a1a1d1 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -435,12 +435,12 @@ elseif(WIN32)
PATTERN ".svn" EXCLUDE
)
- if(NOT CMAKE_CL_64)
- install(
- FILES ${LIBDIR}/gettext/lib/gnu_gettext.dll
- DESTINATION ${TARGETDIR}
- )
+ install(
+ FILES ${LIBDIR}/gettext/lib/gnu_gettext.dll
+ DESTINATION ${TARGETDIR}
+ )
+ if(NOT CMAKE_CL_64)
install(
FILES ${LIBDIR}/iconv/lib/iconv.dll
DESTINATION ${TARGETDIR}
@@ -712,7 +712,11 @@ add_dependencies(blender makesdna)
get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
-set(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} bf_windowmanager bf_render)
+set(BLENDER_LINK_LIBS
+ ${BLENDER_LINK_LIBS}
+ bf_windowmanager
+ bf_render
+)
if(WITH_MOD_FLUID)
list(APPEND BLENDER_LINK_LIBS bf_intern_elbeem)
@@ -798,8 +802,8 @@ endif()
bf_intern_smoke
extern_minilzo
extern_lzma
- extern_recastnavigation
ge_logic_ketsji
+ extern_recastnavigation
ge_phys_common
ge_logic
ge_rasterizer
@@ -807,7 +811,6 @@ endif()
ge_logic_expressions
ge_scenegraph
ge_logic_network
- bf_python # duplicate for BPY_driver_exec
ge_logic_ngnetwork
extern_bullet
ge_logic_loopbacknetwork
@@ -820,8 +823,6 @@ endif()
bf_blenfont
bf_intern_audaspace
bf_intern_mikktspace
- extern_recastnavigation
- bf_editor_util # --- BAD LEVEL CALL HERE --- XXX, this should be removed before release!
)
if(WITH_MOD_CLOTH_ELTOPO)
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 8f21920c799..3afe19334c2 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -589,7 +589,7 @@ static int set_engine(int argc, const char **argv, void *data)
RenderData *rd = &scene->r;
if(BLI_findstring(&R_engines, argv[1], offsetof(RenderEngineType, idname))) {
- BLI_strncpy(rd->engine, argv[1], sizeof(rd->engine));
+ BLI_strncpy_utf8(rd->engine, argv[1], sizeof(rd->engine));
}
}
}
diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp
index 684bd3f341e..c5bf28b9b8d 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.cpp
+++ b/source/gameengine/Converter/BL_ArmatureObject.cpp
@@ -110,7 +110,6 @@ void game_copy_pose(bPose **dst, bPose *src, int copy_constraint)
for (pchan=(bPoseChannel*)out->chanbase.first; pchan; pchan=(bPoseChannel*)pchan->next) {
pchan->parent= (bPoseChannel*)BLI_ghash_lookup(ghash, pchan->parent);
pchan->child= (bPoseChannel*)BLI_ghash_lookup(ghash, pchan->child);
- pchan->path= NULL;
if (copy_constraint) {
ListBase listb;
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index ae8d7094015..853b36b54f7 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -364,7 +364,9 @@ BL_ActionManager* KX_GameObject::GetActionManager()
{
// We only want to create an action manager if we need it
if (!m_actionManager)
- { KX_GetActiveScene()->AddAnimatedObject(this); m_actionManager = new BL_ActionManager(this);
+ {
+ KX_GetActiveScene()->AddAnimatedObject(this);
+ m_actionManager = new BL_ActionManager(this);
}
return m_actionManager;
}
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index 65ff06456b4..acd25ace04a 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -327,6 +327,8 @@ void KX_KetsjiEngine::RenderDome()
// do the rendering
m_dome->RenderDomeFrame(scene,cam, i);
+ //render all the font objects for this scene
+ RenderFonts(scene);
}
list<class KX_Camera*>* cameras = scene->GetCameras();
@@ -344,6 +346,8 @@ void KX_KetsjiEngine::RenderDome()
// do the rendering
m_dome->RenderDomeFrame(scene, (*it),i);
+ //render all the font objects for this scene
+ RenderFonts(scene);
}
it++;
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index bdc30810b9e..7ff4a786387 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1034,6 +1034,8 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj)
ret = newobj->Release();
if (m_euthanasyobjects->RemoveValue(newobj))
ret = newobj->Release();
+ if (m_animatedlist->RemoveValue(newobj))
+ ret = newobj->Release();
if (newobj == m_active_camera)
{
@@ -1525,6 +1527,7 @@ void KX_Scene::LogicBeginFrame(double curtime)
void KX_Scene::AddAnimatedObject(CValue* gameobj)
{
+ gameobj->AddRef();
m_animatedlist->Add(gameobj);
}
@@ -1537,7 +1540,7 @@ void KX_Scene::UpdateAnimations(double curtime)
{
// Update any animations
for (int i=0; i<m_animatedlist->GetCount(); ++i)
- ((KX_GameObject*)GetObjectList()->GetValue(i))->UpdateActionManager(curtime);
+ ((KX_GameObject*)m_animatedlist->GetValue(i))->UpdateActionManager(curtime);
}
void KX_Scene::LogicUpdateFrame(double curtime, bool frame)