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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-11-02 20:17:05 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-11-02 20:17:05 +0400
commit2f453773f6b4cd0a03f5e2d9876ee250b87871f0 (patch)
tree08c4bb2c1c3ee3fe5131e46a4e39b9224ba5c251 /source/blender
parent02fae3440c8b4b89aa0f9412bc4e0db60a787c13 (diff)
parente1594ebb3c52f573a8a6c90f3d30acfb3de6e8a5 (diff)
Cycles: svn merge -r41266:41467 ^/trunk/blender
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenfont/intern/blf_lang.c3
-rw-r--r--source/blender/blenkernel/BKE_deform.h7
-rw-r--r--source/blender/blenkernel/BKE_image.h6
-rw-r--r--source/blender/blenkernel/BKE_library.h4
-rw-r--r--source/blender/blenkernel/CMakeLists.txt13
-rw-r--r--source/blender/blenkernel/SConscript4
-rw-r--r--source/blender/blenkernel/intern/action.c58
-rw-r--r--source/blender/blenkernel/intern/anim.c24
-rw-r--r--source/blender/blenkernel/intern/armature.c102
-rw-r--r--source/blender/blenkernel/intern/blender.c19
-rw-r--r--source/blender/blenkernel/intern/brush.c28
-rw-r--r--source/blender/blenkernel/intern/constraint.c2
-rw-r--r--source/blender/blenkernel/intern/curve.c85
-rw-r--r--source/blender/blenkernel/intern/deform.c99
-rw-r--r--source/blender/blenkernel/intern/effect.c4
-rw-r--r--source/blender/blenkernel/intern/fcurve.c20
-rw-r--r--source/blender/blenkernel/intern/image.c137
-rw-r--r--source/blender/blenkernel/intern/ipo.c9
-rw-r--r--source/blender/blenkernel/intern/key.c30
-rw-r--r--source/blender/blenkernel/intern/lattice.c24
-rw-r--r--source/blender/blenkernel/intern/library.c73
-rw-r--r--source/blender/blenkernel/intern/material.c51
-rw-r--r--source/blender/blenkernel/intern/mball.c26
-rw-r--r--source/blender/blenkernel/intern/mesh.c84
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.c51
-rw-r--r--source/blender/blenkernel/intern/node.c9
-rw-r--r--source/blender/blenkernel/intern/object.c91
-rw-r--r--source/blender/blenkernel/intern/particle.c27
-rw-r--r--source/blender/blenkernel/intern/particle_system.c13
-rw-r--r--source/blender/blenkernel/intern/smoke.c7
-rw-r--r--source/blender/blenkernel/intern/speaker.c23
-rw-r--r--source/blender/blenkernel/intern/texture.c57
-rw-r--r--source/blender/blenkernel/intern/world.c26
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c3
-rw-r--r--source/blender/blenlib/BLI_bpath.h37
-rw-r--r--source/blender/blenlib/BLI_path_util.h1
-rw-r--r--source/blender/blenlib/BLI_string.h1
-rw-r--r--source/blender/blenlib/BLI_threads.h1
-rw-r--r--source/blender/blenlib/intern/bpath.c1158
-rw-r--r--source/blender/blenlib/intern/math_rotation.c2
-rw-r--r--source/blender/blenlib/intern/path_util.c47
-rw-r--r--source/blender/blenlib/intern/string_utf8.c2
-rw-r--r--source/blender/blenlib/intern/threads.c5
-rw-r--r--source/blender/blenloader/BLO_readfile.h1
-rw-r--r--source/blender/blenloader/intern/readfile.c98
-rw-r--r--source/blender/blenloader/intern/writefile.c9
-rw-r--r--source/blender/blenpluginapi/intern/pluginapi.c2
-rw-r--r--source/blender/collada/ArmatureImporter.cpp2
-rw-r--r--source/blender/collada/ArmatureImporter.h2
-rw-r--r--source/blender/editors/CMakeLists.txt1
-rw-r--r--source/blender/editors/SConscript1
-rw-r--r--source/blender/editors/animation/anim_markers.c6
-rw-r--r--source/blender/editors/animation/keyframes_general.c10
-rw-r--r--source/blender/editors/animation/keyingsets.c8
-rw-r--r--source/blender/editors/armature/poseSlide.c4
-rw-r--r--source/blender/editors/armature/poseUtils.c20
-rw-r--r--source/blender/editors/armature/poseobject.c26
-rw-r--r--source/blender/editors/curve/curve_ops.c1
-rw-r--r--source/blender/editors/curve/editfont.c10
-rw-r--r--source/blender/editors/datafiles/CMakeLists.txt2
-rw-r--r--source/blender/editors/datafiles/blender_icons.png.c (renamed from source/blender/editors/datafiles/blenderbuttons.c)6
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c4
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c30
-rw-r--r--source/blender/editors/include/ED_datafiles.h4
-rw-r--r--source/blender/editors/include/ED_mesh.h2
-rw-r--r--source/blender/editors/include/ED_screen.h1
-rw-r--r--source/blender/editors/include/ED_space_api.h1
-rw-r--r--source/blender/editors/include/UI_interface.h2
-rw-r--r--source/blender/editors/interface/interface.c9
-rw-r--r--source/blender/editors/interface/interface_handlers.c20
-rw-r--r--source/blender/editors/interface/interface_icons.c10
-rw-r--r--source/blender/editors/interface/interface_templates.c54
-rw-r--r--source/blender/editors/interface/resources.c41
-rw-r--r--source/blender/editors/mesh/editface.c1
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c4
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c48
-rw-r--r--source/blender/editors/metaball/mball_edit.c4
-rw-r--r--source/blender/editors/object/object_constraint.c7
-rw-r--r--source/blender/editors/object/object_lattice.c4
-rw-r--r--source/blender/editors/object/object_relations.c3
-rw-r--r--source/blender/editors/object/object_vgroup.c146
-rw-r--r--source/blender/editors/physics/CMakeLists.txt4
-rw-r--r--source/blender/editors/physics/particle_edit.c4
-rw-r--r--source/blender/editors/physics/physics_fluid.c6
-rw-r--r--source/blender/editors/render/render_internal.c71
-rw-r--r--source/blender/editors/render/render_opengl.c8
-rw-r--r--source/blender/editors/screen/screen_ops.c13
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c102
-rw-r--r--source/blender/editors/sound/sound_ops.c60
-rw-r--r--source/blender/editors/space_action/action_edit.c14
-rw-r--r--source/blender/editors/space_api/spacetypes.c1
-rw-r--r--source/blender/editors/space_console/console_ops.c60
-rw-r--r--source/blender/editors/space_file/filelist.c2
-rw-r--r--source/blender/editors/space_graph/graph_edit.c7
-rw-r--r--source/blender/editors/space_graph/graph_intern.h4
-rw-r--r--source/blender/editors/space_image/image_intern.h3
-rw-r--r--source/blender/editors/space_image/image_ops.c280
-rw-r--r--source/blender/editors/space_info/info_ops.c17
-rw-r--r--source/blender/editors/space_nla/nla_intern.h5
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c8
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h3
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c4
-rw-r--r--source/blender/editors/space_script/CMakeLists.txt1
-rw-r--r--source/blender/editors/space_script/script_header.c120
-rw-r--r--source/blender/editors/space_script/script_intern.h4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c9
-rw-r--r--source/blender/editors/space_sound/CMakeLists.txt43
-rw-r--r--source/blender/editors/space_sound/SConscript9
-rw-r--r--source/blender/editors/space_sound/sound_header.c127
-rw-r--r--source/blender/editors/space_sound/sound_intern.h42
-rw-r--r--source/blender/editors/space_sound/space_sound.c266
-rw-r--r--source/blender/editors/space_text/text_header.c8
-rw-r--r--source/blender/editors/space_text/text_ops.c336
-rw-r--r--source/blender/editors/space_time/time_intern.h3
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c17
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c1
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c42
-rw-r--r--source/blender/editors/transform/transform.c67
-rw-r--r--source/blender/editors/transform/transform_conversions.c8
-rw-r--r--source/blender/editors/transform/transform_generics.c2
-rw-r--r--source/blender/editors/transform/transform_ops.c2
-rw-r--r--source/blender/gpu/GPU_extensions.h5
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c29
-rw-r--r--source/blender/gpu/intern/gpu_material.c3
-rw-r--r--source/blender/ikplugin/CMakeLists.txt6
-rw-r--r--source/blender/ikplugin/SConscript5
-rw-r--r--source/blender/imbuf/CMakeLists.txt11
-rw-r--r--source/blender/imbuf/IMB_imbuf.h23
-rw-r--r--source/blender/imbuf/intern/allocimbuf.c3
-rw-r--r--source/blender/imbuf/intern/anim_movie.c7
-rw-r--r--source/blender/imbuf/intern/readimage.c50
-rw-r--r--source/blender/makesdna/DNA_mesh_types.h8
-rw-r--r--source/blender/makesdna/DNA_object_types.h1
-rw-r--r--source/blender/makesdna/DNA_space_types.h84
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h4
-rw-r--r--source/blender/makesdna/DNA_world_types.h4
-rw-r--r--source/blender/makesdna/intern/makesdna.c20
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt4
-rw-r--r--source/blender/makesrna/intern/makesrna.c4
-rw-r--r--source/blender/makesrna/intern/rna_action.c6
-rw-r--r--source/blender/makesrna/intern/rna_context.c2
-rw-r--r--source/blender/makesrna/intern/rna_fluidsim.c6
-rw-r--r--source/blender/makesrna/intern/rna_key.c2
-rw-r--r--source/blender/makesrna/intern/rna_scene.c2
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c2
-rw-r--r--source/blender/makesrna/intern/rna_space.c9
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c3
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c35
-rw-r--r--source/blender/makesrna/intern/rna_wm.c2
-rw-r--r--source/blender/makesrna/intern/rna_world.c14
-rw-r--r--source/blender/modifiers/CMakeLists.txt4
-rw-r--r--source/blender/modifiers/SConscript12
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim_util.c11
-rw-r--r--source/blender/modifiers/intern/MOD_mirror.c6
-rw-r--r--source/blender/modifiers/intern/MOD_solidify.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mixrgb.c6
-rw-r--r--source/blender/nodes/shader/node_shader_tree.c11
-rw-r--r--source/blender/nodes/texture/node_texture_tree.c11
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_scale.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_texture.c10
-rw-r--r--source/blender/python/BPY_extern.h18
-rw-r--r--source/blender/python/generic/IDProp.c18
-rw-r--r--source/blender/python/generic/bpy_internal_import.c2
-rw-r--r--source/blender/python/generic/bpy_internal_import.h2
-rw-r--r--source/blender/python/intern/bpy.c67
-rw-r--r--source/blender/python/intern/bpy_library.c5
-rw-r--r--source/blender/python/intern/gpu.c2
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.c96
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c12
-rw-r--r--source/blender/python/simple_enum_gen.py6
-rw-r--r--source/blender/quicktime/SConscript2
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c5
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c9
-rw-r--r--source/blender/windowmanager/intern/wm_window.c3
176 files changed, 2408 insertions, 3135 deletions
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
index 79610f9c10b..3bce3878d72 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -94,6 +94,7 @@ static const char *locales[] = {
"korean", "ko_KR",
"nepali", "ne_NP",
"persian", "fa_PE",
+ "indonesian", "id_ID"
};
void BLF_lang_init(void)
@@ -119,7 +120,7 @@ void BLF_lang_set(const char *str)
const char *short_locale;
int ok= 1;
#if defined (_WIN32) && !defined(FREE_WINDOWS)
- char *long_locale = locales[ 2 * U.language];
+ const char *long_locale = locales[ 2 * U.language];
#endif
if((U.transopts&USER_DOTRANSLATE)==0)
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index 15d3c86c315..3e643fe961c 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -44,7 +44,8 @@ void defgroup_copy_list(struct ListBase *lb1, struct ListBase *lb2);
struct bDeformGroup *defgroup_duplicate(struct bDeformGroup *ingroup);
struct bDeformGroup *defgroup_find_name(struct Object *ob, const char *name);
int defgroup_find_index(struct Object *ob, struct bDeformGroup *dg);
-int *defgroup_flip_map(struct Object *ob, int use_default);
+int *defgroup_flip_map(struct Object *ob, int *flip_map_len, int use_default);
+int *defgroup_flip_map_single(struct Object *ob, int *flip_map_len, int use_default, int defgroup);
int defgroup_flip_index(struct Object *ob, int index, int use_default);
int defgroup_name_index(struct Object *ob, const char *name);
void defgroup_unique_name(struct bDeformGroup *dg, struct Object *ob);
@@ -57,9 +58,9 @@ float defvert_array_find_weight_safe(const struct MDeformVert *dvert, int index
void defvert_copy(struct MDeformVert *dvert_r, const struct MDeformVert *dvert);
void defvert_sync(struct MDeformVert *dvert_r, const struct MDeformVert *dvert, int use_verify);
-void defvert_sync_mapped(struct MDeformVert *dvert_r, const struct MDeformVert *dvert, const int *flip_map, int use_verify);
+void defvert_sync_mapped(struct MDeformVert *dvert_r, const struct MDeformVert *dvert, const int *flip_map, const int flip_map_len, const int use_verify);
void defvert_remap (struct MDeformVert *dvert, int *map);
-void defvert_flip(struct MDeformVert *dvert, const int *flip_map);
+void defvert_flip(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len);
void defvert_normalize(struct MDeformVert *dvert);
/* utility function, note that 32 chars is the maximum string length since its only
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index 4db92757969..adb34f4c501 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -58,10 +58,12 @@ int BKE_ftype_to_imtype(int ftype);
int BKE_imtype_to_ftype(int imtype);
int BKE_imtype_is_movie(int imtype);
-struct anim *openanim(char * name, int flags, int streamindex);
+struct anim *openanim(const char *name, int flags, int streamindex);
void image_de_interlace(struct Image *ima, int odd);
-
+
+void make_local_image(struct Image *ima);
+
void tag_image_time(struct Image *ima);
void free_old_images(void);
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index 947eafa9dd3..9130cac6cd6 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -49,6 +49,7 @@ void *alloc_libblock(struct ListBase *lb, short type, const char *name);
void *copy_libblock(void *rt);
void copy_libblock_data(struct ID *id, const struct ID *id_from, const short do_action);
+void BKE_id_lib_local_paths(struct Main *bmain, struct ID *id);
void id_lib_extern(struct ID *id);
void BKE_library_filepath_set(struct Library *lib, const char *filepath);
void id_us_plus(struct ID *id);
@@ -59,6 +60,7 @@ int id_copy(struct ID *id, struct ID **newid, int test);
int id_unlink(struct ID *id, int test);
int new_id(struct ListBase *lb, struct ID *id, const char *name);
+void id_clear_lib_data(struct Main *bmain, struct ID *id);
struct ListBase *which_libbase(struct Main *mainlib, short type);
@@ -77,7 +79,7 @@ void rename_id(struct ID *id, const char *name);
void name_uiprefix_id(char *name, struct ID *id);
void test_idbutton(char *name);
void text_idbutton(struct ID *id, char *text);
-void all_local(struct Library *lib, int untagged_only);
+void BKE_library_make_local(struct Main *bmain, struct Library *lib, int untagged_only);
struct ID *find_id(const char *type, const char *name);
void clear_id_newpoins(void);
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index e902fb3f89a..1b98dd914aa 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -23,11 +23,6 @@
#
# ***** END GPL LICENSE BLOCK *****
-if(WITH_CODEC_FFMPEG)
- # FFMPEG gives warnigns which are hard to avoid across multiple versions.
- remove_strict_flags()
-endif()
-
set(INC
.
../avi
@@ -304,6 +299,10 @@ if(WITH_CODEC_FFMPEG)
${FFMPEG_INCLUDE_DIRS}
)
add_definitions(-DWITH_FFMPEG)
+
+ remove_strict_flags_file(
+ intern/writeffmpeg.c
+ )
endif()
if(WITH_PYTHON)
@@ -324,8 +323,8 @@ if(WITH_OPENMP)
add_definitions(-DPARALLEL=1)
endif()
-if(NOT WITH_MOD_FLUID)
- add_definitions(-DDISABLE_ELBEEM)
+if(WITH_MOD_FLUID)
+ add_definitions(-DWITH_MOD_FLUID)
endif()
if(WITH_MOD_SMOKE)
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index 512eec4021f..ebb09352a55 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -79,8 +79,8 @@ if env['OURPLATFORM'] == 'darwin':
if env['WITH_BF_OPENMP']:
defs.append('PARALLEL=1')
-if env['BF_NO_ELBEEM']:
- defs.append('DISABLE_ELBEEM')
+if env['WITH_BF_FLUID']:
+ defs.append('WITH_MOD_FLUID')
if env['WITH_BF_LZO']:
incs += ' #/extern/lzo/minilzo'
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index e46e2df8353..944f7c6a0b6 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -43,6 +43,7 @@
#include "DNA_object_types.h"
#include "BLI_blenlib.h"
+#include "BLI_bpath.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
@@ -94,8 +95,8 @@ typedef struct tMakeLocalActionContext {
bAction *act; /* original action */
bAction *actn; /* new action */
- int lib; /* some action users were libraries */
- int local; /* some action users were not libraries */
+ int is_lib; /* some action users were libraries */
+ int is_local; /* some action users were not libraries */
} tMakeLocalActionContext;
/* helper function for make_local_action() - local/lib init step */
@@ -104,10 +105,8 @@ static void make_localact_init_cb(ID *id, AnimData *adt, void *mlac_ptr)
tMakeLocalActionContext *mlac = (tMakeLocalActionContext *)mlac_ptr;
if (adt->action == mlac->act) {
- if (id->lib)
- mlac->lib = 1;
- else
- mlac->local = 1;
+ if (id->lib) mlac->is_lib= TRUE;
+ else mlac->is_local= TRUE;
}
}
@@ -129,7 +128,7 @@ static void make_localact_apply_cb(ID *id, AnimData *adt, void *mlac_ptr)
// does copy_fcurve...
void make_local_action(bAction *act)
{
- tMakeLocalActionContext mlac = {act, NULL, 0, 0};
+ tMakeLocalActionContext mlac = {act, NULL, FALSE, FALSE};
Main *bmain= G.main;
if (act->id.lib==NULL)
@@ -137,24 +136,21 @@ void make_local_action(bAction *act)
// XXX: double-check this; it used to be just single-user check, but that was when fake-users were still default
if ((act->id.flag & LIB_FAKEUSER) && (act->id.us<=1)) {
- act->id.lib= NULL;
- act->id.flag= LIB_LOCAL;
- new_id(&bmain->action, (ID *)act, NULL);
+ id_clear_lib_data(bmain, &act->id);
return;
}
BKE_animdata_main_cb(bmain, make_localact_init_cb, &mlac);
- if (mlac.local && mlac.lib==0) {
- act->id.lib= NULL;
- act->id.flag= LIB_LOCAL;
- //make_local_action_channels(act);
- new_id(&bmain->action, (ID *)act, NULL);
+ if (mlac.is_local && mlac.is_lib==FALSE) {
+ id_clear_lib_data(bmain, &act->id);
}
- else if (mlac.local && mlac.lib) {
+ else if (mlac.is_local && mlac.is_lib) {
mlac.actn= copy_action(act);
mlac.actn->id.us= 0;
-
+
+ BKE_id_lib_local_paths(bmain, &mlac.actn->id);
+
BKE_animdata_main_cb(bmain, make_localact_apply_cb, &mlac);
}
}
@@ -648,12 +644,12 @@ static void copy_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *chan
{
bConstraint *pcon, *con;
- VECCOPY(pchan->loc, chan->loc);
- VECCOPY(pchan->size, chan->size);
- VECCOPY(pchan->eul, chan->eul);
- VECCOPY(pchan->rotAxis, chan->rotAxis);
+ copy_v3_v3(pchan->loc, chan->loc);
+ copy_v3_v3(pchan->size, chan->size);
+ copy_v3_v3(pchan->eul, chan->eul);
+ copy_v3_v3(pchan->rotAxis, chan->rotAxis);
pchan->rotAngle= chan->rotAngle;
- QUATCOPY(pchan->quat, chan->quat);
+ copy_qt_qt(pchan->quat, chan->quat);
pchan->rotmode= chan->rotmode;
copy_m4_m4(pchan->chan_mat, (float(*)[4])chan->chan_mat);
copy_m4_m4(pchan->pose_mat, (float(*)[4])chan->pose_mat);
@@ -682,9 +678,9 @@ void duplicate_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *pchan_
/* ik (dof) settings */
pchan->ikflag = pchan_from->ikflag;
- VECCOPY(pchan->limitmin, pchan_from->limitmin);
- VECCOPY(pchan->limitmax, pchan_from->limitmax);
- VECCOPY(pchan->stiffness, pchan_from->stiffness);
+ copy_v3_v3(pchan->limitmin, pchan_from->limitmin);
+ copy_v3_v3(pchan->limitmax, pchan_from->limitmax);
+ copy_v3_v3(pchan->stiffness, pchan_from->stiffness);
pchan->ikstretch= pchan_from->ikstretch;
pchan->ikrotweight= pchan_from->ikrotweight;
pchan->iklinweight= pchan_from->iklinweight;
@@ -1119,13 +1115,13 @@ void copy_pose_result(bPose *to, bPose *from)
copy_m4_m4(pchanto->chan_mat, pchanfrom->chan_mat);
/* used for local constraints */
- VECCOPY(pchanto->loc, pchanfrom->loc);
- QUATCOPY(pchanto->quat, pchanfrom->quat);
- VECCOPY(pchanto->eul, pchanfrom->eul);
- VECCOPY(pchanto->size, pchanfrom->size);
+ copy_v3_v3(pchanto->loc, pchanfrom->loc);
+ copy_qt_qt(pchanto->quat, pchanfrom->quat);
+ copy_v3_v3(pchanto->eul, pchanfrom->eul);
+ copy_v3_v3(pchanto->size, pchanfrom->size);
- VECCOPY(pchanto->pose_head, pchanfrom->pose_head);
- VECCOPY(pchanto->pose_tail, pchanfrom->pose_tail);
+ copy_v3_v3(pchanto->pose_head, pchanfrom->pose_head);
+ copy_v3_v3(pchanto->pose_tail, pchanfrom->pose_tail);
pchanto->rotmode= pchanfrom->rotmode;
pchanto->flag= pchanfrom->flag;
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 716f3ed2726..2ef13318af4 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -363,10 +363,10 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets)
if (mpt->pchan) {
/* heads or tails */
if (mpath->flag & MOTIONPATH_FLAG_BHEAD) {
- VECCOPY(mpv->co, mpt->pchan->pose_head);
+ copy_v3_v3(mpv->co, mpt->pchan->pose_head);
}
else {
- VECCOPY(mpv->co, mpt->pchan->pose_tail);
+ copy_v3_v3(mpv->co, mpt->pchan->pose_tail);
}
/* result must be in worldspace */
@@ -374,7 +374,7 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets)
}
else {
/* worldspace object location */
- VECCOPY(mpv->co, mpt->ob->obmat[3]);
+ copy_v3_v3(mpv->co, mpt->ob->obmat[3]);
}
}
}
@@ -654,15 +654,15 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir, float *quat,
totfac= data[0]+data[3];
if(totfac>FLT_EPSILON) interp_qt_qtqt(q1, p0->quat, p3->quat, data[3] / totfac);
- else QUATCOPY(q1, p1->quat);
+ else copy_qt_qt(q1, p1->quat);
totfac= data[1]+data[2];
if(totfac>FLT_EPSILON) interp_qt_qtqt(q2, p1->quat, p2->quat, data[2] / totfac);
- else QUATCOPY(q2, p3->quat);
+ else copy_qt_qt(q2, p3->quat);
totfac = data[0]+data[1]+data[2]+data[3];
if(totfac>FLT_EPSILON) interp_qt_qtqt(quat, q1, q2, (data[1]+data[2]) / totfac);
- else QUATCOPY(quat, q2);
+ else copy_qt_qt(quat, q2);
}
if(radius)
@@ -842,7 +842,7 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n
add_v3_v3(vec, vdd->obmat[3]);
copy_m4_m4(obmat, vdd->obmat);
- VECCOPY(obmat[3], vec);
+ copy_v3_v3(obmat[3], vec);
if(vdd->par->transflag & OB_DUPLIROT) {
if(no_f) {
@@ -867,7 +867,7 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n
vdd->ob->lay = origlay;
if(vdd->orco)
- VECCOPY(dob->orco, vdd->orco[index]);
+ copy_v3_v3(dob->orco, vdd->orco[index]);
if(vdd->ob->transflag & OB_DUPLI) {
float tmpmat[4][4];
@@ -1119,7 +1119,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
copy_m4_m4(obmat, ob__obmat);
- VECCOPY(obmat[3], cent);
+ copy_v3_v3(obmat[3], cent);
/* rotation */
tri_to_quat( quat,v1, v2, v3);
@@ -1378,7 +1378,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
psys_get_dupli_path_transform(&sim, NULL, cpa, cache, pamat, &scale);
}
- VECCOPY(pamat[3], cache->co);
+ copy_v3_v3(pamat[3], cache->co);
pamat[3][3]= 1.0f;
}
@@ -1426,7 +1426,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
/* to give ipos in object correct offset */
where_is_object_time(scene, ob, ctime-pa_time);
- VECCOPY(vec, obmat[3]);
+ copy_v3_v3(vec, obmat[3]);
obmat[3][0] = obmat[3][1] = obmat[3][2] = 0.0f;
/* particle rotation uses x-axis as the aligned axis, so pre-rotate the object accordingly */
@@ -1546,7 +1546,7 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, i
mul_m4_v3(pmat, vec);
copy_m4_m4(obmat, par->obmat);
- VECCOPY(obmat[3], vec);
+ copy_v3_v3(obmat[3], vec);
new_dupli_object(lb, ob, obmat, par->lay, a, OB_DUPLIVERTS, animated);
}
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 1149d8eee25..e9a19b50a81 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -37,6 +37,7 @@
#include "MEM_guardedalloc.h"
+#include "BLI_bpath.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
@@ -136,33 +137,32 @@ void free_armature(bArmature *arm)
void make_local_armature(bArmature *arm)
{
Main *bmain= G.main;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
Object *ob;
if (arm->id.lib==NULL) return;
if (arm->id.us==1) {
- arm->id.lib= NULL;
- arm->id.flag= LIB_LOCAL;
- new_id(&bmain->armature, (ID*)arm, NULL);
+ id_clear_lib_data(bmain, &arm->id);
return;
}
- for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+ for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
if(ob->data == arm) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- arm->id.lib= NULL;
- arm->id.flag= LIB_LOCAL;
- new_id(&bmain->armature, (ID *)arm, NULL);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &arm->id);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
bArmature *armn= copy_armature(arm);
armn->id.us= 0;
-
+
+ /* Remap paths of new ID using old library as base. */
+ BKE_id_lib_local_paths(bmain, &armn->id);
+
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data == arm) {
if(ob->id.lib==NULL) {
@@ -389,11 +389,11 @@ static void equalize_bezier(float *data, int desired)
pdist[0]= 0.0f;
for(a=0, fp= data; a<MAX_BBONE_SUBDIV; a++, fp+=4) {
- QUATCOPY(temp[a], fp);
+ copy_qt_qt(temp[a], fp);
pdist[a+1]= pdist[a]+len_v3v3(fp, fp+4);
}
/* do last point */
- QUATCOPY(temp[a], fp);
+ copy_qt_qt(temp[a], fp);
totdist= pdist[a];
/* go over distances and calculate new points */
@@ -419,7 +419,7 @@ static void equalize_bezier(float *data, int desired)
fp[3]= fac1*temp[nr-1][3]+ fac2*temp[nr][3];
}
/* set last point, needed for orientation calculus */
- QUATCOPY(fp, temp[MAX_BBONE_SUBDIV]);
+ copy_qt_qt(fp, temp[MAX_BBONE_SUBDIV]);
}
/* returns pointer to static array, filled with desired amount of bone->segments elements */
@@ -487,9 +487,9 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
/* transform previous point inside this bone space */
if(rest)
- VECCOPY(h1, prev->bone->arm_head)
+ copy_v3_v3(h1, prev->bone->arm_head);
else
- VECCOPY(h1, prev->pose_head)
+ copy_v3_v3(h1, prev->pose_head);
mul_m4_v3(imat, h1);
if(prev->bone->segments>1) {
@@ -526,9 +526,9 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
/* transform next point inside this bone space */
if(rest)
- VECCOPY(h2, next->bone->arm_tail)
+ copy_v3_v3(h2, next->bone->arm_tail);
else
- VECCOPY(h2, next->pose_tail)
+ copy_v3_v3(h2, next->pose_tail);
mul_m4_v3(imat, h2);
/* if next bone is B-bone too, use average handle direction */
if(next->bone->segments>1);
@@ -574,7 +574,7 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
vec_roll_to_mat3(h1, fp[3], mat3); // fp[3] is roll
copy_m4_m3(result_array[a].mat, mat3);
- VECCOPY(result_array[a].mat[3], fp);
+ copy_v3_v3(result_array[a].mat[3], fp);
if(doscale) {
/* correct for scaling when this matrix is used in scaled space */
@@ -736,7 +736,7 @@ static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, f
if(bone==NULL) return 0.0f;
- VECCOPY (cop, co);
+ copy_v3_v3(cop, co);
fac= distfactor_to_bone(cop, bone->arm_head, bone->arm_tail, bone->rad_head, bone->rad_tail, bone->dist);
@@ -781,7 +781,7 @@ static void pchan_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, f
if (!weight)
return;
- VECCOPY(cop, co);
+ copy_v3_v3(cop, co);
if(vec) {
if(pchan->bone->segments>1)
@@ -1018,7 +1018,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
normalize_dq(dq, contrib);
if(armature_weight != 1.0f) {
- VECCOPY(dco, co);
+ copy_v3_v3(dco, co);
mul_v3m3_dq( dco, (defMats)? summat: NULL,dq);
sub_v3_v3(dco, co);
mul_v3_fl(dco, armature_weight);
@@ -1114,11 +1114,11 @@ void armature_loc_world_to_pose(Object *ob, float *inloc, float *outloc)
float nLocMat[4][4];
/* build matrix for location */
- VECCOPY(xLocMat[3], inloc);
+ copy_v3_v3(xLocMat[3], inloc);
/* get bone-space cursor matrix and extract location */
armature_mat_world_to_pose(ob, xLocMat, nLocMat);
- VECCOPY(outloc, nLocMat[3]);
+ copy_v3_v3(outloc, nLocMat[3]);
}
/* Convert Pose-Space Matrix to Bone-Space Matrix
@@ -1193,11 +1193,11 @@ void armature_loc_pose_to_bone(bPoseChannel *pchan, float *inloc, float *outloc)
float nLocMat[4][4];
/* build matrix for location */
- VECCOPY(xLocMat[3], inloc);
+ copy_v3_v3(xLocMat[3], inloc);
/* get bone-space cursor matrix and extract location */
armature_mat_pose_to_bone(pchan, xLocMat, nLocMat);
- VECCOPY(outloc, nLocMat[3]);
+ copy_v3_v3(outloc, nLocMat[3]);
}
/* same as object_mat3_to_rot() */
@@ -1402,7 +1402,7 @@ void where_is_armature_bone(Bone *bone, Bone *prevbone)
copy_m4_m3(offs_bone, bone->bone_mat);
/* The bone's root offset (is in the parent's coordinate system) */
- VECCOPY(offs_bone[3], bone->head);
+ copy_v3_v3(offs_bone[3], bone->head);
/* Get the length translation of parent (length along y axis) */
offs_bone[3][1]+= prevbone->length;
@@ -1412,7 +1412,7 @@ void where_is_armature_bone(Bone *bone, Bone *prevbone)
}
else {
copy_m4_m3(bone->arm_mat, bone->bone_mat);
- VECCOPY(bone->arm_mat[3], bone->head);
+ copy_v3_v3(bone->arm_mat[3], bone->head);
}
/* and the kiddies */
@@ -1848,8 +1848,8 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
/* firstly, calculate the bone matrix the standard way, since this is needed for roll control */
where_is_pose_bone(scene, ob, pchan, ctime, 1);
- VECCOPY(poseHead, pchan->pose_head);
- VECCOPY(poseTail, pchan->pose_tail);
+ copy_v3_v3(poseHead, pchan->pose_head);
+ copy_v3_v3(poseTail, pchan->pose_tail);
/* step 1: determine the positions for the endpoints of the bone */
{
@@ -1893,7 +1893,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
/* store the position, and convert it to pose space */
mul_m4_v3(ob->imat, vec);
- VECCOPY(poseHead, vec);
+ copy_v3_v3(poseHead, vec);
/* set the new radius (it should be the average value) */
radius = (radius+rad) / 2;
@@ -1917,9 +1917,9 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
/* compute the raw rotation matrix from the bone's current matrix by extracting only the
* orientation-relevant axes, and normalising them
*/
- VECCOPY(rmat[0], pchan->pose_mat[0]);
- VECCOPY(rmat[1], pchan->pose_mat[1]);
- VECCOPY(rmat[2], pchan->pose_mat[2]);
+ copy_v3_v3(rmat[0], pchan->pose_mat[0]);
+ copy_v3_v3(rmat[1], pchan->pose_mat[1]);
+ copy_v3_v3(rmat[2], pchan->pose_mat[2]);
normalize_m3(rmat);
/* also, normalise the orientation imposed by the bone, now that we've extracted the scale factor */
@@ -2010,7 +2010,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
/* when the 'no-root' option is affected, the chain can retain
* the shape but be moved elsewhere
*/
- VECCOPY(poseHead, pchan->pose_head);
+ copy_v3_v3(poseHead, pchan->pose_head);
}
else if (tree->con->enforce < 1.0f) {
/* when the influence is too low
@@ -2018,18 +2018,18 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
* - stick to the parent for any other
*/
if (pchan->parent) {
- VECCOPY(poseHead, pchan->pose_head);
+ copy_v3_v3(poseHead, pchan->pose_head);
}
else {
// FIXME: this introduces popping artifacts when we reach 0.0
interp_v3_v3v3(poseHead, pchan->pose_head, poseHead, tree->con->enforce);
}
}
- VECCOPY(poseMat[3], poseHead);
+ copy_v3_v3(poseMat[3], poseHead);
/* finally, store the new transform */
copy_m4_m4(pchan->pose_mat, poseMat);
- VECCOPY(pchan->pose_head, poseHead);
+ copy_v3_v3(pchan->pose_head, poseHead);
/* recalculate tail, as it's now outdated after the head gets adjusted above! */
where_is_pose_bone_tail(pchan);
@@ -2108,7 +2108,7 @@ void pchan_to_mat4(bPoseChannel *pchan, float chan_mat[4][4])
/* prevent action channels breaking chains */
/* need to check for bone here, CONSTRAINT_TYPE_ACTION uses this call */
if ((pchan->bone==NULL) || !(pchan->bone->flag & BONE_CONNECTED)) {
- VECCOPY(chan_mat[3], pchan->loc);
+ copy_v3_v3(chan_mat[3], pchan->loc);
}
}
@@ -2194,11 +2194,11 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha
ofs = amod->turbul / 200.0f;
/* make a copy of starting conditions */
- VECCOPY(loc, pchan->pose_mat[3]);
+ copy_v3_v3(loc, pchan->pose_mat[3]);
mat4_to_eul( eul,pchan->pose_mat);
mat4_to_size( size,pchan->pose_mat);
- VECCOPY(eulo, eul);
- VECCOPY(sizeo, size);
+ copy_v3_v3(eulo, eul);
+ copy_v3_v3(sizeo, size);
/* apply noise to each set of channels */
if (amod->channels & 4) {
@@ -2249,7 +2249,7 @@ void where_is_pose_bone_tail(bPoseChannel *pchan)
{
float vec[3];
- VECCOPY(vec, pchan->pose_mat[1]);
+ copy_v3_v3(vec, pchan->pose_mat[1]);
mul_v3_fl(vec, pchan->bone->length);
add_v3_v3v3(pchan->pose_tail, pchan->pose_head, vec);
}
@@ -2283,7 +2283,7 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti
copy_m4_m3(offs_bone, bone->bone_mat);
/* The bone's root offset (is in the parent's coordinate system) */
- VECCOPY(offs_bone[3], bone->head);
+ copy_v3_v3(offs_bone[3], bone->head);
/* Get the length translation of parent (length along y axis) */
offs_bone[3][1]+= parbone->length;
@@ -2361,7 +2361,7 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti
bConstraintOb *cob;
/* make a copy of location of PoseChannel for later */
- VECCOPY(vec, pchan->pose_mat[3]);
+ copy_v3_v3(vec, pchan->pose_mat[3]);
/* prepare PoseChannel for Constraint solving
* - makes a copy of matrix, and creates temporary struct to use
@@ -2378,13 +2378,13 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti
/* prevent constraints breaking a chain */
if(pchan->bone->flag & BONE_CONNECTED) {
- VECCOPY(pchan->pose_mat[3], vec);
+ copy_v3_v3(pchan->pose_mat[3], vec);
}
}
}
/* calculate head */
- VECCOPY(pchan->pose_head, pchan->pose_mat[3]);
+ copy_v3_v3(pchan->pose_head, pchan->pose_mat[3]);
/* calculate tail */
where_is_pose_bone_tail(pchan);
}
@@ -2415,8 +2415,8 @@ void where_is_pose (Scene *scene, Object *ob)
bone= pchan->bone;
if(bone) {
copy_m4_m4(pchan->pose_mat, bone->arm_mat);
- VECCOPY(pchan->pose_head, bone->arm_head);
- VECCOPY(pchan->pose_tail, bone->arm_tail);
+ copy_v3_v3(pchan->pose_head, bone->arm_head);
+ copy_v3_v3(pchan->pose_tail, bone->arm_tail);
}
}
}
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 4cbdbeb890d..d68b0b361d1 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -160,22 +160,19 @@ static void clear_global(void)
G.main= NULL;
}
+static int clean_paths_visit_cb(void *UNUSED(userdata), char *path_dst, const char *path_src)
+{
+ strcpy(path_dst, path_src);
+ BLI_clean(path_dst);
+ return (strcmp(path_dst, path_src) == 0) ? FALSE : TRUE;
+}
+
/* make sure path names are correct for OS */
static void clean_paths(Main *main)
{
- struct BPathIterator *bpi;
- char filepath_expanded[1024];
Scene *scene;
- for(BLI_bpathIterator_init(&bpi, main, main->name, BPATH_USE_PACKED); !BLI_bpathIterator_isDone(bpi); BLI_bpathIterator_step(bpi)) {
- BLI_bpathIterator_getPath(bpi, filepath_expanded);
-
- BLI_clean(filepath_expanded);
-
- BLI_bpathIterator_setPath(bpi, filepath_expanded);
- }
-
- BLI_bpathIterator_free(bpi);
+ bpath_traverse_main(main, clean_paths_visit_cb, BPATH_TRAVERSE_SKIP_MULTIFILE, NULL);
for(scene= main->scene.first; scene; scene= scene->id.next) {
BLI_clean(scene->r.pic);
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index b5cdbc58807..e78b89441c9 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -45,6 +45,7 @@
#include "RNA_access.h"
+#include "BLI_bpath.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_rand.h"
@@ -181,6 +182,7 @@ void free_brush(Brush *brush)
static void extern_local_brush(Brush *brush)
{
id_lib_extern((ID *)brush->mtex.tex);
+ id_lib_extern((ID *)brush->clone.image);
}
void make_local_brush(Brush *brush)
@@ -193,29 +195,26 @@ void make_local_brush(Brush *brush)
Main *bmain= G.main;
Scene *scene;
- int local= 0, lib= 0;
+ int is_local= FALSE, is_lib= FALSE;
if(brush->id.lib==NULL) return;
if(brush->clone.image) {
- /* special case: ima always local immediately */
- brush->clone.image->id.lib= NULL;
- brush->clone.image->id.flag= LIB_LOCAL;
- new_id(&bmain->brush, (ID *)brush->clone.image, NULL);
+ /* special case: ima always local immediately. Clone image should only
+ have one user anyway. */
+ id_clear_lib_data(bmain, &brush->clone.image->id);
extern_local_brush(brush);
}
- for(scene= bmain->scene.first; scene && ELEM(0, lib, local); scene=scene->id.next) {
+ for(scene= bmain->scene.first; scene && ELEM(0, is_lib, is_local); scene=scene->id.next) {
if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
- if(scene->id.lib) lib= 1;
- else local= 1;
+ if(scene->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- brush->id.lib= NULL;
- brush->id.flag= LIB_LOCAL;
- new_id(&bmain->brush, (ID *)brush, NULL);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &brush->id);
extern_local_brush(brush);
/* enable fake user by default */
@@ -224,10 +223,13 @@ void make_local_brush(Brush *brush)
brush->id.us++;
}
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
Brush *brushn= copy_brush(brush);
brushn->id.us= 1; /* only keep fake user */
brushn->id.flag |= LIB_FAKEUSER;
+
+ /* Remap paths of new ID using old library as base. */
+ BKE_id_lib_local_paths(bmain, &brush->id);
for(scene= bmain->scene.first; scene; scene=scene->id.next) {
if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index c244c26ad7f..aebf3198cf4 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -703,7 +703,7 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *UNUSED(cob), bC
ct->type = CONSTRAINT_OBTYPE_BONE; \
ct->rotOrder= (pchan) ? (pchan->rotmode) : EULER_ORDER_DEFAULT; \
}\
- else if (ELEM(ct->tar->type, OB_MESH, OB_LATTICE) && (ct->subtarget[0])) { \
+ else if (OB_TYPE_SUPPORT_VGROUP(ct->tar->type) && (ct->subtarget[0])) { \
ct->type = CONSTRAINT_OBTYPE_VERT; \
ct->rotOrder = EULER_ORDER_DEFAULT; \
} \
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index b6fb776d801..5d2180fe702 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -36,6 +36,7 @@
#include "MEM_guardedalloc.h"
+#include "BLI_bpath.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -245,7 +246,7 @@ void make_local_curve(Curve *cu)
{
Main *bmain= G.main;
Object *ob;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
/* - when there are only lib users: don't do
* - when there are only local users: set flag
@@ -255,32 +256,28 @@ void make_local_curve(Curve *cu)
if(cu->id.lib==NULL) return;
if(cu->id.us==1) {
- cu->id.lib= NULL;
- cu->id.flag= LIB_LOCAL;
-
- new_id(&bmain->curve, (ID *)cu, NULL);
+ id_clear_lib_data(bmain, &cu->id);
extern_local_curve(cu);
return;
}
- for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+ for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
if(ob->data == cu) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- cu->id.lib= NULL;
- cu->id.flag= LIB_LOCAL;
-
- new_id(&bmain->curve, (ID *)cu, NULL);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &cu->id);
extern_local_curve(cu);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
Curve *cun= copy_curve(cu);
cun->id.us= 0;
+ BKE_id_lib_local_paths(bmain, &cun->id);
+
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data==cu) {
if(ob->id.lib==NULL) {
@@ -1229,7 +1226,7 @@ float *make_orco_curve(Scene *scene, Object *ob)
fp[1]= 0.0;
fp[2]= 0.0;
} else {
- VECCOPY(fp, &dl->verts[u*3]);
+ copy_v3_v3(fp, &dl->verts[u*3]);
fp[0]= (fp[0]-cu->loc[0])/cu->size[0];
fp[1]= (fp[1]-cu->loc[1])/cu->size[1];
@@ -1258,7 +1255,7 @@ float *make_orco_curve(Scene *scene, Object *ob)
int realu= u % dl->parts;
vert= dl->verts + 3*(dl->nr*realu + realv);
- VECCOPY(fp, vert);
+ copy_v3_v3(fp, vert);
fp[0]= (fp[0]-cu->loc[0])/cu->size[0];
fp[1]= (fp[1]-cu->loc[1])/cu->size[1];
@@ -1519,7 +1516,7 @@ static short bevelinside(BevList *bl1,BevList *bl2)
hvec1[0]= bevp->vec[0];
hvec1[1]= bevp->vec[1];
hvec1[2]= 0.0;
- VECCOPY(hvec2,hvec1);
+ copy_v3_v3(hvec2,hvec1);
hvec2[0]+=1000;
/* test it with all edges of potential surounding poly */
@@ -1690,15 +1687,15 @@ static void bevel_list_cyclic_fix_3D(BevList *bl)
bevp= (BevPoint *)(bl+1);
bevp1= bevp+1;
- QUATCOPY(bevp->quat, bevp1->quat);
- VECCOPY(bevp->dir, bevp1->dir);
- VECCOPY(bevp->tan, bevp1->tan);
+ copy_qt_qt(bevp->quat, bevp1->quat);
+ copy_v3_v3(bevp->dir, bevp1->dir);
+ copy_v3_v3(bevp->tan, bevp1->tan);
bevp= (BevPoint *)(bl+1);
bevp+= (bl->nr-1);
bevp1= bevp-1;
- QUATCOPY(bevp->quat, bevp1->quat);
- VECCOPY(bevp->dir, bevp1->dir);
- VECCOPY(bevp->tan, bevp1->tan);
+ copy_qt_qt(bevp->quat, bevp1->quat);
+ copy_v3_v3(bevp->dir, bevp1->dir);
+ copy_v3_v3(bevp->tan, bevp1->tan);
}
/* utility for make_bevel_list_3D_* funcs */
static void bevel_list_calc_bisect(BevList *bl)
@@ -1791,7 +1788,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter)
}
- QUATCOPY(bevp0_quat, bevp0->quat);
+ copy_qt_qt(bevp0_quat, bevp0->quat);
while(nr--) {
/* interpolate quats */
@@ -1804,7 +1801,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter)
axis_angle_to_quat(q2, cross, angle_normalized_v3v3(zaxis, bevp1->dir));
normalize_qt(q2);
- QUATCOPY(bevp0_quat, bevp1->quat);
+ copy_qt_qt(bevp0_quat, bevp1->quat);
mul_qt_qtqt(q, q2, q);
interp_qt_qtqt(bevp1->quat, bevp1->quat, q, 0.5);
normalize_qt(bevp1->quat);
@@ -1866,7 +1863,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
mul_qt_qtqt(bevp1->quat, q, bevp0->quat);
}
else {
- QUATCOPY(bevp1->quat, bevp0->quat);
+ copy_qt_qt(bevp1->quat, bevp0->quat);
}
}
@@ -1975,7 +1972,7 @@ static void make_bevel_list_3D_tangent(BevList *bl)
bevp1= bevp2+(bl->nr-1);
bevp0= bevp1-1;
- VECCOPY(bevp0_tan, bevp0->tan);
+ copy_v3_v3(bevp0_tan, bevp0->tan);
nr= bl->nr;
while(nr--) {
@@ -2035,8 +2032,8 @@ static void make_bevel_list_segment_3D(BevList *bl)
axis_angle_to_quat(q, bevp1->dir, bevp1->alfa);
mul_qt_qtqt(bevp1->quat, q, bevp1->quat);
normalize_qt(bevp1->quat);
- VECCOPY(bevp2->dir, bevp1->dir);
- QUATCOPY(bevp2->quat, bevp1->quat);
+ copy_v3_v3(bevp2->dir, bevp1->dir);
+ copy_qt_qt(bevp2->quat, bevp1->quat);
}
@@ -2106,7 +2103,7 @@ void makeBevelList(Object *ob)
bp= nu->bp;
while(len--) {
- VECCOPY(bevp->vec, bp->vec);
+ copy_v3_v3(bevp->vec, bp->vec);
bevp->alfa= bp->alfa;
bevp->radius= bp->radius;
bevp->weight= bp->weight;
@@ -2139,7 +2136,7 @@ void makeBevelList(Object *ob)
while(a--) {
if(prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) {
- VECCOPY(bevp->vec, prevbezt->vec[1]);
+ copy_v3_v3(bevp->vec, prevbezt->vec[1]);
bevp->alfa= prevbezt->alfa;
bevp->radius= prevbezt->radius;
bevp->weight= prevbezt->weight;
@@ -2191,7 +2188,7 @@ void makeBevelList(Object *ob)
}
if((nu->flagu & CU_NURB_CYCLIC)==0) { /* not cyclic: endpoint */
- VECCOPY(bevp->vec, prevbezt->vec[1]);
+ copy_v3_v3(bevp->vec, prevbezt->vec[1]);
bevp->alfa= prevbezt->alfa;
bevp->radius= prevbezt->radius;
bevp->weight= prevbezt->weight;
@@ -3011,15 +3008,15 @@ float (*curve_getVertexCos(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3]
BezTriple *bezt = nu->bezt;
for (i=0; i<nu->pntsu; i++,bezt++) {
- VECCOPY(co, bezt->vec[0]); co+=3;
- VECCOPY(co, bezt->vec[1]); co+=3;
- VECCOPY(co, bezt->vec[2]); co+=3;
+ copy_v3_v3(co, bezt->vec[0]); co+=3;
+ copy_v3_v3(co, bezt->vec[1]); co+=3;
+ copy_v3_v3(co, bezt->vec[2]); co+=3;
}
} else {
BPoint *bp = nu->bp;
for (i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
- VECCOPY(co, bp->vec); co+=3;
+ copy_v3_v3(co, bp->vec); co+=3;
}
}
}
@@ -3038,15 +3035,15 @@ void curve_applyVertexCos(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3]
BezTriple *bezt = nu->bezt;
for (i=0; i<nu->pntsu; i++,bezt++) {
- VECCOPY(bezt->vec[0], co); co+=3;
- VECCOPY(bezt->vec[1], co); co+=3;
- VECCOPY(bezt->vec[2], co); co+=3;
+ copy_v3_v3(bezt->vec[0], co); co+=3;
+ copy_v3_v3(bezt->vec[1], co); co+=3;
+ copy_v3_v3(bezt->vec[2], co); co+=3;
}
} else {
BPoint *bp = nu->bp;
for (i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
- VECCOPY(bp->vec, co); co+=3;
+ copy_v3_v3(bp->vec, co); co+=3;
}
}
}
@@ -3064,9 +3061,9 @@ float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3]
BezTriple *bezt = nu->bezt;
for (i=0; i<nu->pntsu; i++,bezt++) {
- VECCOPY(co, key); co+=3; key+=3;
- VECCOPY(co, key); co+=3; key+=3;
- VECCOPY(co, key); co+=3; key+=3;
+ copy_v3_v3(co, key); co+=3; key+=3;
+ copy_v3_v3(co, key); co+=3; key+=3;
+ copy_v3_v3(co, key); co+=3; key+=3;
key+=3; /* skip tilt */
}
}
@@ -3074,7 +3071,7 @@ float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3]
BPoint *bp = nu->bp;
for(i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
- VECCOPY(co, key); co+=3; key+=3;
+ copy_v3_v3(co, key); co+=3; key+=3;
key++; /* skip tilt */
}
}
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 0f6828cc358..0c3c78f6eef 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -42,6 +42,7 @@
#include "BKE_deform.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
void defgroup_copy_list (ListBase *outbase, ListBase *inbase)
@@ -103,8 +104,8 @@ void defvert_sync (MDeformVert *dvert_r, const MDeformVert *dvert, int use_verif
MDeformWeight *dw;
for(i=0, dw=dvert->dw; i < dvert->totweight; i++, dw++) {
MDeformWeight *dw_r;
- if(use_verify) dw_r= defvert_find_index(dvert_r, dw->def_nr);
- else dw_r= defvert_verify_index(dvert_r, dw->def_nr);
+ if(use_verify) dw_r= defvert_verify_index(dvert_r, dw->def_nr);
+ else dw_r= defvert_find_index(dvert_r, dw->def_nr);
if(dw_r) {
dw_r->weight= dw->weight;
@@ -114,18 +115,20 @@ void defvert_sync (MDeformVert *dvert_r, const MDeformVert *dvert, int use_verif
}
/* be sure all flip_map values are valid */
-void defvert_sync_mapped (MDeformVert *dvert_r, const MDeformVert *dvert, const int *flip_map, int use_verify)
+void defvert_sync_mapped (MDeformVert *dvert_r, const MDeformVert *dvert, const int *flip_map, const int flip_map_len, const int use_verify)
{
- if(dvert->totweight && dvert_r->totweight) {
+ if (dvert->totweight && dvert_r->totweight) {
int i;
MDeformWeight *dw;
- for(i=0, dw=dvert->dw; i < dvert->totweight; i++, dw++) {
- MDeformWeight *dw_r;
- if(use_verify) dw_r= defvert_find_index(dvert_r, flip_map[dw->def_nr]);
- else dw_r= defvert_verify_index(dvert_r, flip_map[dw->def_nr]);
-
- if(dw_r) {
- dw_r->weight= dw->weight;
+ for (i=0, dw=dvert->dw; i < dvert->totweight; i++, dw++) {
+ if (dw->def_nr < flip_map_len) {
+ MDeformWeight *dw_r;
+ if(use_verify) dw_r= defvert_verify_index(dvert_r, flip_map[dw->def_nr]);
+ else dw_r= defvert_find_index(dvert_r, flip_map[dw->def_nr]);
+
+ if(dw_r) {
+ dw_r->weight= dw->weight;
+ }
}
}
}
@@ -163,14 +166,16 @@ void defvert_normalize (MDeformVert *dvert)
}
}
-void defvert_flip (MDeformVert *dvert, const int *flip_map)
+void defvert_flip (MDeformVert *dvert, const int *flip_map, const int flip_map_len)
{
MDeformWeight *dw;
int i;
- for(dw= dvert->dw, i=0; i<dvert->totweight; dw++, i++)
- if(flip_map[dw->def_nr] >= 0)
+ for(dw= dvert->dw, i=0; i<dvert->totweight; dw++, i++) {
+ if((dw->def_nr < flip_map_len) && (flip_map[dw->def_nr] >= 0)) {
dw->def_nr= flip_map[dw->def_nr];
+ }
+ }
}
@@ -250,19 +255,21 @@ int defgroup_find_index (Object *ob, bDeformGroup *dg)
}
/* note, must be freed */
-int *defgroup_flip_map(Object *ob, int use_default)
+int *defgroup_flip_map(Object *ob, int *flip_map_len, int use_default)
{
- bDeformGroup *dg;
- int totdg= BLI_countlist(&ob->defbase);
+ int totdg= *flip_map_len= BLI_countlist(&ob->defbase);
if(totdg==0) {
return NULL;
}
else {
+ bDeformGroup *dg;
char name[sizeof(dg->name)];
- int i, flip_num, *map= MEM_mallocN(totdg * sizeof(int), "get_defgroup_flip_map");
+ int i, flip_num, *map= MEM_mallocN(totdg * sizeof(int), __func__);
- memset(map, -1, totdg * sizeof(int));
+ for (i=0; i < totdg; i++) {
+ map[i]= -1;
+ }
for (dg=ob->defbase.first, i=0; dg; dg=dg->next, i++) {
if(map[i] == -1) { /* may be calculated previously */
@@ -271,7 +278,7 @@ int *defgroup_flip_map(Object *ob, int use_default)
if(use_default)
map[i]= i;
- flip_side_name(name, dg->name, 0);
+ flip_side_name(name, dg->name, FALSE);
if(strcmp(name, dg->name)) {
flip_num= defgroup_name_index(ob, name);
if(flip_num >= 0) {
@@ -285,6 +292,40 @@ int *defgroup_flip_map(Object *ob, int use_default)
}
}
+/* note, must be freed */
+int *defgroup_flip_map_single(Object *ob, int *flip_map_len, int use_default, int defgroup)
+{
+ int totdg= *flip_map_len= BLI_countlist(&ob->defbase);
+
+ if(totdg==0) {
+ return NULL;
+ }
+ else {
+ bDeformGroup *dg;
+ char name[sizeof(dg->name)];
+ int i, flip_num, *map= MEM_mallocN(totdg * sizeof(int), __func__);
+
+ for (i=0; i < totdg; i++) {
+ if (use_default) map[i]= i;
+ else map[i]= -1;
+ }
+
+ dg= BLI_findlink(&ob->defbase, defgroup);
+
+ flip_side_name(name, dg->name, FALSE);
+ if(strcmp(name, dg->name)) {
+ flip_num= defgroup_name_index(ob, name);
+
+ if(flip_num >= 0) {
+ map[defgroup]= flip_num;
+ map[flip_num]= defgroup;
+ }
+ }
+
+ return map;
+ }
+}
+
int defgroup_flip_index(Object *ob, int index, int use_default)
{
bDeformGroup *dg= BLI_findlink(&ob->defbase, index);
@@ -482,25 +523,25 @@ MDeformWeight *defvert_verify_index(MDeformVert *dv, const int defgroup)
MDeformWeight *newdw;
/* do this check always, this function is used to check for it */
- if(!dv || defgroup<0)
+ if(!dv || defgroup < 0)
return NULL;
- newdw = defvert_find_index(dv, defgroup);
+ newdw= defvert_find_index(dv, defgroup);
if(newdw)
return newdw;
- newdw = MEM_callocN(sizeof(MDeformWeight)*(dv->totweight+1), "deformWeight");
- if(dv->dw) {
+ newdw= MEM_callocN(sizeof(MDeformWeight)*(dv->totweight+1), "deformWeight");
+ if (dv->dw) {
memcpy(newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight);
MEM_freeN(dv->dw);
}
- dv->dw=newdw;
-
- dv->dw[dv->totweight].weight=0.0f;
- dv->dw[dv->totweight].def_nr=defgroup;
+ dv->dw= newdw;
+ newdw += dv->totweight;
+ newdw->weight= 0.0f;
+ newdw->def_nr= defgroup;
/* Group index */
dv->totweight++;
- return dv->dw+(dv->totweight-1);
+ return newdw;
}
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index c4543df0d16..bb14a1ddeaf 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -91,12 +91,12 @@
#include "RE_shader_ext.h"
/* fluid sim particle import */
-#ifndef DISABLE_ELBEEM
+#ifdef WITH_MOD_FLUID
#include "DNA_object_fluidsim.h"
#include "LBM_fluidsim.h"
#include <zlib.h>
#include <string.h>
-#endif // DISABLE_ELBEEM
+#endif // WITH_MOD_FLUID
//XXX #include "BIF_screen.h"
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 3529b7b9e6d..474b3a5ce63 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1178,16 +1178,16 @@ static float dvar_eval_locDiff (ChannelDriver *driver, DriverVar *dvar)
constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_LOCAL);
/* ... and from that, we get our transform */
- VECCOPY(tmp_loc, mat[3]);
+ copy_v3_v3(tmp_loc, mat[3]);
}
else {
/* transform space (use transform values directly) */
- VECCOPY(tmp_loc, pchan->loc);
+ copy_v3_v3(tmp_loc, pchan->loc);
}
}
else {
/* convert to worldspace */
- VECCOPY(tmp_loc, pchan->pose_head);
+ copy_v3_v3(tmp_loc, pchan->pose_head);
mul_m4_v3(ob->obmat, tmp_loc);
}
}
@@ -1203,25 +1203,25 @@ static float dvar_eval_locDiff (ChannelDriver *driver, DriverVar *dvar)
constraint_mat_convertspace(ob, NULL, mat, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL);
/* ... and from that, we get our transform */
- VECCOPY(tmp_loc, mat[3]);
+ copy_v3_v3(tmp_loc, mat[3]);
}
else {
/* transform space (use transform values directly) */
- VECCOPY(tmp_loc, ob->loc);
+ copy_v3_v3(tmp_loc, ob->loc);
}
}
else {
/* worldspace */
- VECCOPY(tmp_loc, ob->obmat[3]);
+ copy_v3_v3(tmp_loc, ob->obmat[3]);
}
}
/* copy the location to the right place */
if (tarIndex) {
- VECCOPY(loc2, tmp_loc);
+ copy_v3_v3(loc2, tmp_loc);
}
else {
- VECCOPY(loc1, tmp_loc);
+ copy_v3_v3(loc1, tmp_loc);
}
}
DRIVER_TARGETS_LOOPER_END
@@ -1262,7 +1262,7 @@ static float dvar_eval_transChan (ChannelDriver *driver, DriverVar *dvar)
if (pchan) {
/* bone */
if (pchan->rotmode > 0) {
- VECCOPY(oldEul, pchan->eul);
+ copy_v3_v3(oldEul, pchan->eul);
rotOrder= pchan->rotmode;
useEulers = 1;
}
@@ -1289,7 +1289,7 @@ static float dvar_eval_transChan (ChannelDriver *driver, DriverVar *dvar)
else {
/* object */
if (ob->rotmode > 0) {
- VECCOPY(oldEul, ob->rot);
+ copy_v3_v3(oldEul, ob->rot);
rotOrder= ob->rotmode;
useEulers = 1;
}
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index f16b1e6b4ec..08440849a4e 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -60,10 +60,14 @@
#include "DNA_camera_types.h"
#include "DNA_sequence_types.h"
#include "DNA_userdef_types.h"
+#include "DNA_brush_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "BLI_blenlib.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
+#include "BLI_bpath.h"
#include "BKE_bmfont.h"
#include "BKE_global.h"
@@ -313,6 +317,133 @@ Image *copy_image(Image *ima)
return nima;
}
+static void extern_local_image(Image *UNUSED(ima))
+{
+ /* Nothing to do: images don't link to other IDs. This function exists to
+ match id_make_local pattern. */
+}
+
+void make_local_image(struct Image *ima)
+{
+ Main *bmain= G.main;
+ Tex *tex;
+ Brush *brush;
+ Mesh *me;
+ int is_local= FALSE, is_lib= FALSE;
+
+ /* - only lib users: do nothing
+ * - only local users: set flag
+ * - mixed: make copy
+ */
+
+ if(ima->id.lib==NULL) return;
+
+ /* Can't take short cut here: must check meshes at least because of bogus
+ texface ID refs. - z0r */
+#if 0
+ if(ima->id.us==1) {
+ id_clear_lib_data(bmain, &ima->id);
+ extern_local_image(ima);
+ return;
+ }
+#endif
+
+ for(tex= bmain->tex.first; tex; tex= tex->id.next) {
+ if(tex->ima == ima) {
+ if(tex->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
+ }
+ }
+ for(brush= bmain->brush.first; brush; brush= brush->id.next) {
+ if(brush->clone.image == ima) {
+ if(brush->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
+ }
+ }
+ for(me= bmain->mesh.first; me; me= me->id.next) {
+ if(me->mtface) {
+ MTFace *tface;
+ int a, i;
+
+ for(i=0; i<me->fdata.totlayer; i++) {
+ if(me->fdata.layers[i].type == CD_MTFACE) {
+ tface= (MTFace*)me->fdata.layers[i].data;
+
+ for(a=0; a<me->totface; a++, tface++) {
+ if(tface->tpage == ima) {
+ if(me->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &ima->id);
+ extern_local_image(ima);
+ }
+ else if(is_local && is_lib) {
+ Image *iman= copy_image(ima);
+
+ iman->id.us= 0;
+
+ /* Remap paths of new ID using old library as base. */
+ BKE_id_lib_local_paths(bmain, &iman->id);
+
+ tex= bmain->tex.first;
+ while(tex) {
+ if(tex->id.lib==NULL) {
+ if(tex->ima==ima) {
+ tex->ima = iman;
+ iman->id.us++;
+ ima->id.us--;
+ }
+ }
+ tex= tex->id.next;
+ }
+ brush= bmain->brush.first;
+ while(brush) {
+ if(brush->id.lib==NULL) {
+ if(brush->clone.image==ima) {
+ brush->clone.image = iman;
+ iman->id.us++;
+ ima->id.us--;
+ }
+ }
+ brush= brush->id.next;
+ }
+ /* Transfer references in texfaces. Texfaces don't add to image ID
+ user count *unless* there are no other users. See
+ readfile.c:lib_link_mtface. */
+ me= bmain->mesh.first;
+ while(me) {
+ if(me->mtface) {
+ MTFace *tface;
+ int a, i;
+
+ for(i=0; i<me->fdata.totlayer; i++) {
+ if(me->fdata.layers[i].type == CD_MTFACE) {
+ tface= (MTFace*)me->fdata.layers[i].data;
+
+ for(a=0; a<me->totface; a++, tface++) {
+ if(tface->tpage == ima) {
+ tface->tpage = iman;
+ if(iman->id.us == 0) {
+ tface->tpage->id.us= 1;
+ }
+ id_lib_extern((ID*)iman);
+ }
+ }
+ }
+ }
+ }
+ me= me->id.next;
+ }
+ }
+}
+
void BKE_image_merge(Image *dest, Image *source)
{
ImBuf *ibuf;
@@ -849,7 +980,7 @@ int BKE_add_image_extension(char *string, int imtype)
|| (G.have_quicktime && BLI_testextensie_array(string, imb_ext_image_qt))) {
return BLI_replace_extension(string, FILE_MAX, extension);
} else {
- strcat(string, extension);
+ return BLI_ensure_extension(string, FILE_MAX, extension);
return TRUE;
}
@@ -1368,7 +1499,7 @@ void BKE_makepicstring(char *string, const char *base, int frame, int imtype, co
}
/* used by sequencer too */
-struct anim *openanim(char *name, int flags, int streamindex)
+struct anim *openanim(const char *name, int flags, int streamindex)
{
struct anim *anim;
struct ImBuf *ibuf;
@@ -1816,7 +1947,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
flag = IB_rect|IB_multilayer;
if(ima->flag & IMA_DO_PREMUL) flag |= IB_premul;
- ibuf = IMB_ibImageFromMemory((unsigned char*)ima->packedfile->data, ima->packedfile->size, flag);
+ ibuf = IMB_ibImageFromMemory((unsigned char*)ima->packedfile->data, ima->packedfile->size, flag, "<packed data>");
}
else {
flag= IB_rect|IB_multilayer|IB_metadata;
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 85e00bcea06..034f4a96879 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -703,14 +703,7 @@ static const char *world_adrcodes_to_paths (int adrcode, int *array_index)
return "mist.start";
case WO_MISTHI:
return "mist.height";
-
- /* Star Color is unused -- recommend removal */
- /* case WO_STAR_R:
- *array_index= 0; return "stars.color";
- case WO_STAR_G:
- *array_index= 1; return "stars.color";
- case WO_STAR_B:
- *array_index= 2; return "stars.color"; */
+
case WO_STAR_R:
case WO_STAR_G:
case WO_STAR_B:
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 5ac8780e4a2..6d095117136 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -181,7 +181,7 @@ void make_local_key(Key *key)
if(key==NULL) return;
key->id.lib= NULL;
- new_id(NULL, (ID *)key, NULL);
+ new_id(NULL, &key->id, NULL);
}
/* Sort shape keys and Ipo curves after a change. This assumes that at most
@@ -505,7 +505,7 @@ static char *key_block_get_data(Key *key, KeyBlock *actkb, KeyBlock *kb, char **
co= MEM_callocN(sizeof(float)*3*me->edit_mesh->totvert, "key_block_get_data");
for(eve=me->edit_mesh->verts.first; eve; eve=eve->next, a++)
- VECCOPY(co[a], eve->co);
+ copy_v3_v3(co[a], eve->co);
*freedata= (char*)co;
return (char*)co;
@@ -1381,7 +1381,7 @@ float *do_ob_key(Scene *scene, Object *ob)
ob->shapenr= 1;
}
- if(ELEM(ob->type, OB_MESH, OB_LATTICE)) {
+ if (OB_TYPE_SUPPORT_VGROUP(ob->type)) {
float *weights= get_weights_array(ob, kb->vgroup);
cp_key(0, tot, tot, out, key, actkb, kb, weights, 0);
@@ -1568,7 +1568,7 @@ void latt_to_key(Lattice *lt, KeyBlock *kb)
bp= lt->def;
fp= kb->data;
for(a=0; a<kb->totelem; a++, fp+=3, bp++) {
- VECCOPY(fp, bp->vec);
+ copy_v3_v3(fp, bp->vec);
}
}
@@ -1585,7 +1585,7 @@ void key_to_latt(KeyBlock *kb, Lattice *lt)
tot= MIN2(kb->totelem, tot);
for(a=0; a<tot; a++, fp+=3, bp++) {
- VECCOPY(bp->vec, fp);
+ copy_v3_v3(bp->vec, fp);
}
}
@@ -1615,11 +1615,11 @@ void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb)
bezt= nu->bezt;
a= nu->pntsu;
while(a--) {
- VECCOPY(fp, bezt->vec[0]);
+ copy_v3_v3(fp, bezt->vec[0]);
fp+= 3;
- VECCOPY(fp, bezt->vec[1]);
+ copy_v3_v3(fp, bezt->vec[1]);
fp+= 3;
- VECCOPY(fp, bezt->vec[2]);
+ copy_v3_v3(fp, bezt->vec[2]);
fp+= 3;
fp[0]= bezt->alfa;
fp+= 3; /* alphas */
@@ -1630,7 +1630,7 @@ void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb)
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
while(a--) {
- VECCOPY(fp, bp->vec);
+ copy_v3_v3(fp, bp->vec);
fp[3]= bp->alfa;
fp+= 4;
@@ -1662,11 +1662,11 @@ void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
bezt= nu->bezt;
a= nu->pntsu;
while(a-- && tot>0) {
- VECCOPY(bezt->vec[0], fp);
+ copy_v3_v3(bezt->vec[0], fp);
fp+= 3;
- VECCOPY(bezt->vec[1], fp);
+ copy_v3_v3(bezt->vec[1], fp);
fp+= 3;
- VECCOPY(bezt->vec[2], fp);
+ copy_v3_v3(bezt->vec[2], fp);
fp+= 3;
bezt->alfa= fp[0];
fp+= 3; /* alphas */
@@ -1679,7 +1679,7 @@ void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
while(a-- && tot>0) {
- VECCOPY(bp->vec, fp);
+ copy_v3_v3(bp->vec, fp);
bp->alfa= fp[3];
fp+= 4;
@@ -1708,7 +1708,7 @@ void mesh_to_key(Mesh *me, KeyBlock *kb)
mvert= me->mvert;
fp= kb->data;
for(a=0; a<kb->totelem; a++, fp+=3, mvert++) {
- VECCOPY(fp, mvert->co);
+ copy_v3_v3(fp, mvert->co);
}
}
@@ -1725,7 +1725,7 @@ void key_to_mesh(KeyBlock *kb, Mesh *me)
tot= MIN2(kb->totelem, me->totvert);
for(a=0; a<tot; a++, fp+=3, mvert++) {
- VECCOPY(mvert->co, fp);
+ copy_v3_v3(mvert->co, fp);
}
}
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 84f9829a639..47878242604 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -39,6 +39,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_bpath.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -246,7 +247,7 @@ void make_local_lattice(Lattice *lt)
{
Main *bmain= G.main;
Object *ob;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -255,28 +256,27 @@ void make_local_lattice(Lattice *lt)
if(lt->id.lib==NULL) return;
if(lt->id.us==1) {
- lt->id.lib= NULL;
- lt->id.flag= LIB_LOCAL;
- new_id(&bmain->latt, (ID *)lt, NULL);
+ id_clear_lib_data(bmain, &lt->id);
return;
}
- for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+ for(ob= bmain->object.first; ob && ELEM(FALSE, is_lib, is_local); ob= ob->id.next) {
if(ob->data==lt) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- lt->id.lib= NULL;
- lt->id.flag= LIB_LOCAL;
- new_id(&bmain->latt, (ID *)lt, NULL);
+ if(is_local && is_lib==FALSE) {
+ id_clear_lib_data(bmain, &lt->id);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
Lattice *ltn= copy_lattice(lt);
ltn->id.us= 0;
+ /* Remap paths of new ID using old library as base. */
+ BKE_id_lib_local_paths(bmain, &ltn->id);
+
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data==lt) {
if(ob->id.lib==NULL) {
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index c44ccd7aa57..35b50730a31 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -74,7 +74,7 @@
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
#include "BLI_utildefines.h"
-
+#include "BLI_bpath.h"
#include "BKE_animsys.h"
#include "BKE_context.h"
@@ -108,6 +108,7 @@
#include "BKE_gpencil.h"
#include "BKE_fcurve.h"
#include "BKE_speaker.h"
+#include "BKE_utildefines.h"
#include "RNA_access.h"
@@ -126,6 +127,21 @@
/* ************* general ************************ */
+
+/* this has to be called from each make_local_* func, we could call
+ * from id_make_local() but then the make local functions would not be self
+ * contained.
+ * also note that the id _must_ have a library - campbell */
+void BKE_id_lib_local_paths(Main *bmain, ID *id)
+{
+ char *bpath_user_data[2]= {bmain->name, (id)->lib->filepath};
+
+ bpath_traverse_id(bmain, id,
+ bpath_relocate_visitor,
+ BPATH_TRAVERSE_SKIP_MULTIFILE,
+ bpath_user_data);
+}
+
void id_lib_extern(ID *id)
{
if(id) {
@@ -194,7 +210,8 @@ int id_make_local(ID *id, int test)
if(!test) make_local_texture((Tex*)id);
return 1;
case ID_IM:
- return 0; /* not implemented */
+ if(!test) make_local_image((Image*)id);
+ return 1;
case ID_LT:
if(!test) {
make_local_lattice((Lattice*)id);
@@ -1246,6 +1263,17 @@ int new_id(ListBase *lb, ID *id, const char *tname)
return result;
}
+/* Pull an ID out of a library (make it local). Only call this for IDs that
+ don't have other library users. */
+void id_clear_lib_data(Main *bmain, ID *id)
+{
+ BKE_id_lib_local_paths(bmain, id);
+
+ id->lib= NULL;
+ id->flag= LIB_LOCAL;
+ new_id(which_libbase(bmain, GS(id->name)), id, NULL);
+}
+
/* next to indirect usage in read/writefile also in editobject.c scene.c */
void clear_id_newpoins(void)
{
@@ -1264,16 +1292,6 @@ void clear_id_newpoins(void)
}
}
-/* only for library fixes */
-static void image_fix_relative_path(Image *ima)
-{
- if(ima->id.lib==NULL) return;
- if(strncmp(ima->name, "//", 2)==0) {
- BLI_path_abs(ima->name, ima->id.lib->filepath);
- BLI_path_rel(ima->name, G.main->name);
- }
-}
-
#define LIBTAG(a) if(a && a->id.lib) {a->id.flag &=~LIB_INDIRECT; a->id.flag |= LIB_EXTERN;}
static void lib_indirect_test_id(ID *id, Library *lib)
@@ -1348,14 +1366,15 @@ void tag_main(struct Main *mainvar, const short tag)
}
}
-/* if lib!=NULL, only all from lib local */
-void all_local(Library *lib, int untagged_only)
+/* if lib!=NULL, only all from lib local
+ * bmain is almost certainly G.main */
+void BKE_library_make_local(Main *bmain, Library *lib, int untagged_only)
{
ListBase *lbarray[MAX_LIBARRAY], tempbase={NULL, NULL};
ID *id, *idn;
int a;
- a= set_listbasepointers(G.main, lbarray);
+ a= set_listbasepointers(bmain, lbarray);
while(a--) {
id= lbarray[a]->first;
@@ -1372,17 +1391,16 @@ void all_local(Library *lib, int untagged_only)
(untagged_only==0 || !(id->flag & LIB_PRE_EXISTING)))
{
if(lib==NULL || id->lib==lib) {
- id->flag &= ~(LIB_EXTERN|LIB_INDIRECT|LIB_NEW);
-
if(id->lib) {
- /* relative file patch */
- if(GS(id->name)==ID_IM)
- image_fix_relative_path((Image *)id);
-
- id->lib= NULL;
- new_id(lbarray[a], id, NULL); /* new_id only does it with double names */
+ id_clear_lib_data(bmain, id); /* sets 'id->flag' */
+
+ /* why sort alphabetically here but not in
+ * id_clear_lib_data() ? - campbell */
sort_alpha_id(lbarray[a], id);
}
+ else {
+ id->flag &= ~(LIB_EXTERN|LIB_INDIRECT|LIB_NEW);
+ }
}
}
id= idn;
@@ -1397,7 +1415,7 @@ void all_local(Library *lib, int untagged_only)
}
/* patch 3: make sure library data isn't indirect falsely... */
- a= set_listbasepointers(G.main, lbarray);
+ a= set_listbasepointers(bmain, lbarray);
while(a--) {
for(id= lbarray[a]->first; id; id=id->next)
lib_indirect_test_id(id, lib);
@@ -1464,7 +1482,12 @@ void name_uiprefix_id(char *name, ID *id)
void BKE_library_filepath_set(Library *lib, const char *filepath)
{
- BLI_strncpy(lib->name, filepath, sizeof(lib->name));
+ /* in some cases this is used to update the absolute path from the
+ * relative */
+ if (lib->name != filepath) {
+ BLI_strncpy(lib->name, filepath, sizeof(lib->name));
+ }
+
BLI_strncpy(lib->filepath, filepath, sizeof(lib->filepath));
/* not essential but set filepath is an absolute copy of value which
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 190df040bf4..7be3514e0f2 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -50,6 +50,7 @@
#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
+#include "BLI_bpath.h"
#include "BKE_animsys.h"
#include "BKE_displist.h"
@@ -285,8 +286,7 @@ void make_local_material(Material *ma)
Mesh *me;
Curve *cu;
MetaBall *mb;
- Material *man;
- int a, local=0, lib=0;
+ int a, is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -294,23 +294,24 @@ void make_local_material(Material *ma)
*/
if(ma->id.lib==NULL) return;
- if(ma->id.us==1) {
- ma->id.lib= NULL;
- ma->id.flag= LIB_LOCAL;
- new_id(&bmain->mat, (ID *)ma, NULL);
+ /* One local user; set flag and return. */
+ if(ma->id.us==1) {
+ id_clear_lib_data(bmain, &ma->id);
extern_local_material(ma);
return;
}
-
+
+ /* Check which other IDs reference this one to determine if it's used by
+ lib or local */
/* test objects */
ob= bmain->object.first;
while(ob) {
if(ob->mat) {
for(a=0; a<ob->totcol; a++) {
if(ob->mat[a]==ma) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
}
@@ -322,8 +323,8 @@ void make_local_material(Material *ma)
if(me->mat) {
for(a=0; a<me->totcol; a++) {
if(me->mat[a]==ma) {
- if(me->id.lib) lib= 1;
- else local= 1;
+ if(me->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
}
@@ -335,8 +336,8 @@ void make_local_material(Material *ma)
if(cu->mat) {
for(a=0; a<cu->totcol; a++) {
if(cu->mat[a]==ma) {
- if(cu->id.lib) lib= 1;
- else local= 1;
+ if(cu->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
}
@@ -348,26 +349,28 @@ void make_local_material(Material *ma)
if(mb->mat) {
for(a=0; a<mb->totcol; a++) {
if(mb->mat[a]==ma) {
- if(mb->id.lib) lib= 1;
- else local= 1;
+ if(mb->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
}
mb= mb->id.next;
}
-
- if(local && lib==0) {
- ma->id.lib= NULL;
- ma->id.flag= LIB_LOCAL;
- new_id(&bmain->mat, (ID *)ma, NULL);
+ /* Only local users. */
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &ma->id);
extern_local_material(ma);
}
- else if(local && lib) {
-
- man= copy_material(ma);
+ /* Both user and local, so copy. */
+ else if(is_local && is_lib) {
+ Material *man= copy_material(ma);
+
man->id.us= 0;
-
+
+ /* Remap paths of new ID using old library as base. */
+ BKE_id_lib_local_paths(bmain, &man->id);
+
/* do objects */
ob= bmain->object.first;
while(ob) {
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index b9ca6dda4cf..327306b32ee 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -50,7 +50,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
-
+#include "BLI_bpath.h"
#include "BKE_global.h"
@@ -147,7 +147,7 @@ void make_local_mball(MetaBall *mb)
{
Main *bmain= G.main;
Object *ob;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -156,32 +156,30 @@ void make_local_mball(MetaBall *mb)
if(mb->id.lib==NULL) return;
if(mb->id.us==1) {
- mb->id.lib= NULL;
- mb->id.flag= LIB_LOCAL;
- new_id(&bmain->mball, (ID *)mb, NULL);
+ id_clear_lib_data(bmain, &mb->id);
extern_local_mball(mb);
return;
}
- for(ob= G.main->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+ for(ob= G.main->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
if(ob->data == mb) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- mb->id.lib= NULL;
- mb->id.flag= LIB_LOCAL;
-
- new_id(&bmain->mball, (ID *)mb, NULL);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &mb->id);
extern_local_mball(mb);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
MetaBall *mbn= copy_mball(mb);
mbn->id.us= 0;
+ /* Remap paths of new ID using old library as base. */
+ BKE_id_lib_local_paths(bmain, &mbn->id);
+
for(ob= G.main->object.first; ob; ob= ob->id.next) {
if(ob->data == mb) {
if(ob->id.lib==NULL) {
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 2b92cdf005d..a96d3a3a217 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -43,6 +43,7 @@
#include "DNA_ipo_types.h"
#include "BLI_blenlib.h"
+#include "BLI_bpath.h"
#include "BLI_editVert.h"
#include "BLI_math.h"
#include "BLI_edgehash.h"
@@ -240,39 +241,26 @@ Mesh *copy_mesh(Mesh *me)
return men;
}
-static void make_local_tface(Main *bmain, Mesh *me)
+static void expand_local_mesh(Mesh *me)
{
- MTFace *tface;
- Image *ima;
- int a, i;
-
- for(i=0; i<me->fdata.totlayer; i++) {
- if(me->fdata.layers[i].type == CD_MTFACE) {
- tface= (MTFace*)me->fdata.layers[i].data;
-
- for(a=0; a<me->totface; a++, tface++) {
- /* special case: ima always local immediately */
- if(tface->tpage) {
- ima= tface->tpage;
- if(ima->id.lib) {
- ima->id.lib= NULL;
- ima->id.flag= LIB_LOCAL;
- new_id(&bmain->image, (ID *)ima, NULL);
+ id_lib_extern((ID *)me->texcomesh);
+
+ if(me->mtface) {
+ MTFace *tface;
+ int a, i;
+
+ for(i=0; i<me->fdata.totlayer; i++) {
+ if(me->fdata.layers[i].type == CD_MTFACE) {
+ tface= (MTFace*)me->fdata.layers[i].data;
+
+ for(a=0; a<me->totface; a++, tface++) {
+ if(tface->tpage) {
+ id_lib_extern((ID *)tface->tpage);
}
}
}
}
}
-}
-
-static void expand_local_mesh(Main *bmain, Mesh *me)
-{
- id_lib_extern((ID *)me->texcomesh);
-
- if(me->mtface) {
- /* why is this an exception? - should not really make local when extern'ing - campbell */
- make_local_tface(bmain, me);
- }
if(me->mat) {
extern_local_matarar(me->mat, me->totcol);
@@ -283,7 +271,7 @@ void make_local_mesh(Mesh *me)
{
Main *bmain= G.main;
Object *ob;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -292,32 +280,30 @@ void make_local_mesh(Mesh *me)
if(me->id.lib==NULL) return;
if(me->id.us==1) {
- me->id.lib= NULL;
- me->id.flag= LIB_LOCAL;
-
- new_id(&bmain->mesh, (ID *)me, NULL);
- expand_local_mesh(bmain, me);
+ id_clear_lib_data(bmain, &me->id);
+ expand_local_mesh(me);
return;
}
- for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+ for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
if(me == ob->data) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- me->id.lib= NULL;
- me->id.flag= LIB_LOCAL;
-
- new_id(&bmain->mesh, (ID *)me, NULL);
- expand_local_mesh(bmain, me);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &me->id);
+ expand_local_mesh(me);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
Mesh *men= copy_mesh(me);
men->id.us= 0;
+
+ /* Remap paths of new ID using old library as base. */
+ BKE_id_lib_local_paths(bmain, &men->id);
+
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(me == ob->data) {
if(ob->id.lib==NULL) {
@@ -1329,7 +1315,6 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned
UvVertMap *vmap;
UvMapVert *buf;
MFace *mf;
- MTFace *tf;
unsigned int a;
int i, totuv, nverts;
@@ -1337,8 +1322,7 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned
/* generate UvMapVert array */
mf= mface;
- tf= tface;
- for(a=0; a<totface; a++, mf++, tf++)
+ for(a=0; a<totface; a++, mf++)
if(!selected || (!(mf->flag & ME_HIDE) && (mf->flag & ME_FACE_SEL)))
totuv += (mf->v4)? 4: 3;
@@ -1358,8 +1342,7 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned
}
mf= mface;
- tf= tface;
- for(a=0; a<totface; a++, mf++, tf++) {
+ for(a=0; a<totface; a++, mf++) {
if(!selected || (!(mf->flag & ME_HIDE) && (mf->flag & ME_FACE_SEL))) {
nverts= (mf->v4)? 4: 3;
@@ -1375,7 +1358,6 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned
}
/* sort individual uvs for each vert */
- tf= tface;
for(a=0; a<totvert; a++) {
UvMapVert *newvlist= NULL, *vlist=vmap->vert[a];
UvMapVert *iterv, *v, *lastv, *next;
@@ -1387,14 +1369,14 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned
v->next= newvlist;
newvlist= v;
- uv= (tf+v->f)->uv[v->tfindex];
+ uv= tface[v->f].uv[v->tfindex];
lastv= NULL;
iterv= vlist;
while(iterv) {
next= iterv->next;
- uv2= (tf+iterv->f)->uv[iterv->tfindex];
+ uv2= tface[iterv->f].uv[iterv->tfindex];
sub_v2_v2v2(uvdiff, uv2, uv);
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index 6b40c0d8f25..0dac4b8cd80 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -115,9 +115,10 @@ static int search_face_cmp(const void *v1, const void *v2)
}
+#define PRINT if(do_verbose) printf
+
int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totvert, MEdge *medges, unsigned int totedge, MFace *mfaces, unsigned int totface, const short do_verbose, const short do_fixes)
{
-# define PRINT if(do_verbose) printf
# define REMOVE_EDGE_TAG(_med) { _med->v2= _med->v1; do_edge_free= 1; }
# define REMOVE_FACE_TAG(_mf) { _mf->v3=0; do_face_free= 1; }
@@ -282,7 +283,6 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve
PRINT("BKE_mesh_validate: finished\n\n");
-# undef PRINT
# undef REMOVE_EDGE_TAG
# undef REMOVE_FACE_TAG
@@ -303,12 +303,57 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve
return (do_face_free || do_edge_free || do_edge_recalc);
}
+static int mesh_validate_customdata(CustomData *data, short do_verbose, const short do_fixes)
+{
+ int i= 0, has_fixes= 0;
+
+ while(i<data->totlayer) {
+ CustomDataLayer *layer= &data->layers[i];
+ int mask= 1 << layer->type;
+ int ok= 1;
+
+ if((mask&CD_MASK_MESH)==0) {
+ PRINT("CustomDataLayer type %d which isn't in CD_MASK_MESH is stored in Mehs structure\n", layer->type);
+
+ if(do_fixes) {
+ CustomData_free_layer(data, layer->type, 0, i);
+ ok= 0;
+ has_fixes= 1;
+ }
+ }
+
+ if(ok)
+ i++;
+ }
+
+ return has_fixes;
+}
+
+#undef PRINT
+
+int BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata, CustomData *fdata, short do_verbose, const short do_fixes)
+{
+ int vfixed= 0, efixed= 0, ffixed= 0;
+
+ vfixed= mesh_validate_customdata(vdata, do_verbose, do_fixes);
+ efixed= mesh_validate_customdata(edata, do_verbose, do_fixes);
+ ffixed= mesh_validate_customdata(fdata, do_verbose, do_fixes);
+
+ return vfixed || efixed || ffixed;
+}
+
int BKE_mesh_validate(Mesh *me, int do_verbose)
{
+ int layers_fixed= 0, arrays_fixed= 0;
+
if(do_verbose) {
printf("MESH: %s\n", me->id.name+2);
}
- return BKE_mesh_validate_arrays(me, me->mvert, me->totvert, me->medge, me->totedge, me->mface, me->totface, do_verbose, TRUE);
+
+ layers_fixed= BKE_mesh_validate_all_customdata(&me->vdata, &me->edata, &me->fdata, do_verbose, TRUE);
+ arrays_fixed= BKE_mesh_validate_arrays(me, me->mvert, me->totvert, me->medge, me->totedge, me->mface, me->totface, do_verbose, TRUE);
+
+ return layers_fixed || arrays_fixed;
}
int BKE_mesh_validate_dm(DerivedMesh *dm)
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 1b5af94fb25..9c2b6cae751 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1040,6 +1040,7 @@ static void ntreeMakeLocal_LinkNew(void *calldata, ID *owner_id, bNodeTree *ntre
void ntreeMakeLocal(bNodeTree *ntree)
{
+ Main *bmain= G.main;
bNodeTreeType *treetype= ntreeGetType(ntree->type);
MakeLocalCallData cd;
@@ -1050,9 +1051,7 @@ void ntreeMakeLocal(bNodeTree *ntree)
if(ntree->id.lib==NULL) return;
if(ntree->id.us==1) {
- ntree->id.lib= NULL;
- ntree->id.flag= LIB_LOCAL;
- new_id(NULL, (ID *)ntree, NULL);
+ id_clear_lib_data(bmain, (ID *)ntree);
return;
}
@@ -1066,9 +1065,7 @@ void ntreeMakeLocal(bNodeTree *ntree)
/* if all users are local, we simply make tree local */
if(cd.local && cd.lib==0) {
- ntree->id.lib= NULL;
- ntree->id.flag= LIB_LOCAL;
- new_id(NULL, (ID *)ntree, NULL);
+ id_clear_lib_data(bmain, (ID *)ntree);
}
else if(cd.local && cd.lib) {
/* this is the mixed case, we copy the tree and assign it to local users */
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 27f40aa6d6a..a5edd569bc2 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -56,6 +56,7 @@
#include "DNA_world_types.h"
#include "BLI_blenlib.h"
+#include "BLI_bpath.h"
#include "BLI_editVert.h"
#include "BLI_math.h"
#include "BLI_pbvh.h"
@@ -748,7 +749,7 @@ void make_local_camera(Camera *cam)
{
Main *bmain= G.main;
Object *ob;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -757,28 +758,28 @@ void make_local_camera(Camera *cam)
if(cam->id.lib==NULL) return;
if(cam->id.us==1) {
- cam->id.lib= NULL;
- cam->id.flag= LIB_LOCAL;
- new_id(&bmain->camera, (ID *)cam, NULL);
+ id_clear_lib_data(bmain, &cam->id);
return;
}
- for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+ for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
if(ob->data==cam) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- cam->id.lib= NULL;
- cam->id.flag= LIB_LOCAL;
- new_id(&bmain->camera, (ID *)cam, NULL);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &cam->id);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
Camera *camn= copy_camera(cam);
+
camn->id.us= 0;
-
+
+ /* Remap paths of new ID using old library as base. */
+ BKE_id_lib_local_paths(bmain, &camn->id);
+
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data == cam) {
if(ob->id.lib==NULL) {
@@ -918,8 +919,7 @@ void make_local_lamp(Lamp *la)
{
Main *bmain= G.main;
Object *ob;
- Lamp *lan;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -928,30 +928,29 @@ void make_local_lamp(Lamp *la)
if(la->id.lib==NULL) return;
if(la->id.us==1) {
- la->id.lib= NULL;
- la->id.flag= LIB_LOCAL;
- new_id(&bmain->lamp, (ID *)la, NULL);
+ id_clear_lib_data(bmain, &la->id);
return;
}
ob= bmain->object.first;
while(ob) {
if(ob->data==la) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
ob= ob->id.next;
}
- if(local && lib==0) {
- la->id.lib= NULL;
- la->id.flag= LIB_LOCAL;
- new_id(&bmain->lamp, (ID *)la, NULL);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &la->id);
}
- else if(local && lib) {
- lan= copy_lamp(la);
+ else if(is_local && is_lib) {
+ Lamp *lan= copy_lamp(la);
lan->id.us= 0;
-
+
+ /* Remap paths of new ID using old library as base. */
+ BKE_id_lib_local_paths(bmain, &lan->id);
+
ob= bmain->object.first;
while(ob) {
if(ob->data==la) {
@@ -1469,7 +1468,7 @@ void make_local_object(Object *ob)
Main *bmain= G.main;
Scene *sce;
Base *base;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -1481,27 +1480,29 @@ void make_local_object(Object *ob)
ob->proxy= ob->proxy_from= NULL;
if(ob->id.us==1) {
- ob->id.lib= NULL;
- ob->id.flag= LIB_LOCAL;
- new_id(&bmain->object, (ID *)ob, NULL);
+ id_clear_lib_data(bmain, &ob->id);
+ extern_local_object(ob);
}
else {
- for(sce= bmain->scene.first; sce && ELEM(0, lib, local); sce= sce->id.next) {
+ for(sce= bmain->scene.first; sce && ELEM(0, is_lib, is_local); sce= sce->id.next) {
if(object_in_scene(ob, sce)) {
- if(sce->id.lib) lib= 1;
- else local= 1;
+ if(sce->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- ob->id.lib= NULL;
- ob->id.flag= LIB_LOCAL;
- new_id(&bmain->object, (ID *)ob, NULL);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &ob->id);
+ extern_local_object(ob);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
Object *obn= copy_object(ob);
+
obn->id.us= 0;
+ /* Remap paths of new ID using old library as base. */
+ BKE_id_lib_local_paths(bmain, &obn->id);
+
sce= bmain->scene.first;
while(sce) {
if(sce->id.lib==NULL) {
@@ -1519,8 +1520,6 @@ void make_local_object(Object *ob)
}
}
}
-
- extern_local_object(ob);
}
/*
@@ -2043,7 +2042,7 @@ static void give_parvert(Object *par, int nr, float *vec)
while(a--) {
if(count==nr) {
found= 1;
- VECCOPY(vec, bezt->vec[1]);
+ copy_v3_v3(vec, bezt->vec[1]);
break;
}
count++;
@@ -2111,7 +2110,7 @@ static void ob_parvert3(Object *ob, Object *par, float mat[][4])
copy_m4_m3(mat, cmat);
if(ob->type==OB_CURVE) {
- VECCOPY(mat[3], v1);
+ copy_v3_v3(mat[3], v1);
}
else {
add_v3_v3v3(mat[3], v1, v2);
@@ -2235,7 +2234,7 @@ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[
case PARVERT1:
unit_m4(totmat);
if (simul){
- VECCOPY(totmat[3], par->obmat[3]);
+ copy_v3_v3(totmat[3], par->obmat[3]);
}
else{
give_parvert(par, ob->par1, vec);
@@ -2269,10 +2268,10 @@ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[
// origin, voor help line
if( (ob->partype & PARTYPE)==PARSKEL ) {
- VECCOPY(ob->orig, par->obmat[3]);
+ copy_v3_v3(ob->orig, par->obmat[3]);
}
else {
- VECCOPY(ob->orig, totmat[3]);
+ copy_v3_v3(ob->orig, totmat[3]);
}
}
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index e5f802c5675..7678da1c7c4 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -53,6 +53,7 @@
#include "BLI_rand.h"
#include "BLI_threads.h"
#include "BLI_linklist.h"
+#include "BLI_bpath.h"
#include "BKE_anim.h"
#include "BKE_animsys.h"
@@ -3601,7 +3602,7 @@ void make_local_particlesettings(ParticleSettings *part)
{
Main *bmain= G.main;
Object *ob;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -3610,34 +3611,34 @@ void make_local_particlesettings(ParticleSettings *part)
if(part->id.lib==0) return;
if(part->id.us==1) {
- part->id.lib= 0;
- part->id.flag= LIB_LOCAL;
- new_id(&bmain->particle, (ID *)part, 0);
+ id_clear_lib_data(bmain, &part->id);
expand_local_particlesettings(part);
return;
}
/* test objects */
- for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+ for(ob= bmain->object.first; ob && ELEM(FALSE, is_lib, is_local); ob= ob->id.next) {
ParticleSystem *psys=ob->particlesystem.first;
for(; psys; psys=psys->next){
if(psys->part==part) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
}
- if(local && lib==0) {
- part->id.lib= 0;
- part->id.flag= LIB_LOCAL;
- new_id(&bmain->particle, (ID *)part, 0);
+ if(is_local && is_lib==FALSE) {
+ id_clear_lib_data(bmain, &part->id);
expand_local_particlesettings(part);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
ParticleSettings *partn= psys_copy_settings(part);
+
partn->id.us= 0;
-
+
+ /* Remap paths of new ID using old library as base. */
+ BKE_id_lib_local_paths(bmain, &partn->id);
+
/* do objects */
for(ob= bmain->object.first; ob; ob= ob->id.next) {
ParticleSystem *psys;
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index c28bbfa0554..ec058b23050 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -95,13 +95,13 @@
#include "RE_shader_ext.h"
/* fluid sim particle import */
-#ifndef DISABLE_ELBEEM
+#ifdef WITH_MOD_FLUID
#include "DNA_object_fluidsim.h"
#include "LBM_fluidsim.h"
#include <zlib.h>
#include <string.h>
-#endif // DISABLE_ELBEEM
+#endif // WITH_MOD_FLUID
/************************************************/
/* Reacting to system events */
@@ -3853,8 +3853,9 @@ static void update_children(ParticleSimulationData *sim)
else if(sim->psys->part->childtype) {
if(sim->psys->totchild != get_psys_tot_child(sim->scene, sim->psys))
distribute_particles(sim, PART_FROM_CHILD);
- else
- ; /* Children are up to date, nothing to do. */
+ else {
+ /* Children are up to date, nothing to do. */
+ }
}
else
psys_free_children(sim->psys);
@@ -3915,7 +3916,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
}
/* fluid sim particle import handling, actual loading of particles from file */
- #ifndef DISABLE_ELBEEM
+ #ifdef WITH_MOD_FLUID
{
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(sim->ob, eModifierType_Fluidsim);
@@ -4008,7 +4009,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
} // fluid sim particles done
}
- #endif // DISABLE_ELBEEM
+ #endif // WITH_MOD_FLUID
}
static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float UNUSED(cfra))
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index ac2a840c95a..7174126a00c 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -77,6 +77,8 @@
#include "BKE_smoke.h"
+#ifdef WITH_SMOKE
+
#ifdef _WIN32
#include <time.h>
#include <stdio.h>
@@ -131,12 +133,13 @@ struct SmokeModifierData;
#define TRI_UVOFFSET (1./4.)
-#ifdef WITH_SMOKE
/* forward declerations */
static void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *tris, int numfaces, int numtris, int **tridivs, float cell_len);
static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int correct);
static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs);
+
#else /* WITH_SMOKE */
+
/* Stubs to use when smoke is disabled */
struct WTURBULENCE *smoke_turbulence_init(int *UNUSED(res), int UNUSED(amplify), int UNUSED(noisetype)) { return NULL; }
struct FLUID_3D *smoke_init(int *UNUSED(res), float *UNUSED(p0)) { return NULL; }
@@ -146,9 +149,11 @@ void smoke_initWaveletBlenderRNA(struct WTURBULENCE *UNUSED(wt), float *UNUSED(s
void smoke_initBlenderRNA(struct FLUID_3D *UNUSED(fluid), float *UNUSED(alpha), float *UNUSED(beta), float *UNUSED(dt_factor), float *UNUSED(vorticity), int *UNUSED(border_colli)) {}
long long smoke_get_mem_req(int UNUSED(xres), int UNUSED(yres), int UNUSED(zres), int UNUSED(amplify)) { return 0; }
void smokeModifier_do(SmokeModifierData *UNUSED(smd), Scene *UNUSED(scene), Object *UNUSED(ob), DerivedMesh *UNUSED(dm)) {}
+
#endif /* WITH_SMOKE */
#ifdef WITH_SMOKE
+
static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, DerivedMesh *dm)
{
if((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain && !smd->domain->fluid)
diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c
index b743f847bb7..018c7a197ff 100644
--- a/source/blender/blenkernel/intern/speaker.c
+++ b/source/blender/blenkernel/intern/speaker.c
@@ -34,6 +34,8 @@
#include "DNA_speaker_types.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
+#include "BLI_bpath.h"
#include "BKE_animsys.h"
#include "BKE_global.h"
@@ -78,7 +80,7 @@ void make_local_speaker(Speaker *spk)
{
Main *bmain= G.main;
Object *ob;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -87,30 +89,29 @@ void make_local_speaker(Speaker *spk)
if(spk->id.lib==NULL) return;
if(spk->id.us==1) {
- spk->id.lib= NULL;
- spk->id.flag= LIB_LOCAL;
- new_id(&bmain->speaker, (ID *)spk, NULL);
+ id_clear_lib_data(bmain, &spk->id);
return;
}
ob= bmain->object.first;
while(ob) {
if(ob->data==spk) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
ob= ob->id.next;
}
- if(local && lib==0) {
- spk->id.lib= NULL;
- spk->id.flag= LIB_LOCAL;
- new_id(&bmain->speaker, (ID *)spk, NULL);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &spk->id);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
Speaker *spkn= copy_speaker(spk);
spkn->id.us= 0;
+ /* Remap paths of new ID using old library as base. */
+ BKE_id_lib_local_paths(bmain, &spkn->id);
+
ob= bmain->object.first;
while(ob) {
if(ob->data==spk) {
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 42415248bdc..d3bd7d7b766 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -42,6 +42,7 @@
#include "BLI_math.h"
#include "BLI_kdopbvh.h"
#include "BLI_utildefines.h"
+#include "BLI_bpath.h"
#include "DNA_key_types.h"
#include "DNA_object_types.h"
@@ -814,16 +815,20 @@ Tex *localize_texture(Tex *tex)
/* ------------------------------------------------------------------------- */
+static void extern_local_texture(Tex *tex)
+{
+ id_lib_extern((ID *)tex->ima);
+}
+
void make_local_texture(Tex *tex)
{
Main *bmain= G.main;
- Tex *texn;
Material *ma;
World *wrld;
Lamp *la;
Brush *br;
ParticleSettings *pa;
- int a, local=0, lib=0;
+ int a, is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -832,18 +837,9 @@ void make_local_texture(Tex *tex)
if(tex->id.lib==NULL) return;
- /* special case: ima always local immediately */
- if(tex->ima) {
- tex->ima->id.lib= NULL;
- tex->ima->id.flag= LIB_LOCAL;
- new_id(&bmain->image, (ID *)tex->ima, NULL);
- }
-
if(tex->id.us==1) {
- tex->id.lib= NULL;
- tex->id.flag= LIB_LOCAL;
- new_id(&bmain->tex, (ID *)tex, NULL);
-
+ id_clear_lib_data(bmain, &tex->id);
+ extern_local_texture(tex);
return;
}
@@ -851,8 +847,8 @@ void make_local_texture(Tex *tex)
while(ma) {
for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a] && ma->mtex[a]->tex==tex) {
- if(ma->id.lib) lib= 1;
- else local= 1;
+ if(ma->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
ma= ma->id.next;
@@ -861,8 +857,8 @@ void make_local_texture(Tex *tex)
while(la) {
for(a=0; a<MAX_MTEX; a++) {
if(la->mtex[a] && la->mtex[a]->tex==tex) {
- if(la->id.lib) lib= 1;
- else local= 1;
+ if(la->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
la= la->id.next;
@@ -871,8 +867,8 @@ void make_local_texture(Tex *tex)
while(wrld) {
for(a=0; a<MAX_MTEX; a++) {
if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) {
- if(wrld->id.lib) lib= 1;
- else local= 1;
+ if(wrld->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
wrld= wrld->id.next;
@@ -880,8 +876,8 @@ void make_local_texture(Tex *tex)
br= bmain->brush.first;
while(br) {
if(br->mtex.tex==tex) {
- if(br->id.lib) lib= 1;
- else local= 1;
+ if(br->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
br= br->id.next;
}
@@ -889,21 +885,24 @@ void make_local_texture(Tex *tex)
while(pa) {
for(a=0; a<MAX_MTEX; a++) {
if(pa->mtex[a] && pa->mtex[a]->tex==tex) {
- if(pa->id.lib) lib= 1;
- else local= 1;
+ if(pa->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
pa= pa->id.next;
}
- if(local && lib==0) {
- tex->id.lib= NULL;
- tex->id.flag= LIB_LOCAL;
- new_id(&bmain->tex, (ID *)tex, NULL);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &tex->id);
+ extern_local_texture(tex);
}
- else if(local && lib) {
- texn= copy_texture(tex);
+ else if(is_local && is_lib) {
+ Tex *texn= copy_texture(tex);
+
texn->id.us= 0;
+
+ /* Remap paths of new ID using old library as base. */
+ BKE_id_lib_local_paths(bmain, &texn->id);
ma= bmain->mat.first;
while(ma) {
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index c972f8e1c5c..9a26cc61cfd 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -40,6 +40,7 @@
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
+#include "BLI_bpath.h"
#include "BKE_world.h"
#include "BKE_library.h"
@@ -165,7 +166,7 @@ void make_local_world(World *wrld)
{
Main *bmain= G.main;
Scene *sce;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -174,28 +175,27 @@ void make_local_world(World *wrld)
if(wrld->id.lib==NULL) return;
if(wrld->id.us==1) {
- wrld->id.lib= NULL;
- wrld->id.flag= LIB_LOCAL;
- new_id(NULL, (ID *)wrld, NULL);
+ id_clear_lib_data(bmain, &wrld->id);
return;
}
- for(sce= bmain->scene.first; sce && ELEM(0, lib, local); sce= sce->id.next) {
+ for(sce= bmain->scene.first; sce && ELEM(FALSE, is_lib, is_local); sce= sce->id.next) {
if(sce->world == wrld) {
- if(sce->id.lib) lib= 1;
- else local= 1;
+ if(sce->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- wrld->id.lib= NULL;
- wrld->id.flag= LIB_LOCAL;
- new_id(NULL, (ID *)wrld, NULL);
+ if(is_local && is_lib==FALSE) {
+ id_clear_lib_data(bmain, &wrld->id);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
World *wrldn= copy_world(wrld);
wrldn->id.us= 0;
-
+
+ /* Remap paths of new ID using old library as base. */
+ BKE_id_lib_local_paths(bmain, &wrldn->id);
+
for(sce= bmain->scene.first; sce; sce= sce->id.next) {
if(sce->world == wrld) {
if(sce->id.lib==NULL) {
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index bdca3c8e618..da1412dac0d 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -1102,7 +1102,7 @@ IDProperty *ffmpeg_property_add(RenderData *rd, char * type, int opt_index, int
idp_type = IDP_FLOAT;
break;
case FF_OPT_TYPE_STRING:
- val.str = " ";
+ val.str = (char *)" ";
idp_type = IDP_STRING;
break;
case FF_OPT_TYPE_CONST:
@@ -1377,4 +1377,3 @@ void ffmpeg_verify_image_type(RenderData *rd)
}
#endif
-
diff --git a/source/blender/blenlib/BLI_bpath.h b/source/blender/blenlib/BLI_bpath.h
index 6101c94e26f..e850db5a171 100644
--- a/source/blender/blenlib/BLI_bpath.h
+++ b/source/blender/blenlib/BLI_bpath.h
@@ -34,22 +34,27 @@
#ifndef BLI_BPATH_H
#define BLI_BPATH_H
-struct BPathIterator;
-struct ReportList;
+struct ID;
+struct ListBase;
struct Main;
+struct ReportList;
-void BLI_bpathIterator_init (struct BPathIterator **bpi, struct Main *bmain, const char *basedir, const int flag);
-void BLI_bpathIterator_free (struct BPathIterator *bpi);
-const char* BLI_bpathIterator_getLib (struct BPathIterator *bpi);
-const char* BLI_bpathIterator_getName (struct BPathIterator *bpi);
-int BLI_bpathIterator_getType (struct BPathIterator *bpi);
-unsigned int BLI_bpathIterator_getPathMaxLen (struct BPathIterator *bpi);
-const char* BLI_bpathIterator_getBasePath (struct BPathIterator *bpi);
-void BLI_bpathIterator_step (struct BPathIterator *bpi);
-int BLI_bpathIterator_isDone (struct BPathIterator *bpi);
-void BLI_bpathIterator_getPath (struct BPathIterator *bpi, char *path);
-void BLI_bpathIterator_getPathExpanded (struct BPathIterator *bpi, char *path_expanded);
-void BLI_bpathIterator_setPath (struct BPathIterator *bpi, const char *path);
+/* Function that does something with an ID's file path. Should return 1 if the
+ path has changed, and in that case, should write the result to pathOut. */
+typedef int (*BPathVisitor)(void *userdata, char *path_dst, const char *path_src);
+/* Executes 'visit' for each path associated with 'id'. */
+void bpath_traverse_id(struct Main *bmain, struct ID *id, BPathVisitor visit_cb, const int flag, void *userdata);
+void bpath_traverse_id_list(struct Main *bmain, struct ListBase *lb, BPathVisitor visit_cb, const int flag, void *userdata);
+void bpath_traverse_main(struct Main *bmain, BPathVisitor visit_cb, const int flag, void *userdata);
+int bpath_relocate_visitor(void *oldbasepath, char *path_dst, const char *path_src);
+
+#define BPATH_TRAVERSE_ABS (1<<0) /* convert paths to absolute */
+#define BPATH_TRAVERSE_SKIP_LIBRARY (1<<2) /* skip library paths */
+#define BPATH_TRAVERSE_SKIP_PACKED (1<<3) /* skip packed data */
+#define BPATH_TRAVERSE_SKIP_MULTIFILE (1<<4) /* skip paths where a single dir is used with an array of files, eg.
+ * sequence strip images and pointcache. in this case only use the first
+ * file, this is needed for directory manipulation functions which might
+ * otherwise modify the same directory multiple times */
/* high level funcs */
@@ -57,8 +62,6 @@ void BLI_bpathIterator_setPath (struct BPathIterator *bpi, const char *path)
void checkMissingFiles(struct Main *bmain, struct ReportList *reports);
void makeFilesRelative(struct Main *bmain, const char *basedir, struct ReportList *reports);
void makeFilesAbsolute(struct Main *bmain, const char *basedir, struct ReportList *reports);
-void findMissingFiles(struct Main *bmain, const char *str);
-
-#define BPATH_USE_PACKED 1
+void findMissingFiles(struct Main *bmain, const char *searchpath, struct ReportList *reports);
#endif // BLI_BPATH_H
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index dd4bc868ab0..68bb1a7280d 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -102,6 +102,7 @@ int BLI_testextensie(const char *str, const char *ext);
int BLI_testextensie_array(const char *str, const char **ext_array);
int BLI_testextensie_glob(const char *str, const char *ext_fnmatch);
int BLI_replace_extension(char *path, size_t maxlen, const char *ext);
+int BLI_ensure_extension(char *path, size_t maxlen, const char *ext);
void BLI_uniquename(struct ListBase *list, void *vlink, const char defname[], char delim, short name_offs, short len);
int BLI_uniquename_cb(int (*unique_check)(void *, const char *), void *arg, const char defname[], char delim, char *name, short name_len);
void BLI_newname(char * name, int add);
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index 0cdb573c4c6..46389a9259e 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -132,7 +132,6 @@ int BLI_strcasecmp(const char *s1, const char *s2);
int BLI_strncasecmp(const char *s1, const char *s2, size_t len);
int BLI_natstrcmp(const char *s1, const char *s2);
size_t BLI_strnlen(const char *str, size_t maxlen);
-
void BLI_timestr(double _time, char *str); /* time var is global */
void BLI_ascii_strtolower(char *str, int len);
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index 00d8131d813..8826e9a9936 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -70,6 +70,7 @@ int BLI_system_thread_count(void); /* gets the number of threads the system can
#define LOCK_CUSTOM1 3
#define LOCK_RCACHE 4
#define LOCK_OPENGL 5
+#define LOCK_NODES 6
void BLI_lock_thread(int type);
void BLI_unlock_thread(int type);
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c
index 455b3b91467..259b25e67dd 100644
--- a/source/blender/blenlib/intern/bpath.c
+++ b/source/blender/blenlib/intern/bpath.c
@@ -20,7 +20,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): Campbell barton
+ * Contributor(s): Campbell barton, Alex Fraser
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -29,6 +29,12 @@
* \ingroup bli
*/
+/* TODO,
+ * currently there are some cases we dont support.
+ * - passing output paths to the visitor?, like render out.
+ * - passing sequence strips with many images.
+ * - passing directory paths - visitors dont know which path is a dir or a file.
+ * */
#include <sys/stat.h>
@@ -46,908 +52,542 @@
#include "MEM_guardedalloc.h"
-#include "DNA_mesh_types.h"
-#include "DNA_scene_types.h" /* to get the current frame */
+#include "DNA_brush_types.h"
#include "DNA_image_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_text_types.h"
-#include "DNA_sound_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_modifier_types.h"
+#include "DNA_object_fluidsim.h"
+#include "DNA_object_force.h"
+#include "DNA_object_types.h"
+#include "DNA_particle_types.h"
#include "DNA_sequence_types.h"
+#include "DNA_sound_types.h"
+#include "DNA_text_types.h"
+#include "DNA_texture_types.h"
#include "DNA_vfont_types.h"
-#include "DNA_windowmanager_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_smoke_types.h"
#include "BLI_blenlib.h"
#include "BLI_bpath.h"
#include "BLI_utildefines.h"
-#include "BKE_global.h"
-#include "BKE_image.h" /* so we can check the image's type */
-#include "BKE_sequencer.h"
+#include "BKE_library.h"
#include "BKE_main.h"
-#include "BKE_utildefines.h"
#include "BKE_report.h"
+#include "BKE_sequencer.h"
+#include "BKE_utildefines.h"
+#include "BKE_image.h" /* so we can check the image's type */
-typedef struct BPathIteratorSeqData
-{
- int totseq;
- int seq;
- struct Sequence **seqar; /* Sequence */
- struct Scene *scene; /* Current scene */
-} BPathIteratorSeqData;
-
-typedef struct BPathIterator
-{
- char* _path; /* never access directly, use BLI_bpathIterator_getPath */
- const char* _lib;
- const char* _name;
- void* data;
- int len;
- int type;
- int flag; /* iterator options */
-
- void (*setpath_callback)(struct BPathIterator *, const char *);
- void (*getpath_callback)(struct BPathIterator *, char *);
-
- const char* base_path; /* base path, the directory the blend file is in - normally bmain->name */
-
- Main *bmain;
-
- /* only for seq data */
- struct BPathIteratorSeqData seqdata;
-} BPathIterator;
-
-#define FILE_MAX 240
-
-
-/* TODO - BPATH_PLUGIN, BPATH_SEQ */
-enum BPathTypes {
- BPATH_IMAGE= 0,
- BPATH_TEXTURE,
- BPATH_TEXT,
- BPATH_SOUND,
- BPATH_FONT,
- BPATH_LIB,
- BPATH_SEQ,
- BPATH_CDATA,
-
- BPATH_DONE
-};
-
-void BLI_bpathIterator_init(struct BPathIterator **bpi_pt, Main *bmain, const char *basedir, const int flag)
+static int checkMissingFiles_visit_cb(void *userdata, char *UNUSED(path_dst), const char *path_src)
{
- BPathIterator *bpi;
-
- bpi= MEM_mallocN(sizeof(BPathIterator), "BLI_bpathIterator_init");
- *bpi_pt= bpi;
-
- bpi->type= BPATH_IMAGE;
- bpi->data= NULL;
-
- bpi->getpath_callback= NULL;
- bpi->setpath_callback= NULL;
+ ReportList *reports= (ReportList *)userdata;
- /* Sequencer specific */
- bpi->seqdata.totseq= 0;
- bpi->seqdata.seq= 0;
- bpi->seqdata.seqar= NULL;
- bpi->seqdata.scene= NULL;
-
- bpi->flag= flag;
-
- bpi->base_path= basedir; /* normally bmain->name */
- bpi->bmain= bmain;
+ if (!BLI_exists(path_src)) {
+ BKE_reportf(reports, RPT_WARNING, "Path Not Found \"%s\"", path_src);
+ }
- BLI_bpathIterator_step(bpi);
+ return FALSE;
}
-#if 0
-static void BLI_bpathIterator_alloc(struct BPathIterator **bpi)
+/* high level function */
+void checkMissingFiles(Main *bmain, ReportList *reports)
{
- *bpi= MEM_mallocN(sizeof(BPathIterator), "BLI_bpathIterator_alloc");
+ bpath_traverse_main(bmain, checkMissingFiles_visit_cb, BPATH_TRAVERSE_ABS, reports);
}
-#endif
-void BLI_bpathIterator_free(struct BPathIterator *bpi)
+typedef struct BPathRemap_Data
{
- if (bpi->seqdata.seqar)
- MEM_freeN((void *)bpi->seqdata.seqar);
- bpi->seqdata.seqar= NULL;
- bpi->seqdata.scene= NULL;
+ const char *basedir;
+ ReportList *reports;
- MEM_freeN(bpi);
-}
+ int count_tot;
+ int count_changed;
+ int count_failed;
+} BPathRemap_Data;
-void BLI_bpathIterator_getPath(struct BPathIterator *bpi, char *path)
+static int makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char *path_src)
{
- if (bpi->getpath_callback) {
- bpi->getpath_callback(bpi, path);
- }
- else {
- strcpy(path, bpi->_path); /* warning, we assume 'path' are long enough */
- }
-}
+ BPathRemap_Data *data= (BPathRemap_Data *)userdata;
-void BLI_bpathIterator_setPath(struct BPathIterator *bpi, const char *path)
-{
- if (bpi->setpath_callback) {
- bpi->setpath_callback(bpi, path);
+ data->count_tot++;
+
+ if(strncmp(path_src, "//", 2)==0) {
+ return FALSE; /* already relative */
}
else {
- strcpy(bpi->_path, path); /* warning, we assume 'path' are long enough */
+ strcpy(path_dst, path_src);
+ BLI_path_rel(path_dst, data->basedir);
+ if (strncmp(path_dst, "//", 2)==0) {
+ data->count_changed++;
+ }
+ else {
+ BKE_reportf(data->reports, RPT_WARNING, "Path cant be made relative \"%s\"", path_src);
+ data->count_failed++;
+ }
+ return TRUE;
}
}
-void BLI_bpathIterator_getPathExpanded(struct BPathIterator *bpi, char *path_expanded)
+void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports)
{
- const char *libpath;
-
- BLI_bpathIterator_getPath(bpi, path_expanded);
- libpath= BLI_bpathIterator_getLib(bpi);
+ BPathRemap_Data data= {0};
- if (libpath) { /* check the files location relative to its library path */
- BLI_path_abs(path_expanded, libpath);
- }
- else { /* local data, use the blend files path */
- BLI_path_abs(path_expanded, bpi->base_path);
+ if(basedir[0] == '\0') {
+ printf("%s: basedir='', this is a bug\n", __func__);
+ return;
}
- BLI_cleanup_file(NULL, path_expanded);
-}
-const char* BLI_bpathIterator_getLib(struct BPathIterator *bpi)
-{
- return bpi->_lib;
-}
-const char* BLI_bpathIterator_getName(struct BPathIterator *bpi)
-{
- return bpi->_name;
-}
-int BLI_bpathIterator_getType(struct BPathIterator *bpi)
-{
- return bpi->type;
-}
-unsigned int BLI_bpathIterator_getPathMaxLen(struct BPathIterator *bpi)
-{
- return bpi->len;
-}
-const char* BLI_bpathIterator_getBasePath(struct BPathIterator *bpi)
-{
- return bpi->base_path;
-}
-/* gets the first or the next image that has a path - not a viewer node or generated image */
-static struct Image *ima_stepdata__internal(struct Image *ima, const int step_next, const int flag)
-{
- if (ima==NULL)
- return NULL;
+ data.basedir= basedir;
+ data.reports= reports;
- if (step_next)
- ima= ima->id.next;
+ bpath_traverse_main(bmain, makeFilesRelative_visit_cb, 0, (void *)&data);
- while (ima) {
- if (ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
- if(ima->packedfile==NULL || (flag & BPATH_USE_PACKED)) {
- break;
- }
- }
- /* image is not a image with a path, skip it */
- ima= ima->id.next;
- }
- return ima;
+ BKE_reportf(reports, data.count_failed ? RPT_WARNING : RPT_INFO,
+ "Total files %d|Changed %d|Failed %d",
+ data.count_tot, data.count_changed, data.count_failed);
}
-static struct Tex *tex_stepdata__internal(struct Tex *tex, const int step_next, const int UNUSED(flag))
+static int makeFilesAbsolute_visit_cb(void *userdata, char *path_dst, const char *path_src)
{
- if (tex==NULL)
- return NULL;
+ BPathRemap_Data *data= (BPathRemap_Data *)userdata;
- if (step_next)
- tex= tex->id.next;
+ data->count_tot++;
- while (tex) {
- if (tex->type == TEX_VOXELDATA && TEX_VD_IS_SOURCE_PATH(tex->vd->file_format))
- break;
- /* image is not a image with a path, skip it */
- tex= tex->id.next;
+ if(strncmp(path_src, "//", 2)!=0) {
+ return FALSE; /* already absolute */
+ }
+ else {
+ strcpy(path_dst, path_src);
+ BLI_path_abs(path_dst, data->basedir);
+ if (strncmp(path_dst, "//", 2)!=0) {
+ data->count_changed++;
+ }
+ else {
+ BKE_reportf(data->reports, RPT_WARNING, "Path cant be made absolute \"%s\"", path_src);
+ data->count_failed++;
+ }
+ return TRUE;
}
- return tex;
}
-static struct Text *text_stepdata__internal(struct Text *text, const int step_next, const int UNUSED(flag))
+/* similar to makeFilesRelative - keep in sync! */
+void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports)
{
- if (text==NULL)
- return NULL;
+ BPathRemap_Data data= {0};
- if (step_next)
- text= text->id.next;
-
- while (text) {
- if (text->name)
- break;
- /* image is not a image with a path, skip it */
- text= text->id.next;
+ if(basedir[0] == '\0') {
+ printf("%s: basedir='', this is a bug\n", __func__);
+ return;
}
- return text;
-}
-
-static struct VFont *vf_stepdata__internal(struct VFont *vf, const int step_next, const int flag)
-{
- if (vf==NULL)
- return NULL;
- if (step_next)
- vf= vf->id.next;
+ data.basedir= basedir;
+ data.reports= reports;
- while (vf) {
- if (strcmp(vf->name, FO_BUILTIN_NAME)!=0) {
- if(vf->packedfile==NULL || (flag & BPATH_USE_PACKED)) {
- break;
- }
- }
+ bpath_traverse_main(bmain, makeFilesAbsolute_visit_cb, 0, (void *)&data);
- /* font with no path, skip it */
- vf= vf->id.next;
- }
- return vf;
+ BKE_reportf(reports, data.count_failed ? RPT_WARNING : RPT_INFO,
+ "Total files %d|Changed %d|Failed %d",
+ data.count_tot, data.count_changed, data.count_failed);
}
-static struct bSound *snd_stepdata__internal(struct bSound *snd, int step_next, const int flag)
+
+/* find this file recursively, use the biggest file so thumbnails dont get used by mistake
+ - dir: subdir to search
+ - filename: set this filename
+ - filesize: filesize for the file
+*/
+#define MAX_RECUR 16
+static int findFileRecursive(char *filename_new, const char *dirname, const char *filename, int *filesize, int *recur_depth)
{
- if (snd==NULL)
- return NULL;
+ /* file searching stuff */
+ DIR *dir;
+ struct dirent *de;
+ struct stat status;
+ char path[FILE_MAX];
+ int size;
- if (step_next)
- snd= snd->id.next;
+ dir= opendir(dirname);
- while (snd) {
- if(snd->packedfile==NULL || (flag & BPATH_USE_PACKED)) {
- break;
- }
+ if (dir==NULL)
+ return 0;
- /* font with no path, skip it */
- snd= snd->id.next;
- }
- return snd;
-}
+ if (*filesize == -1)
+ *filesize= 0; /* dir opened fine */
-static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int step_next)
-{
- Editing *ed;
- Sequence *seq;
+ while ((de= readdir(dir)) != NULL) {
- /* Initializing */
- if (bpi->seqdata.scene==NULL) {
- bpi->seqdata.scene= bpi->bmain->scene.first;
- }
+ if (strcmp(".", de->d_name)==0 || strcmp("..", de->d_name)==0)
+ continue;
- if (step_next) {
- bpi->seqdata.seq++;
- }
+ BLI_join_dirfile(path, sizeof(path), dirname, de->d_name);
- while (bpi->seqdata.scene) {
- ed= seq_give_editing(bpi->seqdata.scene, 0);
- if (ed) {
- if (bpi->seqdata.seqar == NULL) {
- /* allocate the sequencer array */
- seq_array(ed, &bpi->seqdata.seqar, &bpi->seqdata.totseq, 0);
- bpi->seqdata.seq= 0;
- }
+ if (stat(path, &status) != 0)
+ continue; /* cant stat, dont bother with this file, could print debug info here */
- if (bpi->seqdata.seq >= bpi->seqdata.totseq) {
- seq= NULL;
- }
- else {
- seq= bpi->seqdata.seqar[bpi->seqdata.seq];
- while (!SEQ_HAS_PATH(seq) && seq->plugin==NULL) {
- bpi->seqdata.seq++;
- if (bpi->seqdata.seq >= bpi->seqdata.totseq) {
- seq= NULL;
- break;
- }
- seq= bpi->seqdata.seqar[bpi->seqdata.seq];
- }
- }
- if (seq) {
- return seq;
- }
- else {
- /* keep looking through the next scene, reallocate seq array */
- if (bpi->seqdata.seqar) {
- MEM_freeN((void *)bpi->seqdata.seqar);
- bpi->seqdata.seqar= NULL;
+ if (S_ISREG(status.st_mode)) { /* is file */
+ if (strncmp(filename, de->d_name, FILE_MAX)==0) { /* name matches */
+ /* open the file to read its size */
+ size= status.st_size;
+ if ((size > 0) && (size > *filesize)) { /* find the biggest file */
+ *filesize= size;
+ BLI_strncpy(filename_new, path, FILE_MAX);
}
- bpi->seqdata.scene= bpi->seqdata.scene->id.next;
}
}
- else {
- /* no seq data in this scene, next */
- bpi->seqdata.scene= bpi->seqdata.scene->id.next;
+ else if (S_ISDIR(status.st_mode)) { /* is subdir */
+ if (*recur_depth <= MAX_RECUR) {
+ (*recur_depth)++;
+ findFileRecursive(filename_new, path, filename, filesize, recur_depth);
+ (*recur_depth)--;
+ }
}
}
-
- return NULL;
+ closedir(dir);
+ return 1;
}
-static void seq_getpath(struct BPathIterator *bpi, char *path)
+typedef struct BPathFind_Data
{
- Sequence *seq= (Sequence *)bpi->data;
-
-
- path[0]= '\0'; /* incase we cant get the path */
- if (seq==NULL) return;
- if (SEQ_HAS_PATH(seq)) {
- if (ELEM3(seq->type, SEQ_IMAGE, SEQ_MOVIE, SEQ_SOUND)) {
- BLI_strncpy(path, seq->strip->dir, FILE_MAX);
- BLI_add_slash(path); /* incase its missing */
- if (seq->strip->stripdata) { /* should always be true! */
- /* Using the first image is weak for image sequences */
- strcat(path, seq->strip->stripdata->name);
- }
- }
- else {
- /* simple case */
- BLI_strncpy(seq->strip->dir, path, sizeof(seq->strip->dir));
- }
- }
- else if (seq->plugin) {
- BLI_strncpy(seq->plugin->name, path, sizeof(seq->plugin->name));
- }
-}
+ const char *basedir;
+ char searchdir[FILE_MAX];
+ ReportList *reports;
+} BPathFind_Data;
-static void seq_setpath(struct BPathIterator *bpi, const char *path)
+static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char *path_src)
{
- Sequence *seq= (Sequence *)bpi->data;
- if (seq==NULL) return;
+ BPathFind_Data *data= (BPathFind_Data *)userdata;
+ char filename_new[FILE_MAX];
- if (SEQ_HAS_PATH(seq)) {
- if (ELEM3(seq->type, SEQ_IMAGE, SEQ_MOVIE, SEQ_SOUND)) {
- BLI_split_dirfile(path, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir), sizeof(seq->strip->stripdata->name));
- }
- else {
- /* simple case */
- BLI_strncpy(seq->strip->dir, path, sizeof(seq->strip->dir));
- }
+ int filesize= -1;
+ int recur_depth= 0;
+
+ findFileRecursive(filename_new,
+ data->searchdir, BLI_path_basename((char *)path_src),
+ &filesize, &recur_depth);
+
+ if (filesize == -1) { /* could not open dir */
+ BKE_reportf(data->reports, RPT_WARNING,
+ "Could not find \"%s\" in \"%s\"",
+ BLI_path_basename((char *)path_src), data->searchdir);
+ return FALSE;
}
- else if (seq->plugin) {
- BLI_strncpy(seq->plugin->name, path, sizeof(seq->plugin->name));
+ else {
+ strcpy(path_dst, filename_new);
+ return TRUE;
}
}
-static void text_getpath(struct BPathIterator *bpi, char *path)
+void findMissingFiles(Main *bmain, const char *searchpath, ReportList *reports)
{
- Text *text= (Text *)bpi->data;
- path[0]= '\0'; /* incase we cant get the path */
- if(text->name) {
- strcpy(path, text->name);
- }
+ struct BPathFind_Data data= {0};
+
+ data.reports= reports;
+ BLI_split_dir_part(searchpath, data.searchdir, sizeof(data.searchdir));
+
+ bpath_traverse_main(bmain, findMissingFiles_visit_cb, 0, (void *)&data);
}
-static void text_setpath(struct BPathIterator *bpi, const char *path)
+/* Run a visitor on a string, replacing the contents of the string as needed. */
+static int rewrite_path_fixed(char *path, BPathVisitor visit_cb, const char *absbase, void *userdata)
{
- Text *text= (Text *)bpi->data;
- if (text==NULL) return;
+ char path_src_buf[FILE_MAX];
+ const char *path_src;
+ char path_dst[FILE_MAX];
- if(text->name) {
- MEM_freeN(text->name);
+ if (absbase) {
+ BLI_strncpy(path_src_buf, path, sizeof(path_src_buf));
+ BLI_path_abs(path_src_buf, absbase);
+ path_src= path_src_buf;
+ }
+ else {
+ path_src= path;
}
- text->name= BLI_strdup(path);
+ if (visit_cb(userdata, path_dst, path_src)) {
+ BLI_strncpy(path, path_dst, FILE_MAX);
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
}
-static struct Mesh *cdata_stepdata__internal(struct Mesh *me, int step_next)
+static int rewrite_path_fixed_dirfile(char path_dir[FILE_MAXDIR], char path_file[FILE_MAXFILE], BPathVisitor visit_cb, const char *absbase, void *userdata)
{
- if (me==NULL)
- return NULL;
+ char path_src[FILE_MAX];
+ char path_dst[FILE_MAX];
- if (step_next)
- me= me->id.next;
+ BLI_join_dirfile(path_src, sizeof(path_src), path_dir, path_file);
- while (me) {
- if (me->fdata.external) {
- break;
- }
+ if (absbase) {
+ BLI_path_abs(path_src, absbase);
+ }
- me= me->id.next;
+ if (visit_cb(userdata, path_dst, (const char *)path_src)) {
+ BLI_split_dirfile(path_dst, path_dir, path_file, FILE_MAXDIR, FILE_MAXFILE);
+ return TRUE;
+ }
+ else {
+ return FALSE;
}
- return me;
}
-static void bpi_type_step__internal(struct BPathIterator *bpi)
+static int rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *absbase, void *userdata)
{
- bpi->type++; /* advance to the next type */
- bpi->data= NULL;
+ char path_src_buf[FILE_MAX];
+ const char *path_src;
+ char path_dst[FILE_MAX];
- switch (bpi->type) {
- case BPATH_SEQ:
- bpi->getpath_callback= seq_getpath;
- bpi->setpath_callback= seq_setpath;
- break;
- case BPATH_TEXT: /* path is malloc'd */
- bpi->getpath_callback= text_getpath;
- bpi->setpath_callback= text_setpath;
- break;
- default:
- bpi->getpath_callback= NULL;
- bpi->setpath_callback= NULL;
- break;
+ if (absbase) {
+ BLI_strncpy(path_src_buf, *path, sizeof(path_src_buf));
+ BLI_path_abs(path_src_buf, absbase);
+ path_src= path_src_buf;
+ }
+ else {
+ path_src= *path;
+ }
+
+ if (visit_cb(userdata, path_dst, path_src)) {
+ MEM_freeN((*path));
+ (*path)= BLI_strdup(path_dst);
+ return TRUE;
+ }
+ else {
+ return FALSE;
}
}
-void BLI_bpathIterator_step(struct BPathIterator *bpi)
+/* Run visitor function 'visit' on all paths contained in 'id'. */
+void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
{
- while (bpi->type != BPATH_DONE) {
+ Image *ima;
+ const char *absbase= (flag & BPATH_TRAVERSE_ABS) ? (id->lib ? id->lib->filepath : bmain->name) : NULL;
- if ((bpi->type) == BPATH_IMAGE) {
- /*if (bpi->data) bpi->data= ((ID *)bpi->data)->next;*/
- if (bpi->data) bpi->data= ima_stepdata__internal((Image *)bpi->data, 1, bpi->flag); /* must skip images that have no path */
- else bpi->data= ima_stepdata__internal(bpi->bmain->image.first, 0, bpi->flag);
-
- if (bpi->data) {
- /* get the path info from this datatype */
- Image *ima= (Image *)bpi->data;
-
- bpi->_lib= ima->id.lib ? ima->id.lib->filepath : NULL;
- bpi->_path= ima->name;
- bpi->_name= ima->id.name+2;
- bpi->len= sizeof(ima->name);
-
- /* we are done, advancing to the next item, this type worked fine */
- break;
+ if ((flag & BPATH_TRAVERSE_SKIP_LIBRARY) && id->lib) {
+ return;
+ }
+ switch(GS(id->name)) {
+ case ID_IM:
+ ima= (Image *)id;
+ if (ima->packedfile == NULL || (flag & BPATH_TRAVERSE_SKIP_PACKED) == 0) {
+ if (ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+ rewrite_path_fixed(ima->name, visit_cb, absbase, bpath_user_data);
}
- else {
- bpi_type_step__internal(bpi);
+ }
+ break;
+ case ID_BR:
+ {
+ Brush *brush= (Brush *)id;
+ if (brush->icon_filepath[0]) {
+ rewrite_path_fixed(brush->icon_filepath, visit_cb, absbase, bpath_user_data);
}
}
+ break;
+ case ID_OB:
- if ((bpi->type) == BPATH_TEXTURE) {
- /*if (bpi->data) bpi->data= ((ID *)bpi->data)->next;*/
- if (bpi->data) bpi->data= tex_stepdata__internal( (Tex *)bpi->data, 1, bpi->flag); /* must skip images that have no path */
- else bpi->data= tex_stepdata__internal(bpi->bmain->tex.first, 0, bpi->flag);
+#define BPATH_TRAVERSE_POINTCACHE(ptcaches) \
+ { \
+ PointCache *cache; \
+ for(cache= (ptcaches).first; cache; cache= cache->next) { \
+ if(cache->flag & PTCACHE_DISK_CACHE) { \
+ rewrite_path_fixed(cache->path, \
+ visit_cb, \
+ absbase, \
+ bpath_user_data); \
+ } \
+ } \
+ } \
- if (bpi->data) {
- /* get the path info from this datatype */
- Tex *tex= (Tex *)bpi->data;
- if(tex->type == TEX_VOXELDATA) {
- bpi->_lib= tex->id.lib ? tex->id.lib->filepath : NULL;
- bpi->_path= tex->vd->source_path;
- bpi->_name= tex->id.name+2;
- bpi->len= sizeof(tex->vd->source_path);
- }
- else {
- assert(!"Texture has no path, incorrect step 'tex_stepdata__internal'");
- }
+ {
+ Object *ob= (Object *)id;
+ ModifierData *md;
+ ParticleSystem *psys;
- /* we are done, advancing to the next item, this type worked fine */
- break;
+ /* do via modifiers instead */
+#if 0
+ if (ob->fluidsimSettings) {
+ rewrite_path_fixed(ob->fluidsimSettings->surfdataPath, visit_cb, absbase, bpath_user_data);
}
- else {
- bpi_type_step__internal(bpi);
- }
- }
-
- if ((bpi->type) == BPATH_TEXT) {
- /*if (bpi->data) bpi->data= ((ID *)bpi->data)->next;*/
- if (bpi->data) bpi->data= text_stepdata__internal((Text *)bpi->data, 1, bpi->flag); /* must skip images that have no path */
- else bpi->data= text_stepdata__internal(bpi->bmain->text.first, 0, bpi->flag);
-
- if (bpi->data) {
- /* get the path info from this datatype */
- Text *text= (Text *)bpi->data;
-
- bpi->_lib= text->id.lib ? text->id.lib->filepath : NULL;
- bpi->_path= NULL; /* bpi->path= text->name; */ /* get/set functions override. */
- bpi->_name= text->id.name+2;
- bpi->len= FILE_MAX; /* malloc'd but limit anyway since large paths may mess up other areas */
+#endif
- /* we are done, advancing to the next item, this type worked fine */
- break;
+ for (md= ob->modifiers.first; md; md= md->next) {
+ if (md->type == eModifierType_Fluidsim) {
+ FluidsimModifierData *fluidmd= (FluidsimModifierData *)md;
+ if (fluidmd->fss) {
+ rewrite_path_fixed(fluidmd->fss->surfdataPath, visit_cb, absbase, bpath_user_data);
+ }
+ }
+ else if (md->type == eModifierType_Smoke) {
+ SmokeModifierData *smd= (SmokeModifierData *)md;
+ if(smd->type & MOD_SMOKE_TYPE_DOMAIN) {
+ BPATH_TRAVERSE_POINTCACHE(smd->domain->ptcaches[0]);
+ }
+ }
+ else if (md->type==eModifierType_Cloth) {
+ ClothModifierData *clmd= (ClothModifierData*) md;
+ BPATH_TRAVERSE_POINTCACHE(clmd->ptcaches);
+ }
+ }
+ if (ob->soft) {
+ BPATH_TRAVERSE_POINTCACHE(ob->soft->ptcaches);
}
- else {
- bpi_type_step__internal(bpi);
+
+ for (psys= ob->particlesystem.first; psys; psys= psys->next) {
+ BPATH_TRAVERSE_POINTCACHE(psys->ptcaches);
}
}
- else if ((bpi->type) == BPATH_SOUND) {
- if (bpi->data) bpi->data= snd_stepdata__internal((bSound *)bpi->data, 1, bpi->flag); /* must skip images that have no path */
- else bpi->data= snd_stepdata__internal(bpi->bmain->sound.first, 0, bpi->flag);
-
- if (bpi->data) {
- /* get the path info from this datatype */
- bSound *snd= (bSound *)bpi->data;
- bpi->_lib= snd->id.lib ? snd->id.lib->filepath : NULL;
- bpi->_path= snd->name;
- bpi->_name= snd->id.name+2;
- bpi->len= sizeof(snd->name);
+#undef BPATH_TRAVERSE_POINTCACHE
- /* we are done, advancing to the next item, this type worked fine */
- break;
+ break;
+ case ID_SO:
+ {
+ bSound *sound= (bSound *)id;
+ if (sound->packedfile == NULL || (flag & BPATH_TRAVERSE_SKIP_PACKED) == 0) {
+ rewrite_path_fixed(sound->name, visit_cb, absbase, bpath_user_data);
}
- else {
- bpi_type_step__internal(bpi);
+ }
+ break;
+ case ID_TXT:
+ if (((Text*)id)->name) {
+ rewrite_path_alloc(&((Text *)id)->name, visit_cb, absbase, bpath_user_data);
+ }
+ break;
+ case ID_VF:
+ {
+ VFont *vf= (VFont *)id;
+ if (vf->packedfile == NULL || (flag & BPATH_TRAVERSE_SKIP_PACKED) == 0) {
+ if (strcmp(vf->name, FO_BUILTIN_NAME) != 0) {
+ rewrite_path_fixed(((VFont *)id)->name, visit_cb, absbase, bpath_user_data);
+ }
}
}
- else if ((bpi->type) == BPATH_FONT) {
-
- if (bpi->data) bpi->data= vf_stepdata__internal((VFont *)bpi->data, 1, bpi->flag);
- else bpi->data= vf_stepdata__internal(bpi->bmain->vfont.first, 0, bpi->flag);
-
- if (bpi->data) {
- /* get the path info from this datatype */
- VFont *vf= (VFont *)bpi->data;
-
- bpi->_lib= vf->id.lib ? vf->id.lib->filepath : NULL;
- bpi->_path= vf->name;
- bpi->_name= vf->id.name+2;
- bpi->len= sizeof(vf->name);
-
- /* we are done, advancing to the next item, this type worked fine */
- break;
+ break;
+ case ID_TE:
+ {
+ Tex *tex = (Tex *)id;
+ if (tex->plugin) {
+ /* FIXME: rewrite_path assumes path length of FILE_MAX, but
+ tex->plugin->name is 160. ... is this field even a path? */
+ //rewrite_path(tex->plugin->name, visit_cb, bpath_user_data);
}
- else {
- bpi_type_step__internal(bpi);
+ if (tex->type == TEX_VOXELDATA && TEX_VD_IS_SOURCE_PATH(tex->vd->file_format)) {
+ rewrite_path_fixed(tex->vd->source_path, visit_cb, absbase, bpath_user_data);
}
-
}
- else if ((bpi->type) == BPATH_LIB) {
- if (bpi->data) bpi->data= ((ID *)bpi->data)->next;
- else bpi->data= bpi->bmain->library.first;
-
- if (bpi->data) {
- /* get the path info from this datatype */
- Library *lib= (Library *)bpi->data;
+ break;
- bpi->_lib= NULL;
- bpi->_path= lib->name;
- bpi->_name= NULL;
- bpi->len= sizeof(lib->name);
+ case ID_SCE:
+ {
+ Scene *scene= (Scene *)id;
+ if (scene->ed) {
+ Sequence *seq;
+
+ SEQ_BEGIN(scene->ed, seq) {
+ if (SEQ_HAS_PATH(seq)) {
+ if (ELEM(seq->type, SEQ_MOVIE, SEQ_SOUND)) {
+ rewrite_path_fixed_dirfile(seq->strip->dir, seq->strip->stripdata->name, visit_cb, absbase, bpath_user_data);
+ }
+ else if (seq->type == SEQ_IMAGE) {
+ /* might want an option not to loop over all strips */
+ StripElem *se= seq->strip->stripdata;
+ int len= MEM_allocN_len(se) / sizeof(*se);
+ int i;
+
+ if (flag & BPATH_TRAVERSE_SKIP_MULTIFILE) {
+ /* only operate on one path */
+ len= MIN2(1, len);
+ }
+
+ for(i= 0; i < len; i++, se++) {
+ rewrite_path_fixed_dirfile(seq->strip->dir, se->name, visit_cb, absbase, bpath_user_data);
+ }
+ }
+ else {
+ /* simple case */
+ rewrite_path_fixed(seq->strip->dir, visit_cb, absbase, bpath_user_data);
+ }
+ }
+ else if (seq->plugin) {
+ rewrite_path_fixed(seq->plugin->name, visit_cb, absbase, bpath_user_data);
+ }
- /* we are done, advancing to the next item, this type worked fine */
- break;
- }
- else {
- bpi_type_step__internal(bpi);
+ }
+ SEQ_END
}
}
- else if ((bpi->type) == BPATH_SEQ) {
- if (bpi->data) bpi->data= seq_stepdata__internal( bpi, 1 );
- else bpi->data= seq_stepdata__internal( bpi, 0 );
- if (bpi->data) {
- Sequence *seq= (Sequence *)bpi->data;
- bpi->_lib= NULL;
- bpi->_name= seq->name+2;
- bpi->len= seq->plugin ? sizeof(seq->plugin->name) : sizeof(seq->strip->dir) + sizeof(seq->strip->stripdata->name);
- break;
- }
- else {
- bpi_type_step__internal(bpi);
+ break;
+ case ID_ME:
+ {
+ Mesh *me= (Mesh *)id;
+ if (me->fdata.external) {
+ rewrite_path_fixed(me->fdata.external->filename, visit_cb, absbase, bpath_user_data);
}
}
- else if ((bpi->type) == BPATH_CDATA) {
- if (bpi->data) bpi->data= cdata_stepdata__internal( bpi->data, 1 );
- else bpi->data= cdata_stepdata__internal( bpi->bmain->mesh.first, 0 );
-
- if (bpi->data) {
- Mesh *me= (Mesh *)bpi->data;
- bpi->_lib= me->id.lib ? me->id.lib->filepath : NULL;
- bpi->_path= me->fdata.external->filename;
- bpi->_name= me->id.name+2;
- bpi->len= sizeof(me->fdata.external->filename);
- break;
- }
- else {
- bpi_type_step__internal(bpi);
+ break;
+ case ID_LI:
+ {
+ Library *lib= (Library *)id;
+ if(rewrite_path_fixed(lib->name, visit_cb, absbase, bpath_user_data)) {
+ BKE_library_filepath_set(lib, lib->name);
}
}
- }
-}
-
-int BLI_bpathIterator_isDone( struct BPathIterator *bpi)
-{
- return bpi->type==BPATH_DONE;
-}
-
-/* include the path argument */
-static void bpath_as_report(struct BPathIterator *bpi, const char *message, ReportList *reports)
-{
- const char *prefix;
- const char *name;
- char path_expanded[FILE_MAXDIR*2];
-
- if(reports==NULL)
- return;
-
- switch(BLI_bpathIterator_getType(bpi)) {
- case BPATH_IMAGE:
- prefix= "Image";
- break;
- case BPATH_TEXTURE:
- prefix= "Texture";
- break;
- case BPATH_TEXT:
- prefix= "Text";
- break;
- case BPATH_SOUND:
- prefix= "Sound";
- break;
- case BPATH_FONT:
- prefix= "Font";
- break;
- case BPATH_LIB:
- prefix= "Library";
- break;
- case BPATH_SEQ:
- prefix= "Sequence";
- break;
- case BPATH_CDATA:
- prefix= "Mesh Data";
break;
default:
- prefix= "Unknown";
+ /* Nothing to do for other IDs that don't contain file paths. */
break;
}
-
- name= BLI_bpathIterator_getName(bpi);
- BLI_bpathIterator_getPathExpanded(bpi, path_expanded);
-
- if(reports) {
- if (name) BKE_reportf(reports, RPT_WARNING, "%s \"%s\", \"%s\": %s", prefix, name, path_expanded, message);
- else BKE_reportf(reports, RPT_WARNING, "%s \"%s\": %s", prefix, path_expanded, message);
- }
-
}
-/* high level function */
-void checkMissingFiles(Main *bmain, ReportList *reports)
+void bpath_traverse_id_list(Main *bmain, ListBase *lb, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
{
- struct BPathIterator *bpi;
-
- /* be sure there is low chance of the path being too short */
- char filepath_expanded[FILE_MAXDIR*2];
-
- BLI_bpathIterator_init(&bpi, bmain, bmain->name, 0);
- while (!BLI_bpathIterator_isDone(bpi)) {
- BLI_bpathIterator_getPathExpanded(bpi, filepath_expanded);
-
- if (!BLI_exists(filepath_expanded))
- bpath_as_report(bpi, "file not found", reports);
-
- BLI_bpathIterator_step(bpi);
+ ID *id;
+ for(id= lb->first; id; id= id->next) {
+ bpath_traverse_id(bmain, id, visit_cb, flag, bpath_user_data);
}
- BLI_bpathIterator_free(bpi);
}
-/* dont log any errors at the moment, should probably do this */
-void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports)
+void bpath_traverse_main(Main *bmain, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
{
- int tot= 0, changed= 0, failed= 0, linked= 0;
- struct BPathIterator *bpi;
- char filepath[FILE_MAX];
- const char *libpath;
-
- /* be sure there is low chance of the path being too short */
- char filepath_relative[(FILE_MAXDIR * 2) + FILE_MAXFILE];
-
- if(basedir[0] == '\0') {
- printf("makeFilesRelative: basedir='', this is a bug\n");
- return;
- }
-
- BLI_bpathIterator_init(&bpi, bmain, basedir, 0);
- while (!BLI_bpathIterator_isDone(bpi)) {
- BLI_bpathIterator_getPath(bpi, filepath);
- libpath= BLI_bpathIterator_getLib(bpi);
-
- if(strncmp(filepath, "//", 2)) {
- if (libpath) { /* cant make relative if we are library - TODO, LOG THIS */
- linked++;
- }
- else { /* local data, use the blend files path */
- BLI_strncpy(filepath_relative, filepath, sizeof(filepath_relative));
- /* Important BLI_cleanup_dir runs before the path is made relative
- * because it wont work for paths that start with "//../" */
- BLI_cleanup_file(bpi->base_path, filepath_relative); /* fix any /foo/../foo/ */
- BLI_path_rel(filepath_relative, bpi->base_path);
- /* be safe and check the length */
- if (BLI_bpathIterator_getPathMaxLen(bpi) <= strlen(filepath_relative)) {
- bpath_as_report(bpi, "couldn't make path relative (too long)", reports);
- failed++;
- }
- else {
- if(strncmp(filepath_relative, "//", 2)==0) {
- BLI_bpathIterator_setPath(bpi, filepath_relative);
- changed++;
- }
- else {
- bpath_as_report(bpi, "couldn't make path relative", reports);
- failed++;
- }
- }
- }
- }
- BLI_bpathIterator_step(bpi);
- tot++;
- }
- BLI_bpathIterator_free(bpi);
-
- if(reports)
- BKE_reportf(reports, failed ? RPT_ERROR : RPT_INFO, "Total files %i|Changed %i|Failed %i|Linked %i", tot, changed, failed, linked);
+ ListBase *lbarray[MAX_LIBARRAY];
+ int a= set_listbasepointers(bmain, lbarray);
+ while(a--) bpath_traverse_id_list(bmain, lbarray[a], visit_cb, flag, bpath_user_data);
}
-/* dont log any errors at the moment, should probably do this -
- * Verry similar to makeFilesRelative - keep in sync! */
-void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports)
+/* Rewrites a relative path to be relative to the main file - unless the path is
+ absolute, in which case it is not altered. */
+int bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *path_src)
{
- int tot= 0, changed= 0, failed= 0, linked= 0;
-
- struct BPathIterator *bpi;
- char filepath[FILE_MAX];
- const char *libpath;
-
/* be sure there is low chance of the path being too short */
- char filepath_absolute[(FILE_MAXDIR * 2) + FILE_MAXFILE];
-
- if(basedir[0] == '\0') {
- printf("makeFilesAbsolute: basedir='', this is a bug\n");
- return;
+ char filepath[(FILE_MAXDIR * 2) + FILE_MAXFILE];
+ const char *base_new= ((char **)pathbase_v)[0];
+ const char *base_old= ((char **)pathbase_v)[1];
+
+ if (strncmp(base_old, "//", 2) == 0) {
+ printf("%s: error, old base path '%s' is not absolute.\n",
+ __func__, base_old);
+ return FALSE;
+ }
+
+ /* Make referenced file absolute. This would be a side-effect of
+ BLI_cleanup_file, but we do it explicitely so we know if it changed. */
+ BLI_strncpy(filepath, path_src, FILE_MAX);
+ if (BLI_path_abs(filepath, base_old)) {
+ /* Path was relative and is now absolute. Remap.
+ * Important BLI_cleanup_dir runs before the path is made relative
+ * because it wont work for paths that start with "//../" */
+ BLI_cleanup_file(base_new, filepath);
+ BLI_path_rel(filepath, base_new);
+ BLI_strncpy(path_dst, filepath, FILE_MAX);
+ return TRUE;
}
-
- BLI_bpathIterator_init(&bpi, bmain, basedir, 0);
- while (!BLI_bpathIterator_isDone(bpi)) {
- BLI_bpathIterator_getPath(bpi, filepath);
- libpath= BLI_bpathIterator_getLib(bpi);
-
- if(strncmp(filepath, "//", 2)==0) {
- if (libpath) { /* cant make absolute if we are library - TODO, LOG THIS */
- linked++;
- }
- else { /* get the expanded path and check it is relative or too long */
- BLI_bpathIterator_getPathExpanded(bpi, filepath_absolute);
- BLI_cleanup_file(bpi->base_path, filepath_absolute); /* fix any /foo/../foo/ */
- /* to be safe, check the length */
- if (BLI_bpathIterator_getPathMaxLen(bpi) <= strlen(filepath_absolute)) {
- bpath_as_report(bpi, "couldn't make absolute (too long)", reports);
- failed++;
- }
- else {
- if(strncmp(filepath_absolute, "//", 2)) {
- BLI_bpathIterator_setPath(bpi, filepath_absolute);
- changed++;
- }
- else {
- bpath_as_report(bpi, "couldn't make absolute", reports);
- failed++;
- }
- }
- }
- }
- BLI_bpathIterator_step(bpi);
- tot++;
- }
- BLI_bpathIterator_free(bpi);
-
- if(reports)
- BKE_reportf(reports, failed ? RPT_ERROR : RPT_INFO, "Total files %i|Changed %i|Failed %i|Linked %i", tot, changed, failed, linked);
-}
-
-
-/* find this file recursively, use the biggest file so thumbnails dont get used by mistake
- - dir: subdir to search
- - filename: set this filename
- - filesize: filesize for the file
-*/
-#define MAX_RECUR 16
-static int findFileRecursive(char *filename_new, const char *dirname, const char *filename, int *filesize, int *recur_depth)
-{
- /* file searching stuff */
- DIR *dir;
- struct dirent *de;
- struct stat status;
- char path[FILE_MAX];
- int size;
-
- dir= opendir(dirname);
-
- if (dir==NULL)
- return 0;
-
- if (*filesize == -1)
- *filesize= 0; /* dir opened fine */
-
- while ((de= readdir(dir)) != NULL) {
-
- if (strcmp(".", de->d_name)==0 || strcmp("..", de->d_name)==0)
- continue;
-
- BLI_join_dirfile(path, sizeof(path), dirname, de->d_name);
-
- if (stat(path, &status) != 0)
- continue; /* cant stat, dont bother with this file, could print debug info here */
-
- if (S_ISREG(status.st_mode)) { /* is file */
- if (strncmp(filename, de->d_name, FILE_MAX)==0) { /* name matches */
- /* open the file to read its size */
- size= status.st_size;
- if ((size > 0) && (size > *filesize)) { /* find the biggest file */
- *filesize= size;
- BLI_strncpy(filename_new, path, FILE_MAX);
- }
- }
- }
- else if (S_ISDIR(status.st_mode)) { /* is subdir */
- if (*recur_depth <= MAX_RECUR) {
- (*recur_depth)++;
- findFileRecursive(filename_new, path, filename, filesize, recur_depth);
- (*recur_depth)--;
- }
- }
- }
- closedir(dir);
- return 1;
-}
-
-/* high level function - call from fileselector */
-void findMissingFiles(Main *bmain, const char *str)
-{
- struct BPathIterator *bpi;
-
- /* be sure there is low chance of the path being too short */
- char filepath_expanded[FILE_MAXDIR*2];
- char filepath[FILE_MAX];
- const char *libpath;
- int filesize, recur_depth;
-
- char dirname[FILE_MAX], filename_new[FILE_MAX];
-
- //XXX waitcursor( 1 );
-
- BLI_split_dir_part(str, dirname, sizeof(dirname));
-
- BLI_bpathIterator_init(&bpi, bmain, bmain->name, 0);
-
- while (!BLI_bpathIterator_isDone(bpi)) {
- BLI_bpathIterator_getPath(bpi, filepath);
- libpath= BLI_bpathIterator_getLib(bpi);
-
- /* Check if esc was pressed because searching files can be slow */
- /*XXX if (blender_test_break()) {
- break;
- }*/
-
- if (libpath==NULL) {
-
- BLI_bpathIterator_getPathExpanded(bpi, filepath_expanded);
-
- if (!BLI_exists(filepath_expanded)) {
- /* can the dir be opened? */
- filesize= -1;
- recur_depth= 0;
-
- findFileRecursive(filename_new, dirname, BLI_path_basename(filepath), &filesize, &recur_depth);
- if (filesize == -1) { /* could not open dir */
- printf("Could not open dir \"%s\"\n", dirname);
- return;
- }
-
- if (filesize > 0) {
-
- if (BLI_bpathIterator_getPathMaxLen(bpi) < strlen(filename_new)) {
- printf("cannot set path \"%s\" too long!", filename_new);
- }
- else {
- /* copy the found path into the old one */
- if (G.relbase_valid)
- BLI_path_rel(filename_new, bpi->base_path);
-
- BLI_bpathIterator_setPath(bpi, filename_new);
- }
- }
- }
- }
- BLI_bpathIterator_step(bpi);
+ else {
+ /* Path was not relative to begin with. */
+ return FALSE;
}
- BLI_bpathIterator_free(bpi);
-
- //XXX waitcursor( 0 );
}
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 51d12f5430e..0ca8b72c1e3 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -53,7 +53,7 @@ void unit_qt(float q[4])
q[1]= q[2]= q[3]= 0.0f;
}
-void copy_qt_qt(float *q1, const float *q2)
+void copy_qt_qt(float q1[4], const float q2[4])
{
q1[0]= q2[0];
q1[1]= q2[1];
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index bc24415fd3f..bbb62db58f2 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -1397,22 +1397,51 @@ int BLI_testextensie_glob(const char *str, const char *ext_fnmatch)
int BLI_replace_extension(char *path, size_t maxlen, const char *ext)
{
+ size_t path_len= strlen(path);
+ size_t ext_len= strlen(ext);
size_t a;
- for(a=strlen(path); a>0; a--) {
- if(path[a-1] == '.' || path[a-1] == '/' || path[a-1] == '\\') {
- a--;
+ for(a= path_len - 1; a >= 0; a--) {
+ if (ELEM3(path[a], '.', '/', '\\')) {
break;
}
}
-
- if(path[a] != '.')
- a= strlen(path);
- if(a + strlen(ext) >= maxlen)
+ if(a + ext_len >= maxlen)
+ return 0;
+
+ memcpy(path+a, ext, ext_len + 1);
+ return 1;
+}
+
+/* strip's trailing '.'s and adds the extension only when needed */
+int BLI_ensure_extension(char *path, size_t maxlen, const char *ext)
+{
+ size_t path_len= strlen(path);
+ size_t ext_len= strlen(ext);
+ size_t a;
+
+ /* first check the extension is alread there */
+ if ( (ext_len <= path_len) &&
+ (strcmp(path + (path_len - ext_len), ext) == 0))
+ {
+ return 1;
+ }
+
+ for(a= path_len - 1; a >= 0; a--) {
+ if (path[a] == '.') {
+ path[a]= '\0';
+ }
+ else {
+ break;
+ }
+ }
+ a++;
+
+ if(a + ext_len >= maxlen)
return 0;
- strcpy(path+a, ext);
+ memcpy(path+a, ext, ext_len + 1);
return 1;
}
@@ -1844,7 +1873,7 @@ void BLI_where_is_temp(char *fullname, const size_t maxlen, char *userdir)
/* add a trailing slash if needed */
BLI_add_slash(fullname);
#ifdef WIN32
- if(userdir != fullname) {
+ if(userdir && userdir != fullname) {
BLI_strncpy(userdir, fullname, maxlen); /* also set user pref to show %TEMP%. /tmp/ is just plain confusing for Windows users. */
}
#endif
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
index a9c28be6663..f8cdc3ec873 100644
--- a/source/blender/blenlib/intern/string_utf8.c
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -319,6 +319,8 @@ int BLI_str_utf8_size(const char *p)
UTF8_COMPUTE (c, mask, len);
+ (void)mask; /* quiet warning */
+
return len;
}
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index c049ab85546..7b156a3ac52 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -113,6 +113,7 @@ static pthread_mutex_t _viewer_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t _custom1_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t _rcache_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t _opengl_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t _nodes_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_t mainid;
static int thread_levels= 0; /* threads can be invoked inside threads */
@@ -347,6 +348,8 @@ void BLI_lock_thread(int type)
pthread_mutex_lock(&_rcache_lock);
else if (type==LOCK_OPENGL)
pthread_mutex_lock(&_opengl_lock);
+ else if (type==LOCK_NODES)
+ pthread_mutex_lock(&_nodes_lock);
}
void BLI_unlock_thread(int type)
@@ -363,6 +366,8 @@ void BLI_unlock_thread(int type)
pthread_mutex_unlock(&_rcache_lock);
else if(type==LOCK_OPENGL)
pthread_mutex_unlock(&_opengl_lock);
+ else if(type==LOCK_NODES)
+ pthread_mutex_unlock(&_nodes_lock);
}
/* Mutex Locks */
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index 1777979c3ab..38925ea5238 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -44,7 +44,6 @@ struct MemFile;
struct ReportList;
struct Scene;
struct SpaceFile;
-struct SpaceImaSel;
struct UserDef;
struct bContext;
struct BHead;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 5b0c52ebf6e..5c59ae20c7b 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3538,6 +3538,9 @@ static void lib_link_mtface(FileData *fd, Mesh *me, MTFace *mtface, int totface)
MTFace *tf= mtface;
int i;
+ /* Add pseudo-references (not fake users!) to images used by texface. A
+ little bogus; it would be better if each mesh consistently added one ref
+ to each image it used. - z0r */
for (i=0; i<totface; i++, tf++) {
tf->tpage= newlibadr(fd, me->id.lib, tf->tpage);
if(tf->tpage && tf->tpage->id.us==0)
@@ -5036,15 +5039,6 @@ static void lib_link_screen(FileData *fd, Main *main)
sfile->folders_prev= NULL;
sfile->folders_next= NULL;
}
- else if(sl->spacetype==SPACE_IMASEL) {
- SpaceImaSel *simasel= (SpaceImaSel *)sl;
-
- simasel->files = NULL;
- simasel->returnfunc= NULL;
- simasel->menup= NULL;
- simasel->pupmenu= NULL;
- simasel->img= NULL;
- }
else if(sl->spacetype==SPACE_ACTION) {
SpaceAction *saction= (SpaceAction *)sl;
bDopeSheet *ads= &saction->ads;
@@ -5108,11 +5102,6 @@ static void lib_link_screen(FileData *fd, Main *main)
}
}
}
- else if(sl->spacetype==SPACE_SOUND) {
- SpaceSound *ssound= (SpaceSound *)sl;
-
- ssound->sound= newlibadr_us(fd, sc->id.lib, ssound->sound);
- }
else if(sl->spacetype==SPACE_NODE) {
SpaceNode *snode= (SpaceNode *)sl;
@@ -5283,12 +5272,6 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
SpaceFile *sfile= (SpaceFile *)sl;
sfile->op= NULL;
}
- else if(sl->spacetype==SPACE_IMASEL) {
- SpaceImaSel *simasel= (SpaceImaSel *)sl;
- if (simasel->files) {
- //XXX BIF_filelist_freelib(simasel->files);
- }
- }
else if(sl->spacetype==SPACE_ACTION) {
SpaceAction *saction= (SpaceAction *)sl;
@@ -5355,11 +5338,6 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
}
}
}
- else if(sl->spacetype==SPACE_SOUND) {
- SpaceSound *ssound= (SpaceSound *)sl;
-
- ssound->sound= restore_pointer_by_name(newmain, (ID *)ssound->sound, 1);
- }
else if(sl->spacetype==SPACE_NODE) {
SpaceNode *snode= (SpaceNode *)sl;
@@ -5443,8 +5421,8 @@ static void view3d_split_250(View3D *v3d, ListBase *regions)
rv3d->persp= v3d->persp;
rv3d->view= v3d->view;
rv3d->dist= v3d->dist;
- VECCOPY(rv3d->ofs, v3d->ofs);
- QUATCOPY(rv3d->viewquat, v3d->viewquat);
+ copy_v3_v3(rv3d->ofs, v3d->ofs);
+ copy_qt_qt(rv3d->viewquat, v3d->viewquat);
}
}
@@ -6753,16 +6731,6 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
//ar->v2d.flag |= V2D_IS_INITIALISED;
break;
}
- case SPACE_SOUND:
- {
- SpaceSound *ssound= (SpaceSound *)sl;
- memcpy(&ar->v2d, &ssound->v2d, sizeof(View2D));
-
- ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
- ar->v2d.scroll |= (V2D_SCROLL_LEFT);
- //ar->v2d.flag |= V2D_IS_INITIALISED;
- break;
- }
case SPACE_NLA:
{
SpaceNla *snla= (SpaceNla *)sl;
@@ -6878,11 +6846,17 @@ static void do_versions_windowmanager_2_50(bScreen *screen)
area_add_window_regions(sa, sa->spacedata.first, &sa->regionbase);
- /* space imageselect is depricated */
+ /* space imageselect is deprecated */
for(sl= sa->spacedata.first; sl; sl= sl->next) {
if(sl->spacetype==SPACE_IMASEL)
- sl->spacetype= SPACE_INFO; /* spacedata then matches */
- }
+ sl->spacetype= SPACE_EMPTY; /* spacedata then matches */
+ }
+
+ /* space sound is deprecated */
+ for(sl= sa->spacedata.first; sl; sl= sl->next) {
+ if(sl->spacetype==SPACE_SOUND)
+ sl->spacetype= SPACE_EMPTY; /* spacedata then matches */
+ }
/* it seems to be possible in 2.5 to have this saved, filewindow probably */
sa->butspacetype= sa->spacetype;
@@ -9309,7 +9283,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
if(main->versionfile <= 245) {
Scene *sce;
- bScreen *sc;
Object *ob;
Image *ima;
Lamp *la;
@@ -9399,49 +9372,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for(ima= main->image.first; ima; ima= ima->id.next) {
ima->preview = NULL;
}
-
- /* repair imasel space - completely reworked */
- for(sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
- sa= sc->areabase.first;
- while(sa) {
- SpaceLink *sl;
-
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_IMASEL) {
- SpaceImaSel *simasel= (SpaceImaSel*) sl;
- simasel->blockscale= 0.7f;
- /* view 2D */
- simasel->v2d.tot.xmin= -10.0f;
- simasel->v2d.tot.ymin= -10.0f;
- simasel->v2d.tot.xmax= (float)sa->winx + 10.0f;
- simasel->v2d.tot.ymax= (float)sa->winy + 10.0f;
- simasel->v2d.cur.xmin= 0.0f;
- simasel->v2d.cur.ymin= 0.0f;
- simasel->v2d.cur.xmax= (float)sa->winx;
- simasel->v2d.cur.ymax= (float)sa->winy;
- simasel->v2d.min[0]= 1.0;
- simasel->v2d.min[1]= 1.0;
- simasel->v2d.max[0]= 32000.0f;
- simasel->v2d.max[1]= 32000.0f;
- simasel->v2d.minzoom= 0.5f;
- simasel->v2d.maxzoom= 1.21f;
- simasel->v2d.scroll= 0;
- simasel->v2d.keepzoom= V2D_LIMITZOOM|V2D_KEEPASPECT;
- simasel->v2d.keeptot= 0;
- simasel->prv_h = 96;
- simasel->prv_w = 96;
- simasel->flag = 7; /* ??? elubie */
- BLI_strncpy (simasel->dir, U.textudir, sizeof(simasel->dir)); /* TON */
- simasel->file[0]= '\0';
-
- simasel->returnfunc = NULL;
- simasel->title[0] = 0;
- }
- }
- sa = sa->next;
- }
- }
}
/* add point caches */
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 08ccc709266..1e0ef4a6a16 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2217,10 +2217,6 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
if(sima->cumap)
write_curvemapping(wd, sima->cumap);
}
- else if(sl->spacetype==SPACE_IMASEL) {
- // XXX: depreceated... do we still want to keep this?
- writestruct(wd, DATA, "SpaceImaSel", 1, sl);
- }
else if(sl->spacetype==SPACE_TEXT) {
writestruct(wd, DATA, "SpaceText", 1, sl);
}
@@ -2232,9 +2228,6 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
else if(sl->spacetype==SPACE_ACTION) {
writestruct(wd, DATA, "SpaceAction", 1, sl);
}
- else if(sl->spacetype==SPACE_SOUND) {
- writestruct(wd, DATA, "SpaceSound", 1, sl);
- }
else if(sl->spacetype==SPACE_NLA){
SpaceNla *snla= (SpaceNla *)sl;
@@ -2276,7 +2269,7 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
static void write_libraries(WriteData *wd, Main *main)
{
- ListBase *lbarray[30];
+ ListBase *lbarray[MAX_LIBARRAY];
ID *id;
int a, tot, foundone;
diff --git a/source/blender/blenpluginapi/intern/pluginapi.c b/source/blender/blenpluginapi/intern/pluginapi.c
index 67d404899b2..b6bd15fd1c3 100644
--- a/source/blender/blenpluginapi/intern/pluginapi.c
+++ b/source/blender/blenpluginapi/intern/pluginapi.c
@@ -130,7 +130,7 @@ LIBEXPORT short saveiff(struct ImBuf *ib,
LIBEXPORT struct ImBuf *loadifffile(int a,
int b)
{
- return IMB_loadifffile(a, b);
+ return IMB_loadifffile(a, b, "loadifffile");
}
LIBEXPORT struct ImBuf *loadiffname(char *n,
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index 219cf47d857..7e9634da21d 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -567,7 +567,7 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin)
// is a child of a node (not joint), root should be true since
// this is where we build armature bones from
-void ArmatureImporter::set_pose ( Object * ob_arm , COLLADAFW::Node * root_node , char *parentname, float parent_mat[][4])
+void ArmatureImporter::set_pose ( Object * ob_arm , COLLADAFW::Node * root_node , const char *parentname, float parent_mat[][4])
{
char * bone_name = (char *) bc_get_joint_name ( root_node);
float mat[4][4];
diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h
index cc8c3de57f0..d2e3b8be4f5 100644
--- a/source/blender/collada/ArmatureImporter.h
+++ b/source/blender/collada/ArmatureImporter.h
@@ -113,7 +113,7 @@ private:
void fix_leaf_bones();
- void set_pose ( Object * ob_arm , COLLADAFW::Node * root_node ,char * parentname, float parent_mat[][4]);
+ void set_pose ( Object * ob_arm , COLLADAFW::Node * root_node , const char *parentname, float parent_mat[][4]);
#if 0
diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt
index 16c0d4a2c79..7b7d11bd487 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -46,7 +46,6 @@ if(WITH_BLENDER)
add_subdirectory(space_outliner)
add_subdirectory(space_script)
add_subdirectory(space_sequencer)
- add_subdirectory(space_sound)
add_subdirectory(space_text)
add_subdirectory(space_time)
add_subdirectory(space_userpref)
diff --git a/source/blender/editors/SConscript b/source/blender/editors/SConscript
index e8159bdf03f..a1b766ec2be 100644
--- a/source/blender/editors/SConscript
+++ b/source/blender/editors/SConscript
@@ -25,7 +25,6 @@ SConscript(['datafiles/SConscript',
'space_outliner/SConscript',
'space_time/SConscript',
'space_view3d/SConscript',
- 'space_sound/SConscript',
'space_action/SConscript',
'space_nla/SConscript',
'space_script/SConscript',
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 5345fcd756d..4a359acabd9 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -777,7 +777,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
fac= ((float)(evt->x - mm->firstx)*dx);
- if (ELEM(mm->slink->spacetype, SPACE_TIME, SPACE_SOUND))
+ if (mm->slink->spacetype == SPACE_TIME)
apply_keyb_grid(evt->shift, evt->ctrl, &fac, 0.0, FPS, 0.1*FPS, 0);
else
apply_keyb_grid(evt->shift, evt->ctrl, &fac, 0.0, 1.0, 0.1, 0 /*was: U.flag & USER_AUTOGRABGRID*/);
@@ -796,7 +796,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
if (totmark==1) {
/* we print current marker value */
- if (ELEM(mm->slink->spacetype, SPACE_TIME, SPACE_SOUND)) {
+ if (mm->slink->spacetype == SPACE_TIME) {
SpaceTime *stime= (SpaceTime *)mm->slink;
if (stime->flag & TIME_DRAWFRAMES)
BLI_snprintf(str, sizeof(str), "Marker %d offset %d", selmarker->frame, offs);
@@ -816,7 +816,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
}
else {
/* we only print the offset */
- if (ELEM(mm->slink->spacetype, SPACE_TIME, SPACE_SOUND)) {
+ if (mm->slink->spacetype == SPACE_TIME) {
SpaceTime *stime= (SpaceTime *)mm->slink;
if (stime->flag & TIME_DRAWFRAMES)
BLI_snprintf(str, sizeof(str), "Marker offset %d ", offs);
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index 0f4546968ba..732f84bb33d 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -757,7 +757,9 @@ EnumPropertyItem keyframe_paste_merge_items[] = {
{0, NULL, 0, NULL, NULL}};
-/* This function pastes data from the keyframes copy/paste buffer */
+/* This function pastes data from the keyframes copy/paste buffer
+ * > return status code is whether the method FAILED to do anything
+ */
short paste_animedit_keys (bAnimContext *ac, ListBase *anim_data,
const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode)
{
@@ -773,17 +775,17 @@ short paste_animedit_keys (bAnimContext *ac, ListBase *anim_data,
/* check if buffer is empty */
if (animcopybuf.first == NULL) {
- BKE_report(ac->reports, RPT_WARNING, "No data in buffer to paste");
+ BKE_report(ac->reports, RPT_ERROR, "No animation data in buffer to paste");
return -1;
}
if (anim_data->first == NULL) {
- BKE_report(ac->reports, RPT_WARNING, "No FCurves to paste into");
+ BKE_report(ac->reports, RPT_ERROR, "No selected F-Curves to paste into");
return -1;
}
/* mathods of offset */
- switch(offset_mode) {
+ switch (offset_mode) {
case KEYFRAME_PASTE_OFFSET_CFRA_START:
offset= (float)(CFRA - animcopy_firstframe);
break;
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index 95324554a06..3b65e777200 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -731,10 +731,10 @@ EnumPropertyItem *ANIM_keying_sets_enum_itemf (bContext *C, PointerRNA *UNUSED(p
* - these are listed in the order in which they were defined for the active scene
*/
if (scene->keyingsets.first) {
- for (ks= scene->keyingsets.first; ks; ks= ks->next) {
+ for (ks= scene->keyingsets.first; ks; ks= ks->next, i++) {
if (ANIM_keyingset_context_ok_poll(C, ks)) {
item_tmp.identifier= item_tmp.name= ks->name;
- item_tmp.value= i++;
+ item_tmp.value= i;
RNA_enum_item_add(&item, &totitem, &item_tmp);
}
}
@@ -745,11 +745,11 @@ EnumPropertyItem *ANIM_keying_sets_enum_itemf (bContext *C, PointerRNA *UNUSED(p
/* builtin Keying Sets */
i= -1;
- for (ks= builtin_keyingsets.first; ks; ks= ks->next) {
+ for (ks= builtin_keyingsets.first; ks; ks= ks->next, i--) {
/* only show KeyingSet if context is suitable */
if (ANIM_keyingset_context_ok_poll(C, ks)) {
item_tmp.identifier= item_tmp.name= ks->name;
- item_tmp.value= i--;
+ item_tmp.value= i;
RNA_enum_item_add(&item, &totitem, &item_tmp);
}
}
diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c
index 0497c0507dc..efc8ffe4c7d 100644
--- a/source/blender/editors/armature/poseSlide.c
+++ b/source/blender/editors/armature/poseSlide.c
@@ -421,7 +421,7 @@ static void pose_slide_apply_quat (tPoseSlideOp *pso, tPChanFCurveLink *pfl)
sub_qt_qtqt(quat_diff, pchan->quat, quat_prev);
/* make a copy of the original rotation */
- QUATCOPY(quat_orig, pchan->quat);
+ copy_qt_qt(quat_orig, pchan->quat);
/* increase the original by the delta transform, by an amount determined by percentage */
add_qt_qtqt(pchan->quat, quat_orig, quat_diff, pso->percentage);
@@ -436,7 +436,7 @@ static void pose_slide_apply_quat (tPoseSlideOp *pso, tPChanFCurveLink *pfl)
interp_qt_qtqt(quat_interp, quat_prev, quat_next, (cframe-pso->prevFrame) / (pso->nextFrame-pso->prevFrame) );
/* make a copy of the original rotation */
- QUATCOPY(quat_orig, pchan->quat);
+ copy_qt_qt(quat_orig, pchan->quat);
/* tricky interpolations - blending between original and new */
interp_qt_qtqt(pchan->quat, quat_orig, quat_interp, 1.0f/6.0f);
diff --git a/source/blender/editors/armature/poseUtils.c b/source/blender/editors/armature/poseUtils.c
index 5c98fdc08bd..71cdda7fe15 100644
--- a/source/blender/editors/armature/poseUtils.c
+++ b/source/blender/editors/armature/poseUtils.c
@@ -111,11 +111,11 @@ static void fcurves_to_pchan_links_get (ListBase *pfLinks, Object *ob, bAction *
pchan->flag |= POSE_SIZE;
/* store current transforms */
- VECCOPY(pfl->oldloc, pchan->loc);
- VECCOPY(pfl->oldrot, pchan->eul);
- VECCOPY(pfl->oldscale, pchan->size);
- QUATCOPY(pfl->oldquat, pchan->quat);
- VECCOPY(pfl->oldaxis, pchan->rotAxis);
+ copy_v3_v3(pfl->oldloc, pchan->loc);
+ copy_v3_v3(pfl->oldrot, pchan->eul);
+ copy_v3_v3(pfl->oldscale, pchan->size);
+ copy_qt_qt(pfl->oldquat, pchan->quat);
+ copy_v3_v3(pfl->oldaxis, pchan->rotAxis);
pfl->oldangle = pchan->rotAngle;
/* make copy of custom properties */
@@ -205,11 +205,11 @@ void poseAnim_mapping_reset (ListBase *pfLinks)
bPoseChannel *pchan= pfl->pchan;
/* just copy all the values over regardless of whether they changed or not */
- VECCOPY(pchan->loc, pfl->oldloc);
- VECCOPY(pchan->eul, pfl->oldrot);
- VECCOPY(pchan->size, pfl->oldscale);
- QUATCOPY(pchan->quat, pfl->oldquat);
- VECCOPY(pchan->rotAxis, pfl->oldaxis);
+ copy_v3_v3(pchan->loc, pfl->oldloc);
+ copy_v3_v3(pchan->eul, pfl->oldrot);
+ copy_v3_v3(pchan->size, pfl->oldscale);
+ copy_qt_qt(pchan->quat, pfl->oldquat);
+ copy_v3_v3(pchan->rotAxis, pfl->oldaxis);
pchan->rotAngle = pfl->oldangle;
/* just overwrite values of properties from the stored copies (there should be some) */
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index beae9c12bfe..e89674e8a37 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -783,14 +783,14 @@ static void pose_copy_menu(Scene *scene)
{
switch (nr) {
case 1: /* Local Location */
- VECCOPY(pchan->loc, pchanact->loc);
+ copy_v3_v3(pchan->loc, pchanact->loc);
break;
case 2: /* Local Rotation */
- QUATCOPY(pchan->quat, pchanact->quat);
- VECCOPY(pchan->eul, pchanact->eul);
+ copy_qt_qt(pchan->quat, pchanact->quat);
+ copy_v3_v3(pchan->eul, pchanact->eul);
break;
case 3: /* Local Size */
- VECCOPY(pchan->size, pchanact->size);
+ copy_v3_v3(pchan->size, pchanact->size);
break;
case 4: /* All Constraints */
{
@@ -822,9 +822,9 @@ static void pose_copy_menu(Scene *scene)
case 7: /* IK (DOF) settings */
{
pchan->ikflag = pchanact->ikflag;
- VECCOPY(pchan->limitmin, pchanact->limitmin);
- VECCOPY(pchan->limitmax, pchanact->limitmax);
- VECCOPY(pchan->stiffness, pchanact->stiffness);
+ copy_v3_v3(pchan->limitmin, pchanact->limitmin);
+ copy_v3_v3(pchan->limitmax, pchanact->limitmax);
+ copy_v3_v3(pchan->stiffness, pchanact->stiffness);
pchan->ikstretch= pchanact->ikstretch;
pchan->ikrotweight= pchanact->ikrotweight;
pchan->iklinweight= pchanact->iklinweight;
@@ -861,7 +861,7 @@ static void pose_copy_menu(Scene *scene)
armature_mat_pose_to_bone(pchan, pchanact->pose_mat, delta_mat);
mat4_to_size( size,delta_mat);
- VECCOPY(pchan->size, size);
+ copy_v3_v3(pchan->size, size);
}
}
}
@@ -1014,22 +1014,22 @@ static bPoseChannel *pose_bone_do_paste (Object *ob, bPoseChannel *chan, short s
/* only loc rot size
* - only copies transform info for the pose
*/
- VECCOPY(pchan->loc, chan->loc);
- VECCOPY(pchan->size, chan->size);
+ copy_v3_v3(pchan->loc, chan->loc);
+ copy_v3_v3(pchan->size, chan->size);
pchan->flag= chan->flag;
/* check if rotation modes are compatible (i.e. do they need any conversions) */
if (pchan->rotmode == chan->rotmode) {
/* copy the type of rotation in use */
if (pchan->rotmode > 0) {
- VECCOPY(pchan->eul, chan->eul);
+ copy_v3_v3(pchan->eul, chan->eul);
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
- VECCOPY(pchan->rotAxis, chan->rotAxis);
+ copy_v3_v3(pchan->rotAxis, chan->rotAxis);
pchan->rotAngle = chan->rotAngle;
}
else {
- QUATCOPY(pchan->quat, chan->quat);
+ copy_qt_qt(pchan->quat, chan->quat);
}
}
else if (pchan->rotmode > 0) {
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index be6b322e6b4..95f3bb55ba5 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -223,7 +223,6 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "CURVE_OT_tilt_clear", TKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "TRANSFORM_OT_tilt", TKEY, KM_PRESS, KM_CTRL, 0);
- RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", TFM_TILT);
RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", TFM_CURVE_SHRINKFATTEN);
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 1ac920b048a..b1c266482ae 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -1654,14 +1654,14 @@ static void font_ui_template_init(bContext *C, wmOperator *op)
uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
}
-static int open_cancel(bContext *UNUSED(C), wmOperator *op)
+static int font_open_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
op->customdata= NULL;
return OPERATOR_CANCELLED;
}
-static int open_exec(bContext *C, wmOperator *op)
+static int font_open_exec(bContext *C, wmOperator *op)
{
struct Main *bmain= CTX_data_main(C);
VFont *font;
@@ -1719,7 +1719,7 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
path = (font && strcmp(font->name, FO_BUILTIN_NAME) != 0)? font->name: U.fontdir;
if(RNA_property_is_set(op->ptr, "filepath"))
- return open_exec(C, op);
+ return font_open_exec(C, op);
RNA_string_set(op->ptr, "filepath", path);
WM_event_add_fileselect(C, op);
@@ -1734,9 +1734,9 @@ void FONT_OT_open(wmOperatorType *ot)
ot->idname= "FONT_OT_open";
/* api callbacks */
- ot->exec= open_exec;
+ ot->exec= font_open_exec;
ot->invoke= open_invoke;
- ot->cancel= open_cancel;
+ ot->cancel= font_open_cancel;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt
index ae24456383b..946e1c66ad7 100644
--- a/source/blender/editors/datafiles/CMakeLists.txt
+++ b/source/blender/editors/datafiles/CMakeLists.txt
@@ -47,7 +47,7 @@ if(WITH_BLENDER)
# images
splash.png.c
- blenderbuttons.c
+ blender_icons.png.c
# brushes
add.png.c
diff --git a/source/blender/editors/datafiles/blenderbuttons.c b/source/blender/editors/datafiles/blender_icons.png.c
index 243e9838e9e..a53e2813d2e 100644
--- a/source/blender/editors/datafiles/blenderbuttons.c
+++ b/source/blender/editors/datafiles/blender_icons.png.c
@@ -1,7 +1,7 @@
-/* DataToC output of file <blenderbuttons> */
+/* DataToC output of file <blender_icons_png> */
-int datatoc_blenderbuttons_size= 214916;
-char datatoc_blenderbuttons[]= {
+int datatoc_blender_icons_png_size= 214916;
+char datatoc_blender_icons_png[]= {
137, 80, 78, 71,
13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 2, 90, 0, 0, 2,128, 8, 6, 0, 0, 0, 68,254,214,163, 0, 0, 10,
79,105, 67, 67, 80, 80,104,111,116,111,115,104,111,112, 32, 73, 67, 67, 32,112,114,111,102,105,108,101, 0, 0,120,218,157, 83,
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 07858f7182c..64da61f8f55 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -580,8 +580,8 @@ static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy
/* set color, stroke thickness, and point size */
glLineWidth(lthick);
- QUATCOPY(color, gpl->color); // just for copying 4 array elements
- QUATCOPY(tcolor, gpl->color); // additional copy of color (for ghosting)
+ copy_v4_v4(color, gpl->color); // just for copying 4 array elements
+ copy_v4_v4(tcolor, gpl->color); // additional copy of color (for ghosting)
glColor4fv(color);
glPointSize((float)(gpl->thickness + 2));
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 1bab362fe55..ff3b69c2bf6 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -385,9 +385,10 @@ static short gp_stroke_addpoint (tGPsdata *p, const int mval[2], float pressure)
pt->y= mval[1];
pt->pressure= pressure;
- /* if there's stroke fir this poly line session add (or replace last) point
- to stroke. This allows to draw lines more interactively (see new segment
- during mouse slide, i.e.) */
+ /* if there's stroke for this poly line session add (or replace last) point
+ * to stroke. This allows to draw lines more interactively (see new segment
+ * during mouse slide, i.e.)
+ */
if (p->flags & GP_PAINTFLAG_STROKEADDED) {
bGPDstroke *gps= p->gpf->strokes.last;
bGPDspoint *pts;
@@ -401,7 +402,8 @@ static short gp_stroke_addpoint (tGPsdata *p, const int mval[2], float pressure)
pts = &gps->points[gps->totpoints-1];
/* special case for poly lines: normally, depth is needed only when creating new stroke from buffer,
- but poly lines are converting to stroke instantly, so initialize depth buffer before converting coordinates */
+ * but poly lines are converting to stroke instantly, so initialize depth buffer before converting coordinates
+ */
if (gpencil_project_check(p)) {
View3D *v3d= p->sa->spacedata.first;
@@ -1122,7 +1124,7 @@ static int gp_session_initdata (bContext *C, tGPsdata *p)
p->gpd= *gpd_ptr;
}
- if(ED_gpencil_session_active()==0) {
+ if (ED_gpencil_session_active()==0) {
/* initialize undo stack,
also, existing undo stack would make buffer drawn */
gpencil_undo_init(p->gpd);
@@ -1693,9 +1695,11 @@ static int gpencil_area_exists(bContext *C, ScrArea *satest)
bScreen *sc= CTX_wm_screen(C);
ScrArea *sa;
- for(sa= sc->areabase.first; sa; sa= sa->next)
- if(sa==satest)
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ if (sa==satest)
return 1;
+ }
+
return 0;
}
@@ -1781,9 +1785,9 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
/* basically, this should be mouse-button up = end stroke
* BUT what happens next depends on whether we 'painting sessions' is enabled
*/
- sketch|= GPENCIL_SKETCH_SESSIONS_ON(p->scene);
- /* polyline drawig is also 'sketching' -- all knots should be added during one session */
- sketch|= p->paintmode == GP_PAINTMODE_DRAW_POLY;
+ sketch |= GPENCIL_SKETCH_SESSIONS_ON(p->scene);
+ /* polyline drawing is also 'sketching' -- all knots should be added during one session */
+ sketch |= p->paintmode == GP_PAINTMODE_DRAW_POLY;
if (sketch) {
/* end stroke only, and then wait to resume painting soon */
@@ -1804,13 +1808,13 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
}
else if (event->val == KM_PRESS) {
/* not painting, so start stroke (this should be mouse-button down) */
-
p= gpencil_stroke_begin(C, op);
if (p->status == GP_STATUS_ERROR) {
estate = OPERATOR_CANCELLED;
}
- } else {
+ }
+ else {
p->status = GP_STATUS_IDLING;
}
}
@@ -1845,7 +1849,7 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
}
/* gpencil modal operator stores area, which can be removed while using it (like fullscreen) */
- if(0==gpencil_area_exists(C, p->sa))
+ if (0==gpencil_area_exists(C, p->sa))
estate= OPERATOR_CANCELLED;
else
/* update status indicators - cursor, header, etc. */
diff --git a/source/blender/editors/include/ED_datafiles.h b/source/blender/editors/include/ED_datafiles.h
index a31d01358f4..2c4472c4636 100644
--- a/source/blender/editors/include/ED_datafiles.h
+++ b/source/blender/editors/include/ED_datafiles.h
@@ -36,8 +36,8 @@
extern int datatoc_startup_blend_size;
extern char datatoc_startup_blend[];
-extern int datatoc_blenderbuttons_size;
-extern char datatoc_blenderbuttons[];
+extern int datatoc_blender_icons_png_size;
+extern char datatoc_blender_icons_png[];
extern int datatoc_prvicons_size;
extern char datatoc_prvicons[];
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 5d1e02a6cab..414ca671ef2 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -209,7 +209,7 @@ void ED_vgroup_select_by_name(struct Object *ob, const char *name);
int ED_vgroup_data_create(struct ID *id);
int ED_vgroup_give_array(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot);
int ED_vgroup_copy_array(struct Object *ob, struct Object *ob_from);
-void ED_vgroup_mirror(struct Object *ob, const short mirror_weights, const short flip_vgroups);
+void ED_vgroup_mirror(struct Object *ob, const short mirror_weights, const short flip_vgroups, const short all_vgroups);
int ED_vgroup_object_is_edit_mode(struct Object *ob);
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index f92ee724f6f..05537004927 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -159,6 +159,7 @@ int ED_operator_editmesh_view3d(struct bContext *C);
int ED_operator_editmesh_region_view3d(struct bContext *C);
int ED_operator_editarmature(struct bContext *C);
int ED_operator_editcurve(struct bContext *C);
+int ED_operator_editcurve_3d(struct bContext *C);
int ED_operator_editsurf(struct bContext *C);
int ED_operator_editsurfcurve(struct bContext *C);
int ED_operator_editsurfcurve_region_view3d(struct bContext *C);
diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h
index 5c42dfc5d05..8e445ab1cee 100644
--- a/source/blender/editors/include/ED_space_api.h
+++ b/source/blender/editors/include/ED_space_api.h
@@ -46,7 +46,6 @@ void ED_spacetype_node(void);
void ED_spacetype_buttons(void);
void ED_spacetype_info(void);
void ED_spacetype_file(void);
-void ED_spacetype_sound(void);
void ED_spacetype_action(void);
void ED_spacetype_nla(void);
void ED_spacetype_script(void);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 46bec91e421..5dc63c24e39 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -755,7 +755,7 @@ void uiTemplateTextureImage(uiLayout *layout, struct bContext *C, struct Tex *te
void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C);
void uiTemplateKeymapItemProperties(uiLayout *layout, struct PointerRNA *ptr);
-void uiTemplateList(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *activeptr, const char *activeprop, int rows, int maxrows, int type);
+void uiTemplateList(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *activeptr, const char *activeprop, const char *prop_list, int rows, int maxrows, int type);
void uiTemplateNodeLink(uiLayout *layout, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input);
void uiTemplateNodeView(uiLayout *layout, struct bContext *C, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input);
void uiTemplateTextureUser(uiLayout *layout, struct bContext *C);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 5b27fe88b4b..a6316dc0e9e 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -962,6 +962,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
ARegion *ar;
uiBut *but;
rcti rect;
+ int multisample_enabled;
/* get menu region or area region */
ar= CTX_wm_menu(C);
@@ -971,6 +972,11 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
if(!block->endblock)
uiEndBlock(C, block);
+ /* disable AA, makes widgets too blurry */
+ multisample_enabled= glIsEnabled(GL_MULTISAMPLE_ARB);
+ if(multisample_enabled)
+ glDisable(GL_MULTISAMPLE_ARB);
+
/* we set this only once */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -1015,6 +1021,9 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
+
+ if(multisample_enabled)
+ glEnable(GL_MULTISAMPLE_ARB);
ui_draw_links(block);
}
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 9d8e2f33f5c..e49cb4898d9 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -1944,18 +1944,26 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
if((event->ascii || event->utf8_buf[0]) && (retval == WM_UI_HANDLER_CONTINUE)) {
char ascii = event->ascii;
+ const char *utf8_buf= event->utf8_buf;
/* exception that's useful for number buttons, some keyboard
numpads have a comma instead of a period */
- if(ELEM3(but->type, NUM, NUMABS, NUMSLI))
- if(event->type == PADPERIOD && ascii == ',')
+ if(ELEM3(but->type, NUM, NUMABS, NUMSLI)) { /* could use data->min*/
+ if(event->type == PADPERIOD && ascii == ',') {
ascii = '.';
+ utf8_buf= NULL; /* force ascii fallback */
+ }
+ }
- if(event->utf8_buf[0]) {
+ if(utf8_buf && utf8_buf[0]) {
+ int utf8_buf_len= BLI_str_utf8_size(utf8_buf);
/* keep this printf until utf8 is well tested */
- printf("%s: utf8 char '%.*s'\n", __func__, BLI_str_utf8_size(event->utf8_buf), event->utf8_buf);
- // strcpy(event->utf8_buf, "12345");
- changed= ui_textedit_type_buf(but, data, event->utf8_buf, BLI_str_utf8_size(event->utf8_buf));
+ if (utf8_buf_len != 1) {
+ printf("%s: utf8 char '%.*s'\n", __func__, utf8_buf_len, utf8_buf);
+ }
+
+ // strcpy(utf8_buf, "12345");
+ changed= ui_textedit_type_buf(but, data, event->utf8_buf, utf8_buf_len);
}
else {
changed= ui_textedit_type_ascii(but, data, ascii);
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 036cf5a3d3c..ffdd807e362 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -462,10 +462,10 @@ static void vicon_move_down_draw(int x, int y, int w, int h, float UNUSED(alpha)
static void init_brush_icons(void)
{
-#define INIT_BRUSH_ICON(icon_id, name) \
- bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_ ##name## _png, \
- datatoc_ ##name## _png_size, IB_rect); \
- def_internal_icon(bbuf, icon_id, 0, 0, w, ICON_TYPE_BUFFER); \
+#define INIT_BRUSH_ICON(icon_id, name) \
+ bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_ ##name## _png, \
+ datatoc_ ##name## _png_size, IB_rect, "<brush icon>"); \
+ def_internal_icon(bbuf, icon_id, 0, 0, w, ICON_TYPE_BUFFER); \
IMB_freeImBuf(bbuf);
// end INIT_BRUSH_ICON
@@ -527,7 +527,7 @@ static void init_internal_icons(void)
}
}
if(bbuf==NULL)
- bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_blenderbuttons, datatoc_blenderbuttons_size, IB_rect);
+ bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_blender_icons_png, datatoc_blender_icons_png_size, IB_rect, "<blender icons>");
if(bbuf) {
/* free existing texture if any */
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 0e4734569e9..fe61e71c836 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2064,7 +2064,7 @@ static int list_item_icon_get(bContext *C, PointerRNA *itemptr, int rnaicon, int
return rnaicon;
}
-static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *itemptr, int i, int rnaicon, PointerRNA *activeptr, PropertyRNA *activeprop)
+static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *itemptr, int i, int rnaicon, PointerRNA *activeptr, PropertyRNA *activeprop, const char *prop_list_id)
{
uiBlock *block= uiLayoutGetBlock(layout);
uiBut *but;
@@ -2169,6 +2169,54 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
/* nothing else special to do... */
uiItemL(sub, name, icon); /* fails, backdrop LISTROW... */
}
+ /* There is a last chance to display custom controls (in addition to the name/label):
+ * If the given item property group features a string property named as prop_list,
+ * this tries to add controls for all properties of the item listed in that string property.
+ * (colon-separated names).
+ *
+ * This is especially useful for python. E.g., if you list a collection of this property
+ * group:
+ *
+ * class TestPropertyGroup(bpy.types.PropertyGroup):
+ * bool = BoolProperty(default=False)
+ * integer = IntProperty()
+ * string = StringProperty()
+ *
+ * # A string of all identifiers (colon-separated) which property’s controls should be
+ * # displayed in a template_list.
+ * template_list_controls = StringProperty(default="integer:bool:string", options={"HIDDEN"})
+ *
+ * … you’ll get a numfield for the integer prop, a check box for the bool prop, and a textfield
+ * for the string prop, after the name of each item of the collection.
+ */
+ else if (prop_list_id) {
+ row = uiLayoutRow(sub, 1);
+ uiItemL(row, name, icon);
+
+ /* XXX: Check, as sometimes we get an itemptr looking like
+ * {id = {data = 0x0}, type = 0x0, data = 0x0}
+ * which would obviously produce a sigsev… */
+ if (itemptr->type) {
+ /* If the special property is set for the item, and it is a collection… */
+ PropertyRNA *prop_list= RNA_struct_find_property(itemptr, prop_list_id);
+
+ if(prop_list && RNA_property_type(prop_list) == PROP_STRING) {
+ int prop_names_len;
+ char *prop_names = RNA_property_string_get_alloc(itemptr, prop_list, NULL, 0, &prop_names_len);
+ char *prop_names_end= prop_names + prop_names_len;
+ char *id= prop_names;
+ char *id_next;
+ while (id < prop_names_end) {
+ if ((id_next= strchr(id, ':'))) *id_next++= '\0';
+ else id_next= prop_names_end;
+ uiItemR(row, itemptr, id, 0, NULL, 0);
+ id= id_next;
+ }
+ MEM_freeN(prop_names);
+ }
+ }
+ }
+
else
uiItemL(sub, name, icon); /* fails, backdrop LISTROW... */
@@ -2177,7 +2225,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
MEM_freeN(namebuf);
}
-void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *activeptr, const char *activepropname, int rows, int maxrows, int listtype)
+void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *activeptr, const char *activepropname, const char *prop_list, int rows, int maxrows, int listtype)
{
//Scene *scene= CTX_data_scene(C);
PropertyRNA *prop= NULL, *activeprop;
@@ -2331,7 +2379,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
/* create list items */
RNA_PROP_BEGIN(ptr, itemptr, prop) {
if(i >= pa->list_scroll && i<pa->list_scroll+items)
- list_item_row(C, col, ptr, &itemptr, i, rnaicon, activeptr, activeprop);
+ list_item_row(C, col, ptr, &itemptr, i, rnaicon, activeptr, activeprop, prop_list);
i++;
}
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index d3a5c6691ef..921a1879bb7 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -129,18 +129,12 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
case SPACE_IMAGE:
ts= &btheme->tima;
break;
- case SPACE_IMASEL:
- ts= &btheme->timasel;
- break;
case SPACE_TEXT:
ts= &btheme->text;
break;
case SPACE_OUTLINER:
ts= &btheme->toops;
break;
- case SPACE_SOUND:
- ts= &btheme->tsnd;
- break;
case SPACE_INFO:
ts= &btheme->tinfo;
break;
@@ -528,12 +522,10 @@ static void ui_theme_init_new(bTheme *btheme)
ui_theme_init_new_do(&btheme->tfile);
ui_theme_init_new_do(&btheme->tipo);
ui_theme_init_new_do(&btheme->tinfo);
- ui_theme_init_new_do(&btheme->tsnd);
ui_theme_init_new_do(&btheme->tact);
ui_theme_init_new_do(&btheme->tnla);
ui_theme_init_new_do(&btheme->tseq);
ui_theme_init_new_do(&btheme->tima);
- ui_theme_init_new_do(&btheme->timasel);
ui_theme_init_new_do(&btheme->text);
ui_theme_init_new_do(&btheme->toops);
ui_theme_init_new_do(&btheme->ttime);
@@ -731,18 +723,6 @@ void ui_theme_init_default(void)
SETCOL(btheme->tima.editmesh_active, 255, 255, 255, 128);
SETCOLF(btheme->tima.preview_back, 0.45, 0.45, 0.45, 1.0);
- /* space imageselect */
- btheme->timasel= btheme->tv3d;
- SETCOL(btheme->timasel.active, 195, 195, 195, 255); /* active tile */
- SETCOL(btheme->timasel.grid, 94, 94, 94, 255); /* active file text */
- SETCOL(btheme->timasel.back, 110, 110, 110, 255);
- SETCOL(btheme->timasel.shade1, 94, 94, 94, 255); /* bar */
- SETCOL(btheme->timasel.shade2, 172, 172, 172, 255); /* sliders */
- SETCOL(btheme->timasel.hilite, 17, 27, 60, 100); /* selected tile */
- SETCOL(btheme->timasel.text, 0, 0, 0, 255);
- SETCOL(btheme->timasel.text_hi, 255, 255, 255, 255);
- SETCOL(btheme->timasel.panel, 132, 132, 132, 255);
-
/* space text */
btheme->text= btheme->tv3d;
SETCOL(btheme->text.back, 153, 153, 153, 255);
@@ -778,15 +758,11 @@ void ui_theme_init_default(void)
SETCOL(btheme->tconsole.console_error, 220, 96, 96, 255);
SETCOL(btheme->tconsole.console_cursor, 220, 96, 96, 255);
-
- /* space sound */
- btheme->tsnd= btheme->tv3d;
- SETCOLF(btheme->tsnd.back, 0.45, 0.45, 0.45, 1.0);
- SETCOLF(btheme->tsnd.grid, 0.36, 0.36, 0.36, 1.0);
- SETCOL(btheme->tsnd.shade1, 173, 173, 173, 255); // sliders
-
/* space time */
- btheme->ttime= btheme->tsnd; // same as sound space
+ btheme->ttime= btheme->tv3d;
+ SETCOLF(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0);
+ SETCOLF(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0);
+ SETCOL(btheme->ttime.shade1, 173, 173, 173, 255); // sliders
/* space node, re-uses syntax color storage */
btheme->tnode= btheme->tv3d;
@@ -801,7 +777,6 @@ void ui_theme_init_default(void)
/* space logic */
btheme->tlogic= btheme->tv3d;
SETCOL(btheme->tlogic.back, 100, 100, 100, 255);
-
}
@@ -1193,7 +1168,11 @@ void init_userdef_do_versions(void)
for(btheme= U.themes.first; btheme; btheme= btheme->next) {
/* check for alpha==0 is safe, then color was never set */
if(btheme->ttime.back[3]==0) {
- btheme->ttime = btheme->tsnd; // copy from sound
+ // copied from ui_theme_init_default
+ btheme->ttime= btheme->tv3d;
+ SETCOLF(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0);
+ SETCOLF(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0);
+ SETCOL(btheme->ttime.shade1, 173, 173, 173, 255); // sliders
}
if(btheme->text.syntaxn[3]==0) {
SETCOL(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/
@@ -1320,7 +1299,7 @@ void init_userdef_do_versions(void)
SETCOL(btheme->tact.cframe, 0x60, 0xc0, 0x40, 255);
SETCOL(btheme->tnla.cframe, 0x60, 0xc0, 0x40, 255);
SETCOL(btheme->tseq.cframe, 0x60, 0xc0, 0x40, 255);
- SETCOL(btheme->tsnd.cframe, 0x60, 0xc0, 0x40, 255);
+ //SETCOL(btheme->tsnd.cframe, 0x60, 0xc0, 0x40, 255); Not needed anymore
SETCOL(btheme->ttime.cframe, 0x60, 0xc0, 0x40, 255);
}
}
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 279657e71c2..02d20e64bc3 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -346,7 +346,6 @@ void paintface_select_linked(bContext *UNUSED(C), Object *ob, int UNUSED(mval[2]
paintface_flush_flags(ob);
}
-/* note: caller needs to run paintface_flush_flags(ob) after this */
void paintface_deselect_all_visible(Object *ob, int action, short flush_flags)
{
Mesh *me;
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index 004b98e5dd7..b4bee60e415 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -3435,7 +3435,7 @@ void EM_deselect_all(EditMesh *em)
EM_clear_flag_all(em, SELECT);
}
-static int select_all_exec(bContext *C, wmOperator *op)
+static int editmesh_select_all_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
@@ -3470,7 +3470,7 @@ void MESH_OT_select_all(wmOperatorType *ot)
ot->idname= "MESH_OT_select_all";
/* api callbacks */
- ot->exec= select_all_exec;
+ ot->exec= editmesh_select_all_exec;
ot->poll= ED_operator_editmesh;
/* flags */
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 5455bf966ef..54b46cc14a6 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -1456,11 +1456,11 @@ void MESH_OT_delete(wmOperatorType *ot)
/* calculates offset for co, based on fractal, sphere or smooth settings */
static void alter_co(float *co, EditEdge *edge, float smooth, float fractal, int beauty, float perc)
{
- float vec1[3], fac;
+ float tvec[3], fac;
if(beauty & B_SMOOTH) {
- /* we calculate an offset vector vec1[], to be added to *co */
- float len, fac, nor[3], nor1[3], nor2[3];
+ /* we calculate an offset vector tvec[], to be added to *co */
+ float len, nor[3], nor1[3], nor2[3];
sub_v3_v3v3(nor, edge->v1->co, edge->v2->co);
len= 0.5f*normalize_v3(nor);
@@ -1469,43 +1469,31 @@ static void alter_co(float *co, EditEdge *edge, float smooth, float fractal, int
copy_v3_v3(nor2, edge->v2->no);
/* cosine angle */
- fac= nor[0]*nor1[0] + nor[1]*nor1[1] + nor[2]*nor1[2] ;
-
- vec1[0]= fac*nor1[0];
- vec1[1]= fac*nor1[1];
- vec1[2]= fac*nor1[2];
+ fac= dot_v3v3(nor, nor1);
+ mul_v3_v3fl(tvec, nor1, fac);
/* cosine angle */
- fac= -nor[0]*nor2[0] - nor[1]*nor2[1] - nor[2]*nor2[2] ;
-
- vec1[0]+= fac*nor2[0];
- vec1[1]+= fac*nor2[1];
- vec1[2]+= fac*nor2[2];
+ fac= -dot_v3v3(nor, nor2);
+ madd_v3_v3fl(tvec, nor2, fac);
/* falloff for multi subdivide */
smooth *= sqrtf(fabs(1.0f - 2.0f*fabsf(0.5f-perc)));
- vec1[0]*= smooth*len;
- vec1[1]*= smooth*len;
- vec1[2]*= smooth*len;
+ mul_v3_fl(tvec, smooth * len);
- co[0] += vec1[0];
- co[1] += vec1[1];
- co[2] += vec1[2];
+ add_v3_v3(co, tvec);
}
else if(beauty & B_SPHERE) { /* subdivide sphere */
normalize_v3(co);
- co[0]*= smooth;
- co[1]*= smooth;
- co[2]*= smooth;
+ mul_v3_fl(co, smooth);
}
if(beauty & B_FRACTAL) {
fac= fractal*len_v3v3(edge->v1->co, edge->v2->co);
- vec1[0]= fac*(float)(0.5-BLI_drand());
- vec1[1]= fac*(float)(0.5-BLI_drand());
- vec1[2]= fac*(float)(0.5-BLI_drand());
- add_v3_v3(co, vec1);
+ tvec[0]= fac*(float)(0.5-BLI_drand());
+ tvec[1]= fac*(float)(0.5-BLI_drand());
+ tvec[2]= fac*(float)(0.5-BLI_drand());
+ add_v3_v3(co, tvec);
}
}
@@ -1517,9 +1505,7 @@ static EditVert *subdivide_edge_addvert(EditMesh *em, EditEdge *edge, float smoo
EditVert *ev;
float co[3];
- co[0] = (edge->v2->co[0]-edge->v1->co[0])*percent + edge->v1->co[0];
- co[1] = (edge->v2->co[1]-edge->v1->co[1])*percent + edge->v1->co[1];
- co[2] = (edge->v2->co[2]-edge->v1->co[2])*percent + edge->v1->co[2];
+ interp_v3_v3v3(co, edge->v1->co, edge->v2->co, percent);
/* offset for smooth or sphere or fractal */
alter_co(co, edge, smooth, fractal, beauty, percent);
@@ -1543,9 +1529,7 @@ static EditVert *subdivide_edge_addvert(EditMesh *em, EditEdge *edge, float smoo
EM_data_interp_from_verts(em, edge->v1, edge->v2, ev, percent);
/* normal */
- ev->no[0] = (edge->v2->no[0]-edge->v1->no[0])*percent + edge->v1->no[0];
- ev->no[1] = (edge->v2->no[1]-edge->v1->no[1])*percent + edge->v1->no[1];
- ev->no[2] = (edge->v2->no[2]-edge->v1->no[2])*percent + edge->v1->no[2];
+ interp_v3_v3v3(ev->no, edge->v1->no, edge->v2->no, percent);
normalize_v3(ev->no);
return ev;
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index f69f91cd08f..a77a34e05ec 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -121,7 +121,7 @@ MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int UNU
/***************************** Select/Deselect operator *****************************/
/* Select or deselect all MetaElements */
-static int select_all_exec(bContext *C, wmOperator *op)
+static int mball_select_all_exec(bContext *C, wmOperator *op)
{
//Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
@@ -171,7 +171,7 @@ void MBALL_OT_select_all(wmOperatorType *ot)
ot->idname= "MBALL_OT_select_all";
/* callback functions */
- ot->exec= select_all_exec;
+ ot->exec= mball_select_all_exec;
ot->poll= ED_operator_editmball;
/* flags */
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index ab9c071ab30..50b798c5bea 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -1268,9 +1268,10 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o
else
mul_v3_m4v3(obt->loc, obact->obmat, pchanact->pose_head);
}
- else
- VECCOPY(obt->loc, obact->obmat[3]);
-
+ else {
+ copy_v3_v3(obt->loc, obact->obmat[3]);
+ }
+
/* restore, add_object sets active */
BASACT= base;
base->flag |= SELECT;
diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c
index 7585018dfd2..25c1e32f4ae 100644
--- a/source/blender/editors/object/object_lattice.c
+++ b/source/blender/editors/object/object_lattice.c
@@ -186,7 +186,7 @@ void ED_setflagsLatt(Object *obedit, int flag)
}
}
-static int select_all_exec(bContext *C, wmOperator *op)
+static int lattice_select_all_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
Lattice *lt= obedit->data;
@@ -244,7 +244,7 @@ void LATTICE_OT_select_all(wmOperatorType *ot)
ot->idname= "LATTICE_OT_select_all";
/* api callbacks */
- ot->exec= select_all_exec;
+ ot->exec= lattice_select_all_exec;
ot->poll= ED_operator_editlattice;
/* flags */
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 7c049692b40..74da705965a 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1713,6 +1713,7 @@ static void make_local_makelocalmaterial(Material *ma)
static int make_local_exec(bContext *C, wmOperator *op)
{
+ Main *bmain= CTX_data_main(C);
AnimData *adt;
ParticleSystem *psys;
Material *ma, ***matarar;
@@ -1721,7 +1722,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
int a, b, mode= RNA_enum_get(op->ptr, "type");
if(mode==3) {
- all_local(NULL, 0); /* NULL is all libs */
+ BKE_library_make_local(bmain, NULL, 0); /* NULL is all libs */
WM_event_add_notifier(C, NC_WINDOW, NULL);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 378e4a4f314..a59ca5ad954 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -99,8 +99,7 @@ int ED_vgroup_object_is_edit_mode(Object *ob)
bDeformGroup *ED_vgroup_add_name(Object *ob, const char *name)
{
bDeformGroup *defgroup;
-
- if(!ob || !ELEM(ob->type, OB_MESH, OB_LATTICE))
+ if(!ob || !OB_TYPE_SUPPORT_VGROUP(ob->type))
return NULL;
defgroup = MEM_callocN(sizeof(bDeformGroup), "add deformGroup");
@@ -1527,18 +1526,36 @@ static void vgroup_clean_all(Object *ob, float eul, int keep_single)
static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr,
const char sel, const char sel_mirr,
- const int *flip_map,
- const short mirror_weights, const short flip_vgroups)
+ const int *flip_map, const int flip_map_len,
+ const short mirror_weights, const short flip_vgroups,
+ const short all_vgroups, const int act_vgroup)
{
BLI_assert(sel || sel_mirr);
if(sel_mirr && sel) {
/* swap */
- if(mirror_weights)
- SWAP(MDeformVert, *dvert, *dvert_mirr);
+ if(mirror_weights) {
+ if (all_vgroups) {
+ SWAP(MDeformVert, *dvert, *dvert_mirr);
+ }
+ else {
+ MDeformWeight *dw= defvert_find_index(dvert, act_vgroup);
+ MDeformWeight *dw_mirr= defvert_find_index(dvert_mirr, act_vgroup);
+
+ if (dw || dw_mirr) {
+ if (dw_mirr == NULL)
+ dw_mirr= defvert_verify_index(dvert_mirr, act_vgroup);
+ if (dw == NULL)
+ dw= defvert_verify_index(dvert, act_vgroup);
+
+ SWAP(float, dw->weight, dw_mirr->weight);
+ }
+ }
+ }
+
if(flip_vgroups) {
- defvert_flip(dvert, flip_map);
- defvert_flip(dvert_mirr, flip_map);
+ defvert_flip(dvert, flip_map, flip_map_len);
+ defvert_flip(dvert_mirr, flip_map, flip_map_len);
}
}
else {
@@ -1550,57 +1567,114 @@ static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr,
if(mirror_weights)
defvert_copy(dvert, dvert_mirr);
if(flip_vgroups) {
- defvert_flip(dvert, flip_map);
+ defvert_flip(dvert, flip_map, flip_map_len);
}
}
}
-void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_vgroups)
+/* TODO, vgroup locking */
+/* TODO, face masking */
+void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_vgroups, const short all_vgroups)
{
-#define VGROUP_MIRR_OP dvert_mirror_op(dvert, dvert_mirr, sel, sel_mirr, flip_map, mirror_weights, flip_vgroups)
+
+#define VGROUP_MIRR_OP \
+ dvert_mirror_op(dvert, dvert_mirr, \
+ sel, sel_mirr, \
+ flip_map, flip_map_len, \
+ mirror_weights, flip_vgroups, \
+ all_vgroups, act_vgroup \
+ )
EditVert *eve, *eve_mirr;
MDeformVert *dvert, *dvert_mirr;
short sel, sel_mirr;
- int *flip_map;
+ int *flip_map, flip_map_len;
+ const int act_vgroup= ob->actdef > 0 ? ob->actdef-1 : 0;
if(mirror_weights==0 && flip_vgroups==0)
return;
- flip_map= defgroup_flip_map(ob, 0);
+ flip_map= all_vgroups ?
+ defgroup_flip_map(ob, &flip_map_len, FALSE) :
+ defgroup_flip_map_single(ob, &flip_map_len, FALSE, act_vgroup);
/* only the active group */
if(ob->type == OB_MESH) {
Mesh *me= ob->data;
EditMesh *em = BKE_mesh_get_editmesh(me);
+ if (em) {
+ if(!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT)) {
+ MEM_freeN(flip_map);
+ return;
+ }
- if(!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT)) {
- MEM_freeN(flip_map);
- return;
+ EM_cache_x_mirror_vert(ob, em);
+
+ /* Go through the list of editverts and assign them */
+ for(eve=em->verts.first; eve; eve=eve->next){
+ if((eve_mirr=eve->tmp.v)) {
+ sel= eve->f & SELECT;
+ sel_mirr= eve_mirr->f & SELECT;
+
+ if((sel || sel_mirr) && (eve != eve_mirr)) {
+ dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
+ dvert_mirr= CustomData_em_get(&em->vdata, eve_mirr->data, CD_MDEFORMVERT);
+ if(dvert && dvert_mirr) {
+ VGROUP_MIRR_OP;
+ }
+ }
+
+ eve->tmp.v= eve_mirr->tmp.v= NULL;
+ }
+ }
+
+ BKE_mesh_end_editmesh(me, em);
}
+ else {
+ /* object mode / weight paint */
+ MVert *mv, *mv_mirr;
+ int vidx, vidx_mirr;
+ const int use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
+
+ if (me->dvert == NULL) {
+ MEM_freeN(flip_map);
+ return;
+ }
- EM_cache_x_mirror_vert(ob, em);
+ if (!use_vert_sel) {
+ sel= sel_mirr= TRUE;
+ }
+
+ /* tag verts we have used */
+ for(vidx= 0, mv= me->mvert; vidx < me->totvert; vidx++, mv++) {
+ mv->flag &= ~ME_VERT_TMP_TAG;
+ }
+
+ for(vidx= 0, mv= me->mvert; vidx < me->totvert; vidx++, mv++) {
+ if ( ((mv->flag & ME_VERT_TMP_TAG) == 0) &&
+ ((vidx_mirr= mesh_get_x_mirror_vert(ob, vidx)) != -1) &&
+ (vidx != vidx_mirr) &&
+ ((((mv_mirr= me->mvert + vidx_mirr)->flag) & ME_VERT_TMP_TAG) == 0))
+ {
+
+ if (use_vert_sel) {
+ sel= mv->flag & SELECT;
+ sel_mirr= mv_mirr->flag & SELECT;
+ }
+
+ if (sel || sel_mirr) {
+ dvert= &me->dvert[vidx];
+ dvert_mirr= &me->dvert[vidx_mirr];
- /* Go through the list of editverts and assign them */
- for(eve=em->verts.first; eve; eve=eve->next){
- if((eve_mirr=eve->tmp.v)) {
- sel= eve->f & SELECT;
- sel_mirr= eve_mirr->f & SELECT;
-
- if((sel || sel_mirr) && (eve != eve_mirr)) {
- dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
- dvert_mirr= CustomData_em_get(&em->vdata, eve_mirr->data, CD_MDEFORMVERT);
- if(dvert && dvert_mirr) {
VGROUP_MIRR_OP;
}
- }
- eve->tmp.v= eve_mirr->tmp.v= NULL;
+ mv->flag |= ME_VERT_TMP_TAG;
+ mv_mirr->flag |= ME_VERT_TMP_TAG;
+ }
}
}
-
- BKE_mesh_end_editmesh(me, em);
}
else if (ob->type == OB_LATTICE) {
Lattice *lt= ob->data;
@@ -2013,7 +2087,7 @@ static int vertex_group_poll(bContext *C)
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
ID *data= (ob)? ob->data: NULL;
- return (ob && !ob->id.lib && ELEM(ob->type, OB_MESH, OB_LATTICE) && data && !data->lib);
+ return (ob && !ob->id.lib && OB_TYPE_SUPPORT_VGROUP(ob->type) && data && !data->lib);
}
static int vertex_group_poll_edit(bContext *C)
@@ -2509,7 +2583,10 @@ static int vertex_group_mirror_exec(bContext *C, wmOperator *op)
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
- ED_vgroup_mirror(ob, RNA_boolean_get(op->ptr,"mirror_weights"), RNA_boolean_get(op->ptr,"flip_group_names"));
+ ED_vgroup_mirror(ob,
+ RNA_boolean_get(op->ptr,"mirror_weights"),
+ RNA_boolean_get(op->ptr,"flip_group_names"),
+ RNA_boolean_get(op->ptr,"all_groups"));
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
@@ -2527,7 +2604,7 @@ void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot)
"flipping when both sides are selected otherwise copy from unselected";
/* api callbacks */
- ot->poll= vertex_group_poll_edit;
+ ot->poll= vertex_group_poll;
ot->exec= vertex_group_mirror_exec;
/* flags */
@@ -2536,6 +2613,7 @@ void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot)
/* properties */
RNA_def_boolean(ot->srna, "mirror_weights", TRUE, "Mirror Weights", "Mirror weights");
RNA_def_boolean(ot->srna, "flip_group_names", TRUE, "Flip Groups", "Flip vertex group names");
+ RNA_def_boolean(ot->srna, "all_groups", FALSE, "All Groups", "Mirror all vertex groups weights");
}
diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt
index f98122eccbd..382e12cce6c 100644
--- a/source/blender/editors/physics/CMakeLists.txt
+++ b/source/blender/editors/physics/CMakeLists.txt
@@ -45,8 +45,8 @@ set(SRC
physics_intern.h
)
-if(NOT WITH_MOD_FLUID)
- add_definitions(-DDISABLE_ELBEEM)
+if(WITH_MOD_FLUID)
+ add_definitions(-DWITH_MOD_FLUID)
endif()
if(WITH_OPENMP)
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 0803fa2a7a2..3694102fa5b 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -1296,7 +1296,7 @@ static void toggle_key_select(PEData *data, int point_index, int key_index)
/************************ de select all operator ************************/
-static int select_all_exec(bContext *C, wmOperator *op)
+static int pe_select_all_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
@@ -1358,7 +1358,7 @@ void PARTICLE_OT_select_all(wmOperatorType *ot)
ot->idname= "PARTICLE_OT_select_all";
/* api callbacks */
- ot->exec= select_all_exec;
+ ot->exec= pe_select_all_exec;
ot->poll= PE_poll;
/* flags */
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index f0c327b9279..6e88d477d9c 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -85,7 +85,7 @@
#include "physics_intern.h" // own include
/* enable/disable overall compilation */
-#ifndef DISABLE_ELBEEM
+#ifdef WITH_MOD_FLUID
#include "WM_api.h"
@@ -1111,7 +1111,7 @@ void fluidsimFreeBake(Object *UNUSED(ob))
/* not implemented yet */
}
-#else /* DISABLE_ELBEEM */
+#else /* WITH_MOD_FLUID */
/* compile dummy functions for disabled fluid sim */
@@ -1135,7 +1135,7 @@ static int fluidsimBake(bContext *UNUSED(C), ReportList *UNUSED(reports), Object
return 0;
}
-#endif /* DISABLE_ELBEEM */
+#endif /* WITH_MOD_FLUID */
/***************************** Operators ******************************/
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index bef3e7f0a1a..9c38b1ce98f 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -187,24 +187,62 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
/* set callbacks, exported to sequence render too.
Only call in foreground (UI) renders. */
+static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **scene, SceneRenderLayer **srl)
+{
+ /* single layer re-render */
+ if(RNA_property_is_set(op->ptr, "scene")) {
+ Scene *scn;
+ char scene_name[MAX_ID_NAME-2];
+
+ RNA_string_get(op->ptr, "scene", scene_name);
+ scn = (Scene *)BLI_findstring(&mainp->scene, scene_name, offsetof(ID, name) + 2);
+
+ if (scn) {
+ /* camera switch wont have updated */
+ scn->r.cfra= (*scene)->r.cfra;
+ scene_camera_switch_update(scn);
+
+ *scene = scn;
+ }
+ }
+
+ if(RNA_property_is_set(op->ptr, "layer")) {
+ SceneRenderLayer *rl;
+ char rl_name[RE_MAXNAME];
+
+ RNA_string_get(op->ptr, "layer", rl_name);
+ rl = (SceneRenderLayer *)BLI_findstring(&(*scene)->r.layers, rl_name, offsetof(SceneRenderLayer, name));
+
+ if (rl)
+ *srl = rl;
+ }
+}
+
/* executes blocking render */
static int screen_render_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Render *re= RE_NewRender(scene->id.name);
+ SceneRenderLayer *srl= NULL;
+ Render *re;
Image *ima;
View3D *v3d= CTX_wm_view3d(C);
Main *mainp= CTX_data_main(C);
- unsigned int lay= (v3d)? v3d->lay: scene->lay;
+ unsigned int lay;
const short is_animation= RNA_boolean_get(op->ptr, "animation");
const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
struct Object *camera_override= v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
+ /* custom scene and single layer re-render */
+ screen_render_scene_layer_set(op, mainp, &scene, &srl);
+
if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.imtype)) {
BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected");
return OPERATOR_CANCELLED;
}
+ re= RE_NewRender(scene->id.name);
+ lay= (v3d)? v3d->lay: scene->lay;
+
G.afbreek= 0;
RE_test_break_cb(re, NULL, (int (*)(void *)) blender_test_break);
@@ -223,7 +261,7 @@ static int screen_render_exec(bContext *C, wmOperator *op)
if(is_animation)
RE_BlenderAnim(re, mainp, scene, camera_override, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step);
else
- RE_BlenderFrame(re, mainp, scene, NULL, camera_override, lay, scene->r.cfra, is_write_still);
+ RE_BlenderFrame(re, mainp, scene, srl, camera_override, lay, scene->r.cfra, is_write_still);
RE_SetReports(re, NULL);
@@ -518,28 +556,11 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
jobflag= WM_JOB_EXCL_RENDER|WM_JOB_PRIORITY|WM_JOB_PROGRESS;
- /* single layer re-render */
- if(RNA_property_is_set(op->ptr, "layer")) {
- SceneRenderLayer *rl;
- Scene *scn;
- char scene_name[MAX_ID_NAME-2], rl_name[RE_MAXNAME];
+ /* custom scene and single layer re-render */
+ screen_render_scene_layer_set(op, mainp, &scene, &srl);
- RNA_string_get(op->ptr, "layer", rl_name);
- RNA_string_get(op->ptr, "scene", scene_name);
-
- scn = (Scene *)BLI_findstring(&mainp->scene, scene_name, offsetof(ID, name) + 2);
- rl = (SceneRenderLayer *)BLI_findstring(&scene->r.layers, rl_name, offsetof(SceneRenderLayer, name));
-
- if (scn && rl) {
- /* camera switch wont have updated */
- scn->r.cfra= scene->r.cfra;
- scene_camera_switch_update(scn);
-
- scene = scn;
- srl = rl;
- }
+ if(RNA_property_is_set(op->ptr, "layer"))
jobflag |= WM_JOB_SUSPEND;
- }
/* job custom data */
rj= MEM_callocN(sizeof(RenderJob), "render job");
@@ -611,7 +632,7 @@ void RENDER_OT_render(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "animation", 0, "Animation", "Render files from the animation range of this scene");
RNA_def_boolean(ot->srna, "write_still", 0, "Write Image", "Save rendered the image to the output path (used only when animation is disabled)");
- RNA_def_string(ot->srna, "layer", "", RE_MAXNAME, "Render Layer", "Single render layer to re-render");
- RNA_def_string(ot->srna, "scene", "", MAX_ID_NAME-2, "Scene", "Re-render single layer in this scene");
+ RNA_def_string(ot->srna, "layer", "", RE_MAXNAME, "Render Layer", "Single render layer to re-render (used only when animation is disabled)");
+ RNA_def_string(ot->srna, "scene", "", MAX_ID_NAME-2, "Scene", "Scene to render, current scene if not specified");
}
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index feeb2fefca7..fa764e6eefc 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -154,7 +154,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
if((scene->r.mode & R_OSA) == 0) {
ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat);
- glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, rr->rectf);
+ GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, rr->rectf);
}
else {
/* simple accumulation, less hassle then FSAA FBO's */
@@ -167,7 +167,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
/* first sample buffer, also initializes 'rv3d->persmat' */
ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat);
- glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, accum_buffer);
+ GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, accum_buffer);
/* skip the first sample */
for(j=1; j < SAMPLES; j++) {
@@ -175,7 +175,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
window_translate_m4(winmat_jitter, rv3d->persmat, jit_ofs[j][0] / sizex, jit_ofs[j][1] / sizey);
ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat_jitter);
- glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, accum_tmp);
+ GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, accum_tmp);
add_vn_vn(accum_buffer, accum_tmp, sizex*sizey*sizeof(float));
}
@@ -278,7 +278,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
sizey= (scene->r.size*scene->r.ysch)/100;
/* corrects render size with actual size, not every card supports non-power-of-two dimensions */
- ofs= GPU_offscreen_create(&sizex, &sizey, err_out);
+ ofs= GPU_offscreen_create(sizex, sizey, err_out);
if(!ofs) {
BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL offscreen buffer, %s", err_out);
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 0a7e3a2763a..e86dd8dbde3 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -192,7 +192,7 @@ int ED_operator_animview_active(bContext *C)
{
if(ED_operator_areaactive(C)) {
SpaceLink *sl= (SpaceLink *)CTX_wm_space_data(C);
- if (sl && (ELEM6(sl->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_ACTION, SPACE_NLA, SPACE_IPO, SPACE_TIME)))
+ if (sl && (ELEM5(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_IPO, SPACE_TIME)))
return TRUE;
}
@@ -406,6 +406,17 @@ int ED_operator_editcurve(bContext *C)
return 0;
}
+int ED_operator_editcurve_3d(bContext *C)
+{
+ Object *obedit= CTX_data_edit_object(C);
+ if(obedit && obedit->type==OB_CURVE) {
+ Curve *cu= (Curve *)obedit->data;
+
+ return (cu->flag&CU_3D) && (NULL != cu->editnurb);
+ }
+ return 0;
+}
+
int ED_operator_editsurf(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 3e2c4666528..57f926b0612 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -387,37 +387,16 @@ void vpaint_fill(Object *ob, unsigned int paintcol)
/* fills in the selected faces with the current weight and vertex group */
void wpaint_fill(VPaint *wp, Object *ob, float paintweight)
{
- Mesh *me;
+ Mesh *me= ob->data;
+ MFace *mf;
MDeformWeight *dw, *uw;
- int *indexar;
- unsigned int index;
int vgroup, vgroup_mirror= -1;
- int selected;
-
- int use_vert_sel;
-
- me= ob->data;
- if(me==NULL || me->totface==0 || me->dvert==NULL || !me->mface) return;
-
- selected= (me->editflag & ME_EDIT_PAINT_MASK);
-
- use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
+ unsigned int index;
- indexar= get_indexarray(me);
+ /* mutually exclusive, could be made into a */
+ const short paint_selmode= ME_EDIT_PAINT_SEL_MODE(me);
- if(selected) {
- MFace *mf;
- for(index=0, mf= me->mface; index<me->totface; index++, mf++) {
- if((mf->flag & ME_FACE_SEL)==0)
- indexar[index]= 0;
- else
- indexar[index]= index+1;
- }
- }
- else {
- for(index=0; index<me->totface; index++)
- indexar[index]= index+1;
- }
+ if(me->totface==0 || me->dvert==NULL || !me->mface) return;
vgroup= ob->actdef-1;
@@ -428,47 +407,47 @@ void wpaint_fill(VPaint *wp, Object *ob, float paintweight)
copy_wpaint_prev(wp, me->dvert, me->totvert);
- for(index=0; index<me->totface; index++) {
- if(indexar[index] && indexar[index]<=me->totface) {
- MFace *mf= &me->mface[indexar[index]-1];
- unsigned int fidx= mf->v4 ? 3:2;
+ for(index=0, mf= me->mface; index < me->totface; index++, mf++) {
+ unsigned int fidx= mf->v4 ? 3:2;
- do {
- unsigned int vidx= *(&mf->v1 + fidx);
+ if ((paint_selmode == SCE_SELECT_FACE) && !(mf->flag & ME_FACE_SEL)) {
+ continue;
+ }
- if(!me->dvert[vidx].flag) {
- if(use_vert_sel && !(me->mvert[vidx].flag & SELECT)) {
- continue;
- }
+ do {
+ unsigned int vidx= *(&mf->v1 + fidx);
- dw= defvert_verify_index(&me->dvert[vidx], vgroup);
- if(dw) {
- uw= defvert_verify_index(wp->wpaint_prev+vidx, vgroup);
- uw->weight= dw->weight; /* set the undo weight */
- dw->weight= paintweight;
-
- if(me->editflag & ME_EDIT_MIRROR_X) { /* x mirror painting */
- int j= mesh_get_x_mirror_vert(ob, vidx);
- if(j>=0) {
- /* copy, not paint again */
- if(vgroup_mirror != -1) {
- dw= defvert_verify_index(me->dvert+j, vgroup_mirror);
- uw= defvert_verify_index(wp->wpaint_prev+j, vgroup_mirror);
- } else {
- dw= defvert_verify_index(me->dvert+j, vgroup);
- uw= defvert_verify_index(wp->wpaint_prev+j, vgroup);
- }
- uw->weight= dw->weight; /* set the undo weight */
- dw->weight= paintweight;
+ if(!me->dvert[vidx].flag) {
+ if((paint_selmode == SCE_SELECT_VERTEX) && !(me->mvert[vidx].flag & SELECT)) {
+ continue;
+ }
+
+ dw= defvert_verify_index(&me->dvert[vidx], vgroup);
+ if(dw) {
+ uw= defvert_verify_index(wp->wpaint_prev+vidx, vgroup);
+ uw->weight= dw->weight; /* set the undo weight */
+ dw->weight= paintweight;
+
+ if(me->editflag & ME_EDIT_MIRROR_X) { /* x mirror painting */
+ int j= mesh_get_x_mirror_vert(ob, vidx);
+ if(j>=0) {
+ /* copy, not paint again */
+ if(vgroup_mirror != -1) {
+ dw= defvert_verify_index(me->dvert+j, vgroup_mirror);
+ uw= defvert_verify_index(wp->wpaint_prev+j, vgroup_mirror);
+ } else {
+ dw= defvert_verify_index(me->dvert+j, vgroup);
+ uw= defvert_verify_index(wp->wpaint_prev+j, vgroup);
}
+ uw->weight= dw->weight; /* set the undo weight */
+ dw->weight= paintweight;
}
}
- me->dvert[vidx].flag= 1;
}
+ me->dvert[vidx].flag= 1;
+ }
-
- } while (fidx--);
- }
+ } while (fidx--);
}
{
@@ -477,8 +456,7 @@ void wpaint_fill(VPaint *wp, Object *ob, float paintweight)
dv->flag= 0;
}
}
-
- MEM_freeN(indexar);
+
copy_wpaint_prev(wp, NULL, 0);
DAG_id_tag_update(&me->id, 0);
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index d8157743438..623cfc48827 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -77,14 +77,14 @@
/******************** open sound operator ********************/
-static int open_cancel(bContext *UNUSED(C), wmOperator *op)
+static int sound_open_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
op->customdata= NULL;
return OPERATOR_CANCELLED;
}
-static void open_init(bContext *C, wmOperator *op)
+static void sound_open_init(bContext *C, wmOperator *op)
{
PropertyPointerRNA *pprop;
@@ -93,7 +93,7 @@ static void open_init(bContext *C, wmOperator *op)
}
#ifdef WITH_AUDASPACE
-static int open_exec(bContext *C, wmOperator *op)
+static int sound_open_exec(bContext *C, wmOperator *op)
{
char path[FILE_MAX];
bSound *sound;
@@ -106,7 +106,7 @@ static int open_exec(bContext *C, wmOperator *op)
sound = sound_new_file(bmain, path);
if(!op->customdata)
- open_init(C, op);
+ sound_open_init(C, op);
if (sound==NULL || sound->playback_handle == NULL) {
if(op->customdata) MEM_freeN(op->customdata);
@@ -151,7 +151,7 @@ static int open_exec(bContext *C, wmOperator *op)
#else //WITH_AUDASPACE
-static int open_exec(bContext *UNUSED(C), wmOperator *op)
+static int sound_open_exec(bContext *UNUSED(C), wmOperator *op)
{
BKE_report(op->reports, RPT_ERROR, "Compiled without sound support");
@@ -160,12 +160,12 @@ static int open_exec(bContext *UNUSED(C), wmOperator *op)
#endif
-static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int sound_open_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
if(RNA_property_is_set(op->ptr, "filepath"))
- return open_exec(C, op);
+ return sound_open_exec(C, op);
- open_init(C, op);
+ sound_open_init(C, op);
return WM_operator_filesel(C, op, event);
}
@@ -178,9 +178,9 @@ static void SOUND_OT_open(wmOperatorType *ot)
ot->idname= "SOUND_OT_open";
/* api callbacks */
- ot->exec= open_exec;
- ot->invoke= open_invoke;
- ot->cancel= open_cancel;
+ ot->exec= sound_open_exec;
+ ot->invoke= sound_open_invoke;
+ ot->cancel= sound_open_cancel;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -199,9 +199,9 @@ static void SOUND_OT_open_mono(wmOperatorType *ot)
ot->idname= "SOUND_OT_open_mono";
/* api callbacks */
- ot->exec= open_exec;
- ot->invoke= open_invoke;
- ot->cancel= open_cancel;
+ ot->exec= sound_open_exec;
+ ot->invoke= sound_open_invoke;
+ ot->cancel= sound_open_cancel;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -214,7 +214,7 @@ static void SOUND_OT_open_mono(wmOperatorType *ot)
/******************** mixdown operator ********************/
-static int mixdown_exec(bContext *C, wmOperator *op)
+static int sound_mixdown_exec(bContext *C, wmOperator *op)
{
#ifdef WITH_AUDASPACE
char path[FILE_MAX];
@@ -257,15 +257,15 @@ static int mixdown_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int mixdown_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int sound_mixdown_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
if(RNA_property_is_set(op->ptr, "filepath"))
- return mixdown_exec(C, op);
+ return sound_mixdown_exec(C, op);
return WM_operator_filesel(C, op, event);
}
-static int mixdown_draw_check_prop(PropertyRNA *prop)
+static int sound_mixdown_draw_check_prop(PropertyRNA *prop)
{
const char *prop_id= RNA_property_identifier(prop);
return !( strcmp(prop_id, "filepath") == 0 ||
@@ -275,7 +275,7 @@ static int mixdown_draw_check_prop(PropertyRNA *prop)
}
#ifdef WITH_AUDASPACE
-static void mixdown_draw(bContext *C, wmOperator *op)
+static void sound_mixdown_draw(bContext *C, wmOperator *op)
{
static EnumPropertyItem pcm_format_items[] = {
{AUD_FORMAT_U8, "U8", 0, "U8", "8 bit unsigned"},
@@ -424,7 +424,7 @@ static void mixdown_draw(bContext *C, wmOperator *op)
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
/* main draw call */
- uiDefAutoButsRNA(layout, &ptr, mixdown_draw_check_prop, '\0');
+ uiDefAutoButsRNA(layout, &ptr, sound_mixdown_draw_check_prop, '\0');
}
#endif // WITH_AUDASPACE
@@ -476,11 +476,11 @@ static void SOUND_OT_mixdown(wmOperatorType *ot)
ot->idname= "SOUND_OT_mixdown";
/* api callbacks */
- ot->exec= mixdown_exec;
- ot->invoke= mixdown_invoke;
+ ot->exec= sound_mixdown_exec;
+ ot->invoke= sound_mixdown_invoke;
#ifdef WITH_AUDASPACE
- ot->ui= mixdown_draw;
+ ot->ui= sound_mixdown_draw;
#endif
/* flags */
ot->flag= OPTYPE_REGISTER;
@@ -509,7 +509,7 @@ static int sound_poll(bContext *C)
}
/********************* pack operator *********************/
-static int pack_exec(bContext *C, wmOperator *op)
+static int sound_pack_exec(bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
Editing* ed = CTX_data_scene(C)->ed;
@@ -537,7 +537,7 @@ static void SOUND_OT_pack(wmOperatorType *ot)
ot->idname= "SOUND_OT_pack";
/* api callbacks */
- ot->exec= pack_exec;
+ ot->exec= sound_pack_exec;
ot->poll= sound_poll;
/* flags */
@@ -615,7 +615,7 @@ static void SOUND_OT_unpack(wmOperatorType *ot)
/* ******************************************************* */
-static int update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op))
+static int sound_update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op))
{
Sequence* seq;
Scene* scene = CTX_data_scene(C);
@@ -667,7 +667,7 @@ static void SOUND_OT_update_animation_flags(wmOperatorType *ot)
ot->idname= "SOUND_OT_update_animation_flags";
/* api callbacks */
- ot->exec= update_animation_flags_exec;
+ ot->exec= sound_update_animation_flags_exec;
/* flags */
ot->flag= OPTYPE_REGISTER;
@@ -675,14 +675,14 @@ static void SOUND_OT_update_animation_flags(wmOperatorType *ot)
/* ******************************************************* */
-static int bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
+static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
{
Main* bmain = CTX_data_main(C);
Scene* scene = CTX_data_scene(C);
int oldfra = scene->r.cfra;
int cfra;
- update_animation_flags_exec(C, NULL);
+ sound_update_animation_flags_exec(C, NULL);
for(cfra = scene->r.sfra > 0 ? scene->r.sfra - 1 : 0; cfra <= scene->r.efra + 1; cfra++)
{
@@ -704,7 +704,7 @@ static void SOUND_OT_bake_animation(wmOperatorType *ot)
ot->idname= "SOUND_OT_bake_animation";
/* api callbacks */
- ot->exec= bake_animation_exec;
+ ot->exec= sound_bake_animation_exec;
/* flags */
ot->flag= OPTYPE_REGISTER;
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index eb29dfb2ce1..a044651652e 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -492,7 +492,6 @@ void ACTION_OT_copy (wmOperatorType *ot)
ot->description= "Copy selected keyframes to the copy/paste buffer";
/* api callbacks */
-// ot->invoke= WM_operator_props_popup; // better wait for graph redo panel
ot->exec= actkeys_copy_exec;
ot->poll= ED_operator_action_active;
@@ -510,10 +509,9 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op)
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
- if (ac.reports==NULL) {
- ac.reports= op->reports;
- }
+
+ /* ac.reports by default will be the global reports list, which won't show warnings */
+ ac.reports= op->reports;
/* paste keyframes */
if (ac.datatype == ANIMCONT_GPENCIL) {
@@ -522,8 +520,8 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
else {
+ /* non-zero return means an error occurred while trying to paste */
if (paste_action_keys(&ac, offset_mode, merge_mode)) {
- BKE_report(op->reports, RPT_ERROR, "No keyframes to paste");
return OPERATOR_CANCELLED;
}
}
@@ -545,12 +543,14 @@ void ACTION_OT_paste (wmOperatorType *ot)
ot->description= "Paste keyframes from copy/paste buffer for the selected channels, starting on the current frame";
/* api callbacks */
+// ot->invoke= WM_operator_props_popup; // better wait for action redo panel
ot->exec= actkeys_paste_exec;
ot->poll= ED_operator_action_active;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
+
+ /* props */
RNA_def_enum(ot->srna, "offset", keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys");
RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merging pasted keys and existing");
}
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index 99ab356ac5f..905f7bc80b6 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -81,7 +81,6 @@ void ED_spacetypes_init(void)
ED_spacetype_buttons();
ED_spacetype_info();
ED_spacetype_file();
- ED_spacetype_sound();
ED_spacetype_action();
ED_spacetype_nla();
ED_spacetype_script();
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index 9ac9f730fdc..23316616a57 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -282,7 +282,7 @@ static int console_line_insert(ConsoleLine *ci, char *str)
/* static funcs for text editing */
/* similar to the text editor, with some not used. keep compatible */
-static EnumPropertyItem move_type_items[]= {
+static EnumPropertyItem console_move_type_items[]= {
{LINE_BEGIN, "LINE_BEGIN", 0, "Line Begin", ""},
{LINE_END, "LINE_END", 0, "Line End", ""},
{PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""},
@@ -291,7 +291,7 @@ static EnumPropertyItem move_type_items[]= {
{NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
{0, NULL, 0, NULL, NULL}};
-static int move_exec(bContext *C, wmOperator *op)
+static int console_move_exec(bContext *C, wmOperator *op)
{
ConsoleLine *ci= console_history_verify(C);
@@ -364,15 +364,15 @@ void CONSOLE_OT_move(wmOperatorType *ot)
ot->idname= "CONSOLE_OT_move";
/* api callbacks */
- ot->exec= move_exec;
+ ot->exec= console_move_exec;
ot->poll= ED_operator_console_active;
/* properties */
- RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to");
+ RNA_def_enum(ot->srna, "type", console_move_type_items, LINE_BEGIN, "Type", "Where to move cursor to");
}
#define TAB_LENGTH 4
-static int insert_exec(bContext *C, wmOperator *op)
+static int console_insert_exec(bContext *C, wmOperator *op)
{
SpaceConsole *sc= CTX_wm_space_console(C);
ARegion *ar= CTX_wm_region(C);
@@ -408,7 +408,7 @@ static int insert_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int console_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
// if(!RNA_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */
if(!RNA_string_length(op->ptr, "text")) {
@@ -424,7 +424,7 @@ static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_string_set(op->ptr, "text", str);
}
}
- return insert_exec(C, op);
+ return console_insert_exec(C, op);
}
void CONSOLE_OT_insert(wmOperatorType *ot)
@@ -435,8 +435,8 @@ void CONSOLE_OT_insert(wmOperatorType *ot)
ot->idname= "CONSOLE_OT_insert";
/* api callbacks */
- ot->exec= insert_exec;
- ot->invoke= insert_invoke;
+ ot->exec= console_insert_exec;
+ ot->invoke= console_insert_invoke;
ot->poll= ED_operator_console_active;
/* properties */
@@ -444,14 +444,14 @@ void CONSOLE_OT_insert(wmOperatorType *ot)
}
-static EnumPropertyItem delete_type_items[]= {
+static EnumPropertyItem console_delete_type_items[]= {
{DEL_NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""},
{DEL_PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""},
// {DEL_NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
// {DEL_PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""},
{0, NULL, 0, NULL, NULL}};
-static int delete_exec(bContext *C, wmOperator *op)
+static int console_delete_exec(bContext *C, wmOperator *op)
{
SpaceConsole *sc= CTX_wm_space_console(C);
ARegion *ar= CTX_wm_region(C);
@@ -506,16 +506,16 @@ void CONSOLE_OT_delete(wmOperatorType *ot)
ot->idname= "CONSOLE_OT_delete";
/* api callbacks */
- ot->exec= delete_exec;
+ ot->exec= console_delete_exec;
ot->poll= ED_operator_console_active;
/* properties */
- RNA_def_enum(ot->srna, "type", delete_type_items, DEL_NEXT_CHAR, "Type", "Which part of the text to delete");
+ RNA_def_enum(ot->srna, "type", console_delete_type_items, DEL_NEXT_CHAR, "Type", "Which part of the text to delete");
}
/* the python exec operator uses this */
-static int clear_exec(bContext *C, wmOperator *op)
+static int console_clear_exec(bContext *C, wmOperator *op)
{
SpaceConsole *sc= CTX_wm_space_console(C);
ARegion *ar= CTX_wm_region(C);
@@ -549,7 +549,7 @@ void CONSOLE_OT_clear(wmOperatorType *ot)
ot->idname= "CONSOLE_OT_clear";
/* api callbacks */
- ot->exec= clear_exec;
+ ot->exec= console_clear_exec;
ot->poll= ED_operator_console_active;
/* properties */
@@ -560,7 +560,7 @@ void CONSOLE_OT_clear(wmOperatorType *ot)
/* the python exec operator uses this */
-static int history_cycle_exec(bContext *C, wmOperator *op)
+static int console_history_cycle_exec(bContext *C, wmOperator *op)
{
SpaceConsole *sc= CTX_wm_space_console(C);
ARegion *ar= CTX_wm_region(C);
@@ -617,7 +617,7 @@ void CONSOLE_OT_history_cycle(wmOperatorType *ot)
ot->idname= "CONSOLE_OT_history_cycle";
/* api callbacks */
- ot->exec= history_cycle_exec;
+ ot->exec= console_history_cycle_exec;
ot->poll= ED_operator_console_active;
/* properties */
@@ -626,7 +626,7 @@ void CONSOLE_OT_history_cycle(wmOperatorType *ot)
/* the python exec operator uses this */
-static int history_append_exec(bContext *C, wmOperator *op)
+static int console_history_append_exec(bContext *C, wmOperator *op)
{
SpaceConsole *sc= CTX_wm_space_console(C);
ARegion *ar= CTX_wm_region(C);
@@ -668,7 +668,7 @@ void CONSOLE_OT_history_append(wmOperatorType *ot)
ot->idname= "CONSOLE_OT_history_append";
/* api callbacks */
- ot->exec= history_append_exec;
+ ot->exec= console_history_append_exec;
ot->poll= ED_operator_console_active;
/* properties */
@@ -679,7 +679,7 @@ void CONSOLE_OT_history_append(wmOperatorType *ot)
/* the python exec operator uses this */
-static int scrollback_append_exec(bContext *C, wmOperator *op)
+static int console_scrollback_append_exec(bContext *C, wmOperator *op)
{
SpaceConsole *sc= CTX_wm_space_console(C);
ARegion *ar= CTX_wm_region(C);
@@ -722,7 +722,7 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot)
ot->idname= "CONSOLE_OT_scrollback_append";
/* api callbacks */
- ot->exec= scrollback_append_exec;
+ ot->exec= console_scrollback_append_exec;
ot->poll= ED_operator_console_active;
/* properties */
@@ -731,7 +731,7 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot)
}
-static int copy_exec(bContext *C, wmOperator *UNUSED(op))
+static int console_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceConsole *sc= CTX_wm_space_console(C);
@@ -806,12 +806,12 @@ void CONSOLE_OT_copy(wmOperatorType *ot)
/* api callbacks */
ot->poll= ED_operator_console_active;
- ot->exec= copy_exec;
+ ot->exec= console_copy_exec;
/* properties */
}
-static int paste_exec(bContext *C, wmOperator *UNUSED(op))
+static int console_paste_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceConsole *sc= CTX_wm_space_console(C);
ARegion *ar= CTX_wm_region(C);
@@ -859,7 +859,7 @@ void CONSOLE_OT_paste(wmOperatorType *ot)
/* api callbacks */
ot->poll= ED_operator_console_active;
- ot->exec= paste_exec;
+ ot->exec= console_paste_exec;
/* properties */
}
@@ -870,7 +870,7 @@ typedef struct SetConsoleCursor {
} SetConsoleCursor;
// TODO, cursor placement without selection
-static void set_cursor_to_pos(SpaceConsole *sc, ARegion *ar, SetConsoleCursor *scu, int mval[2], int UNUSED(sel))
+static void console_cursor_set_to_pos(SpaceConsole *sc, ARegion *ar, SetConsoleCursor *scu, int mval[2], int UNUSED(sel))
{
int pos;
pos= console_char_pick(sc, ar, mval);
@@ -908,7 +908,7 @@ static void console_modal_select_apply(bContext *C, wmOperator *op, wmEvent *eve
sel_prev[0]= sc->sel_start;
sel_prev[1]= sc->sel_end;
- set_cursor_to_pos(sc, ar, scu, mval, TRUE);
+ console_cursor_set_to_pos(sc, ar, scu, mval, TRUE);
/* only redraw if the selection changed */
if(sel_prev[0] != sc->sel_start || sel_prev[1] != sc->sel_end) {
@@ -916,7 +916,7 @@ static void console_modal_select_apply(bContext *C, wmOperator *op, wmEvent *eve
}
}
-static void set_cursor_exit(bContext *UNUSED(C), wmOperator *op)
+static void console_cursor_set_exit(bContext *UNUSED(C), wmOperator *op)
{
// SpaceConsole *sc= CTX_wm_space_console(C);
SetConsoleCursor *scu= op->customdata;
@@ -958,7 +958,7 @@ static int console_modal_select(bContext *C, wmOperator *op, wmEvent *event)
case LEFTMOUSE:
case MIDDLEMOUSE:
case RIGHTMOUSE:
- set_cursor_exit(C, op);
+ console_cursor_set_exit(C, op);
return OPERATOR_FINISHED;
case MOUSEMOVE:
console_modal_select_apply(C, op, event);
@@ -970,7 +970,7 @@ static int console_modal_select(bContext *C, wmOperator *op, wmEvent *event)
static int console_modal_select_cancel(bContext *C, wmOperator *op)
{
- set_cursor_exit(C, op);
+ console_cursor_set_exit(C, op);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index bcd35c63a41..e739c5fe22e 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -374,7 +374,7 @@ void filelist_init_icons(void)
#ifdef WITH_HEADLESS
bbuf = NULL;
#else
- bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_prvicons, datatoc_prvicons_size, IB_rect);
+ bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_prvicons, datatoc_prvicons_size, IB_rect, "<splash>");
#endif
if (bbuf) {
for (y=0; y<SPECIAL_IMG_ROWS; y++) {
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 455b1bc0bdf..460e46fce30 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -727,11 +727,10 @@ static int graphkeys_paste_exec(bContext *C, wmOperator *op)
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
- if(ac.reports==NULL) {
- ac.reports= op->reports;
- }
+ /* ac.reports by default will be the global reports list, which won't show warnings */
+ ac.reports= op->reports;
- /* paste keyframes */
+ /* paste keyframes - non-zero return means an error occurred while trying to paste */
if (paste_graph_keys(&ac, offset_mode, merge_mode)) {
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index d0efdefe5a5..bc4fa398221 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -57,10 +57,6 @@ void graph_draw_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct AR
void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar);
/* ***************************************** */
-/* graph_header.c */
-void graph_header_buttons(const bContext *C, struct ARegion *ar);
-
-/* ***************************************** */
/* graph_select.c */
void GRAPH_OT_select_all_toggle(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h
index 051926bf689..4310b5dbae8 100644
--- a/source/blender/editors/space_image/image_intern.h
+++ b/source/blender/editors/space_image/image_intern.h
@@ -51,9 +51,6 @@ struct ARegion *image_has_scope_region(struct ScrArea *sa);
extern const char *image_context_dir[]; /* doc access */
-/* image_header.c */
-void image_header_buttons(const struct bContext *C, struct ARegion *ar);
-
void IMAGE_OT_toolbox(struct wmOperatorType *ot);
/* image_draw.c */
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index f5164dc32d3..c83baf24c1c 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -134,18 +134,27 @@ static int space_image_file_exists_poll(bContext *C)
SpaceImage *sima= CTX_wm_space_image(C);
ImBuf *ibuf;
void *lock;
- int poll= 0;
+ int ret= FALSE;
char name[FILE_MAX];
ibuf= ED_space_image_acquire_buffer(sima, &lock);
if(ibuf) {
BLI_strncpy(name, ibuf->name, FILE_MAX);
BLI_path_abs(name, bmain->name);
- poll= (BLI_exists(name) && BLI_file_is_writable(name));
+
+ if(BLI_exists(name) == FALSE) {
+ CTX_wm_operator_poll_msg_set(C, "image file not found");
+ }
+ else if (BLI_file_is_writable(name) == FALSE) {
+ CTX_wm_operator_poll_msg_set(C, "image path can't be written to");
+ }
+ else {
+ ret= TRUE;
+ }
}
ED_space_image_release_buffer(sima, lock);
- return poll;
+ return ret;
}
return 0;
}
@@ -177,7 +186,7 @@ typedef struct ViewPanData {
int event_type;
} ViewPanData;
-static void view_pan_init(bContext *C, wmOperator *op, wmEvent *event)
+static void image_view_pan_init(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceImage *sima= CTX_wm_space_image(C);
ViewPanData *vpd;
@@ -194,7 +203,7 @@ static void view_pan_init(bContext *C, wmOperator *op, wmEvent *event)
WM_event_add_modal_handler(C, op);
}
-static void view_pan_exit(bContext *C, wmOperator *op, int cancel)
+static void image_view_pan_exit(bContext *C, wmOperator *op, int cancel)
{
SpaceImage *sima= CTX_wm_space_image(C);
ViewPanData *vpd= op->customdata;
@@ -209,7 +218,7 @@ static void view_pan_exit(bContext *C, wmOperator *op, int cancel)
MEM_freeN(op->customdata);
}
-static int view_pan_exec(bContext *C, wmOperator *op)
+static int image_view_pan_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima= CTX_wm_space_image(C);
float offset[2];
@@ -232,7 +241,7 @@ static int view_pan_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int image_view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
if (event->type == MOUSEPAN) {
SpaceImage *sima= CTX_wm_space_image(C);
@@ -242,16 +251,16 @@ static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event)
offset[1]= (event->y - event->prevy)/sima->zoom;
RNA_float_set_array(op->ptr, "offset", offset);
- view_pan_exec(C, op);
+ image_view_pan_exec(C, op);
return OPERATOR_FINISHED;
}
else {
- view_pan_init(C, op, event);
+ image_view_pan_init(C, op, event);
return OPERATOR_RUNNING_MODAL;
}
}
-static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
+static int image_view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceImage *sima= CTX_wm_space_image(C);
ViewPanData *vpd= op->customdata;
@@ -264,11 +273,11 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
offset[0]= (vpd->x - event->x)/sima->zoom;
offset[1]= (vpd->y - event->y)/sima->zoom;
RNA_float_set_array(op->ptr, "offset", offset);
- view_pan_exec(C, op);
+ image_view_pan_exec(C, op);
break;
default:
if(event->type==vpd->event_type && event->val==KM_RELEASE) {
- view_pan_exit(C, op, 0);
+ image_view_pan_exit(C, op, 0);
return OPERATOR_FINISHED;
}
break;
@@ -277,9 +286,9 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int view_pan_cancel(bContext *C, wmOperator *op)
+static int image_view_pan_cancel(bContext *C, wmOperator *op)
{
- view_pan_exit(C, op, 1);
+ image_view_pan_exit(C, op, 1);
return OPERATOR_CANCELLED;
}
@@ -290,10 +299,10 @@ void IMAGE_OT_view_pan(wmOperatorType *ot)
ot->idname= "IMAGE_OT_view_pan";
/* api callbacks */
- ot->exec= view_pan_exec;
- ot->invoke= view_pan_invoke;
- ot->modal= view_pan_modal;
- ot->cancel= view_pan_cancel;
+ ot->exec= image_view_pan_exec;
+ ot->invoke= image_view_pan_invoke;
+ ot->modal= image_view_pan_modal;
+ ot->cancel= image_view_pan_cancel;
ot->poll= space_image_main_area_poll;
/* flags */
@@ -312,7 +321,7 @@ typedef struct ViewZoomData {
int event_type;
} ViewZoomData;
-static void view_zoom_init(bContext *C, wmOperator *op, wmEvent *event)
+static void image_view_zoom_init(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceImage *sima= CTX_wm_space_image(C);
ViewZoomData *vpd;
@@ -328,7 +337,7 @@ static void view_zoom_init(bContext *C, wmOperator *op, wmEvent *event)
WM_event_add_modal_handler(C, op);
}
-static void view_zoom_exit(bContext *C, wmOperator *op, int cancel)
+static void image_view_zoom_exit(bContext *C, wmOperator *op, int cancel)
{
SpaceImage *sima= CTX_wm_space_image(C);
ViewZoomData *vpd= op->customdata;
@@ -342,7 +351,7 @@ static void view_zoom_exit(bContext *C, wmOperator *op, int cancel)
MEM_freeN(op->customdata);
}
-static int view_zoom_exec(bContext *C, wmOperator *op)
+static int image_view_zoom_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima= CTX_wm_space_image(C);
ARegion *ar= CTX_wm_region(C);
@@ -363,7 +372,7 @@ static int view_zoom_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int image_view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
if (event->type == MOUSEZOOM) {
SpaceImage *sima= CTX_wm_space_image(C);
@@ -378,12 +387,12 @@ static int view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_FINISHED;
}
else {
- view_zoom_init(C, op, event);
+ image_view_zoom_init(C, op, event);
return OPERATOR_RUNNING_MODAL;
}
}
-static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
+static int image_view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceImage *sima= CTX_wm_space_image(C);
ARegion *ar= CTX_wm_region(C);
@@ -399,7 +408,7 @@ static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
break;
default:
if(event->type==vpd->event_type && event->val==KM_RELEASE) {
- view_zoom_exit(C, op, 0);
+ image_view_zoom_exit(C, op, 0);
return OPERATOR_FINISHED;
}
break;
@@ -408,9 +417,9 @@ static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int view_zoom_cancel(bContext *C, wmOperator *op)
+static int image_view_zoom_cancel(bContext *C, wmOperator *op)
{
- view_zoom_exit(C, op, 1);
+ image_view_zoom_exit(C, op, 1);
return OPERATOR_CANCELLED;
}
@@ -421,10 +430,10 @@ void IMAGE_OT_view_zoom(wmOperatorType *ot)
ot->idname= "IMAGE_OT_view_zoom";
/* api callbacks */
- ot->exec= view_zoom_exec;
- ot->invoke= view_zoom_invoke;
- ot->modal= view_zoom_modal;
- ot->cancel= view_zoom_cancel;
+ ot->exec= image_view_zoom_exec;
+ ot->invoke= image_view_zoom_invoke;
+ ot->modal= image_view_zoom_modal;
+ ot->cancel= image_view_zoom_cancel;
ot->poll= space_image_main_area_poll;
/* flags */
@@ -443,7 +452,7 @@ void IMAGE_OT_view_zoom(wmOperatorType *ot)
* that explains the negative signs in the code below
*/
-static int view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
+static int image_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
if (event->type != NDOF_MOTION)
return OPERATOR_CANCELLED;
@@ -489,7 +498,7 @@ void IMAGE_OT_view_ndof(wmOperatorType *ot)
ot->idname= "IMAGE_OT_view_ndof";
/* api callbacks */
- ot->invoke= view_ndof_invoke;
+ ot->invoke= image_view_ndof_invoke;
}
/********************** view all operator *********************/
@@ -498,7 +507,7 @@ void IMAGE_OT_view_ndof(wmOperatorType *ot)
* Default behavior is to reset the position of the image and set the zoom to 1
* If the image will not fit within the window rectangle, the zoom is adjusted */
-static int view_all_exec(bContext *C, wmOperator *UNUSED(op))
+static int image_view_all_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceImage *sima;
ARegion *ar;
@@ -542,13 +551,13 @@ void IMAGE_OT_view_all(wmOperatorType *ot)
ot->idname= "IMAGE_OT_view_all";
/* api callbacks */
- ot->exec= view_all_exec;
+ ot->exec= image_view_all_exec;
ot->poll= space_image_main_area_poll;
}
/********************** view selected operator *********************/
-static int view_selected_exec(bContext *C, wmOperator *UNUSED(op))
+static int image_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceImage *sima;
ARegion *ar;
@@ -591,7 +600,7 @@ static int view_selected_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-static int view_selected_poll(bContext *C)
+static int image_view_selected_poll(bContext *C)
{
return (space_image_main_area_poll(C) && ED_operator_uvedit(C));
}
@@ -603,13 +612,13 @@ void IMAGE_OT_view_selected(wmOperatorType *ot)
ot->idname= "IMAGE_OT_view_selected";
/* api callbacks */
- ot->exec= view_selected_exec;
- ot->poll= view_selected_poll;
+ ot->exec= image_view_selected_exec;
+ ot->poll= image_view_selected_poll;
}
/********************** view zoom in/out operator *********************/
-static int view_zoom_in_exec(bContext *C, wmOperator *UNUSED(op))
+static int image_view_zoom_in_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceImage *sima= CTX_wm_space_image(C);
ARegion *ar= CTX_wm_region(C);
@@ -628,11 +637,11 @@ void IMAGE_OT_view_zoom_in(wmOperatorType *ot)
ot->idname= "IMAGE_OT_view_zoom_in";
/* api callbacks */
- ot->exec= view_zoom_in_exec;
+ ot->exec= image_view_zoom_in_exec;
ot->poll= space_image_main_area_poll;
}
-static int view_zoom_out_exec(bContext *C, wmOperator *UNUSED(op))
+static int image_view_zoom_out_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceImage *sima= CTX_wm_space_image(C);
ARegion *ar= CTX_wm_region(C);
@@ -651,13 +660,13 @@ void IMAGE_OT_view_zoom_out(wmOperatorType *ot)
ot->idname= "IMAGE_OT_view_zoom_out";
/* api callbacks */
- ot->exec= view_zoom_out_exec;
+ ot->exec= image_view_zoom_out_exec;
ot->poll= space_image_main_area_poll;
}
/********************** view zoom ratio operator *********************/
-static int view_zoom_ratio_exec(bContext *C, wmOperator *op)
+static int image_view_zoom_ratio_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima= CTX_wm_space_image(C);
ARegion *ar= CTX_wm_region(C);
@@ -689,7 +698,7 @@ void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot)
ot->idname= "IMAGE_OT_view_zoom_ratio";
/* api callbacks */
- ot->exec= view_zoom_ratio_exec;
+ ot->exec= image_view_zoom_ratio_exec;
ot->poll= space_image_main_area_poll;
/* properties */
@@ -740,7 +749,7 @@ static void image_filesel(bContext *C, wmOperator *op, const char *path)
/******************** open image operator ********************/
-static void open_init(bContext *C, wmOperator *op)
+static void image_open_init(bContext *C, wmOperator *op)
{
PropertyPointerRNA *pprop;
@@ -748,14 +757,14 @@ static void open_init(bContext *C, wmOperator *op)
uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
}
-static int open_cancel(bContext *UNUSED(C), wmOperator *op)
+static int image_open_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
op->customdata= NULL;
return OPERATOR_CANCELLED;
}
-static int open_exec(bContext *C, wmOperator *op)
+static int image_open_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima= CTX_wm_space_image(C); /* XXX other space types can call */
Scene *scene= CTX_data_scene(C);
@@ -780,7 +789,7 @@ static int open_exec(bContext *C, wmOperator *op)
}
if(!op->customdata)
- open_init(C, op);
+ image_open_init(C, op);
/* hook into UI */
pprop= op->customdata;
@@ -823,7 +832,7 @@ static int open_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int image_open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
SpaceImage *sima= CTX_wm_space_image(C); /* XXX other space types can call */
char *path=U.textudir;
@@ -843,9 +852,9 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
path= ima->name;
if(RNA_property_is_set(op->ptr, "filepath"))
- return open_exec(C, op);
+ return image_open_exec(C, op);
- open_init(C, op);
+ image_open_init(C, op);
image_filesel(C, op, path);
@@ -861,9 +870,9 @@ void IMAGE_OT_open(wmOperatorType *ot)
ot->idname= "IMAGE_OT_open";
/* api callbacks */
- ot->exec= open_exec;
- ot->invoke= open_invoke;
- ot->cancel= open_cancel;
+ ot->exec= image_open_exec;
+ ot->invoke= image_open_invoke;
+ ot->cancel= image_open_cancel;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -874,7 +883,7 @@ void IMAGE_OT_open(wmOperatorType *ot)
/******************** replace image operator ********************/
-static int replace_exec(bContext *C, wmOperator *op)
+static int image_replace_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima= CTX_wm_space_image(C);
char str[FILE_MAX];
@@ -894,7 +903,7 @@ static int replace_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int replace_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int image_replace_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
SpaceImage *sima= CTX_wm_space_image(C);
@@ -902,7 +911,7 @@ static int replace_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
return OPERATOR_CANCELLED;
if(RNA_property_is_set(op->ptr, "filepath"))
- return replace_exec(C, op);
+ return image_replace_exec(C, op);
if(!RNA_property_is_set(op->ptr, "relative_path"))
RNA_boolean_set(op->ptr, "relative_path", (strncmp(sima->image->name, "//", 2))==0);
@@ -919,8 +928,8 @@ void IMAGE_OT_replace(wmOperatorType *ot)
ot->idname= "IMAGE_OT_replace";
/* api callbacks */
- ot->exec= replace_exec;
- ot->invoke= replace_invoke;
+ ot->exec= image_replace_exec;
+ ot->invoke= image_replace_invoke;
ot->poll= space_image_poll;
/* flags */
@@ -1032,7 +1041,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
if (ibuf) {
- Main *bmain= CTX_data_main(C);
+ const char *relbase= ID_BLEND_PATH(CTX_data_main(C), &ima->id);
const short relative= (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path"));
const short save_copy= (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy"));
short ok= FALSE;
@@ -1075,19 +1084,11 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
ok= TRUE;
}
- if(ok) {
- if(relative)
- BLI_path_rel(simopts->filepath, bmain->name); /* only after saving */
-
- if(ibuf->name[0]==0) {
- BLI_strncpy(ibuf->name, simopts->filepath, sizeof(ibuf->name));
- BLI_strncpy(ima->name, simopts->filepath, sizeof(ima->name));
- }
-
+ if (ok) {
if(!save_copy) {
if(do_newpath) {
- BLI_strncpy(ima->name, simopts->filepath, sizeof(ima->name));
BLI_strncpy(ibuf->name, simopts->filepath, sizeof(ibuf->name));
+ BLI_strncpy(ima->name, simopts->filepath, sizeof(ima->name));
}
ibuf->userflags &= ~IB_BITMAPDIRTY;
@@ -1112,6 +1113,11 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
ima->source= IMA_SRC_FILE;
ima->type= IMA_TYPE_IMAGE;
}
+
+ /* only image path, never ibuf */
+ if(relative) {
+ BLI_path_rel(ima->name, relbase); /* only after saving */
+ }
}
}
else {
@@ -1127,7 +1133,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
ED_space_image_release_buffer(sima, lock);
}
-static int save_as_exec(bContext *C, wmOperator *op)
+static int image_save_as_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima= CTX_wm_space_image(C);
SaveImageOptions simopts;
@@ -1143,7 +1149,7 @@ static int save_as_exec(bContext *C, wmOperator *op)
}
-static int save_as_check(bContext *UNUSED(C), wmOperator *op)
+static int image_save_as_check(bContext *UNUSED(C), wmOperator *op)
{
char filepath[FILE_MAX];
RNA_string_get(op->ptr, "filepath", filepath);
@@ -1154,7 +1160,7 @@ static int save_as_check(bContext *UNUSED(C), wmOperator *op)
return FALSE;
}
-static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int image_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
SpaceImage *sima= CTX_wm_space_image(C);
Image *ima = ED_space_image(sima);
@@ -1162,7 +1168,7 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
SaveImageOptions simopts;
if(RNA_property_is_set(op->ptr, "filepath"))
- return save_as_exec(C, op);
+ return image_save_as_exec(C, op);
if (save_image_options_init(&simopts, sima, scene, TRUE) == 0)
return OPERATOR_CANCELLED;
@@ -1188,9 +1194,9 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
ot->idname= "IMAGE_OT_save_as";
/* api callbacks */
- ot->exec= save_as_exec;
- ot->check= save_as_check;
- ot->invoke= save_as_invoke;
+ ot->exec= image_save_as_exec;
+ ot->check= image_save_as_check;
+ ot->invoke= image_save_as_invoke;
ot->poll= space_image_buffer_exists_poll;
/* flags */
@@ -1211,7 +1217,7 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
/******************** save image operator ********************/
-static int save_exec(bContext *C, wmOperator *op)
+static int image_save_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima= CTX_wm_space_image(C);
Scene *scene= CTX_data_scene(C);
@@ -1239,7 +1245,7 @@ void IMAGE_OT_save(wmOperatorType *ot)
ot->idname= "IMAGE_OT_save";
/* api callbacks */
- ot->exec= save_exec;
+ ot->exec= image_save_exec;
ot->poll= space_image_file_exists_poll;
/* flags */
@@ -1248,7 +1254,7 @@ void IMAGE_OT_save(wmOperatorType *ot)
/******************* save sequence operator ********************/
-static int save_sequence_exec(bContext *C, wmOperator *op)
+static int image_save_sequence_exec(bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
SpaceImage *sima= CTX_wm_space_image(C);
@@ -1316,7 +1322,7 @@ void IMAGE_OT_save_sequence(wmOperatorType *ot)
ot->idname= "IMAGE_OT_save_sequence";
/* api callbacks */
- ot->exec= save_sequence_exec;
+ ot->exec= image_save_sequence_exec;
ot->poll= space_image_buffer_exists_poll;
/* flags */
@@ -1325,7 +1331,7 @@ void IMAGE_OT_save_sequence(wmOperatorType *ot)
/******************** reload image operator ********************/
-static int reload_exec(bContext *C, wmOperator *UNUSED(op))
+static int image_reload_exec(bContext *C, wmOperator *UNUSED(op))
{
Image *ima= CTX_data_edit_image(C);
SpaceImage *sima= CTX_wm_space_image(C);
@@ -1351,7 +1357,7 @@ void IMAGE_OT_reload(wmOperatorType *ot)
ot->idname= "IMAGE_OT_reload";
/* api callbacks */
- ot->exec= reload_exec;
+ ot->exec= image_reload_exec;
/* flags */
ot->flag= OPTYPE_REGISTER; /* no undo, image buffer is not handled by undo */
@@ -1538,7 +1544,7 @@ void IMAGE_OT_invert(wmOperatorType *ot)
/********************* pack operator *********************/
-static int pack_test(bContext *C, wmOperator *op)
+static int image_pack_test(bContext *C, wmOperator *op)
{
Image *ima= CTX_data_edit_image(C);
int as_png= RNA_boolean_get(op->ptr, "as_png");
@@ -1556,14 +1562,14 @@ static int pack_test(bContext *C, wmOperator *op)
return 1;
}
-static int pack_exec(bContext *C, wmOperator *op)
+static int image_pack_exec(bContext *C, wmOperator *op)
{
struct Main *bmain= CTX_data_main(C);
Image *ima= CTX_data_edit_image(C);
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
int as_png= RNA_boolean_get(op->ptr, "as_png");
- if(!pack_test(C, op))
+ if(!image_pack_test(C, op))
return OPERATOR_CANCELLED;
if(!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) {
@@ -1581,7 +1587,7 @@ static int pack_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int pack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int image_pack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Image *ima= CTX_data_edit_image(C);
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
@@ -1589,7 +1595,7 @@ static int pack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
uiLayout *layout;
int as_png= RNA_boolean_get(op->ptr, "as_png");
- if(!pack_test(C, op))
+ if(!image_pack_test(C, op))
return OPERATOR_CANCELLED;
if(!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) {
@@ -1601,7 +1607,7 @@ static int pack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
return OPERATOR_CANCELLED;
}
- return pack_exec(C, op);
+ return image_pack_exec(C, op);
}
void IMAGE_OT_pack(wmOperatorType *ot)
@@ -1612,8 +1618,8 @@ void IMAGE_OT_pack(wmOperatorType *ot)
ot->idname= "IMAGE_OT_pack";
/* api callbacks */
- ot->exec= pack_exec;
- ot->invoke= pack_invoke;
+ ot->exec= image_pack_exec;
+ ot->invoke= image_pack_invoke;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1721,7 +1727,7 @@ typedef struct ImageSampleInfo {
int draw;
} ImageSampleInfo;
-static void sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_info)
+static void image_sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_info)
{
ImageSampleInfo *info= arg_info;
if(info->draw) {
@@ -1730,7 +1736,7 @@ static void sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_info)
}
}
-static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
+static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceImage *sima= CTX_wm_space_image(C);
ARegion *ar= CTX_wm_region(C);
@@ -1840,7 +1846,7 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
ED_area_tag_redraw(CTX_wm_area(C));
}
-static void sample_exit(bContext *C, wmOperator *op)
+static void image_sample_exit(bContext *C, wmOperator *op)
{
ImageSampleInfo *info= op->customdata;
@@ -1849,7 +1855,7 @@ static void sample_exit(bContext *C, wmOperator *op)
MEM_freeN(info);
}
-static int sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int image_sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceImage *sima= CTX_wm_space_image(C);
ARegion *ar= CTX_wm_region(C);
@@ -1860,34 +1866,34 @@ static int sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
info= MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
info->art= ar->type;
- info->draw_handle = ED_region_draw_cb_activate(ar->type, sample_draw, info, REGION_DRAW_POST_PIXEL);
+ info->draw_handle = ED_region_draw_cb_activate(ar->type, image_sample_draw, info, REGION_DRAW_POST_PIXEL);
op->customdata= info;
- sample_apply(C, op, event);
+ image_sample_apply(C, op, event);
WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
-static int sample_modal(bContext *C, wmOperator *op, wmEvent *event)
+static int image_sample_modal(bContext *C, wmOperator *op, wmEvent *event)
{
switch(event->type) {
case LEFTMOUSE:
case RIGHTMOUSE: // XXX hardcoded
- sample_exit(C, op);
+ image_sample_exit(C, op);
return OPERATOR_CANCELLED;
case MOUSEMOVE:
- sample_apply(C, op, event);
+ image_sample_apply(C, op, event);
break;
}
return OPERATOR_RUNNING_MODAL;
}
-static int sample_cancel(bContext *C, wmOperator *op)
+static int image_sample_cancel(bContext *C, wmOperator *op)
{
- sample_exit(C, op);
+ image_sample_exit(C, op);
return OPERATOR_CANCELLED;
}
@@ -1898,9 +1904,9 @@ void IMAGE_OT_sample(wmOperatorType *ot)
ot->idname= "IMAGE_OT_sample";
/* api callbacks */
- ot->invoke= sample_invoke;
- ot->modal= sample_modal;
- ot->cancel= sample_cancel;
+ ot->invoke= image_sample_invoke;
+ ot->modal= image_sample_modal;
+ ot->cancel= image_sample_cancel;
ot->poll= space_image_main_area_poll;
/* flags */
@@ -1908,7 +1914,7 @@ void IMAGE_OT_sample(wmOperatorType *ot)
}
/******************** sample line operator ********************/
-static int sample_line_exec(bContext *C, wmOperator *op)
+static int image_sample_line_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima= CTX_wm_space_image(C);
ARegion *ar= CTX_wm_region(C);
@@ -1989,7 +1995,7 @@ static int sample_line_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int sample_line_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int image_sample_line_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceImage *sima= CTX_wm_space_image(C);
@@ -2006,9 +2012,9 @@ void IMAGE_OT_sample_line(wmOperatorType *ot)
ot->idname= "IMAGE_OT_sample_line";
/* api callbacks */
- ot->invoke= sample_line_invoke;
+ ot->invoke= image_sample_line_invoke;
ot->modal= WM_gesture_straightline_modal;
- ot->exec= sample_line_exec;
+ ot->exec= image_sample_line_exec;
ot->poll= space_image_main_area_poll;
ot->cancel= WM_gesture_straightline_cancel;
@@ -2035,9 +2041,9 @@ void IMAGE_OT_curves_point_set(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
- ot->invoke= sample_invoke;
- ot->modal= sample_modal;
- ot->cancel= sample_cancel;
+ ot->invoke= image_sample_invoke;
+ ot->modal= image_sample_modal;
+ ot->cancel= image_sample_cancel;
ot->poll= space_image_main_area_poll;
/* properties */
@@ -2052,7 +2058,7 @@ typedef struct RecordCompositeData {
int sfra, efra;
} RecordCompositeData;
-static int record_composite_apply(bContext *C, wmOperator *op)
+static int image_record_composite_apply(bContext *C, wmOperator *op)
{
SpaceImage *sima= CTX_wm_space_image(C);
RecordCompositeData *rcd= op->customdata;
@@ -2080,7 +2086,7 @@ static int record_composite_apply(bContext *C, wmOperator *op)
return (scene->r.cfra <= rcd->efra);
}
-static int record_composite_init(bContext *C, wmOperator *op)
+static int image_record_composite_init(bContext *C, wmOperator *op)
{
SpaceImage *sima= CTX_wm_space_image(C);
Scene *scene= CTX_data_scene(C);
@@ -2101,7 +2107,7 @@ static int record_composite_init(bContext *C, wmOperator *op)
return 1;
}
-static void record_composite_exit(bContext *C, wmOperator *op)
+static void image_record_composite_exit(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
SpaceImage *sima= CTX_wm_space_image(C);
@@ -2122,60 +2128,60 @@ static void record_composite_exit(bContext *C, wmOperator *op)
MEM_freeN(rcd);
}
-static int record_composite_exec(bContext *C, wmOperator *op)
+static int image_record_composite_exec(bContext *C, wmOperator *op)
{
- if(!record_composite_init(C, op))
+ if(!image_record_composite_init(C, op))
return OPERATOR_CANCELLED;
- while(record_composite_apply(C, op))
+ while(image_record_composite_apply(C, op))
;
- record_composite_exit(C, op);
+ image_record_composite_exit(C, op);
return OPERATOR_FINISHED;
}
-static int record_composite_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int image_record_composite_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
RecordCompositeData *rcd;
- if(!record_composite_init(C, op))
+ if(!image_record_composite_init(C, op))
return OPERATOR_CANCELLED;
rcd= op->customdata;
rcd->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.0f);
WM_event_add_modal_handler(C, op);
- if(!record_composite_apply(C, op))
+ if(!image_record_composite_apply(C, op))
return OPERATOR_FINISHED;
return OPERATOR_RUNNING_MODAL;
}
-static int record_composite_modal(bContext *C, wmOperator *op, wmEvent *event)
+static int image_record_composite_modal(bContext *C, wmOperator *op, wmEvent *event)
{
RecordCompositeData *rcd= op->customdata;
switch(event->type) {
case TIMER:
if(rcd->timer == event->customdata) {
- if(!record_composite_apply(C, op)) {
- record_composite_exit(C, op);
+ if(!image_record_composite_apply(C, op)) {
+ image_record_composite_exit(C, op);
return OPERATOR_FINISHED;
}
}
break;
case ESCKEY:
- record_composite_exit(C, op);
+ image_record_composite_exit(C, op);
return OPERATOR_FINISHED;
}
return OPERATOR_RUNNING_MODAL;
}
-static int record_composite_cancel(bContext *C, wmOperator *op)
+static int image_record_composite_cancel(bContext *C, wmOperator *op)
{
- record_composite_exit(C, op);
+ image_record_composite_exit(C, op);
return OPERATOR_CANCELLED;
}
@@ -2186,23 +2192,23 @@ void IMAGE_OT_record_composite(wmOperatorType *ot)
ot->idname= "IMAGE_OT_record_composite";
/* api callbacks */
- ot->exec= record_composite_exec;
- ot->invoke= record_composite_invoke;
- ot->modal= record_composite_modal;
- ot->cancel= record_composite_cancel;
+ ot->exec= image_record_composite_exec;
+ ot->invoke= image_record_composite_invoke;
+ ot->modal= image_record_composite_modal;
+ ot->cancel= image_record_composite_cancel;
ot->poll= space_image_buffer_exists_poll;
}
/********************* cycle render slot operator *********************/
-static int cycle_render_slot_poll(bContext *C)
+static int image_cycle_render_slot_poll(bContext *C)
{
Image *ima= CTX_data_edit_image(C);
return (ima && ima->type == IMA_TYPE_R_RESULT);
}
-static int cycle_render_slot_exec(bContext *C, wmOperator *op)
+static int image_cycle_render_slot_exec(bContext *C, wmOperator *op)
{
Image *ima= CTX_data_edit_image(C);
int a, slot, cur= ima->render_slot;
@@ -2241,8 +2247,8 @@ void IMAGE_OT_cycle_render_slot(wmOperatorType *ot)
ot->idname= "IMAGE_OT_cycle_render_slot";
/* api callbacks */
- ot->exec= cycle_render_slot_exec;
- ot->poll= cycle_render_slot_poll;
+ ot->exec= image_cycle_render_slot_exec;
+ ot->poll= image_cycle_render_slot_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index 2b3785e2810..deff1c77912 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -253,10 +253,12 @@ void FILE_OT_make_paths_absolute(wmOperatorType *ot)
/********************* report missing files operator *********************/
-static int report_missing_files_exec(bContext *UNUSED(C), wmOperator *op)
+static int report_missing_files_exec(bContext *C, wmOperator *op)
{
+ Main *bmain= CTX_data_main(C);
+
/* run the missing file check */
- checkMissingFiles(G.main, op->reports);
+ checkMissingFiles(bmain, op->reports);
return OPERATOR_FINISHED;
}
@@ -276,13 +278,12 @@ void FILE_OT_report_missing_files(wmOperatorType *ot)
/********************* find missing files operator *********************/
-static int find_missing_files_exec(bContext *UNUSED(C), wmOperator *op)
+static int find_missing_files_exec(bContext *C, wmOperator *op)
{
- char *path;
-
- path= RNA_string_get_alloc(op->ptr, "filepath", NULL, 0);
- findMissingFiles(G.main, path);
- MEM_freeN(path);
+ Main *bmain= CTX_data_main(C);
+ const char *searchpath= RNA_string_get_alloc(op->ptr, "filepath", NULL, 0);
+ findMissingFiles(bmain, searchpath, op->reports);
+ MEM_freeN((void *)searchpath);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h
index ec2e22e65fa..00c16d68f36 100644
--- a/source/blender/editors/space_nla/nla_intern.h
+++ b/source/blender/editors/space_nla/nla_intern.h
@@ -51,11 +51,6 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar);
void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar);
/* **************************************** */
-/* nla_header.c */
-
-void nla_header_buttons(const bContext *C, ARegion *ar);
-
-/* **************************************** */
/* nla_select.c */
/* defines for left-right select tool */
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 608a3c4c0b2..96b5548a8c5 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -313,13 +313,9 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
Library *lib= (Library *)tselem->id;
char expanded[FILE_MAX];
- BLI_strncpy(expanded, lib->name, sizeof(expanded));
-
- /* even though we already set the name this syncs the absolute
- * path, this is intentionally not already expanded yet to
- * avoid copying lib->name to its self. */
- BKE_library_filepath_set(lib, expanded);
+ BKE_library_filepath_set(lib, lib->name);
+ BLI_strncpy(expanded, lib->name, sizeof(expanded));
BLI_path_abs(expanded, G.main->name);
if (!BLI_exists(expanded)) {
BKE_reportf(CTX_wm_reports(C), RPT_ERROR, "Library path '%s' does not exist, correct this before saving", expanded);
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 215ab508ab6..4065b3e2e0b 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -229,7 +229,4 @@ void OUTLINER_OT_action_set(struct wmOperatorType *ot);
void outliner_operatortypes(void);
void outliner_keymap(struct wmKeyConfig *keyconf);
-/* outliner_header.c */
-void outliner_header_buttons(const struct bContext *C, struct ARegion *ar);
-
#endif /* ED_OUTLINER_INTERN_H */
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 78907fbd1ed..a4f67f91763 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -310,9 +310,7 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto
static void id_local_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
if (tselem->id->lib && (tselem->id->flag & LIB_EXTERN)) {
- tselem->id->lib= NULL;
- tselem->id->flag= LIB_LOCAL;
- new_id(NULL, tselem->id, NULL);
+ id_clear_lib_data(NULL, tselem->id);
}
}
diff --git a/source/blender/editors/space_script/CMakeLists.txt b/source/blender/editors/space_script/CMakeLists.txt
index fb88d81ddf6..00f8df299e2 100644
--- a/source/blender/editors/space_script/CMakeLists.txt
+++ b/source/blender/editors/space_script/CMakeLists.txt
@@ -35,7 +35,6 @@ set(INC_SYS
set(SRC
script_edit.c
- script_header.c
script_ops.c
space_script.c
diff --git a/source/blender/editors/space_script/script_header.c b/source/blender/editors/space_script/script_header.c
deleted file mode 100644
index 8354dc1e996..00000000000
--- a/source/blender/editors/space_script/script_header.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * ***** 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) 2008 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_script/script_header.c
- * \ingroup spscript
- */
-
-
-#include <string.h>
-#include <stdio.h>
-
-#include "BLI_blenlib.h"
-#include "BLI_utildefines.h"
-
-
-#include "BKE_context.h"
-
-#include "ED_screen.h"
-#include "ED_types.h"
-#include "ED_util.h"
-
-#include "UI_interface.h"
-#include "UI_resources.h"
-#include "UI_view2d.h"
-
-#include "script_intern.h"
-
-/* ************************ header area region *********************** */
-
-static void do_viewmenu(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event))
-{
-
-}
-
-static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *UNUSED(arg))
-{
- ScrArea *curarea= CTX_wm_area(C);
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP);
- uiBlockSetButmFunc(block, do_viewmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- uiEndBlock(C, block);
-
- return block;
-}
-
-static void do_script_buttons(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event))
-{
- //switch(event) {
- //}
-}
-
-
-void script_header_buttons(const bContext *C, ARegion *ar)
-{
- ScrArea *sa= CTX_wm_area(C);
- uiBlock *block;
- int xco, yco= 3;
-
- block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS);
- uiBlockSetHandleFunc(block, do_script_buttons, NULL);
-
- xco= ED_area_header_standardbuttons(C, block, yco);
-
- if((sa->flag & HEADER_NO_PULLDOWN)==0) {
- int xmax;
-
- xmax= GetButStringLength("View");
- uiDefPulldownBut(block, dummy_viewmenu, CTX_wm_area(C),
- "View", xco, yco-2, xmax-3, UI_UNIT_Y, "");
- xco+=UI_UNIT_X+xmax;
- }
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- /* always as last */
- UI_view2d_totRect_set(&ar->v2d, xco+UI_UNIT_X+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
-
- uiEndBlock(C, block);
- uiDrawBlock(C, block);
-}
-
-
diff --git a/source/blender/editors/space_script/script_intern.h b/source/blender/editors/space_script/script_intern.h
index a3565d070eb..98e9699079b 100644
--- a/source/blender/editors/space_script/script_intern.h
+++ b/source/blender/editors/space_script/script_intern.h
@@ -33,10 +33,6 @@
/* internal exports only */
-
-/* script_header.c */
-void script_header_buttons(const bContext *C, ARegion *ar);
-
/* script_ops.c */
void script_operatortypes(void);
void script_keymap(struct wmKeyConfig *keyconf);
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 18360f8df41..ddfa2fd915f 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -72,7 +72,8 @@
#define SEQ_RIGHTHANDLE 2
-/* Note, Dont use WHILE_SEQ while drawing! - it messes up transform, - Campbell */
+/* Note, Dont use SEQ_BEGIN/SEQ_END while drawing!
+ * it messes up transform, - Campbell */
static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, float y1, float x2, float y2);
static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[3])
@@ -253,8 +254,10 @@ static void drawmeta_stipple(int value)
static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, float x2, float y2)
{
- /* Note, this used to use WHILE_SEQ, but it messes up the seq->depth value, (needed by transform when doing overlap checks)
- * so for now, just use the meta's immediate children, could be fixed but its only drawing - Campbell */
+ /* note: this used to use SEQ_BEGIN/SEQ_END, but it messes up the
+ * seq->depth value, (needed by transform when doing overlap checks)
+ * so for now, just use the meta's immediate children, could be fixed but
+ * its only drawing - campbell */
Sequence *seq;
unsigned char col[4];
diff --git a/source/blender/editors/space_sound/CMakeLists.txt b/source/blender/editors/space_sound/CMakeLists.txt
deleted file mode 100644
index ae605760975..00000000000
--- a/source/blender/editors/space_sound/CMakeLists.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
-# ***** END GPL LICENSE BLOCK *****
-
-set(INC
- ../include
- ../../blenkernel
- ../../blenlib
- ../../blenloader
- ../../makesdna
- ../../makesrna
- ../../windowmanager
- ../../../../intern/guardedalloc
-)
-
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
-set(SRC
- sound_header.c
- space_sound.c
-
- sound_intern.h
-)
-
-blender_add_lib(bf_editor_space_sound "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_sound/SConscript b/source/blender/editors/space_sound/SConscript
deleted file mode 100644
index d76fb7939ea..00000000000
--- a/source/blender/editors/space_sound/SConscript
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/python
-Import ('env')
-
-sources = env.Glob('*.c')
-
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf'
-incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include ../../blenloader'
-
-env.BlenderLib ( 'bf_editors_space_sound', sources, Split(incs), [], libtype=['core'], priority=[75] )
diff --git a/source/blender/editors/space_sound/sound_header.c b/source/blender/editors/space_sound/sound_header.c
deleted file mode 100644
index 6e2010c0c63..00000000000
--- a/source/blender/editors/space_sound/sound_header.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * ***** 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) 2008 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_sound/sound_header.c
- * \ingroup spsnd
- */
-
-
-#include <string.h>
-#include <stdio.h>
-
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_utildefines.h"
-
-
-#include "BKE_context.h"
-
-#include "ED_screen.h"
-#include "ED_types.h"
-#include "ED_util.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
-#include "UI_interface.h"
-#include "UI_resources.h"
-#include "UI_view2d.h"
-
-#include "sound_intern.h"
-
-
-/* ************************ header area region *********************** */
-
-static void do_viewmenu(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event))
-{
-
-}
-
-static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *UNUSED(arg))
-{
- ScrArea *curarea= CTX_wm_area(C);
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP);
- uiBlockSetButmFunc(block, do_viewmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- uiEndBlock(C, block);
-
- return block;
-}
-
-static void do_sound_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event)
-{
- switch(event) {
- }
-}
-
-
-void sound_header_buttons(const bContext *C, ARegion *ar)
-{
- ScrArea *sa= CTX_wm_area(C);
- uiBlock *block;
- int xco, yco= 3;
-
- block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS);
- uiBlockSetHandleFunc(block, do_sound_buttons, NULL);
-
- xco= ED_area_header_standardbuttons(C, block, yco);
-
- if((sa->flag & HEADER_NO_PULLDOWN)==0) {
- int xmax;
-
- xmax= GetButStringLength("View");
- uiDefPulldownBut(block, dummy_viewmenu, CTX_wm_area(C),
- "View", xco, yco-2, xmax-3, UI_UNIT_Y, "");
- xco+=UI_UNIT_X+xmax;
- }
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- /* always as last */
- UI_view2d_totRect_set(&ar->v2d, xco+UI_UNIT_X+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
-
- uiEndBlock(C, block);
- uiDrawBlock(C, block);
-}
-
-
diff --git a/source/blender/editors/space_sound/sound_intern.h b/source/blender/editors/space_sound/sound_intern.h
deleted file mode 100644
index 88891ff4913..00000000000
--- a/source/blender/editors/space_sound/sound_intern.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * ***** 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) 2008 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_sound/sound_intern.h
- * \ingroup spsnd
- */
-
-#ifndef ED_SOUND_INTERN_H
-#define ED_SOUND_INTERN_H
-
-/* internal exports only */
-
-
-/* sound_header.c */
-void sound_header_buttons(const bContext *C, ARegion *ar);
-
-
-#endif /* ED_SOUND_INTERN_H */
-
diff --git a/source/blender/editors/space_sound/space_sound.c b/source/blender/editors/space_sound/space_sound.c
deleted file mode 100644
index 83d1b5b06c2..00000000000
--- a/source/blender/editors/space_sound/space_sound.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * ***** 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) 2008 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_sound/space_sound.c
- * \ingroup spsnd
- */
-
-
-#include <string.h>
-#include <stdio.h>
-
-#include "DNA_scene_types.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-#include "BLI_rand.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_context.h"
-#include "BKE_screen.h"
-
-#include "ED_space_api.h"
-#include "ED_screen.h"
-
-#include "BIF_gl.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "UI_resources.h"
-#include "UI_view2d.h"
-
-
-#include "sound_intern.h" // own include
-
-/* ******************** default callbacks for sound space ***************** */
-
-static SpaceLink *sound_new(const bContext *UNUSED(C))
-{
- ARegion *ar;
- SpaceSound *ssound;
-
- ssound= MEM_callocN(sizeof(SpaceSound), "initsound");
- ssound->spacetype= SPACE_SOUND;
-
- /* header */
- ar= MEM_callocN(sizeof(ARegion), "header for sound");
-
- BLI_addtail(&ssound->regionbase, ar);
- ar->regiontype= RGN_TYPE_HEADER;
- ar->alignment= RGN_ALIGN_BOTTOM;
-
- /* main area */
- ar= MEM_callocN(sizeof(ARegion), "main area for sound");
-
- BLI_addtail(&ssound->regionbase, ar);
- ar->regiontype= RGN_TYPE_WINDOW;
-
- ar->v2d.tot.xmin= -4.0f;
- ar->v2d.tot.ymin= -4.0f;
- ar->v2d.tot.xmax= 250.0f;
- ar->v2d.tot.ymax= 255.0f;
-
- ar->v2d.cur.xmin= -4.0f;
- ar->v2d.cur.ymin= -4.0f;
- ar->v2d.cur.xmax= 50.0f;
- ar->v2d.cur.ymax= 255.0f;
-
- ar->v2d.min[0]= 1.0f;
- ar->v2d.min[1]= 259.0f;
-
- ar->v2d.max[0]= MAXFRAMEF;
- ar->v2d.max[1]= 259.0f;
-
- ar->v2d.minzoom= 0.1f;
- ar->v2d.maxzoom= 10.0f;
-
- ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
- ar->v2d.scroll |= (V2D_SCROLL_LEFT);
- ar->v2d.keepzoom= 0;
- ar->v2d.keeptot= 0;
- ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
-
-
- return (SpaceLink *)ssound;
-}
-
-/* not spacelink itself */
-static void sound_free(SpaceLink *UNUSED(sl))
-{
-// SpaceSound *ssound= (SpaceSound*) sl;
-
-
-}
-
-
-/* spacetype; init callback */
-static void sound_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
-{
-
-}
-
-static SpaceLink *sound_duplicate(SpaceLink *sl)
-{
- SpaceSound *ssoundn= MEM_dupallocN(sl);
-
- /* clear or remove stuff from old */
-
- return (SpaceLink *)ssoundn;
-}
-
-
-
-/* add handlers, stuff you only do once or on area/region changes */
-static void sound_main_area_init(wmWindowManager *wm, ARegion *ar)
-{
- wmKeyMap *keymap;
-
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
-
- /* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "Sound", SPACE_SOUND, 0);
- WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
-}
-
-static void sound_main_area_draw(const bContext *C, ARegion *ar)
-{
- /* draw entirely, view changes should be handled here */
- // SpaceSound *ssound= (SpaceSound*)CTX_wm_space_data(C);
- View2D *v2d= &ar->v2d;
-
- /* clear and setup matrix */
- UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
-
- UI_view2d_view_ortho(v2d);
-
- /* data... */
-
-
- /* reset view matrix */
- UI_view2d_view_restore(C);
-
- /* scrollers? */
-}
-
-static void sound_operatortypes(void)
-{
-
-}
-
-static void sound_keymap(struct wmKeyConfig *UNUSED(keyconf))
-{
-
-}
-
-/* add handlers, stuff you only do once or on area/region changes */
-static void sound_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
-{
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
-}
-
-static void sound_header_area_draw(const bContext *C, ARegion *ar)
-{
- float col[3];
-
- /* clear */
- if(ED_screen_area_active(C))
- UI_GetThemeColor3fv(TH_HEADER, col);
- else
- UI_GetThemeColor3fv(TH_HEADERDESEL, col);
-
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- /* set view2d view matrix for scrolling (without scrollers) */
- UI_view2d_view_ortho(&ar->v2d);
-
- sound_header_buttons(C, ar);
-
- /* restore view matrix? */
- UI_view2d_view_restore(C);
-}
-
-static void sound_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn))
-{
- /* context changes */
-}
-
-/* only called once, from space/spacetypes.c */
-void ED_spacetype_sound(void)
-{
- SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype sound");
- ARegionType *art;
-
- st->spaceid= SPACE_SOUND;
- strncpy(st->name, "Sound", BKE_ST_MAXNAME);
-
- st->new= sound_new;
- st->free= sound_free;
- st->init= sound_init;
- st->duplicate= sound_duplicate;
- st->operatortypes= sound_operatortypes;
- st->keymap= sound_keymap;
-
- /* regions: main window */
- art= MEM_callocN(sizeof(ARegionType), "spacetype sound region");
- art->regionid = RGN_TYPE_WINDOW;
- art->init= sound_main_area_init;
- art->draw= sound_main_area_draw;
- art->listener= sound_main_area_listener;
- art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
-
- BLI_addhead(&st->regiontypes, art);
-
- /* regions: header */
- art= MEM_callocN(sizeof(ARegionType), "spacetype sound region");
- art->regionid = RGN_TYPE_HEADER;
- art->prefsizey= HEADERY;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER;
-
- art->init= sound_header_area_init;
- art->draw= sound_header_area_draw;
-
- BLI_addhead(&st->regiontypes, art);
-
- /* regions: channels */
- art= MEM_callocN(sizeof(ARegionType), "spacetype sound region");
- art->regionid = RGN_TYPE_CHANNELS;
- art->prefsizex= 80;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
-
-// art->init= sound_channel_area_init;
-// art->draw= sound_channel_area_draw;
-
- BLI_addhead(&st->regiontypes, art);
-
-
- BKE_spacetype_register(st);
-}
-
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index 7fde4266655..b8e53f752e2 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -98,12 +98,12 @@ static ARegion *text_has_properties_region(ScrArea *sa)
return arnew;
}
-static int properties_poll(bContext *C)
+static int text_properties_poll(bContext *C)
{
return (CTX_wm_space_text(C) != NULL);
}
-static int properties_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_properties_exec(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= text_has_properties_region(sa);
@@ -122,8 +122,8 @@ void TEXT_OT_properties(wmOperatorType *ot)
ot->idname= "TEXT_OT_properties";
/* api callbacks */
- ot->exec= properties_exec;
- ot->poll= properties_poll;
+ ot->exec= text_properties_exec;
+ ot->poll= text_properties_poll;
}
/******************** XXX popup menus *******************/
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index b200a6269f1..e36cdd32ab8 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -153,7 +153,7 @@ void text_update_edited(Text *text)
/******************* new operator *********************/
-static int new_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_new_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceText *st= CTX_wm_space_text(C);
Text *text;
@@ -196,7 +196,7 @@ void TEXT_OT_new(wmOperatorType *ot)
/* api callbacks */
ot->invoke= WM_operator_confirm;
- ot->exec= new_exec;
+ ot->exec= text_new_exec;
ot->poll= text_new_poll;
/* flags */
@@ -205,7 +205,7 @@ void TEXT_OT_new(wmOperatorType *ot)
/******************* open operator *********************/
-static void open_init(bContext *C, wmOperator *op)
+static void text_open_init(bContext *C, wmOperator *op)
{
PropertyPointerRNA *pprop;
@@ -213,13 +213,13 @@ static void open_init(bContext *C, wmOperator *op)
uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
}
-static int open_cancel(bContext *UNUSED(C), wmOperator *op)
+static int text_open_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
return OPERATOR_CANCELLED;
}
-static int open_exec(bContext *C, wmOperator *op)
+static int text_open_exec(bContext *C, wmOperator *op)
{
SpaceText *st= CTX_wm_space_text(C);
Text *text;
@@ -238,7 +238,7 @@ static int open_exec(bContext *C, wmOperator *op)
}
if(!op->customdata)
- open_init(C, op);
+ text_open_init(C, op);
/* hook into UI */
pprop= op->customdata;
@@ -272,15 +272,15 @@ static int open_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int text_open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Text *text= CTX_data_edit_text(C);
char *path= (text && text->name)? text->name: G.main->name;
if(RNA_property_is_set(op->ptr, "filepath"))
- return open_exec(C, op);
+ return text_open_exec(C, op);
- open_init(C, op);
+ text_open_init(C, op);
RNA_string_set(op->ptr, "filepath", path);
WM_event_add_fileselect(C, op);
@@ -295,9 +295,9 @@ void TEXT_OT_open(wmOperatorType *ot)
ot->description= "Open a new text data block";
/* api callbacks */
- ot->exec= open_exec;
- ot->invoke= open_invoke;
- ot->cancel= open_cancel;
+ ot->exec= text_open_exec;
+ ot->invoke= text_open_invoke;
+ ot->cancel= text_open_cancel;
ot->poll= text_new_poll;
/* flags */
@@ -310,7 +310,7 @@ void TEXT_OT_open(wmOperatorType *ot)
/******************* reload operator *********************/
-static int reload_exec(bContext *C, wmOperator *op)
+static int text_reload_exec(bContext *C, wmOperator *op)
{
Text *text= CTX_data_edit_text(C);
@@ -340,7 +340,7 @@ void TEXT_OT_reload(wmOperatorType *ot)
ot->description= "Reload active text data block from its file";
/* api callbacks */
- ot->exec= reload_exec;
+ ot->exec= text_reload_exec;
ot->invoke= WM_operator_confirm;
ot->poll= text_edit_poll;
}
@@ -353,7 +353,7 @@ static int text_unlink_poll(bContext *C)
return CTX_data_edit_text(C) != NULL;
}
-static int unlink_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_unlink_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
SpaceText *st= CTX_wm_space_text(C);
@@ -390,7 +390,7 @@ void TEXT_OT_unlink(wmOperatorType *ot)
ot->description= "Unlink active text data block";
/* api callbacks */
- ot->exec= unlink_exec;
+ ot->exec= text_unlink_exec;
ot->invoke= WM_operator_confirm;
ot->poll= text_unlink_poll;
@@ -400,7 +400,7 @@ void TEXT_OT_unlink(wmOperatorType *ot)
/******************* make internal operator *********************/
-static int make_internal_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_make_internal_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
@@ -425,7 +425,7 @@ void TEXT_OT_make_internal(wmOperatorType *ot)
ot->description= "Make active text file internal";
/* api callbacks */
- ot->exec= make_internal_exec;
+ ot->exec= text_make_internal_exec;
ot->poll= text_edit_poll;
/* flags */
@@ -434,7 +434,7 @@ void TEXT_OT_make_internal(wmOperatorType *ot)
/******************* save operator *********************/
-static int save_poll(bContext *C)
+static int text_save_poll(bContext *C)
{
Text *text= CTX_data_edit_text(C);
@@ -482,7 +482,7 @@ static void txt_write_file(Text *text, ReportList *reports)
text->flags ^= TXT_ISDIRTY;
}
-static int save_exec(bContext *C, wmOperator *op)
+static int text_save_exec(bContext *C, wmOperator *op)
{
Text *text= CTX_data_edit_text(C);
@@ -502,13 +502,13 @@ void TEXT_OT_save(wmOperatorType *ot)
ot->description= "Save active text data block";
/* api callbacks */
- ot->exec= save_exec;
- ot->poll= save_poll;
+ ot->exec= text_save_exec;
+ ot->poll= text_save_poll;
}
/******************* save as operator *********************/
-static int save_as_exec(bContext *C, wmOperator *op)
+static int text_save_as_exec(bContext *C, wmOperator *op)
{
Text *text= CTX_data_edit_text(C);
char str[FILE_MAX];
@@ -530,13 +530,13 @@ static int save_as_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int text_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Text *text= CTX_data_edit_text(C);
char *str;
if(RNA_property_is_set(op->ptr, "filepath"))
- return save_as_exec(C, op);
+ return text_save_as_exec(C, op);
if(text->name)
str= text->name;
@@ -559,8 +559,8 @@ void TEXT_OT_save_as(wmOperatorType *ot)
ot->description= "Save active text file with options";
/* api callbacks */
- ot->exec= save_as_exec;
- ot->invoke= save_as_invoke;
+ ot->exec= text_save_as_exec;
+ ot->invoke= text_save_as_invoke;
ot->poll= text_edit_poll;
/* properties */
@@ -569,12 +569,12 @@ void TEXT_OT_save_as(wmOperatorType *ot)
/******************* run script operator *********************/
-static int run_script_poll(bContext *C)
+static int text_run_script_poll(bContext *C)
{
return (CTX_data_edit_text(C) != NULL);
}
-static int run_script(bContext *C, ReportList *reports)
+static int text_run_script(bContext *C, ReportList *reports)
{
#ifdef WITH_PYTHON
Text *text= CTX_data_edit_text(C);
@@ -608,7 +608,7 @@ static int run_script(bContext *C, ReportList *reports)
return OPERATOR_CANCELLED;
}
-static int run_script_exec(bContext *C, wmOperator *op)
+static int text_run_script_exec(bContext *C, wmOperator *op)
{
#ifndef WITH_PYTHON
(void)C; /* unused */
@@ -617,7 +617,7 @@ static int run_script_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
#else
- return run_script(C, op->reports);
+ return text_run_script(C, op->reports);
#endif
}
@@ -629,8 +629,8 @@ void TEXT_OT_run_script(wmOperatorType *ot)
ot->description= "Run active script";
/* api callbacks */
- ot->poll= run_script_poll;
- ot->exec= run_script_exec;
+ ot->poll= text_run_script_poll;
+ ot->exec= text_run_script_exec;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -638,7 +638,7 @@ void TEXT_OT_run_script(wmOperatorType *ot)
/******************* refresh pyconstraints operator *********************/
-static int refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
+static int text_refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
{
#ifdef WITH_PYTHON
#if 0
@@ -689,7 +689,7 @@ void TEXT_OT_refresh_pyconstraints(wmOperatorType *ot)
ot->description= "Refresh all pyconstraints";
/* api callbacks */
- ot->exec= refresh_pyconstraints_exec;
+ ot->exec= text_refresh_pyconstraints_exec;
ot->poll= text_edit_poll;
}
@@ -777,7 +777,7 @@ static char *txt_copy_selected(Text *text)
return buf;
}
-static int paste_exec(bContext *C, wmOperator *op)
+static int text_paste_exec(bContext *C, wmOperator *op)
{
Text *text= CTX_data_edit_text(C);
char *buf;
@@ -800,7 +800,7 @@ static int paste_exec(bContext *C, wmOperator *op)
/* run the script while editing, evil but useful */
if(CTX_wm_space_text(C)->live_edit)
- run_script(C, NULL);
+ text_run_script(C, NULL);
return OPERATOR_FINISHED;
}
@@ -813,7 +813,7 @@ void TEXT_OT_paste(wmOperatorType *ot)
ot->description= "Paste text from clipboard";
/* api callbacks */
- ot->exec= paste_exec;
+ ot->exec= text_paste_exec;
ot->poll= text_edit_poll;
/* properties */
@@ -834,7 +834,7 @@ static void txt_copy_clipboard(Text *text)
}
}
-static int copy_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
@@ -851,13 +851,13 @@ void TEXT_OT_copy(wmOperatorType *ot)
ot->description= "Copy selected text to clipboard";
/* api callbacks */
- ot->exec= copy_exec;
+ ot->exec= text_copy_exec;
ot->poll= text_edit_poll;
}
/******************* cut operator *********************/
-static int cut_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_cut_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
@@ -871,7 +871,7 @@ static int cut_exec(bContext *C, wmOperator *UNUSED(op))
/* run the script while editing, evil but useful */
if(CTX_wm_space_text(C)->live_edit)
- run_script(C, NULL);
+ text_run_script(C, NULL);
return OPERATOR_FINISHED;
}
@@ -884,13 +884,13 @@ void TEXT_OT_cut(wmOperatorType *ot)
ot->description= "Cut selected text to clipboard";
/* api callbacks */
- ot->exec= cut_exec;
+ ot->exec= text_cut_exec;
ot->poll= text_edit_poll;
}
/******************* indent operator *********************/
-static int indent_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_indent_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
@@ -919,13 +919,13 @@ void TEXT_OT_indent(wmOperatorType *ot)
ot->description= "Indent selected text";
/* api callbacks */
- ot->exec= indent_exec;
+ ot->exec= text_indent_exec;
ot->poll= text_edit_poll;
}
/******************* unindent operator *********************/
-static int unindent_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_unindent_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
@@ -954,13 +954,13 @@ void TEXT_OT_unindent(wmOperatorType *ot)
ot->description= "Unindent selected text";
/* api callbacks */
- ot->exec= unindent_exec;
+ ot->exec= text_unindent_exec;
ot->poll= text_edit_poll;
}
/******************* line break operator *********************/
-static int line_break_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_line_break_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceText *st= CTX_wm_space_text(C);
Text *text= CTX_data_edit_text(C);
@@ -1001,13 +1001,13 @@ void TEXT_OT_line_break(wmOperatorType *ot)
ot->description= "Insert line break at cursor position";
/* api callbacks */
- ot->exec= line_break_exec;
+ ot->exec= text_line_break_exec;
ot->poll= text_edit_poll;
}
/******************* comment operator *********************/
-static int comment_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_comment_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
@@ -1034,13 +1034,13 @@ void TEXT_OT_comment(wmOperatorType *ot)
ot->description= "Convert selected text to comment";
/* api callbacks */
- ot->exec= comment_exec;
+ ot->exec= text_comment_exec;
ot->poll= text_edit_poll;
}
/******************* uncomment operator *********************/
-static int uncomment_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_uncomment_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
@@ -1068,7 +1068,7 @@ void TEXT_OT_uncomment(wmOperatorType *ot)
ot->description= "Convert selected comment to text";
/* api callbacks */
- ot->exec= uncomment_exec;
+ ot->exec= text_uncomment_exec;
ot->poll= text_edit_poll;
}
@@ -1080,7 +1080,7 @@ static EnumPropertyItem whitespace_type_items[]= {
{TO_TABS, "TABS", 0, "To Tabs", NULL},
{0, NULL, 0, NULL, NULL}};
-static int convert_whitespace_exec(bContext *C, wmOperator *op)
+static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
{
SpaceText *st= CTX_wm_space_text(C);
Text *text= CTX_data_edit_text(C);
@@ -1208,7 +1208,7 @@ void TEXT_OT_convert_whitespace(wmOperatorType *ot)
ot->description= "Convert whitespaces by type";
/* api callbacks */
- ot->exec= convert_whitespace_exec;
+ ot->exec= text_convert_whitespace_exec;
ot->poll= text_edit_poll;
/* properties */
@@ -1217,7 +1217,7 @@ void TEXT_OT_convert_whitespace(wmOperatorType *ot)
/******************* select all operator *********************/
-static int select_all_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_select_all_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
@@ -1237,13 +1237,13 @@ void TEXT_OT_select_all(wmOperatorType *ot)
ot->description= "Select all text";
/* api callbacks */
- ot->exec= select_all_exec;
+ ot->exec= text_select_all_exec;
ot->poll= text_edit_poll;
}
/******************* select line operator *********************/
-static int select_line_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_select_line_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
@@ -1263,13 +1263,13 @@ void TEXT_OT_select_line(wmOperatorType *ot)
ot->description= "Select text by line";
/* api callbacks */
- ot->exec= select_line_exec;
+ ot->exec= text_select_line_exec;
ot->poll= text_edit_poll;
}
/******************* select word operator *********************/
-static int select_word_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_select_word_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
@@ -1290,13 +1290,13 @@ void TEXT_OT_select_word(wmOperatorType *ot)
ot->description= "Select word under cursor";
/* api callbacks */
- ot->exec= select_word_exec;
+ ot->exec= text_select_word_exec;
ot->poll= text_edit_poll;
}
/******************* previous marker operator *********************/
-static int previous_marker_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_previous_marker_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
TextMarker *mrk;
@@ -1326,13 +1326,13 @@ void TEXT_OT_previous_marker(wmOperatorType *ot)
ot->description= "Move to previous marker";
/* api callbacks */
- ot->exec= previous_marker_exec;
+ ot->exec= text_previous_marker_exec;
ot->poll= text_edit_poll;
}
/******************* next marker operator *********************/
-static int next_marker_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_next_marker_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
TextMarker *mrk;
@@ -1362,13 +1362,13 @@ void TEXT_OT_next_marker(wmOperatorType *ot)
ot->description= "Move to next marker";
/* api callbacks */
- ot->exec= next_marker_exec;
+ ot->exec= text_next_marker_exec;
ot->poll= text_edit_poll;
}
/******************* clear all markers operator *********************/
-static int clear_all_markers_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_clear_all_markers_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
@@ -1388,7 +1388,7 @@ void TEXT_OT_markers_clear(wmOperatorType *ot)
ot->description= "Clear all markers";
/* api callbacks */
- ot->exec= clear_all_markers_exec;
+ ot->exec= text_clear_all_markers_exec;
ot->poll= text_edit_poll;
}
@@ -1573,7 +1573,7 @@ static int cursor_skip_find_line(SpaceText* st, ARegion *ar,
return 1;
}
-static void wrap_move_bol(SpaceText *st, ARegion *ar, short sel)
+static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, short sel)
{
Text *text= st->text;
TextLine **linep;
@@ -1641,7 +1641,7 @@ static void wrap_move_bol(SpaceText *st, ARegion *ar, short sel)
txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, oldl, *charp);
}
-static void wrap_move_eol(SpaceText *st, ARegion *ar, short sel)
+static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, short sel)
{
Text *text= st->text;
TextLine **linep;
@@ -1705,7 +1705,7 @@ static void wrap_move_eol(SpaceText *st, ARegion *ar, short sel)
txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, oldl, *charp);
}
-static void wrap_move_up(SpaceText *st, ARegion *ar, short sel)
+static void txt_wrap_move_up(SpaceText *st, ARegion *ar, short sel)
{
Text *text= st->text;
TextLine **linep;
@@ -1741,7 +1741,7 @@ static void wrap_move_up(SpaceText *st, ARegion *ar, short sel)
txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, newl, *charp);
}
-static void wrap_move_down(SpaceText *st, ARegion *ar, short sel)
+static void txt_wrap_move_down(SpaceText *st, ARegion *ar, short sel)
{
Text *text= st->text;
TextLine **linep;
@@ -1814,7 +1814,7 @@ static void cursor_skip(SpaceText* st, ARegion *ar, Text *text, int lines, int s
txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, txt_get_span(text->lines.first, *linep), *charp);
}
-static int move_cursor(bContext *C, int type, int select)
+static int text_move_cursor(bContext *C, int type, int select)
{
SpaceText *st= CTX_wm_space_text(C);
Text *text= CTX_data_edit_text(C);
@@ -1826,12 +1826,12 @@ static int move_cursor(bContext *C, int type, int select)
switch(type) {
case LINE_BEGIN:
- if(st && st->wordwrap && ar) wrap_move_bol(st, ar, select);
+ if(st && st->wordwrap && ar) txt_wrap_move_bol(st, ar, select);
else txt_move_bol(text, select);
break;
case LINE_END:
- if(st && st->wordwrap && ar) wrap_move_eol(st, ar, select);
+ if(st && st->wordwrap && ar) txt_wrap_move_eol(st, ar, select);
else txt_move_eol(text, select);
break;
@@ -1860,12 +1860,12 @@ static int move_cursor(bContext *C, int type, int select)
break;
case PREV_LINE:
- if(st && st->wordwrap && ar) wrap_move_up(st, ar, select);
+ if(st && st->wordwrap && ar) txt_wrap_move_up(st, ar, select);
else txt_move_up(text, select);
break;
case NEXT_LINE:
- if(st && st->wordwrap && ar) wrap_move_down(st, ar, select);
+ if(st && st->wordwrap && ar) txt_wrap_move_down(st, ar, select);
else txt_move_down(text, select);
break;
@@ -1886,11 +1886,11 @@ static int move_cursor(bContext *C, int type, int select)
return OPERATOR_FINISHED;
}
-static int move_exec(bContext *C, wmOperator *op)
+static int text_move_exec(bContext *C, wmOperator *op)
{
int type= RNA_enum_get(op->ptr, "type");
- return move_cursor(C, type, 0);
+ return text_move_cursor(C, type, 0);
}
void TEXT_OT_move(wmOperatorType *ot)
@@ -1901,7 +1901,7 @@ void TEXT_OT_move(wmOperatorType *ot)
ot->description= "Move cursor to position type";
/* api callbacks */
- ot->exec= move_exec;
+ ot->exec= text_move_exec;
ot->poll= text_edit_poll;
/* properties */
@@ -1910,11 +1910,11 @@ void TEXT_OT_move(wmOperatorType *ot)
/******************* move select operator ********************/
-static int move_select_exec(bContext *C, wmOperator *op)
+static int text_move_select_exec(bContext *C, wmOperator *op)
{
int type= RNA_enum_get(op->ptr, "type");
- return move_cursor(C, type, 1);
+ return text_move_cursor(C, type, 1);
}
void TEXT_OT_move_select(wmOperatorType *ot)
@@ -1925,7 +1925,7 @@ void TEXT_OT_move_select(wmOperatorType *ot)
ot->description= "Make selection from current cursor position to new cursor position type";
/* api callbacks */
- ot->exec= move_select_exec;
+ ot->exec= text_move_select_exec;
ot->poll= text_space_edit_poll;
/* properties */
@@ -1934,7 +1934,7 @@ void TEXT_OT_move_select(wmOperatorType *ot)
/******************* jump operator *********************/
-static int jump_exec(bContext *C, wmOperator *op)
+static int text_jump_exec(bContext *C, wmOperator *op)
{
Text *text= CTX_data_edit_text(C);
int line= RNA_int_get(op->ptr, "line");
@@ -1953,7 +1953,7 @@ static int jump_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int jump_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int text_jump_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
return WM_operator_props_dialog_popup(C,op,200,100);
@@ -1967,8 +1967,8 @@ void TEXT_OT_jump(wmOperatorType *ot)
ot->description= "Jump cursor to line";
/* api callbacks */
- ot->invoke= jump_invoke;
- ot->exec= jump_exec;
+ ot->invoke= text_jump_invoke;
+ ot->exec= text_jump_exec;
ot->poll= text_edit_poll;
/* properties */
@@ -1984,7 +1984,7 @@ static EnumPropertyItem delete_type_items[]= {
{DEL_PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""},
{0, NULL, 0, NULL, NULL}};
-static int delete_exec(bContext *C, wmOperator *op)
+static int text_delete_exec(bContext *C, wmOperator *op)
{
Text *text= CTX_data_edit_text(C);
int type= RNA_enum_get(op->ptr, "type");
@@ -2007,7 +2007,7 @@ static int delete_exec(bContext *C, wmOperator *op)
/* run the script while editing, evil but useful */
if(CTX_wm_space_text(C)->live_edit)
- run_script(C, NULL);
+ text_run_script(C, NULL);
return OPERATOR_FINISHED;
}
@@ -2020,7 +2020,7 @@ void TEXT_OT_delete(wmOperatorType *ot)
ot->description= "Delete text by cursor position";
/* api callbacks */
- ot->exec= delete_exec;
+ ot->exec= text_delete_exec;
ot->poll= text_edit_poll;
/* properties */
@@ -2029,7 +2029,7 @@ void TEXT_OT_delete(wmOperatorType *ot)
/******************* toggle overwrite operator **********************/
-static int toggle_overwrite_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_toggle_overwrite_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceText *st= CTX_wm_space_text(C);
@@ -2048,14 +2048,14 @@ void TEXT_OT_overwrite_toggle(wmOperatorType *ot)
ot->description= "Toggle overwrite while typing";
/* api callbacks */
- ot->exec= toggle_overwrite_exec;
+ ot->exec= text_toggle_overwrite_exec;
ot->poll= text_space_edit_poll;
}
/******************* scroll operator **********************/
/* Moves the view vertically by the specified number of lines */
-static void screen_skip(SpaceText *st, ARegion *ar, int lines)
+static void txt_screen_skip(SpaceText *st, ARegion *ar, int lines)
{
int last;
@@ -2091,7 +2091,7 @@ static int text_scroll_poll(bContext *C)
return CTX_data_edit_text(C) != NULL;
}
-static int scroll_exec(bContext *C, wmOperator *op)
+static int text_scroll_exec(bContext *C, wmOperator *op)
{
SpaceText *st= CTX_wm_space_text(C);
ARegion *ar= CTX_wm_region(C);
@@ -2101,14 +2101,14 @@ static int scroll_exec(bContext *C, wmOperator *op)
if(lines == 0)
return OPERATOR_CANCELLED;
- screen_skip(st, ar, lines*U.wheellinescroll);
+ txt_screen_skip(st, ar, lines*U.wheellinescroll);
ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
}
-static void scroll_apply(bContext *C, wmOperator *op, wmEvent *event)
+static void text_scroll_apply(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceText *st= CTX_wm_space_text(C);
ARegion *ar= CTX_wm_region(C);
@@ -2140,7 +2140,7 @@ static void scroll_apply(bContext *C, wmOperator *op, wmEvent *event)
}
if(txtdelta[0] || txtdelta[1]) {
- screen_skip(st, ar, txtdelta[1]);
+ txt_screen_skip(st, ar, txtdelta[1]);
if(st->wordwrap) {
st->left= 0;
@@ -2165,7 +2165,7 @@ static void scroll_exit(bContext *C, wmOperator *op)
MEM_freeN(op->customdata);
}
-static int scroll_modal(bContext *C, wmOperator *op, wmEvent *event)
+static int text_scroll_modal(bContext *C, wmOperator *op, wmEvent *event)
{
TextScroll *tsc= op->customdata;
SpaceText *st= CTX_wm_space_text(C);
@@ -2174,7 +2174,7 @@ static int scroll_modal(bContext *C, wmOperator *op, wmEvent *event)
switch(event->type) {
case MOUSEMOVE:
if(tsc->zone == SCROLLHANDLE_BAR)
- scroll_apply(C, op, event);
+ text_scroll_apply(C, op, event);
break;
case LEFTMOUSE:
case RIGHTMOUSE:
@@ -2198,20 +2198,20 @@ static int scroll_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int scroll_cancel(bContext *C, wmOperator *op)
+static int text_scroll_cancel(bContext *C, wmOperator *op)
{
scroll_exit(C, op);
return OPERATOR_CANCELLED;
}
-static int scroll_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int text_scroll_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceText *st= CTX_wm_space_text(C);
TextScroll *tsc;
if(RNA_property_is_set(op->ptr, "lines"))
- return scroll_exec(C, op);
+ return text_scroll_exec(C, op);
tsc= MEM_callocN(sizeof(TextScroll), "TextScroll");
tsc->first= 1;
@@ -2224,13 +2224,13 @@ static int scroll_invoke(bContext *C, wmOperator *op, wmEvent *event)
text_update_character_width(st);
tsc->old[0] = event->x;
- tsc->old[1] = event->x;
+ tsc->old[1] = event->y;
/* Sensitivity of scroll set to 4pix per line/char */
tsc->delta[0] = (event->x - event->prevx)*st->cwidth/4;
tsc->delta[1] = (event->y - event->prevy)*st->lheight/4;
tsc->first = 0;
tsc->scrollbar = 0;
- scroll_apply(C, op, event);
+ text_scroll_apply(C, op, event);
scroll_exit(C, op);
return OPERATOR_FINISHED;
}
@@ -2251,10 +2251,10 @@ void TEXT_OT_scroll(wmOperatorType *ot)
ot->description= "Scroll text screen";
/* api callbacks */
- ot->exec= scroll_exec;
- ot->invoke= scroll_invoke;
- ot->modal= scroll_modal;
- ot->cancel= scroll_cancel;
+ ot->exec= text_scroll_exec;
+ ot->invoke= text_scroll_invoke;
+ ot->modal= text_scroll_modal;
+ ot->cancel= text_scroll_cancel;
ot->poll= text_scroll_poll;
/* flags */
@@ -2282,7 +2282,7 @@ static int text_region_scroll_poll(bContext *C)
return 1;
}
-static int scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int text_scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceText *st= CTX_wm_space_text(C);
ARegion *ar= CTX_wm_region(C);
@@ -2291,7 +2291,7 @@ static int scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event)
int zone= -1;
if(RNA_property_is_set(op->ptr, "lines"))
- return scroll_exec(C, op);
+ return text_scroll_exec(C, op);
/* verify we are in the right zone */
if(mval[0]>st->txtbar.xmin && mval[0]<st->txtbar.xmax) {
@@ -2334,9 +2334,9 @@ void TEXT_OT_scroll_bar(wmOperatorType *ot)
ot->description= "Scroll text screen";
/* api callbacks */
- ot->invoke= scroll_bar_invoke;
- ot->modal= scroll_modal;
- ot->cancel= scroll_cancel;
+ ot->invoke= text_scroll_bar_invoke;
+ ot->modal= text_scroll_modal;
+ ot->cancel= text_scroll_cancel;
ot->poll= text_region_scroll_poll;
/* flags */
@@ -2354,7 +2354,7 @@ typedef struct SetSelection {
short old[2];
} SetSelection;
-static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel)
+static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel)
{
FlattenString fs;
Text *text= st->text;
@@ -2514,7 +2514,7 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel)
if(!sel) txt_pop_sel(text);
}
-static void set_cursor_apply(bContext *C, wmOperator *op, wmEvent *event)
+static void text_cursor_set_apply(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceText *st= CTX_wm_space_text(C);
ARegion *ar= CTX_wm_region(C);
@@ -2522,9 +2522,9 @@ static void set_cursor_apply(bContext *C, wmOperator *op, wmEvent *event)
if(event->mval[1]<0 || event->mval[1]>ar->winy) {
int d= (ssel->old[1]-event->mval[1])*st->pix_per_line;
- if(d) screen_skip(st, ar, d);
+ if(d) txt_screen_skip(st, ar, d);
- set_cursor_to_pos(st, ar, event->mval[0], event->mval[1]<0?0:ar->winy, 1);
+ text_cursor_set_to_pos(st, ar, event->mval[0], event->mval[1]<0?0:ar->winy, 1);
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, st->text);
@@ -2533,14 +2533,14 @@ static void set_cursor_apply(bContext *C, wmOperator *op, wmEvent *event)
if(event->mval[0]>ar->winx) st->left++;
else if(event->mval[0]<0 && st->left>0) st->left--;
- set_cursor_to_pos(st, ar, event->mval[0], event->mval[1], 1);
+ text_cursor_set_to_pos(st, ar, event->mval[0], event->mval[1], 1);
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, st->text);
// XXX PIL_sleep_ms(10);
}
else {
- set_cursor_to_pos(st, ar, event->mval[0], event->mval[1], 1);
+ text_cursor_set_to_pos(st, ar, event->mval[0], event->mval[1], 1);
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, st->text);
@@ -2550,7 +2550,7 @@ static void set_cursor_apply(bContext *C, wmOperator *op, wmEvent *event)
}
}
-static void set_cursor_exit(bContext *C, wmOperator *op)
+static void text_cursor_set_exit(bContext *C, wmOperator *op)
{
SpaceText *st= CTX_wm_space_text(C);
Text *text= st->text;
@@ -2576,7 +2576,7 @@ static void set_cursor_exit(bContext *C, wmOperator *op)
MEM_freeN(ssel);
}
-static int set_selection_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int text_set_selection_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceText *st= CTX_wm_space_text(C);
SetSelection *ssel;
@@ -2596,30 +2596,30 @@ static int set_selection_invoke(bContext *C, wmOperator *op, wmEvent *event)
WM_event_add_modal_handler(C, op);
- set_cursor_apply(C, op, event);
+ text_cursor_set_apply(C, op, event);
return OPERATOR_RUNNING_MODAL;
}
-static int set_selection_modal(bContext *C, wmOperator *op, wmEvent *event)
+static int text_set_selection_modal(bContext *C, wmOperator *op, wmEvent *event)
{
switch(event->type) {
case LEFTMOUSE:
case MIDDLEMOUSE:
case RIGHTMOUSE:
- set_cursor_exit(C, op);
+ text_cursor_set_exit(C, op);
return OPERATOR_FINISHED;
case MOUSEMOVE:
- set_cursor_apply(C, op, event);
+ text_cursor_set_apply(C, op, event);
break;
}
return OPERATOR_RUNNING_MODAL;
}
-static int set_selection_cancel(bContext *C, wmOperator *op)
+static int text_set_selection_cancel(bContext *C, wmOperator *op)
{
- set_cursor_exit(C, op);
+ text_cursor_set_exit(C, op);
return OPERATOR_FINISHED;
}
@@ -2631,9 +2631,9 @@ void TEXT_OT_selection_set(wmOperatorType *ot)
ot->description= "Set cursor selection";
/* api callbacks */
- ot->invoke= set_selection_invoke;
- ot->modal= set_selection_modal;
- ot->cancel= set_selection_cancel;
+ ot->invoke= text_set_selection_invoke;
+ ot->modal= text_set_selection_modal;
+ ot->cancel= text_set_selection_cancel;
ot->poll= text_region_edit_poll;
/* properties */
@@ -2642,7 +2642,7 @@ void TEXT_OT_selection_set(wmOperatorType *ot)
/******************* set cursor operator **********************/
-static int set_cursor_exec(bContext *C, wmOperator *op)
+static int text_cursor_set_exec(bContext *C, wmOperator *op)
{
SpaceText *st= CTX_wm_space_text(C);
Text *text= st->text;
@@ -2654,7 +2654,7 @@ static int set_cursor_exec(bContext *C, wmOperator *op)
oldl= txt_get_span(text->lines.first, text->curl);
oldc= text->curc;
- set_cursor_to_pos(st, ar, x, y, 0);
+ text_cursor_set_to_pos(st, ar, x, y, 0);
txt_undo_add_toop(text, UNDO_CTO, oldl, oldc, txt_get_span(text->lines.first, text->curl), text->curc);
@@ -2664,7 +2664,7 @@ static int set_cursor_exec(bContext *C, wmOperator *op)
return OPERATOR_PASS_THROUGH;
}
-static int set_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int text_cursor_set_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceText *st= CTX_wm_space_text(C);
@@ -2674,7 +2674,7 @@ static int set_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_int_set(op->ptr, "x", event->mval[0]);
RNA_int_set(op->ptr, "y", event->mval[1]);
- return set_cursor_exec(C, op);
+ return text_cursor_set_exec(C, op);
}
void TEXT_OT_cursor_set(wmOperatorType *ot)
@@ -2685,8 +2685,8 @@ void TEXT_OT_cursor_set(wmOperatorType *ot)
ot->description= "Set cursor position";
/* api callbacks */
- ot->invoke= set_cursor_invoke;
- ot->exec= set_cursor_exec;
+ ot->invoke= text_cursor_set_invoke;
+ ot->exec= text_cursor_set_exec;
ot->poll= text_region_edit_poll;
/* properties */
@@ -2696,7 +2696,7 @@ void TEXT_OT_cursor_set(wmOperatorType *ot)
/******************* line number operator **********************/
-static int line_number_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
+static int text_line_number_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
SpaceText *st= CTX_wm_space_text(C);
Text *text= CTX_data_edit_text(C);
@@ -2741,13 +2741,13 @@ void TEXT_OT_line_number(wmOperatorType *ot)
ot->description= "The current line number";
/* api callbacks */
- ot->invoke= line_number_invoke;
+ ot->invoke= text_line_number_invoke;
ot->poll= text_region_edit_poll;
}
/******************* insert operator **********************/
-static int insert_exec(bContext *C, wmOperator *op)
+static int text_insert_exec(bContext *C, wmOperator *op)
{
SpaceText *st= CTX_wm_space_text(C);
Text *text= CTX_data_edit_text(C);
@@ -2781,7 +2781,7 @@ static int insert_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int text_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
int ret;
@@ -2799,11 +2799,11 @@ static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
}
- ret = insert_exec(C, op);
+ ret = text_insert_exec(C, op);
/* run the script while editing, evil but useful */
if(ret==OPERATOR_FINISHED && CTX_wm_space_text(C)->live_edit)
- run_script(C, NULL);
+ text_run_script(C, NULL);
return ret;
}
@@ -2816,8 +2816,8 @@ void TEXT_OT_insert(wmOperatorType *ot)
ot->description= "Insert text at cursor position";
/* api callbacks */
- ot->exec= insert_exec;
- ot->invoke= insert_invoke;
+ ot->exec= text_insert_exec;
+ ot->invoke= text_insert_invoke;
ot->poll= text_edit_poll;
/* properties */
@@ -2831,7 +2831,7 @@ void TEXT_OT_insert(wmOperatorType *ot)
#define TEXT_REPLACE 1
#define TEXT_MARK_ALL 2
-static int find_and_replace(bContext *C, wmOperator *op, short mode)
+static int text_find_and_replace(bContext *C, wmOperator *op, short mode)
{
Main *bmain= CTX_data_main(C);
SpaceText *st= CTX_wm_space_text(C);
@@ -2922,9 +2922,9 @@ static int find_and_replace(bContext *C, wmOperator *op, short mode)
return OPERATOR_FINISHED;
}
-static int find_exec(bContext *C, wmOperator *op)
+static int text_find_exec(bContext *C, wmOperator *op)
{
- return find_and_replace(C, op, TEXT_FIND);
+ return text_find_and_replace(C, op, TEXT_FIND);
}
void TEXT_OT_find(wmOperatorType *ot)
@@ -2935,15 +2935,15 @@ void TEXT_OT_find(wmOperatorType *ot)
ot->description= "Find specified text";
/* api callbacks */
- ot->exec= find_exec;
+ ot->exec= text_find_exec;
ot->poll= text_space_edit_poll;
}
/******************* replace operator *********************/
-static int replace_exec(bContext *C, wmOperator *op)
+static int text_replace_exec(bContext *C, wmOperator *op)
{
- return find_and_replace(C, op, TEXT_REPLACE);
+ return text_find_and_replace(C, op, TEXT_REPLACE);
}
void TEXT_OT_replace(wmOperatorType *ot)
@@ -2954,15 +2954,15 @@ void TEXT_OT_replace(wmOperatorType *ot)
ot->description= "Replace text with the specified text";
/* api callbacks */
- ot->exec= replace_exec;
+ ot->exec= text_replace_exec;
ot->poll= text_space_edit_poll;
}
/******************* mark all operator *********************/
-static int mark_all_exec(bContext *C, wmOperator *op)
+static int text_mark_all_exec(bContext *C, wmOperator *op)
{
- return find_and_replace(C, op, TEXT_MARK_ALL);
+ return text_find_and_replace(C, op, TEXT_MARK_ALL);
}
void TEXT_OT_mark_all(wmOperatorType *ot)
@@ -2973,13 +2973,13 @@ void TEXT_OT_mark_all(wmOperatorType *ot)
ot->description= "Mark all specified text";
/* api callbacks */
- ot->exec= mark_all_exec;
+ ot->exec= text_mark_all_exec;
ot->poll= text_space_edit_poll;
}
/******************* find set selected *********************/
-static int find_set_selected_exec(bContext *C, wmOperator *op)
+static int text_find_set_selected_exec(bContext *C, wmOperator *op)
{
SpaceText *st= CTX_wm_space_text(C);
Text *text= CTX_data_edit_text(C);
@@ -2992,7 +2992,7 @@ static int find_set_selected_exec(bContext *C, wmOperator *op)
if(!st->findstr[0])
return OPERATOR_FINISHED;
- return find_and_replace(C, op, TEXT_FIND);
+ return text_find_and_replace(C, op, TEXT_FIND);
}
void TEXT_OT_find_set_selected(wmOperatorType *ot)
@@ -3003,13 +3003,13 @@ void TEXT_OT_find_set_selected(wmOperatorType *ot)
ot->description= "Find specified text and set as selected";
/* api callbacks */
- ot->exec= find_set_selected_exec;
+ ot->exec= text_find_set_selected_exec;
ot->poll= text_space_edit_poll;
}
/******************* replace set selected *********************/
-static int replace_set_selected_exec(bContext *C, wmOperator *UNUSED(op))
+static int text_replace_set_selected_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceText *st= CTX_wm_space_text(C);
Text *text= CTX_data_edit_text(C);
@@ -3030,7 +3030,7 @@ void TEXT_OT_replace_set_selected(wmOperatorType *ot)
ot->description= "Replace text with specified text and set as selected";
/* api callbacks */
- ot->exec= replace_set_selected_exec;
+ ot->exec= text_replace_set_selected_exec;
ot->poll= text_space_edit_poll;
}
@@ -3099,18 +3099,18 @@ static void text_ignore_modified(Text *text)
text->mtime= st.st_mtime;
}
-static int resolve_conflict_exec(bContext *C, wmOperator *op)
+static int text_resolve_conflict_exec(bContext *C, wmOperator *op)
{
Text *text= CTX_data_edit_text(C);
int resolution= RNA_enum_get(op->ptr, "resolution");
switch(resolution) {
case RESOLVE_RELOAD:
- return reload_exec(C, op);
+ return text_reload_exec(C, op);
case RESOLVE_SAVE:
- return save_exec(C, op);
+ return text_save_exec(C, op);
case RESOLVE_MAKE_INTERNAL:
- return make_internal_exec(C, op);
+ return text_make_internal_exec(C, op);
case RESOLVE_IGNORE:
text_ignore_modified(text);
return OPERATOR_FINISHED;
@@ -3119,7 +3119,7 @@ static int resolve_conflict_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
-static int resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int text_resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Text *text= CTX_data_edit_text(C);
uiPopupMenu *pup;
@@ -3165,9 +3165,9 @@ void TEXT_OT_resolve_conflict(wmOperatorType *ot)
ot->description= "When external text is out of sync, resolve the conflict";
/* api callbacks */
- ot->exec= resolve_conflict_exec;
- ot->invoke= resolve_conflict_invoke;
- ot->poll= save_poll;
+ ot->exec= text_resolve_conflict_exec;
+ ot->invoke= text_resolve_conflict_invoke;
+ ot->poll= text_save_poll;
/* properties */
RNA_def_enum(ot->srna, "resolution", resolution_items, RESOLVE_IGNORE, "Resolution", "How to solve conflict due to differences in internal and external text");
@@ -3175,7 +3175,7 @@ void TEXT_OT_resolve_conflict(wmOperatorType *ot)
/********************** to 3d object operator *****************/
-static int to_3d_object_exec(bContext *C, wmOperator *op)
+static int text_to_3d_object_exec(bContext *C, wmOperator *op)
{
Text *text= CTX_data_edit_text(C);
int split_lines= RNA_boolean_get(op->ptr, "split_lines");
@@ -3193,7 +3193,7 @@ void TEXT_OT_to_3d_object(wmOperatorType *ot)
ot->description= "Create 3d text object from active text data block";
/* api callbacks */
- ot->exec= to_3d_object_exec;
+ ot->exec= text_to_3d_object_exec;
ot->poll= text_edit_poll;
/* flags */
diff --git a/source/blender/editors/space_time/time_intern.h b/source/blender/editors/space_time/time_intern.h
index 094b0bc9e86..a345d00bd74 100644
--- a/source/blender/editors/space_time/time_intern.h
+++ b/source/blender/editors/space_time/time_intern.h
@@ -40,8 +40,5 @@ struct wmWindowManager;
void time_operatortypes(void);
void time_keymap(struct wmKeyConfig *keyconf);
-/* time_header.c */
-void time_header_buttons(const bContext *C, ARegion *ar);
-
#endif /* ED_TIME_INTERN_H */
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 936f18fdc68..692d45f8303 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -226,7 +226,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
static int c_lit;
Object *litob = NULL; //to get mode to turn off mipmap in painting mode
- int backculled = 0;
+ int backculled = GEMAT_BACKCULL;
int alphablend = 0;
int textured = 0;
int lit = 0;
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 5e0a32c41c8..63b0f68f158 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -613,9 +613,9 @@ static void editvert_mirror_update(Object *ob, EditVert *eve, int def_nr, int in
if(dvert_dst) {
if(def_nr == -1) {
/* all vgroups, add groups where neded */
-
- int *flip_map= defgroup_flip_map(ob, 1);
- defvert_sync_mapped(dvert_dst, dvert_src, flip_map, 1);
+ int flip_map_len;
+ int *flip_map= defgroup_flip_map(ob, &flip_map_len, TRUE);
+ defvert_sync_mapped(dvert_dst, dvert_src, flip_map, flip_map_len, TRUE);
MEM_freeN(flip_map);
}
else {
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index af73e4cd50b..3d2558699ef 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1227,6 +1227,7 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
{
RegionView3D *rv3d= ar->regiondata;
struct Base *base = scene->basact;
+ int multisample_enabled;
rcti winrct;
BLI_assert(ar->regiontype == RGN_TYPE_WINDOW);
@@ -1253,8 +1254,13 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
if(v3d->drawtype > OB_WIRE) v3d->zbuf= TRUE;
+ /* dithering and AA break color coding, so disable */
glDisable(GL_DITHER);
+ multisample_enabled= glIsEnabled(GL_MULTISAMPLE_ARB);
+ if(multisample_enabled)
+ glDisable(GL_MULTISAMPLE_ARB);
+
region_scissor_winrct(ar, &winrct);
glScissor(winrct.xmin, winrct.ymin, winrct.xmax - winrct.xmin, winrct.ymax - winrct.ymin);
@@ -1273,9 +1279,8 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
G.f |= G_BACKBUFSEL;
- if(base && (base->lay & v3d->lay)) {
+ if(base && (base->lay & v3d->lay))
draw_object_backbufsel(scene, v3d, rv3d, base->object);
- }
v3d->flag &= ~V3D_INVALID_BACKBUF;
ar->swap= 0; /* mark invalid backbuf for wm draw */
@@ -1284,6 +1289,8 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
v3d->zbuf= FALSE;
glDisable(GL_DEPTH_TEST);
glEnable(GL_DITHER);
+ if(multisample_enabled)
+ glEnable(GL_MULTISAMPLE_ARB);
if(rv3d->rflag & RV3D_CLIPPING)
view3d_clr_clipping();
@@ -2387,7 +2394,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
glPushAttrib(GL_LIGHTING_BIT);
/* bind */
- ofs= GPU_offscreen_create(&sizex, &sizey, err_out);
+ ofs= GPU_offscreen_create(sizex, sizey, err_out);
if(ofs == NULL)
return NULL;
@@ -2411,9 +2418,9 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
ibuf= IMB_allocImBuf(sizex, sizey, 32, flag);
if(ibuf->rect_float)
- glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, ibuf->rect_float);
+ GPU_offscreen_read_pixels(ofs, GL_FLOAT, ibuf->rect_float);
else if(ibuf->rect)
- glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
+ GPU_offscreen_read_pixels(ofs, GL_UNSIGNED_BYTE, ibuf->rect);
//if((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW))
// BKE_stamp_buf(scene, NULL, rr->rectf, rr->rectx, rr->recty, 4);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 99f11554aa6..ea8db17daf0 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -2946,6 +2946,7 @@ static BGpic *background_image_add(bContext *C)
bgpic->iuser.fie_ima= 2;
bgpic->iuser.ok= 1;
bgpic->view= 0; /* 0 for all */
+ bgpic->flag |= V3D_BGPIC_EXPANDED;
BLI_addtail(&v3d->bgpicbase, bgpic);
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 8000a3b03f1..1b726cd90b3 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -168,11 +168,11 @@ static void special_transvert_update(Object *obedit)
if ((ebo->flag & BONE_CONNECTED) && ebo->parent){
/* If this bone has a parent tip that has been moved */
if (ebo->parent->flag & BONE_TIPSEL){
- VECCOPY (ebo->head, ebo->parent->tail);
+ copy_v3_v3(ebo->head, ebo->parent->tail);
}
/* If this bone has a parent tip that has NOT been moved */
else{
- VECCOPY (ebo->parent->tail, ebo->head);
+ copy_v3_v3(ebo->parent->tail, ebo->head);
}
}
}
@@ -250,7 +250,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
for(eve= em->verts.first; eve; eve= eve->next) {
if(eve->f1) {
- VECCOPY(tv->oldloc, eve->co);
+ copy_v3_v3(tv->oldloc, eve->co);
tv->loc= eve->co;
if(eve->no[0] != 0.0f || eve->no[1] != 0.0f ||eve->no[2] != 0.0f)
tv->nor= eve->no; // note this is a hackish signal (ton)
@@ -280,7 +280,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
* location as heads.
*/
if (rootok) {
- VECCOPY (tv->oldloc, ebo->head);
+ copy_v3_v3(tv->oldloc, ebo->head);
tv->loc= ebo->head;
tv->nor= NULL;
tv->flag= 1;
@@ -289,7 +289,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
}
if ((mode & TM_ALL_JOINTS) && (tipsel)) {
- VECCOPY (tv->oldloc, ebo->tail);
+ copy_v3_v3(tv->oldloc, ebo->tail);
tv->loc= ebo->tail;
tv->nor= NULL;
tv->flag= 1;
@@ -298,7 +298,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
}
}
else if (tipsel) {
- VECCOPY (tv->oldloc, ebo->tail);
+ copy_v3_v3(tv->oldloc, ebo->tail);
tv->loc= ebo->tail;
tv->nor= NULL;
tv->flag= 1;
@@ -333,14 +333,14 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
skip_handle= mode & TM_SKIP_HANDLES;
if((bezt->f1 & SELECT) && !skip_handle) {
- VECCOPY(tv->oldloc, bezt->vec[0]);
+ copy_v3_v3(tv->oldloc, bezt->vec[0]);
tv->loc= bezt->vec[0];
tv->flag= bezt->f1 & SELECT;
tv++;
tottrans++;
}
if(bezt->f2 & SELECT) {
- VECCOPY(tv->oldloc, bezt->vec[1]);
+ copy_v3_v3(tv->oldloc, bezt->vec[1]);
tv->loc= bezt->vec[1];
tv->val= &(bezt->alfa);
tv->oldval= bezt->alfa;
@@ -349,7 +349,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
tottrans++;
}
if((bezt->f3 & SELECT) && !skip_handle) {
- VECCOPY(tv->oldloc, bezt->vec[2]);
+ copy_v3_v3(tv->oldloc, bezt->vec[2]);
tv->loc= bezt->vec[2];
tv->flag= bezt->f3 & SELECT;
tv++;
@@ -365,7 +365,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
while(a--) {
if(bp->hide==0) {
if(bp->f1 & SELECT) {
- VECCOPY(tv->oldloc, bp->vec);
+ copy_v3_v3(tv->oldloc, bp->vec);
tv->loc= bp->vec;
tv->val= &(bp->alfa);
tv->oldval= bp->alfa;
@@ -474,7 +474,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
tv= transvmain;
for(a=0; a<tottrans; a++, tv++) {
- VECCOPY(vec, tv->loc);
+ copy_v3_v3(vec, tv->loc);
mul_m3_v3(bmat, vec);
add_v3_v3(vec, obedit->obmat[3]);
vec[0]= gridf*floorf(0.5f+ vec[0]/gridf);
@@ -483,7 +483,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
sub_v3_v3(vec, obedit->obmat[3]);
mul_m3_v3(imat, vec);
- VECCOPY(tv->loc, vec);
+ copy_v3_v3(tv->loc, vec);
}
special_transvert_update(obedit);
@@ -507,7 +507,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
float vecN[3], nLoc[3];
/* get nearest grid point to snap to */
- VECCOPY(nLoc, pchan->pose_mat[3]);
+ copy_v3_v3(nLoc, pchan->pose_mat[3]);
vec[0]= gridf * (float)(floor(0.5f+ nLoc[0]/gridf));
vec[1]= gridf * (float)(floor(0.5f+ nLoc[1]/gridf));
vec[2]= gridf * (float)(floor(0.5f+ nLoc[2]/gridf));
@@ -632,7 +632,7 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
float cursp[3];
invert_m4_m4(ob->imat, ob->obmat);
- VECCOPY(cursp, curs);
+ copy_v3_v3(cursp, curs);
mul_m4_v3(ob->imat, cursp);
for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
@@ -779,7 +779,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
tv= transvmain;
for(a=0; a<tottrans; a++, tv++) {
- VECCOPY(vec, tv->loc);
+ copy_v3_v3(vec, tv->loc);
mul_m3_v3(bmat, vec);
add_v3_v3(vec, obedit->obmat[3]);
add_v3_v3(centroid, vec);
@@ -788,7 +788,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
if(v3d->around==V3D_CENTROID) {
mul_v3_fl(centroid, 1.0f/(float)tottrans);
- VECCOPY(curs, centroid);
+ copy_v3_v3(curs, centroid);
}
else {
mid_v3_v3v3(curs, min, max);
@@ -805,7 +805,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
for (pchan = obact->pose->chanbase.first; pchan; pchan=pchan->next) {
if(arm->layer & pchan->bone->layer) {
if(pchan->bone->flag & BONE_SELECTED) {
- VECCOPY(vec, pchan->pose_head);
+ copy_v3_v3(vec, pchan->pose_head);
mul_m4_v3(obact->obmat, vec);
add_v3_v3(centroid, vec);
DO_MINMAX(vec, min, max);
@@ -816,7 +816,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
}
else {
CTX_DATA_BEGIN(C, Object*, ob, selected_objects) {
- VECCOPY(vec, ob->obmat[3]);
+ copy_v3_v3(vec, ob->obmat[3]);
add_v3_v3(centroid, vec);
DO_MINMAX(vec, min, max);
count++;
@@ -826,7 +826,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
if(count) {
if(v3d->around==V3D_CENTROID) {
mul_v3_fl(centroid, 1.0f/(float)count);
- VECCOPY(curs, centroid);
+ copy_v3_v3(curs, centroid);
}
else {
mid_v3_v3v3(curs, min, max);
@@ -881,7 +881,7 @@ static int snap_curs_to_active(bContext *C, wmOperator *UNUSED(op))
}
else {
if (obact) {
- VECCOPY(curs, obact->obmat[3]);
+ copy_v3_v3(curs, obact->obmat[3]);
}
}
@@ -958,7 +958,7 @@ int minmax_verts(Object *obedit, float *min, float *max)
tv= transvmain;
for(a=0; a<tottrans; a++, tv++) {
- VECCOPY(vec, tv->loc);
+ copy_v3_v3(vec, tv->loc);
mul_m3_v3(bmat, vec);
add_v3_v3(vec, obedit->obmat[3]);
add_v3_v3(centroid, vec);
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 2fc1182a280..759fefba438 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -118,10 +118,22 @@ void setTransformViewMatrices(TransInfo *t)
calculateCenter2D(t);
}
+static void convertViewVec2D(View2D *v2d, float *vec, int dx, int dy)
+{
+ float divx, divy;
+
+ divx= v2d->mask.xmax - v2d->mask.xmin;
+ divy= v2d->mask.ymax - v2d->mask.ymin;
+
+ vec[0]= (v2d->cur.xmax - v2d->cur.xmin) * dx / divx;
+ vec[1]= (v2d->cur.ymax - v2d->cur.ymin) * dy / divy;
+ vec[2]= 0.0f;
+}
+
void convertViewVec(TransInfo *t, float *vec, int dx, int dy)
{
- if (t->spacetype==SPACE_VIEW3D) {
- if (t->ar->regiontype == RGN_TYPE_WINDOW) {
+ if(t->spacetype==SPACE_VIEW3D) {
+ if(t->ar->regiontype == RGN_TYPE_WINDOW) {
float mval_f[2];
mval_f[0]= dx;
mval_f[1]= dy;
@@ -129,50 +141,19 @@ void convertViewVec(TransInfo *t, float *vec, int dx, int dy)
}
}
else if(t->spacetype==SPACE_IMAGE) {
- View2D *v2d = t->view;
- float divx, divy, aspx, aspy;
-
- ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
+ float aspx, aspy;
- divx= v2d->mask.xmax-v2d->mask.xmin;
- divy= v2d->mask.ymax-v2d->mask.ymin;
+ convertViewVec2D(t->view, vec, dx, dy);
- vec[0]= aspx*(v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx;
- vec[1]= aspy*(v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy;
- vec[2]= 0.0f;
+ ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
+ vec[0]*= aspx;
+ vec[1]*= aspy;
}
else if(ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
- View2D *v2d = t->view;
- float divx, divy;
-
- divx= v2d->mask.xmax-v2d->mask.xmin;
- divy= v2d->mask.ymax-v2d->mask.ymin;
-
- vec[0]= (v2d->cur.xmax-v2d->cur.xmin)*(dx) / (divx);
- vec[1]= (v2d->cur.ymax-v2d->cur.ymin)*(dy) / (divy);
- vec[2]= 0.0f;
+ convertViewVec2D(t->view, vec, dx, dy);
}
- else if(t->spacetype==SPACE_NODE) {
- View2D *v2d = &t->ar->v2d;
- float divx, divy;
-
- divx= v2d->mask.xmax-v2d->mask.xmin;
- divy= v2d->mask.ymax-v2d->mask.ymin;
-
- vec[0]= (v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx;
- vec[1]= (v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy;
- vec[2]= 0.0f;
- }
- else if(t->spacetype==SPACE_SEQ) {
- View2D *v2d = &t->ar->v2d;
- float divx, divy;
-
- divx= v2d->mask.xmax-v2d->mask.xmin;
- divy= v2d->mask.ymax-v2d->mask.ymin;
-
- vec[0]= (v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx;
- vec[1]= (v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy;
- vec[2]= 0.0f;
+ else if(ELEM(t->spacetype, SPACE_NODE, SPACE_SEQ)) {
+ convertViewVec2D(&t->ar->v2d, vec, dx, dy);
}
}
@@ -1690,8 +1671,8 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
values[0]= RNA_float_get(op->ptr, "value");
}
- QUATCOPY(t->values, values);
- QUATCOPY(t->auto_values, values);
+ copy_v4_v4(t->values, values);
+ copy_v4_v4(t->auto_values, values);
t->flag |= T_AUTOVALUES;
}
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index a9f9208346c..6de854ff6c9 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -555,7 +555,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
td->ext->rotAngle= NULL;
td->ext->quat= pchan->quat;
- QUATCOPY(td->ext->iquat, pchan->quat);
+ copy_qt_qt(td->ext->iquat, pchan->quat);
}
td->ext->rotOrder= pchan->rotmode;
@@ -1305,7 +1305,7 @@ static void createTransMBallVerts(TransInfo *t)
/* quat is used for rotation of MetaElem */
tx->quat = ml->quat;
- QUATCOPY(tx->iquat, ml->quat);
+ copy_qt_qt(tx->iquat, ml->quat);
tx->rot = NULL;
@@ -4299,8 +4299,8 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
td->ext->rotAngle= NULL;
td->ext->quat= ob->quat;
- QUATCOPY(td->ext->iquat, ob->quat);
- QUATCOPY(td->ext->dquat, ob->dquat);
+ copy_qt_qt(td->ext->iquat, ob->quat);
+ copy_qt_qt(td->ext->dquat, ob->dquat);
}
td->ext->rotOrder=ob->rotmode;
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 103556accd8..2c69cc85214 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1299,7 +1299,7 @@ static void restoreElement(TransData *td)
copy_v3_v3(td->ext->size, td->ext->isize);
}
if (td->ext->quat) {
- QUATCOPY(td->ext->quat, td->ext->iquat);
+ copy_qt_qt(td->ext->quat, td->ext->iquat);
}
}
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 2d3c1d80d8d..f926f442830 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -610,7 +610,7 @@ void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
ot->exec = transform_exec;
ot->modal = transform_modal;
ot->cancel = transform_cancel;
- ot->poll = ED_operator_editcurve;
+ ot->poll = ED_operator_editcurve_3d;
RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h
index 965f317aa50..3fff79390e3 100644
--- a/source/blender/gpu/GPU_extensions.h
+++ b/source/blender/gpu/GPU_extensions.h
@@ -136,7 +136,7 @@ int GPU_texture_opengl_bindcode(GPUTexture *tex);
GPUFrameBuffer *GPU_framebuffer_create(void);
int GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, char err_out[256]);
void GPU_framebuffer_texture_detach(GPUFrameBuffer *fb, GPUTexture *tex);
-void GPU_framebuffer_texture_bind(GPUFrameBuffer *fb, GPUTexture *tex);
+void GPU_framebuffer_texture_bind(GPUFrameBuffer *fb, GPUTexture *tex, int w, int h);
void GPU_framebuffer_texture_unbind(GPUFrameBuffer *fb, GPUTexture *tex);
void GPU_framebuffer_free(GPUFrameBuffer *fb);
@@ -146,10 +146,11 @@ void GPU_framebuffer_restore(void);
- wrapper around framebuffer and texture for simple offscreen drawing
- changes size if graphics card can't support it */
-GPUOffScreen *GPU_offscreen_create(int *width, int *height, char err_out[256]);
+GPUOffScreen *GPU_offscreen_create(int width, int height, char err_out[256]);
void GPU_offscreen_free(GPUOffScreen *ofs);
void GPU_offscreen_bind(GPUOffScreen *ofs);
void GPU_offscreen_unbind(GPUOffScreen *ofs);
+void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels);
/* GPU Shader
- only for fragment shaders now
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index 6189062a855..e1a89daf7e2 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -790,7 +790,7 @@ void GPU_framebuffer_texture_detach(GPUFrameBuffer *fb, GPUTexture *tex)
tex->fb = NULL;
}
-void GPU_framebuffer_texture_bind(GPUFrameBuffer *UNUSED(fb), GPUTexture *tex)
+void GPU_framebuffer_texture_bind(GPUFrameBuffer *UNUSED(fb), GPUTexture *tex, int w, int h)
{
/* push attributes */
glPushAttrib(GL_ENABLE_BIT);
@@ -801,7 +801,7 @@ void GPU_framebuffer_texture_bind(GPUFrameBuffer *UNUSED(fb), GPUTexture *tex)
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, tex->fb->object);
/* push matrices and set default viewport and matrix */
- glViewport(0, 0, tex->w, tex->h);
+ glViewport(0, 0, w, h);
GG.currentfb = tex->fb->object;
glMatrixMode(GL_PROJECTION);
@@ -859,13 +859,19 @@ struct GPUOffScreen {
GPUFrameBuffer *fb;
GPUTexture *color;
GPUTexture *depth;
+
+ /* requested width/height, may be smaller than actual texture size due
+ to missing non-power of two support, so we compensate for that */
+ int w, h;
};
-GPUOffScreen *GPU_offscreen_create(int *width, int *height, char err_out[256])
+GPUOffScreen *GPU_offscreen_create(int width, int height, char err_out[256])
{
GPUOffScreen *ofs;
ofs= MEM_callocN(sizeof(GPUOffScreen), "GPUOffScreen");
+ ofs->w= width;
+ ofs->h= height;
ofs->fb = GPU_framebuffer_create();
if(!ofs->fb) {
@@ -873,24 +879,18 @@ GPUOffScreen *GPU_offscreen_create(int *width, int *height, char err_out[256])
return NULL;
}
- ofs->depth = GPU_texture_create_depth(*width, *height, err_out);
+ ofs->depth = GPU_texture_create_depth(width, height, err_out);
if(!ofs->depth) {
GPU_offscreen_free(ofs);
return NULL;
}
- if(*width!=ofs->depth->w || *height!=ofs->depth->h) {
- *width= ofs->depth->w;
- *height= ofs->depth->h;
- printf("Offscreen size differs from given size!\n");
- }
-
if(!GPU_framebuffer_texture_attach(ofs->fb, ofs->depth, err_out)) {
GPU_offscreen_free(ofs);
return NULL;
}
- ofs->color = GPU_texture_create_2D(*width, *height, NULL, err_out);
+ ofs->color = GPU_texture_create_2D(width, height, NULL, err_out);
if(!ofs->color) {
GPU_offscreen_free(ofs);
return NULL;
@@ -921,7 +921,7 @@ void GPU_offscreen_free(GPUOffScreen *ofs)
void GPU_offscreen_bind(GPUOffScreen *ofs)
{
glDisable(GL_SCISSOR_TEST);
- GPU_framebuffer_texture_bind(ofs->fb, ofs->color);
+ GPU_framebuffer_texture_bind(ofs->fb, ofs->color, ofs->w, ofs->h);
}
void GPU_offscreen_unbind(GPUOffScreen *ofs)
@@ -931,6 +931,11 @@ void GPU_offscreen_unbind(GPUOffScreen *ofs)
glEnable(GL_SCISSOR_TEST);
}
+void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels)
+{
+ glReadPixels(0, 0, ofs->w, ofs->h, GL_RGBA, type, pixels);
+}
+
/* GPUShader */
struct GPUShader {
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 181ccefa1e9..d585d0bc7ec 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -1665,7 +1665,8 @@ void GPU_lamp_shadow_buffer_bind(GPULamp *lamp, float viewmat[][4], int *winsize
/* opengl */
glDisable(GL_SCISSOR_TEST);
- GPU_framebuffer_texture_bind(lamp->fb, lamp->tex);
+ GPU_framebuffer_texture_bind(lamp->fb, lamp->tex,
+ GPU_texture_opengl_width(lamp->tex), GPU_texture_opengl_height(lamp->tex));
/* set matrices */
copy_m4_m4(viewmat, lamp->viewmat);
diff --git a/source/blender/ikplugin/CMakeLists.txt b/source/blender/ikplugin/CMakeLists.txt
index bde6f78df8b..87b0c6c671a 100644
--- a/source/blender/ikplugin/CMakeLists.txt
+++ b/source/blender/ikplugin/CMakeLists.txt
@@ -49,7 +49,7 @@ set(SRC
if(WITH_IK_ITASC)
add_definitions(-DWITH_IK_ITASC)
list(APPEND INC
- ../../../extern/Eigen2
+ ../../../extern/Eigen3
../../../intern/itasc
)
list(APPEND SRC
@@ -57,4 +57,8 @@ if(WITH_IK_ITASC)
)
endif()
+if(WIN32)
+ add_definitions(-DEIGEN_DONT_ALIGN_STATICALLY)
+endif()
+
blender_add_lib(bf_ikplugin "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/ikplugin/SConscript b/source/blender/ikplugin/SConscript
index f60c42f8dc9..4cff3399fdc 100644
--- a/source/blender/ikplugin/SConscript
+++ b/source/blender/ikplugin/SConscript
@@ -4,8 +4,11 @@ defs = []
sources = env.Glob('intern/*.c') + env.Glob('intern/*.cpp')
incs = '#/intern/guardedalloc #/intern/iksolver/extern ../makesdna ../blenlib'
-incs += ' ../blenkernel ../include ../ikplugin #/intern/itasc #/extern/Eigen2'
+incs += ' ../blenkernel ../include ../ikplugin #/intern/itasc #/extern/Eigen3'
defs.append('WITH_IK_ITASC')
+if env['PLATFORM'] == 'win32':
+ defs.append('EIGEN_DONT_ALIGN_STATICALLY')
+
env.BlenderLib ( 'bf_ikplugin', sources, Split(incs), defs, libtype=['core','player'], priority=[180, 190] )
diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt
index 6aef9a4254e..c7556a2818e 100644
--- a/source/blender/imbuf/CMakeLists.txt
+++ b/source/blender/imbuf/CMakeLists.txt
@@ -23,11 +23,6 @@
#
# ***** END GPL LICENSE BLOCK *****
-if(WITH_CODEC_FFMPEG)
- # FFMPEG gives warnigns which are hard to avoid across multiple versions.
- remove_strict_flags()
-endif()
-
set(INC
.
../avi
@@ -161,6 +156,12 @@ if(WITH_CODEC_FFMPEG)
${FFMPEG_INCLUDE_DIRS}
)
add_definitions(-DWITH_FFMPEG)
+
+ remove_strict_flags_file(
+ intern/indexer.c
+ intern/util.c
+ intern/anim_movie.c
+ )
endif()
if(WITH_IMAGE_DDS)
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h
index 5f03ca9ba28..3ab199625a4 100644
--- a/source/blender/imbuf/IMB_imbuf.h
+++ b/source/blender/imbuf/IMB_imbuf.h
@@ -94,19 +94,20 @@ void IMB_exit(void);
*
* @attention Defined in readimage.c
*/
-struct ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags);
+struct ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size,
+ int flags, const char *descr);
/**
*
* @attention Defined in readimage.c
*/
-struct ImBuf *IMB_testiffname(char *naam,int flags);
+struct ImBuf *IMB_testiffname(const char *filepath, int flags);
/**
*
* @attention Defined in readimage.c
*/
-struct ImBuf *IMB_loadiffname(const char *naam, int flags);
+struct ImBuf *IMB_loadiffname(const char *filepath, int flags);
/**
*
@@ -119,7 +120,7 @@ void IMB_freeImBuf(struct ImBuf *ibuf);
* @attention Defined in allocimbuf.c
*/
struct ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y,
- unsigned char d, unsigned int flags);
+ unsigned char d, unsigned int flags);
/**
*
@@ -237,7 +238,7 @@ int IMB_anim_get_fps(struct anim * anim,
/**
*
- * @attention Defined in anim.c
+ * @attention Defined in anim_movie.c
*/
struct anim *IMB_open_anim(const char *name, int ib_flags, int streamindex);
void IMB_close_anim(struct anim *anim);
@@ -245,16 +246,16 @@ void IMB_close_anim(struct anim *anim);
/**
*
- * @attention Defined in anim.c
+ * @attention Defined in anim_movie.c
*/
-int ismovie(const char *name);
+int ismovie(const char *filepath);
void IMB_anim_set_preseek(struct anim *anim, int preseek);
int IMB_anim_get_preseek(struct anim *anim);
/**
*
- * @attention Defined in anim.c
+ * @attention Defined in anim_movie.c
*/
struct ImBuf *IMB_anim_absolute(
@@ -264,14 +265,14 @@ struct ImBuf *IMB_anim_absolute(
/**
*
- * @attention Defined in anim.c
+ * @attention Defined in anim_movie.c
* fetches a define previewframe, usually half way into the movie
*/
struct ImBuf *IMB_anim_previewframe(struct anim *anim);
/**
*
- * @attention Defined in anim.c
+ * @attention Defined in anim_movie.c
*/
void IMB_free_anim(struct anim *anim);
@@ -419,7 +420,7 @@ struct ImBuf *IMB_loadiffmem(int *mem, int flags);
* @deprecated Only here for backwards compatibility of the
* @deprecated plugin system.
*/
-struct ImBuf *IMB_loadifffile(int file, int flags);
+struct ImBuf *IMB_loadifffile(int file, int flags, const char *descr);
/**
*
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c
index 98828c58511..5bbabd84648 100644
--- a/source/blender/imbuf/intern/allocimbuf.c
+++ b/source/blender/imbuf/intern/allocimbuf.c
@@ -446,6 +446,7 @@ ImBuf *IMB_dupImBuf(ImBuf *ibuf1)
return(ibuf2);
}
+#if 0 /* remove? - campbell */
/* support for cache limiting */
static void imbuf_cache_destructor(void *data)
@@ -461,6 +462,7 @@ static void imbuf_cache_destructor(void *data)
ibuf->c_handle = NULL;
}
+
static MEM_CacheLimiterC **get_imbuf_cache_limiter(void)
{
static MEM_CacheLimiterC *c = NULL;
@@ -470,3 +472,4 @@ static MEM_CacheLimiterC **get_imbuf_cache_limiter(void)
return &c;
}
+#endif
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index e1592d221fb..3adb9a3791f 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -1,7 +1,4 @@
/*
- * anim.c
- *
- *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -113,7 +110,7 @@
#endif
#endif
-int ismovie(const char *UNUSED(name)) {
+int ismovie(const char *UNUSED(filepath)) {
return 0;
}
@@ -372,7 +369,7 @@ static ImBuf * avi_fetchibuf (struct anim *anim, int position) {
if (anim->pgf) {
lpbi = AVIStreamGetFrame(anim->pgf, position + AVIStreamStart(anim->pavi[anim->firstvideo]));
if (lpbi) {
- ibuf = IMB_ibImageFromMemory((unsigned char *) lpbi, 100, IB_rect);
+ ibuf = IMB_ibImageFromMemory((unsigned char *) lpbi, 100, IB_rect, "<avi_fetchibuf>");
//Oh brother...
}
}
diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c
index 005c343379a..5f7c4bfeedf 100644
--- a/source/blender/imbuf/intern/readimage.c
+++ b/source/blender/imbuf/intern/readimage.c
@@ -43,6 +43,7 @@
#endif
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "imbuf.h"
#include "IMB_imbuf_types.h"
@@ -71,13 +72,13 @@ static ImBuf *imb_ibImageFromFile(const char *filepath, int flags)
return NULL;
}
-ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags)
+ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags, const char *descr)
{
ImBuf *ibuf;
ImFileType *type;
if(mem == NULL) {
- printf("Error in ibImageFromMemory: NULL pointer\n");
+ fprintf(stderr, "%s: NULL pointer\n", __func__);
return NULL;
}
@@ -95,12 +96,12 @@ ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags)
}
}
- fprintf(stderr, "Unknown fileformat\n");
-
+ fprintf(stderr, "%s: unknown fileformat (%s)\n", __func__, descr);
+
return NULL;
}
-ImBuf *IMB_loadifffile(int file, int flags)
+ImBuf *IMB_loadifffile(int file, int flags, const char *descr)
{
ImBuf *ibuf;
unsigned char *mem;
@@ -112,14 +113,14 @@ ImBuf *IMB_loadifffile(int file, int flags)
mem= mmap(NULL, size, PROT_READ, MAP_SHARED, file, 0);
if(mem==(unsigned char*)-1) {
- fprintf(stderr, "Couldn't get mapping\n");
+ fprintf(stderr, "%s: couldn't get mapping %s\n", __func__, descr);
return NULL;
}
- ibuf= IMB_ibImageFromMemory(mem, size, flags);
+ ibuf= IMB_ibImageFromMemory(mem, size, flags, descr);
if(munmap(mem, size))
- fprintf(stderr, "Couldn't unmap file.\n");
+ fprintf(stderr, "%s: couldn't unmap file %s\n", __func__, descr);
return ibuf;
}
@@ -139,50 +140,51 @@ static void imb_cache_filename(char *filename, const char *name, int flags)
BLI_strncpy(filename, name, IB_FILENAME_SIZE);
}
-ImBuf *IMB_loadiffname(const char *name, int flags)
+ImBuf *IMB_loadiffname(const char *filepath, int flags)
{
ImBuf *ibuf;
int file, a;
- char filename[IB_FILENAME_SIZE];
+ char filepath_tx[IB_FILENAME_SIZE];
- imb_cache_filename(filename, name, flags);
+ imb_cache_filename(filepath_tx, filepath, flags);
- ibuf= imb_ibImageFromFile(name, flags);
+ ibuf= imb_ibImageFromFile(filepath_tx, flags);
if(!ibuf) {
- file = open(filename, O_BINARY|O_RDONLY);
+ file = open(filepath_tx, O_BINARY|O_RDONLY);
if(file < 0) return NULL;
- ibuf= IMB_loadifffile(file, flags);
+ ibuf= IMB_loadifffile(file, flags, filepath_tx);
close(file);
}
if(ibuf) {
- BLI_strncpy(ibuf->name, name, sizeof(ibuf->name));
- BLI_strncpy(ibuf->cachename, filename, sizeof(ibuf->cachename));
+ BLI_strncpy(ibuf->name, filepath, sizeof(ibuf->name));
+ BLI_strncpy(ibuf->cachename, filepath_tx, sizeof(ibuf->cachename));
for(a=1; a<ibuf->miptot; a++)
- BLI_strncpy(ibuf->mipmap[a-1]->cachename, filename, sizeof(ibuf->cachename));
+ BLI_strncpy(ibuf->mipmap[a-1]->cachename, filepath_tx, sizeof(ibuf->cachename));
if(flags & IB_fields) IMB_de_interlace(ibuf);
}
return ibuf;
}
-ImBuf *IMB_testiffname(char *name, int flags)
+ImBuf *IMB_testiffname(const char *filepath, int flags)
{
ImBuf *ibuf;
int file;
- char filename[IB_FILENAME_SIZE];
+ char filepath_tx[IB_FILENAME_SIZE];
- imb_cache_filename(filename, name, flags);
+ imb_cache_filename(filepath_tx, filepath, flags);
- file = open(filename,O_BINARY|O_RDONLY);
+ file = open(filepath_tx,O_BINARY|O_RDONLY);
if(file < 0) return NULL;
- ibuf=IMB_loadifffile(file, flags|IB_test|IB_multilayer);
+ ibuf=IMB_loadifffile(file, flags|IB_test|IB_multilayer, filepath_tx);
+
if(ibuf) {
- BLI_strncpy(ibuf->name, name, sizeof(ibuf->name));
- BLI_strncpy(ibuf->cachename, filename, sizeof(ibuf->cachename));
+ BLI_strncpy(ibuf->name, filepath, sizeof(ibuf->name));
+ BLI_strncpy(ibuf->cachename, filepath_tx, sizeof(ibuf->cachename));
}
close(file);
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index ece6c84b0e8..bb67b46a7e5 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -125,6 +125,14 @@ typedef struct TFace {
#define ME_EDIT_MIRROR_TOPO (1 << 4)
#define ME_EDIT_VERT_SEL (1 << 5)
+/* we cant have both flags enabled at once,
+ * flags defined in DNA_scene_types.h */
+#define ME_EDIT_PAINT_SEL_MODE(_me) ( \
+ (_me->editflag & ME_EDIT_PAINT_MASK) ? SCE_SELECT_FACE : \
+ (_me->editflag & ME_EDIT_VERT_SEL) ? SCE_SELECT_VERTEX : \
+ 0 \
+ )
+
/* me->flag */
/* #define ME_ISDONE 1 */
#define ME_DEPRECATED 2
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 98bcad79be3..3e17d7f4942 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -321,6 +321,7 @@ typedef struct DupliObject {
/* check if the object type supports materials */
#define OB_TYPE_SUPPORT_MATERIAL(_type) ((_type) >= OB_MESH && (_type) <= OB_MBALL)
+#define OB_TYPE_SUPPORT_VGROUP(_type) (ELEM(_type, OB_MESH, OB_LATTICE))
/* partype: first 4 bits: type */
#define PARTYPE 15
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index c0d1931d326..bbc70797921 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -441,68 +441,6 @@ typedef struct SpaceLogic {
struct bGPdata *gpd; /* grease-pencil data */
} SpaceLogic;
-/* note, this entire struct isnt used anymore!,
- * may remove some day - campbell */
-typedef struct SpaceImaSel {
- SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
- int spacetype;
- float blockscale;
-
- short blockhandler[8];
-
- View2D v2d; /* deprecated, copied to region */
-
- struct FileList *files;
-
- /* specific stuff for drawing */
- char title[24];
- char dir[240];
- char file[80];
-
- short type, menu, flag, sort;
-
- void *curfont;
- int active_file;
-
- int numtilesx;
- int numtilesy;
-
- int selstate;
-
- struct rcti viewrect;
- struct rcti bookmarkrect;
-
- float scrollpos; /* current position of scrollhandle */
- float scrollheight; /* height of the scrollhandle */
- float scrollarea; /* scroll region, scrollpos is from 0 to scrollarea */
-
- float aspect;
- unsigned short retval; /* event */
-
- short ipotype;
-
- short filter;
- short active_bookmark;
- short pad, pad1;
-
- /* view settings */
- short prv_w;
- short prv_h;
-
- /* one day we'll add unions to dna */
- void (*returnfunc)(char *);
- void (*returnfunc_event)(unsigned short);
- void (*returnfunc_args)(char *, void *, void *);
-
- void *arg1, *arg2;
- short *menup; /* pointer to menu result or ID browsing */
- char *pupmenu; /* optional menu in header */
-
- struct ImBuf *img;
-} SpaceImaSel;
-
-
typedef struct ConsoleLine {
struct ConsoleLine *next, *prev;
@@ -554,22 +492,6 @@ typedef struct SpaceUserPref {
} SpaceUserPref;
-typedef struct SpaceSound {
- struct SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
- int spacetype;
- float blockscale;
- struct ScrArea *area;
-
- View2D v2d;
-
- struct bSound *sound;
- short mode, sndnr;
- short xof, yof;
- short flag, lock;
- int pad2;
-} SpaceSound;
-
/* view3d Now in DNA_view3d_types.h */
@@ -956,11 +878,11 @@ enum {
SPACE_INFO,
SPACE_SEQ,
SPACE_TEXT,
- SPACE_IMASEL,
- SPACE_SOUND,
+ SPACE_IMASEL, /* deprecated */
+ SPACE_SOUND, /* Deprecated */
SPACE_ACTION,
SPACE_NLA,
- SPACE_SCRIPT,
+ SPACE_SCRIPT, /* Deprecated */
SPACE_TIME,
SPACE_NODE,
SPACE_LOGIC,
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index a3934618582..8dd00f4ac08 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -267,13 +267,11 @@ typedef struct bTheme {
ThemeSpace tv3d;
ThemeSpace tfile;
ThemeSpace tipo;
- ThemeSpace tinfo;
- ThemeSpace tsnd;
+ ThemeSpace tinfo;
ThemeSpace tact;
ThemeSpace tnla;
ThemeSpace tseq;
ThemeSpace tima;
- ThemeSpace timasel;
ThemeSpace text;
ThemeSpace toops;
ThemeSpace ttime;
diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h
index 5f420893204..0c455022db4 100644
--- a/source/blender/makesdna/DNA_world_types.h
+++ b/source/blender/makesdna/DNA_world_types.h
@@ -96,7 +96,7 @@ typedef struct World {
float misi, miststa, mistdist, misthi;
- float starr, starg, starb, stark;
+ float starr, starg, starb, stark; /* Deprecated */
float starsize, starmindist;
float stardist, starcolnoise;
@@ -186,7 +186,7 @@ typedef struct World {
#define WOMAP_HORIZ 2
#define WOMAP_ZENUP 4
#define WOMAP_ZENDOWN 8
-#define WOMAP_MIST 16
+#define WOMAP_MIST 16 /* Deprecated */
/* flag */
#define WO_DS_EXPAND (1<<0)
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 39cb1743c25..a966523d990 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -168,35 +168,35 @@ static int additional_slen_offset;
* \param str char
* \param len int
*/
-int add_type(const char *str, int len);
+static int add_type(const char *str, int len);
/**
* Add variable \c str to
* \param str
*/
-int add_name(char *str);
+static int add_name(const char *str);
/**
* Search whether this structure type was already found, and if not,
* add it.
*/
-short *add_struct(int namecode);
+static short *add_struct(int namecode);
/**
* Remove comments from this buffer. Assumes that the buffer refers to
* ascii-code text.
*/
-int preprocess_include(char *maindata, int len);
+static int preprocess_include(char *maindata, int len);
/**
* Scan this file for serializable types.
*/
-int convert_include(char *filename);
+static int convert_include(char *filename);
/**
* Determine how many bytes are needed for an array.
*/
-int arraysize(char *astr, int len);
+static int arraysize(char *astr, int len);
/**
* Determine how many bytes are needed for each struct.
@@ -267,12 +267,12 @@ int add_type(const char *str, int len)
* cases, unfortunately. These are explicitly checked.
*
* */
-int add_name(char *str)
+static int add_name(const char *str)
{
int nr, i, j, k;
char *cp;
char buf[255]; /* stupid limit, change it :) */
- char *name;
+ const char *name;
additional_slen_offset = 0;
@@ -422,7 +422,7 @@ short *add_struct(int namecode)
return sp;
}
-int preprocess_include(char *maindata, int len)
+static int preprocess_include(char *maindata, int len)
{
int a, newlen, comment = 0;
char *cp, *temp, *md;
@@ -1087,7 +1087,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
/* ************************* END MAKE DNA ********************** */
-static void make_bad_file(char *file, int line)
+static void make_bad_file(const char *file, int line)
{
FILE *fp= fopen(file, "w");
fprintf(fp, "#error \"Error! can't make correct DNA.c file from %s:%d, STUPID!\"\n", __FILE__, line);
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 59b251317dc..ab69addbbdb 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -195,8 +195,8 @@ if(WITH_CODEC_FFMPEG)
add_definitions(-DWITH_FFMPEG)
endif()
-if(NOT WITH_MOD_FLUID)
- add_definitions(-DDISABLE_ELBEEM)
+if(WITH_MOD_FLUID)
+ add_definitions(-DWITH_MOD_FLUID)
endif()
if(WITH_FFTW3)
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index d7fb9536587..adedcbb18b3 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -2768,14 +2768,14 @@ static void rna_generate_header_cpp(BlenderRNA *brna, FILE *f)
fprintf(f, "}\n\n#endif /* __RNA_BLENDER_CPP_H__ */\n\n");
}
-static void make_bad_file(char *file, int line)
+static void make_bad_file(const char *file, int line)
{
FILE *fp= fopen(file, "w");
fprintf(fp, "#error \"Error! can't make correct RNA file from %s:%d, STUPID!\"\n", __FILE__, line);
fclose(fp);
}
-static int rna_preprocess(char *outfile)
+static int rna_preprocess(const char *outfile)
{
BlenderRNA *brna;
StructDefRNA *ds;
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index f2d1578388d..82a7d276817 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -95,15 +95,15 @@ static void rna_Action_groups_remove(bAction *act, ReportList *reports, bActionG
static FCurve *rna_Action_fcurve_new(bAction *act, ReportList *reports, const char *data_path, int index, const char *group)
{
- if(group && group[0]=='\0') group= NULL;
+ if (group && group[0]=='\0') group= NULL;
- if(data_path[0] == '\0') {
+ if (data_path[0] == '\0') {
BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument");
return NULL;
}
/* annoying, check if this exists */
- if(verify_fcurve(act, group, data_path, index, 0)) {
+ if (verify_fcurve(act, group, data_path, index, 0)) {
BKE_reportf(reports, RPT_ERROR, "F-Curve '%s[%d]' already exists in action '%s'", data_path, index, act->id.name+2);
return NULL;
}
diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c
index 15facd3606f..f041d3efde4 100644
--- a/source/blender/makesrna/intern/rna_context.c
+++ b/source/blender/makesrna/intern/rna_context.c
@@ -112,7 +112,7 @@ static PointerRNA rna_Context_tool_settings_get(PointerRNA *ptr)
return rna_pointer_inherit_refine(ptr, &RNA_ToolSettings, CTX_data_tool_settings(C));
}
-static PointerRNA rna_Context_user_preferences_get(PointerRNA *ptr)
+static PointerRNA rna_Context_user_preferences_get(PointerRNA *UNUSED(ptr))
{
PointerRNA newptr;
RNA_pointer_create(NULL, &RNA_UserPreferences, &U, &newptr);
diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c
index df32359ef91..a7eedf5f062 100644
--- a/source/blender/makesrna/intern/rna_fluidsim.c
+++ b/source/blender/makesrna/intern/rna_fluidsim.c
@@ -75,7 +75,7 @@ static StructRNA* rna_FluidSettings_refine(struct PointerRNA *ptr)
}
}
-static void rna_fluid_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_fluid_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob= ptr->id.data;
@@ -170,7 +170,7 @@ static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA
static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *value)
{
-#ifdef DISABLE_ELBEEM
+#ifndef WITH_MOD_FLUID
(void)ptr;
value[0]= '\0';
#else
@@ -183,7 +183,7 @@ static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *v
static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *UNUSED(ptr))
{
-#ifdef DISABLE_ELBEEM
+#ifndef WITH_MOD_FLUID
return 0;
#else
return 31;
diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c
index 16d7dd16382..65dcbc66624 100644
--- a/source/blender/makesrna/intern/rna_key.c
+++ b/source/blender/makesrna/intern/rna_key.c
@@ -351,7 +351,7 @@ static char *rna_ShapeKey_path(PointerRNA *ptr)
return BLI_sprintfN("key_blocks[\"%s\"]", kb->name);
}
-static void rna_Key_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Key_update_data(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
Key *key= ptr->id.data;
Object *ob;
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 0fa27be251d..63fce2d9edb 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1065,7 +1065,7 @@ static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, cons
* is not for general use and only for the few cases where changing scene
* settings and NOT for general purpose updates, possibly this should be
* given its own notifier. */
-static void rna_Scene_update_active_object_data(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+static void rna_Scene_update_active_object_data(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
Object *ob= OBACT;
if(ob) {
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 625a37814cb..f3b158f84fe 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -541,7 +541,7 @@ static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value)
BLI_split_file_part(value, elem->name, sizeof(elem->name));
}*/
-static void rna_Sequence_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+static void rna_Sequence_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
Editing *ed= seq_give_editing(scene, FALSE);
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index ce84fbeacf9..5793a2ba6f1 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -63,11 +63,8 @@ EnumPropertyItem space_type_items[] = {
{SPACE_INFO, "INFO", 0, "Info", ""},
{SPACE_SEQ, "SEQUENCE_EDITOR", 0, "Sequence Editor", ""},
{SPACE_TEXT, "TEXT_EDITOR", 0, "Text Editor", ""},
- //{SPACE_IMASEL, "IMAGE_BROWSER", 0, "Image Browser", ""},
- {SPACE_SOUND, "AUDIO_WINDOW", 0, "Audio Window", ""},
{SPACE_ACTION, "DOPESHEET_EDITOR", 0, "DopeSheet Editor", ""},
{SPACE_NLA, "NLA_EDITOR", 0, "NLA Editor", ""},
- {SPACE_SCRIPT, "SCRIPTS_WINDOW", 0, "Scripts Window", ""},
{SPACE_TIME, "TIMELINE", 0, "Timeline", ""},
{SPACE_NODE, "NODE_EDITOR", 0, "Node Editor", ""},
{SPACE_LOGIC, "LOGIC_EDITOR", 0, "Logic Editor", ""},
@@ -156,16 +153,10 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
return &RNA_SpaceSequenceEditor;
case SPACE_TEXT:
return &RNA_SpaceTextEditor;
- //case SPACE_IMASEL:
- // return &RNA_SpaceImageBrowser;
- /*case SPACE_SOUND:
- return &RNA_SpaceAudioWindow;*/
case SPACE_ACTION:
return &RNA_SpaceDopeSheetEditor;
case SPACE_NLA:
return &RNA_SpaceNLA;
- /*case SPACE_SCRIPT:
- return &RNA_SpaceScriptsWindow;*/
case SPACE_TIME:
return &RNA_SpaceTimeline;
case SPACE_NODE:
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index df766d7919c..eb66c820455 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -408,6 +408,9 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
parm= RNA_def_string(func, "active_property", "", 0, "", "Identifier of property in data, for the active element");
RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_string(func, "prop_list", "", 0, "",
+ "Identifier of a string property in each data member, specifying which "
+ "of its properties should have a widget displayed in its row");
RNA_def_int(func, "rows", 5, 0, INT_MAX, "", "Number of rows to display", 0, INT_MAX);
RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Maximum number of rows to display", 0, INT_MAX);
RNA_def_enum(func, "type", list_type_items, 0, "Type", "Type of list to use");
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index fbb8218bc85..fc9c8a241c6 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1392,7 +1392,7 @@ static void rna_def_userdef_theme_space_logic(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- /* space_buts */
+ /* space_logic */
srna= RNA_def_struct(brna, "ThemeLogicEditor", NULL);
RNA_def_struct_sdna(srna, "ThemeSpace");
@@ -1451,37 +1451,6 @@ static void rna_def_userdef_theme_space_time(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_userdef_update");
}
-static void rna_def_userdef_theme_space_sound(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* space_sound */
-
- srna= RNA_def_struct(brna, "ThemeAudioWindow", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_ui_text(srna, "Theme Audio Window", "Theme settings for the Audio Window");
-
- rna_def_userdef_theme_spaces_main(srna, SPACE_SOUND);
-
- prop= RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Grid", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop= RNA_def_property(srna, "window_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "shade1");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Window Sliders", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop= RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "cframe");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Current Frame", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-}
-
static void rna_def_userdef_theme_space_image(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1956,7 +1925,6 @@ static void rna_def_userdef_dothemes(BlenderRNA *brna)
rna_def_userdef_theme_space_info(brna);
rna_def_userdef_theme_space_userpref(brna);
rna_def_userdef_theme_space_console(brna);
- rna_def_userdef_theme_space_sound(brna);
rna_def_userdef_theme_space_logic(brna);
rna_def_userdef_theme_colorset(brna);
rna_def_userdef_themes(brna);
@@ -2539,6 +2507,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
/*{25, "NEPALI", 0, "Nepali (नेपाली)", "ne_NP"},*/
/* using the utf8 flipped form of Persian (فارسی) */
{26, "PERSIAN", 0, "Persian (ﯽﺳﺭﺎﻓ)", "fa_PE"},
+ {27, "INDONESIAN", 0, "Indonesian (Bahasa indonesia)", "id_ID"},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "UserPreferencesSystem", NULL);
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 7e2bef9c91f..c7f7fe5feea 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -1179,7 +1179,7 @@ static void rna_Operator_bl_description_set(PointerRNA *ptr, const char *value)
else assert(!"setting the bl_description on a non-builtin operator");
}
-static void rna_KeyMapItem_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_KeyMapItem_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
wmKeyMapItem *kmi= ptr->data;
WM_keyconfig_update_tag(NULL, kmi);
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c
index ab5371aeaad..d421aff7157 100644
--- a/source/blender/makesrna/intern/rna_world.c
+++ b/source/blender/makesrna/intern/rna_world.c
@@ -172,11 +172,6 @@ static void rna_def_world_mtex(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Zenith Down", "Affect the color of the zenith below");
RNA_def_property_update(prop, 0, "rna_World_update");
- /* unused
- prop= RNA_def_property(srna, "map_mist", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_MIST);
- RNA_def_property_ui_text(prop, "Mist", "Causes the texture to affect the intensity of the mist");*/
-
prop= RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "texco");
RNA_def_property_enum_items(prop, texco_items);
@@ -404,7 +399,7 @@ static void rna_def_world_mist(BlenderRNA *brna)
prop= RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "misi");
RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Intensity", "Intensity of the mist effect");
+ RNA_def_property_ui_text(prop, "Minimum", "Overall minimum intensity of the mist effect");
RNA_def_property_update(prop, 0, "rna_World_update");
prop= RNA_def_property(srna, "start", PROP_FLOAT, PROP_DISTANCE);
@@ -472,13 +467,6 @@ static void rna_def_world_stars(BlenderRNA *brna)
RNA_def_property_range(prop, 0, 1);
RNA_def_property_ui_text(prop, "Color Randomization", "Randomize star colors");
RNA_def_property_update(prop, 0, "rna_World_stars_update");
-
- /* unused
- prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "starr");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Color", "Stars color");
- RNA_def_property_update(prop, 0, "rna_World_update");*/
}
void RNA_def_world(BlenderRNA *brna)
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt
index 7e06ef1d017..805cd913aa0 100644
--- a/source/blender/modifiers/CMakeLists.txt
+++ b/source/blender/modifiers/CMakeLists.txt
@@ -111,8 +111,8 @@ if(WITH_MOD_DECIMATE)
)
endif()
-if(NOT WITH_MOD_FLUID)
- add_definitions(-DDISABLE_ELBEEM)
+if(WITH_MOD_FLUID)
+ add_definitions(-DWITH_MOD_FLUID)
endif()
if(WITH_GAMEENGINE)
diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript
index 77a2d577fb5..277ed2c3fb3 100644
--- a/source/blender/modifiers/SConscript
+++ b/source/blender/modifiers/SConscript
@@ -13,12 +13,14 @@ incs += ' ' + env['BF_ZLIB_INC']
defs = []
-# could be made optional
-defs += ['WITH_MOD_BOOLEAN']
-defs += ['WITH_MOD_DECIMATE']
+if env ['WITH_BF_BOOLEAN']:
+ defs.append('WITH_MOD_BOOLEAN')
-if env['BF_NO_ELBEEM']:
- defs.append('DISABLE_ELBEEM')
+if env ['WITH_BF_DECIMATE']:
+ defs.append('WITH_MOD_DECIMATE')
+
+if env['WITH_BF_FLUID']:
+ defs.append('WITH_MOD_FLUID')
if env['WITH_BF_GAMEENGINE']:
incs += ' #/extern/recastnavigation'
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c
index 0e9b71c3e6d..1baa03d2063 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c
@@ -62,9 +62,10 @@
// headers for fluidsim bobj meshes
#include "LBM_fluidsim.h"
+
void fluidsim_init(FluidsimModifierData *fluidmd)
{
-#ifndef DISABLE_ELBEEM
+#ifdef WITH_MOD_FLUID
if(fluidmd)
{
FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings");
@@ -152,7 +153,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
void fluidsim_free(FluidsimModifierData *fluidmd)
{
-#ifndef DISABLE_ELBEEM
+#ifdef WITH_MOD_FLUID
if(fluidmd)
{
if(fluidmd->fss->meshVelocities)
@@ -169,7 +170,7 @@ void fluidsim_free(FluidsimModifierData *fluidmd)
return;
}
-#ifndef DISABLE_ELBEEM
+#ifdef WITH_MOD_FLUID
/* read .bobj.gz file into a fluidsimDerivedMesh struct */
static DerivedMesh *fluidsim_read_obj(const char *filename)
{
@@ -534,14 +535,14 @@ static DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData
return dm;
}
-#endif // DISABLE_ELBEEM
+#endif // WITH_MOD_FLUID
DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene,
Object *UNUSED(ob),
DerivedMesh *dm,
int useRenderParams, int UNUSED(isFinalCalc))
{
-#ifndef DISABLE_ELBEEM
+#ifdef WITH_MOD_FLUID
DerivedMesh *result = NULL;
int framenr;
FluidsimSettings *fss = NULL;
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c
index f551f0f5e7a..b36850da786 100644
--- a/source/blender/modifiers/intern/MOD_mirror.c
+++ b/source/blender/modifiers/intern/MOD_mirror.c
@@ -108,7 +108,7 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
int maxVerts = dm->getNumVerts(dm);
int maxEdges = dm->getNumEdges(dm);
int maxFaces = dm->getNumFaces(dm);
- int *flip_map= NULL;
+ int *flip_map= NULL, flip_map_len= 0;
int do_vgroup_mirr= (mmd->flag & MOD_MIR_VGROUP);
int (*indexMap)[2];
float mtx[4][4], imtx[4][4];
@@ -121,7 +121,7 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
if (do_vgroup_mirr) {
- flip_map= defgroup_flip_map(ob, 0);
+ flip_map= defgroup_flip_map(ob, &flip_map_len, FALSE);
if(flip_map == NULL)
do_vgroup_mirr= 0;
}
@@ -187,7 +187,7 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
if (do_vgroup_mirr) {
MDeformVert *dvert= DM_get_vert_data(result, numVerts, CD_MDEFORMVERT);
if(dvert) {
- defvert_flip(dvert, flip_map);
+ defvert_flip(dvert, flip_map, flip_map_len);
}
}
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index 8d47ad28a86..347af0066c6 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -626,7 +626,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
add_v3_v3(edge_vert_nos[ed->v1], nor);
add_v3_v3(edge_vert_nos[ed->v2], nor);
#endif
- origindex[numFaces * 2 + i]= ORIGINDEX_NONE;
}
#ifdef SOLIDIFY_SIDE_NORMALS
diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
index 6732803f19c..0f5a2b61b87 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
@@ -33,9 +33,9 @@
/* **************** MIX RGB ******************** */
static bNodeSocketTemplate cmp_node_mix_rgb_in[]= {
- { SOCK_FLOAT, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 5.0f, PROP_FACTOR},
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ { SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 5.0f, PROP_FACTOR},
+ { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f},
+ { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f},
{ -1, 0, "" }
};
static bNodeSocketTemplate cmp_node_mix_rgb_out[]= {
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c
index 7851654a0b9..5ca8f2c3d9a 100644
--- a/source/blender/nodes/shader/node_shader_tree.c
+++ b/source/blender/nodes/shader/node_shader_tree.c
@@ -233,8 +233,15 @@ void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
/* each material node has own local shaderesult, with optional copying */
memset(shr, 0, sizeof(ShadeResult));
- if (!exec)
- exec = ntree->execdata = ntreeShaderBeginExecTree(ntree, 1);
+ /* ensure execdata is only initialized once */
+ if (!exec) {
+ BLI_lock_thread(LOCK_NODES);
+ if(!ntree->execdata)
+ ntree->execdata = ntreeShaderBeginExecTree(ntree, 1);
+ BLI_unlock_thread(LOCK_NODES);
+
+ exec = ntree->execdata;
+ }
nts= ntreeGetThreadStack(exec, shi->thread);
ntreeExecThreadNodes(exec, nts, &scd, shi->thread);
diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c
index 78792956684..5e5d44540dc 100644
--- a/source/blender/nodes/texture/node_texture_tree.c
+++ b/source/blender/nodes/texture/node_texture_tree.c
@@ -232,8 +232,15 @@ int ntreeTexExecTree(
data.mtex= mtex;
data.shi= shi;
- if (!exec)
- exec = ntreeTexBeginExecTree(nodes, 1);
+ /* ensure execdata is only initialized once */
+ if (!exec) {
+ BLI_lock_thread(LOCK_NODES);
+ if(!nodes->execdata)
+ ntreeTexBeginExecTree(nodes, 1);
+ BLI_unlock_thread(LOCK_NODES);
+
+ exec= nodes->execdata;
+ }
nts= ntreeGetThreadStack(exec, thread);
ntreeExecThreadNodes(exec, nts, &data, thread);
diff --git a/source/blender/nodes/texture/nodes/node_texture_scale.c b/source/blender/nodes/texture/nodes/node_texture_scale.c
index fbca9be068c..f42b3addc91 100644
--- a/source/blender/nodes/texture/nodes/node_texture_scale.c
+++ b/source/blender/nodes/texture/nodes/node_texture_scale.c
@@ -35,7 +35,7 @@
static bNodeSocketTemplate inputs[]= {
{ SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f },
- { SOCK_VECTOR, 1, "Scale", 1.0f, 1.0f, 1.0f, 0.0f, -10.0f, 10.0f, PROP_FACTOR },
+ { SOCK_VECTOR, 1, "Scale", 1.0f, 1.0f, 1.0f, 0.0f, -10.0f, 10.0f, PROP_XYZ },
{ -1, 0, "" }
};
diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c
index 2d543470342..1b8eb3aabc6 100644
--- a/source/blender/nodes/texture/nodes/node_texture_texture.c
+++ b/source/blender/nodes/texture/nodes/node_texture_texture.c
@@ -54,8 +54,14 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
float co[3], dxt[3], dyt[3];
copy_v3_v3(co, p->co);
- copy_v3_v3(dxt, p->dxt);
- copy_v3_v3(dyt, p->dyt);
+ if (p->osatex) {
+ copy_v3_v3(dxt, p->dxt);
+ copy_v3_v3(dyt, p->dyt);
+ }
+ else {
+ zero_v3(dxt);
+ zero_v3(dyt);
+ }
if(node->custom2 || node->need_exec==0) {
/* this node refers to its own texture tree! */
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h
index c43a2520bb8..d8ddcd593a8 100644
--- a/source/blender/python/BPY_extern.h
+++ b/source/blender/python/BPY_extern.h
@@ -20,7 +20,10 @@
*
* The Original Code was in: source/blender/bpython/include/BPY_extern.h
*
- * Contributor(s): Michel Selten, Willian P. Germano, Chris Keith
+ * Contributor(s): Michel Selten,
+ * Willian P. Germano,
+ * Chris Keith,
+ * Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -39,14 +42,10 @@ struct ID; /* DNA_ID.h */
struct Object; /* DNA_object_types.h */
struct ChannelDriver; /* DNA_anim_types.h */
struct ListBase; /* DNA_listBase.h */
-struct SpaceText; /* DNA_space_types.h */
-struct ScrArea; /* DNA_screen_types.h */
-struct bScreen; /* DNA_screen_types.h */
struct bConstraint; /* DNA_constraint_types.h */
struct bPythonConstraint; /* DNA_constraint_types.h */
struct bConstraintOb; /* DNA_constraint_types.h */
struct bConstraintTarget; /* DNA_constraint_types.h*/
-struct BPyMenu;
struct bContext;
struct bContextDataResult;
struct ReportList;
@@ -61,16 +60,9 @@ void BPY_pyconstraint_target(struct bPythonConstraint *con, struct bConstraintTa
void BPY_pyconstraint_update(struct Object *owner, struct bConstraint *con);
int BPY_is_pyconstraint(struct Text *text);
// void BPY_free_pyconstraint_links(struct Text *text);
-//
+
void BPY_python_start(int argc, const char **argv);
void BPY_python_end(void);
-// void init_syspath(int first_time);
-// void syspath_append(char *dir);
-// void BPY_rebuild_syspath(void);
-// int BPY_path_update(void);
-//
-// int BPY_Err_getLinenumber(void);
-// const char *BPY_Err_getFilename(void);
/* 2.5 UI Scripts */
int BPY_filepath_exec(struct bContext *C, const char *filepath, struct ReportList *reports);
diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c
index 7aa5ed61203..076b4811d07 100644
--- a/source/blender/python/generic/IDProp.c
+++ b/source/blender/python/generic/IDProp.c
@@ -65,9 +65,9 @@ PyObject *BPy_IDGroup_WrapData( ID *id, IDProperty *prop )
switch ( prop->type ) {
case IDP_STRING:
#ifdef USE_STRING_COERCE
- return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len);
+ return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1);
#else
- return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len);
+ return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len - 1);
#endif
case IDP_INT:
return PyLong_FromLong( (long)prop->data.val );
@@ -483,9 +483,9 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
switch (prop->type) {
case IDP_STRING:
#ifdef USE_STRING_COERCE
- return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len);
+ return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1);
#else
- return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len);
+ return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len - 1);
#endif
break;
case IDP_FLOAT:
@@ -625,11 +625,11 @@ static PyObject *BPy_IDGroup_IterItems(BPy_IDProperty *self)
}
/* utility function */
-static void BPy_IDGroup_CorrectListLen(IDProperty *prop, PyObject *seq, int len)
+static void BPy_IDGroup_CorrectListLen(IDProperty *prop, PyObject *seq, int len, const char *func)
{
int j;
- printf("ID Property Error found and corrected in BPy_IDGroup_GetKeys/Values/Items!\n");
+ printf("%s: ID Property Error found and corrected!\n", func);
/*fill rest of list with valid references to None*/
for (j=len; j<prop->len; j++) {
@@ -654,7 +654,7 @@ PyObject *BPy_Wrap_GetKeys(IDProperty *prop)
for (; loop; loop=loop->next, i++) {}
if (i != prop->len) { /* if the loop didnt finish, we know the length is wrong */
- BPy_IDGroup_CorrectListLen(prop, seq, i);
+ BPy_IDGroup_CorrectListLen(prop, seq, i, __func__);
Py_DECREF(seq); /*free the list*/
/*call self again*/
return BPy_Wrap_GetKeys(prop);
@@ -674,7 +674,7 @@ PyObject *BPy_Wrap_GetValues(ID *id, IDProperty *prop)
}
if (i != prop->len) {
- BPy_IDGroup_CorrectListLen(prop, seq, i);
+ BPy_IDGroup_CorrectListLen(prop, seq, i, __func__);
Py_DECREF(seq); /*free the list*/
/*call self again*/
return BPy_Wrap_GetValues(id, prop);
@@ -697,7 +697,7 @@ PyObject *BPy_Wrap_GetItems(ID *id, IDProperty *prop)
}
if (i != prop->len) {
- BPy_IDGroup_CorrectListLen(prop, seq, i);
+ BPy_IDGroup_CorrectListLen(prop, seq, i, __func__);
Py_DECREF(seq); /*free the list*/
/*call self again*/
return BPy_Wrap_GetItems(id, prop);
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index ac54cef7d4d..293ade35584 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -124,7 +124,7 @@ PyObject *bpy_text_import(Text *text)
return PyImport_ExecCodeModule(modulename, text->compiled);
}
-PyObject *bpy_text_import_name(char *name, int *found)
+PyObject *bpy_text_import_name(const char *name, int *found)
{
Text *text;
char txtname[MAX_ID_NAME-2];
diff --git a/source/blender/python/generic/bpy_internal_import.h b/source/blender/python/generic/bpy_internal_import.h
index 8bc10234a9b..2ce644715e9 100644
--- a/source/blender/python/generic/bpy_internal_import.h
+++ b/source/blender/python/generic/bpy_internal_import.h
@@ -49,7 +49,7 @@ struct Text;
void bpy_import_init(PyObject *builtins);
PyObject* bpy_text_import(struct Text *text);
-PyObject* bpy_text_import_name(char *name, int *found);
+PyObject* bpy_text_import_name(const char *name, int *found);
PyObject* bpy_text_reimport(PyObject *module, int *found);
/* void bpy_text_clear_modules(int clear_all);*/ /* Clear user modules */
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index d9d1c16e11f..dfb7a1e8f75 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -81,53 +81,52 @@ static PyObject *bpy_script_paths(PyObject *UNUSED(self))
return ret;
}
+static int bpy_blend_paths_visit_cb(void *userdata, char *UNUSED(path_dst), const char *path_src)
+{
+ PyObject *list= (PyObject *)userdata;
+ PyObject *item= PyUnicode_DecodeFSDefault(path_src);
+ PyList_Append(list, item);
+ Py_DECREF(item);
+ return FALSE; /* never edits the path */
+}
+
PyDoc_STRVAR(bpy_blend_paths_doc,
-".. function:: blend_paths(absolute=False)\n"
+".. function:: blend_paths(absolute=False, packed=False, local=False)\n"
"\n"
" Returns a list of paths to external files referenced by the loaded .blend file.\n"
"\n"
" :arg absolute: When true the paths returned are made absolute.\n"
" :type absolute: boolean\n"
+" :arg packed: When true skip file paths for packed data.\n"
+" :type packed: boolean\n"
+" :arg local: When true skip linked library paths.\n"
+" :type local: boolean\n"
" :return: path list.\n"
" :rtype: list of strings\n"
);
static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
- struct BPathIterator *bpi;
- PyObject *list, *st; /* stupidly big string to be safe */
- /* be sure there is low chance of the path being too short */
- char filepath_expanded[1024];
- const char *lib;
+ int flag= 0;
+ PyObject *list;
- int absolute= 0;
- static const char *kwlist[]= {"absolute", NULL};
+ int absolute= FALSE;
+ int packed= FALSE;
+ int local= FALSE;
+ static const char *kwlist[]= {"absolute", "packed", "local", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kw, "|i:blend_paths", (char **)kwlist, &absolute))
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "|ii:blend_paths",
+ (char **)kwlist, &absolute, &packed))
+ {
return NULL;
+ }
- list= PyList_New(0);
+ if (absolute) flag |= BPATH_TRAVERSE_ABS;
+ if (!packed) flag |= BPATH_TRAVERSE_SKIP_PACKED;
+ if (local) flag |= BPATH_TRAVERSE_SKIP_LIBRARY;
- for (BLI_bpathIterator_init(&bpi, G.main, G.main->name, 0); !BLI_bpathIterator_isDone(bpi); BLI_bpathIterator_step(bpi)) {
- /* build the list */
- if (absolute) {
- BLI_bpathIterator_getPathExpanded(bpi, filepath_expanded);
- }
- else {
- lib= BLI_bpathIterator_getLib(bpi);
- if (lib && (BLI_path_cmp(lib, BLI_bpathIterator_getBasePath(bpi)))) { /* relative path to the library is NOT the same as our blendfile path, return an absolute path */
- BLI_bpathIterator_getPathExpanded(bpi, filepath_expanded);
- }
- else {
- BLI_bpathIterator_getPath(bpi, filepath_expanded);
- }
- }
- st= PyUnicode_DecodeFSDefault(filepath_expanded);
-
- PyList_Append(list, st);
- Py_DECREF(st);
- }
+ list= PyList_New(0);
- BLI_bpathIterator_free(bpi);
+ bpath_traverse_main(G.main, bpy_blend_paths_visit_cb, flag, (void *)list);
return list;
}
@@ -147,10 +146,10 @@ static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObj
return NULL;
/* stupid string compare */
- if (!strcmp(type, "DATAFILES")) folder_id= BLENDER_USER_DATAFILES;
- else if (!strcmp(type, "CONFIG")) folder_id= BLENDER_USER_CONFIG;
- else if (!strcmp(type, "SCRIPTS")) folder_id= BLENDER_USER_SCRIPTS;
- else if (!strcmp(type, "AUTOSAVE")) folder_id= BLENDER_USER_AUTOSAVE;
+ if (!strcmp(type, "DATAFILES")) folder_id= BLENDER_USER_DATAFILES;
+ else if (!strcmp(type, "CONFIG")) folder_id= BLENDER_USER_CONFIG;
+ else if (!strcmp(type, "SCRIPTS")) folder_id= BLENDER_USER_SCRIPTS;
+ else if (!strcmp(type, "AUTOSAVE")) folder_id= BLENDER_USER_AUTOSAVE;
else {
PyErr_SetString(PyExc_ValueError, "invalid resource argument");
return NULL;
diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c
index 651a626244f..382a513f40a 100644
--- a/source/blender/python/intern/bpy_library.c
+++ b/source/blender/python/intern/bpy_library.c
@@ -310,13 +310,14 @@ static void bpy_lib_exit_warn_type(BPy_Library *self, PyObject *item)
static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
{
+ Main *bmain= CTX_data_main(BPy_GetContext());
Main *mainl= NULL;
int err= 0;
flag_all_listbases_ids(LIB_PRE_EXISTING, 1);
/* here appending/linking starts */
- mainl= BLO_library_append_begin(CTX_data_main(BPy_GetContext()), &(self->blo_handle), self->relpath);
+ mainl= BLO_library_append_begin(bmain, &(self->blo_handle), self->relpath);
{
int i= 0, code;
@@ -399,7 +400,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
/* append, rather than linking */
if ((self->flag & FILE_LINK)==0) {
Library *lib= BLI_findstring(&G.main->library, self->abspath, offsetof(Library, name));
- if (lib) all_local(lib, 1);
+ if (lib) BKE_library_make_local(bmain, lib, 1);
else BLI_assert(!"cant find name of just added library!");
}
}
diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c
index 238558b7ad7..1162491ee26 100644
--- a/source/blender/python/intern/gpu.c
+++ b/source/blender/python/intern/gpu.c
@@ -236,7 +236,7 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
PY_DICT_ADD_LONG(dict,uniform,texnumber);
}
if (uniform->texpixels) {
- val = PyByteArray_FromStringAndSize((const char *)uniform->texpixels, uniform->texsize);
+ val = PyByteArray_FromStringAndSize((const char *)uniform->texpixels, uniform->texsize * 4);
PyDict_SetItemString(dict, "texpixels", val);
Py_DECREF(val);
PY_DICT_ADD_LONG(dict,uniform,texsize);
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index 554d4ba132d..f892c25f67e 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -39,6 +39,7 @@
#define QUAT_SIZE 4
static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObject *self);
+static void quat__axis_angle_sanitize(float axis[3], float *angle);
static PyObject *Quaternion_copy(QuaternionObject *self);
//-----------------------------METHODS------------------------------
@@ -141,6 +142,39 @@ static PyObject *Quaternion_to_matrix(QuaternionObject *self)
return newMatrixObject(mat, 3, 3, Py_NEW, NULL);
}
+//----------------------------Quaternion.toMatrix()------------------
+PyDoc_STRVAR(Quaternion_to_axis_angle_doc,
+".. method:: to_axis_angle()\n"
+"\n"
+" Return the axis, angle representation of the quaternion.\n"
+"\n"
+" :return: axis, angle.\n"
+" :rtype: (:class:`Vector`, float) pair\n"
+);
+static PyObject *Quaternion_to_axis_angle(QuaternionObject *self)
+{
+ PyObject *ret;
+
+ float tquat[4];
+
+ float axis[3];
+ float angle;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return NULL;
+
+ normalize_qt_qt(tquat, self->quat);
+ quat_to_axis_angle(axis, &angle, tquat);
+
+ quat__axis_angle_sanitize(axis, &angle);
+
+ ret= PyTuple_New(2);
+ PyTuple_SET_ITEM(ret, 0, newVectorObject(axis, 3, Py_NEW, NULL));
+ PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(angle));
+ return ret;
+}
+
+
//----------------------------Quaternion.cross(other)------------------
PyDoc_STRVAR(Quaternion_cross_doc,
".. method:: cross(other)\n"
@@ -881,12 +915,18 @@ static PyObject *Quaternion_getMagnitude(QuaternionObject *self, void *UNUSED(cl
static PyObject *Quaternion_getAngle(QuaternionObject *self, void *UNUSED(closure))
{
float tquat[4];
+ float angle;
if (BaseMath_ReadCallback(self) == -1)
return NULL;
normalize_qt_qt(tquat, self->quat);
- return PyFloat_FromDouble(2.0f * (saacos(tquat[0])));
+
+ angle= 2.0f * saacos(tquat[0]);
+
+ quat__axis_angle_sanitize(NULL, &angle);
+
+ return PyFloat_FromDouble(angle);
}
static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UNUSED(closure))
@@ -895,7 +935,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN
float len;
float axis[3], angle_dummy;
- double angle;
+ float angle;
if (BaseMath_ReadCallback(self) == -1)
return -1;
@@ -913,13 +953,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN
angle= angle_wrap_rad(angle);
- /* If the axis of rotation is 0,0,0 set it to 1,0,0 - for zero-degree rotations */
- if ( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) &&
- EXPP_FloatsAreEqual(axis[1], 0.0f, 10) &&
- EXPP_FloatsAreEqual(axis[2], 0.0f, 10)
- ) {
- axis[0] = 1.0f;
- }
+ quat__axis_angle_sanitize(axis, &angle);
axis_angle_to_quat(self->quat, axis, angle);
mul_qt_fl(self->quat, len);
@@ -935,21 +969,15 @@ static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *UNUSED(clos
float tquat[4];
float axis[3];
- float angle;
+ float angle_dummy;
if (BaseMath_ReadCallback(self) == -1)
return NULL;
normalize_qt_qt(tquat, self->quat);
- quat_to_axis_angle(axis, &angle, tquat);
+ quat_to_axis_angle(axis, &angle_dummy, tquat);
- /* If the axis of rotation is 0,0,0 set it to 1,0,0 - for zero-degree rotations */
- if ( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) &&
- EXPP_FloatsAreEqual(axis[1], 0.0f, 10) &&
- EXPP_FloatsAreEqual(axis[2], 0.0f, 10)
- ) {
- axis[0] = 1.0f;
- }
+ quat__axis_angle_sanitize(axis, NULL);
return (PyObject *) newVectorObject(axis, 3, Py_NEW, NULL);
}
@@ -971,6 +999,8 @@ static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *
if (mathutils_array_parse(axis, 3, 3, value, "quat.axis = other") == -1)
return -1;
+ quat__axis_angle_sanitize(axis, &angle);
+
axis_angle_to_quat(self->quat, axis, angle);
mul_qt_fl(self->quat, len);
@@ -1029,6 +1059,33 @@ static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObjec
}
}
+/* axis vector suffers from precission errors, use this function to ensure */
+static void quat__axis_angle_sanitize(float axis[3], float *angle)
+{
+ if (axis) {
+ if ( !finite(axis[0]) ||
+ !finite(axis[1]) ||
+ !finite(axis[2]))
+ {
+ axis[0]= 1.0f;
+ axis[1]= 0.0f;
+ axis[2]= 0.0f;
+ }
+ else if ( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) &&
+ EXPP_FloatsAreEqual(axis[1], 0.0f, 10) &&
+ EXPP_FloatsAreEqual(axis[2], 0.0f, 10)
+ ) {
+ axis[0] = 1.0f;
+ }
+ }
+
+ if (angle) {
+ if (!finite(*angle)) {
+ *angle= 0.0f;
+ }
+ }
+}
+
//-----------------------METHOD DEFINITIONS ----------------------
static struct PyMethodDef Quaternion_methods[] = {
/* in place only */
@@ -1048,6 +1105,7 @@ static struct PyMethodDef Quaternion_methods[] = {
/* return converted representation */
{"to_euler", (PyCFunction) Quaternion_to_euler, METH_VARARGS, Quaternion_to_euler_doc},
{"to_matrix", (PyCFunction) Quaternion_to_matrix, METH_NOARGS, Quaternion_to_matrix_doc},
+ {"to_axis_angle", (PyCFunction) Quaternion_to_axis_angle, METH_NOARGS, Quaternion_to_axis_angle_doc},
/* operation between 2 or more types */
{"cross", (PyCFunction) Quaternion_cross, METH_O, Quaternion_cross_doc},
@@ -1157,7 +1215,7 @@ PyObject *newQuaternionObject(float *quat, int type, PyTypeObject *base_type)
unit_qt(self->quat);
}
else {
- QUATCOPY(self->quat, quat);
+ copy_qt_qt(self->quat, quat);
}
self->wrapped = Py_NEW;
}
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index 44bb2ed51aa..6e8624721b7 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -628,14 +628,14 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec
return NULL;
/* accept 2d verts */
- if (pt->size==3) { VECCOPY(pt_in, pt->vec);}
- else { pt_in[2]=0.0; VECCOPY2D(pt_in, pt->vec) }
+ if (pt->size==3) { copy_v3_v3(pt_in, pt->vec);}
+ else { pt_in[2]=0.0; copy_v2_v2(pt_in, pt->vec); }
- if (line_1->size==3) { VECCOPY(l1, line_1->vec);}
- else { l1[2]=0.0; VECCOPY2D(l1, line_1->vec) }
+ if (line_1->size==3) { copy_v3_v3(l1, line_1->vec);}
+ else { l1[2]=0.0; copy_v2_v2(l1, line_1->vec); }
- if (line_2->size==3) { VECCOPY(l2, line_2->vec);}
- else { l2[2]=0.0; VECCOPY2D(l2, line_2->vec) }
+ if (line_2->size==3) { copy_v3_v3(l2, line_2->vec);}
+ else { l2[2]=0.0; copy_v2_v2(l2, line_2->vec); }
/* do the calculation */
lambda= closest_to_line_v3(pt_out, pt_in, l1, l2);
diff --git a/source/blender/python/simple_enum_gen.py b/source/blender/python/simple_enum_gen.py
index bc7a2df9fb6..ec2eead522c 100644
--- a/source/blender/python/simple_enum_gen.py
+++ b/source/blender/python/simple_enum_gen.py
@@ -29,11 +29,11 @@ defs = """
SPACE_INFO,
SPACE_SEQ,
SPACE_TEXT,
- SPACE_IMASEL,
- SPACE_SOUND,
+ SPACE_IMASEL, #Deprecated
+ SPACE_SOUND, #Deprecated
SPACE_ACTION,
SPACE_NLA,
- SPACE_SCRIPT,
+ SPACE_SCRIPT, #Deprecated
SPACE_TIME,
SPACE_NODE,
SPACEICONMAX
diff --git a/source/blender/quicktime/SConscript b/source/blender/quicktime/SConscript
index a128ded965c..db1d4a4f1ab 100644
--- a/source/blender/quicktime/SConscript
+++ b/source/blender/quicktime/SConscript
@@ -35,6 +35,6 @@ defs=['WITH_QUICKTIME']
if env['WITH_GHOST_COCOA']:
defs.append('GHOST_COCOA')
- env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities, cc_compilerchange='/usr/bin/gcc-4.2', cxx_compilerchange='/usr/bin/g++-4.2') # always use Apple-gcc-4.2 for objC language, for gnu-compilers do not support it fully yet
+ env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities, cc_compilerchange='/usr/bin/gcc', cxx_compilerchange='/usr/bin/g++') # always use default-Apple-gcc for objC language, gnu-compilers do not support it fully yet
else:
env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities)
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 799e6182d77..03b0d637de1 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1959,8 +1959,9 @@ void wm_event_do_handlers(bContext *C)
win->eventstate->prevy= event->y;
//printf("win->eventstate->prev = %d %d\n", event->x, event->y);
}
- else
- ;//printf("not setting prev to %d %d\n", event->x, event->y);
+ else {
+ //printf("not setting prev to %d %d\n", event->x, event->y);
+ }
}
/* store last event for this window */
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 177a468c008..acd5df79982 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1218,7 +1218,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
extern char datatoc_splash_png[];
extern int datatoc_splash_png_size;
- ImBuf *ibuf= IMB_ibImageFromMemory((unsigned char*)datatoc_splash_png, datatoc_splash_png_size, IB_rect);
+ ImBuf *ibuf= IMB_ibImageFromMemory((unsigned char*)datatoc_splash_png, datatoc_splash_png_size, IB_rect, "<splash screen>");
#else
ImBuf *ibuf= NULL;
#endif
@@ -1745,7 +1745,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
/* append, rather than linking */
if((flag & FILE_LINK)==0) {
Library *lib= BLI_findstring(&bmain->library, libname, offsetof(Library, filepath));
- if(lib) all_local(lib, 1);
+ if(lib) BKE_library_make_local(bmain, lib, 1);
else BLI_assert(!"cant find name of just added library!");
}
@@ -1949,7 +1949,10 @@ static int blend_save_check(bContext *UNUSED(C), wmOperator *op)
{
char filepath[FILE_MAX];
RNA_string_get(op->ptr, "filepath", filepath);
- if(BLI_replace_extension(filepath, sizeof(filepath), ".blend")) {
+ if(!BLO_has_bfile_extension(filepath)) {
+ /* some users would prefer BLI_replace_extension(),
+ * we keep getting knit-picking bug reports about this - campbell */
+ BLI_ensure_extension(filepath, FILE_MAX, ".blend");
RNA_string_set(op->ptr, "filepath", filepath);
return TRUE;
}
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 250f431dc9a..fe967bbcd1c 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -648,7 +648,8 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
// window_handle(win, INPUTCHANGE, win->active);
/* bad ghost support for modifier keys... so on activate we set the modifiers again */
- kdata.ascii= 0;
+ kdata.ascii= '\0';
+ kdata.utf8_buf[0]= '\0';
if (win->eventstate->shift && !query_qual(SHIFT)) {
kdata.key= GHOST_kKeyLeftShift;
wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata);