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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-11-17 03:58:03 +0300
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-11-17 03:58:03 +0300
commit09ba291c554a87cf1d94eb8213c89ddf75ee0389 (patch)
tree4dd1e48d1f0bb1f1191bd647d0a6f97b2cb0385d /source/blender
parenta95181a7a07c057fe757a2ec20391439ea671345 (diff)
parent12afa64de98ccbfbf8ac2064dc537182b3d4cc81 (diff)
Merged changes in the trunk up to revision 33112.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenfont/BLF_api.h30
-rw-r--r--source/blender/blenfont/intern/blf.c40
-rw-r--r--source/blender/blenfont/intern/blf_dir.c4
-rw-r--r--source/blender/blenfont/intern/blf_font.c22
-rw-r--r--source/blender/blenfont/intern/blf_internal.h20
-rw-r--r--source/blender/blenkernel/BKE_animsys.h7
-rw-r--r--source/blender/blenkernel/BKE_curve.h2
-rw-r--r--source/blender/blenkernel/BKE_image.h2
-rw-r--r--source/blender/blenkernel/BKE_library.h2
-rw-r--r--source/blender/blenkernel/BKE_multires.h1
-rw-r--r--source/blender/blenkernel/BKE_object.h2
-rw-r--r--source/blender/blenkernel/BKE_packedFile.h2
-rw-r--r--source/blender/blenkernel/intern/anim.c6
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c35
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c2
-rw-r--r--source/blender/blenkernel/intern/constraint.c4
-rw-r--r--source/blender/blenkernel/intern/curve.c51
-rw-r--r--source/blender/blenkernel/intern/customdata.c36
-rw-r--r--source/blender/blenkernel/intern/deform.c35
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c2
-rw-r--r--source/blender/blenkernel/intern/displist.c25
-rw-r--r--source/blender/blenkernel/intern/image.c6
-rw-r--r--source/blender/blenkernel/intern/ipo.c50
-rw-r--r--source/blender/blenkernel/intern/library.c14
-rw-r--r--source/blender/blenkernel/intern/material.c1
-rw-r--r--source/blender/blenkernel/intern/mball.c16
-rw-r--r--source/blender/blenkernel/intern/mesh.c46
-rw-r--r--source/blender/blenkernel/intern/multires.c89
-rw-r--r--source/blender/blenkernel/intern/nla.c30
-rw-r--r--source/blender/blenkernel/intern/node.c2
-rw-r--r--source/blender/blenkernel/intern/object.c33
-rw-r--r--source/blender/blenkernel/intern/packedFile.c6
-rw-r--r--source/blender/blenkernel/intern/particle_system.c23
-rw-r--r--source/blender/blenkernel/intern/pointcache.c20
-rw-r--r--source/blender/blenkernel/intern/scene.c8
-rw-r--r--source/blender/blenkernel/intern/sequencer.c4
-rw-r--r--source/blender/blenkernel/intern/smoke.c14
-rw-r--r--source/blender/blenkernel/intern/sound.c7
-rw-r--r--source/blender/blenkernel/intern/texture.c4
-rw-r--r--source/blender/blenlib/BLI_bfile.h143
-rw-r--r--source/blender/blenlib/BLI_bpath.h24
-rw-r--r--source/blender/blenlib/BLI_fileops.h2
-rw-r--r--source/blender/blenlib/BLI_math_vector.h2
-rw-r--r--source/blender/blenlib/BLI_path_util.h11
-rw-r--r--source/blender/blenlib/BLI_storage.h14
-rw-r--r--source/blender/blenlib/BLI_winstuff.h20
-rw-r--r--source/blender/blenlib/SConscript5
-rw-r--r--source/blender/blenlib/intern/BLI_bfile.c372
-rw-r--r--source/blender/blenlib/intern/bpath.c31
-rw-r--r--source/blender/blenlib/intern/fileops.c2
-rw-r--r--source/blender/blenlib/intern/math_matrix.c4
-rw-r--r--source/blender/blenlib/intern/math_rotation.c19
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c17
-rw-r--r--source/blender/blenlib/intern/path_util.c115
-rw-r--r--source/blender/blenlib/intern/storage.c10
-rw-r--r--source/blender/blenloader/intern/readfile.c62
-rw-r--r--source/blender/collada/AnimationImporter.cpp2
-rw-r--r--source/blender/collada/DocumentImporter.cpp32
-rw-r--r--source/blender/collada/GeometryExporter.cpp5
-rw-r--r--source/blender/collada/GeometryExporter.h3
-rw-r--r--source/blender/collada/SkinInfo.cpp2
-rw-r--r--source/blender/collada/collada_internal.cpp2
-rw-r--r--source/blender/collada/collada_utils.cpp2
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c14
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c623
-rw-r--r--source/blender/editors/animation/anim_filter.c141
-rw-r--r--source/blender/editors/armature/editarmature.c56
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c2
-rw-r--r--source/blender/editors/datafiles/SConscript2
-rw-r--r--source/blender/editors/include/ED_anim_api.h2
-rw-r--r--source/blender/editors/include/ED_screen.h4
-rw-r--r--source/blender/editors/include/ED_view3d.h2
-rw-r--r--source/blender/editors/include/UI_interface.h1
-rw-r--r--source/blender/editors/interface/interface.c45
-rw-r--r--source/blender/editors/interface/interface_draw.c2
-rw-r--r--source/blender/editors/interface/interface_handlers.c16
-rw-r--r--source/blender/editors/interface/interface_style.c12
-rw-r--r--source/blender/editors/interface/interface_templates.c4
-rw-r--r--source/blender/editors/interface/view2d.c6
-rw-r--r--source/blender/editors/interface/view2d_ops.c3
-rw-r--r--source/blender/editors/mesh/editmesh.c5
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c79
-rw-r--r--source/blender/editors/mesh/loopcut.c15
-rw-r--r--source/blender/editors/mesh/mesh_intern.h1
-rw-r--r--source/blender/editors/mesh/mesh_ops.c4
-rw-r--r--source/blender/editors/mesh/meshtools.c37
-rw-r--r--source/blender/editors/object/object_add.c109
-rw-r--r--source/blender/editors/object/object_group.c8
-rw-r--r--source/blender/editors/object/object_relations.c42
-rw-r--r--source/blender/editors/object/object_select.c20
-rw-r--r--source/blender/editors/object/object_transform.c9
-rw-r--r--source/blender/editors/render/Makefile5
-rw-r--r--source/blender/editors/render/render_internal.c41
-rw-r--r--source/blender/editors/render/render_opengl.c50
-rw-r--r--source/blender/editors/screen/area.c4
-rw-r--r--source/blender/editors/screen/screen_edit.c59
-rw-r--r--source/blender/editors/screen/screen_ops.c39
-rw-r--r--source/blender/editors/screen/screendump.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c167
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c7
-rw-r--r--source/blender/editors/sound/sound_ops.c2
-rw-r--r--source/blender/editors/space_console/CMakeLists.txt1
-rw-r--r--source/blender/editors/space_console/console_draw.c417
-rw-r--r--source/blender/editors/space_console/console_intern.h21
-rw-r--r--source/blender/editors/space_console/console_ops.c41
-rw-r--r--source/blender/editors/space_console/space_console.c68
-rw-r--r--source/blender/editors/space_file/CMakeLists.txt1
-rw-r--r--source/blender/editors/space_file/file_draw.c159
-rw-r--r--source/blender/editors/space_file/file_intern.h3
-rw-r--r--source/blender/editors/space_file/file_ops.c74
-rw-r--r--source/blender/editors/space_file/file_panels.c8
-rw-r--r--source/blender/editors/space_file/filesel.c83
-rw-r--r--source/blender/editors/space_file/space_file.c1
-rw-r--r--source/blender/editors/space_file/writeimage.c234
-rw-r--r--source/blender/editors/space_image/image_ops.c111
-rw-r--r--source/blender/editors/space_image/space_image.c19
-rw-r--r--source/blender/editors/space_info/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_info/info_draw.c192
-rw-r--r--source/blender/editors/space_info/info_intern.h18
-rw-r--r--source/blender/editors/space_info/info_ops.c2
-rw-r--r--source/blender/editors/space_info/info_report.c (renamed from source/blender/editors/space_console/console_report.c)102
-rw-r--r--source/blender/editors/space_info/space_info.c100
-rw-r--r--source/blender/editors/space_info/textview.c301
-rw-r--r--source/blender/editors/space_info/textview.h52
-rw-r--r--source/blender/editors/space_logic/logic_window.c2
-rw-r--r--source/blender/editors/space_nla/nla_ops.c24
-rw-r--r--source/blender/editors/space_nla/space_nla.c6
-rw-r--r--source/blender/editors/space_node/drawnode.c27
-rw-r--r--source/blender/editors/space_outliner/outliner.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c10
-rw-r--r--source/blender/editors/space_text/text_draw.c5
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c82
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c56
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c96
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c30
-rw-r--r--source/blender/editors/transform/transform.c58
-rw-r--r--source/blender/editors/transform/transform.h2
-rw-r--r--source/blender/editors/transform/transform_constraints.c4
-rw-r--r--source/blender/editors/transform/transform_conversions.c16
-rw-r--r--source/blender/editors/transform/transform_generics.c32
-rw-r--r--source/blender/editors/transform/transform_manipulator.c2
-rw-r--r--source/blender/editors/transform/transform_ops.c2
-rw-r--r--source/blender/editors/transform/transform_orientations.c35
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c3
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c9
-rw-r--r--source/blender/imbuf/IMB_imbuf.h2
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp6
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_multi.h12
-rw-r--r--source/blender/makesdna/DNA_action_types.h6
-rw-r--r--source/blender/makesdna/DNA_anim_types.h3
-rw-r--r--source/blender/makesdna/DNA_image_types.h5
-rw-r--r--source/blender/makesdna/DNA_lattice_types.h2
-rw-r--r--source/blender/makesdna/DNA_scene_types.h3
-rw-r--r--source/blender/makesdna/DNA_screen_types.h8
-rw-r--r--source/blender/makesdna/DNA_space_types.h32
-rw-r--r--source/blender/makesdna/DNA_texture_types.h2
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h2
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h2
-rw-r--r--source/blender/makesrna/RNA_access.h1
-rw-r--r--source/blender/makesrna/RNA_define.h2
-rw-r--r--source/blender/makesrna/SConscript3
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt4
-rw-r--r--source/blender/makesrna/intern/SConscript3
-rw-r--r--source/blender/makesrna/intern/rna_access.c5
-rw-r--r--source/blender/makesrna/intern/rna_animation.c7
-rw-r--r--source/blender/makesrna/intern/rna_cloth.c16
-rw-r--r--source/blender/makesrna/intern/rna_curve.c10
-rw-r--r--source/blender/makesrna/intern/rna_define.c8
-rw-r--r--source/blender/makesrna/intern/rna_material.c4
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c2
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c4
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c48
-rw-r--r--source/blender/makesrna/intern/rna_nodetree_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_object.c28
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c26
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c6
-rw-r--r--source/blender/makesrna/intern/rna_pose.c21
-rw-r--r--source/blender/makesrna/intern/rna_scene.c21
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c23
-rw-r--r--source/blender/makesrna/intern/rna_sensor.c4
-rw-r--r--source/blender/makesrna/intern/rna_smoke.c4
-rw-r--r--source/blender/makesrna/intern/rna_space.c101
-rw-r--r--source/blender/makesrna/intern/rna_texture.c14
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c12
-rw-r--r--source/blender/makesrna/intern/rna_wm.c2
-rw-r--r--source/blender/makesrna/intern/rna_world.c19
-rw-r--r--source/blender/makesrna/rna_cleanup/rna_properties.txt1
-rw-r--r--source/blender/modifiers/Makefile1
-rw-r--r--source/blender/modifiers/intern/MOD_array.c36
-rw-r--r--source/blender/modifiers/intern/Makefile2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_defocus.c4
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c86
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_texture.c1
-rw-r--r--source/blender/python/generic/blf_api.c5
-rw-r--r--source/blender/python/generic/mathutils_matrix.c80
-rw-r--r--source/blender/python/generic/mathutils_quat.c16
-rw-r--r--source/blender/python/generic/mathutils_vector.c91
-rw-r--r--source/blender/python/intern/bpy.c2
-rw-r--r--source/blender/python/intern/bpy_operator.c14
-rw-r--r--source/blender/quicktime/apple/quicktime_export.c3
-rw-r--r--source/blender/quicktime/apple/quicktime_import.c5
-rw-r--r--source/blender/render/extern/include/RE_pipeline.h4
-rw-r--r--source/blender/render/intern/source/convertblender.c7
-rw-r--r--source/blender/render/intern/source/pipeline.c43
-rw-r--r--source/blender/render/intern/source/rendercore.c11
-rw-r--r--source/blender/render/intern/source/texture.c20
-rw-r--r--source/blender/render/intern/source/voxeldata.c16
-rw-r--r--source/blender/windowmanager/WM_api.h2
-rw-r--r--source/blender/windowmanager/WM_types.h35
-rw-r--r--source/blender/windowmanager/intern/wm.c2
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c1
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c4
-rw-r--r--source/blender/windowmanager/intern/wm_files.c12
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c2
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c11
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c43
-rw-r--r--source/blender/windowmanager/intern/wm_window.c20
221 files changed, 3659 insertions, 3180 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index c01886be65e..02834d3c905 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -34,11 +34,11 @@ struct rctf;
int BLF_init(int points, int dpi);
void BLF_exit(void);
-int BLF_load(char *name);
-int BLF_load_mem(char *name, unsigned char *mem, int mem_size);
+int BLF_load(const char *name);
+int BLF_load_mem(const char *name, unsigned char *mem, int mem_size);
-int BLF_load_unique(char *name);
-int BLF_load_mem_unique(char *name, unsigned char *mem, int mem_size);
+int BLF_load_unique(const char *name);
+int BLF_load_mem_unique(const char *name, unsigned char *mem, int mem_size);
/* Attach a file with metrics information from memory. */
void BLF_metrics_attach(int fontid, unsigned char *mem, int mem_size);
@@ -48,32 +48,32 @@ void BLF_position(int fontid, float x, float y, float z);
void BLF_size(int fontid, int size, int dpi);
/* Draw the string using the default font, size and dpi. */
-void BLF_draw_default(float x, float y, float z, const char *str);
-void BLF_draw_default_ascii(float x, float y, float z, const char *str);
+void BLF_draw_default(float x, float y, float z, const char *str, size_t len);
+void BLF_draw_default_ascii(float x, float y, float z, const char *str, size_t len);
/* Draw the string using the current font. */
-void BLF_draw(int fontid, const char *str);
-void BLF_draw_ascii(int fontid, const char *str);
+void BLF_draw(int fontid, const char *str, size_t len);
+void BLF_draw_ascii(int fontid, const char *str, size_t len);
/*
* This function return the bounding box of the string
* and are not multiplied by the aspect.
*/
-void BLF_boundbox(int fontid, char *str, struct rctf *box);
+void BLF_boundbox(int fontid, const char *str, struct rctf *box);
/*
* The next both function return the width and height
* of the string, using the current font and both value
* are multiplied by the aspect of the font.
*/
-float BLF_width(int fontid, char *str);
-float BLF_height(int fontid, char *str);
+float BLF_width(int fontid, const char *str);
+float BLF_height(int fontid, const char *str);
/*
* The following function return the width and height of the string, but
* just in one call, so avoid extra freetype2 stuff.
*/
-void BLF_width_and_height(int fontid, char *str, float *width, float *height);
+void BLF_width_and_height(int fontid, const char *str, float *width, float *height);
/*
* For fixed width fonts only, returns the width of a
@@ -86,8 +86,8 @@ float BLF_fixed_width(int fontid);
* of the string, using the default font and both value
* are multiplied by the aspect of the font.
*/
-float BLF_width_default(char *str);
-float BLF_height_default(char *str);
+float BLF_width_default(const char *str);
+float BLF_height_default(const char *str);
/*
* Set rotation for default font.
@@ -147,7 +147,7 @@ void BLF_buffer_col(int fontid, float r, float g, float b, float a);
* Draw the string into the buffer, this function draw in both buffer, float and unsigned char _BUT_
* it's not necessary set both buffer, NULL is valid here.
*/
-void BLF_draw_buffer(int fontid, char *str);
+void BLF_draw_buffer(int fontid, const char *str);
/*
* Search the path directory to the locale files, this try all
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 59189abf1e3..360c79ed06a 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -99,7 +99,7 @@ void BLF_exit(void)
blf_font_exit();
}
-static int blf_search(char *name)
+static int blf_search(const char *name)
{
FontBLF *font;
int i;
@@ -112,7 +112,7 @@ static int blf_search(char *name)
return(-1);
}
-int BLF_load(char *name)
+int BLF_load(const char *name)
{
FontBLF *font;
char *filename;
@@ -153,7 +153,7 @@ int BLF_load(char *name)
return(i);
}
-int BLF_load_unique(char *name)
+int BLF_load_unique(const char *name)
{
FontBLF *font;
char *filename;
@@ -199,7 +199,7 @@ void BLF_metrics_attach(int fontid, unsigned char *mem, int mem_size)
blf_font_attach_from_mem(font, mem, mem_size);
}
-int BLF_load_mem(char *name, unsigned char *mem, int mem_size)
+int BLF_load_mem(const char *name, unsigned char *mem, int mem_size)
{
FontBLF *font;
int i;
@@ -235,7 +235,7 @@ int BLF_load_mem(char *name, unsigned char *mem, int mem_size)
return(i);
}
-int BLF_load_mem_unique(char *name, unsigned char *mem, int mem_size)
+int BLF_load_mem_unique(const char *name, unsigned char *mem, int mem_size)
{
FontBLF *font;
int i;
@@ -361,7 +361,7 @@ void BLF_blur(int fontid, int size)
font->blur= size;
}
-void BLF_draw_default(float x, float y, float z, const char *str)
+void BLF_draw_default(float x, float y, float z, const char *str, size_t len)
{
if (!str)
return;
@@ -376,10 +376,10 @@ void BLF_draw_default(float x, float y, float z, const char *str)
BLF_size(global_font_default, global_font_points, global_font_dpi);
BLF_position(global_font_default, x, y, z);
- BLF_draw(global_font_default, str);
+ BLF_draw(global_font_default, str, len);
}
/* same as above but call 'BLF_draw_ascii' */
-void BLF_draw_default_ascii(float x, float y, float z, const char *str)
+void BLF_draw_default_ascii(float x, float y, float z, const char *str, size_t len)
{
if (!str)
return;
@@ -394,7 +394,7 @@ void BLF_draw_default_ascii(float x, float y, float z, const char *str)
BLF_size(global_font_default, global_font_points, global_font_dpi);
BLF_position(global_font_default, x, y, z);
- BLF_draw_ascii(global_font_default, str);
+ BLF_draw_ascii(global_font_default, str, len); /* XXX, use real length */
}
void BLF_rotation_default(float angle)
@@ -432,27 +432,27 @@ static void blf_draw__end(void)
glDisable(GL_TEXTURE_2D);
}
-void BLF_draw(int fontid, const char *str)
+void BLF_draw(int fontid, const char *str, size_t len)
{
FontBLF *font= BLF_get(fontid);
if (font) {
blf_draw__start(font);
- blf_font_draw(font, str);
+ blf_font_draw(font, str, len);
blf_draw__end();
}
}
-void BLF_draw_ascii(int fontid, const char *str)
+void BLF_draw_ascii(int fontid, const char *str, size_t len)
{
FontBLF *font= BLF_get(fontid);
if (font) {
blf_draw__start(font);
- blf_font_draw_ascii(font, str);
+ blf_font_draw_ascii(font, str, len);
blf_draw__end();
}
}
-void BLF_boundbox(int fontid, char *str, rctf *box)
+void BLF_boundbox(int fontid, const char *str, rctf *box)
{
FontBLF *font;
@@ -461,7 +461,7 @@ void BLF_boundbox(int fontid, char *str, rctf *box)
blf_font_boundbox(font, str, box);
}
-void BLF_width_and_height(int fontid, char *str, float *width, float *height)
+void BLF_width_and_height(int fontid, const char *str, float *width, float *height)
{
FontBLF *font;
@@ -470,7 +470,7 @@ void BLF_width_and_height(int fontid, char *str, float *width, float *height)
blf_font_width_and_height(font, str, width, height);
}
-float BLF_width(int fontid, char *str)
+float BLF_width(int fontid, const char *str)
{
FontBLF *font;
@@ -490,7 +490,7 @@ float BLF_fixed_width(int fontid)
return(0.0f);
}
-float BLF_width_default(char *str)
+float BLF_width_default(const char *str)
{
float width;
@@ -507,7 +507,7 @@ float BLF_width_default(char *str)
return(width);
}
-float BLF_height(int fontid, char *str)
+float BLF_height(int fontid, const char *str)
{
FontBLF *font;
@@ -517,7 +517,7 @@ float BLF_height(int fontid, char *str)
return(0.0f);
}
-float BLF_height_default(char *str)
+float BLF_height_default(const char *str)
{
float height;
@@ -621,7 +621,7 @@ void BLF_buffer_col(int fontid, float r, float g, float b, float a)
}
}
-void BLF_draw_buffer(int fontid, char *str)
+void BLF_draw_buffer(int fontid, const char *str)
{
FontBLF *font;
diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c
index e650586aa9c..1eb7597fa54 100644
--- a/source/blender/blenfont/intern/blf_dir.c
+++ b/source/blender/blenfont/intern/blf_dir.c
@@ -121,7 +121,7 @@ void BLF_dir_free(char **dirs, int count)
MEM_freeN(dirs);
}
-char *blf_dir_search(char *file)
+char *blf_dir_search(const char *file)
{
DirBLF *dir;
char full_path[FILE_MAXDIR+FILE_MAXFILE];
@@ -175,7 +175,7 @@ int blf_dir_split(const char *str, char *file, int *size)
/* Some font have additional file with metrics information,
* in general, the extension of the file is: .afm or .pfm
*/
-char *blf_dir_metrics_search(char *filename)
+char *blf_dir_metrics_search(const char *filename)
{
char *mfile;
char *s;
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 9fb40f0206d..1ae654cc5bc 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -92,7 +92,7 @@ void blf_font_size(FontBLF *font, int size, int dpi)
}
}
-void blf_font_draw(FontBLF *font, const char *str)
+void blf_font_draw(FontBLF *font, const char *str, unsigned int len)
{
unsigned int c;
GlyphBLF *g, *g_prev;
@@ -110,7 +110,7 @@ void blf_font_draw(FontBLF *font, const char *str)
has_kerning= FT_HAS_KERNING(font->face);
g_prev= NULL;
- while (str[i]) {
+ while (str[i] && i < len) {
c= blf_utf8_next((unsigned char *)str, &i);
if (c == 0)
break;
@@ -147,7 +147,7 @@ void blf_font_draw(FontBLF *font, const char *str)
}
/* faster version of blf_font_draw, ascii only for view dimensions */
-void blf_font_draw_ascii(FontBLF *font, const char *str)
+void blf_font_draw_ascii(FontBLF *font, const char *str, unsigned int len)
{
char c;
GlyphBLF *g, *g_prev;
@@ -177,7 +177,7 @@ void blf_font_draw_ascii(FontBLF *font, const char *str)
}
}
- while ((c= *(str++))) {
+ while ((c= *(str++)) && len--) {
g= font->glyph_ascii_table[c];
/* if we don't found a glyph, skip it. */
@@ -205,7 +205,7 @@ void blf_font_draw_ascii(FontBLF *font, const char *str)
}
}
-void blf_font_buffer(FontBLF *font, char *str)
+void blf_font_buffer(FontBLF *font, const char *str)
{
unsigned char *cbuf;
unsigned int c;
@@ -339,7 +339,7 @@ void blf_font_buffer(FontBLF *font, char *str)
}
}
-void blf_font_boundbox(FontBLF *font, char *str, rctf *box)
+void blf_font_boundbox(FontBLF *font, const char *str, rctf *box)
{
unsigned int c;
GlyphBLF *g, *g_prev;
@@ -418,7 +418,7 @@ void blf_font_boundbox(FontBLF *font, char *str, rctf *box)
}
}
-void blf_font_width_and_height(FontBLF *font, char *str, float *width, float *height)
+void blf_font_width_and_height(FontBLF *font, const char *str, float *width, float *height)
{
rctf box;
@@ -429,7 +429,7 @@ void blf_font_width_and_height(FontBLF *font, char *str, float *width, float *he
}
}
-float blf_font_width(FontBLF *font, char *str)
+float blf_font_width(FontBLF *font, const char *str)
{
rctf box;
@@ -440,7 +440,7 @@ float blf_font_width(FontBLF *font, char *str)
return((box.xmax - box.xmin) * font->aspect);
}
-float blf_font_height(FontBLF *font, char *str)
+float blf_font_height(FontBLF *font, const char *str)
{
rctf box;
@@ -523,7 +523,7 @@ static void blf_font_fill(FontBLF *font)
memset(font->glyph_ascii_table, 0, sizeof(font->glyph_ascii_table));
}
-FontBLF *blf_font_new(char *name, char *filename)
+FontBLF *blf_font_new(const char *name, const char *filename)
{
FontBLF *font;
FT_Error err;
@@ -566,7 +566,7 @@ void blf_font_attach_from_mem(FontBLF *font, const unsigned char *mem, int mem_s
FT_Attach_Stream(font->face, &open);
}
-FontBLF *blf_font_new_from_mem(char *name, unsigned char *mem, int mem_size)
+FontBLF *blf_font_new_from_mem(const char *name, unsigned char *mem, int mem_size)
{
FontBLF *font;
FT_Error err;
diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h
index c7a3cd54740..bded1feb9bb 100644
--- a/source/blender/blenfont/intern/blf_internal.h
+++ b/source/blender/blenfont/intern/blf_internal.h
@@ -33,24 +33,24 @@ unsigned int blf_hash(unsigned int val);
int blf_utf8_next(unsigned char *buf, int *iindex);
char *blf_dir_search(const char *file);
-char *blf_dir_metrics_search(char *filename);
+char *blf_dir_metrics_search(const char *filename);
int blf_dir_split(const char *str, char *file, int *size);
int blf_font_init(void);
void blf_font_exit(void);
-FontBLF *blf_font_new(char *name, char *filename);
-FontBLF *blf_font_new_from_mem(char *name, unsigned char *mem, int mem_size);
+FontBLF *blf_font_new(const char *name, const char *filename);
+FontBLF *blf_font_new_from_mem(const char *name, unsigned char *mem, int mem_size);
void blf_font_attach_from_mem(FontBLF *font, const unsigned char *mem, int mem_size);
void blf_font_size(FontBLF *font, int size, int dpi);
-void blf_font_draw(FontBLF *font, const char *str);
-void blf_font_draw_ascii(FontBLF *font, const char *str);
-void blf_font_buffer(FontBLF *font, char *str);
-void blf_font_boundbox(FontBLF *font, char *str, rctf *box);
-void blf_font_width_and_height(FontBLF *font, char *str, float *width, float *height);
-float blf_font_width(FontBLF *font, char *str);
-float blf_font_height(FontBLF *font, char *str);
+void blf_font_draw(FontBLF *font, const char *str, unsigned int len);
+void blf_font_draw_ascii(FontBLF *font, const char *str, unsigned int len);
+void blf_font_buffer(FontBLF *font, const char *str);
+void blf_font_boundbox(FontBLF *font, const char *str, rctf *box);
+void blf_font_width_and_height(FontBLF *font, const char *str, float *width, float *height);
+float blf_font_width(FontBLF *font, const char *str);
+float blf_font_height(FontBLF *font, const char *str);
float blf_font_fixed_width(FontBLF *font);
void blf_font_free(FontBLF *font);
diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h
index af5e31b1efa..07ab0e7ec2c 100644
--- a/source/blender/blenkernel/BKE_animsys.h
+++ b/source/blender/blenkernel/BKE_animsys.h
@@ -56,10 +56,13 @@ struct AnimData *BKE_id_add_animdata(struct ID *id);
void BKE_free_animdata(struct ID *id);
/* Copy AnimData */
-struct AnimData *BKE_copy_animdata(struct AnimData *adt);
+struct AnimData *BKE_copy_animdata(struct AnimData *adt, const short do_action);
/* Copy AnimData */
-int BKE_copy_animdata_id(struct ID *id_to, struct ID *id_from);
+int BKE_copy_animdata_id(struct ID *id_to, struct ID *id_from, const short do_action);
+
+/* Copy AnimData Actions */
+void BKE_copy_animdata_id_action(struct ID *id);
/* Make Local */
void BKE_animdata_make_local(struct AnimData *adt);
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index 39de5517170..f60f8f8e28f 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -72,7 +72,7 @@ void minmaxNurb( struct Nurb *nu, float *min, float *max);
void nurbs_knot_calc_u(struct Nurb *nu);
void nurbs_knot_calc_v(struct Nurb *nu);
-void makeNurbfaces(struct Nurb *nu, float *coord_array, int rowstride);
+void makeNurbfaces(struct Nurb *nu, float *coord_array, int rowstride, int resolu, int resolv);
void makeNurbcurve(struct Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride);
void forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride);
float *make_orco_curve(struct Scene *scene, struct Object *ob);
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index b0cb3f32d37..ab636899925 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -47,7 +47,7 @@ void free_image(struct Image *me);
void BKE_stamp_info(struct Scene *scene, struct ImBuf *ibuf);
void BKE_stamp_buf(struct Scene *scene, unsigned char *rect, float *rectf, int width, int height, int channels);
int BKE_write_ibuf(struct Scene *scene, struct ImBuf *ibuf, char *name, int imtype, int subimtype, int quality);
-void BKE_makepicstring(char *string, char *base, int frame, int imtype, int use_ext);
+void BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames);
int BKE_add_image_extension(char *string, int imtype);
int BKE_ftype_to_imtype(int ftype);
int BKE_imtype_to_ftype(int imtype);
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index d98fb082aa9..4f0238854ef 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -46,7 +46,7 @@ struct bContext;
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);
+void copy_libblock_data(struct ID *id, const struct ID *id_from, const short do_action);
void id_lib_extern(struct ID *id);
void id_us_plus(struct ID *id);
diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h
index a05dce81fbc..6520ef0df63 100644
--- a/source/blender/blenkernel/BKE_multires.h
+++ b/source/blender/blenkernel/BKE_multires.h
@@ -55,7 +55,6 @@ struct MultiresModifierData *find_multires_modifier_before(struct Scene *scene,
struct ModifierData *lastmd);
struct DerivedMesh *get_multires_dm(struct Scene *scene, struct MultiresModifierData *mmd,
struct Object *ob);
-void multiresModifier_join(struct Object *);
void multiresModifier_del_levels(struct MultiresModifierData *, struct Object *, int direction);
void multiresModifier_subdivide(struct MultiresModifierData *mmd, struct Object *ob,
int updateblock, int simple);
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index b64011a7c9a..8999d7285c2 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -101,7 +101,7 @@ void object_rot_to_mat3(struct Object *ob, float mat[][3]);
void object_mat3_to_rot(struct Object *ob, float mat[][3], short use_compat);
void object_to_mat3(struct Object *ob, float mat[][3]);
void object_to_mat4(struct Object *ob, float mat[][4]);
-void object_apply_mat4(struct Object *ob, float mat[][4], short use_compat);
+void object_apply_mat4(struct Object *ob, float mat[][4], const short use_compat, const short use_parent);
void set_no_parent_ipo(int val);
diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h
index 58cf144483f..ca03708edef 100644
--- a/source/blender/blenkernel/BKE_packedFile.h
+++ b/source/blender/blenkernel/BKE_packedFile.h
@@ -50,7 +50,7 @@ void packAll(struct Main *bmain, struct ReportList *reports);
/* unpack */
char *unpackFile(struct ReportList *reports, char *abs_name, char *local_name, struct PackedFile *pf, int how);
int unpackVFont(struct ReportList *reports, struct VFont *vfont, int how);
-int unpackSound(struct ReportList *reports, struct bSound *sound, int how);
+int unpackSound(struct Main *bmain, struct ReportList *reports, struct bSound *sound, int how);
int unpackImage(struct ReportList *reports, struct Image *ima, int how);
void unpackAll(struct Main *bmain, struct ReportList *reports, int how);
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 547d3f7a738..6bbcecce2f7 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -436,6 +436,7 @@ void animviz_calc_motionpaths(Scene *scene, ListBase *targets)
/* free curve path data
* NOTE: frees the path itself!
+ * NOTE: this is increasingly innacurate with non-uniform BevPoint subdivisions [#24633]
*/
void free_path(Path *path)
{
@@ -444,7 +445,7 @@ void free_path(Path *path)
}
/* calculate a curve-deform path for a curve
- * - only called from displist.c -> makeDispListCurveTypes
+ * - only called from displist.c -> do_makeDispListCurveTypes
*/
void calc_curvepath(Object *ob)
{
@@ -507,7 +508,7 @@ void calc_curvepath(Object *ob)
/* the path verts in path->data */
/* now also with TILT value */
- pp= path->data = (PathPoint *)MEM_callocN(sizeof(PathPoint)*4*path->len, "pathdata"); // XXX - why *4? - in 2.4x each element was 4 and the size was 16, so better leave for now - Campbell
+ pp= path->data = (PathPoint *)MEM_callocN(sizeof(PathPoint)*path->len, "pathdata");
bevp= bevpfirst;
bevpn= bevp+1;
@@ -637,7 +638,6 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir, float *quat,
vec[1]= data[0]*p0->vec[1] + data[1]*p1->vec[1] + data[2]*p2->vec[1] + data[3]*p3->vec[1] ; /* Y */
vec[2]= data[0]*p0->vec[2] + data[1]*p1->vec[2] + data[2]*p2->vec[2] + data[3]*p3->vec[2] ; /* Z */
vec[3]= data[0]*p0->vec[3] + data[1]*p1->vec[3] + data[2]*p2->vec[3] + data[3]*p3->vec[3] ; /* Tilt, should not be needed since we have quat still used */
- /* Need to verify the quat interpolation is correct - XXX */
if (quat) {
float totfac, q1[4], q2[4];
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index a4df6aa8ab2..edda8a2547d 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -36,8 +36,10 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BKE_library.h"
#include "BLI_dynstr.h"
+
#include "DNA_anim_types.h"
#include "DNA_scene_types.h"
@@ -176,7 +178,7 @@ void BKE_free_animdata (ID *id)
/* Freeing -------------------------------------------- */
/* Make a copy of the given AnimData - to be used when copying datablocks */
-AnimData *BKE_copy_animdata (AnimData *adt)
+AnimData *BKE_copy_animdata (AnimData *adt, const short do_action)
{
AnimData *dadt;
@@ -186,9 +188,15 @@ AnimData *BKE_copy_animdata (AnimData *adt)
dadt= MEM_dupallocN(adt);
/* make a copy of action - at worst, user has to delete copies... */
- dadt->action= copy_action(adt->action);
- dadt->tmpact= copy_action(adt->tmpact);
-
+ if(do_action) {
+ dadt->action= copy_action(adt->action);
+ dadt->tmpact= copy_action(adt->tmpact);
+ }
+ else {
+ id_us_plus((ID *)dadt->action);
+ id_us_plus((ID *)dadt->tmpact);
+ }
+
/* duplicate NLA data */
copy_nladata(&dadt->nla_tracks, &adt->nla_tracks);
@@ -202,7 +210,7 @@ AnimData *BKE_copy_animdata (AnimData *adt)
return dadt;
}
-int BKE_copy_animdata_id(struct ID *id_to, struct ID *id_from)
+int BKE_copy_animdata_id(struct ID *id_to, struct ID *id_from, const short do_action)
{
AnimData *adt;
@@ -214,13 +222,26 @@ int BKE_copy_animdata_id(struct ID *id_to, struct ID *id_from)
adt = BKE_animdata_from_id(id_from);
if (adt) {
IdAdtTemplate *iat = (IdAdtTemplate *)id_to;
- iat->adt= BKE_copy_animdata(adt);
+ iat->adt= BKE_copy_animdata(adt, do_action);
}
return 1;
}
-
+void BKE_copy_animdata_id_action(struct ID *id)
+{
+ AnimData *adt= BKE_animdata_from_id(id);
+ if(adt) {
+ if(adt->action) {
+ ((ID *)adt->action)->us--;
+ adt->action= copy_action(adt->action);
+ }
+ if(adt->tmpact) {
+ ((ID *)adt->tmpact)->us--;
+ adt->tmpact= copy_action(adt->tmpact);
+ }
+ }
+}
/* Make Local -------------------------------------------- */
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 20987e15c4d..b820ad00305 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -289,7 +289,7 @@ static void cdDM_drawUVEdges(DerivedMesh *dm)
GPU_uvedge_setup(dm);
if( !GPU_buffer_legacy(dm) ) {
for(i = 0; i < dm->numFaceData; i++, mf++) {
- if(mf->flag&ME_LOOSEEDGE) {
+ if(!(mf->flag&ME_HIDE)) {
draw = 1;
}
else {
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index a561df49e94..5dff21d8af4 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -3462,7 +3462,9 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
BLI_bvhtree_find_nearest(treeData.tree, co, &nearest, treeData.nearest_callback, &treeData);
dist = len_v3v3(co, nearest.co);
- interp_v3_v3v3(co, co, nearest.co, (dist - scon->dist)/dist); /* linear interpolation */
+ if(dist != 0.0f) {
+ interp_v3_v3v3(co, co, nearest.co, (dist - scon->dist)/dist); /* linear interpolation */
+ }
space_transform_invert(&transform, co);
break;
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index b6b6dde3cdc..79e0393cdca 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -741,16 +741,16 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas
}
-void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride)
+void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int resolv)
/* coord_array has to be 3*4*resolu*resolv in size, and zero-ed */
{
BPoint *bp;
float *basisu, *basis, *basisv, *sum, *fp, *in;
float u, v, ustart, uend, ustep, vstart, vend, vstep, sumdiv;
- int i, j, iofs, jofs, cycl, len, resolu, resolv;
+ int i, j, iofs, jofs, cycl, len, curu, curv;
int istart, iend, jsta, jen, *jstart, *jend, ratcomp;
- int totu = nu->pntsu*nu->resolu, totv = nu->pntsv*nu->resolv;
+ int totu = nu->pntsu*resolu, totv = nu->pntsv*resolv;
if(nu->knotsu==NULL || nu->knotsv==NULL) return;
if(nu->orderu>nu->pntsu) return;
@@ -807,9 +807,9 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride)
else cycl= 0;
v= vstart;
basis= basisv;
- resolv= totv;
- while(resolv--) {
- basisNurb(v, nu->orderv, (short)(nu->pntsv+cycl), nu->knotsv, basis, jstart+resolv, jend+resolv);
+ curv= totv;
+ while(curv--) {
+ basisNurb(v, nu->orderv, (short)(nu->pntsv+cycl), nu->knotsv, basis, jstart+curv, jend+curv);
basis+= KNOTSV(nu);
v+= vstep;
}
@@ -818,17 +818,17 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride)
else cycl= 0;
in= coord_array;
u= ustart;
- resolu= totu;
- while(resolu--) {
+ curu= totu;
+ while(curu--) {
basisNurb(u, nu->orderu, (short)(nu->pntsu+cycl), nu->knotsu, basisu, &istart, &iend);
basis= basisv;
- resolv= totv;
- while(resolv--) {
+ curv= totv;
+ while(curv--) {
- jsta= jstart[resolv];
- jen= jend[resolv];
+ jsta= jstart[curv];
+ jen= jend[curv];
/* calculate sum */
sumdiv= 0.0;
@@ -1056,10 +1056,13 @@ static void forward_diff_bezier_cotangent(float *p0, float *p1, float *p2, float
float *make_orco_surf(Object *ob)
{
+ /* Note: this function is used in convertblender only atm, so
+ * suppose nonzero curve's render resolution should always be used */
Curve *cu= ob->data;
Nurb *nu;
int a, b, tot=0;
int sizeu, sizev;
+ int resolu, resolv;
float *fp, *coord_array;
/* first calculate the size of the datablock */
@@ -1073,9 +1076,12 @@ float *make_orco_surf(Object *ob)
See also convertblender.c: init_render_surf()
*/
+
+ resolu= cu->resolu_ren ? cu->resolu_ren : nu->resolu;
+ resolv= cu->resolv_ren ? cu->resolv_ren : nu->resolv;
- sizeu = nu->pntsu*nu->resolu;
- sizev = nu->pntsv*nu->resolv;
+ sizeu = nu->pntsu*resolu;
+ sizev = nu->pntsv*resolv;
if (nu->flagu & CU_NURB_CYCLIC) sizeu++;
if (nu->flagv & CU_NURB_CYCLIC) sizev++;
if(nu->pntsv>1) tot+= sizeu * sizev;
@@ -1087,9 +1093,12 @@ float *make_orco_surf(Object *ob)
nu= cu->nurb.first;
while(nu) {
+ resolu= cu->resolu_ren ? cu->resolu_ren : nu->resolu;
+ resolv= cu->resolv_ren ? cu->resolv_ren : nu->resolv;
+
if(nu->pntsv>1) {
- sizeu = nu->pntsu*nu->resolu;
- sizev = nu->pntsv*nu->resolv;
+ sizeu = nu->pntsu*resolu;
+ sizev = nu->pntsv*resolv;
if (nu->flagu & CU_NURB_CYCLIC) sizeu++;
if (nu->flagv & CU_NURB_CYCLIC) sizev++;
@@ -1110,10 +1119,10 @@ float *make_orco_surf(Object *ob)
}
}
else {
- float *_tdata= MEM_callocN((nu->pntsu*nu->resolu) * (nu->pntsv*nu->resolv) *3*sizeof(float), "temp data");
+ float *_tdata= MEM_callocN((nu->pntsu*resolu) * (nu->pntsv*resolv) *3*sizeof(float), "temp data");
float *tdata= _tdata;
- makeNurbfaces(nu, tdata, 0);
+ makeNurbfaces(nu, tdata, 0, resolu, resolv);
for(b=0; b<sizeu; b++) {
int use_b= b;
@@ -1125,7 +1134,7 @@ float *make_orco_surf(Object *ob)
if (a==sizev-1 && (nu->flagv & CU_NURB_CYCLIC))
use_a= 0;
- tdata = _tdata + 3 * (use_b * (nu->pntsv*nu->resolv) + use_a);
+ tdata = _tdata + 3 * (use_b * (nu->pntsv*resolv) + use_a);
fp[0]= (tdata[0]-cu->loc[0])/cu->size[0];
fp[1]= (tdata[1]-cu->loc[1])/cu->size[1];
@@ -1203,8 +1212,8 @@ float *make_orco_curve(Scene *scene, Object *ob)
for (u=0; u<sizev; u++) {
for (v=0; v<sizeu; v++,fp+=3) {
if (cu->flag & CU_UV_ORCO) {
- fp[0]= 2.0f*u/(dl->parts-1) - 1.0f;
- fp[1]= 2.0f*v/(dl->nr-1) - 1.0f;
+ fp[0]= 2.0f*u/(sizev - 1) - 1.0f;
+ fp[1]= 2.0f*v/(sizeu - 1) - 1.0f;
fp[2]= 0.0;
} else {
float *vert;
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index cd476d8491b..beb6c085d64 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -34,6 +34,7 @@
#include <math.h>
#include <string.h>
+#include <assert.h>
#include "MEM_guardedalloc.h"
@@ -41,6 +42,7 @@
#include "DNA_ID.h"
#include "BLI_blenlib.h"
+#include "BLI_path_util.h"
#include "BLI_linklist.h"
#include "BLI_math.h"
#include "BLI_mempool.h"
@@ -2261,32 +2263,26 @@ static int cd_layer_find_dupe(CustomData *data, const char *name, int type, int
return 0;
}
-void CustomData_set_layer_unique_name(CustomData *data, int index)
+static int customdata_unique_check(void *arg, const char *name)
{
+ struct {CustomData *data; int type; int index;} *data_arg= arg;
+ return cd_layer_find_dupe(data_arg->data, name, data_arg->type, data_arg->index);
+}
+
+void CustomData_set_layer_unique_name(CustomData *data, int index)
+{
CustomDataLayer *nlayer= &data->layers[index];
const LayerTypeInfo *typeInfo= layerType_getInfo(nlayer->type);
+ struct {CustomData *data; int type; int index;} data_arg;
+ data_arg.data= data;
+ data_arg.type= nlayer->type;
+ data_arg.index= index;
+
if (!typeInfo->defaultname)
return;
-
- if (nlayer->name[0] == '\0')
- BLI_strncpy(nlayer->name, typeInfo->defaultname, sizeof(nlayer->name));
-
- if(cd_layer_find_dupe(data, nlayer->name, nlayer->type, index)) {
- /* note: this block is used in other places, when changing logic apply to all others, search this message */
- char tempname[sizeof(nlayer->name)];
- char left[sizeof(nlayer->name)];
- int number;
- int len= BLI_split_name_num(left, &number, nlayer->name);
- do { /* nested while loop looks bad but likely it wont run most times */
- while(BLI_snprintf(tempname, sizeof(tempname), "%s.%03d", left, number) >= sizeof(tempname)) {
- if(len > 0) left[--len]= '\0'; /* word too long */
- else number= 0; /* reset, must be a massive number */
- }
- } while(number++, cd_layer_find_dupe(data, tempname, nlayer->type, index));
-
- BLI_strncpy(nlayer->name, tempname, sizeof(nlayer->name));
- }
+
+ BLI_uniquename_cb(customdata_unique_check, &data_arg, typeInfo->defaultname, '.', nlayer->name, sizeof(nlayer->name));
}
int CustomData_verify_versions(struct CustomData *data, int index)
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 10fbd247c84..2eecc6d5c1b 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -319,32 +319,19 @@ static int defgroup_find_name_dupe(const char *name, bDeformGroup *dg, Object *o
return 0;
}
+static int defgroup_unique_check(void *arg, const char *name)
+{
+ struct {Object *ob; void *dg;} *data= arg;
+ return defgroup_find_name_dupe(name, data->dg, data->ob);
+}
+
void defgroup_unique_name (bDeformGroup *dg, Object *ob)
-{
- if (!ob)
- return;
-
- /* See if we are given an empty string */
- if (dg->name[0] == '\0') {
- /* give it default name first */
- strcpy (dg->name, "Group");
- }
-
- if(defgroup_find_name_dupe(dg->name, dg, ob)) {
- /* note: this block is used in other places, when changing logic apply to all others, search this message */
- char tempname[sizeof(dg->name)];
- char left[sizeof(dg->name)];
- int number;
- int len= BLI_split_name_num(left, &number, dg->name);
- do { /* nested while loop looks bad but likely it wont run most times */
- while(BLI_snprintf(tempname, sizeof(tempname), "%s.%03d", left, number) >= sizeof(tempname)) {
- if(len > 0) left[--len]= '\0'; /* word too long */
- else number= 0; /* reset, must be a massive number */
- }
- } while(number++, defgroup_find_name_dupe(tempname, dg, ob));
+{
+ struct {Object *ob; void *dg;} data;
+ data.ob= ob;
+ data.dg= dg;
- BLI_strncpy(dg->name, tempname, sizeof(dg->name));
- }
+ BLI_uniquename_cb(defgroup_unique_check, &data, "Group", '.', dg->name, sizeof(dg->name));
}
/* finds the best possible flipped name. For renaming; check for unique names afterwards */
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 21ef1c03e3a..c4ee97c21c5 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -1858,7 +1858,7 @@ static void flush_pointcache_reset(Scene *scene, DagNode *node, int curtime, int
for(itA = node->child; itA; itA= itA->next) {
if(itA->node->type==ID_OB) {
if(itA->node->lasttime!=curtime) {
- ob= (Object*)(node->ob);
+ ob= (Object*)(itA->node->ob);
if(reset || (ob->recalc & OB_RECALC_ALL)) {
if(BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH))
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index a8032f5a40d..979bd13a35d 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -789,7 +789,7 @@ void reshadeall_displist(Scene *scene)
/* ****************** make displists ********************* */
-static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
+static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, int forRender)
{
Nurb *nu;
DispList *dl;
@@ -802,7 +802,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
while(nu) {
if(nu->hide==0) {
- if(G.rendering && cu->resolu_ren!=0)
+ if(forRender && cu->resolu_ren!=0)
resolu= cu->resolu_ren;
else
resolu= nu->resolu;
@@ -1614,8 +1614,15 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
for (nu=nubase->first; nu; nu=nu->next) {
if(forRender || nu->hide==0) {
+ int resolu= nu->resolu, resolv= nu->resolv;
+
+ if(forRender){
+ if(cu->resolu_ren) resolu= cu->resolu_ren;
+ if(cu->resolv_ren) resolv= cu->resolv_ren;
+ }
+
if(nu->pntsv==1) {
- len= SEGMENTSU(nu)*nu->resolu;
+ len= SEGMENTSU(nu)*resolu;
dl= MEM_callocN(sizeof(DispList), "makeDispListsurf");
dl->verts= MEM_callocN(len*3*sizeof(float), "dlverts");
@@ -1634,10 +1641,10 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
if(nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
else dl->type= DL_SEGM;
- makeNurbcurve(nu, data, NULL, NULL, NULL, nu->resolu, 3*sizeof(float));
+ makeNurbcurve(nu, data, NULL, NULL, NULL, resolu, 3*sizeof(float));
}
else {
- len= (nu->pntsu*nu->resolu) * (nu->pntsv*nu->resolv);
+ len= (nu->pntsu*resolu) * (nu->pntsv*resolv);
dl= MEM_callocN(sizeof(DispList), "makeDispListsurf");
dl->verts= MEM_callocN(len*3*sizeof(float), "dlverts");
@@ -1653,12 +1660,12 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
data= dl->verts;
dl->type= DL_SURF;
- dl->parts= (nu->pntsu*nu->resolu); /* in reverse, because makeNurbfaces works that way */
- dl->nr= (nu->pntsv*nu->resolv);
+ dl->parts= (nu->pntsu*resolu); /* in reverse, because makeNurbfaces works that way */
+ dl->nr= (nu->pntsv*resolv);
if(nu->flagv & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_U; /* reverse too! */
if(nu->flagu & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_V;
- makeNurbfaces(nu, data, 0);
+ makeNurbfaces(nu, data, 0, resolu, resolv);
/* gl array drawing: using indices */
displist_surf_indices(dl);
@@ -1711,7 +1718,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
/* no bevel or extrude, and no width correction? */
if (!dlbev.first && cu->width==1.0f) {
- curve_to_displist(cu, nubase, dispbase);
+ curve_to_displist(cu, nubase, dispbase, forRender);
} else {
float widfac= cu->width-1.0;
BevList *bl= cu->bev.first;
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 2719563f829..a2435801ac6 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1310,12 +1310,14 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, char *name, int imtype, int subimt
}
-void BKE_makepicstring(char *string, char *base, int frame, int imtype, int use_ext)
+void BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames)
{
if (string==NULL) return;
BLI_strncpy(string, base, FILE_MAX - 10); /* weak assumption */
BLI_path_abs(string, G.main->name);
- BLI_path_frame(string, frame, 4);
+
+ if(use_frames)
+ BLI_path_frame(string, frame, 4);
if(use_ext)
BKE_add_image_extension(string, imtype);
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 7914bc2b640..5dc1cc2d746 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -111,27 +111,26 @@ typedef struct AdrBit2Path {
/* Object layers */
static AdrBit2Path ob_layer_bits[]= {
- {(1<<0), "layer", 0},
- {(1<<1), "layer", 1},
- {(1<<2), "layer", 2},
- {(1<<3), "layer", 3},
- {(1<<4), "layer", 4},
- {(1<<5), "layer", 5},
- {(1<<6), "layer", 6},
- {(1<<7), "layer", 7},
- {(1<<8), "layer", 8},
- {(1<<9), "layer", 9},
- {(1<<10), "layer", 10},
- {(1<<11), "layer", 11},
- {(1<<12), "layer", 12},
- {(1<<13), "layer", 13},
- {(1<<14), "layer", 14},
- {(1<<15), "layer", 15},
- {(1<<16), "layer", 16},
- {(1<<17), "layer", 17},
- {(1<<18), "layer", 18},
- {(1<<19), "layer", 19},
- {(1<<20), "layer", 20}
+ {(1<<0), "layers", 0},
+ {(1<<1), "layers", 1},
+ {(1<<2), "layers", 2},
+ {(1<<3), "layers", 3},
+ {(1<<4), "layers", 4},
+ {(1<<5), "layers", 5},
+ {(1<<6), "layers", 6},
+ {(1<<7), "layers", 7},
+ {(1<<8), "layers", 8},
+ {(1<<9), "layers", 9},
+ {(1<<10), "layers", 10},
+ {(1<<11), "layers", 11},
+ {(1<<12), "layers", 12},
+ {(1<<13), "layers", 13},
+ {(1<<14), "layers", 14},
+ {(1<<15), "layers", 15},
+ {(1<<16), "layers", 16},
+ {(1<<17), "layers", 17},
+ {(1<<18), "layers", 18},
+ {(1<<19), "layers", 19}
};
/* Material mode */
@@ -1123,7 +1122,6 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve *
{
AdrBit2Path *abp;
FCurve *fcu;
- unsigned int i=0;
int totbits;
/* allocate memory for a new F-Curve */
@@ -1189,6 +1187,8 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve *
* 3) filter the keyframes for the flag of interest
*/
for (b=0; b < totbits; b++, abp++) {
+ unsigned int i=0;
+
/* make a copy of existing base-data if not the last curve */
if (b < (totbits-1))
fcurve= copy_fcurve(fcu);
@@ -1212,7 +1212,7 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve *
fcurve->bezt= MEM_callocN(sizeof(BezTriple)*fcurve->totvert, "BezTriples");
/* loop through copying all BezTriples individually, as we need to modify a few things */
- for (dst=fcurve->bezt, src=icu->bezt; i < fcurve->totvert; i++, dst++, src++) {
+ for (dst=fcurve->bezt, src=icu->bezt, i=0; i < fcurve->totvert; i++, dst++, src++) {
/* firstly, copy BezTriple data */
*dst= *src;
@@ -1240,6 +1240,8 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve *
}
}
else {
+ unsigned int i=0;
+
/* get rna-path
* - we will need to set the 'disabled' flag if no path is able to be made (for now)
*/
@@ -1260,7 +1262,7 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve *
fcu->bezt= MEM_callocN(sizeof(BezTriple)*fcu->totvert, "BezTriples");
/* loop through copying all BezTriples individually, as we need to modify a few things */
- for (dst=fcu->bezt, src=icu->bezt; i < fcu->totvert; i++, dst++, src++) {
+ for (dst=fcu->bezt, src=icu->bezt, i=0; i < fcu->totvert; i++, dst++, src++) {
/* firstly, copy BezTriple data */
*dst= *src;
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 1c75c34e913..8d869563a77 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -631,24 +631,24 @@ void *alloc_libblock(ListBase *lb, short type, const char *name)
/* by spec, animdata is first item after ID */
/* and, trust that BKE_animdata_from_id() will only find AnimData for valid ID-types */
-static void id_copy_animdata(ID *id)
+static void id_copy_animdata(ID *id, const short do_action)
{
AnimData *adt= BKE_animdata_from_id(id);
if (adt) {
IdAdtTemplate *iat = (IdAdtTemplate *)id;
- iat->adt= BKE_copy_animdata(iat->adt);
+ iat->adt= BKE_copy_animdata(iat->adt, do_action); /* could be set to FALSE, need to investigate */
}
}
/* material nodes use this since they are not treated as libdata */
-void copy_libblock_data(ID *id, const ID *id_from)
+void copy_libblock_data(ID *id, const ID *id_from, const short do_action)
{
if (id_from->properties)
id->properties = IDP_CopyProperty(id_from->properties);
/* the duplicate should get a copy of the animdata */
- id_copy_animdata(id);
+ id_copy_animdata(id, do_action);
}
/* used everywhere in blenkernel */
@@ -676,7 +676,7 @@ void *copy_libblock(void *rt)
id->newid= idn;
idn->flag |= LIB_NEW;
- copy_libblock_data(idn, id);
+ copy_libblock_data(idn, id, FALSE);
return idn;
}
@@ -1077,7 +1077,7 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
memset(in_use, 0, sizeof(in_use));
/* get name portion, number portion ("name.number") */
- left_len= BLI_split_name_num(left, &nr, name);
+ left_len= BLI_split_name_num(left, &nr, name, '.');
/* if new name will be too long, truncate it */
if(nr > 999 && left_len > 16) {
@@ -1094,7 +1094,7 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
(idtest->lib == NULL) &&
(*name == *(idtest->name+2)) &&
(strncmp(name, idtest->name+2, left_len)==0) &&
- (BLI_split_name_num(leftest, &nrtest, idtest->name+2) == left_len)
+ (BLI_split_name_num(leftest, &nrtest, idtest->name+2, '.') == left_len)
) {
if(nrtest < sizeof(in_use))
in_use[nrtest]= 1; /* mark as used */
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 54bd0b956ac..3e7223e5e50 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -493,6 +493,7 @@ Material *material_pop_id(ID *id, int index)
short *totcol= give_totcolp_id(id);
if(index >= 0 && index < (*totcol)) {
ret= (*matar)[index];
+ id_us_min((ID *)ret);
if(*totcol <= 1) {
*totcol= 0;
MEM_freeN(*matar);
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index fd3bc47da9e..dc343e0d6c2 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -330,8 +330,8 @@ int is_mball_basis_for(Object *ob1, Object *ob2)
int basis1nr, basis2nr;
char basis1name[32], basis2name[32];
- BLI_split_name_num(basis1name, &basis1nr, ob1->id.name+2);
- BLI_split_name_num(basis2name, &basis2nr, ob2->id.name+2);
+ BLI_split_name_num(basis1name, &basis1nr, ob1->id.name+2, '.');
+ BLI_split_name_num(basis2name, &basis2nr, ob2->id.name+2, '.');
if(!strcmp(basis1name, basis2name)) return is_basis_mball(ob1);
else return 0;
@@ -352,7 +352,7 @@ void copy_mball_properties(Scene *scene, Object *active_object)
int basisnr, obnr;
char basisname[32], obname[32];
- BLI_split_name_num(basisname, &basisnr, active_object->id.name+2);
+ BLI_split_name_num(basisname, &basisnr, active_object->id.name+2, '.');
/* XXX recursion check, see scene.c, just too simple code this next_object() */
if(F_ERROR==next_object(&sce_iter, 0, 0, 0))
@@ -361,7 +361,7 @@ void copy_mball_properties(Scene *scene, Object *active_object)
while(next_object(&sce_iter, 1, &base, &ob)) {
if (ob->type==OB_MBALL) {
if(ob!=active_object){
- BLI_split_name_num(obname, &obnr, ob->id.name+2);
+ BLI_split_name_num(obname, &obnr, ob->id.name+2, '.');
/* Object ob has to be in same "group" ... it means, that it has to have
* same base of its name */
@@ -395,7 +395,7 @@ Object *find_basis_mball(Scene *scene, Object *basis)
int basisnr, obnr;
char basisname[32], obname[32];
- BLI_split_name_num(basisname, &basisnr, basis->id.name+2);
+ BLI_split_name_num(basisname, &basisnr, basis->id.name+2, '.');
totelem= 0;
/* XXX recursion check, see scene.c, just too simple code this next_object() */
@@ -415,7 +415,7 @@ Object *find_basis_mball(Scene *scene, Object *basis)
else ml= mb->elems.first;
}
else{
- BLI_split_name_num(obname, &obnr, ob->id.name+2);
+ BLI_split_name_num(obname, &obnr, ob->id.name+2, '.');
/* object ob has to be in same "group" ... it means, that it has to have
* same base of its name */
@@ -1572,7 +1572,7 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
invert_m4_m4(obinv, ob->obmat);
a= 0;
- BLI_split_name_num(obname, &obnr, ob->id.name+2);
+ BLI_split_name_num(obname, &obnr, ob->id.name+2, '.');
/* make main array */
next_object(&sce_iter, 0, 0, 0);
@@ -1593,7 +1593,7 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
char name[32];
int nr;
- BLI_split_name_num(name, &nr, bob->id.name+2);
+ BLI_split_name_num(name, &nr, bob->id.name+2, '.');
if( strcmp(obname, name)==0 ) {
mb= bob->data;
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index faefbdacb45..f5a563faa6f 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -751,9 +751,13 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int
float *data;
int a, b, ofs, vertcount, startvert, totvert=0, totvlak=0;
int p1, p2, p3, p4, *index;
+ int conv_polys= 0;
cu= ob->data;
+ conv_polys|= cu->flag & CU_3D; /* 2d polys are filled with DL_INDEX3 displists */
+ conv_polys|= ob->type == OB_SURF; /* surf polys are never filled */
+
/* count */
dl= dispbase->first;
while(dl) {
@@ -762,8 +766,10 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int
totvlak+= dl->parts*(dl->nr-1);
}
else if(dl->type==DL_POLY) {
- totvert+= dl->parts*dl->nr;
- totvlak+= dl->parts*dl->nr;
+ if(conv_polys) {
+ totvert+= dl->parts*dl->nr;
+ totvlak+= dl->parts*dl->nr;
+ }
}
else if(dl->type==DL_SURF) {
totvert+= dl->parts*dl->nr;
@@ -815,24 +821,26 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int
}
else if(dl->type==DL_POLY) {
- startvert= vertcount;
- a= dl->parts*dl->nr;
- data= dl->verts;
- while(a--) {
- VECCOPY(mvert->co, data);
- data+=3;
- vertcount++;
- mvert++;
- }
+ if(conv_polys) {
+ startvert= vertcount;
+ a= dl->parts*dl->nr;
+ data= dl->verts;
+ while(a--) {
+ VECCOPY(mvert->co, data);
+ data+=3;
+ vertcount++;
+ mvert++;
+ }
- for(a=0; a<dl->parts; a++) {
- ofs= a*dl->nr;
- for(b=0; b<dl->nr; b++) {
- mface->v1= startvert+ofs+b;
- if(b==dl->nr-1) mface->v2= startvert+ofs;
- else mface->v2= startvert+ofs+b+1;
- if(smooth) mface->flag |= ME_SMOOTH;
- mface++;
+ for(a=0; a<dl->parts; a++) {
+ ofs= a*dl->nr;
+ for(b=0; b<dl->nr; b++) {
+ mface->v1= startvert+ofs+b;
+ if(b==dl->nr-1) mface->v2= startvert+ofs;
+ else mface->v2= startvert+ofs+b+1;
+ if(smooth) mface->flag |= ME_SMOOTH;
+ mface++;
+ }
}
}
}
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index f4e9dcf742b..5e3c147a99f 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -180,68 +180,6 @@ void multires_force_render_update(Object *ob)
multires_force_update(ob);
}
-/* XXX */
-#if 0
-void multiresModifier_join(Object *ob)
-{
- Base *base = NULL;
- int highest_lvl = 0;
-
- /* First find the highest level of subdivision */
- base = FIRSTBASE;
- while(base) {
- if(TESTBASELIB_BGMODE(v3d, scene, base) && base->object->type==OB_MESH) {
- ModifierData *md;
- for(md = base->object->modifiers.first; md; md = md->next) {
- if(md->type == eModifierType_Multires) {
- int totlvl = ((MultiresModifierData*)md)->totlvl;
- if(totlvl > highest_lvl)
- highest_lvl = totlvl;
-
- /* Ensure that all updates are processed */
- multires_force_update(base->object);
- }
- }
- }
- base = base->next;
- }
-
- /* No multires meshes selected */
- if(highest_lvl == 0)
- return;
-
- /* Subdivide all the displacements to the highest level */
- base = FIRSTBASE;
- while(base) {
- if(TESTBASELIB_BGMODE(v3d, scene, base) && base->object->type==OB_MESH) {
- ModifierData *md = NULL;
- MultiresModifierData *mmd = NULL;
-
- for(md = base->object->modifiers.first; md; md = md->next) {
- if(md->type == eModifierType_Multires)
- mmd = (MultiresModifierData*)md;
- }
-
- /* If the object didn't have multires enabled, give it a new modifier */
- if(!mmd) {
- md = base->object->modifiers.first;
-
- while(md && modifierType_getInfo(md->type)->type == eModifierTypeType_OnlyDeform)
- md = md->next;
-
- mmd = (MultiresModifierData*)modifier_new(eModifierType_Multires);
- BLI_insertlinkbefore(&base->object->modifiers, md, mmd);
- modifier_unique_name(&base->object->modifiers, mmd);
- }
-
- if(mmd)
- multiresModifier_subdivide(mmd, base->object, highest_lvl - mmd->totlvl, 0, 0);
- }
- base = base->next;
- }
-}
-#endif
-
int multiresModifier_reshapeFromDM(Scene *scene, MultiresModifierData *mmd,
Object *ob, DerivedMesh *srcdm)
{
@@ -1613,18 +1551,39 @@ void multiresModifier_prepare_join(Scene *scene, Object *ob, Object *to_ob)
void multires_topology_changed(Object *ob)
{
Mesh *me= (Mesh*)ob->data;
- MDisps *mdisp= NULL;
- int i;
+ MDisps *mdisp= NULL, *cur= NULL;
+ int i, grid= 0, corners;
CustomData_external_read(&me->fdata, &me->id, CD_MASK_MDISPS, me->totface);
mdisp= CustomData_get_layer(&me->fdata, CD_MDISPS);
if(!mdisp) return;
+ cur= mdisp;
+ for(i = 0; i < me->totface; i++, cur++) {
+ if(mdisp->totdisp) {
+ corners= multires_mdisp_corners(mdisp);
+ grid= mdisp->totdisp / corners;
+
+ break;
+ }
+ }
+
for(i = 0; i < me->totface; i++, mdisp++) {
- int corners= multires_mdisp_corners(mdisp);
int nvert= me->mface[i].v4 ? 4 : 3;
+ /* allocate memory for mdisp, the whole disp layer would be erased otherwise */
+ if(!mdisp->totdisp) {
+ if(grid) {
+ mdisp->totdisp= nvert*grid;
+ mdisp->disps= MEM_callocN(mdisp->totdisp*sizeof(float)*3, "mdisp topology");
+ }
+
+ continue;
+ }
+
+ corners= multires_mdisp_corners(mdisp);
+
if(corners!=nvert) {
mdisp->totdisp= (mdisp->totdisp/corners)*nvert;
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 423ccb00e8e..5996bdc9f9a 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -916,9 +916,14 @@ void BKE_nlatrack_set_active (ListBase *tracks, NlaTrack *nlt_a)
/* Check if there is any space in the given track to add a strip of the given length */
short BKE_nlatrack_has_space (NlaTrack *nlt, float start, float end)
{
- /* sanity checks */
- if ((nlt == NULL) || IS_EQ(start, end))
+ /* sanity checks
+ * - track must exist
+ * - track must be editable
+ * - bounds cannot be equal (0-length is nasty)
+ */
+ if ((nlt == NULL) || (nlt->flag & NLATRACK_PROTECTED) || IS_EQ(start, end))
return 0;
+
if (start > end) {
puts("BKE_nlatrack_has_space() error... start and end arguments swapped");
SWAP(float, start, end);
@@ -1204,6 +1209,11 @@ void BKE_nlastrip_validate_fcurves (NlaStrip *strip)
}
}
+static int nla_editbone_name_check(void *arg, const char *name)
+{
+ return BLI_ghash_haskey((GHash *)arg, (void *)name);
+}
+
/* Sanity Validation ------------------------------------ */
/* Find (and set) a unique name for a strip from the whole AnimData block
@@ -1259,21 +1269,7 @@ void BKE_nlastrip_validate_name (AnimData *adt, NlaStrip *strip)
/* if the hash-table has a match for this name, try other names...
* - in an extreme case, it might not be able to find a name, but then everything else in Blender would fail too :)
*/
- if (BLI_ghash_haskey(gh, strip->name)) {
- /* note: this block is used in other places, when changing logic apply to all others, search this message */
- char tempname[sizeof(strip->name)];
- char left[sizeof(strip->name)];
- int number;
- int len= BLI_split_name_num(left, &number, strip->name);
- do { /* nested while loop looks bad but likely it wont run most times */
- while(BLI_snprintf(tempname, sizeof(tempname), "%s.%03d", left, number) >= sizeof(tempname)) {
- if(len > 0) left[--len]= '\0'; /* word too long */
- else number= 0; /* reset, must be a massive number */
- }
- } while(number++, BLI_ghash_haskey(gh, tempname));
-
- BLI_strncpy(strip->name, tempname, sizeof(strip->name));
- }
+ BLI_uniquename_cb(nla_editbone_name_check, (void *)gh, "NlaStrip", '.', strip->name, sizeof(strip->name));
/* free the hash... */
BLI_ghash_free(gh, NULL, NULL);
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 6c4c566f5b1..7b25c38648d 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1077,7 +1077,7 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree, int internal_select)
newtree= copy_libblock(ntree);
} else {
newtree= MEM_dupallocN(ntree);
- copy_libblock_data(&newtree->id, &ntree->id); /* copy animdata and ID props */
+ copy_libblock_data(&newtree->id, &ntree->id, TRUE); /* copy animdata and ID props */
}
newtree->nodes.first= newtree->nodes.last= NULL;
newtree->links.first= newtree->links.last= NULL;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index e006c48aca5..a10901d15d6 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -715,7 +715,6 @@ Camera *copy_camera(Camera *cam)
Camera *camn;
camn= copy_libblock(cam);
- camn->adt= BKE_copy_animdata(cam->adt);
return camn;
}
@@ -1550,7 +1549,7 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
if(gob) {
ob->rotmode= target->rotmode;
mul_m4_m4m4(ob->obmat, target->obmat, gob->obmat);
- object_apply_mat4(ob, ob->obmat, FALSE);
+ object_apply_mat4(ob, ob->obmat, FALSE, TRUE);
}
else {
copy_object_transform(ob, target);
@@ -1683,22 +1682,44 @@ void object_mat3_to_rot(Object *ob, float mat[][3], short use_compat)
switch(ob->rotmode) {
case ROT_MODE_QUAT:
mat3_to_quat(ob->quat, mat);
+ sub_v4_v4(ob->quat, ob->dquat);
break;
case ROT_MODE_AXISANGLE:
mat3_to_axis_angle(ob->rotAxis, &ob->rotAngle, mat);
+ sub_v3_v3(ob->rotAxis, ob->drotAxis);
+ ob->rotAngle -= ob->drotAngle;
break;
default: /* euler */
if(use_compat) mat3_to_compatible_eulO(ob->rot, ob->rot, ob->rotmode, mat);
else mat3_to_eulO(ob->rot, ob->rotmode, mat);
+ sub_v3_v3(ob->rot, ob->drot);
}
}
/* see pchan_apply_mat4() for the equivalent 'pchan' function */
-void object_apply_mat4(Object *ob, float mat[][4], short use_compat)
+void object_apply_mat4(Object *ob, float mat[][4], const short use_compat, const short use_parent)
{
float rot[3][3];
- mat4_to_loc_rot_size(ob->loc, rot, ob->size, mat);
- object_mat3_to_rot(ob, rot, use_compat);
+
+ if(use_parent && ob->parent) {
+ float rmat[4][4], diff_mat[4][4], imat[4][4];
+ mul_m4_m4m4(diff_mat, ob->parentinv, ob->parent->obmat);
+ invert_m4_m4(imat, diff_mat);
+ mul_m4_m4m4(rmat, mat, imat); /* get the parent relative matrix */
+ object_apply_mat4(ob, rmat, use_compat, FALSE);
+
+ /* same as below, use rmat rather then mat */
+ mat4_to_loc_rot_size(ob->loc, rot, ob->size, rmat);
+ object_mat3_to_rot(ob, rot, use_compat);
+ }
+ else {
+ mat4_to_loc_rot_size(ob->loc, rot, ob->size, mat);
+ object_mat3_to_rot(ob, rot, use_compat);
+ }
+
+ sub_v3_v3(ob->loc, ob->dloc);
+ sub_v3_v3(ob->size, ob->dsize);
+ /* object_mat3_to_rot handles delta rotations */
}
void object_to_mat3(Object *ob, float mat[][3]) /* no parent */
@@ -2127,7 +2148,7 @@ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[
copy_m3_m4(originmat, tmat);
// origin, voor help line
- if( (ob->partype & 15)==PARSKEL ) {
+ if( (ob->partype & PARTYPE)==PARSKEL ) {
VECCOPY(ob->orig, par->obmat[3]);
}
else {
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index e8223caed41..7d7f73222fa 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -467,7 +467,7 @@ int unpackVFont(ReportList *reports, VFont *vfont, int how)
return (ret_value);
}
-int unpackSound(ReportList *reports, bSound *sound, int how)
+int unpackSound(Main *bmain, ReportList *reports, bSound *sound, int how)
{
char localname[FILE_MAXDIR + FILE_MAX], fi[FILE_MAX];
char *newname;
@@ -486,7 +486,7 @@ int unpackSound(ReportList *reports, bSound *sound, int how)
freePackedFile(sound->packedfile);
sound->packedfile = 0;
- sound_load(NULL, sound);
+ sound_load(bmain, sound);
ret_value = RET_OK;
}
@@ -536,6 +536,6 @@ void unpackAll(Main *bmain, ReportList *reports, int how)
for(sound=bmain->sound.first; sound; sound=sound->id.next)
if(sound->packedfile)
- unpackSound(reports, sound, how);
+ unpackSound(bmain, reports, sound, how);
}
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 2b045647661..f58ab63ff81 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -136,9 +136,12 @@ void psys_reset(ParticleSystem *psys, int mode)
if(ELEM(mode, PSYS_RESET_ALL, PSYS_RESET_DEPSGRAPH)) {
if(mode == PSYS_RESET_ALL || !(psys->flag & PSYS_EDITED)) {
- psys_free_particles(psys);
+ /* don't free if not absolutely necessary */
+ if(psys->totpart != psys->part->totpart) {
+ psys_free_particles(psys);
+ psys->totpart= 0;
+ }
- psys->totpart= 0;
psys->totkeyed= 0;
psys->flag &= ~(PSYS_HAIR_DONE|PSYS_KEYED);
@@ -3750,14 +3753,14 @@ static void system_step(ParticleSimulationData *sim, float cfra)
/* simulation is only active during a specific period */
if(framenr < startframe) {
- psys_reset(psys, PSYS_RESET_CACHE_MISS);
+ /* set correct particle state and reset particles */
+ cached_step(sim, cfra);
return;
}
else if(framenr > endframe) {
framenr= endframe;
}
-
- if(framenr == startframe) {
+ else if(framenr == startframe) {
BKE_ptcache_id_reset(sim->scene, use_cache, PTCACHE_RESET_OUTDATED);
BKE_ptcache_validate(cache, framenr);
cache->flag &= ~PTCACHE_REDO_NEEDED;
@@ -4058,6 +4061,8 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
psys->flag |= PSYS_HAIR_DONE;
psys->recalc = recalc;
}
+ else if(psys->flag & PSYS_EDITED)
+ psys->flag |= PSYS_HAIR_DONE;
if(psys->flag & PSYS_HAIR_DONE)
hair_step(&sim, cfra);
@@ -4075,12 +4080,13 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
case PART_PHYS_KEYED:
{
PARTICLE_P;
+ float disp = (float)psys_get_current_display_percentage(psys)/100.0f;
/* Particles without dynamics haven't been reset yet because they don't use pointcache */
if(psys->recalc & PSYS_RECALC_RESET)
psys_reset(psys, PSYS_RESET_ALL);
- if(emit_particles(&sim, NULL, cfra)) {
+ if(emit_particles(&sim, NULL, cfra) || (psys->recalc & PSYS_RECALC_RESET)) {
free_keyed_keys(psys);
distribute_particles(&sim, part->from);
initialize_all_particles(&sim);
@@ -4092,6 +4098,11 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
reset_particle(&sim, pa, 0.0, cfra);
+
+ if(PSYS_FRAND(p) > disp)
+ pa->flag |= PARS_NO_DISP;
+ else
+ pa->flag &= ~PARS_NO_DISP;
}
if(part->phystype == PART_PHYS_KEYED) {
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 35e0441739e..bceff487543 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -2847,6 +2847,8 @@ void BKE_ptcache_load_external(PTCacheID *pid)
PointCache *cache = pid->cache;
int len; /* store the length of the string */
int info = 0;
+ int start = MAXFRAME;
+ int end = -1;
/* mode is same as fopen's modes */
DIR *dir;
@@ -2858,10 +2860,6 @@ void BKE_ptcache_load_external(PTCacheID *pid)
if(!cache)
return;
- cache->startframe = MAXFRAME;
- cache->endframe = -1;
- cache->totpoint = 0;
-
ptcache_path(pid, path);
len = BKE_ptcache_id_filename(pid, filename, 1, 0, 0); /* no path */
@@ -2887,8 +2885,8 @@ void BKE_ptcache_load_external(PTCacheID *pid)
frame = atoi(num);
if(frame) {
- cache->startframe = MIN2(cache->startframe, frame);
- cache->endframe = MAX2(cache->endframe, frame);
+ start = MIN2(start, frame);
+ end = MAX2(end, frame);
}
else
info = 1;
@@ -2898,9 +2896,13 @@ void BKE_ptcache_load_external(PTCacheID *pid)
}
closedir(dir);
- if(cache->startframe != MAXFRAME) {
+ if(start != MAXFRAME) {
PTCacheFile *pf;
+ cache->startframe = start;
+ cache->endframe = end;
+ cache->totpoint = 0;
+
/* read totpoint from info file (frame 0) */
if(info) {
pf= ptcache_file_open(pid, PTCACHE_FILE_READ, 0);
@@ -2931,10 +2933,10 @@ void BKE_ptcache_load_external(PTCacheID *pid)
ptcache_file_close(pf);
}
}
+ cache->flag |= (PTCACHE_BAKED|PTCACHE_DISK_CACHE|PTCACHE_SIMULATION_VALID);
+ cache->flag &= ~(PTCACHE_OUTDATED|PTCACHE_FRAMES_SKIPPED);
}
- cache->flag &= ~(PTCACHE_OUTDATED|PTCACHE_FRAMES_SKIPPED);
-
BKE_ptcache_update_info(pid);
}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 027ec5e4052..4da948fd3cb 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -130,7 +130,6 @@ Scene *copy_scene(Scene *sce, int type)
id_us_plus((ID *)scen->world);
id_us_plus((ID *)scen->set);
- id_us_plus((ID *)scen->ima);
id_us_plus((ID *)scen->gm.dome.warptext);
scen->ed= NULL;
@@ -173,7 +172,7 @@ Scene *copy_scene(Scene *sce, int type)
BKE_keyingsets_copy(&(scen->keyingsets), &(sce->keyingsets));
if(sce->nodetree) {
- scen->nodetree= ntreeCopyTree(sce->nodetree, 0);
+ scen->nodetree= ntreeCopyTree(sce->nodetree, 0); /* copies actions */
ntreeSwitchID(scen->nodetree, &sce->id, &scen->id);
}
@@ -218,9 +217,11 @@ Scene *copy_scene(Scene *sce, int type)
/* world */
if(type == SCE_COPY_FULL) {
+ BKE_copy_animdata_id_action((ID *)scen);
if(scen->world) {
id_us_plus((ID *)scen->world);
scen->world= copy_world(scen->world);
+ BKE_copy_animdata_id_action((ID *)scen->world);
}
if(sce->ed) {
@@ -449,8 +450,7 @@ Scene *add_scene(char *name)
pset->brush[a].count= 10;
}
pset->brush[PE_BRUSH_CUT].strength= 100;
-
- sce->jumpframe = 10;
+
sce->r.ffcodecdata.audio_mixrate = 44100;
sce->audio.distance_model = 2.0;
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 4a8c47f1f71..4272e317cc7 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -610,6 +610,8 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
}
seq->strip->len = seq->len;
case SEQ_SOUND:
+ if(!seq->sound)
+ return;
seq->len = ceil(AUD_getInfo(seq->sound->playback_handle).length * FPS);
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
@@ -1826,7 +1828,7 @@ static ImBuf * seq_render_scene_strip_impl(
if(re==NULL)
re= RE_NewRender(sce->id.name);
- RE_BlenderFrame(re, bmain, sce, NULL, sce->lay, frame);
+ RE_BlenderFrame(re, bmain, sce, NULL, sce->lay, frame, FALSE);
/* restore previous state after it was toggled on & off by RE_BlenderFrame */
G.rendering = rendering;
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index aafa2d9870c..c1090326fd9 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -1353,13 +1353,17 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
}
}
- if(framenr < startframe)
+ if(!smd->domain->fluid && (framenr != startframe) && (cache->flag & PTCACHE_BAKED)==0)
return;
+ if(framenr < startframe)
+ framenr = startframe;
+
if(framenr > endframe)
- return;
+ framenr = endframe;
- if(!smd->domain->fluid && (framenr != startframe) && (cache->flag & PTCACHE_BAKED)==0)
+ /* If already viewing a pre/after frame, no need to reload */
+ if ((smd->time == framenr) && (framenr != scene->r.cfra))
return;
// printf("startframe: %d, framenr: %d\n", startframe, framenr);
@@ -1402,6 +1406,10 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
else if(framenr != (int)smd->time+1)
return;
+ /* don't simulate if viewing start frame, but scene frame is not real start frame */
+ if (framenr != scene->r.cfra)
+ return;
+
tstart();
smoke_calc_domain(scene, ob, smd);
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index cc941c81131..4a9a5fa881b 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -236,7 +236,7 @@ void sound_delete_cache(struct bSound* sound)
}
}
-void sound_load(struct Main *UNUSED(bmain), struct bSound* sound)
+void sound_load(struct Main *bmain, struct bSound* sound)
{
if(sound)
{
@@ -266,8 +266,7 @@ void sound_load(struct Main *UNUSED(bmain), struct bSound* sound)
if(sound->id.lib)
path = sound->id.lib->filepath;
else
- // XXX this should be fixed!
- path = /*bmain ? bmain->name :*/ G.main->name;
+ path = bmain->name;
BLI_path_abs(fullpath, path);
@@ -277,7 +276,7 @@ void sound_load(struct Main *UNUSED(bmain), struct bSound* sound)
/* or else load it from disk */
else
sound->handle = AUD_load(fullpath);
- } // XXX
+ }
// XXX unused currently
#if 0
break;
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index da3dea37220..595b85955b8 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -573,6 +573,7 @@ void default_tex(Tex *tex)
tex->iuser.fie_ima= 2;
tex->iuser.ok= 1;
tex->iuser.frames= 100;
+ tex->iuser.sfra= 1;
tex->preview = NULL;
}
@@ -1285,8 +1286,7 @@ void BKE_free_pointdensity(PointDensity *pd)
void BKE_free_voxeldatadata(struct VoxelData *vd)
{
if (vd->dataset) {
- if(vd->file_format != TEX_VD_SMOKE)
- MEM_freeN(vd->dataset);
+ MEM_freeN(vd->dataset);
vd->dataset = NULL;
}
diff --git a/source/blender/blenlib/BLI_bfile.h b/source/blender/blenlib/BLI_bfile.h
deleted file mode 100644
index 71e771fb4fa..00000000000
--- a/source/blender/blenlib/BLI_bfile.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/* -*- indent-tabs-mode:t; tab-width:4; -*-
- *
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2009 by Stichting Blender Foundation.
- * All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- * BFILE* based abstraction of file access.
- */
-
-#ifndef BLI_BFILE_H
-#define BLI_BFILE_H
-
-/* For fopen's FILE */
-#include <stdio.h>
-
-/**
- Defines for the bflags param.
- */
-/* Special handling, pick one of: */
-/* For "symmetry" of flags */
-#define BFILE_NORMAL (0)
-/* No supervision, just translate // if needed, RISKY */
-#define BFILE_RAW (1<<0)
-/* Path is for current session temp files */
-#define BFILE_TEMP (1<<1)
-/* Path is based in env vars of matching name */
-#define BFILE_CONFIG_BASE (1<<2)
-#define BFILE_CONFIG_DATAFILES (1<<3)
-#define BFILE_CONFIG_PYTHON (1<<4)
-#define BFILE_CONFIG_PLUGINS (1<<5)
-
-/* Config handling, special cases: */
-#define BFILE_USERONLY (1<<6)
-#define BFILE_SYSONLY (1<<7)
-
-/* Compression to apply on close: */
-#define BFILE_GZIP (1<<8)
-#define BFILE_LZMA (1<<9)
-
-/**
- File descriptor for Blender abstracted file access.
- */
-typedef struct {
- FILE *stream;
- int fd;
-
- /* Anything below should not be touched directly */
- int uflags; /* Special options requested by upper level, copy of bflags */
- char *fpath; /* Final/requested path name */
- char *tpath; /* Temp path name if applicable */
- int classf; /* Own flags, common classification of open and fopen */
- int error; /* An op caused an error, unsafe to replace older files */
-} BFILE;
-
-/**
- Open a BFILE* with fopen()-like syntax.
- */
-BFILE *BLI_bfile_fopen(const char *path, const char *mode, int bflags, const char *relpath);
-
-/**
- Open a BFILE* with open()-like syntax.
- */
-BFILE *BLI_bfile_open(const char *pathname, int flags, int bflags, const char *relpath);
-
-/**
- Get the FILE* associated with the BFILE*.
- */
-FILE *BLI_bfile_file_from_bfile(BFILE *bfile);
-
-/**
- Get the fd associated with the BFILE*.
- */
-int BLI_bfile_fd_from_bfile(BFILE *bfile);
-
-/**
- write()-like using BFILE*.
- */
-ssize_t BLI_bfile_write(BFILE *f, const void *buf, size_t count);
-
-/**
- read()-like using BFILE*.
- */
-ssize_t BLI_bfile_read(BFILE *f, void *buf, size_t count);
-
-/**
- fwrite()-like using BFILE*.
- */
-size_t BLI_bfile_fwrite(const void *ptr, size_t size, size_t nmemb, BFILE *f);
-
-/**
- fread()-like using BFILE*.
- */
-size_t BLI_bfile_fread(void *ptr, size_t size, size_t nmemb, BFILE *f);
-
-/**
- Close a BFILE, to match close() and fclose().
- */
-void BLI_bfile_close(BFILE *bfile);
-
-/**
- Clear error status.
- Call it only if the error has been really handled.
- */
-void BLI_bfile_clear_error(BFILE *bfile);
-
-/**
- Set the error status.
- Call it to mark writing by a 3rd party failed (libjpeg reported error, ie).
- */
-void BLI_bfile_set_error(BFILE *bfile, int error);
-
-/*
-TODO
-Maybe also provide more OS/libc things like:
-fflush
-fprintf and related
-fscanf
-fgetc/fputc and related
-fseek and related
-
-Probably good to do:
-readdir (compacted list showing all files for a "directory" (user versions on top of system's))
-*/
-
-#endif /* ifndef BLI_BFILE_H */
diff --git a/source/blender/blenlib/BLI_bpath.h b/source/blender/blenlib/BLI_bpath.h
index 96eb67867b1..d7b008c5a1b 100644
--- a/source/blender/blenlib/BLI_bpath.h
+++ b/source/blender/blenlib/BLI_bpath.h
@@ -47,16 +47,16 @@ struct BPathIteratorFrsModuleData {
struct BPathIterator {
char* path;
- char* lib;
- char* name;
+ const char* lib;
+ const char* name;
void* data;
int len;
int type;
- void (*setpath_callback)(struct BPathIterator *, char *);
+ void (*setpath_callback)(struct BPathIterator *, const char *);
void (*getpath_callback)(struct BPathIterator *, char *);
- char* base_path; /* base path, the directry the blend file is in - normally G.main->name */
+ const char* base_path; /* base path, the directry the blend file is in - normally G.main->name */
/* only for seq data */
struct BPathIteratorSeqData seqdata;
@@ -64,24 +64,24 @@ struct BPathIterator {
struct BPathIteratorFrsModuleData frsmoduledata;
};
-void BLI_bpathIterator_init (struct BPathIterator *bpi, char *base_path);
+void BLI_bpathIterator_init (struct BPathIterator *bpi, const char *base_path);
void BLI_bpathIterator_free (struct BPathIterator *bpi);
-char* BLI_bpathIterator_getLib (struct BPathIterator *bpi);
-char* BLI_bpathIterator_getName (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);
int BLI_bpathIterator_getPathMaxLen (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, char *path);
+void BLI_bpathIterator_setPath (struct BPathIterator *bpi, const char *path);
/* high level funcs */
/* creates a text file with missing files if there are any */
-void checkMissingFiles(char *basepath, ReportList *reports);
-void makeFilesRelative(char *basepath, ReportList *reports);
-void makeFilesAbsolute(char *basepath, ReportList *reports);
-void findMissingFiles(char *basepath, char *str);
+void checkMissingFiles(const char *basepath, ReportList *reports);
+void makeFilesRelative(const char *basepath, ReportList *reports);
+void makeFilesAbsolute(const char *basepath, ReportList *reports);
+void findMissingFiles(const char *basepath, const char *str);
#endif // BLI_BPATH_H
diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h
index 552de7b170c..ecf981c1640 100644
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -47,7 +47,7 @@ int BLI_is_writable(char *filename);
/**
* @attention Do not confuse with BLI_exist
*/
-int BLI_exists(char *file);
+int BLI_exists(const char *file);
int BLI_copy_fileops(char *file, char *to);
int BLI_rename(char *from, char *to);
int BLI_gzip(char *from, char *to);
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 3fceef36e2a..2e596951fef 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -63,6 +63,8 @@ MINLINE void sub_v2_v2(float r[2], const float a[2]);
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2]);
MINLINE void sub_v3_v3(float r[3], const float a[3]);
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3]);
+MINLINE void sub_v4_v4(float r[4], const float a[4]);
+MINLINE void sub_v4_v4v4(float r[4], const float a[4], const float b[4]);
MINLINE void mul_v2_fl(float r[2], float f);
MINLINE void mul_v2_v2fl(float r[2], const float a[2], float f);
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index 69b10661e23..85286d15acb 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -42,9 +42,9 @@ struct direntry;
char *BLI_getDefaultDocumentFolder(void);
-char *BLI_get_folder(int folder_id, char *subfolder);
-char *BLI_get_folder_create(int folder_id, char *subfolder);
-char *BLI_get_user_folder_notest(int folder_id, char *subfolder);
+char *BLI_get_folder(int folder_id, const char *subfolder);
+char *BLI_get_folder_create(int folder_id, const char *subfolder);
+char *BLI_get_user_folder_notest(int folder_id, const char *subfolder);
/* folder_id */
@@ -101,7 +101,7 @@ void BLI_setenv_if_new(const char *env, const char* val);
void BLI_make_file_string(const char *relabase, char *string, const char *dir, const char *file);
void BLI_make_exist(char *dir);
-void BLI_make_existing_file(char *name);
+void BLI_make_existing_file(const char *name);
void BLI_split_dirfile(const char *string, char *dir, char *file);
void BLI_join_dirfile(char *string, const char *dir, const char *file);
char *BLI_path_basename(char *path);
@@ -117,10 +117,11 @@ 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, int 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);
int BLI_stringdec(const char *string, char *head, char *start, unsigned short *numlen);
void BLI_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic);
-int BLI_split_name_num(char *left, int *nr, const char *name);
+int BLI_split_name_num(char *left, int *nr, const char *name, const char delim);
void BLI_splitdirstring(char *di,char *fi);
/* make sure path separators conform to system one */
diff --git a/source/blender/blenlib/BLI_storage.h b/source/blender/blenlib/BLI_storage.h
index e52ea1600eb..0996b19a854 100644
--- a/source/blender/blenlib/BLI_storage.h
+++ b/source/blender/blenlib/BLI_storage.h
@@ -38,19 +38,19 @@ struct direntry;
void BLI_adddirstrings(void);
-void BLI_builddir(char *dirname, char *relname);
+void BLI_builddir(const char *dirname, const char *relname);
int BLI_compare(struct direntry *entry1, struct direntry *entry2);
size_t BLI_filesize(int file);
size_t BLI_filepathsize(const char *path);
-double BLI_diskfree(char *dir);
-char *BLI_getwdN(char *dir);
+double BLI_diskfree(const char *dir);
+char *BLI_getwdN(const char *dir);
-unsigned int BLI_getdir(char *dirname, struct direntry **filelist);
+unsigned int BLI_getdir(const char *dirname, struct direntry **filelist);
/**
* @attention Do not confuse with BLI_exists
*/
-int BLI_exist(char *name);
+int BLI_exist(const char *name);
/**
* Read a file as ASCII lines. An empty list is
* returned if the file cannot be opened or read.
@@ -62,9 +62,9 @@ int BLI_exist(char *name);
* @retval A list of strings representing the file lines.
*/
-int BLI_is_dir(char *file);
+int BLI_is_dir(const char *file);
-struct LinkNode *BLI_read_file_as_lines(char *name);
+struct LinkNode *BLI_read_file_as_lines(const char *name);
/**
* Free the list returned by BLI_read_file_as_lines.
diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h
index b66790f701f..2b0f548f5dd 100644
--- a/source/blender/blenlib/BLI_winstuff.h
+++ b/source/blender/blenlib/BLI_winstuff.h
@@ -36,6 +36,13 @@
#ifndef FREE_WINDOWS
#pragma warning(once: 4761 4305 4244 4018)
+#else
+#ifdef WINVER
+#undef WINVER
+#endif
+
+/* Some stuff requires WINVER 0x500, but mingw's default is 0x400 */
+#define WINVER 0x0501
#endif
#define WIN32_LEAN_AND_MEAN
@@ -82,15 +89,6 @@ extern "C" {
#endif
/* defines for using ISO C++ conformant names */
-#define open _open
-#define close _close
-#define write _write
-#define read _read
-#define getcwd _getcwd
-#define chdir _chdir
-#define strdup _strdup
-#define lseek _lseek
-#define getpid _getpid
#define snprintf _snprintf
#ifndef FREE_WINDOWS
@@ -134,15 +132,13 @@ void get_default_root(char *root);
int check_file_chars(char *filename);
char *dirname(char *path);
-#ifdef WIN32
int BLI_getInstallationDir(char *str);
-#endif
#ifdef __cplusplus
}
#endif
-#endif
+#endif /* _WIN32 */
#endif /* __WINSTUFF_H__ */
diff --git a/source/blender/blenlib/SConscript b/source/blender/blenlib/SConscript
index 9ee03df8d8b..78aecf9936b 100644
--- a/source/blender/blenlib/SConscript
+++ b/source/blender/blenlib/SConscript
@@ -3,11 +3,6 @@ Import ('env')
sources = env.Glob('intern/*.c')
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc'):
- sources.remove('intern\\BLI_bfile.c')
-else:
- sources.remove('intern/BLI_bfile.c')
-
cflags=''
incs = '. ../makesdna ../blenkernel #/intern/guardedalloc #/intern/ghost ../editors/include ../gpu'
incs += ' ' + env['BF_FREETYPE_INC']
diff --git a/source/blender/blenlib/intern/BLI_bfile.c b/source/blender/blenlib/intern/BLI_bfile.c
deleted file mode 100644
index b9ac6875b20..00000000000
--- a/source/blender/blenlib/intern/BLI_bfile.c
+++ /dev/null
@@ -1,372 +0,0 @@
-/* -*- indent-tabs-mode:t; tab-width:4; -*-
- *
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2009 by Stichting Blender Foundation.
- * All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- * BFILE* based abstraction for file access.
- */
-
-#include <string.h>
-#include <stdlib.h>
-#ifndef WIN32
- #include <libgen.h>
- #include <unistd.h>
- #include <sys/param.h>
-#else
- #include <io.h>
- #include "BLI_winstuff.h"
- static char* find_in_pathlist(char* filename, char* pathlist);
-#endif
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include "MEM_guardedalloc.h"
-#include "BKE_utildefines.h"
-#include "BKE_blender.h"
-#include "BLI_path_util.h"
-#include "BLI_fileops.h"
-#include "BLI_storage.h"
-#include "BLI_bfile.h"
-
-/* Internal bfile classification flags */
-#define BCF_OPEN (0)
-#define BCF_FOPEN (1<<0)
-#define BCF_READ (1<<1)
-#define BCF_WRITE (1<<2)
-#define BCF_AT_END (1<<3)
-#define BCF_DISCARD (1<<4)
-
-/* Standard files names */
-#define LAST_SESSION_FILE "last-session"
-#define ENVIRONMENT_FILE "environment"
-
-
-/* Declaration of internal functions */
-static void fill_paths(BFILE *bfile, const char *path, const char *relpath);
-static void free_paths(BFILE* bfile);
-
-
-/*** Exported functions ***/
-
-BFILE *BLI_bfile_fopen(const char *path, const char *mode, int bflags,
- const char *relpath)
-{
- BFILE *bfile;
-
- bfile = MEM_mallocN(sizeof(BFILE), "bfile-fopen");
- bfile->classf = BCF_FOPEN;
- bfile->uflags = bflags;
-
- /* From fopen() doc, we can guess some logic:
- r BCF_READ
- r+ BCF_READ | BCF_WRITE
- w BCF_DISCARD | BCF_WRITE
- w+ BCF_DISCARD | BCF_WRITE | BCF_READ
- a BCF_AT_END | BCF_WRITE
- a+ BCF_AT_END | BCF_WRITE | BCF_READ
- */
- if (strchr(mode, 'r'))
- bfile->classf |= BCF_READ;
- if (strchr(mode, 'w'))
- bfile->classf |= (BCF_DISCARD | BCF_WRITE);
- if (strchr(mode, 'a'))
- bfile->classf |= (BCF_AT_END | BCF_WRITE);
- if (strchr(mode, '+'))
- bfile->classf |= (BCF_READ | BCF_WRITE);
-
- fill_paths(bfile, path, relpath);
-
- bfile->stream = fopen(bfile->tpath, mode);
- if (!(bfile->stream)) {
- free_paths(bfile);
- MEM_freeN(bfile);
- return NULL;
- }
-
- bfile->fd = fileno(bfile->stream);
-
- return bfile;
-}
-
-
-BFILE *BLI_bfile_open(const char *pathname, int flags, int bflags,
- const char *relpath)
-{
- BFILE *bfile;
- char fopen_mode[3];
-
- bfile = MEM_mallocN(sizeof(BFILE), "bfile-open");
- bfile->classf = BCF_OPEN;
- bfile->uflags = bflags;
-
- /* Easy mapping for open() */
- if (flags & O_RDONLY)
- bfile->classf |= BCF_READ;
- if (flags & O_WRONLY)
- bfile->classf |= BCF_WRITE;
- if (flags & O_RDWR)
- bfile->classf |= (BCF_READ | BCF_WRITE);
- if (flags & O_APPEND)
- bfile->classf |= BCF_AT_END;
- if (flags & O_TRUNC)
- bfile->classf |= BCF_DISCARD;
-
- fill_paths(bfile, pathname, relpath);
-
- bfile->fd = open(bfile->tpath, flags);
- if (bfile->fd == -1) {
- free_paths(bfile);
- MEM_freeN(bfile);
- return NULL;
- }
-
- fopen_mode[0] = 'r';
- fopen_mode[1] = '\0';
- fopen_mode[2] = '\0';
- if (bfile->classf & BCF_DISCARD) {
- fopen_mode[0] = 'w';
- if (bfile->classf & BCF_READ) {
- fopen_mode[1] = '+';
- }
- } else if (bfile->classf & BCF_AT_END) {
- fopen_mode[0] = 'a';
- if (bfile->classf & BCF_READ) {
- fopen_mode[1] = '+';
- }
- } else if (bfile->classf & BCF_WRITE) {
- fopen_mode[1] = '+';
- }
-
- bfile->stream = fdopen(bfile->fd, fopen_mode); /* MSWindows _fdopen? */
- if (!(bfile->stream)) {
- free_paths(bfile);
- MEM_freeN(bfile);
- return NULL;
- }
-
- return bfile;
-}
-
-
-FILE *BLI_bfile_file_from_bfile(BFILE *bfile) {
- return bfile->stream;
-}
-
-
-int BLI_bfile_fd_from_bfile(BFILE *bfile) {
- return bfile->fd;
-}
-
-
-ssize_t BLI_bfile_write(BFILE *f, const void *buf, size_t count) {
- ssize_t ret;
-
- ret = write((f->fd), buf, count);
- if (ret == -1) {
- f->error = 1;
- }
-
- return ret;
-}
-
-
-ssize_t BLI_bfile_read(BFILE *f, void *buf, size_t count) {
- ssize_t ret;
-
- ret = read((f->fd), buf, count);
- if (ret == -1) {
- f->error = 1;
- }
-
- return ret;
-}
-
-
-size_t BLI_bfile_fwrite(const void *ptr, size_t size, size_t nmemb,
- BFILE *f)
-{
- size_t ret;
-
- if (f == NULL)
- return 0;
-
- ret = fwrite(ptr, size, nmemb, f->stream);
- if (ret <= 0) {
- f->error = 1;
- }
-
- return ret;
-}
-
-
-size_t BLI_bfile_fread(void *ptr, size_t size, size_t nmemb, BFILE *f) {
- size_t ret;
-
- if (f == NULL)
- return 0;
-
- ret = fread(ptr, size, nmemb, f->stream);
- if ((ret <= 0) && ferror(f->stream)) {
- f->error = 1;
- }
-
- return ret;
-}
-
-
-void BLI_bfile_close(BFILE *bfile) {
- if ((bfile->classf | BCF_WRITE) &&
- !(bfile->uflags | BFILE_RAW)) {
- int error;
- /* Make sure data is on disk */
- error = fsync(bfile->fd);
- /* fsync the directory too? */
- /* Move to final name if no errors */
- if (!(bfile->error) && !error) {
- rename(bfile->tpath, bfile->fpath);
- }
- }
-
- /* Normal close */
-
- /* Cleanup */
- free_paths(bfile);
- MEM_freeN(bfile);
-}
-
-
-void BLI_bfile_clear_error(BFILE *bfile) {
- bfile->error = 0;
-}
-
-
-void BLI_bfile_set_error(BFILE *bfile, int error) {
- /* No cheating, use clear_error() for 0 */
- if (error) {
- bfile->error = error;
- }
-}
-
-
-/*** Internal functions ***/
-
-/**
- Return a full path if the filename exists when combined
- with any item from pathlist. Or NULL otherwise.
- */
-#ifdef WIN32
- #define SEPARATOR ';'
-#else
- #define SEPARATOR ':'
-#endif
-
-#ifdef WIN32
-static char* find_in_pathlist(char* filename, char* pathlist) {
- char first[FILE_MAX + 10];
- char* rest = NULL;
-
- /* Separate first path from rest, use typical separator for current OS */
- rest = strchr(pathlist, SEPARATOR);
- if (rest) {
- strncpy(first, pathlist, rest - pathlist);
- first[rest - pathlist] = '\0';
- /* Skip the separator so it becomes a valid new pathlist */
- rest++;
- } else {
- strcpy(first, pathlist);
- }
-
- /* Check if combination exists */
- BLI_add_slash(first);
- strcat(first, filename);
- if (BLI_exist(first)) {
- return strdup(first);
- }
-
- /* First path failed, try with rest of paths if possible */
- if (rest) {
- return find_in_pathlist(filename, rest);
- } else {
- return NULL;
- }
-}
-#endif
-
-/**
- Setup fpath and tpath based in the needs of the bfile.
- */
-static void fill_paths(BFILE *bfile, const char *path, const char *relpath) {
- char* source_path = NULL;
- char* temp_path = NULL;
- int bflags = bfile->uflags;
-
- if (bflags & BFILE_NORMAL || bflags & BFILE_RAW) {
-// bfile->fpath is path with // replaced
- }
- if (bflags & BFILE_TEMP) {
- temp_path = MEM_mallocN(MAXPATHLEN, "bfile-fpath-1");
- snprintf(temp_path, MAXPATHLEN, "%s/%s", getenv("BLENDER_TEMP"), path);
- bfile->fpath = temp_path;
- }
- if (bflags & (BFILE_CONFIG_BASE | BFILE_CONFIG_DATAFILES |
- BFILE_CONFIG_PYTHON | BFILE_CONFIG_PLUGINS)) {
-// evars
-// bfile->fpath is userdir+version+path
-// source_path is first hit in (if using fallback to older versions)
-// userdir+curversion+path (... userdir+limitversion+path) sysdir+path
-// (limitversion is based in path, using some kind of regex or "tables")
- }
-
- if (bfile->classf & BCF_WRITE && !(bflags & BFILE_RAW)) {
- /* Generate random named path */
- temp_path = MEM_mallocN(MAXPATHLEN, "bfile-fpath-2");
- snprintf(temp_path, MAXPATHLEN, "%s.XXXXXX", path);
- bfile->fd = mkstemp(temp_path);
- bfile->tpath = temp_path;
- /* It will be reopened in upper levels, later */
- close(bfile->fd);
- if (!(bfile->classf & BCF_DISCARD)) {
- /* Copy original data into temp location */
- if (source_path) {
- BLI_copy_fileops(source_path, bfile->tpath);
- } else {
- BLI_copy_fileops(bfile->fpath, bfile->tpath);
- }
- }
- } else {
- bfile->tpath = bfile->fpath;
- }
-}
-
-
-/**
- Free memory used for path strings.
- */
-static void free_paths(BFILE* bfile) {
- if (bfile->fpath) {
- MEM_freeN(bfile->fpath);
- }
- if (bfile->tpath) {
- MEM_freeN(bfile->tpath);
- }
-}
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c
index 290fd1ff325..61cec1f7486 100644
--- a/source/blender/blenlib/intern/bpath.c
+++ b/source/blender/blenlib/intern/bpath.c
@@ -81,7 +81,7 @@ enum BPathTypes {
BPATH_DONE
};
-void BLI_bpathIterator_init( struct BPathIterator *bpi, char *base_path ) {
+void BLI_bpathIterator_init( struct BPathIterator *bpi, const char *base_path ) {
bpi->type = BPATH_IMAGE;
bpi->data = NULL;
@@ -119,7 +119,7 @@ void BLI_bpathIterator_getPath( struct BPathIterator *bpi, char *path) {
}
}
-void BLI_bpathIterator_setPath( struct BPathIterator *bpi, char *path) {
+void BLI_bpathIterator_setPath( struct BPathIterator *bpi, const char *path) {
if (bpi->setpath_callback) {
bpi->setpath_callback( bpi, path );
} else {
@@ -128,7 +128,7 @@ void BLI_bpathIterator_setPath( struct BPathIterator *bpi, char *path) {
}
void BLI_bpathIterator_getPathExpanded( struct BPathIterator *bpi, char *path_expanded) {
- char *libpath;
+ const char *libpath;
BLI_bpathIterator_getPath(bpi, path_expanded);
libpath = BLI_bpathIterator_getLib(bpi);
@@ -140,10 +140,10 @@ void BLI_bpathIterator_getPathExpanded( struct BPathIterator *bpi, char *path_ex
}
BLI_cleanup_file(NULL, path_expanded);
}
-char* BLI_bpathIterator_getLib( struct BPathIterator *bpi) {
+const char* BLI_bpathIterator_getLib( struct BPathIterator *bpi) {
return bpi->lib;
}
-char* BLI_bpathIterator_getName( struct BPathIterator *bpi) {
+const char* BLI_bpathIterator_getName( struct BPathIterator *bpi) {
return bpi->name;
}
int BLI_bpathIterator_getType( struct BPathIterator *bpi) {
@@ -308,7 +308,7 @@ static void seq_getpath(struct BPathIterator *bpi, char *path) {
}
}
-static void seq_setpath(struct BPathIterator *bpi, char *path) {
+static void seq_setpath(struct BPathIterator *bpi, const char *path) {
Sequence *seq = (Sequence *)bpi->data;
if (seq==NULL) return;
@@ -490,7 +490,7 @@ int BLI_bpathIterator_isDone( struct BPathIterator *bpi) {
static void bpath_as_report(struct BPathIterator *bpi, const char *message, ReportList *reports)
{
char *prefix;
- char *name;
+ const char *name;
char path_expanded[FILE_MAXDIR*2];
if(reports==NULL)
@@ -534,7 +534,7 @@ static void bpath_as_report(struct BPathIterator *bpi, const char *message, Repo
}
/* high level function */
-void checkMissingFiles(char *basepath, ReportList *reports) {
+void checkMissingFiles(const char *basepath, ReportList *reports) {
struct BPathIterator bpi;
/* be sure there is low chance of the path being too short */
@@ -553,10 +553,11 @@ void checkMissingFiles(char *basepath, ReportList *reports) {
}
/* dont log any errors at the moment, should probably do this */
-void makeFilesRelative(char *basepath, ReportList *reports) {
+void makeFilesRelative(const char *basepath, ReportList *reports) {
int tot= 0, changed= 0, failed= 0, linked= 0;
struct BPathIterator bpi;
- char filepath[FILE_MAX], *libpath;
+ 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];
@@ -601,12 +602,13 @@ void makeFilesRelative(char *basepath, ReportList *reports) {
/* dont log any errors at the moment, should probably do this -
* Verry similar to makeFilesRelative - keep in sync! */
-void makeFilesAbsolute(char *basepath, ReportList *reports)
+void makeFilesAbsolute(const char *basepath, ReportList *reports)
{
int tot= 0, changed= 0, failed= 0, linked= 0;
struct BPathIterator bpi;
- char filepath[FILE_MAX], *libpath;
+ 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];
@@ -702,12 +704,13 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char
}
/* high level function - call from fileselector */
-void findMissingFiles(char *basepath, char *str) {
+void findMissingFiles(const char *basepath, 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], *libpath;
+ char filepath[FILE_MAX];
+ const char *libpath;
int filesize, recur_depth;
char dirname[FILE_MAX], filename_new[FILE_MAX];
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index 180cfdbbc5a..931dd6119a2 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -143,7 +143,7 @@ int BLI_touch(const char *file)
return 0;
}
-int BLI_exists(char *file) {
+int BLI_exists(const char *file) {
return BLI_exist(file);
}
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 58fb3b9b76b..d2bd7a0a2b1 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -25,7 +25,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-
+#include <assert.h>
#include "BLI_math.h"
/********************************* Init **************************************/
@@ -1041,6 +1041,8 @@ void rotate_m4(float mat[][4], const char axis, const float angle)
float temp[4]= {0.0f, 0.0f, 0.0f, 0.0f};
float cosine, sine;
+ assert(axis >= 'X' && axis <= 'Z');
+
cosine = (float)cos(angle);
sine = (float)sin(angle);
switch(axis){
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 2d0e347b2e6..5f6f7ac54d9 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -26,6 +26,7 @@
* */
+#include <assert.h>
#include "BLI_math.h"
/******************************** Quaternions ********************************/
@@ -365,6 +366,9 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
{
float q2[4], nor[3], *fp, mat[3][3], angle, si, co, x2, y2, z2, len1;
+ assert(axis >= 0 && axis <= 5);
+ assert(upflag >= 0 && upflag <= 2);
+
/* first rotate to axis */
if(axis>2) {
x2= vec[0] ; y2= vec[1] ; z2= vec[2];
@@ -946,7 +950,9 @@ void eul_to_quat(float *quat, const float eul[3])
void rotate_eul(float *beul, const char axis, const float ang)
{
float eul[3], mat1[3][3], mat2[3][3], totmat[3][3];
-
+
+ assert(axis >= 'X' && axis <= 'Z');
+
eul[0]= eul[1]= eul[2]= 0.0f;
if(axis=='X') eul[0]= ang;
else if(axis=='Y') eul[1]= ang;
@@ -1084,7 +1090,7 @@ static RotOrderInfo rotOrders[]= {
* NOTE: since we start at 1 for the values, but arrays index from 0,
* there is -1 factor involved in this process...
*/
-#define GET_ROTATIONORDER_INFO(order) (((order)>=1) ? &rotOrders[(order)-1] : &rotOrders[0])
+#define GET_ROTATIONORDER_INFO(order) (assert(order>=0 && order<=6), (order < 1) ? &rotOrders[0] : &rotOrders[(order)-1])
/* Construct quaternion from Euler angles (in radians). */
void eulO_to_quat(float q[4], const float e[3], const short order)
@@ -1266,7 +1272,9 @@ void mat4_to_compatible_eulO(float eul[3], float oldrot[3], short order,float M[
void rotate_eulO(float beul[3], short order, char axis, float ang)
{
float eul[3], mat1[3][3], mat2[3][3], totmat[3][3];
-
+
+ assert(axis >= 'X' && axis <= 'Z');
+
eul[0]= eul[1]= eul[2]= 0.0f;
if (axis=='X')
eul[0]= ang;
@@ -1544,6 +1552,9 @@ void quat_apply_track(float quat[4], short axis, short upflag)
{0.5, -0.5, -0.5, 0.5}, /* Quaternion((1,0,0), radians(-90)) * Quaternion((0,1,0), radians(-90)) */
{-3.0908619663705394e-08, 0.70710676908493, 0.70710676908493, 3.0908619663705394e-08}}; /* no rotation */
+ assert(axis >= 0 && axis <= 5);
+ assert(upflag >= 0 && upflag <= 2);
+
mul_qt_qtqt(quat, quat, quat_track[axis]);
if(axis>2)
@@ -1564,6 +1575,8 @@ void vec_apply_track(float vec[3], short axis)
{
float tvec[3];
+ assert(axis >= 0 && axis <= 5);
+
copy_v3_v3(tvec, vec);
switch(axis) {
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index a45356f0bde..6bccb0045fa 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -149,6 +149,23 @@ MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
r[2]= a[2] - b[2];
}
+MINLINE void sub_v4_v4(float r[4], const float a[4])
+{
+ r[0] -= a[0];
+ r[1] -= a[1];
+ r[2] -= a[2];
+ r[3] -= a[3];
+}
+
+MINLINE void sub_v4_v4v4(float r[3], const float a[3], const float b[3])
+{
+ r[0]= a[0] - b[0];
+ r[1]= a[1] - b[1];
+ r[2]= a[2] - b[2];
+ r[3]= a[3] - b[3];
+}
+
+
MINLINE void mul_v2_fl(float *v1, float f)
{
v1[0]*= f;
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 466012eb9b8..a87617868d1 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -32,6 +32,7 @@
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
+#include <assert.h>
#include "MEM_guardedalloc.h"
@@ -76,6 +77,7 @@
#endif /* WIN32 */
/* local */
+#define UNIQUE_NAME_MAX 128
static int add_win32_extension(char *name);
static char *blender_version_decimal(void);
@@ -138,7 +140,7 @@ void BLI_stringenc(char *string, const char *head, const char *tail, unsigned sh
/* Foo.001 -> "Foo", 1
* Returns the length of "Foo" */
-int BLI_split_name_num(char *left, int *nr, const char *name)
+int BLI_split_name_num(char *left, int *nr, const char *name, const char delim)
{
int a;
@@ -146,10 +148,10 @@ int BLI_split_name_num(char *left, int *nr, const char *name)
a= strlen(name);
memcpy(left, name, (a + 1) * sizeof(char));
- if(a>1 && name[a-1]=='.') return a;
+ if(a>1 && name[a-1]==delim) return a;
while(a--) {
- if( name[a]=='.' ) {
+ if( name[a]==delim ) {
left[a]= 0;
*nr= atol(name+a+1);
/* casting down to an int, can overflow for large numbers */
@@ -170,7 +172,7 @@ int BLI_split_name_num(char *left, int *nr, const char *name)
void BLI_newname(char *name, int add)
{
- char head[128], tail[128];
+ char head[UNIQUE_NAME_MAX], tail[UNIQUE_NAME_MAX];
int pic;
unsigned short digits;
@@ -190,13 +192,43 @@ void BLI_newname(char *name, int add)
BLI_stringenc(name, head, tail, digits, pic);
}
+
+
+int BLI_uniquename_cb(int (*unique_check)(void *, const char *), void *arg, const char defname[], char delim, char *name, short name_len)
+{
+ if(name == '\0') {
+ BLI_strncpy(name, defname, name_len);
+ }
+
+ if(unique_check(arg, name)) {
+ char tempname[UNIQUE_NAME_MAX];
+ char left[UNIQUE_NAME_MAX];
+ int number;
+ int len= BLI_split_name_num(left, &number, name, delim);
+ do {
+ int newlen= BLI_snprintf(tempname, name_len, "%s%c%03d", left, delim, number);
+ if(newlen >= name_len) {
+ len -= ((newlen + 1) - name_len);
+ if(len < 0) len= number= 0;
+ left[len]= '\0';
+ }
+ } while(number++, unique_check(arg, tempname));
+
+ BLI_strncpy(name, tempname, name_len);
+
+ return 1;
+ }
+
+ return 0;
+}
+
/* little helper macro for BLI_uniquename */
#ifndef GIVE_STRADDR
#define GIVE_STRADDR(data, offset) ( ((char *)data) + offset )
#endif
/* Generic function to set a unique name. It is only designed to be used in situations
- * where the name is part of the struct, and also that the name is at most 128 chars long.
+ * where the name is part of the struct, and also that the name is at most UNIQUE_NAME_MAX chars long.
*
* For places where this is used, see constraint.c for example...
*
@@ -220,42 +252,30 @@ static int uniquename_find_dupe(ListBase *list, void *vlink, const char *name, s
return 0;
}
+static int uniquename_unique_check(void *arg, const char *name)
+{
+ struct {ListBase *lb; void *vlink; short name_offs;} *data= arg;
+ return uniquename_find_dupe(data->lb, data->vlink, name, data->name_offs);
+}
+
void BLI_uniquename(ListBase *list, void *vlink, const char defname[], char delim, short name_offs, short name_len)
-{
- /* Make sure length can be handled */
- if ((name_len < 0) || (name_len > 128))
- return;
-
+{
+ struct {ListBase *lb; void *vlink; short name_offs;} data;
+ data.lb= list;
+ data.vlink= vlink;
+ data.name_offs= name_offs;
+
+ assert((name_len > 1) && (name_len <= UNIQUE_NAME_MAX));
+
/* See if we are given an empty string */
if (ELEM(NULL, vlink, defname))
return;
-
- if (GIVE_STRADDR(vlink, name_offs) == '\0') {
- /* give it default name first */
- BLI_strncpy(GIVE_STRADDR(vlink, name_offs), defname, name_len);
- }
-
- /* See if we even need to do this */
- if (list == NULL)
- return;
- if(uniquename_find_dupe(list,vlink, GIVE_STRADDR(vlink, name_offs), name_offs)) {
- /* note: this block is used in other places, when changing logic apply to all others, search this message */
- char tempname[128];
- char left[128];
- int number;
- int len= BLI_split_name_num(left, &number, GIVE_STRADDR(vlink, name_offs));
- do { /* nested while loop looks bad but likely it wont run most times */
- while(BLI_snprintf(tempname, name_len, "%s%c%03d", left, delim, number) >= name_len) {
- if(len > 0) left[--len]= '\0'; /* word too long */
- else number= 0; /* reset, must be a massive number */
- }
- } while(number++, uniquename_find_dupe(list, vlink, tempname, name_offs));
-
- BLI_strncpy(GIVE_STRADDR(vlink, name_offs), tempname, name_len);
- }
+ BLI_uniquename_cb(uniquename_unique_check, &data, defname, delim, GIVE_STRADDR(vlink, name_offs), name_len);
}
+
+
/* ******************** string encoding ***************** */
/* This is quite an ugly function... its purpose is to
@@ -595,9 +615,18 @@ int BLI_path_frame_range(char *path, int sta, int end, int digits)
if (stringframe_chars(path, &ch_sta, &ch_end)) { /* warning, ch_end is the last # +1 */
char tmp[FILE_MAX], format[64];
+#if 0 // neat but breaks on non ascii strings.
sprintf(format, "%%.%ds%%.%dd_%%.%dd%%s", ch_sta, ch_end-ch_sta, ch_end-ch_sta); /* example result: "%.12s%.5d-%.5d%s" */
sprintf(tmp, format, path, sta, end, path+ch_end);
strcpy(path, tmp);
+#else
+ char *tmp_pt;
+ BLI_snprintf(format, sizeof(format), "%%.%dd-%%.%dd%%s", digits, digits);
+ memcpy(tmp, path, ch_sta * sizeof(char));
+ tmp_pt = &tmp[ch_sta];
+ tmp_pt += BLI_snprintf(tmp_pt, sizeof(tmp)-ch_sta, format, sta, end, &path[ch_end]);
+ memcpy(path, tmp, (int)(tmp_pt - tmp) + 1);
+#endif
return 1;
}
return 0;
@@ -825,7 +854,7 @@ static char *blender_version_decimal(void)
return version_str;
}
-static int test_path(char *targetpath, char *path_base, char *path_sep, char *folder_name)
+static int test_path(char *targetpath, const char *path_base, const char *path_sep, const char *folder_name)
{
char tmppath[FILE_MAX];
@@ -849,7 +878,7 @@ static int test_path(char *targetpath, char *path_base, char *path_sep, char *fo
}
}
-static int test_env_path(char *path, char *envvar)
+static int test_env_path(char *path, const char *envvar)
{
char *env = envvar?getenv(envvar):NULL;
if (!env) return 0;
@@ -863,7 +892,7 @@ static int test_env_path(char *path, char *envvar)
}
}
-static int get_path_local(char *targetpath, char *folder_name, char *subfolder_name)
+static int get_path_local(char *targetpath, const char *folder_name, const char *subfolder_name)
{
extern char bprogname[]; /* argv[0] from creator.c */
char bprogdir[FILE_MAX];
@@ -889,7 +918,7 @@ static int get_path_local(char *targetpath, char *folder_name, char *subfolder_n
return 0;
}
-static int get_path_user(char *targetpath, char *folder_name, char *subfolder_name, char *envvar)
+static int get_path_user(char *targetpath, const char *folder_name, const char *subfolder_name, const char *envvar)
{
char user_path[FILE_MAX];
const char *user_base_path;
@@ -926,7 +955,7 @@ static int get_path_user(char *targetpath, char *folder_name, char *subfolder_na
}
}
-static int get_path_system(char *targetpath, char *folder_name, char *subfolder_name, char *envvar)
+static int get_path_system(char *targetpath, const char *folder_name, const char *subfolder_name, const char *envvar)
{
char system_path[FILE_MAX];
const char *system_base_path;
@@ -993,7 +1022,7 @@ static int get_path_system(char *targetpath, char *folder_name, char *subfolder_
/* get a folder out of the 'folder_id' presets for paths */
/* returns the path if found, NULL string if not */
-char *BLI_get_folder(int folder_id, char *subfolder)
+char *BLI_get_folder(int folder_id, const char *subfolder)
{
static char path[FILE_MAX] = "";
@@ -1065,7 +1094,7 @@ char *BLI_get_folder(int folder_id, char *subfolder)
return path;
}
-char *BLI_get_user_folder_notest(int folder_id, char *subfolder)
+char *BLI_get_user_folder_notest(int folder_id, const char *subfolder)
{
static char path[FILE_MAX] = "";
@@ -1089,7 +1118,7 @@ char *BLI_get_user_folder_notest(int folder_id, char *subfolder)
return path;
}
-char *BLI_get_folder_create(int folder_id, char *subfolder)
+char *BLI_get_folder_create(int folder_id, const char *subfolder)
{
char *path;
@@ -1197,7 +1226,7 @@ void BLI_make_exist(char *dir) {
}
}
-void BLI_make_existing_file(char *name)
+void BLI_make_existing_file(const char *name)
{
char di[FILE_MAXDIR+FILE_MAXFILE], fi[FILE_MAXFILE];
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 9c31557619b..7144a7dce34 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -146,7 +146,7 @@ int BLI_compare(struct direntry *entry1, struct direntry *entry2)
}
-double BLI_diskfree(char *dir)
+double BLI_diskfree(const char *dir)
{
#ifdef WIN32
DWORD sectorspc, bytesps, freec, clusters;
@@ -201,7 +201,7 @@ double BLI_diskfree(char *dir)
#endif
}
-void BLI_builddir(char *dirname, char *relname)
+void BLI_builddir(const char *dirname, char *relname)
{
struct dirent *fname;
struct dirlink *dlink;
@@ -397,7 +397,7 @@ void BLI_adddirstrings()
}
}
-unsigned int BLI_getdir(char *dirname, struct direntry **filelist)
+unsigned int BLI_getdir(const char *dirname, struct direntry **filelist)
{
// reset global variables
// memory stored in files is free()'d in
@@ -443,7 +443,7 @@ size_t BLI_filepathsize(const char *path)
}
-int BLI_exist(char *name)
+int BLI_exist(const char *name)
{
#if defined(WIN32) && !defined(__MINGW32__)
struct _stat64i32 st;
@@ -474,7 +474,7 @@ int BLI_exist(char *name)
}
/* would be better in fileops.c except that it needs stat.h so add here */
-int BLI_is_dir(char *file) {
+int BLI_is_dir(const char *file) {
return S_ISDIR(BLI_exist(file));
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 2700c09ce4f..319022e2d1a 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3706,6 +3706,9 @@ static void direct_link_pose(FileData *fd, bPose *pose)
pchan->iktree.first= pchan->iktree.last= NULL;
pchan->path= NULL;
+
+ /* incase this value changes in future, clamp else we get undefined behavior */
+ CLAMP(pchan->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
}
pose->ikdata = NULL;
if (pose->ikparam != NULL) {
@@ -4112,6 +4115,9 @@ static void direct_link_object(FileData *fd, Object *ob)
ob->gpulamp.first= ob->gpulamp.last= NULL;
link_list(fd, &ob->pc_ids);
+ /* incase this value changes in future, clamp else we get undefined behavior */
+ CLAMP(ob->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
+
if(ob->sculpt) {
ob->sculpt= MEM_callocN(sizeof(SculptSession), "reload sculpt session");
ob->sculpt->ob= ob;
@@ -4160,7 +4166,6 @@ static void lib_link_scene(FileData *fd, Main *main)
sce->camera= newlibadr(fd, sce->id.lib, sce->camera);
sce->world= newlibadr_us(fd, sce->id.lib, sce->world);
sce->set= newlibadr(fd, sce->id.lib, sce->set);
- sce->ima= newlibadr_us(fd, sce->id.lib, sce->ima);
sce->gpd= newlibadr_us(fd, sce->id.lib, sce->gpd);
link_paint(fd, sce, &sce->toolsettings->sculpt->paint);
@@ -8315,7 +8320,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if(arm->layer==0) arm->layer= 1;
}
for(sce= main->scene.first; sce; sce= sce->id.next) {
- if(sce->jumpframe==0) sce->jumpframe= 10;
if(sce->audio.mixrate==0) sce->audio.mixrate= 44100;
if(sce->r.xparts<2) sce->r.xparts= 4;
@@ -10495,31 +10499,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
- /* clear hanging 'temp' screens from older 2.5 files*/
- if (main->versionfile == 250) {
- bScreen *screen, *nextscreen;
- wmWindowManager *wm;
- wmWindow *win, *nextwin;
-
- for(screen= main->screen.first; screen; screen= nextscreen) {
- nextscreen= screen->id.next;
-
- if (screen->full == SCREENTEMP) {
- /* remove corresponding windows */
- for(wm= main->wm.first; wm; wm=wm->id.next) {
- for(win= wm->windows.first; win; win=nextwin) {
- nextwin= win->next;
-
- if(newlibadr(fd, wm->id.lib, win->screen) == screen)
- BLI_freelinkN(&wm->windows, win);
- }
- }
-
- /* remove screen itself */
- free_libblock(&main->screen, screen);
- }
- }
- }
}
if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 9))
@@ -11288,6 +11267,35 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
+ {
+ bScreen *sc;
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl;
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype == SPACE_INFO) {
+ SpaceInfo *sinfo= (SpaceInfo *)sl;
+ ARegion *ar;
+
+ sinfo->rpt_mask= INFO_RPT_OP;
+
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ ar->v2d.scroll = (V2D_SCROLL_RIGHT);
+ ar->v2d.align = V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y; /* align bottom left */
+ ar->v2d.keepofs = V2D_LOCKOFS_X;
+ ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
+ ar->v2d.keeptot= V2D_KEEPTOT_BOUNDS;
+ ar->v2d.minzoom= ar->v2d.maxzoom= 1.0f;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index c7267bd46f8..d462042b3f6 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -403,7 +403,7 @@ void AnimationImporter::read_node_transform(COLLADAFW::Node *node, Object *ob)
TransformReader::get_node_mat(mat, node, &uid_animated_map, ob);
if (ob) {
copy_m4_m4(ob->obmat, mat);
- object_apply_mat4(ob, ob->obmat, 0);
+ object_apply_mat4(ob, ob->obmat, 0, 0);
}
}
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index 86609d11c02..fc3ae1ac8c2 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -375,27 +375,36 @@ public:
COLLADAFW::InstanceLightPointerArray &lamp = node->getInstanceLights();
COLLADAFW::InstanceControllerPointerArray &controller = node->getInstanceControllers();
COLLADAFW::InstanceNodePointerArray &inst_node = node->getInstanceNodes();
+ int geom_done = 0;
+ int camera_done = 0;
+ int lamp_done = 0;
+ int controller_done = 0;
+ int inst_done = 0;
// XXX linking object with the first <instance_geometry>, though a node may have more of them...
// maybe join multiple <instance_...> meshes into 1, and link object with it? not sure...
// <instance_geometry>
- if (geom.getCount() != 0) {
- ob = mesh_importer.create_mesh_object(node, geom[0], false, uid_material_map,
+ while (geom_done < geom.getCount()) {
+ ob = mesh_importer.create_mesh_object(node, geom[geom_done], false, uid_material_map,
material_texture_mapping_map);
+ ++geom_done;
}
- else if (camera.getCount() != 0) {
- ob = create_camera_object(camera[0], sce);
+ while (camera_done < camera.getCount()) {
+ ob = create_camera_object(camera[camera_done], sce);
+ ++camera_done;
}
- else if (lamp.getCount() != 0) {
- ob = create_lamp_object(lamp[0], sce);
+ while (lamp_done < lamp.getCount()) {
+ ob = create_lamp_object(lamp[lamp_done], sce);
+ ++lamp_done;
}
- else if (controller.getCount() != 0) {
- COLLADAFW::InstanceGeometry *geom = (COLLADAFW::InstanceGeometry*)controller[0];
+ while (controller_done < controller.getCount()) {
+ COLLADAFW::InstanceGeometry *geom = (COLLADAFW::InstanceGeometry*)controller[controller_done];
ob = mesh_importer.create_mesh_object(node, geom, true, uid_material_map, material_texture_mapping_map);
+ ++controller_done;
}
// XXX instance_node is not supported yet
- else if (inst_node.getCount() != 0) {
- const COLLADAFW::UniqueId& node_id = inst_node[0]->getInstanciatedObjectId();
+ while (inst_done < inst_node.getCount()) {
+ const COLLADAFW::UniqueId& node_id = inst_node[inst_done]->getInstanciatedObjectId();
if (object_map.find(node_id) == object_map.end()) {
fprintf(stderr, "Cannot find node to instanciate.\n");
ob = NULL;
@@ -406,10 +415,11 @@ public:
ob = create_instance_node(source_ob, source_node, node, sce, is_library_node);
}
+ ++inst_done;
}
// if node is empty - create empty object
// XXX empty node may not mean it is empty object, not sure about this
- else {
+ if ( (geom_done + camera_done + lamp_done + controller_done + inst_done) < 1) {
ob = add_object(sce, OB_EMPTY);
}
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index 1aef6e6489a..7b5b5397955 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -63,6 +63,11 @@ void GeometryExporter::operator()(Object *ob)
std::vector<Normal> nor;
std::vector<Face> norind;
+ // Skip if linked geometry was already exported from another reference
+ if (exportedGeometry.find(geom_id) != exportedGeometry.end())
+ return;
+ exportedGeometry.insert(geom_id);
+
bool has_color = (bool)CustomData_has_layer(&me->fdata, CD_MCOL);
create_normals(nor, norind, me);
diff --git a/source/blender/collada/GeometryExporter.h b/source/blender/collada/GeometryExporter.h
index 7a78b676f49..27c837418b1 100644
--- a/source/blender/collada/GeometryExporter.h
+++ b/source/blender/collada/GeometryExporter.h
@@ -28,6 +28,7 @@
#include <string>
#include <vector>
+#include <set>
#include "COLLADASWStreamWriter.h"
#include "COLLADASWLibraryGeometries.h"
@@ -89,6 +90,8 @@ public:
COLLADASW::URI makeUrl(std::string id);
/* int getTriCount(MFace *faces, int totface);*/
+private:
+ std::set<std::string> exportedGeometry;
};
struct GeometryFunctor {
diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp
index b052f283e62..97d12f10c05 100644
--- a/source/blender/collada/SkinInfo.cpp
+++ b/source/blender/collada/SkinInfo.cpp
@@ -215,7 +215,7 @@ void SkinInfo::link_armature(bContext *C, Object *ob, std::map<COLLADAFW::Unique
((ArmatureModifierData *)md)->object = ob_arm;
copy_m4_m4(ob->obmat, bind_shape_matrix);
- object_apply_mat4(ob, ob->obmat, 0);
+ object_apply_mat4(ob, ob->obmat, 0, 0);
#if 1
bc_set_parent(ob, ob_arm, C);
#else
diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp
index 6f401c1856f..4943aa96546 100644
--- a/source/blender/collada/collada_internal.cpp
+++ b/source/blender/collada/collada_internal.cpp
@@ -247,7 +247,7 @@ std::string id_name(void *id)
std::string get_geometry_id(Object *ob)
{
- return translate_id(id_name(ob)) + "-mesh";
+ return translate_id(id_name(ob->data)) + "-mesh";
}
std::string get_light_id(Object *ob)
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index 98728001eb8..b6451c58a01 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -88,7 +88,7 @@ int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space)
}
// apply child obmat (i.e. decompose it into rot/loc/size)
- object_apply_mat4(ob, ob->obmat, 0);
+ object_apply_mat4(ob, ob->obmat, 0, 0);
// compute parentinv
what_does_parent(sce, ob, &workob);
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index a471879540c..09083e77fe1 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -25,7 +25,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-
+#include <stdio.h>
#include "MEM_guardedalloc.h"
@@ -62,6 +62,7 @@
#include "ED_keyframing.h"
#include "BIF_gl.h"
+#include "BIF_glutil.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -2863,6 +2864,17 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float
offset += 3;
UI_DrawString(offset, ytext, name);
+
+ /* draw red underline if channel is disabled */
+ if ((ale->type == ANIMTYPE_FCURVE) && (ale->flag & FCURVE_DISABLED))
+ {
+ // FIXME: replace hardcoded color here, and check on extents!
+ glColor3f(1.0f, 0.0f, 0.0f);
+ glLineWidth(2.0);
+ fdrawline((float)(offset), yminc,
+ (float)(v2d->cur.xmax), yminc);
+ glLineWidth(1.0);
+ }
}
/* step 6) draw backdrops behidn mute+protection toggles + (sliders) ....................... */
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 9464f6b2768..7fbf40bfb1a 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -25,6 +25,10 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
@@ -544,94 +548,29 @@ int animedit_poll_channels_nla_tweakmode_off (bContext *C)
}
/* ****************** Rearrange Channels Operator ******************* */
-/* This operator only works for Action Editor mode for now, as having it elsewhere makes things difficult */
-
-#if 0 // XXX old animation system - needs to be updated for new system...
/* constants for channel rearranging */
/* WARNING: don't change exising ones without modifying rearrange func accordingly */
enum {
- REARRANGE_ACTCHAN_TOP= -2,
- REARRANGE_ACTCHAN_UP= -1,
- REARRANGE_ACTCHAN_DOWN= 1,
- REARRANGE_ACTCHAN_BOTTOM= 2
+ REARRANGE_ANIMCHAN_TOP= -2,
+ REARRANGE_ANIMCHAN_UP= -1,
+ REARRANGE_ANIMCHAN_DOWN= 1,
+ REARRANGE_ANIMCHAN_BOTTOM= 2
};
-/* make sure all action-channels belong to a group (and clear action's list) */
-static void split_groups_action_temp (bAction *act, bActionGroup *tgrp)
-{
- bActionChannel *achan;
- bActionGroup *agrp;
-
- /* Separate action-channels into lists per group */
- for (agrp= act->groups.first; agrp; agrp= agrp->next) {
- if (agrp->channels.first) {
- achan= agrp->channels.last;
- act->chanbase.first= achan->next;
-
- achan= agrp->channels.first;
- achan->prev= NULL;
-
- achan= agrp->channels.last;
- achan->next= NULL;
- }
- }
-
- /* Initialise memory for temp-group */
- memset(tgrp, 0, sizeof(bActionGroup));
- tgrp->flag |= (AGRP_EXPANDED|AGRP_TEMP);
- strcpy(tgrp->name, "#TempGroup");
-
- /* Move any action-channels not already moved, to the temp group */
- if (act->chanbase.first) {
- /* start of list */
- achan= act->chanbase.first;
- achan->prev= NULL;
- tgrp->channels.first= achan;
- act->chanbase.first= NULL;
-
- /* end of list */
- achan= act->chanbase.last;
- achan->next= NULL;
- tgrp->channels.last= achan;
- act->chanbase.last= NULL;
- }
-
- /* Add temp-group to list */
- BLI_addtail(&act->groups, tgrp);
-}
-
-/* link lists of channels that groups have */
-static void join_groups_action_temp (bAction *act)
-{
- bActionGroup *agrp;
- bActionChannel *achan;
-
- for (agrp= act->groups.first; agrp; agrp= agrp->next) {
- ListBase tempGroup;
-
- /* add list of channels to action's channels */
- tempGroup= agrp->channels;
- addlisttolist(&act->chanbase, &agrp->channels);
- agrp->channels= tempGroup;
-
- /* clear moved flag */
- agrp->flag &= ~AGRP_MOVED;
-
- /* if temp-group... remove from list (but don't free as it's on the stack!) */
- if (agrp->flag & AGRP_TEMP) {
- BLI_remlink(&act->groups, agrp);
- break;
- }
- }
-
- /* clear "moved" flag from all achans */
- for (achan= act->chanbase.first; achan; achan= achan->next)
- achan->flag &= ~ACHAN_MOVED;
-}
+/* defines for rearranging channels */
+EnumPropertyItem prop_animchannel_rearrange_types[] = {
+ {REARRANGE_ANIMCHAN_TOP, "TOP", 0, "To Top", ""},
+ {REARRANGE_ANIMCHAN_UP, "UP", 0, "Up", ""},
+ {REARRANGE_ANIMCHAN_DOWN, "DOWN", 0, "Down", ""},
+ {REARRANGE_ANIMCHAN_BOTTOM, "BOTTOM", 0, "To Bottom", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+/* Rearrange Utilities --------------------------------------------- */
-static short rearrange_actchannel_is_ok (Link *channel, short type)
+/* checks if a channel should be considered for moving */
+static short rearrange_animchannel_is_ok (Link *channel, short type)
{
if (type == ANIMTYPE_GROUP) {
bActionGroup *agrp= (bActionGroup *)channel;
@@ -639,17 +578,25 @@ static short rearrange_actchannel_is_ok (Link *channel, short type)
if (SEL_AGRP(agrp) && !(agrp->flag & AGRP_MOVED))
return 1;
}
- else if (type == ANIMTYPE_ACHAN) {
- bActionChannel *achan= (bActionChannel *)channel;
+ else if (type == ANIMTYPE_FCURVE) {
+ FCurve *fcu= (FCurve *)channel;
+
+ // FIXME: F-Curve visibility is difficult... needs special filtering tests these days...
+ if (SEL_FCU(fcu) && !(fcu->flag & FCURVE_TAGGED))
+ return 1;
+ }
+ else if (type == ANIMTYPE_NLATRACK) {
+ NlaTrack *nlt = (NlaTrack *)channel;
- if (VISIBLE_ACHAN(achan) && SEL_ACHAN(achan) && !(achan->flag & ACHAN_MOVED))
+ if (SEL_NLT(nlt) && !(nlt->flag & NLASTRIP_FLAG_EDIT_TOUCHED))
return 1;
}
return 0;
}
-static short rearrange_actchannel_after_ok (Link *channel, short type)
+/* checks if another channel can be placed after the given one */
+static short rearrange_animchannel_after_ok (Link *channel, short type)
{
if (type == ANIMTYPE_GROUP) {
bActionGroup *agrp= (bActionGroup *)channel;
@@ -661,10 +608,11 @@ static short rearrange_actchannel_after_ok (Link *channel, short type)
return 1;
}
+/* Rearrange Methods --------------------------------------------- */
-static short rearrange_actchannel_top (ListBase *list, Link *channel, short type)
+static short rearrange_animchannel_top (ListBase *list, Link *channel, short type)
{
- if (rearrange_actchannel_is_ok(channel, type)) {
+ if (rearrange_animchannel_is_ok(channel, type)) {
/* take it out off the chain keep data */
BLI_remlink(list, channel);
@@ -677,9 +625,9 @@ static short rearrange_actchannel_top (ListBase *list, Link *channel, short type
return 0;
}
-static short rearrange_actchannel_up (ListBase *list, Link *channel, short type)
+static short rearrange_animchannel_up (ListBase *list, Link *channel, short type)
{
- if (rearrange_actchannel_is_ok(channel, type)) {
+ if (rearrange_animchannel_is_ok(channel, type)) {
Link *prev= channel->prev;
if (prev) {
@@ -696,9 +644,9 @@ static short rearrange_actchannel_up (ListBase *list, Link *channel, short type)
return 0;
}
-static short rearrange_actchannel_down (ListBase *list, Link *channel, short type)
+static short rearrange_animchannel_down (ListBase *list, Link *channel, short type)
{
- if (rearrange_actchannel_is_ok(channel, type)) {
+ if (rearrange_animchannel_is_ok(channel, type)) {
Link *next = (channel->next) ? channel->next->next : NULL;
if (next) {
@@ -710,7 +658,7 @@ static short rearrange_actchannel_down (ListBase *list, Link *channel, short typ
return 1;
}
- else if (rearrange_actchannel_after_ok(list->last, type)) {
+ else if (rearrange_animchannel_after_ok(list->last, type)) {
/* take it out off the chain keep data */
BLI_remlink(list, channel);
@@ -733,10 +681,10 @@ static short rearrange_actchannel_down (ListBase *list, Link *channel, short typ
return 0;
}
-static short rearrange_actchannel_bottom (ListBase *list, Link *channel, short type)
+static short rearrange_animchannel_bottom (ListBase *list, Link *channel, short type)
{
- if (rearrange_actchannel_is_ok(channel, type)) {
- if (rearrange_actchannel_after_ok(list->last, type)) {
+ if (rearrange_animchannel_is_ok(channel, type)) {
+ if (rearrange_animchannel_after_ok(list->last, type)) {
/* take it out off the chain keep data */
BLI_remlink(list, channel);
@@ -750,51 +698,237 @@ static short rearrange_actchannel_bottom (ListBase *list, Link *channel, short t
return 0;
}
+/* Generic Stuff ---------------------------------------------------------- */
-/* Change the order of action-channels
- * mode: REARRANGE_ACTCHAN_*
+/* typedef for channel rearranging function
+ * < list: list that channels belong to
+ * < channel: channel to be moved
+ * < type: type of channel (eAnim_ChannelType)
+ * > return[0]: whether operation was a success
*/
-static void rearrange_action_channels (bAnimContext *ac, short mode)
+typedef short (*AnimChanRearrangeFp)(ListBase *list, Link *channel, short type);
+
+/* get rearranging function, given 'rearrange' mode */
+static AnimChanRearrangeFp rearrange_get_mode_func (short mode)
{
- bAction *act;
- bActionChannel *achan, *chan;
- bActionGroup *agrp, *grp;
- bActionGroup tgrp;
+ switch (mode) {
+ case REARRANGE_ANIMCHAN_TOP:
+ return rearrange_animchannel_top;
+ case REARRANGE_ANIMCHAN_UP:
+ return rearrange_animchannel_up;
+ case REARRANGE_ANIMCHAN_DOWN:
+ return rearrange_animchannel_down;
+ case REARRANGE_ANIMCHAN_BOTTOM:
+ return rearrange_animchannel_bottom;
+ default:
+ return NULL;
+ }
+}
+
+/* ........ */
+
+/* These iteration helpers (ideally should be inlined, but probably not necessary) */
+
+static Link *rearrange_iter_first (ListBase *list, short mode)
+{
+ return (mode > 0) ? list->first : list->last;
+}
+
+static Link *rearrange_iter_next (Link *item, short mode)
+{
+ return (mode > 0) ? item->next : item->prev;
+}
+
+/* ........ */
+
+/* Clear 'tag' on all F-Curves */
+static void rearrange_clear_fcurve_tags (ListBase *list)
+{
+ FCurve *fcu;
- short (*rearrange_func)(ListBase *, Link *, short);
- short do_channels = 1;
+ for (fcu = list->first; fcu; fcu = fcu->next)
+ fcu->flag &= ~FCURVE_TAGGED;
+}
+
+/* NLA Specific Stuff ----------------------------------------------------- */
+
+/* Change the order NLA Tracks within NLA Stack
+ * ! NLA tracks are displayed in opposite order, so directions need care
+ * mode: REARRANGE_ANIMCHAN_*
+ */
+static void rearrange_nla_channels (bAnimContext *UNUSED(ac), AnimData *adt, short mode)
+{
+ NlaTrack *nlt, *track;
- /* Get the active action, exit if none are selected */
- act= (bAction *)ac->data;
+ AnimChanRearrangeFp rearrange_func;
- /* exit if invalid mode */
- switch (mode) {
- case REARRANGE_ACTCHAN_TOP:
- rearrange_func= rearrange_actchannel_top;
- break;
- case REARRANGE_ACTCHAN_UP:
- rearrange_func= rearrange_actchannel_up;
- break;
- case REARRANGE_ACTCHAN_DOWN:
- rearrange_func= rearrange_actchannel_down;
- break;
- case REARRANGE_ACTCHAN_BOTTOM:
- rearrange_func= rearrange_actchannel_bottom;
+ /* hack: invert mode so that functions will work in right order */
+ mode *= -1;
+
+ /* get rearranging function */
+ rearrange_func = rearrange_get_mode_func(mode);
+ if (rearrange_func == NULL)
+ return;
+
+ /* only consider NLA data if it's accessible */
+ //if (EXPANDED_DRVD(adt) == 0)
+ // return;
+
+ /* clear "moved" flag from all tracks */
+ for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next)
+ nlt->flag &= ~NLASTRIP_FLAG_EDIT_TOUCHED;
+
+ /* reorder all selected tracks */
+ for (nlt= (NlaTrack *)rearrange_iter_first(&adt->nla_tracks, mode); nlt; nlt= track) {
+ /* Get next channel to consider */
+ track= (NlaTrack *)rearrange_iter_next((Link *)nlt, mode);
+
+ /* Try to do channel */
+ if (rearrange_func(&adt->nla_tracks, (Link *)nlt, ANIMTYPE_NLATRACK))
+ nlt->flag |= NLASTRIP_FLAG_EDIT_TOUCHED;
+ }
+
+ /* clear "moved" flag from all tracks */
+ for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next)
+ nlt->flag &= ~NLASTRIP_FLAG_EDIT_TOUCHED;
+}
+
+/* Drivers Specific Stuff ------------------------------------------------- */
+
+/* Change the order drivers within AnimData block
+ * mode: REARRANGE_ANIMCHAN_*
+ */
+static void rearrange_driver_channels (bAnimContext *UNUSED(ac), AnimData *adt, short mode)
+{
+ FCurve *fcu, *fcun;
+
+ /* get rearranging function */
+ AnimChanRearrangeFp rearrange_func = rearrange_get_mode_func(mode);
+
+ if (rearrange_func == NULL)
+ return;
+
+ /* only consider drivers if they're accessible */
+ if (EXPANDED_DRVD(adt) == 0)
+ return;
+
+ rearrange_clear_fcurve_tags(&adt->drivers);
+
+ /* reorder all selected driver F-Curves */
+ for (fcu= (FCurve *)rearrange_iter_first(&adt->drivers, mode); fcu; fcu= fcun) {
+ /* Get next channel to consider */
+ fcun= (FCurve *)rearrange_iter_next((Link *)fcu, mode);
+
+ /* Try to do channel */
+ if (rearrange_func(&adt->drivers, (Link *)fcu, ANIMTYPE_FCURVE))
+ fcu->flag |= FCURVE_TAGGED;
+ }
+
+ rearrange_clear_fcurve_tags(&adt->drivers);
+}
+
+/* Action Specific Stuff ------------------------------------------------- */
+
+/* make sure all action-channels belong to a group (and clear action's list) */
+static void split_groups_action_temp (bAction *act, bActionGroup *tgrp)
+{
+ bActionGroup *agrp;
+ FCurve *fcu;
+
+ if (act == NULL)
+ return;
+
+ /* clear "moved" flag from all FCurves */
+ rearrange_clear_fcurve_tags(&act->curves);
+
+ /* Separate F-Curves into lists per group */
+ for (agrp= act->groups.first; agrp; agrp= agrp->next) {
+ if (agrp->channels.first) {
+ fcu= agrp->channels.last;
+ act->curves.first= fcu->next;
+
+ fcu= agrp->channels.first;
+ fcu->prev= NULL;
+
+ fcu= agrp->channels.last;
+ fcu->next= NULL;
+ }
+ }
+
+ /* Initialise memory for temp-group */
+ memset(tgrp, 0, sizeof(bActionGroup));
+ tgrp->flag |= (AGRP_EXPANDED|AGRP_TEMP);
+ BLI_strncpy(tgrp->name, "#TempGroup", sizeof(tgrp->name));
+
+ /* Move any action-channels not already moved, to the temp group */
+ if (act->curves.first) {
+ /* start of list */
+ fcu= act->curves.first;
+ fcu->prev= NULL;
+ tgrp->channels.first= fcu;
+ act->curves.first= NULL;
+
+ /* end of list */
+ fcu= act->curves.last;
+ fcu->next= NULL;
+ tgrp->channels.last= fcu;
+ act->curves.last= NULL;
+ }
+
+ /* Add temp-group to list */
+ BLI_addtail(&act->groups, tgrp);
+}
+
+/* link lists of channels that groups have */
+static void join_groups_action_temp (bAction *act)
+{
+ bActionGroup *agrp;
+
+ for (agrp= act->groups.first; agrp; agrp= agrp->next) {
+ ListBase tempGroup;
+
+ /* add list of channels to action's channels */
+ tempGroup= agrp->channels;
+ addlisttolist(&act->curves, &agrp->channels);
+ agrp->channels= tempGroup;
+
+ /* clear moved flag */
+ agrp->flag &= ~AGRP_MOVED;
+
+ /* if temp-group... remove from list (but don't free as it's on the stack!) */
+ if (agrp->flag & AGRP_TEMP) {
+ BLI_remlink(&act->groups, agrp);
break;
- default:
- return;
+ }
}
+ /* clear "moved" flag from all fcurve's */
+ rearrange_clear_fcurve_tags(&act->curves);
+}
+
+/* Change the order of anim-channels within action
+ * mode: REARRANGE_ANIMCHAN_*
+ */
+static void rearrange_action_channels (bAnimContext *ac, bAction *act, short mode)
+{
+ bActionGroup *agrp, *grp;
+ bActionGroup tgrp;
+ FCurve *fcu, *fcun;
+ short do_channels = 1;
+
+ /* get rearranging function */
+ AnimChanRearrangeFp rearrange_func = rearrange_get_mode_func(mode);
+
+ if (rearrange_func == NULL)
+ return;
+
/* make sure we're only operating with groups */
split_groups_action_temp(act, &tgrp);
/* rearrange groups first (and then, only consider channels if the groups weren't moved) */
- #define GET_FIRST(list) ((mode > 0) ? (list.first) : (list.last))
- #define GET_NEXT(item) ((mode > 0) ? (item->next) : (item->prev))
-
- for (agrp= GET_FIRST(act->groups); agrp; agrp= grp) {
+ for (agrp= (bActionGroup *)rearrange_iter_first(&act->groups, mode); agrp; agrp= grp) {
/* Get next group to consider */
- grp= GET_NEXT(agrp);
+ grp= (bActionGroup *)rearrange_iter_next((Link *)agrp, mode);
/* try to do group first */
if (rearrange_func(&act->groups, (Link *)agrp, ANIMTYPE_GROUP)) {
@@ -804,25 +938,23 @@ static void rearrange_action_channels (bAnimContext *ac, short mode)
}
if (do_channels) {
- for (agrp= GET_FIRST(act->groups); agrp; agrp= grp) {
+ for (agrp= (bActionGroup *)rearrange_iter_first(&act->groups, mode); agrp; agrp= grp) {
/* Get next group to consider */
- grp= GET_NEXT(agrp);
+ grp= (bActionGroup *)rearrange_iter_next((Link *)agrp, mode);
- /* only consider action-channels if they're visible (group expanded) */
+ /* only consider F-Curves if they're visible (group expanded) */
if (EXPANDED_AGRP(agrp)) {
- for (achan= GET_FIRST(agrp->channels); achan; achan= chan) {
+ for (fcu= (FCurve *)rearrange_iter_first(&agrp->channels, mode); fcu; fcu= fcun) {
/* Get next channel to consider */
- chan= GET_NEXT(achan);
+ fcun= (FCurve *)rearrange_iter_next((Link *)fcu, mode);
/* Try to do channel */
- if (rearrange_func(&agrp->channels, (Link *)achan, ANIMTYPE_ACHAN))
- achan->flag |= ACHAN_MOVED;
+ if (rearrange_func(&agrp->channels, (Link *)fcu, ANIMTYPE_FCURVE))
+ fcu->flag |= FCURVE_TAGGED;
}
}
}
}
- #undef GET_FIRST
- #undef GET_NEXT
/* assemble lists into one list (and clear moved tags) */
join_groups_action_temp(act);
@@ -833,95 +965,79 @@ static void rearrange_action_channels (bAnimContext *ac, short mode)
static int animchannels_rearrange_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
+
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
short mode;
- /* get editor data - only for Action Editor (for now) */
+ /* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
- if (ac.datatype != ANIMCONT_ACTION)
- return OPERATOR_PASS_THROUGH;
- /* get mode, then rearrange channels */
+ /* get mode */
mode= RNA_enum_get(op->ptr, "direction");
- rearrange_action_channels(&ac, mode);
- /* send notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-
-void ANIM_OT_channels_move_up (wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Move Channel(s) Up";
- ot->idname= "ANIM_OT_channels_move_up";
-
- /* api callbacks */
- ot->exec= animchannels_rearrange_exec;
- ot->poll= ED_operator_areaactive;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
- /* props */
- RNA_def_enum(ot->srna, "direction", NULL /* XXX add enum for this */, REARRANGE_ACTCHAN_UP, "Direction", "");
-}
-
-void ANIM_OT_channels_move_down (wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Move Channel(s) Down";
- ot->idname= "ANIM_OT_channels_move_down";
-
- /* api callbacks */
- ot->exec= animchannels_rearrange_exec;
- ot->poll= ED_operator_areaactive;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ /* get animdata blocks */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_ANIMDATA);
+ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
- /* props */
- RNA_def_enum(ot->srna, "direction", NULL /* XXX add enum for this */, REARRANGE_ACTCHAN_DOWN, "Direction", "");
-}
-
-void ANIM_OT_channels_move_top (wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Move Channel(s) to Top";
- ot->idname= "ANIM_OT_channels_move_to_top";
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ AnimData *adt= ale->data;
+
+ switch (ac.datatype) {
+ case ANIMCONT_NLA: /* NLA-tracks only */
+ rearrange_nla_channels(&ac, adt, mode);
+ break;
+
+ case ANIMCONT_DRIVERS: /* Drivers list only */
+ rearrange_driver_channels(&ac, adt, mode);
+ break;
+
+#if 0
+ case ANIMCONT_GPENCIL: /* Grease Pencil channels */
+ break;
+#endif
+
+ case ANIMCONT_SHAPEKEY: // DOUBLE CHECK ME...
+
+ default: /* some collection of actions */
+ // FIXME: actions should only be considered once!
+ if (adt->action)
+ rearrange_action_channels(&ac, adt->action, mode);
+ else
+ printf("animdata has no action\n");
+ break;
+ }
+ }
- /* api callbacks */
- ot->exec= animchannels_rearrange_exec;
- ot->poll= ED_operator_areaactive;
+ /* free temp data */
+ BLI_freelistN(&anim_data);
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ /* send notifier that things have changed */
+ WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
- /* props */
- RNA_def_enum(ot->srna, "direction", NULL /* XXX add enum for this */, REARRANGE_ACTCHAN_TOP, "Direction", "");
+ return OPERATOR_FINISHED;
}
-void ANIM_OT_channels_move_bottom (wmOperatorType *ot)
+void ANIM_OT_channels_move (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Move Channel(s) to Bottom";
- ot->idname= "ANIM_OT_channels_move_to_bottom";
+ ot->name= "Move Channels";
+ ot->idname= "ANIM_OT_channels_move";
/* api callbacks */
ot->exec= animchannels_rearrange_exec;
- ot->poll= ED_operator_areaactive;
+ ot->poll= animedit_poll_channels_nla_tweakmode_off;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- RNA_def_enum(ot->srna, "direction", NULL /* XXX add enum for this */, REARRANGE_ACTCHAN_BOTTOM, "Direction", "");
+ RNA_def_enum(ot->srna, "direction", prop_animchannel_rearrange_types, REARRANGE_ANIMCHAN_DOWN, "Direction", "");
}
-#endif // XXX old animation system - needs to be updated for new system...
-
/* ******************** Delete Channel Operator *********************** */
static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1482,9 +1598,73 @@ void ANIM_OT_channels_collapse (wmOperatorType *ot)
ot->prop= RNA_def_boolean(ot->srna, "all", 1, "All", "Collapse all channels (not just selected ones)");
}
+/* ******************* Reenable Disabled Operator ******************* */
+
+static int animchannels_enable_poll (bContext *C)
+{
+ ScrArea *sa= CTX_wm_area(C);
+
+ /* channels region test */
+ // TODO: could enhance with actually testing if channels region?
+ if (ELEM(NULL, sa, CTX_wm_region(C)))
+ return 0;
+
+ /* animation editor test - Action/Dopesheet/etc. and Graph only */
+ if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_IPO) == 0)
+ return 0;
+
+ return 1;
+}
+
+static int animchannels_enable_exec (bContext *C, wmOperator *UNUSED(op))
+{
+ bAnimContext ac;
+
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+
+ /* loop through filtered data and clean curves */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ FCurve *fcu = (FCurve *)ale->data;
+ fcu->flag &= ~FCURVE_DISABLED;
+ }
+
+ /* free temp data */
+ BLI_freelistN(&anim_data);
+
+ /* send notifier that things have changed */
+ WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+void ANIM_OT_channels_fcurves_enable (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Revive Disabled F-Curves";
+ ot->idname= "ANIM_OT_channels_fcurves_enable";
+ ot->description= "Clears 'disabled' tag from all F-Curves to get broken F-Curves working again";
+
+ /* api callbacks */
+ ot->exec= animchannels_enable_exec;
+ ot->poll= animchannels_enable_poll;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
/* ********************** Select All Operator *********************** */
-static int animchannels_deselectall_exec(bContext *C, wmOperator *op)
+static int animchannels_deselectall_exec (bContext *C, wmOperator *op)
{
bAnimContext ac;
@@ -1532,7 +1712,17 @@ static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short sele
View2D *v2d= &ac->ar->v2d;
rctf rectf;
- float ymin=0, ymax=(float)(-ACHANNEL_HEIGHT);
+ float ymin, ymax;
+
+ /* set initial y extents */
+ if (ac->datatype == ANIMCONT_NLA) {
+ ymin = (float)(-NLACHANNEL_HEIGHT);
+ ymax = 0.0f;
+ }
+ else {
+ ymin = 0.0f;
+ ymax = (float)(-ACHANNEL_HEIGHT);
+ }
/* convert border-region to view coordinates */
UI_view2d_region_to_view(v2d, rect->xmin, rect->ymin+2, &rectf.xmin, &rectf.ymin);
@@ -1544,7 +1734,10 @@ static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short sele
/* loop over data, doing border select */
for (ale= anim_data.first; ale; ale= ale->next) {
- ymin= ymax - ACHANNEL_STEP;
+ if (ac->datatype == ANIMCONT_NLA)
+ ymin= ymax - NLACHANNEL_STEP;
+ else
+ ymin= ymax - ACHANNEL_STEP;
/* if channel is within border-select region, alter it */
if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))) {
@@ -1561,6 +1754,16 @@ static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short sele
agrp->flag &= ~AGRP_ACTIVE;
}
break;
+ case ANIMTYPE_NLATRACK:
+ {
+ NlaTrack *nlt= (NlaTrack *)ale->data;
+
+ /* for now, it's easier just to do this here manually, as defining a new type
+ * currently adds complications when doing other stuff
+ */
+ ACHANNEL_SET_FLAG(nlt, selectmode, NLATRACK_SELECTED);
+ }
+ break;
}
}
@@ -1972,17 +2175,15 @@ void ED_operatortypes_animchannels(void)
// XXX does this need to be a separate operator?
WM_operatortype_append(ANIM_OT_channels_editable_toggle);
- // XXX these need to be updated for new system... todo...
- //WM_operatortype_append(ANIM_OT_channels_move_up);
- //WM_operatortype_append(ANIM_OT_channels_move_down);
- //WM_operatortype_append(ANIM_OT_channels_move_top);
- //WM_operatortype_append(ANIM_OT_channels_move_bottom);
+ WM_operatortype_append(ANIM_OT_channels_move);
WM_operatortype_append(ANIM_OT_channels_expand);
WM_operatortype_append(ANIM_OT_channels_collapse);
WM_operatortype_append(ANIM_OT_channels_visibility_toggle);
WM_operatortype_append(ANIM_OT_channels_visibility_set);
+
+ WM_operatortype_append(ANIM_OT_channels_fcurves_enable);
}
// TODO: check on a poll callback for this, to get hotkeys into menus
@@ -2024,11 +2225,11 @@ void ED_keymap_animchannels(wmKeyConfig *keyconf)
RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_expand", PADPLUSKEY, KM_PRESS, KM_CTRL, 0)->ptr, "all", 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_collapse", PADMINUS, KM_PRESS, KM_CTRL, 0)->ptr, "all", 0);
- /* rearranging - actions only */
- //WM_keymap_add_item(keymap, "ANIM_OT_channels_move_up", PAGEUPKEY, KM_PRESS, KM_SHIFT, 0);
- //WM_keymap_add_item(keymap, "ANIM_OT_channels_move_down", PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0);
- //WM_keymap_add_item(keymap, "ANIM_OT_channels_move_to_top", PAGEUPKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
- //WM_keymap_add_item(keymap, "ANIM_OT_channels_move_to_bottom", PAGEDOWNKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+ /* rearranging */
+ RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEUPKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "direction", REARRANGE_ANIMCHAN_UP);
+ RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "direction", REARRANGE_ANIMCHAN_DOWN);
+ RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEUPKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "direction", REARRANGE_ANIMCHAN_TOP);
+ RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEDOWNKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "direction", REARRANGE_ANIMCHAN_BOTTOM);
/* Graph Editor only */
WM_keymap_add_item(keymap, "ANIM_OT_channels_visibility_set", VKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 4647d2a5a2e..0779e88d310 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -1404,29 +1404,34 @@ static int animdata_filter_dopesheet_mats (bAnimContext *ac, ListBase *anim_data
/* for now, if no material returned, skip (this shouldn't confuse the user I hope) */
if (ma == NULL) continue;
- if (ma->adt == NULL) {
- /* need to check textures */
- if(ma->mtex) {
- MTex **mtex = ma->mtex;
- int a;
- for (a=0; a < MAX_MTEX; a++) {
- if (ELEM3(NULL, mtex[a], mtex[a]->tex, mtex[a]->tex->adt))
- continue;
- else
- ok=1;
- }
- }
- else
- continue;
- }
-
-
+
/* check if ok */
ANIMDATA_FILTER_CASES(ma,
{ /* AnimData blocks - do nothing... */ },
ok=1;,
ok=1;,
ok=1;)
+
+ /* need to check textures */
+ if (ok == 0 && !(ads->filterflag & ADS_FILTER_NOTEX)) {
+ int mtInd;
+
+ for (mtInd=0; mtInd < MAX_MTEX; mtInd++) {
+ MTex *mtex = ma->mtex[mtInd];
+
+ if(mtex && mtex->tex) {
+ ANIMDATA_FILTER_CASES(mtex->tex,
+ { /* AnimData blocks - do nothing... */ },
+ ok=1;,
+ ok=1;,
+ ok=1;)
+ }
+
+ if(ok)
+ break;
+ }
+ }
+
if (ok == 0) continue;
/* make a temp list elem for this */
@@ -2279,7 +2284,7 @@ static int animdata_filter_dopesheet (bAnimContext *ac, ListBase *anim_data, bDo
}
/* additionally, dopesheet filtering also affects what objects to consider */
- if (ads->filterflag) {
+ {
/* check selection and object type filters */
if ( (ads->filterflag & ADS_FILTER_ONLYSEL) && !((base->flag & SELECT) /*|| (base == sce->basact)*/) ) {
/* only selected should be shown */
@@ -2336,7 +2341,7 @@ static int animdata_filter_dopesheet (bAnimContext *ac, ListBase *anim_data, bDo
int a;
/* firstly check that we actuallly have some materials */
- for (a=0; a < ob->totcol; a++) {
+ for (a=1; a <= ob->totcol; a++) {
Material *ma= give_current_material(ob, a);
if (ma) {
@@ -2529,104 +2534,6 @@ static int animdata_filter_dopesheet (bAnimContext *ac, ListBase *anim_data, bDo
if (!actOk && !keyOk && !dataOk && !matOk && !partOk)
continue;
}
- else {
- /* check data-types */
- actOk= ANIMDATA_HAS_KEYS(ob);
- keyOk= (key != NULL);
-
- /* materials - only for geometric types */
- matOk= 0; /* by default, not ok... */
- if (ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL) && (ob->totcol))
- {
- int a;
-
- /* firstly check that we actuallly have some materials */
- for (a=0; a < ob->totcol; a++) {
- Material *ma= give_current_material(ob, a);
- int mtInd;
-
- if ((ma) && ANIMDATA_HAS_KEYS(ma)) {
- matOk= 1;
- break;
- }
-
- if(ma) {
- for (mtInd= 0; mtInd < MAX_MTEX; mtInd++) {
- MTex *mtex= ma->mtex[mtInd];
-
- if (mtex && mtex->tex && ANIMDATA_HAS_KEYS(mtex->tex)) {
- matOk= 1;
- break;
- }
- }
- }
-
- if(matOk)
- break;
- }
- }
-
- /* data */
- switch (ob->type) {
- case OB_CAMERA: /* ------- Camera ------------ */
- {
- Camera *ca= (Camera *)ob->data;
- dataOk= ANIMDATA_HAS_KEYS(ca);
- }
- break;
- case OB_LAMP: /* ---------- Lamp ----------- */
- {
- Lamp *la= (Lamp *)ob->data;
- dataOk= ANIMDATA_HAS_KEYS(la);
- }
- break;
- case OB_CURVE: /* ------- Curve ---------- */
- case OB_SURF: /* ------- Nurbs Surface ---------- */
- case OB_FONT: /* ------- Text Curve ---------- */
- {
- Curve *cu= (Curve *)ob->data;
- dataOk= ANIMDATA_HAS_KEYS(cu);
- }
- break;
- case OB_MBALL: /* -------- Metas ---------- */
- {
- MetaBall *mb= (MetaBall *)ob->data;
- dataOk= ANIMDATA_HAS_KEYS(mb);
- }
- break;
- case OB_ARMATURE: /* -------- Armature ---------- */
- {
- bArmature *arm= (bArmature *)ob->data;
- dataOk= ANIMDATA_HAS_KEYS(arm);
- }
- break;
- case OB_MESH: /* -------- Mesh ---------- */
- {
- Mesh *me= (Mesh *)ob->data;
- dataOk= ANIMDATA_HAS_KEYS(me);
- }
- break;
- default: /* --- other --- */
- dataOk= 0;
- break;
- }
-
- /* particles */
- partOk = 0;
- if (ob->particlesystem.first) {
- ParticleSystem *psys = ob->particlesystem.first;
- for(; psys; psys=psys->next) {
- if(psys->part && ANIMDATA_HAS_KEYS(psys->part)) {
- partOk = 1;
- break;
- }
- }
- }
-
- /* check if all bad (i.e. nothing to show) */
- if (!actOk && !keyOk && !dataOk && !matOk && !partOk)
- continue;
- }
/* since we're still here, this object should be usable */
items += animdata_filter_dopesheet_ob(ac, anim_data, ads, base, filter_mode);
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index dcfc2762735..8b5b99c2870 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -506,27 +506,20 @@ static EditBone *editbone_name_exists (ListBase *edbo, const char *name)
}
/* note: there's a unique_bone_name() too! */
-void unique_editbone_name (ListBase *edbo, char *name, EditBone *bone)
+static int editbone_unique_check(void *arg, const char *name)
{
- EditBone *dupli;
+ struct {ListBase *lb;void *bone;} *data= arg;
+ EditBone *dupli= editbone_name_exists(data->lb, name);
+ return dupli && dupli != data->bone;
+}
- dupli = editbone_name_exists(edbo, name);
-
- if (dupli && bone != dupli) {
- /* note: this block is used in other places, when changing logic apply to all others, search this message */
- char tempname[sizeof(bone->name)];
- char left[sizeof(bone->name)];
- int number;
- int len= BLI_split_name_num(left, &number, name);
- do { /* nested while loop looks bad but likely it wont run most times */
- while(BLI_snprintf(tempname, sizeof(tempname), "%s.%03d", left, number) >= sizeof(tempname)) {
- if(len > 0) left[--len]= '\0'; /* word too long */
- else number= 0; /* reset, must be a massive number */
- }
- } while(number++, ((dupli= editbone_name_exists(edbo, tempname)) && bone != dupli));
+void unique_editbone_name (ListBase *edbo, char *name, EditBone *bone)
+{
+ struct {ListBase *lb; void *bone;} data;
+ data.lb= edbo;
+ data.bone= bone;
- BLI_strncpy(name, tempname, sizeof(bone->name));
- }
+ BLI_uniquename_cb(editbone_unique_check, &data, "Bone", '.', name, sizeof(bone->name));
}
/* helper for apply_armature_pose2bones - fixes parenting of objects that are bone-parented to armature */
@@ -541,7 +534,7 @@ static void applyarmature_fix_boneparents (Scene *scene, Object *armob)
/* apply current transform from parent (not yet destroyed),
* then calculate new parent inverse matrix
*/
- object_apply_mat4(ob, ob->obmat, FALSE);
+ object_apply_mat4(ob, ob->obmat, FALSE, FALSE);
what_does_parent(scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
@@ -5398,26 +5391,17 @@ void POSE_OT_reveal(wmOperatorType *ot)
/* ************* RENAMING DISASTERS ************ */
-/* note: there's a unique_editbone_name() too! */
-static void unique_bone_name (bArmature *arm, char *name)
-{
- if (get_named_bone(arm, name)) {
- /* note: this block is used in other places, when changing logic apply to all others, search this message */
- char tempname[sizeof(((Bone *)NULL)->name)];
- char left[sizeof(((Bone *)NULL)->name)];
- int number;
- int len= BLI_split_name_num(left, &number, name);
- do { /* nested while loop looks bad but likely it wont run most times */
- while(BLI_snprintf(tempname, sizeof(tempname), "%s.%03d", left, number) >= sizeof(tempname)) {
- if(len > 0) left[--len]= '\0'; /* word too long */
- else number= 0; /* reset, must be a massive number */
- }
- } while(number++, get_named_bone(arm, tempname));
+static int bone_unique_check(void *arg, const char *name)
+{
+ return get_named_bone((bArmature *)arg, name) != NULL;
+}
- BLI_strncpy(name, tempname, sizeof(tempname));
- }
+void unique_bone_name(bArmature *arm, char *name)
+{
+ BLI_uniquename_cb(bone_unique_check, (void *)arm, "Bone", '.', name, sizeof(((Bone *)NULL)->name));
}
+
#define MAXBONENAME 32
/* helper call for armature_bone_rename */
static void constraint_bone_name_fix(Object *ob, ListBase *conlist, char *oldname, char *newname)
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index 749443b276c..d50f2d00ebb 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -1925,8 +1925,6 @@ static RetargetMode detectArcRetargetMode(RigArc *iarc)
mode = RETARGET_LENGTH;
}
- mode = RETARGET_AGGRESSIVE;
-
return mode;
}
diff --git a/source/blender/editors/datafiles/SConscript b/source/blender/editors/datafiles/SConscript
index 99acd52806e..dd0db90af44 100644
--- a/source/blender/editors/datafiles/SConscript
+++ b/source/blender/editors/datafiles/SConscript
@@ -6,4 +6,4 @@ sources = env.Glob('*.c')
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
incs += ' #/intern/guardedalloc'
-env.BlenderLib ( 'bf_editor_datafiles', sources, Split(incs), [], libtype=['core'], priority=[235] )
+env.BlenderLib ( 'bf_editor_datafiles', sources, Split(incs), [], libtype=['core', 'player'], priority=[235, 30] )
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index cf2b32653c8..1514facc441 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -332,7 +332,7 @@ typedef enum eAnimChannels_SetFlag {
/* types of settings for AnimChannels */
typedef enum eAnimChannel_Settings {
- ACHANNEL_SETTING_SELECT = 0,
+ ACHANNEL_SETTING_SELECT = 0,
ACHANNEL_SETTING_PROTECT, // warning: for drawing UI's, need to check if this is off (maybe inverse this later)
ACHANNEL_SETTING_MUTE,
ACHANNEL_SETTING_EXPAND,
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index b679ca64a28..4d3e40274f7 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -125,6 +125,7 @@ int ED_operator_areaactive(struct bContext *C);
int ED_operator_regionactive(struct bContext *C);
int ED_operator_scene_editable(struct bContext *C);
+int ED_operator_objectmode(struct bContext *C);
int ED_operator_view3d_active(struct bContext *C);
int ED_operator_region_view3d_active(struct bContext *C);
@@ -141,6 +142,9 @@ int ED_operator_sequencer_active(struct bContext *C);
int ED_operator_image_active(struct bContext *C);
int ED_operator_nla_active(struct bContext *C);
int ED_operator_logic_active(struct bContext *C);
+int ED_operator_info_active(struct bContext *C);
+int ED_operator_console_active(struct bContext *C);
+
int ED_operator_object_active(struct bContext *C);
int ED_operator_object_active_editable(struct bContext *C);
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index afc6787010a..2b5dc3b14ff 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -167,7 +167,7 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int
Base *ED_view3d_give_base_under_cursor(struct bContext *C, short *mval);
-void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar);
+void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, short do_clip);
#endif /* ED_VIEW3D_H */
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 2a1527b670d..bb3dad8d065 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -400,6 +400,7 @@ uiBut *uiDefButC(uiBlock *block, int type, int retval, char *str, short x1, shor
uiBut *uiDefButBitC(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButR(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButO(uiBlock *block, int type, char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, char *tip);
+uiBut *uiDefButTextO(uiBlock *block, int type, char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconBut(uiBlock *block,
int type, int retval, int icon,
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 099629b0422..dfb375225b4 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -511,7 +511,13 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut
for(oldbut=oldblock->buttons.first; oldbut; oldbut=oldbut->next) {
if(ui_but_equals_old(oldbut, but)) {
if(oldbut->active) {
+#if 0
but->flag= oldbut->flag;
+#else
+ /* exception! redalert flag can't be update from old button.
+ * perhaps it should only copy spesific flags rather then all. */
+ but->flag= (oldbut->flag & ~UI_BUT_REDALERT) | (but->flag & UI_BUT_REDALERT);
+#endif
but->active= oldbut->active;
but->pos= oldbut->pos;
but->editstr= oldbut->editstr;
@@ -2634,6 +2640,35 @@ uiBut *ui_def_but_operator(uiBlock *block, int type, char *opname, int opcontext
return but;
}
+uiBut *ui_def_but_operator_text(uiBlock *block, int type, char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
+{
+ uiBut *but;
+ wmOperatorType *ot;
+
+ ot= WM_operatortype_find(opname, 0);
+
+ if(!str) {
+ if(ot) str= ot->name;
+ else str= opname;
+ }
+
+ if ((!tip || tip[0]=='\0') && ot && ot->description) {
+ tip= ot->description;
+ }
+
+ but= ui_def_but(block, type, -1, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+ but->optype= ot;
+ but->opcontext= opcontext;
+
+ if(!ot) {
+ but->flag |= UI_BUT_DISABLED;
+ but->lock = 1;
+ but->lockstr = "";
+ }
+
+ return but;
+}
+
uiBut *uiDefBut(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
{
uiBut *but= ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
@@ -2805,6 +2840,16 @@ uiBut *uiDefButO(uiBlock *block, int type, char *opname, int opcontext, char *st
return but;
}
+uiBut *uiDefButTextO(uiBlock *block, int type, char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
+{
+ uiBut *but= ui_def_but_operator_text(block, type, opname, opcontext, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+
+ if(but)
+ ui_check_but(but);
+
+ return but;
+}
+
/* if a1==1.0 then a2 is an extra icon blending factor (alpha 0.0 - 1.0) */
uiBut *uiDefIconBut(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
{
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 29278edf451..1e818289d1e 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -856,7 +856,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
sprintf(str,"%-3d",i*20);
str[3]='\0';
fdrawline(rect.xmin+22, yofs+(i/5.f)*h, rect.xmax+1, yofs+(i/5.f)*h);
- BLF_draw_default(rect.xmin+1, yofs-5+(i/5.f)*h, 0, str);
+ BLF_draw_default(rect.xmin+1, yofs-5+(i/5.f)*h, 0, str, sizeof(str)-1);
/* in the loop because blf_draw reset it */
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index d3f915cddce..b6db799a443 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -1589,7 +1589,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data)
{
if(but) {
- if(ui_is_utf8_but(but)) {
+ if(!ui_is_utf8_but(but)) {
int strip= BLI_utf8_invalid_strip(but->editstr, strlen(but->editstr));
/* not a file?, strip non utf-8 chars */
if(strip) {
@@ -4031,12 +4031,16 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
km = WM_keymap_guess_opname(C, but->optype->idname);
kmi = WM_keymap_add_item(km, but->optype->idname, AKEY, KM_PRESS, 0, 0);
- MEM_freeN(kmi->properties);
- if (prop)
- kmi->properties= IDP_CopyProperty(prop);
-
+
+ if (prop) {
+ prop= IDP_CopyProperty(prop);
+ }
+
+ /* prop can be NULL */
+ WM_keymap_properties_reset(kmi, prop);
+
RNA_pointer_create(NULL, &RNA_KeyMapItem, kmi, &ptr);
-
+
block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
uiBlockSetHandleFunc(block, but_shortcut_name_func, but);
uiBlockSetFlag(block, UI_BLOCK_RET_1);
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 03676ae5e06..719be6c3463 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -165,7 +165,7 @@ void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, char *str)
if (fs->kerning == 1)
BLF_enable(fs->uifont_id, BLF_KERNING_DEFAULT);
- BLF_draw(fs->uifont_id, str);
+ BLF_draw(fs->uifont_id, str, 65535); /* XXX, use real length */
BLF_disable(fs->uifont_id, BLF_CLIPPING);
if (fs->shadow)
BLF_disable(fs->uifont_id, BLF_SHADOW);
@@ -218,7 +218,7 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, char *str)
if (fs->kerning == 1)
BLF_enable(fs->uifont_id, BLF_KERNING_DEFAULT);
- BLF_draw(fs->uifont_id, str);
+ BLF_draw(fs->uifont_id, str, 65535); /* XXX, use real length */
BLF_disable(fs->uifont_id, BLF_ROTATION);
BLF_disable(fs->uifont_id, BLF_CLIPPING);
if (fs->shadow)
@@ -253,9 +253,15 @@ void UI_DrawString(float x, float y, char *str)
{
uiStyle *style= U.uistyles.first;
+ if (style->widget.kerning == 1)
+ BLF_enable(style->widget.uifont_id, BLF_KERNING_DEFAULT);
+
uiStyleFontSet(&style->widget);
BLF_position(style->widget.uifont_id, x, y, 0.0f);
- BLF_draw(style->widget.uifont_id, str);
+ BLF_draw(style->widget.uifont_id, str, 65535); /* XXX, use real length */
+
+ if (style->widget.kerning == 1)
+ BLF_disable(style->widget.uifont_id, BLF_KERNING_DEFAULT);
}
/* ************** init exit ************************ */
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 9995ddb0d51..856164990e8 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -337,11 +337,13 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
/* text button with name */
if(id) {
char name[UI_MAX_NAME_STR];
+ const short user_alert= (id->us <= 0);
//text_idbutton(id, name);
name[0]= '\0';
but= uiDefButR(block, TEX, 0, name, 0, 0, UI_UNIT_X*6, UI_UNIT_Y, &idptr, "name", -1, 0, 0, -1, -1, NULL);
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_RENAME));
+ if(user_alert) uiButSetFlag(but, UI_BUT_REDALERT);
if(id->lib) {
if(id->flag & LIB_INDIRECT) {
@@ -373,6 +375,8 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
if(!id_copy(id, NULL, 1 /* test only */) || (idfrom && idfrom->lib))
uiButSetFlag(but, UI_BUT_DISABLED);
}
+
+ if(user_alert) uiButSetFlag(but, UI_BUT_REDALERT);
if(id->lib == NULL && !(ELEM4(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_TXT))) {
uiDefButR(block, TOG, 0, "F", 0, 0, UI_UNIT_X, UI_UNIT_Y, &idptr, "use_fake_user", -1, 0, 0, -1, -1, NULL);
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index c1c10bf33c6..43d4e20b8bb 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -1525,7 +1525,7 @@ static void scroll_printstr(Scene *scene, float x, float y, float val, int power
}
/* draw it */
- BLF_draw_default(x, y, 0.0f, str);
+ BLF_draw_default(x, y, 0.0f, str, sizeof(str)-1);
}
/* Draw scrollbars in the given 2d-region */
@@ -2054,7 +2054,7 @@ void UI_view2d_text_cache_draw(ARegion *ar)
for(v2s= strings.first; v2s; v2s= v2s->next) {
glColor3fv(v2s->col);
if(v2s->rect.xmin==v2s->rect.xmax)
- BLF_draw_default((float)v2s->mval[0], (float)v2s->mval[1], 0.0, v2s->str);
+ BLF_draw_default((float)v2s->mval[0], (float)v2s->mval[1], 0.0, v2s->str, sizeof(v2s->str)-1);
else {
int xofs=0, yofs;
@@ -2063,7 +2063,7 @@ void UI_view2d_text_cache_draw(ARegion *ar)
BLF_clipping_default(v2s->rect.xmin-4, v2s->rect.ymin-4, v2s->rect.xmax+4, v2s->rect.ymax+4);
BLF_enable_default(BLF_CLIPPING);
- BLF_draw_default(v2s->rect.xmin+xofs, v2s->rect.ymin+yofs, 0.0f, v2s->str);
+ BLF_draw_default(v2s->rect.xmin+xofs, v2s->rect.ymin+yofs, 0.0f, v2s->str, sizeof(v2s->str)-1);
BLF_disable_default(BLF_CLIPPING);
}
}
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 5500d9aae8d..f59e7ddda4b 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -1002,7 +1002,8 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
/* apply zooming */
view_zoomdrag_apply(C, op);
- } else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE)) {
+ }
+ else if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE)) { /* XXX needs modal keymap */
if (event->val==KM_RELEASE) {
/* for redo, store the overall deltas - need to respect zoom-locks here... */
if ((v2d->keepzoom & V2D_LOCKZOOM_X)==0)
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c
index d95a2570e80..f8135e47d20 100644
--- a/source/blender/editors/mesh/editmesh.c
+++ b/source/blender/editors/mesh/editmesh.c
@@ -739,6 +739,7 @@ void make_editMesh(Scene *scene, Object *ob)
EditSelection *ese;
float *co, (*keyco)[3]= NULL;
int tot, a, eekadoodle= 0;
+ const short is_paint_sel= paint_facesel_test(ob);
if(me->edit_mesh==NULL)
me->edit_mesh= MEM_callocN(sizeof(EditMesh), "editmesh");
@@ -789,7 +790,7 @@ void make_editMesh(Scene *scene, Object *ob)
evlist[a]= eve;
/* face select sets selection in next loop */
- if(!paint_facesel_test(ob))
+ if(!is_paint_sel)
eve->f |= (mvert->flag & 1);
if (mvert->flag & ME_HIDE) eve->h= 1;
@@ -864,7 +865,7 @@ void make_editMesh(Scene *scene, Object *ob)
if(mface->flag & ME_FACE_SEL) {
efa->f |= SELECT;
- if(paint_facesel_test(ob)) {
+ if(is_paint_sel) {
EM_select_face(efa, 1); /* flush down */
}
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index 309ee6b57e2..c9934275f3f 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -59,6 +59,7 @@ editmesh_mods.c, UI level access, no geometry changes
#include "BKE_material.h"
#include "BKE_paint.h"
#include "BKE_report.h"
+#include "BKE_texture.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
@@ -2113,7 +2114,7 @@ void MESH_OT_loop_select(wmOperatorType *ot)
/* api callbacks */
ot->invoke= mesh_select_loop_invoke;
- ot->poll= ED_operator_editmesh_view3d;
+ ot->poll= ED_operator_editmesh_region_view3d;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2219,7 +2220,7 @@ static int mesh_shortest_path_select_invoke(bContext *C, wmOperator *UNUSED(op),
static int mesh_shortest_path_select_poll(bContext *C)
{
- if(ED_operator_editmesh_view3d(C)) {
+ if(ED_operator_editmesh_region_view3d(C)) {
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
return (em->selectmode & SCE_SELECT_EDGE);
@@ -2544,7 +2545,7 @@ void MESH_OT_select_linked_pick(wmOperatorType *ot)
/* api callbacks */
ot->invoke= select_linked_pick_invoke;
- ot->poll= ED_operator_editmesh_view3d;
+ ot->poll= ED_operator_editmesh_region_view3d;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -4425,48 +4426,76 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "zaxis", 1, "Z-Axis", "Smooth along the Z axis.");
}
-void vertexnoise(Object *obedit, EditMesh *em)
+static int mesh_noise_exec(bContext *C, wmOperator *op)
{
+ Object *obedit= CTX_data_edit_object(C);
+ EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
Material *ma;
Tex *tex;
EditVert *eve;
- float b2, ofs, vec[3];
+ float fac= RNA_float_get(op->ptr, "factor");
+
+ if(em==NULL) return OPERATOR_FINISHED;
- if(em==NULL) return;
-
ma= give_current_material(obedit, obedit->actcol);
if(ma==0 || ma->mtex[0]==0 || ma->mtex[0]->tex==0) {
- return;
+ return OPERATOR_FINISHED;
}
- tex= ma->mtex[0]->tex;
-
- ofs= tex->turbul/200.0;
-
- eve= (struct EditVert *)em->verts.first;
- while(eve) {
- if(eve->f & SELECT) {
-
- if(tex->type==TEX_STUCCI) {
-
+ tex= give_current_material_texture(ma);
+
+
+ if(tex->type==TEX_STUCCI) {
+ float b2, vec[3];
+ float ofs= tex->turbul/200.0;
+ for(eve= em->verts.first; eve; eve= eve->next) {
+ if(eve->f & SELECT) {
b2= BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1], eve->co[2]);
if(tex->stype) ofs*=(b2*b2);
- vec[0]= 0.2*(b2-BLI_hnoise(tex->noisesize, eve->co[0]+ofs, eve->co[1], eve->co[2]));
- vec[1]= 0.2*(b2-BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1]+ofs, eve->co[2]));
- vec[2]= 0.2*(b2-BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1], eve->co[2]+ofs));
+ vec[0]= fac*(b2-BLI_hnoise(tex->noisesize, eve->co[0]+ofs, eve->co[1], eve->co[2]));
+ vec[1]= fac*(b2-BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1]+ofs, eve->co[2]));
+ vec[2]= fac*(b2-BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1], eve->co[2]+ofs));
add_v3_v3(eve->co, vec);
}
- else {
+ }
+ }
+ else {
+ for(eve= em->verts.first; eve; eve= eve->next) {
+ if(eve->f & SELECT) {
float tin, dum;
externtex(ma->mtex[0], eve->co, &tin, &dum, &dum, &dum, &dum, 0);
- eve->co[2]+= 0.05*tin;
+ eve->co[2]+= fac*tin;
}
}
- eve= eve->next;
}
recalc_editnormals(em);
-// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+
+ BKE_mesh_end_editmesh(obedit->data, em);
+
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+
+ return OPERATOR_FINISHED;
+}
+
+void MESH_OT_noise(wmOperatorType *ot)
+{
+ PropertyRNA *prop;
+
+ /* identifiers */
+ ot->name= "Noise";
+ ot->description= "Use vertex coordinate as texture coordinate";
+ ot->idname= "MESH_OT_noise";
+
+ /* api callbacks */
+ ot->exec= mesh_noise_exec;
+ ot->poll= ED_operator_editmesh;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ prop= RNA_def_float(ot->srna, "factor", 0.1f, -FLT_MAX, FLT_MAX, "Factor", "", 0.0f, 1.0f);
}
diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c
index ac65a3c21d3..85faf00fef8 100644
--- a/source/blender/editors/mesh/loopcut.c
+++ b/source/blender/editors/mesh/loopcut.c
@@ -94,13 +94,15 @@ typedef struct tringselOpData {
} tringselOpData;
/* modal loop selection drawing callback */
-static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg)
+static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
{
- int i;
+ View3D *v3d = CTX_wm_view3d(C);
tringselOpData *lcd = arg;
+ int i;
if (lcd->totedge > 0) {
- glDisable(GL_DEPTH_TEST);
+ if(v3d && v3d->zbuf)
+ glDisable(GL_DEPTH_TEST);
glPushMatrix();
glMultMatrixf(lcd->ob->obmat);
@@ -114,7 +116,8 @@ static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *a
glEnd();
glPopMatrix();
- glEnable(GL_DEPTH_TEST);
+ if(v3d && v3d->zbuf)
+ glEnable(GL_DEPTH_TEST);
}
}
@@ -487,7 +490,7 @@ void MESH_OT_edgering_select (wmOperatorType *ot)
/* callbacks */
ot->invoke= ringsel_invoke;
- ot->poll= ED_operator_editmesh_view3d;
+ ot->poll= ED_operator_editmesh_region_view3d;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -506,7 +509,7 @@ void MESH_OT_loopcut (wmOperatorType *ot)
ot->invoke= ringcut_invoke;
ot->modal= ringcut_modal;
ot->cancel= ringcut_cancel;
- ot->poll= ED_operator_editmesh_view3d;
+ ot->poll= ED_operator_editmesh_region_view3d;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index fcd1eb40a02..e80176586d9 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -165,6 +165,7 @@ void MESH_OT_loop_multi_select(struct wmOperatorType *ot);
void MESH_OT_mark_seam(struct wmOperatorType *ot);
void MESH_OT_mark_sharp(struct wmOperatorType *ot);
void MESH_OT_vertices_smooth(struct wmOperatorType *ot);
+void MESH_OT_noise(struct wmOperatorType *ot);
void MESH_OT_flip_normals(struct wmOperatorType *ot);
void MESH_OT_solidify(struct wmOperatorType *ot);
void MESH_OT_select_nth(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 2ff7095cfea..682010be4db 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -123,6 +123,7 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_mark_seam);
WM_operatortype_append(MESH_OT_mark_sharp);
WM_operatortype_append(MESH_OT_vertices_smooth);
+ WM_operatortype_append(MESH_OT_noise);
WM_operatortype_append(MESH_OT_flip_normals);
WM_operatortype_append(MESH_OT_knife_cut);
WM_operatortype_append(MESH_OT_rip);
@@ -263,9 +264,10 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "inside", 1);
WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_move_normal", EKEY, KM_PRESS, 0, 0); /* python operator */
- WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_individual_move", EKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_extrude", EKEY, KM_PRESS, KM_ALT, 0);
+ WM_keymap_add_item(keymap, "TRANSFORM_OT_edge_crease", EKEY, KM_PRESS, KM_SHIFT, 0);
+
WM_keymap_add_item(keymap, "MESH_OT_spin", RKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "MESH_OT_fill", FKEY, KM_PRESS, KM_ALT, 0);
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 0307ba13424..b7c4011c538 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -85,7 +85,7 @@
/* join selected meshes into the active mesh, context sensitive
return 0 if no join is made (error) and 1 of the join is done */
-int join_mesh_exec(bContext *C, wmOperator *UNUSED(op))
+int join_mesh_exec(bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -105,12 +105,16 @@ int join_mesh_exec(bContext *C, wmOperator *UNUSED(op))
MDeformVert *dvert;
CustomData vdata, edata, fdata;
- if(scene->obedit)
+ if(scene->obedit) {
+ BKE_report(op->reports, RPT_ERROR, "Cant join while in editmode");
return OPERATOR_CANCELLED;
+ }
/* ob is the object we are adding geometry to */
- if(!ob || ob->type!=OB_MESH)
+ if(!ob || ob->type!=OB_MESH) {
+ BKE_report(op->reports, RPT_ERROR, "Active object is not a mesh");
return OPERATOR_CANCELLED;
+ }
/* count & check */
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
@@ -133,15 +137,25 @@ int join_mesh_exec(bContext *C, wmOperator *UNUSED(op))
CTX_DATA_END;
/* that way the active object is always selected */
- if(ok==0)
+ if(ok==0) {
+ BKE_report(op->reports, RPT_ERROR, "Active object is not a selected mesh");
return OPERATOR_CANCELLED;
+ }
/* only join meshes if there are verts to join, there aren't too many, and we only had one mesh selected */
me= (Mesh *)ob->data;
key= me->key;
- if(totvert==0 || totvert>MESH_MAX_VERTS || totvert==me->totvert)
+
+ if(totvert==0 || totvert==me->totvert) {
+ BKE_report(op->reports, RPT_ERROR, "No mesh data to join");
return OPERATOR_CANCELLED;
+ }
+ if(totvert > MESH_MAX_VERTS) {
+ BKE_reportf(op->reports, RPT_ERROR, "Joining results in %d vertices, limit is " STRINGIFY(MESH_MAX_VERTS), totvert);
+ return OPERATOR_CANCELLED;
+ }
+
/* new material indices and material array */
matar= MEM_callocN(sizeof(void*)*totmat, "join_mesh matar");
if (totmat) matmap= MEM_callocN(sizeof(int)*totmat, "join_mesh matmap");
@@ -508,10 +522,19 @@ int join_mesh_exec(bContext *C, wmOperator *UNUSED(op))
}
DAG_scene_sort(bmain, scene); // removed objects, need to rebuild dag before editmode call
-
+
+#if 0
ED_object_enter_editmode(C, EM_WAITCURSOR);
ED_object_exit_editmode(C, EM_FREEDATA|EM_WAITCURSOR|EM_DO_UNDO);
-
+#else
+ /* toggle editmode using lower level functions so this can be called from python */
+ make_editMesh(scene, ob);
+ load_editMesh(scene, ob);
+ free_editMesh(me->edit_mesh);
+ MEM_freeN(me->edit_mesh);
+ me->edit_mesh= NULL;
+ DAG_id_flush_update(&ob->id, OB_RECALC_OB|OB_RECALC_DATA);
+#endif
WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 196440f29cf..88072d7d045 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -45,6 +45,7 @@
#include "BLI_listbase.h"
#include "BKE_anim.h"
+#include "BKE_animsys.h"
#include "BKE_armature.h"
#include "BKE_constraint.h"
#include "BKE_context.h"
@@ -331,7 +332,7 @@ void OBJECT_OT_add(wmOperatorType *ot)
ot->invoke= ED_object_add_generic_invoke;
ot->exec= object_add_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -421,7 +422,7 @@ void OBJECT_OT_effector_add(wmOperatorType *ot)
ot->invoke= WM_menu_invoke;
ot->exec= effector_add_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -472,7 +473,7 @@ void OBJECT_OT_camera_add(wmOperatorType *ot)
/* api callbacks */
ot->exec= object_camera_add_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -556,7 +557,7 @@ void OBJECT_OT_metaball_add(wmOperatorType *ot)
/* api callbacks */
ot->invoke= object_metaball_add_invoke;
ot->exec= object_metaball_add_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -596,7 +597,7 @@ void OBJECT_OT_text_add(wmOperatorType *ot)
/* api callbacks */
ot->invoke= ED_object_add_generic_invoke;
ot->exec= object_add_text_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -651,7 +652,7 @@ void OBJECT_OT_armature_add(wmOperatorType *ot)
/* api callbacks */
ot->invoke= ED_object_add_generic_invoke;
ot->exec= object_armature_add_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -711,7 +712,7 @@ void OBJECT_OT_lamp_add(wmOperatorType *ot)
/* api callbacks */
ot->invoke= WM_menu_invoke;
ot->exec= object_lamp_add_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -768,7 +769,7 @@ void OBJECT_OT_group_instance_add(wmOperatorType *ot)
ot->invoke= WM_enum_search_invoke;
ot->exec= group_instance_add_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -834,7 +835,7 @@ void OBJECT_OT_delete(wmOperatorType *ot)
/* api callbacks */
ot->invoke= WM_operator_confirm;
ot->exec= object_delete_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -982,7 +983,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base)
ob->lay= base->lay;
copy_m4_m4(ob->obmat, dob->mat);
- object_apply_mat4(ob, ob->obmat, FALSE);
+ object_apply_mat4(ob, ob->obmat, FALSE, FALSE);
}
copy_object_set_idnew(C, 0);
@@ -1026,7 +1027,7 @@ void OBJECT_OT_duplicates_make_real(wmOperatorType *ot)
/* api callbacks */
ot->exec= object_duplicates_make_real_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1445,17 +1446,12 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
}
}
- if(dupflag & USER_DUP_ACT){ /* Not buttons in the UI to modify this, add later? */
- id= (ID *)obn->action;
- if (id){
- ID_NEW_US(obn->action)
- else{
- obn->action= copy_action(obn->action);
- }
- id->us--;
- }
- }
#endif // XXX old animation system
+
+ if(dupflag & USER_DUP_ACT) {
+ BKE_copy_animdata_id_action(&obn->id);
+ }
+
if(dupflag & USER_DUP_MAT) {
for(a=0; a<obn->totcol; a++) {
id= (ID *)obn->mat[a];
@@ -1463,6 +1459,10 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
ID_NEW_US(obn->mat[a])
else obn->mat[a]= copy_material(obn->mat[a]);
id->us--;
+
+ if(dupflag & USER_DUP_ACT) {
+ BKE_copy_animdata_id_action(&obn->mat[a]->id);
+ }
}
}
}
@@ -1473,6 +1473,11 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
if(id) {
ID_NEW_US(psys->part)
else psys->part= psys_copy_settings(psys->part);
+
+ if(dupflag & USER_DUP_ACT) {
+ BKE_copy_animdata_id_action(&psys->part->id);
+ }
+
id->us--;
}
}
@@ -1540,7 +1545,10 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
case OB_LAMP:
if(dupflag & USER_DUP_LAMP) {
ID_NEW_US2(obn->data )
- else obn->data= copy_lamp(obn->data);
+ else {
+ obn->data= copy_lamp(obn->data);
+ didit= 1;
+ }
id->us--;
}
break;
@@ -1564,29 +1572,42 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
case OB_LATTICE:
if(dupflag!=0) {
ID_NEW_US2(obn->data )
- else obn->data= copy_lattice(obn->data);
+ else {
+ obn->data= copy_lattice(obn->data);
+ didit= 1;
+ }
id->us--;
}
break;
case OB_CAMERA:
if(dupflag!=0) {
ID_NEW_US2(obn->data )
- else obn->data= copy_camera(obn->data);
+ else {
+ obn->data= copy_camera(obn->data);
+ didit= 1;
+ }
id->us--;
}
break;
}
-
- if(dupflag & USER_DUP_MAT) {
- matarar= give_matarar(obn);
- if(didit && matarar) {
- for(a=0; a<obn->totcol; a++) {
- id= (ID *)(*matarar)[a];
- if(id) {
- ID_NEW_US( (*matarar)[a] )
- else (*matarar)[a]= copy_material((*matarar)[a]);
-
- id->us--;
+
+ /* check if obdata is copied */
+ if(didit) {
+ if(dupflag & USER_DUP_ACT) {
+ BKE_copy_animdata_id_action((ID *)obn->data);
+ }
+
+ if(dupflag & USER_DUP_MAT) {
+ matarar= give_matarar(obn);
+ if(matarar) {
+ for(a=0; a<obn->totcol; a++) {
+ id= (ID *)(*matarar)[a];
+ if(id) {
+ ID_NEW_US( (*matarar)[a] )
+ else (*matarar)[a]= copy_material((*matarar)[a]);
+
+ id->us--;
+ }
}
}
}
@@ -1669,7 +1690,7 @@ void OBJECT_OT_duplicate(wmOperatorType *ot)
/* api callbacks */
ot->exec= duplicate_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1682,20 +1703,6 @@ void OBJECT_OT_duplicate(wmOperatorType *ot)
/* **************** add named object, for dragdrop ************* */
-/* contextual operator dupli */
-
-static int add_named_poll(bContext *C)
-{
- if(!ED_operator_scene_editable(C)) {
- return 0;
- } else {
- Object *ob= CTX_data_active_object(C);
- if(ob && ob->mode != OB_MODE_OBJECT)
- return 0;
- else
- return 1;
- }
-}
static int add_named_exec(bContext *C, wmOperator *op)
{
@@ -1754,7 +1761,7 @@ void OBJECT_OT_add_named(wmOperatorType *ot)
/* api callbacks */
ot->exec= add_named_exec;
- ot->poll= add_named_poll;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index 99e27d8a286..3b504995e6a 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -96,7 +96,7 @@ void GROUP_OT_objects_add_active(wmOperatorType *ot)
/* api callbacks */
ot->exec= objects_add_active_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -143,7 +143,7 @@ void GROUP_OT_objects_remove_active(wmOperatorType *ot)
/* api callbacks */
ot->exec= objects_remove_active_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -177,7 +177,7 @@ void GROUP_OT_objects_remove(wmOperatorType *ot)
/* api callbacks */
ot->exec= group_objects_remove_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -214,7 +214,7 @@ void GROUP_OT_create(wmOperatorType *ot)
/* api callbacks */
ot->exec= group_create_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 5f9eeb04125..b8edbb8c104 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -262,7 +262,7 @@ void OBJECT_OT_vertex_parent_set(wmOperatorType *ot)
static int make_proxy_invoke (bContext *C, wmOperator *op, wmEvent *evt)
{
Scene *scene= CTX_data_scene(C);
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_active_context(C);
/* sanity checks */
if (!scene || scene->id.lib || !ob)
@@ -299,7 +299,7 @@ static int make_proxy_invoke (bContext *C, wmOperator *op, wmEvent *evt)
static int make_proxy_exec (bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
- Object *ob, *gob= CTX_data_active_object(C);
+ Object *ob, *gob= ED_object_active_context(C);
GroupObject *go;
Scene *scene= CTX_data_scene(C);
@@ -360,7 +360,7 @@ static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *UNUSE
EnumPropertyItem *item= NULL, item_tmp;
int totitem= 0;
int i= 0;
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_active_context(C);
GroupObject *go;
if(!ob || !ob->dup_group)
@@ -431,7 +431,7 @@ static int parent_clear_exec(bContext *C, wmOperator *op)
}
else if(type == 1) {
ob->parent= NULL;
- object_apply_mat4(ob, ob->obmat, TRUE);
+ object_apply_mat4(ob, ob->obmat, TRUE, FALSE);
}
else if(type == 2)
unit_m4(ob->parentinv);
@@ -528,7 +528,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
- Object *par= CTX_data_active_object(C);
+ Object *par= ED_object_active_context(C);
bPoseChannel *pchan= NULL;
int partype= RNA_enum_get(op->ptr, "type");
int pararm= ELEM4(partype, PAR_ARMATURE, PAR_ARMATURE_NAME, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO);
@@ -688,7 +688,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_active_context(C);
uiPopupMenu *pup= uiPupMenuBegin(C, "Set Parent To", 0);
uiLayout *layout= uiPupMenuLayout(pup);
@@ -729,7 +729,7 @@ void OBJECT_OT_parent_set(wmOperatorType *ot)
ot->invoke= parent_set_invoke;
ot->exec= parent_set_exec;
- ot->poll= ED_operator_object_active_editable;
+ ot->poll= ED_operator_object_active;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -742,7 +742,7 @@ void OBJECT_OT_parent_set(wmOperatorType *ot)
static int parent_noinv_set_exec(bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
- Object *par= CTX_data_active_object(C);
+ Object *par= ED_object_active_context(C);
par->recalc |= OB_RECALC_OB;
@@ -906,7 +906,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
}
if(type == 1)
- object_apply_mat4(ob, ob->obmat, TRUE);
+ object_apply_mat4(ob, ob->obmat, TRUE, TRUE);
}
CTX_DATA_END;
@@ -928,7 +928,7 @@ void OBJECT_OT_track_clear(wmOperatorType *ot)
ot->invoke= WM_menu_invoke;
ot->exec= object_track_clear_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -949,7 +949,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
- Object *obact= CTX_data_active_object(C);
+ Object *obact= ED_object_active_context(C);
int type= RNA_enum_get(op->ptr, "type");
@@ -1033,7 +1033,7 @@ void OBJECT_OT_track_set(wmOperatorType *ot)
ot->invoke= WM_menu_invoke;
ot->exec= track_set_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1143,7 +1143,7 @@ void OBJECT_OT_move_to_layer(wmOperatorType *ot)
/* api callbacks */
ot->invoke= move_to_layer_invoke;
ot->exec= move_to_layer_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1252,7 +1252,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
ID *id;
int a;
- ob= CTX_data_active_object(C);
+ ob= ED_object_active_context(C);
CTX_DATA_BEGIN(C, Object*, obt, selected_editable_objects) {
if(ob != obt) {
@@ -1279,8 +1279,8 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
}
break;
case MAKE_LINKS_ANIMDATA:
- BKE_copy_animdata_id((ID *)obt, (ID *)ob);
- BKE_copy_animdata_id((ID *)obt->data, (ID *)ob->data);
+ BKE_copy_animdata_id((ID *)obt, (ID *)ob, FALSE);
+ BKE_copy_animdata_id((ID *)obt->data, (ID *)ob->data, FALSE);
break;
case MAKE_LINKS_DUPLIGROUP:
obt->dup_group= ob->dup_group;
@@ -1346,7 +1346,7 @@ void OBJECT_OT_make_links_data(wmOperatorType *ot)
/* api callbacks */
ot->exec= make_links_data_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1573,6 +1573,8 @@ void single_ipo_users(Scene *UNUSED(scene), int UNUSED(flag))
}
}
#endif // XXX old animation system
+ // TODO, something like this but must check users first.
+ // BKE_copy_animdata_id_action((ID *)obn->data);
}
static void single_mat_users(Scene *scene, int flag, int do_textures)
@@ -1848,7 +1850,7 @@ void OBJECT_OT_make_local(wmOperatorType *ot)
/* api callbacks */
ot->invoke= WM_menu_invoke;
ot->exec= make_local_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1900,7 +1902,7 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot)
/* api callbacks */
ot->invoke= WM_menu_invoke;
ot->exec= make_single_user_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1947,7 +1949,7 @@ void OBJECT_OT_drop_named_material(wmOperatorType *ot)
/* api callbacks */
ot->invoke= drop_named_material_invoke;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_UNDO;
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 29c3ee5c95c..b131a358ae7 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -148,7 +148,7 @@ void OBJECT_OT_select_by_type(wmOperatorType *ot)
/* api callbacks */
ot->invoke= WM_menu_invoke;
ot->exec= object_select_by_type_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -330,7 +330,7 @@ void OBJECT_OT_select_linked(wmOperatorType *ot)
/* api callbacks */
ot->invoke= WM_menu_invoke;
ot->exec= object_select_linked_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -618,7 +618,7 @@ void OBJECT_OT_select_grouped(wmOperatorType *ot)
/* api callbacks */
ot->invoke= WM_menu_invoke;
ot->exec= object_select_grouped_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -667,7 +667,7 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot)
/* api callbacks */
/*ot->invoke = XXX - need a int grid popup*/
ot->exec= object_select_by_layer_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -705,7 +705,7 @@ void OBJECT_OT_select_inverse(wmOperatorType *ot)
/* api callbacks */
ot->exec= object_select_inverse_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -766,7 +766,7 @@ void OBJECT_OT_select_all(wmOperatorType *ot)
/* api callbacks */
ot->exec= object_select_all_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -815,7 +815,7 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot)
/* api callbacks */
ot->exec= object_select_same_group_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -863,7 +863,7 @@ void OBJECT_OT_select_mirror(wmOperatorType *ot)
/* api callbacks */
ot->exec= object_select_mirror_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -920,7 +920,7 @@ void OBJECT_OT_select_name(wmOperatorType *ot)
/* api callbacks */
ot->exec= object_select_name_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -968,7 +968,7 @@ void OBJECT_OT_select_random(wmOperatorType *ot)
/* api callbacks */
/*ot->invoke= object_select_random_invoke XXX - need a number popup ;*/
ot->exec = object_select_random_exec;
- ot->poll= ED_operator_scene_editable;
+ ot->poll= ED_operator_objectmode;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index bd8a7f99978..2917de2864b 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -391,7 +391,7 @@ static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob )
/* a change was made, adjust the children to compensate */
for(ob_child=bmain->object.first; ob_child; ob_child=ob_child->id.next) {
if(ob_child->parent == ob) {
- object_apply_mat4(ob_child, ob_child->obmat, TRUE);
+ object_apply_mat4(ob_child, ob_child->obmat, TRUE, FALSE);
what_does_parent(scene, ob_child, &workob);
invert_m4_m4(ob_child->parentinv, workob.obmat);
}
@@ -577,9 +577,12 @@ static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op))
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
where_is_object(scene, ob);
- object_apply_mat4(ob, ob->obmat, TRUE);
+ object_apply_mat4(ob, ob->obmat, TRUE, TRUE);
where_is_object(scene, ob);
-
+
+ /* update for any children that may get moved */
+ DAG_id_flush_update(&ob->id, OB_RECALC_OB);
+
change = 1;
}
CTX_DATA_END;
diff --git a/source/blender/editors/render/Makefile b/source/blender/editors/render/Makefile
index 510e5372e22..8f523b7f5d4 100644
--- a/source/blender/editors/render/Makefile
+++ b/source/blender/editors/render/Makefile
@@ -35,6 +35,11 @@ include nan_compile.mk
CFLAGS += $(LEVEL_1_C_WARNINGS)
+ifeq ($(WITH_QUICKTIME),true)
+ CPPFLAGS += -I../../quicktime
+ CPPFLAGS += -DWITH_QUICKTIME
+endif
+
CPPFLAGS += -I$(NAN_GLEW)/include
CPPFLAGS += -I$(OPENGL_HEADERS)
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index bf017856389..94057aa5087 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -402,6 +402,13 @@ static int screen_render_exec(bContext *C, wmOperator *op)
View3D *v3d= CTX_wm_view3d(C);
Main *mainp= CTX_data_main(C);
unsigned int lay= (v3d)? v3d->lay: scene->lay;
+ const short is_animation= RNA_boolean_get(op->ptr, "animation");
+ const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
+
+ 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;
+ }
if(re==NULL) {
re= RE_NewRender(scene->id.name);
@@ -421,10 +428,10 @@ static int screen_render_exec(bContext *C, wmOperator *op)
since sequence rendering can call that recursively... (peter) */
seq_stripelem_cache_cleanup();
- if(RNA_boolean_get(op->ptr, "animation"))
+ if(is_animation)
RE_BlenderAnim(re, mainp, scene, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step, op->reports);
else
- RE_BlenderFrame(re, mainp, scene, NULL, lay, scene->r.cfra);
+ RE_BlenderFrame(re, mainp, scene, NULL, lay, scene->r.cfra, is_write_still);
// no redraw needed, we leave state as we entered it
ED_update_for_newframe(mainp, scene, CTX_wm_screen(C), 1);
@@ -441,7 +448,7 @@ typedef struct RenderJob {
wmWindow *win;
SceneRenderLayer *srl;
int lay;
- int anim;
+ short anim, write_still;
Image *image;
ImageUser iuser;
short *stop;
@@ -568,7 +575,7 @@ static void render_startjob(void *rjv, short *stop, short *do_update, float *pro
if(rj->anim)
RE_BlenderAnim(rj->re, rj->main, rj->scene, rj->lay, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step, rj->reports);
else
- RE_BlenderFrame(rj->re, rj->main, rj->scene, rj->srl, rj->lay, rj->scene->r.cfra);
+ RE_BlenderFrame(rj->re, rj->main, rj->scene, rj->srl, rj->lay, rj->scene->r.cfra, rj->write_still);
}
static void render_endjob(void *rjv)
@@ -632,7 +639,9 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
wmJob *steve;
RenderJob *rj;
Image *ima;
-
+ const short is_animation= RNA_boolean_get(op->ptr, "animation");
+ const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
+
/* only one render job at a time */
if(WM_jobs_test(CTX_wm_manager(C), scene))
return OPERATOR_CANCELLED;
@@ -641,6 +650,11 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_CANCELLED;
}
+ 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;
+ }
+
/* stop all running jobs, currently previews frustrate Render */
WM_jobs_stop_all(CTX_wm_manager(C));
@@ -703,7 +717,8 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
rj->win= CTX_wm_window(C);
rj->srl = srl;
rj->lay = (v3d)? v3d->lay: scene->lay;
- rj->anim= RNA_boolean_get(op->ptr, "animation");
+ rj->anim= is_animation;
+ rj->write_still= is_write_still && !is_animation;
rj->iuser.scene= scene;
rj->iuser.ok= 1;
rj->reports= op->reports;
@@ -764,7 +779,8 @@ void RENDER_OT_render(wmOperatorType *ot)
ot->poll= ED_operator_screenactive;
- RNA_def_boolean(ot->srna, "animation", 0, "Animation", "");
+ 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", "", 19, "Scene", "Re-render single layer in this scene");
}
@@ -781,7 +797,7 @@ static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(unused))
SpaceImage *sima= sa->spacedata.first;
/* test if we have a temp screen in front */
- if(CTX_wm_window(C)->screen->full==SCREENTEMP) {
+ if(CTX_wm_window(C)->screen->temp) {
wm_window_lower(CTX_wm_window(C));
return OPERATOR_FINISHED;
}
@@ -826,7 +842,7 @@ static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(unused), wmEv
ScrArea *sa= find_area_showing_r_result(C);
/* test if we have a temp screen in front */
- if(CTX_wm_window(C)->screen->full==SCREENTEMP) {
+ if(CTX_wm_window(C)->screen->temp) {
wm_window_lower(CTX_wm_window(C));
}
/* determine if render already shows */
@@ -841,7 +857,12 @@ static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(unused), wmEv
ED_screen_full_prevspace(C, sa);
}
else if(sima->next) {
- ED_area_newspace(C, sa, sima->next->spacetype);
+ /* workaround for case of double prevspace, render window
+ with a file browser on top of it (same as in ED_area_prevspace) */
+ if(sima->next->spacetype == SPACE_FILE && sima->next->next)
+ ED_area_newspace(C, sa, sima->next->next->spacetype);
+ else
+ ED_area_newspace(C, sa, sima->next->spacetype);
ED_area_tag_redraw(sa);
}
}
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index eb24919f99b..6b067a94003 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -81,6 +81,7 @@ typedef struct OGLRender {
GPUOffScreen *ofs;
int sizex, sizey;
+ int write_still;
ReportList *reports;
bMovieHandle *mh;
@@ -112,7 +113,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
float winmat[4][4];
int sizex= oglrender->sizex;
int sizey= oglrender->sizey;
- int view_context = (v3d != NULL);
+ const short view_context= (v3d != NULL);
rr= RE_AcquireResultRead(oglrender->re);
@@ -134,7 +135,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
/* render 3d view */
if(rv3d->persp==RV3D_CAMOB && v3d->camera) {
RE_GetCameraWindow(oglrender->re, v3d->camera, scene->r.cfra, winmat);
- is_ortho= scene->r.mode * R_ORTHO;
+ is_ortho= scene->r.mode & R_ORTHO;
}
else {
@@ -196,7 +197,20 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
/* update byte from float buffer */
ibuf= BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock);
- if(ibuf) image_buffer_rect_update(NULL, rr, ibuf, NULL);
+
+ if(ibuf) {
+ image_buffer_rect_update(NULL, rr, ibuf, NULL);
+
+ if(oglrender->write_still) {
+ char name[FILE_MAX];
+ int ok;
+ BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, FALSE);
+ ok= BKE_write_ibuf(scene, ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality);
+ if(ok) printf("OpenGL Render written to '%s'\n", name);
+ else printf("OpenGL Render failed to write '%s'\n", name);
+ }
+ }
+
BKE_image_release_ibuf(oglrender->ima, lock);
}
@@ -208,24 +222,31 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
GPUOffScreen *ofs;
OGLRender *oglrender;
int sizex, sizey;
- int view_context= RNA_boolean_get(op->ptr, "view_context");
+ short is_view_context= RNA_boolean_get(op->ptr, "view_context");
+ const short is_animation= RNA_boolean_get(op->ptr, "animation");
+ const short is_write_still= RNA_boolean_get(op->ptr, "view_context");
/* ensure we have a 3d view */
-
+
if(!ED_view3d_context_activate(C)) {
RNA_boolean_set(op->ptr, "view_context", 0);
- view_context = 0;
+ is_view_context= 0;
}
/* only one render job at a time */
if(WM_jobs_test(CTX_wm_manager(C), scene))
return 0;
- if(!view_context && scene->camera==NULL) {
+ if(!is_view_context && scene->camera==NULL) {
BKE_report(op->reports, RPT_ERROR, "Scene has no camera.");
return 0;
}
+ 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 0;
+ }
+
/* stop all running jobs, currently previews frustrate Render */
WM_jobs_stop_all(CTX_wm_manager(C));
@@ -252,7 +273,9 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
oglrender->sizey= sizey;
oglrender->scene= scene;
- if(view_context) {
+ oglrender->write_still= is_write_still && !is_animation;
+
+ if(is_view_context) {
oglrender->v3d= CTX_wm_view3d(C);
oglrender->ar= CTX_wm_region(C);
oglrender->rv3d= CTX_wm_region_view3d(C);
@@ -343,7 +366,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
void *lock;
char name[FILE_MAXDIR+FILE_MAXFILE];
int ok= 0;
- int view_context = (oglrender->v3d != NULL);
+ const short view_context= (oglrender->v3d != NULL);
/* update animated image textures for gpu, etc,
* call before scene_update_for_newframe so modifiers with textuers dont lag 1 frame */
@@ -389,7 +412,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
}
}
else {
- BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION);
+ BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE);
ok= BKE_write_ibuf(scene, ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality);
if(ok==0) {
@@ -488,12 +511,12 @@ static int screen_opengl_render_invoke(bContext *C, wmOperator *op, wmEvent *eve
/* executes blocking render */
static int screen_opengl_render_exec(bContext *C, wmOperator *op)
{
- int anim= RNA_boolean_get(op->ptr, "animation");
+ const short is_animation= RNA_boolean_get(op->ptr, "animation");
if(!screen_opengl_render_init(C, op))
return OPERATOR_CANCELLED;
- if(!anim) { /* same as invoke */
+ if(!is_animation) { /* same as invoke */
/* render image */
screen_opengl_render_apply(op->customdata);
screen_opengl_render_end(C, op->customdata);
@@ -533,7 +556,8 @@ void RENDER_OT_opengl(wmOperatorType *ot)
ot->poll= ED_operator_screenactive;
- RNA_def_boolean(ot->srna, "animation", 0, "Animation", "");
+ 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_boolean(ot->srna, "view_context", 1, "View Context", "Use the current 3D view for rendering, else use scene settings.");
}
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 7838fbdd5f4..dcb3762c6f1 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -338,7 +338,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
glClear(GL_COLOR_BUFFER_BIT);
UI_ThemeColor(TH_TEXT);
- BLF_draw_default(20, 8, 0.0f, ar->headerstr);
+ BLF_draw_default(20, 8, 0.0f, ar->headerstr, 65535); /* XXX, use real length */
}
else if(at->draw) {
at->draw(C, ar);
@@ -1165,7 +1165,7 @@ static char *editortype_pup(void)
"|%l"
- "|Console %x18"
+ "|Python Console %x18"
);
}
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index e3da9af4e2d..130916f4285 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1140,8 +1140,7 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
/* mark it available for use for other windows */
screen->winid= 0;
- /* before deleting the temp screen or we get invalid access */
- if (prevwin->screen->full != SCREENTEMP) {
+ if (prevwin->screen->temp == 0) {
/* use previous window if possible */
CTX_wm_window_set(C, prevwin);
} else {
@@ -1149,11 +1148,6 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
CTX_wm_window_set(C, NULL);
}
- /* if temp screen, delete it */
- if(screen->full == SCREENTEMP) {
- Main *bmain= CTX_data_main(C);
- free_libblock(&bmain->screen, screen);
- }
}
/* *********************************** */
@@ -1560,46 +1554,39 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
}
if(sa && sa->full) {
+ ScrArea *old;
short fulltype;
sc= sa->full; /* the old screen to restore */
oldscreen= win->screen; /* the one disappearing */
fulltype = sc->full;
+ sc->full= 0;
- /* refuse to go out of SCREENAUTOPLAY as long as G_FLAGS_AUTOPLAY
- is set */
-
- if (fulltype != SCREENAUTOPLAY || (G.flags & G_FILE_AUTOPLAY) == 0) {
- ScrArea *old;
+ /* removed: SCREENAUTOPLAY exception here */
+
+ /* find old area */
+ for(old= sc->areabase.first; old; old= old->next)
+ if(old->full) break;
+ if(old==NULL) {
+ if (G.f & G_DEBUG)
+ printf("something wrong in areafullscreen\n");
+ return NULL;
+ }
- sc->full= 0;
+ area_copy_data(old, sa, 1); /* 1 = swap spacelist */
+ if (sa->flag & AREA_TEMP_INFO) sa->flag &= ~AREA_TEMP_INFO;
+ old->full= NULL;
- /* find old area */
- for(old= sc->areabase.first; old; old= old->next)
- if(old->full) break;
- if(old==NULL) {
- if (G.f & G_DEBUG)
- printf("something wrong in areafullscreen\n");
- return NULL;
- }
- // old feature described below (ton)
- // in autoplay screens the headers are disabled by
- // default. So use the old headertype instead
-
- area_copy_data(old, sa, 1); /* 1 = swap spacelist */
- if (sa->flag & AREA_TEMP_INFO) sa->flag &= ~AREA_TEMP_INFO;
- old->full= NULL;
+ /* animtimer back */
+ sc->animtimer= oldscreen->animtimer;
+ oldscreen->animtimer= NULL;
- /* animtimer back */
- sc->animtimer= oldscreen->animtimer;
- oldscreen->animtimer= NULL;
+ ED_screen_set(C, sc);
- ED_screen_set(C, sc);
+ free_screen(oldscreen);
+ free_libblock(&CTX_data_main(C)->screen, oldscreen);
- free_screen(oldscreen);
- free_libblock(&CTX_data_main(C)->screen, oldscreen);
- }
}
else {
ScrArea *newa;
@@ -1614,7 +1601,7 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
*/
oldscreen->full = SCREENFULL;
- BLI_snprintf(newname, sizeof(newname), "%s-%s", oldscreen->id.name+2, "temp");
+ BLI_snprintf(newname, sizeof(newname), "%s-%s", oldscreen->id.name+2, "full");
sc= ED_screen_add(win, oldscreen->scene, newname);
sc->full = SCREENFULL; // XXX
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 7cdd19e435b..4fac0abb50e 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -116,6 +116,24 @@ int ED_operator_scene_editable(bContext *C)
return 0;
}
+int ED_operator_objectmode(bContext *C)
+{
+ Scene *scene= CTX_data_scene(C);
+ Object *obact= CTX_data_active_object(C);
+
+ if(scene==NULL || scene->id.lib)
+ return 0;
+ if( CTX_data_edit_object(C) )
+ return 0;
+
+ /* add a check for ob->mode too? */
+ if(obact && obact->mode)
+ return 0;
+
+ return 1;
+}
+
+
static int ed_spacetype_test(bContext *C, int type)
{
if(ED_operator_areaactive(C)) {
@@ -144,7 +162,7 @@ int ED_operator_animview_active(bContext *C)
{
if(ED_operator_areaactive(C)) {
SpaceLink *sl= (SpaceLink *)CTX_wm_space_data(C);
- if (sl && (ELEM5(sl->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_ACTION, SPACE_NLA, SPACE_TIME)))
+ if (sl && (ELEM6(sl->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_ACTION, SPACE_NLA, SPACE_IPO, SPACE_TIME)))
return TRUE;
}
@@ -226,6 +244,17 @@ int ED_operator_logic_active(bContext *C)
return ed_spacetype_test(C, SPACE_LOGIC);
}
+int ED_operator_info_active(bContext *C)
+{
+ return ed_spacetype_test(C, SPACE_INFO);
+}
+
+
+int ED_operator_console_active(bContext *C)
+{
+ return ed_spacetype_test(C, SPACE_CONSOLE);
+}
+
int ED_operator_object_active(bContext *C)
{
Object *ob = ED_object_active_context(C);
@@ -1708,6 +1737,10 @@ static int screen_set_exec(bContext *C, wmOperator *op)
int tot= BLI_countlist(&CTX_data_main(C)->screen);
int delta= RNA_int_get(op->ptr, "delta");
+ /* temp screens are for userpref or render display */
+ if(screen->temp)
+ return OPERATOR_CANCELLED;
+
/* return to previous state before switching screens */
if(sa && sa->full)
ED_screen_full_restore(C, sa);
@@ -2817,7 +2850,6 @@ static void SCREEN_OT_back_to_previous(struct wmOperatorType *ot)
static int userpref_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
- ScrArea *sa;
rcti rect;
int sizex, sizey;
@@ -2833,9 +2865,6 @@ static int userpref_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *ev
/* changes context! */
WM_window_open_temp(C, &rect, WM_WINDOW_USERPREFS);
- sa= CTX_wm_area(C);
-
-
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 082c9f2f721..a536b4ea1a4 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -256,7 +256,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
char name[FILE_MAXDIR+FILE_MAXFILE];
int ok;
- BKE_makepicstring(name, rd.pic, cfra, rd.imtype, rd.scemode & R_EXTENSION);
+ BKE_makepicstring(name, rd.pic, cfra, rd.imtype, rd.scemode & R_EXTENSION, TRUE);
ibuf->rect= sj->dumprect;
ok= BKE_write_ibuf(sj->scene, ibuf, name, rd.imtype, rd.subimtype, rd.quality);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 6f246692987..8b010b6dcdb 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -224,70 +224,70 @@ void ED_operatortypes_paint(void)
}
-static void ed_keymap_paint_brush_switch(wmKeyMap *keymap, const char *path)
+static void ed_keymap_paint_brush_switch(wmKeyMap *keymap, const char *mode)
{
wmKeyMapItem *kmi;
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", ONEKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 0);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", TWOKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 1);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", THREEKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 2);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", FOURKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 3);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", FIVEKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 4);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", SIXKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 5);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", SEVENKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 6);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", EIGHTKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 7);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", NINEKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 8);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", ZEROKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 9);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", ONEKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 10);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", TWOKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 11);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", THREEKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 12);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", FOURKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 13);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", FIVEKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 14);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", SIXKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 15);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", SEVENKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 16);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", EIGHTKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 17);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", NINEKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 18);
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", ZEROKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_int_set(kmi->ptr, "value", 19);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", ONEKEY, KM_PRESS, 0, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 0);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", TWOKEY, KM_PRESS, 0, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 1);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", THREEKEY, KM_PRESS, 0, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 2);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", FOURKEY, KM_PRESS, 0, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 3);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", FIVEKEY, KM_PRESS, 0, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 4);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", SIXKEY, KM_PRESS, 0, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 5);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", SEVENKEY, KM_PRESS, 0, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 6);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", EIGHTKEY, KM_PRESS, 0, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 7);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", NINEKEY, KM_PRESS, 0, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 8);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", ZEROKEY, KM_PRESS, 0, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 9);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", ONEKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 10);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", TWOKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 11);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", THREEKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 12);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", FOURKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 13);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", FIVEKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 14);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", SIXKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 15);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", SEVENKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 16);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", EIGHTKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 17);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", NINEKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 18);
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_set_active_number", ZEROKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_string_set(kmi->ptr, "mode", mode);
+ RNA_int_set(kmi->ptr, "number", 19);
}
static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *UNUSED(path))
@@ -333,7 +333,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
RNA_int_set(kmi->ptr, "level", -1);
RNA_boolean_set(kmi->ptr, "relative", 1);
- ed_keymap_paint_brush_switch(keymap, "tool_settings.sculpt.active_brush_index");
+ ed_keymap_paint_brush_switch(keymap, "sculpt");
ed_keymap_paint_brush_size(keymap, "tool_settings.sculpt.brush.size");
/* */
@@ -349,43 +349,6 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", AKEY, KM_PRESS, KM_SHIFT, 0);
RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush.use_airbrush");
- /* brush switching */
- kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", DKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
- RNA_string_set(kmi->ptr, "value", "SculptDraw");
-
- kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", SKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
- RNA_string_set(kmi->ptr, "value", "Smooth");
-
- kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", PKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
- RNA_string_set(kmi->ptr, "value", "Pinch/Magnify");
-
- kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", GKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
- RNA_string_set(kmi->ptr, "value", "Grab");
-
- kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", LKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
- RNA_string_set(kmi->ptr, "value", "Layer");
-
- kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", CKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
- RNA_string_set(kmi->ptr, "value", "Crease");
-
- kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", CKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
- RNA_string_set(kmi->ptr, "value", "Clay");
-
- kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", IKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
- RNA_string_set(kmi->ptr, "value", "Inflate/Deflate");
-
- kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", TKEY, KM_PRESS, KM_SHIFT, 0); // was just T in 2.4x
- RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
- RNA_string_set(kmi->ptr, "value", "Flatten/Contrast");
-
/* Vertex Paint mode */
keymap= WM_keymap_find(keyconf, "Vertex Paint", 0, 0);
keymap->poll= vertex_paint_mode_poll;
@@ -398,7 +361,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap,
"PAINT_OT_vertex_color_set",KKEY, KM_PRESS, KM_SHIFT, 0);
- ed_keymap_paint_brush_switch(keymap, "tool_settings.vertex_paint.active_brush_index");
+ ed_keymap_paint_brush_switch(keymap, "vertex_paint");
ed_keymap_paint_brush_size(keymap, "tool_settings.vertex_paint.brush.size");
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0); /* mask toggle */
@@ -416,7 +379,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap,
"PAINT_OT_weight_set", KKEY, KM_PRESS, KM_SHIFT, 0);
- ed_keymap_paint_brush_switch(keymap, "tool_settings.weight_paint.active_brush_index");
+ ed_keymap_paint_brush_switch(keymap, "weight_paint");
ed_keymap_paint_brush_size(keymap, "tool_settings.weight_paint.brush.size");
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0); /* mask toggle */
@@ -439,7 +402,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "PAINT_OT_sample_color", RIGHTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_clone_cursor_set", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
- ed_keymap_paint_brush_switch(keymap, "tool_settings.image_paint.active_brush_index");
+ ed_keymap_paint_brush_switch(keymap, "image_paint");
ed_keymap_paint_brush_size(keymap, "tool_settings.image_paint.brush.size");
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0); /* mask toggle */
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index efc39e6ae0a..79314ca4113 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -2562,8 +2562,11 @@ static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm,
unit_m4(cache->symm_rot_mat);
unit_m4(cache->symm_rot_mat_inv);
- rotate_m4(cache->symm_rot_mat, axis, angle);
- rotate_m4(cache->symm_rot_mat_inv, axis, -angle);
+
+ if(axis) { /* expects XYZ */
+ rotate_m4(cache->symm_rot_mat, axis, angle);
+ rotate_m4(cache->symm_rot_mat_inv, axis, -angle);
+ }
mul_m4_v3(cache->symm_rot_mat, cache->location);
mul_m4_v3(cache->symm_rot_mat, cache->grab_delta_symmetry);
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index 18f35502f8b..df45bc15827 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -275,7 +275,7 @@ static int unpack_exec(bContext *C, wmOperator *op)
if(G.fileflags & G_AUTOPACK)
BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save.");
- unpackSound(op->reports, sound, method);
+ unpackSound(CTX_data_main(C), op->reports, sound, method);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_console/CMakeLists.txt b/source/blender/editors/space_console/CMakeLists.txt
index dbef838db65..83912388bcd 100644
--- a/source/blender/editors/space_console/CMakeLists.txt
+++ b/source/blender/editors/space_console/CMakeLists.txt
@@ -34,7 +34,6 @@ SET(INC
SET(SRC
console_draw.c
console_ops.c
- console_report.c
space_console.c
)
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index f1fead47a0a..5a9c3249abc 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -17,11 +17,6 @@
* 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) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
* Contributor(s): Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
@@ -58,18 +53,9 @@
#include "console_intern.h"
-static int mono= -1; // XXX needs proper storage and change all the BLF_* here!
-
-static void console_font_begin(SpaceConsole *sc)
-{
- if(mono == -1)
- mono= BLF_load_mem("monospace", (unsigned char*)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size);
-
- BLF_aspect(mono, 1.0);
- BLF_size(mono, sc->lheight-2, 72);
-}
+#include "../space_info/textview.h"
-static void console_line_color(unsigned char *fg, int type)
+static void console_line_color(unsigned char fg[3], int type)
{
switch(type) {
case CONSOLE_LINE_OUTPUT:
@@ -87,39 +73,6 @@ static void console_line_color(unsigned char *fg, int type)
}
}
-static void console_report_color(unsigned char *fg, unsigned char *bg, Report *report, int bool)
-{
- /*
- if (type & RPT_ERROR_ALL) { fg[0]=220; fg[1]=0; fg[2]=0; }
- else if (type & RPT_WARNING_ALL) { fg[0]=220; fg[1]=96; fg[2]=96; }
- else if (type & RPT_OPERATOR_ALL) { fg[0]=96; fg[1]=128; fg[2]=255; }
- else if (type & RPT_INFO_ALL) { fg[0]=0; fg[1]=170; fg[2]=0; }
- else if (type & RPT_DEBUG_ALL) { fg[0]=196; fg[1]=196; fg[2]=196; }
- else { fg[0]=196; fg[1]=196; fg[2]=196; }
- */
- if(report->flag & SELECT) {
- fg[0]=255; fg[1]=255; fg[2]=255;
- if(bool) {
- bg[0]=96; bg[1]=128; bg[2]=255;
- }
- else {
- bg[0]=90; bg[1]=122; bg[2]=249;
- }
- }
-
- else {
- fg[0]=0; fg[1]=0; fg[2]=0;
-
- if(bool) {
- bg[0]=120; bg[1]=120; bg[2]=120;
- }
- else {
- bg[0]=114; bg[1]=114; bg[2]=114;
- }
-
- }
-}
-
typedef struct ConsoleDrawContext {
int cwidth;
int lheight;
@@ -133,163 +86,6 @@ typedef struct ConsoleDrawContext {
int draw;
} ConsoleDrawContext;
-static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int lheight)
-{
- if(sel[0] <= str_len_draw && sel[1] >= 0) {
- int sta = MAX2(sel[0], 0);
- int end = MIN2(sel[1], str_len_draw);
-
- glEnable(GL_POLYGON_STIPPLE);
- glPolygonStipple(stipple_halftone);
- glEnable( GL_BLEND );
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glColor4ub(255, 255, 255, 96);
-
- glRecti(xy[0]+(cwidth*sta), xy[1]-2 + lheight, xy[0]+(cwidth*end), xy[1]-2);
-
- glDisable(GL_POLYGON_STIPPLE);
- glDisable( GL_BLEND );
- }
-}
-
-
-/* return 0 if the last line is off the screen
- * should be able to use this for any string type */
-
-static int console_draw_string(ConsoleDrawContext *cdc, char *str, int str_len, unsigned char *fg, unsigned char *bg)
-{
-#define STEP_SEL(value) cdc->sel[0] += (value); cdc->sel[1] += (value)
- int rct_ofs= cdc->lheight/4;
- int tot_lines = (str_len/cdc->console_width)+1; /* total number of lines for wrapping */
- int y_next = (str_len > cdc->console_width) ? cdc->xy[1]+cdc->lheight*tot_lines : cdc->xy[1]+cdc->lheight;
-
- /* just advance the height */
- if(cdc->draw==0) {
- if(cdc->pos_pick && (cdc->mval[1] != INT_MAX)) {
- if(cdc->xy[1] <= cdc->mval[1]) {
- if((y_next >= cdc->mval[1])) {
- int ofs = (int)floor(((float)cdc->mval[0] / (float)cdc->cwidth));
-
- /* wrap */
- if(str_len > cdc->console_width)
- ofs += (cdc->console_width * ((int)((((float)(y_next - cdc->mval[1]) / (float)(y_next-cdc->xy[1])) * tot_lines))));
-
- CLAMP(ofs, 0, str_len);
- *cdc->pos_pick += str_len - ofs;
- } else
- *cdc->pos_pick += str_len + 1;
- }
- }
-
- cdc->xy[1]= y_next;
- return 1;
- }
- else if (y_next-cdc->lheight < cdc->ymin) {
- /* have not reached the drawable area so don't break */
- cdc->xy[1]= y_next;
-
- /* adjust selection even if not drawing */
- if(cdc->sel[0] != cdc->sel[1]) {
- STEP_SEL(-(str_len + 1));
- }
-
- return 1;
- }
-
- if(str_len > cdc->console_width) { /* wrap? */
- const int initial_offset= ((tot_lines-1) * cdc->console_width);
- char *line_stride= str + initial_offset; /* advance to the last line and draw it first */
- char eol; /* baclup the end of wrapping */
-
- int sel_orig[2];
- VECCOPY2D(sel_orig, cdc->sel);
-
- /* invert and swap for wrapping */
- cdc->sel[0] = str_len - sel_orig[1];
- cdc->sel[1] = str_len - sel_orig[0];
-
- if(bg) {
- glColor3ubv(bg);
- glRecti(0, cdc->xy[1]-rct_ofs, cdc->winx, (cdc->xy[1]+(cdc->lheight*tot_lines))+rct_ofs);
- }
-
- glColor3ubv(fg);
-
- /* last part needs no clipping */
- BLF_position(mono, cdc->xy[0], cdc->xy[1], 0);
- BLF_draw(mono, line_stride);
-
- if(cdc->sel[0] != cdc->sel[1]) {
- STEP_SEL(-initial_offset);
- // glColor4ub(255, 0, 0, 96); // debug
- console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->lheight);
- STEP_SEL(cdc->console_width);
- glColor3ubv(fg);
- }
-
- cdc->xy[1] += cdc->lheight;
-
- line_stride -= cdc->console_width;
-
- for(; line_stride >= str; line_stride -= cdc->console_width) {
- eol = line_stride[cdc->console_width];
- line_stride[cdc->console_width]= '\0';
-
- BLF_position(mono, cdc->xy[0], cdc->xy[1], 0);
- BLF_draw(mono, line_stride);
-
- if(cdc->sel[0] != cdc->sel[1]) {
- // glColor4ub(0, 255, 0, 96); // debug
- console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->lheight);
- STEP_SEL(cdc->console_width);
- glColor3ubv(fg);
- }
-
- cdc->xy[1] += cdc->lheight;
-
- line_stride[cdc->console_width] = eol; /* restore */
-
- /* check if were out of view bounds */
- if(cdc->xy[1] > cdc->ymax)
- return 0;
- }
-
- VECCOPY2D(cdc->sel, sel_orig);
- STEP_SEL(-(str_len + 1));
- }
- else { /* simple, no wrap */
-
- if(bg) {
- glColor3ubv(bg);
- glRecti(0, cdc->xy[1]-rct_ofs, cdc->winx, cdc->xy[1]+cdc->lheight-rct_ofs);
- }
-
- glColor3ubv(fg);
-
- BLF_position(mono, cdc->xy[0], cdc->xy[1], 0);
- BLF_draw(mono, str);
-
- if(cdc->sel[0] != cdc->sel[1]) {
- int isel[2];
-
- isel[0]= str_len - cdc->sel[1];
- isel[1]= str_len - cdc->sel[0];
-
- // glColor4ub(255, 255, 0, 96); // debug
- console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->lheight);
- STEP_SEL(-(str_len + 1));
- }
-
- cdc->xy[1] += cdc->lheight;
-
- if(cdc->xy[1] > cdc->ymax)
- return 0;
- }
-
- return 1;
-#undef STEP_SEL
-}
-
void console_scrollback_prompt_begin(struct SpaceConsole *sc, ConsoleLine *cl_dummy)
{
/* fake the edit line being in the scroll buffer */
@@ -311,142 +107,111 @@ void console_scrollback_prompt_end(struct SpaceConsole *sc, ConsoleLine *cl_dumm
#define CONSOLE_DRAW_MARGIN 4
#define CONSOLE_DRAW_SCROLL 16
-static int console_text_main__internal(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports, int draw, int mval[2], void **mouse_pick, int *pos_pick)
-{
- View2D *v2d= &ar->v2d;
- ConsoleLine *cl= sc->history.last;
- ConsoleDrawContext cdc;
-
- int x_orig=CONSOLE_DRAW_MARGIN, y_orig=CONSOLE_DRAW_MARGIN;
- int xy[2], y_prev;
- int cwidth;
- int console_width; /* number of characters that fit into the width of the console (fixed width) */
- int sel[2]= {-1, -1}; /* defaults disabled */
- unsigned char fg[3];
- console_font_begin(sc);
- cwidth = BLF_fixed_width(mono);
+/* console textview callbacks */
+static int console_textview_begin(TextViewContext *tvc)
+{
+ SpaceConsole *sc= (SpaceConsole *)tvc->arg1;
+ tvc->lheight= sc->lheight;
+ tvc->sel_start= sc->sel_start;
+ tvc->sel_end= sc->sel_end;
- console_width= (ar->winx - (CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN*2) )/cwidth;
- if (console_width < 8) console_width= 8;
+ /* iterator */
+ tvc->iter= sc->scrollback.last;
- xy[0]= x_orig; xy[1]= y_orig;
+ return (tvc->iter != NULL);
+}
+
+static void console_textview_end(TextViewContext *tvc)
+{
+ SpaceConsole *sc= (SpaceConsole *)tvc->arg1;
+ (void)sc;
- if(mval[1] != INT_MAX)
- mval[1] += (v2d->cur.ymin + CONSOLE_DRAW_MARGIN);
-
- if(pos_pick)
- *pos_pick = 0;
-
- /* constants for the sequencer context */
- cdc.cwidth= cwidth;
- cdc.lheight= sc->lheight;
- cdc.console_width= console_width;
- cdc.winx= ar->winx-(CONSOLE_DRAW_MARGIN+CONSOLE_DRAW_SCROLL);
- cdc.ymin= v2d->cur.ymin;
- cdc.ymax= v2d->cur.ymax;
- cdc.xy= xy;
- cdc.sel= sel;
- cdc.pos_pick= pos_pick;
- cdc.mval= mval;
- cdc.draw= draw;
-
- if(sc->type==CONSOLE_TYPE_PYTHON) {
- ConsoleLine cl_dummy= {0};
+}
+
+static int console_textview_step(TextViewContext *tvc)
+{
+ return ((tvc->iter= (void *)((Link *)tvc->iter)->prev) != NULL);
+}
+
+static int console_textview_line_get(struct TextViewContext *tvc, const char **line, int *len)
+{
+ ConsoleLine *cl= (ConsoleLine *)tvc->iter;
+ *line= cl->line;
+ *len= cl->len;
+
+ return 1;
+}
+
+static int console_textview_line_color(struct TextViewContext *tvc, unsigned char fg[3], unsigned char UNUSED(bg[3]))
+{
+ ConsoleLine *cl= (ConsoleLine *)tvc->iter;
+
+ /* annoying hack, to draw the prompt */
+ if(tvc->iter_index == 0) {
+ SpaceConsole *sc= (SpaceConsole *)tvc->arg1;
int prompt_len= strlen(sc->prompt);
+ int xy[2] = {CONSOLE_DRAW_MARGIN, CONSOLE_DRAW_MARGIN};
+ const int cursor = ((ConsoleLine *)sc->history.last)->cursor;
- if(sc->sel_start != sc->sel_end) {
- sel[0]= sc->sel_start;
- sel[1]= sc->sel_end;
- }
-
- /* text */
- if(draw) {
- /* cursor */
- UI_GetThemeColor3ubv(TH_CONSOLE_CURSOR, (char *)fg);
- glColor3ubv(fg);
- glRecti(xy[0]+(cwidth*(cl->cursor+prompt_len)) -1, xy[1]-2, xy[0]+(cwidth*(cl->cursor+prompt_len)) +1, xy[1]+sc->lheight-2);
-
- xy[0]= x_orig; /* remove prompt offset */
- }
-
- console_scrollback_prompt_begin(sc, &cl_dummy);
-
- for(cl= sc->scrollback.last; cl; cl= cl->prev) {
- y_prev= xy[1];
-
- if(draw)
- console_line_color(fg, cl->type);
-
- if(!console_draw_string(&cdc, cl->line, cl->len, fg, NULL)) {
- /* when drawing, if we pass v2d->cur.ymax, then quit */
- if(draw) {
- break; /* past the y limits */
- }
- }
-
- if((mval[1] != INT_MAX) && (mval[1] >= y_prev && mval[1] <= xy[1])) {
- *mouse_pick= (void *)cl;
- break;
- }
- }
-
- console_scrollback_prompt_end(sc, &cl_dummy);
- }
- else {
- Report *report;
- int report_mask= 0;
- int bool= 0;
- unsigned char bg[3];
-
- if(draw) {
- glClearColor(120.0/255.0, 120.0/255.0, 120.0/255.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
- }
-
- /* convert our display toggles into a flag compatible with BKE_report flags */
- report_mask= console_report_mask(sc);
-
- for(report=reports->list.last; report; report=report->prev) {
-
- if(report->type & report_mask) {
- y_prev= xy[1];
-
- if(draw)
- console_report_color(fg, bg, report, bool);
-
- if(!console_draw_string(&cdc, report->message, report->len, fg, bg)) {
- /* when drawing, if we pass v2d->cur.ymax, then quit */
- if(draw) {
- break; /* past the y limits */
- }
- }
- if((mval[1] != INT_MAX) && (mval[1] >= y_prev && mval[1] <= xy[1])) {
- *mouse_pick= (void *)report;
- break;
- }
-
- bool = !(bool);
- }
- }
+ /* cursor */
+ UI_GetThemeColor3ubv(TH_CONSOLE_CURSOR, (char *)fg);
+ glColor3ubv(fg);
+
+ glRecti(xy[0]+(tvc->cwidth*(cursor+prompt_len)) -1, xy[1]-2, xy[0]+(tvc->cwidth*(cursor+prompt_len)) +1, xy[1]+tvc->lheight-2);
}
- xy[1] += sc->lheight*2;
+ console_line_color(fg, cl->type);
+
+ return TVC_LINE_FG;
+}
+
+
+static int console_textview_main__internal(struct SpaceConsole *sc, struct ARegion *ar, ReportList *UNUSED(reports), int draw, int mval[2], void **mouse_pick, int *pos_pick)
+{
+ ConsoleLine cl_dummy= {0};
+ int ret= 0;
- return xy[1]-y_orig;
+ View2D *v2d= &ar->v2d;
+
+ TextViewContext tvc= {0};
+ tvc.begin= console_textview_begin;
+ tvc.end= console_textview_end;
+
+ tvc.step= console_textview_step;
+ tvc.line_get= console_textview_line_get;
+ tvc.line_color= console_textview_line_color;
+
+ tvc.arg1= sc;
+ tvc.arg2= NULL;
+
+ /* view */
+ tvc.sel_start= sc->sel_start;
+ tvc.sel_end= sc->sel_end;
+ tvc.lheight= sc->lheight;
+ tvc.ymin= v2d->cur.ymin;
+ tvc.ymax= v2d->cur.ymax;
+ tvc.winx= ar->winx;
+
+ console_scrollback_prompt_begin(sc, &cl_dummy);
+ ret= textview_draw(&tvc, draw, mval, mouse_pick, pos_pick);
+ console_scrollback_prompt_end(sc, &cl_dummy);
+
+ return ret;
}
-void console_text_main(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports)
+
+void console_textview_main(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports)
{
int mval[2] = {INT_MAX, INT_MAX};
- console_text_main__internal(sc, ar, reports, 1, mval, NULL, NULL);
+ console_textview_main__internal(sc, ar, reports, 1, mval, NULL, NULL);
}
-int console_text_height(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports)
+int console_textview_height(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports)
{
int mval[2] = {INT_MAX, INT_MAX};
- return console_text_main__internal(sc, ar, reports, 0, mval, NULL, NULL);
+ return console_textview_main__internal(sc, ar, reports, 0, mval, NULL, NULL);
}
void *console_text_pick(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports, int mouse_y)
@@ -457,7 +222,7 @@ void *console_text_pick(struct SpaceConsole *sc, struct ARegion *ar, ReportList
mval[0]= 0;
mval[1]= mouse_y;
- console_text_main__internal(sc, ar, reports, 0, mval, &mouse_pick, NULL);
+ console_textview_main__internal(sc, ar, reports, 0, mval, &mouse_pick, NULL);
return (void *)mouse_pick;
}
@@ -470,6 +235,6 @@ int console_char_pick(struct SpaceConsole *sc, struct ARegion *ar, ReportList *r
mval_clamp[0]= CLAMPIS(mval[0], CONSOLE_DRAW_MARGIN, ar->winx-(CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN));
mval_clamp[1]= CLAMPIS(mval[1], CONSOLE_DRAW_MARGIN, ar->winy-CONSOLE_DRAW_MARGIN);
- console_text_main__internal(sc, ar, reports, 0, mval_clamp, &mouse_pick, &pos_pick);
+ console_textview_main__internal(sc, ar, reports, 0, mval_clamp, &mouse_pick, &pos_pick);
return pos_pick;
}
diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h
index 1a48dd408bd..b8d53785d74 100644
--- a/source/blender/editors/space_console/console_intern.h
+++ b/source/blender/editors/space_console/console_intern.h
@@ -17,10 +17,6 @@
* 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): Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
@@ -36,8 +32,8 @@ struct ReportList;
struct bContext;
/* console_draw.c */
-void console_text_main(struct SpaceConsole *sc, struct ARegion *ar, struct ReportList *reports);
-int console_text_height(struct SpaceConsole *sc, struct ARegion *ar, struct ReportList *reports); /* needed to calculate the scrollbar */
+void console_textview_main(struct SpaceConsole *sc, struct ARegion *ar, struct ReportList *reports);
+int console_textview_height(struct SpaceConsole *sc, struct ARegion *ar, struct ReportList *reports); /* needed to calculate the scrollbar */
void *console_text_pick(struct SpaceConsole *sc, struct ARegion *ar, struct ReportList *reports, int mouse_y); /* needed for selection */
int console_char_pick(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports, int mval[2]);
@@ -68,19 +64,6 @@ void CONSOLE_OT_copy(struct wmOperatorType *ot);
void CONSOLE_OT_paste(struct wmOperatorType *ot);
void CONSOLE_OT_select_set(struct wmOperatorType *ot);
-
-
-/* console_report.c */
-void CONSOLE_OT_select_pick(struct wmOperatorType *ot); /* report selection */
-void CONSOLE_OT_select_all_toggle(struct wmOperatorType *ot);
-void CONSOLE_OT_select_border(struct wmOperatorType *ot);
-
-void CONSOLE_OT_report_replay(struct wmOperatorType *ot);
-void CONSOLE_OT_report_delete(struct wmOperatorType *ot);
-void CONSOLE_OT_report_copy(struct wmOperatorType *ot);
-
-
-
enum { LINE_BEGIN, LINE_END, PREV_CHAR, NEXT_CHAR, PREV_WORD, NEXT_WORD };
enum { DEL_ALL, DEL_NEXT_CHAR, DEL_PREV_CHAR, DEL_SELECTION, DEL_NEXT_SEL, DEL_PREV_SEL };
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index ceb16d2aab9..6aef967b851 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -17,11 +17,6 @@
* 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) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
* Contributor(s): Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
@@ -264,22 +259,6 @@ static int console_line_insert(ConsoleLine *ci, char *str)
return len;
}
-static int console_edit_poll(bContext *C)
-{
- SpaceConsole *sc= CTX_wm_space_console(C);
-
- if(!sc || sc->type != CONSOLE_TYPE_PYTHON)
- return 0;
-
- return 1;
-}
-#if 0
-static int console_poll(bContext *C)
-{
- return (CTX_wm_space_console(C) != NULL);
-}
-#endif
-
/* static funcs for text editing */
/* similar to the text editor, with some not used. keep compatible */
@@ -361,7 +340,7 @@ void CONSOLE_OT_move(wmOperatorType *ot)
/* api callbacks */
ot->exec= move_exec;
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
/* properties */
RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to.");
@@ -429,7 +408,7 @@ void CONSOLE_OT_insert(wmOperatorType *ot)
/* api callbacks */
ot->exec= insert_exec;
ot->invoke= insert_invoke;
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
/* properties */
RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position.");
@@ -498,7 +477,7 @@ void CONSOLE_OT_delete(wmOperatorType *ot)
/* api callbacks */
ot->exec= delete_exec;
- ot->poll= console_edit_poll;
+ 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.");
@@ -539,7 +518,7 @@ void CONSOLE_OT_clear(wmOperatorType *ot)
/* api callbacks */
ot->exec= clear_exec;
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
/* properties */
RNA_def_boolean(ot->srna, "scrollback", 1, "Scrollback", "Clear the scrollback history");
@@ -601,7 +580,7 @@ void CONSOLE_OT_history_cycle(wmOperatorType *ot)
/* api callbacks */
ot->exec= history_cycle_exec;
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
/* properties */
RNA_def_boolean(ot->srna, "reverse", 0, "Reverse", "reverse cycle history");
@@ -649,7 +628,7 @@ void CONSOLE_OT_history_append(wmOperatorType *ot)
/* api callbacks */
ot->exec= history_append_exec;
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
/* properties */
RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position.");
@@ -694,7 +673,7 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot)
/* api callbacks */
ot->exec= scrollback_append_exec;
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
/* properties */
RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position.");
@@ -777,7 +756,7 @@ void CONSOLE_OT_copy(wmOperatorType *ot)
ot->idname= "CONSOLE_OT_copy";
/* api callbacks */
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
ot->exec= copy_exec;
/* properties */
@@ -827,7 +806,7 @@ void CONSOLE_OT_paste(wmOperatorType *ot)
ot->idname= "CONSOLE_OT_paste";
/* api callbacks */
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
ot->exec= paste_exec;
/* properties */
@@ -946,5 +925,5 @@ void CONSOLE_OT_select_set(wmOperatorType *ot)
ot->invoke= console_modal_select_invoke;
ot->modal= console_modal_select;
ot->cancel= console_modal_select_cancel;
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
}
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index 72478133f1c..55fb6a50bb4 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -16,10 +16,6 @@
* 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): Campbell Barton
*
@@ -57,12 +53,12 @@
#include "console_intern.h" // own include
-static void console_update_rect(const bContext *C, ARegion *ar)
+static void console_textview_update_rect(const bContext *C, ARegion *ar)
{
SpaceConsole *sc= CTX_wm_space_console(C);
View2D *v2d= &ar->v2d;
- UI_view2d_totRect_set(v2d, ar->winx-1, console_text_height(sc, ar, CTX_wm_reports(C)));
+ UI_view2d_totRect_set(v2d, ar->winx-1, console_textview_height(sc, ar, CTX_wm_reports(C)));
}
/* ******************** default callbacks for console space ***************** */
@@ -76,8 +72,6 @@ static SpaceLink *console_new(const bContext *UNUSED(C))
sconsole->spacetype= SPACE_CONSOLE;
sconsole->lheight= 14;
- sconsole->type= CONSOLE_TYPE_PYTHON;
- sconsole->rpt_mask= CONSOLE_RPT_OP; /* ? - not sure whats a good default here?*/
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for console");
@@ -93,7 +87,7 @@ static SpaceLink *console_new(const bContext *UNUSED(C))
BLI_addtail(&sconsole->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
-
+ /* keep in sync with info */
ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
ar->v2d.align |= V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y; /* align bottom left */
ar->v2d.keepofs |= V2D_LOCKOFS_X;
@@ -162,12 +156,11 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar)
/* ************* dropboxes ************* */
-static int id_drop_poll(bContext *C, wmDrag *drag, wmEvent *UNUSED(event))
+static int id_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
- SpaceConsole *sc= CTX_wm_space_console(C);
- if(sc->type==CONSOLE_TYPE_PYTHON)
- if(drag->type==WM_DRAG_ID)
- return 1;
+// SpaceConsole *sc= CTX_wm_space_console(C);
+ if(drag->type==WM_DRAG_ID)
+ return 1;
return 0;
}
@@ -182,12 +175,11 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop)
RNA_string_set(drop->ptr, "text", text);
}
-static int path_drop_poll(bContext *C, wmDrag *drag, wmEvent *UNUSED(event))
+static int path_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
- SpaceConsole *sc= CTX_wm_space_console(C);
- if(sc->type==CONSOLE_TYPE_PYTHON)
- if(drag->type==WM_DRAG_PATH)
- return 1;
+// SpaceConsole *sc= CTX_wm_space_console(C);
+ if(drag->type==WM_DRAG_PATH)
+ return 1;
return 0;
}
@@ -217,14 +209,14 @@ static void console_main_area_draw(const bContext *C, ARegion *ar)
View2D *v2d= &ar->v2d;
View2DScrollers *scrollers;
- if((sc->type==CONSOLE_TYPE_PYTHON) && (sc->scrollback.first==NULL))
+ if(sc->scrollback.first==NULL)
WM_operator_name_call((bContext *)C, "CONSOLE_OT_banner", WM_OP_EXEC_DEFAULT, NULL);
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
- console_update_rect(C, ar);
+ console_textview_update_rect(C, ar);
/* worlks best with no view2d matrix set */
UI_view2d_view_ortho(v2d);
@@ -232,7 +224,7 @@ static void console_main_area_draw(const bContext *C, ARegion *ar)
/* data... */
console_history_verify(C); /* make sure we have some command line */
- console_text_main(sc, ar, CTX_wm_reports(C));
+ console_textview_main(sc, ar, CTX_wm_reports(C));
/* reset view matrix */
UI_view2d_view_restore(C);
@@ -259,15 +251,6 @@ void console_operatortypes(void)
WM_operatortype_append(CONSOLE_OT_copy);
WM_operatortype_append(CONSOLE_OT_paste);
WM_operatortype_append(CONSOLE_OT_select_set);
-
- /* console_report.c */
- WM_operatortype_append(CONSOLE_OT_select_pick);
- WM_operatortype_append(CONSOLE_OT_select_all_toggle);
- WM_operatortype_append(CONSOLE_OT_select_border);
-
- WM_operatortype_append(CONSOLE_OT_report_replay);
- WM_operatortype_append(CONSOLE_OT_report_delete);
- WM_operatortype_append(CONSOLE_OT_report_copy);
}
void console_keymap(struct wmKeyConfig *keyconf)
@@ -335,16 +318,6 @@ void console_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "CONSOLE_OT_autocomplete", SPACEKEY, KM_PRESS, KM_CTRL, 0); /* python operator - space_text.py */
#endif
- /* report selection */
- WM_keymap_add_item(keymap, "CONSOLE_OT_select_pick", SELECTMOUSE, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "CONSOLE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "CONSOLE_OT_select_border", BKEY, KM_PRESS, 0, 0);
-
- WM_keymap_add_item(keymap, "CONSOLE_OT_report_replay", RKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "CONSOLE_OT_report_delete", XKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "CONSOLE_OT_report_delete", DELKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "CONSOLE_OT_report_copy", CKEY, KM_PRESS, KM_CTRL, 0);
-
WM_keymap_add_item(keymap, "CONSOLE_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "CONSOLE_OT_paste", VKEY, KM_PRESS, KM_CTRL, 0);
#ifdef __APPLE__
@@ -371,19 +344,15 @@ static void console_header_area_draw(const bContext *C, ARegion *ar)
ED_region_header(C, ar);
}
-static void console_main_area_listener(ScrArea *sa, wmNotifier *wmn)
+static void console_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
- SpaceConsole *sc= sa->spacedata.first;
+ // SpaceInfo *sinfo= sa->spacedata.first;
/* context changes */
switch(wmn->category) {
case NC_SPACE:
if(wmn->data == ND_SPACE_CONSOLE) { /* generic redraw request */
- ED_area_tag_redraw(sa);
- }
- else if(wmn->data == ND_SPACE_CONSOLE_REPORT && sc->type==CONSOLE_TYPE_REPORT) {
- /* redraw also but only for report view, could do less redraws by checking the type */
- ED_area_tag_redraw(sa);
+ ED_region_tag_redraw(ar);
}
break;
}
@@ -405,7 +374,6 @@ void ED_spacetype_console(void)
st->operatortypes= console_operatortypes;
st->keymap= console_keymap;
st->dropboxes= console_dropboxes;
- st->listener= console_main_area_listener;
/* regions: main window */
art= MEM_callocN(sizeof(ARegionType), "spacetype console region");
@@ -414,7 +382,7 @@ void ED_spacetype_console(void)
art->init= console_main_area_init;
art->draw= console_main_area_draw;
-
+ art->listener= console_main_area_listener;
diff --git a/source/blender/editors/space_file/CMakeLists.txt b/source/blender/editors/space_file/CMakeLists.txt
index 3130e6d6c14..a4b402cce43 100644
--- a/source/blender/editors/space_file/CMakeLists.txt
+++ b/source/blender/editors/space_file/CMakeLists.txt
@@ -41,7 +41,6 @@ SET(SRC
filesel.c
fsmenu.c
space_file.c
- writeimage.c
)
IF(WITH_IMAGE_OPENEXR)
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 65415d382ec..76760fb76fd 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -177,7 +177,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
/* callbacks for operator check functions */
uiBlockSetFunc(block, file_draw_check_cb, NULL, NULL);
- but = uiDefBut(block, TEX, B_FS_DIRNAME, "",
+ but = uiDefButTextO(block, TEX, "FILE_OT_directory", 0, "",
min_x, line1_y, line1_w-chan_offs, btn_h,
params->dir, 0.0, (float)FILE_MAX-1, 0, 0,
"File path.");
@@ -240,56 +240,6 @@ static void draw_tile(int sx, int sy, int width, int height, int colorid, int sh
uiRoundBox(sx, sy - height, sx + width, sy, 5);
}
-#define FILE_SHORTEN_END 0
-#define FILE_SHORTEN_FRONT 1
-
-static float shorten_string(char* string, float w, int flag)
-{
- char temp[FILE_MAX];
- short shortened = 0;
- float sw = 0;
- float pad = 0;
-
- if (w <= 0) {
- *string = '\0';
- return 0.0;
- }
-
- sw = file_string_width(string);
- if (flag == FILE_SHORTEN_FRONT) {
- char *s = string;
- BLI_strncpy(temp, "...", 4);
- pad = file_string_width(temp);
- while ((*s) && (sw+pad>w)) {
- s++;
- sw = file_string_width(s);
- shortened = 1;
- }
- if (shortened) {
- int slen = strlen(s);
- BLI_strncpy(temp+3, s, slen+1);
- temp[slen+4] = '\0';
- BLI_strncpy(string, temp, slen+4);
- }
- } else {
- char *s = string;
- while (sw>w) {
- int slen = strlen(string);
- string[slen-1] = '\0';
- sw = file_string_width(s);
- shortened = 1;
- }
-
- if (shortened) {
- int slen = strlen(string);
- if (slen > 3) {
- BLI_strncpy(string+slen-3, "...", 4);
- }
- }
- }
-
- return sw;
-}
static int get_file_icon(struct direntry *file)
{
@@ -340,25 +290,26 @@ static void file_draw_icon(uiBlock *block, char *path, int sx, int sy, int icon,
}
-static void file_draw_string(int sx, int sy, const char* string, float width, int height, int flag)
+static void file_draw_string(int sx, int sy, const char* string, float width, int height, short align)
{
- uiStyle *style= U.uistyles.first;
- int soffs;
char fname[FILE_MAXFILE];
+ rcti rect;
float sw;
- float x,y;
+ uiStyle *style= U.uistyles.first;
+ uiFontStyle fs = style->widgetlabel;
+ fs.align = align;
BLI_strncpy(fname,string, FILE_MAXFILE);
- sw = shorten_string(fname, width, flag );
+ sw = file_shorten_string(fname, width+1, 0 );
- soffs = (width - sw) / 2;
- x = (float)(sx);
- y = (float)(sy-height);
- uiStyleFontSet(&style->widget);
- BLF_position(style->widget.uifont_id, x, y, 0);
- BLF_draw(style->widget.uifont_id, fname);
+ rect.xmin = sx;
+ rect.xmax = sx + width;
+ rect.ymin = sy - height;
+ rect.ymax = sy;
+
+ uiStyleFontDraw(&fs, &rect, fname);
}
void file_calc_previews(const bContext *C, ARegion *ar)
@@ -513,9 +464,11 @@ void file_draw_list(const bContext *C, ARegion *ar)
int colorid = 0;
int sx, sy;
int offset;
+ int textwidth, textheight;
int i;
- float sw, spos;
short is_icon;
+ short align;
+
numfiles = filelist_numfiles(files);
@@ -538,6 +491,11 @@ void file_draw_list(const bContext *C, ARegion *ar)
numfiles_layout += layout->columns;
}
+ textwidth =( FILE_IMGDISPLAY == params->display) ? layout->tile_w : layout->column_widths[COLUMN_NAME];
+ textheight = layout->textheight*3.0/2.0 + 0.5;
+
+ align = ( FILE_IMGDISPLAY == params->display) ? UI_STYLE_TEXT_CENTER : UI_STYLE_TEXT_LEFT;
+
for (i=offset; (i < numfiles) && (i<offset+numfiles_layout); ++i)
{
ED_fileselect_layout_tilepos(layout, i, &sx, &sy);
@@ -548,20 +506,6 @@ void file_draw_list(const bContext *C, ARegion *ar)
UI_ThemeColor4(TH_TEXT);
- spos = ( FILE_IMGDISPLAY == params->display ) ? sx : sx + ICON_DEFAULT_WIDTH + 4;
-
- sw = file_string_width(file->relname);
- if (file->flags & EDITING) {
- int but_width = (FILE_IMGDISPLAY == params->display) ? layout->tile_w : layout->column_widths[COLUMN_NAME];
-
- uiBut *but = uiDefBut(block, TEX, 1, "", spos, sy-layout->tile_h-3,
- but_width, layout->textheight*2, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit),0,0,"");
- uiButSetRenameFunc(but, renamebutton_cb, file);
- uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */
- if ( 0 == uiButActiveOnly(C, block, but)) {
- file->flags &= ~EDITING;
- }
- }
if (!(file->flags & EDITING)) {
if (params->active_file == i) {
@@ -584,58 +528,61 @@ void file_draw_list(const bContext *C, ARegion *ar)
}
file_draw_preview(block, file, sx, sy, imb, layout, !is_icon && (file->flags & IMAGEFILE));
-
} else {
file_draw_icon(block, file->path, sx, sy-3, get_file_icon(file), ICON_DEFAULT_WIDTH, ICON_DEFAULT_WIDTH);
+ sx += ICON_DEFAULT_WIDTH + 4;
}
UI_ThemeColor4(TH_TEXT);
+
+ if (file->flags & EDITING) {
+ uiBut *but = uiDefBut(block, TEX, 1, "", sx , sy-layout->tile_h-3,
+ textwidth, textheight, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit),0,0,"");
+ uiButSetRenameFunc(but, renamebutton_cb, file);
+ uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */
+ if ( 0 == uiButActiveOnly(C, block, but)) {
+ file->flags &= ~EDITING;
+ }
+ }
+
if (!(file->flags & EDITING)) {
- float name_width = (FILE_IMGDISPLAY == params->display) ? layout->tile_w : sw;
- file_draw_string(spos, sy, file->relname, name_width, layout->tile_h, FILE_SHORTEN_END);
+ int tpos = (FILE_IMGDISPLAY == params->display) ? sy - layout->tile_h + layout->textheight : sy;
+ file_draw_string(sx+1, tpos, file->relname, textwidth, textheight, align);
}
if (params->display == FILE_SHORTDISPLAY) {
- spos += layout->column_widths[COLUMN_NAME] + 12;
+ sx += layout->column_widths[COLUMN_NAME] + 12;
if (!(file->type & S_IFDIR)) {
- sw = file_string_width(file->size);
- file_draw_string(spos, sy, file->size, sw+1, layout->tile_h, FILE_SHORTEN_END);
- spos += layout->column_widths[COLUMN_SIZE] + 12;
+ file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align);
+ sx += layout->column_widths[COLUMN_SIZE] + 12;
}
} else if (params->display == FILE_LONGDISPLAY) {
- spos += layout->column_widths[COLUMN_NAME] + 12;
+ sx += layout->column_widths[COLUMN_NAME] + 12;
#ifndef WIN32
/* rwx rwx rwx */
- sw = file_string_width(file->mode1);
- file_draw_string(spos, sy, file->mode1, sw, layout->tile_h, FILE_SHORTEN_END);
- spos += layout->column_widths[COLUMN_MODE1] + 12;
+ file_draw_string(sx, sy, file->mode1, layout->column_widths[COLUMN_MODE1], layout->tile_h, align);
+ sx += layout->column_widths[COLUMN_MODE1] + 12;
- sw = file_string_width(file->mode2);
- file_draw_string(spos, sy, file->mode2, sw, layout->tile_h, FILE_SHORTEN_END);
- spos += layout->column_widths[COLUMN_MODE2] + 12;
+ file_draw_string(sx, sy, file->mode2, layout->column_widths[COLUMN_MODE2], layout->tile_h, align);
+ sx += layout->column_widths[COLUMN_MODE2] + 12;
- sw = file_string_width(file->mode3);
- file_draw_string(spos, sy, file->mode3, sw, layout->tile_h, FILE_SHORTEN_END);
- spos += layout->column_widths[COLUMN_MODE3] + 12;
+ file_draw_string(sx, sy, file->mode3, layout->column_widths[COLUMN_MODE3], layout->tile_h, align);
+ sx += layout->column_widths[COLUMN_MODE3] + 12;
- sw = file_string_width(file->owner);
- file_draw_string(spos, sy, file->owner, sw, layout->tile_h, FILE_SHORTEN_END);
- spos += layout->column_widths[COLUMN_OWNER] + 12;
+ file_draw_string(sx, sy, file->owner, layout->column_widths[COLUMN_OWNER] , layout->tile_h, align);
+ sx += layout->column_widths[COLUMN_OWNER] + 12;
#endif
- sw = file_string_width(file->date);
- file_draw_string(spos, sy, file->date, sw, layout->tile_h, FILE_SHORTEN_END);
- spos += layout->column_widths[COLUMN_DATE] + 12;
+ file_draw_string(sx, sy, file->date, layout->column_widths[COLUMN_DATE], layout->tile_h, align);
+ sx += layout->column_widths[COLUMN_DATE] + 12;
- sw = file_string_width(file->time);
- file_draw_string(spos, sy, file->time, sw, layout->tile_h, FILE_SHORTEN_END);
- spos += layout->column_widths[COLUMN_TIME] + 12;
+ file_draw_string(sx, sy, file->time, layout->column_widths[COLUMN_TIME] , layout->tile_h, align);
+ sx += layout->column_widths[COLUMN_TIME] + 12;
if (!(file->type & S_IFDIR)) {
- sw = file_string_width(file->size);
- file_draw_string(spos, sy, file->size, sw, layout->tile_h, FILE_SHORTEN_END);
- spos += layout->column_widths[COLUMN_SIZE] + 12;
+ file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align);
+ sx += layout->column_widths[COLUMN_SIZE] + 12;
}
}
}
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h
index 07a24454520..fc7ab289683 100644
--- a/source/blender/editors/space_file/file_intern.h
+++ b/source/blender/editors/space_file/file_intern.h
@@ -66,6 +66,7 @@ void FILE_OT_cancel(struct wmOperatorType *ot);
void FILE_OT_parent(struct wmOperatorType *ot);
void FILE_OT_directory_new(struct wmOperatorType *ot);
void FILE_OT_filename(struct wmOperatorType *ot);
+void FILE_OT_directory(struct wmOperatorType *ot);
void FILE_OT_previous(struct wmOperatorType *ot);
void FILE_OT_next(struct wmOperatorType *ot);
void FILE_OT_refresh(struct wmOperatorType *ot);
@@ -92,7 +93,9 @@ void file_operator_to_sfile(struct SpaceFile *sfile, struct wmOperator *op);
/* filesel.c */
+float file_shorten_string(char* string, float w, int front);
float file_string_width(const char* str);
+
float file_font_pointsize();
void file_change_dir(bContext *C, int checkdir);
int file_select_match(struct SpaceFile *sfile, const char *pattern);
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 1af8e9d14be..2e8db0dc998 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -947,6 +947,8 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
{
char name[FILE_MAXFILE];
char path[FILE_MAX];
+ int generate_name= 1;
+
SpaceFile *sfile= CTX_wm_space_file(C);
if(!sfile->params) {
@@ -954,13 +956,22 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- /* create a new, non-existing folder name */
- if (!new_folder_path(sfile->params->dir, path, name)) {
- BKE_report(op->reports,RPT_ERROR, "Couldn't create new folder name.");
- return OPERATOR_CANCELLED;
+ path[0] = '\0';
+
+ if(RNA_struct_find_property(op->ptr, "directory")) {
+ RNA_string_get(op->ptr, "directory", path);
+ if (path[0] != '\0') generate_name= 0;
}
-
- /* rename the file */
+
+ if (generate_name) {
+ /* create a new, non-existing folder name */
+ if (!new_folder_path(sfile->params->dir, path, name)) {
+ BKE_report(op->reports,RPT_ERROR, "Couldn't create new folder name.");
+ return OPERATOR_CANCELLED;
+ }
+ }
+
+ /* create the file */
BLI_recurdir_fileops(path);
if (!BLI_exists(path)) {
@@ -994,9 +1005,13 @@ void FILE_OT_directory_new(struct wmOperatorType *ot)
ot->invoke= WM_operator_confirm;
ot->exec= file_directory_new_exec;
ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+
+ RNA_def_string_dir_path(ot->srna, "directory", "", FILE_MAX, "Directory", "Name of new directory");
+
}
-int file_directory_exec(bContext *C, wmOperator *UNUSED(unused))
+
+static void file_expand_directory(bContext *C)
{
SpaceFile *sfile= CTX_wm_space_file(C);
@@ -1011,6 +1026,39 @@ int file_directory_exec(bContext *C, wmOperator *UNUSED(unused))
if (sfile->params->dir[0] == '\0')
get_default_root(sfile->params->dir);
#endif
+ }
+}
+
+int file_directory_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+{
+ SpaceFile *sfile= CTX_wm_space_file(C);
+
+ if(sfile->params) {
+ file_expand_directory(C);
+
+ if (!BLI_exists(sfile->params->dir)) {
+ return WM_operator_confirm_message(C, op, "Create new directory?");
+ }
+
+ return file_directory_exec(C, op);
+ }
+
+ return OPERATOR_CANCELLED;
+}
+
+
+
+int file_directory_exec(bContext *C, wmOperator *UNUSED(unused))
+{
+ SpaceFile *sfile= CTX_wm_space_file(C);
+
+ if(sfile->params) {
+ file_expand_directory(C);
+
+ if (!BLI_exists(sfile->params->dir)) {
+ BLI_recurdir_fileops(sfile->params->dir);
+ }
+
BLI_cleanup_dir(G.main->name, sfile->params->dir);
BLI_add_slash(sfile->params->dir);
file_change_dir(C, 1);
@@ -1037,6 +1085,18 @@ int file_filename_exec(bContext *C, wmOperator *UNUSED(unused))
return OPERATOR_FINISHED;
}
+void FILE_OT_directory(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Enter Directory Name";
+ ot->description= "Enter a directory name";
+ ot->idname= "FILE_OT_directory";
+
+ /* api callbacks */
+ ot->invoke= file_directory_invoke;
+ ot->exec= file_directory_exec;
+ ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+}
void FILE_OT_refresh(struct wmOperatorType *ot)
{
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index 9096b9eed27..86cd4a967f1 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -33,6 +33,7 @@
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
+#include "DNA_userdef_types.h"
#include "MEM_guardedalloc.h"
@@ -146,8 +147,11 @@ static void file_panel_recent(const bContext *C, Panel *pa)
{
SpaceFile *sfile= CTX_wm_space_file(C);
- if(sfile)
- file_panel_category(C, pa, FS_CATEGORY_RECENT, &sfile->recentnr, ICON_FILE_FOLDER, 0, 1);
+ if(sfile) {
+ if ( !(U.uiflag & USER_HIDE_RECENT) ) {
+ file_panel_category(C, pa, FS_CATEGORY_RECENT, &sfile->recentnr, ICON_FILE_FOLDER, 0, 1);
+ }
+ }
}
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 6442cfbb4eb..d55fcd7d8ba 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -79,6 +79,7 @@
#include "RNA_access.h"
#include "UI_interface.h"
+#include "UI_interface_icons.h"
#include "file_intern.h"
#include "filelist.h"
@@ -199,12 +200,16 @@ short ED_fileselect_set_params(SpaceFile *sfile)
params->flag |= RNA_boolean_get(op->ptr, "autoselect") ? FILE_AUTOSELECT : 0;
params->flag |= RNA_boolean_get(op->ptr, "active_layer") ? FILE_ACTIVELAY : 0;
}
-
- if(params->filter & (IMAGEFILE|MOVIEFILE))
- params->display= FILE_IMGDISPLAY;
- else
- params->display= FILE_SHORTDISPLAY;
+ if (U.uiflag & USER_SHOW_THUMBNAILS) {
+ if(params->filter & (IMAGEFILE|MOVIEFILE))
+ params->display= FILE_IMGDISPLAY;
+ else
+ params->display= FILE_SHORTDISPLAY;
+ } else {
+ params->display= FILE_SHORTDISPLAY;
+ }
+
} else {
/* default values, if no operator */
params->type = FILE_UNIX;
@@ -283,11 +288,62 @@ void ED_fileselect_layout_tilepos(FileLayout* layout, int tile, int *x, int *y)
}
}
+/* Shorten a string to a given width w.
+ If front is set, shorten from the front,
+ otherwise shorten from the end. */
+float file_shorten_string(char* string, float w, int front)
+{
+ char temp[FILE_MAX];
+ short shortened = 0;
+ float sw = 0;
+ float pad = 0;
+
+ if (w <= 0) {
+ *string = '\0';
+ return 0.0;
+ }
+
+ sw = file_string_width(string);
+ if (front == 1) {
+ char *s = string;
+ BLI_strncpy(temp, "...", 4);
+ pad = file_string_width(temp);
+ while ((*s) && (sw+pad>w)) {
+ s++;
+ sw = file_string_width(s);
+ shortened = 1;
+ }
+ if (shortened) {
+ int slen = strlen(s);
+ BLI_strncpy(temp+3, s, slen+1);
+ temp[slen+4] = '\0';
+ BLI_strncpy(string, temp, slen+4);
+ }
+ } else {
+ char *s = string;
+ while (sw>w) {
+ int slen = strlen(string);
+ string[slen-1] = '\0';
+ sw = file_string_width(s);
+ shortened = 1;
+ }
+
+ if (shortened) {
+ int slen = strlen(string);
+ if (slen > 3) {
+ BLI_strncpy(string+slen-3, "...", 4);
+ }
+ }
+ }
+
+ return sw;
+}
+
float file_string_width(const char* str)
{
uiStyle *style= U.uistyles.first;
uiStyleFontSet(&style->widget);
- return BLF_width(style->widget.uifont_id, (char *)str);
+ return BLF_width(style->widget.uifont_id, str);
}
float file_font_pointsize()
@@ -315,7 +371,7 @@ static void column_widths(struct FileList* files, struct FileLayout* layout)
if (file) {
int len;
len = file_string_width(file->relname);
- if (len > layout->column_widths[COLUMN_NAME]) layout->column_widths[COLUMN_NAME] = len + 20;
+ if (len > layout->column_widths[COLUMN_NAME]) layout->column_widths[COLUMN_NAME] = len;
len = file_string_width(file->date);
if (len > layout->column_widths[COLUMN_DATE]) layout->column_widths[COLUMN_DATE] = len;
len = file_string_width(file->time);
@@ -387,11 +443,12 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
column_widths(sfile->files, layout);
if (params->display == FILE_SHORTDISPLAY) {
- maxlen = layout->column_widths[COLUMN_NAME] + 12 +
- layout->column_widths[COLUMN_SIZE];
- maxlen += 20; // for icon
+ maxlen = ICON_DEFAULT_WIDTH + 4 +
+ layout->column_widths[COLUMN_NAME] + 12 +
+ layout->column_widths[COLUMN_SIZE] + 12;
} else {
- maxlen = layout->column_widths[COLUMN_NAME] + 12 +
+ maxlen = ICON_DEFAULT_WIDTH + 4 +
+ layout->column_widths[COLUMN_NAME] + 12 +
#ifndef WIN32
layout->column_widths[COLUMN_MODE1] + 12 +
layout->column_widths[COLUMN_MODE2] + 12 +
@@ -400,8 +457,8 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
#endif
layout->column_widths[COLUMN_DATE] + 12 +
layout->column_widths[COLUMN_TIME] + 12 +
- layout->column_widths[COLUMN_SIZE];
- maxlen += 20; // for icon
+ layout->column_widths[COLUMN_SIZE] + 12;
+
}
layout->tile_w = maxlen;
if(layout->rows > 0)
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 92244165dc1..b46704c8a6b 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -377,6 +377,7 @@ void file_operatortypes(void)
WM_operatortype_append(FILE_OT_delete);
WM_operatortype_append(FILE_OT_rename);
WM_operatortype_append(FILE_OT_smoothscroll);
+ WM_operatortype_append(FILE_OT_directory);
}
/* NOTE: do not add .blend file reading on this level */
diff --git a/source/blender/editors/space_file/writeimage.c b/source/blender/editors/space_file/writeimage.c
deleted file mode 100644
index 750cf98727a..00000000000
--- a/source/blender/editors/space_file/writeimage.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <string.h>
-
-
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
-
-#include "BLI_blenlib.h"
-
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-
-#include "BKE_context.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_image.h"
-
-#include "RE_pipeline.h"
-
-#include "file_intern.h"
-
-/* XXX */
-static void error(const char *UNUSED(dummy)) {}
-static void waitcursor(int UNUSED(val)) {}
-static void activate_fileselect(int UNUSED(d1), char *UNUSED(d2), char *UNUSED(d3), void *UNUSED(d4)) {}
-static int saveover(const char *UNUSED(dummy)) {return 0;}
-/* XXX */
-
-
-/* ------------------------------------------------------------------------- */
-
-/* callback for fileselect to save rendered image, renderresult was checked to exist */
-static void save_rendered_image_cb_real(char *name, int confirm)
-{
- Scene *scene= NULL; // XXX
- char str[FILE_MAXDIR+FILE_MAXFILE];
- int overwrite;
-
- if(BLI_testextensie(name,".blend")) {
- error("Wrong filename");
- return;
- }
-
- /* BKE_add_image_extension() checks for if extension was already set */
- if(scene->r.scemode & R_EXTENSION)
- if(strlen(name)<FILE_MAXDIR+FILE_MAXFILE-5)
- BKE_add_image_extension(name, scene->r.imtype);
-
- strcpy(str, name);
- BLI_path_abs(str, G.main->name);
-
- if (confirm)
- overwrite = saveover(str);
- else
- overwrite = 1;
-
- if(overwrite) {
- if(scene->r.imtype==R_MULTILAYER) {
- Render *re= RE_GetRender(scene->id.name);
- RenderResult *rr= RE_AcquireResultRead(re);
- if(rr)
- RE_WriteRenderResult(rr, str, scene->r.quality);
- RE_ReleaseResult(re);
- }
- else {
- Render *re= RE_GetRender(scene->id.name);
- RenderResult rres;
- ImBuf *ibuf;
-
- RE_AcquireResultImage(re, &rres);
-
- waitcursor(1); /* from screen.c */
-
- ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.planes, 0);
- ibuf->rect= (unsigned int *)rres.rect32;
- ibuf->rect_float= rres.rectf;
- ibuf->zbuf_float= rres.rectz;
-
- /* float factor for random dither, imbuf takes care of it */
- ibuf->dither= scene->r.dither_intensity;
-
- BKE_write_ibuf(scene, ibuf, str, scene->r.imtype, scene->r.subimtype, scene->r.quality);
- IMB_freeImBuf(ibuf); /* imbuf knows rects are not part of ibuf */
-
- RE_ReleaseResultImage(re);
- }
-
- strcpy(G.ima, name);
-
- waitcursor(0);
- }
-}
-
-
-void save_image_filesel_str(Scene *scene, char *str)
-{
- switch(scene->r.imtype) {
-#ifdef WITH_HDR
- case R_RADHDR:
- strcpy(str, "Save Radiance HDR");
- break;
-#endif
- case R_FFMPEG:
- case R_H264:
- case R_XVID:
- case R_THEORA:
- case R_PNG:
- strcpy(str, "Save PNG");
- break;
-#ifdef WITH_DDS
- case R_DDS:
- strcpy(str, "Save DDS");
- break;
-#endif
- case R_BMP:
- strcpy(str, "Save BMP");
- break;
-#ifdef WITH_TIFF
- case R_TIFF:
- strcpy(str, "Save TIFF");
- break;
-#endif
-#ifdef WITH_OPENEXR
- case R_OPENEXR:
- strcpy(str, "Save OpenEXR");
- break;
-#endif
-#ifdef WITH_CINEON
- case R_CINEON:
- strcpy(str, "Save Cineon");
- break;
- case R_DPX:
- strcpy(str, "Save DPX");
- break;
-#endif
- case R_RAWTGA:
- strcpy(str, "Save Raw Targa");
- break;
- case R_IRIS:
- strcpy(str, "Save IRIS");
- break;
- case R_IRIZ:
- strcpy(str, "Save IRIS");
- break;
- case R_TARGA:
- strcpy(str, "Save Targa");
- break;
- case R_MULTILAYER:
- strcpy(str, "Save Multi Layer EXR");
- break;
-#ifdef WITH_OPENJPEG
- case R_JP2:
- strcpy(str, "Save JPEG2000");
- break;
-#endif
- /* default we save jpeg, also for all movie formats */
- case R_JPEG90:
- case R_AVICODEC:
- case R_AVIRAW:
- case R_AVIJPEG:
- default:
- strcpy(str, "Save JPEG");
- break;
- }
-}
-
-static void save_rendered_image_cb(char *name)
-{
- save_rendered_image_cb_real(name, 1);
-}
-
-/* no fileselect, no confirm */
-void BIF_save_rendered_image(char *name)
-{
- save_rendered_image_cb_real(name, 0);
-}
-
-/* calls fileselect */
-void BIF_save_rendered_image_fs(Scene *scene)
-{
- Render *re= RE_GetRender(scene->id.name);
- RenderResult rres;
-
- RE_AcquireResultImage(re, &rres);
-
- if(!rres.rectf && !rres.rect32) {
- error("No image rendered");
- }
- else {
- char dir[FILE_MAXDIR * 2], str[FILE_MAXFILE * 2];
-
- if(G.ima[0]==0) {
- strcpy(dir, G.main->name);
- BLI_splitdirstring(dir, str);
- strcpy(G.ima, dir);
- }
-
- save_image_filesel_str(scene, str);
- activate_fileselect(FILE_SPECIAL, str, G.ima, save_rendered_image_cb);
- }
-
- RE_ReleaseResultImage(re);
-}
-
-
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 50730e3b35e..ea6579f3429 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -124,6 +124,7 @@ static int space_image_buffer_exists_poll(bContext *C)
static int space_image_file_exists_poll(bContext *C)
{
if(space_image_buffer_exists_poll(C)) {
+ Main *bmain= CTX_data_main(C);
SpaceImage *sima= CTX_wm_space_image(C);
ImBuf *ibuf;
void *lock;
@@ -133,7 +134,7 @@ static int space_image_file_exists_poll(bContext *C)
ibuf= ED_space_image_acquire_buffer(sima, &lock);
if(ibuf) {
BLI_strncpy(name, ibuf->name, FILE_MAX);
- BLI_path_abs(name, G.main->name);
+ BLI_path_abs(name, bmain->name);
poll= (BLI_exists(name) && BLI_is_writable(name));
}
ED_space_image_release_buffer(sima, lock);
@@ -688,9 +689,10 @@ static int open_cancel(bContext *UNUSED(C), wmOperator *op)
static int open_exec(bContext *C, wmOperator *op)
{
- SpaceImage *sima= CTX_wm_space_image(C);
+ SpaceImage *sima= CTX_wm_space_image(C); /* XXX other space types can call */
Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
+ ImageUser *iuser= NULL;
PropertyPointerRNA *pprop;
PointerRNA idptr;
Image *ima= NULL;
@@ -724,11 +726,25 @@ static int open_exec(bContext *C, wmOperator *op)
RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr);
RNA_property_update(C, &pprop->ptr, pprop->prop);
}
- else if(sima)
+ else if(sima) {
ED_space_image_set(C, sima, scene, obedit, ima);
+ iuser= &sima->iuser;
+ }
+ else {
+ Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+ if(tex && tex->type==TEX_IMAGE)
+ iuser= &tex->iuser;
+
+ }
+
+ /* initialize because of new image */
+ if(iuser) {
+ iuser->sfra= 1;
+ iuser->offset= 0;
+ iuser->fie_ima= 2;
+ }
- // XXX other users?
- BKE_image_signal(ima, (sima)? &sima->iuser: NULL, IMA_SIGNAL_RELOAD);
+ BKE_image_signal(ima, iuser, IMA_SIGNAL_RELOAD);
WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, ima);
MEM_freeN(op->customdata);
@@ -738,7 +754,7 @@ static int open_exec(bContext *C, wmOperator *op)
static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- SpaceImage *sima= CTX_wm_space_image(C);
+ SpaceImage *sima= CTX_wm_space_image(C); /* XXX other space types can call */
char *path=U.textudir;
Image *ima= NULL;
@@ -769,6 +785,7 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
return OPERATOR_RUNNING_MODAL;
}
+/* called by other space types too */
void IMAGE_OT_open(wmOperatorType *ot)
{
/* identifiers */
@@ -853,50 +870,48 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
if (ibuf) {
- int relative= (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path"));
- int save_copy= (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy"));
+ Main *bmain= CTX_data_main(C);
+ 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;
- BLI_path_abs(path, G.main->name);
-
- if(scene->r.scemode & R_EXTENSION) {
- BKE_add_image_extension(path, sima->imtypenr);
- }
+ BLI_path_abs(path, bmain->name);
+ WM_cursor_wait(1);
+
/* enforce user setting for RGB or RGBA, but skip BW */
if(scene->r.planes==32)
ibuf->depth= 32;
else if(scene->r.planes==24)
ibuf->depth= 24;
- WM_cursor_wait(1);
-
+ if(scene->r.scemode & R_EXTENSION) {
+ BKE_add_image_extension(path, sima->imtypenr);
+ }
+
if(sima->imtypenr==R_MULTILAYER) {
RenderResult *rr= BKE_image_acquire_renderresult(scene, ima);
if(rr) {
RE_WriteRenderResult(rr, path, scene->r.quality);
-
- if(relative)
- BLI_path_rel(path, G.main->name); /* only after saving */
-
- if(!save_copy) {
- if(do_newpath) {
- BLI_strncpy(ima->name, path, sizeof(ima->name));
- BLI_strncpy(ibuf->name, path, sizeof(ibuf->name));
- }
-
- /* should be function? nevertheless, saving only happens here */
- for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next)
- ibuf->userflags &= ~IB_BITMAPDIRTY;
- }
+ ok= TRUE;
}
- else
+ else {
BKE_report(op->reports, RPT_ERROR, "Did not write, no Multilayer Image");
+ }
BKE_image_release_renderresult(scene, ima);
}
else if (BKE_write_ibuf(scene, ibuf, path, sima->imtypenr, scene->r.subimtype, scene->r.quality)) {
+ ok= TRUE;
+ }
+ if(ok) {
if(relative)
- BLI_path_rel(path, G.main->name); /* only after saving */
+ BLI_path_rel(path, bmain->name); /* only after saving */
+
+ if(ibuf->name[0]==0) {
+ BLI_strncpy(ibuf->name, path, sizeof(ibuf->name));
+ BLI_strncpy(ima->name, path, sizeof(ima->name));
+ }
if(!save_copy) {
if(do_newpath) {
@@ -926,14 +941,14 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
ima->source= IMA_SRC_FILE;
ima->type= IMA_TYPE_IMAGE;
}
-
- /* name image as how we saved it */
- rename_id(&ima->id, BLI_path_basename(path));
}
- }
- else
+ }
+ else {
BKE_reportf(op->reports, RPT_ERROR, "Couldn't write image: %s", path);
-
+ }
+
+
+
WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, sima->image);
WM_cursor_wait(0);
@@ -978,6 +993,8 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
Image *ima = ED_space_image(sima);
Scene *scene= CTX_data_scene(C);
ImBuf *ibuf;
+ char filename[FILE_MAX];
+
void *lock;
if(!RNA_property_is_set(op->ptr, "relative_path"))
@@ -1006,15 +1023,21 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
RNA_enum_set(op->ptr, "file_type", sima->imtypenr);
if(ibuf->name[0]==0)
- BLI_strncpy(ibuf->name, G.ima, FILE_MAX);
-
+ if ( (G.ima[0] == '/') && (G.ima[1] == '/') && (G.ima[2] == '\0') ) {
+ BLI_strncpy(filename, "//untitled", FILE_MAX);
+ } else {
+ BLI_strncpy(filename, G.ima, FILE_MAX);
+ }
+ else
+ BLI_strncpy(filename, ibuf->name, FILE_MAX);
+
/* enable save_copy by default for render results */
if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE) && !RNA_property_is_set(op->ptr, "copy")) {
RNA_boolean_set(op->ptr, "copy", TRUE);
}
// XXX note: we can give default menu enums to operator for this
- image_filesel(C, op, ibuf->name);
+ image_filesel(C, op, filename);
ED_space_image_release_buffer(sima, lock);
@@ -1052,6 +1075,7 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
static int save_exec(bContext *C, wmOperator *op)
{
+ Main *bmain= CTX_data_main(C);
SpaceImage *sima= CTX_wm_space_image(C);
Image *ima = ED_space_image(sima);
void *lock;
@@ -1071,7 +1095,7 @@ static int save_exec(bContext *C, wmOperator *op)
if(name[0]==0)
BLI_strncpy(name, G.ima, FILE_MAX);
else
- BLI_path_abs(name, G.main->name);
+ BLI_path_abs(name, bmain->name);
if(BLI_exists(name) && BLI_is_writable(name)) {
rr= BKE_image_acquire_renderresult(scene, ima);
@@ -1114,6 +1138,7 @@ void IMAGE_OT_save(wmOperatorType *ot)
static int save_sequence_exec(bContext *C, wmOperator *op)
{
+ Main *bmain= CTX_data_main(C);
SpaceImage *sima= CTX_wm_space_image(C);
ImBuf *ibuf;
int tot= 0;
@@ -1157,7 +1182,7 @@ static int save_sequence_exec(bContext *C, wmOperator *op)
char name[FILE_MAX];
BLI_strncpy(name, ibuf->name, sizeof(name));
- BLI_path_abs(name, G.main->name);
+ BLI_path_abs(name, bmain->name);
if(0 == IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat)) {
BKE_reportf(op->reports, RPT_ERROR, "Could not write image %s.", name);
@@ -1293,7 +1318,7 @@ void IMAGE_OT_new(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- RNA_def_string(ot->srna, "name", "Untitled", 21, "Name", "Image datablock name.");
+ RNA_def_string(ot->srna, "name", "untitled", 21, "Name", "Image datablock name.");
RNA_def_int(ot->srna, "width", 1024, 1, INT_MAX, "Width", "Image width.", 1, 16384);
RNA_def_int(ot->srna, "height", 1024, 1, INT_MAX, "Height", "Image height.", 1, 16384);
prop= RNA_def_float_color(ot->srna, "color", 4, NULL, 0.0f, FLT_MAX, "Color", "Default fill color.", 0.0f, 1.0f);
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index d77d153a324..9d5b5048d75 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -225,9 +225,18 @@ void ED_space_image_uv_aspect(SpaceImage *sima, float *aspx, float *aspy)
ED_space_image_aspect(sima, aspx, aspy);
ED_space_image_size(sima, &w, &h);
+
+ *aspx *= (float)w;
+ *aspy *= (float)h;
- *aspx *= (float)w/256.0f;
- *aspy *= (float)h/256.0f;
+ if(*aspx < *aspy) {
+ *aspy= *aspy / *aspx;
+ *aspx= 1.0f;
+ }
+ else {
+ *aspx= *aspx / *aspy;
+ *aspy= 1.0f;
+ }
}
void ED_image_uv_aspect(Image *ima, float *aspx, float *aspy)
@@ -638,14 +647,18 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
break;
}
case NC_OBJECT:
+ {
+ Object *ob= (Object *)wmn->reference;
switch(wmn->data) {
case ND_TRANSFORM:
- if(sima->lock && (sima->flag & SI_DRAWSHADOW)) {
+ case ND_MODIFIER:
+ if(ob && (ob->mode & OB_MODE_EDIT) && sima->lock && (sima->flag & SI_DRAWSHADOW)) {
ED_area_tag_refresh(sa);
ED_area_tag_redraw(sa);
}
break;
}
+ }
}
}
diff --git a/source/blender/editors/space_info/CMakeLists.txt b/source/blender/editors/space_info/CMakeLists.txt
index 4187afd8df4..47bbfec5fe5 100644
--- a/source/blender/editors/space_info/CMakeLists.txt
+++ b/source/blender/editors/space_info/CMakeLists.txt
@@ -21,6 +21,7 @@
SET(INC
../include
+ ../../blenfont
../../blenkernel
../../blenlib
../../imbuf
@@ -33,6 +34,9 @@ SET(INC
SET(SRC
info_ops.c
info_stats.c
+ info_draw.c
+ info_report.c
+ textview.c
space_info.c
)
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
new file mode 100644
index 00000000000..fe2c0efe44d
--- /dev/null
+++ b/source/blender/editors/space_info/info_draw.c
@@ -0,0 +1,192 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2010 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <limits.h>
+
+
+#include "BLF_api.h"
+
+#include "BLI_blenlib.h"
+
+#include "DNA_space_types.h"
+#include "DNA_screen_types.h"
+
+// #include "BKE_suggestions.h"
+#include "BKE_report.h"
+#include "BKE_utildefines.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
+#include "ED_datafiles.h"
+#include "ED_types.h"
+
+#include "UI_resources.h"
+
+#include "../space_info/textview.h"
+
+static void info_report_color(unsigned char *fg, unsigned char *bg, Report *report, int bool)
+{
+ /*
+ if (type & RPT_ERROR_ALL) { fg[0]=220; fg[1]=0; fg[2]=0; }
+ else if (type & RPT_WARNING_ALL) { fg[0]=220; fg[1]=96; fg[2]=96; }
+ else if (type & RPT_OPERATOR_ALL) { fg[0]=96; fg[1]=128; fg[2]=255; }
+ else if (type & RPT_INFO_ALL) { fg[0]=0; fg[1]=170; fg[2]=0; }
+ else if (type & RPT_DEBUG_ALL) { fg[0]=196; fg[1]=196; fg[2]=196; }
+ else { fg[0]=196; fg[1]=196; fg[2]=196; }
+ */
+ if(report->flag & SELECT) {
+ fg[0]=255; fg[1]=255; fg[2]=255;
+ if(bool) {
+ bg[0]=96; bg[1]=128; bg[2]=255;
+ }
+ else {
+ bg[0]=90; bg[1]=122; bg[2]=249;
+ }
+ }
+
+ else {
+ fg[0]=0; fg[1]=0; fg[2]=0;
+
+ if(bool) {
+ bg[0]=120; bg[1]=120; bg[2]=120;
+ }
+ else {
+ bg[0]=114; bg[1]=114; bg[2]=114;
+ }
+
+ }
+}
+
+
+/* reports! */
+static int report_textview_begin(TextViewContext *tvc)
+{
+ // SpaceConsole *sc= (SpaceConsole *)tvc->arg1;
+ ReportList *reports= (ReportList *)tvc->arg2;
+
+ tvc->lheight= 14; //sc->lheight;
+ tvc->sel_start= 0;
+ tvc->sel_end= 0;
+
+ /* iterator */
+ tvc->iter= reports->list.last;
+
+ glClearColor(120.0/255.0, 120.0/255.0, 120.0/255.0, 1.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ return (tvc->iter != NULL);
+}
+
+static void report_textview_end(TextViewContext *UNUSED(tvc))
+{
+ /* pass */
+}
+
+static int report_textview_step(TextViewContext *tvc)
+{
+ return ((tvc->iter= (void *)((Link *)tvc->iter)->prev) != NULL);
+}
+
+static int report_textview_line_get(struct TextViewContext *tvc, const char **line, int *len)
+{
+ Report *report= (Report *)tvc->iter;
+ *line= report->message;
+ *len= report->len;
+
+ return 1;
+}
+
+static int report_textview_line_color(struct TextViewContext *tvc, unsigned char fg[3], unsigned char bg[3])
+{
+ Report *report= (Report *)tvc->iter;
+ info_report_color(fg, bg, report, tvc->iter_index % 2);
+ return TVC_LINE_FG | TVC_LINE_BG;
+}
+
+
+static int info_textview_main__internal(struct SpaceInfo *sinfo, struct ARegion *ar, ReportList *reports, int draw, int mval[2], void **mouse_pick, int *pos_pick)
+{
+ int ret= 0;
+
+ View2D *v2d= &ar->v2d;
+
+ TextViewContext tvc= {0};
+ tvc.begin= report_textview_begin;
+ tvc.end= report_textview_end;
+
+ tvc.step= report_textview_step;
+ tvc.line_get= report_textview_line_get;
+ tvc.line_color= report_textview_line_color;
+
+ tvc.arg1= sinfo;
+ tvc.arg2= reports;
+
+ /* view */
+ tvc.sel_start= 0;
+ tvc.sel_end= 0;
+ tvc.lheight= 14; //sc->lheight;
+ tvc.ymin= v2d->cur.ymin;
+ tvc.ymax= v2d->cur.ymax;
+ tvc.winx= ar->winx;
+
+ ret= textview_draw(&tvc, draw, mval, mouse_pick, pos_pick);
+
+ return ret;
+}
+
+void *info_text_pick(struct SpaceInfo *sinfo, struct ARegion *ar, ReportList *reports, int mouse_y)
+{
+ void *mouse_pick= NULL;
+ int mval[2];
+
+ mval[0]= 0;
+ mval[1]= mouse_y;
+
+ info_textview_main__internal(sinfo, ar, reports, 0, mval, &mouse_pick, NULL);
+ return (void *)mouse_pick;
+}
+
+
+int info_textview_height(struct SpaceInfo *sinfo, struct ARegion *ar, ReportList *reports)
+{
+ int mval[2] = {INT_MAX, INT_MAX};
+ return info_textview_main__internal(sinfo, ar, reports, 0, mval, NULL, NULL);
+}
+
+void info_textview_main(struct SpaceInfo *sinfo, struct ARegion *ar, ReportList *reports)
+{
+ int mval[2] = {INT_MAX, INT_MAX};
+ info_textview_main__internal(sinfo, ar, reports, 1, mval, NULL, NULL);
+}
diff --git a/source/blender/editors/space_info/info_intern.h b/source/blender/editors/space_info/info_intern.h
index 4053bbf5a1f..4953bc1b4be 100644
--- a/source/blender/editors/space_info/info_intern.h
+++ b/source/blender/editors/space_info/info_intern.h
@@ -30,7 +30,9 @@
/* internal exports only */
+struct SpaceInfo;
struct wmOperatorType;
+struct ReportList;
void FILE_OT_pack_all(struct wmOperatorType *ot);
void FILE_OT_unpack_all(struct wmOperatorType *ot);
@@ -41,5 +43,19 @@ void FILE_OT_find_missing_files(struct wmOperatorType *ot);
void INFO_OT_reports_display_update(struct wmOperatorType *ot);
-#endif /* ED_INFO_INTERN_H */
+/* info_draw.c */
+void *info_text_pick(struct SpaceInfo *sinfo, struct ARegion *ar, ReportList *reports, int mouse_y);
+int info_textview_height(struct SpaceInfo *sinfo, struct ARegion *ar, struct ReportList *reports);
+void info_textview_main(struct SpaceInfo *sinfo, struct ARegion *ar, struct ReportList *reports);
+
+/* info_report.c */
+/* console_report.c */
+void INFO_OT_select_pick(struct wmOperatorType *ot); /* report selection */
+void INFO_OT_select_all_toggle(struct wmOperatorType *ot);
+void INFO_OT_select_border(struct wmOperatorType *ot);
+void INFO_OT_report_replay(struct wmOperatorType *ot);
+void INFO_OT_report_delete(struct wmOperatorType *ot);
+void INFO_OT_report_copy(struct wmOperatorType *ot);
+
+#endif /* ED_INFO_INTERN_H */
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index aeb32cda6bd..3ed4f07d150 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -395,3 +395,5 @@ void INFO_OT_reports_display_update(wmOperatorType *ot)
/* properties */
}
+
+/* report operators */
diff --git a/source/blender/editors/space_console/console_report.c b/source/blender/editors/space_info/info_report.c
index 6483177a045..0fc8e157d92 100644
--- a/source/blender/editors/space_console/console_report.c
+++ b/source/blender/editors/space_info/info_report.c
@@ -17,11 +17,6 @@
* 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) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
* Contributor(s): Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
@@ -29,6 +24,7 @@
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "MEM_guardedalloc.h"
@@ -47,38 +43,30 @@
#include "RNA_access.h"
#include "RNA_define.h"
-#include "console_intern.h"
+#include "info_intern.h"
-int console_report_mask(SpaceConsole *sc)
+int info_report_mask(SpaceInfo *sinfo)
{
int report_mask = 0;
- if(sc->rpt_mask & CONSOLE_RPT_DEBUG) report_mask |= RPT_DEBUG_ALL;
- if(sc->rpt_mask & CONSOLE_RPT_INFO) report_mask |= RPT_INFO_ALL;
- if(sc->rpt_mask & CONSOLE_RPT_OP) report_mask |= RPT_OPERATOR_ALL;
- if(sc->rpt_mask & CONSOLE_RPT_WARN) report_mask |= RPT_WARNING_ALL;
- if(sc->rpt_mask & CONSOLE_RPT_ERR) report_mask |= RPT_ERROR_ALL;
+ if(sinfo->rpt_mask & INFO_RPT_DEBUG) report_mask |= RPT_DEBUG_ALL;
+ if(sinfo->rpt_mask & INFO_RPT_INFO) report_mask |= RPT_INFO_ALL;
+ if(sinfo->rpt_mask & INFO_RPT_OP) report_mask |= RPT_OPERATOR_ALL;
+ if(sinfo->rpt_mask & INFO_RPT_WARN) report_mask |= RPT_WARNING_ALL;
+ if(sinfo->rpt_mask & INFO_RPT_ERR) report_mask |= RPT_ERROR_ALL;
return report_mask;
}
-static int console_report_poll(bContext *C)
-{
- SpaceConsole *sc= CTX_wm_space_console(C);
-
- if(!sc || sc->type != CONSOLE_TYPE_REPORT)
- return 0;
-
- return 1;
-}
-
+// TODO, get this working again!
static int report_replay_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceConsole *sc= CTX_wm_space_console(C);
- ReportList *reports= CTX_wm_reports(C);
- int report_mask= console_report_mask(sc);
- Report *report;
+// SpaceInfo *sc= CTX_wm_space_info(C);
+// ReportList *reports= CTX_wm_reports(C);
+// int report_mask= info_report_mask(sc);
+// Report *report;
+#if 0
sc->type= CONSOLE_TYPE_PYTHON;
for(report=reports->list.last; report; report=report->prev) {
@@ -91,21 +79,21 @@ static int report_replay_exec(bContext *C, wmOperator *UNUSED(op))
}
sc->type= CONSOLE_TYPE_REPORT;
-
+#endif
ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
}
-void CONSOLE_OT_report_replay(wmOperatorType *ot)
+void INFO_OT_report_replay(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Replay Operators";
ot->description= "Replay selected reports";
- ot->idname= "CONSOLE_OT_report_replay";
+ ot->idname= "INFO_OT_report_replay";
/* api callbacks */
- ot->poll= console_report_poll;
+ ot->poll= ED_operator_info_active;
ot->exec= report_replay_exec;
/* flags */
@@ -131,12 +119,12 @@ static int select_report_pick_exec(bContext *C, wmOperator *op)
static int select_report_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- SpaceConsole *sc= CTX_wm_space_console(C);
+ SpaceInfo *sinfo= CTX_wm_space_info(C);
ARegion *ar= CTX_wm_region(C);
ReportList *reports= CTX_wm_reports(C);
Report *report;
- report= console_text_pick(sc, ar, reports, event->mval[1]);
+ report= info_text_pick(sinfo, ar, reports, event->mval[1]);
RNA_int_set(op->ptr, "report_index", BLI_findindex(&reports->list, report));
@@ -144,15 +132,15 @@ static int select_report_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
}
-void CONSOLE_OT_select_pick(wmOperatorType *ot)
+void INFO_OT_select_pick(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Select report";
ot->description= "Select reports by index";
- ot->idname= "CONSOLE_OT_select_pick";
+ ot->idname= "INFO_OT_select_pick";
/* api callbacks */
- ot->poll= console_report_poll;
+ ot->poll= ED_operator_info_active;
ot->invoke= select_report_pick_invoke;
ot->exec= select_report_pick_exec;
@@ -167,9 +155,9 @@ void CONSOLE_OT_select_pick(wmOperatorType *ot)
static int report_select_all_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceConsole *sc= CTX_wm_space_console(C);
+ SpaceInfo *sinfo= CTX_wm_space_info(C);
ReportList *reports= CTX_wm_reports(C);
- int report_mask= console_report_mask(sc);
+ int report_mask= info_report_mask(sinfo);
int deselect= 0;
Report *report;
@@ -198,15 +186,15 @@ static int report_select_all_toggle_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void CONSOLE_OT_select_all_toggle(wmOperatorType *ot)
+void INFO_OT_select_all_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name= "(De)Select All";
ot->description= "(de)select all reports";
- ot->idname= "CONSOLE_OT_select_all_toggle";
+ ot->idname= "INFO_OT_select_all_toggle";
/* api callbacks */
- ot->poll= console_report_poll;
+ ot->poll= ED_operator_info_active;
ot->exec= report_select_all_toggle_exec;
/* flags */
@@ -218,10 +206,10 @@ void CONSOLE_OT_select_all_toggle(wmOperatorType *ot)
/* borderselect operator */
static int borderselect_exec(bContext *C, wmOperator *op)
{
- SpaceConsole *sc= CTX_wm_space_console(C);
+ SpaceInfo *sinfo= CTX_wm_space_info(C);
ARegion *ar= CTX_wm_region(C);
ReportList *reports= CTX_wm_reports(C);
- int report_mask= console_report_mask(sc);
+ int report_mask= info_report_mask(sinfo);
Report *report_min, *report_max, *report;
//View2D *v2d= UI_view2d_fromcontext(C);
@@ -246,8 +234,8 @@ static int borderselect_exec(bContext *C, wmOperator *op)
UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmax, &rectf.ymax);
*/
- report_min= console_text_pick(sc, ar, reports, rect.ymax);
- report_max= console_text_pick(sc, ar, reports, rect.ymin);
+ report_min= info_text_pick(sinfo, ar, reports, rect.ymax);
+ report_max= info_text_pick(sinfo, ar, reports, rect.ymin);
/* get the first report if none found */
if(report_min==NULL) {
@@ -291,19 +279,19 @@ static int borderselect_exec(bContext *C, wmOperator *op)
/* ****** Border Select ****** */
-void CONSOLE_OT_select_border(wmOperatorType *ot)
+void INFO_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Border Select";
ot->description= "Toggle border selection";
- ot->idname= "CONSOLE_OT_select_border";
+ ot->idname= "INFO_OT_select_border";
/* api callbacks */
ot->invoke= WM_border_select_invoke;
ot->exec= borderselect_exec;
ot->modal= WM_border_select_modal;
- ot->poll= console_report_poll;
+ ot->poll= ED_operator_info_active;
/* flags */
/* ot->flag= OPTYPE_REGISTER; */
@@ -316,9 +304,9 @@ void CONSOLE_OT_select_border(wmOperatorType *ot)
static int report_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceConsole *sc= CTX_wm_space_console(C);
+ SpaceInfo *sinfo= CTX_wm_space_info(C);
ReportList *reports= CTX_wm_reports(C);
- int report_mask= console_report_mask(sc);
+ int report_mask= info_report_mask(sinfo);
Report *report, *report_next;
@@ -341,15 +329,15 @@ static int report_delete_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void CONSOLE_OT_report_delete(wmOperatorType *ot)
+void INFO_OT_report_delete(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Delete Reports";
ot->description= "Delete selected reports";
- ot->idname= "CONSOLE_OT_report_delete";
+ ot->idname= "INFO_OT_report_delete";
/* api callbacks */
- ot->poll= console_report_poll;
+ ot->poll= ED_operator_info_active;
ot->exec= report_delete_exec;
/* flags */
@@ -361,9 +349,9 @@ void CONSOLE_OT_report_delete(wmOperatorType *ot)
static int report_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceConsole *sc= CTX_wm_space_console(C);
+ SpaceInfo *sinfo= CTX_wm_space_info(C);
ReportList *reports= CTX_wm_reports(C);
- int report_mask= console_report_mask(sc);
+ int report_mask= info_report_mask(sinfo);
Report *report;
@@ -386,15 +374,15 @@ static int report_copy_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void CONSOLE_OT_report_copy(wmOperatorType *ot)
+void INFO_OT_report_copy(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Copy Reports to Clipboard";
ot->description= "Copy selected reports to Clipboard";
- ot->idname= "CONSOLE_OT_report_copy";
+ ot->idname= "INFO_OT_report_copy";
/* api callbacks */
- ot->poll= console_report_poll;
+ ot->poll= ED_operator_info_active;
ot->exec= report_copy_exec;
/* flags */
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 5173621d9c1..95c1614ffd5 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -49,6 +49,7 @@
#include "UI_resources.h"
#include "UI_interface.h"
+#include "UI_view2d.h"
#include "info_intern.h" // own include
@@ -62,7 +63,9 @@ static SpaceLink *info_new(const bContext *UNUSED(C))
sinfo= MEM_callocN(sizeof(SpaceInfo), "initinfo");
sinfo->spacetype= SPACE_INFO;
-
+
+ sinfo->rpt_mask= INFO_RPT_OP;
+
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for info");
@@ -76,6 +79,17 @@ static SpaceLink *info_new(const bContext *UNUSED(C))
BLI_addtail(&sinfo->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
+ /* keep in sync with console */
+ ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
+ ar->v2d.align |= V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y; /* align bottom left */
+ ar->v2d.keepofs |= V2D_LOCKOFS_X;
+ ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
+ ar->v2d.keeptot= V2D_KEEPTOT_BOUNDS;
+ ar->v2d.minzoom= ar->v2d.maxzoom= 1.0f;
+
+ /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
+ //ar->v2d.keepzoom= (V2D_KEEPASPECT|V2D_LIMITZOOM);
+
return (SpaceLink *)sinfo;
}
@@ -105,16 +119,54 @@ static SpaceLink *info_duplicate(SpaceLink *sl)
/* add handlers, stuff you only do once or on area/region changes */
-static void info_main_area_init(wmWindowManager *UNUSED(wm), ARegion *UNUSED(ar))
+static void info_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, "Info", SPACE_INFO, 0);
+ WM_event_add_keymap_handler(&ar->handlers, keymap);
}
-static void info_main_area_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar))
+static void info_textview_update_rect(const bContext *C, ARegion *ar)
{
-
+ SpaceInfo *sinfo= CTX_wm_space_info(C);
+ View2D *v2d= &ar->v2d;
+
+ UI_view2d_totRect_set(v2d, ar->winx-1, info_textview_height(sinfo, ar, CTX_wm_reports(C)));
+}
+
+static void info_main_area_draw(const bContext *C, ARegion *ar)
+{
+ /* draw entirely, view changes should be handled here */
+ SpaceInfo *sinfo= CTX_wm_space_info(C);
+ View2D *v2d= &ar->v2d;
+ View2DScrollers *scrollers;
+
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
+
+ /* quick way to avoid drawing if not bug enough */
+ if(ar->winy < 16)
+ return;
+
+ info_textview_update_rect(C, ar);
+
+ /* worlks best with no view2d matrix set */
+ UI_view2d_view_ortho(v2d);
+
+ info_textview_main(sinfo, ar, CTX_wm_reports(C));
+
+ /* reset view matrix */
+ UI_view2d_view_restore(C);
+
+ /* scrollers */
+ scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_GRID_CLAMP);
+ UI_view2d_scrollers_draw(C, v2d, scrollers);
+ UI_view2d_scrollers_free(scrollers);
}
void info_operatortypes(void)
@@ -125,8 +177,16 @@ void info_operatortypes(void)
WM_operatortype_append(FILE_OT_make_paths_absolute);
WM_operatortype_append(FILE_OT_report_missing_files);
WM_operatortype_append(FILE_OT_find_missing_files);
-
WM_operatortype_append(INFO_OT_reports_display_update);
+
+ /* info_report.c */
+ WM_operatortype_append(INFO_OT_select_pick);
+ WM_operatortype_append(INFO_OT_select_all_toggle);
+ WM_operatortype_append(INFO_OT_select_border);
+
+ WM_operatortype_append(INFO_OT_report_replay);
+ WM_operatortype_append(INFO_OT_report_delete);
+ WM_operatortype_append(INFO_OT_report_copy);
}
void info_keymap(struct wmKeyConfig *keyconf)
@@ -134,6 +194,20 @@ void info_keymap(struct wmKeyConfig *keyconf)
wmKeyMap *keymap= WM_keymap_find(keyconf, "Window", 0, 0);
WM_keymap_verify_item(keymap, "INFO_OT_reports_display_update", TIMER, KM_ANY, KM_ANY, 0);
+
+ /* info space */
+ keymap= WM_keymap_find(keyconf, "Info", SPACE_INFO, 0);
+
+
+ /* report selection */
+ WM_keymap_add_item(keymap, "INFO_OT_select_pick", SELECTMOUSE, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "INFO_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "INFO_OT_select_border", BKEY, KM_PRESS, 0, 0);
+
+ WM_keymap_add_item(keymap, "INFO_OT_report_replay", RKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "INFO_OT_report_delete", XKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "INFO_OT_report_delete", DELKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "INFO_OT_report_copy", CKEY, KM_PRESS, KM_CTRL, 0);
}
/* add handlers, stuff you only do once or on area/region changes */
@@ -147,9 +221,19 @@ static void info_header_area_draw(const bContext *C, ARegion *ar)
ED_region_header(C, ar);
}
-static void info_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn))
+static void info_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
+ // SpaceInfo *sinfo= sa->spacedata.first;
+
/* context changes */
+ switch(wmn->category) {
+ case NC_SPACE:
+ if(wmn->data == ND_SPACE_INFO_REPORT) {
+ /* redraw also but only for report view, could do less redraws by checking the type */
+ ED_region_tag_redraw(ar);
+ }
+ break;
+ }
}
static void info_header_listener(ARegion *ar, wmNotifier *wmn)
@@ -223,10 +307,11 @@ void ED_spacetype_info(void)
/* regions: main window */
art= MEM_callocN(sizeof(ARegionType), "spacetype info region");
art->regionid = RGN_TYPE_WINDOW;
+ art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+
art->init= info_main_area_init;
art->draw= info_main_area_draw;
art->listener= info_main_area_listener;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
BLI_addhead(&st->regiontypes, art);
@@ -246,4 +331,3 @@ void ED_spacetype_info(void)
BKE_spacetype_register(st);
}
-
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c
new file mode 100644
index 00000000000..5f2ed46789e
--- /dev/null
+++ b/source/blender/editors/space_info/textview.c
@@ -0,0 +1,301 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <math.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <limits.h>
+#include <assert.h>
+
+#include "BLF_api.h"
+
+#include "BKE_utildefines.h"
+
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
+#include "ED_datafiles.h"
+
+#include "textview.h"
+
+
+static int mono= -1; // XXX needs proper storage and change all the BLF_* here!
+
+
+static void console_font_begin(TextViewContext *sc)
+{
+ if(mono == -1) {
+ mono= BLF_load_mem("monospace", (unsigned char*)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size);
+ }
+
+ BLF_aspect(mono, 1.0);
+ BLF_size(mono, sc->lheight-2, 72);
+}
+
+typedef struct ConsoleDrawContext {
+ int cwidth;
+ int lheight;
+ int console_width; /* number of characters that fit into the width of the console (fixed width) */
+ int winx;
+ int ymin, ymax;
+ int *xy; // [2]
+ int *sel; // [2]
+ int *pos_pick; // bottom of view == 0, top of file == combine chars, end of line is lower then start.
+ int *mval; // [2]
+ int draw;
+} ConsoleDrawContext;
+
+static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int lheight)
+{
+ if(sel[0] <= str_len_draw && sel[1] >= 0) {
+ int sta = MAX2(sel[0], 0);
+ int end = MIN2(sel[1], str_len_draw);
+
+ glEnable(GL_POLYGON_STIPPLE);
+ glPolygonStipple(stipple_halftone);
+ glEnable( GL_BLEND );
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glColor4ub(255, 255, 255, 96);
+
+ glRecti(xy[0]+(cwidth*sta), xy[1]-2 + lheight, xy[0]+(cwidth*end), xy[1]-2);
+
+ glDisable(GL_POLYGON_STIPPLE);
+ glDisable( GL_BLEND );
+ }
+}
+
+
+/* return 0 if the last line is off the screen
+ * should be able to use this for any string type */
+
+static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str_len, unsigned char *fg, unsigned char *bg)
+{
+#define STEP_SEL(value) cdc->sel[0] += (value); cdc->sel[1] += (value)
+ int rct_ofs= cdc->lheight/4;
+ int tot_lines = (str_len/cdc->console_width)+1; /* total number of lines for wrapping */
+ int y_next = (str_len > cdc->console_width) ? cdc->xy[1]+cdc->lheight*tot_lines : cdc->xy[1]+cdc->lheight;
+
+ /* just advance the height */
+ if(cdc->draw==0) {
+ if(cdc->pos_pick && (cdc->mval[1] != INT_MAX)) {
+ if(cdc->xy[1] <= cdc->mval[1]) {
+ if((y_next >= cdc->mval[1])) {
+ int ofs = (int)floor(((float)cdc->mval[0] / (float)cdc->cwidth));
+
+ /* wrap */
+ if(str_len > cdc->console_width)
+ ofs += (cdc->console_width * ((int)((((float)(y_next - cdc->mval[1]) / (float)(y_next-cdc->xy[1])) * tot_lines))));
+
+ CLAMP(ofs, 0, str_len);
+ *cdc->pos_pick += str_len - ofs;
+ } else
+ *cdc->pos_pick += str_len + 1;
+ }
+ }
+
+ cdc->xy[1]= y_next;
+ return 1;
+ }
+ else if (y_next-cdc->lheight < cdc->ymin) {
+ /* have not reached the drawable area so don't break */
+ cdc->xy[1]= y_next;
+
+ /* adjust selection even if not drawing */
+ if(cdc->sel[0] != cdc->sel[1]) {
+ STEP_SEL(-(str_len + 1));
+ }
+
+ return 1;
+ }
+
+ if(str_len > cdc->console_width) { /* wrap? */
+ const int initial_offset= ((tot_lines-1) * cdc->console_width);
+ const char *line_stride= str + initial_offset; /* advance to the last line and draw it first */
+
+ int sel_orig[2];
+ VECCOPY2D(sel_orig, cdc->sel);
+
+ /* invert and swap for wrapping */
+ cdc->sel[0] = str_len - sel_orig[1];
+ cdc->sel[1] = str_len - sel_orig[0];
+
+ if(bg) {
+ glColor3ubv(bg);
+ glRecti(0, cdc->xy[1]-rct_ofs, cdc->winx, (cdc->xy[1]+(cdc->lheight*tot_lines))+rct_ofs);
+ }
+
+ glColor3ubv(fg);
+
+ /* last part needs no clipping */
+ BLF_position(mono, cdc->xy[0], cdc->xy[1], 0);
+ BLF_draw(mono, line_stride, str_len - initial_offset);
+
+ if(cdc->sel[0] != cdc->sel[1]) {
+ STEP_SEL(-initial_offset);
+ // glColor4ub(255, 0, 0, 96); // debug
+ console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->lheight);
+ STEP_SEL(cdc->console_width);
+ glColor3ubv(fg);
+ }
+
+ cdc->xy[1] += cdc->lheight;
+
+ line_stride -= cdc->console_width;
+
+ for(; line_stride >= str; line_stride -= cdc->console_width) {
+ BLF_position(mono, cdc->xy[0], cdc->xy[1], 0);
+ BLF_draw(mono, line_stride, cdc->console_width);
+
+ if(cdc->sel[0] != cdc->sel[1]) {
+ // glColor4ub(0, 255, 0, 96); // debug
+ console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->lheight);
+ STEP_SEL(cdc->console_width);
+ glColor3ubv(fg);
+ }
+
+ cdc->xy[1] += cdc->lheight;
+
+ /* check if were out of view bounds */
+ if(cdc->xy[1] > cdc->ymax)
+ return 0;
+ }
+
+ VECCOPY2D(cdc->sel, sel_orig);
+ STEP_SEL(-(str_len + 1));
+ }
+ else { /* simple, no wrap */
+
+ if(bg) {
+ glColor3ubv(bg);
+ glRecti(0, cdc->xy[1]-rct_ofs, cdc->winx, cdc->xy[1]+cdc->lheight-rct_ofs);
+ }
+
+ glColor3ubv(fg);
+
+ BLF_position(mono, cdc->xy[0], cdc->xy[1], 0);
+ BLF_draw(mono, str, str_len);
+
+ if(cdc->sel[0] != cdc->sel[1]) {
+ int isel[2];
+
+ isel[0]= str_len - cdc->sel[1];
+ isel[1]= str_len - cdc->sel[0];
+
+ // glColor4ub(255, 255, 0, 96); // debug
+ console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->lheight);
+ STEP_SEL(-(str_len + 1));
+ }
+
+ cdc->xy[1] += cdc->lheight;
+
+ if(cdc->xy[1] > cdc->ymax)
+ return 0;
+ }
+
+ return 1;
+#undef STEP_SEL
+}
+
+#define CONSOLE_DRAW_MARGIN 4
+#define CONSOLE_DRAW_SCROLL 16
+
+int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick, int *pos_pick)
+{
+ ConsoleDrawContext cdc= {0};
+
+ int x_orig=CONSOLE_DRAW_MARGIN, y_orig=CONSOLE_DRAW_MARGIN;
+ int xy[2], y_prev;
+ int sel[2]= {-1, -1}; /* defaults disabled */
+ unsigned char fg[3], bg[3];
+
+ console_font_begin(tvc);
+
+ xy[0]= x_orig; xy[1]= y_orig;
+
+ if(mval[1] != INT_MAX)
+ mval[1] += (tvc->ymin + CONSOLE_DRAW_MARGIN);
+
+ if(pos_pick)
+ *pos_pick = 0;
+
+ /* constants for the sequencer context */
+ cdc.cwidth= (int)BLF_fixed_width(mono);
+ assert(cdc.cwidth > 0);
+ cdc.lheight= tvc->lheight;
+ cdc.console_width= (tvc->winx - (CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN*2) ) / cdc.cwidth;
+ cdc.winx= tvc->winx-(CONSOLE_DRAW_MARGIN+CONSOLE_DRAW_SCROLL);
+ cdc.ymin= tvc->ymin;
+ cdc.ymax= tvc->ymax;
+ cdc.xy= xy;
+ cdc.sel= sel;
+ cdc.pos_pick= pos_pick;
+ cdc.mval= mval;
+ cdc.draw= draw;
+
+ /* shouldnt be needed */
+ tvc->cwidth= cdc.cwidth;
+ tvc->iter_index= 0;
+
+ if(tvc->sel_start != tvc->sel_end) {
+ sel[0]= tvc->sel_start;
+ sel[1]= tvc->sel_end;
+ }
+
+ if(tvc->begin(tvc)) {
+
+ do {
+ const char *ext_line;
+ int ext_len;
+ int color_flag= 0;
+
+ y_prev= xy[1];
+
+ if(draw)
+ color_flag= tvc->line_color(tvc, fg, bg);
+
+ tvc->line_get(tvc, &ext_line, &ext_len);
+
+ if(!console_draw_string(&cdc, ext_line, ext_len, (color_flag & TVC_LINE_FG) ? fg : NULL, (color_flag & TVC_LINE_BG) ? bg : NULL)) {
+ /* when drawing, if we pass v2d->cur.ymax, then quit */
+ if(draw) {
+ break; /* past the y limits */
+ }
+ }
+
+ if((mval[1] != INT_MAX) && (mval[1] >= y_prev && mval[1] <= xy[1])) {
+ *mouse_pick= (void *)tvc->iter;
+ break;
+ }
+
+ tvc->iter_index++;
+
+ } while(tvc->step(tvc));
+ }
+
+ tvc->end(tvc);
+
+ xy[1] += tvc->lheight * 2;
+
+ return xy[1] - y_orig;
+}
diff --git a/source/blender/editors/space_info/textview.h b/source/blender/editors/space_info/textview.h
new file mode 100644
index 00000000000..35c44d36f27
--- /dev/null
+++ b/source/blender/editors/space_info/textview.h
@@ -0,0 +1,52 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+typedef struct TextViewContext {
+ int lheight;
+ int sel_start, sel_end;
+
+ /* view settings */
+ int cwidth; /* shouldnt be needed! */
+ int winx;
+ int ymin, ymax;
+
+ /* callbacks */
+ int (*begin)(struct TextViewContext *tvc);
+ void (*end)(struct TextViewContext *tvc);
+ void *arg1;
+ void *arg2;
+
+ /* iterator */
+ int (*step)(struct TextViewContext *tvc);
+ int (*line_get)(struct TextViewContext *tvc, const char **, int *);
+ int (*line_color)(struct TextViewContext *tvc, unsigned char fg[3], unsigned char bg[3]);
+ void *iter;
+ int iter_index;
+
+} TextViewContext;
+
+int textview_draw(struct TextViewContext *tvc, int draw, int mval[2], void **mouse_pick, int *pos_pick);
+
+#define TVC_LINE_FG (1<<0)
+#define TVC_LINE_BG (1<<1)
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index c8d6e960132..bf91fdef42f 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -3365,8 +3365,8 @@ static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr)
uiItemR(row, ptr, "modifier_key_2", UI_ITEM_R_EVENT, "", 0);
RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
- uiItemPointerR(layout, ptr, "target", &settings_ptr, "properties", NULL, 0);
uiItemPointerR(layout, ptr, "log", &settings_ptr, "properties", NULL, 0);
+ uiItemPointerR(layout, ptr, "target", &settings_ptr, "properties", NULL, 0);
}
static void draw_sensor_message(uiLayout *layout, PointerRNA *ptr)
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
index 13380cd17f7..c5d6cde62c6 100644
--- a/source/blender/editors/space_nla/nla_ops.c
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -173,30 +173,6 @@ static void nla_keymap_channels(wmKeyMap *keymap)
/* delete tracks */
WM_keymap_add_item(keymap, "NLA_OT_delete_tracks", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NLA_OT_delete_tracks", DELKEY, KM_PRESS, 0, 0);
-
- /* General Animation Channels keymap (see anim_channels.c) ----------------------- */
- /* selection */
- /* borderselect - not in tweakmode */
- WM_keymap_add_item(keymap, "ANIM_OT_channels_select_border", BKEY, KM_PRESS, 0, 0);
-
- /* deselect all - not in tweakmode */
- WM_keymap_add_item(keymap, "ANIM_OT_channels_select_all_toggle", AKEY, KM_PRESS, 0, 0);
- RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_select_all_toggle", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "invert", 1);
-
- /* settings */
- WM_keymap_add_item(keymap, "ANIM_OT_channels_setting_toggle", WKEY, KM_PRESS, KM_SHIFT, 0);
- WM_keymap_add_item(keymap, "ANIM_OT_channels_setting_enable", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
- WM_keymap_add_item(keymap, "ANIM_OT_channels_setting_disable", WKEY, KM_PRESS, KM_ALT, 0);
-
- /* settings - specialised hotkeys */
- WM_keymap_add_item(keymap, "ANIM_OT_channels_editable_toggle", TABKEY, KM_PRESS, 0, 0);
-
- /* expand/collapse */
- WM_keymap_add_item(keymap, "ANIM_OT_channels_expand", PADPLUSKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "ANIM_OT_channels_collapse", PADMINUS, KM_PRESS, 0, 0);
-
- RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_expand", PADPLUSKEY, KM_PRESS, KM_CTRL, 0)->ptr, "all", 1);
- RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_collapse", PADMINUS, KM_PRESS, KM_CTRL, 0)->ptr, "all", 1);
}
static void nla_keymap_main (wmKeyConfig *keyconf, wmKeyMap *keymap)
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 25c53687597..3bff1d4159f 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -209,9 +209,13 @@ static void nla_channel_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
/* own keymap */
- // TODO: cannot use generic copy, need special NLA version
+ /* own channels map first to override some channel keymaps */
keymap= WM_keymap_find(wm->defaultconf, "NLA Channels", SPACE_NLA, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
+ /* now generic channels map for everything else that can apply */
+ keymap= WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0);
+ WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
+
keymap= WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index c34ade4f5e2..85c1daf81b3 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -58,6 +58,8 @@
#include "RNA_access.h"
+#include "ED_node.h"
+
#include "WM_api.h"
#include "WM_types.h"
@@ -169,16 +171,27 @@ static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA
uiTemplateCurveMapping(layout, ptr, "mapping", 'c', 0, 0);
}
+static void node_normal_cb(bContext *C, void *ntree_v, void *node_v)
+{
+ Main *bmain = CTX_data_main(C);
+
+ ED_node_generic_update(bmain, ntree_v, node_v);
+ WM_event_add_notifier(C, NC_NODE|NA_EDITED, ntree_v);
+}
+
static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiBlock *block= uiLayoutAbsoluteBlock(layout);
+ bNodeTree *ntree= ptr->id.data;
bNode *node= ptr->data;
rctf *butr= &node->butr;
bNodeSocket *sock= node->outputs.first; /* first socket stores normal */
+ uiBut *bt;
- uiDefButF(block, BUT_NORMAL, B_NODE_EXEC, "",
+ bt= uiDefButF(block, BUT_NORMAL, B_NODE_EXEC, "",
(short)butr->xmin, (short)butr->xmin, butr->xmax-butr->xmin, butr->xmax-butr->xmin,
sock->ns.vec, 0.0f, 1.0f, 0, 0, "");
+ uiButSetFunc(bt, node_normal_cb, ntree, node);
}
#if 0 // not used in 2.5x yet
static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
@@ -763,6 +776,15 @@ static void node_composit_buts_alphaover(uiLayout *layout, bContext *UNUSED(C),
uiItemR(col, ptr, "premul", 0, NULL, 0);
}
+static void node_composit_buts_zcombine(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiLayout *col;
+
+ col =uiLayoutColumn(layout, 1);
+ uiItemR(col, ptr, "use_alpha", 0, NULL, 0);
+}
+
+
static void node_composit_buts_hue_sat(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -1136,6 +1158,9 @@ static void node_composit_set_butfunc(bNodeType *ntype)
case CMP_NODE_HUECORRECT:
ntype->uifunc=node_composit_buts_huecorrect;
break;
+ case CMP_NODE_ZCOMBINE:
+ ntype->uifunc=node_composit_buts_zcombine;
+ break;
default:
ntype->uifunc= NULL;
}
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index fad34322f0a..a19a498d88b 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -5587,7 +5587,7 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa
spx=te->xs+2*OL_X-4;
if(spx+dx+10>ar->v2d.cur.xmax) dx = ar->v2d.cur.xmax-spx-10;
- bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, (short)te->ys, dx+10, OL_H-1, te->name, 1.0, (float)len-1, 0, 0, "");
+ bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, (short)te->ys, dx+10, OL_H-1, te->name, 1.0, (float)len, 0, 0, "");
uiButSetRenameFunc(bt, namebutton_cb, tselem);
/* returns false if button got removed */
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 286442ba08c..9d67cc2366c 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -1138,14 +1138,15 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
snap_frame= RNA_int_get(op->ptr, "frame");
- /* problem: contents of meta's are all shifted to the same position... */
-
/* also check metas */
- SEQP_BEGIN(ed, seq) {
+ for(seq= ed->seqbasep->first; seq; seq= seq->next) {
if (seq->flag & SELECT && !(seq->depth==0 && seq->flag & SEQ_LOCK) &&
seq_tx_test(seq)) {
if((seq->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL))==0) {
- seq->start= snap_frame-seq->startofs+seq->startstill;
+ /* simple but no anim update */
+ /* seq->start= snap_frame-seq->startofs+seq->startstill; */
+
+ seq_translate(scene, seq, (snap_frame-seq->startofs+seq->startstill) - seq->start);
} else {
if(seq->flag & SEQ_LEFTSEL) {
seq_tx_set_final_left(seq, snap_frame);
@@ -1157,7 +1158,6 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
calc_sequence(scene, seq);
}
}
- SEQ_END
/* test for effects and overlap
* dont use SEQP_BEGIN since that would be recursive */
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 024eef9092a..2b27186041f 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -74,7 +74,7 @@ static void text_font_end(SpaceText *UNUSED(st))
static int text_font_draw(SpaceText *UNUSED(st), int x, int y, char *str)
{
BLF_position(mono, x, y, 0);
- BLF_draw(mono, str);
+ BLF_draw(mono, str, 65535); /* XXX, use real length */
return BLF_width(mono, str);
}
@@ -82,12 +82,11 @@ static int text_font_draw(SpaceText *UNUSED(st), int x, int y, char *str)
static int text_font_draw_character(SpaceText *st, int x, int y, char c)
{
char str[2];
-
str[0]= c;
str[1]= '\0';
BLF_position(mono, x, y, 0);
- BLF_draw(mono, str);
+ BLF_draw(mono, str, 1);
return st->cwidth;
}
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 8cfb11478be..e65751e1f9d 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -1772,7 +1772,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
if ((bone) && !(bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))) {
if (bone->layer & arm->layer) {
- if ((do_dashed & 1) && (bone->parent)) {
+ if ((do_dashed & 1) && (pchan->parent)) {
/* Draw a line from our root to the parent's tip
* - only if V3D_HIDE_HELPLINES is enabled...
*/
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 7d30c404bf0..fa5000a5c9e 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -643,10 +643,10 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
const char *str= (char *)(vos+1);
glColor3fv(vos->col);
if(vos->flag & V3D_CACHE_TEXT_ASCII) {
- BLF_draw_default_ascii((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str);
+ BLF_draw_default_ascii((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str, 65535); /* XXX, use real length */
}
else {
- BLF_draw_default((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str);
+ BLF_draw_default((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str, 65535); /* XXX, use real length */
}
}
}
@@ -1218,10 +1218,15 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
{
/* a standing up pyramid with (0,0,0) as top */
Camera *cam;
- World *wrld;
- float nobmat[4][4], vec[8][4], fac, facx, facy, depth, aspx, aspy, caspx, caspy, shx, shy;
+ float vec[8][4], facx, facy, depth, aspx, aspy, caspx, caspy, shx, shy;
int i;
+ float drawsize;
+ const short is_view= (rv3d->persp==RV3D_CAMOB && ob==v3d->camera);
+ const float scax= 1.0f / len_v3(ob->obmat[0]);
+ const float scay= 1.0f / len_v3(ob->obmat[1]);
+ const float scaz= 1.0f / len_v3(ob->obmat[2]);
+
cam= ob->data;
aspx= (float) scene->r.xsch*scene->r.xasp;
aspy= (float) scene->r.ysch*scene->r.yasp;
@@ -1238,40 +1243,46 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE);
- if(rv3d->persp>=2 && cam->type==CAM_ORTHO && ob==v3d->camera) {
- facx= 0.5*cam->ortho_scale*caspx;
- facy= 0.5*cam->ortho_scale*caspy;
- shx= cam->shiftx * cam->ortho_scale;
- shy= cam->shifty * cam->ortho_scale;
- depth= -cam->clipsta-0.1;
+ if(cam->type==CAM_ORTHO) {
+ facx= 0.5f * cam->ortho_scale * caspx * scax;
+ facy= 0.5f * cam->ortho_scale * caspy * scay;
+ shx= cam->shiftx * cam->ortho_scale * scax;
+ shy= cam->shifty * cam->ortho_scale * scay;
+ depth= is_view ? -((cam->clipsta * scaz) + 0.1f) : - cam->drawsize * cam->ortho_scale * scaz;
+
+ drawsize= 0.5f * cam->ortho_scale;
}
else {
- fac= cam->drawsize;
- if(rv3d->persp>=2 && ob==v3d->camera) fac= cam->clipsta+0.1; /* that way it's always visible */
+ /* that way it's always visible - clipsta+0.1 */
+ float fac;
+ drawsize= cam->drawsize / ((scax + scay + scaz) / 3.0f);
+ fac= is_view ? (cam->clipsta + 0.1f) : drawsize;
+ depth= - fac*cam->lens/16.0 * scaz;
+ facx= fac * caspx * scax;
+ facy= fac * caspy * scay;
+ shx= cam->shiftx*fac*2 * scax;
+ shy= cam->shifty*fac*2 * scay;
- depth= - fac*cam->lens/16.0;
- facx= fac*caspx;
- facy= fac*caspy;
- shx= cam->shiftx*fac*2;
- shy= cam->shifty*fac*2;
}
- vec[0][0]= 0.0; vec[0][1]= 0.0; vec[0][2]= 0.001; /* GLBUG: for picking at iris Entry (well thats old!) */
+ vec[0][0]= 0.0; vec[0][1]= 0.0; vec[0][2]= 0.0;
vec[1][0]= shx + facx; vec[1][1]= shy + facy; vec[1][2]= depth;
vec[2][0]= shx + facx; vec[2][1]= shy - facy; vec[2][2]= depth;
vec[3][0]= shx - facx; vec[3][1]= shy - facy; vec[3][2]= depth;
vec[4][0]= shx - facx; vec[4][1]= shy + facy; vec[4][2]= depth;
+ /* camera frame */
glBegin(GL_LINE_LOOP);
glVertex3fv(vec[1]);
glVertex3fv(vec[2]);
glVertex3fv(vec[3]);
glVertex3fv(vec[4]);
glEnd();
-
- if(rv3d->persp>=2 && ob==v3d->camera) return;
-
+ if(is_view)
+ return;
+
+ /* center point to camera frame */
glBegin(GL_LINE_STRIP);
glVertex3fv(vec[2]);
glVertex3fv(vec[0]);
@@ -1285,7 +1296,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
/* arrow on top */
vec[0][2]= depth;
-
+
/* draw an outline arrow for inactive cameras and filled
* for active cameras. We actually draw both outline+filled
* for active cameras so the wire can be seen side-on */
@@ -1294,15 +1305,15 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
else if (i==1 && (ob == v3d->camera)) glBegin(GL_TRIANGLES);
else break;
- vec[0][0]= shx + (-0.7 * cam->drawsize);
- vec[0][1]= shy + (cam->drawsize * (caspy + 0.1));
+ vec[0][0]= shx + ((-0.7 * drawsize) * scax);
+ vec[0][1]= shy + ((drawsize * (caspy + 0.1)) * scay);
glVertex3fv(vec[0]); /* left */
- vec[0][0]= shx + (0.7 * cam->drawsize);
+ vec[0][0]= shx + ((0.7 * drawsize) * scax);
glVertex3fv(vec[0]); /* right */
vec[0][0]= shx;
- vec[0][1]= shy + (1.1 * cam->drawsize * (caspy + 0.7));
+ vec[0][1]= shy + ((1.1 * drawsize * (caspy + 0.7)) * scay);
glVertex3fv(vec[0]); /* top */
glEnd();
@@ -1310,6 +1321,9 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
if(flag==0) {
if(cam->flag & (CAM_SHOWLIMITS+CAM_SHOWMIST)) {
+ float nobmat[4][4];
+ World *wrld;
+
/* draw in normalized object matrix space */
copy_m4_m4(nobmat, ob->obmat);
normalize_m4(nobmat);
@@ -2321,7 +2335,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
}
}
- if((me->drawflag & (ME_DRAWFACES)) || paint_facesel_test(ob)) { /* transp faces */
+ if(me->drawflag & ME_DRAWFACES) { /* transp faces */
unsigned char col1[4], col2[4], col3[4];
UI_GetThemeColor4ubv(TH_FACE, (char *)col1);
@@ -2458,7 +2472,8 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
Object *ob= base->object;
Mesh *me = ob->data;
Material *ma= give_current_material(ob, 1);
- int hasHaloMat = (ma && (ma->material_type == MA_TYPE_HALO));
+ const short hasHaloMat = (ma && (ma->material_type == MA_TYPE_HALO));
+ const short is_paint_sel= (ob==OBACT && paint_facesel_test(ob));
int draw_wire = 0;
int totvert, totedge, totface;
DispList *dl;
@@ -2480,7 +2495,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
// Unwanted combination.
- if (ob==OBACT && paint_facesel_test(ob)) draw_wire = 0;
+ if (is_paint_sel) draw_wire = 0;
if(dt==OB_BOUNDBOX) {
if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
@@ -2494,11 +2509,10 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
else if(dt==OB_WIRE || totface==0) {
draw_wire = 1; /* draw wire only, no depth buffer stuff */
}
- else if( (ob==OBACT && (ob->mode & OB_MODE_TEXTURE_PAINT || paint_facesel_test(ob))) ||
+ else if( (is_paint_sel && (ob->mode & OB_MODE_TEXTURE_PAINT)) ||
CHECK_OB_DRAWTEXTURE(v3d, dt))
{
- int faceselect= (ob==OBACT && paint_facesel_test(ob));
- if ((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !(G.f&G_PICKSEL || paint_facesel_test(ob)) && !draw_wire) {
+ if ((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !(G.f&G_PICKSEL || is_paint_sel) && !draw_wire) {
draw_mesh_object_outline(v3d, ob, dm);
}
@@ -2513,10 +2527,10 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
glFrontFace(GL_CCW);
}
else {
- draw_mesh_textured(scene, v3d, rv3d, ob, dm, faceselect);
+ draw_mesh_textured(scene, v3d, rv3d, ob, dm, is_paint_sel);
}
- if(!faceselect) {
+ if(!is_paint_sel) {
if(base->flag & SELECT)
UI_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
else
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index f5c1612f786..612f2b4af48 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -654,6 +654,13 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_WORLD_DRAW:
/* handled by space_view3d_listener() for v3d access */
break;
+ case ND_WORLD_STARS:
+ {
+ RegionView3D *rv3d= ar->regiondata;
+ if(rv3d->persp == RV3D_CAMOB) {
+ ED_region_tag_redraw(ar);
+ }
+ }
}
break;
case NC_LAMP:
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 27afe07c4b2..2bdba27a237 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -604,7 +604,7 @@ static void draw_view_axis(RegionView3D *rv3d)
glEnd();
if (fabs(dx) > toll || fabs(dy) > toll) {
- BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "x");
+ BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "x", 1);
}
/* BLF_draw_default disables blending */
@@ -624,7 +624,7 @@ static void draw_view_axis(RegionView3D *rv3d)
glEnd();
if (fabs(dx) > toll || fabs(dy) > toll) {
- BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "y");
+ BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "y", 1);
}
glEnable(GL_BLEND);
@@ -643,7 +643,7 @@ static void draw_view_axis(RegionView3D *rv3d)
glEnd();
if (fabs(dx) > toll || fabs(dy) > toll) {
- BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "z");
+ BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "z", 1);
}
/* restore line-width */
@@ -724,24 +724,17 @@ static char *view3d_get_name(View3D *v3d, RegionView3D *rv3d)
static void draw_viewport_name(ARegion *ar, View3D *v3d)
{
RegionView3D *rv3d= ar->regiondata;
- char *name = view3d_get_name(v3d, rv3d);
- char *printable = NULL;
+ char *name= view3d_get_name(v3d, rv3d);
+ char tmpstr[24];
if (v3d->localvd) {
- printable = MEM_mallocN(strlen(name) + strlen(" (Local)_"), "viewport_name"); /* '_' gives space for '\0' */
- strcpy(printable, name);
- strcat(printable, " (Local)");
- } else {
- printable = name;
+ BLI_snprintf(tmpstr, sizeof(tmpstr), "%s (Local)", name);
+ name= tmpstr;
}
- if (printable) {
+ if (name) {
UI_ThemeColor(TH_TEXT_HI);
- BLF_draw_default(22, ar->winy-17, 0.0f, printable);
- }
-
- if (v3d->localvd) {
- MEM_freeN(printable);
+ BLF_draw_default(22, ar->winy-17, 0.0f, name, sizeof(tmpstr));
}
}
@@ -836,7 +829,7 @@ static void draw_selected_name(Scene *scene, Object *ob, View3D *v3d)
if (U.uiflag & USER_SHOW_ROTVIEWICON)
offset = 14 + (U.rvisize * 2);
- BLF_draw_default(offset, 10, 0.0f, info);
+ BLF_draw_default(offset, 10, 0.0f, info, sizeof(info)-1);
}
static void view3d_get_viewborder_size(Scene *scene, ARegion *ar, float size_r[2])
@@ -1015,7 +1008,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
/* camera name - draw in highlighted text color */
if (ca && (ca->flag & CAM_SHOWNAME)) {
UI_ThemeColor(TH_TEXT_HI);
- BLF_draw_default(x1i, y1i-15, 0.0f, v3d->camera->id.name+2);
+ BLF_draw_default(x1i, y1i-15, 0.0f, v3d->camera->id.name+2, sizeof(v3d->camera->id.name)-2);
UI_ThemeColor(TH_WIRE);
}
}
@@ -2274,7 +2267,7 @@ static void draw_viewport_fps(Scene *scene, ARegion *ar)
BLI_snprintf(printable, sizeof(printable), "fps: %i", (int)(fps+0.5));
}
- BLF_draw_default(22, ar->winy-17, 0.0f, printable);
+ BLF_draw_default(22, ar->winy-17, 0.0f, printable, sizeof(printable)-1);
}
void view3d_main_area_draw(const bContext *C, ARegion *ar)
@@ -2339,22 +2332,25 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
// needs to be done always, gridview is adjusted in drawgrid() now
rv3d->gridview= v3d->grid;
-
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
- if(rv3d->view==0 || rv3d->persp != RV3D_ORTHO) {
+ if(rv3d->view==0 || rv3d->persp != RV3D_ORTHO) {
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
drawfloor(scene, v3d);
- if(rv3d->persp==RV3D_CAMOB) {
- if(scene->world) {
- if(scene->world->mode & WO_STARS) {
- RE_make_stars(NULL, scene, star_stuff_init_func, star_stuff_vertex_func,
- star_stuff_term_func);
- }
+ }
+ if(rv3d->persp==RV3D_CAMOB) {
+ if(scene->world) {
+ if(scene->world->mode & WO_STARS) {
+ RE_make_stars(NULL, scene, star_stuff_init_func, star_stuff_vertex_func,
+ star_stuff_term_func);
}
+ }
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
if(v3d->flag & V3D_DISPBGPICS) draw_bgpic(scene, ar, v3d);
}
}
- else {
+ }
+ else {
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
ED_region_pixelspace(ar);
drawgrid(&scene->unit, ar, v3d, &grid_unit);
/* XXX make function? replaces persp(1) */
@@ -2507,7 +2503,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
}
if (grid_unit) { /* draw below the viewport name */
UI_ThemeColor(TH_TEXT_HI);
- BLF_draw_default(22, ar->winy-(USER_SHOW_VIEWPORTNAME?40:20), 0.0f, grid_unit);
+ BLF_draw_default(22, ar->winy-(USER_SHOW_VIEWPORTNAME?40:20), 0.0f, grid_unit, 65535); /* XXX, use real length */
}
ob= OBACT;
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 9fbfd12f902..3bfe4fa604a 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -34,6 +34,7 @@
#include "DNA_armature_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "DNA_camera_types.h"
#include "MEM_guardedalloc.h"
@@ -158,6 +159,7 @@ static void view3d_boxview_sync(ScrArea *sa, ARegion *ar)
{
ARegion *artest;
RegionView3D *rv3d= ar->regiondata;
+ short clip= 0;
for(artest= sa->regionbase.first; artest; artest= artest->next) {
if(artest!=ar && artest->regiontype==RGN_TYPE_WINDOW) {
@@ -185,11 +187,16 @@ static void view3d_boxview_sync(ScrArea *sa, ARegion *ar)
rv3dtest->ofs[2]= rv3d->ofs[2];
}
+ clip |= rv3dtest->viewlock & RV3D_BOXCLIP;
+
ED_region_tag_redraw(artest);
}
}
}
- view3d_boxview_clip(sa);
+
+ if(clip) {
+ view3d_boxview_clip(sa);
+ }
}
/* for home, center etc */
@@ -197,6 +204,7 @@ void view3d_boxview_copy(ScrArea *sa, ARegion *ar)
{
ARegion *artest;
RegionView3D *rv3d= ar->regiondata;
+ short clip= 0;
for(artest= sa->regionbase.first; artest; artest= artest->next) {
if(artest!=ar && artest->regiontype==RGN_TYPE_WINDOW) {
@@ -206,17 +214,23 @@ void view3d_boxview_copy(ScrArea *sa, ARegion *ar)
rv3dtest->dist= rv3d->dist;
copy_v3_v3(rv3dtest->ofs, rv3d->ofs);
ED_region_tag_redraw(artest);
+
+ clip |= rv3dtest->viewlock & RV3D_BOXCLIP;
}
}
}
- view3d_boxview_clip(sa);
+
+ if(clip) {
+ view3d_boxview_clip(sa);
+ }
}
-void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar)
+/* 'clip' is used to know if our clip setting has changed */
+void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, short do_clip)
{
+ ARegion *arsync= NULL;
RegionView3D *rv3d= ar->regiondata;
short viewlock;
-
/* this function copies flags from the first of the 3 other quadview
regions to the 2 other, so it assumes this is the region whose
properties are always being edited, weak */
@@ -224,18 +238,30 @@ void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar)
if((viewlock & RV3D_LOCKED)==0)
viewlock= 0;
- else if((viewlock & RV3D_BOXVIEW)==0)
+ else if((viewlock & RV3D_BOXVIEW)==0) {
viewlock &= ~RV3D_BOXCLIP;
+ do_clip= TRUE;
+ }
for(; ar; ar= ar->prev) {
if(ar->alignment==RGN_ALIGN_QSPLIT) {
rv3d= ar->regiondata;
rv3d->viewlock= viewlock;
+
+ if(do_clip && (viewlock & RV3D_BOXCLIP)==0) {
+ rv3d->rflag &= ~RV3D_BOXCLIP;
+ }
+
+ /* use arsync so we sync with one of the aligned views below
+ * else the view jumps on changing view settings like 'clip'
+ * since it copies from the perspective view */
+ arsync= ar;
}
}
- if(rv3d->viewlock & RV3D_BOXVIEW)
- view3d_boxview_copy(sa, sa->regionbase.last);
+ if(rv3d->viewlock & RV3D_BOXVIEW) {
+ view3d_boxview_copy(sa, arsync ? arsync : sa->regionbase.last);
+ }
ED_area_tag_redraw(sa);
}
@@ -707,7 +733,7 @@ static int viewrotate_modal(bContext *C, wmOperator *op, wmEvent *event)
viewrotate_apply(vod, event->x, event->y);
}
else if (event_code==VIEW_CONFIRM) {
- request_depth_update(CTX_wm_region_view3d(C));
+ request_depth_update(vod->rv3d);
viewops_data_free(C, op);
return OPERATOR_FINISHED;
@@ -718,36 +744,44 @@ static int viewrotate_modal(bContext *C, wmOperator *op, wmEvent *event)
static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- RegionView3D *rv3d= CTX_wm_region_view3d(C);
ViewOpsData *vod;
-
- if(rv3d->viewlock)
- return OPERATOR_CANCELLED;
+ RegionView3D *rv3d;
/* makes op->customdata */
viewops_data_create(C, op, event);
vod= op->customdata;
+ rv3d= vod->rv3d;
+
+ if(rv3d->viewlock) { /* poll should check but in some cases fails, see poll func for details */
+ viewops_data_free(C, op);
+ return OPERATOR_CANCELLED;
+ }
/* switch from camera view when: */
- if(vod->rv3d->persp != RV3D_PERSP) {
+ if(rv3d->persp != RV3D_PERSP) {
- if (U.uiflag & USER_AUTOPERSP)
- vod->rv3d->persp= RV3D_PERSP;
- else if(vod->rv3d->persp==RV3D_CAMOB) {
+ if (U.uiflag & USER_AUTOPERSP) {
+ rv3d->persp= RV3D_PERSP;
+ }
+ else if(rv3d->persp==RV3D_CAMOB) {
/* changed since 2.4x, use the camera view */
- View3D *v3d = CTX_wm_view3d(C);
- if(v3d->camera)
+ View3D *v3d = vod->sa->spacedata.first;
+
+ if(v3d->camera) {
view3d_settings_from_ob(v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
+ }
- vod->rv3d->persp= RV3D_PERSP;
+ if(rv3d->persp==RV3D_CAMOB) {
+ rv3d->persp= rv3d->lpersp;
+ }
}
ED_region_tag_redraw(vod->ar);
}
if (event->type == MOUSEPAN) {
viewrotate_apply(vod, event->prevx, event->prevy);
- request_depth_update(CTX_wm_region_view3d(C));
+ request_depth_update(rv3d);
viewops_data_free(C, op);
@@ -756,7 +790,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
else if (event->type == MOUSEROTATE) {
/* MOUSEROTATE performs orbital rotation, so y axis delta is set to 0 */
viewrotate_apply(vod, event->prevx, event->y);
- request_depth_update(CTX_wm_region_view3d(C));
+ request_depth_update(rv3d);
viewops_data_free(C, op);
@@ -914,7 +948,7 @@ static int viewmove_modal(bContext *C, wmOperator *op, wmEvent *event)
viewmove_apply(vod, event->x, event->y);
}
else if (event_code==VIEW_CONFIRM) {
- request_depth_update(CTX_wm_region_view3d(C));
+ request_depth_update(vod->rv3d);
viewops_data_free(C, op);
@@ -932,7 +966,7 @@ static int viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event)
if (event->type == MOUSEPAN) {
ViewOpsData *vod= op->customdata;
viewmove_apply(vod, event->prevx, event->prevy);
- request_depth_update(CTX_wm_region_view3d(C));
+ request_depth_update(vod->rv3d);
viewops_data_free(C, op);
@@ -1146,7 +1180,7 @@ static int viewzoom_modal(bContext *C, wmOperator *op, wmEvent *event)
viewzoom_apply(vod, event->x, event->y, U.viewzoom);
}
else if (event_code==VIEW_CONFIRM) {
- request_depth_update(CTX_wm_region_view3d(C));
+ request_depth_update(vod->rv3d);
viewops_data_free(C, op);
return OPERATOR_FINISHED;
@@ -1186,7 +1220,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
if(rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_sync(CTX_wm_area(C), CTX_wm_region(C));
- request_depth_update(CTX_wm_region_view3d(C));
+ request_depth_update(rv3d);
ED_region_tag_redraw(CTX_wm_region(C));
viewops_data_free(C, op);
@@ -1232,7 +1266,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
vod->origy = vod->oldy = vod->origy + event->x - event->prevx;
viewzoom_apply(vod, event->prevx, event->prevy, USER_ZOOM_DOLLY);
}
- request_depth_update(CTX_wm_region_view3d(C));
+ request_depth_update(vod->rv3d);
viewops_data_free(C, op);
return OPERATOR_FINISHED;
@@ -1348,9 +1382,6 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
}
// XXX BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
- if(rv3d->viewlock & RV3D_BOXVIEW)
- view3d_boxview_copy(CTX_wm_area(C), ar);
-
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
return OPERATOR_FINISHED;
@@ -1492,9 +1523,9 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op)) /* like a loca
smooth_view(C, NULL, NULL, new_ofs, NULL, ok_dist ? &new_dist : NULL, NULL);
}
+ /* smooth view does viewlock RV3D_BOXVIEW copy */
+
// XXX BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
- if(rv3d->viewlock & RV3D_BOXVIEW)
- view3d_boxview_copy(CTX_wm_area(C), ar);
return OPERATOR_FINISHED;
}
@@ -1527,8 +1558,7 @@ static int viewcenter_cursor_exec(bContext *C, wmOperator *UNUSED(op))
negate_v3_v3(new_ofs, give_cursor(scene, v3d));
smooth_view(C, NULL, NULL, new_ofs, NULL, NULL, NULL);
- if (rv3d->viewlock & RV3D_BOXVIEW)
- view3d_boxview_copy(CTX_wm_area(C), CTX_wm_region(C));
+ /* smooth view does viewlock RV3D_BOXVIEW copy */
}
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index e137270aa5b..b6372242a9a 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -794,7 +794,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
view3d_persp_mat4(rv3d, view_mat);
mul_m4_m4m4(diff_mat, prev_view_imat, view_mat);
mul_m4_m4m4(parent_mat, fly->root_parent->obmat, diff_mat);
- object_apply_mat4(fly->root_parent, parent_mat, TRUE);
+ object_apply_mat4(fly->root_parent, parent_mat, TRUE, FALSE);
// where_is_object(scene, fly->root_parent);
@@ -812,7 +812,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
else {
float view_mat[4][4];
view3d_persp_mat4(rv3d, view_mat);
- object_apply_mat4(v3d->camera, view_mat, TRUE);
+ object_apply_mat4(v3d->camera, view_mat, TRUE, FALSE);
id_key= &v3d->camera->id;
}
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 1be7816f5ea..d0d4c9ee5c8 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -180,6 +180,7 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
struct SmoothViewStore sms= {0};
+ short ok= FALSE;
/* initialize sms */
copy_v3_v3(sms.new_ofs, rv3d->ofs);
@@ -269,18 +270,26 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo
/* TIMER1 is hardcoded in keymap */
rv3d->smooth_timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER1, 1.0/100.0); /* max 30 frs/sec */
- return;
+ ok= TRUE;
}
}
/* if we get here nothing happens */
- if(sms.to_camera==0) {
- copy_v3_v3(rv3d->ofs, sms.new_ofs);
- copy_qt_qt(rv3d->viewquat, sms.new_quat);
- rv3d->dist = sms.new_dist;
- v3d->lens = sms.new_lens;
+ if(ok == FALSE) {
+ ARegion *ar= CTX_wm_region(C);
+
+ if(sms.to_camera==0) {
+ copy_v3_v3(rv3d->ofs, sms.new_ofs);
+ copy_qt_qt(rv3d->viewquat, sms.new_quat);
+ rv3d->dist = sms.new_dist;
+ v3d->lens = sms.new_lens;
+ }
+
+ if(rv3d->viewlock & RV3D_BOXVIEW)
+ view3d_boxview_copy(CTX_wm_area(C), ar);
+
+ ED_region_tag_redraw(ar);
}
- ED_region_tag_redraw(CTX_wm_region(C));
}
/* only meant for timer usage */
@@ -347,6 +356,9 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
v3d->lens = sms->new_lens*step + sms->orig_lens*step_inv;
}
+ if(rv3d->viewlock & RV3D_BOXVIEW)
+ view3d_boxview_copy(CTX_wm_area(C), CTX_wm_region(C));
+
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
return OPERATOR_FINISHED;
@@ -394,7 +406,9 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op))
copy_qt_qt(rv3d->lviewquat, rv3d->viewquat);
rv3d->lview= rv3d->view;
- rv3d->lpersp= rv3d->persp;
+ if(rv3d->persp != RV3D_CAMOB) {
+ rv3d->lpersp= rv3d->persp;
+ }
setcameratoview3d(rv3d, v3d->camera);
rv3d->persp = RV3D_CAMOB;
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 0f27316ec5b..8822e868556 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1986,9 +1986,10 @@ static void constraintob_from_transdata(bConstraintOb *cob, TransData *td)
* - current space should be local
*/
memset(cob, 0, sizeof(bConstraintOb));
- if (td->rotOrder == ROT_MODE_QUAT) {
- /* quats */
- if (td->ext) {
+ if (td->ext)
+ {
+ if (td->ext->rotOrder == ROT_MODE_QUAT) {
+ /* quats */
/* objects and bones do normalization first too, otherwise
we don't necessarily end up with a rotation matrix, and
then conversion back to quat gives a different result */
@@ -1997,22 +1998,14 @@ static void constraintob_from_transdata(bConstraintOb *cob, TransData *td)
normalize_qt(quat);
quat_to_mat4(cob->matrix, quat);
}
- else
- return;
- }
- else if (td->rotOrder == ROT_MODE_AXISANGLE) {
- /* axis angle */
- if (td->ext)
+ else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
+ /* axis angle */
axis_angle_to_mat4(cob->matrix, &td->ext->quat[1], td->ext->quat[0]);
- else
- return;
- }
- else {
- /* eulers */
- if (td->ext)
- eulO_to_mat4(cob->matrix, td->ext->rot, td->rotOrder);
- else
- return;
+ }
+ else {
+ /* eulers */
+ eulO_to_mat4(cob->matrix, td->ext->rot, td->ext->rotOrder);
+ }
}
}
@@ -2070,17 +2063,17 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td)
if(dolimit) {
/* copy results from cob->matrix */
- if (td->rotOrder == ROT_MODE_QUAT) {
+ if (td->ext->rotOrder == ROT_MODE_QUAT) {
/* quats */
mat4_to_quat( td->ext->quat,cob.matrix);
}
- else if (td->rotOrder == ROT_MODE_AXISANGLE) {
+ else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
/* axis angle */
mat4_to_axis_angle( &td->ext->quat[1], &td->ext->quat[0],cob.matrix);
}
else {
/* eulers */
- mat4_to_eulO( td->ext->rot, td->rotOrder,cob.matrix);
+ mat4_to_eulO( td->ext->rot, td->ext->rotOrder,cob.matrix);
}
}
}
@@ -2946,7 +2939,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
/* rotation */
if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't rotate objects itself
/* euler or quaternion/axis-angle? */
- if (td->rotOrder == ROT_MODE_QUAT) {
+ if (td->ext->rotOrder == ROT_MODE_QUAT) {
mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
mat3_to_quat( quat,fmat); // Actual transform
@@ -2956,7 +2949,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
}
- else if (td->rotOrder == ROT_MODE_AXISANGLE) {
+ else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
/* calculate effect based on quats */
float iquat[4], tquat[4];
@@ -2979,12 +2972,12 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
/* calculate the total rotatation in eulers */
VECCOPY(eul, td->ext->irot);
- eulO_to_mat3( eulmat,eul, td->rotOrder);
+ eulO_to_mat3( eulmat,eul, td->ext->rotOrder);
/* mat = transform, obmat = bone rotation */
mul_m3_m3m3(fmat, smat, eulmat);
- mat3_to_compatible_eulO( eul, td->ext->rot, td->rotOrder,fmat);
+ mat3_to_compatible_eulO( eul, td->ext->rot, td->ext->rotOrder,fmat);
/* and apply (to end result only) */
protectedRotateBits(td->protectflag, eul, td->ext->irot);
@@ -3016,7 +3009,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
/* rotation */
if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't rotate objects itself
/* euler or quaternion? */
- if ((td->rotOrder == ROT_MODE_QUAT) || (td->flag & TD_USEQUAT)) {
+ if ((td->ext->rotOrder == ROT_MODE_QUAT) || (td->flag & TD_USEQUAT)) {
mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
mat3_to_quat( quat,fmat); // Actual transform
@@ -3024,7 +3017,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
/* this function works on end result */
protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
}
- else if (td->rotOrder == ROT_MODE_AXISANGLE) {
+ else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
/* calculate effect based on quats */
float iquat[4], tquat[4];
@@ -3047,11 +3040,11 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
/* calculate the total rotatation in eulers */
add_v3_v3v3(eul, td->ext->irot, td->ext->drot); /* we have to correct for delta rot */
- eulO_to_mat3( obmat,eul, td->rotOrder);
+ eulO_to_mat3( obmat,eul, td->ext->rotOrder);
/* mat = transform, obmat = object rotation */
mul_m3_m3m3(fmat, smat, obmat);
- mat3_to_compatible_eulO( eul, td->ext->rot, td->rotOrder,fmat);
+ mat3_to_compatible_eulO( eul, td->ext->rot, td->ext->rotOrder,fmat);
/* correct back for delta rot */
sub_v3_v3v3(eul, eul, td->ext->drot);
@@ -3433,6 +3426,9 @@ int Translation(TransInfo *t, short UNUSED(mval[2]))
if (t->con.mode & CON_APPLY) {
float pvec[3] = {0.0f, 0.0f, 0.0f};
float tvec[3];
+ if (hasNumInput(&t->num)) {
+ removeAspectRatio(t, t->values);
+ }
applySnapping(t, t->values);
t->con.applyVec(t, NULL, t->values, tvec, pvec);
VECCOPY(t->values, tvec);
@@ -3442,11 +3438,9 @@ int Translation(TransInfo *t, short UNUSED(mval[2]))
applyNDofInput(&t->ndof, t->values);
snapGrid(t, t->values);
applyNumInput(&t->num, t->values);
- if (hasNumInput(&t->num))
- {
+ if (hasNumInput(&t->num)) {
removeAspectRatio(t, t->values);
}
-
applySnapping(t, t->values);
headerTranslation(t, t->values, str);
}
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index b9f3382e9d3..de978626b3e 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -147,6 +147,7 @@ typedef struct TransDataExtension {
float isize[3]; /* Initial size */
float obmat[4][4]; /* Object matrix */
float l_smtx[3][3]; /* use instead of td->smtx, It is the same but without the 'bone->bone_mat', see TD_PBONE_LOCAL_MTX_C */
+ int rotOrder; /* rotation mode, as defined in eRotationModes (DNA_action_types.h) */
} TransDataExtension;
typedef struct TransData2D {
@@ -233,7 +234,6 @@ typedef struct TransData {
void *extra; /* extra data (mirrored element pointer, in editmode mesh to EditVert) (editbone for roll fixing) (...) */
int flag; /* Various flags */
short protectflag; /* If set, copy of Object or PoseChannel protection */
- int rotOrder; /* rotation mode, as defined in eRotationModes (DNA_action_types.h) */
} TransData;
typedef struct MouseInput {
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index b15c5b07758..f002bf9aeb9 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -154,14 +154,16 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) {
if (hasNumInput(&t->num)) {
applyNumInput(&t->num, vec);
+ removeAspectRatio(t, vec);
constraintNumInput(t, vec);
}
/* autovalues is operator param, use that directly but not if snapping is forced */
if (t->flag & T_AUTOVALUES && (t->tsnap.status & SNAP_FORCED) == 0)
{
- VECCOPY(vec, t->auto_values);
+ mul_v3_m3v3(vec, t->con.imtx, t->auto_values);
constraintAutoValues(t, vec);
+ /* inverse transformation at the end */
}
if (t->con.mode & CON_AXIS0) {
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index edae59fc00c..54b724d69f7 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -548,7 +548,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
QUATCOPY(td->ext->iquat, pchan->quat);
}
- td->rotOrder= pchan->rotmode;
+ td->ext->rotOrder= pchan->rotmode;
/* proper way to get parent transform + own transform + constraints transform */
@@ -2662,6 +2662,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
for (ale= anim_data.first; ale; ale= ale->next) {
/* only if a real NLA-track */
if (ale->type == ANIMTYPE_NLATRACK) {
+ AnimData *adt = ale->adt;
NlaTrack *nlt= (NlaTrack *)ale->data;
NlaStrip *strip;
@@ -2686,7 +2687,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
tdn->id= ale->id;
tdn->oldTrack= tdn->nlt= nlt;
tdn->strip= strip;
- tdn->trackIndex= BLI_findindex(&nlt->strips, strip);
+ tdn->trackIndex= BLI_findindex(&adt->nla_tracks, nlt);
yval= (float)(tdn->trackIndex * NLACHANNEL_STEP);
@@ -4328,7 +4329,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
QUATCOPY(td->ext->iquat, ob->quat);
QUATCOPY(td->ext->dquat, ob->dquat);
}
- td->rotOrder=ob->rotmode;
+ td->ext->rotOrder=ob->rotmode;
td->ext->size = ob->size;
VECCOPY(td->ext->isize, ob->size);
@@ -4403,8 +4404,11 @@ static void set_trans_object_base_flags(TransInfo *t)
while(parsel) {
if(parsel->flag & SELECT) {
Base *parbase = object_in_scene(parsel, scene);
- if TESTBASELIB_BGMODE(v3d, scene, parbase)
+ if(parbase) { /* in rare cases this can fail */
+ if TESTBASELIB_BGMODE(v3d, scene, parbase) {
break;
+ }
+ }
}
parsel= parsel->parent;
}
@@ -5154,7 +5158,7 @@ static void createTransObject(bContext *C, TransInfo *t)
td->flag = TD_SELECTED;
td->protectflag= ob->protectflag;
td->ext = tx;
- td->rotOrder= ob->rotmode;
+ td->ext->rotOrder= ob->rotmode;
if (base->flag & BA_TRANSFORM_CHILD)
{
@@ -5188,7 +5192,7 @@ static void createTransObject(bContext *C, TransInfo *t)
{
td->protectflag= ob->protectflag;
td->ext = tx;
- td->rotOrder= ob->rotmode;
+ td->ext->rotOrder= ob->rotmode;
ObjectToTransData(t, td, ob);
td->val = NULL;
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 22888a6b007..6e71cf30112 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -582,7 +582,7 @@ void recalcData(TransInfo *t)
BKE_nlatrack_add_strip(track, strip);
tdn->nlt= track;
- tdn->trackIndex += (n + 1); /* + 1, since n==0 would mean that we didn't change track */
+ tdn->trackIndex++;
}
else /* can't move any further */
break;
@@ -600,7 +600,7 @@ void recalcData(TransInfo *t)
BKE_nlatrack_add_strip(track, strip);
tdn->nlt= track;
- tdn->trackIndex -= (n - 1); /* - 1, since n==0 would mean that we didn't change track */
+ tdn->trackIndex--;
}
else /* can't move any further */
break;
@@ -622,11 +622,6 @@ void recalcData(TransInfo *t)
}
else if (t->spacetype == SPACE_VIEW3D) {
- /* project */
- if(t->state != TRANS_CANCEL) {
- applyProject(t);
- }
-
if (t->obedit) {
if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
Curve *cu= t->obedit->data;
@@ -635,6 +630,7 @@ void recalcData(TransInfo *t)
if(t->state != TRANS_CANCEL) {
clipMirrorModifier(t, t->obedit);
+ applyProject(t);
}
DAG_id_flush_update(t->obedit->data, OB_RECALC_DATA); /* sets recalc flags */
@@ -655,6 +651,11 @@ void recalcData(TransInfo *t)
}
else if(t->obedit->type==OB_LATTICE) {
Lattice *la= t->obedit->data;
+
+ if(t->state != TRANS_CANCEL) {
+ applyProject(t);
+ }
+
DAG_id_flush_update(t->obedit->data, OB_RECALC_DATA); /* sets recalc flags */
if(la->editlatt->latt->flag & LT_OUTSIDE) outside_lattice(la->editlatt->latt);
@@ -664,6 +665,7 @@ void recalcData(TransInfo *t)
/* mirror modifier clipping? */
if(t->state != TRANS_CANCEL) {
clipMirrorModifier(t, t->obedit);
+ applyProject(t);
}
if((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
editmesh_apply_to_mirror(t);
@@ -679,6 +681,10 @@ void recalcData(TransInfo *t)
TransData *td = t->data;
int i;
+ if(t->state != TRANS_CANCEL) {
+ applyProject(t);
+ }
+
/* Ensure all bones are correctly adjusted */
for (ebo = edbo->first; ebo; ebo = ebo->next){
@@ -751,7 +757,12 @@ void recalcData(TransInfo *t)
}
else
+ {
+ if(t->state != TRANS_CANCEL) {
+ applyProject(t);
+ }
DAG_id_flush_update(t->obedit->data, OB_RECALC_DATA); /* sets recalc flags */
+ }
}
else if( (t->flag & T_POSE) && t->poseobj) {
Object *ob= t->poseobj;
@@ -777,11 +788,18 @@ void recalcData(TransInfo *t)
where_is_pose(scene, ob);
}
else if(base && (base->object->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(scene, base->object)) {
+ if(t->state != TRANS_CANCEL) {
+ applyProject(t);
+ }
flushTransParticles(t);
}
else {
int i;
+ if(t->state != TRANS_CANCEL) {
+ applyProject(t);
+ }
+
for (i = 0; i < t->total; i++) {
TransData *td = t->data + i;
Object *ob = td->ob;
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 7ed569dab93..b03c5ef5395 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -477,7 +477,7 @@ int calc_manipulator_stats(const bContext *C)
if(ob && !(ob->flag & SELECT)) ob= NULL;
for(base= scene->base.first; base; base= base->next) {
- if TESTBASELIB(scene, base) {
+ if TESTBASELIB(v3d, base) {
if(ob==NULL)
ob= base->object;
calc_tw_center(scene, base->object->obmat[3]);
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 381612bf1ef..94af243eb0e 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -171,7 +171,7 @@ void TRANSFORM_OT_select_orientation(struct wmOperatorType *ot)
/* api callbacks */
ot->invoke = select_orientation_invoke;
ot->exec = select_orientation_exec;
- ot->poll = ED_operator_areaactive;
+ ot->poll = ED_operator_view3d_active;
prop= RNA_def_property(ot->srna, "orientation", PROP_ENUM, PROP_NONE);
RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 28ff095e706..b1011277be3 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -72,13 +72,12 @@ void BIF_clearTransformOrientation(bContext *C)
}
}
-TransformOrientation* findOrientationName(bContext *C, char *name)
+static TransformOrientation* findOrientationName(ListBase *lb, const char *name)
{
- ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
TransformOrientation *ts= NULL;
- for (ts = transform_spaces->first; ts; ts = ts->next) {
- if (strncmp(ts->name, name, 35) == 0) {
+ for (ts= lb->first; ts; ts = ts->next) {
+ if (strncmp(ts->name, name, sizeof(ts->name)-1) == 0) {
return ts;
}
}
@@ -86,24 +85,14 @@ TransformOrientation* findOrientationName(bContext *C, char *name)
return NULL;
}
-static void uniqueOrientationName(bContext *C, char *name)
+static int uniqueOrientationNameCheck(void *arg, const char *name)
{
- if (findOrientationName(C, name) != NULL)
- {
- /* note: this block is used in other places, when changing logic apply to all others, search this message */
- char tempname[sizeof(((TransformOrientation *)NULL)->name)];
- char left[sizeof(((TransformOrientation *)NULL)->name)];
- int number;
- int len= BLI_split_name_num(left, &number, name);
- do { /* nested while loop looks bad but likely it wont run most times */
- while(BLI_snprintf(tempname, sizeof(tempname), "%s.%03d", left, number) >= sizeof(tempname)) {
- if(len > 0) left[--len]= '\0'; /* word too long */
- else number= 0; /* reset, must be a massive number */
- }
- } while(number++, findOrientationName(C, tempname));
-
- BLI_strncpy(name, tempname, sizeof(tempname));
- }
+ return findOrientationName((ListBase *)arg, name) != NULL;
+}
+
+static void uniqueOrientationName(ListBase *lb, char *name)
+{
+ BLI_uniquename_cb(uniqueOrientationNameCheck, lb, "Space", '.', name, sizeof(((TransformOrientation *)NULL)->name));
}
void BIF_createTransformOrientation(bContext *C, ReportList *reports, char *name, int use, int overwrite)
@@ -277,11 +266,11 @@ TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[],
if (overwrite)
{
- ts = findOrientationName(C, name);
+ ts = findOrientationName(transform_spaces, name);
}
else
{
- uniqueOrientationName(C, name);
+ uniqueOrientationName(transform_spaces, name);
}
/* if not, create a new one */
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index d8c618d4d07..a3364223d28 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -3029,6 +3029,9 @@ static int set_2d_cursor_exec(bContext *C, wmOperator *op)
SpaceImage *sima = CTX_wm_space_image(C);
float location[2];
+ if(!sima)
+ return OPERATOR_CANCELLED;
+
RNA_float_get_array(op->ptr, "location", location);
sima->cursor[0]= location[0];
sima->cursor[1]= location[1];
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 7d2006a3aab..129ba188e5f 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -1179,8 +1179,13 @@ void GPU_buffer_copy_uvedge(DerivedMesh *dm, float *varray, int *UNUSED(index),
GPUBuffer *GPU_buffer_uvedge( DerivedMesh *dm )
{
DEBUG_VBO("GPU_buffer_uvedge\n");
-
- return GPU_buffer_setup( dm, dm->drawObject, sizeof(float)*2*(dm->drawObject->nelements/3)*2, GL_ARRAY_BUFFER_ARB, 0, GPU_buffer_copy_uvedge);
+ /* logic here:
+ * ...each face gets 3 'nelements'
+ * ...3 edges per triangle
+ * ...each edge has its own, non-shared coords.
+ * so each tri corner needs minimum of 4 floats, quads used less so here we can over allocate and assume all tris.
+ * */
+ return GPU_buffer_setup( dm, dm->drawObject, 4 * sizeof(float) * dm->drawObject->nelements, GL_ARRAY_BUFFER_ARB, 0, GPU_buffer_copy_uvedge);
}
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h
index 4a9adaf59fd..22dfc5e9592 100644
--- a/source/blender/imbuf/IMB_imbuf.h
+++ b/source/blender/imbuf/IMB_imbuf.h
@@ -283,7 +283,7 @@ struct ImBuf *IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned
*
* @attention Defined in writeimage.c
*/
-short IMB_saveiff(struct ImBuf *ibuf,char *naam,int flags);
+short IMB_saveiff(struct ImBuf *ibuf, char *filepath, int flags);
/**
* Encodes a png image from an ImBuf
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 5b8c5c72802..2be935a9565 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -482,7 +482,7 @@ void IMB_exr_add_channel(void *handle, const char *layname, const char *passname
}
/* only used for writing temp. render results (not image files) */
-void IMB_exr_begin_write(void *handle, char *filename, int width, int height, int compress)
+void IMB_exr_begin_write(void *handle, const char *filename, int width, int height, int compress)
{
ExrHandle *data= (ExrHandle *)handle;
Header header (width, height);
@@ -503,7 +503,7 @@ void IMB_exr_begin_write(void *handle, char *filename, int width, int height, in
data->ofile = new OutputFile(filename, header);
}
-void IMB_exrtile_begin_write(void *handle, char *filename, int mipmap, int width, int height, int tilex, int tiley)
+void IMB_exrtile_begin_write(void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley)
{
ExrHandle *data= (ExrHandle *)handle;
Header header (width, height);
@@ -528,7 +528,7 @@ void IMB_exrtile_begin_write(void *handle, char *filename, int mipmap, int width
}
/* read from file */
-int IMB_exr_begin_read(void *handle, char *filename, int *width, int *height)
+int IMB_exr_begin_read(void *handle, const char *filename, int *width, int *height)
{
ExrHandle *data= (ExrHandle *)handle;
diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h
index e96b52e121d..4b5a5b648df 100644
--- a/source/blender/imbuf/intern/openexr/openexr_multi.h
+++ b/source/blender/imbuf/intern/openexr/openexr_multi.h
@@ -44,9 +44,9 @@
void * IMB_exr_get_handle (void);
void IMB_exr_add_channel (void *handle, const char *layname, const char *passname, int xstride, int ystride, float *rect);
-int IMB_exr_begin_read (void *handle, char *filename, int *width, int *height);
-void IMB_exr_begin_write (void *handle, char *filename, int width, int height, int compress);
-void IMB_exrtile_begin_write (void *handle, char *filename, int mipmap, int width, int height, int tilex, int tiley);
+int IMB_exr_begin_read (void *handle, const char *filename, int *width, int *height);
+void IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress);
+void IMB_exrtile_begin_write (void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley);
void IMB_exr_set_channel (void *handle, char *layname, char *passname, int xstride, int ystride, float *rect);
@@ -69,9 +69,9 @@ void IMB_exr_close (void *handle);
void * IMB_exr_get_handle (void) {return NULL;}
void IMB_exr_add_channel (void *handle, const char *layname, const char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; }
-int IMB_exr_begin_read (void *handle, char *filename, int *width, int *height) { (void)handle; (void)filename; (void)width; (void)height; return 0;}
-void IMB_exr_begin_write (void *handle, char *filename, int width, int height, int compress) { (void)handle; (void)filename; (void)width; (void)height; (void)compress; }
-void IMB_exrtile_begin_write (void *handle, char *filename, int mipmap, int width, int height, int tilex, int tiley) { (void)handle; (void)filename; (void)mipmap; (void)width; (void)height; (void)tilex; (void)tiley; }
+int IMB_exr_begin_read (void *handle, const char *filename, int *width, int *height) { (void)handle; (void)filename; (void)width; (void)height; return 0;}
+void IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress) { (void)handle; (void)filename; (void)width; (void)height; (void)compress; }
+void IMB_exrtile_begin_write (void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley) { (void)handle; (void)filename; (void)mipmap; (void)width; (void)height; (void)tilex; (void)tiley; }
void IMB_exr_set_channel (void *handle, char *layname, char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; }
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index caba9815a8d..c0b756d4926 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -309,9 +309,11 @@ typedef enum eRotationModes {
/* NOTE: space is reserved here for 18 other possible
* euler rotation orders not implemented
*/
- ROT_MODE_MAX, /* sentinel for Py API */
/* axis angle rotations */
- ROT_MODE_AXISANGLE = -1
+ ROT_MODE_AXISANGLE = -1,
+
+ ROT_MODE_MIN = ROT_MODE_AXISANGLE, /* sentinel for Py API */
+ ROT_MODE_MAX = ROT_MODE_ZYX
} eRotationModes;
/* Pose ------------------------------------ */
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index 8c2fc7db390..498ecdcd183 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -465,6 +465,9 @@ typedef enum eFCurve_Flags {
FCURVE_INT_VALUES = (1<<11),
/* curve can only have certain discrete-number values (no interpolation at all, for enums/booleans) */
FCURVE_DISCRETE_VALUES = (1<<12),
+
+ /* temporary tag for editing */
+ FCURVE_TAGGED = (1<<15),
} eFCurve_Flags;
/* extrapolation modes (only simple value 'extending') */
diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h
index d1aa3c00ac4..b58bd259983 100644
--- a/source/blender/makesdna/DNA_image_types.h
+++ b/source/blender/makesdna/DNA_image_types.h
@@ -51,8 +51,9 @@ typedef struct ImageUser {
short flag, ok;
short multi_index, layer, pass; /* listbase indices, for menu browsing or retrieve buffer */
- short menunr; /* localized menu entry, for handling browse event */
-
+ /* short menunr; */ /* localized menu entry, for handling browse event */
+ short pad;
+
struct Scene *scene; /* to retrieve render result */
} ImageUser;
diff --git a/source/blender/makesdna/DNA_lattice_types.h b/source/blender/makesdna/DNA_lattice_types.h
index 94fc9fefb66..3d05acfbe0d 100644
--- a/source/blender/makesdna/DNA_lattice_types.h
+++ b/source/blender/makesdna/DNA_lattice_types.h
@@ -49,7 +49,7 @@ typedef struct Lattice {
short pntsu, pntsv, pntsw, flag;
short opntsu, opntsv, opntsw, pad2;
- char typeu, typev, typew, type;
+ char typeu, typev, typew, pad3;
int pad;
float fu, fv, fw, du, dv, dw;
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 8ac93e65312..3d774c7eb2e 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -765,7 +765,6 @@ typedef struct Scene {
struct World *world;
struct Scene *set;
- struct Image *ima;
ListBase base;
struct Base *basact; /* active base */
@@ -809,7 +808,7 @@ typedef struct Scene {
short dagisvalid, dagflags;
short recalc; /* recalc = counterpart of ob->recalc */
- short jumpframe;
+ short pad6;
int pad5;
/* User-Defined KeyingSets */
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index a811fd9c014..7091bc79a5b 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -54,7 +54,8 @@ typedef struct bScreen {
struct Scene *scene;
struct Scene *newscene; /* temporary when switching */
- short full; /* fade out? */
+ short full; /* temp screen for image render display or fileselect */
+ short temp; /* temp screen in a temp window, don't save (like user prefs) */
short winid; /* winid from WM, starts with 1 */
short do_draw; /* notifier for drawing edges */
short do_refresh; /* notifier for scale screen, changed screen, etc */
@@ -66,7 +67,7 @@ typedef struct bScreen {
short mainwin; /* screensize subwindow, for screenedges and global menus */
short subwinactive; /* active subwindow */
- int pad2;
+ short pad;
struct wmTimer *animtimer; /* if set, screen has timer handler added in window */
void *context; /* context callback */
@@ -187,10 +188,9 @@ typedef struct ARegion {
#define HEADERDOWN 1
#define HEADERTOP 2
+/* screen->full */
#define SCREENNORMAL 0
#define SCREENFULL 1
-#define SCREENAUTOPLAY 2
-#define SCREENTEMP 3
/* Panel->snap - for snapping to screen edges */
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 0ca31983ac5..eafb03accb8 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -84,11 +84,20 @@ typedef struct SpaceInfo {
short blockhandler[8]; /* XXX depricate this */
- struct bScreen *screen; /* browse screen */
- struct Scene *scene; /* browse scene */
+ char rpt_mask;
+ char pad[7];
} SpaceInfo;
+/* SpaceInfo.rpt_mask */
+enum {
+ INFO_RPT_DEBUG = 1<<0,
+ INFO_RPT_INFO = 1<<1,
+ INFO_RPT_OP = 1<<2,
+ INFO_RPT_WARN = 1<<3,
+ INFO_RPT_ERR = 1<<4,
+};
+
/* 'Graph' Editor (formerly known as the IPO Editor) */
typedef struct SpaceIpo {
SpaceLink *next, *prev;
@@ -505,21 +514,6 @@ enum {
CONSOLE_LINE_ERROR
};
-/* SpaceConsole.rpt_mask */
-enum {
- CONSOLE_TYPE_PYTHON=0,
- CONSOLE_TYPE_REPORT,
-};
-
-/* SpaceConsole.type see BKE_report.h */
-enum {
- CONSOLE_RPT_DEBUG = 1<<0,
- CONSOLE_RPT_INFO = 1<<1,
- CONSOLE_RPT_OP = 1<<2,
- CONSOLE_RPT_WARN = 1<<3,
- CONSOLE_RPT_ERR = 1<<4,
-};
-
typedef struct SpaceConsole {
SpaceLink *next, *prev;
ListBase regionbase; /* storage of regions for inactive spaces */
@@ -529,9 +523,7 @@ typedef struct SpaceConsole {
short blockhandler[8]; // XXX are these needed?
/* space vars */
- int type; /* console/report/..? */
- int rpt_mask; /* which reports to display */
- int flag, lheight;
+ int lheight, pad;
ListBase scrollback; /* ConsoleLine; output */
ListBase history; /* ConsoleLine; command history, current edited line is the first */
diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h
index 19aacaa8108..9df596666a7 100644
--- a/source/blender/makesdna/DNA_texture_types.h
+++ b/source/blender/makesdna/DNA_texture_types.h
@@ -224,7 +224,7 @@ typedef struct Tex {
float vn_mexp;
short vn_distm, vn_coltype;
- short noisedepth, noisetype;
+ short noisedepth, noisetype; /* noisedepth MUST be <= 30 else we get floating point exceptions */
/* newnoise: noisebasis type for clouds/marble/etc, noisebasis2 only used for distorted noise */
short noisebasis, noisebasis2;
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 4e3a957d775..c504c61bc90 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -468,6 +468,8 @@ extern UserDef U; /* from blenkernel blender.c */
#define USER_ZOOM_INVERT (1 << 25)
#define USER_ZOOM_DOLLY_HORIZ (1 << 26)
#define USER_SPLASH_DISABLE (1 << 27)
+#define USER_HIDE_RECENT (1 << 28)
+#define USER_SHOW_THUMBNAILS (1 << 29)
/* Auto-Keying mode */
/* AUTOKEY_ON is a bitflag */
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 307e111abe6..77b42bbed62 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -120,7 +120,7 @@ typedef struct RegionView3D {
/* last view */
float lviewquat[4];
- short lpersp, lview;
+ short lpersp, lview; /* lpersp can never be set to 'RV3D_CAMOB' */
float gridview;
float twangle[3];
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 10c1946416d..d26e018e266 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -342,6 +342,7 @@ extern StructRNA RNA_NlaStrip;
extern StructRNA RNA_NlaTrack;
extern StructRNA RNA_Node;
extern StructRNA RNA_NodeGroup;
+extern StructRNA RNA_NodeLink;
extern StructRNA RNA_NodeSocket;
extern StructRNA RNA_NodeTree;
extern StructRNA RNA_NoiseTexture;
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index dc31573e8dd..f97187d6e15 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -134,7 +134,7 @@ void RNA_def_property_flag(PropertyRNA *prop, int flag);
void RNA_def_property_clear_flag(PropertyRNA *prop, int flag);
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype);
void RNA_def_property_array(PropertyRNA *prop, int length);
-void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, int length[]);
+void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[]);
void RNA_def_property_range(PropertyRNA *prop, double min, double max);
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item);
diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript
index e32f453b67e..d280278b677 100644
--- a/source/blender/makesrna/SConscript
+++ b/source/blender/makesrna/SConscript
@@ -49,6 +49,9 @@ if env['WITH_BF_LCMS']:
if env['WITH_BF_GAMEENGINE']:
defs.append('WITH_GAMEENGINE')
+if env['WITH_BF_COLLADA']:
+ defs.append('WITH_COLLADA')
+
if env['BF_UNIT_TEST']:
defs.append('UNIT_TEST')
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index d430fd405fc..9343459e061 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -137,6 +137,10 @@ IF(WITH_JACK)
ADD_DEFINITIONS(-DWITH_JACK)
ENDIF(WITH_JACK)
+IF(WITH_OPENCOLLADA)
+ ADD_DEFINITIONS(-DWITH_COLLADA)
+ENDIF(WITH_OPENCOLLADA)
+
# Build makesrna executable
ADD_EXECUTABLE(makesrna ${SRC} ${INC_FILES})
TARGET_LINK_LIBRARIES(makesrna bf_dna)
diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript
index b8e30bcfe98..ec588319eae 100644
--- a/source/blender/makesrna/intern/SConscript
+++ b/source/blender/makesrna/intern/SConscript
@@ -88,6 +88,9 @@ if env['BF_UNIT_TEST']:
if env['WITH_BF_PYTHON']:
defs.append('WITH_PYTHON')
+if env['WITH_BF_COLLADA']:
+ defs.append('WITH_COLLADA')
+
if env['OURPLATFORM'] == 'linux2':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index fe82c6e06e1..0144a0c1bdf 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -3772,7 +3772,10 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
}
case PROP_POINTER:
{
- BLI_dynstr_append(dynstr, "'<POINTER>'"); /* TODO */
+ PointerRNA tptr= RNA_property_pointer_get(ptr, prop);
+ cstring= RNA_pointer_as_string(&tptr);
+ BLI_dynstr_append(dynstr, cstring);
+ MEM_freeN(cstring);
break;
}
case PROP_COLLECTION:
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 9f5308cce33..e872037db2a 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -60,12 +60,6 @@ static int rna_AnimData_action_editable(PointerRNA *ptr)
return 1;
}
-static void rna_AnimData_action_set(PointerRNA *ptr, PointerRNA value)
-{
- AnimData *adt= (AnimData*)(ptr->data);
- adt->action= value.data;
-}
-
/* ****************************** */
/* wrapper for poll callback */
@@ -657,7 +651,6 @@ void rna_def_animdata(BlenderRNA *brna)
/* Active Action */
prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_AnimData_action_set", NULL, NULL);
RNA_def_property_flag(prop, PROP_EDITABLE); /* this flag as well as the dynamic test must be defined for this to be editable... */
RNA_def_property_editable_func(prop, "rna_AnimData_action_editable");
RNA_def_property_ui_text(prop, "Action", "Active Action for this datablock");
diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c
index 71e95248512..759a4acc860 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -52,6 +52,18 @@ static void rna_cloth_update(Main *bmain, Scene *scene, PointerRNA *ptr)
WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
}
+static void rna_cloth_pinning_changed(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ Object *ob= (Object*)ptr->id.data;
+// ClothSimSettings *settings = (ClothSimSettings*)ptr->data;
+ ClothModifierData *clmd = (ClothModifierData*)modifiers_findByType(ob, eModifierType_Cloth);
+
+ cloth_free_modifier(clmd);
+
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+ WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
+}
+
static void rna_cloth_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
@@ -256,7 +268,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
prop= RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop, "rna_ClothSettings_mass_vgroup_get", "rna_ClothSettings_mass_vgroup_length", "rna_ClothSettings_mass_vgroup_set");
RNA_def_property_ui_text(prop, "Mass Vertex Group", "Vertex Group for pinning of vertices");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
+ RNA_def_property_update(prop, 0, "rna_cloth_pinning_changed");
prop= RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
RNA_def_property_array(prop, 3);
@@ -276,7 +288,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_pin_cloth", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_GOAL);
RNA_def_property_ui_text(prop, "Pin Cloth", "Enable pinning of cloth vertices to other objects/positions");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
+ RNA_def_property_update(prop, 0, "rna_cloth_pinning_changed");
prop= RNA_def_property(srna, "pin_stiffness", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "goalspring");
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index c7802de9ebb..9f59d3b8573 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -745,9 +745,9 @@ static void rna_def_nurbs(BlenderRNA *brna, StructRNA *srna)
PropertyRNA *prop;
/* flags */
- prop= RNA_def_property(srna, "use_map_on_length", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_uv_as_generated", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_UV_ORCO);
- RNA_def_property_ui_text(prop, "Map Along Length", "Generate texture mapping coordinates following the curve direction, rather than the local bounding box");
+ RNA_def_property_ui_text(prop, "Use UV for Mapping", "Uses the UV values as Generated textured coordinates");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
}
@@ -1234,7 +1234,7 @@ static void rna_def_curve(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_fill_deform", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_DEFORM_FILL);
- RNA_def_property_ui_text(prop, "Fill deformed", "Fill curve after applying deformation");
+ RNA_def_property_ui_text(prop, "Fill deformed", "Fill curve after applying shape keys and all modifiers");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
/* texture space */
@@ -1263,9 +1263,9 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_editable_func(prop, texspace_editable);
RNA_def_property_update(prop, 0, "rna_Curve_update_data");*/
- prop= RNA_def_property(srna, "use_map_on_length", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_uv_as_generated", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_UV_ORCO);
- RNA_def_property_ui_text(prop, "Map Along Length", "Generate texture mapping coordinates following the curve direction, rather than the local bounding box");
+ RNA_def_property_ui_text(prop, "Use UV for mapping", "Uses the UV values as Generated textured coordinates");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
/* materials */
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 85f31e245d4..c44b55764b6 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -1026,6 +1026,12 @@ void RNA_def_property_array(PropertyRNA *prop, int length)
return;
}
+ if(prop->arraydimension > 1) {
+ fprintf(stderr, "RNA_def_property_array: \"%s.%s\", array dimensions has been set to %d but would be overwritten as 1.\n", srna->identifier, prop->identifier, prop->arraydimension);
+ DefRNA.error= 1;
+ return;
+ }
+
switch(prop->type) {
case PROP_BOOLEAN:
case PROP_INT:
@@ -1041,7 +1047,7 @@ void RNA_def_property_array(PropertyRNA *prop, int length)
}
}
-void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, int length[])
+void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
{
StructRNA *srna= DefRNA.laststruct;
int i;
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 8557f115737..c238ed6991d 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -1063,7 +1063,7 @@ static void rna_def_material_volume(BlenderRNA *brna)
prop= RNA_def_property(srna, "cache_resolution", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "precache_resolution");
- RNA_def_property_range(prop, 0, 1024);
+ RNA_def_property_range(prop, 1, 1024);
RNA_def_property_ui_text(prop, "Resolution", "Resolution of the voxel grid, low resolutions are faster, high resolutions use more memory");
RNA_def_property_update(prop, 0, "rna_Material_update");
@@ -1403,7 +1403,7 @@ static void rna_def_material_specularity(StructRNA *srna)
RNA_def_property_ui_text(prop, "Specular Toon Smooth", "Smoothness of specular toon area");
RNA_def_property_update(prop, 0, "rna_Material_update");
- prop= RNA_def_property(srna, "specular_slope", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "specular_slope", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "rms");
RNA_def_property_range(prop, 0, 0.4);
RNA_def_property_ui_text(prop, "Specular Slope", "The standard deviation of surface slope");
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 95e17451e62..8d16c705d96 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -1300,7 +1300,7 @@ static void rna_def_mtface(BlenderRNA *brna)
{TF_ALPHA, "ALPHA", 0, "Alpha", "Render polygon transparent, depending on alpha channel of the texture"},
{TF_CLIP, "CLIPALPHA", 0, "Clip Alpha", "Use the images alpha values clipped with no blending (binary alpha)"},
{0, NULL, 0, NULL, NULL}};
- int uv_dim[]= {4, 2};
+ const int uv_dim[]= {4, 2};
srna= RNA_def_struct(brna, "MeshTextureFaceLayer", NULL);
RNA_def_struct_ui_text(srna, "Mesh Texture Face Layer", "Layer of texture faces in a Mesh datablock");
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 7fc07d6c193..a434eb645cd 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -1166,12 +1166,12 @@ static void rna_def_modifier_array(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Constant Offset Displacement", "");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop= RNA_def_property(srna, "use_relative_offset", PROP_BOOLEAN, PROP_TRANSLATION);
+ prop= RNA_def_property(srna, "use_relative_offset", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_RELATIVE);
RNA_def_property_ui_text(prop, "Relative Offset", "Add an offset relative to the object's bounding box");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop= RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_TRANSLATION);
+ prop= RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_NONE); /* PROP_TRANSLATION causes units to be used which we dont want */
RNA_def_property_float_sdna(prop, NULL, "scale");
RNA_def_property_ui_text(prop, "Relative Offset Displacement", "");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 52a19c6376f..7a382f537a6 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -2034,6 +2034,16 @@ static void def_cmp_huecorrect(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
}
+static void def_cmp_zcombine(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 0);
+ RNA_def_property_ui_text(prop, "Use Alpha", "Takes Alpha channel into account when doing the Z operation");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+}
+
/* -- Texture Nodes --------------------------------------------------------- */
@@ -2277,6 +2287,37 @@ static void rna_def_node(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Outputs", "");
}
+static void rna_def_node_link(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "NodeLink", NULL);
+ RNA_def_struct_ui_text(srna, "NodeLink", "Link between nodes in a node tree");
+ RNA_def_struct_sdna(srna, "bNodeLink");
+ RNA_def_struct_ui_icon(srna, ICON_NODE);
+
+ prop = RNA_def_property(srna, "from_node", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "fromnode");
+ RNA_def_property_struct_type(prop, "Node");
+ RNA_def_property_ui_text(prop, "From node", "");
+
+ prop = RNA_def_property(srna, "to_node", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "tonode");
+ RNA_def_property_struct_type(prop, "Node");
+ RNA_def_property_ui_text(prop, "To node", "");
+
+ prop = RNA_def_property(srna, "from_socket", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "fromsock");
+ RNA_def_property_struct_type(prop, "NodeSocket");
+ RNA_def_property_ui_text(prop, "From socket", "");
+
+ prop = RNA_def_property(srna, "to_socket", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "tosock");
+ RNA_def_property_struct_type(prop, "NodeSocket");
+ RNA_def_property_ui_text(prop, "To socket", "");
+}
+
static void rna_def_nodetree(BlenderRNA *brna)
{
StructRNA *srna;
@@ -2295,6 +2336,12 @@ static void rna_def_nodetree(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "nodes", NULL);
RNA_def_property_struct_type(prop, "Node");
RNA_def_property_ui_text(prop, "Nodes", "");
+
+ /* NodeLinks Collection */
+ prop = RNA_def_property(srna, "links", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "links", NULL);
+ RNA_def_property_struct_type(prop, "NodeLink");
+ RNA_def_property_ui_text(prop, "Links", "");
/* Grease Pencil */
prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
@@ -2321,6 +2368,7 @@ void RNA_def_nodetree(BlenderRNA *brna)
rna_def_node_socket_vector(brna);
rna_def_node_socket_rgba(brna);
rna_def_node(brna);
+ rna_def_node_link(brna);
rna_def_shader_node(brna);
rna_def_compositor_node(brna);
rna_def_texture_node(brna);
diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h
index f824f6f20ce..679a5fc0cdc 100644
--- a/source/blender/makesrna/intern/rna_nodetree_types.h
+++ b/source/blender/makesrna/intern/rna_nodetree_types.h
@@ -71,7 +71,7 @@ DefNode( CompositorNode, CMP_NODE_COMPOSITE, 0, "COMPO
DefNode( CompositorNode, CMP_NODE_OUTPUT_FILE, def_cmp_output_file, "OUTPUT_FILE", OutputFile, "Output File", "" )
DefNode( CompositorNode, CMP_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" )
DefNode( CompositorNode, CMP_NODE_TRANSLATE, 0, "TRANSLATE", Translate, "Translate", "" )
-DefNode( CompositorNode, CMP_NODE_ZCOMBINE, 0, "ZCOMBINE", Zcombine, "Z Combine", "" )
+DefNode( CompositorNode, CMP_NODE_ZCOMBINE, def_cmp_zcombine, "ZCOMBINE", Zcombine, "Z Combine", "" )
DefNode( CompositorNode, CMP_NODE_COMBRGBA, 0, "COMBRGBA", CombRGBA, "Combine RGBA", "" )
DefNode( CompositorNode, CMP_NODE_DILATEERODE, def_cmp_dilate_erode, "DILATEERODE", DilateErode, "Dilate/Erode", "" )
DefNode( CompositorNode, CMP_NODE_ROTATE, def_cmp_rotate, "ROTATE", Rotate, "Rotate", "" )
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 599aa4abc91..fab30668a5b 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -144,7 +144,7 @@ static void rna_Object_internal_update(Main *bmain, Scene *scene, PointerRNA *pt
static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
/* dont use compat so we get pradictable rotation */
- object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat, FALSE);
+ object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat, FALSE, TRUE);
rna_Object_internal_update(bmain, scene, ptr);
}
@@ -179,7 +179,19 @@ static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16])
}
/* dont use compat so we get pradictable rotation */
- object_apply_mat4(ob, ob->obmat, FALSE);
+ object_apply_mat4(ob, ob->obmat, FALSE, FALSE);
+}
+
+static void rna_Object_matrix_basis_get(PointerRNA *ptr, float values[16])
+{
+ Object *ob= ptr->id.data;
+ object_to_mat4(ob, (float(*)[4])values);
+}
+
+static void rna_Object_matrix_basis_set(PointerRNA *ptr, const float values[16])
+{
+ Object *ob= ptr->id.data;
+ object_apply_mat4(ob, (float(*)[4])values, FALSE, FALSE);
}
void rna_Object_internal_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
@@ -1566,7 +1578,7 @@ static void rna_def_object(BlenderRNA *brna)
{OB_MESH, "MESH", 0, "Mesh", ""},
{OB_CURVE, "CURVE", 0, "Curve", ""},
{OB_SURF, "SURFACE", 0, "Surface", ""},
- {OB_FONT, "TEXT", 0, "Text", ""},
+ {OB_FONT, "FONT", 0, "Font", ""},
{OB_MBALL, "META", 0, "Meta", ""},
{OB_LAMP, "LAMP", 0, "Lamp", ""},
{OB_CAMERA, "CAMERA", 0, "Camera", ""},
@@ -1639,8 +1651,8 @@ static void rna_def_object(BlenderRNA *brna)
static float default_quat[4] = {1,0,0,0}; /* default quaternion values */
static float default_axisAngle[4] = {0,0,1,0}; /* default axis-angle rotation values */
static float default_scale[3] = {1,1,1}; /* default scale values */
- int matrix_dimsize[]= {4, 4};
- int boundbox_dimsize[]= {8, 3};
+ const int matrix_dimsize[]= {4, 4};
+ const int boundbox_dimsize[]= {8, 3};
srna= RNA_def_struct(brna, "Object", "ID");
RNA_def_struct_ui_text(srna, "Object", "Object datablock defining an object in a scene");
@@ -1886,6 +1898,12 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, "rna_Object_matrix_local_get", "rna_Object_matrix_local_set", NULL);
RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, NULL);
+ prop= RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(prop, 2, matrix_dimsize);
+ RNA_def_property_ui_text(prop, "Input Matrix", "Matrix access to location, rotation and scale (including deltas), before constraints and parenting are applied.");
+ RNA_def_property_float_funcs(prop, "rna_Object_matrix_basis_get", "rna_Object_matrix_basis_set", NULL);
+ RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
+
/* collections */
prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "Constraint");
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index d48e714ea23..3c8fb5ab871 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -56,6 +56,7 @@
#include "BKE_displist.h"
#include "BKE_font.h"
#include "BKE_mball.h"
+#include "BKE_modifier.h"
#include "BLI_math.h"
@@ -280,29 +281,6 @@ static void rna_Object_update(Object *ob, Scene *sce, int object, int data, int
DAG_id_flush_update(&ob->id, flag);
}
-static Object *rna_Object_find_armature(Object *ob)
-{
- Object *ob_arm = NULL;
-
- if (ob->type != OB_MESH) return NULL;
-
- if (ob->parent && ob->partype == PARSKEL && ob->parent->type == OB_ARMATURE) {
- ob_arm = ob->parent;
- }
- else {
- ModifierData *mod = (ModifierData*)ob->modifiers.first;
- while (mod) {
- if (mod->type == eModifierType_Armature) {
- ob_arm = ((ArmatureModifierData*)mod)->object;
- }
-
- mod = mod->next;
- }
- }
-
- return ob_arm;
-}
-
static PointerRNA rna_Object_add_shape_key(Object *ob, bContext *C, ReportList *reports, char *name, int from_mix)
{
Scene *scene= CTX_data_scene(C);
@@ -447,7 +425,7 @@ void RNA_api_object(StructRNA *srna)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
/* Armature */
- func= RNA_def_function(srna, "find_armature", "rna_Object_find_armature");
+ func= RNA_def_function(srna, "find_armature", "modifiers_isDeformedByArmature");
RNA_def_function_ui_description(func, "Find armature influencing this object as a parent or via a modifier.");
parm= RNA_def_pointer(func, "ob_arm", "Object", "", "Armature object influencing this object or NULL.");
RNA_def_function_return(func, parm);
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 3a8f66a3773..a28e0b32eae 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -171,10 +171,8 @@ static void rna_Cache_idname_change(Main *bmain, Scene *scene, PointerRNA *ptr)
if(!pid)
return;
- cache->flag |= (PTCACHE_BAKED|PTCACHE_DISK_CACHE|PTCACHE_SIMULATION_VALID);
- cache->flag &= ~(PTCACHE_OUTDATED|PTCACHE_FRAMES_SKIPPED);
-
BKE_ptcache_load_external(pid);
+
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
}
else {
@@ -1439,7 +1437,7 @@ static void rna_def_softbody(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
- int matrix_dimsize[]= {3, 3};
+ const int matrix_dimsize[]= {3, 3};
static EnumPropertyItem collision_type_items[] = {
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index b4a132dd1ec..df332ffa253 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -541,13 +541,13 @@ PointerRNA rna_PoseBones_lookup_string(PointerRNA *ptr, const char *key)
return rptr;
}
-static void rna_PoseChannel_matrix_local_get(PointerRNA *ptr, float *values)
+static void rna_PoseChannel_matrix_basis_get(PointerRNA *ptr, float *values)
{
bPoseChannel *pchan= (bPoseChannel*)ptr->data;
pchan_to_mat4(pchan, (float (*)[4])values);
}
-static void rna_PoseChannel_matrix_local_set(PointerRNA *ptr, const float *values)
+static void rna_PoseChannel_matrix_basis_set(PointerRNA *ptr, const float *values)
{
bPoseChannel *pchan= (bPoseChannel*)ptr->data;
pchan_apply_mat4(pchan, (float (*)[4])values, FALSE); /* no compat for pradictable result */
@@ -683,6 +683,8 @@ static void rna_def_pose_channel(BlenderRNA *brna)
static float default_axisAngle[4] = {0,0,1,0}; /* default axis-angle rotation values */
static float default_scale[3] = {1,1,1}; /* default scale values */
+ const int matrix_dimsize[]= {4, 4};
+
StructRNA *srna;
PropertyRNA *prop;
@@ -784,18 +786,21 @@ static void rna_def_pose_channel(BlenderRNA *brna)
/* transform matrices - should be read-only since these are set directly by AnimSys evaluation */
prop= RNA_def_property(srna, "matrix_channel", PROP_FLOAT, PROP_MATRIX);
RNA_def_property_float_sdna(prop, NULL, "chan_mat");
- RNA_def_property_array(prop, 16);
+ RNA_def_property_multi_array(prop, 2, matrix_dimsize);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Channel Matrix", "4x4 matrix, before constraints");
- prop= RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_array(prop, 16);
- RNA_def_property_ui_text(prop, "Local Matrix", "Matrix representing the parent relative location, scale and rotation. Provides an alternative access to these properties.");
- RNA_def_property_float_funcs(prop, "rna_PoseChannel_matrix_local_get", "rna_PoseChannel_matrix_local_set", NULL);
+ /* writable because it touches loc/scale/rot directly */
+ prop= RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(prop, 2, matrix_dimsize);
+ RNA_def_property_ui_text(prop, "Basis Matrix", "Provides an alternative access to loc/scale/rotation relative to the parent and own rest bone.");
+ RNA_def_property_float_funcs(prop, "rna_PoseChannel_matrix_basis_get", "rna_PoseChannel_matrix_basis_set", NULL);
+ RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
+ /* final matrix */
prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
RNA_def_property_float_sdna(prop, NULL, "pose_mat");
- RNA_def_property_array(prop, 16);
+ RNA_def_property_multi_array(prop, 2, matrix_dimsize);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Pose Matrix", "Final 4x4 matrix for this channel");
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index a69fe64189e..c21e7bfdfce 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -151,6 +151,8 @@ EnumPropertyItem image_type_items[] = {
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
+#include "RNA_access.h"
+
#include "MEM_guardedalloc.h"
#include "BKE_context.h"
@@ -183,6 +185,20 @@ EnumPropertyItem image_type_items[] = {
#include "FRS_freestyle.h"
+static PointerRNA rna_Scene_object_bases_lookup_string(PointerRNA *ptr, const char *key)
+{
+ Scene *scene= (Scene*)ptr->data;
+ Base *base;
+
+ for(base= scene->base.first; base; base= base->next) {
+ if(strncmp(base->object->id.name+2, key, sizeof(base->object->id.name)-2)==0) {
+ return rna_pointer_inherit_refine(ptr, &RNA_ObjectBase, base);
+ }
+ }
+
+ return PointerRNA_NULL;
+}
+
static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
{
ListBaseIterator *internal= iter->internal;
@@ -1009,7 +1025,7 @@ static void rna_def_transform_orientation(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- int matrix_dimsize[]= {3, 3};
+ const int matrix_dimsize[]= {3, 3};
srna= RNA_def_struct(brna, "TransformOrientation", NULL);
@@ -1153,7 +1169,7 @@ static void rna_def_tool_settings(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_snap_project", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT);
- RNA_def_property_ui_text(prop, "Project Individual Elements", "Project vertices on the surface of other objects");
+ RNA_def_property_ui_text(prop, "Project Individual Elements", "Project individual elements on the surface of other objects");
RNA_def_property_ui_icon(prop, ICON_RETOPO, 0);
RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
@@ -3412,6 +3428,7 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "base", NULL);
RNA_def_property_struct_type(prop, "ObjectBase");
RNA_def_property_ui_text(prop, "Bases", "");
+ RNA_def_property_collection_funcs(prop, 0, 0, 0, 0, 0, 0, "rna_Scene_object_bases_lookup_string");
rna_def_scene_bases(brna, prop);
prop= RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 4b5edb5c6e9..cea0653172f 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -68,9 +68,22 @@ static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name
if(BKE_imtype_is_movie(rd->imtype))
BKE_makeanimstring(name, rd);
else
- BKE_makepicstring(name, rd->pic, (frame==INT_MIN) ? rd->cfra : frame, rd->imtype, rd->scemode & R_EXTENSION);
+ BKE_makepicstring(name, rd->pic, (frame==INT_MIN) ? rd->cfra : frame, rd->imtype, rd->scemode & R_EXTENSION, TRUE);
}
+#ifdef WITH_COLLADA
+
+#include "../../collada/collada.h"
+
+static void rna_Scene_collada_export(Scene *scene, char *filepath)
+{
+ /* XXX not really nice, as this will bring essentially in COLLADA as dependency for
+ * blenderplayer. For now stubbing in blc. */
+ collada_export(scene, filepath);
+}
+
+#endif
+
#else
void RNA_api_scene(StructRNA *srna)
@@ -86,6 +99,14 @@ void RNA_api_scene(StructRNA *srna)
func= RNA_def_function(srna, "update", "rna_Scene_update_tagged");
RNA_def_function_ui_description(func, "Update data tagged to be updated from previous access to data or operators.");
+
+#ifdef WITH_COLLADA
+ func= RNA_def_function(srna, "collada_export", "rna_Scene_collada_export");
+ parm= RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "File path to write Collada file.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */
+ RNA_def_function_ui_description(func, "Export to collada file.");
+#endif
}
void RNA_api_scene_render(StructRNA *srna)
diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c
index a1e25207f1f..6281460d3ad 100644
--- a/source/blender/makesrna/intern/rna_sensor.c
+++ b/source/blender/makesrna/intern/rna_sensor.c
@@ -425,12 +425,12 @@ static void rna_def_keyboard_sensor(BlenderRNA *brna)
prop= RNA_def_property(srna, "target", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "targetName");
- RNA_def_property_ui_text(prop, "Target", "Property that indicates whether to log keystrokes as a string");
+ RNA_def_property_ui_text(prop, "Target", "Property that receive the keystrokes in case a string is logged");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "log", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "toggleName");
- RNA_def_property_ui_text(prop, "Log Toggle", "Property that receive the keystrokes in case a string is logged");
+ RNA_def_property_ui_text(prop, "Log Toggle", "Property that indicates whether to log keystrokes as a string");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "use_all_keys", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index 11b00e1c77f..0638667ad28 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -176,14 +176,14 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "alpha");
RNA_def_property_range(prop, -5.0, 5.0);
RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
- RNA_def_property_ui_text(prop, "Gravity", "Higher value results in sinking smoke");
+ RNA_def_property_ui_text(prop, "Density", "How much density effects smoke motion, higher value results in faster rising smoke");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
prop= RNA_def_property(srna, "beta", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "beta");
RNA_def_property_range(prop, -5.0, 5.0);
RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
- RNA_def_property_ui_text(prop, "Heat", "Higher value results in faster rising smoke");
+ RNA_def_property_ui_text(prop, "Heat", "How much heat effects smoke motion, higher value results in faster rising smoke");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
prop= RNA_def_property(srna, "collision_group", PROP_POINTER, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 80a053c3c99..45ad7700229 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -62,7 +62,7 @@ EnumPropertyItem space_type_items[] = {
{SPACE_TIME, "TIMELINE", 0, "Timeline", ""},
{SPACE_NODE, "NODE_EDITOR", 0, "Node Editor", ""},
{SPACE_LOGIC, "LOGIC_EDITOR", 0, "Logic Editor", ""},
- {SPACE_CONSOLE, "CONSOLE", 0, "Console", ""},
+ {SPACE_CONSOLE, "CONSOLE", 0, "Python Console", ""},
{SPACE_USERPREF, "USER_PREFERENCES", 0, "User Preferences", ""},
{0, NULL, 0, NULL, NULL}};
@@ -348,7 +348,18 @@ static void rna_RegionView3D_quadview_update(Main *main, Scene *scene, PointerRN
rna_area_region_from_regiondata(ptr, &sa, &ar);
if(sa && ar && ar->alignment==RGN_ALIGN_QSPLIT)
- ED_view3d_quadview_update(sa, ar);
+ ED_view3d_quadview_update(sa, ar, FALSE);
+}
+
+/* same as above but call clip==TRUE */
+static void rna_RegionView3D_quadview_clip_update(Main *main, Scene *scene, PointerRNA *ptr)
+{
+ ScrArea *sa;
+ ARegion *ar;
+
+ rna_area_region_from_regiondata(ptr, &sa, &ar);
+ if(sa && ar && ar->alignment==RGN_ALIGN_QSPLIT)
+ ED_view3d_quadview_update(sa, ar, TRUE);
}
static void rna_RegionView3D_view_location_get(PointerRNA *ptr, float *values)
@@ -721,6 +732,18 @@ static void rna_Sequencer_display_mode_update(bContext *C, PointerRNA *ptr)
ED_sequencer_update_view(C, view);
}
+static float rna_BackgroundImage_opacity_get(PointerRNA *ptr)
+{
+ BGpic *bgpic= (BGpic *)ptr->data;
+ return 1.0f-bgpic->blend;
+}
+
+static void rna_BackgroundImage_opacity_set(PointerRNA *ptr, float value)
+{
+ BGpic *bgpic= (BGpic *)ptr->data;
+ bgpic->blend = 1.0f - value;
+}
+
#else
static void rna_def_space(BlenderRNA *brna)
@@ -956,9 +979,10 @@ static void rna_def_background_image(BlenderRNA *brna)
RNA_def_property_range(prop, 0.0, FLT_MAX);
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
- prop= RNA_def_property(srna, "transparency", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "blend");
- RNA_def_property_ui_text(prop, "Transparency", "Amount to blend the image against the background color");
+ RNA_def_property_float_funcs(prop, "rna_BackgroundImage_opacity_get", "rna_BackgroundImage_opacity_set", NULL);
+ RNA_def_property_ui_text(prop, "Opacity", "Image opacity to blend the image against the background color");
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
@@ -979,7 +1003,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
- int matrix_dimsize[]= {4, 4};
+ const int matrix_dimsize[]= {4, 4};
static EnumPropertyItem pivot_items[] = {
{V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", ""},
@@ -1233,7 +1257,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_box_clip", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_BOXCLIP);
RNA_def_property_ui_text(prop, "Clip", "Clip objects based on what's visible in other side views");
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_update");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_clip_update");
prop= RNA_def_property(srna, "perspective_matrix", PROP_FLOAT, PROP_MATRIX);
RNA_def_property_float_sdna(prop, NULL, "persmat");
@@ -1988,11 +2012,6 @@ static void rna_def_console_line(BlenderRNA *brna)
RNA_def_property_int_funcs(prop, NULL, NULL, "rna_ConsoleLine_cursor_index_range");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
}
-
-static EnumPropertyItem console_type_items[] = {
- {CONSOLE_TYPE_PYTHON, "PYTHON", 0, "Python", ""},
- {CONSOLE_TYPE_REPORT, "REPORT", 0, "Report", ""},
- {0, NULL, 0, NULL, NULL}};
static void rna_def_space_console(BlenderRNA *brna)
{
@@ -2009,12 +2028,7 @@ static void rna_def_space_console(BlenderRNA *brna)
RNA_def_property_range(prop, 8, 32);
RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
-
- prop= RNA_def_property(srna, "console_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, console_type_items);
- RNA_def_property_ui_text(prop, "Type", "Console type");
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
+
prop= RNA_def_property(srna, "select_start", PROP_INT, PROP_UNSIGNED); /* copied from text editor */
RNA_def_property_int_sdna(prop, NULL, "sel_start");
@@ -2024,32 +2038,6 @@ static void rna_def_space_console(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "sel_end");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
- /* reporting display */
- prop= RNA_def_property(srna, "show_report_debug", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", CONSOLE_RPT_DEBUG);
- RNA_def_property_ui_text(prop, "Show Debug", "Display debug reporting info");
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE_REPORT, NULL);
-
- prop= RNA_def_property(srna, "show_report_info", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", CONSOLE_RPT_INFO);
- RNA_def_property_ui_text(prop, "Show Info", "Display general information");
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE_REPORT, NULL);
-
- prop= RNA_def_property(srna, "show_report_operator", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", CONSOLE_RPT_OP);
- RNA_def_property_ui_text(prop, "Show Operator", "Display the operator log");
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE_REPORT, NULL);
-
- prop= RNA_def_property(srna, "show_report_warning", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", CONSOLE_RPT_WARN);
- RNA_def_property_ui_text(prop, "Show Warn", "Display warnings");
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE_REPORT, NULL);
-
- prop= RNA_def_property(srna, "show_report_error", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", CONSOLE_RPT_ERR);
- RNA_def_property_ui_text(prop, "Show Error", "Display error text");
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE_REPORT, NULL);
-
prop= RNA_def_property(srna, "prompt", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Prompt", "Command line prompt");
@@ -2201,10 +2189,37 @@ static void rna_def_space_filebrowser(BlenderRNA *brna)
static void rna_def_space_info(BlenderRNA *brna)
{
StructRNA *srna;
+ PropertyRNA *prop;
srna= RNA_def_struct(brna, "SpaceInfo", "Space");
RNA_def_struct_sdna(srna, "SpaceInfo");
RNA_def_struct_ui_text(srna, "Space Info", "Info space data");
+
+ /* reporting display */
+ prop= RNA_def_property(srna, "show_report_debug", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_DEBUG);
+ RNA_def_property_ui_text(prop, "Show Debug", "Display debug reporting info");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
+
+ prop= RNA_def_property(srna, "show_report_info", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_INFO);
+ RNA_def_property_ui_text(prop, "Show Info", "Display general information");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
+
+ prop= RNA_def_property(srna, "show_report_operator", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_OP);
+ RNA_def_property_ui_text(prop, "Show Operator", "Display the operator log");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
+
+ prop= RNA_def_property(srna, "show_report_warning", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_WARN);
+ RNA_def_property_ui_text(prop, "Show Warn", "Display warnings");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
+
+ prop= RNA_def_property(srna, "show_report_error", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_ERR);
+ RNA_def_property_ui_text(prop, "Show Error", "Display error text");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
}
static void rna_def_space_userpref(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index 4b5b450a620..c020ceb2c0f 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -676,8 +676,8 @@ static void rna_def_texture_clouds(BlenderRNA *brna)
prop= RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "noisedepth");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_range(prop, 0, 6, 0, 2);
+ RNA_def_property_range(prop, 0, 30);
+ RNA_def_property_ui_range(prop, 0, 24, 0, 2);
RNA_def_property_ui_text(prop, "Noise Depth", "Sets the depth of the cloud calculation");
RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
@@ -811,8 +811,8 @@ static void rna_def_texture_marble(BlenderRNA *brna)
prop= RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "noisedepth");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_range(prop, 0, 6, 0, 2);
+ RNA_def_property_range(prop, 0, 30);
+ RNA_def_property_ui_range(prop, 0, 24, 0, 2);
RNA_def_property_ui_text(prop, "Noise Depth", "Sets the depth of the cloud calculation");
RNA_def_property_update(prop, 0, "rna_Texture_update");
@@ -866,8 +866,8 @@ static void rna_def_texture_magic(BlenderRNA *brna)
prop= RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "noisedepth");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_range(prop, 0, 6, 0, 2);
+ RNA_def_property_range(prop, 0, 30);
+ RNA_def_property_ui_range(prop, 0, 24, 0, 2);
RNA_def_property_ui_text(prop, "Noise Depth", "Sets the depth of the cloud calculation");
RNA_def_property_update(prop, 0, "rna_Texture_update");
}
@@ -1520,7 +1520,7 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna)
prop= RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "noise_depth");
- RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_range(prop, 0, 30);
RNA_def_property_ui_text(prop, "Depth", "Level of detail in the added turbulent noise");
RNA_def_property_update(prop, 0, "rna_Texture_update");
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 97bf19f019a..879378a4053 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1698,7 +1698,7 @@ static void rna_def_userdef_themes(BlenderRNA *brna)
{14, "USER_PREFERENCES", ICON_PREFERENCES, "User Preferences", ""},
{15, "INFO", ICON_INFO, "Info", ""},
{16, "FILE_BROWSER", ICON_FILESEL, "File Browser", ""},
- {17, "CONSOLE", ICON_CONSOLE, "Console", ""},
+ {17, "CONSOLE", ICON_CONSOLE, "Python Console", ""},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "Theme", NULL);
@@ -2718,10 +2718,18 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_FILTERFILEEXTS);
RNA_def_property_ui_text(prop, "Filter File Extensions", "Display only files with extensions in the image select window");
+ prop= RNA_def_property(srna, "hide_recent_locations", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_RECENT);
+ RNA_def_property_ui_text(prop, "Hide Recent Locations", "Hide recent locations in the file selector");
+
+ prop= RNA_def_property(srna, "show_thumbnails", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_THUMBNAILS);
+ RNA_def_property_ui_text(prop, "Show Thumbnails", "Open in thumbnail view for images and movies");
+
prop= RNA_def_property(srna, "use_relative_paths", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_RELPATHS);
RNA_def_property_ui_text(prop, "Relative Paths", "Default relative path option for the file selector");
-
+
prop= RNA_def_property(srna, "use_file_compression", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_FILECOMPRESS);
RNA_def_property_ui_text(prop, "Compress File", "Enable file compression when saving .blend files");
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index f8c262dff43..539a46c8f84 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -588,7 +588,7 @@ static void rna_wmKeyMapItem_idname_set(PointerRNA *ptr, const char *value)
if(strcmp(idname, kmi->idname) != 0) {
BLI_strncpy(kmi->idname, idname, sizeof(kmi->idname));
- WM_keymap_properties_reset(kmi);
+ WM_keymap_properties_reset(kmi, NULL);
}
}
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c
index 726d64f26f4..5807143f3a3 100644
--- a/source/blender/makesrna/intern/rna_world.c
+++ b/source/blender/makesrna/intern/rna_world.c
@@ -98,6 +98,15 @@ static void rna_World_draw_update(Main *bmain, Scene *scene, PointerRNA *ptr)
WM_main_add_notifier(NC_WORLD|ND_WORLD_DRAW, wo);
}
+static void rna_World_stars_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ World *wo= ptr->id.data;
+
+ DAG_id_flush_update(&wo->id, 0);
+ WM_main_add_notifier(NC_WORLD|ND_WORLD_STARS, wo);
+}
+
+
#else
static void rna_def_world_mtex(BlenderRNA *brna)
@@ -414,31 +423,31 @@ static void rna_def_world_stars(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_stars", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_STARS);
RNA_def_property_ui_text(prop, "Use Stars", "Enable starfield generation");
- RNA_def_property_update(prop, 0, "rna_World_draw_update");
+ RNA_def_property_update(prop, 0, "rna_World_stars_update");
prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "starsize");
RNA_def_property_range(prop, 0, 10);
RNA_def_property_ui_text(prop, "Size", "Average screen dimension of stars");
- RNA_def_property_update(prop, 0, "rna_World_update");
+ RNA_def_property_update(prop, 0, "rna_World_draw_update"); /* use normal update since this isnt visualized */
prop= RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "starmindist");
RNA_def_property_range(prop, 0, 1000);
RNA_def_property_ui_text(prop, "Minimum Distance", "Minimum distance to the camera for stars");
- RNA_def_property_update(prop, 0, "rna_World_update");
+ RNA_def_property_update(prop, 0, "rna_World_stars_update");
prop= RNA_def_property(srna, "average_separation", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "stardist");
RNA_def_property_range(prop, 2, 1000);
RNA_def_property_ui_text(prop, "Average Separation", "Average distance between any two stars");
- RNA_def_property_update(prop, 0, "rna_World_draw_update");
+ RNA_def_property_update(prop, 0, "rna_World_stars_update");
prop= RNA_def_property(srna, "color_random", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "starcolnoise");
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_update");
+ RNA_def_property_update(prop, 0, "rna_World_stars_update");
/* unused
prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
diff --git a/source/blender/makesrna/rna_cleanup/rna_properties.txt b/source/blender/makesrna/rna_cleanup/rna_properties.txt
index 92adbf4373e..df833d8e82b 100644
--- a/source/blender/makesrna/rna_cleanup/rna_properties.txt
+++ b/source/blender/makesrna/rna_cleanup/rna_properties.txt
@@ -2495,6 +2495,7 @@
#+ * Node|CompositorNode.type -> type: enum, "(read-only)"
#+ * Node|CompositorNode|CompositorNodeAlphaOver.premul -> premul: float "Mix Factor"
#Node|CompositorNode|CompositorNodeAlphaOver.use_premultiply -> use_premultiply: boolean "NO DESCRIPTION"
+#Node|CompositorNode|CompositorNodeZcombine.use_alpha -> use_alpha: boolean "NO DESCRIPTION"
#+ * Node|CompositorNode|CompositorNodeBilateralblur.iterations -> iterations: int "NO DESCRIPTION"
#+ * Node|CompositorNode|CompositorNodeBilateralblur.sigma_color -> sigma_color: float "NO DESCRIPTION"
#+ * Node|CompositorNode|CompositorNodeBilateralblur.sigma_space -> sigma_space: float "NO DESCRIPTION"
diff --git a/source/blender/modifiers/Makefile b/source/blender/modifiers/Makefile
index 2115e8ac888..3efa5210def 100644
--- a/source/blender/modifiers/Makefile
+++ b/source/blender/modifiers/Makefile
@@ -30,5 +30,4 @@
SOURCEDIR = source/blender/modifiers
DIRS = intern
-CFLAGS += -DWITH_MOD_BOOLEAN -DWITH_MOD_BOOLEAN
include nan_subdirs.mk
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index 9916afcfe55..c02ccd1fbcd 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -151,6 +151,30 @@ static float vertarray_size(MVert *mvert, int numVerts, int axis)
return max_co - min_co;
}
+/* XXX This function fixes bad merging code, in some cases removing vertices creates indices > maxvert */
+
+static int test_index_face_maxvert(MFace *mface, CustomData *fdata, int mfindex, int nr, int maxvert)
+{
+ if(mface->v1 >= maxvert) {
+ // printf("bad index in array\n");
+ mface->v1= maxvert - 1;
+ }
+ if(mface->v2 >= maxvert) {
+ // printf("bad index in array\n");
+ mface->v2= maxvert - 1;
+ }
+ if(mface->v3 >= maxvert) {
+ // printf("bad index in array\n");
+ mface->v3= maxvert - 1;
+ }
+ if(mface->v4 >= maxvert) {
+ // printf("bad index in array\n");
+ mface->v4= maxvert - 1;
+ }
+
+ return test_index_face(mface, fdata, mfindex, nr);
+}
+
typedef struct IndexMapEntry {
/* the new vert index that this old vert index maps to */
int new;
@@ -436,6 +460,10 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
{
vert1 = calc_mapping(indexMap, inMED.v1, j);
vert2 = calc_mapping(indexMap, inMED.v2, j);
+
+ /* edge could collapse to single point after mapping */
+ if(vert1 == vert2) continue;
+
/* avoid duplicate edges */
if(!BLI_edgehash_haskey(edges, vert1, vert2)) {
med2 = &medge[numEdges];
@@ -481,7 +509,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
if(inMF.v4 && indexMap[inMF.v4].merge_final)
mf->v4 = calc_mapping(indexMap, indexMap[inMF.v4].merge, count-1);
- if(test_index_face(mf, &result->faceData, numFaces, inMF.v4?4:3) < 3)
+ if(test_index_face_maxvert(mf, &result->faceData, numFaces, inMF.v4?4:3, numVerts) < 3)
continue;
numFaces++;
@@ -505,7 +533,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
if (inMF.v4)
mf2->v4 = calc_mapping(indexMap, inMF.v4, j);
- test_index_face(mf2, &result->faceData, numFaces, inMF.v4?4:3);
+ test_index_face_maxvert(mf2, &result->faceData, numFaces, inMF.v4?4:3, numVerts);
numFaces++;
/* if the face has fewer than 3 vertices, don't create it */
@@ -601,8 +629,8 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
if(mface[numFaces].v4) {
mface[numFaces].v4 = vert_map[mface[numFaces].v4];
- test_index_face(&mface[numFaces], &result->faceData,
- numFaces, 4);
+ test_index_face_maxvert(&mface[numFaces], &result->faceData,
+ numFaces, 4, numVerts);
}
else
{
diff --git a/source/blender/modifiers/intern/Makefile b/source/blender/modifiers/intern/Makefile
index 94ea068a1bc..9ba41efbd47 100644
--- a/source/blender/modifiers/intern/Makefile
+++ b/source/blender/modifiers/intern/Makefile
@@ -34,6 +34,8 @@ DIR = $(OCGDIR)/blender/$(LIBNAME)
include nan_compile.mk
CFLAGS += $(LEVEL_1_C_WARNINGS)
+CFLAGS += -DWITH_MOD_BOOLEAN
+CFLAGS += -DWITH_MOD_DECIMATE
CPPFLAGS += -I..
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
index 5c25bffa5d9..a18ae13b438 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
@@ -378,7 +378,11 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
//------------------------------------------------------------------
// main loop
+#ifdef __INTEL_COMPILER /* icc doesn't like the compound statement -- internal error: 0_1506 */
+ #pragma omp parallel for private(y) if(!nqd->preview) schedule(guided)
+#else
#pragma omp parallel for private(y) if(!nqd->preview && img->y*img->x > 16384) schedule(guided)
+#endif
for (y=0; y<img->y; y++) {
unsigned int p, p4, zp, cp, cp4;
float *ctcol, u, v, ct_crad, cR2=0;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
index 85baa8c347a..0129c1bb03d 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
@@ -71,7 +71,7 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack *
}
}
- BKE_makepicstring(string, nif->name, rd->cfra, nif->imtype, (rd->scemode & R_EXTENSION));
+ BKE_makepicstring(string, nif->name, rd->cfra, nif->imtype, (rd->scemode & R_EXTENSION), TRUE);
if(0 == BKE_write_ibuf((Scene *)node->id, ibuf, string, nif->imtype, nif->subimtype, nif->imtype==R_OPENEXR?nif->codec:nif->quality))
printf("Cannot save Node File Output to %s\n", string);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c
index 80989feaf26..17d88543698 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c
@@ -31,7 +31,7 @@
/* **************** Z COMBINE ******************** */
- /* lazy coder note: node->custom1 is abused to send signal */
+ /* lazy coder note: node->custom2 is abused to send signal */
static bNodeSocketType cmp_node_zcombine_in[]= {
{ SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{ SOCK_VALUE, 1, "Z", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 10000.0f},
@@ -47,13 +47,40 @@ static bNodeSocketType cmp_node_zcombine_out[]= {
static void do_zcombine(bNode *node, float *out, float *src1, float *z1, float *src2, float *z2)
{
+ float alpha;
+ float malpha;
+
if(*z1 <= *z2) {
- QUATCOPY(out, src1);
+ if (node->custom1) {
+ // use alpha in combine operation
+ alpha= src1[3];
+ malpha= 1.0f - alpha;
+ out[0]= malpha*src2[0] + alpha*src1[0];
+ out[1]= malpha*src2[1] + alpha*src1[1];
+ out[2]= malpha*src2[2] + alpha*src1[2];
+ out[3]= malpha*src2[3] + alpha*src1[3];
+ }
+ else {
+ // do combination based solely on z value
+ QUATCOPY(out, src1);
+ }
}
else {
- QUATCOPY(out, src2);
+ if (node->custom1) {
+ // use alpha in combine operation
+ alpha= src2[3];
+ malpha= 1.0f - alpha;
+ out[0]= malpha*src1[0] + alpha*src2[0];
+ out[1]= malpha*src1[1] + alpha*src2[1];
+ out[2]= malpha*src1[2] + alpha*src2[2];
+ out[3]= malpha*src1[3] + alpha*src2[3];
+ }
+ else {
+ // do combination based solely on z value
+ QUATCOPY(out, src1);
+ }
- if(node->custom1)
+ if(node->custom2)
*z1= *z2;
}
}
@@ -62,20 +89,49 @@ static void do_zcombine_mask(bNode *node, float *out, float *z1, float *z2)
{
if(*z1 > *z2) {
*out= 1.0f;
- if(node->custom1)
+ if(node->custom2)
*z1= *z2;
}
}
-static void do_zcombine_add(bNode *UNUSED(node), float *out, float *col1, float *col2, float *acol)
+static void do_zcombine_add(bNode *node, float *out, float *col1, float *col2, float *acol)
{
- float alpha= *acol;
- float malpha= 1.0f - alpha;
-
- out[0]= malpha*col1[0] + alpha*col2[0];
- out[1]= malpha*col1[1] + alpha*col2[1];
- out[2]= malpha*col1[2] + alpha*col2[2];
- out[3]= malpha*col1[3] + alpha*col2[3];
+ float alpha;
+ float malpha;
+
+ if (node->custom1) {
+ // use alpha in combine operation, antialiased mask in used here just as hint for the z value
+ if (*acol>0.0f) {
+ alpha= col2[3];
+ malpha= 1.0f - alpha;
+
+
+ out[0]= malpha*col1[0] + alpha*col2[0];
+ out[1]= malpha*col1[1] + alpha*col2[1];
+ out[2]= malpha*col1[2] + alpha*col2[2];
+ out[3]= malpha*col1[3] + alpha*col2[3];
+ }
+ else {
+ alpha= col1[3];
+ malpha= 1.0f - alpha;
+
+
+ out[0]= malpha*col2[0] + alpha*col1[0];
+ out[1]= malpha*col2[1] + alpha*col1[1];
+ out[2]= malpha*col2[2] + alpha*col1[2];
+ out[3]= malpha*col2[3] + alpha*col1[3];
+ }
+ }
+ else {
+ // do combination based solely on z value but with antialiased mask
+ alpha = *acol;
+ malpha= 1.0f - alpha;
+
+ out[0]= malpha*col1[0] + alpha*col2[0];
+ out[1]= malpha*col1[1] + alpha*col2[1];
+ out[2]= malpha*col1[2] + alpha*col2[2];
+ out[3]= malpha*col1[3] + alpha*col2[3];
+ }
}
static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
@@ -107,11 +163,11 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in
*zval= in[1]->vec[0];
}
/* lazy coder hack */
- node->custom1= 1;
+ node->custom2= 1;
out[1]->data= zbuf;
}
else {
- node->custom1= 0;
+ node->custom2= 0;
zbuf= in[1]->data;
}
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_texture.c b/source/blender/nodes/intern/SHD_nodes/SHD_texture.c
index b2fb3b2261c..ee73fac4c7e 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_texture.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_texture.c
@@ -58,6 +58,7 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
/* we should find out if a normal as output is needed, for now we do all */
texres.nor= nor;
+ texres.tr= texres.tg= texres.tb= 0.0f;
if(in[0]->hasinput) {
nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
diff --git a/source/blender/python/generic/blf_api.c b/source/blender/python/generic/blf_api.c
index 80e140b7eac..e81b885f7bb 100644
--- a/source/blender/python/generic/blf_api.c
+++ b/source/blender/python/generic/blf_api.c
@@ -141,12 +141,13 @@ static char py_blf_draw_doc[] =
static PyObject *py_blf_draw(PyObject *UNUSED(self), PyObject *args)
{
char *text;
+ int text_length;
int fontid;
- if (!PyArg_ParseTuple(args, "is:blf.draw", &fontid, &text))
+ if (!PyArg_ParseTuple(args, "is#:blf.draw", &fontid, &text, &text_length))
return NULL;
- BLF_draw(fontid, text);
+ BLF_draw(fontid, text, (unsigned int)text_length);
Py_RETURN_NONE;
}
diff --git a/source/blender/python/generic/mathutils_matrix.c b/source/blender/python/generic/mathutils_matrix.c
index c74ec3536e5..34a31768b69 100644
--- a/source/blender/python/generic/mathutils_matrix.c
+++ b/source/blender/python/generic/mathutils_matrix.c
@@ -31,9 +31,6 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
-static PyObject *column_vector_multiplication(MatrixObject * mat, VectorObject* vec); /* utility func */
-
-
/* matrix vector callbacks */
int mathutils_matrix_vector_cb_index= -1;
@@ -1196,28 +1193,35 @@ PyObject *Matrix_copy(MatrixObject *self)
static PyObject *Matrix_repr(MatrixObject * self)
{
int x, y;
- char str[1024]="Matrix((", *str_p;
+ PyObject *rows[MATRIX_MAX_DIM]= {0};
if(!BaseMath_ReadCallback(self))
return NULL;
- str_p= &str[8];
-
- for(x = 0; x < self->colSize; x++){
- for(y = 0; y < (self->rowSize - 1); y++) {
- str_p += sprintf(str_p, "%f, ", self->matrix[y][x]);
- }
- if(x < (self->colSize-1)){
- str_p += sprintf(str_p, "%f), (", self->matrix[y][x]);
- }
- else{
- str_p += sprintf(str_p, "%f)", self->matrix[y][x]);
+ for(x = 0; x < self->rowSize; x++){
+ rows[x]= PyTuple_New(self->rowSize);
+ for(y = 0; y < self->colSize; y++) {
+ PyTuple_SET_ITEM(rows[x], y, PyFloat_FromDouble(self->matrix[x][y]));
}
}
- strcat(str_p, ")");
+ switch(self->rowSize) {
+ case 2: return PyUnicode_FromFormat("Matrix(%R,\n"
+ " %R)", rows[0], rows[1]);
+
+ case 3: return PyUnicode_FromFormat("Matrix(%R,\n"
+ " %R,\n"
+ " %R)", rows[0], rows[1], rows[2]);
+
+ case 4: return PyUnicode_FromFormat("Matrix(%R,\n"
+ " %R,\n"
+ " %R,\n"
+ " %R)", rows[0], rows[1], rows[2], rows[3]);
+ }
- return PyUnicode_FromString(str);
+ PyErr_SetString(PyExc_RuntimeError, "invalid matrix size");
+ return NULL;
}
+
/*------------------------tp_richcmpr*/
/*returns -1 execption, 0 false, 1 true*/
static PyObject* Matrix_richcmpr(PyObject *objectA, PyObject *objectB, int comparison_type)
@@ -1568,7 +1572,8 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
}
else /* if(mat1) { */ {
if(VectorObject_Check(m2)) { /* MATRIX*VECTOR */
- return column_vector_multiplication(mat1, (VectorObject *)m2); /* vector update done inside the function */
+ PyErr_SetString(PyExc_TypeError, "Matrix multiplication: Only 'vec * matrix' is supported, not the reverse.");
+ return NULL;
}
else {
scalar= PyFloat_AsDouble(m2);
@@ -1945,42 +1950,3 @@ PyObject *newMatrixObject_cb(PyObject *cb_user, int rowSize, int colSize, int cb
}
return (PyObject *) self;
}
-
-//----------------column_vector_multiplication (internal)---------
-//COLUMN VECTOR Multiplication (Matrix X Vector)
-// [1][4][7] [a]
-// [2][5][8] * [b]
-// [3][6][9] [c]
-//vector/matrix multiplication IS NOT COMMUTATIVE!!!!
-static PyObject *column_vector_multiplication(MatrixObject * mat, VectorObject* vec)
-{
- float vecNew[4], vecCopy[4];
- double dot = 0.0f;
- int x, y, z = 0;
-
- if(!BaseMath_ReadCallback(mat) || !BaseMath_ReadCallback(vec))
- return NULL;
-
- if(mat->rowSize != vec->size){
- if(mat->rowSize == 4 && vec->size != 3){
- PyErr_SetString(PyExc_AttributeError, "matrix * vector: matrix row size and vector size must be the same");
- return NULL;
- }else{
- vecCopy[3] = 1.0f;
- }
- }
-
- for(x = 0; x < vec->size; x++){
- vecCopy[x] = vec->vec[x];
- }
- vecNew[3] = 1.0f;
-
- for(x = 0; x < mat->colSize; x++) {
- for(y = 0; y < mat->rowSize; y++) {
- dot += mat->matrix[y][x] * vecCopy[y];
- }
- vecNew[z++] = (float)dot;
- dot = 0.0f;
- }
- return newVectorObject(vecNew, vec->size, Py_NEW, NULL);
-}
diff --git a/source/blender/python/generic/mathutils_quat.c b/source/blender/python/generic/mathutils_quat.c
index cb6e6fd3ddd..8a42adce9a9 100644
--- a/source/blender/python/generic/mathutils_quat.c
+++ b/source/blender/python/generic/mathutils_quat.c
@@ -647,7 +647,6 @@ static PyObject *Quaternion_mul(PyObject * q1, PyObject * q2)
{
float quat[QUAT_SIZE], scalar;
QuaternionObject *quat1 = NULL, *quat2 = NULL;
- VectorObject *vec = NULL;
if(QuaternionObject_Check(q1)) {
quat1 = (QuaternionObject*)q1;
@@ -678,19 +677,8 @@ static PyObject *Quaternion_mul(PyObject * q1, PyObject * q2)
}
else { /* QUAT*SOMETHING */
if(VectorObject_Check(q2)){ /* QUAT*VEC */
- float tvec[3];
- vec = (VectorObject*)q2;
- if(vec->size != 3){
- PyErr_SetString(PyExc_TypeError, "Quaternion multiplication: only 3D vector rotations currently supported\n");
- return NULL;
- }
- if(!BaseMath_ReadCallback(vec)) {
- return NULL;
- }
-
- copy_v3_v3(tvec, vec->vec);
- mul_qt_v3(quat1->quat, tvec);
- return newVectorObject(tvec, 3, Py_NEW, NULL);
+ PyErr_SetString(PyExc_TypeError, "Quaternion multiplication: Only 'vector * quaternion' is supported, not the reverse");
+ return NULL;
}
scalar= PyFloat_AsDouble(q2);
diff --git a/source/blender/python/generic/mathutils_vector.c b/source/blender/python/generic/mathutils_vector.c
index 57d7ee659d5..e4027d7a80e 100644
--- a/source/blender/python/generic/mathutils_vector.c
+++ b/source/blender/python/generic/mathutils_vector.c
@@ -39,7 +39,6 @@
#define SWIZZLE_VALID_AXIS 0x4
#define SWIZZLE_AXIS 0x3
-static int row_vector_multiplication(float rvec[4], VectorObject* vec, MatrixObject * mat); /* utility func */
static PyObject *Vector_ToTupleExt(VectorObject *self, int ndigits);
//----------------------------------mathutils.Vector() ------------------
@@ -1007,6 +1006,47 @@ static PyObject *Vector_isub(PyObject * v1, PyObject * v2)
/*------------------------obj * obj------------------------------
mulplication*/
+
+
+/* COLUMN VECTOR Multiplication (Vector X Matrix)
+ * [a] * [1][4][7]
+ * [b] * [2][5][8]
+ * [c] * [3][6][9]
+ *
+ * note: vector/matrix multiplication IS NOT COMMUTATIVE!!!!
+ * note: assume read callbacks have been done first.
+ */
+static int column_vector_multiplication(float *rvec, VectorObject* vec, MatrixObject * mat)
+{
+ float vecCopy[4];
+ double dot = 0.0f;
+ int x, y, z = 0;
+
+ if(mat->rowSize != vec->size){
+ if(mat->rowSize == 4 && vec->size != 3){
+ PyErr_SetString(PyExc_AttributeError, "matrix * vector: matrix row size and vector size must be the same");
+ return -1;
+ }else{
+ vecCopy[3] = 1.0f;
+ }
+ }
+
+ for(x = 0; x < vec->size; x++){
+ vecCopy[x] = vec->vec[x];
+ }
+ rvec[3] = 1.0f;
+
+ for(x = 0; x < mat->colSize; x++) {
+ for(y = 0; y < mat->rowSize; y++) {
+ dot += mat->matrix[y][x] * vecCopy[y];
+ }
+ rvec[z++] = (float)dot;
+ dot = 0.0f;
+ }
+
+ return 0;
+}
+
static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
{
VectorObject *vec1 = NULL, *vec2 = NULL;
@@ -1050,17 +1090,21 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
vec1= vec2;
v2= v1;
}
-
+
if (MatrixObject_Check(v2)) {
/* VEC * MATRIX */
- float tvec[4];
- if(row_vector_multiplication(tvec, vec1, (MatrixObject*)v2) == -1)
+ float tvec[MAX_DIMENSIONS];
+ if(!BaseMath_ReadCallback((MatrixObject *)v2))
return NULL;
+ if(column_vector_multiplication(tvec, vec1, (MatrixObject*)v2) == -1) {
+ return NULL;
+ }
+
return newVectorObject(tvec, vec1->size, Py_NEW, NULL);
} else if (QuaternionObject_Check(v2)) {
/* VEC * QUAT */
QuaternionObject *quat2 = (QuaternionObject*)v2;
- float tvec[4];
+ float tvec[3];
if(vec1->size != 3) {
PyErr_SetString(PyExc_TypeError, "Vector multiplication: only 3D vector rotations (with quats) currently supported\n");
@@ -1075,7 +1119,7 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
}
else if (((scalar= PyFloat_AsDouble(v2)) == -1.0 && PyErr_Occurred())==0) { /* VEC*FLOAT */
int i;
- float vec[4];
+ float vec[MAX_DIMENSIONS];
for(i = 0; i < vec1->size; i++) {
vec[i] = vec1->vec[i] * scalar;
@@ -1093,7 +1137,6 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
static PyObject *Vector_imul(PyObject * v1, PyObject * v2)
{
VectorObject *vec = (VectorObject *)v1;
- int i;
float scalar;
if(!BaseMath_ReadCallback(vec))
@@ -1102,20 +1145,31 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2)
/* only support vec*=float and vec*=mat
vec*=vec result is a float so that wont work */
if (MatrixObject_Check(v2)) {
- float tvec[4];
- if(row_vector_multiplication(tvec, vec, (MatrixObject*)v2) == -1)
+ float rvec[MAX_DIMENSIONS];
+ if(!BaseMath_ReadCallback((MatrixObject *)v2))
+ return NULL;
+
+ if(column_vector_multiplication(rvec, vec, (MatrixObject*)v2) == -1)
return NULL;
- i= vec->size - 1;
- do {
- vec->vec[i] = tvec[i];
- } while(i--);
+ memcpy(vec->vec, rvec, sizeof(float) * vec->size);
+ }
+ else if (QuaternionObject_Check(v2)) {
+ /* VEC *= QUAT */
+ QuaternionObject *quat2 = (QuaternionObject*)v2;
+
+ if(vec->size != 3) {
+ PyErr_SetString(PyExc_TypeError, "Vector multiplication: only 3D vector rotations (with quats) currently supported\n");
+ return NULL;
+ }
+
+ if(!BaseMath_ReadCallback(quat2)) {
+ return NULL;
+ }
+ mul_qt_v3(quat2->quat, vec->vec);
}
else if (((scalar= PyFloat_AsDouble(v2)) == -1.0 && PyErr_Occurred())==0) { /* VEC*=FLOAT */
- i= vec->size - 1;
- do {
- vec->vec[i] *= scalar;
- } while(i--);
+ mul_vn_fl(vec->vec, vec->size, scalar);
}
else {
PyErr_SetString(PyExc_TypeError, "Vector multiplication: arguments not acceptable for this operation\n");
@@ -2010,7 +2064,7 @@ if len(unique) != len(items):
print "ERROR"
*/
-//-----------------row_vector_multiplication (internal)-----------
+#if 0
//ROW VECTOR Multiplication - Vector X Matrix
//[x][y][z] * [1][4][7]
// [2][5][8]
@@ -2048,6 +2102,7 @@ static int row_vector_multiplication(float rvec[4], VectorObject* vec, MatrixObj
}
return 0;
}
+#endif
/*----------------------------Vector.negate() -------------------- */
static char Vector_Negate_doc[] =
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index b1c4a9951cd..c38dcd3d5df 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -83,7 +83,7 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
PyObject *list = PyList_New(0), *st; /* stupidly big string to be safe */
/* be sure there is low chance of the path being too short */
char filepath_expanded[1024];
- char *lib;
+ const char *lib;
int absolute = 0;
static char *kwlist[] = {"absolute", NULL};
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index f3e960f87b2..e78e79fd6a8 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -73,8 +73,13 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
}
}
- if(!PyDict_Check(context_dict))
+ if(context_dict==NULL || context_dict==Py_None) {
context_dict= NULL;
+ }
+ else if (!PyDict_Check(context_dict)) {
+ PyErr_Format(PyExc_TypeError, "Calling operator \"bpy.ops.%s.poll\" error, custom context expected a dict or None, got a %.200s", opname, Py_TYPE(context_dict)->tp_name);
+ return NULL;
+ }
context_dict_back= CTX_py_dict_get(C);
@@ -130,8 +135,13 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
}
}
- if(!PyDict_Check(context_dict))
+ if(context_dict==NULL || context_dict==Py_None) {
context_dict= NULL;
+ }
+ else if (!PyDict_Check(context_dict)) {
+ PyErr_Format(PyExc_TypeError, "Calling operator \"bpy.ops.%s\" error, custom context expected a dict or None, got a %.200s", opname, Py_TYPE(context_dict)->tp_name);
+ return NULL;
+ }
context_dict_back= CTX_py_dict_get(C);
diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c
index 362f17ee945..40dc0df6b9b 100644
--- a/source/blender/quicktime/apple/quicktime_export.c
+++ b/source/blender/quicktime/apple/quicktime_export.c
@@ -61,6 +61,9 @@
#include <Movies.h>
#include <QuickTimeComponents.h>
#include <TextUtils.h>
+#include <string.h>
+#include <memory.h>
+
#endif /* _WIN32 */
#ifdef __APPLE__
diff --git a/source/blender/quicktime/apple/quicktime_import.c b/source/blender/quicktime/apple/quicktime_import.c
index 917a75772ce..08196553a79 100644
--- a/source/blender/quicktime/apple/quicktime_import.c
+++ b/source/blender/quicktime/apple/quicktime_import.c
@@ -611,7 +611,7 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags)
ImageDescriptionHandle desc;
ComponentInstance dataHandler;
- PointerDataRef dataref = (PointerDataRef)NewHandle(sizeof(PointerDataRefRecord));
+ PointerDataRef dataref;
int x, y, depth;
int have_gw = FALSE;
@@ -634,11 +634,12 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags)
unsigned char *from, *to;
#endif
- if (mem == NULL)
+ if (mem == NULL || !G.have_quicktime)
goto bail;
if(QTIME_DEBUG) printf("qt: attempt to load mem as image\n");
+ dataref= (PointerDataRef)NewHandle(sizeof(PointerDataRefRecord));
(**dataref).data = mem;
(**dataref).dataLength = size;
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h
index 42bf95827e7..265788830bc 100644
--- a/source/blender/render/extern/include/RE_pipeline.h
+++ b/source/blender/render/extern/include/RE_pipeline.h
@@ -212,7 +212,7 @@ void RE_init_threadcount(Render *re);
void RE_TileProcessor(struct Render *re);
/* only RE_NewRender() needed, main Blender render calls */
-void RE_BlenderFrame(struct Render *re, struct Main *bmain, struct Scene *scene, struct SceneRenderLayer *srl, unsigned int lay, int frame);
+void RE_BlenderFrame(struct Render *re, struct Main *bmain, struct Scene *scene, struct SceneRenderLayer *srl, unsigned int lay, int frame, const short write_still);
void RE_BlenderAnim(struct Render *re, struct Main *bmain, struct Scene *scene, unsigned int lay, int sfra, int efra, int tfra, struct ReportList *reports);
void RE_RenderFreestyleStrokes(struct Render *re, struct Main *bmain, struct Scene *scene);
@@ -220,7 +220,7 @@ void RE_RenderFreestyleStrokes(struct Render *re, struct Main *bmain, struct Sce
void RE_PreviewRender(struct Render *re, struct Main *bmain, struct Scene *scene);
void RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode);
-void RE_WriteRenderResult(RenderResult *rr, char *filename, int compress);
+void RE_WriteRenderResult(RenderResult *rr, const char *filename, int compress);
struct RenderResult *RE_MultilayerConvert(void *exrhandle, int rectx, int recty);
/* do a full sample buffer compo */
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 89176944652..a908133a7ce 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -199,9 +199,10 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
* x = -z | +z,
* y = -z | +z
*/
-
- if(scene->camera==NULL)
+
+ if(scene->camera==NULL || scene->camera->type != OB_CAMERA)
return;
+
camera = scene->camera->data;
clipend = camera->clipend;
@@ -3307,7 +3308,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
/* test for 100% transparant */
ok= 1;
- if(ma->alpha==0.0 && ma->spectra==0.0) {
+ if(ma->alpha==0.0f && ma->spectra==0.0f && ma->filter==0.0f) {
ok= 0;
/* texture on transparency? */
for(a=0; a<MAX_MTEX; a++) {
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 4995e98fc07..0bd8858d9d4 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -124,6 +124,7 @@ Render R;
/* ********* alloc and free ******** */
+static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, ReportList *reports, const char *name_override);
static volatile int g_break= 0;
static int thread_break(void *UNUSED(arg))
@@ -812,7 +813,7 @@ static char *make_pass_name(RenderPass *rpass, int chan)
/* filename already made absolute */
/* called from within UI, saves both rendered result as a file-read result */
-void RE_WriteRenderResult(RenderResult *rr, char *filename, int compress)
+void RE_WriteRenderResult(RenderResult *rr, const char *filename, int compress)
{
RenderLayer *rl;
RenderPass *rpass;
@@ -1252,6 +1253,9 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
return;
}
+ if((re->r.mode & (R_OSA))==0)
+ re->r.scemode &= ~R_FULL_SAMPLE;
+
#ifdef WITH_OPENEXR
if(re->r.scemode & R_FULL_SAMPLE)
re->r.scemode |= R_EXR_TILE_FILE; /* enable automatic */
@@ -1533,9 +1537,9 @@ static RenderPart *find_next_pano_slice(Render *re, int *minx, rctf *viewplane)
if(best) {
float phi= panorama_pixel_rot(re);
-
+ /* R.disprect.xmax - R.disprect.xmin rather then R.winx for border render */
R.panodxp= (re->winx - (best->disprect.xmin + best->disprect.xmax) )/2;
- R.panodxv= ((viewplane->xmax-viewplane->xmin)*R.panodxp)/(float)R.winx;
+ R.panodxv= ((viewplane->xmax-viewplane->xmin)*R.panodxp)/(float)(R.disprect.xmax - R.disprect.xmin);
/* shift viewplane */
R.viewplane.xmin = viewplane->xmin + R.panodxv;
@@ -2736,10 +2740,6 @@ int RE_is_rendering_allowed(Scene *scene, void *erh, void (*error)(void *handle,
/* forbidden combinations */
if(scene->r.mode & R_PANORAMA) {
- if(scene->r.mode & R_BORDER) {
- error(erh, "No border supported for Panorama");
- return 0;
- }
if(scene->r.mode & R_ORTHO) {
error(erh, "No Ortho render possible for Panorama");
return 0;
@@ -2921,7 +2921,7 @@ static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, Sc
}
/* general Blender frame render call */
-void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *srl, unsigned int lay, int frame)
+void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *srl, unsigned int lay, int frame, const short write_still)
{
/* ugly global still... is to prevent preview events and signal subsurfs etc to make full resol */
G.rendering= 1;
@@ -2933,6 +2933,20 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr
do_render_all_options(re);
}
+ if(write_still) {
+ if(BKE_imtype_is_movie(scene->r.imtype)) {
+ /* operator checks this but incase its called from elsewhere */
+ printf("Error: cant write single images with a movie format!\n");
+ }
+ else {
+ char name[FILE_MAX];
+ BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, FALSE);
+
+ /* reports only used for Movie */
+ do_write_image_or_movie(re, scene, NULL, NULL, name);
+ }
+ }
+
/* UGLY WARNING */
G.rendering= 0;
}
@@ -2947,7 +2961,7 @@ void RE_RenderFreestyleStrokes(Render *re, Main *bmain, Scene *scene)
re->result_ok= 1;
}
-static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, ReportList *reports)
+static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, ReportList *reports, const char *name_override)
{
char name[FILE_MAX];
RenderResult rres;
@@ -2971,7 +2985,10 @@ static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, R
printf("Append frame %d", scene->r.cfra);
}
else {
- BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION);
+ if(name_override)
+ BLI_strncpy(name, name_override, sizeof(name));
+ else
+ BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE);
if(re->r.imtype==R_MULTILAYER) {
if(re->result) {
@@ -3061,7 +3078,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, unsigned int lay, int
do_render_all_options(re);
if(re->test_break(re->tbh) == 0) {
- if(!do_write_image_or_movie(re, scene, mh, reports))
+ if(!do_write_image_or_movie(re, scene, mh, reports, NULL))
G.afbreek= 1;
}
} else {
@@ -3098,7 +3115,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, unsigned int lay, int
/* Touch/NoOverwrite options are only valid for image's */
if(BKE_imtype_is_movie(scene->r.imtype) == 0) {
if(scene->r.mode & (R_NO_OVERWRITE | R_TOUCH))
- BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION);
+ BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE);
if(scene->r.mode & R_NO_OVERWRITE && BLI_exist(name)) {
printf("skipping existing frame \"%s\"\n", name);
@@ -3116,7 +3133,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, unsigned int lay, int
if(re->test_break(re->tbh) == 0) {
if(!G.afbreek)
- if(!do_write_image_or_movie(re, scene, mh, reports))
+ if(!do_write_image_or_movie(re, scene, mh, reports, NULL))
G.afbreek= 1;
}
else
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index bd4af52cd91..3ddfabfa110 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -96,8 +96,15 @@ void calc_view_vector(float *view, float x, float y)
}
else {
- if(R.r.mode & R_PANORAMA)
- x-= R.panodxp;
+ if(R.r.mode & R_PANORAMA) {
+ if(R.r.mode & R_BORDER) {
+ /* scale by the win/border size */
+ x-= R.panodxp * ((float)R.winx / (float)(R.disprect.xmax - R.disprect.xmin));
+ }
+ else {
+ x-= R.panodxp;
+ }
+ }
/* move x and y to real viewplane coords */
x= (x/(float)R.winx);
diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c
index cdac27f352a..843f05f3766 100644
--- a/source/blender/render/intern/source/texture.c
+++ b/source/blender/render/intern/source/texture.c
@@ -1348,9 +1348,16 @@ int multitex_mtex(ShadeInput *shi, MTex *mtex, float *texvec, float *dxt, float
/* Warning, if the texres's values are not declared zero, check the return value to be sure
* the color values are set before using the r/g/b values, otherwise you may use uninitialized values - Campbell */
+/* extern-tex doesn't support nodes (ntreeBeginExec() can't be called when rendering is going on) */
int multitex_ext(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres)
{
- return multitex_nodes(tex, texvec, dxt, dyt, osatex, texres, 0, 0, NULL, NULL);
+ int use_nodes= tex->use_nodes, retval;
+
+ tex->use_nodes= 0;
+ retval= multitex_nodes(tex, texvec, dxt, dyt, osatex, texres, 0, 0, NULL, NULL);
+ tex->use_nodes= use_nodes;
+
+ return retval;
}
/* ------------------------------------------------------------------------- */
@@ -1667,7 +1674,7 @@ void do_material_tex(ShadeInput *shi)
float texvec[3], dxt[3], dyt[3], tempvec[3], norvec[3], warpvec[3]={0.0f, 0.0f, 0.0f}, Tnor=1.0;
int tex_nr, rgbnor= 0, warpdone=0;
float nu[3] = {0,0,0}, nv[3] = {0,0,0}, nn[3] = {0,0,0}, dudnu = 1.f, dudnv = 0.f, dvdnu = 0.f, dvdnv = 1.f; // bump mapping
- int nunvdone= 0;
+ int nunvdone= 0, newbump;
if (R.r.scemode & R_NO_TEX) return;
/* here: test flag if there's a tex (todo) */
@@ -1683,6 +1690,9 @@ void do_material_tex(ShadeInput *shi)
tex= mtex->tex;
if(tex==0) continue;
+ /* XXX texture node trees don't work for this yet */
+ newbump= (mtex->texflag & MTEX_NEW_BUMP) && !(tex->nodetree && tex->use_nodes);
+
/* which coords */
if(mtex->texco==TEXCO_ORCO) {
if(mtex->texflag & MTEX_DUPLI_MAPTO) {
@@ -1844,7 +1854,8 @@ void do_material_tex(ShadeInput *shi)
co= tempvec;
}
- if(mtex->texflag & MTEX_NEW_BUMP) {
+ /* XXX texture node trees don't work for this yet */
+ if(newbump) {
// compute ortho basis around normal
if(!nunvdone) {
// render normal is negated
@@ -2169,7 +2180,8 @@ void do_material_tex(ShadeInput *shi)
}
}
else {
- if (mtex->texflag & MTEX_NEW_BUMP) {
+ /* XXX texture node trees don't work for this yet */
+ if (newbump) {
shi->vn[0] = texres.nor[0];
shi->vn[1] = texres.nor[1];
shi->vn[2] = texres.nor[2];
diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c
index 0a2ea54c5b0..914092f6c41 100644
--- a/source/blender/render/intern/source/voxeldata.c
+++ b/source/blender/render/intern/source/voxeldata.c
@@ -238,13 +238,22 @@ static void init_frame_smoke(VoxelData *vd)
}
else {
+ int totRes;
+ float *density;
+
if (smd->domain->flags & MOD_SMOKE_HIGHRES) {
smoke_turbulence_get_res(smd->domain->wt, vd->resol);
- vd->dataset = smoke_turbulence_get_density(smd->domain->wt);
+ density = smoke_turbulence_get_density(smd->domain->wt);
} else {
VECCOPY(vd->resol, smd->domain->res);
- vd->dataset = smoke_get_density(smd->domain->fluid);
+ density = smoke_get_density(smd->domain->fluid);
}
+
+ totRes = (vd->resol[0])*(vd->resol[1])*(vd->resol[2]);
+
+ /* always store copy, as smoke internal data can change */
+ vd->dataset = MEM_mapallocN(sizeof(float)*(totRes), "smoke data");
+ memcpy(vd->dataset, density, sizeof(float)*totRes);
} // end of fluid condition
}
}
@@ -267,8 +276,7 @@ static void cache_voxeldata(struct Render *re,Tex *tex)
/* clear out old cache, ready for new */
if (vd->dataset) {
- if(vd->file_format != TEX_VD_SMOKE)
- MEM_freeN(vd->dataset);
+ MEM_freeN(vd->dataset);
vd->dataset = NULL;
}
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 7d4690ac7e1..5d856036180 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -130,7 +130,7 @@ wmKeyMap *WM_keymap_guess_opname(const struct bContext *C, char *opname);
int WM_keymap_user_init(struct wmWindowManager *wm, struct wmKeyMap *keymap);
wmKeyMap *WM_keymap_copy_to_user(struct wmKeyMap *keymap);
void WM_keymap_restore_to_default(struct wmKeyMap *keymap);
-void WM_keymap_properties_reset(struct wmKeyMapItem *kmi);
+void WM_keymap_properties_reset(struct wmKeyMapItem *kmi, struct IDProperty *properties);
void WM_keymap_restore_item_to_default(struct bContext *C, struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
wmKeyMapItem *WM_keymap_item_find_id(struct wmKeyMap *keymap, int id);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 7af6de6c86c..cae875a9b06 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -219,6 +219,7 @@ typedef struct wmNotifier {
/* NC_WORLD World */
#define ND_WORLD_DRAW (45<<16)
+#define ND_WORLD_STARS (46<<16)
/* NC_TEXT Text */
#define ND_CURSOR (50<<16)
@@ -241,23 +242,23 @@ typedef struct wmNotifier {
/* NC_SPACE */
#define ND_SPACE_CONSOLE (1<<16) /* general redraw */
-#define ND_SPACE_CONSOLE_REPORT (2<<16) /* update for reports, could specify type */
-#define ND_SPACE_INFO (2<<16)
-#define ND_SPACE_IMAGE (3<<16)
-#define ND_SPACE_FILE_PARAMS (4<<16)
-#define ND_SPACE_FILE_LIST (5<<16)
-#define ND_SPACE_NODE (6<<16)
-#define ND_SPACE_OUTLINER (7<<16)
-#define ND_SPACE_VIEW3D (8<<16)
-#define ND_SPACE_PROPERTIES (9<<16)
-#define ND_SPACE_TEXT (10<<16)
-#define ND_SPACE_TIME (11<<16)
-#define ND_SPACE_GRAPH (12<<16)
-#define ND_SPACE_DOPESHEET (13<<16)
-#define ND_SPACE_NLA (14<<16)
-#define ND_SPACE_SEQUENCER (15<<16)
-#define ND_SPACE_NODE_VIEW (16<<16)
-#define ND_SPACE_CHANGED (17<<16) /*sent to a new editor type after it's replaced an old one*/
+#define ND_SPACE_INFO_REPORT (2<<16) /* update for reports, could specify type */
+#define ND_SPACE_INFO (3<<16)
+#define ND_SPACE_IMAGE (4<<16)
+#define ND_SPACE_FILE_PARAMS (5<<16)
+#define ND_SPACE_FILE_LIST (6<<16)
+#define ND_SPACE_NODE (7<<16)
+#define ND_SPACE_OUTLINER (8<<16)
+#define ND_SPACE_VIEW3D (9<<16)
+#define ND_SPACE_PROPERTIES (10<<16)
+#define ND_SPACE_TEXT (11<<16)
+#define ND_SPACE_TIME (12<<16)
+#define ND_SPACE_GRAPH (13<<16)
+#define ND_SPACE_DOPESHEET (14<<16)
+#define ND_SPACE_NLA (15<<16)
+#define ND_SPACE_SEQUENCER (16<<16)
+#define ND_SPACE_NODE_VIEW (17<<16)
+#define ND_SPACE_CHANGED (18<<16) /*sent to a new editor type after it's replaced an old one*/
/* subtype, 256 entries too */
#define NOTE_SUBTYPE 0x0000FF00
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index 76b5762fa4e..fa4ff7a7b9b 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -127,7 +127,7 @@ void wm_operator_register(bContext *C, wmOperator *op)
}
/* so the console is redrawn */
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CONSOLE_REPORT, NULL);
+ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
WM_event_add_notifier(C, NC_WM|ND_HISTORY, NULL);
}
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 9123cdeef20..5e5d236a0f9 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -257,7 +257,6 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
CTX_wm_region_set(C, NULL);
ar->swap= WIN_BOTH_OK;
- printf("draws swap exchange %d\n", ar->swinid);
}
else if(ar->swap == WIN_BACK_OK)
ar->swap= WIN_FRONT_OK;
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 910a528d419..c30152c05eb 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1285,6 +1285,7 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
retval= handler->op->type->exec(C, handler->op);
+ /* XXX check this carefully, CTX_wm_manager(C) == wm is a bit hackish */
if(handler->op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
wm->op_undo_depth--;
@@ -1292,7 +1293,8 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
if(G.f & G_DEBUG)
wm_operator_print(handler->op);
- if(wm->op_undo_depth == 0)
+ /* XXX check this carefully, CTX_wm_manager(C) == wm is a bit hackish */
+ if(CTX_wm_manager(C) == wm && wm->op_undo_depth == 0)
if(handler->op->type->flag & OPTYPE_UNDO)
ED_undo_push_op(C, handler->op);
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index ca37f0db61b..e6d750ce8c1 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -340,7 +340,7 @@ int WM_read_homefile(bContext *C, wmOperator *op)
ListBase wmbase;
char tstr[FILE_MAXDIR+FILE_MAXFILE];
int from_memory= op && strcmp(op->type->idname, "WM_OT_read_factory_settings")==0;
- int success;
+ int success= 0;
free_ttfont(); /* still weird... what does it here? */
@@ -366,7 +366,13 @@ int WM_read_homefile(bContext *C, wmOperator *op)
if (!from_memory && BLI_exists(tstr)) {
success = BKE_read_file(C, tstr, NULL);
- } else {
+
+ if(U.themes.first==NULL) {
+ printf("\nError: No valid startup.blend, fall back to built-in default.\n\n");
+ success = 0;
+ }
+ }
+ if(success==0) {
success = BKE_read_file_from_memory(C, datatoc_startup_blend, datatoc_startup_blend_size, NULL);
if (wmbase.first == NULL) wm_clear_default_size(C);
}
@@ -673,7 +679,7 @@ int WM_write_homefile(bContext *C, wmOperator *op)
int fileflags;
/* check current window and close it if temp */
- if(win->screen->full == SCREENTEMP)
+ if(win->screen->temp)
wm_window_close(C, wm, win);
BLI_make_file_string("/", tstr, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE);
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index d98459a113c..855317b9f76 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -129,7 +129,7 @@ void WM_init(bContext *C, int argc, char **argv)
ED_file_init(); /* for fsmenu */
ED_init_node_butfuncs();
- BLF_init(11, U.dpi);
+ BLF_init(11, U.dpi); /* Please update source/gamengine/GamePlayer/GPG_ghost.cpp if you change this */
BLF_lang_init();
/* get the default database, plus a wm */
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 436494be975..628c2aa1922 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -63,13 +63,14 @@ static void keymap_properties_set(wmKeyMapItem *kmi)
WM_operator_properties_sanitize(kmi->ptr, 1);
}
-void WM_keymap_properties_reset(wmKeyMapItem *kmi)
+/* properties can be NULL, otherwise the arg passed is used and ownership is given to the kmi */
+void WM_keymap_properties_reset(wmKeyMapItem *kmi, struct IDProperty *properties)
{
WM_operator_properties_free(kmi->ptr);
MEM_freeN(kmi->ptr);
kmi->ptr = NULL;
- kmi->properties = NULL;
+ kmi->properties = properties;
keymap_properties_set(kmi);
}
@@ -706,7 +707,7 @@ void WM_keymap_restore_item_to_default(bContext *C, wmKeyMap *keymap, wmKeyMapIt
if(strcmp(orig->idname, kmi->idname) != 0) {
BLI_strncpy(kmi->idname, orig->idname, sizeof(kmi->idname));
- WM_keymap_properties_reset(kmi);
+ WM_keymap_properties_reset(kmi, NULL);
}
if (orig->properties) {
@@ -887,6 +888,10 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, char *opname)
else if (strstr(opname, "CONSOLE_OT")) {
km = WM_keymap_find_all(C, "Console", sl->spacetype, 0);
}
+ /* Console */
+ else if (strstr(opname, "INFO_OT")) {
+ km = WM_keymap_find_all(C, "Info", sl->spacetype, 0);
+ }
/* Transform */
else if (strstr(opname, "TRANSFORM_OT")) {
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 7fa58db54bb..4a0aaecfbf9 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -32,8 +32,11 @@
#include <stdio.h>
#include <stddef.h>
#include <assert.h>
+
#ifdef WIN32
-#include <windows.h>
+#include "BLI_winstuff.h"
+#include <windows.h>
+
#include <io.h>
#endif
@@ -617,6 +620,7 @@ void WM_operator_properties_free(PointerRNA *ptr)
if(properties) {
IDP_FreeProperty(properties);
MEM_freeN(properties);
+ ptr->data= NULL; /* just incase */
}
}
@@ -1459,7 +1463,15 @@ static void open_set_use_scripts(wmOperator *op)
static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- RNA_string_set(op->ptr, "filepath", G.main->name);
+ const char *openname= G.main->name;
+
+ /* if possible, get the name of the most recently used .blend file */
+ if (G.recent_files.first) {
+ struct RecentFile *recent = G.recent_files.first;
+ openname = recent->filepath;
+ }
+
+ RNA_string_set(op->ptr, "filepath", openname);
open_set_load_ui(op);
open_set_use_scripts(op);
@@ -2027,33 +2039,16 @@ static void WM_OT_quit_blender(wmOperatorType *ot)
}
/* *********************** */
-#ifdef WIN32
+#if defined(WIN32)
static int console= 1;
void WM_toggle_console(bContext *C, short show)
{
if(show) {
- FILE *fp;
- char fn[FILE_MAX];
- char tmp[FILE_MAXDIR];
- BLI_where_is_temp(tmp, 1);
- BLI_make_file_string("/", fn, tmp, "blenderlog.txt");
- /* open the console */
- AllocConsole();
-
- /* redirect stdin */
- fp= freopen(fn, "r", stdin);
- SetStdHandle(STD_INPUT_HANDLE, (HANDLE)_get_osfhandle(_fileno(stdin)));
- /* redirect stdout */
- fp= freopen(fn, "w", stdout);
- SetStdHandle(STD_OUTPUT_HANDLE, (HANDLE)_get_osfhandle(_fileno(stdout)));
- /* redirect stderr */
- fp= freopen(fn, "w", stderr);
- SetStdHandle(STD_ERROR_HANDLE, (HANDLE)_get_osfhandle(_fileno(stderr)));
-
+ ShowWindow(GetConsoleWindow(),SW_SHOW);
console= 1;
}
else {
- FreeConsole();
+ ShowWindow(GetConsoleWindow(),SW_HIDE);
console= 0;
}
}
@@ -3156,7 +3151,7 @@ void wm_operatortype_init(void)
WM_operatortype_append(WM_OT_splash);
WM_operatortype_append(WM_OT_search_menu);
WM_operatortype_append(WM_OT_call_menu);
-#ifdef WIN32
+#if defined(WIN32)
WM_operatortype_append(WM_OT_toggle_console);
#endif
@@ -3285,7 +3280,7 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_assign(keymap, "ACTION_OT_select_border");
WM_modalkeymap_assign(keymap, "ANIM_OT_channels_select_border");
WM_modalkeymap_assign(keymap, "ANIM_OT_previewrange_set");
- WM_modalkeymap_assign(keymap, "CONSOLE_OT_select_border");
+ WM_modalkeymap_assign(keymap, "INFO_OT_select_border");
WM_modalkeymap_assign(keymap, "FILE_OT_select_border");
WM_modalkeymap_assign(keymap, "GRAPH_OT_select_border");
WM_modalkeymap_assign(keymap, "MARKER_OT_select_border");
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 35a3fbcf9fb..315f7edf1ec 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -44,6 +44,7 @@
#include "BKE_blender.h"
#include "BKE_context.h"
+#include "BKE_library.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_utildefines.h"
@@ -237,13 +238,20 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
CTX_wm_window_set(C, win); /* needed by handlers */
WM_event_remove_handlers(C, &win->handlers);
WM_event_remove_handlers(C, &win->modalhandlers);
- ED_screen_exit(C, win, win->screen); /* will free the current screen if it is a temp layout */
+ ED_screen_exit(C, win, win->screen);
+
+ /* if temp screen, delete it */
+ if(win->screen->temp) {
+ Main *bmain= CTX_data_main(C);
+ free_libblock(&bmain->screen, win->screen);
+ }
+
wm_window_free(C, wm, win);
/* check remaining windows */
if(wm->windows.first) {
for(win= wm->windows.first; win; win= win->next)
- if(win->screen->full!=SCREENTEMP)
+ if(win->screen->temp == 0)
break;
/* in this case we close all */
if(win==NULL)
@@ -256,7 +264,7 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
void wm_window_title(wmWindowManager *wm, wmWindow *win)
{
/* handle the 'temp' window */
- if(win->screen && win->screen->full==SCREENTEMP) {
+ if(win->screen && win->screen->temp) {
GHOST_SetTitle(win->ghostwin, "Blender");
}
else {
@@ -430,7 +438,7 @@ wmWindow *WM_window_open(bContext *C, rcti *rect)
return win;
}
-/* uses screen->full tag to define what to do, currently it limits
+/* uses screen->temp tag to define what to do, currently it limits
to only one "temp" window for render out, preferences, filewindow, etc */
/* type is #define in WM_api.h */
@@ -444,7 +452,7 @@ void WM_window_open_temp(bContext *C, rcti *position, int type)
/* test if we have a temp screen already */
for(win= CTX_wm_manager(C)->windows.first; win; win= win->next)
- if(win->screen->full == SCREENTEMP)
+ if(win->screen->temp)
break;
/* add new window? */
@@ -466,7 +474,7 @@ void WM_window_open_temp(bContext *C, rcti *position, int type)
/* add new screen? */
if(win->screen==NULL)
win->screen= ED_screen_add(win, CTX_data_scene(C), "temp");
- win->screen->full = SCREENTEMP;
+ win->screen->temp = 1;
/* make window active, and validate/resize */
CTX_wm_window_set(C, win);