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:
authorJoseph Eagar <joeedh@gmail.com>2009-01-30 18:48:38 +0300
committerJoseph Eagar <joeedh@gmail.com>2009-01-30 18:48:38 +0300
commita64260263e5dcbb7e9626d96cf67f7a8ba398bab (patch)
tree1e4254ec5700c1dcf70a9b88b7bb311908017fc2
parent78ffacad41ba9265173820f6e8064afdd9c20f62 (diff)
parentb50ef7af146957c5c936f116ed5012db9e128c48 (diff)
merge with 2.5 at r18751
-rw-r--r--projectfiles_vc9/blender/editors/ED_editors.vcproj60
-rw-r--r--projectfiles_vc9/blender/windowmanager/windowmanager.vcproj4
-rw-r--r--source/Makefile1
-rw-r--r--source/blender/CMakeLists.txt2
-rw-r--r--source/blender/Makefile1
-rw-r--r--source/blender/SConscript3
-rw-r--r--source/blender/blenfont/BLF_api.h52
-rw-r--r--source/blender/blenfont/CMakeLists.txt38
-rw-r--r--source/blender/blenfont/Makefile30
-rw-r--r--source/blender/blenfont/SConscript14
-rw-r--r--source/blender/blenfont/intern/Makefile42
-rw-r--r--source/blender/blenfont/intern/blf_internal_types.h45
-rw-r--r--source/blender/blenfont/intern/blf_lang.c246
-rw-r--r--source/blender/blenkernel/BKE_action.h13
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h1
-rw-r--r--source/blender/blenkernel/BKE_idprop.h2
-rw-r--r--source/blender/blenkernel/BKE_image.h6
-rw-r--r--source/blender/blenkernel/BKE_node.h6
-rw-r--r--source/blender/blenkernel/BKE_sculpt.h16
-rw-r--r--source/blender/blenkernel/BKE_sequence.h1
-rw-r--r--source/blender/blenkernel/intern/action.c124
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c25
-rw-r--r--source/blender/blenkernel/intern/armature.c46
-rw-r--r--source/blender/blenkernel/intern/blender.c2
-rw-r--r--source/blender/blenkernel/intern/brush.c7
-rw-r--r--source/blender/blenkernel/intern/constraint.c16
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c13
-rw-r--r--source/blender/blenkernel/intern/fcurve.c43
-rw-r--r--source/blender/blenkernel/intern/idprop.c54
-rw-r--r--source/blender/blenkernel/intern/image.c28
-rw-r--r--source/blender/blenkernel/intern/ipo.c651
-rw-r--r--source/blender/blenkernel/intern/key.c30
-rw-r--r--source/blender/blenkernel/intern/library.c44
-rw-r--r--source/blender/blenkernel/intern/node.c331
-rw-r--r--source/blender/blenkernel/intern/object.c10
-rw-r--r--source/blender/blenkernel/intern/scene.c3
-rw-r--r--source/blender/blenkernel/intern/sequence.c38
-rw-r--r--source/blender/blenlib/intern/bpath.c10
-rw-r--r--source/blender/blenloader/intern/readfile.c38
-rw-r--r--source/blender/editors/CMakeLists.txt1
-rw-r--r--source/blender/editors/animation/anim_channels.c13
-rw-r--r--source/blender/editors/animation/anim_deps.c7
-rw-r--r--source/blender/editors/animation/anim_filter.c244
-rw-r--r--source/blender/editors/animation/anim_ipo_utils.c9
-rw-r--r--source/blender/editors/animation/anim_markers.c2
-rw-r--r--source/blender/editors/animation/keyframes_edit.c56
-rw-r--r--source/blender/editors/animation/keyframes_general.c101
-rw-r--r--source/blender/editors/animation/keyframing.c8
-rw-r--r--source/blender/editors/curve/curve_ops.c4
-rw-r--r--source/blender/editors/curve/editcurve.c173
-rw-r--r--source/blender/editors/include/ED_anim_api.h5
-rw-r--r--source/blender/editors/include/ED_curve.h2
-rw-r--r--source/blender/editors/include/ED_image.h39
-rw-r--r--source/blender/editors/include/ED_keyframes_edit.h9
-rw-r--r--source/blender/editors/include/ED_node.h35
-rw-r--r--source/blender/editors/include/ED_object.h3
-rw-r--r--source/blender/editors/include/ED_util.h4
-rw-r--r--source/blender/editors/include/ED_uvedit.h17
-rw-r--r--source/blender/editors/include/UI_interface.h303
-rw-r--r--source/blender/editors/include/UI_text.h14
-rw-r--r--source/blender/editors/interface/Makefile1
-rw-r--r--source/blender/editors/interface/SConscript2
-rw-r--r--source/blender/editors/interface/interface.c208
-rw-r--r--source/blender/editors/interface/interface_draw.c3
-rw-r--r--source/blender/editors/interface/interface_handlers.c179
-rw-r--r--source/blender/editors/interface/interface_intern.h71
-rw-r--r--source/blender/editors/interface/interface_panel.c2
-rw-r--r--source/blender/editors/interface/interface_regions.c971
-rw-r--r--source/blender/editors/interface/text.c194
-rw-r--r--source/blender/editors/interface/view2d.c184
-rw-r--r--source/blender/editors/mesh/editmesh.c433
-rw-r--r--source/blender/editors/mesh/editmesh_add.c260
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c72
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c16
-rw-r--r--source/blender/editors/mesh/mesh_intern.h3
-rw-r--r--source/blender/editors/mesh/mesh_ops.c7
-rw-r--r--source/blender/editors/object/object_edit.c338
-rw-r--r--source/blender/editors/preview/previewrender.c11
-rw-r--r--source/blender/editors/screen/area.c4
-rw-r--r--source/blender/editors/screen/screen_ops.c12
-rw-r--r--source/blender/editors/sculpt/sculpt.c184
-rw-r--r--source/blender/editors/space_action/action_edit.c11
-rw-r--r--source/blender/editors/space_action/action_header.c68
-rw-r--r--source/blender/editors/space_action/action_intern.h4
-rw-r--r--source/blender/editors/space_action/action_ops.c11
-rw-r--r--source/blender/editors/space_action/action_select.c10
-rw-r--r--source/blender/editors/space_action/space_action.c8
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c4
-rw-r--r--source/blender/editors/space_file/file_draw.c83
-rw-r--r--source/blender/editors/space_file/file_header.c4
-rw-r--r--source/blender/editors/space_file/file_intern.h8
-rw-r--r--source/blender/editors/space_file/file_ops.c109
-rw-r--r--source/blender/editors/space_file/space_file.c17
-rw-r--r--source/blender/editors/space_image/image_header.c449
-rw-r--r--source/blender/editors/space_image/image_intern.h5
-rw-r--r--source/blender/editors/space_image/image_ops.c2
-rw-r--r--source/blender/editors/space_image/space_image.c36
-rw-r--r--source/blender/editors/space_info/info_header.c4
-rw-r--r--source/blender/editors/space_ipo/Makefile1
-rw-r--r--source/blender/editors/space_ipo/SConscript2
-rw-r--r--source/blender/editors/space_ipo/ipo_draw.c88
-rw-r--r--source/blender/editors/space_ipo/ipo_edit.c1381
-rw-r--r--source/blender/editors/space_ipo/ipo_header.c93
-rw-r--r--source/blender/editors/space_ipo/ipo_intern.h75
-rw-r--r--source/blender/editors/space_ipo/ipo_ops.c212
-rw-r--r--source/blender/editors/space_ipo/ipo_select.c894
-rw-r--r--source/blender/editors/space_ipo/space_ipo.c34
-rw-r--r--source/blender/editors/space_nla/nla_header.c4
-rw-r--r--source/blender/editors/space_node/drawnode.c390
-rw-r--r--source/blender/editors/space_node/node_draw.c33
-rw-r--r--source/blender/editors/space_node/node_edit.c128
-rw-r--r--source/blender/editors/space_node/node_header.c71
-rw-r--r--source/blender/editors/space_node/node_intern.h2
-rw-r--r--source/blender/editors/space_node/node_ops.c8
-rw-r--r--source/blender/editors/space_node/node_select.c5
-rw-r--r--source/blender/editors/space_node/node_state.c14
-rw-r--r--source/blender/editors/space_node/space_node.c22
-rw-r--r--source/blender/editors/space_outliner/outliner.c236
-rw-r--r--source/blender/editors/space_outliner/outliner_header.c4
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h5
-rw-r--r--source/blender/editors/space_script/script_header.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c10
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c155
-rw-r--r--source/blender/editors/space_sequencer/sequencer_header.c47
-rw-r--r--source/blender/editors/space_sequencer/sequencer_ops.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c56
-rw-r--r--source/blender/editors/space_sound/sound_header.c4
-rw-r--r--source/blender/editors/space_text/text_header.c4
-rw-r--r--source/blender/editors/space_time/time_header.c12
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c352
-rw-r--r--source/blender/editors/transform/transform.c116
-rw-r--r--source/blender/editors/transform/transform.h6
-rw-r--r--source/blender/editors/transform/transform_conversions.c753
-rw-r--r--source/blender/editors/transform/transform_generics.c170
-rw-r--r--source/blender/editors/transform/transform_ops.c53
-rw-r--r--source/blender/editors/transform/transform_snap.c31
-rw-r--r--source/blender/editors/util/editmode_undo.c4
-rw-r--r--source/blender/editors/uvedit/uvedit_intern.h4
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c128
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c19
-rw-r--r--source/blender/makesdna/DNA_action_types.h2
-rw-r--r--source/blender/makesdna/DNA_anim_types.h3
-rw-r--r--source/blender/makesdna/DNA_curve_types.h18
-rw-r--r--source/blender/makesdna/DNA_node_types.h1
-rw-r--r--source/blender/makesdna/DNA_space_types.h1
-rw-r--r--source/blender/makesdna/DNA_view2d_types.h3
-rw-r--r--source/blender/makesdna/DNA_windowmanager_types.h3
-rw-r--r--source/blender/makesrna/intern/SConscript18
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c13
-rw-r--r--source/blender/makesrna/intern/rna_space.c4
-rw-r--r--source/blender/makesrna/intern/rna_texture.c1
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c145
-rw-r--r--source/blender/python/intern/bpy_compat.h7
-rw-r--r--source/blender/python/intern/bpy_operator.c4
-rw-r--r--source/blender/python/intern/bpy_operator.h4
-rw-r--r--source/blender/python/intern/bpy_rna.c32
-rw-r--r--source/blender/python/intern/bpy_rna.h7
-rw-r--r--source/blender/python/intern/bpy_util.c40
-rw-r--r--source/blender/render/intern/source/occlusion.c9
-rw-r--r--source/blender/windowmanager/CMakeLists.txt1
-rw-r--r--source/blender/windowmanager/SConscript2
-rw-r--r--source/blender/windowmanager/WM_api.h10
-rw-r--r--source/blender/windowmanager/WM_types.h23
-rw-r--r--source/blender/windowmanager/intern/Makefile1
-rw-r--r--source/blender/windowmanager/intern/wm.c6
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c35
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c7
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c21
-rw-r--r--source/blender/windowmanager/intern/wm_files.c27
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c19
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c70
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c53
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c10
-rw-r--r--source/blender/windowmanager/intern/wm_window.c4
-rw-r--r--source/blender/windowmanager/wm_cursors.h4
-rw-r--r--source/creator/CMakeLists.txt1
178 files changed, 8951 insertions, 4436 deletions
diff --git a/projectfiles_vc9/blender/editors/ED_editors.vcproj b/projectfiles_vc9/blender/editors/ED_editors.vcproj
index a1fa717607a..76a5a9676a4 100644
--- a/projectfiles_vc9/blender/editors/ED_editors.vcproj
+++ b/projectfiles_vc9/blender/editors/ED_editors.vcproj
@@ -206,10 +206,18 @@
>
</File>
<File
+ RelativePath="..\..\..\source\blender\editors\include\ED_editparticle.h"
+ >
+ </File>
+ <File
RelativePath="..\..\..\source\blender\editors\include\ED_fileselect.h"
>
</File>
<File
+ RelativePath="..\..\..\source\blender\editors\include\ED_fluidsim.h"
+ >
+ </File>
+ <File
RelativePath="..\..\..\source\blender\editors\include\ED_gpencil.h"
>
</File>
@@ -238,6 +246,10 @@
>
</File>
<File
+ RelativePath="..\..\..\source\blender\editors\include\ED_node.h"
+ >
+ </File>
+ <File
RelativePath="..\..\..\source\blender\editors\include\ED_object.h"
>
</File>
@@ -559,6 +571,10 @@
>
</File>
<File
+ RelativePath="..\..\..\source\blender\editors\space_ipo\ipo_edit.c"
+ >
+ </File>
+ <File
RelativePath="..\..\..\source\blender\editors\space_ipo\ipo_header.c"
>
</File>
@@ -567,6 +583,14 @@
>
</File>
<File
+ RelativePath="..\..\..\source\blender\editors\space_ipo\ipo_ops.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\source\blender\editors\space_ipo\ipo_select.c"
+ >
+ </File>
+ <File
RelativePath="..\..\..\source\blender\editors\space_ipo\space_ipo.c"
>
</File>
@@ -706,6 +730,10 @@
RelativePath="..\..\..\source\blender\editors\space_file\space_file.c"
>
</File>
+ <File
+ RelativePath="..\..\..\source\blender\editors\space_file\writeimage.c"
+ >
+ </File>
</Filter>
<Filter
Name="space_info"
@@ -1147,9 +1175,25 @@
Name="curve"
>
<File
+ RelativePath="..\..\..\source\blender\editors\curve\curve_intern.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\source\blender\editors\curve\curve_ops.c"
+ >
+ </File>
+ <File
RelativePath="..\..\..\source\blender\editors\curve\editcurve.c"
>
</File>
+ <File
+ RelativePath="..\..\..\source\blender\editors\curve\editfont.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\source\blender\editors\curve\lorem.c"
+ >
+ </File>
</Filter>
<Filter
Name="preview"
@@ -1163,6 +1207,22 @@
>
</File>
</Filter>
+ <Filter
+ Name="physics"
+ >
+ <File
+ RelativePath="..\..\..\source\blender\editors\physics\ed_fluidsim.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\source\blender\editors\physics\editparticle.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\source\blender\editors\physics\physics_intern.h"
+ >
+ </File>
+ </Filter>
</Files>
<Globals>
</Globals>
diff --git a/projectfiles_vc9/blender/windowmanager/windowmanager.vcproj b/projectfiles_vc9/blender/windowmanager/windowmanager.vcproj
index 7e503fb25b8..819b885cc18 100644
--- a/projectfiles_vc9/blender/windowmanager/windowmanager.vcproj
+++ b/projectfiles_vc9/blender/windowmanager/windowmanager.vcproj
@@ -235,6 +235,10 @@
>
</File>
<File
+ RelativePath="..\..\..\source\blender\windowmanager\wm_draw.h"
+ >
+ </File>
+ <File
RelativePath="..\..\..\source\blender\windowmanager\wm_event_system.h"
>
</File>
diff --git a/source/Makefile b/source/Makefile
index 46fbffeb610..fedf438d4cc 100644
--- a/source/Makefile
+++ b/source/Makefile
@@ -107,6 +107,7 @@ COMLIB += $(NAN_JPEG)/lib/libjpeg.a
COMLIB += $(OCGDIR)/blender/gpu/$(DEBUG_DIR)libgpu.a
COMLIB += $(NAN_GLEW)/lib/libglew.a
COMLIB += $(NAN_ELBEEM)/lib/$(DEBUG_DIR)libelbeem.a
+COMLIB += $(OCGDIR)/blender/blenfont/$(DEBUG_DIR)libblenfont.a
ifneq ($(NAN_NO_KETSJI),true)
COMLIB += $(OCGDIR)/gameengine/bloutines/$(DEBUG_DIR)libbloutines.a
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index 4caeebbd6a8..b76ce220ab3 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -24,7 +24,7 @@
#
# ***** END GPL LICENSE BLOCK *****
-SUBDIRS(windowmanager editors avi nodes blenkernel blenlib blenloader blenpluginapi imbuf imbuf/intern/cineon gpu makesdna makesrna radiosity readblenfile render)
+SUBDIRS(windowmanager editors avi nodes blenkernel blenlib blenloader blenpluginapi imbuf imbuf/intern/cineon gpu makesdna makesrna radiosity readblenfile render blenfont)
IF(WITH_INTERNATIONAL)
SUBDIRS(ftfont)
diff --git a/source/blender/Makefile b/source/blender/Makefile
index 37d647788d0..3b092b6f3db 100644
--- a/source/blender/Makefile
+++ b/source/blender/Makefile
@@ -34,6 +34,7 @@ DIRS = windowmanager editors blenloader readblenfile
DIRS += avi imbuf render radiosity blenlib blenkernel blenpluginapi
DIRS += makesdna makesrna yafray
DIRS += python nodes gpu
+DIRS += blenfont
ifeq ($(WITH_FREETYPE2), true)
DIRS += ftfont
diff --git a/source/blender/SConscript b/source/blender/SConscript
index cd00776440a..f9bafcd804a 100644
--- a/source/blender/SConscript
+++ b/source/blender/SConscript
@@ -18,7 +18,8 @@ SConscript(['avi/SConscript',
'readblenfile/SConscript',
'render/SConscript',
'nodes/SConscript',
- 'windowmanager/SConscript'])
+ 'windowmanager/SConscript',
+ 'blenfont/SConscript'])
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
new file mode 100644
index 00000000000..0a4ed0d7020
--- /dev/null
+++ b/source/blender/blenfont/BLF_api.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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef BLF_API_H
+#define BLF_API_H
+
+/* Read the .Blanguages file, return 1 on success or 0 if fails. */
+int BLF_lang_init(void);
+
+/* Free the memory allocate for the .Blanguages. */
+void BLF_lang_exit(void);
+
+/* Set the current Language. */
+void BLF_lang_set(int id);
+
+/* Return a string with all the Language available. */
+char *BLF_lang_pup(void);
+
+/* Return the number of invalid lines in the .Blanguages file,
+ * zero means no error found.
+ */
+int BLF_lang_error(void);
+
+/* Return the code string for the specified language code. */
+char *BLF_lang_find_code(short langid);
+
+#endif /* BLF_API_H */
diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt
new file mode 100644
index 00000000000..cd91bf69c91
--- /dev/null
+++ b/source/blender/blenfont/CMakeLists.txt
@@ -0,0 +1,38 @@
+# $Id $
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2008, Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+FILE(GLOB SRC intern/*.c)
+
+#SET(INC . intern ../../../intern/guardedalloc ../blenlib ../blenkernel ../makedna
+
+SET(INC
+ ../../../intern/guardedalloc ../blenlib ../makesdna
+ ../blenkernel ../ftfont
+)
+
+IF(WITH_INTERNATIONAL)
+ ADD_DEFINITIONS(-DWITH_FREETYPE2)
+ENDIF(WITH_INTERNATIONAL)
+
+BLENDERLIB(bf_blenfont "${SRC}" "${INC}") \ No newline at end of file
diff --git a/source/blender/blenfont/Makefile b/source/blender/blenfont/Makefile
new file mode 100644
index 00000000000..70dd2e5052b
--- /dev/null
+++ b/source/blender/blenfont/Makefile
@@ -0,0 +1,30 @@
+#
+# $Id:
+#
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2009 Blender Foundation
+# All rights reserved.
+#
+# Contributor(s): none yet.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+SOURCEDIR = source/blender/blenfont
+DIRS = intern
+
+include nan_subdirs.mk
diff --git a/source/blender/blenfont/SConscript b/source/blender/blenfont/SConscript
new file mode 100644
index 00000000000..009b96f90b1
--- /dev/null
+++ b/source/blender/blenfont/SConscript
@@ -0,0 +1,14 @@
+#!/usr/bin/python
+import sys
+Import ('env')
+
+sources = env.Glob('intern/*.c')
+
+incs = '. intern #/intern/guardedalloc ../blenkernel ../blenlib ../makesdna ../ftfont'
+
+defs = ''
+
+if env['WITH_BF_INTERNATIONAL']:
+ defs += ' WITH_FREETYPE2'
+
+env.BlenderLib ( 'bf_blenfont', sources, Split(incs), Split(defs), libtype=['core'], priority=[210] )
diff --git a/source/blender/blenfont/intern/Makefile b/source/blender/blenfont/intern/Makefile
new file mode 100644
index 00000000000..94e80466782
--- /dev/null
+++ b/source/blender/blenfont/intern/Makefile
@@ -0,0 +1,42 @@
+#
+# $Id:
+#
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2008 Blender Foundation.
+# All rights reserved.
+#
+# Contributor(s): none yet.
+#
+# ***** END GPL LICENSE BLOCK *****
+#
+#
+
+LIBNAME = blenfont
+DIR = $(OCGDIR)/blender/blenfont
+
+include nan_compile.mk
+
+CFLAGS += $(LEVEL_1_C_WARNINGS)
+
+CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
+CPPFLAGS += -I../../makesdna
+CPPFLAGS += -I../../blenlib
+CPPFLAGS += -I../../blenkernel
+CPPFLAGS += -I../../ftfont
+
+CPPFLAGS += -I..
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
new file mode 100644
index 00000000000..3a8c1bca3f5
--- /dev/null
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -0,0 +1,45 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef BLF_INTERNAL_TYPES_H
+#define BLF_INTERNAL_TYPES_H
+
+typedef struct LangBLF {
+ struct LangBLF *next;
+ struct LangBLF *prev;
+
+ char *line;
+ char *language;
+ char *code;
+ int id;
+} LangBLF;
+
+#define BLF_LANG_FIND_BY_LINE 0
+#define BLF_LANG_FIND_BY_LANGUAGE 1
+#define BLF_LANG_FIND_BY_CODE 2
+
+#endif /* BLF_INTERNAL_TYPES_H */
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
new file mode 100644
index 00000000000..0aaf399cf58
--- /dev/null
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -0,0 +1,246 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_listBase.h"
+
+#include "BKE_utildefines.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_linklist.h" /* linknode */
+#include "BLI_string.h"
+
+#include "blf_internal_types.h"
+
+// XXX 2.50 Remove this later.
+#ifdef WITH_FREETYPE2
+#include "FTF_Api.h"
+#endif
+
+static ListBase global_lang= { NULL, NULL };
+static int global_tot_lang= 0;
+static int global_err_lang= 0;
+
+int BLF_lang_error(void)
+{
+ return(global_err_lang);
+}
+
+char *BLF_lang_pup(void)
+{
+ LangBLF *lme;
+ static char string[1024];
+ static char tmp[1024];
+
+ if(global_tot_lang == 0)
+ sprintf(string, "Choose Language: %%t|Language: English %%x0");
+ else {
+ lme= global_lang.first;
+ sprintf(string, "Choose Language: %%t");
+ while (lme) {
+ sprintf(tmp, "|Language: %s %%x%d", lme->language, lme->id);
+ strcat(string, tmp);
+ lme= lme->next;
+ }
+ }
+
+ return(string);
+}
+
+LangBLF *blf_lang_find_by_id(short langid)
+{
+ LangBLF *p;
+
+ p= global_lang.first;
+ while (p) {
+ if (p->id == langid)
+ return(p);
+ p= p->next;
+ }
+ return(NULL);
+}
+
+char *BLF_lang_find_code(short langid)
+{
+ LangBLF *p;
+
+ p= blf_lang_find_by_id(langid);
+ if (p)
+ return(p->code);
+ return(NULL);
+}
+
+void BLF_lang_set(int id)
+{
+#ifdef WITH_FREETYPE2
+ LangBLF *lme;
+
+ // XXX 2.50 Remove this later, with ftfont
+ lme= blf_lang_find_by_id(id);
+ if(lme) FTF_SetLanguage(lme->code);
+ else FTF_SetLanguage("en_US");
+#endif
+}
+
+static void blf_lang_split(char *line, LangBLF* lme)
+{
+ char *dpointchar= strchr(line, ':');
+
+ if (dpointchar) {
+ lme->code= BLI_strdup(dpointchar+1);
+ *(dpointchar)=0;
+ lme->language= BLI_strdup(line);
+ } else {
+ lme->code= NULL;
+ lme->language= NULL;
+ /* XXX 2.50 bad call error("Invalid language file");
+ * If we set this to NULL, the function blf_lang_new
+ * drop the line and increment the error lang value
+ * so the init code can call BLF_lang_error to get
+ * the number of invalid lines and show the error.
+ */
+ }
+}
+
+LangBLF *blf_lang_find(char *s, int find_by)
+{
+ LangBLF *p;
+
+ p= global_lang.first;
+ while (p) {
+ if (find_by == BLF_LANG_FIND_BY_LINE) {
+ if (BLI_streq(s, p->line))
+ return(p);
+ }
+ else if (find_by == BLF_LANG_FIND_BY_CODE) {
+ if (BLI_streq(s, p->code))
+ return(p);
+ }
+ else if (find_by == BLF_LANG_FIND_BY_LANGUAGE) {
+ if (BLI_streq(s, p->language))
+ return(p);
+ }
+ p= p->next;
+ }
+ return(NULL);
+}
+
+static void blf_lang_new(char *line)
+{
+ LangBLF *lme;
+
+ lme= blf_lang_find(line, BLF_LANG_FIND_BY_LINE);
+ if (!lme) {
+ lme= MEM_mallocN(sizeof(LangBLF), "blf_lang_new");
+ lme->next= NULL;
+ lme->prev= NULL;
+ lme->line = BLI_strdup(line);
+ blf_lang_split(line, lme);
+
+ if (lme->code && lme->language) {
+ lme->id = global_tot_lang;
+ global_tot_lang++;
+ BLI_addhead(&global_lang, lme);
+ }
+ else {
+ global_err_lang++;
+ MEM_freeN(lme->line);
+ MEM_freeN(lme);
+ }
+ }
+}
+
+int BLF_lang_init(void)
+{
+ char name[FILE_MAXDIR+FILE_MAXFILE];
+ LinkNode *l, *lines;
+
+ /* .Blanguages, http://www.blender3d.org/cms/Installation_Policy.352.0.html*/
+#if defined (__APPLE__) || (WIN32)
+ BLI_make_file_string("/", name, BLI_gethome(), ".Blanguages");
+#else
+ BLI_make_file_string("/", name, BLI_gethome(), ".blender/.Blanguages");
+#endif
+
+ lines= BLI_read_file_as_lines(name);
+
+ if(lines == NULL) {
+ /* If not found in home, try current dir
+ * (Resources folder of app bundle on OS X) */
+#if defined (__APPLE__)
+ char *bundlePath = BLI_getbundle();
+ strcpy(name, bundlePath);
+ strcat(name, "/Contents/Resources/.Blanguages");
+#else
+ /* Check the CWD. Takes care of the case where users
+ * unpack blender tarball; cd blender-dir; ./blender */
+ strcpy(name, ".blender/.Blanguages");
+#endif
+ lines= BLI_read_file_as_lines(name);
+
+ if(lines == NULL) {
+ /* If not found in .blender, try current dir */
+ strcpy(name, ".Blanguages");
+ lines= BLI_read_file_as_lines(name);
+ if(lines == NULL) {
+// XXX 2.50 if(G.f & G_DEBUG)
+ printf("File .Blanguages not found\n");
+ return(0);
+ }
+ }
+ }
+
+ for (l= lines; l; l= l->next) {
+ char *line= l->link;
+
+ if (!BLI_streq(line, "")) {
+ blf_lang_new(line);
+ }
+ }
+
+ BLI_free_file_lines(lines);
+ return(1);
+}
+
+void BLF_lang_exit(void)
+{
+ LangBLF *p;
+
+ while (global_lang.first) {
+ p= global_lang.first;
+ BLI_remlink(&global_lang, p);
+ MEM_freeN(p->line);
+ MEM_freeN(p->language);
+ MEM_freeN(p->code);
+ MEM_freeN(p);
+ }
+}
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h
index 9ef91d60e89..9abacf862c5 100644
--- a/source/blender/blenkernel/BKE_action.h
+++ b/source/blender/blenkernel/BKE_action.h
@@ -123,17 +123,8 @@ void update_pose_constraint_flags(struct bPose *pose);
// XXX to be depreceated for a more general solution in animsys...
void framechange_poses_clear_unkeyed(void);
-/**
- * Set the pose channels from the given action.
- */
-// XXX old crap
-void extract_pose_from_action(struct bPose *pose, struct bAction *act, float ctime);
-
-/**
- * Get the effects of the given action using a workob
- */
-// XXX old crap, used for action constraint though!
-void what_does_obaction(struct Scene *scene, struct Object *ob, struct Object *workob, struct bAction *act, float cframe);
+/* Used for the Action Constraint */
+void what_does_obaction(struct Scene *scene, struct Object *ob, struct Object *workob, struct bPose *pose, struct bAction *act, float cframe);
/* exported for game engine */
void blend_poses(struct bPose *dst, struct bPose *src, float srcweight, short mode);
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index bed909fd040..87c230eec91 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -25,6 +25,7 @@ void bezt_add_to_cfra_elem(ListBase *lb, struct BezTriple *bezt);
/* ************** F-Curve Drivers ***************** */
void fcurve_free_driver(struct FCurve *fcu);
+struct ChannelDriver *fcurve_copy_driver(struct ChannelDriver *driver);
/* ************** F-Curve Modifiers *************** */
diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h
index 4f57e1d6d14..1980ba78c86 100644
--- a/source/blender/blenkernel/BKE_idprop.h
+++ b/source/blender/blenkernel/BKE_idprop.h
@@ -142,6 +142,8 @@ void IDP_FreeIterBeforeEnd(void *vself);
struct IDProperty *IDP_GetProperties(struct ID *id, int create_if_needed);
struct IDProperty *IDP_CopyProperty(struct IDProperty *prop);
+int IDP_EqualsProperties(struct IDProperty *prop1, struct IDProperty *prop2);
+
/*
Allocate a new ID.
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index d1bcd63c936..816baa20467 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -148,6 +148,12 @@ void BKE_image_memorypack(struct Image *ima);
/* prints memory statistics for images */
void BKE_image_print_memlist(void);
+/* empty image block, of similar type and filename */
+struct Image *BKE_image_copy(struct Image *ima);
+
+/* merge source into dest, and free source */
+void BKE_image_merge(struct Image *dest, struct Image *source);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 669ee11926b..bf2da892506 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -106,6 +106,7 @@ typedef struct bNodeType {
#define NODE_BREAK 2
#define NODE_FINISHED 4
#define NODE_FREEBUFS 8
+#define NODE_SKIPPED 16
/* nodetype->nclass, for add-menu and themes */
#define NODE_CLASS_INPUT 0
@@ -148,6 +149,11 @@ void ntreeInitPreview(struct bNodeTree *, int xsize, int ysize);
void ntreeClearPreview(struct bNodeTree *ntree);
void ntreeFreeCache(struct bNodeTree *ntree);
+
+ /* calls allowing threaded composite */
+struct bNodeTree *ntreeLocalize(struct bNodeTree *ntree);
+void ntreeLocalSync(struct bNodeTree *localtree, struct bNodeTree *ntree);
+void ntreeLocalMerge(struct bNodeTree *localtree, struct bNodeTree *ntree);
/* ************** GENERIC API, NODES *************** */
diff --git a/source/blender/blenkernel/BKE_sculpt.h b/source/blender/blenkernel/BKE_sculpt.h
index 7e5a6a3c01c..08db1ac632e 100644
--- a/source/blender/blenkernel/BKE_sculpt.h
+++ b/source/blender/blenkernel/BKE_sculpt.h
@@ -30,16 +30,22 @@
#ifndef BKE_SCULPT_H
#define BKE_SCULPT_H
-struct NumInput;
-struct RadialControl;
-struct Scene;
+struct MFace;
+struct MultireModifierData;
+struct MVert;
struct Sculpt;
-struct SculptSession;
struct StrokeCache;
typedef struct SculptSession {
struct ProjVert *projverts;
+ /* Mesh data (not copied) can come either directly from a Mesh, or from a MultiresDM */
+ struct MultiresModifierData *multires; /* Special handling for multires meshes */
+ struct MVert *mvert;
+ struct MFace *mface;
+ int totvert, totface;
+ float *face_normals;
+
/* Mesh connectivity */
struct ListBase *fmap;
struct IndexNode *fmap_mem;
@@ -55,8 +61,6 @@ typedef struct SculptSession {
void *cursor; /* wm handle */
- struct RadialControl *radialcontrol;
-
struct SculptStroke *stroke;
struct StrokeCache *cache;
diff --git a/source/blender/blenkernel/BKE_sequence.h b/source/blender/blenkernel/BKE_sequence.h
index 5bf0e84c7c4..0960f968c4e 100644
--- a/source/blender/blenkernel/BKE_sequence.h
+++ b/source/blender/blenkernel/BKE_sequence.h
@@ -140,6 +140,7 @@ struct SeqEffectHandle {
void seq_free_sequence(struct Editing *ed, struct Sequence *seq);
void seq_free_strip(struct Strip *strip);
void seq_free_editing(struct Editing *ed);
+struct Editing *seq_give_editing(struct Scene *scene, int alloc);
char *give_seqname(struct Sequence *seq);
struct ImBuf *give_ibuf_seq(struct Scene *scene, int rectx, int recty, int cfra, int chanshown);
struct ImBuf *give_ibuf_seq_threaded(struct Scene *scene, int rectx, int recty, int cfra, int chanshown);
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index eb68b1f3a6a..3758f9ba0db 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -45,6 +45,7 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "BKE_animsys.h"
#include "BKE_action.h"
#include "BKE_anim.h"
#include "BKE_armature.h"
@@ -610,46 +611,6 @@ void extract_pose_from_pose(bPose *pose, const bPose *src)
}
}
-/* Pose should exist, can have any number of channels too (used for constraint) */
-void extract_pose_from_action(bPose *pose, bAction *act, float ctime)
-{
-#if 0 // XXX old animation system
- bActionChannel *achan;
- bPoseChannel *pchan;
- Ipo *ipo;
-
- if (!act)
- return;
- if (!pose)
- return;
-
- /* Copy the data from the action into the pose */
- for (pchan= pose->chanbase.first; pchan; pchan=pchan->next) {
- /* skip this pose channel if it has been tagged as having unkeyed poses */
- if ((pchan->bone) && (pchan->bone->flag & BONE_UNKEYED))
- continue;
-
- /* get action channel and clear pchan-transform flags */
- achan= get_action_channel(act, pchan->name);
- pchan->flag &= ~(POSE_LOC|POSE_ROT|POSE_SIZE);
-
- if (achan) {
- ipo = achan->ipo;
- if (ipo) {
- /* Evaluates and sets the internal ipo value */
- calc_ipo(ipo, ctime);
- /* This call also sets the pchan flags */
- execute_action_ipo(achan, pchan);
- }
- /* 0 = do all ipos, not only drivers */
- do_constraint_channels(&pchan->constraints, &achan->constraintChannels, ctime, 0);
- }
- }
-#endif // XXX old animation system
-
- pose->ctime= ctime; /* used for cyclic offset matching */
-}
-
/* for do_all_pose_actions, clears the pose. Now also exported for proxy and tools */
void rest_pose(bPose *pose)
{
@@ -708,6 +669,50 @@ void copy_pose_result(bPose *to, bPose *from)
}
}
+/* For the calculation of the effects of an Action at the given frame on an object
+ * This is currently only used for the Action Constraint
+ */
+void what_does_obaction (Scene *scene, Object *ob, Object *workob, bPose *pose, bAction *act, float cframe)
+{
+ AnimData adt;
+
+ /* clear workob and animdata */
+ clear_workob(workob);
+ memset(&adt, 0, sizeof(AnimData));
+
+ /* init workob */
+ Mat4CpyMat4(workob->obmat, ob->obmat);
+ Mat4CpyMat4(workob->parentinv, ob->parentinv);
+ Mat4CpyMat4(workob->constinv, ob->constinv);
+ workob->parent= ob->parent;
+ workob->track= ob->track;
+
+ workob->trackflag= ob->trackflag;
+ workob->upflag= ob->upflag;
+
+ workob->partype= ob->partype;
+ workob->par1= ob->par1;
+ workob->par2= ob->par2;
+ workob->par3= ob->par3;
+
+ workob->constraints.first = ob->constraints.first;
+ workob->constraints.last = ob->constraints.last;
+
+ workob->pose= pose; /* need to set pose too, since this is used for both types of Action Constraint */
+
+ strcpy(workob->parsubstr, ob->parsubstr);
+ strcpy(workob->id.name, "OB<ConstrWorkOb>"); /* we don't use real object name, otherwise RNA screws with the real thing */
+
+ /* init animdata, and attach to workob */
+ workob->adt= &adt;
+
+ adt.recalc= ADT_RECALC_ANIM;
+ adt.action= act;
+
+ /* execute effects of Action on to workob (or it's PoseChannels) */
+ BKE_animsys_evaluate_animdata(workob, &adt, cframe, ADT_RECALC_ANIM);
+}
+
/* ********** NLA with non-poses works with ipo channels ********** */
#if 0 // XXX OLD ANIMATION SYSTEM (TO BE REMOVED)
@@ -1162,45 +1167,6 @@ static Object *get_parent_path(Object *ob)
/* ************** do the action ************ */
-/* For the calculation of the effects of an action at the given frame on an object
- * This is currently only used for the action constraint
- */
-void what_does_obaction (Scene *scene, Object *ob, Object *workob, bAction *act, float cframe)
-{
- ListBase tchanbase= {NULL, NULL};
-
- clear_workob(workob);
- Mat4CpyMat4(workob->obmat, ob->obmat);
- Mat4CpyMat4(workob->parentinv, ob->parentinv);
- Mat4CpyMat4(workob->constinv, ob->constinv);
- workob->parent= ob->parent;
- workob->track= ob->track;
-
- workob->trackflag= ob->trackflag;
- workob->upflag= ob->upflag;
-
- workob->partype= ob->partype;
- workob->par1= ob->par1;
- workob->par2= ob->par2;
- workob->par3= ob->par3;
-
- workob->constraints.first = ob->constraints.first;
- workob->constraints.last = ob->constraints.last;
-
- strcpy(workob->parsubstr, ob->parsubstr);
- strcpy(workob->id.name, ob->id.name);
-
- /* extract_ipochannels_from_action needs id's! */
- workob->action= act;
-
- extract_ipochannels_from_action(&tchanbase, &workob->id, act, "Object", bsystem_time(scene, workob, cframe, 0.0));
-
- if (tchanbase.first) {
- execute_ipochannels(&tchanbase);
- BLI_freelistN(&tchanbase);
- }
-}
-
/* ----- nla, etc. --------- */
static void do_nla(Scene *scene, Object *ob, int blocktype)
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 30e5daeeb3b..d02797ba345 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -14,6 +14,7 @@
#include "BKE_animsys.h"
#include "BKE_action.h"
#include "BKE_fcurve.h"
+#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_utildefines.h"
@@ -183,8 +184,8 @@ short animsys_remap_path (AnimMapper *remap, char *path, char **dst)
}
-/* Write the given value to a setting using RNA */
-static void animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_index, float value)
+/* Write the given value to a setting using RNA, and return success */
+static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_index, float value)
{
PropertyRNA *prop;
PointerRNA new_ptr;
@@ -222,6 +223,21 @@ static void animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_in
break;
}
}
+
+ /* successful */
+ // XXX should the unhandled case also be successful?
+ return 1;
+ }
+ else {
+ /* failed to get path */
+ // XXX don't tag as failed yet though, as there are some legit situations (Action Constraint)
+ // where some channels will not exist, but shouldn't lock up Action
+ if (G.f & G_DEBUG) {
+ printf("Animato: Invalid path. ID = '%s', '%s [%d]' \n",
+ (ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name+2) : "<No ID>",
+ path, array_index);
+ }
+ return 0;
}
}
@@ -282,7 +298,7 @@ static void animsys_evaluate_drivers (PointerRNA *ptr, AnimData *adt, float ctim
if ((fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED)) == 0)
{
/* check if driver itself is tagged for recalculation */
- if ((driver) && (driver->flag & DRIVER_FLAG_RECALC)) {
+ if ((driver) /*&& (driver->flag & DRIVER_FLAG_RECALC)*/) { // XXX driver recalc flag is not set yet by depsgraph!
/* evaluate this using values set already in other places */
// NOTE: for 'layering' option later on, we should check if we should remove old value before adding new to only be done when drivers only changed
calculate_fcurve(fcu, ctime);
@@ -619,7 +635,8 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
{
ID *id;
- printf("Evaluate all animation - %f \n", ctime);
+ if (G.f & G_DEBUG)
+ printf("Evaluate all animation - %f \n", ctime);
/* macro for less typing */
#define EVAL_ANIM_IDS(first) \
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index d256e8dc8e7..841759ef153 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -363,7 +363,7 @@ void bone_flip_name (char *name, int strip_number)
*/
void bone_autoside_name (char *name, int strip_number, short axis, float head, float tail)
{
- int len;
+ unsigned int len;
char basename[32]={""};
char extension[5]={""};
@@ -606,7 +606,7 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
Mat3Inv(imat3, mat3);
Mat3MulMat3(mat3, result, imat3); // the matrix transforming vec_roll to desired roll
- roll1= atan2(mat3[2][0], mat3[2][2]);
+ roll1= (float)atan2(mat3[2][0], mat3[2][2]);
}
}
else {
@@ -639,7 +639,7 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
Mat3Inv(imat3, mat3);
Mat3MulMat3(mat3, imat3, result); // the matrix transforming vec_roll to desired roll
- roll2= atan2(mat3[2][0], mat3[2][2]);
+ roll2= (float)atan2(mat3[2][0], mat3[2][2]);
/* and only now negate handle */
VecMulf(h2, -hlength2);
@@ -784,7 +784,7 @@ float distfactor_to_bone (float vec[3], float b1[3], float b2[3], float rad1, fl
if(l!=0.0f) {
rad= a/l;
- rad= rad*rad2 + (1.0-rad)*rad1;
+ rad= rad*rad2 + (1.0f-rad)*rad1;
}
else rad= rad1;
}
@@ -798,8 +798,8 @@ float distfactor_to_bone (float vec[3], float b1[3], float b2[3], float rad1, fl
if(rdist==0.0f || dist >= l)
return 0.0f;
else {
- a= sqrt(dist)-rad;
- return 1.0-( a*a )/( rdist*rdist );
+ a= (float)sqrt(dist)-rad;
+ return 1.0f-( a*a )/( rdist*rdist );
}
}
}
@@ -1301,7 +1301,7 @@ void mat3_to_vec_roll(float mat[][3], float *vec, float *roll)
Mat3Inv(vecmatinv, vecmat);
Mat3MulMat3(rollmat, vecmatinv, mat);
- *roll= atan2(rollmat[2][0], rollmat[2][2]);
+ *roll= (float)atan2(rollmat[2][0], rollmat[2][2]);
}
}
@@ -1333,7 +1333,7 @@ void vec_roll_to_mat3(float *vec, float roll, float mat[][3])
float updown;
/* point same direction, or opposite? */
- updown = ( Inpf (target,nor) > 0 ) ? 1.0 : -1.0;
+ updown = ( Inpf (target,nor) > 0 ) ? 1.0f : -1.0f;
/* I think this should work ... */
bMatrix[0][0]=updown; bMatrix[0][1]=0.0; bMatrix[0][2]=0.0;
@@ -1789,10 +1789,10 @@ static void execute_posetree(Object *ob, PoseTree *tree)
IK_SetStiffness(seg, IK_Y, pchan->stiffness[1]);
IK_SetStiffness(seg, IK_Z, pchan->stiffness[2]);
- if(tree->stretch && (pchan->ikstretch > 0.0)) {
+ if(tree->stretch && (pchan->ikstretch > 0.0f)) {
float ikstretch = pchan->ikstretch*pchan->ikstretch;
- IK_SetStiffness(seg, IK_TRANS_Y, MIN2(1.0-ikstretch, 0.99));
- IK_SetLimit(seg, IK_TRANS_Y, 0.001, 1e10);
+ IK_SetStiffness(seg, IK_TRANS_Y, MIN2(1.0f-ikstretch, 0.99f));
+ IK_SetLimit(seg, IK_TRANS_Y, 0.001f, 1e10);
}
}
@@ -1858,10 +1858,10 @@ static void execute_posetree(Object *ob, PoseTree *tree)
}
/* do we need blending? */
- if (!resultblend && target->con->enforce!=1.0) {
+ if (!resultblend && target->con->enforce!=1.0f) {
float q1[4], q2[4], q[4];
float fac= target->con->enforce;
- float mfac= 1.0-fac;
+ float mfac= 1.0f-fac;
pchan= tree->pchan[target->tip];
@@ -1884,13 +1884,13 @@ static void execute_posetree(Object *ob, PoseTree *tree)
iktarget= iktree[target->tip];
- if(data->weight != 0.0) {
+ if(data->weight != 0.0f) {
if(poleconstrain)
IK_SolverSetPoleVectorConstraint(solver, iktarget, goalpos,
- polepos, data->poleangle*M_PI/180, (poleangledata == data));
+ polepos, data->poleangle*(float)M_PI/180.0f, (poleangledata == data));
IK_SolverAddGoal(solver, iktarget, goalpos, data->weight);
}
- if((data->flag & CONSTRAINT_IK_ROT) && (data->orientweight != 0.0))
+ if((data->flag & CONSTRAINT_IK_ROT) && (data->orientweight != 0.0f))
if((data->flag & CONSTRAINT_IK_AUTO)==0)
IK_SolverAddGoalOrientation(solver, iktarget, goalrot,
data->orientweight);
@@ -1900,7 +1900,7 @@ static void execute_posetree(Object *ob, PoseTree *tree)
IK_Solve(solver, 0.0f, tree->iterations);
if(poleangledata)
- poleangledata->poleangle= IK_SolverGetPoleAngle(solver)*180/M_PI;
+ poleangledata->poleangle= IK_SolverGetPoleAngle(solver)*180.0f/(float)M_PI;
IK_FreeSolver(solver);
@@ -1917,20 +1917,20 @@ static void execute_posetree(Object *ob, PoseTree *tree)
float parentstretch, stretch;
pchan= tree->pchan[a];
- parentstretch= (tree->parent[a] >= 0)? ikstretch[tree->parent[a]]: 1.0;
+ parentstretch= (tree->parent[a] >= 0)? ikstretch[tree->parent[a]]: 1.0f;
- if(tree->stretch && (pchan->ikstretch > 0.0)) {
+ if(tree->stretch && (pchan->ikstretch > 0.0f)) {
float trans[3], length;
IK_GetTranslationChange(iktree[a], trans);
length= pchan->bone->length*VecLength(pchan->pose_mat[1]);
- ikstretch[a]= (length == 0.0)? 1.0: (trans[1]+length)/length;
+ ikstretch[a]= (length == 0.0f)? 1.0f: (trans[1]+length)/length;
}
else
- ikstretch[a] = 1.0;
+ ikstretch[a] = 1.0f;
- stretch= (parentstretch == 0.0)? 1.0: ikstretch[a]/parentstretch;
+ stretch= (parentstretch == 0.0f)? 1.0f: ikstretch[a]/parentstretch;
VecMulf(tree->basis_change[a][0], stretch);
VecMulf(tree->basis_change[a][1], stretch);
@@ -2035,7 +2035,7 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha
{
bActionModifier *amod;
bActionStrip *strip, *strip2;
- float scene_cfra= scene->r.cfra;
+ float scene_cfra= (float)scene->r.cfra;
int do_modif;
for (strip=armob->nlastrips.first; strip; strip=strip->next) {
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 2ad0c98bb79..4ac25d2750c 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -251,7 +251,7 @@ static void clean_paths(Main *main)
}
while(scene) {
- ed= scene->ed;
+ ed= seq_give_editing(scene, 0);
if(ed) {
seq= ed->seqbasep->first;
while(seq) {
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 804b14b66b1..c0882451f6c 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -1018,14 +1018,15 @@ static struct ImBuf *brush_gen_radial_control_imbuf(Brush *br)
/* Modulate curve with texture */
if(texcache) {
- for(i=0; i<side; ++i)
+ for(i=0; i<side; ++i) {
for(j=0; j<side; ++j) {
const int col= texcache[i*side+j];
im->rect_float[i*side+j]*= (((char*)&col)[0]+((char*)&col)[1]+((char*)&col)[2])/3.0f/255.0f;
}
- }
+ }
- MEM_freeN(texcache);
+ MEM_freeN(texcache);
+ }
return im;
}
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 912bc7ab3bd..5c8bec3af6f 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -1882,20 +1882,29 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
CLAMP(s, 0, 1);
t = ( s * (data->end-data->start)) + data->start;
+ if (G.f & G_DEBUG)
+ printf("do Action Constraint %s - Ob %s Pchan %s \n", con->name, cob->ob->id.name+2, (cob->pchan)?cob->pchan->name:NULL);
+
/* Get the appropriate information from the action */
+ // XXX probably we might need some special filtering methods to make this more efficient
if (cob->type == CONSTRAINT_OBTYPE_BONE) {
+ Object workob;
bPose *pose;
bPoseChannel *pchan, *tchan;
/* make a temporary pose and evaluate using that */
pose = MEM_callocN(sizeof(bPose), "pose");
+ /* make a copy of the bone of interest in the temp pose before evaluating action, so that it can get set */
pchan = cob->pchan;
tchan= verify_pose_channel(pose, pchan->name);
- extract_pose_from_action(pose, data->act, t);
- chan_calc_mat(tchan);
+ /* evaluate action using workob (it will only set the PoseChannel in question) */
+ // XXX we need some flags to prevent evaluation from setting disabled flags on all other settings
+ what_does_obaction(cob->scene, cob->ob, &workob, pose, data->act, t);
+ /* convert animation to matrices for use here */
+ chan_calc_mat(tchan);
Mat4CpyMat4(ct->matrix, tchan->chan_mat);
/* Clean up */
@@ -1903,8 +1912,9 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
}
else if (cob->type == CONSTRAINT_OBTYPE_OBJECT) {
Object workob;
+
/* evaluate using workob */
- //what_does_obaction(cob->scene, cob->ob, &workob, data->act, t); // FIXME: missing func...
+ what_does_obaction(cob->scene, cob->ob, &workob, NULL, data->act, t);
object_to_mat4(&workob, ct->matrix);
}
else {
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 4f083c4bf9b..265fb1258a1 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -347,11 +347,16 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node
// XXX rotational difference
}
else if (driver->id) {
- /* normal channel-drives-channel */
- node1 = dag_get_node(dag, driver->id); // XXX we assume that id is an object...
+ if(GS(driver->id->name)==ID_OB) {
+ /* normal channel-drives-channel */
+ node1 = dag_get_node(dag, driver->id);
- // XXX what happens for bone drivers?
- dag_add_relation(dag, node1, node, isdata?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Ipo Driver");
+ // XXX how to find out rnapath is bone?
+ if( ((Object *)driver->id)->type==OB_ARMATURE )
+ dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Ipo Driver");
+ else
+ dag_add_relation(dag, node1, node, isdata?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Ipo Driver");
+ }
}
#if 0 // XXX old 'normal' type
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 56f0b53c16d..8c36f2b0017 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -20,6 +20,7 @@
#include "BKE_fcurve.h"
#include "BKE_curve.h"
+#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_utildefines.h"
@@ -106,7 +107,7 @@ FCurve *copy_fcurve (FCurve *fcu)
fcu_d->rna_path= MEM_dupallocN(fcu_d->rna_path);
/* copy driver */
- //fcurve_copy_driver();
+ fcu_d->driver= fcurve_copy_driver(fcu_d->driver);
/* copy modifiers */
fcurve_copy_modifiers(&fcu_d->modifiers, &fcu->modifiers);
@@ -438,6 +439,24 @@ void fcurve_free_driver(FCurve *fcu)
fcu->driver= NULL;
}
+/* This makes a copy of the given driver */
+ChannelDriver *fcurve_copy_driver (ChannelDriver *driver)
+{
+ ChannelDriver *ndriver;
+
+ /* sanity checks */
+ if (driver == NULL)
+ return NULL;
+
+ /* copy all data */
+ ndriver= MEM_dupallocN(driver);
+ ndriver->rna_path= MEM_dupallocN(ndriver->rna_path);
+ ndriver->rna_path2= MEM_dupallocN(ndriver->rna_path2);
+
+ /* return the new driver */
+ return ndriver;
+}
+
/* Driver Evaluation -------------------------- */
/* Helper function to obtain a value using RNA from the specified source (for evaluating drivers)
@@ -447,24 +466,35 @@ static float driver_get_driver_value (ChannelDriver *driver, short target)
{
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
+ ID *id;
char *path;
int index;
float value= 0.0f;
/* get RNA-pointer for the ID-block given in driver */
- if (target == 2) {
+ if (target == 1) {
/* second target */
RNA_id_pointer_create(driver->id2, &id_ptr);
+ id= driver->id2;
path= driver->rna_path2;
index= driver->array_index2;
}
else {
/* first/main target */
RNA_id_pointer_create(driver->id, &id_ptr);
+ id= driver->id;
path= driver->rna_path;
index= driver->array_index;
}
+ /* error check for missing pointer... */
+ if (id == NULL) {
+ printf("Error: driver doesn't have any valid target to use \n");
+ if (G.f & G_DEBUG) printf("\tpath = %s [%d] \n", path, index);
+ driver->flag |= DRIVER_FLAG_INVALID;
+ return 0.0f;
+ }
+
/* get property to read from, and get value as appropriate */
if (RNA_path_resolve(&id_ptr, path, &ptr, &prop)) {
switch (RNA_property_type(&ptr, prop)) {
@@ -511,9 +541,10 @@ static float evaluate_driver (ChannelDriver *driver, float evaltime)
case DRIVER_TYPE_CHANNEL: /* channel/setting drivers channel/setting */
return driver_get_driver_value(driver, 0);
-#ifndef DISABLE_PYTHON
+
case DRIVER_TYPE_PYTHON: /* expression */
{
+#ifndef DISABLE_PYTHON
/* check for empty or invalid expression */
if ( (driver->expression[0] == '\0') ||
(driver->flag & DRIVER_FLAG_INVALID) )
@@ -526,8 +557,10 @@ static float evaluate_driver (ChannelDriver *driver, float evaltime)
*/
//return BPY_pydriver_eval(driver); // XXX old func
return 1.0f;
- }
#endif /* DISABLE_PYTHON*/
+ }
+ break;
+
case DRIVER_TYPE_ROTDIFF: /* difference of rotations of 2 bones (should be in same armature) */
{
@@ -1011,7 +1044,7 @@ static void fcm_generator_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue,
// TODO: could this be more efficient (i.e. without need to recalc pow() everytime)
cp= data->poly_coefficients;
for (i=0; (i <= data->poly_order) && (cp); i++, cp++)
- value += (*cp) * pow(evaltime, i);
+ value += (*cp) * (float)pow(evaltime, i);
/* only if something changed */
if (data->poly_order)
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index c2474e847ae..3be47778674 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -527,6 +527,60 @@ IDProperty *IDP_GetProperties(ID *id, int create_if_needed)
}
}
+int IDP_EqualsProperties(IDProperty *prop1, IDProperty *prop2)
+{
+ if(prop1 == NULL && prop2 == NULL)
+ return 1;
+ else if(prop1 == NULL || prop2 == NULL)
+ return 0;
+ else if(prop1->type != prop2->type)
+ return 0;
+
+ if(prop1->type == IDP_INT)
+ return (IDP_Int(prop1) == IDP_Int(prop2));
+ else if(prop1->type == IDP_FLOAT)
+ return (IDP_Float(prop1) == IDP_Float(prop2));
+ else if(prop1->type == IDP_DOUBLE)
+ return (IDP_Double(prop1) == IDP_Double(prop2));
+ else if(prop1->type == IDP_STRING)
+ return BSTR_EQ(IDP_String(prop1), IDP_String(prop2));
+ else if(prop1->type == IDP_ARRAY) {
+ if(prop1->len == prop2->len && prop1->subtype == prop2->subtype)
+ return memcmp(IDP_Array(prop1), IDP_Array(prop2), idp_size_table[prop1->subtype]*prop1->len);
+ else
+ return 0;
+ }
+ else if(prop1->type == IDP_GROUP) {
+ IDProperty *link1, *link2;
+
+ if(BLI_countlist(&prop1->data.group) != BLI_countlist(&prop2->data.group))
+ return 0;
+
+ for(link1=prop1->data.group.first; link1; link1=link1->next) {
+ link2= IDP_GetPropertyFromGroup(prop2, link1->name);
+
+ if(!IDP_EqualsProperties(link1, link2))
+ return 0;
+ }
+
+ return 1;
+ }
+ else if(prop1->type == IDP_IDPARRAY) {
+ IDProperty *array1= IDP_IDPArray(prop1);
+ IDProperty *array2= IDP_IDPArray(prop2);
+ int i;
+
+ if(prop1->len != prop2->len)
+ return 0;
+
+ for(i=0; i<prop1->len; i++)
+ if(!IDP_EqualsProperties(&array1[i], &array2[i]))
+ return 0;
+ }
+
+ return 1;
+}
+
IDProperty *IDP_New(int type, IDPropertyTemplate val, const char *name)
{
IDProperty *prop=NULL;
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 1b851444e04..ee631a89083 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -91,6 +91,7 @@
/* quick lookup: supports 1 million frames, thousand passes */
#define IMA_MAKE_INDEX(frame, index) ((frame)<<10)+index
#define IMA_INDEX_FRAME(index) (index>>10)
+#define IMA_INDEX_PASS(index) (index & ~1023)
/* ******** IMAGE PROCESSING ************* */
@@ -332,6 +333,33 @@ static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int frame)
}
}
+/* empty image block, of similar type and filename */
+Image *BKE_image_copy(Image *ima)
+{
+ Image *new= image_alloc(ima->id.name+2, ima->source, ima->type);
+
+ BLI_strncpy(new->name, ima->name, sizeof(ima->name));
+
+ new->gen_x= ima->gen_x;
+ new->gen_y= ima->gen_y;
+ new->gen_type= ima->gen_type;
+
+ return new;
+}
+
+void BKE_image_merge(Image *dest, Image *source)
+{
+ ImBuf *ibuf;
+
+ while((ibuf= source->ibufs.first)) {
+ BLI_remlink(&source->ibufs, ibuf);
+ image_assign_ibuf(dest, ibuf, IMA_INDEX_PASS(ibuf->index), IMA_INDEX_FRAME(ibuf->index));
+ }
+
+ free_libblock(&G.main->image, source);
+}
+
+
/* checks if image was already loaded, then returns same image */
/* otherwise creates new. */
/* does not load ibuf itself */
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 9fef1c657ca..6d3632d1975 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -109,11 +109,83 @@ void free_ipo (Ipo *ipo)
BLI_freelinkN(&ipo->curve, icu);
}
- printf("Freed %d (Unconverted) Ipo-Curves from IPO '%s' \n", n, ipo->id.name+2);
+ if (G.f & G_DEBUG)
+ printf("Freed %d (Unconverted) Ipo-Curves from IPO '%s' \n", n, ipo->id.name+2);
}
/* *************************************************** */
-/* ADRCODE to RNA-Path Conversion Code */
+/* ADRCODE to RNA-Path Conversion Code - Special (Bitflags) */
+
+/* Mapping Table for bitflag <-> RNA path */
+typedef struct AdrBit2Path {
+ int bit;
+ char *path;
+ int array_index;
+} AdrBit2Path;
+
+/* ----------------- */
+/* Mapping Tables to use bits <-> RNA paths */
+
+/* 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}
+};
+
+/* ----------------- */
+
+/* This function checks if a Blocktype+Adrcode combo, returning a mapping table */
+static AdrBit2Path *adrcode_bitmaps_to_paths (int blocktype, int adrcode, int *tot)
+{
+ /* Object layers */
+ if ((blocktype == ID_OB) && (adrcode == OB_LAY)) {
+ *tot= sizeof(ob_layer_bits)/sizeof(AdrBit2Path);
+ return ob_layer_bits;
+ }
+ else if ((blocktype == ID_MA) && (adrcode == MA_MODE)) {
+ // XXX to be added...
+ }
+ // XXX TODO: add other types...
+
+ /* Normal curve */
+ return NULL;
+}
+
+/* This function makes a copy of a path stored in AdrBit2Path entry, and makes a guardedalloc copy */
+static char *adrcode_bitmap_path_copy (const char *abp_path)
+{
+ char *path;
+ int len;
+
+ /* copy the path */
+ len= strlen(abp_path) + 1; // XXX is this safe?
+ path= MEM_callocN(len, "Bitflag IPO-Curve RNA-Path");
+ memcpy(path, abp_path, len);
+
+ return path;
+}
+
+/* *************************************************** */
+/* ADRCODE to RNA-Path Conversion Code - Standard */
/* Object types */
static char *ob_adrcodes_to_paths (int adrcode, int *array_index)
@@ -163,10 +235,6 @@ static char *ob_adrcodes_to_paths (int adrcode, int *array_index)
*array_index= 2; return "delta_scale";
#if 0
- case OB_LAY: // XXX EVIL BITFLAG ALERT! this one will need special attention...
- // poin= &(ob->lay); *type= IPO_INT_BIT; break;
- return NULL;
-
case OB_COL_R:
poin= &(ob->col[0]); break;
case OB_COL_G:
@@ -250,6 +318,23 @@ static char *pchan_adrcodes_to_paths (int adrcode, int *array_index)
return NULL;
}
+/* Constraint types */
+static char *constraint_adrcodes_to_paths (int adrcode, int *array_index)
+{
+ /* set array index like this in-case nothing sets it correctly */
+ *array_index= 0;
+
+ /* result depends on adrcode */
+ switch (adrcode) {
+ case CO_ENFORCE:
+ return "influence";
+ case CO_HEADTAIL: // XXX this needs to be wrapped in RNA.. probably then this path will be invalid
+ return "data.head_tail";
+ }
+
+ return NULL;
+}
+
/* ShapeKey types
* NOTE: as we don't have access to the keyblock where the data comes from (for now),
* we'll just use numerical indicies for now...
@@ -260,7 +345,10 @@ static char *shapekey_adrcodes_to_paths (int adrcode, int *array_index)
/* block will be attached to ID_KE block, and setting that we alter is the 'value' (which sets keyblock.curval) */
// XXX adrcode 0 was dummy 'speed' curve
- sprintf(buf, "keys[%d].value", adrcode-1); // XXX this doesn't seem too safe...
+ if (adrcode == 0)
+ sprintf(buf, "speed");
+ else
+ sprintf(buf, "keys[%d].value", adrcode);
return buf;
}
@@ -397,8 +485,6 @@ static char *material_adrcodes_to_paths (int adrcode, int *array_index)
poin= &(ma->spectra); break;
case MA_IOR:
poin= &(ma->ang); break;
- case MA_MODE:
- poin= &(ma->mode); *type= IPO_INT_BIT; break; // evil... dumping bitflags directly to user!
case MA_HASIZE:
poin= &(ma->hasize); break;
case MA_TRANSLU:
@@ -482,6 +568,71 @@ static char *camera_adrcodes_to_paths (int adrcode, int *array_index)
return NULL;
}
+/* Lamp Types */
+static char *lamp_adrcodes_to_paths (int adrcode, int *array_index)
+{
+ /* set array index like this in-case nothing sets it correctly */
+ *array_index= 0;
+
+ /* result depends on adrcode */
+ switch (adrcode) {
+ case LA_ENERGY:
+ return "energy";
+
+ case LA_COL_R:
+ *array_index= 0; return "color";
+ case LA_COL_G:
+ *array_index= 1; return "color";
+ case LA_COL_B:
+ *array_index= 2; return "color";
+
+ case LA_DIST:
+ return "distance";
+
+ case LA_SPOTSI:
+ return "spot_size";
+ case LA_SPOTBL:
+ return "spot_blend";
+
+ case LA_QUAD1:
+ return "linear_attenuation";
+ case LA_QUAD2:
+ return "quadratic_attenuation";
+
+ case LA_HALOINT:
+ return "halo_intensity";
+ }
+
+#if 0 // XXX to be converted
+ if (poin == NULL) {
+ if (icu->adrcode & MA_MAP1) mtex= la->mtex[0];
+ else if (icu->adrcode & MA_MAP2) mtex= la->mtex[1];
+ else if (icu->adrcode & MA_MAP3) mtex= la->mtex[2];
+ else if (icu->adrcode & MA_MAP4) mtex= la->mtex[3];
+ else if (icu->adrcode & MA_MAP5) mtex= la->mtex[4];
+ else if (icu->adrcode & MA_MAP6) mtex= la->mtex[5];
+ else if (icu->adrcode & MA_MAP7) mtex= la->mtex[6];
+ else if (icu->adrcode & MA_MAP8) mtex= la->mtex[7];
+ else if (icu->adrcode & MA_MAP9) mtex= la->mtex[8];
+ else if (icu->adrcode & MA_MAP10) mtex= la->mtex[9];
+ else if (icu->adrcode & MA_MAP11) mtex= la->mtex[10];
+ else if (icu->adrcode & MA_MAP12) mtex= la->mtex[11];
+ else if (icu->adrcode & MA_MAP13) mtex= la->mtex[12];
+ else if (icu->adrcode & MA_MAP14) mtex= la->mtex[13];
+ else if (icu->adrcode & MA_MAP15) mtex= la->mtex[14];
+ else if (icu->adrcode & MA_MAP16) mtex= la->mtex[15];
+ else if (icu->adrcode & MA_MAP17) mtex= la->mtex[16];
+ else if (icu->adrcode & MA_MAP18) mtex= la->mtex[17];
+
+ if (mtex)
+ poin= give_mtex_poin(mtex, (icu->adrcode & (MA_MAP1-1)));
+ }
+#endif // XXX to be converted
+
+ /* unrecognised adrcode, or not-yet-handled ones! */
+ return NULL;
+}
+
/* ------- */
/* Allocate memory for RNA-path for some property given a blocktype, adrcode, and 'root' parts of path
@@ -513,6 +664,10 @@ char *get_rna_access (int blocktype, int adrcode, char actname[], char constname
propname= shapekey_adrcodes_to_paths(adrcode, &dummy_index);
break;
+ case ID_CO: /* constraint */
+ propname= constraint_adrcodes_to_paths(adrcode, &dummy_index);
+ break;
+
case ID_TE: /* texture */
propname= texture_adrcodes_to_paths(adrcode, &dummy_index);
break;
@@ -525,6 +680,10 @@ char *get_rna_access (int blocktype, int adrcode, char actname[], char constname
propname= camera_adrcodes_to_paths(adrcode, &dummy_index);
break;
+ case ID_LA: /* lamp */
+ propname= lamp_adrcodes_to_paths(adrcode, &dummy_index);
+ break;
+
/* XXX problematic blocktypes */
case ID_CU: /* curve */
propname= "speed"; // XXX this was a 'dummy curve' that didn't really correspond to any real var...
@@ -620,6 +779,7 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
if (idriver->blocktype == ID_AR) {
/* ID_PO */
if (idriver->adrcode == OB_ROT_DIFF) {
+ if (G.f & G_DEBUG) printf("idriver_to_cdriver - rotdiff %p \n", idriver->ob);
/* Rotational Difference is a special type of driver now... */
cdriver->type= DRIVER_TYPE_ROTDIFF;
@@ -637,6 +797,7 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
cdriver->rna_path2= get_rna_access(-1, -1, idriver->name+DRIVER_NAME_OFFS, NULL, NULL);
}
else {
+ if (G.f & G_DEBUG) printf("idriver_to_cdriver - arm %p \n", idriver->ob);
/* 'standard' driver */
cdriver->type= DRIVER_TYPE_CHANNEL;
cdriver->id= (ID *)idriver->ob;
@@ -677,12 +838,15 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
}
else {
/* ID_OB */
+ if (G.f & G_DEBUG) printf("idriver_to_cdriver - ob %p \n", idriver->ob);
cdriver->type= DRIVER_TYPE_CHANNEL;
cdriver->id= (ID *)idriver->ob;
- cdriver->rna_path= get_rna_access(ID_OB, idriver->adrcode, idriver->name, NULL, &cdriver->array_index);
+ cdriver->rna_path= get_rna_access(ID_OB, idriver->adrcode, NULL, NULL, &cdriver->array_index);
}
}
+ if (G.f & G_DEBUG) printf("\tcdriver -> id = %p \n", cdriver->id);
+
/* free old driver */
MEM_freeN(idriver);
@@ -695,10 +859,11 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
* actname: name of Action-Channel (if applicable) that IPO-Curve's IPO-block belonged to
* constname: name of Constraint-Channel (if applicable) that IPO-Curve's IPO-block belonged to
*/
-static FCurve *icu_to_fcu (IpoCurve *icu, char *actname, char *constname)
+static void icu_to_fcurves (ListBase *list, IpoCurve *icu, char *actname, char *constname)
{
+ AdrBit2Path *abp;
FCurve *fcu;
- int i= 0;
+ int i=0, totbits;
/* allocate memory for a new F-Curve */
fcu= MEM_callocN(sizeof(FCurve), "FCurve");
@@ -709,56 +874,6 @@ static FCurve *icu_to_fcu (IpoCurve *icu, char *actname, char *constname)
icu->driver= NULL;
}
- /* convert keyframes
- * - beztriples and bpoints are mutually exclusive, so we won't have both at the same time
- * - beztriples are more likely to be encountered as they are keyframes (the other type wasn't used yet)
- */
- // XXX we need to cope with the nasty old 'bitflag' curves... that will be a task for later
- // XXX we also need to correct values for object-rotation curves
- fcu->totvert= icu->totvert;
-
- if (icu->bezt) {
- BezTriple *dst, *src;
-
- /* allocate new array for keyframes/beztriples */
- 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++) {
- /* firstly, copy BezTriple data */
- *dst= *src;
-
- /* now copy interpolation from curve (if not already set) */
- if (icu->ipo != IPO_MIXED)
- dst->ipo= icu->ipo;
-
- /* correct values for object rotation curves - they were degrees/10 */
- // XXX for now, just make them into radians as RNA sets/reads directly in that form
- if ((icu->blocktype == ID_OB) && ELEM3(icu->adrcode, OB_ROT_X, OB_ROT_Y, OB_ROT_Z)) {
- const float fac= M_PI / 18.0f; //10.0f * M_PI/180.0f;
-
- dst->vec[0][1] *= fac;
- dst->vec[1][1] *= fac;
- dst->vec[2][1] *= fac;
- }
- }
-
- /* free this data now */
- MEM_freeN(icu->bezt);
- }
- else if (icu->bp) {
- /* TODO: need to convert from BPoint type to the more compact FPoint type... but not priority, since no data used this */
- //BPoint *bp;
- //FPoint *fpt;
- }
-
- /* get rna-path
- * - we will need to set the 'disabled' flag if no path is able to be made (for now)
- */
- fcu->rna_path= get_rna_access(icu->blocktype, icu->adrcode, actname, constname, &fcu->array_index);
- if (fcu->rna_path == NULL)
- fcu->flag |= FCURVE_DISABLED;
-
/* copy flags */
if (icu->flag & IPO_VISIBLE) fcu->flag |= FCURVE_VISIBLE;
if (icu->flag & IPO_SELECT) fcu->flag |= FCURVE_SELECTED;
@@ -795,33 +910,147 @@ static FCurve *icu_to_fcu (IpoCurve *icu, char *actname, char *constname)
break;
}
- /* return new F-Curve */
- return fcu;
+ /* -------- */
+
+ /* get adrcode <-> bitflags mapping to handle nasty bitflag curves? */
+ abp= adrcode_bitmaps_to_paths(icu->blocktype, icu->adrcode, &totbits);
+ if (abp && totbits) {
+ FCurve *fcurve;
+ int b;
+
+ if (G.f & G_DEBUG) printf("\tconvert bitflag ipocurve, totbits = %d \n", totbits);
+
+ /* add the 'only int values' flag */
+ fcu->flag |= FCURVE_INT_VALUES;
+
+ /* for each bit we have to remap + check for:
+ * 1) we need to make copy the existing F-Curve data (fcu -> fcurve),
+ * except for the last one which will use the original
+ * 2) copy the relevant path info across
+ * 3) filter the keyframes for the flag of interest
+ */
+ for (b=0; b < totbits; b++, abp++) {
+ /* make a copy of existing base-data if not the last curve */
+ if (b < (totbits-1))
+ fcurve= copy_fcurve(fcu);
+ else
+ fcurve= fcu;
+
+ /* set path */
+ fcurve->rna_path= MEM_dupallocN(abp->path);
+ fcurve->array_index= abp->array_index;
+
+ /* convert keyframes
+ * - beztriples and bpoints are mutually exclusive, so we won't have both at the same time
+ * - beztriples are more likely to be encountered as they are keyframes (the other type wasn't used yet)
+ */
+ fcurve->totvert= icu->totvert;
+
+ if (icu->bezt) {
+ BezTriple *dst, *src;
+
+ /* allocate new array for keyframes/beztriples */
+ 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++) {
+ /* firstly, copy BezTriple data */
+ *dst= *src;
+
+ /* interpolation can only be constant... */
+ dst->ipo= BEZT_IPO_CONST;
+
+ /* correct values, by checking if the flag of interest is set */
+ if ( ((int)(dst->vec[1][1])) & (abp->bit) )
+ dst->vec[0][1]= dst->vec[1][1]= dst->vec[2][1] = 1.0f;
+ else
+ dst->vec[0][1]= dst->vec[1][1]= dst->vec[2][1] = 0.0f;
+ }
+ }
+ else if (icu->bp) {
+ /* TODO: need to convert from BPoint type to the more compact FPoint type... but not priority, since no data used this */
+ //BPoint *bp;
+ //FPoint *fpt;
+ }
+
+ /* add new F-Curve to list */
+ BLI_addtail(list, fcurve);
+ }
+
+ /* free old data of curve now that it's no longer needed for converting any more curves */
+ if (icu->bezt) MEM_freeN(icu->bezt);
+ if (icu->bp) MEM_freeN(icu->bezt);
+ }
+ else {
+ /* get rna-path
+ * - we will need to set the 'disabled' flag if no path is able to be made (for now)
+ */
+ fcu->rna_path= get_rna_access(icu->blocktype, icu->adrcode, actname, constname, &fcu->array_index);
+ if (fcu->rna_path == NULL)
+ fcu->flag |= FCURVE_DISABLED;
+
+ /* convert keyframes
+ * - beztriples and bpoints are mutually exclusive, so we won't have both at the same time
+ * - beztriples are more likely to be encountered as they are keyframes (the other type wasn't used yet)
+ */
+ fcu->totvert= icu->totvert;
+
+ if (icu->bezt) {
+ BezTriple *dst, *src;
+
+ /* allocate new array for keyframes/beztriples */
+ 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++) {
+ /* firstly, copy BezTriple data */
+ *dst= *src;
+
+ /* now copy interpolation from curve (if not already set) */
+ if (icu->ipo != IPO_MIXED)
+ dst->ipo= icu->ipo;
+
+ /* correct values for object rotation curves - they were degrees/10 */
+ // XXX for now, just make them into radians as RNA sets/reads directly in that form
+ if ((icu->blocktype == ID_OB) && ELEM3(icu->adrcode, OB_ROT_X, OB_ROT_Y, OB_ROT_Z)) {
+ const float fac= (float)M_PI / 18.0f; //10.0f * M_PI/180.0f;
+
+ dst->vec[0][1] *= fac;
+ dst->vec[1][1] *= fac;
+ dst->vec[2][1] *= fac;
+ }
+ }
+
+ /* free this data now */
+ MEM_freeN(icu->bezt);
+ }
+ else if (icu->bp) {
+ /* TODO: need to convert from BPoint type to the more compact FPoint type... but not priority, since no data used this */
+ //BPoint *bp;
+ //FPoint *fpt;
+ }
+
+ /* add new F-Curve to list */
+ BLI_addtail(list, fcu);
+ }
}
-/* Convert IPO-block (i.e. all its IpoCurves) for some ID to the new system
- * This assumes that AnimData has been added already. Separation of drivers
- * from animation data is accomplished here too...
+/* ------------------------- */
+
+/* Convert IPO-block (i.e. all its IpoCurves) to the new system.
+ * This does not assume that any ID or AnimData uses it, but does assume that
+ * it is given two lists, which it will perform driver/animation-data separation.
*/
-static void ipo_to_animdata (ID *id, Ipo *ipo, char *actname, char *constname)
+static void ipo_to_animato (Ipo *ipo, char actname[], char constname[], ListBase *anim, ListBase *drivers)
{
- AnimData *adt= BKE_animdata_from_id(id);
- //bActionGroup *grp;
IpoCurve *icu, *icn;
- FCurve *fcu;
/* sanity check */
- if ELEM(NULL, id, ipo)
- return;
- if (adt == NULL) {
- printf("ERROR ipo_to_animdata(): adt invalid \n");
+ if (ELEM3(NULL, ipo, anim, drivers))
return;
- }
-
- printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s curves:%d \n",
- id->name+2, ipo->id.name+2, (actname)?actname:"<None>", (constname)?constname:"<None>",
- BLI_countlist(&ipo->curve));
-
+
+ if (G.f & G_DEBUG) printf("ipo_to_animato \n");
+
/* validate actname and constname
* - clear actname if it was one of the generic <builtin> ones (i.e. 'Object', or 'Shapes')
* - actname can then be used to assign F-Curves in Action to Action Groups
@@ -829,10 +1058,9 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char *actname, char *constname)
* F-Curves for bones). This may be added later... for now let's just dump without them...
*/
if (actname) {
- printf("actname != 0 \n");
- if ((GS(id->name) == ID_OB) && (strcmp(actname, "Object") == 0))
+ if ((ipo->blocktype == ID_OB) && (strcmp(actname, "Object") == 0))
actname= NULL;
- else if ((GS(id->name) == ID_OB) && (strcmp(actname, "Shape") == 0))
+ else if ((ipo->blocktype == ID_OB) && (strcmp(actname, "Shape") == 0))
actname= NULL;
}
@@ -841,59 +1069,38 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char *actname, char *constname)
/* get link to next (for later) */
icn= icu->next;
- /* convert IPO-Curve to F-Curve
- * NOTE: this frees any of the old data stored in the IPO-Curve that isn't needed anymore...
+ /* Since an IPO-Curve may end up being made into many F-Curves (i.e. bitflag curves),
+ * we figure out the best place to put the channel, then tell the curve-converter to just dump there
*/
- // XXX we need to cope with the nasty old 'bitflag' curves... that will be a task for later
- // we will need to create a few new curves when doing so, and will need to sift through the keyframes to add relevant data
- fcu= icu_to_fcu(icu, actname, constname);
-
- /* conversion path depends on whether it's a driver or not */
- if (fcu->driver == NULL) {
- /* try to get action */
- if (adt->action == NULL) {
- adt->action= add_empty_action("ConvertedAction"); // XXX we need a better name for this...
- printf("added new action \n");
- }
-
- /* add F-Curve to action */
- BLI_addtail(&adt->action->curves, fcu);
- }
- else {
- /* add F-Curve to AnimData's drivers */
- BLI_addtail(&adt->drivers, fcu);
- }
+ if (icu->driver)
+ icu_to_fcurves(drivers, icu, actname, constname);
+ else
+ icu_to_fcurves(anim, icu, actname, constname);
/* free this IpoCurve now that it's been converted */
BLI_freelinkN(&ipo->curve, icu);
}
}
-/* Convert Action-block to new system
+/* Convert Action-block to new system, separating animation and drivers
+ * New curves may not be converted directly into the given Action (i.e. for Actions linked
+ * to Objects, where ob->ipo and ob->action need to be combined).
* NOTE: we need to be careful here, as same data-structs are used for new system too!
*/
-static void action_to_animdata (ID *id, bAction *act)
+static void action_to_animato (bAction *act, ListBase *curves, ListBase *drivers)
{
- AnimData *adt= BKE_animdata_from_id(id);
bActionChannel *achan, *achann;
bConstraintChannel *conchan, *conchann;
/* only continue if there are Action Channels (indicating unconverted data) */
- if (ELEM(NULL, adt, act->chanbase.first))
+ if (act->chanbase.first == NULL)
return;
/* get rid of all Action Groups */
- // XXX this is risky if there's some old, some new data in the Action...
+ // XXX this is risky if there's some old + some new data in the Action...
if (act->groups.first)
BLI_freelistN(&act->groups);
-
- /* check if we need to set this Action as the AnimData's action */
- if (adt->action == NULL) {
- /* set this Action as AnimData's Action */
- printf("act_to_adt - set adt action to act \n");
- adt->action= act;
- }
-
+
/* loop through Action-Channels, converting data, freeing as we go */
for (achan= act->chanbase.first; achan; achan= achann) {
/* get pointer to next Action Channel */
@@ -901,7 +1108,7 @@ static void action_to_animdata (ID *id, bAction *act)
/* convert Action Channel's IPO data */
if (achan->ipo) {
- ipo_to_animdata(id, achan->ipo, achan->name, NULL);
+ ipo_to_animato(achan->ipo, achan->name, NULL, curves, drivers);
achan->ipo->id.us--;
achan->ipo= NULL;
}
@@ -913,7 +1120,7 @@ static void action_to_animdata (ID *id, bAction *act)
/* convert Constraint Channel's IPO data */
if (conchan->ipo) {
- ipo_to_animdata(id, conchan->ipo, achan->name, conchan->name);
+ ipo_to_animato(conchan->ipo, achan->name, conchan->name, curves, drivers);
conchan->ipo->id.us--;
conchan->ipo= NULL;
}
@@ -927,6 +1134,81 @@ static void action_to_animdata (ID *id, bAction *act)
}
}
+
+/* ------------------------- */
+
+/* Convert IPO-block (i.e. all its IpoCurves) for some ID to the new system
+ * This assumes that AnimData has been added already. Separation of drivers
+ * from animation data is accomplished here too...
+ */
+static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[])
+{
+ AnimData *adt= BKE_animdata_from_id(id);
+ ListBase anim = {NULL, NULL};
+ ListBase drivers = {NULL, NULL};
+
+ /* sanity check */
+ if ELEM(NULL, id, ipo)
+ return;
+ if (adt == NULL) {
+ printf("ERROR ipo_to_animdata(): adt invalid \n");
+ return;
+ }
+
+ if (G.f & G_DEBUG) {
+ printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s curves:%d \n",
+ id->name+2, ipo->id.name+2, (actname)?actname:"<None>", (constname)?constname:"<None>",
+ BLI_countlist(&ipo->curve));
+ }
+
+ /* Convert curves to animato system (separated into separate lists of F-Curves for animation and drivers),
+ * and the try to put these lists in the right places, but do not free the lists here
+ */
+ ipo_to_animato(ipo, actname, constname, &anim, &drivers);
+
+ /* deal with animation first */
+ if (anim.first) {
+ if (G.f & G_DEBUG) printf("\thas anim \n");
+ /* try to get action */
+ if (adt->action == NULL) {
+ adt->action= add_empty_action("ConvData_Action"); // XXX we need a better name for this
+ if (G.f & G_DEBUG) printf("\t\tadded new action \n");
+ }
+
+ /* add F-Curves to action */
+ addlisttolist(&adt->action->curves, &anim);
+ }
+
+ /* deal with drivers */
+ if (drivers.first) {
+ if (G.f & G_DEBUG) printf("\thas drivers \n");
+ /* add drivers to end of driver stack */
+ addlisttolist(&adt->drivers, &drivers);
+ }
+}
+
+/* Convert Action-block to new system
+ * NOTE: we need to be careful here, as same data-structs are used for new system too!
+ */
+static void action_to_animdata (ID *id, bAction *act)
+{
+ AnimData *adt= BKE_animdata_from_id(id);
+
+ /* only continue if there are Action Channels (indicating unconverted data) */
+ if (ELEM(NULL, adt, act->chanbase.first))
+ return;
+
+ /* check if we need to set this Action as the AnimData's action */
+ if (adt->action == NULL) {
+ /* set this Action as AnimData's Action */
+ if (G.f & G_DEBUG) printf("act_to_adt - set adt action to act \n");
+ adt->action= act;
+ }
+
+ /* convert Action data */
+ action_to_animato(act, &adt->action->curves, &adt->drivers);
+}
+
/* *************************************************** */
/* External API - Only Called from do_versions() */
@@ -943,6 +1225,7 @@ static void action_to_animdata (ID *id, bAction *act)
// XXX currently done after all file reading...
void do_versions_ipos_to_animato(Main *main)
{
+ ListBase drivers = {NULL, NULL};
ID *id;
AnimData *adt;
@@ -960,6 +1243,7 @@ void do_versions_ipos_to_animato(Main *main)
else
printf("INFO: Converting to Animato... \n"); // xxx debug
+ /* ----------- Animation Attached to Data -------------- */
/* objects */
for (id= main->object.first; id; id= id->next) {
@@ -968,7 +1252,7 @@ void do_versions_ipos_to_animato(Main *main)
bConstraint *con;
bConstraintChannel *conchan, *conchann;
- printf("\tconverting ob %s \n", id->name+2);
+ if (G.f & G_DEBUG) printf("\tconverting ob %s \n", id->name+2);
/* check if object has any animation data */
if ((ob->ipo) || (ob->action) || (ob->nlastrips.first)) {
@@ -1012,9 +1296,6 @@ void do_versions_ipos_to_animato(Main *main)
con->ipo->id.us--;
con->ipo= NULL;
}
-
- /* check for Action Constraint */
- // XXX do we really want to do this here?
}
}
}
@@ -1058,7 +1339,7 @@ void do_versions_ipos_to_animato(Main *main)
for (id= main->key.first; id; id= id->next) {
Key *key= (Key *)id;
- printf("\tconverting key %s \n", id->name+2);
+ if (G.f & G_DEBUG) printf("\tconverting key %s \n", id->name+2);
/* we're only interested in the IPO
* NOTE: for later, it might be good to port these over to Object instead, as many of these
@@ -1079,7 +1360,7 @@ void do_versions_ipos_to_animato(Main *main)
for (id= main->mat.first; id; id= id->next) {
Material *ma= (Material *)id;
- printf("\tconverting material %s \n", id->name+2);
+ if (G.f & G_DEBUG) printf("\tconverting material %s \n", id->name+2);
/* we're only interested in the IPO */
if (ma->ipo) {
@@ -1097,7 +1378,7 @@ void do_versions_ipos_to_animato(Main *main)
for (id= main->tex.first; id; id= id->next) {
Tex *te= (Tex *)id;
- printf("\tconverting texture %s \n", id->name+2);
+ if (G.f & G_DEBUG) printf("\tconverting texture %s \n", id->name+2);
/* we're only interested in the IPO */
if (te->ipo) {
@@ -1115,7 +1396,7 @@ void do_versions_ipos_to_animato(Main *main)
for (id= main->camera.first; id; id= id->next) {
Camera *ca= (Camera *)id;
- printf("\tconverting camera %s \n", id->name+2);
+ if (G.f & G_DEBUG) printf("\tconverting camera %s \n", id->name+2);
/* we're only interested in the IPO */
if (ca->ipo) {
@@ -1129,7 +1410,67 @@ void do_versions_ipos_to_animato(Main *main)
}
}
- // XXX add other types too...
+ /* lamps */
+ for (id= main->lamp.first; id; id= id->next) {
+ Lamp *la= (Lamp *)id;
+
+ if (G.f & G_DEBUG) printf("\tconverting lamp %s \n", id->name+2);
+
+ /* we're only interested in the IPO */
+ if (la->ipo) {
+ /* Add AnimData block */
+ adt= BKE_id_add_animdata(id);
+
+ /* Convert Lamp data... */
+ ipo_to_animdata(id, la->ipo, NULL, NULL);
+ la->ipo->id.us--;
+ la->ipo= NULL;
+ }
+ }
+
+ /* --------- Unconverted Animation Data ------------------ */
+ /* For Animation data which may not be directly connected (i.e. not linked) to any other
+ * data, we need to perform a separate pass to make sure that they are converted to standalone
+ * Actions which may then be able to be reused. This does mean that we will be going over data that's
+ * already been converted, but there are no problems with that.
+ *
+ * The most common case for this will be Action Constraints, or IPO's with Fake-Users.
+ * We collect all drivers that were found into a temporary collection, and free them in one go, as they're
+ * impossible to resolve.
+ */
+
+ /* actions */
+ for (id= main->action.first; id; id= id->next) {
+ bAction *act= (bAction *)id;
+
+ if (G.f & G_DEBUG) printf("\tconverting action %s \n", id->name+2);
+
+ /* be careful! some of the actions we encounter will be converted ones... */
+ action_to_animato(act, &act->curves, &drivers);
+ }
+
+ /* ipo's */
+ for (id= main->ipo.first; id; id= id->next) {
+ Ipo *ipo= (Ipo *)id;
+
+ if (G.f & G_DEBUG) printf("\tconverting ipo %s \n", id->name+2);
+
+ /* most likely this IPO has already been processed, so check if any curves left to convert */
+ if (ipo->curve.first) {
+ bAction *new_act;
+
+ /* add a new action for this, and convert all data into that action */
+ new_act= add_empty_action("ConvIPO_Action"); // XXX need a better name...
+ ipo_to_animato(ipo, NULL, NULL, &new_act->curves, &drivers);
+ }
+
+ /* clear fake-users, and set user-count to zero to make sure it is cleared on file-save */
+ ipo->id.us= 0;
+ ipo->id.flag &= ~LIB_FAKEUSER;
+ }
+
+ /* free unused drivers from actions + ipos */
+ free_fcurves(&drivers);
printf("INFO: animato convert done \n"); // xxx debug
}
@@ -1281,58 +1622,6 @@ void *get_ipo_poin (ID *id, IpoCurve *icu, int *type)
}
}
break;
- case ID_LA: /* lamp channels ----------------------------- */
- {
- Lamp *la= (Lamp *)id;
-
- switch (icu->adrcode) {
- case LA_ENERGY:
- poin= &(la->energy); break;
- case LA_COL_R:
- poin= &(la->r); break;
- case LA_COL_G:
- poin= &(la->g); break;
- case LA_COL_B:
- poin= &(la->b); break;
- case LA_DIST:
- poin= &(la->dist); break;
- case LA_SPOTSI:
- poin= &(la->spotsize); break;
- case LA_SPOTBL:
- poin= &(la->spotblend); break;
- case LA_QUAD1:
- poin= &(la->att1); break;
- case LA_QUAD2:
- poin= &(la->att2); break;
- case LA_HALOINT:
- poin= &(la->haint); break;
- }
-
- if (poin == NULL) {
- if (icu->adrcode & MA_MAP1) mtex= la->mtex[0];
- else if (icu->adrcode & MA_MAP2) mtex= la->mtex[1];
- else if (icu->adrcode & MA_MAP3) mtex= la->mtex[2];
- else if (icu->adrcode & MA_MAP4) mtex= la->mtex[3];
- else if (icu->adrcode & MA_MAP5) mtex= la->mtex[4];
- else if (icu->adrcode & MA_MAP6) mtex= la->mtex[5];
- else if (icu->adrcode & MA_MAP7) mtex= la->mtex[6];
- else if (icu->adrcode & MA_MAP8) mtex= la->mtex[7];
- else if (icu->adrcode & MA_MAP9) mtex= la->mtex[8];
- else if (icu->adrcode & MA_MAP10) mtex= la->mtex[9];
- else if (icu->adrcode & MA_MAP11) mtex= la->mtex[10];
- else if (icu->adrcode & MA_MAP12) mtex= la->mtex[11];
- else if (icu->adrcode & MA_MAP13) mtex= la->mtex[12];
- else if (icu->adrcode & MA_MAP14) mtex= la->mtex[13];
- else if (icu->adrcode & MA_MAP15) mtex= la->mtex[14];
- else if (icu->adrcode & MA_MAP16) mtex= la->mtex[15];
- else if (icu->adrcode & MA_MAP17) mtex= la->mtex[16];
- else if (icu->adrcode & MA_MAP18) mtex= la->mtex[17];
-
- if (mtex)
- poin= give_mtex_poin(mtex, (icu->adrcode & (MA_MAP1-1)));
- }
- }
- break;
case ID_SO: /* sound channels ----------------------------- */
{
bSound *snd= (bSound *)id;
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 27f91c2f2ae..595ba37e09c 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -646,7 +646,7 @@ void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, int mode
if(key->from==NULL) return;
- printf("do_rel_key() \n");
+ if (G.f & G_DEBUG) printf("do_rel_key() \n");
if( GS(key->from->name)==ID_ME ) {
ofs[0]= sizeof(MVert);
@@ -683,14 +683,14 @@ void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, int mode
if(kb!=key->refkey) {
float icuval= kb->curval;
- printf("\tdo rel key %s : %s = %f \n", key->id.name+2, kb->name, icuval);
+ if (G.f & G_DEBUG) printf("\tdo rel key %s : %s = %f \n", key->id.name+2, kb->name, icuval);
/* only with value, and no difference allowed */
if(!(kb->flag & KEYBLOCK_MUTE) && icuval!=0.0f && kb->totelem==tot) {
KeyBlock *refb;
float weight, *weights= kb->weights;
- printf("\t\tnot skipped \n");
+ if (G.f & G_DEBUG) printf("\t\tnot skipped \n");
poin= basispoin;
from= kb->data;
@@ -762,7 +762,7 @@ static void do_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *
if(key->from==0) return;
- printf("do_key() \n");
+ if (G.f & G_DEBUG) printf("do_key() \n");
if( GS(key->from->name)==ID_ME ) {
ofs[0]= sizeof(MVert);
@@ -1024,10 +1024,10 @@ static int do_mesh_key(Scene *scene, Object *ob, Mesh *me)
/* prevent python from screwing this up? anyhoo, the from pointer could be dropped */
me->key->from= (ID *)me;
- printf("do mesh key ob:%s me:%s ke:%s \n", ob->id.name+2, me->id.name+2, me->key->id.name+2);
+ if (G.f & G_DEBUG) printf("do mesh key ob:%s me:%s ke:%s \n", ob->id.name+2, me->id.name+2, me->key->id.name+2);
if(me->key->slurph && me->key->type!=KEY_RELATIVE ) {
- printf("\tslurph key\n");
+ if (G.f & G_DEBUG) printf("\tslurph key\n");
delta= me->key->slurph;
delta/= me->totvert;
@@ -1039,7 +1039,7 @@ static int do_mesh_key(Scene *scene, Object *ob, Mesh *me)
/* in do_key and cp_key the case a>tot is handled */
}
- cfra= scene->r.cfra;
+ cfra= (float)scene->r.cfra;
for(a=0; a<me->totvert; a+=step, cfra+= delta) {
@@ -1071,7 +1071,7 @@ static int do_mesh_key(Scene *scene, Object *ob, Mesh *me)
if(me->key->type==KEY_RELATIVE) {
KeyBlock *kb;
- printf("\tdo relative \n");
+ if (G.f & G_DEBUG) printf("\tdo relative \n");
for(kb= me->key->block.first; kb; kb= kb->next)
kb->weights= get_weights_array(ob, kb->vgroup);
@@ -1084,9 +1084,9 @@ static int do_mesh_key(Scene *scene, Object *ob, Mesh *me)
}
}
else {
- printf("\tdo absolute \n");
+ if (G.f & G_DEBUG) printf("\tdo absolute \n");
- ctime= bsystem_time(scene, ob, scene->r.cfra, 0.0); // xxx old cruft
+ ctime= bsystem_time(scene, ob, (float)scene->r.cfra, 0.0f); // xxx old cruft
#if 0 // XXX old animation system
if(calc_ipo_spec(me->key->ipo, KEY_SPEED, &ctime)==0) {
@@ -1207,10 +1207,10 @@ static int do_curve_key(Scene *scene, Curve *cu)
/* in do_key and cp_key the case a>tot has been handled */
}
- cfra= scene->r.cfra;
+ cfra= (float)scene->r.cfra;
for(a=0; a<tot; a+=step, cfra+= delta) {
- ctime= bsystem_time(scene, 0, cfra, 0.0); // XXX old cruft
+ ctime= bsystem_time(scene, 0, cfra, 0.0f); // XXX old cruft
#if 0 // XXX old animation system
if(calc_ipo_spec(cu->key->ipo, KEY_SPEED, &ctime)==0) {
ctime /= 100.0;
@@ -1274,7 +1274,7 @@ static int do_latt_key(Scene *scene, Object *ob, Lattice *lt)
delta= lt->key->slurph;
delta/= (float)tot;
- cfra= scene->r.cfra;
+ cfra= (float)scene->r.cfra;
for(a=0; a<tot; a++, cfra+= delta) {
@@ -1346,7 +1346,7 @@ int do_ob_key(Scene *scene, Object *ob)
if(ob->shapeflag & (OB_SHAPE_LOCK|OB_SHAPE_TEMPLOCK)) {
KeyBlock *kb= BLI_findlink(&key->block, ob->shapenr-1);
- printf("ob %s, key %s locked \n", ob->id.name+2, key->id.name+2);
+ if (G.f & G_DEBUG) printf("ob %s, key %s locked \n", ob->id.name+2, key->id.name+2);
if(kb && (kb->flag & KEYBLOCK_MUTE))
kb= key->refkey;
@@ -1393,7 +1393,7 @@ int do_ob_key(Scene *scene, Object *ob)
#endif // XXX old animation system
/* do shapekey local drivers */
float ctime= (float)scene->r.cfra; // XXX this needs to be checked
- printf("ob %s - do shapekey (%s) drivers \n", ob->id.name+2, key->id.name+2);
+ if (G.f & G_DEBUG) printf("ob %s - do shapekey (%s) drivers \n", ob->id.name+2, key->id.name+2);
BKE_animsys_evaluate_animdata(&key->id, key->adt, ctime, ADT_RECALC_DRIVERS);
if(ob->type==OB_MESH) return do_mesh_key(scene, ob, ob->data);
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index b74406f3d3f..0712b53c5dd 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -83,8 +83,9 @@
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
-#include "BKE_library.h"
+#include "BKE_animsys.h"
#include "BKE_context.h"
+#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_sound.h"
@@ -401,6 +402,45 @@ void *alloc_libblock(ListBase *lb, short type, const char *name)
/* from blendef: */
#define GS(a) (*((short *)(a)))
+/* by spec, animdata is first item after ID */
+/* we still read ->adt itself, to ensure compiler warns when it doesnt exist */
+static void id_copy_animdata(ID *id)
+{
+ switch(GS(id->name)) {
+ case ID_OB:
+ ((Object *)id)->adt= BKE_copy_animdata(((Object *)id)->adt);
+ break;
+ case ID_CU:
+ ((Curve *)id)->adt= BKE_copy_animdata(((Curve *)id)->adt);
+ break;
+ case ID_CA:
+ ((Camera *)id)->adt= BKE_copy_animdata(((Camera *)id)->adt);
+ break;
+ case ID_KE:
+ ((Key *)id)->adt= BKE_copy_animdata(((Key *)id)->adt);
+ break;
+ case ID_LA:
+ ((Lamp *)id)->adt= BKE_copy_animdata(((Lamp *)id)->adt);
+ break;
+ case ID_MA:
+ ((Material *)id)->adt= BKE_copy_animdata(((Material *)id)->adt);
+ break;
+ case ID_NT:
+ ((bNodeTree *)id)->adt= BKE_copy_animdata(((bNodeTree *)id)->adt);
+ break;
+ case ID_SCE:
+ ((Scene *)id)->adt= BKE_copy_animdata(((Scene *)id)->adt);
+ break;
+ case ID_TE:
+ ((Tex *)id)->adt= BKE_copy_animdata(((Tex *)id)->adt);
+ break;
+ case ID_WO:
+ ((World *)id)->adt= BKE_copy_animdata(((World *)id)->adt);
+ break;
+ }
+
+}
+
/* used everywhere in blenkernel and text.c */
void *copy_libblock(void *rt)
{
@@ -429,6 +469,8 @@ void *copy_libblock(void *rt)
idn->flag |= LIB_NEW;
if (id->properties) idn->properties = IDP_CopyProperty(id->properties);
+ id_copy_animdata(id);
+
return idn;
}
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index e7ccb15d923..d41dda4c81e 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1158,6 +1158,104 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree, int internal_select)
return newtree;
}
+/* *************** preview *********** */
+/* if node->preview, then we assume the rect to exist */
+
+static void node_free_preview(bNode *node)
+{
+ if(node->preview) {
+ if(node->preview->rect)
+ MEM_freeN(node->preview->rect);
+ MEM_freeN(node->preview);
+ node->preview= NULL;
+ }
+}
+
+static void node_init_preview(bNode *node, int xsize, int ysize)
+{
+
+ if(node->preview==NULL) {
+ node->preview= MEM_callocN(sizeof(bNodePreview), "node preview");
+ // printf("added preview %s\n", node->name);
+ }
+
+ /* node previews can get added with variable size this way */
+ if(xsize==0 || ysize==0)
+ return;
+
+ /* sanity checks & initialize */
+ if(node->preview->rect) {
+ if(node->preview->xsize!=xsize && node->preview->ysize!=ysize) {
+ MEM_freeN(node->preview->rect);
+ node->preview->rect= NULL;
+ }
+ }
+
+ if(node->preview->rect==NULL) {
+ node->preview->rect= MEM_callocN(4*xsize + xsize*ysize*sizeof(float)*4, "node preview rect");
+ node->preview->xsize= xsize;
+ node->preview->ysize= ysize;
+ }
+}
+
+void ntreeInitPreview(bNodeTree *ntree, int xsize, int ysize)
+{
+ bNode *node;
+
+ if(ntree==NULL)
+ return;
+
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if(node->typeinfo->flag & NODE_PREVIEW) /* hrms, check for closed nodes? */
+ node_init_preview(node, xsize, ysize);
+ if(node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
+ ntreeInitPreview((bNodeTree *)node->id, xsize, ysize);
+ }
+}
+
+static void nodeClearPreview(bNode *node)
+{
+ if(node->preview && node->preview->rect)
+ memset(node->preview->rect, 0, MEM_allocN_len(node->preview->rect));
+}
+
+/* use it to enforce clear */
+void ntreeClearPreview(bNodeTree *ntree)
+{
+ bNode *node;
+
+ if(ntree==NULL)
+ return;
+
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if(node->typeinfo->flag & NODE_PREVIEW)
+ nodeClearPreview(node);
+ if(node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
+ ntreeClearPreview((bNodeTree *)node->id);
+ }
+}
+
+/* hack warning! this function is only used for shader previews, and
+since it gets called multiple times per pixel for Ztransp we only
+add the color once. Preview gets cleared before it starts render though */
+void nodeAddToPreview(bNode *node, float *col, int x, int y)
+{
+ bNodePreview *preview= node->preview;
+ if(preview) {
+ if(x>=0 && y>=0) {
+ if(x<preview->xsize && y<preview->ysize) {
+ float *tar= preview->rect+ 4*((preview->xsize*y) + x);
+ //if(tar[0]==0.0f) {
+ QUATCOPY(tar, col);
+ //}
+ }
+ //else printf("prv out bound x y %d %d\n", x, y);
+ }
+ //else printf("prv out bound x y %d %d\n", x, y);
+ }
+}
+
+
/* ************** Free stuff ********** */
/* goes over entire tree */
@@ -1215,11 +1313,8 @@ void nodeFreeNode(bNodeTree *ntree, bNode *node)
BLI_freelistN(&node->inputs);
BLI_freelistN(&node->outputs);
- if(node->preview) {
- if(node->preview->rect)
- MEM_freeN(node->preview->rect);
- MEM_freeN(node->preview);
- }
+ node_free_preview(node);
+
if(node->typeinfo && node->typeinfo->freestoragefunc) {
node->typeinfo->freestoragefunc(node);
}
@@ -1652,14 +1747,8 @@ void NodeTagChanged(bNodeTree *ntree, bNode *node)
for(sock= node->outputs.first; sock; sock= sock->next) {
if(sock->ns.data) {
- free_compbuf(sock->ns.data);
- sock->ns.data= NULL;
-
- //if(node->preview && node->preview->rect) {
- // MEM_freeN(node->preview->rect);
- // node->preview->rect= NULL;
- //}
-
+ //free_compbuf(sock->ns.data);
+ //sock->ns.data= NULL;
}
}
node->need_exec= 1;
@@ -1683,95 +1772,6 @@ void NodeTagIDChanged(bNodeTree *ntree, ID *id)
}
-/* *************** preview *********** */
-
-/* if node->preview, then we assume the rect to exist */
-
-static void nodeInitPreview(bNode *node, int xsize, int ysize)
-{
-
- if(node->preview==NULL) {
- node->preview= MEM_callocN(sizeof(bNodePreview), "node preview");
-// printf("added preview %s\n", node->name);
- }
-
- /* node previews can get added with variable size this way */
- if(xsize==0 || ysize==0)
- return;
-
- /* sanity checks & initialize */
- if(node->preview->rect) {
- if(node->preview->xsize!=xsize && node->preview->ysize!=ysize) {
- MEM_freeN(node->preview->rect);
- node->preview->rect= NULL;
- }
- }
-
- if(node->preview->rect==NULL) {
- node->preview->rect= MEM_callocN(4*xsize + xsize*ysize*sizeof(float)*4, "node preview rect");
- node->preview->xsize= xsize;
- node->preview->ysize= ysize;
- }
-}
-
-void ntreeInitPreview(bNodeTree *ntree, int xsize, int ysize)
-{
- bNode *node;
-
- if(ntree==NULL)
- return;
-
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->typeinfo->flag & NODE_PREVIEW) /* hrms, check for closed nodes? */
- nodeInitPreview(node, xsize, ysize);
- if(node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
- ntreeInitPreview((bNodeTree *)node->id, xsize, ysize);
- }
-}
-
-static void nodeClearPreview(bNode *node)
-{
- if(node->preview && node->preview->rect)
- memset(node->preview->rect, 0, MEM_allocN_len(node->preview->rect));
-}
-
-/* use it to enforce clear */
-void ntreeClearPreview(bNodeTree *ntree)
-{
- bNode *node;
-
- if(ntree==NULL)
- return;
-
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->typeinfo->flag & NODE_PREVIEW)
- nodeClearPreview(node);
- if(node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
- ntreeClearPreview((bNodeTree *)node->id);
- }
-}
-
-/* hack warning! this function is only used for shader previews, and
- since it gets called multiple times per pixel for Ztransp we only
- add the color once. Preview gets cleared before it starts render though */
-void nodeAddToPreview(bNode *node, float *col, int x, int y)
-{
- bNodePreview *preview= node->preview;
- if(preview) {
- if(x>=0 && y>=0) {
- if(x<preview->xsize && y<preview->ysize) {
- float *tar= preview->rect+ 4*((preview->xsize*y) + x);
- //if(tar[0]==0.0f) {
- QUATCOPY(tar, col);
- //}
- }
- //else printf("prv out bound x y %d %d\n", x, y);
- }
- //else printf("prv out bound x y %d %d\n", x, y);
- }
-}
-
-
/* ******************* executing ************* */
@@ -2205,7 +2205,7 @@ static void *exec_composite_node(void *node_v)
bNodeStack *nsin[MAX_SOCKET]; /* arbitrary... watch this */
bNodeStack *nsout[MAX_SOCKET]; /* arbitrary... watch this */
bNode *node= node_v;
- ThreadData *thd= (ThreadData *)node->new_node; /* abuse */
+ ThreadData *thd= (ThreadData *)node->threaddata;
node_get_stack(node, thd->stack, nsin, nsout);
@@ -2300,7 +2300,7 @@ static int setExecutableNodes(bNodeTree *ntree, ThreadData *thd)
}
else {
/* tag for getExecutableNode() */
- node->exec= NODE_READY|NODE_FINISHED;
+ node->exec= NODE_READY|NODE_FINISHED|NODE_SKIPPED;
}
}
@@ -2410,7 +2410,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
/* sets need_exec tags in nodes */
totnode= setExecutableNodes(ntree, &thdata);
-
+
BLI_init_threads(&threads, exec_composite_node, rd->threads);
while(rendering) {
@@ -2418,7 +2418,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
if(BLI_available_threads(&threads)) {
node= getExecutableNode(ntree);
if(node) {
-
+
if(ntree->timecursor)
ntree->timecursor(ntree->tch, totnode);
if(ntree->stats_draw) {
@@ -2428,7 +2428,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
}
totnode--;
- node->new_node = (bNode *)&thdata;
+ node->threaddata = &thdata;
node->exec= NODE_PROCESSING;
BLI_insert_thread(&threads, node);
}
@@ -2461,12 +2461,127 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
}
}
-
BLI_end_threads(&threads);
ntreeEndExecTree(ntree);
}
+
+/* ********** copy composite tree entirely, to allow threaded exec ******************* */
+/* ***************** do NOT execute this in a thread! ****************** */
+
+/* returns localized composite tree for execution in threads */
+/* local tree then owns all compbufs */
+bNodeTree *ntreeLocalize(bNodeTree *ntree)
+{
+ bNodeTree *ltree= ntreeCopyTree(ntree, 0);
+ bNode *node;
+ bNodeSocket *sock;
+
+ /* move over the compbufs */
+ /* right after ntreeCopyTree() oldsock pointers are valid */
+ for(node= ntree->nodes.first; node; node= node->next) {
+
+ /* store new_node pointer to original */
+ node->new_node->new_node= node;
+ /* ensure new user input gets handled ok */
+ node->need_exec= 0;
+
+ if(ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
+ if(node->id && (node->flag & NODE_DO_OUTPUT)) {
+ node->new_node->id= (ID *)BKE_image_copy((Image *)node->id);
+ }
+ }
+
+ for(sock= node->outputs.first; sock; sock= sock->next) {
+
+ sock->new_sock->ns.data= sock->ns.data;
+ sock->ns.data= NULL;
+ sock->new_sock->new_sock= sock;
+ }
+ }
+
+ return ltree;
+}
+
+static int node_exists(bNodeTree *ntree, bNode *testnode)
+{
+ bNode *node= ntree->nodes.first;
+ for(; node; node= node->next)
+ if(node==testnode)
+ return 1;
+ return 0;
+}
+
+static int outsocket_exists(bNode *node, bNodeSocket *testsock)
+{
+ bNodeSocket *sock= node->outputs.first;
+ for(; sock; sock= sock->next)
+ if(sock==testsock)
+ return 1;
+ return 0;
+}
+
+
+/* sync local composite with real tree */
+/* local composite is supposed to be running, be careful moving previews! */
+void ntreeLocalSync(bNodeTree *localtree, bNodeTree *ntree)
+{
+ bNode *lnode;
+
+ /* move over the compbufs and previews */
+ for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
+ if( (lnode->exec & NODE_READY) && !(lnode->exec & NODE_SKIPPED) ) {
+ if(node_exists(ntree, lnode->new_node)) {
+
+ if(lnode->preview && lnode->preview->rect) {
+ node_free_preview(lnode->new_node);
+ lnode->new_node->preview= lnode->preview;
+ lnode->preview= NULL;
+ }
+ }
+ }
+ }
+}
+
+/* merge local tree results back, and free local tree */
+/* we have to assume the editor already changed completely */
+void ntreeLocalMerge(bNodeTree *localtree, bNodeTree *ntree)
+{
+ bNode *lnode;
+ bNodeSocket *lsock;
+
+ /* move over the compbufs and previews */
+ for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
+ if(node_exists(ntree, lnode->new_node)) {
+
+ if(lnode->preview && lnode->preview->rect) {
+ node_free_preview(lnode->new_node);
+ lnode->new_node->preview= lnode->preview;
+ lnode->preview= NULL;
+ }
+
+ if(ELEM(lnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
+ if(lnode->id && (lnode->flag & NODE_DO_OUTPUT)) {
+ BKE_image_merge((Image *)lnode->new_node->id, (Image *)lnode->id);
+ }
+ }
+
+ for(lsock= lnode->outputs.first; lsock; lsock= lsock->next) {
+ if(outsocket_exists(lnode->new_node, lsock->new_sock)) {
+ lsock->new_sock->ns.data= lsock->ns.data;
+ lsock->ns.data= NULL;
+ lsock->new_sock= NULL;
+ }
+ }
+ }
+ }
+ ntreeFreeTree(localtree);
+ MEM_freeN(localtree);
+}
+
+/* *********************************************** */
+
/* GPU material from shader nodes */
static void gpu_from_node_stack(ListBase *sockets, bNodeStack **ns, GPUNodeStack *gs)
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 15fde4420f0..53fa5d8570f 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1617,7 +1617,7 @@ static void ob_parbone(Object *ob, Object *par, float mat[][4])
bPoseChannel *pchan;
float vec[3];
- if (ob->type!=OB_ARMATURE) {
+ if (par->type!=OB_ARMATURE) {
Mat4One(mat);
return;
}
@@ -2273,8 +2273,9 @@ void object_handle_update(Scene *scene, Object *ob)
if(ob->recalc & OB_RECALC) {
if(ob->recalc & OB_RECALC_OB) {
-
- printf("recalcob %s\n", ob->id.name+2);
+
+ if (G.f & G_DEBUG)
+ printf("recalcob %s\n", ob->id.name+2);
/* handle proxy copy for target */
if(ob->id.lib && ob->proxy_from) {
@@ -2296,7 +2297,8 @@ void object_handle_update(Scene *scene, Object *ob)
if(ob->recalc & OB_RECALC_DATA) {
- printf("recalcdata %s\n", ob->id.name+2);
+ if (G.f & G_DEBUG)
+ printf("recalcdata %s\n", ob->id.name+2);
/* includes all keys and modifiers */
if(ob->type==OB_MESH) {
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 0d036c924c5..9cdd67428ac 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -658,9 +658,6 @@ void sculptsession_free(Sculpt *sculpt)
if(ss->projverts)
MEM_freeN(ss->projverts);
- if(ss->radialcontrol)
- MEM_freeN(ss->radialcontrol);
-
if(ss->fmap)
MEM_freeN(ss->fmap);
diff --git a/source/blender/blenkernel/intern/sequence.c b/source/blender/blenkernel/intern/sequence.c
index 37d8cb1aae6..b32f1c765af 100644
--- a/source/blender/blenkernel/intern/sequence.c
+++ b/source/blender/blenkernel/intern/sequence.c
@@ -184,6 +184,17 @@ void seq_free_sequence(Editing *ed, Sequence *seq)
MEM_freeN(seq);
}
+Editing *seq_give_editing(Scene *scene, int alloc)
+{
+ if (scene->ed == NULL && alloc) {
+ Editing *ed;
+
+ ed= scene->ed= MEM_callocN( sizeof(Editing), "addseq");
+ ed->seqbasep= &ed->seqbase;
+ }
+ return scene->ed;
+}
+
void seq_free_editing(Editing *ed)
{
MetaStack *ms;
@@ -594,10 +605,10 @@ void sort_seq(Scene *scene)
{
/* all strips together per kind, and in order of y location ("machine") */
ListBase seqbase, effbase;
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq, *seqt;
- ed= scene->ed;
+
if(ed==NULL) return;
seqbase.first= seqbase.last= 0;
@@ -1036,14 +1047,11 @@ static int evaluate_seq_frame_gen(Sequence ** seq_arr, ListBase *seqbase, int cf
int evaluate_seq_frame(Scene *scene, int cfra)
{
- Editing *ed;
- Sequence *seq_arr[MAXSEQ+1];
-
- ed= scene->ed;
- if(ed==NULL) return 0;
-
- return evaluate_seq_frame_gen(seq_arr, ed->seqbasep, cfra);
+ Editing *ed= seq_give_editing(scene, FALSE);
+ Sequence *seq_arr[MAXSEQ+1];
+ if(ed==NULL) return 0;
+ return evaluate_seq_frame_gen(seq_arr, ed->seqbasep, cfra);
}
static int video_seq_is_rendered(Sequence * seq)
@@ -2403,12 +2411,12 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene,
static ImBuf *give_ibuf_seq_impl(Scene *scene, int rectx, int recty, int cfra, int chanshown)
{
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
int count;
ListBase *seqbasep;
TStripElem *se;
- ed= scene->ed;
+
if(ed==NULL) return NULL;
count = BLI_countlist(&ed->metastack);
@@ -2818,7 +2826,7 @@ static void free_anim_seq(Sequence *seq)
void free_imbuf_seq_except(Scene *scene, int cfra)
{
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
TStripElem *se;
int a;
@@ -2960,10 +2968,10 @@ static int update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *chan
void update_changed_seq_and_deps(Scene *scene, Sequence *changed_seq, int len_change, int ibuf_change)
{
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
- if (!ed) return;
+ if (ed==NULL) return;
for (seq=ed->seqbase.first; seq; seq=seq->next)
update_changed_seq_recurs(scene, seq, changed_seq, len_change, ibuf_change);
@@ -2972,7 +2980,7 @@ void update_changed_seq_and_deps(Scene *scene, Sequence *changed_seq, int len_ch
void free_imbuf_seq_with_ipo(Scene *scene, struct Ipo *ipo)
{
/* force update of all sequences with this ipo, on ipo changes */
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
if(ed==NULL) return;
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c
index 5c8eb5d2aa0..f1057ff3efe 100644
--- a/source/blender/blenlib/intern/bpath.c
+++ b/source/blender/blenlib/intern/bpath.c
@@ -201,7 +201,9 @@ static struct bSound *snd_stepdata__internal(struct bSound *snd, int step_next)
return snd;
}
-static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int step_next) {
+static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int step_next)
+{
+ Editing *ed;
Sequence *seq;
/* Initializing */
@@ -214,11 +216,11 @@ static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int st
}
while (bpi->seqdata.scene) {
-
- if (bpi->seqdata.scene->ed) {
+ ed= seq_give_editing(bpi->seqdata.scene, 0);
+ if (ed) {
if (bpi->seqdata.seqar == NULL) {
/* allocate the sequencer array */
- seq_array(bpi->seqdata.scene->ed, &bpi->seqdata.seqar, &bpi->seqdata.totseq, 0);
+ seq_array(ed, &bpi->seqdata.seqar, &bpi->seqdata.totseq, 0);
bpi->seqdata.seq = 0;
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 85d7883de24..bd266b08e87 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4152,6 +4152,22 @@ static void lib_link_screen(FileData *fd, Main *main)
ssound->sound= newlibadr_us(fd, sc->id.lib, ssound->sound);
}
+ else if(sl->spacetype==SPACE_NODE) {
+ SpaceNode *snode= (SpaceNode *)sl;
+
+ snode->id= newlibadr(fd, sc->id.lib, snode->id);
+
+ /* internal data, a bit patchy */
+ if(snode->id) {
+ if(GS(snode->id->name)==ID_MA)
+ snode->nodetree= ((Material *)snode->id)->nodetree;
+ else if(GS(snode->id->name)==ID_SCE)
+ snode->nodetree= ((Scene *)snode->id)->nodetree;
+ else if(GS(snode->id->name)==ID_TE)
+ snode->nodetree= ((Tex *)snode->id)->nodetree;
+ }
+
+ }
}
sa= sa->next;
}
@@ -4345,8 +4361,19 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
else if(sl->spacetype==SPACE_NODE) {
SpaceNode *snode= (SpaceNode *)sl;
- snode->nodetree= snode->edittree= NULL;
- snode->flag |= SNODE_DO_PREVIEW;
+ snode->id= restore_pointer_by_name(newmain, snode->id, 1);
+ snode->edittree= NULL;
+
+ if(snode->id==NULL)
+ snode->nodetree= NULL;
+ else {
+ if(GS(snode->id->name)==ID_MA)
+ snode->nodetree= ((Material *)snode->id)->nodetree;
+ else if(GS(snode->id->name)==ID_SCE)
+ snode->nodetree= ((Scene *)snode->id)->nodetree;
+ else if(GS(snode->id->name)==ID_TE)
+ snode->nodetree= ((Tex *)snode->id)->nodetree;
+ }
}
}
sa= sa->next;
@@ -4544,7 +4571,6 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
link_gpencil(fd, snode->gpd);
}
snode->nodetree= snode->edittree= NULL;
- snode->flag |= SNODE_DO_PREVIEW;
}
else if(sl->spacetype==SPACE_SEQ) {
SpaceSeq *sseq= (SpaceSeq *)sl;
@@ -5454,11 +5480,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
/* init mainarea view2d */
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
-
- /* init dopesheet */
- // XXX move this elsewhere instead?
- sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
-
+
//ar->v2d.flag |= V2D_IS_INITIALISED;
break;
}
diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt
index 15c0bca8ffb..b014454d252 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -38,6 +38,7 @@ SET(INC ../windowmanager
../../../intern/ghost ../../../intern/opennl/extern ../../../extern/glew/include
../nodes
../gpu
+ ../blenfont
${SDL_INC}
)
diff --git a/source/blender/editors/animation/anim_channels.c b/source/blender/editors/animation/anim_channels.c
index 3ebb6bb5a11..006ffc0c641 100644
--- a/source/blender/editors/animation/anim_channels.c
+++ b/source/blender/editors/animation/anim_channels.c
@@ -1025,7 +1025,13 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s
case ANIMTYPE_FILLACTD:
{
bAction *act= (bAction *)ale->data;
- act->flag ^= ACT_EXPANDED;
+ act->flag ^= ACT_COLLAPSED;
+ }
+ break;
+ case ANIMTYPE_FILLDRIVERS:
+ {
+ AnimData *adt= (AnimData* )ale->data;
+ adt->flag ^= ADT_DRIVERS_COLLAPSED;
}
break;
case ANIMTYPE_FILLMATD:
@@ -1126,6 +1132,11 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s
else {
/* select/deselect */
fcu->flag ^= FCURVE_SELECTED;
+
+ if (fcu->flag & FCURVE_SELECTED)
+ fcu->flag |= FCURVE_ACTIVE;
+ else
+ fcu->flag &= ~FCURVE_ACTIVE;
}
}
break;
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index 07816228dad..f8e6cd2d8e8 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -145,6 +145,8 @@ void ANIM_animdata_send_notifiers (bContext *C, bAnimContext *ac, short data_cha
/* types of notifiers to send, depends on the editor context */
switch (ac->datatype) {
case ANIMCONT_DOPESHEET: /* dopesheet */
+ case ANIMCONT_FCURVES: /* fcurve editor */
+ case ANIMCONT_DRIVERS: /* drivers editor */ // XXX probably this will need separate handling, since these are part of dependency system
{
/* what action was taken */
switch (data_changed) {
@@ -153,8 +155,9 @@ void ANIM_animdata_send_notifiers (bContext *C, bAnimContext *ac, short data_cha
// XXX what about other cases? maybe we need general ND_KEYFRAMES or ND_ANIMATION?
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
break;
- //case ANIM_CHANGED_KEYFRAMES_SELECT: // XXX what to do here?
- // break;
+ case ANIM_CHANGED_KEYFRAMES_SELECT: // XXX what to do here?
+ WM_event_add_notifier(C, NC_SCENE, NULL);
+ break;
case ANIM_CHANGED_CHANNELS:
// XXX err... check available datatypes in dopesheet first?
// FIXME: this currently doesn't work (to update own view)
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 361a384cf03..8b14b9b2d5c 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -199,6 +199,10 @@ static short actedit_get_context (bAnimContext *ac, SpaceAction *saction)
/* Get data being edited in Graph Editor (depending on current 'mode') */
static short graphedit_get_context (bAnimContext *ac, SpaceIpo *sipo)
{
+ /* init dopesheet data if non-existant (i.e. for old files) */
+ if (sipo->ads == NULL)
+ sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
+
/* sync settings with current view status, then return appropriate data */
switch (sipo->mode) {
case SIPO_MODE_ANIMATION: /* Animation F-Curve Editor */
@@ -217,7 +221,7 @@ static short graphedit_get_context (bAnimContext *ac, SpaceIpo *sipo)
sipo->ads->source= (ID *)ac->scene;
sipo->ads->filterflag |= ADS_FILTER_ONLYDRIVERS;
- ac->datatype= ANIMCONT_FCURVES;
+ ac->datatype= ANIMCONT_DRIVERS;
ac->data= sipo->ads;
ac->mode= sipo->mode;
@@ -302,6 +306,9 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac)
/* quick macro to test if AnimData is usable */
#define ANIMDATA_HAS_KEYS(id) ((id)->adt && (id)->adt->action)
+/* quick macro to test if AnimData is usable for drivers */
+#define ANIMDATA_HAS_DRIVERS(id) ((id)->adt && (id)->adt->drivers.first)
+
/* ----------- 'Private' Stuff --------------- */
/* this function allocates memory for a new bAnimListElem struct for the
@@ -347,6 +354,17 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
ale->datatype= ALE_ACT;
}
break;
+ case ANIMTYPE_FILLDRIVERS:
+ {
+ AnimData *adt= (AnimData *)data;
+
+ ale->flag= adt->flag;
+
+ // XXX... drivers don't show summary for now
+ ale->key_data= NULL;
+ ale->datatype= ALE_NONE;
+ }
+ break;
case ANIMTYPE_FILLMATD:
{
Object *ob= (Object *)data;
@@ -466,7 +484,7 @@ static int animdata_filter_fcurves (ListBase *anim_data, FCurve *first, bActionG
*/
for (fcu= first; ((fcu) && (fcu->grp==grp)); fcu= fcu->next) {
/* only include if visible (Graph Editor check, not channels check) */
- if (!(filter_mode & ANIMFILTER_CURVEVISIBLE) || (fcu->flag & FCURVE_VISIBLE)) {
+ //if (!(filter_mode & ANIMFILTER_CURVEVISIBLE) || (fcu->flag & FCURVE_VISIBLE)) { // XXX don't do this till we have tools to set this
/* only work with this channel and its subchannels if it is editable */
if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_FCU(fcu)) {
/* only include this curve if selected */
@@ -480,7 +498,7 @@ static int animdata_filter_fcurves (ListBase *anim_data, FCurve *first, bActionG
}
}
}
- }
+ //}
}
/* return the number of items added to the list */
@@ -690,9 +708,29 @@ static int animdata_filter_gpencil (ListBase *anim_data, bScreen *sc, int filter
static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
{
+ ListBase mats = {NULL, NULL};
+ LinkData *ld;
+
bAnimListElem *ale=NULL;
Object *ob= base->object;
- int items = 0;
+ int items=0, a=0;
+
+ /* firstly check that we actuallly have some materials, by gathering all materials in a temp list */
+ for (a=0; a < ob->totcol; a++) {
+ Material *ma= give_current_material(ob, a);
+
+ /* for now, if no material returned, skip (this shouldn't confuse the user I hope) */
+ if (ELEM3(NULL, ma, ma->adt, ma->adt->action)) continue;
+
+ /* make a temp list elem for this */
+ ld= MEM_callocN(sizeof(LinkData), "DopeSheet-MaterialCache");
+ ld->data= ma;
+ BLI_addtail(&mats, ld);
+ }
+
+ /* if there were no channels found, no need to carry on */
+ if (mats.first == NULL)
+ return 0;
/* include materials-expand widget? */
if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
@@ -705,14 +743,9 @@ static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads,
/* add materials? */
if (FILTER_MAT_OBJC(ob) || (filter_mode & ANIMFILTER_CURVESONLY)) {
- short a;
-
- /* for each material, either add channels separately, or as ipo-block */
- for (a=0; a<ob->totcol; a++) {
- Material *ma= give_current_material(ob, a);
-
- /* for now, if no material returned, skip (this shouldn't confuse the user I hope) */
- if (ELEM(NULL, ma, ma->adt)) continue;
+ /* for each material in cache, add channels */
+ for (ld= mats.first; ld; ld= ld->next) {
+ Material *ma= (Material *)ld->data;
/* include material-expand widget? */
// hmm... do we need to store the index of this material in the array anywhere?
@@ -724,7 +757,7 @@ static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads,
}
}
- /* add material's ipo-curve channels? */
+ /* add material's F-Curve channels? */
if (FILTER_MAT_OBJD(ma) || (filter_mode & ANIMFILTER_CURVESONLY)) {
//items += animdata_filter_ipocurves(anim_data, ma->ipo, filter_mode, base, ANIMTYPE_OBJECT, (ID *)ma);
// XXX the 'owner' info here is still subject to improvement
@@ -733,6 +766,9 @@ static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads,
}
}
+ /* free cache */
+ BLI_freelistN(&mats);
+
/* return the number of items added to the list */
return items;
}
@@ -742,6 +778,7 @@ static int animdata_filter_dopesheet_obdata (ListBase *anim_data, bDopeSheet *ad
bAnimListElem *ale=NULL;
Object *ob= base->object;
IdAdtTemplate *iat= ob->data;
+ AnimData *adt= iat->adt;
short type=0, expanded=0;
int items= 0;
@@ -773,6 +810,10 @@ static int animdata_filter_dopesheet_obdata (ListBase *anim_data, bDopeSheet *ad
break;
}
+ /* special exception for drivers instead of action */
+ if (ads->filterflag & ADS_FILTER_ONLYDRIVERS)
+ expanded= EXPANDED_DRVD(adt);
+
/* include data-expand widget? */
if ((filter_mode & ANIMFILTER_CURVESONLY) == 0) {
ale= make_new_animlistelem(iat, type, base, ANIMTYPE_OBJECT, (ID *)iat);
@@ -781,8 +822,15 @@ static int animdata_filter_dopesheet_obdata (ListBase *anim_data, bDopeSheet *ad
/* add object-data animation channels? */
if ((expanded) || (filter_mode & ANIMFILTER_CURVESONLY)) {
- // XXX the 'owner' info here is still subject to improvement
- items += animdata_filter_action(anim_data, iat->adt->action, filter_mode, iat, type, (ID *)iat);
+ /* Action or Drivers? */
+ if ((ads->filterflag & ADS_FILTER_ONLYDRIVERS) == 0) {
+ // XXX the 'owner' info here is still subject to improvement
+ items += animdata_filter_action(anim_data, iat->adt->action, filter_mode, iat, type, (ID *)iat);
+ }
+ else {
+ // need to make the ownertype normal object here... (maybe type should be a separate one for clarity?)
+ items += animdata_filter_fcurves(anim_data, adt->drivers.first, NULL, iat, type, filter_mode, (ID *)iat);
+ }
}
/* return the number of items added to the list */
@@ -813,40 +861,88 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
if ( (EXPANDED_OBJC(ob) == 0) && !(filter_mode & ANIMFILTER_CURVESONLY) )
return items;
- /* Action? */
- if (ANIMDATA_HAS_KEYS(ob) /*&& !(ads->filterflag & ADS_FILTER_NOACTS)*/) {
- AnimData *adt= ob->adt;
-
- /* include action-expand widget? */
- if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
- ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLACTD, base, ANIMTYPE_OBJECT, (ID *)ob);
- if (ale) {
- BLI_addtail(anim_data, ale);
- items++;
+ /* Action or Drivers */
+ if ((ads->filterflag & ADS_FILTER_ONLYDRIVERS) == 0) {
+ /* Action? */
+ if (ANIMDATA_HAS_KEYS(ob) /*&& !(ads->filterflag & ADS_FILTER_NOACTS)*/) {
+ AnimData *adt= ob->adt;
+
+ /* include action-expand widget? */
+ if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
+ ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLACTD, base, ANIMTYPE_OBJECT, (ID *)ob);
+ if (ale) {
+ BLI_addtail(anim_data, ale);
+ items++;
+ }
+ }
+
+ /* add F-Curve channels? */
+ if (EXPANDED_ACTC(adt->action) || !(filter_mode & ANIMFILTER_CHANNELS)) {
+ // need to make the ownertype normal object here... (maybe type should be a separate one for clarity?)
+ items += animdata_filter_action(anim_data, adt->action, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob);
}
}
-
- /* add F-Curve channels? */
- if (EXPANDED_ACTC(adt->action) || !(filter_mode & ANIMFILTER_CHANNELS)) {
- // need to make the ownertype normal object here... (maybe type should be a separate one for clarity?)
- items += animdata_filter_action(anim_data, adt->action, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob);
+ }
+ else {
+ /* Drivers */
+ if (ANIMDATA_HAS_DRIVERS(ob)) {
+ AnimData *adt= ob->adt;
+
+ /* include drivers-expand widget? */
+ if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
+ ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLDRIVERS, base, ANIMTYPE_OBJECT, (ID *)ob);
+ if (ale) {
+ BLI_addtail(anim_data, ale);
+ items++;
+ }
+ }
+
+ /* add F-Curve channels (drivers are F-Curves) */
+ if (EXPANDED_DRVD(adt) || !(filter_mode & ANIMFILTER_CHANNELS)) {
+ // need to make the ownertype normal object here... (maybe type should be a separate one for clarity?)
+ items += animdata_filter_fcurves(anim_data, adt->drivers.first, NULL, ob, ANIMTYPE_OBJECT, filter_mode, (ID *)ob);
+ }
}
}
/* ShapeKeys? */
if ((key) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS)) {
- /* include shapekey-expand widget? */
- if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
- ale= make_new_animlistelem(key, ANIMTYPE_DSSKEY, base, ANIMTYPE_OBJECT, (ID *)ob);
- if (ale) {
- BLI_addtail(anim_data, ale);
- items++;
+ /* Animation or Drivers */
+ if ((ads->filterflag & ADS_FILTER_ONLYDRIVERS) == 0) {
+ /* include shapekey-expand widget? */
+ if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
+ ale= make_new_animlistelem(key, ANIMTYPE_DSSKEY, base, ANIMTYPE_OBJECT, (ID *)ob);
+ if (ale) {
+ BLI_addtail(anim_data, ale);
+ items++;
+ }
+ }
+
+ /* add channels */
+ if (FILTER_SKE_OBJD(key) || (filter_mode & ANIMFILTER_CURVESONLY)) {
+ items += animdata_filter_shapekey(anim_data, key, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob);
}
}
-
- /* add channels */
- if (FILTER_SKE_OBJD(key) || (filter_mode & ANIMFILTER_CURVESONLY)) {
- items += animdata_filter_shapekey(anim_data, key, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob);
+ else {
+ /* Drivers */
+ if (ANIMDATA_HAS_DRIVERS(key)) {
+ AnimData *adt= key->adt;
+
+ /* include shapekey-expand widget? */
+ if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
+ ale= make_new_animlistelem(key, ANIMTYPE_DSSKEY, base, ANIMTYPE_OBJECT, (ID *)ob);
+ if (ale) {
+ BLI_addtail(anim_data, ale);
+ items++;
+ }
+ }
+
+ /* add F-Curve channels (drivers are F-Curves) */
+ if (FILTER_SKE_OBJD(key)/*EXPANDED_DRVD(adt)*/ || !(filter_mode & ANIMFILTER_CHANNELS)) {
+ // XXX owner info is messed up now...
+ items += animdata_filter_fcurves(anim_data, adt->drivers.first, NULL, ob, ANIMTYPE_OBJECT, filter_mode, (ID *)key);
+ }
+ }
}
}
@@ -860,22 +956,49 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
case OB_CAMERA: /* ------- Camera ------------ */
{
Camera *ca= (Camera *)ob->data;
- if (ANIMDATA_HAS_KEYS(ca) && !(ads->filterflag & ADS_FILTER_NOCAM))
- items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode);
+
+ if ((ads->filterflag & ADS_FILTER_NOCAM) == 0) {
+ if ((ads->filterflag & ADS_FILTER_ONLYDRIVERS)==0) {
+ if (ANIMDATA_HAS_KEYS(ca))
+ items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode);
+ }
+ else {
+ if (ANIMDATA_HAS_DRIVERS(ca))
+ items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode);
+ }
+ }
}
break;
case OB_LAMP: /* ---------- Lamp ----------- */
{
Lamp *la= (Lamp *)ob->data;
- if (ANIMDATA_HAS_KEYS(la) && !(ads->filterflag & ADS_FILTER_NOLAM))
- items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode);
+
+ if ((ads->filterflag & ADS_FILTER_NOLAM) == 0) {
+ if ((ads->filterflag & ADS_FILTER_ONLYDRIVERS)==0) {
+ if (ANIMDATA_HAS_KEYS(la))
+ items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode);
+ }
+ else {
+ if (ANIMDATA_HAS_DRIVERS(la))
+ items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode);
+ }
+ }
}
break;
case OB_CURVE: /* ------- Curve ---------- */
{
Curve *cu= (Curve *)ob->data;
- if (ANIMDATA_HAS_KEYS(cu) && !(ads->filterflag & ADS_FILTER_NOCUR))
- items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode);
+
+ if ((ads->filterflag & ADS_FILTER_NOCUR) == 0) {
+ if ((ads->filterflag & ADS_FILTER_ONLYDRIVERS)==0) {
+ if (ANIMDATA_HAS_KEYS(cu))
+ items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode);
+ }
+ else {
+ if (ANIMDATA_HAS_DRIVERS(cu))
+ items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode);
+ }
+ }
}
break;
}
@@ -938,26 +1061,41 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
#endif
/* check filters for datatypes */
- actOk= (ANIMDATA_HAS_KEYS(ob) /*&& !(ads->filterflag & ADS_FILTER_NOACTS)*/);
- keyOk= ((key) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS));
+ if (ads->filterflag & ADS_FILTER_ONLYDRIVERS) {
+ actOk= (ANIMDATA_HAS_DRIVERS(ob));
+ keyOk= ((key) && ANIMDATA_HAS_DRIVERS(key) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS));
+ }
+ else {
+ actOk= (ANIMDATA_HAS_KEYS(ob) /*&& !(ads->filterflag & ADS_FILTER_NOACTS)*/);
+ keyOk= ((key) && ANIMDATA_HAS_KEYS(key) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS));
+ }
switch (ob->type) {
case OB_CAMERA: /* ------- Camera ------------ */
{
Camera *ca= (Camera *)ob->data;
- dataOk= (ANIMDATA_HAS_KEYS(ca) && !(ads->filterflag & ADS_FILTER_NOCAM));
+ if (ads->filterflag & ADS_FILTER_ONLYDRIVERS)
+ dataOk= (ANIMDATA_HAS_DRIVERS(ca) && !(ads->filterflag & ADS_FILTER_NOCAM));
+ else
+ dataOk= (ANIMDATA_HAS_KEYS(ca) && !(ads->filterflag & ADS_FILTER_NOCAM));
}
break;
case OB_LAMP: /* ---------- Lamp ----------- */
{
Lamp *la= (Lamp *)ob->data;
- dataOk= (ANIMDATA_HAS_KEYS(la) && !(ads->filterflag & ADS_FILTER_NOLAM));
+ if (ads->filterflag & ADS_FILTER_ONLYDRIVERS)
+ dataOk= (ANIMDATA_HAS_DRIVERS(la) && !(ads->filterflag & ADS_FILTER_NOLAM));
+ else
+ dataOk= (ANIMDATA_HAS_KEYS(la) && !(ads->filterflag & ADS_FILTER_NOLAM));
}
break;
case OB_CURVE: /* -------- Curve ---------- */
{
Curve *cu= (Curve *)ob->data;
- dataOk= (ANIMDATA_HAS_KEYS(cu) && !(ads->filterflag & ADS_FILTER_NOCUR));
+ if (ads->filterflag & ADS_FILTER_ONLYDRIVERS)
+ dataOk= (ANIMDATA_HAS_DRIVERS(cu) && !(ads->filterflag & ADS_FILTER_NOCUR));
+ else
+ dataOk= (ANIMDATA_HAS_KEYS(cu) && !(ads->filterflag & ADS_FILTER_NOCUR));
}
break;
default: /* --- other --- */
@@ -984,13 +1122,13 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
case OB_LAMP: /* ---------- Lamp ----------- */
{
Lamp *la= (Lamp *)ob->data;
- dataOk= ANIMDATA_HAS_KEYS(la);
+ dataOk= ANIMDATA_HAS_KEYS(la);
}
break;
case OB_CURVE: /* -------- Curve ---------- */
{
Curve *cu= (Curve *)ob->data;
- dataOk= ANIMDATA_HAS_KEYS(cu);
+ dataOk= ANIMDATA_HAS_KEYS(cu);
}
break;
default: /* --- other --- */
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c
index 4473ddbf1f8..8de1531629b 100644
--- a/source/blender/editors/animation/anim_ipo_utils.c
+++ b/source/blender/editors/animation/anim_ipo_utils.c
@@ -138,6 +138,7 @@ void getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
/* Property Name is straightforward */
propname= (char *)RNA_property_ui_name(&ptr, prop);
+ /* Array Index - only if applicable */
if (RNA_property_array_length(&ptr, prop)) {
// XXX the format of these is not final... we don't know how this will go yet
static char *vectoritem[4]= {".X", ".Y", ".Z", ".W"};
@@ -160,6 +161,10 @@ void getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
arrayname= &arrayindbuf[0];
}
}
+ else {
+ /* no array index */
+ arrayname= "";
+ }
/* putting this all together into the buffer */
// XXX we need to check for invalid names...
@@ -190,8 +195,8 @@ unsigned int ipo_rainbow(int cur, int tot)
if(tot > 32) fac= fac*1.95f;
if(fac>1.0f) fac-= 1.0f;
- if(fac>0.5f && fac<0.8f) sat= 0.4f;
- else sat= 0.5f;
+ if(fac>0.5f && fac<0.8f) sat= 0.5f;
+ else sat= 0.6f;
return hsv_to_cpack(fac, sat, 1.0f);
}
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 947b3bad9e7..723a59e38f2 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -867,7 +867,7 @@ void ED_marker_keymap(wmWindowManager *wm)
WM_keymap_add_item(keymap, "MARKER_OT_move", GKEY, KM_PRESS, 0, 0);
- /* generates event, in end to make select work */
+ /* generates event, needs to be after select to work */
WM_keymap_verify_item(keymap, "WM_OT_tweak_gesture", RIGHTMOUSE, KM_PRESS, 0, 0);
}
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 66049d5e5f7..c3a393994d7 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -38,7 +38,6 @@
#include "DNA_action_types.h"
#include "DNA_constraint_types.h"
#include "DNA_curve_types.h"
-#include "DNA_ipo_types.h" // XXX to be phased out
#include "DNA_key_types.h"
#include "DNA_object_types.h"
#include "DNA_space_types.h"
@@ -56,7 +55,7 @@
/* This file defines an API and set of callback-operators for non-destructive editing of keyframe data.
*
* Two API functions are defined for actually performing the operations on the data:
- * ipo_keys_bezier_loop() and icu_keys_bezier_loop()
+ * ANIM_fcurve_keys_bezier_loop()
* which take the data they operate on, a few callbacks defining what operations to perform.
*
* As operators which work on keyframes usually apply the same operation on all BezTriples in
@@ -84,6 +83,10 @@ short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, FCurve *fcu, BeztEditFunc
BezTriple *bezt;
int b;
+ /* sanity check */
+ if (fcu == NULL)
+ return 0;
+
/* if function to apply to bezier curves is set, then loop through executing it on beztriples */
if (bezt_cb) {
/* if there's a validation func, include that check in the loop
@@ -194,7 +197,7 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac)
for (ale= anim_data.first; ale; ale= ale->next) {
FCurve *fcu= ale->key_data;
- /* make sure keyframes in IPO-curve are all in order, and handles are in valid positions */
+ /* make sure keyframes in F-curve are all in order, and handles are in valid positions */
sort_time_fcurve(fcu);
testhandles_fcurve(fcu);
}
@@ -233,6 +236,21 @@ static short ok_bezier_value(BeztEditData *bed, BezTriple *bezt)
return IS_EQ(bezt->vec[1][1], bed->f1);
}
+static short ok_bezier_valuerange(BeztEditData *bed, BezTriple *bezt)
+{
+ /* value range is stored in float properties */
+ return ((bezt->vec[1][1] > bed->f1) && (bezt->vec[1][1] < bed->f2));
+}
+
+static short ok_bezier_region(BeztEditData *bed, BezTriple *bezt)
+{
+ /* rect is stored in data property (it's of type rectf, but may not be set) */
+ if (bed->data)
+ return BLI_in_rctf(bed->data, bezt->vec[1][0], bezt->vec[1][1]);
+ else
+ return 0;
+}
+
BeztEditFunc ANIM_editkeyframes_ok(short mode)
{
@@ -242,10 +260,14 @@ BeztEditFunc ANIM_editkeyframes_ok(short mode)
return ok_bezier_frame;
case BEZT_OK_FRAMERANGE: /* only if bezt falls within the specified frame range (floats) */
return ok_bezier_framerange;
- case BEZT_OK_SELECTED: /* only if bezt is selected */
+ case BEZT_OK_SELECTED: /* only if bezt is selected (self) */
return ok_bezier_selected;
case BEZT_OK_VALUE: /* only if bezt value matches (float) */
return ok_bezier_value;
+ case BEZT_OK_VALUERANGE: /* only if bezier falls within the specified value range (floats) */
+ return ok_bezier_valuerange;
+ case BEZT_OK_REGION: /* only if bezier falls within the specified rect (data -> rectf) */
+ return ok_bezier_region;
default: /* nothing was ok */
return NULL;
}
@@ -286,6 +308,16 @@ static short snap_bezier_nearmarker(BeztEditData *bed, BezTriple *bezt)
return 0;
}
+static short snap_bezier_horizontal(BeztEditData *bed, BezTriple *bezt)
+{
+ if (bezt->f2 & SELECT) {
+ bezt->vec[0][1]= bezt->vec[2][1]= bezt->vec[1][1];
+ if ((bezt->h1==HD_AUTO) || (bezt->h1==HD_VECT)) bezt->h1= HD_ALIGN;
+ if ((bezt->h2==HD_AUTO) || (bezt->h2==HD_VECT)) bezt->h2= HD_ALIGN;
+ }
+ return 0;
+}
+
// calchandles_ipocurve
BeztEditFunc ANIM_editkeyframes_snap(short type)
{
@@ -299,6 +331,8 @@ BeztEditFunc ANIM_editkeyframes_snap(short type)
return snap_bezier_nearmarker;
case SNAP_KEYS_NEARSEC: /* snap to nearest second */
return snap_bezier_nearestsec;
+ case SNAP_KEYS_HORIZONTAL: /* snap handles to same value */
+ return snap_bezier_horizontal;
default: /* just in case */
return snap_bezier_nearest;
}
@@ -355,7 +389,7 @@ static short mirror_bezier_marker(BeztEditData *bed, BezTriple *bezt)
}
/* Note: for markers case, need to set global vars (eww...) */
-// calchandles_ipocurve
+// calchandles_fcurve
BeztEditFunc ANIM_editkeyframes_mirror(short type)
{
switch (type) {
@@ -437,7 +471,7 @@ static short set_bezier_free(BeztEditData *bed, BezTriple *bezt)
}
/* Set all Bezier Handles to a single type */
-// calchandles_ipocurve
+// calchandles_fcurve
BeztEditFunc ANIM_editkeyframes_handles(short code)
{
switch (code) {
@@ -460,21 +494,21 @@ BeztEditFunc ANIM_editkeyframes_handles(short code)
static short set_bezt_constant(BeztEditData *bed, BezTriple *bezt)
{
if (bezt->f2 & SELECT)
- bezt->ipo= IPO_CONST;
+ bezt->ipo= BEZT_IPO_CONST;
return 0;
}
static short set_bezt_linear(BeztEditData *bed, BezTriple *bezt)
{
if (bezt->f2 & SELECT)
- bezt->ipo= IPO_LIN;
+ bezt->ipo= BEZT_IPO_LIN;
return 0;
}
static short set_bezt_bezier(BeztEditData *bed, BezTriple *bezt)
{
if (bezt->f2 & SELECT)
- bezt->ipo= IPO_BEZ;
+ bezt->ipo= BEZT_IPO_BEZ;
return 0;
}
@@ -483,9 +517,9 @@ static short set_bezt_bezier(BeztEditData *bed, BezTriple *bezt)
BeztEditFunc ANIM_editkeyframes_ipo(short code)
{
switch (code) {
- case IPO_CONST: /* constant */
+ case BEZT_IPO_CONST: /* constant */
return set_bezt_constant;
- case IPO_LIN: /* linear */
+ case BEZT_IPO_LIN: /* linear */
return set_bezt_linear;
default: /* bezier */
return set_bezt_bezier;
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index 11397a1d60b..30d05b91582 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -152,11 +152,6 @@ void duplicate_fcurve_keys(FCurve *fcu)
/* **************************************************** */
/* Various Tools */
-// XXX - stub... until keyframing code is fixed...
-static void insert_vert_fcu(FCurve *fcu, float x, float y, short flag)
-{
-}
-
/* Basic IPO-Curve 'cleanup' function that removes 'double points' and unnecessary keyframes on linear-segments only */
void clean_fcurve(FCurve *fcu, float thresh)
{
@@ -176,7 +171,7 @@ void clean_fcurve(FCurve *fcu, float thresh)
/* now insert first keyframe, as it should be ok */
bezt = old_bezts;
- insert_vert_fcu(fcu, bezt->vec[1][0], bezt->vec[1][1], 0);
+ insert_vert_fcurve(fcu, bezt->vec[1][0], bezt->vec[1][1], 0);
/* Loop through BezTriples, comparing them. Skip any that do
* not fit the criteria for "ok" points.
@@ -213,7 +208,7 @@ void clean_fcurve(FCurve *fcu, float thresh)
if (cur[1] > next[1]) {
if (IS_EQT(cur[1], prev[1], thresh) == 0) {
/* add new keyframe */
- insert_vert_fcu(fcu, cur[0], cur[1], 0);
+ insert_vert_fcurve(fcu, cur[0], cur[1], 0);
}
}
}
@@ -221,7 +216,7 @@ void clean_fcurve(FCurve *fcu, float thresh)
/* only add if values are a considerable distance apart */
if (IS_EQT(cur[1], prev[1], thresh) == 0) {
/* add new keyframe */
- insert_vert_fcu(fcu, cur[0], cur[1], 0);
+ insert_vert_fcurve(fcu, cur[0], cur[1], 0);
}
}
}
@@ -231,18 +226,18 @@ void clean_fcurve(FCurve *fcu, float thresh)
/* does current have same value as previous and next? */
if (IS_EQT(cur[1], prev[1], thresh) == 0) {
/* add new keyframe*/
- insert_vert_fcu(fcu, cur[0], cur[1], 0);
+ insert_vert_fcurve(fcu, cur[0], cur[1], 0);
}
else if (IS_EQT(cur[1], next[1], thresh) == 0) {
/* add new keyframe */
- insert_vert_fcu(fcu, cur[0], cur[1], 0);
+ insert_vert_fcurve(fcu, cur[0], cur[1], 0);
}
}
else {
/* add if value doesn't equal that of previous */
if (IS_EQT(cur[1], prev[1], thresh) == 0) {
/* add new keyframe */
- insert_vert_fcu(fcu, cur[0], cur[1], 0);
+ insert_vert_fcurve(fcu, cur[0], cur[1], 0);
}
}
}
@@ -261,8 +256,7 @@ typedef struct tSmooth_Bezt {
} tSmooth_Bezt;
/* Use a weighted moving-means method to reduce intensity of fluctuations */
-//mode= pupmenu("Smooth F-Curve%t|Tweak Points%x1|Flatten Handles%x2");
-void smooth_fcurve(FCurve *fcu, short mode)
+void smooth_fcurve (FCurve *fcu)
{
BezTriple *bezt;
int i, x, totSel = 0;
@@ -283,8 +277,6 @@ void smooth_fcurve(FCurve *fcu, short mode)
}
}
- /* check if adjust values too... */
- if (mode == 2) {
/* if any points were selected, allocate tSmooth_Bezt points to work on */
if (totSel >= 3) {
tSmooth_Bezt *tarray, *tsb;
@@ -309,51 +301,50 @@ void smooth_fcurve(FCurve *fcu, short mode)
}
}
- /* calculate the new smoothed ipo's with weighted averages:
- * - this is done with two passes
- * - uses 5 points for each operation (which stores in the relevant handles)
- * - previous: w/a ratio = 3:5:2:1:1
- * - next: w/a ratio = 1:1:2:5:3
- */
-
- /* round 1: calculate previous and next */
- tsb= tarray;
- for (i=0; i < totSel; i++, tsb++) {
- /* don't touch end points (otherwise, curves slowly explode) */
- if (ELEM(i, 0, (totSel-1)) == 0) {
- const tSmooth_Bezt *tP1 = tsb - 1;
- const tSmooth_Bezt *tP2 = (i-2 > 0) ? (tsb - 2) : (NULL);
- const tSmooth_Bezt *tN1 = tsb + 1;
- const tSmooth_Bezt *tN2 = (i+2 < totSel) ? (tsb + 2) : (NULL);
-
- const float p1 = *tP1->h2;
- const float p2 = (tP2) ? (*tP2->h2) : (*tP1->h2);
- const float c1 = *tsb->h2;
- const float n1 = *tN1->h2;
- const float n2 = (tN2) ? (*tN2->h2) : (*tN1->h2);
-
- /* calculate previous and next */
- *tsb->h1= (3*p2 + 5*p1 + 2*c1 + n1 + n2) / 12;
- *tsb->h3= (p2 + p1 + 2*c1 + 5*n1 + 3*n2) / 12;
- }
- }
+ /* calculate the new smoothed F-Curve's with weighted averages:
+ * - this is done with two passes
+ * - uses 5 points for each operation (which stores in the relevant handles)
+ * - previous: w/a ratio = 3:5:2:1:1
+ * - next: w/a ratio = 1:1:2:5:3
+ */
+
+ /* round 1: calculate previous and next */
+ tsb= tarray;
+ for (i=0; i < totSel; i++, tsb++) {
+ /* don't touch end points (otherwise, curves slowly explode) */
+ if (ELEM(i, 0, (totSel-1)) == 0) {
+ const tSmooth_Bezt *tP1 = tsb - 1;
+ const tSmooth_Bezt *tP2 = (i-2 > 0) ? (tsb - 2) : (NULL);
+ const tSmooth_Bezt *tN1 = tsb + 1;
+ const tSmooth_Bezt *tN2 = (i+2 < totSel) ? (tsb + 2) : (NULL);
- /* round 2: calculate new values and reset handles */
- tsb= tarray;
- for (i=0; i < totSel; i++, tsb++) {
- /* calculate new position by averaging handles */
- *tsb->h2 = (*tsb->h1 + *tsb->h3) / 2;
-
- /* reset handles now */
- *tsb->h1 = *tsb->h2;
- *tsb->h3 = *tsb->h2;
- }
+ const float p1 = *tP1->h2;
+ const float p2 = (tP2) ? (*tP2->h2) : (*tP1->h2);
+ const float c1 = *tsb->h2;
+ const float n1 = *tN1->h2;
+ const float n2 = (tN2) ? (*tN2->h2) : (*tN1->h2);
- /* free memory required for tarray */
- MEM_freeN(tarray);
+ /* calculate previous and next */
+ *tsb->h1= (3*p2 + 5*p1 + 2*c1 + n1 + n2) / 12;
+ *tsb->h3= (p2 + p1 + 2*c1 + 5*n1 + 3*n2) / 12;
}
}
+ /* round 2: calculate new values and reset handles */
+ tsb= tarray;
+ for (i=0; i < totSel; i++, tsb++) {
+ /* calculate new position by averaging handles */
+ *tsb->h2 = (*tsb->h1 + *tsb->h3) / 2;
+
+ /* reset handles now */
+ *tsb->h1 = *tsb->h2;
+ *tsb->h3 = *tsb->h2;
+ }
+
+ /* free memory required for tarray */
+ MEM_freeN(tarray);
+}
+
/* recalculate handles */
calchandles_fcurve(fcu);
}
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 7ab5a790e97..a476b567c0c 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -334,7 +334,7 @@ void insert_vert_fcurve (FCurve *fcu, float x, float y, short fast)
/* set handletype and interpolation */
if (fcu->totvert > 2) {
BezTriple *bezt= (fcu->bezt + a);
- short h1, h2;
+ char h1, h2;
/* set handles (autohandles by default) */
h1= h2= HD_AUTO;
@@ -2117,9 +2117,9 @@ static int insert_key_exec (bContext *C, wmOperator *op)
ED_undo_push(C, "Insert Keyframe");
if (mode == 3) // material color requires different notifiers
- WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING_DRAW, NULL);
+ WM_event_add_notifier(C, NC_MATERIAL|ND_KEYS, NULL);
else
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, NULL);
return OPERATOR_FINISHED;
}
@@ -2184,7 +2184,7 @@ static int delete_key_exec (bContext *C, wmOperator *op)
ED_undo_push(C, "Delete Keyframe");
// XXX what if it was a material keyframe?
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, NULL);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index ee7260606a5..4d60c2716ba 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -74,9 +74,9 @@ void ED_keymap_curve(wmWindowManager *wm)
WM_keymap_add_item(keymap, "FONT_OT_textedit", KM_TEXTINPUT, KM_ANY, KM_ANY, 0);
/* only set in editmode curve, by space_view3d listener */
-// keymap= WM_keymap_listbase(wm, "Curve", 0, 0);
+ keymap= WM_keymap_listbase(wm, "Curve", 0, 0);
-// WM_keymap_add_item(keymap, "OBJECT_OT_de_select_all", AKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "OBJECT_OT_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0);
}
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 4d468fdd28b..075b1047392 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -4049,28 +4049,23 @@ int join_curve(Scene *scene, int type)
return 1;
}
-
-
-Nurb *addNurbprim(Scene *scene, int type, int stype, int newname)
-/* type: &8= 2D; 0=poly,1 bez, 4 nurb
- * stype: 0: 2/4 points curve
- * 1: 8 points circle
- * 2: 4x4 patch Nurb
- * 3: tube 4:sphere 5:donut
- * 6: 5 points, 5th order straight line (for anim path)
- */
+Nurb *addNurbprim(bContext *C, int type, int newname)
{
- Object *obedit= scene->obedit; // XXX
+ static int xzproj= 0; /* this function calls itself... */
+ Scene *scene= CTX_data_scene(C);
+ Object *obedit= CTX_data_edit_object(C);
ListBase *editnurb= curve_get_editcurve(obedit);
- View3D *v3d= NULL; // XXX
- RegionView3D *rv3d= NULL; // XXX
- static int xzproj= 0;
+ View3D *v3d= CTX_wm_view3d(C);
+ RegionView3D *rv3d= CTX_wm_region_view3d(C);
Nurb *nu = NULL;
BezTriple *bezt;
BPoint *bp;
float *curs, cent[3],vec[3],imat[3][3],mat[3][3];
float fac,cmat[3][3], grid;
- int a, b;
+ int a, b, cutype, stype;
+
+ cutype= type & CU_TYPE; // poly, bezier, nurbs, etc
+ stype= type & CU_PRIMITIVE;
if (v3d) grid = v3d->grid;
else grid = 1.0;
@@ -4085,7 +4080,7 @@ Nurb *addNurbprim(Scene *scene, int type, int stype, int newname)
cent[1]-= obedit->obmat[3][1];
cent[2]-= obedit->obmat[3][2];
- if (v3d) {
+ if (rv3d) {
if ( !(newname) || U.flag & USER_ADD_VIEWALIGNED)
Mat3CpyMat4(imat, rv3d->viewmat);
else Mat3One(imat);
@@ -4096,11 +4091,11 @@ Nurb *addNurbprim(Scene *scene, int type, int stype, int newname)
setflagsNurb(editnurb, 0);
}
else {
- Mat3One(imat);
- cent[0]= cent[1]= cent[2]= 0.0;
+ return NULL;
}
- if (ELEM5(stype, 0, 1, 2, 4, 6)) {
+ /* these types call this function to return a Nurb */
+ if (stype!=CU_PRIM_TUBE && stype!=CU_PRIM_DONUT) {
nu = (Nurb*)MEM_callocN(sizeof(Nurb), "addNurbprim");
nu->type= type;
nu->resolu= 4;
@@ -4108,13 +4103,13 @@ Nurb *addNurbprim(Scene *scene, int type, int stype, int newname)
}
switch(stype) {
- case 0: /* curve */
+ case CU_PRIM_CURVE: /* curve */
nu->resolu= 12; /* set as 4 above */
if(newname) {
rename_id((ID *)obedit, "Curve");
rename_id((ID *)obedit->data, "Curve");
}
- if((type & 7)==CU_BEZIER) {
+ if(cutype==CU_BEZIER) {
nu->pntsu= 2;
nu->bezt =
(BezTriple*)MEM_callocN(2 * sizeof(BezTriple), "addNurbprim1");
@@ -4175,14 +4170,14 @@ Nurb *addNurbprim(Scene *scene, int type, int stype, int newname)
bp= nu->bp;
for(a=0;a<4;a++, bp++) Mat3MulVecfl(imat,bp->vec);
- if((type & 7)==4) {
+ if(cutype==CU_NURBS) {
nu->knotsu= 0; /* makeknots allocates */
makeknots(nu, 1, nu->flagu>>1);
}
}
break;
- case 6: /* 5 point path */
+ case CU_PRIM_PATH: /* 5 point path */
nu->pntsu= 5;
nu->pntsv= 1;
nu->orderu= 5;
@@ -4210,19 +4205,19 @@ Nurb *addNurbprim(Scene *scene, int type, int stype, int newname)
bp= nu->bp;
for(a=0;a<5;a++, bp++) Mat3MulVecfl(imat,bp->vec);
- if((type & 7)==4) {
+ if(cutype==CU_NURBS) {
nu->knotsu= 0; /* makeknots allocates */
makeknots(nu, 1, nu->flagu>>1);
}
break;
- case 1: /* circle */
+ case CU_PRIM_CIRCLE: /* circle */
nu->resolu= 12; /* set as 4 above */
if(newname) {
rename_id((ID *)obedit, "CurveCircle");
rename_id((ID *)obedit->data, "CurveCircle");
}
- if((type & 7)==CU_BEZIER) {
+ if(cutype==CU_BEZIER) {
nu->pntsu= 4;
nu->bezt= callocstructN(BezTriple, 4, "addNurbprim1");
nu->flagu= CU_CYCLIC;
@@ -4269,7 +4264,7 @@ Nurb *addNurbprim(Scene *scene, int type, int stype, int newname)
calchandlesNurb(nu);
}
- else if( (type & 7)==CU_NURBS ) { /* nurb */
+ else if( cutype==CU_NURBS ) { /* nurb */
nu->pntsu= 8;
nu->pntsv= 1;
nu->orderu= 4;
@@ -4300,8 +4295,8 @@ Nurb *addNurbprim(Scene *scene, int type, int stype, int newname)
makeknots(nu, 1, nu->flagu>>1);
}
break;
- case 2: /* 4x4 patch */
- if( (type & 7)==CU_NURBS ) { /* nurb */
+ case CU_PRIM_PATCH: /* 4x4 patch */
+ if( cutype==CU_NURBS ) { /* nurb */
if(newname) {
rename_id((ID *)obedit, "Surf");
rename_id((ID *)obedit->data, "Surf");
@@ -4338,14 +4333,14 @@ Nurb *addNurbprim(Scene *scene, int type, int stype, int newname)
makeknots(nu, 2, nu->flagv>>1);
}
break;
- case 3: /* tube */
- if( (type & 7)==CU_NURBS ) {
+ case CU_PRIM_TUBE: /* tube */
+ if( cutype==CU_NURBS ) {
if(newname) {
rename_id((ID *)obedit, "SurfTube");
rename_id((ID *)obedit->data, "SurfTube");
}
- nu= addNurbprim(scene, 4, 1, newname); /* circle */
+ nu= addNurbprim(C, CU_NURBS|CU_2D|CU_PRIM_CIRCLE, 0); /* circle */
nu->resolu= 4;
nu->flag= CU_SMOOTH;
BLI_addtail(editnurb, nu); /* temporal for extrude and translate */
@@ -4369,8 +4364,8 @@ Nurb *addNurbprim(Scene *scene, int type, int stype, int newname)
}
}
break;
- case 4: /* sphere */
- if( (type & 7)==CU_NURBS ) {
+ case CU_PRIM_SPHERE: /* sphere */
+ if( cutype==CU_NURBS ) {
if(newname) {
rename_id((ID *)obedit, "SurfSphere");
rename_id((ID *)obedit->data, "SurfSphere");
@@ -4416,15 +4411,15 @@ Nurb *addNurbprim(Scene *scene, int type, int stype, int newname)
BLI_remlink(editnurb, nu);
}
break;
- case 5: /* donut */
- if( (type & 7)==CU_NURBS ) {
+ case CU_PRIM_DONUT: /* donut */
+ if( cutype==CU_NURBS ) {
if(newname) {
rename_id((ID *)obedit, "SurfDonut");
rename_id((ID *)obedit->data, "SurfDonut");
}
xzproj= 1;
- nu= addNurbprim(scene, 4, 1, newname); /* circle */
+ nu= addNurbprim(C, CU_NURBS|CU_2D|CU_PRIM_CIRCLE, 0); /* circle */
xzproj= 0;
nu->resolu= 4;
nu->resolv= 4;
@@ -4492,110 +4487,6 @@ void default_curve_ipo(Scene *scene, Curve *cu)
#endif // XXX old animation system
}
-void add_primitiveCurve(Scene *scene, int stype)
-{
- Object *obedit= scene->obedit; // XXX
- ListBase *editnurb= curve_get_editcurve(obedit);
- View3D *v3d= NULL; // XXX
- Nurb *nu;
- Curve *cu;
- int type, newname= 0;
-
- if(v3d==0) return;
- if(scene->id.lib) return;
-
- if(stype>=10 && stype<20) type= CU_2D+1;
- else if(stype>=20 && stype<30) type= CU_2D+2;
- else if(stype>=30 && stype<40) type= CU_2D+3;
- else if(stype>=40 && stype<50) {
- if(stype==46) type= 4;
- else type= CU_2D+4;
- }
- else type= CU_2D;
-
-// XXX check_editmode(OB_CURVE);
-
- /* if no obedit: new object and enter editmode */
- if(obedit==NULL) {
-// XXX add_object_draw(OB_CURVE);
- ED_object_base_init_from_view(NULL, BASACT); // NULL is C
- obedit= BASACT->object;
-
- where_is_object(scene, obedit);
-
- make_editNurb(obedit);
- newname= 1;
-
- cu= obedit->data;
- if(stype==46) {
- cu->flag |= (CU_3D+CU_PATH);
-
- default_curve_ipo(scene, cu);
- }
- }
- else {
- cu= obedit->data;
- }
-
- if(cu->flag & CU_3D) type &= ~CU_2D;
-
- stype= (stype % 10);
-
- nu= addNurbprim(scene, type, stype, newname); /* 2D */
-
- BLI_addtail(editnurb, nu);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-
- /* if a new object was created, it stores it in Curve, for reload original data and undo */
- if ( !(newname) || U.flag & USER_ADD_EDITMODE) {
- if(newname) load_editNurb(obedit);
- } else {
- // XXX
- ED_object_exit_editmode(NULL, EM_FREEDATA|EM_WAITCURSOR);
- }
-
- BIF_undo_push("Add Curve");
-}
-
-void add_primitiveNurb(Scene *scene, int type)
-{
- Object *obedit= scene->obedit; // XXX
- ListBase *editnurb= curve_get_editcurve(obedit);
- Nurb *nu;
- int newname= 0;
-
- if(scene->id.lib) return;
-
-// XXX check_editmode(OB_SURF);
-
- /* if no obedit: new object and enter editmode */
- if(obedit==0) {
-// XXX add_object_draw(OB_SURF);
- ED_object_base_init_from_view(NULL, BASACT); // NULL is C
- obedit= BASACT->object;
-
- where_is_object(scene, obedit);
-
- make_editNurb(obedit);
- newname= 1;
- }
-
- nu= addNurbprim(scene, 4, type, newname);
- BLI_addtail(editnurb,nu);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-
- /* if a new object was created, it stores it in Curve, for reload original data and undo */
- if ( !(newname) || U.flag & USER_ADD_EDITMODE) {
- if(newname) load_editNurb(obedit);
- } else {
- // XXX
- ED_object_exit_editmode(NULL, EM_FREEDATA|EM_WAITCURSOR);
- }
-
- BIF_undo_push("Add Surface");
-}
-
-
void clear_tilt(Scene *scene)
{
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 4531e282e2f..ee9f0a5bb6e 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -112,6 +112,7 @@ typedef enum eAnim_ChannelType {
ANIMTYPE_FCURVE,
ANIMTYPE_FILLACTD,
+ ANIMTYPE_FILLDRIVERS,
ANIMTYPE_FILLMATD,
ANIMTYPE_DSMAT,
@@ -170,7 +171,9 @@ typedef enum eAnimFilter_Flags {
#define FILTER_CUR_OBJD(cu) ((cu->flag & CU_DS_EXPAND))
/* 'Sub-object/Action' channels (flags stored in Action) */
#define SEL_ACTC(actc) ((actc->flag & ACT_SELECTED))
-#define EXPANDED_ACTC(actc) ((actc->flag & ACT_EXPANDED))
+#define EXPANDED_ACTC(actc) ((actc->flag & ACT_COLLAPSED)==0)
+ /* 'Sub-AnimData' chanenls */
+#define EXPANDED_DRVD(adt) ((adt->flag & ADT_DRIVERS_COLLAPSED)==0)
/* Actions (also used for Dopesheet) */
/* Action Channel Group */
diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h
index 076f82c0a70..29411e2cc91 100644
--- a/source/blender/editors/include/ED_curve.h
+++ b/source/blender/editors/include/ED_curve.h
@@ -50,6 +50,8 @@ void free_editNurb (struct Object *obedit);
void mouse_nurb (struct bContext *C, short mval[2], int extend);
+struct Nurb *addNurbprim(struct bContext *C, int type, int newname);
+
/* editfont.h */
void undo_push_font (struct bContext *C, char *name);
void make_editText (struct Object *obedit);
diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h
new file mode 100644
index 00000000000..ac73aa10e4f
--- /dev/null
+++ b/source/blender/editors/include/ED_image.h
@@ -0,0 +1,39 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef ED_IMAGE_H
+#define ED_IMAGE_H
+
+struct SpaceImage;
+
+/* space_image.c, exported for transform */
+struct Image *ED_space_image(struct SpaceImage *sima);
+void ED_space_image_size(struct SpaceImage *sima, int *width, int *height);
+void ED_space_image_uv_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
+
+#endif /* ED_IMAGE_H */
+
diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h
index 8fd5a0152c9..c0646514d1a 100644
--- a/source/blender/editors/include/ED_keyframes_edit.h
+++ b/source/blender/editors/include/ED_keyframes_edit.h
@@ -53,6 +53,8 @@ typedef enum eEditKeyframes_Validate {
BEZT_OK_FRAMERANGE,
BEZT_OK_SELECTED,
BEZT_OK_VALUE,
+ BEZT_OK_VALUERANGE,
+ BEZT_OK_REGION,
} eEditKeyframes_Validate;
/* ------------ */
@@ -71,6 +73,7 @@ typedef enum eEditKeyframes_Snap {
SNAP_KEYS_NEARFRAME,
SNAP_KEYS_NEARSEC,
SNAP_KEYS_NEARMARKER,
+ SNAP_KEYS_HORIZONTAL,
} eEditKeyframes_Snap;
/* mirroring tools */
@@ -89,7 +92,7 @@ typedef enum eEditKeyframes_Mirror {
typedef struct BeztEditData {
ListBase list; /* temp list for storing custom list of data to check */
struct Scene *scene; /* pointer to current scene - many tools need access to cfra/etc. */
- void *data; /* pointer to custom data - usually 'Object', but could be other types too */
+ void *data; /* pointer to custom data - usually 'Object' but also 'rectf', but could be other types too */
float f1, f2; /* storage of times/values as 'decimals' */
int i1, i2; /* storage of times/values/flags as 'whole' numbers */
} BeztEditData;
@@ -126,10 +129,10 @@ BeztEditFunc ANIM_editkeyframes_ipo(short mode);
void delete_fcurve_key(struct FCurve *fcu, int index, short do_recalc);
void delete_fcurve_keys(struct FCurve *fcu);
-void duplicate_fcurve_keys(struct FCurve *fcu); // XXX fixme...
+void duplicate_fcurve_keys(struct FCurve *fcu);
void clean_fcurve(struct FCurve *fcu, float thresh);
-void smooth_fcurve(struct FCurve *fcu, short mode);
+void smooth_fcurve(struct FCurve *fcu);
/* ************************************************ */
diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h
new file mode 100644
index 00000000000..0cd5551f17f
--- /dev/null
+++ b/source/blender/editors/include/ED_node.h
@@ -0,0 +1,35 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef ED_NODE_H
+#define ED_NODE_H
+
+/* drawnode.c */
+void ED_init_node_butfuncs(void);
+
+#endif /* ED_NODE_H */
+
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index e0a6ed86695..8ff716476ad 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -40,6 +40,7 @@ struct Lattice;
struct Mesh;
struct Curve;
+/* object_edit.c */
void ED_operatortypes_object(void);
void ED_keymap_object(struct wmWindowManager *wm);
@@ -51,6 +52,8 @@ void ED_base_object_activate(struct bContext *C, struct Base *base);
void ED_base_object_free_and_unlink(struct Scene *scene, struct Base *base);
void ED_object_apply_obmat(struct Object *ob);
+ /* single object duplicate, if dupflag==0, fully linked, else it uses U.dupflag */
+Base *ED_object_add_duplicate(struct Scene *scene, struct Base *base, int usedupflag);
/* bitflags for enter/exit editmode */
diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h
index 4fe7112bc26..1fbf5453f98 100644
--- a/source/blender/editors/include/ED_util.h
+++ b/source/blender/editors/include/ED_util.h
@@ -30,7 +30,7 @@
struct Object;
struct bContext;
-struct uiMenuBlockHandle;
+struct ARegion;
struct uiBlock;
struct wmOperatorType;
@@ -55,7 +55,7 @@ void undo_editmode_push(struct bContext *C, char *name,
void *undo_editmode_get_prev (struct Object *ob);
-struct uiBlock *editmode_undohistorymenu(struct bContext *C, struct uiMenuBlockHandle *handle, void *arg_unused);
+struct uiBlock *editmode_undohistorymenu(struct bContext *C, struct ARegion *ar, void *arg_unused);
void undo_editmode_menu (struct bContext *C);
void undo_editmode_clear (void);
void undo_editmode_step (struct bContext *C, int step);
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index f027dbc8915..fa106ff4360 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -30,6 +30,8 @@
struct Scene;
struct Object;
+struct MTFace;
+struct EditFace;
struct Image;
struct wmWindowManager;
@@ -41,5 +43,20 @@ void ED_uvedit_assign_image(struct Scene *scene, struct Object *obedit, struct I
void ED_uvedit_set_tile(struct Scene *scene, struct Object *obedit, struct Image *ima, int curtile, int dotile);
int ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float *min, float *max);
+int ED_uvedit_test_silent(struct Object *obedit);
+int ED_uvedit_test(struct Object *obedit);
+
+int uvedit_face_visible(struct Scene *scene, struct Image *ima, struct EditFace *efa, struct MTFace *tf);
+int uvedit_face_selected(struct Scene *scene, struct EditFace *efa, struct MTFace *tf);
+int uvedit_edge_selected(struct Scene *scene, struct EditFace *efa, struct MTFace *tf, int i);
+int uvedit_uv_selected(struct Scene *scene, struct EditFace *efa, struct MTFace *tf, int i);
+
+int ED_uvedit_nearest_uv(struct Scene *scene, struct Object *obedit, struct Image *ima, float co[2], float uv[2]);
+
+/* uvedit_unwrap.c */
+void ED_uvedit_live_unwrap_begin(struct Scene *scene, struct Object *obedit);
+void ED_uvedit_live_unwrap_re_solve(void);
+void ED_uvedit_live_unwrap_end(short cancel);
+
#endif /* ED_UVEDIT_H */
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 95a5220ecca..8ad4ea2a1e7 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -30,6 +30,8 @@
#ifndef UI_INTERFACE_H
#define UI_INTERFACE_H
+/* Struct Declarations */
+
struct ID;
struct ListBase;
struct ARegion;
@@ -42,6 +44,12 @@ struct PointerRNA;
struct PropertyRNA;
struct ReportList;
+typedef struct uiBut uiBut;
+typedef struct uiBlock uiBlock;
+typedef struct uiPopupBlockHandle uiPopupBlockHandle;
+
+/* Defines */
+
/* uiBlock->dt */
#define UI_EMBOSS 0 /* use one of the themes for drawing */
#define UI_EMBOSSN 1 /* Nothing */
@@ -76,7 +84,7 @@ struct ReportList;
#define UI_BLOCK_MOVEMOUSE_QUIT 128
#define UI_BLOCK_KEEP_OPEN 256
-/* uiMenuBlockHandle->menuretval */
+/* uiPopupBlockHandle->menuretval */
#define UI_RETURN_CANCEL 1 /* cancel all menus cascading */
#define UI_RETURN_OK 2 /* choice made */
#define UI_RETURN_OUT 4 /* left the menu */
@@ -169,12 +177,13 @@ struct ReportList;
#define ICONTOGN (34<<9)
#define FTPREVIEW (35<<9)
#define NUMABS (36<<9)
+#define HMENU (37<<9)
#define BUTTYPE (63<<9)
-typedef struct uiBut uiBut;
-typedef struct uiBlock uiBlock;
-
-/* Common Drawing Functions */
+/* Drawing
+ *
+ * Functions to draw various shapes, taking theme settings into account.
+ * Used for code that draws its own UI style elements. */
void uiEmboss(float x1, float y1, float x2, float y2, int sel);
void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad);
@@ -183,91 +192,137 @@ void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad);
void uiDrawMenuBox(float minx, float miny, float maxx, float maxy, short flag, short direction);
void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy);
-/* Popup Menu's */
-
-typedef struct uiMenuBlockHandle {
- /* internal */
- struct ARegion *region;
- int towardsx, towardsy;
- double towardstime;
- int dotowards;
-
- int popup;
- void (*popup_func)(struct bContext *C, void *arg, int event);
- void *popup_arg;
- /* for operator menus */
- struct wmOperator *op_arg;
- const char *propname;
-
- /* return values */
- int butretval;
- int menuretval;
- float retvalue;
- float retvec[3];
-} uiMenuBlockHandle;
-
-typedef uiBlock* (*uiBlockFuncFP)(struct bContext *C, struct uiMenuBlockHandle *handle, void *arg1);
-typedef void (*uiPupmenuFunc)(struct bContext *C, void *arg, int event);
-
-void uiPupmenuSetActive(int val);
-
-void uiPupmenuOperator(struct bContext *C, int maxrow, struct wmOperator *op, const char *propname, char *str);
-void uiPupmenu(struct bContext *C, int maxrow, uiPupmenuFunc func, void *arg, char *str, ...);
-void uiPupmenuOkee(struct bContext *C, char *opname, char *str, ...);
-void uiPupmenuSaveOver(struct bContext *C, char *opname, char *filename, ...);
-void uiPupmenuNotice(struct bContext *C, char *str, ...);
-void uiPupmenuError(struct bContext *C, char *str, ...);
-void uiPupmenuReports(struct bContext *C, struct ReportList *reports);
-
-/* Custom popup menus and toolbox */
+/* Menus
+ *
+ * These functions are used by popup menus, toolbox and header menus. They
+ * assume uiMenuItem head is already created, which is done by uiMenuButton
+ * for header menus, or can be done with uiPupMenuBegin for popups. These
+ * functions do not use uiDefBut functions in order to simplify creating
+ * them, and to permit other types of menus (radial, ..) in the future. */
+
typedef struct uiMenuItem uiMenuItem;
-uiMenuItem *uiMenuBegin(const char *title);
+typedef void (*uiMenuCreateFunc)(struct bContext *C, uiMenuItem *head, void *arg1);
+typedef void (*uiMenuHandleFunc)(struct bContext *C, void *arg, int event);
-void uiMenuFunc(uiMenuItem *head, void (*eventfunc)(struct bContext *, void *, int), void *argv);
+void uiMenuFunc(uiMenuItem *head, uiMenuHandleFunc handlefunc, void *argv);
void uiMenuContext(uiMenuItem *head, int opcontext);
void uiMenuItemVal(uiMenuItem *head, const char *name, int icon, int argval);
+
void uiMenuItemEnumO(uiMenuItem *head, char *opname, char *propname, int value);
+void uiMenuItemBooleanO(uiMenuItem *head, char *opname, char *propname, int value);
void uiMenuItemsEnumO(uiMenuItem *head, char *opname, char *propname);
+void uiMenuItemFloatO(uiMenuItem *head, const char *name, char *opname, char *propname, float value);
void uiMenuItemO(uiMenuItem *head, char *name, int icon);
-void uiMenuLevel(uiMenuItem *head, const char *name, void (*newlevel)(uiMenuItem *));
+
+void uiMenuItemBooleanR(uiMenuItem *head, struct PointerRNA *ptr, char *propname);
+void uiMenuItemEnumR(uiMenuItem *head, struct PointerRNA *ptr, char *propname, int value);
+void uiMenuItemsEnumR(uiMenuItem *head, struct PointerRNA *ptr, char *propname);
+
+void uiMenuLevel(uiMenuItem *head, const char *name, uiMenuCreateFunc newlevel);
void uiMenuLevelEnumO(uiMenuItem *head, char *opname, char *propname);
+void uiMenuLevelEnumR(uiMenuItem *head, struct PointerRNA *ptr, char *propname);
+
+void uiMenuSeparator(uiMenuItem *head);
+
+/* Popup Menus
+ *
+ * Functions used to create popup menus. For more extended menus the
+ * uiPupMenuBegin/End functions can be used to define own items with
+ * the uiMenu functions inbetween. If it is a simple confirmation menu
+ * or similar, popups can be created with a single function call. */
+
+uiMenuItem *uiPupMenuBegin(const char *title);
+void uiPupMenuEnd(struct bContext *C, struct uiMenuItem *head);
+
+void uiPupMenu(struct bContext *C, int maxrow, uiMenuHandleFunc func, void *arg, char *str, ...);
+void uiPupMenuOperator(struct bContext *C, int maxrow, struct wmOperator *op, const char *propname, char *str);
+void uiPupMenuOkee(struct bContext *C, char *opname, char *str, ...);
+void uiPupMenuSaveOver(struct bContext *C, char *opname, char *filename, ...);
+void uiPupMenuNotice(struct bContext *C, char *str, ...);
+void uiPupMenuError(struct bContext *C, char *str, ...);
+void uiPupMenuReports(struct bContext *C, struct ReportList *reports);
+
+void uiPupMenuSetActive(int val);
-void uiMenuEnd(struct bContext *C, struct uiMenuItem *head);
+/* Popup Blocks
+ *
+ * Functions used to create popup blocks. These are like popup menus
+ * but allow using all button types and creating an own layout. */
+
+uiBlock *uiPupBlockBegin(struct bContext *C, const char *title);
+void uiPupBlockEnd(struct bContext *C, uiBlock *block);
-/* Block */
+/* Blocks
+ *
+ * Functions for creating, drawing and freeing blocks. A Block is a
+ * container of buttons and used for various purposes.
+ *
+ * Begin/Define Buttons/End/Draw is the typical order in which these
+ * function should be called, though for popup blocks Draw is left out.
+ * Freeing blocks is done by the screen/ module automatically.
+ *
+ * */
uiBlock *uiBeginBlock(const struct bContext *C, struct ARegion *region, char *name, short dt, short font);
void uiEndBlock(const struct bContext *C, uiBlock *block);
void uiDrawBlock(const struct bContext *C, struct uiBlock *block);
+
uiBlock *uiGetBlock(char *name, struct ARegion *ar);
+
void uiFreeBlock(const struct bContext *C, uiBlock *block);
void uiFreeBlocks(const struct bContext *C, struct ListBase *lb);
void uiFreeInactiveBlocks(const struct bContext *C, struct ListBase *lb);
-void uiBoundsBlock(struct uiBlock *block, int addval);
-void uiTextBoundsBlock(uiBlock *block, int addval);
-
void uiBlockSetButLock(uiBlock *block, int val, char *lockstr);
void uiBlockClearButLock(uiBlock *block);
+/* Appearance/Cruft
+ *
+ * These functions should mostly dissappear ideally, or become internal.
+ * Font handling could move to blenfont/, and appearance could be dictated
+ * better by high level information instead of spread out all over. */
+
+void uiSetCurFont(uiBlock *block, int index);
+void *uiSetCurFont_ext(float aspect);
+void uiDefFont(unsigned int index, void *xl, void *large, void *medium, void *small);
+void *uiBlockGetCurFont (uiBlock *block);
+
/* automatic aligning, horiz or verical */
void uiBlockBeginAlign(uiBlock *block);
void uiBlockEndAlign(uiBlock *block);
-/* Misc */
+void uiBoundsBlock(struct uiBlock *block, int addval);
+void uiTextBoundsBlock(uiBlock *block, int addval);
+void uiPopupBoundsBlock(uiBlock *block, int addval);
-void uiSetCurFont(uiBlock *block, int index);
-void *uiSetCurFont_ext(float aspect);
-void uiDefFont(unsigned int index, void *xl, void *large, void *medium, void *small);
+int uiBlocksGetYMin (ListBase *lb);
+int uiBlockGetCol (uiBlock *block);
-void uiComposeLinks(uiBlock *block);
-uiBut *uiFindInlink(uiBlock *block, void *poin);
+void uiBlockSetCol (uiBlock *block, int col);
+void uiBlockSetEmboss (uiBlock *block, int emboss);
+void uiBlockSetDirection (uiBlock *block, int direction);
+void uiBlockFlipOrder (uiBlock *block);
+void uiBlockSetFlag (uiBlock *block, int flag);
+void uiBlockSetXOfs (uiBlock *block, int xofs);
-void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval);
+int uiButGetRetVal (uiBut *but);
+
+void uiButSetFlag (uiBut *but, int flag);
+void uiButClearFlag (uiBut *but, int flag);
-/* Defining Buttons */
+void uiAutoBlock(uiBlock *block, float minx, float miny, float sizex, float sizey, int flag);
+
+/* Buttons
+ *
+ * Functions to define various types of buttons in a block. Postfixes:
+ * - F: float
+ * - I: int
+ * - S: short
+ * - C: char
+ * - R: RNA
+ * - O: operator */
uiBut *uiDefBut(uiBlock *block,
int type, int retval, char *str,
@@ -323,65 +378,93 @@ uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int i
uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, 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 *uiDefIconTextButO(uiBlock *block, int type, char *opname, int opcontext, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
-typedef void (*uiIDPoinFuncFP) (struct bContext *C, char *str, struct ID **idpp);
+/* for passing inputs to ButO buttons */
+struct PointerRNA *uiButGetOperatorPtrRNA(uiBut *but);
+
+/* Special Buttons
+ *
+ * Butons with a more specific purpose:
+ * - IDPoinBut: for creating buttons that work on a pointer to an ID block.
+ * - MenuBut: buttons that popup a menu (in headers usually).
+ * - PulldownBut: like MenuBut, but creating a uiBlock (for compatibility).
+ * - BlockBut: buttons that popup a block with more buttons.
+ * - KeyevtBut: buttons that can be used to turn key events into values.
+ * - PickerButtons: buttons like the color picker (for code sharing). */
+
+typedef uiBlock* (*uiBlockCreateFunc)(struct bContext *C, struct ARegion *ar, void *arg1);
+typedef void (*uiIDPoinFuncFP)(struct bContext *C, char *str, struct ID **idpp);
+
uiBut *uiDefIDPoinBut(struct uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, char *str,
short x1, short y1, short x2, short y2, void *idpp, char *tip);
-uiBut *uiDefBlockBut(uiBlock *block, uiBlockFuncFP func, void *func_arg1, char *str, short x1, short y1, short x2, short y2, char *tip);
-uiBut *uiDefPulldownBut(uiBlock *block, uiBlockFuncFP func, void *func_arg1, char *str, short x1, short y1, short x2, short y2, char *tip);
+uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip);
+uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip);
+uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
-uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
-uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int retval, int icon, short x1, short y1, short x2, short y2, char *tip);
+uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *func_arg1, char *str, short x1, short y1, short x2, short y2, char *tip);
+uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int retval, int icon, short x1, short y1, short x2, short y2, char *tip);
+uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
void uiDefKeyevtButS(uiBlock *block, int retval, char *str, short x1, short y1, short x2, short y2, short *spoin, char *tip);
-uiBut *uiDefMenuButO(uiBlock *block, char *opname, char *name);
-uiBut *uiDefMenuSep(uiBlock *block);
-uiBut *uiDefMenuSub(uiBlock *block, uiBlockFuncFP func, char *name);
-uiBut *uiDefMenuTogR(uiBlock *block, struct PointerRNA *ptr, char *propname, char *propvalue, char *name);
-
-void uiAutoBlock(struct uiBlock *block,
- float minx, float miny,
- float sizex, float sizey, int flag);
-void uiSetButLink(struct uiBut *but,
- void **poin,
- void ***ppoin,
- short *tot,
- int from, int to);
+void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval);
-int uiBlocksGetYMin (ListBase *lb);
-int uiBlockGetCol (uiBlock *block);
-void* uiBlockGetCurFont (uiBlock *block);
+/* Links
+ *
+ * Game engine logic brick links. Non-functional currently in 2.5,
+ * code to handle and draw these is disabled internally. */
-void uiBlockSetCol (uiBlock *block, int col);
-void uiBlockSetEmboss (uiBlock *block, int emboss);
-void uiBlockSetDirection (uiBlock *block, int direction);
-void uiBlockFlipOrder (uiBlock *block);
-void uiBlockSetFlag (uiBlock *block, int flag);
-void uiBlockSetXOfs (uiBlock *block, int xofs);
+void uiSetButLink(struct uiBut *but, void **poin, void ***ppoin, short *tot, int from, int to);
-int uiButGetRetVal (uiBut *but);
+void uiComposeLinks(uiBlock *block);
+uiBut *uiFindInlink(uiBlock *block, void *poin);
-void uiButSetFlag (uiBut *but, int flag);
-void uiButClearFlag (uiBut *but, int flag);
+/* Callbacks
+ *
+ * uiBlockSetHandleFunc/ButmFunc are for handling events through a callback.
+ * HandleFunc gets the retval passed on, and ButmFunc gets a2. The latter is
+ * mostly for compatibility with older code.
+ *
+ * uiButSetCompleteFunc is for tab completion.
+ *
+ * uiBlockSetFunc and uiButSetFunc are callbacks run when a button is used,
+ * in case events, operators or RNA are not sufficient to handle the button. */
-struct PointerRNA *uiButGetOperatorPtrRNA(uiBut *but);
+typedef void (*uiButHandleFunc)(struct bContext *C, void *arg1, void *arg2);
+typedef void (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg);
+typedef void (*uiBlockHandleFunc)(struct bContext *C, void *arg, int event);
-void uiBlockSetHandleFunc(uiBlock *block, void (*func)(struct bContext *C, void *arg, int event), void *arg);
-void uiBlockSetButmFunc (uiBlock *block, void (*func)(struct bContext *C, void *arg, int but_a2), void *arg);
+void uiBlockSetHandleFunc(uiBlock *block, uiBlockHandleFunc func, void *arg);
+void uiBlockSetButmFunc (uiBlock *block, uiMenuHandleFunc func, void *arg);
-void uiBlockSetFunc (uiBlock *block, void (*func)(struct bContext *C, void *arg1, void *arg2), void *arg1, void *arg2);
-void uiButSetFunc (uiBut *but, void (*func)(struct bContext *C, void *arg1, void *arg2), void *arg1, void *arg2);
+void uiBlockSetFunc (uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2);
+void uiButSetFunc (uiBut *but, uiButHandleFunc func, void *arg1, void *arg2);
-void uiButSetCompleteFunc(uiBut *but, void (*func)(struct bContext *C, char *str, void *arg), void *arg);
+void uiButSetCompleteFunc(uiBut *but, uiButCompleteFunc func, void *arg);
void uiBlockSetDrawExtraFunc(uiBlock *block, void (*func)(struct bContext *C, uiBlock *block));
-/* Panels */
+/* Autocomplete
+ *
+ * Tab complete helper functions, for use in uiButCompleteFunc callbacks.
+ * Call begin once, then multiple times do_name with all possibilities,
+ * and finally end to finish and get the completed name. */
+
+typedef struct AutoComplete AutoComplete;
+
+AutoComplete *autocomplete_begin(char *startname, int maxlen);
+void autocomplete_do_name(AutoComplete *autocpl, const char *name);
+void autocomplete_end(AutoComplete *autocpl, char *autoname);
+
+/* Panels
+ *
+ * Functions for creating, freeing and drawing panels. The API here
+ * could use a good cleanup, though how they will function in 2.5 is
+ * not clear yet so we postpone that. */
-extern void uiFreePanels(struct ListBase *lb);
extern void uiNewPanelTabbed(char *, char *);
extern int uiNewPanel(const struct bContext *C, struct ARegion *ar, uiBlock *block, char *panelname, char *tabname, int ofsx, int ofsy, int sizex, int sizey);
+extern void uiFreePanels(struct ListBase *lb);
extern void uiDrawPanels(const struct bContext *C, int re_align);
extern void uiSetPanelsView2d(struct ARegion *ar);
@@ -394,25 +477,31 @@ extern int uiAlignPanelStep(struct ScrArea *sa, struct ARegion *ar, float fac);
extern void uiPanelControl(int);
extern void uiSetPanelHandler(int);
-/* Autocomplete */
-
-typedef struct AutoComplete AutoComplete;
-
-AutoComplete *autocomplete_begin(char *startname, int maxlen);
-void autocomplete_do_name(AutoComplete *autocpl, const char *name);
-void autocomplete_end(AutoComplete *autocpl, char *autoname);
-
-/* Handlers for regions with UI blocks */
+/* Handlers
+ *
+ * Handlers that can be registered in regions, areas and windows for
+ * handling WM events. Mostly this is done automatic by modules such
+ * as screen/ if ED_KEYMAP_UI is set, or internally in popup functions. */
void UI_add_region_handlers(struct ListBase *handlers);
void UI_add_area_handlers(struct ListBase *handlers);
-void UI_add_popup_handlers(struct ListBase *handlers, uiMenuBlockHandle *menu);
+void UI_add_popup_handlers(struct ListBase *handlers, uiPopupBlockHandle *menu);
-/* Module initialization and exit */
+/* Module
+ *
+ * init and exit should be called before using this module. init_userdef must
+ * be used to reinitialize some internal state if user preferences change. */
void UI_init(void);
void UI_init_userdef(void);
void UI_exit(void);
+/* XXX hide this */
+
+uiBut *uiDefMenuButO(uiBlock *block, char *opname, char *name);
+uiBut *uiDefMenuSep(uiBlock *block);
+uiBut *uiDefMenuSub(uiBlock *block, uiBlockCreateFunc func, char *name);
+uiBut *uiDefMenuTogR(uiBlock *block, struct PointerRNA *ptr, char *propname, char *propvalue, char *name);
+
#endif /* UI_INTERFACE_H */
diff --git a/source/blender/editors/include/UI_text.h b/source/blender/editors/include/UI_text.h
index 03a51f5ee49..860fd5e15aa 100644
--- a/source/blender/editors/include/UI_text.h
+++ b/source/blender/editors/include/UI_text.h
@@ -32,14 +32,9 @@
struct BMF_Font;
-int read_languagefile(void); /* usiblender.c */
-void free_languagemenu(void); /* usiblender.c */
-
void set_interface_font(char *str); /* headerbuttons.c */
void start_interface_font(void); /* headerbuttons.c */
-void lang_setlanguage(void); /* usiblender.c */
-char *language_pup(void);
char *fontsize_pup(void);
int UI_DrawString(struct BMF_Font* font, char *str, int translate);
@@ -53,15 +48,6 @@ void UI_RasterPos(float x, float y);
void UI_SetScale(float aspect);
void ui_text_init_userdef(void);
-struct LANGMenuEntry {
- struct LANGMenuEntry *next;
- char *line;
- char *language;
- char *code;
- int id;
-};
-
-struct LANGMenuEntry *find_language(short langid);
#endif /* UI_TEXT_H */
diff --git a/source/blender/editors/interface/Makefile b/source/blender/editors/interface/Makefile
index fe223fabf2a..fa9550041c5 100644
--- a/source/blender/editors/interface/Makefile
+++ b/source/blender/editors/interface/Makefile
@@ -49,6 +49,7 @@ CPPFLAGS += -I../../makesdna
CPPFLAGS += -I../../makesrna
CPPFLAGS += -I../../imbuf
CPPFLAGS += -I../../ftfont
+CPPFLAGS += -I../../blenfont
# own include
diff --git a/source/blender/editors/interface/SConscript b/source/blender/editors/interface/SConscript
index f9af9b5e078..38cb876beb7 100644
--- a/source/blender/editors/interface/SConscript
+++ b/source/blender/editors/interface/SConscript
@@ -3,7 +3,7 @@ Import ('env')
sources = env.Glob('*.c')
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
+incs = '../include ../../blenlib ../../blenfont ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../makesrna ../../windowmanager #/intern/guardedalloc #intern/bmfont'
incs += ' #/extern/glew/include'
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index f4696cab08c..ff4e1f46145 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -207,11 +207,27 @@ void ui_window_to_region(const ARegion *ar, int *x, int *y)
/* ******************* block calc ************************* */
-/* only for pulldowns */
-void uiTextBoundsBlock(uiBlock *block, int addval)
+static void ui_block_translate(uiBlock *block, int x, int y)
+{
+ uiBut *bt;
+
+ for(bt= block->buttons.first; bt; bt=bt->next) {
+ bt->x1 += x;
+ bt->y1 += y;
+ bt->x2 += x;
+ bt->y2 += y;
+ }
+
+ block->minx += x;
+ block->miny += y;
+ block->maxx += x;
+ block->maxy += y;
+}
+
+static void ui_text_bounds_block(uiBlock *block, float offset)
{
uiBut *bt;
- int i = 0, j, x1addval= 0, nextcol;
+ int i = 0, j, x1addval= offset, nextcol;
bt= block->buttons.first;
while(bt) {
@@ -233,25 +249,22 @@ void uiTextBoundsBlock(uiBlock *block, int addval)
else nextcol= 0;
bt->x1 = x1addval;
- bt->x2 = bt->x1 + i + addval;
+ bt->x2 = bt->x1 + i + block->bounds;
ui_check_but(bt); // clips text again
if(nextcol)
- x1addval+= i + addval;
+ x1addval+= i + block->bounds;
bt= bt->next;
}
}
-void uiBoundsBlock(uiBlock *block, int addval)
+void ui_bounds_block(uiBlock *block)
{
uiBut *bt;
int xof;
- if(block==NULL)
- return;
-
if(block->buttons.first==NULL) {
if(block->panel) {
block->minx= 0.0; block->maxx= block->panel->sizex;
@@ -274,10 +287,10 @@ void uiBoundsBlock(uiBlock *block, int addval)
bt= bt->next;
}
- block->minx -= addval;
- block->miny -= addval;
- block->maxx += addval;
- block->maxy += addval;
+ block->minx -= block->bounds;
+ block->miny -= block->bounds;
+ block->maxx += block->bounds;
+ block->maxy += block->bounds;
}
/* hardcoded exception... but that one is annoying with larger safety */
@@ -291,34 +304,80 @@ void uiBoundsBlock(uiBlock *block, int addval)
block->safety.ymax= block->maxy+xof;
}
-void uiBlockTranslate(uiBlock *block, int x, int y)
+static void ui_popup_bounds_block(const bContext *C, uiBlock *block)
{
- uiBut *bt;
+ int startx, starty, endx, endy, width, height;
+ int oldbounds, mx, my, xmax, ymax;
- for(bt= block->buttons.first; bt; bt=bt->next) {
- bt->x1 += x;
- bt->y1 += y;
- bt->x2 += x;
- bt->y2 += y;
+ oldbounds= block->bounds;
+
+ /* compute bounds */
+ ui_bounds_block(block);
+ mx= block->minx;
+ my= block->miny;
+
+ wm_window_get_size(CTX_wm_window(C), &xmax, &ymax);
+
+ /* first we ensure wide enough text bounds */
+ block->bounds= 50;
+ ui_text_bounds_block(block, block->minx);
+
+ /* next we recompute bounds */
+ block->bounds= oldbounds;
+ ui_bounds_block(block);
+
+ /* and we adjust the position to fit within window */
+ width= block->maxx - block->minx;
+ height= block->maxy - block->miny;
+
+ startx= mx-(0.8*(width));
+ starty= my;
+
+ if(startx<10)
+ startx= 10;
+ if(starty<10)
+ starty= 10;
+
+ endx= startx+width;
+ endy= starty+height;
+
+ if(endx>xmax) {
+ endx= xmax-10;
+ startx= endx-width;
+ }
+ if(endy>ymax-20) {
+ endy= ymax-20;
+ starty= endy-height;
}
- block->minx += x;
- block->miny += y;
- block->maxx += x;
- block->maxy += y;
+ ui_block_translate(block, startx - block->minx, starty - block->miny);
+
+ /* now recompute bounds and safety */
+ ui_bounds_block(block);
}
-void uiBlockOrigin(uiBlock *block)
+/* used for various cases */
+void uiBoundsBlock(uiBlock *block, int addval)
{
- uiBut *bt;
- int minx= 10000, miny= 10000;
+ if(block==NULL)
+ return;
+
+ block->bounds= addval;
+ block->dobounds= 1;
+}
- for(bt= block->buttons.first; bt; bt=bt->next) {
- if(bt->x1 < minx) minx= bt->x1;
- if(bt->y1 < miny) miny= bt->y1;
- }
+/* used for pulldowns */
+void uiTextBoundsBlock(uiBlock *block, int addval)
+{
+ block->bounds= addval;
+ block->dobounds= 2;
+}
- uiBlockTranslate(block, -minx, -miny);
+/* used for menu popups */
+void uiPopupBoundsBlock(uiBlock *block, int addval)
+{
+ block->bounds= addval;
+ block->dobounds= 3;
}
void ui_autofill(uiBlock *block)
@@ -433,8 +492,8 @@ static int ui_but_equals_old(uiBut *but, uiBut *oldbut)
if(but->rnaprop != oldbut->rnaprop)
if(but->rnaindex != oldbut->rnaindex) return 0;
if(but->func != oldbut->func) return 0;
- if(but->func_arg1 != oldbut->func_arg1) return 0;
- if(but->func_arg2 != oldbut->func_arg2) return 0;
+ if(oldbut->func_arg1 != oldbut && but->func_arg1 != oldbut->func_arg1) return 0;
+ if(oldbut->func_arg2 != oldbut && but->func_arg2 != oldbut->func_arg2) return 0;
return 1;
}
@@ -479,16 +538,21 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut
return found;
}
-static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
+void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
{
uiBut *but;
+ IDProperty *prop;
char buf[512], *butstr;
- /* XXX bounds? */
+ /* only do it before bounding */
+ if(block->minx != block->maxx)
+ return;
+
for(but=block->buttons.first; but; but=but->next) {
- /* only hotkey for menus without properties */
- if(but->opname && but->opptr==NULL) {
- if(WM_key_event_operator_string(C, but->opname, but->opcontext, buf, sizeof(buf))) {
+ if(but->opname) {
+ prop= (but->opptr)? but->opptr->data: NULL;
+
+ if(WM_key_event_operator_string(C, but->opname, but->opcontext, prop, buf, sizeof(buf))) {
butstr= MEM_mallocN(strlen(but->str)+strlen(buf)+2, "menu_block_set_keymaps");
strcpy(butstr, but->str);
strcat(butstr, "|");
@@ -526,9 +590,17 @@ void uiEndBlock(const bContext *C, uiBlock *block)
/* handle pending stuff */
if(block->flag & UI_BLOCK_LOOP) ui_menu_block_set_keymaps(C, block);
+
+ /* after keymaps! */
+ if(block->dobounds == 1) ui_bounds_block(block);
+ else if(block->dobounds == 2) ui_text_bounds_block(block, 0.0f);
+ else if(block->dobounds == 3) ui_popup_bounds_block(C, block);
+
if(block->autofill) ui_autofill(block);
if(block->minx==0.0 && block->maxx==0.0) uiBoundsBlock(block, 0);
if(block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
+
+ block->endblock= 1;
}
/* ************** BLOCK DRAWING FUNCTION ************* */
@@ -537,6 +609,9 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
{
uiBut *but;
+ if(!block->endblock)
+ uiEndBlock(C, block);
+
/* we set this only once */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -1767,6 +1842,7 @@ static int ui_auto_themecol(uiBut *but)
case TEX:
return TH_BUT_TEXTFIELD;
case PULLDOWN:
+ case HMENU:
case BLOCK:
case MENU:
case BUTM:
@@ -2103,6 +2179,18 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1,
freestr= 1;
}
+ else if(type == ROW && proptype == PROP_ENUM) {
+ const EnumPropertyItem *item;
+ int i, totitem;
+
+ RNA_property_enum_items(ptr, prop, &item, &totitem);
+ for(i=0; i<totitem; i++)
+ if(item[i].value == (int)max)
+ str= (char*)item[i].name;
+
+ if(!str)
+ str= (char*)RNA_property_ui_name(ptr, prop);
+ }
else
str= (char*)RNA_property_ui_name(ptr, prop);
}
@@ -2564,7 +2652,7 @@ uiBut *uiDefMenuSep(uiBlock *block)
return uiDefBut(block, SEPR, 0, "", 0, y, MENU_WIDTH, MENU_SEP_HEIGHT, NULL, 0.0, 0.0, 0, 0, "");
}
-uiBut *uiDefMenuSub(uiBlock *block, uiBlockFuncFP func, char *name)
+uiBut *uiDefMenuSub(uiBlock *block, uiBlockCreateFunc func, char *name)
{
int y= ui_menu_y(block) - MENU_ITEM_HEIGHT;
return uiDefIconTextBlockBut(block, func, NULL, ICON_RIGHTARROW_THIN, name, 0, y, MENU_WIDTH, MENU_ITEM_HEIGHT-1, "");
@@ -2798,24 +2886,48 @@ uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int
return but;
}
-uiBut *uiDefBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip)
+uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip)
{
uiBut *but= ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
- but->block_func= func;
+ but->block_create_func= func;
ui_check_but(but);
return but;
}
-uiBut *uiDefPulldownBut(uiBlock *block, uiBlockFuncFP func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip)
+uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip)
{
uiBut *but= ui_def_but(block, PULLDOWN, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
- but->block_func= func;
+ but->block_create_func= func;
ui_check_but(but);
return but;
}
+uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip)
+{
+ uiBut *but= ui_def_but(block, HMENU, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+ but->menu_create_func= func;
+ ui_check_but(but);
+ return but;
+}
+
+uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip)
+{
+ uiBut *but= ui_def_but(block, HMENU, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+
+ but->icon= (BIFIconID) icon;
+ but->flag|= UI_HAS_ICON;
+
+ but->flag|= UI_ICON_LEFT;
+ but->flag|= UI_ICON_RIGHT;
+
+ but->menu_create_func= func;
+ ui_check_but(but);
+
+ return but;
+}
+
/* Block button containing both string label and icon */
-uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip)
+uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip)
{
uiBut *but= ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
@@ -2825,14 +2937,14 @@ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int
but->flag|= UI_ICON_LEFT;
but->flag|= UI_ICON_RIGHT;
- but->block_func= func;
+ but->block_create_func= func;
ui_check_but(but);
return but;
}
/* Block button containing icon */
-uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int retval, int icon, short x1, short y1, short x2, short y2, char *tip)
+uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int retval, int icon, short x1, short y1, short x2, short y2, char *tip)
{
uiBut *but= ui_def_but(block, BLOCK, retval, "", x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
@@ -2842,7 +2954,7 @@ uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int retv
but->flag|= UI_ICON_LEFT;
but->flag|= UI_ICON_RIGHT;
- but->block_func= func;
+ but->block_create_func= func;
ui_check_but(but);
return but;
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 799c1cc743c..db9f621c1fd 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -3214,7 +3214,8 @@ void ui_set_embossfunc(uiBut *but, int drawtype)
// standard builtin first:
if(but->type==LABEL || but->type==ROUNDBOX) but->embossfunc= ui_draw_nothing;
- else if(but->type==PULLDOWN) but->embossfunc= ui_draw_pulldown_round;
+ else if(ELEM(but->type, PULLDOWN, HMENU) && !(but->block->flag & UI_BLOCK_LOOP))
+ but->embossfunc= ui_draw_pulldown_round;
else if(drawtype==UI_EMBOSSM) but->embossfunc= ui_draw_minimal;
else if(drawtype==UI_EMBOSSN) but->embossfunc= ui_draw_nothing;
else if(drawtype==UI_EMBOSSP) but->embossfunc= ui_draw_pulldown_item;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index bfe6057cfce..61ea1b1b8e3 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -122,7 +122,7 @@ typedef struct uiHandleButtonData {
CBData *dragcbd;
/* menu open */
- uiMenuBlockHandle *menu;
+ uiPopupBlockHandle *menu;
int menuretval;
/* post activate */
@@ -157,6 +157,51 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
static int ui_handler_region_menu(bContext *C, wmEvent *event, void *userdata);
static int ui_handler_popup(bContext *C, wmEvent *event, void *userdata);
static void ui_handler_remove_popup(bContext *C, void *userdata);
+static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type);
+
+/* ******************** menu navigation helpers ************** */
+
+static uiBut *ui_but_prev(uiBut *but)
+{
+ while(but->prev) {
+ but= but->prev;
+ if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
+ }
+ return NULL;
+}
+
+static uiBut *ui_but_next(uiBut *but)
+{
+ while(but->next) {
+ but= but->next;
+ if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
+ }
+ return NULL;
+}
+
+static uiBut *ui_but_first(uiBlock *block)
+{
+ uiBut *but;
+
+ but= block->buttons.first;
+ while(but) {
+ if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
+ but= but->next;
+ }
+ return NULL;
+}
+
+static uiBut *ui_but_last(uiBlock *block)
+{
+ uiBut *but;
+
+ but= block->buttons.last;
+ while(but) {
+ if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
+ but= but->prev;
+ }
+ return NULL;
+}
/* ********************** button apply/revert ************************/
@@ -553,6 +598,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
case ICONTEXTROW:
case BLOCK:
case PULLDOWN:
+ case HMENU:
case COL:
ui_apply_but_BLOCK(C, but, data);
break;
@@ -1384,13 +1430,19 @@ static void ui_numedit_apply(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
{
- uiBlockFuncFP func= NULL;
+ uiBlockCreateFunc func= NULL;
+ uiBlockHandleCreateFunc handlefunc= NULL;
+ uiMenuCreateFunc menufunc= NULL;
void *arg= NULL;
switch(but->type) {
case BLOCK:
case PULLDOWN:
- func= but->block_func;
+ func= but->block_create_func;
+ arg= but->poin;
+ break;
+ case HMENU:
+ menufunc= but->menu_create_func;
arg= but->poin;
break;
case MENU:
@@ -1398,15 +1450,15 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data
data->value= data->origvalue;
but->editval= &data->value;
- func= ui_block_func_MENU;
+ handlefunc= ui_block_func_MENU;
arg= but;
break;
case ICONROW:
- func= ui_block_func_ICONROW;
+ handlefunc= ui_block_func_ICONROW;
arg= but;
break;
case ICONTEXTROW:
- func= ui_block_func_ICONTEXTROW;
+ handlefunc= ui_block_func_ICONTEXTROW;
arg= but;
break;
case COL:
@@ -1414,13 +1466,18 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data
VECCOPY(data->vec, data->origvec);
but->editvec= data->vec;
- func= ui_block_func_COL;
+ handlefunc= ui_block_func_COL;
arg= but;
break;
}
- if(func) {
- data->menu= ui_menu_block_create(C, data->region, but, func, arg);
+ if(func || handlefunc) {
+ data->menu= ui_popup_block_create(C, data->region, but, func, handlefunc, arg);
+ if(but->block->handle)
+ data->menu->popup= but->block->handle->popup;
+ }
+ else if(menufunc) {
+ data->menu= ui_popup_menu_create(C, data->region, but, menufunc, arg);
if(but->block->handle)
data->menu->popup= but->block->handle->popup;
}
@@ -1439,7 +1496,7 @@ static void ui_blockopen_end(bContext *C, uiBut *but, uiHandleButtonData *data)
}
if(data->menu) {
- ui_menu_block_free(C, data->menu);
+ ui_popup_block_free(C, data->menu);
data->menu= NULL;
}
}
@@ -2613,6 +2670,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
break;
case BLOCK:
case PULLDOWN:
+ case HMENU:
retval= ui_do_but_BLOCK(C, but, data, event);
break;
case BUTM:
@@ -2790,7 +2848,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
button_tooltip_timer_reset(but);
/* automatic open pulldown block timer */
- if(but->type==BLOCK || but->type==MENU || but->type==PULLDOWN || but->type==ICONTEXTROW) {
+ if(ELEM5(but->type, BLOCK, MENU, PULLDOWN, HMENU, ICONTEXTROW)) {
if(!data->autoopentimer) {
int time;
@@ -2892,8 +2950,23 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT);
- if(type == BUTTON_ACTIVATE_OPEN)
+ if(type == BUTTON_ACTIVATE_OPEN) {
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
+
+ /* activate first button in submenu */
+ if(data->menu && data->menu->region) {
+ ARegion *subar= data->menu->region;
+ uiBlock *subblock= subar->uiblocks.first;
+ uiBut *subbut;
+
+ if(subblock) {
+ subbut= ui_but_first(subblock);
+
+ if(subbut)
+ ui_handle_button_activate(C, subar, subbut, BUTTON_ACTIVATE);
+ }
+ }
+ }
else if(type == BUTTON_ACTIVATE_TEXT_EDITING)
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
else if(type == BUTTON_ACTIVATE_APPLY)
@@ -2915,7 +2988,7 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
* value to the button value and the menu return value to ok, the
* menu return value will be picked up and the menu will close */
if(block->handle && !(block->flag & UI_BLOCK_KEEP_OPEN) && !data->cancel) {
- uiMenuBlockHandle *menu;
+ uiPopupBlockHandle *menu;
menu= block->handle;
menu->butretval= data->retval;
@@ -3124,7 +3197,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
static void ui_handle_button_closed_submenu(bContext *C, wmEvent *event, uiBut *but)
{
uiHandleButtonData *data;
- uiMenuBlockHandle *menu;
+ uiPopupBlockHandle *menu;
data= but->active;
menu= data->menu;
@@ -3155,50 +3228,6 @@ static void ui_handle_button_closed_submenu(bContext *C, wmEvent *event, uiBut *
}
}
-/* ******************** menu navigation helpers ************** */
-
-static uiBut *ui_but_prev(uiBut *but)
-{
- while(but->prev) {
- but= but->prev;
- if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
- }
- return NULL;
-}
-
-static uiBut *ui_but_next(uiBut *but)
-{
- while(but->next) {
- but= but->next;
- if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
- }
- return NULL;
-}
-
-static uiBut *ui_but_first(uiBlock *block)
-{
- uiBut *but;
-
- but= block->buttons.first;
- while(but) {
- if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
- but= but->next;
- }
- return NULL;
-}
-
-static uiBut *ui_but_last(uiBlock *block)
-{
- uiBut *but;
-
- but= block->buttons.last;
- while(but) {
- if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
- but= but->prev;
- }
- return NULL;
-}
-
/* ************************* menu handling *******************************/
/* function used to prevent loosing the open menu when using nested pulldowns,
@@ -3210,7 +3239,7 @@ static uiBut *ui_but_last(uiBlock *block)
* - only for 1 second
*/
-static void ui_mouse_motion_towards_init(uiMenuBlockHandle *menu, int mx, int my)
+static void ui_mouse_motion_towards_init(uiPopupBlockHandle *menu, int mx, int my)
{
if(!menu->dotowards) {
menu->dotowards= 1;
@@ -3220,7 +3249,7 @@ static void ui_mouse_motion_towards_init(uiMenuBlockHandle *menu, int mx, int my
}
}
-static int ui_mouse_motion_towards_check(uiBlock *block, uiMenuBlockHandle *menu, int mx, int my)
+static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *menu, int mx, int my)
{
int fac, dx, dy, domx, domy;
@@ -3274,7 +3303,7 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiMenuBlockHandle *menu
return menu->dotowards;
}
-int ui_handle_menu_event(bContext *C, wmEvent *event, uiMenuBlockHandle *menu, int topmenu)
+int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int topmenu)
{
ARegion *ar;
uiBlock *block;
@@ -3474,9 +3503,11 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiMenuBlockHandle *menu, i
}
}
- /* if we are inside the region and didn't handle the event yet, lets
- * pass it on to buttons inside this region */
- if((inside && !menu->menuretval && retval == WM_UI_HANDLER_CONTINUE) || event->type == TIMER) {
+ /* if we are didn't handle the event yet, lets pass it on to
+ * buttons inside this region. disabled inside check .. not sure
+ * anymore why it was there? but i meant enter enter didn't work
+ * for example when mouse was not over submenu */
+ if((/*inside &&*/ !menu->menuretval && retval == WM_UI_HANDLER_CONTINUE) || event->type == TIMER) {
but= ui_but_find_activated(ar);
if(but)
@@ -3496,13 +3527,13 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiMenuBlockHandle *menu, i
return retval;
}
-static int ui_handle_menu_closed_submenu(bContext *C, wmEvent *event, uiMenuBlockHandle *menu)
+static int ui_handle_menu_closed_submenu(bContext *C, wmEvent *event, uiPopupBlockHandle *menu)
{
ARegion *ar;
uiBut *but;
uiBlock *block;
uiHandleButtonData *data;
- uiMenuBlockHandle *submenu;
+ uiPopupBlockHandle *submenu;
ar= menu->region;
block= ar->uiblocks.first;
@@ -3532,11 +3563,11 @@ static int ui_handle_menu_closed_submenu(bContext *C, wmEvent *event, uiMenuBloc
return WM_UI_HANDLER_BREAK;
}
-static int ui_handle_menus_recursive(bContext *C, wmEvent *event, uiMenuBlockHandle *menu)
+static int ui_handle_menus_recursive(bContext *C, wmEvent *event, uiPopupBlockHandle *menu)
{
uiBut *but;
uiHandleButtonData *data;
- uiMenuBlockHandle *submenu;
+ uiPopupBlockHandle *submenu;
int retval= WM_UI_HANDLER_CONTINUE;
/* check if we have a submenu, and handle events for it first */
@@ -3665,16 +3696,16 @@ static int ui_handler_region_menu(bContext *C, wmEvent *event, void *userdata)
/* two types of popups, one with operator + enum, other with regular callbacks */
static int ui_handler_popup(bContext *C, wmEvent *event, void *userdata)
{
- uiMenuBlockHandle *menu= userdata;
+ uiPopupBlockHandle *menu= userdata;
ui_handle_menus_recursive(C, event, menu);
/* free if done, does not free handle itself */
if(menu->menuretval) {
/* copy values, we have to free first (closes region) */
- uiMenuBlockHandle temp= *menu;
+ uiPopupBlockHandle temp= *menu;
- ui_menu_block_free(C, menu);
+ ui_popup_block_free(C, menu);
WM_event_remove_ui_handler(&CTX_wm_window(C)->handlers, ui_handler_popup, ui_handler_remove_popup, menu);
if(temp.menuretval == UI_RETURN_OK) {
@@ -3707,10 +3738,10 @@ static int ui_handler_popup(bContext *C, wmEvent *event, void *userdata)
static void ui_handler_remove_popup(bContext *C, void *userdata)
{
- uiMenuBlockHandle *menu= userdata;
+ uiPopupBlockHandle *menu= userdata;
/* free menu block if window is closed for some reason */
- ui_menu_block_free(C, menu);
+ ui_popup_block_free(C, menu);
/* delayed apply callbacks */
ui_apply_but_funcs_after(C);
@@ -3722,7 +3753,7 @@ void UI_add_region_handlers(ListBase *handlers)
WM_event_add_ui_handler(NULL, handlers, ui_handler_region, ui_handler_remove_region, NULL);
}
-void UI_add_popup_handlers(ListBase *handlers, uiMenuBlockHandle *menu)
+void UI_add_popup_handlers(ListBase *handlers, uiPopupBlockHandle *menu)
{
WM_event_add_ui_handler(NULL, handlers, ui_handler_popup, ui_handler_remove_popup, menu);
}
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index f4e37867fc3..d66c6e4129e 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -121,14 +121,14 @@ struct uiBut {
float a1, a2, hsv[3]; // hsv is temp memory for hsv buttons
float aspect;
- void (*func)(struct bContext*, void *, void *);
+ uiButHandleFunc func;
void *func_arg1;
void *func_arg2;
void (*embossfunc)(int , int , float, float, float, float, float, int);
void (*sliderfunc)(int , float, float, float, float, float, float, int);
- void (*autocomplete_func)(struct bContext*, char *, void *);
+ uiButCompleteFunc autocomplete_func;
void *autofunc_arg;
uiLink *link;
@@ -143,19 +143,22 @@ struct uiBut {
short lock, win;
short iconadd, dt;
- /* IDPOIN data */
+ /* IDPOIN data */
uiIDPoinFuncFP idpoin_func;
ID **idpoin_idpp;
- /* BLOCK data */
- uiBlockFuncFP block_func;
+ /* BLOCK data */
+ uiBlockCreateFunc block_create_func;
- /* RNA */
+ /* HMENU data */
+ uiMenuCreateFunc menu_create_func;
+
+ /* RNA data */
struct PointerRNA rnapoin;
struct PropertyRNA *rnaprop;
int rnaindex;
- /* Operator */
+ /* Operator data */
const char *opname;
int opcontext;
struct IDProperty *opproperties;
@@ -188,14 +191,14 @@ struct uiBlock {
float minx, miny, maxx, maxy;
float aspect;
- void (*func)(struct bContext*, void *arg1, void *arg2);
+ uiButHandleFunc func;
void *func_arg1;
void *func_arg2;
- void (*butm_func)(struct bContext*, void *arg, int but_a2);
+ uiMenuHandleFunc butm_func;
void *butm_func_arg;
- void (*handle_func)(struct bContext*, void *arg, int event);
+ uiBlockHandleFunc handle_func;
void *handle_func_arg;
/* extra draw function for custom blocks */
@@ -214,12 +217,14 @@ struct uiBlock {
int lock;
char *lockstr;
- float xofs, yofs; // offset to parent button
+ float xofs, yofs; // offset to parent button
+ int bounds, dobounds; // for doing delayed
+ int endblock; // uiEndBlock done?
rctf safety; // pulldowns, to detect outside, can differ per case how it is created
ListBase saferct; // uiSafetyRct list
- uiMenuBlockHandle *handle; // handle
+ uiPopupBlockHandle *handle; // handle
int tooltipdisabled; // to avoid tooltip after click
int handler; // for panels in other windows than buttonswin... just event code
@@ -258,18 +263,46 @@ extern void ui_autofill(uiBlock *block);
extern int ui_is_but_float(uiBut *but);
extern void ui_update_block_buts_hsv(uiBlock *block, float *hsv);
+extern void ui_bounds_block(uiBlock *block);
+
/* interface_regions.c */
-uiBlock *ui_block_func_MENU(struct bContext *C, uiMenuBlockHandle *handle, void *arg_but);
-uiBlock *ui_block_func_ICONROW(struct bContext *C, uiMenuBlockHandle *handle, void *arg_but);
-uiBlock *ui_block_func_ICONTEXTROW(struct bContext *C, uiMenuBlockHandle *handle, void *arg_but);
-uiBlock *ui_block_func_COL(struct bContext *C, uiMenuBlockHandle *handle, void *arg_but);
+
+struct uiPopupBlockHandle {
+ /* internal */
+ struct ARegion *region;
+ int towardsx, towardsy;
+ double towardstime;
+ int dotowards;
+
+ int popup;
+ void (*popup_func)(struct bContext *C, void *arg, int event);
+ void *popup_arg;
+ /* for operator menus */
+ struct wmOperator *op_arg;
+ const char *propname;
+
+ /* return values */
+ int butretval;
+ int menuretval;
+ float retvalue;
+ float retvec[3];
+};
+
+uiBlock *ui_block_func_MENU(struct bContext *C, uiPopupBlockHandle *handle, void *arg_but);
+uiBlock *ui_block_func_ICONROW(struct bContext *C, uiPopupBlockHandle *handle, void *arg_but);
+uiBlock *ui_block_func_ICONTEXTROW(struct bContext *C, uiPopupBlockHandle *handle, void *arg_but);
+uiBlock *ui_block_func_COL(struct bContext *C, uiPopupBlockHandle *handle, void *arg_but);
struct ARegion *ui_tooltip_create(struct bContext *C, struct ARegion *butregion, uiBut *but);
void ui_tooltip_free(struct bContext *C, struct ARegion *ar);
-uiMenuBlockHandle *ui_menu_block_create(struct bContext *C, struct ARegion *butregion, uiBut *but,
- uiBlockFuncFP block_func, void *arg);
-void ui_menu_block_free(struct bContext *C, uiMenuBlockHandle *handle);
+typedef uiBlock* (*uiBlockHandleCreateFunc)(struct bContext *C, struct uiPopupBlockHandle *handle, void *arg1);
+
+uiPopupBlockHandle *ui_popup_block_create(struct bContext *C, struct ARegion *butregion, uiBut *but,
+ uiBlockCreateFunc create_func, uiBlockHandleCreateFunc handle_create_func, void *arg);
+uiPopupBlockHandle *ui_popup_menu_create(struct bContext *C, struct ARegion *butregion, uiBut *but,
+ uiMenuCreateFunc create_func, void *arg);
+void ui_popup_block_free(struct bContext *C, uiPopupBlockHandle *handle);
void ui_set_name_menu(uiBut *but, int value);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 0d6aa4082d3..74cd888df26 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -266,7 +266,7 @@ static void ui_scale_panel_block(uiBlock *block)
if(block->autofill) ui_autofill(block);
/* buttons min/max centered, offset calculated */
- uiBoundsBlock(block, 0);
+ ui_bounds_block(block);
if( block->maxx-block->minx > block->panel->sizex - 2*PNL_SAFETY ) {
facx= (block->panel->sizex - (2*PNL_SAFETY))/( block->maxx-block->minx );
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index d0343f55db3..7fb3567033b 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -622,18 +622,18 @@ static void ui_block_region_draw(const bContext *C, ARegion *ar)
uiDrawBlock(C, block);
}
-uiMenuBlockHandle *ui_menu_block_create(bContext *C, ARegion *butregion, uiBut *but, uiBlockFuncFP block_func, void *arg)
+uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut *but, uiBlockCreateFunc create_func, uiBlockHandleCreateFunc handle_create_func, void *arg)
{
wmWindow *window= CTX_wm_window(C);
static ARegionType type;
ARegion *ar;
uiBlock *block;
uiBut *bt;
- uiMenuBlockHandle *handle;
+ uiPopupBlockHandle *handle;
uiSafetyRct *saferct;
/* create handle */
- handle= MEM_callocN(sizeof(uiMenuBlockHandle), "uiMenuBlockHandle");
+ handle= MEM_callocN(sizeof(uiPopupBlockHandle), "uiPopupBlockHandle");
/* create area region */
ar= ui_add_temporary_region(CTX_wm_screen(C));
@@ -648,12 +648,18 @@ uiMenuBlockHandle *ui_menu_block_create(bContext *C, ARegion *butregion, uiBut *
ar->regiondata= handle;
/* create ui block */
- block= block_func(C, handle, arg);
+ if(create_func)
+ block= create_func(C, handle->region, arg);
+ else
+ block= handle_create_func(C, handle, arg);
block->handle= handle;
+ if(!block->endblock)
+ uiEndBlock(C, block);
+
/* if this is being created from a button */
if(but) {
- if(ELEM(but->type, BLOCK, PULLDOWN))
+ if(ELEM3(but->type, BLOCK, PULLDOWN, HMENU))
block->xofs = -2; /* for proper alignment */
/* only used for automatic toolbox, so can set the shift flag */
@@ -709,7 +715,7 @@ uiMenuBlockHandle *ui_menu_block_create(bContext *C, ARegion *butregion, uiBut *
return handle;
}
-void ui_menu_block_free(bContext *C, uiMenuBlockHandle *handle)
+void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle)
{
ui_remove_temporary_region(C, CTX_wm_screen(C), handle->region);
MEM_freeN(handle);
@@ -717,7 +723,7 @@ void ui_menu_block_free(bContext *C, uiMenuBlockHandle *handle)
/***************************** Menu Button ***************************/
-uiBlock *ui_block_func_MENU(bContext *C, uiMenuBlockHandle *handle, void *arg_but)
+uiBlock *ui_block_func_MENU(bContext *C, uiPopupBlockHandle *handle, void *arg_but)
{
uiBut *but= arg_but;
uiBlock *block;
@@ -833,7 +839,7 @@ uiBlock *ui_block_func_MENU(bContext *C, uiMenuBlockHandle *handle, void *arg_bu
return block;
}
-uiBlock *ui_block_func_ICONROW(bContext *C, uiMenuBlockHandle *handle, void *arg_but)
+uiBlock *ui_block_func_ICONROW(bContext *C, uiPopupBlockHandle *handle, void *arg_but)
{
uiBut *but= arg_but;
uiBlock *block;
@@ -854,7 +860,7 @@ uiBlock *ui_block_func_ICONROW(bContext *C, uiMenuBlockHandle *handle, void *arg
return block;
}
-uiBlock *ui_block_func_ICONTEXTROW(bContext *C, uiMenuBlockHandle *handle, void *arg_but)
+uiBlock *ui_block_func_ICONTEXTROW(bContext *C, uiPopupBlockHandle *handle, void *arg_but)
{
uiBut *but= arg_but;
uiBlock *block;
@@ -1259,7 +1265,7 @@ void uiBlockPickerButtons(uiBlock *block, float *col, float *hsv, float *old, ch
uiBlockEndAlign(block);
}
-uiBlock *ui_block_func_COL(bContext *C, uiMenuBlockHandle *handle, void *arg_but)
+uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_but)
{
uiBut *but= arg_but;
uiBlock *block;
@@ -1284,7 +1290,7 @@ uiBlock *ui_block_func_COL(bContext *C, uiMenuBlockHandle *handle, void *arg_but
static int pupmenu_set= 0;
-void uiPupmenuSetActive(int val)
+void uiPupMenuSetActive(int val)
{
pupmenu_set= val;
}
@@ -1319,7 +1325,7 @@ typedef struct uiPupMenuInfo {
int maxrow;
} uiPupMenuInfo;
-uiBlock *ui_block_func_PUPMENU(bContext *C, uiMenuBlockHandle *handle, void *arg_info)
+uiBlock *ui_block_func_PUPMENU(bContext *C, uiPopupBlockHandle *handle, void *arg_info)
{
uiBlock *block;
uiPupMenuInfo *info;
@@ -1483,7 +1489,7 @@ uiBlock *ui_block_func_PUPMENU(bContext *C, uiMenuBlockHandle *handle, void *arg
return block;
}
-uiBlock *ui_block_func_PUPMENUCOL(bContext *C, uiMenuBlockHandle *handle, void *arg_info)
+uiBlock *ui_block_func_PUPMENUCOL(bContext *C, uiPopupBlockHandle *handle, void *arg_info)
{
uiBlock *block;
uiPupMenuInfo *info;
@@ -1638,205 +1644,304 @@ uiBlock *ui_block_func_PUPMENUCOL(bContext *C, uiMenuBlockHandle *handle, void *
return block;
}
-/* This one will set enum propname, call operator and register it, and free the operator itself,
- call it in op->invoke with returning OPERATOR_RUNNING_MODAL */
-/* Note: propname has to be static */
-void uiPupmenuOperator(bContext *C, int maxrow, wmOperator *op, const char *propname, char *str)
-{
- wmWindow *window= CTX_wm_window(C);
- uiPupMenuInfo info;
- uiMenuBlockHandle *menu;
-
- memset(&info, 0, sizeof(info));
- info.mx= window->eventstate->x;
- info.my= window->eventstate->y;
- info.maxrow= maxrow;
- info.instr= str;
-
- menu= ui_menu_block_create(C, NULL, NULL, ui_block_func_PUPMENU, &info);
- menu->popup= 1;
-
- UI_add_popup_handlers(&window->handlers, menu);
- WM_event_add_mousemove(C);
-
- menu->op_arg= op;
- menu->propname= propname;
-}
-
+/************************** Menu Definitions ***************************/
-/* this one only to be called with operatortype name option */
-void uiPupmenu(bContext *C, int maxrow, uiPupmenuFunc func, void *arg, char *str, ...)
-{
- wmWindow *window= CTX_wm_window(C);
- uiPupMenuInfo info;
- uiMenuBlockHandle *menu;
-
- memset(&info, 0, sizeof(info));
- info.mx= window->eventstate->x;
- info.my= window->eventstate->y;
- info.maxrow= maxrow;
- info.instr= str;
-
- menu= ui_menu_block_create(C, NULL, NULL, ui_block_func_PUPMENU, &info);
- menu->popup= 1;
+/* prototype */
+static uiBlock *ui_block_func_MENU_ITEM(bContext *C, uiPopupBlockHandle *handle, void *arg_info);
- UI_add_popup_handlers(&window->handlers, menu);
- WM_event_add_mousemove(C);
+#define MAX_MENU_STR 64
- menu->popup_func= func;
- menu->popup_arg= arg;
-}
+/* type, internal */
+#define MENU_ITEM_TITLE 0
+#define MENU_ITEM_ITEM 1
+#define MENU_ITEM_OPNAME 2
+#define MENU_ITEM_OPNAME_BOOL 3
+#define MENU_ITEM_OPNAME_ENUM 4
+#define MENU_ITEM_OPNAME_FLOAT 5
+#define MENU_ITEM_RNA_BOOL 6
+#define MENU_ITEM_RNA_ENUM 7
+#define MENU_ITEM_LEVEL 8
+#define MENU_ITEM_LEVEL_OPNAME_ENUM 9
+#define MENU_ITEM_LEVEL_RNA_ENUM 10
+#define MENU_ITEM_SEPARATOR 11
-/* standard pupmenus */
+struct uiMenuItem {
+ struct uiMenuItem *next, *prev;
+
+ int type;
+ int icon;
+ char name[MAX_MENU_STR];
+
+ char *opname; /* static string */
+ char *propname; /* static string */
+
+ int retval, enumval, boolval;
+ float fltval;
+ int opcontext;
+ uiMenuHandleFunc eventfunc;
+ void *argv;
+ uiMenuCreateFunc newlevel;
+ PointerRNA rnapoin;
+
+ ListBase items;
+};
-static void operator_cb(bContext *C, void *arg, int retval)
-{
- const char *opname= arg;
+typedef struct uiMenuInfo {
+ uiMenuItem *head;
+ int mx, my, popup, slideout;
+ int startx, starty;
+} uiMenuInfo;
- if(opname && retval > 0)
- WM_operator_name_call(C, opname, WM_OP_EXEC_DEFAULT, NULL);
-}
+/************************ Menu Definitions to uiBlocks ***********************/
-static void vconfirm(bContext *C, char *opname, char *title, char *itemfmt, va_list ap)
+const char *ui_menu_enumpropname(char *opname, const char *propname, int retval)
{
- char *s, buf[512];
+ wmOperatorType *ot= WM_operatortype_find(opname);
+ PointerRNA ptr;
+ PropertyRNA *prop;
- s= buf;
- if (title) s+= sprintf(s, "%s%%t|", title);
- vsprintf(s, itemfmt, ap);
+ if(!ot || !ot->srna)
+ return "";
+
+ RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
+ prop= RNA_struct_find_property(&ptr, propname);
+
+ if(prop) {
+ const EnumPropertyItem *item;
+ int totitem, i;
+
+ RNA_property_enum_items(&ptr, prop, &item, &totitem);
+
+ for (i=0; i<totitem; i++) {
+ if(item[i].value==retval)
+ return item[i].name;
+ }
+ }
- uiPupmenu(C, 0, operator_cb, opname, buf);
+ return "";
}
-static void confirm(bContext *C, char *opname, char *title, char *itemfmt, ...)
+/* make a menu level from enum properties */
+static void menu_item_enum_opname_menu(bContext *C, uiMenuItem *head, void *arg)
{
- va_list ap;
+ uiBut *but= arg; /* parent caller */
+ char *opname= but->func_arg1;
+ char *propname= but->func_arg2;
- va_start(ap, itemfmt);
- vconfirm(C, opname, title, itemfmt, ap);
- va_end(ap);
+ uiMenuItemsEnumO(head, opname, propname);
}
-void uiPupmenuOkee(bContext *C, char *opname, char *str, ...)
+static void menu_item_enum_rna_menu(bContext *C, uiMenuItem *head, void *arg)
{
- va_list ap;
- char titlestr[256];
-
- sprintf(titlestr, "OK? %%i%d", ICON_HELP);
+ uiBut *but= arg; /* parent caller */
+ char *propname= but->func_arg1;
- va_start(ap, str);
- vconfirm(C, opname, titlestr, str, ap);
- va_end(ap);
+ uiMenuItemsEnumR(head, &but->rnapoin, propname);
}
-void uiPupmenuSaveOver(bContext *C, char *opname, char *filename, ...)
+static uiBlock *ui_block_func_MENU_ITEM(bContext *C, uiPopupBlockHandle *handle, void *arg_info)
{
- size_t len= strlen(filename);
+ uiBlock *block;
+ uiBut *but;
+ uiMenuInfo *info= arg_info;
+ uiMenuItem *head, *item;
+ ScrArea *sa;
+ ARegion *ar;
+ static int counter= 0;
+ int width, height, icon;
+ int startx, starty, x1, y1;
+ char str[16];
+
+ head= info->head;
+ height= 0;
+
+ /* block stuff first, need to know the font */
+ sprintf(str, "tb %d", counter++);
+ block= uiBeginBlock(C, handle->region, str, UI_EMBOSSP, UI_HELV);
+ uiBlockSetButmFunc(block, head->eventfunc, head->argv);
+ block->themecol= TH_MENU_ITEM;
+ block->direction= UI_DOWN;
- if(len==0)
- return;
+ width= 50; // fixed with, uiPopupBoundsBlock will compute actual width
- if(BLI_exists(filename)==0)
- operator_cb(C, opname, 1);
-
- if(filename[len-1]=='/' || filename[len-1]=='\\') {
- uiPupmenuError(C, "Cannot overwrite a directory");
- return;
+ for(item= head->items.first; item; item= item->next) {
+ if(0) height+= PUP_LABELH; // XXX sepr line
+ else height+= MENU_BUTTON_HEIGHT;
}
- confirm(C, opname, "Save over", filename);
-}
-
-void uiPupmenuNotice(bContext *C, char *str, ...)
-{
- va_list ap;
-
- va_start(ap, str);
- vconfirm(C, NULL, NULL, str, ap);
- va_end(ap);
-}
-
-void uiPupmenuError(bContext *C, char *str, ...)
-{
- va_list ap;
- char nfmt[256];
- char titlestr[256];
+ startx= info->mx;
+ starty= info->my-height+MENU_BUTTON_HEIGHT/2;
+
+ /* here we go! */
+ if(head->name[0]) {
+ char titlestr[256];
+ uiSetCurFont(block, UI_HELVB);
+
+ if(head->icon) {
+ width+= 20;
+ sprintf(titlestr, " %s", head->name);
+ uiDefIconTextBut(block, LABEL, 0, head->icon, titlestr, startx, (short)(starty+height), width, MENU_BUTTON_HEIGHT, NULL, 0.0, 0.0, 0, 0, "");
+ }
+ else {
+ but= uiDefBut(block, LABEL, 0, head->name, startx, (short)(starty+height), width, MENU_BUTTON_HEIGHT, NULL, 0.0, 0.0, 0, 0, "");
+ but->flag= UI_TEXT_LEFT;
+ }
+ uiSetCurFont(block, UI_HELV);
+
+ //uiDefBut(block, SEPR, 0, "", startx, (short)(starty+height)-MENU_SEPR_HEIGHT, width, MENU_SEPR_HEIGHT, NULL, 0.0, 0.0, 0, 0, "");
+ }
+
+ x1= startx;
+ y1= starty + height - MENU_BUTTON_HEIGHT; // - MENU_SEPR_HEIGHT;
+
+ for(item= head->items.first; item; item= item->next) {
+
+ if(item->type==MENU_ITEM_LEVEL) {
+ uiDefIconTextMenuBut(block, item->newlevel, NULL, ICON_RIGHTARROW_THIN, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL);
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type==MENU_ITEM_LEVEL_OPNAME_ENUM) {
+ but= uiDefIconTextMenuBut(block, menu_item_enum_opname_menu, NULL, ICON_RIGHTARROW_THIN, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL);
+ /* XXX warning, abuse of func_arg! */
+ but->poin= (char*)but;
+ but->func_arg1= item->opname;
+ but->func_arg2= item->propname;
+
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type==MENU_ITEM_LEVEL_RNA_ENUM) {
+ but= uiDefIconTextMenuBut(block, menu_item_enum_rna_menu, NULL, ICON_RIGHTARROW_THIN, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL);
+ /* XXX warning, abuse of func_arg! */
+ but->poin= (char*)but;
+ but->rnapoin= item->rnapoin;
+ but->func_arg1= item->propname;
+
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type==MENU_ITEM_OPNAME_BOOL) {
+ but= uiDefIconTextButO(block, BUTM, item->opname, head->opcontext, item->icon, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, "");
+ RNA_boolean_set(uiButGetOperatorPtrRNA(but), item->propname, item->boolval);
+
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type==MENU_ITEM_OPNAME_ENUM) {
+ const char *name;
+ char bname[64];
- sprintf(titlestr, "Error %%i%d", ICON_ERROR);
+ name= ui_menu_enumpropname(item->opname, item->propname, item->enumval);
+ BLI_strncpy(bname, name, sizeof(bname));
+
+ but= uiDefIconTextButO(block, BUTM, item->opname, head->opcontext, item->icon, bname, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, "");
+ RNA_enum_set(uiButGetOperatorPtrRNA(but), item->propname, item->enumval);
+
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type==MENU_ITEM_OPNAME_FLOAT) {
+ but= uiDefIconTextButO(block, BUTM, item->opname, head->opcontext, item->icon, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, "");
+ RNA_float_set(uiButGetOperatorPtrRNA(but), item->propname, item->fltval);
+
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type==MENU_ITEM_OPNAME) {
+ uiDefIconTextButO(block, BUTM, item->opname, head->opcontext, item->icon, NULL, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL);
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type==MENU_ITEM_RNA_BOOL) {
+ PropertyRNA *prop= RNA_struct_find_property(&item->rnapoin, item->propname);
- sprintf(nfmt, "%s", str);
+ if(prop && RNA_property_type(&item->rnapoin, prop) == PROP_BOOLEAN) {
+ icon= (RNA_property_boolean_get(&item->rnapoin, prop))? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
+ uiDefIconTextButR(block, TOG, 0, icon, NULL, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, &item->rnapoin, item->propname, 0, 0, 0, 0, 0, NULL);
+ }
+ else {
+ uiBlockSetButLock(block, 1, "");
+ uiDefIconTextBut(block, BUT, 0, ICON_BLANK1, item->propname, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL, 0.0, 0.0, 0, 0, "");
+ uiBlockClearButLock(block);
+ }
- va_start(ap, str);
- vconfirm(C, NULL, titlestr, nfmt, ap);
- va_end(ap);
-}
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type==MENU_ITEM_RNA_ENUM) {
+ PropertyRNA *prop= RNA_struct_find_property(&item->rnapoin, item->propname);
-void uiPupmenuReports(bContext *C, ReportList *reports)
-{
- Report *report;
- DynStr *ds;
- char *str;
+ if(prop && RNA_property_type(&item->rnapoin, prop) == PROP_ENUM) {
+ icon= (RNA_property_enum_get(&item->rnapoin, prop) == item->enumval)? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
+ uiDefIconTextButR(block, ROW, 0, icon, NULL, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, &item->rnapoin, item->propname, 0, 0, item->enumval, 0, 0, NULL);
+ }
+ else {
+ uiBlockSetButLock(block, 1, "");
+ uiDefIconTextBut(block, BUT, 0, ICON_BLANK1, item->propname, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL, 0.0, 0.0, 0, 0, "");
+ uiBlockClearButLock(block);
+ }
+
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type == MENU_ITEM_ITEM) {
+ uiDefIconTextButF(block, BUTM, B_NOP, item->icon, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, &handle->retvalue, 0.0, 0.0, 0, item->retval, "");
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else {
+ uiDefBut(block, SEPR, 0, "", x1, y1, width+16, MENU_SEPR_HEIGHT-1, NULL, 0.0, 0.0, 0, 0, "");
+ y1 -= MENU_SEPR_HEIGHT;
+ }
+ }
- if(!reports || !reports->list.first)
- return;
- if(!CTX_wm_window(C))
- return;
+ if(info->popup) {
+ uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_NUMSELECT|UI_BLOCK_RET_1);
+ uiBlockSetDirection(block, UI_DOWN);
- ds= BLI_dynstr_new();
+ uiPopupBoundsBlock(block, 1);
+ }
+ else {
+ /* for a header menu we set the direction automatic */
+ if(!info->slideout) {
+ sa= CTX_wm_area(C);
+ ar= CTX_wm_region(C);
+
+ if(sa && sa->headertype==HEADERDOWN) {
+ if(ar && ar->regiontype == RGN_TYPE_HEADER) {
+ uiBlockSetDirection(block, UI_TOP);
+ uiBlockFlipOrder(block);
+ }
+ }
+ }
- for(report=reports->list.first; report; report=report->next) {
- if(report->type >= RPT_ERROR)
- BLI_dynstr_appendf(ds, "Error %%i%d%%t|%s", ICON_ERROR, report->message);
- else if(report->type >= RPT_WARNING)
- BLI_dynstr_appendf(ds, "Warning %%i%d%%t|%s", ICON_ERROR, report->message);
+ uiTextBoundsBlock(block, 50);
}
- str= BLI_dynstr_get_cstring(ds);
- uiPupmenu(C, 0, NULL, NULL, str);
- MEM_freeN(str);
+ /* if menu slides out of other menu, override direction */
+ if(info->slideout)
+ uiBlockSetDirection(block, UI_RIGHT);
- BLI_dynstr_free(ds);
+ uiEndBlock(C, block);
+
+ return block;
}
-/* ******************* customize own menus, toolbox *************** */
-
-/* prototype */
-static uiBlock *ui_block_func_MENU_ITEM(bContext *C, uiMenuBlockHandle *handle, void *arg_info);
-
-#define MAX_MENU_STR 64
-
-/* type, internal */
-#define MENU_ITEM_TITLE 0
-#define MENU_ITEM_ITEM 1
-#define MENU_ITEM_OPNAME 2
-#define MENU_ITEM_OPNAME_ENUM 3
-#define MENU_ITEM_LEVEL 4
-#define MENU_ITEM_LEVEL_ENUM 5
-
-struct uiMenuItem {
- struct uiMenuItem *next, *prev;
+uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut *but, uiMenuCreateFunc menu_func, void *arg)
+{
+ uiPopupBlockHandle *handle;
+ uiMenuItem *head;
+ uiMenuInfo info;
- int type;
- int icon;
- char name[MAX_MENU_STR];
+ head= MEM_callocN(sizeof(uiMenuItem), "menu dummy");
+ head->opcontext= WM_OP_EXEC_REGION_WIN;
+
+ menu_func(C, head, arg);
- char *opname; /* static string */
- char *propname; /* static string */
+ memset(&info, 0, sizeof(info));
+ info.head= head;
+ info.slideout= (but && (but->block->flag & UI_BLOCK_LOOP));
- int retval;
- int opcontext;
- void (*eventfunc)(bContext *, void *, int);
- void *argv;
- void (*newlevel)(uiMenuItem *);
+ handle= ui_popup_block_create(C, butregion, but, NULL, ui_block_func_MENU_ITEM, &info);
- ListBase items;
-};
+ BLI_freelistN(&head->items);
+ MEM_freeN(head);
-typedef struct uiMenuInfo {
- uiMenuItem *head;
- int mx, my;
- int startx, starty;
-} uiMenuInfo;
+ return handle;
+}
+
+/*************************** Menu Creating API **************************/
/* internal add func */
static uiMenuItem *ui_menu_add_item(uiMenuItem *head, const char *name, int icon, int argval)
@@ -1856,22 +1961,6 @@ static uiMenuItem *ui_menu_add_item(uiMenuItem *head, const char *name, int icon
return item;
}
-
-/* only return handler, and set optional title */
-uiMenuItem *uiMenuBegin(const char *title)
-{
- uiMenuItem *item= MEM_callocN(sizeof(uiMenuItem), "menu start");
-
- item->type = MENU_ITEM_TITLE;
- item->opcontext= WM_OP_EXEC_REGION_WIN;
-
- /* NULL is no title */
- if(title)
- BLI_strncpy(item->name, title, MAX_MENU_STR);
-
- return item;
-}
-
/* set callback for regular items */
void uiMenuFunc(uiMenuItem *head, void (*eventfunc)(bContext *, void *, int), void *argv)
{
@@ -1903,48 +1992,103 @@ void uiMenuItemO(uiMenuItem *head, char *name, int icon)
item->type = MENU_ITEM_OPNAME;
}
-/* Single operator item with property */
+/* single operator item with property */
void uiMenuItemEnumO(uiMenuItem *head, char *opname, char *propname, int value)
{
uiMenuItem *item= ui_menu_add_item(head, "", 0, 0);
item->opname= opname; // static!
item->propname= propname; // static!
- item->retval= value;
+ item->enumval= value;
item->type = MENU_ITEM_OPNAME_ENUM;
}
-/* Add all operator items with property */
+/* single operator item with property */
+void uiMenuItemFloatO(uiMenuItem *head, const char *name, char *opname, char *propname, float value)
+{
+ uiMenuItem *item= ui_menu_add_item(head, name, 0, 0);
+
+ item->opname= opname; // static!
+ item->propname= propname; // static!
+ item->fltval= value;
+ item->type = MENU_ITEM_OPNAME_FLOAT;
+}
+
+/* single operator item with property */
+void uiMenuItemBooleanO(uiMenuItem *head, char *opname, char *propname, int value)
+{
+ uiMenuItem *item= ui_menu_add_item(head, "", 0, 0);
+
+ item->opname= opname; // static!
+ item->propname= propname; // static!
+ item->boolval= value;
+ item->type = MENU_ITEM_OPNAME_BOOL;
+}
+
+/* add all operator items with property */
void uiMenuItemsEnumO(uiMenuItem *head, char *opname, char *propname)
{
- wmOperatorType *ot;
+ wmOperatorType *ot= WM_operatortype_find(opname);
+ PointerRNA ptr;
+ PropertyRNA *prop;
+
+ if(!ot || !ot->srna)
+ return;
- ot= WM_operatortype_find(opname);
- if(ot) {
- PointerRNA *opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
- PropertyRNA *prop;
+ RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
+ prop= RNA_struct_find_property(&ptr, propname);
+
+ if(prop && RNA_property_type(&ptr, prop) == PROP_ENUM) {
+ const EnumPropertyItem *item;
+ int totitem, i;
- WM_operator_properties_create(opptr, opname);
- prop= RNA_struct_find_property(opptr, propname);
+ RNA_property_enum_items(&ptr, prop, &item, &totitem);
- if(prop) {
- const EnumPropertyItem *item;
- int totitem, i;
-
- RNA_property_enum_items(opptr, prop, &item, &totitem);
-
- for (i=0; i<totitem; i++) {
- uiMenuItemEnumO(head, opname, propname, item[i].value);
- }
- }
- WM_operator_properties_free(opptr);
- MEM_freeN(opptr);
+ for (i=0; i<totitem; i++)
+ uiMenuItemEnumO(head, opname, propname, item[i].value);
}
}
+/* rna property toggle */
+void uiMenuItemBooleanR(uiMenuItem *head, PointerRNA *ptr, char *propname)
+{
+ uiMenuItem *item= ui_menu_add_item(head, "", 0, 0);
+
+ item->propname= propname; // static!
+ item->rnapoin= *ptr;
+ item->type = MENU_ITEM_RNA_BOOL;
+}
+
+void uiMenuItemEnumR(uiMenuItem *head, PointerRNA *ptr, char *propname, int value)
+{
+ uiMenuItem *item= ui_menu_add_item(head, "", 0, 0);
+
+ item->propname= propname; // static!
+ item->rnapoin= *ptr;
+ item->enumval= value;
+ item->type = MENU_ITEM_RNA_ENUM;
+}
+
+/* add all rna items with property */
+void uiMenuItemsEnumR(uiMenuItem *head, PointerRNA *ptr, char *propname)
+{
+ PropertyRNA *prop;
+
+ prop= RNA_struct_find_property(ptr, propname);
+
+ if(prop && RNA_property_type(ptr, prop) == PROP_ENUM) {
+ const EnumPropertyItem *item;
+ int totitem, i;
+
+ RNA_property_enum_items(ptr, prop, &item, &totitem);
+
+ for (i=0; i<totitem; i++)
+ uiMenuItemEnumR(head, ptr, propname, item[i].value);
+ }
+}
/* generic new menu level */
-void uiMenuLevel(uiMenuItem *head, const char *name, void (*newlevel)(uiMenuItem *))
+void uiMenuLevel(uiMenuItem *head, const char *name, uiMenuCreateFunc newlevel)
{
uiMenuItem *item= ui_menu_add_item(head, name, 0, 0);
@@ -1958,7 +2102,7 @@ void uiMenuLevelEnumO(uiMenuItem *head, char *opname, char *propname)
uiMenuItem *item= ui_menu_add_item(head, "", 0, 0);
wmOperatorType *ot;
- item->type = MENU_ITEM_LEVEL_ENUM;
+ item->type = MENU_ITEM_LEVEL_OPNAME_ENUM;
ot= WM_operatortype_find(opname);
if(ot)
BLI_strncpy(item->name, ot->name, MAX_MENU_STR);
@@ -1969,19 +2113,62 @@ void uiMenuLevelEnumO(uiMenuItem *head, char *opname, char *propname)
BLI_addtail(&head->items, item);
}
+/* make a new level from enum properties */
+void uiMenuLevelEnumR(uiMenuItem *head, PointerRNA *ptr, char *propname)
+{
+ uiMenuItem *item= ui_menu_add_item(head, "", 0, 0);
+ PropertyRNA *prop;
+
+ item->type = MENU_ITEM_LEVEL_RNA_ENUM;
+ prop= RNA_struct_find_property(ptr, propname);
+ if(prop)
+ BLI_strncpy(item->name, RNA_property_ui_name(ptr, prop), MAX_MENU_STR);
+
+ item->rnapoin= *ptr;
+ item->propname= propname; // static!
+
+ BLI_addtail(&head->items, item);
+}
+
+/* separator */
+void uiMenuSeparator(uiMenuItem *head)
+{
+ uiMenuItem *item= ui_menu_add_item(head, "", 0, 0);
+
+ item->type = MENU_ITEM_SEPARATOR;
+}
+
+/*************************** Popup Menu API **************************/
+
+/* only return handler, and set optional title */
+uiMenuItem *uiPupMenuBegin(const char *title)
+{
+ uiMenuItem *item= MEM_callocN(sizeof(uiMenuItem), "menu start");
+
+ item->type = MENU_ITEM_TITLE;
+ item->opcontext= WM_OP_EXEC_REGION_WIN;
+
+ /* NULL is no title */
+ if(title)
+ BLI_strncpy(item->name, title, MAX_MENU_STR);
+
+ return item;
+}
+
/* set the whole structure to work */
-void uiMenuEnd(bContext *C, uiMenuItem *head)
+void uiPupMenuEnd(bContext *C, uiMenuItem *head)
{
wmWindow *window= CTX_wm_window(C);
uiMenuInfo info;
- uiMenuBlockHandle *menu;
+ uiPopupBlockHandle *menu;
memset(&info, 0, sizeof(info));
+ info.popup= 1;
info.mx= window->eventstate->x;
info.my= window->eventstate->y;
info.head= head;
- menu= ui_menu_block_create(C, NULL, NULL, ui_block_func_MENU_ITEM, &info);
+ menu= ui_popup_block_create(C, NULL, NULL, NULL, ui_block_func_MENU_ITEM, &info);
menu->popup= 1;
UI_add_popup_handlers(&window->handlers, menu);
@@ -1991,239 +2178,163 @@ void uiMenuEnd(bContext *C, uiMenuItem *head)
MEM_freeN(head);
}
-/* *********** internal code for menu/toolbox system */
-
-const char *ui_menu_enumpropname(PointerRNA *opptr, const char *propname, int retval)
+/* This one will set enum propname, call operator and register it, and free the operator itself,
+ call it in op->invoke with returning OPERATOR_RUNNING_MODAL */
+/* Note: propname has to be static */
+void uiPupMenuOperator(bContext *C, int maxrow, wmOperator *op, const char *propname, char *str)
{
- PropertyRNA *prop;
+ wmWindow *window= CTX_wm_window(C);
+ uiPupMenuInfo info;
+ uiPopupBlockHandle *menu;
- prop= RNA_struct_find_property(opptr, propname);
+ memset(&info, 0, sizeof(info));
+ info.mx= window->eventstate->x;
+ info.my= window->eventstate->y;
+ info.maxrow= maxrow;
+ info.instr= str;
- if(prop) {
- const EnumPropertyItem *item;
- int totitem, i;
-
- RNA_property_enum_items(opptr, prop, &item, &totitem);
-
- for (i=0; i<totitem; i++) {
- if(item[i].value==retval)
- return item[i].name;
- }
- }
- return "";
+ menu= ui_popup_block_create(C, NULL, NULL, NULL, ui_block_func_PUPMENU, &info);
+ menu->popup= 1;
+
+ UI_add_popup_handlers(&window->handlers, menu);
+ WM_event_add_mousemove(C);
+
+ menu->op_arg= op;
+ menu->propname= propname;
}
-/* make a menu level from uiMenuItems */
-static uiBlock *menu_item_makemenu(bContext *C, uiMenuBlockHandle *handle, void *arg)
+
+/* this one only to be called with operatortype name option */
+void uiPupMenu(bContext *C, int maxrow, uiMenuHandleFunc func, void *arg, char *str, ...)
{
- uiBlock *block;
- uiMenuInfo info;
- uiMenuItem *head;
- void (*newlevel)(uiMenuItem *)= arg;
-
- if(arg==NULL) return NULL;
-
- head= MEM_callocN(sizeof(uiMenuItem), "sub level item");
- head->opcontext= WM_OP_EXEC_REGION_WIN;
+ wmWindow *window= CTX_wm_window(C);
+ uiPupMenuInfo info;
+ uiPopupBlockHandle *menu;
- newlevel(head);
-
memset(&info, 0, sizeof(info));
- info.head= head;
-
- block= ui_block_func_MENU_ITEM(C, handle, &info);
- block->direction= UI_RIGHT;
-
- BLI_freelistN(&head->items);
- MEM_freeN(head);
-
- return block;
+ info.mx= window->eventstate->x;
+ info.my= window->eventstate->y;
+ info.maxrow= maxrow;
+ info.instr= str;
+
+ menu= ui_popup_block_create(C, NULL, NULL, NULL, ui_block_func_PUPMENU, &info);
+ menu->popup= 1;
+
+ UI_add_popup_handlers(&window->handlers, menu);
+ WM_event_add_mousemove(C);
+
+ menu->popup_func= func;
+ menu->popup_arg= arg;
}
-/* make a menu level from enum properties */
-static uiBlock *menu_item_enum_menu(bContext *C, uiMenuBlockHandle *handle, void *arg)
+/* standard pupmenus */
+
+static void operator_cb(bContext *C, void *arg, int retval)
{
- uiBlock *block;
- uiBut *but= arg; /* parent caller */
- wmOperatorType *ot;
- uiMenuInfo info;
- uiMenuItem *head;
-
- head= MEM_callocN(sizeof(uiMenuItem), "sub level item");
- head->opcontext= WM_OP_EXEC_REGION_WIN;
-
- ot= WM_operatortype_find(but->func_arg1);
- if(ot) {
- PointerRNA *opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
- PropertyRNA *prop;
-
- WM_operator_properties_create(opptr, but->func_arg1);
- prop= RNA_struct_find_property(opptr, but->func_arg2);
-
- if(prop) {
- const EnumPropertyItem *item;
- int totitem, i;
-
- RNA_property_enum_items(opptr, prop, &item, &totitem);
-
- for (i=0; i<totitem; i++) {
- uiMenuItemEnumO(head, but->func_arg1, but->func_arg2, item[i].value);
- }
- }
- WM_operator_properties_free(opptr);
- MEM_freeN(opptr);
- }
-
- memset(&info, 0, sizeof(info));
- info.head= head;
+ const char *opname= arg;
- block= ui_block_func_MENU_ITEM(C, handle, &info);
- block->direction= UI_RIGHT;
-
- BLI_freelistN(&head->items);
- MEM_freeN(head);
-
- return block;
+ if(opname && retval > 0)
+ WM_operator_name_call(C, opname, WM_OP_EXEC_DEFAULT, NULL);
}
-static uiBlock *ui_block_func_MENU_ITEM(bContext *C, uiMenuBlockHandle *handle, void *arg_info)
+static void vconfirm(bContext *C, char *opname, char *title, char *itemfmt, va_list ap)
{
- uiBlock *block;
- uiBut *but;
- uiMenuInfo *info= arg_info;
- uiMenuItem *head, *item;
- static int counter= 0;
- int width, height, xmax, ymax;
- int startx, starty, endx, endy, x1, y1;
- char str[16];
-
- head= info->head;
- height= 0;
-
- /* block stuff first, need to know the font */
- sprintf(str, "tb %d", counter++);
- block= uiBeginBlock(C, handle->region, str, UI_EMBOSSP, UI_HELV);
- uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1|UI_BLOCK_NUMSELECT);
- uiBlockSetButmFunc(block, head->eventfunc, head->argv);
- block->themecol= TH_MENU_ITEM;
- block->direction= UI_DOWN;
-
- /* size and location, title slightly bigger for bold */
- if(head->name[0]) {
- width= 2*strlen(head->name)+UI_GetStringWidth(uiBlockGetCurFont(block), head->name, ui_translate_buttons());
- }
- else width= UI_GetStringWidth(uiBlockGetCurFont(block), "Standardtext", ui_translate_buttons());
-
- for(item= head->items.first; item; item= item->next) {
- xmax= UI_GetStringWidth(uiBlockGetCurFont(block), item->name, ui_translate_buttons());
- if(xmax>width) width= xmax;
-
- if(0) height+= PUP_LABELH; // XXX sepr line
- else height+= MENU_BUTTON_HEIGHT;
- }
-
- width+= 10;
- if (width<50) width=50;
-
- wm_window_get_size(CTX_wm_window(C), &xmax, &ymax);
-
- /* boundbox */
-
- startx= info->mx-(0.8*(width));
- starty= info->my-height+MENU_BUTTON_HEIGHT/2;
-
- if(startx<10) {
- startx= 10;
- }
- if(starty<10) {
- starty= 10;
- }
-
- endx= startx+width;
- endy= starty+height;
-
- if(endx>xmax) {
- endx= xmax-10;
- startx= endx-width;
- }
- if(endy>ymax-20) {
- endy= ymax-20;
- starty= endy-height;
- }
-
- /* here we go! */
- if(head->name[0]) {
- char titlestr[256];
- uiSetCurFont(block, UI_HELVB);
-
- if(head->icon) {
- width+= 20;
- sprintf(titlestr, " %s", head->name);
- uiDefIconTextBut(block, LABEL, 0, head->icon, titlestr, startx, (short)(starty+height), width, MENU_BUTTON_HEIGHT, NULL, 0.0, 0.0, 0, 0, "");
- }
- else {
- but= uiDefBut(block, LABEL, 0, head->name, startx, (short)(starty+height), width, MENU_BUTTON_HEIGHT, NULL, 0.0, 0.0, 0, 0, "");
- but->flag= UI_TEXT_LEFT;
- }
- uiSetCurFont(block, UI_HELV);
-
- //uiDefBut(block, SEPR, 0, "", startx, (short)(starty+height)-MENU_SEPR_HEIGHT, width, MENU_SEPR_HEIGHT, NULL, 0.0, 0.0, 0, 0, "");
- }
-
- x1= startx;
- y1= starty + height - MENU_BUTTON_HEIGHT; // - MENU_SEPR_HEIGHT;
-
- for(item= head->items.first; item; item= item->next) {
-
- if(0) { // SEPR
- uiDefBut(block, SEPR, B_NOP, "", x1, y1, width, PUP_LABELH, NULL, 0, 0.0, 0, 0, "");
- y1 -= PUP_LABELH;
- }
- else if(item->type==MENU_ITEM_LEVEL) {
- uiDefIconTextBlockBut(block, menu_item_makemenu, item->newlevel, ICON_RIGHTARROW_THIN, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL);
- y1 -= MENU_BUTTON_HEIGHT;
- }
- else if(item->type==MENU_ITEM_LEVEL_ENUM) {
- but= uiDefIconTextBlockBut(block, menu_item_enum_menu, NULL, ICON_RIGHTARROW_THIN, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL);
- /* XXX warning, abuse of func_arg! */
- but->poin= (char *)but;
- but->func_arg1= item->opname;
- but->func_arg2= item->propname;
-
- y1 -= MENU_BUTTON_HEIGHT;
- }
- else if(item->type==MENU_ITEM_OPNAME_ENUM) {
- PointerRNA *opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
- char bname[64];
- const char *name;
-
- WM_operator_properties_create(opptr, item->opname);
- RNA_enum_set(opptr, item->propname, item->retval);
- name= ui_menu_enumpropname(opptr, item->propname, item->retval);
- BLI_strncpy(bname, name, 64);
-
- but= uiDefIconTextBut(block, BUTM, item->retval, ICON_BLANK1, bname, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL, 0.0, 0.0, 0, 0, "");
-
- but->opptr= opptr;
- but->opname= item->opname;
- but->opcontext= head->opcontext;
-
- y1 -= MENU_BUTTON_HEIGHT;
- }
- else if(item->type==MENU_ITEM_OPNAME) {
- uiDefIconTextButO(block, BUTM, item->opname, head->opcontext, ICON_BLANK1, NULL, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL);
- y1 -= MENU_BUTTON_HEIGHT;
- }
- else {
- uiDefIconTextButF(block, BUTM, B_NOP, item->icon, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, &handle->retvalue, 0.0, 0.0, 0, item->retval, "");
- y1 -= MENU_BUTTON_HEIGHT;
- }
+ char *s, buf[512];
+
+ s= buf;
+ if (title) s+= sprintf(s, "%s%%t|", title);
+ vsprintf(s, itemfmt, ap);
+
+ uiPupMenu(C, 0, operator_cb, opname, buf);
+}
+
+static void confirm(bContext *C, char *opname, char *title, char *itemfmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, itemfmt);
+ vconfirm(C, opname, title, itemfmt, ap);
+ va_end(ap);
+}
+
+void uiPupMenuOkee(bContext *C, char *opname, char *str, ...)
+{
+ va_list ap;
+ char titlestr[256];
+
+ sprintf(titlestr, "OK? %%i%d", ICON_HELP);
+
+ va_start(ap, str);
+ vconfirm(C, opname, titlestr, str, ap);
+ va_end(ap);
+}
+
+void uiPupMenuSaveOver(bContext *C, char *opname, char *filename, ...)
+{
+ size_t len= strlen(filename);
+
+ if(len==0)
+ return;
+
+ if(BLI_exists(filename)==0)
+ operator_cb(C, opname, 1);
+
+ if(filename[len-1]=='/' || filename[len-1]=='\\') {
+ uiPupMenuError(C, "Cannot overwrite a directory");
+ return;
}
-
- uiBoundsBlock(block, 1);
- uiEndBlock(C, block);
-
- return block;
+
+ confirm(C, opname, "Save over", filename);
}
+void uiPupMenuNotice(bContext *C, char *str, ...)
+{
+ va_list ap;
+
+ va_start(ap, str);
+ vconfirm(C, NULL, NULL, str, ap);
+ va_end(ap);
+}
+
+void uiPupMenuError(bContext *C, char *str, ...)
+{
+ va_list ap;
+ char nfmt[256];
+ char titlestr[256];
+
+ sprintf(titlestr, "Error %%i%d", ICON_ERROR);
+
+ sprintf(nfmt, "%s", str);
+
+ va_start(ap, str);
+ vconfirm(C, NULL, titlestr, nfmt, ap);
+ va_end(ap);
+}
+
+void uiPupMenuReports(bContext *C, ReportList *reports)
+{
+ Report *report;
+ DynStr *ds;
+ char *str;
+
+ if(!reports || !reports->list.first)
+ return;
+ if(!CTX_wm_window(C))
+ return;
+
+ ds= BLI_dynstr_new();
+
+ for(report=reports->list.first; report; report=report->next) {
+ if(report->type >= RPT_ERROR)
+ BLI_dynstr_appendf(ds, "Error %%i%d%%t|%s", ICON_ERROR, report->message);
+ else if(report->type >= RPT_WARNING)
+ BLI_dynstr_appendf(ds, "Warning %%i%d%%t|%s", ICON_ERROR, report->message);
+ }
+
+ str= BLI_dynstr_get_cstring(ds);
+ uiPupMenu(C, 0, NULL, NULL, str);
+ MEM_freeN(str);
+
+ BLI_dynstr_free(ds);
+}
diff --git a/source/blender/editors/interface/text.c b/source/blender/editors/interface/text.c
index edca092f42b..8d4a3e4fb29 100644
--- a/source/blender/editors/interface/text.c
+++ b/source/blender/editors/interface/text.c
@@ -43,6 +43,7 @@
#include "BIF_gl.h"
#include "UI_text.h"
+#include "BLF_api.h"
#include "ED_datafiles.h"
@@ -77,11 +78,7 @@ void string_to_utf8(char *original, char *utf_8, char *code)
#ifdef INTERNATIONAL
#include "FTF_Api.h"
-
-static struct LANGMenuEntry *langmenu= 0;
-static int tot_lang = 0;
-
-#endif // INTERNATIONAL
+#endif
void UI_RasterPos(float x, float y)
{
@@ -118,14 +115,13 @@ int UI_DrawString(BMF_Font* font, char *str, int translate)
#ifdef WITH_ICONV
if(translate & CONVERT_TO_UTF8) {
char utf_8[512];
+ char *code;
- struct LANGMenuEntry *lme;
- lme = find_language(U.language);
-
- if (lme !=NULL) {
- if (!strcmp(lme->code, "ja_JP"))
+ code= BLF_lang_find_code(U.language);
+ if (lme) {
+ if (!strcmp(code, "ja_JP"))
string_to_utf8(str, utf_8, "Shift_JIS"); /* Japanese */
- else if (!strcmp(lme->code, "zh_CN"))
+ else if (!strcmp(code, "zh_CN"))
string_to_utf8(str, utf_8, "GB2312"); /* Chinese */
}
@@ -204,50 +200,6 @@ char *fontsize_pup(void)
return (string);
}
-
-char *language_pup(void)
-{
- struct LANGMenuEntry *lme = langmenu;
- static char string[1024];
- static char tmp[1024];
-
- if(tot_lang == 0)
- sprintf(string, "Choose Language: %%t|Language: English %%x0");
- else {
- sprintf(string, "Choose Language: %%t");
- while(lme) {
- sprintf(tmp, "|Language: %s %%x%d", lme->language, lme->id);
- strcat(string, tmp);
- lme= lme->next;
- }
- }
-
- return string;
-}
-
-struct LANGMenuEntry *find_language(short langid)
-{
- struct LANGMenuEntry *lme = langmenu;
-
- while(lme) {
- if(lme->id == langid)
- return lme;
-
- lme=lme->next;
- }
- return NULL;
-}
-
-
-void lang_setlanguage(void)
-{
- struct LANGMenuEntry *lme;
-
- lme = find_language(U.language);
- if(lme) FTF_SetLanguage(lme->code);
- else FTF_SetLanguage("en_US");
-}
-
/* called from fileselector */
void set_interface_font(char *str)
{
@@ -255,7 +207,7 @@ void set_interface_font(char *str)
/* this test needed because fileselect callback can happen after disable AA fonts */
if(U.transopts & USER_DOTRANSLATE) {
if(FTF_SetFont((unsigned char*)str, 0, U.fontsize)) {
- lang_setlanguage();
+ BLF_lang_set(U.language);
if(strlen(str) < FILE_MAXDIR) strcpy(U.fontname, str);
G.ui_international = TRUE;
@@ -297,8 +249,7 @@ void start_interface_font(void)
}
if(result) {
- lang_setlanguage();
-
+ BLF_lang_set(U.language);
G.ui_international = TRUE;
}
else {
@@ -311,132 +262,5 @@ void start_interface_font(void)
/* XXX 2.50 bad call allqueue(REDRAWALL, 0); */
}
-static char *first_dpointchar(char *string)
-{
- char *dpointchar;
-
- dpointchar= strchr(string, ':');
-
- return dpointchar;
-}
-
-
-static void splitlangline(char *line, struct LANGMenuEntry *lme)
-{
- char *dpointchar= first_dpointchar(line);
-
- if (dpointchar) {
- lme->code= BLI_strdup(dpointchar+1);
- *(dpointchar)=0;
- lme->language= BLI_strdup(line);
- } else {
- /* XXX 2.50 bad call error("Invalid language file"); */
- }
-}
-
-
-static void puplang_insert_entry(char *line)
-{
- struct LANGMenuEntry *lme, *prev;
- int sorted = 0;
-
- prev= NULL;
- lme= langmenu;
-
- for (; lme; prev= lme, lme= lme->next) {
- if (lme->line) {
- if (BLI_streq(line, lme->line)) {
- return;
- } else if (sorted && strcmp(line, lme->line)<0) {
- break;
- }
- }
- }
-
- lme= MEM_mallocN(sizeof(*lme), "lme");
- lme->line = BLI_strdup(line);
- splitlangline(line, lme);
- lme->id = tot_lang;
- tot_lang++;
-
- if (prev) {
- lme->next= prev->next;
- prev->next= lme;
- } else {
- lme->next= langmenu;
- langmenu= lme;
- }
-}
-
-
-int read_languagefile(void)
-{
- char name[FILE_MAXDIR+FILE_MAXFILE];
- LinkNode *l, *lines;
-
- /* .Blanguages, http://www.blender3d.org/cms/Installation_Policy.352.0.html*/
-#if defined (__APPLE__) || (WIN32)
- BLI_make_file_string("/", name, BLI_gethome(), ".Blanguages");
-#else
- BLI_make_file_string("/", name, BLI_gethome(), ".blender/.Blanguages");
-#endif
-
- lines= BLI_read_file_as_lines(name);
-
- if(lines == NULL) {
- /* If not found in home, try current dir
- * (Resources folder of app bundle on OS X) */
-#if defined (__APPLE__)
- char *bundlePath = BLI_getbundle();
- strcpy(name, bundlePath);
- strcat(name, "/Contents/Resources/.Blanguages");
-#else
- /* Check the CWD. Takes care of the case where users
- * unpack blender tarball; cd blender-dir; ./blender */
- strcpy(name, ".blender/.Blanguages");
-#endif
- lines= BLI_read_file_as_lines(name);
-
- if(lines == NULL) {
- /* If not found in .blender, try current dir */
- strcpy(name, ".Blanguages");
- lines= BLI_read_file_as_lines(name);
- if(lines == NULL) {
- if(G.f & G_DEBUG) printf("File .Blanguages not found\n");
- return 0;
- }
- }
- }
-
- for (l= lines; l; l= l->next) {
- char *line= l->link;
-
- if (!BLI_streq(line, "")) {
- puplang_insert_entry(line);
- }
- }
-
- BLI_free_file_lines(lines);
-
- return 1;
-}
-
-
-void free_languagemenu(void)
-{
- struct LANGMenuEntry *lme= langmenu;
-
- while (lme) {
- struct LANGMenuEntry *n= lme->next;
-
- if (lme->line) MEM_freeN(lme->line);
- if (lme->language) MEM_freeN(lme->language);
- if (lme->code) MEM_freeN(lme->code);
- MEM_freeN(lme);
-
- lme= n;
- }
-}
-
#endif /* INTERNATIONAL */
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index c12fd7903d9..73fa62ba33e 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -57,6 +57,91 @@
#include "interface_intern.h"
/* *********************************************************************** */
+
+/* helper to allow scrollbars to dynamically hide */
+static int view2d_scroll_mapped(int scroll)
+{
+ if(scroll & V2D_SCROLL_HORIZONTAL_HIDE)
+ scroll &= ~(V2D_SCROLL_HORIZONTAL);
+ if(scroll & V2D_SCROLL_VERTICAL_HIDE)
+ scroll &= ~(V2D_SCROLL_VERTICAL);
+ return scroll;
+}
+
+/* called each time cur changes, to dynamically update masks */
+static void view2_masks(View2D *v2d)
+{
+ int scroll;
+
+ /* mask - view frame */
+ v2d->mask.xmin= v2d->mask.ymin= 0;
+ v2d->mask.xmax= v2d->winx - 1; /* -1 yes! masks are pixels */
+ v2d->mask.ymax= v2d->winy - 1;
+
+#if 0
+ v2d->scroll &= ~(V2D_SCROLL_HORIZONTAL_HIDE|V2D_SCROLL_VERTICAL_HIDE);
+ /* check size if: */
+ if (v2d->scroll & V2D_SCROLL_HORIZONTAL)
+ if(!(v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL))
+ if (v2d->tot.xmax-v2d->tot.xmin <= v2d->cur.xmax-v2d->cur.xmin)
+ v2d->scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
+ if (v2d->scroll & V2D_SCROLL_VERTICAL)
+ if(!(v2d->scroll & V2D_SCROLL_SCALE_VERTICAL))
+ if (v2d->tot.ymax-v2d->tot.ymin <= v2d->cur.ymax-v2d->cur.ymin)
+ v2d->scroll |= V2D_SCROLL_VERTICAL_HIDE;
+#endif
+ scroll= view2d_scroll_mapped(v2d->scroll);
+
+ /* scrollers shrink mask area, but should be based off regionsize
+ * - they can only be on one to two edges of the region they define
+ * - if they overlap, they must not occupy the corners (which are reserved for other widgets)
+ */
+ if (scroll) {
+ /* vertical scroller */
+ if (scroll & V2D_SCROLL_LEFT) {
+ /* on left-hand edge of region */
+ v2d->vert= v2d->mask;
+ v2d->vert.xmax= V2D_SCROLL_WIDTH;
+ v2d->mask.xmin= v2d->vert.xmax + 1;
+ }
+ else if (scroll & V2D_SCROLL_RIGHT) {
+ /* on right-hand edge of region */
+ v2d->vert= v2d->mask;
+ v2d->vert.xmax++; /* one pixel extra... was having leaving a minor gap... */
+ v2d->vert.xmin= v2d->vert.xmax - V2D_SCROLL_WIDTH;
+ v2d->mask.xmax= v2d->vert.xmin - 1;
+ }
+
+ /* horizontal scroller */
+ if (scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O)) {
+ /* on bottom edge of region (V2D_SCROLL_BOTTOM_O is outliner, the other is for standard) */
+ v2d->hor= v2d->mask;
+ v2d->hor.ymax= V2D_SCROLL_HEIGHT;
+ v2d->mask.ymin= v2d->hor.ymax + 1;
+ }
+ else if (scroll & V2D_SCROLL_TOP) {
+ /* on upper edge of region */
+ v2d->hor= v2d->mask;
+ v2d->hor.ymin= v2d->hor.ymax - V2D_SCROLL_HEIGHT;
+ v2d->mask.ymax= v2d->hor.ymin - 1;
+ }
+
+ /* adjust vertical scroller if there's a horizontal scroller, to leave corner free */
+ if (scroll & V2D_SCROLL_VERTICAL) {
+ /* just set y min/max for vertical scroller to y min/max of mask as appropriate */
+ if (scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O)) {
+ /* on bottom edge of region (V2D_SCROLL_BOTTOM_O is outliner, the other is for standard) */
+ v2d->vert.ymin= v2d->mask.ymin;
+ }
+ else if (scroll & V2D_SCROLL_TOP) {
+ /* on upper edge of region */
+ v2d->vert.ymax= v2d->mask.ymax;
+ }
+ }
+ }
+
+}
+
/* Refresh and Validation */
/* Initialise all relevant View2D data (including view rects if first time) and/or refresh mask sizes after view resize
@@ -153,69 +238,19 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
}
}
-
/* store view size */
v2d->winx= winx;
v2d->winy= winy;
- /* mask - view frame */
- v2d->mask.xmin= v2d->mask.ymin= 0;
- v2d->mask.xmax= winx - 1; /* -1 yes! masks are pixels */
- v2d->mask.ymax= winy - 1;
-
- /* scrollers shrink mask area, but should be based off regionsize
- * - they can only be on one to two edges of the region they define
- * - if they overlap, they must not occupy the corners (which are reserved for other widgets)
- */
- if (v2d->scroll) {
- /* vertical scroller */
- if (v2d->scroll & V2D_SCROLL_LEFT) {
- /* on left-hand edge of region */
- v2d->vert= v2d->mask;
- v2d->vert.xmax= V2D_SCROLL_WIDTH;
- v2d->mask.xmin= v2d->vert.xmax + 1;
- }
- else if (v2d->scroll & V2D_SCROLL_RIGHT) {
- /* on right-hand edge of region */
- v2d->vert= v2d->mask;
- v2d->vert.xmax++; /* one pixel extra... was having leaving a minor gap... */
- v2d->vert.xmin= v2d->vert.xmax - V2D_SCROLL_WIDTH;
- v2d->mask.xmax= v2d->vert.xmin - 1;
- }
-
- /* horizontal scroller */
- if (v2d->scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O)) {
- /* on bottom edge of region (V2D_SCROLL_BOTTOM_O is outliner, the other is for standard) */
- v2d->hor= v2d->mask;
- v2d->hor.ymax= V2D_SCROLL_HEIGHT;
- v2d->mask.ymin= v2d->hor.ymax + 1;
- }
- else if (v2d->scroll & V2D_SCROLL_TOP) {
- /* on upper edge of region */
- v2d->hor= v2d->mask;
- v2d->hor.ymin= v2d->hor.ymax - V2D_SCROLL_HEIGHT;
- v2d->mask.ymax= v2d->hor.ymin - 1;
- }
-
- /* adjust vertical scroller if there's a horizontal scroller, to leave corner free */
- if (v2d->scroll & V2D_SCROLL_VERTICAL) {
- /* just set y min/max for vertical scroller to y min/max of mask as appropriate */
- if (v2d->scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O)) {
- /* on bottom edge of region (V2D_SCROLL_BOTTOM_O is outliner, the other is for standard) */
- v2d->vert.ymin= v2d->mask.ymin;
- }
- else if (v2d->scroll & V2D_SCROLL_TOP) {
- /* on upper edge of region */
- v2d->vert.ymax= v2d->mask.ymax;
- }
- }
- }
+ /* set masks */
+ view2_masks(v2d);
/* set 'tot' rect before setting cur? */
if (tot_changed)
UI_view2d_totRect_set(v2d, winx, winy);
else
UI_view2d_curRect_validate(v2d);
+
}
/* Ensure View2D rects remain in a viable configuration
@@ -549,6 +584,9 @@ void UI_view2d_curRect_validate(View2D *v2d)
}
}
}
+
+ /* set masks */
+ view2_masks(v2d);
}
/* ------------------ */
@@ -731,7 +769,7 @@ static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked)
{
*curmasked= v2d->cur;
- if ((v2d->scroll)) {
+ if (view2d_scroll_mapped(v2d->scroll)) {
float dx= (v2d->cur.xmax-v2d->cur.xmin)/((float)(v2d->mask.xmax-v2d->mask.xmin+1));
float dy= (v2d->cur.ymax-v2d->cur.ymin)/((float)(v2d->mask.ymax-v2d->mask.ymin+1));
@@ -1116,6 +1154,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
View2DScrollers *scrollers;
rcti vert, hor;
float fac, totsize, scrollsize;
+ int scroll= view2d_scroll_mapped(v2d->scroll);
vert= v2d->vert;
hor= v2d->hor;
@@ -1129,7 +1168,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
*/
/* horizontal scrollers */
- if (v2d->scroll & V2D_SCROLL_HORIZONTAL) {
+ if (scroll & V2D_SCROLL_HORIZONTAL) {
/* scroller 'button' extents */
totsize= v2d->tot.xmax - v2d->tot.xmin;
scrollsize= (float)(hor.xmax - hor.xmin);
@@ -1145,7 +1184,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
}
/* vertical scrollers */
- if (v2d->scroll & V2D_SCROLL_VERTICAL) {
+ if (scroll & V2D_SCROLL_VERTICAL) {
/* scroller 'button' extents */
totsize= v2d->tot.ymax - v2d->tot.ymin;
scrollsize= (float)(vert.ymax - vert.ymin);
@@ -1161,7 +1200,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
}
/* grid markings on scrollbars */
- if (v2d->scroll & (V2D_SCROLL_SCALE_HORIZONTAL|V2D_SCROLL_SCALE_VERTICAL)) {
+ if (scroll & (V2D_SCROLL_SCALE_HORIZONTAL|V2D_SCROLL_SCALE_VERTICAL)) {
/* store clamping */
scrollers->xclamp= xclamp;
scrollers->xunits= xunits;
@@ -1292,13 +1331,14 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
Scene *scene= CTX_data_scene(C);
const short darker= -50, dark= -10, light= 20, lighter= 50;
rcti vert, hor, corner;
+ int scroll= view2d_scroll_mapped(v2d->scroll);
/* make copies of rects for less typing */
vert= v2d->vert;
hor= v2d->hor;
/* horizontal scrollbar */
- if (v2d->scroll & V2D_SCROLL_HORIZONTAL) {
+ if (scroll & V2D_SCROLL_HORIZONTAL) {
/* scroller backdrop */
UI_ThemeColorShade(TH_SHADE1, light);
glRecti(hor.xmin, hor.ymin, hor.xmax, hor.ymax);
@@ -1306,8 +1346,10 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
/* scroller 'button'
* - if view is zoomable in x, draw handles too
* - handles are drawn darker
+ * - no slider when view is > total
*/
- if (v2d->keepzoom & V2D_LOCKZOOM_X) {
+ if (v2d->tot.xmax-v2d->tot.xmin <= v2d->cur.xmax-v2d->cur.xmin);
+ else if (v2d->keepzoom & V2D_LOCKZOOM_X) {
/* draw base bar as rounded shape */
UI_ThemeColorShade(TH_SHADE1, dark);
uiSetRoundBox(15);
@@ -1362,7 +1404,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
/* scale indicators */
// XXX will need to update the font drawing when the new stuff comes in
- if ((v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL) && (vs->grid)) {
+ if ((scroll & V2D_SCROLL_SCALE_HORIZONTAL) && (vs->grid)) {
View2DGrid *grid= vs->grid;
float fac, dfac, fac2, val;
@@ -1426,14 +1468,14 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
/* decoration outer bevel line */
UI_ThemeColorShade(TH_SHADE1, lighter);
- if (v2d->scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O))
+ if (scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O))
sdrawline(hor.xmin, hor.ymax, hor.xmax, hor.ymax);
- else if (v2d->scroll & V2D_SCROLL_TOP)
+ else if (scroll & V2D_SCROLL_TOP)
sdrawline(hor.xmin, hor.ymin, hor.xmax, hor.ymin);
}
/* vertical scrollbar */
- if (v2d->scroll & V2D_SCROLL_VERTICAL) {
+ if (scroll & V2D_SCROLL_VERTICAL) {
/* scroller backdrop */
UI_ThemeColorShade(TH_SHADE1, light);
glRecti(vert.xmin, vert.ymin, vert.xmax, vert.ymax);
@@ -1442,7 +1484,8 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
* - if view is zoomable in y, draw handles too
* - handles are drawn darker
*/
- if (v2d->keepzoom & V2D_LOCKZOOM_Y) {
+ if (v2d->tot.ymax-v2d->tot.ymin <= v2d->cur.ymax-v2d->cur.ymin);
+ else if (v2d->keepzoom & V2D_LOCKZOOM_Y) {
/* draw base bar as rounded shape */
UI_ThemeColorShade(TH_SHADE1, dark);
uiSetRoundBox(15);
@@ -1497,7 +1540,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
/* scale indiators */
// XXX will need to update the font drawing when the new stuff comes in
- if ((v2d->scroll & V2D_SCROLL_SCALE_VERTICAL) && (vs->grid)) {
+ if ((scroll & V2D_SCROLL_SCALE_VERTICAL) && (vs->grid)) {
View2DGrid *grid= vs->grid;
float fac, dfac, val;
@@ -1532,14 +1575,14 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
/* decoration outer bevel line */
UI_ThemeColorShade(TH_SHADE1, lighter);
- if (v2d->scroll & V2D_SCROLL_RIGHT)
+ if (scroll & V2D_SCROLL_RIGHT)
sdrawline(vert.xmin, vert.ymin, vert.xmin, vert.ymax);
- else if (v2d->scroll & V2D_SCROLL_LEFT)
+ else if (scroll & V2D_SCROLL_LEFT)
sdrawline(vert.xmax, vert.ymin, vert.xmax, vert.ymax);
}
/* draw a 'sunken square' to cover up any overlapping corners resulting from intersection of overflowing scroller data */
- if ((v2d->scroll & V2D_SCROLL_VERTICAL) && (v2d->scroll & V2D_SCROLL_HORIZONTAL)) {
+ if ((scroll & V2D_SCROLL_VERTICAL) && (scroll & V2D_SCROLL_HORIZONTAL)) {
/* set bounds (these should be right) */
corner.xmin= vert.xmin;
corner.xmax= vert.xmax;
@@ -1811,16 +1854,17 @@ short UI_view2d_mouse_in_scrollers (const bContext *C, View2D *v2d, int x, int y
{
ARegion *ar= CTX_wm_region(C);
int co[2];
+ int scroll= view2d_scroll_mapped(v2d->scroll);
/* clamp x,y to region-coordinates first */
co[0]= x - ar->winrct.xmin;
co[1]= y - ar->winrct.ymin;
/* check if within scrollbars */
- if (v2d->scroll & V2D_SCROLL_HORIZONTAL) {
+ if (scroll & V2D_SCROLL_HORIZONTAL) {
if (IN_2D_HORIZ_SCROLL(v2d, co)) return 'h';
}
- if (v2d->scroll & V2D_SCROLL_VERTICAL) {
+ if (scroll & V2D_SCROLL_VERTICAL) {
if (IN_2D_VERT_SCROLL(v2d, co)) return 'v';
}
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c
index adb45db40f2..58041120a42 100644
--- a/source/blender/editors/mesh/editmesh.c
+++ b/source/blender/editors/mesh/editmesh.c
@@ -77,9 +77,17 @@
#include "BIF_retopo.h"
#include "ED_mesh.h"
+#include "ED_object.h"
#include "ED_util.h"
+#include "ED_screen.h"
#include "ED_view3d.h"
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
/* own include */
#include "mesh_intern.h"
@@ -92,11 +100,7 @@ editmesh.c:
/* XXX */
static void BIF_undo_push() {}
-static void waitcursor() {}
static void error() {}
-static int pupmenu() {return 0;}
-static void key_to_mesh() {}
-static void adduplicate() {}
/* ***************** HASH ********************* */
@@ -583,6 +587,7 @@ static void editMesh_set_hash(EditMesh *em)
{
EditEdge *eed;
+ if(em->hashedgetab) MEM_freeN(em->hashedgetab);
em->hashedgetab= NULL;
for(eed=em->edges.first; eed; eed= eed->next) {
@@ -851,8 +856,6 @@ void make_editMesh(Scene *scene, Object *ob)
actkey = ob_get_keyblock(ob);
if(actkey) {
- // XXX strcpy(G.editModeTitleExtra, "(Key) ");
- key_to_mesh(actkey, me);
tot= actkey->totelem;
/* undo-ing in past for previous editmode sessions gives corrupt 'keyindex' values */
undo_editmode_clear();
@@ -1424,371 +1427,203 @@ void load_editMesh(Scene *scene, Object *ob)
void remake_editMesh(Scene *scene, Object *ob)
{
make_editMesh(scene, ob);
-// allqueue(REDRAWVIEW3D, 0);
-// allqueue(REDRAWBUTSOBJECT, 0); /* needed to have nice cloth panels */
DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
BIF_undo_push("Undo all changes");
}
-/* *************** (partial exit editmode) *************/
-
+/* *************** Operator: separate parts *************/
+static EnumPropertyItem prop_separate_types[] = {
+ {0, "SELECTED", "Selection", ""},
+ {1, "MATERIAL", "By Material", ""},
+ {2, "LOOSE", "By loose parts", ""},
+ {0, NULL, NULL, NULL}
+};
-
-void separate_mesh(Scene *scene, Object *obedit)
+/* return 1: success */
+static int mesh_separate_selected(Scene *scene, Base *editbase)
{
- EditMesh *em, emcopy;
+ EditMesh *em, *emnew;
EditVert *eve, *v1;
EditEdge *eed, *e1;
- EditFace *efa, *vl1;
- Object *oldob;
- Mesh *me, *men;
- Base *base, *oldbase;
- ListBase edve, eded, edvl;
+ EditFace *efa, *f1;
+ Object *obedit;
+ Mesh *me, *menew;
+ Base *basenew;
- if(obedit==NULL) return;
-
- waitcursor(1);
+ if(editbase==NULL) return 0;
+ obedit= editbase->object;
me= obedit->data;
em= me->edit_mesh;
if(me->key) {
error("Can't separate with vertex keys");
- return;
+ return 0;
}
- if(em->selected.first) BLI_freelistN(&(em->selected)); /* clear the selection order */
+ if(em->selected.first)
+ BLI_freelistN(&(em->selected)); /* clear the selection order */
EM_selectmode_set(em); // enforce full consistant selection flags
- /* we are going to abuse the system as follows:
- * 1. add a duplicate object: this will be the new one, we remember old pointer
- * 2: then do a split if needed.
- * 3. put apart: all NOT selected verts, edges, faces
- * 4. call load_editMesh(): this will be the new object
- * 5. freelist and get back old verts, edges, facs
+ EM_stats_update(em);
+
+ if(em->totvertsel==0) return 0;
+
+ /* we are going to work as follows:
+ * 1. add a linked duplicate object: this will be the new one, we remember old pointer
+ * 2. give new object empty mesh and put in editmode
+ * 3: do a split if needed on current editmesh.
+ * 4. copy over: all NOT selected verts, edges, faces
+ * 5. call load_editMesh() on the new object
*/
- /* make only obedit selected */
- base= FIRSTBASE;
- while(base) {
-// XXX if(base->lay & G.vd->lay) {
- if(base->object==obedit) base->flag |= SELECT;
- else base->flag &= ~SELECT;
-// }
- base= base->next;
- }
+ /* 1 */
+ basenew= ED_object_add_duplicate(scene, editbase, 0); /* 0 = fully linked */
+ ED_base_object_select(basenew, BA_DESELECT);
+
+ /* 2 */
+ basenew->object->data= menew= add_mesh(me->id.name); /* empty */
+ me->id.us--;
+ make_editMesh(scene, basenew->object);
+ emnew= menew->edit_mesh;
- /* no test for split, split doesn't split when a loose part is selected */
+ /* 3 */
/* SPLIT: first make duplicate */
adduplicateflag(em, SELECT);
-
/* SPLIT: old faces have 3x flag 128 set, delete these ones */
delfaceflag(em, 128);
-
/* since we do tricky things with verts/edges/faces, this makes sure all is selected coherent */
EM_selectmode_set(em);
- /* set apart: everything that is not selected */
- edve.first= edve.last= eded.first= eded.last= edvl.first= edvl.last= 0;
- eve= em->verts.first;
- while(eve) {
+ /* 4 */
+ /* move over: everything that is selected */
+ for(eve= em->verts.first; eve; eve= v1) {
v1= eve->next;
- if((eve->f & SELECT)==0) {
+ if(eve->f & SELECT) {
BLI_remlink(&em->verts, eve);
- BLI_addtail(&edve, eve);
+ BLI_addtail(&emnew->verts, eve);
}
-
- eve= v1;
}
- eed= em->edges.first;
- while(eed) {
+
+ for(eed= em->edges.first; eed; eed= e1) {
e1= eed->next;
- if((eed->f & SELECT)==0) {
+ if(eed->f & SELECT) {
BLI_remlink(&em->edges, eed);
- BLI_addtail(&eded, eed);
+ BLI_addtail(&emnew->edges, eed);
}
- eed= e1;
}
- efa= em->faces.first;
- while(efa) {
- vl1= efa->next;
+
+ for(efa= em->faces.first; efa; efa= f1) {
+ f1= efa->next;
if (efa == em->act_face && (efa->f & SELECT)) {
EM_set_actFace(em, NULL);
}
- if((efa->f & SELECT)==0) {
+ if(efa->f & SELECT) {
BLI_remlink(&em->faces, efa);
- BLI_addtail(&edvl, efa);
+ BLI_addtail(&emnew->faces, efa);
}
- efa= vl1;
}
-
- oldob= obedit;
- oldbase= BASACT;
-
- adduplicate(1, 0); /* notrans and a linked duplicate */
-
- obedit= BASACT->object; /* basact was set in adduplicate() */
-
- men= copy_mesh(me);
- set_mesh(obedit, men);
- /* because new mesh is a copy: reduce user count */
- men->id.us--;
-
- load_editMesh(scene, obedit);
-
- BASACT->flag &= ~SELECT;
-
- /* we cannot free the original buffer... */
- emcopy= *em;
- emcopy.allverts= NULL;
- emcopy.alledges= NULL;
- emcopy.allfaces= NULL;
- emcopy.derivedFinal= emcopy.derivedCage= NULL;
- memset(&emcopy.vdata, 0, sizeof(emcopy.vdata));
- memset(&emcopy.fdata, 0, sizeof(emcopy.fdata));
- free_editMesh(&emcopy);
-
- em->verts= edve;
- em->edges= eded;
- em->faces= edvl;
-
- /* hashedges are freed now, make new! */
- editMesh_set_hash(em);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- obedit= oldob;
- BASACT= oldbase;
- BASACT->flag |= SELECT;
+ /* 5 */
+ load_editMesh(scene, basenew->object);
+ free_editMesh(emnew);
- waitcursor(0);
+ /* hashedges are invalid now, make new! */
+ editMesh_set_hash(em);
-// allqueue(REDRAWVIEW3D, 0);
DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+ DAG_object_flush_update(scene, basenew->object, OB_RECALC_DATA);
+ return 1;
}
-void separate_material(Scene *scene, Object *obedit)
+/* return 1: success */
+static int mesh_separate_material(Scene *scene, Base *editbase)
{
- Mesh *me;
- EditMesh *em;
+ Mesh *me= editbase->object->data;
+ EditMesh *em= me->edit_mesh;
unsigned char curr_mat;
- me= obedit->data;
- em= me->edit_mesh;
- if(me->key) {
- error("Can't separate with vertex keys");
- return;
- }
-
- if(obedit && em) {
- if(obedit->type == OB_MESH) {
- for (curr_mat = 1; curr_mat < obedit->totcol; ++curr_mat) {
- /* clear selection, we're going to use that to select material group */
- EM_clear_flag_all(em, SELECT);
- /* select the material */
- editmesh_select_by_material(em, curr_mat);
- /* and now separate */
- separate_mesh(scene, obedit);
- }
- }
+ for (curr_mat = 1; curr_mat < editbase->object->totcol; ++curr_mat) {
+ /* clear selection, we're going to use that to select material group */
+ EM_clear_flag_all(em, SELECT);
+ /* select the material */
+ editmesh_select_by_material(em, curr_mat);
+ /* and now separate */
+ if(0==mesh_separate_selected(scene, editbase))
+ return 0;
}
-
- // allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-
+ return 1;
}
-
-void separate_mesh_loose(Scene *scene, Object *obedit)
+/* return 1: success */
+static int mesh_separate_loose(Scene *scene, Base *editbase)
{
- EditMesh *em, emcopy;
- EditVert *eve, *v1;
- EditEdge *eed, *e1;
- EditFace *efa, *vl1;
- Object *oldob=NULL;
- Mesh *me, *men;
- Base *base, *oldbase;
- ListBase edve, eded, edvl;
- int vertsep=0;
- short done=0, check=1;
-
- me= obedit->data;
+ Mesh *me;
+ EditMesh *em;
+ int doit= 1;
+
+ me= editbase->object->data;
em= me->edit_mesh;
+
if(me->key) {
- error("Can't separate a mesh with vertex keys");
- return;
+ error("Can't separate with vertex keys");
+ return 0;
}
-
- waitcursor(1);
- /* we are going to abuse the system as follows:
- * 1. add a duplicate object: this will be the new one, we remember old pointer
- * 2: then do a split if needed.
- * 3. put apart: all NOT selected verts, edges, faces
- * 4. call load_editMesh(): this will be the new object
- * 5. freelist and get back old verts, edges, facs
- */
-
- while(!done){
- vertsep=check=1;
-
- /* make only obedit selected */
- base= FIRSTBASE;
- while(base) {
-// XXX if(base->lay & G.vd->lay) {
- if(base->object==obedit) base->flag |= SELECT;
- else base->flag &= ~SELECT;
-// }
- base= base->next;
- }
-
- /*--------- Select connected-----------*/
-
- EM_clear_flag_all(em, SELECT);
-
+ EM_clear_flag_all(em, SELECT);
+
+ while(doit && em->verts.first) {
/* Select a random vert to start with */
- eve= em->verts.first;
+ EditVert *eve= em->verts.first;
eve->f |= SELECT;
- while(check==1) {
- check= 0;
- eed= em->edges.first;
- while(eed) {
- if(eed->h==0) {
- if(eed->v1->f & SELECT) {
- if( (eed->v2->f & SELECT)==0 ) {
- eed->v2->f |= SELECT;
- vertsep++;
- check= 1;
- }
- }
- else if(eed->v2->f & SELECT) {
- if( (eed->v1->f & SELECT)==0 ) {
- eed->v1->f |= SELECT;
- vertsep++;
- check= SELECT;
- }
- }
- }
- eed= eed->next;
- }
- }
- /*----------End of select connected--------*/
-
+ selectconnected_mesh_all(em);
- /* If the amount of vertices that is about to be split == the total amount
- of verts in the mesh, it means that there is only 1 unconnected object, so we don't have to separate
- */
- if(em->totvert==vertsep) done=1;
- else{
- /* No splitting: select connected goes fine */
-
- EM_select_flush(em); // from verts->edges->faces
+ /* and now separate */
+ doit= mesh_separate_selected(scene, editbase);
+ }
+ return 1;
+}
- /* set apart: everything that is not selected */
- edve.first= edve.last= eded.first= eded.last= edvl.first= edvl.last= 0;
- eve= em->verts.first;
- while(eve) {
- v1= eve->next;
- if((eve->f & SELECT)==0) {
- BLI_remlink(&em->verts, eve);
- BLI_addtail(&edve, eve);
- }
- eve= v1;
- }
- eed= em->edges.first;
- while(eed) {
- e1= eed->next;
- if( (eed->f & SELECT)==0 ) {
- BLI_remlink(&em->edges, eed);
- BLI_addtail(&eded, eed);
- }
- eed= e1;
- }
- efa= em->faces.first;
- while(efa) {
- vl1= efa->next;
- if( (efa->f & SELECT)==0 ) {
- BLI_remlink(&em->faces, efa);
- BLI_addtail(&edvl, efa);
- }
- efa= vl1;
- }
-
- oldob= obedit;
- oldbase= BASACT;
-
- adduplicate(1, 0); /* notrans and a linked duplicate*/
-
- obedit= BASACT->object; /* basact was set in adduplicate() */
- men= copy_mesh(me);
- set_mesh(obedit, men);
- /* because new mesh is a copy: reduce user count */
- men->id.us--;
-
- load_editMesh(scene, obedit);
-
- BASACT->flag &= ~SELECT;
-
- /* we cannot free the original buffer... */
- emcopy= *em;
- emcopy.allverts= NULL;
- emcopy.alledges= NULL;
- emcopy.allfaces= NULL;
- emcopy.derivedFinal= emcopy.derivedCage= NULL;
- memset(&emcopy.vdata, 0, sizeof(emcopy.vdata));
- memset(&emcopy.fdata, 0, sizeof(emcopy.fdata));
- free_editMesh(&emcopy);
-
- em->verts= edve;
- em->edges= eded;
- em->faces= edvl;
-
- /* hashedges are freed now, make new! */
- editMesh_set_hash(em);
-
- obedit= oldob;
- BASACT= oldbase;
- BASACT->flag |= SELECT;
-
- }
+static int mesh_separate_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ Base *base= CTX_data_active_base(C);
+ int retval= 0;
+
+ if(RNA_enum_is_equal(op->ptr, "type", "SELECTED"))
+ retval= mesh_separate_selected(scene, base);
+ else if(RNA_enum_is_equal(op->ptr, "type", "MATERIAL"))
+ retval= mesh_separate_material (scene, base);
+ else if(RNA_enum_is_equal(op->ptr, "type", "LOOSE"))
+ retval= mesh_separate_loose(scene, base);
+
+ if(retval) {
+ WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, base->object);
+ return OPERATOR_FINISHED;
}
-
- /* unselect the vertices that we (ab)used for the separation*/
- EM_clear_flag_all(em, SELECT);
-
- waitcursor(0);
-// allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+ return OPERATOR_CANCELLED;
}
-void separatemenu(Scene *scene, Object *obedit)
+void MESH_OT_separate(wmOperatorType *ot)
{
- Mesh *me= obedit->data;
- short event;
+ /* identifiers */
+ ot->name= "Mesh Separate";
+ ot->idname= "MESH_OT_separate";
- if(me->edit_mesh->verts.first==NULL) return;
-
- event = pupmenu("Separate %t|Selected%x1|All Loose Parts%x2|By Material%x3");
-
- if (event==0) return;
- waitcursor(1);
-
- switch (event) {
- case 1:
- separate_mesh(scene, obedit);
- break;
- case 2:
- separate_mesh_loose(scene, obedit);
- break;
- case 3:
- separate_material(scene, obedit);
- break;
- }
- waitcursor(0);
+ /* api callbacks */
+ ot->invoke= WM_menu_invoke;
+ ot->exec= mesh_separate_exec;
+ ot->poll= ED_operator_editmesh;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+
+ RNA_def_enum(ot->srna, "type", prop_separate_types, 0, "Type", "");
}
@@ -1848,9 +1683,6 @@ static void free_undoMesh(void *umv)
{
UndoMesh *um= umv;
- if (um == NULL)
- return; /* XXX FIX ME, THIS SHOULD NEVER BE TRUE YET IT HAPPENS DURING TRANSFORM */
-
if(um->verts) MEM_freeN(um->verts);
if(um->edges) MEM_freeN(um->edges);
if(um->faces) MEM_freeN(um->faces);
@@ -1865,7 +1697,6 @@ static void free_undoMesh(void *umv)
static void *editMesh_to_undoMesh(void *emv)
{
EditMesh *em= (EditMesh *)emv;
-// Scene *scene= NULL;
UndoMesh *um;
EditVert *eve;
EditEdge *eed;
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index e0712290081..54445f87150 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -76,7 +76,6 @@
/* XXX */
static void BIF_undo_push() {}
-static void waitcursor() {}
static void error() {}
static int pupmenu() {return 0;}
#define add_numbut(a, b, c, d, e, f, g) {}
@@ -119,34 +118,36 @@ static short icoface[20][3] = {
{10,9,11}
};
-static void get_view_aligned_coordinate(float *fp, short mval[2])
+static void get_view_aligned_coordinate(ViewContext *vc, float *fp, short mval[2])
{
-// float dvec[3];
-// short mx, my;
+ float dvec[3];
+ short mx, my;
-// mx= mval[0];
-// my= mval[1];
+ mx= mval[0];
+ my= mval[1];
-// XXX project_short_noclip(ar, v3d, fp, mval);
+ project_short_noclip(vc->ar, fp, mval);
-// XXX initgrabz(fp[0], fp[1], fp[2]);
+ initgrabz(vc->rv3d, fp[0], fp[1], fp[2]);
-// if(mval[0]!=IS_CLIPPED) {
-// window_to_3d_delta(dvec, mval[0]-mx, mval[1]-my);
-// VecSubf(fp, fp, dvec);
-// }
+ if(mval[0]!=IS_CLIPPED) {
+ window_to_3d_delta(vc->ar, dvec, mval[0]-mx, mval[1]-my);
+ VecSubf(fp, fp, dvec);
+ }
}
-void add_click_mesh(Scene *scene, Object *obedit, EditMesh *em)
+void add_click_mesh(bContext *C)
{
- View3D *v3d= NULL; // XXX
+ ViewContext vc;
EditVert *eve, *v1;
float min[3], max[3];
int done= 0;
+ em_setup_viewcontext(C, &vc);
+
INIT_MINMAX(min, max);
- for(v1= em->verts.first;v1; v1=v1->next) {
+ for(v1= vc.em->verts.first;v1; v1=v1->next) {
if(v1->f & SELECT) {
DO_MINMAX(v1->co, min, max);
done= 1;
@@ -162,7 +163,7 @@ void add_click_mesh(Scene *scene, Object *obedit, EditMesh *em)
/* check for edges that are half selected, use for rotation */
done= 0;
- for(eed= em->edges.first; eed; eed= eed->next) {
+ for(eed= vc.em->edges.first; eed; eed= eed->next) {
if( (eed->v1->f & SELECT)+(eed->v2->f & SELECT) == SELECT ) {
if(eed->v1->f & SELECT) VecSubf(vec, eed->v1->co, eed->v2->co);
else VecSubf(vec, eed->v2->co, eed->v1->co);
@@ -177,10 +178,10 @@ void add_click_mesh(Scene *scene, Object *obedit, EditMesh *em)
VecMulf(cent, 0.5f);
VECCOPY(min, cent);
- Mat4MulVecfl(obedit->obmat, min); // view space
- get_view_aligned_coordinate(min, mval);
- Mat4Invert(obedit->imat, obedit->obmat);
- Mat4MulVecfl(obedit->imat, min); // back in object space
+ Mat4MulVecfl(vc.obedit->obmat, min); // view space
+ get_view_aligned_coordinate(&vc, min, mval);
+ Mat4Invert(vc.obedit->imat, vc.obedit->obmat);
+ Mat4MulVecfl(vc.obedit->imat, min); // back in object space
VecSubf(min, min, cent);
@@ -209,23 +210,23 @@ void add_click_mesh(Scene *scene, Object *obedit, EditMesh *em)
}
}
- extrudeflag(obedit, em, SELECT, nor);
- rotateflag(em, SELECT, cent, mat);
- translateflag(em, SELECT, min);
+ extrudeflag(vc.obedit, vc.em, SELECT, nor);
+ rotateflag(vc.em, SELECT, cent, mat);
+ translateflag(vc.em, SELECT, min);
- recalc_editnormals(em);
+ recalc_editnormals(vc.em);
}
else {
float mat[3][3],imat[3][3];
- float *curs= give_cursor(scene, v3d);
+ float *curs= give_cursor(vc.scene, vc.v3d);
- eve= addvertlist(em, 0, NULL);
+ eve= addvertlist(vc.em, 0, NULL);
- Mat3CpyMat4(mat, obedit->obmat);
+ Mat3CpyMat4(mat, vc.obedit->obmat);
Mat3Inv(imat, mat);
VECCOPY(eve->co, curs);
- VecSubf(eve->co, eve->co, obedit->obmat[3]);
+ VecSubf(eve->co, eve->co, vc.obedit->obmat[3]);
Mat3MulVecfl(imat, eve->co);
@@ -235,9 +236,8 @@ void add_click_mesh(Scene *scene, Object *obedit, EditMesh *em)
//retopo_do_all();
BIF_undo_push("Add vertex/edge/face");
-// XXX DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+ DAG_object_flush_update(vc.scene, vc.obedit, OB_RECALC_DATA);
- while(0); // XXX get_mbut()&R_MOUSE);
}
@@ -560,6 +560,7 @@ static void fix_new_face(EditMesh *em, EditFace *eface)
}
}
+/* only adds quads or trias when there's edges already */
void addfaces_from_edgenet(EditMesh *em)
{
EditVert *eve1, *eve2, *eve3, *eve4;
@@ -740,30 +741,6 @@ void addedgeface_mesh(EditMesh *em)
}
-void adduplicate_mesh(Scene *scene, Object *obedit, EditMesh *em)
-{
-
- waitcursor(1);
-
- adduplicateflag(em, SELECT);
-
- waitcursor(0);
-
- /* We need to force immediate calculation here because
- * transform may use derived objects (which are now stale).
- *
- * This shouldn't be necessary, derived queries should be
- * automatically building this data if invalid. Or something.
- */
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- object_handle_update(scene, obedit);
-
-// XXX BIF_TransformSetUndo("Add Duplicate");
-// initTransform(TFM_TRANSLATION, CTX_NO_PET);
-// Transform();
-}
-
-
// HACK: these can also be found in cmoview.tga.c, but are here so that they can be found by linker
// this hack is only used so that scons+mingw + split-sources hack works
// ------------------------------- start copied code
@@ -1214,181 +1191,6 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
righthandfaces(em, 1); /* otherwise monkey has eyes in wrong direction */
}
-#if 0
-void add_primitiveMesh(Scene *scene, View3D *v3d, Object *obedit, EditMesh *em, int type)
-{
- Mesh *me;
- float *curs, d, dia, phi, phid, cent[3], imat[3][3], mat[3][3];
- float cmat[3][3];
- static int tot=32, seg=32, subdiv=2,
- /* so each type remembers its fill setting */
- fill_circle=0, fill_cone=1, fill_cylinder=1;
-
- int ext=0, fill=0, totoud, newob=0;
- char *undostr="Add Primitive";
- char *name=NULL;
-
-// if(scene->id.lib) return;
-
- /* this function also comes from an info window */
-// XXX if ELEM(curarea->spacetype, SPACE_VIEW3D, SPACE_INFO); else return;
-
- /* if editmode exists for other type, it exits */
- check_editmode(OB_MESH);
-
- if(G.f & (G_VERTEXPAINT+G_TEXTUREPAINT)) {
- G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT);
- }
-
- totoud= tot; /* store, and restore when cube/plane */
-
- dia= v3d->grid;
- d= v3d->grid;
-
- /* ext==extrudeflag, tot==amount of vertices in basis */
- switch(type) {
- case 0: /* plane */
- tot= 4;
- ext= 0;
- fill= 1;
- newob = confirm_objectExists(scene, obedit, &me, mat );
- if(newob) name = "Plane";
- undostr="Add Plane";
- break;
- case 1: /* cube */
- tot= 4;
- ext= 1;
- fill= 1;
- newob = confirm_objectExists(scene, obedit, &me, mat );
- if(newob) name = "Cube";
- undostr="Add Cube";
- break;
- case 4: /* circle */
- add_numbut(0, NUM|INT, "Vertices:", 3, 500, &tot, NULL);
- add_numbut(1, NUM|FLO, "Radius:", 0.001*v3d->grid, 100*v3d->grid, &dia, NULL);
- add_numbut(2, TOG|INT, "Fill", 0, 0, &(fill_circle), NULL);
- if (!(do_clever_numbuts("Add Circle", 3, 0))) return;
- ext= 0;
- fill = fill_circle;
- newob = confirm_objectExists(scene, obedit, &me, mat );
- if(newob) name = "Circle";
- undostr="Add Circle";
- break;
- case 5: /* cylinder */
- d*=2;
- add_numbut(0, NUM|INT, "Vertices:", 2, 500, &tot, NULL);
- add_numbut(1, NUM|FLO, "Radius:", 0.001*v3d->grid, 100*v3d->grid, &dia, NULL);
- add_numbut(2, NUM|FLO, "Depth:", 0.001*v3d->grid, 100*v3d->grid, &d, NULL);
- add_numbut(3, TOG|INT, "Cap Ends", 0, 0, &(fill_cylinder), NULL);
- if (!(do_clever_numbuts("Add Cylinder", 4, 0))) return;
- ext= 1;
- fill = fill_cylinder;
- d/=2;
- newob = confirm_objectExists(scene, obedit, &me, mat );
- if(newob) {
- if (fill) name = "Cylinder";
- else name = "Tube";
- }
- undostr="Add Cylinder";
- break;
- case 7: /* cone */
- d*=2;
- add_numbut(0, NUM|INT, "Vertices:", 2, 500, &tot, NULL);
- add_numbut(1, NUM|FLO, "Radius:", 0.001*v3d->grid, 100*v3d->grid, &dia, NULL);
- add_numbut(2, NUM|FLO, "Depth:", 0.001*v3d->grid, 100*v3d->grid, &d, NULL);
- add_numbut(3, TOG|INT, "Cap End", 0, 0, &(fill_cone), NULL);
- if (!(do_clever_numbuts("Add Cone", 4, 0))) return;
- d/=2;
- ext= 0;
- fill = fill_cone;
- newob = confirm_objectExists(scene, obedit, &me, mat );
- if(newob) name = "Cone";
- undostr="Add Cone";
- break;
- case 10: /* grid */
- add_numbut(0, NUM|INT, "X res:", 3, 1000, &tot, NULL);
- add_numbut(1, NUM|INT, "Y res:", 3, 1000, &seg, NULL);
- if (!(do_clever_numbuts("Add Grid", 2, 0))) return;
- newob = confirm_objectExists(scene, obedit, &me, mat );
- if(newob) name = "Grid";
- undostr="Add Grid";
- break;
- case 11: /* UVsphere */
- add_numbut(0, NUM|INT, "Segments:", 3, 500, &seg, NULL);
- add_numbut(1, NUM|INT, "Rings:", 3, 500, &tot, NULL);
- add_numbut(2, NUM|FLO, "Radius:", 0.001*v3d->grid, 100*v3d->grid, &dia, NULL);
-
- if (!(do_clever_numbuts("Add UV Sphere", 3, 0))) return;
-
- newob = confirm_objectExists(scene, obedit, &me, mat );
- if(newob) name = "Sphere";
- undostr="Add UV Sphere";
- break;
- case 12: /* Icosphere */
- add_numbut(0, NUM|INT, "Subdivision:", 1, 8, &subdiv, NULL);
- add_numbut(1, NUM|FLO, "Radius:", 0.001*v3d->grid, 100*v3d->grid, &dia, NULL);
- if (!(do_clever_numbuts("Add Ico Sphere", 2, 0))) return;
-
- newob = confirm_objectExists(scene, obedit, &me, mat );
- if(newob) name = "Sphere";
- undostr="Add Ico Sphere";
- break;
- case 13: /* Monkey */
- newob = confirm_objectExists(scene, obedit, &me, mat );
- if(newob) name = "Suzanne";
- undostr="Add Monkey";
- break;
- default:
- newob = confirm_objectExists(scene, obedit, &me, mat );
- break;
- }
-
- if( name!=NULL ) {
- rename_id((ID *)obedit, name );
- rename_id((ID *)me, name );
- }
-
- d = -d;
- curs= give_cursor(scene, v3d);
- VECCOPY(cent, curs);
- cent[0]-= obedit->obmat[3][0];
- cent[1]-= obedit->obmat[3][1];
- cent[2]-= obedit->obmat[3][2];
-
- if ( !(newob) || U.flag & USER_ADD_VIEWALIGNED) Mat3CpyMat4(imat, v3d->viewmat);
- else Mat3One(imat);
- Mat3MulVecfl(imat, cent);
- Mat3MulMat3(cmat, imat, mat);
- Mat3Inv(imat,cmat);
-
-
- if(type == 0 || type == 1) /* plane, cube (diameter of 1.41 makes it unit size) */
- dia *= sqrt(2.0);
-
- phid= 2*M_PI/tot;
- phi= .25*M_PI;
-
- make_prim(obedit, type, imat, tot, seg, subdiv, dia, d, ext, fill, cent);
-
- if(type<2) tot = totoud;
-
- /* simple selection flush OK, based on fact it's a single model */
- EM_select_flush(em); // flushes vertex -> edge -> face selection
-
- if(type!=0 && type!=13) righthandfaces(em, 1); /* otherwise monkey has eyes in wrong direction... */
-
-// XXX DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-
- /* if a new object was created, it stores it in Mesh, for reload original data and undo */
- if ( !(newob) || U.flag & USER_ADD_EDITMODE) {
- if(newob) load_editMesh(scene, obedit);
- } else {
- exit_editmode(2);
- }
-
- BIF_undo_push(undostr);
-}
-#endif
/* uses context to figure out transform for primitive */
/* returns standard diameter */
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index 8198db508ab..d79d8003ff0 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -256,12 +256,8 @@ int EM_mask_init_backbuf_border(ViewContext *vc, short mcords[][2], short tot, s
dr = buf->rect;
/* draw the mask */
-#ifdef __APPLE__
- glDrawBuffer(GL_AUX0);
-#endif
glDisable(GL_DEPTH_TEST);
-// XXX persp(PERSP_WIN);
glColor3ub(0, 0, 0);
/* yah, opengl doesn't do concave... tsk! */
@@ -271,11 +267,8 @@ int EM_mask_init_backbuf_border(ViewContext *vc, short mcords[][2], short tot, s
for(a=0; a<tot; a++) glVertex2s(mcords[a][0], mcords[a][1]);
glEnd();
-// XXX persp(PERSP_VIEW);
glFinish(); /* to be sure readpixels sees mask */
- glDrawBuffer(GL_BACK);
-
/* grab mask */
bufmask= view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
drm = bufmask->rect;
@@ -1476,9 +1469,6 @@ void EM_mesh_copy_face(EditMesh *em, short type)
if (change) {
// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- if (type==3) {
-// XXX allqueue(REDRAWIMAGE, 0);
- }
BIF_undo_push("Copy Face Attribute");
}
@@ -2832,31 +2822,31 @@ void select_faces_by_numverts(EditMesh *em, int numverts)
BIF_undo_push("Select non-Triangles/Quads");
}
-void select_sharp_edges(EditMesh *em, float fsharpness)
+static int select_sharp_edges_exec(bContext *C, wmOperator *op)
{
/* Find edges that have exactly two neighboring faces,
- * check the angle between those faces, and if angle is
- * small enough, select the edge
- */
+ * check the angle between those faces, and if angle is
+ * small enough, select the edge
+ */
+ Object *obedit= CTX_data_edit_object(C);
+ EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
EditEdge *eed;
EditFace *efa;
EditFace **efa1;
EditFace **efa2;
- intptr_t edgecount = 0, i;
- static short sharpness = 135;
-
+ intptr_t edgecount = 0, i = 0;
+ float sharpness, fsharpness;
+
+ /* 'standard' behaviour - check if selected, then apply relevant selection */
+
if(em->selectmode==SCE_SELECT_FACE) {
error("Doesn't work in face selection mode");
- return;
+ return OPERATOR_CANCELLED;
}
-// XXX if(button(&sharpness,0, 180,"Max Angle:")==0) return;
- /* if faces are at angle 'sharpness', then the face normals
- * are at angle 180.0 - 'sharpness' (convert to radians too)
- */
+ sharpness= RNA_float_get(op->ptr, "sharpness");
fsharpness = ((180.0 - sharpness) * M_PI) / 180.0;
- i=0;
/* count edges, use tmp.l */
eed= em->edges.first;
while(eed) {
@@ -2929,18 +2919,6 @@ void select_sharp_edges(EditMesh *em, float fsharpness)
// if (EM_texFaceCheck())
BIF_undo_push("Select Sharp Edges");
-}
-
-static int select_sharp_edges_exec(bContext *C, wmOperator *op)
-{
- Object *obedit= CTX_data_edit_object(C);
- EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
-
- /* 'standard' behaviour - check if selected, then apply relevant selection */
-
- // XXX we need a message here - for 1 its recalculate normals inside, for 2 its outside
- righthandfaces(em, RNA_float_get(op->ptr, "sharpness"));
-
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); //TODO is this needed ?
return OPERATOR_FINISHED;
}
@@ -2958,13 +2936,12 @@ void MESH_OT_select_sharp_edges(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
- /* props XXX figure out? */
+ /* props */
RNA_def_float(ot->srna, "sharpness", 0.01f, 0.0f, FLT_MAX, "sharpness", "", 0.0f, 180.0f);
}
-// XXX looks like more work is needed in order for this to work (see in function)
-void select_linked_flat_faces(EditMesh *em, float fsharpness)
+static void select_linked_flat_faces(EditMesh *em, float sharpness)
{
/* Find faces that are linked to selected faces that are
* relatively flat (angle between faces is higher than
@@ -2975,18 +2952,13 @@ void select_linked_flat_faces(EditMesh *em, float fsharpness)
EditFace **efa1;
EditFace **efa2;
intptr_t edgecount = 0, i, faceselcount=0, faceselcountold=0;
- static short sharpness = 135;
+ float fsharpness;
-
if(em->selectmode!=SCE_SELECT_FACE) {
error("Only works in face selection mode");
return;
}
-// XXX if(button(&sharpness,0, 180,"Min Angle:")==0) return;
- /* if faces are at angle 'sharpness', then the face normals
- * are at angle 180.0 - 'sharpness' (convert to radians too)
- */
fsharpness = ((180.0 - sharpness) * M_PI) / 180.0;
i=0;
@@ -3890,6 +3862,7 @@ void Face_Menu(EditMesh *em)
/* **************** NORMALS ************** */
+/* XXX value of select is messed up, it means two things */
void righthandfaces(EditMesh *em, int select) /* makes faces righthand turning */
{
EditEdge *eed, *ed1, *ed2, *ed3, *ed4;
@@ -4108,7 +4081,7 @@ static int righthandfaces_exec(bContext *C, wmOperator *op)
/* 'standard' behaviour - check if selected, then apply relevant selection */
- // XXX we need a message here - for 1 its recalculate normals inside, for 2 its outside
+ // XXX need other args
righthandfaces(em, RNA_int_get(op->ptr, "select"));
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); //TODO is this needed ?
@@ -4128,7 +4101,7 @@ void MESH_OT_righthandfaces(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
- /* props */
+ /* XXX make it enum or so */
RNA_def_int(ot->srna, "select", 0, INT_MIN, INT_MAX, "Select", "", INT_MIN, INT_MAX);
}
@@ -4310,6 +4283,7 @@ void editmesh_align_view_to_selected(Object *obedit, EditMesh *em, View3D *v3d,
void vertexsmooth(Object *obedit, EditMesh *em)
{
+ Scene *scene= NULL; // XXX
EditVert *eve, *eve_mir = NULL;
EditEdge *eed;
float *adror, *adr, fac;
@@ -4394,9 +4368,9 @@ void vertexsmooth(Object *obedit, EditMesh *em)
if(eve->f & SELECT) {
if(eve->f1) {
-// XXX if (scene->toolsettings->editbutflag & B_MESH_X_MIRROR) {
-// eve_mir= editmesh_get_x_mirror_vert(obedit, em, eve->co);
-// }
+ if (scene->toolsettings->editbutflag & B_MESH_X_MIRROR) {
+ eve_mir= editmesh_get_x_mirror_vert(obedit, em, eve->co);
+ }
adr = eve->tmp.p;
fac= 0.5/(float)eve->f1;
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 04a2d34a08d..3a9faec7e93 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -99,7 +99,6 @@ static int extern_qread() {return 0;}
static void waitcursor() {}
static void error() {}
static int pupmenu() {return 0;}
-static int okee() {return 0;}
static int qtest() {return 0;}
#define add_numbut(a, b, c, d, e, f, g) {}
static int do_clever_numbuts() {return 0;}
@@ -724,8 +723,6 @@ void MESH_OT_extrude_mesh(wmOperatorType *ot)
void split_mesh(EditMesh *em)
{
- if(okee(" Split ")==0) return;
-
waitcursor(1);
/* make duplicate first */
@@ -777,6 +774,7 @@ void extrude_repeat_mesh(RegionView3D *rv3d, Object *obedit, EditMesh *em, int s
void spin_mesh(View3D *v3d, Object *obedit, EditMesh *em, int steps, float degr, float *dvec, int mode)
{
+ Scene *scene= NULL; // XXX from context!
RegionView3D *rv3d= NULL; // XXX from context
EditVert *eve,*nextve;
float nor[3]= {0.0, 0.0, 0.0};
@@ -798,7 +796,7 @@ void spin_mesh(View3D *v3d, Object *obedit, EditMesh *em, int steps, float degr,
phi= degr*M_PI/360.0;
phi/= steps;
-// if(scene->toolsettings->editbutflag & B_CLOCKWISE) phi= -phi;
+ if(scene->toolsettings->editbutflag & B_CLOCKWISE) phi= -phi;
if(dvec) {
n[0]= rv3d->viewinv[1][0];
@@ -821,7 +819,7 @@ void spin_mesh(View3D *v3d, Object *obedit, EditMesh *em, int steps, float degr,
Mat3MulMat3(tmat,cmat,bmat);
Mat3MulMat3(bmat,imat,tmat);
-// if(mode==0) if(scene->toolsettings->editbutflag & B_KEEPORIG) adduplicateflag(1);
+ if(mode==0) if(scene->toolsettings->editbutflag & B_KEEPORIG) adduplicateflag(em, 1);
ok= 1;
for(a=0;a<steps;a++) {
@@ -1184,6 +1182,8 @@ void fill_mesh(EditMesh *em)
BLI_end_edgefill();
+ // XXX option beautyfill */
+
waitcursor(0);
EM_select_flush(em);
// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
@@ -6478,7 +6478,7 @@ static int subdivs_invoke(bContext *C, wmOperator *op, wmEvent *event)
p+= sprintf(p, "|%s %%x%d", "fractal", 1);
p+= sprintf(p, "|%s %%x%d", "smooth", 0);
- uiPupmenuOperator(C, 20, op, "index", menu);
+ uiPupMenuOperator(C, 20, op, "index", menu);
MEM_freeN(menu);
return OPERATOR_RUNNING_MODAL;
@@ -6740,7 +6740,7 @@ static int edit_faces_invoke(bContext *C, wmOperator *op, wmEvent *event)
p+= sprintf(p, "|%s %%x%d", "set solid", 0);
- uiPupmenuOperator(C, 20, op, "index", menu);
+ uiPupMenuOperator(C, 20, op, "index", menu);
MEM_freeN(menu);
return OPERATOR_RUNNING_MODAL;
@@ -6794,4 +6794,4 @@ void MESH_OT_edit_faces(wmOperatorType *ot)
/*props */
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, 1000);
-} \ No newline at end of file
+}
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 45b3124a8dc..cf4adc4a59c 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -94,6 +94,8 @@ int editface_containsEdge(struct EditFace *efa, struct EditEdge *eed);
void em_setup_viewcontext(struct bContext *C, struct ViewContext *vc);
+void MESH_OT_separate(struct wmOperatorType *ot);
+
/* ******************* editmesh_add.c */
void MESH_OT_add_primitive_plane(struct wmOperatorType *ot);
void MESH_OT_add_primitive_cube(struct wmOperatorType *ot);
@@ -185,6 +187,7 @@ extern void EM_automerge(int update);
void editmesh_select_by_material(EditMesh *em, int index);
void righthandfaces(EditMesh *em, int select); /* makes faces righthand turning */
void EM_select_more(EditMesh *em);
+void selectconnected_mesh_all(EditMesh *em);
/**
* findnearestvert
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index d2a2be30adf..53c80708e9e 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -74,7 +74,10 @@ static int mesh_add_duplicate_exec(bContext *C, wmOperator *op)
static int mesh_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
+ WM_cursor_wait(1);
mesh_add_duplicate_exec(C, op);
+ WM_cursor_wait(0);
+
RNA_int_set(op->ptr, "mode", TFM_TRANSLATION);
WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
@@ -135,6 +138,7 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_removedoublesflag);
WM_operatortype_append(MESH_OT_extrude_mesh);
WM_operatortype_append(MESH_OT_edit_faces);
+ WM_operatortype_append(MESH_OT_separate);
}
@@ -178,5 +182,8 @@ void ED_keymap_mesh(wmWindowManager *wm)
/* add */
WM_keymap_add_item(keymap, "MESH_OT_add_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_mesh_add", AKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "MESH_OT_separate", PKEY, KM_PRESS, KM_SHIFT, 0);
+
+
}
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index dc94d61b940..9d997b54982 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -284,15 +284,16 @@ void add_object_draw(Scene *scene, View3D *v3d, int type) /* for toolbox or menu
/* keep here to get things compile, remove later */
}
-static int object_add_exec(bContext *C, wmOperator *op)
+/* for object add primitive operators */
+static Object *object_add_type(bContext *C, int type)
{
Scene *scene= CTX_data_scene(C);
Object *ob;
- int type= RNA_int_get(op->ptr, "type");
- /* hrms, this is editor level operator */
+ /* XXX hrms, this is editor level operator, remove? */
ED_view3d_exit_paint_modes(C);
+ /* for as long scene has editmode... */
if (CTX_data_edit_object(C))
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* freedata, and undo */
@@ -306,6 +307,14 @@ static int object_add_exec(bContext *C, wmOperator *op)
DAG_scene_sort(scene);
+ return ob;
+}
+
+/* for object add operator */
+static int object_add_exec(bContext *C, wmOperator *op)
+{
+ object_add_type(C, RNA_int_get(op->ptr, "type"));
+
return OPERATOR_FINISHED;
}
@@ -346,13 +355,14 @@ static int object_add_mesh_exec(bContext *C, wmOperator *op)
Object *obedit= CTX_data_edit_object(C);
int newob= 0;
- if(obedit==NULL) {
- RNA_enum_set(op->ptr, "type", OB_MESH);
- object_add_exec(C, op);
+ if(obedit==NULL || obedit->type!=OB_MESH) {
+ object_add_type(C, OB_MESH);
ED_object_enter_editmode(C, 0);
newob = 1;
}
- switch(RNA_enum_get(op->ptr, "primtype")) {
+ else DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
+
+ switch(RNA_enum_get(op->ptr, "type")) {
case 0:
WM_operator_name_call(C, "MESH_OT_add_primitive_plane", WM_OP_INVOKE_REGION_WIN, NULL);
break;
@@ -386,19 +396,11 @@ static int object_add_mesh_exec(bContext *C, wmOperator *op)
ED_object_exit_editmode(C, EM_FREEDATA);
}
+ WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+
return OPERATOR_FINISHED;
}
-static int object_add_mesh_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
- uiMenuItem *head= uiMenuBegin("Add Mesh");
-
- uiMenuItemsEnumO(head, "OBJECT_OT_mesh_add", "primtype");
- uiMenuEnd(C, head);
-
- /* this operator is only for a menu, not used further */
- return OPERATOR_CANCELLED;
-}
void OBJECT_OT_mesh_add(wmOperatorType *ot)
{
@@ -407,38 +409,48 @@ void OBJECT_OT_mesh_add(wmOperatorType *ot)
ot->idname= "OBJECT_OT_mesh_add";
/* api callbacks */
- ot->invoke= object_add_mesh_invoke;
+ ot->invoke= WM_menu_invoke;
ot->exec= object_add_mesh_exec;
ot->poll= ED_operator_scene_editable;
ot->flag= OPTYPE_REGISTER;
- RNA_def_enum(ot->srna, "type", prop_object_types, 0, "Type", "");
- RNA_def_enum(ot->srna, "primtype", prop_mesh_types, 0, "Primitive", "");
+ RNA_def_enum(ot->srna, "type", prop_mesh_types, 0, "Primitive", "");
}
static EnumPropertyItem prop_curve_types[] = {
- {0, "BEZCUVE", "Bezier Curve", ""},
- {1, "BEZCIRCLE", "Bezier Circle", ""},
- {2, "NURBSCUVE", "Nurbs Curve", ""},
- {3, "NURBSCIRCLE", "Nurbs Circle", ""},
+ {CU_BEZIER|CU_2D|CU_PRIM_CURVE, "BEZCURVE", "Bezier Curve", ""},
+ {CU_BEZIER|CU_2D|CU_PRIM_CIRCLE, "BEZCIRCLE", "Bezier Circle", ""},
+ {CU_NURBS|CU_2D|CU_PRIM_CURVE, "NURBSCUVE", "NURBS Curve", ""},
+ {CU_NURBS|CU_2D|CU_PRIM_CIRCLE, "NURBSCIRCLE", "NURBS Circle", ""},
+ {CU_NURBS|CU_2D|CU_PRIM_PATH, "PATH", "Path", ""},
{0, NULL, NULL, NULL}
};
static int object_add_curve_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
+ ListBase *editnurb;
+ Nurb *nu;
+ int newob= 0;
- if(obedit==NULL) {
- RNA_enum_set(op->ptr, "type", OB_MESH);
- object_add_exec(C, op);
+ if(obedit==NULL || obedit->type!=OB_CURVE) {
+ object_add_type(C, OB_CURVE);
ED_object_enter_editmode(C, 0);
+ newob = 1;
}
- switch(RNA_enum_get(op->ptr, "primtype")) {
-
-
- }
+ else DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
+
+ nu= addNurbprim(C, RNA_enum_get(op->ptr, "type"), newob);
+ editnurb= curve_get_editcurve(CTX_data_edit_object(C));
+ BLI_addtail(editnurb, nu);
+
/* userdef */
+ if (newob && (U.flag & USER_ADD_EDITMODE)==0) {
+ ED_object_exit_editmode(C, EM_FREEDATA);
+ }
+
+ WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
return OPERATOR_FINISHED;
}
@@ -450,21 +462,22 @@ void OBJECT_OT_curve_add(wmOperatorType *ot)
ot->idname= "OBJECT_OT_curve_add";
/* api callbacks */
+ ot->invoke= WM_menu_invoke;
ot->exec= object_add_curve_exec;
ot->poll= ED_operator_scene_editable;
ot->flag= OPTYPE_REGISTER;
- RNA_def_enum(ot->srna, "primtype", prop_curve_types, 0, "Type", "");
+ RNA_def_enum(ot->srna, "type", prop_curve_types, 0, "Primitive", "");
}
static int object_add_primitive_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- uiMenuItem *head= uiMenuBegin("Add Object");
+ uiMenuItem *head= uiPupMenuBegin("Add Object");
- uiMenuLevelEnumO(head, "OBJECT_OT_mesh_add", "primtype");
- uiMenuLevelEnumO(head, "OBJECT_OT_curve_add", "primtype");
+ uiMenuLevelEnumO(head, "OBJECT_OT_mesh_add", "type");
+ uiMenuLevelEnumO(head, "OBJECT_OT_curve_add", "type");
uiMenuItemEnumO(head, "OBJECT_OT_object_add", "type", OB_SURF);
uiMenuItemEnumO(head, "OBJECT_OT_object_add", "type", OB_MBALL);
uiMenuItemEnumO(head, "OBJECT_OT_object_add", "type", OB_CAMERA);
@@ -473,7 +486,7 @@ static int object_add_primitive_invoke(bContext *C, wmOperator *op, wmEvent *eve
uiMenuItemEnumO(head, "OBJECT_OT_object_add", "type", OB_ARMATURE);
uiMenuItemEnumO(head, "OBJECT_OT_object_add", "type", OB_LATTICE);
- uiMenuEnd(C, head);
+ uiPupMenuEnd(C, head);
/* this operator is only for a menu, not used further */
return OPERATOR_CANCELLED;
@@ -597,7 +610,7 @@ static void copy_object_set_idnew(Scene *scene, View3D *v3d, int dupflag)
#endif // XXX old animation system
int a;
- /* check object pointers */
+ /* XXX check object pointers */
for(base= FIRSTBASE; base; base= base->next) {
if(TESTBASELIB(v3d, base)) {
ob= base->object;
@@ -2404,7 +2417,7 @@ static int make_parent_exec(bContext *C, wmOperator *op)
DAG_scene_sort(CTX_data_scene(C));
ED_anim_dag_flush_update(C);
- BIF_undo_push("make Parent");
+ ED_undo_push(C,"make Parent");
return OPERATOR_FINISHED;
}
@@ -2412,31 +2425,26 @@ static int make_parent_exec(bContext *C, wmOperator *op)
static int make_parent_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Object *ob= CTX_data_active_object(C);
- char *str, string[256];
- char formatstr[] = "|%s %%x%d";
+ uiMenuItem *head= uiPupMenuBegin("Make Parent To");
- str= string + sprintf(string, "Make Parent To %%t");
+ uiMenuContext(head, WM_OP_EXEC_DEFAULT);
+ uiMenuItemEnumO(head, "OBJECT_OT_make_parent", "type", PAR_OBJECT);
/* ob becomes parent, make the associated menus */
if(ob->type==OB_ARMATURE) {
- str += sprintf(str, formatstr, "Object", PAR_OBJECT);
- str += sprintf(str, formatstr, "Armature Deform", PAR_ARMATURE);
- str += sprintf(str, formatstr, "Bone", PAR_BONE);
+ uiMenuItemEnumO(head, "OBJECT_OT_make_parent", "type", PAR_ARMATURE);
+ uiMenuItemEnumO(head, "OBJECT_OT_make_parent", "type", PAR_BONE);
}
else if(ob->type==OB_CURVE) {
- str += sprintf(str, formatstr, "Object", PAR_OBJECT);
- str += sprintf(str, formatstr, "Curve Deform", PAR_CURVE);
- str += sprintf(str, formatstr, "Follow Path", PAR_FOLLOW);
- str += sprintf(str, formatstr, "Path Constraint", PAR_PATH_CONST);
+ uiMenuItemEnumO(head, "OBJECT_OT_make_parent", "type", PAR_CURVE);
+ uiMenuItemEnumO(head, "OBJECT_OT_make_parent", "type", PAR_FOLLOW);
+ uiMenuItemEnumO(head, "OBJECT_OT_make_parent", "type", PAR_PATH_CONST);
}
else if(ob->type == OB_LATTICE) {
- str += sprintf(str, formatstr, "Object", PAR_OBJECT);
- str += sprintf(str, formatstr, "Lattice Deform", PAR_LATTICE);
+ uiMenuItemEnumO(head, "OBJECT_OT_make_parent", "type", PAR_LATTICE);
}
- else
- str += sprintf(str, formatstr, "Object", PAR_OBJECT);
- uiPupmenuOperator(C, 0, op, "type", string);
+ uiPupMenuEnd(C, head);
return OPERATOR_RUNNING_MODAL;
}
@@ -5750,95 +5758,85 @@ void make_local_menu(Scene *scene, View3D *v3d)
U.dupflag for default operations or you can construct a flag as python does
if the dupflag is 0 then no data will be copied (linked duplicate) */
-static int add_duplicate_exec(bContext *C, wmOperator *op)
+/* used below, assumes id.new is correct */
+/* leaves selection of base/object unaltered */
+static Base *object_add_duplicate_internal(Scene *scene, Base *base, int dupflag)
{
- Scene *scene= CTX_data_scene(C);
- View3D *v3d= CTX_wm_view3d(C);
- Base *basen;
+ Base *basen= NULL;
Material ***matarar;
Object *ob, *obn;
ID *id;
- int dupflag= U.dupflag;
int a, didit;
-
- clear_id_newpoins();
- clear_sca_new_poins(); /* sensor/contr/act */
-
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+
+ ob= base->object;
+ if(ob->flag & OB_POSEMODE) {
+ ; /* nothing? */
+ }
+ else {
+ obn= copy_object(ob);
+ obn->recalc |= OB_RECALC;
- ob= base->object;
- if(ob->flag & OB_POSEMODE) {
- ; /* nothing? */
+ basen= MEM_mallocN(sizeof(Base), "duplibase");
+ *basen= *base;
+ BLI_addhead(&scene->base, basen); /* addhead: prevent eternal loop */
+ basen->object= obn;
+
+ if(basen->flag & OB_FROMGROUP) {
+ Group *group;
+ for(group= G.main->group.first; group; group= group->id.next) {
+ if(object_in_group(ob, group))
+ add_to_group(group, obn);
+ }
+ obn->flag |= OB_FROMGROUP; /* this flag is unset with copy_object() */
}
- else {
- obn= copy_object(ob);
- obn->recalc |= OB_RECALC;
-
- basen= MEM_mallocN(sizeof(Base), "duplibase");
- *basen= *base;
- BLI_addhead(&scene->base, basen); /* addhead: prevent eternal loop */
- basen->object= obn;
- base->flag &= ~SELECT;
+
+ /* duplicates using userflags */
+#if 0 // XXX old animation system
+ if(dupflag & USER_DUP_IPO) {
+ bConstraintChannel *chan;
+ id= (ID *)obn->ipo;
- if(basen->flag & OB_FROMGROUP) {
- Group *group;
- for(group= G.main->group.first; group; group= group->id.next) {
- if(object_in_group(ob, group))
- add_to_group(group, obn);
- }
- obn->flag |= OB_FROMGROUP; /* this flag is unset with copy_object() */
+ if(id) {
+ ID_NEW_US( obn->ipo)
+ else obn->ipo= copy_ipo(obn->ipo);
+ id->us--;
}
-
- if(BASACT==base)
- ED_base_object_activate(C, basen);
-
- /* duplicates using userflags */
-#if 0 // XXX old animation system
- if(dupflag & USER_DUP_IPO) {
- bConstraintChannel *chan;
- id= (ID *)obn->ipo;
-
+ /* Handle constraint ipos */
+ for (chan=obn->constraintChannels.first; chan; chan=chan->next){
+ id= (ID *)chan->ipo;
if(id) {
- ID_NEW_US( obn->ipo)
- else obn->ipo= copy_ipo(obn->ipo);
+ ID_NEW_US( chan->ipo)
+ else chan->ipo= copy_ipo(chan->ipo);
id->us--;
}
- /* Handle constraint ipos */
- for (chan=obn->constraintChannels.first; chan; chan=chan->next){
- id= (ID *)chan->ipo;
- if(id) {
- ID_NEW_US( chan->ipo)
- else chan->ipo= copy_ipo(chan->ipo);
- id->us--;
- }
- }
}
- 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--;
+ }
+ 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_MAT) {
- for(a=0; a<obn->totcol; a++) {
- id= (ID *)obn->mat[a];
- if(id) {
- ID_NEW_US(obn->mat[a])
- else obn->mat[a]= copy_material(obn->mat[a]);
- id->us--;
- }
+ if(dupflag & USER_DUP_MAT) {
+ for(a=0; a<obn->totcol; a++) {
+ id= (ID *)obn->mat[a];
+ if(id) {
+ ID_NEW_US(obn->mat[a])
+ else obn->mat[a]= copy_material(obn->mat[a]);
+ id->us--;
}
}
-
- id= obn->data;
- didit= 0;
-
- switch(obn->type) {
+ }
+
+ id= obn->data;
+ didit= 0;
+
+ switch(obn->type) {
case OB_MESH:
if(dupflag & USER_DUP_MESH) {
ID_NEW_US2( obn->data )
@@ -5846,7 +5844,7 @@ static int add_duplicate_exec(bContext *C, wmOperator *op)
obn->data= copy_mesh(obn->data);
if(obn->fluidsimSettings) {
- obn->fluidsimSettings->orgMesh = (Mesh *)obn->data;
+ obn->fluidsimSettings->orgMesh = (Mesh *)obn->data;
}
didit= 1;
@@ -5901,22 +5899,22 @@ static int add_duplicate_exec(bContext *C, wmOperator *op)
id->us--;
}
break;
-
+
case OB_ARMATURE:
obn->recalc |= OB_RECALC_DATA;
if(obn->pose) obn->pose->flag |= POSE_RECALC;
-
- if(dupflag & USER_DUP_ARM) {
- ID_NEW_US2(obn->data )
- else {
- obn->data= copy_armature(obn->data);
- armature_rebuild_pose(obn, obn->data);
- didit= 1;
+
+ if(dupflag & USER_DUP_ARM) {
+ ID_NEW_US2(obn->data )
+ else {
+ obn->data= copy_armature(obn->data);
+ armature_rebuild_pose(obn, obn->data);
+ didit= 1;
+ }
+ id->us--;
}
- id->us--;
- }
-
- break;
+
+ break;
case OB_LATTICE:
if(dupflag!=0) {
@@ -5932,26 +5930,66 @@ static int add_duplicate_exec(bContext *C, wmOperator *op)
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--;
- }
+ }
+
+ 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--;
}
}
}
}
}
+ return basen;
+}
+
+/* single object duplicate, if dupflag==0, fully linked, else it uses U.dupflag */
+/* leaves selection of base/object unaltered */
+Base *ED_object_add_duplicate(Scene *scene, Base *base, int usedupflag)
+{
+ Base *basen;
+ int dupflag= usedupflag?U.dupflag:0;
+
+ clear_id_newpoins();
+ clear_sca_new_poins(); /* sensor/contr/act */
+
+ basen= object_add_duplicate_internal(scene, base, dupflag);
+
+ DAG_scene_sort(scene);
+
+ return basen;
+}
+
+/* contextual operator dupli */
+static int add_duplicate_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ View3D *v3d= CTX_wm_view3d(C);
+ int dupflag= U.dupflag;
+
+ clear_id_newpoins();
+ clear_sca_new_poins(); /* sensor/contr/act */
+
+ CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ Base *basen= object_add_duplicate_internal(scene, base, dupflag);
+
+ /* XXX context conflict maybe, itterator could solve this? */
+ ED_base_object_select(base, BA_DESELECT);
+ /* new object becomes active */
+ if(BASACT==base)
+ ED_base_object_activate(C, basen);
+
+ }
CTX_DATA_END;
+ /* XXX fix this for context */
copy_object_set_idnew(scene, v3d, dupflag);
DAG_scene_sort(scene);
diff --git a/source/blender/editors/preview/previewrender.c b/source/blender/editors/preview/previewrender.c
index 7fbac0a77c2..407674163a6 100644
--- a/source/blender/editors/preview/previewrender.c
+++ b/source/blender/editors/preview/previewrender.c
@@ -1060,13 +1060,6 @@ static void shader_preview_free(void *customdata)
MEM_freeN(sp);
}
-static void shader_preview_update(void *customdata)
-{
-// ShaderPreview *sp= customdata;
-
-}
-
-
void ED_preview_shader_job(const bContext *C, void *owner, ID *id, int sizex, int sizey)
{
wmJob *steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner);
@@ -1082,8 +1075,8 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, int sizex, in
/* setup job */
WM_jobs_customdata(steve, sp, shader_preview_free);
- WM_jobs_timer(steve, 0.1, NC_MATERIAL);
- WM_jobs_callbacks(steve, shader_preview_startjob, shader_preview_update);
+ WM_jobs_timer(steve, 0.1, NC_MATERIAL, NC_MATERIAL);
+ WM_jobs_callbacks(steve, shader_preview_startjob, NULL, NULL);
WM_jobs_start(steve);
}
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index d104efef73d..95fd8bfa102 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -764,8 +764,8 @@ static char *windowtype_pup(void)
"|%l" // 33
- "|Ipo Curve Editor %x2" //54
- "|Action Editor %x12" //73
+ "|Graph Editor %x2" //54
+ "|DopeSheet Editor %x12" //73
"|NLA Editor %x13" //94
"|%l" //97
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 0dff9c1b92f..2cf440ad62e 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1359,7 +1359,7 @@ static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *event)
for (i=items-1, lastop= wm->operators.last; lastop; lastop= lastop->prev, i--)
p+= sprintf(p, "|%s %%x%d", lastop->type->name, i);
- uiPupmenuOperator(C, i/20, op, "index", menu);
+ uiPupMenuOperator(C, i/20, op, "index", menu);
MEM_freeN(menu);
return OPERATOR_RUNNING_MODAL;
@@ -1559,7 +1559,7 @@ static void testfunc(bContext *C, void *argv, int arg)
printf("arg %d\n", arg);
}
-static void newlevel1(uiMenuItem *head)
+static void newlevel1(bContext *C, uiMenuItem *head, void *arg)
{
uiMenuFunc(head, testfunc, NULL);
@@ -1571,7 +1571,7 @@ static void newlevel1(uiMenuItem *head)
static int testing123(bContext *C, wmOperator *op, wmEvent *event)
{
- uiMenuItem *head= uiMenuBegin("Hello world");
+ uiMenuItem *head= uiPupMenuBegin("Hello world");
uiMenuContext(head, WM_OP_EXEC_DEFAULT);
uiMenuItemO(head, "SCREEN_OT_region_flip", ICON_PROP_ON);
@@ -1580,7 +1580,7 @@ static int testing123(bContext *C, wmOperator *op, wmEvent *event)
uiMenuLevel(head, "Submenu", newlevel1);
uiMenuItemO(head, "SCREEN_OT_area_rip", ICON_PROP_ON);
- uiMenuEnd(C, head);
+ uiPupMenuEnd(C, head);
/* this operator is only for a menu, not used further */
return OPERATOR_CANCELLED;
@@ -1760,6 +1760,10 @@ void ED_keymap_screen(wmWindowManager *wm)
WM_keymap_verify_item(keymap, "SCREEN_OT_repeat_last", F4KEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SCREEN_OT_region_flip", F5KEY, KM_PRESS, 0, 0);
+ /* files */
+ WM_keymap_add_item(keymap, "ED_FILE_OT_load", RETKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "ED_FILE_OT_cancel", ESCKEY, KM_PRESS, 0, 0);
+
/* undo */
WM_keymap_add_item(keymap, "ED_OT_undo", ZKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "ED_OT_undo", ZKEY, KM_PRESS, KM_OSKEY, 0);
diff --git a/source/blender/editors/sculpt/sculpt.c b/source/blender/editors/sculpt/sculpt.c
index d617fde065a..743ecb03ed3 100644
--- a/source/blender/editors/sculpt/sculpt.c
+++ b/source/blender/editors/sculpt/sculpt.c
@@ -145,13 +145,6 @@ typedef struct StrokeCache {
ViewContext vc;
bglMats *mats;
- /* Mesh data (not copied) can come either directly from a Mesh, or from a MultiresDM */
- int multires; /* Special handling for multires meshes */
- MVert *mvert;
- MFace *mface;
- int totvert, totface;
- float *face_normals;
-
float *layer_disps; /* Displacements for each vertex */
float (*mesh_store)[3]; /* Copy of the mesh vertices' locations */
short (*orig_norms)[3]; /* Copy of the mesh vertices' normals */
@@ -331,7 +324,7 @@ static void calc_area_normal(Sculpt *sd, float out[3], const ListBase* active_ve
}
else {
for(; node; node = node->next)
- add_norm_if(out_dir, out, out_flip, cache->mvert[node->Index].no);
+ add_norm_if(out_dir, out, out_flip, sd->session->mvert[node->Index].no);
}
if (out[0]==0.0 && out[1]==0.0 && out[2]==0.0) {
@@ -359,7 +352,7 @@ static void do_draw_brush(Sculpt *sd, SculptSession *ss, const ListBase* active_
sculpt_axislock(sd, area_normal);
while(node){
- float *co= ss->cache->mvert[node->Index].co;
+ float *co= ss->mvert[node->Index].co;
const float val[3]= {co[0]+area_normal[0]*node->Fade*ss->cache->scale[0],
co[1]+area_normal[1]*node->Fade*ss->cache->scale[1],
@@ -385,12 +378,12 @@ static void neighbor_average(SculptSession *ss, float avg[3], const int vert)
/* Don't modify corner vertices */
if(ncount==1) {
- VecCopyf(avg, ss->cache->mvert[vert].co);
+ VecCopyf(avg, ss->mvert[vert].co);
return;
}
while(node){
- f= &ss->cache->mface[node->index];
+ f= &ss->mface[node->index];
if(f->v4) {
skip= (f->v1==vert?2:
@@ -401,7 +394,7 @@ static void neighbor_average(SculptSession *ss, float avg[3], const int vert)
for(i=0; i<(f->v4?4:3); ++i) {
if(i != skip && (ncount!=2 || BLI_countlist(&ss->fmap[(&f->v1)[i]]) <= 2)) {
- VecAddf(avg, avg, ss->cache->mvert[(&f->v1)[i]].co);
+ VecAddf(avg, avg, ss->mvert[(&f->v1)[i]].co);
++total;
}
}
@@ -412,7 +405,7 @@ static void neighbor_average(SculptSession *ss, float avg[3], const int vert)
if(total>0)
VecMulf(avg, 1.0f / total);
else
- VecCopyf(avg, ss->cache->mvert[vert].co);
+ VecCopyf(avg, ss->mvert[vert].co);
}
static void do_smooth_brush(SculptSession *ss, const ListBase* active_verts)
@@ -420,7 +413,7 @@ static void do_smooth_brush(SculptSession *ss, const ListBase* active_verts)
ActiveData *node= active_verts->first;
while(node){
- float *co= ss->cache->mvert[node->Index].co;
+ float *co= ss->mvert[node->Index].co;
float avg[3], val[3];
neighbor_average(ss, avg, node->Index);
@@ -438,7 +431,7 @@ static void do_pinch_brush(SculptSession *ss, const ListBase* active_verts)
ActiveData *node= active_verts->first;
while(node) {
- float *co= ss->cache->mvert[node->Index].co;
+ float *co= ss->mvert[node->Index].co;
const float val[3]= {co[0]+(ss->cache->location[0]-co[0])*node->Fade,
co[1]+(ss->cache->location[1]-co[1])*node->Fade,
co[2]+(ss->cache->location[2]-co[2])*node->Fade};
@@ -457,7 +450,7 @@ static void do_grab_brush(Sculpt *sd, SculptSession *ss)
sculpt_axislock(sd, grab_delta);
while(node) {
- float *co= ss->cache->mvert[node->Index].co;
+ float *co= ss->mvert[node->Index].co;
VecCopyf(add, grab_delta);
VecMulf(add, node->Fade);
@@ -482,7 +475,7 @@ static void do_layer_brush(Sculpt *sd, SculptSession *ss, const ListBase *active
if((bstr > 0 && *disp < bstr) ||
(bstr < 0 && *disp > bstr)) {
- float *co= ss->cache->mvert[node->Index].co;
+ float *co= ss->mvert[node->Index].co;
*disp+= node->Fade;
@@ -512,8 +505,8 @@ static void do_inflate_brush(SculptSession *ss, const ListBase *active_verts)
float add[3];
while(node) {
- float *co= ss->cache->mvert[node->Index].co;
- short *no= ss->cache->mvert[node->Index].no;
+ float *co= ss->mvert[node->Index].co;
+ short *no= ss->mvert[node->Index].no;
add[0]= no[0]/ 32767.0f;
add[1]= no[1]/ 32767.0f;
@@ -549,7 +542,7 @@ static void calc_flatten_center(SculptSession *ss, ActiveData *node, float co[3]
co[0] = co[1] = co[2] = 0.0f;
for(i = 0; i < FLATTEN_SAMPLE_SIZE; ++i)
- VecAddf(co, co, ss->cache->mvert[outer[i]->Index].co);
+ VecAddf(co, co, ss->mvert[outer[i]->Index].co);
VecMulf(co, 1.0f / FLATTEN_SAMPLE_SIZE);
}
@@ -564,7 +557,7 @@ static void do_flatten_brush(Sculpt *sd, SculptSession *ss, const ListBase *acti
calc_flatten_center(ss, node, cntr);
while(node){
- float *co= ss->cache->mvert[node->Index].co;
+ float *co= ss->mvert[node->Index].co;
float p1[3], sub1[3], sub2[3], intr[3], val[3];
/* Find the intersection between squash-plane and vertex (along the area normal) */
@@ -743,7 +736,7 @@ static void sculpt_add_damaged_rect(SculptSession *ss)
BLI_addtail(&ss->damaged_rects, rn);
/* Update insides */
- for(i=0; i<ss->cache->totvert; ++i) {
+ for(i=0; i<ss->totvert; ++i) {
if(!ss->projverts[i].inside) {
if(ss->projverts[i].co[0] > rn->r.xmin && ss->projverts[i].co[1] > rn->r.ymin &&
ss->projverts[i].co[0] < rn->r.xmax && ss->projverts[i].co[1] < rn->r.ymax) {
@@ -757,6 +750,7 @@ static void sculpt_add_damaged_rect(SculptSession *ss)
}
/* Clears the depth buffer in each modified area. */
+#if 0
static void sculpt_clear_damaged_areas(SculptSession *ss)
{
RectNode *rn= NULL;
@@ -785,7 +779,7 @@ static void sculpt_clear_damaged_areas(SculptSession *ss)
glClear(GL_DEPTH_BUFFER_BIT);
}
}
-
+#endif
static void do_brush_action(Sculpt *sd, StrokeCache *cache)
{
SculptSession *ss = sd->session;
@@ -805,11 +799,11 @@ static void do_brush_action(Sculpt *sd, StrokeCache *cache)
/* Build a list of all vertices that are potentially within the brush's
area of influence. Only do this once for the grab brush. */
if((b->sculpt_tool != SCULPT_TOOL_GRAB) || cache->first_time) {
- for(i=0; i<cache->totvert; ++i) {
+ for(i=0; i<ss->totvert; ++i) {
/* Projverts.inside provides a rough bounding box */
- if(cache->multires || ss->projverts[i].inside) {
+ if(ss->multires || ss->projverts[i].inside) {
//vert= ss->vertexcosnos ? &ss->vertexcosnos[i*6] : a->verts[i].co;
- vert= cache->mvert[i].co;
+ vert= ss->mvert[i].co;
av_dist= VecLenf(ss->cache->location, vert);
if(av_dist < cache->radius) {
adata= (ActiveData*)MEM_mallocN(sizeof(ActiveData), "ActiveData");
@@ -857,7 +851,7 @@ static void do_brush_action(Sculpt *sd, StrokeCache *cache)
}
/* Copy the modified vertices from mesh to the active key */
- if(keyblock && !cache->multires) {
+ if(keyblock && !ss->multires) {
float *co= keyblock->data;
if(co) {
if(b->sculpt_tool == SCULPT_TOOL_GRAB)
@@ -871,7 +865,7 @@ static void do_brush_action(Sculpt *sd, StrokeCache *cache)
}
}
- if(ss->vertexcosnos && !cache->multires)
+ if(ss->vertexcosnos && !ss->multires)
BLI_freelistN(&active_verts);
else {
if(b->sculpt_tool != SCULPT_TOOL_GRAB)
@@ -952,16 +946,16 @@ static void update_damaged_vert(SculptSession *ss, ListBase *lb)
while(face){
float *fn = NULL;
- if(ss->cache->face_normals)
- fn = &ss->cache->face_normals[face->index*3];
- add_face_normal(&norm, ss->cache->mvert, &ss->cache->mface[face->index], fn);
+ if(ss->face_normals)
+ fn = &ss->face_normals[face->index*3];
+ add_face_normal(&norm, ss->mvert, &ss->mface[face->index], fn);
face= face->next;
}
Normalize(&norm.x);
- ss->cache->mvert[vert->Index].no[0]=norm.x*32767;
- ss->cache->mvert[vert->Index].no[1]=norm.y*32767;
- ss->cache->mvert[vert->Index].no[2]=norm.z*32767;
+ ss->mvert[vert->Index].no[0]=norm.x*32767;
+ ss->mvert[vert->Index].no[1]=norm.y*32767;
+ ss->mvert[vert->Index].no[2]=norm.z*32767;
}
}
@@ -971,18 +965,19 @@ static void calc_damaged_verts(SculptSession *ss)
for(i=0; i<8; ++i)
update_damaged_vert(ss, &ss->cache->grab_active_verts[i]);
-
update_damaged_vert(ss, &ss->damaged_verts);
BLI_freelistN(&ss->damaged_verts);
ss->damaged_verts.first = ss->damaged_verts.last = NULL;
}
+#if 0
static void projverts_clear_inside(SculptSession *ss)
{
int i;
- for(i = 0; i < ss->cache->totvert; ++i)
+ for(i = 0; i < ss->totvert; ++i)
ss->projverts[i].inside = 0;
}
+#endif
static void sculpt_update_tex(Sculpt *sd)
{
@@ -1027,10 +1022,10 @@ static void sculptmode_update_all_projverts(SculptSession *ss)
unsigned i;
if(!ss->projverts)
- ss->projverts = MEM_mallocN(sizeof(ProjVert)*ss->cache->totvert,"ProjVerts");
+ ss->projverts = MEM_mallocN(sizeof(ProjVert)*ss->totvert,"ProjVerts");
- for(i=0; i<ss->cache->totvert; ++i) {
- project(ss->cache->mats, ss->vertexcosnos ? &ss->vertexcosnos[i * 6] : ss->cache->mvert[i].co,
+ for(i=0; i<ss->totvert; ++i) {
+ project(ss->cache->mats, ss->vertexcosnos ? &ss->vertexcosnos[i * 6] : ss->mvert[i].co,
ss->projverts[i].co);
ss->projverts[i].inside= 0;
}
@@ -1066,32 +1061,31 @@ static struct MultiresModifierData *sculpt_multires_active(Object *ob)
return NULL;
}
-static void sculpt_update_mesh_elements(SculptSession *ss, Object *ob)
+static void sculpt_update_mesh_elements(bContext *C)
{
- StrokeCache *cache = ss->cache;
+ SculptSession *ss = CTX_data_tool_settings(C)->sculpt->session;
+ Object *ob = CTX_data_active_object(C);
- if(sculpt_multires_active(ob)) {
- DerivedMesh *dm = mesh_get_derived_final(NULL, ob, CD_MASK_BAREMESH); /* XXX scene=? */
- cache->multires = 1;
- cache->totvert = dm->getNumVerts(dm);
- cache->totface = dm->getNumFaces(dm);
- cache->mvert = dm->getVertDataArray(dm, CD_MVERT);
- cache->mface = dm->getFaceDataArray(dm, CD_MFACE);
- cache->face_normals = dm->getFaceDataArray(dm, CD_NORMAL);
+ if((ss->multires = sculpt_multires_active(ob))) {
+ DerivedMesh *dm = mesh_get_derived_final(CTX_data_scene(C), ob, CD_MASK_BAREMESH);
+ ss->totvert = dm->getNumVerts(dm);
+ ss->totface = dm->getNumFaces(dm);
+ ss->mvert = dm->getVertDataArray(dm, CD_MVERT);
+ ss->mface = dm->getFaceDataArray(dm, CD_MFACE);
+ ss->face_normals = dm->getFaceDataArray(dm, CD_NORMAL);
}
else {
Mesh *me = get_mesh(ob);
- cache->multires = 0;
- cache->totvert = me->totvert;
- cache->totface = me->totface;
- cache->mvert = me->mvert;
- cache->mface = me->mface;
- cache->face_normals = NULL;
+ ss->totvert = me->totvert;
+ ss->totface = me->totface;
+ ss->mvert = me->mvert;
+ ss->mface = me->mface;
+ ss->face_normals = NULL;
}
- if(cache->totvert != ss->fmap_size) {
- create_vert_face_map(&ss->fmap, &ss->fmap_mem, cache->mface, cache->totvert, cache->totface);
- ss->fmap_size = cache->totvert;
+ if(ss->totvert != ss->fmap_size) {
+ create_vert_face_map(&ss->fmap, &ss->fmap_mem, ss->mface, ss->totvert, ss->totface);
+ ss->fmap_size = ss->totvert;
}
}
@@ -1343,21 +1337,21 @@ static void sculpt_update_cache_invariants(Sculpt *sd, bContext *C, wmOperator *
cache->mats = MEM_callocN(sizeof(bglMats), "sculpt bglMats");
sculpt_load_mats(cache->mats, &cache->vc);
- sculpt_update_mesh_elements(sd->session, cache->vc.obact);
+ sculpt_update_mesh_elements(C);
/* Make copies of the mesh vertex locations and normals for some tools */
if(sd->brush->sculpt_tool == SCULPT_TOOL_LAYER || (sd->brush->flag & BRUSH_ANCHORED)) {
- cache->layer_disps = MEM_callocN(sizeof(float) * cache->totvert, "layer brush displacements");
- cache->mesh_store= MEM_mallocN(sizeof(float) * 3 * cache->totvert, "sculpt mesh vertices copy");
- for(i = 0; i < cache->totvert; ++i)
- VecCopyf(cache->mesh_store[i], cache->mvert[i].co);
+ cache->layer_disps = MEM_callocN(sizeof(float) * sd->session->totvert, "layer brush displacements");
+ cache->mesh_store= MEM_mallocN(sizeof(float) * 3 * sd->session->totvert, "sculpt mesh vertices copy");
+ for(i = 0; i < sd->session->totvert; ++i)
+ VecCopyf(cache->mesh_store[i], sd->session->mvert[i].co);
if(sd->brush->flag & BRUSH_ANCHORED) {
- cache->orig_norms= MEM_mallocN(sizeof(short) * 3 * cache->totvert, "Sculpt orig norm");
- for(i = 0; i < cache->totvert; ++i) {
- cache->orig_norms[i][0] = cache->mvert[i].no[0];
- cache->orig_norms[i][1] = cache->mvert[i].no[1];
- cache->orig_norms[i][2] = cache->mvert[i].no[2];
+ cache->orig_norms= MEM_mallocN(sizeof(short) * 3 * sd->session->totvert, "Sculpt orig norm");
+ for(i = 0; i < sd->session->totvert; ++i) {
+ cache->orig_norms[i][0] = sd->session->mvert[i].no[0];
+ cache->orig_norms[i][1] = sd->session->mvert[i].no[1];
+ cache->orig_norms[i][2] = sd->session->mvert[i].no[2];
}
}
}
@@ -1490,22 +1484,40 @@ static void sculpt_restore_mesh(Sculpt *sd)
/* Restore the mesh before continuing with anchored stroke */
if((sd->brush->flag & BRUSH_ANCHORED) && cache->mesh_store) {
- for(i = 0; i < cache->totvert; ++i) {
- VecCopyf(cache->mvert[i].co, cache->mesh_store[i]);
- cache->mvert[i].no[0] = cache->orig_norms[i][0];
- cache->mvert[i].no[1] = cache->orig_norms[i][1];
- cache->mvert[i].no[2] = cache->orig_norms[i][2];
+ for(i = 0; i < sd->session->totvert; ++i) {
+ VecCopyf(sd->session->mvert[i].co, cache->mesh_store[i]);
+ sd->session->mvert[i].no[0] = cache->orig_norms[i][0];
+ sd->session->mvert[i].no[1] = cache->orig_norms[i][1];
+ sd->session->mvert[i].no[2] = cache->orig_norms[i][2];
}
}
}
static void sculpt_post_stroke_free(SculptSession *ss)
{
- //calc_damaged_verts(sd->session, &a);
BLI_freelistN(&ss->damaged_rects);
BLI_freelistN(&ss->damaged_verts);
}
+static void sculpt_flush_update(bContext *C)
+{
+ Sculpt *s = CTX_data_tool_settings(C)->sculpt;
+ ARegion *ar = CTX_wm_region(C);
+ MultiresModifierData *mmd = s->session->multires;
+
+ calc_damaged_verts(s->session);
+
+ if(mmd) {
+ if(mmd->undo_verts && mmd->undo_verts != s->session->mvert)
+ MEM_freeN(mmd->undo_verts);
+
+ mmd->undo_verts = s->session->mvert;
+ mmd->undo_verts_tot = s->session->totvert;
+ }
+
+ ED_region_tag_redraw(ar);
+}
+
static int sculpt_brush_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
{
PointerRNA itemptr;
@@ -1515,6 +1527,8 @@ static int sculpt_brush_stroke_modal(bContext *C, wmOperator *op, wmEvent *event
float center[3];
int mouse[2] = {event->x, event->y};
+ sculpt_update_mesh_elements(C);
+
unproject(sd->session->cache->mats, center, event->x, event->y,
read_cached_depth(&sd->session->cache->vc, event->x, event->y));
@@ -1528,11 +1542,9 @@ static int sculpt_brush_stroke_modal(bContext *C, wmOperator *op, wmEvent *event
sculpt_restore_mesh(sd);
do_symmetrical_brush_actions(CTX_data_tool_settings(C)->sculpt, sd->session->cache);
+ sculpt_flush_update(C);
sculpt_post_stroke_free(sd->session);
- DAG_object_flush_update(CTX_data_scene(C), ob, OB_RECALC_DATA);
- ED_region_tag_redraw(ar);
-
/* Finished */
if(event->type == LEFTMOUSE && event->val == 0) {
request_depth_update(&sd->session->cache->vc);
@@ -1549,8 +1561,6 @@ static int sculpt_brush_stroke_modal(bContext *C, wmOperator *op, wmEvent *event
static int sculpt_brush_stroke_exec(bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
- ARegion *ar = CTX_wm_region(C);
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
view3d_operator_needs_opengl(C);
@@ -1570,8 +1580,7 @@ static int sculpt_brush_stroke_exec(bContext *C, wmOperator *op)
sculpt_cache_free(sd->session->cache);
- DAG_object_flush_update(CTX_data_scene(C), ob, OB_RECALC_DATA);
- ED_region_tag_redraw(ar);
+ sculpt_flush_update(C);
sculpt_undo_push(C, sd);
@@ -1655,11 +1664,14 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *op)
ts->sculpt->brush = add_brush("test brush");
/* Also for testing, set the brush texture to the first available one */
if(G.main->tex.first) {
- mtex = MEM_callocN(sizeof(MTex), "test mtex");
- ts->sculpt->brush->texact = 0;
- ts->sculpt->brush->mtex[0] = mtex;
- mtex->tex = G.main->tex.first;
- mtex->size[0] = mtex->size[1] = mtex->size[2] = 50;
+ Tex *tex = G.main->tex.first;
+ if(tex->type) {
+ mtex = MEM_callocN(sizeof(MTex), "test mtex");
+ ts->sculpt->brush->texact = 0;
+ ts->sculpt->brush->mtex[0] = mtex;
+ mtex->tex = tex;
+ mtex->size[0] = mtex->size[1] = mtex->size[2] = 50;
+ }
}
ED_undo_push(C, "Enter sculpt");
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index d618d2869c8..3cf593d35a9 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -627,6 +627,7 @@ void ACT_OT_keyframes_delete (wmOperatorType *ot)
ot->idname= "ACT_OT_keyframes_delete";
/* api callbacks */
+ ot->invoke= WM_operator_confirm;
ot->exec= actkeys_delete_exec;
ot->poll= ED_operator_areaactive;
@@ -825,8 +826,6 @@ void ACT_OT_keyframes_sample (wmOperatorType *ot)
/* ******************** Set Extrapolation-Type Operator *********************** */
-// XXX rename this operator...
-
/* defines for set extrapolation-type for selected keyframes tool */
EnumPropertyItem prop_actkeys_expo_types[] = {
{FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", "Constant Extrapolation", ""},
@@ -883,11 +882,11 @@ static int actkeys_expo_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACT_OT_keyframes_expotype (wmOperatorType *ot)
+void ACT_OT_keyframes_extrapolation_type (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Set Keyframe Extrapolation";
- ot->idname= "ACT_OT_keyframes_expotype";
+ ot->idname= "ACT_OT_keyframes_extrapolation_type";
/* api callbacks */
ot->invoke= WM_menu_invoke;
@@ -961,11 +960,11 @@ static int actkeys_ipo_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACT_OT_keyframes_ipotype (wmOperatorType *ot)
+void ACT_OT_keyframes_interpolation_type (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Set Keyframe Interpolation";
- ot->idname= "ACT_OT_keyframes_ipotype";
+ ot->idname= "ACT_OT_keyframes_interpolation_type";
/* api callbacks */
ot->invoke= WM_menu_invoke;
diff --git a/source/blender/editors/space_action/action_header.c b/source/blender/editors/space_action/action_header.c
index 2e8b34742b0..dedca434ce8 100644
--- a/source/blender/editors/space_action/action_header.c
+++ b/source/blender/editors/space_action/action_header.c
@@ -247,12 +247,12 @@ static void do_keymenu_transformmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_keymenu_transformmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_keymenu_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_keymenu_transformmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_keymenu_transformmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_keymenu_transformmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -293,14 +293,14 @@ static void do_keymenu_snapmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_keymenu_snapmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_keymenu_snapmenu(bContext *C, ARegion *ar, void *arg_unused)
{
SpaceAction *saction= (SpaceAction*)CTX_wm_space_data(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_keymenu_snapmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_keymenu_snapmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_keymenu_snapmenu, NULL);
if (saction->flag & SACTION_DRAWTIME) {
@@ -357,12 +357,12 @@ static void do_keymenu_mirrormenu(bContext *C, void *arg, int event)
}
-static uiBlock *action_keymenu_mirrormenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_keymenu_mirrormenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_keymenu_mirrormenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_keymenu_mirrormenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_keymenu_mirrormenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -411,12 +411,12 @@ static void do_keymenu_handlemenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_keymenu_handlemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_keymenu_handlemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_keymenu_handlemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_keymenu_handlemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_keymenu_handlemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -463,12 +463,12 @@ static void do_keymenu_extendmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_keymenu_extendmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_keymenu_extendmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_keymenu_extendmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_keymenu_extendmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_keymenu_extendmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -512,12 +512,12 @@ static void do_keymenu_intpolmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_keymenu_intpolmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_keymenu_intpolmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_keymenu_intpolmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_keymenu_intpolmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_keymenu_intpolmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -572,13 +572,13 @@ static void do_action_keymenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_keymenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_keymenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_keymenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_keymenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_action_keymenu, NULL);
@@ -661,13 +661,13 @@ static uiBlock *action_keymenu(bContext *C, uiMenuBlockHandle *handle, void *arg
// framemenu uses functions from keymenu
-static uiBlock *action_framemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_framemenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_framemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_framemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_action_keymenu, NULL);
uiDefIconTextBlockBut(block, action_keymenu_transformmenu,
@@ -744,14 +744,14 @@ static void do_markermenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_markermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_markermenu(bContext *C, ARegion *ar, void *arg_unused)
{
SpaceAction *saction= (SpaceAction*)CTX_wm_space_data(C);
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_markermenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_markermenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_markermenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Marker|M", 0, yco-=20,
@@ -817,12 +817,12 @@ static void do_channelmenu_posmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_channelmenu_posmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_channelmenu_posmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_channelmenu_posmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_channelmenu_posmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_channelmenu_posmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -871,12 +871,12 @@ static void do_channelmenu_groupmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_channelmenu_groupmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_channelmenu_groupmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_channelmenu_groupmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_channelmenu_groupmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_channelmenu_groupmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -915,12 +915,12 @@ static void do_channelmenu_settingsmenu(bContext *C, void *arg, int event)
//setflag_action_channels(event);
}
-static uiBlock *action_channelmenu_settingsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_channelmenu_settingsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_channelmenu_settingsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_channelmenu_settingsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_channelmenu_settingsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -970,13 +970,13 @@ static void do_channelmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_channelmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_channelmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_channelmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_channelmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_channelmenu, NULL);
uiDefIconTextBlockBut(block, action_channelmenu_groupmenu,
@@ -1034,13 +1034,13 @@ static uiBlock *action_channelmenu(bContext *C, uiMenuBlockHandle *handle, void
/* Grease Pencil --------------------------- */
/* Uses channelmenu functions */
-static uiBlock *action_gplayermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_gplayermenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_gplayermenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_gplayermenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_channelmenu, NULL);
uiDefIconTextBlockBut(block, action_channelmenu_settingsmenu,
@@ -1088,13 +1088,13 @@ static void do_selectmenu_columnmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_selectmenu_columnmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_selectmenu_columnmenu(bContext *C, ARegion *ar, void *arg_unused)
{
SpaceAction *saction= (SpaceAction*)CTX_wm_space_data(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_selectmenu_columnmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_selectmenu_columnmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_selectmenu_columnmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -1198,14 +1198,14 @@ static void do_selectmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_selectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_selectmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceAction *saction= (SpaceAction*)CTX_wm_space_data(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_selectmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_selectmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_selectmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -1371,7 +1371,7 @@ static void do_viewmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceAction *saction= (SpaceAction*)CTX_wm_space_data(C);
@@ -1379,7 +1379,7 @@ static uiBlock *action_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *ar
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h
index 14cf6f82f76..591aecb061a 100644
--- a/source/blender/editors/space_action/action_intern.h
+++ b/source/blender/editors/space_action/action_intern.h
@@ -88,8 +88,8 @@ void ACT_OT_keyframes_clean(struct wmOperatorType *ot);
void ACT_OT_keyframes_sample(struct wmOperatorType *ot);
void ACT_OT_keyframes_handletype(struct wmOperatorType *ot);
-void ACT_OT_keyframes_ipotype(struct wmOperatorType *ot);
-void ACT_OT_keyframes_expotype(struct wmOperatorType *ot);
+void ACT_OT_keyframes_interpolation_type(struct wmOperatorType *ot);
+void ACT_OT_keyframes_extrapolation_type(struct wmOperatorType *ot);
void ACT_OT_keyframes_cfrasnap(struct wmOperatorType *ot);
void ACT_OT_keyframes_snap(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c
index f3a9ceb21ba..87ee41c795a 100644
--- a/source/blender/editors/space_action/action_ops.c
+++ b/source/blender/editors/space_action/action_ops.c
@@ -73,8 +73,8 @@ void action_operatortypes(void)
WM_operatortype_append(ACT_OT_keyframes_mirror);
WM_operatortype_append(ACT_OT_keyframes_cfrasnap);
WM_operatortype_append(ACT_OT_keyframes_handletype);
- WM_operatortype_append(ACT_OT_keyframes_ipotype);
- WM_operatortype_append(ACT_OT_keyframes_expotype);
+ WM_operatortype_append(ACT_OT_keyframes_interpolation_type);
+ WM_operatortype_append(ACT_OT_keyframes_extrapolation_type);
WM_operatortype_append(ACT_OT_keyframes_sample);
WM_operatortype_append(ACT_OT_keyframes_clean);
WM_operatortype_append(ACT_OT_keyframes_delete);
@@ -121,8 +121,8 @@ static void action_keymap_keyframes (wmWindowManager *wm, ListBase *keymap)
/* menu + set setting */
WM_keymap_add_item(keymap, "ACT_OT_keyframes_handletype", HKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "ACT_OT_keyframes_ipotype", TKEY, KM_PRESS, KM_SHIFT, 0);
- WM_keymap_add_item(keymap, "ACT_OT_keyframes_expotype", EKEY, KM_PRESS, KM_SHIFT, 0); // temp...
+ WM_keymap_add_item(keymap, "ACT_OT_keyframes_interpolation_type", TKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "ACT_OT_keyframes_extrapolation_type", EKEY, KM_PRESS, KM_SHIFT, 0);
/* destructive */
WM_keymap_add_item(keymap, "ACT_OT_keyframes_clean", OKEY, KM_PRESS, 0, 0);
@@ -138,6 +138,9 @@ static void action_keymap_keyframes (wmWindowManager *wm, ListBase *keymap)
/* auto-set range */
WM_keymap_add_item(keymap, "ACT_OT_set_previewrange", PKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
WM_keymap_add_item(keymap, "ACT_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
+
+ /* generates event, needs to be after select to work */
+ WM_keymap_add_item(keymap, "WM_OT_tweak_gesture", SELECTMOUSE, KM_PRESS, 0, 0);
/* transform system */
transform_keymap_for_space(wm, keymap, SPACE_ACTION);
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 2e07b2db417..3c9e8a4215f 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -521,7 +521,7 @@ void ACT_OT_keyframes_borderselect(wmOperatorType *ot)
*/
/* defines for column-select mode */
-EnumPropertyItem prop_column_select_types[] = {
+static EnumPropertyItem prop_column_select_types[] = {
{ACTKEYS_COLUMNSEL_KEYS, "KEYS", "On Selected Keyframes", ""},
{ACTKEYS_COLUMNSEL_CFRA, "CFRA", "On Current Frame", ""},
{ACTKEYS_COLUMNSEL_MARKERS_COLUMN, "MARKERS_COLUMN", "On Selected Markers", ""},
@@ -750,7 +750,7 @@ void ACT_OT_keyframes_columnselect (wmOperatorType *ot)
*/
/* defines for left-right select tool */
-EnumPropertyItem prop_leftright_select_types[] = {
+static EnumPropertyItem prop_leftright_select_types[] = {
{ACTKEYS_LRSEL_TEST, "CHECK", "Check if Select Left or Right", ""},
{ACTKEYS_LRSEL_NONE, "OFF", "Don't select", ""},
{ACTKEYS_LRSEL_LEFT, "LEFT", "Before current frame", ""},
@@ -978,12 +978,13 @@ static void mouse_columnselect_action_keys (bAnimContext *ac, float selx)
Object *nob= ANIM_nla_mapping_get(ac, ale);
/* set frame for validation callback to refer to */
+ // XXX have a more sensitive range?
if (nob)
bed.f1= get_action_frame(nob, selx);
else
bed.f1= selx;
- /* select elements with frame number matching cfraelem */
+ /* select elements with frame number matching cfra */
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
#if 0 // XXX reenable when Grease Pencil stuff is back
@@ -1067,7 +1068,8 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
/* set notifier tha things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_BOTH);
- return OPERATOR_FINISHED;
+ /* for tweak grab to work */
+ return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
}
void ACT_OT_keyframes_clickselect (wmOperatorType *ot)
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 72053c01e12..37c787877f2 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -298,10 +298,14 @@ static void action_channel_area_listener(ARegion *ar, wmNotifier *wmn)
switch(wmn->data) {
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
+ case ND_KEYS:
ED_region_tag_redraw(ar);
break;
}
break;
+ default:
+ if(wmn->data==ND_KEYS)
+ ED_region_tag_redraw(ar);
}
}
@@ -322,10 +326,14 @@ static void action_main_area_listener(ARegion *ar, wmNotifier *wmn)
switch(wmn->data) {
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
+ case ND_KEYS:
ED_region_tag_redraw(ar);
break;
}
break;
+ default:
+ if(wmn->data==ND_KEYS)
+ ED_region_tag_redraw(ar);
}
}
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index 5090a81aaa7..abccb1aa733 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -65,13 +65,13 @@ static void do_viewmenu(bContext *C, void *arg, int event)
}
-static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 93c9236cf13..4f34aac70c0 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -89,38 +89,12 @@ enum {
static void do_file_buttons(bContext *C, void *arg, int event)
{
- SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
switch(event) {
case B_FS_LOAD:
- {
- char name[FILE_MAX];
-
- ED_screen_full_prevspace(C);
- if(sfile->op) {
- wmOperator *op= sfile->op;
-
- /* if load .blend, all UI pointers after exec are invalid! */
- /* but, operator can be freed still */
-
- sfile->op = NULL;
- BLI_strncpy(name, sfile->params->dir, sizeof(name));
- strcat(name, sfile->params->file);
- RNA_string_set(op->ptr, "filename", name);
-
- op->type->exec(C, op);
-
- WM_operator_free(op);
- }
-
- }
+ file_load_exec(C, NULL); /* file_ops.c */
break;
case B_FS_CANCEL:
- if(sfile->op) {
- WM_operator_free(sfile->op);
- sfile->op = NULL;
- }
- ED_screen_full_prevspace(C);
-
+ file_cancel_exec(C, NULL); /* file_ops.c */
break;
}
}
@@ -203,15 +177,16 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
static void draw_tile(short sx, short sy, short width, short height, int colorid, int shade)
{
/* TODO: BIF_ThemeColor seems to need this to show the color, not sure why? - elubie */
- glEnable(GL_BLEND);
- glColor4ub(0, 0, 0, 100);
- glDisable(GL_BLEND);
+ //glEnable(GL_BLEND);
+ //glColor4ub(0, 0, 0, 100);
+ //glDisable(GL_BLEND);
+ /* I think it was a missing glDisable() - ton */
UI_ThemeColorShade(colorid, shade);
uiSetRoundBox(15);
- glRecti(sx, sy - height, sx + width, sy);
+ // glRecti(sx, sy - height, sx + width, sy);
- // uiRoundBox(sx+TILE_BORDER_X, sy - sfile->prv_h - TILE_BORDER_Y*3 - U.fontsize, sx + sfile->prv_w + TILE_BORDER_X*3, sy, 6);
+ uiRoundBox(sx, sy - height, sx + width, sy, 6);
}
static float shorten_string(char* string, float w)
@@ -293,7 +268,10 @@ void file_calc_previews(const bContext *C, ARegion *ar)
sfile->tile_h = sfile->prv_h + 4*sfile->prv_border_y + U.fontsize*3/2;
width= (v2d->cur.xmax - v2d->cur.xmin - 2*sfile->tile_border_x);
columns= file_view_columns(sfile, v2d);
- rows= filelist_numfiles(sfile->files)/columns + 1; // XXX dirty, modulo is zero
+ if(columns)
+ rows= filelist_numfiles(sfile->files)/columns + 1; // XXX dirty, modulo is zero
+ else
+ rows= filelist_numfiles(sfile->files) + 1; // XXX dirty, modulo is zero
height= rows*(sfile->tile_h+2*sfile->tile_border_y) + sfile->tile_border_y*2;
} else {
sfile->prv_w = 0;
@@ -306,7 +284,11 @@ void file_calc_previews(const bContext *C, ARegion *ar)
sfile->tile_h = U.fontsize*3/2;
height= v2d->cur.ymax - v2d->cur.ymin;
rows = file_view_rows(sfile, v2d);
- columns = filelist_numfiles(sfile->files)/rows + 1; // XXX dirty, modulo is zero
+ if(rows)
+ columns = filelist_numfiles(sfile->files)/rows + 1; // XXX dirty, modulo is zero
+ else
+ columns = filelist_numfiles(sfile->files) + 1; // XXX dirty, modulo is zero
+
width = columns * (sfile->tile_w + 2*sfile->tile_border_x) + sfile->tile_border_x*2;
}
@@ -360,10 +342,10 @@ void file_draw_previews(const bContext *C, ARegion *ar)
if (params->active_file == i) {
colorid = TH_ACTIVE;
- draw_tile(sx, sy, sfile->tile_w, sfile->tile_h, colorid,0);
+ draw_tile(sx - 1, sy, sfile->tile_w + 1, sfile->tile_h, colorid,0);
} else if (file->flags & ACTIVE) {
colorid = TH_HILITE;
- draw_tile(sx, sy, sfile->tile_w, sfile->tile_h, colorid,0);
+ draw_tile(sx - 1, sy, sfile->tile_w + 1, sfile->tile_h, colorid,0);
} else {
colorid = TH_BACK;
draw_tile(sx, sy, sfile->tile_w, sfile->tile_h, colorid, -5);
@@ -417,18 +399,18 @@ void file_draw_previews(const bContext *C, ARegion *ar)
// glaDrawPixelsSafe((float)sx+8 + dx, (float)sy - imgwidth + dy - 8, imb->x, imb->y, imb->x, GL_RGBA, GL_UNSIGNED_BYTE, imb->rect);
glColor4f(1.0, 1.0, 1.0, 1.0);
glaDrawPixelsTex((float)sx + dx, (float)sy - sfile->prv_h + dy, imb->x, imb->y,GL_UNSIGNED_BYTE, imb->rect);
- // glDisable(GL_BLEND);
+ glDisable(GL_BLEND);
imb = 0;
}
#if 0
}
#endif
if (type == FILE_MAIN) {
- glColor3f(1.0f, 1.0f, 1.0f);
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
else {
if (S_ISDIR(file->type)) {
- glColor3f(1.0f, 1.0f, 0.9f);
+ glColor4f(1.0f, 1.0f, 0.9f, 1.0f);
}
else if (file->flags & IMAGEFILE) {
UI_ThemeColor(TH_SEQ_IMAGE);
@@ -499,16 +481,17 @@ void file_draw_list(const bContext *C, ARegion *ar)
for (i=offset; (i < numfiles); ++i)
{
sy = ar->v2d.tot.ymax-sfile->tile_border_y - (i%rows)*(sfile->tile_h+sfile->tile_border_y);
- sx = ar->v2d.tot.xmin +sfile->tile_border_x + (i/rows)*(sfile->tile_w+sfile->tile_border_x);
+ sx = 2 + ar->v2d.tot.xmin +sfile->tile_border_x + (i/rows)*(sfile->tile_w+sfile->tile_border_x);
file = filelist_file(files, i);
if (params->active_file == i) {
- colorid = TH_ACTIVE;
- draw_tile(sx, sy, sfile->tile_w, sfile->tile_h, colorid,0);
+ if (file->flags & ACTIVE) colorid= TH_HILITE;
+ else colorid = TH_BACK;
+ draw_tile(sx, sy-3, sfile->tile_w, sfile->tile_h, colorid,20);
} else if (file->flags & ACTIVE) {
colorid = TH_HILITE;
- draw_tile(sx, sy, sfile->tile_w, sfile->tile_h, colorid,0);
+ draw_tile(sx, sy-3, sfile->tile_w, sfile->tile_h, colorid,0);
} else {
/*
colorid = TH_PANEL;
@@ -516,11 +499,11 @@ void file_draw_list(const bContext *C, ARegion *ar)
*/
}
if (type == FILE_MAIN) {
- glColor3f(1.0f, 1.0f, 1.0f);
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
else {
if (S_ISDIR(file->type)) {
- glColor3f(1.0f, 1.0f, 0.9f);
+ glColor4f(1.0f, 1.0f, 0.9f, 1.0f);
}
else if (file->flags & IMAGEFILE) {
UI_ThemeColor(TH_SEQ_IMAGE);
@@ -543,7 +526,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
}
sw = UI_GetStringWidth(G.font, file->size, 0);
- file_draw_string(sx, sy, file->relname, sfile->tile_w - sw - 2, sfile->tile_h);
+ file_draw_string(sx, sy, file->relname, sfile->tile_w - sw - 5, sfile->tile_h);
file_draw_string(sx + sfile->tile_w - sw, sy, file->size, sfile->tile_w - sw, sfile->tile_h);
}
}
@@ -577,9 +560,9 @@ void file_draw_fsmenu(const bContext *C, ARegion *ar)
if (params->active_bookmark == i ) {
glColor4ub(0, 0, 0, 100);
UI_ThemeColor(TH_HILITE);
- // uiSetRoundBox(15);
- // uiRoundBox(simasel->bookmarkrect.xmin + TILE_BORDER_X - 1, sy - linestep*0.25, simasel->bookmarkrect.xmax - TILE_BORDER_X + 1, sy + linestep*0.75, 6);
- glRecti(sx, sy - linestep, sx + bmwidth, sy);
+ uiSetRoundBox(15);
+ uiRoundBox(sx, sy - linestep, sx + bmwidth, sy, 6);
+ // glRecti(sx, sy - linestep, sx + bmwidth, sy);
UI_ThemeColor(TH_TEXT_HI);
} else {
UI_ThemeColor(TH_TEXT);
diff --git a/source/blender/editors/space_file/file_header.c b/source/blender/editors/space_file/file_header.c
index cbe36f28c9d..ef86eb5b7f3 100644
--- a/source/blender/editors/space_file/file_header.c
+++ b/source/blender/editors/space_file/file_header.c
@@ -72,13 +72,13 @@ static void do_viewmenu(bContext *C, void *arg, int event)
}
-static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h
index a551832772b..4f9e6681e6d 100644
--- a/source/blender/editors/space_file/file_intern.h
+++ b/source/blender/editors/space_file/file_intern.h
@@ -47,12 +47,20 @@ void file_draw_fsmenu(const bContext *C, ARegion *ar);
/* file_ops.h */
struct wmOperatorType;
+struct wmOperator;
+struct wmEvent;
void ED_FILE_OT_highlight(struct wmOperatorType *ot);
void ED_FILE_OT_select(struct wmOperatorType *ot);
void ED_FILE_OT_select_all(struct wmOperatorType *ot);
void ED_FILE_OT_border_select(struct wmOperatorType *ot);
void ED_FILE_OT_select_bookmark(struct wmOperatorType *ot);
void ED_FILE_OT_loadimages(struct wmOperatorType *ot);
+void ED_FILE_OT_load(struct wmOperatorType *ot);
+void ED_FILE_OT_cancel(struct wmOperatorType *ot);
+
+int file_load_exec(bContext *C, struct wmOperator *unused);
+int file_cancel_exec(bContext *C, struct wmOperator *unused);
+int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my);
#endif /* ED_FILE_INTERN_H */
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 4c2b7d59368..c6ed0d159d6 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -398,38 +398,39 @@ void ED_FILE_OT_loadimages(wmOperatorType *ot)
/* api callbacks */
ot->invoke= loadimages_invoke;
- ot->poll= ED_operator_areaactive;
+ ot->poll= ED_operator_file_active;
}
-
-static int file_highlight_invoke(bContext *C, wmOperator *op, wmEvent *event)
+int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
{
- ScrArea *sa= CTX_wm_area(C);
- ARegion *ar= CTX_wm_region(C);
FileSelectParams* params;
- short x, y;
- int actfile;
- int numfiles;
- SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
+ int numfiles, actfile;
+
+ if(sfile==NULL || sfile->files==NULL) return 0;
- if (!sfile || !sfile->files) return OPERATOR_FINISHED;
-
numfiles = filelist_numfiles(sfile->files);
-
- x = event->x - ar->winrct.xmin;
- y = event->y - ar->winrct.ymin;
-
params = ED_fileselect_get_params(sfile);
+
if (params->display) {
- actfile = find_file_mouse_hor(sfile, ar,x , y);
+ actfile = find_file_mouse_hor(sfile, ar, mx , my);
} else {
- actfile = find_file_mouse_vert(sfile, ar, x, y);
+ actfile = find_file_mouse_vert(sfile, ar, mx, my);
}
-
- if (actfile >= 0 && actfile < numfiles )
- {
+
+ if (actfile >= 0 && actfile < numfiles ) {
params->active_file=actfile;
- ED_area_tag_redraw(sa);
+ return 1;
+ }
+ return 0;
+}
+
+static int file_highlight_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ ARegion *ar= CTX_wm_region(C);
+ SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
+
+ if( file_hilight_set(sfile, ar, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin)) {
+ ED_area_tag_redraw(CTX_wm_area(C));
}
return OPERATOR_FINISHED;
@@ -443,6 +444,70 @@ void ED_FILE_OT_highlight(struct wmOperatorType *ot)
/* api callbacks */
ot->invoke= file_highlight_invoke;
- ot->poll= ED_operator_areaactive;
+ ot->poll= ED_operator_file_active;
+}
+
+int file_cancel_exec(bContext *C, wmOperator *unused)
+{
+ SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
+
+ if(sfile->op) {
+ WM_operator_free(sfile->op);
+ sfile->op = NULL;
+ }
+ ED_screen_full_prevspace(C);
+
+ return OPERATOR_FINISHED;
}
+void ED_FILE_OT_cancel(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Cancel File Load";
+ ot->idname= "ED_FILE_OT_cancel";
+
+ /* api callbacks */
+ ot->exec= file_cancel_exec;
+ ot->poll= ED_operator_file_active;
+}
+
+
+int file_load_exec(bContext *C, wmOperator *unused)
+{
+ SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
+ char name[FILE_MAX];
+
+ ED_screen_full_prevspace(C);
+
+ if(sfile->op) {
+ wmOperator *op= sfile->op;
+
+ /* if load .blend, all UI pointers after exec are invalid! */
+ /* but, operator can be freed still */
+
+ sfile->op = NULL;
+ BLI_strncpy(name, sfile->params->dir, sizeof(name));
+ strcat(name, sfile->params->file);
+ RNA_string_set(op->ptr, "filename", name);
+
+ op->type->exec(C, op);
+
+ WM_operator_free(op);
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void ED_FILE_OT_load(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Load File";
+ ot->idname= "ED_FILE_OT_load";
+
+ /* api callbacks */
+ ot->exec= file_load_exec;
+ ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+}
+
+
+
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index e90436a0c59..e32527ee420 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -195,6 +195,7 @@ static void file_main_area_draw(const bContext *C, ARegion *ar)
sfile->files = filelist_new();
filelist_setdir(sfile->files, params->dir);
filelist_settype(sfile->files, params->type);
+ params->active_file = -1; // added this so it opens nicer (ton)
}
if (filelist_empty(sfile->files))
@@ -213,15 +214,21 @@ static void file_main_area_draw(const bContext *C, ARegion *ar)
if(params->sort!=FILE_SORTALPHA) filelist_sort(sfile->files, params->sort);
}
-
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
- file_calc_previews(C,ar);
-
+ /* sets tile/border settings in sfile */
+ file_calc_previews(C, ar);
+ /* on first read, find active file */
+ if (params->active_file == -1) {
+ wmEvent *event= CTX_wm_window(C)->eventstate;
+ file_hilight_set(sfile, ar, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin);
+
+ }
+
/* data... */
UI_view2d_view_ortho(C, v2d);
@@ -250,8 +257,11 @@ void file_operatortypes(void)
WM_operatortype_append(ED_FILE_OT_select_bookmark);
WM_operatortype_append(ED_FILE_OT_loadimages);
WM_operatortype_append(ED_FILE_OT_highlight);
+ WM_operatortype_append(ED_FILE_OT_load);
+ WM_operatortype_append(ED_FILE_OT_cancel);
}
+/* NOTE: do not add .blend file reading on this level */
void file_keymap(struct wmWindowManager *wm)
{
ListBase *keymap= WM_keymap_listbase(wm, "File", SPACE_FILE, 0);
@@ -259,6 +269,7 @@ void file_keymap(struct wmWindowManager *wm)
WM_keymap_add_item(keymap, "ED_FILE_OT_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ED_FILE_OT_border_select", BKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ED_FILE_OT_highlight", MOUSEMOVE, KM_ANY, 0, 0);
+
WM_keymap_add_item(keymap, "ED_FILE_OT_loadimages", TIMER1, KM_ANY, KM_ANY, 0);
keymap= WM_keymap_listbase(wm, "FileBookmark", SPACE_FILE, 0);
diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c
index caf8eacdddb..59bc98eac93 100644
--- a/source/blender/editors/space_image/image_header.c
+++ b/source/blender/editors/space_image/image_header.c
@@ -83,88 +83,52 @@
#define B_SIMA_RECORD 8
#define B_SIMA_PLAY 9
-static uiBlock *image_view_viewnavmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_view_viewnavmenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
- uiBlock *block;
- uiBut *but;
int a;
- /* create menu */
- block= uiBeginBlock(C, handle->region, "image_view_viewnavmenu", UI_EMBOSSP, UI_HELV);
-
- uiDefMenuButO(block, "IMAGE_OT_view_zoom_in", NULL);
- uiDefMenuButO(block, "IMAGE_OT_view_zoom_out", NULL);
+ uiMenuItemO(head, "IMAGE_OT_view_zoom_in", ICON_BLANK1);
+ uiMenuItemO(head, "IMAGE_OT_view_zoom_out", ICON_BLANK1);
- uiDefMenuSep(block);
+ uiMenuSeparator(head);
for(a=0; a<7; a++) {
const int ratios[7][2] = {{1, 8}, {1, 4}, {1, 2}, {1, 1}, {2, 1}, {4, 1}, {8, 1}};
char namestr[128];
sprintf(namestr, "Zoom %d:%d", ratios[a][0], ratios[a][1]);
-
- but= uiDefMenuButO(block, "IMAGE_OT_view_zoom_ratio", namestr);
- RNA_float_set(uiButGetOperatorPtrRNA(but), "ratio", (float)ratios[a][0]/(float)ratios[a][1]);
+ uiMenuItemFloatO(head, namestr, "IMAGE_OT_view_zoom_ratio", "ratio", (float)ratios[a][0]/(float)ratios[a][1]);
}
-
- /* XXX find key shortcut! */
-
- /* position menu */
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 50);
-
- return block;
}
#if 0
static void do_viewmenu(bContext *C, void *arg, int event)
{
- switch(event) {
- case 1: /* View All */
- do_image_buttons(B_SIMAGEHOME);
- break;
- case 4: /* Realtime Panel... */
- add_blockhandler(curarea, IMAGE_HANDLER_VIEW_PROPERTIES, UI_PNL_UNSTOW);
- break;
- case 7: /* Properties Panel */
- add_blockhandler(curarea, IMAGE_HANDLER_PROPERTIES, UI_PNL_UNSTOW);
- break;
- case 8: /* Paint Panel... */
- add_blockhandler(curarea, IMAGE_HANDLER_PAINT, UI_PNL_UNSTOW);
- break;
- case 9:
- image_viewcenter();
- break;
- case 11: /* Curves Panel... */
- add_blockhandler(curarea, IMAGE_HANDLER_CURVES, UI_PNL_UNSTOW);
- break;
- case 12: /* composite preview */
- toggle_blockhandler(curarea, IMAGE_HANDLER_PREVIEW, 0);
- scrarea_queue_winredraw(curarea);
- break;
- case 13: /* Realtime Panel... */
- add_blockhandler(curarea, IMAGE_HANDLER_GAME_PROPERTIES, UI_PNL_UNSTOW);
- break;
- case 15: /* Grease Pencil... */
- add_blockhandler(curarea, IMAGE_HANDLER_GREASEPENCIL, UI_PNL_UNSTOW);
- break;
- }
+ add_blockhandler(curarea, IMAGE_HANDLER_VIEW_PROPERTIES, UI_PNL_UNSTOW);
+ add_blockhandler(curarea, IMAGE_HANDLER_PROPERTIES, UI_PNL_UNSTOW);
+ add_blockhandler(curarea, IMAGE_HANDLER_PAINT, UI_PNL_UNSTOW);
+ add_blockhandler(curarea, IMAGE_HANDLER_CURVES, UI_PNL_UNSTOW);
+
+ toggle_blockhandler(curarea, IMAGE_HANDLER_PREVIEW, 0);
+ scrarea_queue_winredraw(curarea);
+
+ add_blockhandler(curarea, IMAGE_HANDLER_GAME_PROPERTIES, UI_PNL_UNSTOW);
+ add_blockhandler(curarea, IMAGE_HANDLER_GREASEPENCIL, UI_PNL_UNSTOW);
allqueue(REDRAWIMAGE, 0);
allqueue(REDRAWVIEW3D, 0);
}
#endif
-static uiBlock *image_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_viewmenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
bScreen *sc= CTX_wm_screen(C);
ScrArea *sa= CTX_wm_area(C);
SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
PointerRNA spaceptr, uvptr;
- uiBlock *block;
int show_paint, show_render, show_uvedit;
- /* retrrieve state */
+ /* retrieve state */
RNA_pointer_create(&sc->id, &RNA_SpaceImageEditor, sima, &spaceptr);
RNA_pointer_create(&sc->id, &RNA_SpaceUVEditor, sima, &uvptr);
@@ -173,43 +137,27 @@ static uiBlock *image_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg
show_uvedit= get_space_image_show_uvedit(sima, CTX_data_edit_object(C));
/* create menu */
- block= uiBeginBlock(C, handle->region, "image_viewmenu", UI_EMBOSSP, UI_HELV);
-
- uiDefMenuButO(block, "IMAGE_OT_toggle_view_properties_panel", NULL); // View Properties...
- uiDefMenuButO(block, "IMAGE_OT_toggle_image_properties_panel", NULL); // Image Properties...|N
- uiDefMenuButO(block, "IMAGE_OT_toggle_realtime_properties_panel", NULL); // Real-time properties...
- if(show_paint) uiDefMenuButO(block, "IMAGE_OT_toggle_paint_panel", NULL); // Paint Tool...|C
- uiDefMenuButO(block, "IMAGE_OT_toggle_curves_panel", NULL); // Curves Tool...
- if(show_render) uiDefMenuButO(block, "IMAGE_OT_toggle_compositing_preview_panel", NULL); // Compositing Preview...|Shift P
- uiDefMenuButO(block, "IMAGE_OT_toggle_grease_pencil_panel", NULL); // Grease Pencil...
+ uiMenuItemO(head, "IMAGE_OT_toggle_view_properties_panel", ICON_MENU_PANEL); // View Properties...
+ uiMenuItemO(head, "IMAGE_OT_toggle_image_properties_panel", ICON_MENU_PANEL); // Image Properties...|N
+ uiMenuItemO(head, "IMAGE_OT_toggle_realtime_properties_panel", ICON_MENU_PANEL); // Real-time properties...
+ if(show_paint) uiMenuItemO(head, "IMAGE_OT_toggle_paint_panel", ICON_MENU_PANEL); // Paint Tool...|C
+ uiMenuItemO(head, "IMAGE_OT_toggle_curves_panel", ICON_MENU_PANEL); // Curves Tool...
+ if(show_render) uiMenuItemO(head, "IMAGE_OT_toggle_compositing_preview_panel", ICON_MENU_PANEL); // Compositing Preview...|Shift P
+ uiMenuItemO(head, "IMAGE_OT_toggle_grease_pencil_panel", ICON_MENU_PANEL); // Grease Pencil...
- uiDefMenuSep(block);
+ uiMenuSeparator(head);
- uiDefMenuTogR(block, &spaceptr, "update_automatically", NULL, NULL);
- // XXX if(show_uvedit) uiDefMenuTogR(block, &uvptr, "local_view", NULL, "UV Local View"); // Numpad /
+ uiMenuItemBooleanR(head, &spaceptr, "update_automatically");
+ // XXX if(show_uvedit) uiMenuItemBooleanR(head, &uvptr, "local_view"); // "UV Local View", Numpad /
- uiDefMenuSep(block);
+ uiMenuSeparator(head);
- uiDefMenuSub(block, image_view_viewnavmenu, "View Navigation");
- if(show_uvedit) uiDefMenuButO(block, "IMAGE_OT_view_selected", NULL);
- uiDefMenuButO(block, "IMAGE_OT_view_all", NULL);
+ uiMenuLevel(head, "View Navigation", image_view_viewnavmenu);
+ if(show_uvedit) uiMenuItemO(head, "IMAGE_OT_view_selected", ICON_BLANK1);
+ uiMenuItemO(head, "IMAGE_OT_view_all", ICON_BLANK1);
- if(sa->full) uiDefMenuButO(block, "SCREEN_OT_screen_full_area", "Tile Window"); // Ctrl UpArrow
- else uiDefMenuButO(block, "SCREEN_OT_screen_full_area", "Maximize Window"); // Ctr DownArrow
-
- /* position menu */
- if(sa->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- uiEndBlock(C, block);
-
- return block;
+ if(sa->full) uiMenuItemO(head, "SCREEN_OT_screen_full_area", ICON_BLANK1); // "Tile Window", Ctrl UpArrow
+ else uiMenuItemO(head, "SCREEN_OT_screen_full_area", ICON_BLANK1); // "Maximize Window", Ctr DownArrow
}
#if 0
@@ -230,41 +178,21 @@ static void do_selectmenu(bContext *C, void *arg, int event)
}
#endif
-static uiBlock *image_selectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_selectmenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
- ScrArea *sa= CTX_wm_area(C);
- uiBlock *block;
-
- /* create menu */
- block= uiBeginBlock(C, handle->region, "image_selectmenu", UI_EMBOSSP, UI_HELV);
-
- uiDefMenuButO(block, "UV_OT_border_select", NULL); // Border Select|B
- uiDefMenuButO(block, "UV_OT_border_select_pinned", NULL); // Border Select Pinned|Shift B
+ uiMenuItemO(head, "UV_OT_border_select", ICON_BLANK1); // Border Select|B
+ uiMenuItemO(head, "UV_OT_border_select_pinned", ICON_BLANK1); // Border Select Pinned|Shift B
- uiDefMenuSep(block);
+ uiMenuSeparator(head);
- uiDefMenuButO(block, "UV_OT_de_select_all", NULL);
- uiDefMenuButO(block, "UV_OT_select_invert", NULL);
- uiDefMenuButO(block, "UV_OT_unlink_selection", NULL); // Unlink Selection|Alt L
+ uiMenuItemO(head, "UV_OT_de_select_all", ICON_BLANK1);
+ uiMenuItemO(head, "UV_OT_select_invert", ICON_BLANK1);
+ uiMenuItemO(head, "UV_OT_unlink_selection", ICON_BLANK1); // Unlink Selection|Alt L
- uiDefMenuSep(block);
-
- uiDefMenuButO(block, "UV_OT_select_pinned", NULL); // Select Pinned|Shift P
- uiDefMenuButO(block, "UV_OT_select_linked", NULL); // Select Linked|Ctrl L
+ uiMenuSeparator(head);
- /* position menu */
- if(sa->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- uiEndBlock(C, block);
-
- return block;
+ uiMenuItemO(head, "UV_OT_select_pinned", ICON_BLANK1); // Select Pinned|Shift P
+ uiMenuItemO(head, "UV_OT_select_linked", ICON_BLANK1); // Select Linked|Ctrl L
}
#if 0
@@ -331,12 +259,10 @@ static void do_image_image_rtmappingmenu(void *arg, int event)
}
#endif
-static uiBlock *image_imagemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_imagemenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
bScreen *sc= CTX_wm_screen(C);
- ScrArea *sa= CTX_wm_area(C);
SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
- uiBlock *block;
PointerRNA spaceptr;
Image *ima;
ImBuf *ibuf;
@@ -351,34 +277,32 @@ static uiBlock *image_imagemenu(bContext *C, uiMenuBlockHandle *handle, void *ar
RNA_pointer_create(&sc->id, &RNA_SpaceImageEditor, sima, &spaceptr);
/* create menu */
- block= uiBeginBlock(C, handle->region, "image_imagemenu", UI_EMBOSSP, UI_HELV);
-
- uiDefMenuButO(block, "IMAGE_OT_new", NULL); // New...|Alt N
- uiDefMenuButO(block, "IMAGE_OT_open", NULL); // Open...|Alt O
+ uiMenuItemO(head, "IMAGE_OT_new", ICON_BLANK1); // New...|Alt N
+ uiMenuItemO(head, "IMAGE_OT_open", ICON_BLANK1); // Open...|Alt O
if(ima) {
- uiDefMenuButO(block, "IMAGE_OT_replace", NULL); // Replace...
- uiDefMenuButO(block, "IMAGE_OT_reload", NULL); // Reload...|Alt R
- uiDefMenuButO(block, "IMAGE_OT_save", NULL); // Save|Alt S
- uiDefMenuButO(block, "IMAGE_OT_save_as", NULL); // Save As...
+ uiMenuItemO(head, "IMAGE_OT_replace", ICON_BLANK1); // Replace...
+ uiMenuItemO(head, "IMAGE_OT_reload", ICON_BLANK1); // Reload...|Alt R
+ uiMenuItemO(head, "IMAGE_OT_save", ICON_BLANK1); // Save|Alt S
+ uiMenuItemO(head, "IMAGE_OT_save_as", ICON_BLANK1); // Save As...
if(ima->source == IMA_SRC_SEQUENCE)
- uiDefMenuButO(block, "IMAGE_OT_save_changed", NULL); // Save Changed Images
+ uiMenuItemO(head, "IMAGE_OT_save_changed", ICON_BLANK1); // Save Changed Images
if(!show_render) {
- uiDefMenuSep(block);
+ uiMenuSeparator(head);
- if(ima->packedfile) uiDefMenuButO(block, "IMAGE_OT_unpack", NULL); // Unpack Image...
- else uiDefMenuButO(block, "IMAGE_OT_pack", NULL); // Pack Image
+ if(ima->packedfile) uiMenuItemO(head, "IMAGE_OT_unpack", ICON_BLANK1); // Unpack Image...
+ else uiMenuItemO(head, "IMAGE_OT_pack", ICON_BLANK1); // Pack Image
/* only for dirty && specific image types : XXX poll? */
if(ibuf && (ibuf->userflags & IB_BITMAPDIRTY))
if(ELEM(ima->source, IMA_SRC_FILE, IMA_SRC_GENERATED) && ima->type != IMA_TYPE_MULTILAYER)
- uiDefMenuButO(block, "IMAGE_OT_pack_as_png", NULL); // Pack Image As PNG
+ uiMenuItemO(head, "IMAGE_OT_pack_as_png", ICON_BLANK1); // Pack Image As PNG
- uiDefMenuSep(block);
+ uiMenuSeparator(head);
/* XXX check state better */
- uiDefMenuTogR(block, &spaceptr, "image_painting", NULL, NULL);
+ uiMenuItemBooleanR(head, &spaceptr, "image_painting");
}
}
@@ -398,20 +322,6 @@ static uiBlock *image_imagemenu(bContext *C, uiMenuBlockHandle *handle, void *ar
}
#endif
#endif
-
- /* position menu */
- if(sa->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 80);
- uiEndBlock(C, block);
-
- return block;
}
#if 0
@@ -432,61 +342,11 @@ static void do_image_uvs_showhidemenu(void *arg, int event)
}
#endif
-static uiBlock *image_uvs_showhidemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
-{
- uiBlock *block;
-
- /* create menu */
- block= uiBeginBlock(C, handle->region, "image_uvs_showhidemenu", UI_EMBOSSP, UI_HELV);
-
- uiDefMenuButO(block, "UV_OT_show_hidden_faces", NULL); // Show Hidden Faces|Alt H
- uiDefMenuButO(block, "UV_OT_hide_selected_faces", NULL); // Hide Selected Faces|H
- uiDefMenuButO(block, "UV_OT_hide_deselected_faces", NULL); // Hide Deselected Faces|Shift H
-
- /* position menu */
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- uiEndBlock(C, block);
-
- return block;
-}
-
-#if 0
-static void do_image_uvs_propfalloffmenu(void *arg, int event)
-{
- G.scene->prop_mode= event;
- allqueue(REDRAWVIEW3D, 1);
-}
-#endif
-
-static uiBlock *image_uvs_propfalloffmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_uvs_showhidemenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
- Scene *scene= CTX_data_scene(C);
- PointerRNA sceneptr;
- uiBlock *block;
-
- /* retrieve state */
- RNA_id_pointer_create(&scene->id, &sceneptr);
-
- /* create menu */
- block= uiBeginBlock(C, handle->region, "image_uvs_propfalloffmenu", UI_EMBOSSP, UI_HELV);
-
- uiDefMenuTogR(block, &sceneptr, "proportional_editing_falloff", "SMOOTH", NULL); // Smooth|Shift O
- uiDefMenuTogR(block, &sceneptr, "proportional_editing_falloff", "SPHERE", NULL); // Sphere|Shift O
- uiDefMenuTogR(block, &sceneptr, "proportional_editing_falloff", "ROOT", NULL); // Root|Shift O
- uiDefMenuTogR(block, &sceneptr, "proportional_editing_falloff", "SHARP", NULL); // Sharp|Shift O
- uiDefMenuTogR(block, &sceneptr, "proportional_editing_falloff", "LINEAR", NULL); // Linear|Shift O
- uiDefMenuTogR(block, &sceneptr, "proportional_editing_falloff", "RANDOM", NULL); // Random|Shift O
- uiDefMenuTogR(block, &sceneptr, "proportional_editing_falloff", "CONSTANT", NULL); // Constant|Shift O
-
- /* position menu */
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- uiEndBlock(C, block);
-
- return block;
+ uiMenuItemO(head, "UV_OT_show_hidden_faces", ICON_BLANK1); // Show Hidden Faces|Alt H
+ uiMenuItemO(head, "UV_OT_hide_selected_faces", ICON_BLANK1); // Hide Selected Faces|H
+ uiMenuItemO(head, "UV_OT_hide_deselected_faces", ICON_BLANK1); // Hide Deselected Faces|Shift H
}
#if 0
@@ -509,24 +369,11 @@ static void do_image_uvs_transformmenu(void *arg, int event)
}
#endif
-static uiBlock *image_uvs_transformmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_uvs_transformmenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
- uiBlock *block;
-
- /* create menu */
- block= uiBeginBlock(C, handle->region, "image_uvs_transformmenu", UI_EMBOSSP, UI_HELV);
-
- uiDefMenuButO(block, "UV_OT_grab", NULL); // Grab/Move|G
- uiDefMenuButO(block, "UV_OT_rotate", NULL); // Rotate|R
- uiDefMenuButO(block, "UV_OT_scale", NULL); // Scale|S
-
- /* position menu */
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- uiEndBlock(C, block);
-
- return block;
+ uiMenuItemO(head, "UV_OT_grab", ICON_BLANK1); // Grab/Move|G
+ uiMenuItemO(head, "UV_OT_rotate", ICON_BLANK1); // Rotate|R
+ uiMenuItemO(head, "UV_OT_scale", ICON_BLANK1); // Scale|S
}
#if 0
@@ -553,26 +400,10 @@ static void do_image_uvs_mirrormenu(void *arg, int event)
}
#endif
-static uiBlock *image_uvs_mirrormenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_uvs_mirrormenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
- uiBlock *block;
- uiBut *but;
-
- /* create menu */
- block= uiBeginBlock(C, handle->region, "image_uvs_mirrormenu", UI_EMBOSSP, UI_HELV);
-
- but= uiDefMenuButO(block, "UV_OT_mirror", "X Axis"); // M, 1
- RNA_enum_set(uiButGetOperatorPtrRNA(but), "axis", 'x');
- but= uiDefMenuButO(block, "UV_OT_mirror", "Y Axis"); // M, 2
- RNA_enum_set(uiButGetOperatorPtrRNA(but), "axis", 'y');
-
- /* position menu */
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- uiEndBlock(C, block);
-
- return block;
+ uiMenuItemEnumO(head, "UV_OT_mirror", "axis", 'x'); // "X Axis", M, 1
+ uiMenuItemEnumO(head, "UV_OT_mirror", "axis", 'y'); // "Y Axis", M, 2
}
#if 0
@@ -598,29 +429,10 @@ static void do_image_uvs_weldalignmenu(void *arg, int event)
}
#endif
-static uiBlock *image_uvs_weldalignmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_uvs_weldalignmenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
- uiBlock *block;
- uiBut *but;
-
- /* create menu */
- block= uiBeginBlock(C, handle->region, "image_uvs_weldalignmenu", UI_EMBOSSP, UI_HELV);
-
- but= uiDefMenuButO(block, "UV_OT_weld", NULL); // W, 1
- but= uiDefMenuButO(block, "UV_OT_align", "Align Auto"); // W, 2
- RNA_enum_set(uiButGetOperatorPtrRNA(but), "axis", 'a');
- but= uiDefMenuButO(block, "UV_OT_align", "Align X"); // W, 3
- RNA_enum_set(uiButGetOperatorPtrRNA(but), "axis", 'x');
- but= uiDefMenuButO(block, "UV_OT_align", "Align Y"); // W, 4
- RNA_enum_set(uiButGetOperatorPtrRNA(but), "axis", 'y');
-
- /* position menu */
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- uiEndBlock(C, block);
-
- return block;
+ uiMenuItemO(head, "UV_OT_weld", ICON_BLANK1); // W, 1
+ uiMenuItemsEnumO(head, "UV_OT_align", "axis"); // W, 2/3/4
}
#if 0
@@ -632,7 +444,7 @@ static void do_image_uvs_scriptsmenu(void *arg, int event)
allqueue(REDRAWIMAGE, 0);
}
-static uiBlock *image_uvs_scriptsmenu (void *args_unused)
+static void image_uvs_scriptsmenu (void *args_unused)
{
uiBlock *block;
BPyMenu *pym;
@@ -662,10 +474,6 @@ static uiBlock *image_uvs_scriptsmenu (void *args_unused)
static void do_uvsmenu(bContext *C, void *arg, int event)
{
switch(event) {
- case 1: /* UVs Constrained Rectangular */
- if(sima->flag & SI_BE_SQUARE) sima->flag &= ~SI_BE_SQUARE;
- else sima->flag |= SI_BE_SQUARE;
- break;
case 2: /* UVs Clipped to Image Size */
if(sima->flag & SI_CLIP_UV) sima->flag &= ~SI_CLIP_UV;
else sima->flag |= SI_CLIP_UV;
@@ -705,13 +513,11 @@ static void do_uvsmenu(bContext *C, void *arg, int event)
}
#endif
-static uiBlock *image_uvsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_uvsmenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
bScreen *sc= CTX_wm_screen(C);
- ScrArea *sa= CTX_wm_area(C);
Scene *scene= CTX_data_scene(C);
SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
- uiBlock *block;
PointerRNA uvptr, sceneptr;
Image *ima;
ImBuf *ibuf;
@@ -724,61 +530,45 @@ static uiBlock *image_uvsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_
RNA_id_pointer_create(&scene->id, &sceneptr);
/* create menu */
- block= uiBeginBlock(C, handle->region, "image_imagemenu", UI_EMBOSSP, UI_HELV);
+ uiMenuItemBooleanR(head, &uvptr, "snap_to_pixels");
+ uiMenuItemBooleanR(head, &uvptr, "constrain_to_image_bounds");
- uiDefMenuTogR(block, &uvptr, "snap_to_pixels", 0, NULL);
- uiDefMenuTogR(block, &uvptr, "constrain_quads_rectangular", 0, NULL);
- uiDefMenuTogR(block, &uvptr, "constrain_to_image_bounds", 0, NULL);
+ uiMenuSeparator(head);
- uiDefMenuSep(block);
+ uiMenuItemBooleanR(head, &uvptr, "live_unwrap");
+ uiMenuItemO(head, "UV_OT_unwrap", ICON_BLANK1); // Unwrap|E
+ uiMenuItemO(head, "UV_OT_unpin", ICON_BLANK1); // Unpin|Alt P
+ uiMenuItemO(head, "UV_OT_pin", ICON_BLANK1); // Pin|P
- uiDefMenuTogR(block, &uvptr, "live_unwrap", 0, NULL);
- uiDefMenuButO(block, "UV_OT_unwrap", NULL); // Unwrap|E
- uiDefMenuButO(block, "UV_OT_unpin", NULL); // Unpin|Alt P
- uiDefMenuButO(block, "UV_OT_pin", NULL); // Pin|P
+ uiMenuSeparator(head);
- uiDefMenuSep(block);
+ uiMenuItemO(head, "UV_OT_pack_islands", ICON_BLANK1); // Pack Islands|Ctr P
+ uiMenuItemO(head, "UV_OT_average_islands", ICON_BLANK1); // Average Islands Scale|Ctrl A
+ uiMenuItemO(head, "UV_OT_minimize_stretch", ICON_BLANK1); // Minimize Stretch...|Ctrl V
+ uiMenuItemO(head, "UV_OT_stitch", ICON_BLANK1);
- uiDefMenuButO(block, "UV_OT_pack_islands", NULL); // Pack Islands|Ctr P
- uiDefMenuButO(block, "UV_OT_average_islands", NULL); // Average Islands Scale|Ctrl A
- uiDefMenuButO(block, "UV_OT_minimize_stretch", NULL); // Minimize Stretch...|Ctrl V
- uiDefMenuButO(block, "UV_OT_stitch", NULL);
+ uiMenuSeparator(head);
- uiDefMenuSep(block);
+ uiMenuLevel(head, "Transform", image_uvs_transformmenu);
+ uiMenuLevel(head, "Mirror", image_uvs_mirrormenu);
+ uiMenuLevel(head, "Weld/Align", image_uvs_weldalignmenu);
- uiDefMenuSub(block, image_uvs_transformmenu, "Transform");
- uiDefMenuSub(block, image_uvs_mirrormenu, "Mirror");
- uiDefMenuSub(block, image_uvs_weldalignmenu, "Weld/Align");
+ uiMenuSeparator(head);
- uiDefMenuSep(block);
+ uiMenuItemBooleanR(head, &sceneptr, "proportional_editing");
+ uiMenuLevelEnumR(head, &sceneptr, "proportional_editing_falloff");
- uiDefMenuTogR(block, &sceneptr, "proportional_editing", 0, NULL);
- uiDefMenuSub(block, image_uvs_propfalloffmenu, "Proportional Falloff");
+ uiMenuSeparator(head);
- uiDefMenuSep(block);
-
- uiDefMenuSub(block, image_uvs_showhidemenu, "Show/Hide Faces");
+ uiMenuLevel(head, "Show/Hide Faces", image_uvs_showhidemenu);
#if 0
#ifndef DISABLE_PYTHON
- uiDefMenuSep(block);
+ uiMenuSeparator(head);
- uiDefMenuSub(block, image_uvs_scriptsmenu, "Scripts");
+ uiMenuLevel(head, "Scripts", image_uvs_scriptsmenu);
#endif
#endif
-
- if(sa->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- uiEndBlock(C, block);
-
- return block;
}
static void image_menu_uvlayers(Object *obedit, char *menustr, int *active)
@@ -1134,23 +924,23 @@ void image_header_buttons(const bContext *C, ARegion *ar)
uiBlockSetEmboss(block, UI_EMBOSSP);
xmax= GetButStringLength("View");
- uiDefPulldownBut(block, image_viewmenu, NULL, "View", xco, yco-2, xmax-3, 24, "");
+ uiDefMenuBut(block, image_viewmenu, NULL, "View", xco, yco-2, xmax-3, 24, "");
xco+= xmax;
if(show_uvedit) {
xmax= GetButStringLength("Select");
- uiDefPulldownBut(block, image_selectmenu, NULL, "Select", xco, yco-2, xmax-3, 24, "");
+ uiDefMenuBut(block, image_selectmenu, NULL, "Select", xco, yco-2, xmax-3, 24, "");
xco+= xmax;
}
menuname= (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))? "Image*": "Image";
xmax= GetButStringLength(menuname);
- uiDefPulldownBut(block, image_imagemenu, NULL, menuname, xco, yco-2, xmax-3, 24, "");
+ uiDefMenuBut(block, image_imagemenu, NULL, menuname, xco, yco-2, xmax-3, 24, "");
xco+= xmax;
if(show_uvedit) {
xmax= GetButStringLength("UVs");
- uiDefPulldownBut(block, image_uvsmenu, NULL, "UVs", xco, yco-2, xmax-3, 24, "");
+ uiDefMenuBut(block, image_uvsmenu, NULL, "UVs", xco, yco-2, xmax-3, 24, "");
xco+= xmax;
}
}
@@ -1306,11 +1096,11 @@ void image_header_buttons(const bContext *C, ARegion *ar)
/* record & play */
uiBlockBeginAlign(block);
if(ima->type==IMA_TYPE_COMPOSITE) {
- uiDefIconButO(block, BUT, "IMAGE_OT_record_composite", WM_OP_INVOKE_REGION_WIN, ICON_REC, xco, yco, XIC, YIC, NULL); // Record Composite
+//XXX uiDefIconButO(block, BUT, "IMAGE_OT_record_composite", WM_OP_INVOKE_REGION_WIN, ICON_REC, xco, yco, XIC, YIC, NULL); // Record Composite
xco+= XIC;
}
if((ima->type==IMA_TYPE_COMPOSITE) || ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
- uiDefIconButO(block, BUT, "IMAGE_OT_play_composite", WM_OP_INVOKE_REGION_WIN, ICON_PLAY, xco, yco, XIC, YIC, NULL); // PLAY
+//XXX uiDefIconButO(block, BUT, "IMAGE_OT_play_composite", WM_OP_INVOKE_REGION_WIN, ICON_PLAY, xco, yco, XIC, YIC, NULL); // PLAY
xco+= XIC;
}
uiBlockEndAlign(block);
@@ -1327,3 +1117,38 @@ void image_header_buttons(const bContext *C, ARegion *ar)
uiDrawBlock(C, block);
}
+/********************** toolbox operator *********************/
+
+static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
+ Object *obedit= CTX_data_edit_object(C);
+ uiMenuItem *head;
+ int show_uvedit;
+
+ show_uvedit= get_space_image_show_uvedit(sima, obedit);
+
+ head= uiPupMenuBegin("Toolbox");
+
+ uiMenuLevel(head, "View", image_viewmenu);
+ if(show_uvedit) uiMenuLevel(head, "Select", image_selectmenu);
+ uiMenuLevel(head, "Image", image_imagemenu);
+ if(show_uvedit) uiMenuLevel(head, "UVs", image_uvsmenu);
+
+ uiPupMenuEnd(C, head);
+
+ return OPERATOR_CANCELLED;
+}
+
+void IMAGE_OT_toolbox(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Toolbox";
+ ot->idname= "IMAGE_OT_toolbox";
+
+ /* api callbacks */
+ ot->invoke= toolbox_invoke;
+ ot->poll= space_image_main_area_poll;
+}
+
+
diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h
index 85d4c476150..3f61ec6207a 100644
--- a/source/blender/editors/space_image/image_intern.h
+++ b/source/blender/editors/space_image/image_intern.h
@@ -47,6 +47,7 @@ struct ImBuf *get_space_image_buffer(struct SpaceImage *sima);
void get_space_image_size(struct SpaceImage *sima, int *width, int *height);
void get_space_image_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
void get_space_image_zoom(struct SpaceImage *sima, struct ARegion *ar, float *zoomx, float *zoomy);
+void get_space_image_uv_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
int get_space_image_show_render(struct SpaceImage *sima);
int get_space_image_show_paint(struct SpaceImage *sima);
@@ -56,10 +57,14 @@ int get_space_image_show_uvshadow(struct SpaceImage *sima, struct Object *obedit
/* image_header.c */
void image_header_buttons(const struct bContext *C, struct ARegion *ar);
+void IMAGE_OT_toolbox(struct wmOperatorType *ot);
+
/* image_draw.c */
void draw_image_main(struct SpaceImage *sima, struct ARegion *ar, struct Scene *scene);
/* image_ops.c */
+int space_image_main_area_poll(struct bContext *C);
+
void IMAGE_OT_view_all(struct wmOperatorType *ot);
void IMAGE_OT_view_pan(struct wmOperatorType *ot);
void IMAGE_OT_view_selected(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index c1d212e261f..a4f0abb788f 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -144,7 +144,7 @@ static void sima_zoom_set_factor(SpaceImage *sima, ARegion *ar, float zoomfac)
sima_zoom_set(sima, ar, sima->zoom*zoomfac);
}
-static int space_image_main_area_poll(bContext *C)
+int space_image_main_area_poll(bContext *C)
{
SpaceLink *slink= CTX_wm_space_data(C);
ARegion *ar= CTX_wm_region(C);
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index b21c9aaab2a..5ca1a54e40e 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -53,6 +53,7 @@
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
+#include "ED_image.h"
#include "ED_mesh.h"
#include "ED_space_api.h"
#include "ED_screen.h"
@@ -145,6 +146,8 @@ void image_operatortypes(void)
WM_operatortype_append(IMAGE_OT_view_zoom_in);
WM_operatortype_append(IMAGE_OT_view_zoom_out);
WM_operatortype_append(IMAGE_OT_view_zoom_ratio);
+
+ WM_operatortype_append(IMAGE_OT_toolbox);
}
void image_keymap(struct wmWindowManager *wm)
@@ -168,6 +171,8 @@ void image_keymap(struct wmWindowManager *wm)
RNA_float_set(WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom_ratio", PAD2, KM_PRESS, 0, 0)->ptr, "ratio", 0.5f);
RNA_float_set(WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom_ratio", PAD4, KM_PRESS, 0, 0)->ptr, "ratio", 0.25f);
RNA_float_set(WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom_ratio", PAD8, KM_PRESS, 0, 0)->ptr, "ratio", 0.125f);
+
+ WM_keymap_add_item(keymap, "IMAGE_OT_toolbox", SPACEKEY, KM_PRESS, 0, 0);
}
static void image_refresh(const bContext *C, ScrArea *sa)
@@ -215,6 +220,8 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
case NC_SCENE:
switch(wmn->data) {
case ND_MODE:
+ case ND_RENDER_RESULT:
+ case ND_COMPO_RESULT:
ED_area_tag_refresh(sa);
ED_area_tag_redraw(sa);
break;
@@ -545,6 +552,17 @@ void get_space_image_zoom(SpaceImage *sima, ARegion *ar, float *zoomx, float *zo
*zoomy= (float)(ar->winrct.ymax - ar->winrct.ymin)/(float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin)*height);
}
+void get_space_image_uv_aspect(SpaceImage *sima, float *aspx, float *aspy)
+{
+ int w, h;
+
+ get_space_image_aspect(sima, aspx, aspy);
+ get_space_image_size(sima, &w, &h);
+
+ *aspx *= (float)w;
+ *aspy *= (float)h;
+}
+
int get_space_image_show_render(SpaceImage *sima)
{
return (sima->image && ELEM(sima->image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE));
@@ -583,3 +601,21 @@ int get_space_image_show_uvshadow(SpaceImage *sima, Object *obedit)
return 0;
}
+/* Exported Functions */
+
+Image *ED_space_image(SpaceImage *sima)
+{
+ return get_space_image(sima);
+}
+
+void ED_space_image_size(SpaceImage *sima, int *width, int *height)
+{
+ get_space_image_size(sima, width, height);
+}
+
+void ED_space_image_uv_aspect(SpaceImage *sima, float *aspx, float *aspy)
+{
+ get_space_image_uv_aspect(sima, aspx, aspy);
+}
+
+
diff --git a/source/blender/editors/space_info/info_header.c b/source/blender/editors/space_info/info_header.c
index 4ee5939d1c5..0a6ff9e0b3e 100644
--- a/source/blender/editors/space_info/info_header.c
+++ b/source/blender/editors/space_info/info_header.c
@@ -65,13 +65,13 @@ static void do_viewmenu(bContext *C, void *arg, int event)
}
-static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
diff --git a/source/blender/editors/space_ipo/Makefile b/source/blender/editors/space_ipo/Makefile
index deb61b90362..a1c15ff3225 100644
--- a/source/blender/editors/space_ipo/Makefile
+++ b/source/blender/editors/space_ipo/Makefile
@@ -44,6 +44,7 @@ CPPFLAGS += -I../../blenloader
CPPFLAGS += -I../../blenkernel
CPPFLAGS += -I../../blenlib
CPPFLAGS += -I../../makesdna
+CPPFLAGS += -I../../makesrna
CPPFLAGS += -I../../imbuf
CPPFLAGS += -I../../python
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
diff --git a/source/blender/editors/space_ipo/SConscript b/source/blender/editors/space_ipo/SConscript
index e1556efbbb3..1ff259b5757 100644
--- a/source/blender/editors/space_ipo/SConscript
+++ b/source/blender/editors/space_ipo/SConscript
@@ -3,7 +3,7 @@ Import ('env')
sources = env.Glob('*.c')
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
+incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
env.BlenderLib ( 'bf_editors_space_ipo', sources, Split(incs), [], libtype=['core'], priority=[50] )
diff --git a/source/blender/editors/space_ipo/ipo_draw.c b/source/blender/editors/space_ipo/ipo_draw.c
index f68d524d288..e9566506059 100644
--- a/source/blender/editors/space_ipo/ipo_draw.c
+++ b/source/blender/editors/space_ipo/ipo_draw.c
@@ -67,6 +67,7 @@
#include "BKE_global.h"
#include "BKE_key.h"
#include "BKE_object.h"
+#include "BKE_screen.h"
#include "BKE_utildefines.h"
#include "BIF_gl.h"
@@ -96,22 +97,32 @@ extern void gl_round_box(int mode, float minx, float miny, float maxx, float max
static void draw_fcurve_vertices_keyframes (FCurve *fcu, View2D *v2d, short edit, short sel)
{
BezTriple *bezt= fcu->bezt;
+ const float fac= 0.05f * (v2d->cur.xmax - v2d->cur.xmin);
int i;
+ /* we use bgl points not standard gl points, to workaround vertex
+ * drawing bugs that some drivers have (probably legacy ones only though)
+ */
bglBegin(GL_POINTS);
for (i = 0; i < fcu->totvert; i++, bezt++) {
- if (edit) {
- /* Only the vertex of the line, the
- * handler are drawn later
- */
- if ((bezt->f2 & SELECT) == sel) /* && v2d->cur.xmin < bezt->vec[1][0] < v2d->cur.xmax)*/
+ /* as an optimisation step, only draw those in view
+ * - we apply a correction factor to ensure that points don't pop in/out due to slight twitches of view size
+ */
+ if IN_RANGE(bezt->vec[1][0], (v2d->cur.xmin - fac), (v2d->cur.xmax + fac)) {
+ if (edit) {
+ /* 'Keyframe' vertex only, as handle lines and handles have already been drawn
+ * - only draw those with correct selection state for the current drawing color
+ * -
+ */
+ if ((bezt->f2 & SELECT) == sel)
+ bglVertex3fv(bezt->vec[1]);
+ }
+ else {
+ /* no check for selection here, as curve is not editable... */
+ // XXX perhaps we don't want to even draw points? maybe add an option for that later
bglVertex3fv(bezt->vec[1]);
- }
- else {
- /* draw only if in bounds */
- /*if (v2d->cur.xmin < bezt->vec[1][0] < v2d->cur.xmax)*/
- bglVertex3fv(bezt->vec[1]);
+ }
}
}
@@ -125,16 +136,15 @@ static void draw_fcurve_handle_control (float x, float y, float xscale, float ys
static GLuint displist=0;
/* initialise round circle shape */
- // FIXME: sometimes, this will draw incorrectly (i.e. a scaled copy shows up at the origin)
if (displist == 0) {
GLUquadricObj *qobj;
displist= glGenLists(1);
- glNewList(displist, GL_COMPILE_AND_EXECUTE);
+ glNewList(displist, GL_COMPILE);
qobj = gluNewQuadric();
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
- gluDisk(qobj, 0.07, 0.6, 8, 1);
+ gluDisk(qobj, 0, 0.7, 8, 1);
gluDeleteQuadric(qobj);
glEndList();
@@ -142,7 +152,7 @@ static void draw_fcurve_handle_control (float x, float y, float xscale, float ys
/* adjust view transform before starting */
glTranslatef(x, y, 0.0f);
- glScalef(1.0/xscale*hsize, 1.0/yscale*hsize, 1.0);
+ glScalef(1.0f/xscale*hsize, 1.0f/yscale*hsize, 1.0f);
/* draw! */
glCallList(displist);
@@ -247,9 +257,6 @@ static void draw_fcurve_handles (SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
{
extern unsigned int nurbcol[];
unsigned int *col;
-
- BezTriple *bezt=fcu->bezt, *prevbezt=NULL;
- float *fp;
int sel, b;
/* don't draw handle lines if handles are not shown */
@@ -258,6 +265,9 @@ static void draw_fcurve_handles (SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
/* slightly hacky, but we want to draw unselected points before selected ones*/
for (sel= 0; sel < 2; sel++) {
+ BezTriple *bezt=fcu->bezt, *prevbezt=NULL;
+ float *fp;
+
if (sel) col= nurbcol+4;
else col= nurbcol;
@@ -268,7 +278,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
/* only draw first handle if previous segment had handles */
if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) )
{
- cpack(col[bezt->h1]);
+ cpack(col[(unsigned char)bezt->h1]);
glBegin(GL_LINE_STRIP);
glVertex2fv(fp); glVertex2fv(fp+3);
glEnd();
@@ -278,7 +288,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
/* only draw second handle if this segment is bezier */
if (bezt->ipo == BEZT_IPO_BEZ)
{
- cpack(col[bezt->h2]);
+ cpack(col[(unsigned char)bezt->h2]);
glBegin(GL_LINE_STRIP);
glVertex2fv(fp+3); glVertex2fv(fp+6);
glEnd();
@@ -290,7 +300,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) )
{
fp= bezt->vec[0];
- cpack(col[bezt->h1]);
+ cpack(col[(unsigned char)bezt->h1]);
glBegin(GL_LINE_STRIP);
glVertex2fv(fp); glVertex2fv(fp+3);
@@ -302,7 +312,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
(bezt->ipo == BEZT_IPO_BEZ) )
{
fp= bezt->vec[1];
- cpack(col[bezt->h2]);
+ cpack(col[(unsigned char)bezt->h2]);
glBegin(GL_LINE_STRIP);
glVertex2fv(fp); glVertex2fv(fp+3);
@@ -388,10 +398,11 @@ static void draw_fcurve_repeat (FCurve *fcu, View2D *v2d, float cycxofs, float c
*/
/* resol not depending on horizontal resolution anymore, drivers for example... */
+ // XXX need to take into account the scale
if (fcu->driver)
resol= 32;
else
- resol= 3.0*sqrt(bezt->vec[1][0] - prevbezt->vec[1][0]);
+ resol= (int)(3.0*sqrt(bezt->vec[1][0] - prevbezt->vec[1][0]));
if (resol < 2) {
/* only draw one */
@@ -604,7 +615,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
/* build list of curves to draw */
// XXX enable ANIMFILTER_CURVEVISIBLE when we have a method to set them
- filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CURVESONLY/*|ANIMFILTER_CURVEVISIBLE*/);
+ filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CURVESONLY|ANIMFILTER_CURVEVISIBLE);
items= ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* for each curve:
@@ -618,7 +629,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
/* map ipo-points for drawing if scaled F-Curve */
if (nob)
- ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 0, 1);
+ ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 0, 0);
/* draw curve - we currently calculate colour on the fly, but that should probably be done in advance instead */
col= ipo_rainbow(i, items);
@@ -630,10 +641,9 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
draw_fcurve_handles(sipo, ar, fcu);
draw_fcurve_vertices(sipo, ar, fcu);
-
/* undo mapping of keyframes for drawing if scaled F-Curve */
if (nob)
- ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 1, 1);
+ ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 1, 0);
}
/* free list of curves */
@@ -655,8 +665,8 @@ void graph_draw_channel_names(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
int filter;
View2D *v2d= &ar->v2d;
- float x= 0.0f, y= 0.0f;
- int items, height;
+ float x= 0.0f, y= 0.0f, height;
+ int items;
/* build list of channels to draw */
filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS);
@@ -668,7 +678,8 @@ void graph_draw_channel_names(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
* - offset of ACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for
* start of list offset, and the second is as a correction for the scrollers.
*/
- height= ((items*ACHANNEL_STEP) + (ACHANNEL_HEIGHT*2));
+ height= (float)((items*ACHANNEL_STEP) + (ACHANNEL_HEIGHT*2));
+
if (height > (v2d->mask.ymax - v2d->mask.ymin)) {
/* don't use totrect set, as the width stays the same
* (NOTE: this is ok here, the configuration is pretty straightforward)
@@ -676,6 +687,9 @@ void graph_draw_channel_names(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
v2d->tot.ymin= (float)(-height);
}
+ /* XXX I would call the below line! (ton) */
+ /* UI_view2d_totRect_set(v2d, ar->type->minsizex, height); */
+
/* loop through channels, and set up drawing depending on their type */
y= (float)ACHANNEL_FIRST;
@@ -735,6 +749,22 @@ void graph_draw_channel_names(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
strcpy(name, "Action");
}
break;
+ case ANIMTYPE_FILLDRIVERS: /* drivers widget */
+ {
+ AnimData *adt= (AnimData *)ale->data;
+
+ group = 4;
+ indent= 1;
+ special= ICON_IPO_DEHLT;
+
+ if (EXPANDED_DRVD(adt))
+ expand= ICON_TRIA_DOWN;
+ else
+ expand= ICON_TRIA_RIGHT;
+
+ strcpy(name, "Drivers");
+ }
+ break;
case ANIMTYPE_FILLMATD: /* object materials (dopesheet) expand widget */
{
Object *ob = (Object *)ale->data;
diff --git a/source/blender/editors/space_ipo/ipo_edit.c b/source/blender/editors/space_ipo/ipo_edit.c
new file mode 100644
index 00000000000..1e67b30c15a
--- /dev/null
+++ b/source/blender/editors/space_ipo/ipo_edit.c
@@ -0,0 +1,1381 @@
+/**
+ * $Id: editaction.c 17746 2008-12-08 11:19:44Z aligorith $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Joshua Leung
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <float.h>
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+
+#include "DNA_anim_types.h"
+#include "DNA_action_types.h"
+#include "DNA_armature_types.h"
+#include "DNA_camera_types.h"
+#include "DNA_curve_types.h"
+#include "DNA_object_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_space_types.h"
+#include "DNA_constraint_types.h"
+#include "DNA_key_types.h"
+#include "DNA_lamp_types.h"
+#include "DNA_material_types.h"
+#include "DNA_userdef_types.h"
+#include "DNA_gpencil_types.h"
+#include "DNA_windowmanager_types.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "BKE_action.h"
+#include "BKE_depsgraph.h"
+#include "BKE_fcurve.h"
+#include "BKE_key.h"
+#include "BKE_material.h"
+#include "BKE_object.h"
+#include "BKE_context.h"
+#include "BKE_utildefines.h"
+
+#include "UI_view2d.h"
+
+#include "ED_anim_api.h"
+#include "ED_keyframing.h"
+#include "ED_keyframes_draw.h"
+#include "ED_keyframes_edit.h"
+#include "ED_screen.h"
+#include "ED_space_api.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "ipo_intern.h"
+
+#if 0 // XXX code to be sanitied for new system
+
+/* ************************************************************************** */
+/* KEYFRAME-RANGE STUFF */
+
+/* *************************** Calculate Range ************************** */
+
+/* Get the min/max keyframes*/
+static void get_keyframe_extents (bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ /* get data to filter, from Dopesheet */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* set large values to try to override */
+ if (xmin) *xmin= 999999999.0f;
+ if (xmax) *xmax= -999999999.0f;
+ //if (ymin) *ymin= 999999999.0f;
+ //if (ymax) *ymax= -999999999.0f;
+
+ // XXX
+ if (ymin) *ymin= -10;
+ if (ymax) *ymax= 10;
+
+ /* check if any channels to set range with */
+ if (anim_data.first) {
+ /* go through channels, finding max extents */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ Object *nob= ANIM_nla_mapping_get(ac, ale);
+ FCurve *fcu= (FCurve *)ale->key_data;
+ float tmin, tmax;
+
+ /* get range and apply necessary scaling before */
+ calc_fcurve_range(fcu, &tmin, &tmax);
+ tmin= tmax= 0.0f; // xxx
+
+ if (nob) {
+ tmin= get_action_frame_inv(nob, tmin);
+ tmax= get_action_frame_inv(nob, tmax);
+ }
+
+ /* try to set cur using these values, if they're more extreme than previously set values */
+ if (xmin) *xmin= MIN2(*xmin, tmin);
+ if (xmax) *xmax= MAX2(*xmax, tmax);
+ }
+
+ /* free memory */
+ BLI_freelistN(&anim_data);
+ }
+ else {
+ /* set default range */
+ if (ac->scene) {
+ if (xmin) *xmin= (float)ac->scene->r.sfra;
+ if (xmax) *xmax= (float)ac->scene->r.efra;
+ }
+ else {
+ if (xmin) *xmin= -5;
+ if (xmax) *xmax= 100;
+ }
+ }
+}
+
+/* ****************** Automatic Preview-Range Operator ****************** */
+
+static int graphkeys_previewrange_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+ Scene *scene;
+ float min, max;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+ if (ac.scene == NULL)
+ return OPERATOR_CANCELLED;
+ else
+ scene= ac.scene;
+
+ /* set the range directly */
+ get_keyframe_extents(&ac, &min, &max);
+ scene->r.psfra= (int)floor(min + 0.5f);
+ scene->r.pefra= (int)floor(max + 0.5f);
+
+ /* set notifier that things have changed */
+ // XXX err... there's nothing for frame ranges yet, but this should do fine too
+ WM_event_add_notifier(C, NC_SCENE|ND_FRAME, ac.scene);
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_set_previewrange (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Auto-Set Preview Range";
+ ot->idname= "GRAPHEDIT_OT_set_previewrange";
+
+ /* api callbacks */
+ ot->exec= graphkeys_previewrange_exec;
+ ot->poll= ED_operator_areaactive;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+}
+
+/* ****************** View-All Operator ****************** */
+
+static int graphkeys_viewall_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+ View2D *v2d;
+ float extra;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+ v2d= &ac.ar->v2d;
+
+ /* set the horizontal range, with an extra offset so that the extreme keys will be in view */
+ get_keyframe_extents(&ac, &v2d->cur.xmin, &v2d->cur.xmax, &v2d->cur.ymin, &v2d->cur.ymax);
+
+ extra= 0.05f * (v2d->cur.xmax - v2d->cur.xmin);
+ v2d->cur.xmin -= extra;
+ v2d->cur.xmax += extra;
+
+ extra= 0.05f * (v2d->cur.ymax - v2d->cur.ymin);
+ v2d->cur.ymin -= extra;
+ v2d->cur.ymax += extra;
+
+ /* do View2D syncing */
+ UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
+
+ /* set notifier that things have changed */
+ ED_area_tag_redraw(CTX_wm_area(C));
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_view_all (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "View All";
+ ot->idname= "GRAPHEDIT_OT_view_all";
+
+ /* api callbacks */
+ ot->exec= graphkeys_viewall_exec;
+ ot->poll= ED_operator_areaactive;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+}
+
+/* ************************************************************************** */
+/* GENERAL STUFF */
+
+// TODO:
+// - insert key
+
+/* ******************** Copy/Paste Keyframes Operator ************************* */
+/* - The copy/paste buffer currently stores a set of Action Channels, with temporary
+ * IPO-blocks, and also temporary IpoCurves which only contain the selected keyframes.
+ * - Only pastes between compatable data is possible (i.e. same achan->name, ipo-curve type, etc.)
+ * Unless there is only one element in the buffer, names are also tested to check for compatability.
+ * - All pasted frames are offset by the same amount. This is calculated as the difference in the times of
+ * the current frame and the 'first keyframe' (i.e. the earliest one in all channels).
+ * - The earliest frame is calculated per copy operation.
+ */
+
+#if 0
+/* globals for copy/paste data (like for other copy/paste buffers) */
+ListBase actcopybuf = {NULL, NULL};
+static float actcopy_firstframe= 999999999.0f;
+
+/* This function frees any MEM_calloc'ed copy/paste buffer data */
+// XXX find some header to put this in!
+void free_actcopybuf ()
+{
+ FCurve *fcu, *fcn;
+
+ /* free_fcurve() frees F-Curve memory too, but we don't need to do remlink first, as we're freeing all
+ * channels anyway, and the freeing func only cares about the data it's given
+ */
+ for (fcu= actcopybuf.first; fcu; fcu= fcn) {
+ fcn= fcu->next;
+ free_fcurve(fcu);
+ }
+
+ actcopybuf.first= actcopybuf.last= NULL;
+ actcopy_firstframe= 999999999.0f;
+}
+#endif
+
+/* ------------------- */
+
+/* This function adds data to the copy/paste buffer, freeing existing data first
+ * Only the selected action channels gets their selected keyframes copied.
+ */
+static short copy_graph_keys (bAnimContext *ac)
+{
+#if 0 // XXX old animation system
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ /* clear buffer first */
+ free_actcopybuf();
+
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_SEL | ANIMFILTER_IPOKEYS);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* assume that each of these is an ipo-block */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ bActionChannel *achan;
+ Ipo *ipo= ale->key_data;
+ Ipo *ipn;
+ IpoCurve *icu, *icn;
+ BezTriple *bezt;
+ int i;
+
+ /* coerce an action-channel out of owner */
+ if (ale->ownertype == ANIMTYPE_ACHAN) {
+ bActionChannel *achanO= ale->owner;
+ achan= MEM_callocN(sizeof(bActionChannel), "ActCopyPasteAchan");
+ strcpy(achan->name, achanO->name);
+ }
+ else if (ale->ownertype == ANIMTYPE_SHAPEKEY) {
+ achan= MEM_callocN(sizeof(bActionChannel), "ActCopyPasteAchan");
+ strcpy(achan->name, "#ACP_ShapeKey");
+ }
+ else
+ continue;
+ BLI_addtail(&actcopybuf, achan);
+
+ /* add constraint channel if needed, then add new ipo-block */
+ if (ale->type == ANIMTYPE_CONCHAN) {
+ bConstraintChannel *conchanO= ale->data;
+ bConstraintChannel *conchan;
+
+ conchan= MEM_callocN(sizeof(bConstraintChannel), "ActCopyPasteConchan");
+ strcpy(conchan->name, conchanO->name);
+ BLI_addtail(&achan->constraintChannels, conchan);
+
+ conchan->ipo= ipn= MEM_callocN(sizeof(Ipo), "ActCopyPasteIpo");
+ }
+ else {
+ achan->ipo= ipn= MEM_callocN(sizeof(Ipo), "ActCopyPasteIpo");
+ }
+ ipn->blocktype = ipo->blocktype;
+
+ /* now loop through curves, and only copy selected keyframes */
+ for (icu= ipo->curve.first; icu; icu= icu->next) {
+ /* allocate a new curve */
+ icn= MEM_callocN(sizeof(IpoCurve), "ActCopyPasteIcu");
+ icn->blocktype = icu->blocktype;
+ icn->adrcode = icu->adrcode;
+ BLI_addtail(&ipn->curve, icn);
+
+ /* find selected BezTriples to add to the buffer (and set first frame) */
+ for (i=0, bezt=icu->bezt; i < icu->totvert; i++, bezt++) {
+ if (BEZSELECTED(bezt)) {
+ /* add to buffer ipo-curve */
+ //insert_bezt_icu(icn, bezt); // XXX
+
+ /* check if this is the earliest frame encountered so far */
+ if (bezt->vec[1][0] < actcopy_firstframe)
+ actcopy_firstframe= bezt->vec[1][0];
+ }
+ }
+ }
+ }
+
+ /* check if anything ended up in the buffer */
+ if (ELEM(NULL, actcopybuf.first, actcopybuf.last))
+ // error("Nothing copied to buffer");
+ return -1;
+
+ /* free temp memory */
+ BLI_freelistN(&anim_data);
+#endif // XXX old animation system
+
+ /* everything went fine */
+ return 0;
+}
+
+static short paste_graph_keys (bAnimContext *ac)
+{
+#if 0 // XXX old animation system
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ const Scene *scene= (ac->scene);
+ const float offset = (float)(CFRA - actcopy_firstframe);
+ char *actname = NULL, *conname = NULL;
+ short no_name= 0;
+
+ /* check if buffer is empty */
+ if (ELEM(NULL, actcopybuf.first, actcopybuf.last)) {
+ //error("No data in buffer to paste");
+ return -1;
+ }
+ /* check if single channel in buffer (disregard names if so) */
+ if (actcopybuf.first == actcopybuf.last)
+ no_name= 1;
+
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_IPOKEYS);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* from selected channels */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ Ipo *ipo_src = NULL;
+ bActionChannel *achan;
+ IpoCurve *ico, *icu;
+ BezTriple *bezt;
+ int i;
+
+ /* find suitable IPO-block from buffer to paste from */
+ for (achan= actcopybuf.first; achan; achan= achan->next) {
+ /* try to match data */
+ if (ale->ownertype == ANIMTYPE_ACHAN) {
+ bActionChannel *achant= ale->owner;
+
+ /* check if we have a corresponding action channel */
+ if ((no_name) || (strcmp(achan->name, achant->name)==0)) {
+ actname= achant->name;
+
+ /* check if this is a constraint channel */
+ if (ale->type == ANIMTYPE_CONCHAN) {
+ bConstraintChannel *conchant= ale->data;
+ bConstraintChannel *conchan;
+
+ for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) {
+ if (strcmp(conchan->name, conchant->name)==0) {
+ conname= conchant->name;
+ ipo_src= conchan->ipo;
+ break;
+ }
+ }
+ if (ipo_src) break;
+ }
+ else {
+ ipo_src= achan->ipo;
+ break;
+ }
+ }
+ }
+ else if (ale->ownertype == ANIMTYPE_SHAPEKEY) {
+ /* check if this action channel is "#ACP_ShapeKey" */
+ if ((no_name) || (strcmp(achan->name, "#ACP_ShapeKey")==0)) {
+ actname= NULL;
+ ipo_src= achan->ipo;
+ break;
+ }
+ }
+ }
+
+ /* this shouldn't happen, but it might */
+ if (ipo_src == NULL)
+ continue;
+
+ /* loop over curves, pasting keyframes */
+ for (ico= ipo_src->curve.first; ico; ico= ico->next) {
+ /* get IPO-curve to paste to (IPO-curve might not exist for destination, so gets created) */
+ //icu= verify_ipocurve(ale->id, ico->blocktype, actname, conname, NULL, ico->adrcode, 1);
+
+
+ if (icu) {
+ /* just start pasting, with the the first keyframe on the current frame, and so on */
+ for (i=0, bezt=ico->bezt; i < ico->totvert; i++, bezt++) {
+ /* temporarily apply offset to src beztriple while copying */
+ bezt->vec[0][0] += offset;
+ bezt->vec[1][0] += offset;
+ bezt->vec[2][0] += offset;
+
+ /* insert the keyframe */
+ //insert_bezt_icu(icu, bezt); // XXX
+
+ /* un-apply offset from src beztriple after copying */
+ bezt->vec[0][0] -= offset;
+ bezt->vec[1][0] -= offset;
+ bezt->vec[2][0] -= offset;
+ }
+
+ /* recalculate channel's handles? */
+ //calchandles_fcurve(fcu);
+ }
+ }
+ }
+
+ /* free temp memory */
+ BLI_freelistN(&anim_data);
+#endif // XXX old animation system
+
+ return 0;
+}
+
+/* ------------------- */
+
+static int graphkeys_copy_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* copy keyframes */
+ if (copy_graph_keys(&ac)) {
+ // XXX errors - need a way to inform the user
+ printf("Action Copy: No keyframes copied to copy-paste buffer\n");
+ }
+
+ /* set notifier tha things have changed */
+ ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_keyframes_copy (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Copy Keyframes";
+ ot->idname= "GRAPHEDIT_OT_keyframes_copy";
+
+ /* api callbacks */
+ ot->exec= graphkeys_copy_exec;
+ ot->poll= ED_operator_areaactive;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+}
+
+
+
+static int graphkeys_paste_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* paste keyframes */
+ if (paste_graph_keys(&ac)) {
+ // XXX errors - need a way to inform the user
+ printf("Action Paste: Nothing to paste, as Copy-Paste buffer was empty.\n");
+ }
+
+ /* validate keyframes after editing */
+ ANIM_editkeyframes_refresh(&ac);
+
+ /* set notifier tha things have changed */
+ ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_keyframes_paste (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Paste Keyframes";
+ ot->idname= "GRAPHEDIT_OT_keyframes_paste";
+
+ /* api callbacks */
+ ot->exec= graphkeys_paste_exec;
+ ot->poll= ED_operator_areaactive;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+}
+
+#endif // XXX code to be sanitied for new system
+
+/* ******************** Delete Keyframes Operator ************************* */
+
+static void delete_graph_keys (bAnimContext *ac)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* loop through filtered data and delete selected keys */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ delete_fcurve_keys((FCurve *)ale->key_data); // XXX... this doesn't delete empty curves anymore
+ }
+
+ /* free filtered list */
+ BLI_freelistN(&anim_data);
+}
+
+/* ------------------- */
+
+static int graphkeys_delete_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* delete keyframes */
+ delete_graph_keys(&ac);
+
+ /* validate keyframes after editing */
+ ANIM_editkeyframes_refresh(&ac);
+
+ /* set notifier tha things have changed */
+ ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_keyframes_delete (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Delete Keyframes";
+ ot->idname= "GRAPHEDIT_OT_keyframes_delete";
+
+ /* api callbacks */
+ ot->invoke= WM_operator_confirm;
+ ot->exec= graphkeys_delete_exec;
+ ot->poll= ED_operator_areaactive;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+}
+
+/* ******************** Clean Keyframes Operator ************************* */
+
+static void clean_graph_keys (bAnimContext *ac, float thresh)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY);
+ 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)
+ clean_fcurve((FCurve *)ale->key_data, thresh);
+
+ /* free temp data */
+ BLI_freelistN(&anim_data);
+}
+
+/* ------------------- */
+
+static int graphkeys_clean_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+ float thresh;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* get cleaning threshold */
+ thresh= RNA_float_get(op->ptr, "threshold");
+
+ /* clean keyframes */
+ clean_graph_keys(&ac, thresh);
+
+ /* validate keyframes after editing */
+ ANIM_editkeyframes_refresh(&ac);
+
+ /* set notifier tha things have changed */
+ ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_keyframes_clean (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Clean Keyframes";
+ ot->idname= "GRAPHEDIT_OT_keyframes_clean";
+
+ /* api callbacks */
+ //ot->invoke= // XXX we need that number popup for this!
+ ot->exec= graphkeys_clean_exec;
+ ot->poll= ED_operator_areaactive;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+
+ /* properties */
+ RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 1000.0f);
+}
+
+/* ******************** Sample Keyframes Operator *********************** */
+
+// XXX some of the common parts (with DopeSheet) should be unified in animation module...
+
+/* little cache for values... */
+typedef struct tempFrameValCache {
+ float frame, val;
+} tempFrameValCache;
+
+/* Evaluates the curves between each selected keyframe on each frame, and keys the value */
+static void sample_graph_keys (bAnimContext *ac)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* loop through filtered data and add keys between selected keyframes on every frame */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ FCurve *fcu= (FCurve *)ale->key_data;
+ BezTriple *bezt, *start=NULL, *end=NULL;
+ tempFrameValCache *value_cache, *fp;
+ int sfra, range;
+ int i, n;
+
+ /* find selected keyframes... once pair has been found, add keyframes */
+ for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
+ /* check if selected, and which end this is */
+ if (BEZSELECTED(bezt)) {
+ if (start) {
+ /* set end */
+ end= bezt;
+
+ /* cache values then add keyframes using these values, as adding
+ * keyframes while sampling will affect the outcome...
+ */
+ range= (int)( ceil(end->vec[1][0] - start->vec[1][0]) );
+ sfra= (int)( floor(start->vec[1][0]) );
+
+ if (range) {
+ value_cache= MEM_callocN(sizeof(tempFrameValCache)*range, "IcuFrameValCache");
+
+ /* sample values */
+ for (n=0, fp=value_cache; n<range && fp; n++, fp++) {
+ fp->frame= (float)(sfra + n);
+ fp->val= evaluate_fcurve(fcu, fp->frame);
+ }
+
+ /* add keyframes with these */
+ for (n=0, fp=value_cache; n<range && fp; n++, fp++) {
+ insert_vert_fcurve(fcu, fp->frame, fp->val, 1);
+ }
+
+ /* free temp cache */
+ MEM_freeN(value_cache);
+
+ /* as we added keyframes, we need to compensate so that bezt is at the right place */
+ bezt = fcu->bezt + i + range - 1;
+ i += (range - 1);
+ }
+
+ /* bezt was selected, so it now marks the start of a whole new chain to search */
+ start= bezt;
+ end= NULL;
+ }
+ else {
+ /* just set start keyframe */
+ start= bezt;
+ end= NULL;
+ }
+ }
+ }
+
+ /* recalculate channel's handles? */
+ calchandles_fcurve(fcu);
+ }
+
+ /* admin and redraws */
+ BLI_freelistN(&anim_data);
+}
+
+/* ------------------- */
+
+static int graphkeys_sample_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* sample keyframes */
+ sample_graph_keys(&ac);
+
+ /* validate keyframes after editing */
+ ANIM_editkeyframes_refresh(&ac);
+
+ /* set notifier tha things have changed */
+ ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_keyframes_sample (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Sample Keyframes";
+ ot->idname= "GRAPHEDIT_OT_keyframes_sample";
+
+ /* api callbacks */
+ ot->exec= graphkeys_sample_exec;
+ ot->poll= ED_operator_areaactive;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+}
+
+
+/* ************************************************************************** */
+/* SETTINGS STUFF */
+
+/* ******************** Set Extrapolation-Type Operator *********************** */
+
+/* defines for set extrapolation-type for selected keyframes tool */
+EnumPropertyItem prop_graphkeys_expo_types[] = {
+ {FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", "Constant Extrapolation", ""},
+ {FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", "Linear Extrapolation", ""},
+ {0, NULL, NULL, NULL}
+};
+
+/* this function is responsible for setting extrapolation mode for keyframes */
+static void setexpo_graph_keys(bAnimContext *ac, short mode)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* loop through setting mode per F-Curve */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ FCurve *fcu= (FCurve *)ale->data;
+ fcu->extend= mode;
+ }
+
+ /* cleanup */
+ BLI_freelistN(&anim_data);
+}
+
+/* ------------------- */
+
+static int graphkeys_expo_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+ short mode;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* get handle setting mode */
+ mode= RNA_enum_get(op->ptr, "type");
+
+ /* set handle type */
+ setexpo_graph_keys(&ac, mode);
+
+ /* validate keyframes after editing */
+ ANIM_editkeyframes_refresh(&ac);
+
+ /* set notifier tha things have changed */
+ ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_keyframes_extrapolation_type (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Set Keyframe Extrapolation";
+ ot->idname= "GRAPHEDIT_OT_keyframes_extrapolation_type";
+
+ /* api callbacks */
+ ot->invoke= WM_menu_invoke;
+ ot->exec= graphkeys_expo_exec;
+ ot->poll= ED_operator_areaactive;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+
+ /* id-props */
+ RNA_def_enum(ot->srna, "type", prop_graphkeys_expo_types, 0, "Type", "");
+}
+
+/* ******************** Set Interpolation-Type Operator *********************** */
+
+/* defines for set ipo-type for selected keyframes tool */
+EnumPropertyItem prop_graphkeys_ipo_types[] = {
+ {BEZT_IPO_CONST, "CONSTANT", "Constant Interpolation", ""},
+ {BEZT_IPO_LIN, "LINEAR", "Linear Interpolation", ""},
+ {BEZT_IPO_BEZ, "BEZIER", "Bezier Interpolation", ""},
+ {0, NULL, NULL, NULL}
+};
+
+/* this function is responsible for setting interpolation mode for keyframes */
+static void setipo_graph_keys(bAnimContext *ac, short mode)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+ BeztEditFunc set_cb= ANIM_editkeyframes_ipo(mode);
+
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* loop through setting BezTriple interpolation
+ * Note: we do not supply BeztEditData to the looper yet. Currently that's not necessary here...
+ */
+ for (ale= anim_data.first; ale; ale= ale->next)
+ ANIM_fcurve_keys_bezier_loop(NULL, ale->key_data, NULL, set_cb, calchandles_fcurve);
+
+ /* cleanup */
+ BLI_freelistN(&anim_data);
+}
+
+/* ------------------- */
+
+static int graphkeys_ipo_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+ short mode;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* get handle setting mode */
+ mode= RNA_enum_get(op->ptr, "type");
+
+ /* set handle type */
+ setipo_graph_keys(&ac, mode);
+
+ /* validate keyframes after editing */
+ ANIM_editkeyframes_refresh(&ac);
+
+ /* set notifier tha things have changed */
+ ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_keyframes_interpolation_type (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Set Keyframe Interpolation";
+ ot->idname= "GRAPHEDIT_OT_keyframes_interpolation_type";
+
+ /* api callbacks */
+ ot->invoke= WM_menu_invoke;
+ ot->exec= graphkeys_ipo_exec;
+ ot->poll= ED_operator_areaactive;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+
+ /* id-props */
+ RNA_def_enum(ot->srna, "type", prop_graphkeys_ipo_types, 0, "Type", "");
+}
+
+/* ******************** Set Handle-Type Operator *********************** */
+
+/* defines for set handle-type for selected keyframes tool */
+EnumPropertyItem prop_graphkeys_handletype_types[] = {
+ {HD_AUTO, "AUTO", "Auto Handles", ""},
+ {HD_VECT, "VECTOR", "Vector Handles", ""},
+ {HD_FREE, "FREE", "Free Handles", ""},
+ {HD_ALIGN, "ALIGN", "Aligned Handles", ""},
+// {-1, "TOGGLE", "Toggle between Free and Aligned Handles", ""},
+ {0, NULL, NULL, NULL}
+};
+
+/* this function is responsible for setting handle-type of selected keyframes */
+static void sethandles_graph_keys(bAnimContext *ac, short mode)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+ BeztEditFunc set_cb= ANIM_editkeyframes_handles(mode);
+
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* loop through setting flags for handles
+ * Note: we do not supply BeztEditData to the looper yet. Currently that's not necessary here...
+ */
+ // XXX we might need to supply BeztEditData to get it to only affect selected handles
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ if (mode == -1) {
+ BeztEditFunc toggle_cb;
+
+ /* check which type of handle to set (free or aligned)
+ * - check here checks for handles with free alignment already
+ */
+ if (ANIM_fcurve_keys_bezier_loop(NULL, ale->key_data, NULL, set_cb, NULL))
+ toggle_cb= ANIM_editkeyframes_handles(HD_FREE);
+ else
+ toggle_cb= ANIM_editkeyframes_handles(HD_ALIGN);
+
+ /* set handle-type */
+ ANIM_fcurve_keys_bezier_loop(NULL, ale->key_data, NULL, toggle_cb, calchandles_fcurve);
+ }
+ else {
+ /* directly set handle-type */
+ ANIM_fcurve_keys_bezier_loop(NULL, ale->key_data, NULL, set_cb, calchandles_fcurve);
+ }
+ }
+
+ /* cleanup */
+ BLI_freelistN(&anim_data);
+}
+
+/* ------------------- */
+
+static int graphkeys_handletype_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+ short mode;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* get handle setting mode */
+ mode= RNA_enum_get(op->ptr, "type");
+
+ /* set handle type */
+ sethandles_graph_keys(&ac, mode);
+
+ /* validate keyframes after editing */
+ ANIM_editkeyframes_refresh(&ac);
+
+ /* set notifier tha things have changed */
+ ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_keyframes_handletype (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Set Keyframe Handle Type";
+ ot->idname= "GRAPHEDIT_OT_keyframes_handletype";
+
+ /* api callbacks */
+ ot->invoke= WM_menu_invoke;
+ ot->exec= graphkeys_handletype_exec;
+ ot->poll= ED_operator_areaactive;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+
+ /* id-props */
+ RNA_def_enum(ot->srna, "type", prop_graphkeys_handletype_types, 0, "Type", "");
+}
+
+/* ************************************************************************** */
+/* TRANSFORM STUFF */
+
+/* ***************** Snap Current Frame Operator *********************** */
+
+/* helper callback for graphkeys_cfrasnap_exec() -> used to help get the average time of all selected beztriples */
+// TODO: if some other code somewhere needs this, it'll be time to port this over to keyframes_edit.c!!!
+static short bezt_calc_average(BeztEditData *bed, BezTriple *bezt)
+{
+ /* only if selected */
+ if (bezt->f2 & SELECT) {
+ /* store average time in float (only do rounding at last step */
+ bed->f1 += bezt->vec[1][0];
+
+ /* increment number of items */
+ bed->i1++;
+ }
+
+ return 0;
+}
+
+/* snap current-frame indicator to 'average time' of selected keyframe */
+static int graphkeys_cfrasnap_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+ ListBase anim_data= {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+ BeztEditData bed;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* init edit data */
+ memset(&bed, 0, sizeof(BeztEditData));
+
+ /* loop over action data, averaging values */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_CURVESONLY);
+ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+
+ for (ale= anim_data.first; ale; ale= ale->next)
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_calc_average, NULL);
+
+ BLI_freelistN(&anim_data);
+
+ /* set the new current frame value, based on the average time */
+ if (bed.i1) {
+ Scene *scene= ac.scene;
+ CFRA= (int)floor((bed.f1 / bed.i1) + 0.5f);
+ }
+
+ /* set notifier tha things have changed */
+ WM_event_add_notifier(C, NC_SCENE|ND_FRAME, ac.scene);
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_keyframes_cfrasnap (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Snap Current Frame to Keys";
+ ot->idname= "GRAPHEDIT_OT_keyframes_cfrasnap";
+
+ /* api callbacks */
+ ot->exec= graphkeys_cfrasnap_exec;
+ ot->poll= ED_operator_areaactive;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+}
+
+/* ******************** Snap Keyframes Operator *********************** */
+
+/* defines for snap keyframes tool */
+EnumPropertyItem prop_graphkeys_snap_types[] = {
+ {GRAPHKEYS_SNAP_CFRA, "CFRA", "Current frame", ""},
+ {GRAPHKEYS_SNAP_NEAREST_FRAME, "NEAREST_FRAME", "Nearest Frame", ""}, // XXX as single entry?
+ {GRAPHKEYS_SNAP_NEAREST_SECOND, "NEAREST_SECOND", "Nearest Second", ""}, // XXX as single entry?
+ {GRAPHKEYS_SNAP_NEAREST_MARKER, "NEAREST_MARKER", "Nearest Marker", ""},
+ {GRAPHKEYS_SNAP_HORIZONTAL, "HORIZONTAL", "Flatten Handles", ""},
+ {0, NULL, NULL, NULL}
+};
+
+/* this function is responsible for snapping keyframes to frame-times */
+static void snap_graph_keys(bAnimContext *ac, short mode)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ BeztEditData bed;
+ BeztEditFunc edit_cb;
+
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* get beztriple editing callbacks */
+ edit_cb= ANIM_editkeyframes_snap(mode);
+
+ memset(&bed, 0, sizeof(BeztEditData));
+ bed.scene= ac->scene;
+
+ /* snap keyframes */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ Object *nob= ANIM_nla_mapping_get(ac, ale);
+
+ if (nob) {
+ ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 0, 1);
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve);
+ ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 1, 1);
+ }
+ else
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve);
+ }
+ BLI_freelistN(&anim_data);
+}
+
+/* ------------------- */
+
+static int graphkeys_snap_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+ short mode;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* get snapping mode */
+ mode= RNA_enum_get(op->ptr, "type");
+
+ /* snap keyframes */
+ snap_graph_keys(&ac, mode);
+
+ /* validate keyframes after editing */
+ ANIM_editkeyframes_refresh(&ac);
+
+ /* set notifier tha things have changed */
+ ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_keyframes_snap (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Snap Keys";
+ ot->idname= "GRAPHEDIT_OT_keyframes_snap";
+
+ /* api callbacks */
+ ot->invoke= WM_menu_invoke;
+ ot->exec= graphkeys_snap_exec;
+ ot->poll= ED_operator_areaactive;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+
+ /* id-props */
+ RNA_def_enum(ot->srna, "type", prop_graphkeys_snap_types, 0, "Type", "");
+}
+
+/* ******************** Mirror Keyframes Operator *********************** */
+
+/* defines for mirror keyframes tool */
+EnumPropertyItem prop_graphkeys_mirror_types[] = {
+ {GRAPHKEYS_MIRROR_CFRA, "CFRA", "Current frame", ""},
+ {GRAPHKEYS_MIRROR_YAXIS, "YAXIS", "Vertical Axis", ""},
+ {GRAPHKEYS_MIRROR_XAXIS, "XAXIS", "Horizontal Axis", ""},
+ {GRAPHKEYS_MIRROR_MARKER, "MARKER", "First Selected Marker", ""},
+ {0, NULL, NULL, NULL}
+};
+
+/* this function is responsible for mirroring keyframes */
+static void mirror_graph_keys(bAnimContext *ac, short mode)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ BeztEditData bed;
+ BeztEditFunc edit_cb;
+
+ /* get beztriple editing callbacks */
+ edit_cb= ANIM_editkeyframes_mirror(mode);
+
+ memset(&bed, 0, sizeof(BeztEditData));
+ bed.scene= ac->scene;
+
+ /* for 'first selected marker' mode, need to find first selected marker first! */
+ // XXX should this be made into a helper func in the API?
+ if (mode == GRAPHKEYS_MIRROR_MARKER) {
+ Scene *scene= ac->scene;
+ TimeMarker *marker= NULL;
+
+ /* find first selected marker */
+ for (marker= scene->markers.first; marker; marker=marker->next) {
+ if (marker->flag & SELECT) {
+ break;
+ }
+ }
+
+ /* store marker's time (if available) */
+ if (marker)
+ bed.f1= (float)marker->frame;
+ else
+ return;
+ }
+
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* mirror keyframes */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ Object *nob= ANIM_nla_mapping_get(ac, ale);
+
+ if (nob) {
+ ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 0, 1);
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve);
+ ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 1, 1);
+ }
+ else
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve);
+ }
+ BLI_freelistN(&anim_data);
+}
+
+/* ------------------- */
+
+static int graphkeys_mirror_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+ short mode;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* get mirroring mode */
+ mode= RNA_enum_get(op->ptr, "type");
+
+ /* mirror keyframes */
+ mirror_graph_keys(&ac, mode);
+
+ /* validate keyframes after editing */
+ ANIM_editkeyframes_refresh(&ac);
+
+ /* set notifier tha things have changed */
+ ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_keyframes_mirror (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Mirror Keys";
+ ot->idname= "GRAPHEDIT_OT_keyframes_mirror";
+
+ /* api callbacks */
+ ot->invoke= WM_menu_invoke;
+ ot->exec= graphkeys_mirror_exec;
+ ot->poll= ED_operator_areaactive;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+
+ /* id-props */
+ RNA_def_enum(ot->srna, "type", prop_graphkeys_mirror_types, 0, "Type", "");
+}
+
+/* ******************** Smooth Keyframes Operator *********************** */
+
+static int graphkeys_smooth_exec(bContext *C, wmOperator *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_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+
+ /* smooth keyframes */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ /* For now, we can only smooth by flattening handles AND smoothing curve values.
+ * Perhaps the mode argument could be removed, as that functionality is offerred through
+ * Snap->Flatten Handles anyway.
+ */
+ smooth_fcurve(ale->key_data);
+ }
+ BLI_freelistN(&anim_data);
+
+ /* validate keyframes after editing */
+ ANIM_editkeyframes_refresh(&ac);
+
+ /* set notifier tha things have changed */
+ ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_keyframes_smooth (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Smooth Keys";
+ ot->idname= "GRAPHEDIT_OT_keyframes_smooth";
+
+ /* api callbacks */
+ ot->exec= graphkeys_smooth_exec;
+ ot->poll= ED_operator_areaactive;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+}
+
+/* ************************************************************************** */
diff --git a/source/blender/editors/space_ipo/ipo_header.c b/source/blender/editors/space_ipo/ipo_header.c
index df2dcd28914..0135a274372 100644
--- a/source/blender/editors/space_ipo/ipo_header.c
+++ b/source/blender/editors/space_ipo/ipo_header.c
@@ -73,22 +73,54 @@ enum {
static void do_viewmenu(bContext *C, void *arg, int event)
{
+ SpaceIpo *sipo= (SpaceIpo *)CTX_wm_space_data(C);
+ switch (event) {
+ case 1: /* Show time/frames */
+ sipo->flag ^= SIPO_DRAWTIME;
+ break;
+ case 2: /* AutoMerge Keyframes */
+ sipo->flag ^= SIPO_NOTRANSKEYCULL;
+ break;
+ case 3: /* Show/Hide handles */
+ sipo->flag ^= SIPO_NOHANDLES;
+ break;
+ case 4: /* Show current frame number beside indicator */
+ sipo->flag ^= SIPO_NODRAWCFRANUM;
+ break;
+ }
}
-static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *graph_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
+ SpaceIpo *sipo= (SpaceIpo *)CTX_wm_space_data(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "graph_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
+ // XXX these options should use new menu-options
+
+ if (sipo->flag & SIPO_DRAWTIME) {
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
+ "Show Frames|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
+ }
+ else {
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
+ "Show Seconds|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
+ }
+
+
+ uiDefIconTextBut(block, BUTM, 1, (sipo->flag & SIPO_NOTRANSKEYCULL)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT,
+ "AutoMerge Keyframes|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+ uiDefIconTextBut(block, BUTM, 1, (sipo->flag & SIPO_NOHANDLES)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT,
+ "Show Handles|Ctrl H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
+ uiDefIconTextBut(block, BUTM, 1, (sipo->flag & SIPO_NODRAWCFRANUM)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT,
+ "Show Current Frame Number|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- if(curarea->headertype==HEADERTOP) {
+ if (curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -131,7 +163,7 @@ void graph_header_buttons(const bContext *C, ARegion *ar)
uiBlockSetEmboss(block, UI_EMBOSSP);
xmax= GetButStringLength("View");
- uiDefPulldownBut(block, dummy_viewmenu, CTX_wm_area(C),
+ uiDefPulldownBut(block, graph_viewmenu, CTX_wm_area(C),
"View", xco, yco-2, xmax-3, 24, "");
xco+= xmax;
}
@@ -141,11 +173,56 @@ void graph_header_buttons(const bContext *C, ARegion *ar)
/* mode selector */
uiDefButS(block, MENU, B_REDR,
"Editor Mode %t|F-Curve Editor %x0|Drivers %x1",
- xco,yco,90,YIC, &sipo->mode, 0, 1, 0, 0,
+ xco,yco,110,YIC, &sipo->mode, 0, 1, 0, 0,
"Editing modes for this editor");
+ xco+= 120;
+
+ /* filtering buttons */
+ if (sipo->ads) {
+ //uiBlockBeginAlign(block);
+ uiDefIconButBitI(block, TOG, ADS_FILTER_ONLYSEL, B_REDR, ICON_RESTRICT_SELECT_OFF, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Only display selected Objects");
+ //uiBlockEndAlign(block);
+ xco += 5;
+
+ uiBlockBeginAlign(block);
+ //uiDefIconButBitI(block, TOGN, ADS_FILTER_NOOBJ, B_REDR, ICON_OBJECT, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Non-Armature Objects");
+ //uiDefIconButBitI(block, TOGN, ADS_FILTER_NOARM, B_REDR, ICON_ARMATURE, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Armature Objects");
+ uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSHAPEKEYS, B_REDR, ICON_EDIT, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display ShapeKeys");
+ uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMAT, B_REDR, ICON_MATERIAL, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Materials");
+ uiDefIconButBitI(block, TOGN, ADS_FILTER_NOLAM, B_REDR, ICON_LAMP, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Lamps");
+ uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCAM, B_REDR, ICON_CAMERA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Cameras");
+ uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCUR, B_REDR, ICON_CURVE, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Curves");
+ uiBlockEndAlign(block);
+ xco += 30;
+ }
+ else {
+ // XXX this case shouldn't happen at all... for now, just pad out same amount of space
+ xco += 6*XIC + 35;
+ }
+
+ /* copy + paste */
+ uiBlockBeginAlign(block);
+ uiDefIconBut(block, BUT, B_GRAPHCOPYKEYS, ICON_COPYDOWN, xco,yco,XIC,YIC, 0, 0, 0, 0, 0, "Copies the selected keyframes from the selected channel(s) to the buffer");
+ uiDefIconBut(block, BUT, B_GRAPHPASTEKEYS, ICON_PASTEDOWN, xco+=XIC,yco,XIC,YIC, 0, 0, 0, 0, 0, "Pastes the keyframes from the buffer");
+ uiBlockEndAlign(block);
+ xco += (XIC + 8);
+
+ /* auto-snap selector */
+ if (sipo->flag & SIPO_DRAWTIME) {
+ uiDefButS(block, MENU, B_REDR,
+ "Auto-Snap Keyframes %t|No Time-Snap %x0|Nearest Second %x2|Nearest Marker %x3",
+ xco,yco,90,YIC, &sipo->autosnap, 0, 1, 0, 0,
+ "Auto-snapping mode for keyframe times when transforming");
+ }
+ else {
+ uiDefButS(block, MENU, B_REDR,
+ "Auto-Snap Keyframes %t|No Time-Snap %x0|Nearest Frame %x2|Nearest Marker %x3",
+ xco,yco,90,YIC, &sipo->autosnap, 0, 1, 0, 0,
+ "Auto-snapping mode for keyframe times when transforming");
+ }
/* always as last */
- UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
+ UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, (int)(ar->v2d.tot.ymax - ar->v2d.tot.ymin));
uiEndBlock(C, block);
uiDrawBlock(C, block);
diff --git a/source/blender/editors/space_ipo/ipo_intern.h b/source/blender/editors/space_ipo/ipo_intern.h
index 61fa095c157..f44f2174462 100644
--- a/source/blender/editors/space_ipo/ipo_intern.h
+++ b/source/blender/editors/space_ipo/ipo_intern.h
@@ -29,19 +29,94 @@
#define ED_IPO_INTERN_H
struct bContext;
+struct wmWindowManager;
struct bAnimContext;
struct SpaceIpo;
struct ARegion;
/* internal exports only */
+/* ***************************************** */
/* ipo_draw.c */
void graph_draw_channel_names(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar);
void graph_draw_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar);
+/* ***************************************** */
/* ipo_header.c */
void graph_header_buttons(const bContext *C, struct ARegion *ar);
+/* ***************************************** */
+/* ipo_select.c */
+
+void GRAPHEDIT_OT_keyframes_deselectall(struct wmOperatorType *ot);
+void GRAPHEDIT_OT_keyframes_borderselect(struct wmOperatorType *ot);
+void GRAPHEDIT_OT_keyframes_columnselect(struct wmOperatorType *ot);
+void GRAPHEDIT_OT_keyframes_clickselect(struct wmOperatorType *ot);
+
+/* defines for left-right select tool */
+enum {
+ GRAPHKEYS_LRSEL_TEST = -1,
+ GRAPHKEYS_LRSEL_NONE,
+ GRAPHKEYS_LRSEL_LEFT,
+ GRAPHKEYS_LRSEL_RIGHT,
+} eGraphKeys_LeftRightSelect_Mode;
+
+/* defines for column-select mode */
+enum {
+ GRAPHKEYS_COLUMNSEL_KEYS = 0,
+ GRAPHKEYS_COLUMNSEL_CFRA,
+ GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN,
+ GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN,
+} eGraphKeys_ColumnSelect_Mode;
+
+/* ***************************************** */
+/* ipo_edit.c */
+
+void GRAPHEDIT_OT_set_previewrange(struct wmOperatorType *ot);
+void GRAPHEDIT_OT_view_all(struct wmOperatorType *ot);
+
+void GRAPHEDIT_OT_keyframes_copy(struct wmOperatorType *ot);
+void GRAPHEDIT_OT_keyframes_paste(struct wmOperatorType *ot);
+
+void GRAPHEDIT_OT_keyframes_delete(struct wmOperatorType *ot);
+void GRAPHEDIT_OT_keyframes_clean(struct wmOperatorType *ot);
+void GRAPHEDIT_OT_keyframes_sample(struct wmOperatorType *ot);
+void GRAPHEDIT_OT_keyframes_smooth(struct wmOperatorType *ot);
+
+void GRAPHEDIT_OT_keyframes_handletype(struct wmOperatorType *ot);
+void GRAPHEDIT_OT_keyframes_interpolation_type(struct wmOperatorType *ot);
+void GRAPHEDIT_OT_keyframes_extrapolation_type(struct wmOperatorType *ot);
+
+void GRAPHEDIT_OT_keyframes_cfrasnap(struct wmOperatorType *ot);
+void GRAPHEDIT_OT_keyframes_snap(struct wmOperatorType *ot);
+void GRAPHEDIT_OT_keyframes_mirror(struct wmOperatorType *ot);
+
+/* defines for snap keyframes
+ * NOTE: keep in sync with eEditKeyframes_Snap (in ED_keyframes_edit.h)
+ */
+enum {
+ GRAPHKEYS_SNAP_CFRA = 1,
+ GRAPHKEYS_SNAP_NEAREST_FRAME,
+ GRAPHKEYS_SNAP_NEAREST_SECOND,
+ GRAPHKEYS_SNAP_NEAREST_MARKER,
+ GRAPHKEYS_SNAP_HORIZONTAL,
+} eGraphKeys_Snap_Mode;
+
+/* defines for mirror keyframes
+ * NOTE: keep in sync with eEditKeyframes_Mirror (in ED_keyframes_edit.h)
+ */
+enum {
+ GRAPHKEYS_MIRROR_CFRA = 1,
+ GRAPHKEYS_MIRROR_YAXIS,
+ GRAPHKEYS_MIRROR_XAXIS,
+ GRAPHKEYS_MIRROR_MARKER,
+} eGraphKeys_Mirror_Mode;
+
+/* ***************************************** */
+/* ipo_ops.c */
+void graphedit_keymap(struct wmWindowManager *wm);
+void graphedit_operatortypes(void);
+
#endif /* ED_IPO_INTERN_H */
diff --git a/source/blender/editors/space_ipo/ipo_ops.c b/source/blender/editors/space_ipo/ipo_ops.c
new file mode 100644
index 00000000000..68ce0997906
--- /dev/null
+++ b/source/blender/editors/space_ipo/ipo_ops.c
@@ -0,0 +1,212 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <math.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_listBase.h"
+#include "DNA_action_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
+#include "DNA_windowmanager_types.h"
+
+#include "BLI_blenlib.h"
+
+#include "BKE_context.h"
+#include "BKE_utildefines.h"
+
+#include "UI_interface.h"
+#include "UI_view2d.h"
+
+#include "ED_screen.h"
+
+#include "BIF_transform.h"
+
+#include "ipo_intern.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+/* ************************** view-based operators **********************************/
+// XXX this probably shouldn't be here..
+
+/* Toggle Handles ----------------------------------------------------------------- */
+
+static int view_toggle_handles_exec (bContext *C, wmOperator *op)
+{
+ SpaceIpo *sipo= (SpaceIpo *)CTX_wm_space_data(C);
+ ARegion *ar= CTX_wm_region(C);
+
+ if (sipo == NULL)
+ return OPERATOR_CANCELLED;
+
+ /* toggle flag to hide handles */
+ sipo->flag ^= SIPO_NOHANDLES;
+
+ /* request refresh of keys area */
+ ED_region_tag_redraw(ar);
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_view_togglehandles (wmOperatorType *ot)
+{
+ /* identification */
+ ot->name= "Show/Hide All Handles";
+ ot->idname= "GRAPHEDIT_OT_view_toggle_handles";
+
+ /* callbacks */
+ ot->exec= view_toggle_handles_exec;
+ ot->poll= ED_operator_areaactive;
+}
+
+/* ************************** registration - operator types **********************************/
+
+void graphedit_operatortypes(void)
+{
+ /* view */
+ WM_operatortype_append(GRAPHEDIT_OT_view_togglehandles);
+ //WM_operatortype_append(GRAPHEDIT_OT_set_previewrange);
+ //WM_operatortype_append(GRAPHEDIT_OT_view_all);
+
+ /* keyframes */
+ /* selection */
+ WM_operatortype_append(GRAPHEDIT_OT_keyframes_clickselect);
+ WM_operatortype_append(GRAPHEDIT_OT_keyframes_deselectall);
+ WM_operatortype_append(GRAPHEDIT_OT_keyframes_borderselect);
+ WM_operatortype_append(GRAPHEDIT_OT_keyframes_columnselect);
+
+ /* editing */
+ WM_operatortype_append(GRAPHEDIT_OT_keyframes_snap);
+ WM_operatortype_append(GRAPHEDIT_OT_keyframes_mirror);
+ WM_operatortype_append(GRAPHEDIT_OT_keyframes_cfrasnap);
+ WM_operatortype_append(GRAPHEDIT_OT_keyframes_handletype);
+ WM_operatortype_append(GRAPHEDIT_OT_keyframes_interpolation_type);
+ WM_operatortype_append(GRAPHEDIT_OT_keyframes_extrapolation_type);
+ WM_operatortype_append(GRAPHEDIT_OT_keyframes_sample);
+ WM_operatortype_append(GRAPHEDIT_OT_keyframes_smooth);
+ WM_operatortype_append(GRAPHEDIT_OT_keyframes_clean);
+ WM_operatortype_append(GRAPHEDIT_OT_keyframes_delete);
+#if 0 // XXX code to be sanitied for new system
+ WM_operatortype_append(GRAPHEDIT_OT_keyframes_copy);
+ WM_operatortype_append(GRAPHEDIT_OT_keyframes_paste);
+#endif // XXX code to be sanitied for new system
+}
+
+/* ************************** registration - keymaps **********************************/
+
+static void graphedit_keymap_keyframes (wmWindowManager *wm, ListBase *keymap)
+{
+ /* view */
+ WM_keymap_add_item(keymap, "GRAPHEDIT_OT_view_toggle_handles", HKEY, KM_PRESS, KM_CTRL, 0);
+
+ /* iposelect.c - selection tools */
+ /* click-select */
+ // TODO: column to alt, left-right to ctrl (for select-linked consistency)
+ WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, 0, 0);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "column_select", 1);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend_select", 1);
+ RNA_enum_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "left_right", GRAPHKEYS_LRSEL_TEST);
+
+ /* deselect all */
+ WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_deselectall", AKEY, KM_PRESS, 0, 0);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_deselectall", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "invert", 1);
+
+ /* borderselect */
+ WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_borderselect", BKEY, KM_PRESS, 0, 0);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_borderselect", BKEY, KM_PRESS, KM_ALT, 0)->ptr, "axis_range", 1);
+
+ /* column select */
+ // XXX KKEY would be nice to keep for 'keyframe' lines
+ RNA_enum_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_columnselect", KKEY, KM_PRESS, 0, 0)->ptr, "mode", GRAPHKEYS_COLUMNSEL_KEYS);
+ RNA_enum_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_columnselect", KKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", GRAPHKEYS_COLUMNSEL_CFRA);
+ RNA_enum_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_columnselect", KKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN);
+ RNA_enum_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_columnselect", KKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN);
+
+
+ /* ipo_edit.c */
+ /* snap - current frame to selected keys */
+ WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_cfrasnap", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+
+ /* menu + single-step transform */
+ WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_mirror", MKEY, KM_PRESS, KM_SHIFT, 0);
+
+ WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_handletype", HKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_interpolation_type", TKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_extrapolation_type", EKEY, KM_PRESS, KM_SHIFT, 0);
+
+
+ /* destructive */
+ WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clean", OKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_sample", OKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_smooth", OKEY, KM_PRESS, KM_ALT, 0);
+
+ WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_delete", XKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_delete", DELKEY, KM_PRESS, 0, 0);
+
+#if 0 // XXX code to be sanitied for new system
+ /* copy/paste */
+ WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_copy", CKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_paste", VKEY, KM_PRESS, KM_CTRL, 0);
+#endif // XXX code to be sanitied for new system
+
+ /* auto-set range */
+ //WM_keymap_add_item(keymap, "GRAPHEDIT_OT_set_previewrange", PKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
+ //WM_keymap_add_item(keymap, "GRAPHEDIT_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
+
+ /* generates event, needs to be after select to work */
+ WM_keymap_add_item(keymap, "WM_OT_tweak_gesture", SELECTMOUSE, KM_PRESS, 0, 0);
+
+ /* transform system */
+ transform_keymap_for_space(wm, keymap, SPACE_IPO);
+}
+
+/* --------------- */
+
+void graphedit_keymap(wmWindowManager *wm)
+{
+ ListBase *keymap;
+
+ /* channels */
+ /* Channels are not directly handled by the Graph Editor module, but are inherited from the Animation module.
+ * All the relevant operations, keymaps, drawing, etc. can therefore all be found in that module instead, as these
+ * are all used for the Graph Editor too.
+ */
+
+ /* keyframes */
+ keymap= WM_keymap_listbase(wm, "GraphEdit Keys", SPACE_IPO, 0);
+ graphedit_keymap_keyframes(wm, keymap);
+}
+
diff --git a/source/blender/editors/space_ipo/ipo_select.c b/source/blender/editors/space_ipo/ipo_select.c
new file mode 100644
index 00000000000..fff40f1c739
--- /dev/null
+++ b/source/blender/editors/space_ipo/ipo_select.c
@@ -0,0 +1,894 @@
+/**
+ * $Id: editaction.c 17746 2008-12-08 11:19:44Z aligorith $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation
+ *
+ * Contributor(s): Joshua Leung
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <float.h>
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+
+#include "DNA_anim_types.h"
+#include "DNA_action_types.h"
+#include "DNA_armature_types.h"
+#include "DNA_camera_types.h"
+#include "DNA_curve_types.h"
+#include "DNA_object_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_space_types.h"
+#include "DNA_constraint_types.h"
+#include "DNA_key_types.h"
+#include "DNA_lamp_types.h"
+#include "DNA_material_types.h"
+#include "DNA_userdef_types.h"
+#include "DNA_gpencil_types.h"
+#include "DNA_windowmanager_types.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "BKE_action.h"
+#include "BKE_depsgraph.h"
+#include "BKE_fcurve.h"
+#include "BKE_key.h"
+#include "BKE_material.h"
+#include "BKE_object.h"
+#include "BKE_context.h"
+#include "BKE_utildefines.h"
+
+#include "UI_view2d.h"
+
+#include "ED_anim_api.h"
+#include "ED_keyframing.h"
+#include "ED_keyframes_draw.h"
+#include "ED_keyframes_edit.h"
+#include "ED_screen.h"
+#include "ED_space_api.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "ipo_intern.h"
+
+
+/* ************************************************************************** */
+/* KEYFRAMES STUFF */
+
+/* ******************** Deselect All Operator ***************************** */
+/* This operator works in one of three ways:
+ * 1) (de)select all (AKEY) - test if select all or deselect all
+ * 2) invert all (CTRL-IKEY) - invert selection of all keyframes
+ * 3) (de)select all - no testing is done; only for use internal tools as normal function...
+ */
+
+/* Deselects keyframes in the action editor
+ * - This is called by the deselect all operator, as well as other ones!
+ *
+ * - test: check if select or deselect all
+ * - sel: how to select keyframes
+ * 0 = deselect
+ * 1 = select
+ * 2 = invert
+ */
+static void deselect_graph_keys (bAnimContext *ac, short test, short sel)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ BeztEditData bed;
+ BeztEditFunc test_cb, sel_cb;
+
+ /* determine type-based settings */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+
+ /* filter data */
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* init BezTriple looping data */
+ memset(&bed, 0, sizeof(BeztEditData));
+ test_cb= ANIM_editkeyframes_ok(BEZT_OK_SELECTED);
+
+ /* See if we should be selecting or deselecting */
+ // xxx check for curves too
+ if (test) {
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ if (ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, test_cb, NULL)) {
+ sel= SELECT_SUBTRACT;
+ break;
+ }
+ }
+ }
+
+ /* convert sel to selectmode, and use that to get editor */
+ sel_cb= ANIM_editkeyframes_select(sel);
+
+ /* Now set the flags */
+ // xxx check for curves too
+ for (ale= anim_data.first; ale; ale= ale->next)
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, sel_cb, NULL);
+
+ /* Cleanup */
+ BLI_freelistN(&anim_data);
+}
+
+/* ------------------- */
+
+static int graphkeys_deselectall_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* 'standard' behaviour - check if selected, then apply relevant selection */
+ if (RNA_boolean_get(op->ptr, "invert"))
+ deselect_graph_keys(&ac, 0, SELECT_INVERT);
+ else
+ deselect_graph_keys(&ac, 1, SELECT_ADD);
+
+ /* set notifier tha things have changed */
+ ED_area_tag_redraw(CTX_wm_area(C)); // FIXME... should be updating 'keyframes' data context or so instead!
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_keyframes_deselectall (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Select All";
+ ot->idname= "GRAPHEDIT_OT_keyframes_deselectall";
+
+ /* api callbacks */
+ ot->exec= graphkeys_deselectall_exec;
+ ot->poll= ED_operator_areaactive;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+
+ /* props */
+ RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
+}
+
+/* ******************** Border Select Operator **************************** */
+/* This operator currently works in one of three ways:
+ * -> BKEY - 1) all keyframes within region are selected (validation with BEZT_OK_REGION)
+ * -> ALT-BKEY - depending on which axis of the region was larger...
+ * -> 2) x-axis, so select all frames within frame range (validation with BEZT_OK_FRAMERANGE)
+ * -> 3) y-axis, so select all frames within channels that region included (validation with BEZT_OK_VALUERANGE)
+ */
+
+/* Borderselect only selects keyframes now, as overshooting handles often get caught too,
+ * which means that they may be inadvertantly moved as well.
+ * Also, for convenience, handles should get same status as keyframe (if it was within bounds)
+ */
+static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, short selectmode)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ BeztEditData bed;
+ BeztEditFunc ok_cb, select_cb;
+ View2D *v2d= &ac->ar->v2d;
+ rctf rectf;
+
+ /* convert mouse coordinates to frame ranges and channel coordinates corrected for view pan/zoom */
+ UI_view2d_region_to_view(v2d, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
+ UI_view2d_region_to_view(v2d, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
+
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* get beztriple editing/validation funcs */
+ select_cb= ANIM_editkeyframes_select(selectmode);
+ ok_cb= ANIM_editkeyframes_ok(mode);
+
+ /* init editing data */
+ memset(&bed, 0, sizeof(BeztEditData));
+ bed.data= &rectf;
+
+ /* loop over data, doing border select */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ Object *nob= ANIM_nla_mapping_get(ac, ale);
+
+ /* set horizontal range (if applicable) */
+ if (mode != BEZT_OK_VALUERANGE) {
+ /* if channel is mapped in NLA, apply correction */
+ if (nob) {
+ bed.f1= get_action_frame(nob, rectf.xmin);
+ bed.f2= get_action_frame(nob, rectf.xmax);
+ }
+ else {
+ bed.f1= rectf.xmin;
+ bed.f2= rectf.xmax;
+ }
+ }
+ else {
+ bed.f1= rectf.ymin;
+ bed.f2= rectf.ymax;
+ }
+
+ /* select keyframes that are in the appropriate places */
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
+ }
+
+ /* cleanup */
+ BLI_freelistN(&anim_data);
+}
+
+/* ------------------- */
+
+static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+ rcti rect;
+ short mode=0, selectmode=0;
+ int event;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* get settings from operator */
+ rect.xmin= RNA_int_get(op->ptr, "xmin");
+ rect.ymin= RNA_int_get(op->ptr, "ymin");
+ rect.xmax= RNA_int_get(op->ptr, "xmax");
+ rect.ymax= RNA_int_get(op->ptr, "ymax");
+
+ event= RNA_int_get(op->ptr, "event_type");
+ if (event == LEFTMOUSE) // FIXME... hardcoded
+ selectmode = SELECT_ADD;
+ else
+ selectmode = SELECT_SUBTRACT;
+
+ /* selection 'mode' depends on whether borderselect region only matters on one axis */
+ if (RNA_boolean_get(op->ptr, "axis_range")) {
+ /* mode depends on which axis of the range is larger to determine which axis to use
+ * - checking this in region-space is fine, as it's fundamentally still going to be a different rect size
+ * - the frame-range select option is favoured over the channel one (x over y), as frame-range one is often
+ * used for tweaking timing when "blocking", while channels is not that useful...
+ */
+ if ((rect.xmax - rect.xmin) >= (rect.ymax - rect.ymin))
+ mode= BEZT_OK_FRAMERANGE;
+ else
+ mode= BEZT_OK_VALUERANGE;
+ }
+ else
+ mode= BEZT_OK_REGION;
+
+ /* apply borderselect action */
+ borderselect_graphkeys(&ac, rect, mode, selectmode);
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_keyframes_borderselect(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Border Select";
+ ot->idname= "GRAPHEDIT_OT_keyframes_borderselect";
+
+ /* api callbacks */
+ ot->invoke= WM_border_select_invoke;
+ ot->exec= graphkeys_borderselect_exec;
+ ot->modal= WM_border_select_modal;
+
+ ot->poll= ED_operator_areaactive;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+
+ /* rna */
+ RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
+
+ RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
+}
+
+/* ******************** Column Select Operator **************************** */
+/* This operator works in one of four ways:
+ * - 1) select all keyframes in the same frame as a selected one (KKEY)
+ * - 2) select all keyframes in the same frame as the current frame marker (CTRL-KKEY)
+ * - 3) select all keyframes in the same frame as a selected markers (SHIFT-KKEY)
+ * - 4) select all keyframes that occur between selected markers (ALT-KKEY)
+ */
+
+/* defines for column-select mode */
+static EnumPropertyItem prop_column_select_types[] = {
+ {GRAPHKEYS_COLUMNSEL_KEYS, "KEYS", "On Selected Keyframes", ""},
+ {GRAPHKEYS_COLUMNSEL_CFRA, "CFRA", "On Current Frame", ""},
+ {GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN, "MARKERS_COLUMN", "On Selected Markers", ""},
+ {GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN, "MARKERS_BETWEEN", "Between Min/Max Selected Markers", ""},
+ {0, NULL, NULL, NULL}
+};
+
+/* ------------------- */
+
+/* Selects all visible keyframes between the specified markers */
+static void markers_selectkeys_between (bAnimContext *ac)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ BeztEditFunc select_cb;
+ BeztEditData bed;
+ float min, max;
+
+ /* get extreme markers */
+ //get_minmax_markers(1, &min, &max); // FIXME... add back markers api!
+ min= (float)ac->scene->r.sfra; // xxx temp code
+ max= (float)ac->scene->r.efra; // xxx temp code
+
+ if (min==max) return;
+ min -= 0.5f;
+ max += 0.5f;
+
+ /* get editing funcs + data */
+ select_cb= ANIM_editkeyframes_select(SELECT_ADD);
+ memset(&bed, 0, sizeof(BeztEditData));
+ bed.f1= min;
+ bed.f2= max;
+
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* select keys in-between */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ Object *nob= ANIM_nla_mapping_get(ac, ale);
+
+ if (nob) {
+ ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 0, 1);
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, select_cb, NULL);
+ ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 1, 1);
+ }
+ else {
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, select_cb, NULL);
+ }
+ }
+
+ /* Cleanup */
+ BLI_freelistN(&anim_data);
+}
+
+
+/* helper callback for columnselect_graph_keys() -> populate list CfraElems with frame numbers from selected beztriples */
+// TODO: if some other code somewhere needs this, it'll be time to port this over to keyframes_edit.c!!!
+static short bezt_to_cfraelem(BeztEditData *bed, BezTriple *bezt)
+{
+ /* only if selected */
+ if (bezt->f2 & SELECT) {
+ CfraElem *ce= MEM_callocN(sizeof(CfraElem), "cfraElem");
+ BLI_addtail(&bed->list, ce);
+
+ ce->cfra= bezt->vec[1][0];
+ }
+
+ return 0;
+}
+
+/* Selects all visible keyframes in the same frames as the specified elements */
+static void columnselect_graph_keys (bAnimContext *ac, short mode)
+{
+ ListBase anim_data= {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ Scene *scene= ac->scene;
+ CfraElem *ce;
+ BeztEditFunc select_cb, ok_cb;
+ BeztEditData bed;
+
+ /* initialise keyframe editing data */
+ memset(&bed, 0, sizeof(BeztEditData));
+
+ /* build list of columns */
+ switch (mode) {
+ case GRAPHKEYS_COLUMNSEL_KEYS: /* list of selected keys */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ for (ale= anim_data.first; ale; ale= ale->next)
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_to_cfraelem, NULL);
+
+ BLI_freelistN(&anim_data);
+ break;
+
+ case GRAPHKEYS_COLUMNSEL_CFRA: /* current frame */
+ /* make a single CfraElem for storing this */
+ ce= MEM_callocN(sizeof(CfraElem), "cfraElem");
+ BLI_addtail(&bed.list, ce);
+
+ ce->cfra= (float)CFRA;
+ break;
+
+ case GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN: /* list of selected markers */
+ // FIXME: markers api needs to be improved for this first!
+ //make_marker_cfra_list(&elems, 1);
+ return; // XXX currently, this does nothing!
+ break;
+
+ default: /* invalid option */
+ return;
+ }
+
+ /* set up BezTriple edit callbacks */
+ select_cb= ANIM_editkeyframes_select(SELECT_ADD);
+ ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAME);
+
+ /* loop through all of the keys and select additional keyframes
+ * based on the keys found to be selected above
+ */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ Object *nob= ANIM_nla_mapping_get(ac, ale);
+
+ /* loop over cfraelems (stored in the BeztEditData->list)
+ * - we need to do this here, as we can apply fewer NLA-mapping conversions
+ */
+ for (ce= bed.list.first; ce; ce= ce->next) {
+ /* set frame for validation callback to refer to */
+ if (nob)
+ bed.f1= get_action_frame(nob, ce->cfra);
+ else
+ bed.f1= ce->cfra;
+
+ /* select elements with frame number matching cfraelem */
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
+ }
+ }
+
+ /* free elements */
+ BLI_freelistN(&bed.list);
+ BLI_freelistN(&anim_data);
+}
+
+/* ------------------- */
+
+static int graphkeys_columnselect_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+ short mode;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* action to take depends on the mode */
+ mode= RNA_enum_get(op->ptr, "mode");
+
+ if (mode == GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN)
+ markers_selectkeys_between(&ac);
+ else
+ columnselect_graph_keys(&ac, mode);
+
+ /* set notifier tha things have changed */
+ ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_SELECT);
+
+ return OPERATOR_FINISHED;
+}
+
+void GRAPHEDIT_OT_keyframes_columnselect (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Select All";
+ ot->idname= "GRAPHEDIT_OT_keyframes_columnselect";
+
+ /* api callbacks */
+ ot->exec= graphkeys_columnselect_exec;
+ ot->poll= ED_operator_areaactive;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+
+ /* props */
+ RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
+}
+
+/* ******************** Mouse-Click Select Operator *********************** */
+/* This operator works in one of three ways:
+ * - 1) keyframe under mouse - no special modifiers
+ * - 2) all keyframes on the same side of current frame indicator as mouse - ALT modifier
+ * - 3) column select all keyframes in frame under mouse - CTRL modifier
+ *
+ * In addition to these basic options, the SHIFT modifier can be used to toggle the
+ * selection mode between replacing the selection (without) and inverting the selection (with).
+ */
+
+/* defines for left-right select tool */
+static EnumPropertyItem prop_leftright_select_types[] = {
+ {GRAPHKEYS_LRSEL_TEST, "CHECK", "Check if Select Left or Right", ""},
+ {GRAPHKEYS_LRSEL_NONE, "OFF", "Don't select", ""},
+ {GRAPHKEYS_LRSEL_LEFT, "LEFT", "Before current frame", ""},
+ {GRAPHKEYS_LRSEL_RIGHT, "RIGHT", "After current frame", ""},
+ {0, NULL, NULL, NULL}
+};
+
+/* ------------------- */
+
+enum {
+ NEAREST_HANDLE_LEFT = 0,
+ NEAREST_HANDLE_KEY,
+ NEAREST_HANDLE_RIGHT
+} eHandleIndex;
+
+/* Find the vertex (either handle (0/2) or the keyframe (1)) that is nearest to the mouse cursor (in area coordinates)
+ * Selected verts get a disadvantage, to make it easier to select handles behind.
+ * Returns eHandleIndex
+ */
+static short findnearest_fcurve_vert (bAnimContext *ac, int mval[2], FCurve **fcurve, BezTriple **bezt)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
+ View2D *v2d= &ac->ar->v2d;
+ int hpoint=0, sco[3][2];
+ int dist= 100, temp, i;
+
+ /* clear pointers first */
+ *fcurve= 0;
+ *bezt= 0;
+
+ /* get curves to search through */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ FCurve *fcu= (FCurve *)ale->key_data;
+
+ /* try to progressively get closer to the right point... */
+ if (fcu->bezt) {
+ BezTriple *bezt1=fcu->bezt, *prevbezt=NULL;
+
+ for (i=0; i < fcu->totvert; i++, prevbezt=bezt1, bezt1++) {
+ /* convert beztriple points to screen-space */
+ UI_view2d_to_region_no_clip(v2d, bezt1->vec[0][0], bezt1->vec[0][1], &sco[0][0], &sco[0][1]);
+ UI_view2d_to_region_no_clip(v2d, bezt1->vec[1][0], bezt1->vec[1][1], &sco[1][0], &sco[1][1]);
+ UI_view2d_to_region_no_clip(v2d, bezt1->vec[2][0], bezt1->vec[2][1], &sco[2][0], &sco[2][1]);
+
+ /* keyframe - do select? */
+ temp= abs(mval[0] - sco[1][0]) + abs(mval[1] - sco[1][1]);
+
+ if (bezt1->f2 & SELECT)
+ temp += 5;
+
+ if (temp < dist) {
+ hpoint= NEAREST_HANDLE_KEY;
+ *bezt= bezt1;
+ dist= temp;
+ *fcurve= fcu;
+ }
+
+ /* handles - only do them if they're visible */
+ if ((sipo->flag & SIPO_NOHANDLES)==0) {
+ /* first handle only visible if previous segment had handles */
+ if ( (!prevbezt && (bezt1->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) )
+ {
+ temp= -3 + abs(mval[0] - sco[0][0]) + abs(mval[1] - sco[0][1]);
+ if (bezt1->f1 & SELECT)
+ temp += 5;
+
+ if (temp < dist) {
+ hpoint= NEAREST_HANDLE_LEFT;
+ *bezt= bezt1;
+ dist= temp;
+ *fcurve= fcu;
+ }
+ }
+
+ /* second handle only visible if this segment is bezier */
+ if (bezt1->ipo == BEZT_IPO_BEZ)
+ {
+ temp= abs(mval[0] - sco[2][0]) + abs(mval[1] - sco[2][1]);
+ if (bezt1->f3 & SELECT)
+ temp += 5;
+
+ if (temp < dist) {
+ hpoint= NEAREST_HANDLE_RIGHT;
+ *bezt=bezt1;
+ dist= temp;
+ *fcurve= fcu;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* free channels */
+ BLI_freelistN(&anim_data);
+
+ /* return handle */
+ return hpoint;
+}
+
+/* option 1) select keyframe directly under mouse */
+static void mouse_graph_keys (bAnimContext *ac, int mval[], short selectmode)
+{
+ FCurve *fcu;
+ BezTriple *bezt;
+ short handle;
+
+ /* find the beztriple that we're selecting, and the handle that was clicked on */
+ handle= findnearest_fcurve_vert(ac, mval, &fcu, &bezt);
+
+ /* check if anything to select */
+ if (fcu == NULL)
+ return;
+
+ /* deselect all other curves? */
+ if (selectmode == SELECT_REPLACE) {
+ deselect_graph_keys(ac, 0, SELECT_SUBTRACT); // XXX this should be curves, not keys
+ selectmode= SELECT_ADD;
+ }
+
+ /* select or deselect? */
+ if (selectmode == SELECT_ADD)
+ fcu->flag |= (FCURVE_ACTIVE|FCURVE_SELECTED);
+ else if (selectmode == SELECT_INVERT)
+ fcu->flag ^= (FCURVE_ACTIVE|FCURVE_SELECTED);
+
+ /* if we're selecting points too */
+ if ( ((fcu->flag & FCURVE_PROTECTED)==0) /*|| (curvesonly == 0) */) {
+ /* only if there's keyframe */
+ if (bezt) {
+ /* depends on selection mode */
+ if (selectmode == SELECT_INVERT) {
+ /* keyframe - invert select of all */
+ if (handle == NEAREST_HANDLE_KEY) {
+ if (BEZSELECTED(bezt)) {
+ BEZ_DESEL(bezt);
+ }
+ else {
+ BEZ_SEL(bezt);
+ }
+ }
+
+ /* handles - toggle selection of relevant handle */
+ else if (handle == NEAREST_HANDLE_LEFT) {
+ /* toggle selection */
+ bezt->f1 ^= SELECT;
+ }
+ else {
+ /* toggle selection */
+ bezt->f3 ^= SELECT;
+ }
+ }
+ else {
+ /* deselect all other keyframes? */
+ deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
+
+ /* if the keyframe was clicked on, select all verts of given beztriple */
+ if (handle == NEAREST_HANDLE_KEY) {
+ BEZ_SEL(bezt);
+ }
+ /* otherwise, select the handle that applied */
+ else if (handle == NEAREST_HANDLE_LEFT)
+ bezt->f1 |= SELECT;
+ else
+ bezt->f3 |= SELECT;
+ }
+ }
+ }
+}
+
+/* Option 2) Selects all the keyframes on either side of the current frame (depends on which side the mouse is on) */
+static void graphkeys_select_leftright (bAnimContext *ac, short leftright, short select_mode)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ BeztEditFunc ok_cb, select_cb;
+ BeztEditData bed;
+ Scene *scene= ac->scene;
+
+ /* if select mode is replace, deselect all keyframes first */
+ if (select_mode==SELECT_REPLACE) {
+ select_mode=SELECT_ADD;
+ deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
+ }
+
+ /* set callbacks and editing data */
+ ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
+ select_cb= ANIM_editkeyframes_select(select_mode);
+
+ memset(&bed, 0, sizeof(BeztEditFunc));
+ if (leftright == GRAPHKEYS_LRSEL_LEFT) {
+ bed.f1 = -MAXFRAMEF;
+ bed.f2 = (float)(CFRA + 0.1f);
+ }
+ else {
+ bed.f1 = (float)(CFRA - 0.1f);
+ bed.f2 = MAXFRAMEF;
+ }
+
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* select keys on the side where most data occurs */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ Object *nob= ANIM_nla_mapping_get(ac, ale);
+
+ if (nob) {
+ ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 0, 1);
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
+ ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 1, 1);
+ }
+ else
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
+ }
+
+ /* Cleanup */
+ BLI_freelistN(&anim_data);
+}
+
+/* Option 3) Selects all visible keyframes in the same frame as the mouse click */
+static void mouse_columnselect_graph_keys (bAnimContext *ac, float selx)
+{
+ ListBase anim_data= {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ BeztEditFunc select_cb, ok_cb;
+ BeztEditData bed;
+
+ /* initialise keyframe editing data */
+ memset(&bed, 0, sizeof(BeztEditData));
+
+ /* set up BezTriple edit callbacks */
+ select_cb= ANIM_editkeyframes_select(SELECT_ADD);
+ ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAME);
+
+ /* loop through all of the keys and select additional keyframes
+ * based on the keys found to be selected above
+ */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ Object *nob= ANIM_nla_mapping_get(ac, ale);
+
+ /* set frame for validation callback to refer to */
+ // XXX have a more sensitive range?
+ if (nob)
+ bed.f1= get_action_frame(nob, selx);
+ else
+ bed.f1= selx;
+
+ /* select elements with frame number matching cfra */
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
+ }
+
+ /* free elements */
+ BLI_freelistN(&bed.list);
+ BLI_freelistN(&anim_data);
+}
+
+/* ------------------- */
+
+/* handle clicking */
+static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ bAnimContext ac;
+ Scene *scene;
+ ARegion *ar;
+ View2D *v2d;
+ short selectmode;
+ int mval[2];
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* get useful pointers from animation context data */
+ scene= ac.scene;
+ ar= ac.ar;
+ v2d= &ar->v2d;
+
+ /* get mouse coordinates (in region coordinates) */
+ mval[0]= (event->x - ar->winrct.xmin);
+ mval[1]= (event->y - ar->winrct.ymin);
+
+ /* select mode is either replace (deselect all, then add) or add/extend */
+ // XXX this is currently only available for normal select only
+ if (RNA_boolean_get(op->ptr, "extend_select"))
+ selectmode= SELECT_INVERT;
+ else
+ selectmode= SELECT_REPLACE;
+
+ /* figure out action to take */
+ if (RNA_enum_get(op->ptr, "left_right")) {
+ /* select all keys on same side of current frame as mouse */
+ float x;
+
+ UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, NULL);
+ if (x < CFRA)
+ RNA_int_set(op->ptr, "left_right", GRAPHKEYS_LRSEL_LEFT);
+ else
+ RNA_int_set(op->ptr, "left_right", GRAPHKEYS_LRSEL_RIGHT);
+
+ graphkeys_select_leftright(&ac, RNA_enum_get(op->ptr, "left_right"), selectmode);
+ }
+ else if (RNA_boolean_get(op->ptr, "column_select")) {
+ /* select all the keyframes that occur on the same frame as where the mouse clicked */
+ float x;
+
+ /* figure out where (the frame) the mouse clicked, and set all keyframes in that frame */
+ UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, NULL);
+ mouse_columnselect_graph_keys(&ac, x);
+ }
+ else {
+ /* select keyframe under mouse */
+ mouse_graph_keys(&ac, mval, selectmode); // xxx curves only should become an arg
+ // XXX activate transform...
+ }
+
+ /* set notifier tha things have changed */
+ ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_BOTH);
+
+ /* for tweak grab to work */
+ return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
+}
+
+void GRAPHEDIT_OT_keyframes_clickselect (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Mouse Select Keys";
+ ot->idname= "GRAPHEDIT_OT_keyframes_clickselect";
+
+ /* api callbacks */
+ ot->invoke= graphkeys_clickselect_invoke;
+ ot->poll= ED_operator_areaactive;
+
+ /* id-props */
+ // XXX should we make this into separate operators?
+ RNA_def_enum(ot->srna, "left_right", NULL /* XXX prop_graphkeys_clickselect_items */, 0, "Left Right", ""); // ALTKEY
+ RNA_def_boolean(ot->srna, "extend_select", 0, "Extend Select", ""); // SHIFTKEY
+ RNA_def_boolean(ot->srna, "column_select", 0, "Column Select", ""); // CTRLKEY
+}
+
+/* ************************************************************************** */
diff --git a/source/blender/editors/space_ipo/space_ipo.c b/source/blender/editors/space_ipo/space_ipo.c
index 6ee3af04594..387304bb02c 100644
--- a/source/blender/editors/space_ipo/space_ipo.c
+++ b/source/blender/editors/space_ipo/space_ipo.c
@@ -132,8 +132,11 @@ static void graph_free(SpaceLink *sl)
/* spacetype; init callback */
static void graph_init(struct wmWindowManager *wm, ScrArea *sa)
{
- //SpaceIpo *si= (SpaceIpo *)sa->spacedata.first;
+ SpaceIpo *sipo= (SpaceIpo *)sa->spacedata.first;
+ /* init dopesheet data if non-existant (i.e. for old files) */
+ if (sipo->ads == NULL)
+ sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
}
static SpaceLink *graph_duplicate(SpaceLink *sl)
@@ -155,7 +158,7 @@ static void graph_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_listbase(wm, "Ipo", SPACE_IPO, 0); /* XXX weak? */
+ keymap= WM_keymap_listbase(wm, "GraphEdit Keys", SPACE_IPO, 0); /* XXX weak? */
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -211,14 +214,6 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar)
UI_view2d_scrollers_free(scrollers);
}
-void graph_operatortypes(void)
-{
-}
-
-void graph_keymap(struct wmWindowManager *wm)
-{
-}
-
static void graph_channel_area_init(wmWindowManager *wm, ARegion *ar)
{
ListBase *keymap;
@@ -287,7 +282,7 @@ static void graph_header_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_restore(C);
}
-static void graph_main_area_listener(ARegion *ar, wmNotifier *wmn)
+static void graph_region_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
switch(wmn->category) {
@@ -304,10 +299,15 @@ static void graph_main_area_listener(ARegion *ar, wmNotifier *wmn)
switch(wmn->data) {
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
+ case ND_KEYS:
ED_region_tag_redraw(ar);
break;
}
break;
+ default:
+ if(wmn->data==ND_KEYS)
+ ED_region_tag_redraw(ar);
+
}
}
@@ -375,8 +375,8 @@ void ED_spacetype_ipo(void)
st->free= graph_free;
st->init= graph_init;
st->duplicate= graph_duplicate;
- st->operatortypes= graph_operatortypes;
- st->keymap= graph_keymap;
+ st->operatortypes= graphedit_operatortypes;
+ st->keymap= graphedit_keymap;
st->listener= graph_listener;
st->refresh= graph_refresh;
@@ -385,8 +385,8 @@ void ED_spacetype_ipo(void)
art->regionid = RGN_TYPE_WINDOW;
art->init= graph_main_area_init;
art->draw= graph_main_area_draw;
- art->listener= graph_main_area_listener;
- art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_ANIMATION;
+ art->listener= graph_region_listener;
+ art->keymapflag= ED_KEYMAP_VIEW2D/*|ED_KEYMAP_MARKERS*/|ED_KEYMAP_ANIMATION|ED_KEYMAP_FRAMES;
BLI_addhead(&st->regiontypes, art);
@@ -395,7 +395,7 @@ void ED_spacetype_ipo(void)
art->regionid = RGN_TYPE_HEADER;
art->minsizey= HEADERY;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
-
+ art->listener= graph_region_listener;
art->init= graph_header_area_init;
art->draw= graph_header_area_draw;
@@ -406,7 +406,7 @@ void ED_spacetype_ipo(void)
art->regionid = RGN_TYPE_CHANNELS;
art->minsizex= 200;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
-
+ art->listener= graph_region_listener;
art->init= graph_channel_area_init;
art->draw= graph_channel_area_draw;
diff --git a/source/blender/editors/space_nla/nla_header.c b/source/blender/editors/space_nla/nla_header.c
index ef850df1c59..cee940ca428 100644
--- a/source/blender/editors/space_nla/nla_header.c
+++ b/source/blender/editors/space_nla/nla_header.c
@@ -65,13 +65,13 @@ static void do_viewmenu(bContext *C, void *arg, int event)
}
-static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index dd9487c2113..a1a7a32bf28 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -67,33 +67,14 @@
#include "CMP_node.h"
#include "SHD_node.h"
-/* #include "BDR_gpencil.h" XXX */
-
#include "BIF_gl.h"
#include "BIF_glutil.h"
-/*
-#include "BIF_drawgpencil.h"
-#include "BIF_interface.h"
-#include "BIF_interface_icons.h"
-#include "BIF_language.h"
-#include "BIF_mywindow.h"
-#include "BIF_previewrender.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-*/
-
-/* XXX
-#include "BSE_drawipo.h"
-#include "BSE_node.h"
-#include "BSE_view.h"
-*/
-
#include "BMF_Api.h"
#include "MEM_guardedalloc.h"
+#include "ED_node.h"
#include "ED_space_api.h"
#include "ED_screen.h"
#include "ED_types.h"
@@ -112,11 +93,6 @@
#include "RE_pipeline.h"
#include "IMB_imbuf_types.h"
-/*#include "blendef.h"
-#include "butspace.h"*/
-/*#include "interface.h"*/ /* urm... for rasterpos_safe, roundbox */
-/*#include "mydevice.h"*/
-
#include "node_intern.h"
extern void autocomplete_uv(char *str, void *arg_v);
@@ -234,7 +210,7 @@ static int node_buts_value(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *
if(block) {
bNodeSocket *sock= node->outputs.first; /* first socket stores value */
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "",
+ uiDefButF(block, NUM, B_NODE_EXEC, "",
(short)butr->xmin, (short)butr->ymin, butr->xmax-butr->xmin, 20,
sock->ns.vec, sock->ns.min, sock->ns.max, 10, 2, "");
@@ -250,10 +226,10 @@ static int node_buts_rgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *bu
/* enforce square box drawing */
uiBlockSetEmboss(block, UI_EMBOSSP);
- uiDefButF(block, HSVCUBE, B_NODE_EXEC+node->nr, "",
+ uiDefButF(block, HSVCUBE, B_NODE_EXEC, "",
(short)butr->xmin, (short)butr->ymin, butr->xmax-butr->xmin, 12,
sock->ns.vec, 0.0f, 1.0f, 3, 0, "");
- uiDefButF(block, HSVCUBE, B_NODE_EXEC+node->nr, "",
+ uiDefButF(block, HSVCUBE, B_NODE_EXEC, "",
(short)butr->xmin, (short)butr->ymin+15, butr->xmax-butr->xmin, butr->ymax-butr->ymin -15 -15,
sock->ns.vec, 0.0f, 1.0f, 2, 0, "");
uiDefButF(block, COL, B_NOP, "",
@@ -275,13 +251,13 @@ static int node_buts_mix_rgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf
/* blend type */
uiBlockBeginAlign(block);
- bt=uiDefButS(block, MENU, B_NODE_EXEC+node->nr, "Mix %x0|Add %x1|Subtract %x3|Multiply %x2|Screen %x4|Overlay %x9|Divide %x5|Difference %x6|Darken %x7|Lighten %x8|Dodge %x10|Burn %x11|Color %x15|Value %x14|Saturation %x13|Hue %x12",
+ bt=uiDefButS(block, MENU, B_NODE_EXEC, "Mix %x0|Add %x1|Subtract %x3|Multiply %x2|Screen %x4|Overlay %x9|Divide %x5|Difference %x6|Darken %x7|Lighten %x8|Dodge %x10|Burn %x11|Color %x15|Value %x14|Saturation %x13|Hue %x12",
(short)butr->xmin, (short)butr->ymin, butr->xmax-butr->xmin -(a_but?20:0), 20,
&node->custom1, 0, 0, 0, 0, "");
uiButSetFunc(bt, node_but_title_cb, node, bt);
/* Alpha option, composite */
if(a_but)
- uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "A",
+ uiDefButS(block, TOG, B_NODE_EXEC, "A",
(short)butr->xmax-20, (short)butr->ymin, 20, 20,
&node->custom2, 0, 0, 0, 0, "Include Alpha of 2nd input in this operation");
}
@@ -295,7 +271,7 @@ static int node_buts_time(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *b
short dx= (short)((butr->xmax-butr->xmin)/2);
butr->ymin += 26;
- // XXX curvemap_buttons(block, node->storage, 's', B_NODE_EXEC+node->nr, B_REDR, butr);
+ // XXX curvemap_buttons(block, node->storage, 's', B_NODE_EXEC, B_REDR, butr);
if(cumap) {
cumap->flag |= CUMA_DRAW_CFRA;
@@ -304,10 +280,10 @@ static int node_buts_time(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *b
}
uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Sta:",
+ uiDefButS(block, NUM, B_NODE_EXEC, "Sta:",
(short)butr->xmin, (short)butr->ymin-22, dx, 19,
&node->custom1, 1.0, 20000.0, 0, 0, "Start frame");
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "End:",
+ uiDefButS(block, NUM, B_NODE_EXEC, "End:",
(short)butr->xmin+dx, (short)butr->ymin-22, dx, 19,
&node->custom2, 1.0, 20000.0, 0, 0, "End frame");
}
@@ -319,7 +295,7 @@ static int node_buts_valtorgb(uiBlock *block, bNodeTree *ntree, bNode *node, rct
{
if(block) {
if(node->storage) {
- ; // XXX draw_colorband_buts_small(block, node->storage, butr, B_NODE_EXEC+node->nr);
+ ; // XXX draw_colorband_buts_small(block, node->storage, butr, B_NODE_EXEC);
}
}
return 40;
@@ -328,7 +304,7 @@ static int node_buts_valtorgb(uiBlock *block, bNodeTree *ntree, bNode *node, rct
static int node_buts_curvevec(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
{
if(block) {
- ; // XXX curvemap_buttons(block, node->storage, 'v', B_NODE_EXEC+node->nr, B_REDR, butr);
+ ; // XXX curvemap_buttons(block, node->storage, 'v', B_NODE_EXEC, B_REDR, butr);
}
return (int)(node->width-NODE_DY);
}
@@ -350,7 +326,7 @@ static int node_buts_curvecol(uiBlock *block, bNodeTree *ntree, bNode *node, rct
else
cumap->flag &= ~CUMA_DRAW_SAMPLE;
- // XXX curvemap_buttons(block, node->storage, 'c', B_NODE_EXEC+node->nr, B_REDR, butr);
+ // XXX curvemap_buttons(block, node->storage, 'c', B_NODE_EXEC, B_REDR, butr);
}
return (int)(node->width-NODE_DY);
}
@@ -360,7 +336,7 @@ static int node_buts_normal(uiBlock *block, bNodeTree *ntree, bNode *node, rctf
if(block) {
bNodeSocket *sock= node->outputs.first; /* first socket stores normal */
- uiDefButF(block, BUT_NORMAL, B_NODE_EXEC+node->nr, "",
+ uiDefButF(block, BUT_NORMAL, B_NODE_EXEC, "",
(short)butr->xmin, (short)butr->ymin, butr->xmax-butr->xmin, butr->ymax-butr->ymin,
sock->ns.vec, 0.0f, 1.0f, 0, 0, "");
@@ -447,7 +423,7 @@ static int node_buts_texture(uiBlock *block, bNodeTree *ntree, bNode *node, rctf
uiBlockBeginAlign(block);
IDnames_to_pupstring(&strp, NULL, "", &(G.main->tex), NULL, NULL);
node->menunr= 0;
- bt= uiDefButS(block, MENU, B_NODE_EXEC+node->nr, strp,
+ bt= uiDefButS(block, MENU, B_NODE_EXEC, strp,
butr->xmin, butr->ymin+(multi?30:0), 20, 19,
&node->menunr, 0, 0, 0, 0, "Browse texture");
uiButSetFunc(bt, node_browse_tex_cb, ntree, node);
@@ -639,13 +615,13 @@ static int node_shader_buts_material(uiBlock *block, bNodeTree *ntree, bNode *no
if(butr->ymax-butr->ymin > 21.0f) {
/* node options */
uiBlockSetCol(block, TH_AUTO);
- uiDefButBitS(block, TOG, SH_NODE_MAT_DIFF, B_NODE_EXEC+node->nr, "Diff",
+ uiDefButBitS(block, TOG, SH_NODE_MAT_DIFF, B_NODE_EXEC, "Diff",
butr->xmin, butr->ymin, dx, 19,
&node->custom1, 0, 0, 0, 0, "Material Node outputs Diffuse");
- uiDefButBitS(block, TOG, SH_NODE_MAT_SPEC, B_NODE_EXEC+node->nr, "Spec",
+ uiDefButBitS(block, TOG, SH_NODE_MAT_SPEC, B_NODE_EXEC, "Spec",
butr->xmin+dx, butr->ymin, dx, 19,
&node->custom1, 0, 0, 0, 0, "Material Node outputs Specular");
- uiDefButBitS(block, TOG, SH_NODE_MAT_NEG, B_NODE_EXEC+node->nr, "Neg Normal",
+ uiDefButBitS(block, TOG, SH_NODE_MAT_NEG, B_NODE_EXEC, "Neg Normal",
butr->xmax-dx, butr->ymin, dx, 19,
&node->custom1, 0, 0, 0, 0, "Material Node uses inverted Normal");
}
@@ -665,26 +641,26 @@ static int node_shader_buts_mapping(uiBlock *block, bNodeTree *ntree, bNode *nod
uiBlockSetFunc(block, node_texmap_cb, texmap, NULL); /* all buttons get this */
uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->loc, -1000.0f, 1000.0f, 10, 2, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->loc+1, -1000.0f, 1000.0f, 10, 2, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->loc+2, -1000.0f, 1000.0f, 10, 2, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+dx, dy, 2*dx, 19, texmap->loc, -1000.0f, 1000.0f, 10, 2, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->loc+1, -1000.0f, 1000.0f, 10, 2, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->loc+2, -1000.0f, 1000.0f, 10, 2, "");
dy-= 19;
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->rot, -1000.0f, 1000.0f, 1000, 1, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->rot+1, -1000.0f, 1000.0f, 1000, 1, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->rot+2, -1000.0f, 1000.0f, 1000, 1, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+dx, dy, 2*dx, 19, texmap->rot, -1000.0f, 1000.0f, 1000, 1, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->rot+1, -1000.0f, 1000.0f, 1000, 1, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->rot+2, -1000.0f, 1000.0f, 1000, 1, "");
dy-= 19;
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->size, -1000.0f, 1000.0f, 10, 2, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->size+1, -1000.0f, 1000.0f, 10, 2, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->size+2, -1000.0f, 1000.0f, 10, 2, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+dx, dy, 2*dx, 19, texmap->size, -1000.0f, 1000.0f, 10, 2, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->size+1, -1000.0f, 1000.0f, 10, 2, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->size+2, -1000.0f, 1000.0f, 10, 2, "");
dy-= 25;
uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->min, -10.0f, 10.0f, 100, 2, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->min+1, -10.0f, 10.0f, 100, 2, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->min+2, -10.0f, 10.0f, 100, 2, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+dx, dy, 2*dx, 19, texmap->min, -10.0f, 10.0f, 100, 2, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->min+1, -10.0f, 10.0f, 100, 2, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->min+2, -10.0f, 10.0f, 100, 2, "");
dy-= 19;
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->max, -10.0f, 10.0f, 10, 2, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->max+1, -10.0f, 10.0f, 10, 2, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->max+2, -10.0f, 10.0f, 10, 2, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+dx, dy, 2*dx, 19, texmap->max, -10.0f, 10.0f, 10, 2, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->max+1, -10.0f, 10.0f, 10, 2, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->max+2, -10.0f, 10.0f, 10, 2, "");
uiBlockEndAlign(block);
/* labels/options */
@@ -696,9 +672,9 @@ static int node_shader_buts_mapping(uiBlock *block, bNodeTree *ntree, bNode *nod
dy-= 19;
uiDefBut(block, LABEL, B_NOP, "Size", butr->xmin, dy, dx, 19, NULL, 0.0f, 0.0f, 0, 0, "");
dy-= 25;
- uiDefButBitI(block, TOG, TEXMAP_CLIP_MIN, B_NODE_EXEC+node->nr, "Min", butr->xmin, dy, dx-4, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
+ uiDefButBitI(block, TOG, TEXMAP_CLIP_MIN, B_NODE_EXEC, "Min", butr->xmin, dy, dx-4, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
dy-= 19;
- uiDefButBitI(block, TOG, TEXMAP_CLIP_MAX, B_NODE_EXEC+node->nr, "Max", butr->xmin, dy, dx-4, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
+ uiDefButBitI(block, TOG, TEXMAP_CLIP_MAX, B_NODE_EXEC, "Max", butr->xmin, dy, dx-4, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
}
return 5*19 + 6;
@@ -723,13 +699,13 @@ static int node_shader_buts_geometry(uiBlock *block, bNodeTree *ntree, bNode *no
// XXX if(!verify_valid_uv_name(ngeo->uvname))
// XXX uiBlockSetCol(block, TH_REDALERT);
- but= uiDefBut(block, TEX, B_NODE_EXEC+node->nr, "UV:", butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20, ngeo->uvname, 0, 31, 0, 0, "Set name of UV layer to use, default is active UV layer");
+ but= uiDefBut(block, TEX, B_NODE_EXEC, "UV:", butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20, ngeo->uvname, 0, 31, 0, 0, "Set name of UV layer to use, default is active UV layer");
// uiButSetCompleteFunc(but, autocomplete_uv, NULL);
uiBlockSetCol(block, TH_AUTO);
if(!verify_valid_vcol_name(ngeo->colname))
uiBlockSetCol(block, TH_REDALERT);
- but= uiDefBut(block, TEX, B_NODE_EXEC+node->nr, "Col:", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, ngeo->colname, 0, 31, 0, 0, "Set name of vertex color layer to use, default is active vertex color layer");
+ but= uiDefBut(block, TEX, B_NODE_EXEC, "Col:", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, ngeo->colname, 0, 31, 0, 0, "Set name of vertex color layer to use, default is active vertex color layer");
uiButSetCompleteFunc(but, autocomplete_vcol, NULL);
uiBlockSetCol(block, TH_AUTO);
}
@@ -852,7 +828,7 @@ static void node_browse_image_cb(bContext *C, void *ntree_v, void *node_v)
NodeTagChanged(ntree, node);
BKE_image_signal((Image *)node->id, node->storage, IMA_SIGNAL_USER_NEW_IMAGE);
- // addqueue(curarea->win, UI_BUT_EVENT, B_NODE_EXEC+node->nr); XXX
+ // addqueue(curarea->win, UI_BUT_EVENT, B_NODE_EXEC); XXX
}
node->menunr= 0;
}
@@ -966,20 +942,20 @@ static int node_composit_buts_image(uiBlock *block, bNodeTree *ntree, bNode *nod
width= (xmax-xmin)/2;
dy-= 19;
- uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "Frs:",
+ uiDefButI(block, NUM, B_NODE_EXEC, "Frs:",
xmin, dy, width, 19,
&iuser->frames, 1.0, MAXFRAMEF, 0, 0, "Amount of images used in animation");
- uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "SFra:",
+ uiDefButI(block, NUM, B_NODE_EXEC, "SFra:",
xmin+width, dy, width, 19,
&iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Start frame of animation");
dy-= 19;
- uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "Offs:",
+ uiDefButI(block, NUM, B_NODE_EXEC, "Offs:",
xmin, dy, width, 19,
&iuser->offset, -MAXFRAMEF, MAXFRAMEF, 0, 0, "Offsets the number of the frame to use in the animation");
- uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Cycl",
+ uiDefButS(block, TOG, B_NODE_EXEC, "Cycl",
xmin+width, dy, width-20, 19,
&iuser->cycl, 0.0, 0.0, 0, 0, "Make animation go cyclic");
- uiDefIconButBitS(block, TOG, IMA_ANIM_ALWAYS, B_NODE_EXEC+node->nr, ICON_AUTO,
+ uiDefIconButBitS(block, TOG, IMA_ANIM_ALWAYS, B_NODE_EXEC, ICON_AUTO,
xmax-20, dy, 20, 19,
&iuser->flag, 0.0, 0.0, 0, 0, "Always refresh Image on frame changes");
}
@@ -989,7 +965,7 @@ static int node_composit_buts_image(uiBlock *block, bNodeTree *ntree, bNode *nod
width= (xmax-xmin);
dy-= 19;
strp= layer_menu(ima->rr);
- bt= uiDefButS(block, MENU, B_NODE_EXEC+node->nr, strp,
+ bt= uiDefButS(block, MENU, B_NODE_EXEC, strp,
xmin, dy, width, 19,
&iuser->layer, 0.0, 10000.0, 0, 0, "Layer");
uiButSetFunc(bt, image_layer_cb, ima->rr, node->storage);
@@ -1006,7 +982,7 @@ static int node_composit_buts_image(uiBlock *block, bNodeTree *ntree, bNode *nod
/* for each draw we test for anim refresh event */
if(iuser->flag & IMA_ANIM_REFRESHED) {
iuser->flag &= ~IMA_ANIM_REFRESHED;
- // addqueue(curarea->win, UI_BUT_EVENT, B_NODE_EXEC+node->nr); XXX
+ // addqueue(curarea->win, UI_BUT_EVENT, B_NODE_EXEC); XXX
}
if( ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE) )
@@ -1093,8 +1069,8 @@ static void node_browse_scene_cb(bContext *C, void *ntree_v, void *node_v)
static int node_composit_buts_renderlayers(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
{
- if(block) {
- Scene *scene= NULL; // XXX CTX_data_scene(C) can't work here. node->id has to be set default (ton)
+ if(block && node->id) {
+ Scene *scene= (Scene *)node->id;
uiBut *bt;
char *strp;
@@ -1111,11 +1087,11 @@ static int node_composit_buts_renderlayers(uiBlock *block, bNodeTree *ntree, bNo
/* browse button layer */
strp= scene_layer_menu(node->id?(Scene *)node->id:scene);
if(node->id)
- bt= uiDefIconTextButS(block, MENU, B_NODE_EXEC+node->nr, ICON_SCENE_DEHLT, strp,
+ bt= uiDefIconTextButS(block, MENU, B_NODE_EXEC, ICON_SCENE_DEHLT, strp,
butr->xmin+20, butr->ymin, (butr->xmax-butr->xmin)-40, 19,
&node->custom1, 0, 0, 0, 0, "Choose Render Layer");
else
- bt= uiDefButS(block, MENU, B_NODE_EXEC+node->nr, strp,
+ bt= uiDefButS(block, MENU, B_NODE_EXEC, strp,
butr->xmin+20, butr->ymin, (butr->xmax-butr->xmin)-40, 19,
&node->custom1, 0, 0, 0, 0, "Choose Render Layer");
uiButSetFunc(bt, set_render_layers_title, node, NULL);
@@ -1123,7 +1099,7 @@ static int node_composit_buts_renderlayers(uiBlock *block, bNodeTree *ntree, bNo
/* re-render */
/* uses custom2, not the best implementation of the world... but we need it to work now :) */
- bt= uiDefIconButS(block, TOG, B_NODE_EXEC+node->nr, ICON_SCENE,
+ bt= uiDefIconButS(block, TOG, B_NODE_EXEC, ICON_SCENE,
butr->xmax-20, butr->ymin, 20, 19,
&node->custom2, 0, 0, 0, 0, "Re-render this Layer");
@@ -1171,15 +1147,15 @@ static int node_composit_buts_blur(uiBlock *block, bNodeTree *ntree, bNode *node
uiBlockBeginAlign(block);
sprintf(str, "Filter Type%%t|Flat %%x%d|Tent %%x%d|Quad %%x%d|Cubic %%x%d|Gauss %%x%d|Fast Gauss%%x%d|CatRom %%x%d|Mitch %%x%d", R_FILTER_BOX, R_FILTER_TENT, R_FILTER_QUAD, R_FILTER_CUBIC, R_FILTER_GAUSS, R_FILTER_FAST_GAUSS, R_FILTER_CATROM, R_FILTER_MITCH);
- uiDefButS(block, MENU, B_NODE_EXEC+node->nr,str,
+ uiDefButS(block, MENU, B_NODE_EXEC,str,
butr->xmin, dy, dx*2, 19,
&nbd->filtertype, 0, 0, 0, 0, "Set sampling filter for blur");
dy-=19;
if (nbd->filtertype != R_FILTER_FAST_GAUSS) {
- uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Bokeh",
+ uiDefButC(block, TOG, B_NODE_EXEC, "Bokeh",
butr->xmin, dy, dx, 19,
&nbd->bokeh, 0, 0, 0, 0, "Uses circular filter, warning it's slow!");
- uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Gamma",
+ uiDefButC(block, TOG, B_NODE_EXEC, "Gamma",
butr->xmin+dx, dy, dx, 19,
&nbd->gamma, 0, 0, 0, 0, "Applies filter on gamma corrected values");
} else {
@@ -1194,20 +1170,20 @@ static int node_composit_buts_blur(uiBlock *block, bNodeTree *ntree, bNode *node
dy-=19;
if(nbd->relative) {
- bt= uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "X:",
+ bt= uiDefButF(block, NUM, B_NODE_EXEC, "X:",
butr->xmin, dy, dx, 19,
&nbd->percentx, 0.0f, 1.0f, 0, 0, "");
uiButSetFunc(bt, node_blur_update_sizex_cb, node, NULL);
- bt= uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Y:",
+ bt= uiDefButF(block, NUM, B_NODE_EXEC, "Y:",
butr->xmin+dx, dy, dx, 19,
&nbd->percenty, 0.0f, 1.0f, 0, 0, "");
uiButSetFunc(bt, node_blur_update_sizey_cb, node, NULL);
}
else {
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "X:",
+ uiDefButS(block, NUM, B_NODE_EXEC, "X:",
butr->xmin, dy, dx, 19,
&nbd->sizex, 0, 256, 0, 0, "");
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Y:",
+ uiDefButS(block, NUM, B_NODE_EXEC, "Y:",
butr->xmin+dx, dy, dx, 19,
&nbd->sizey, 0, 256, 0, 0, "");
}
@@ -1225,10 +1201,10 @@ static int node_composit_buts_dblur(uiBlock *block, bNodeTree *ntree, bNode *nod
short halfdx= (short)dx/2;
uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Iterations:",
+ uiDefButS(block, NUM, B_NODE_EXEC, "Iterations:",
butr->xmin, dy, dx, 19,
&ndbd->iter, 1, 32, 10, 0, "Amount of iterations");
- uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Wrap",
+ uiDefButC(block, TOG, B_NODE_EXEC, "Wrap",
butr->xmin, dy-= 19, dx, 19,
&ndbd->wrap, 0, 0, 0, 0, "Wrap blur");
uiBlockEndAlign(block);
@@ -1238,10 +1214,10 @@ static int node_composit_buts_dblur(uiBlock *block, bNodeTree *ntree, bNode *nod
uiDefBut(block, LABEL, B_NOP, "Center", butr->xmin, dy-= 19, dx, 19, NULL, 0.0f, 0.0f, 0, 0, "");
uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "X:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "X:",
butr->xmin, dy-= 19, halfdx, 19,
&ndbd->center_x, 0.0f, 1.0f, 10, 0, "X center in percents");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Y:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Y:",
butr->xmin+halfdx, dy, halfdx, 19,
&ndbd->center_y, 0.0f, 1.0f, 10, 0, "Y center in percents");
uiBlockEndAlign(block);
@@ -1249,23 +1225,23 @@ static int node_composit_buts_dblur(uiBlock *block, bNodeTree *ntree, bNode *nod
dy-= 9;
uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Distance:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Distance:",
butr->xmin, dy-= 19, dx, 19,
&ndbd->distance, -1.0f, 1.0f, 10, 0, "Amount of which the image moves");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Angle:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Angle:",
butr->xmin, dy-= 19, dx, 19,
&ndbd->angle, 0.0f, 360.0f, 1000, 0, "Angle in which the image will be moved");
uiBlockEndAlign(block);
dy-= 9;
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Spin:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Spin:",
butr->xmin, dy-= 19, dx, 19,
&ndbd->spin, -360.0f, 360.0f, 1000, 0, "Angle that is used to spin the image");
dy-= 9;
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Zoom:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Zoom:",
butr->xmin, dy-= 19, dx, 19,
&ndbd->zoom, 0.0f, 100.0f, 100, 0, "Amount of which the image is zoomed");
@@ -1281,15 +1257,15 @@ static int node_composit_buts_bilateralblur(uiBlock *block, bNodeTree *ntree, bN
short dx= (butr->xmax-butr->xmin);
uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Iterations:",
+ uiDefButS(block, NUM, B_NODE_EXEC, "Iterations:",
butr->xmin, dy, dx, 19,
&nbbd->iter, 1, 128, 0, 0, "Amount of iterations");
dy-=19;
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Color Sigma:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Color Sigma:",
butr->xmin, dy, dx, 19,
&nbbd->sigma_color,0.01, 3, 10, 0, "Sigma value used to modify color");
dy-=19;
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Space Sigma:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Space Sigma:",
butr->xmin, dy, dx, 19,
&nbbd->sigma_space ,0.01, 30, 10, 0, "Sigma value used to modify space");
@@ -1307,43 +1283,43 @@ static int node_composit_buts_defocus(uiBlock *block, bNodeTree *ntree, bNode *n
char* mstr1 = "Bokeh Type%t|Octagon %x8|Heptagon %x7|Hexagon %x6|Pentagon %x5|Square %x4|Triangle %x3|Disk %x0";
uiDefBut(block, LABEL, B_NOP, "Bokeh Type", butr->xmin, dy, dx, 19, NULL, 0, 0, 0, 0, "");
- uiDefButC(block, MENU, B_NODE_EXEC+node->nr, mstr1,
+ uiDefButC(block, MENU, B_NODE_EXEC, mstr1,
butr->xmin, dy-19, dx, 19,
&nqd->bktype, 0, 0, 0, 0, "Bokeh type");
if (nqd->bktype) { /* for some reason rotating a disk doesn't seem to work... ;) */
- uiDefButC(block, NUM, B_NODE_EXEC+node->nr, "Rotate:",
+ uiDefButC(block, NUM, B_NODE_EXEC, "Rotate:",
butr->xmin, dy-38, dx, 19,
&nqd->rotation, 0, 90, 0, 0, "Bokeh shape rotation offset in degrees");
}
- uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Gamma Correct",
+ uiDefButC(block, TOG, B_NODE_EXEC, "Gamma Correct",
butr->xmin, dy-57, dx, 19,
&nqd->gamco, 0, 0, 0, 0, "Enable gamma correction before and after main process");
if (nqd->no_zbuf==0) {
// only needed for zbuffer input
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "fStop:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "fStop:",
butr->xmin, dy-76, dx, 19,
&nqd->fstop, 0.5, 128, 10, 0, "Amount of focal blur, 128=infinity=perfect focus, half the value doubles the blur radius");
}
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Maxblur:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Maxblur:",
butr->xmin, dy-95, dx, 19,
&nqd->maxblur, 0, 10000, 1000, 0, "blur limit, maximum CoC radius, 0=no limit");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "BThreshold:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "BThreshold:",
butr->xmin, dy-114, dx, 19,
&nqd->bthresh, 0, 100, 100, 0, "CoC radius threshold, prevents background bleed on in-focus midground, 0=off");
- uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Preview",
+ uiDefButC(block, TOG, B_NODE_EXEC, "Preview",
butr->xmin, dy-142, dx, 19,
&nqd->preview, 0, 0, 0, 0, "Enable sampling mode, useful for preview when using low samplecounts");
if (nqd->preview) {
/* only visible when sampling mode enabled */
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Samples:",
+ uiDefButS(block, NUM, B_NODE_EXEC, "Samples:",
butr->xmin, dy-161, dx, 19,
&nqd->samples, 16, 256, 0, 0, "Number of samples (16=grainy, higher=less noise)");
}
- uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "No zbuffer",
+ uiDefButS(block, TOG, B_NODE_EXEC, "No zbuffer",
butr->xmin, dy-190, dx, 19,
&nqd->no_zbuf, 0, 0, 0, 0, "Enable when using an image as input instead of actual zbuffer (auto enabled if node not image based, eg. time node)");
if (nqd->no_zbuf) {
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Zscale:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Zscale:",
butr->xmin, dy-209, dx, 19,
&nqd->scale, 0, 1000, 100, 0, "Scales the Z input when not using a zbuffer, controls maximum blur designated by the color white or input value 1");
}
@@ -1360,56 +1336,56 @@ static int node_composit_buts_glare(uiBlock *block, bNodeTree *ntree, bNode *nod
short dy = butr->ymin + 152, dx = butr->xmax - butr->xmin;
char* mn1 = "Type%t|Ghosts%x3|Streaks%x2|Fog Glow%x1|Simple Star%x0";
char* mn2 = "Quality/Speed%t|High/Slow%x0|Medium/Medium%x1|Low/Fast%x2";
- uiDefButC(block, MENU, B_NODE_EXEC+node->nr, mn1,
+ uiDefButC(block, MENU, B_NODE_EXEC, mn1,
butr->xmin, dy, dx, 19,
&ndg->type, 0, 0, 0, 0, "Glow/Flare/Bloom type");
- uiDefButC(block, MENU, B_NODE_EXEC+node->nr, mn2,
+ uiDefButC(block, MENU, B_NODE_EXEC, mn2,
butr->xmin, dy-19, dx, 19,
&ndg->quality, 0, 0, 0, 0,
"Quality speed trade off, if not set to high quality, effect will be applied to low-res copy of source image");
if (ndg->type != 1) {
- uiDefButC(block, NUM, B_NODE_EXEC+node->nr, "Iterations:",
+ uiDefButC(block, NUM, B_NODE_EXEC, "Iterations:",
butr->xmin, dy-38, dx, 19,
&ndg->iter, 2, 5, 1, 0,
"higher values will generate longer/more streaks/ghosts");
if (ndg->type != 0)
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "ColMod:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "ColMod:",
butr->xmin, dy-57, dx, 19,
&ndg->colmod, 0, 1, 10, 0,
"Amount of Color Modulation, modulates colors of streaks and ghosts for a spectral dispersion effect");
}
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Mix:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Mix:",
butr->xmin, dy-76, dx, 19,
&ndg->mix, -1, 1, 10, 0,
"Mix balance, -1 is original image only, 0 is exact 50/50 mix, 1 is processed image only");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Threshold:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Threshold:",
butr->xmin, dy-95, dx, 19,
&ndg->threshold, 0, 1000, 10, 0,
"Brightness threshold, the glarefilter will be applied only to pixels brighter than this value");
if ((ndg->type == 2) || (ndg->type == 0))
{
if (ndg->type == 2) {
- uiDefButC(block, NUM, B_NODE_EXEC+node->nr, "streaks:",
+ uiDefButC(block, NUM, B_NODE_EXEC, "streaks:",
butr->xmin, dy-114, dx, 19,
&ndg->angle, 2, 16, 1000, 0,
"Total number of streaks");
- uiDefButC(block, NUM, B_NODE_EXEC+node->nr, "AngOfs:",
+ uiDefButC(block, NUM, B_NODE_EXEC, "AngOfs:",
butr->xmin, dy-133, dx, 19,
&ndg->angle_ofs, 0, 180, 1000, 0,
"Streak angle rotation offset in degrees");
}
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Fade:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Fade:",
butr->xmin, dy-152, dx, 19,
&ndg->fade, 0.75, 1, 5, 0,
"Streak fade out factor");
}
if (ndg->type == 0)
- uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Rot45",
+ uiDefButC(block, TOG, B_NODE_EXEC, "Rot45",
butr->xmin, dy-114, dx, 19,
&ndg->angle, 0, 0, 0, 0,
"simple star filter, add 45 degree rotation offset");
if ((ndg->type == 1) || (ndg->type > 3)) // PBGH and fog glow
- uiDefButC(block, NUM, B_NODE_EXEC+node->nr, "Size:",
+ uiDefButC(block, NUM, B_NODE_EXEC, "Size:",
butr->xmin, dy-114, dx, 19,
&ndg->size, 6, 9, 1000, 0,
"glow/glare size (not actual size, relative to initial size of bright area of pixels)");
@@ -1426,35 +1402,35 @@ static int node_composit_buts_tonemap(uiBlock *block, bNodeTree *ntree, bNode *n
char* mn = "Type%t|R/D Photoreceptor%x1|Rh Simple%x0";
uiBlockBeginAlign(block);
- uiDefButI(block, MENU, B_NODE_EXEC+node->nr, mn,
+ uiDefButI(block, MENU, B_NODE_EXEC, mn,
butr->xmin, dy, dx, 19,
&ntm->type, 0, 0, 0, 0,
"Tone mapping type");
if (ntm->type == 0) {
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Key:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Key:",
butr->xmin, dy-19, dx, 19,
&ntm->key, 0, 1, 5, 0,
"The value the average luminance is mapped to");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Offset:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Offset:",
butr->xmin, dy-38, dx, 19,
&ntm->offset, 0.001, 10, 5, 0,
"Tonemap offset, normally always 1, but can be used as an extra control to alter the brightness curve");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Gamma:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Gamma:",
butr->xmin, dy-57, dx, 19,
&ntm->gamma, 0.001, 3, 5, 0,
"Gamma factor, if not used, set to 1");
}
else {
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Intensity:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Intensity:",
butr->xmin, dy-19, dx, 19,
&ntm->f, -8, 8, 10, 0, "if less than zero, darkens image, otherwise makes it brighter");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Contrast:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Contrast:",
butr->xmin, dy-38, dx, 19,
&ntm->m, 0, 1, 5, 0, "Set to 0 to use estimate from input image");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Adaptation:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Adaptation:",
butr->xmin, dy-57, dx, 19,
&ntm->a, 0, 1, 5, 0, "if 0, global, if 1, based on pixel intensity");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "ColCorrect:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "ColCorrect:",
butr->xmin, dy-76, dx, 19,
&ntm->c, 0, 1, 5, 0, "color correction, if 0, same for all channels, if 1, each independent");
}
@@ -1470,16 +1446,16 @@ static int node_composit_buts_lensdist(uiBlock *block, bNodeTree *ntree, bNode *
NodeLensDist *nld = node->storage;
short dy = butr->ymin + 19, dx = butr->xmax - butr->xmin;
uiBlockBeginAlign(block);
- uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Projector",
+ uiDefButS(block, TOG, B_NODE_EXEC, "Projector",
butr->xmin, dy, dx, 19,
&nld->proj, 0, 0, 0, 0,
"Enable/disable projector mode, effect is applied in horizontal direction only");
if (!nld->proj) {
- uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Jitter",
+ uiDefButS(block, TOG, B_NODE_EXEC, "Jitter",
butr->xmin, dy-19, dx/2, 19,
&nld->jit, 0, 0, 0, 0,
"Enable/disable jittering, faster, but also noisier");
- uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Fit",
+ uiDefButS(block, TOG, B_NODE_EXEC, "Fit",
butr->xmin+dx/2, dy-19, dx/2, 19,
&nld->fit, 0, 0, 0, 0,
"For positive distortion factor only, scale image such that black areas are not visible");
@@ -1498,19 +1474,19 @@ static int node_composit_buts_vecblur(uiBlock *block, bNodeTree *ntree, bNode *n
short dx= (butr->xmax-butr->xmin);
uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Samples:",
+ uiDefButS(block, NUM, B_NODE_EXEC, "Samples:",
butr->xmin, dy+76, dx, 19,
&nbd->samples, 1, 256, 0, 0, "Amount of samples");
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "MinSpeed:",
+ uiDefButS(block, NUM, B_NODE_EXEC, "MinSpeed:",
butr->xmin, dy+57, dx, 19,
&nbd->minspeed, 0, 1024, 0, 0, "Minimum speed for a pixel to be blurred, used to separate background from foreground");
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "MaxSpeed:",
+ uiDefButS(block, NUM, B_NODE_EXEC, "MaxSpeed:",
butr->xmin, dy+38, dx, 19,
&nbd->maxspeed, 0, 1024, 0, 0, "If not zero, maximum speed in pixels");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "BlurFac:",
+ uiDefButF(block, NUM, B_NODE_EXEC, "BlurFac:",
butr->xmin, dy+19, dx, 19,
&nbd->fac, 0.0f, 2.0f, 10, 2, "Scaling factor for motion vectors, actually 'shutter speed' in frames");
- uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Curved",
+ uiDefButS(block, TOG, B_NODE_EXEC, "Curved",
butr->xmin, dy, dx, 19,
&nbd->curved, 0.0f, 2.0f, 10, 2, "Interpolate between frames in a bezier curve, rather than linearly");
uiBlockEndAlign(block);
@@ -1524,7 +1500,7 @@ static int node_composit_buts_filter(uiBlock *block, bNodeTree *ntree, bNode *no
uiBut *bt;
/* blend type */
- bt=uiDefButS(block, MENU, B_NODE_EXEC+node->nr, "Soften %x0|Sharpen %x1|Laplace %x2|Sobel %x3|Prewitt %x4|Kirsch %x5|Shadow %x6",
+ bt=uiDefButS(block, MENU, B_NODE_EXEC, "Soften %x0|Sharpen %x1|Laplace %x2|Sobel %x3|Prewitt %x4|Kirsch %x5|Shadow %x6",
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
&node->custom1, 0, 0, 0, 0, "");
uiButSetFunc(bt, node_but_title_cb, node, bt);
@@ -1538,7 +1514,7 @@ static int node_composit_buts_flip(uiBlock *block, bNodeTree *ntree, bNode *node
uiBut *bt;
/* flip x\y */
- bt=uiDefButS(block, MENU, B_NODE_EXEC+node->nr, "Flip X %x0|Flip Y %x1|Flip X & Y %x2",
+ bt=uiDefButS(block, MENU, B_NODE_EXEC, "Flip X %x0|Flip Y %x1|Flip X & Y %x2",
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
&node->custom1, 0, 0, 0, 0, "");
uiButSetFunc(bt, node_but_title_cb, node, bt);
@@ -1558,29 +1534,29 @@ static int node_composit_buts_crop(uiBlock *block, bNodeTree *ntree, bNode *node
uiBlockBeginAlign(block);
/* crop image size toggle */
- uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Crop Image Size",
+ uiDefButS(block, TOG, B_NODE_EXEC, "Crop Image Size",
butr->xmin, dy, dx*2, elementheight,
&node->custom1, 0, 0, 0, 0, "Crop the size of the input image.");
dy-=elementheight;
/* x1 */
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "X1:",
+ uiDefButS(block, NUM, B_NODE_EXEC, "X1:",
butr->xmin, dy, dx, elementheight,
&ntxy->x1, xymin, xymax, 0, 0, "");
/* y1 */
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Y1:",
+ uiDefButS(block, NUM, B_NODE_EXEC, "Y1:",
butr->xmin+dx, dy, dx, elementheight,
&ntxy->y1, xymin, xymax, 0, 0, "");
dy-=elementheight;
/* x2 */
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "X2:",
+ uiDefButS(block, NUM, B_NODE_EXEC, "X2:",
butr->xmin, dy, dx, elementheight,
&ntxy->x2, xymin, xymax, 0, 0, "");
/* y2 */
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Y2:",
+ uiDefButS(block, NUM, B_NODE_EXEC, "Y2:",
butr->xmin+dx, dy, dx, elementheight,
&ntxy->y2, xymin, xymax, 0, 0, "");
@@ -1594,14 +1570,14 @@ static int node_composit_buts_splitviewer(uiBlock *block, bNodeTree *ntree, bNod
if(block) {
uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "X",
+ uiDefButS(block, ROW, B_NODE_EXEC, "X",
butr->xmin, butr->ymin+19, (butr->xmax-butr->xmin)/2, 20,
&node->custom2, 0.0, 0.0, 0, 0, "");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Y",
+ uiDefButS(block, ROW, B_NODE_EXEC, "Y",
butr->xmin+(butr->xmax-butr->xmin)/2, butr->ymin+19, (butr->xmax-butr->xmin)/2, 20,
&node->custom2, 0.0, 1.0, 0, 0, "");
- uiDefButS(block, NUMSLI, B_NODE_EXEC+node->nr, "Split %: ",
+ uiDefButS(block, NUMSLI, B_NODE_EXEC, "Split %: ",
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 100, 10, 0, "");
}
return 40;
@@ -1616,16 +1592,16 @@ static int node_composit_buts_map_value(uiBlock *block, bNodeTree *ntree, bNode
short dx= (short)(butr->xmax-butr->xmin)/2;
uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Offs:", xstart, dy, 2*dx, 19, texmap->loc, -1000.0f, 1000.0f, 10, 2, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "Offs:", xstart, dy, 2*dx, 19, texmap->loc, -1000.0f, 1000.0f, 10, 2, "");
dy-= 19;
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Size:", xstart, dy, 2*dx, 19, texmap->size, -1000.0f, 1000.0f, 10, 3, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "Size:", xstart, dy, 2*dx, 19, texmap->size, -1000.0f, 1000.0f, 10, 3, "");
dy-= 23;
uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, TEXMAP_CLIP_MIN, B_NODE_EXEC+node->nr, "Min", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", xstart+dx, dy, dx, 19, texmap->min, -1000.0f, 1000.0f, 10, 2, "");
+ uiDefButBitI(block, TOG, TEXMAP_CLIP_MIN, B_NODE_EXEC, "Min", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "", xstart+dx, dy, dx, 19, texmap->min, -1000.0f, 1000.0f, 10, 2, "");
dy-= 19;
- uiDefButBitI(block, TOG, TEXMAP_CLIP_MAX, B_NODE_EXEC+node->nr, "Max", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", xstart+dx, dy, dx, 19, texmap->max, -1000.0f, 1000.0f, 10, 2, "");
+ uiDefButBitI(block, TOG, TEXMAP_CLIP_MAX, B_NODE_EXEC, "Max", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
+ uiDefButF(block, NUM, B_NODE_EXEC, "", xstart+dx, dy, dx, 19, texmap->max, -1000.0f, 1000.0f, 10, 2, "");
}
return 80;
}
@@ -1636,11 +1612,11 @@ static int node_composit_buts_alphaover(uiBlock *block, bNodeTree *ntree, bNode
NodeTwoFloats *ntf= node->storage;
/* alpha type */
- uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "ConvertPremul",
+ uiDefButS(block, TOG, B_NODE_EXEC, "ConvertPremul",
butr->xmin, butr->ymin+19, butr->xmax-butr->xmin, 19,
&node->custom1, 0, 0, 0, 0, "");
/* mix factor */
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Premul: ",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Premul: ",
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 19,
&ntf->x, 0.0f, 1.0f, 100, 0, "");
}
@@ -1653,13 +1629,13 @@ static int node_composit_buts_hue_sat(uiBlock *block, bNodeTree *ntree, bNode *n
NodeHueSat *nhs= node->storage;
uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Hue: ",
+ uiDefButF(block, NUMSLI, B_NODE_EXEC, "Hue: ",
butr->xmin, butr->ymin+40.0f, butr->xmax-butr->xmin, 20,
&nhs->hue, 0.0f, 1.0f, 100, 0, "");
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Sat: ",
+ uiDefButF(block, NUMSLI, B_NODE_EXEC, "Sat: ",
butr->xmin, butr->ymin+20.0f, butr->xmax-butr->xmin, 20,
&nhs->sat, 0.0f, 2.0f, 100, 0, "");
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Val: ",
+ uiDefButF(block, NUMSLI, B_NODE_EXEC, "Val: ",
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
&nhs->val, 0.0f, 2.0f, 100, 0, "");
}
@@ -1669,7 +1645,7 @@ static int node_composit_buts_hue_sat(uiBlock *block, bNodeTree *ntree, bNode *n
static int node_composit_buts_dilateerode(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
{
if(block) {
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Distance:",
+ uiDefButS(block, NUM, B_NODE_EXEC, "Distance:",
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
&node->custom2, -100, 100, 0, 0, "Distance to grow/shrink (number of iterations)");
}
@@ -1685,35 +1661,35 @@ static int node_composit_buts_diff_matte(uiBlock *block, bNodeTree *ntree, bNode
uiBlockBeginAlign(block);
/*color space selectors*/
- uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"RGB",
+ uiDefButS(block, ROW,B_NODE_EXEC,"RGB",
butr->xmin,butr->ymin+60,sx,20,
&node->custom1,1,1, 0, 0, "RGB Color Space");
- uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"HSV",
+ uiDefButS(block, ROW,B_NODE_EXEC,"HSV",
butr->xmin+sx,butr->ymin+60,sx,20,
&node->custom1,1,2, 0, 0, "HSV Color Space");
- uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YUV",
+ uiDefButS(block, ROW,B_NODE_EXEC,"YUV",
butr->xmin+2*sx,butr->ymin+60,sx,20,
&node->custom1,1,3, 0, 0, "YUV Color Space");
- uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YCC",
+ uiDefButS(block, ROW,B_NODE_EXEC,"YCC",
butr->xmin+3*sx,butr->ymin+60,sx,20,
&node->custom1,1,4, 0, 0, "YCbCr Color Space");
/*channel tolorences*/
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, " ",
+ uiDefButF(block, NUM, B_NODE_EXEC, " ",
butr->xmin, butr->ymin+40, dx, 20,
&c->t1, 0.0f, 1.0f, 100, 0, "Channel 1 Tolerance");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, " ",
+ uiDefButF(block, NUM, B_NODE_EXEC, " ",
butr->xmin+dx, butr->ymin+40, dx, 20,
&c->t2, 0.0f, 1.0f, 100, 0, "Channel 2 Tolorence");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, " ",
+ uiDefButF(block, NUM, B_NODE_EXEC, " ",
butr->xmin+2*dx, butr->ymin+40, dx, 20,
&c->t3, 0.0f, 1.0f, 100, 0, "Channel 3 Tolorence");
/*falloff parameters*/
/*
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff Size ",
+ uiDefButF(block, NUMSLI, B_NODE_EXEC, "Falloff Size ",
butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20,
&c->fsize, 0.0f, 1.0f, 100, 0, "");
*/
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff: ",
+ uiDefButF(block, NUMSLI, B_NODE_EXEC, "Falloff: ",
butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20,
&c->fstrength, 0.0f, 1.0f, 100, 0, "");
}
@@ -1727,16 +1703,16 @@ static int node_composit_buts_color_spill(uiBlock *block, bNodeTree *ntree, bNod
NodeChroma *c=node->storage;
uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Enhance: ",
+ uiDefButF(block, NUM, B_NODE_EXEC, "Enhance: ",
butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20,
&c->t1, 0.0f, 0.5f, 100, 2, "Adjusts how much selected channel is affected by color spill algorithm");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "R",
+ uiDefButS(block, ROW, B_NODE_EXEC, "R",
butr->xmin,butr->ymin,dx,20,
&node->custom1,1,1, 0, 0, "Red Spill Suppression");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "G",
+ uiDefButS(block, ROW, B_NODE_EXEC, "G",
butr->xmin+dx,butr->ymin,dx,20,
&node->custom1,1,2, 0, 0, "Green Spill Suppression");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "B",
+ uiDefButS(block, ROW, B_NODE_EXEC, "B",
butr->xmin+2*dx,butr->ymin,dx,20,
&node->custom1, 1, 3, 0, 0, "Blue Spill Suppression");
uiBlockEndAlign(block);
@@ -1751,21 +1727,21 @@ static int node_composit_buts_chroma_matte(uiBlock *block, bNodeTree *ntree, bNo
NodeChroma *c= node->storage;
uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Acceptance ",
+ uiDefButF(block, NUMSLI, B_NODE_EXEC, "Acceptance ",
butr->xmin, butr->ymin+60, butr->xmax-butr->xmin, 20,
&c->t1, 1.0f, 80.0f, 100, 0, "Tolerance for colors to be considered a keying color");
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Cutoff ",
+ uiDefButF(block, NUMSLI, B_NODE_EXEC, "Cutoff ",
butr->xmin, butr->ymin+40, butr->xmax-butr->xmin, 20,
&c->t2, 0.0f, 30.0f, 100, 0, "Colors below this will be considered as exact matches for keying color");
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Lift ",
+ uiDefButF(block, NUMSLI, B_NODE_EXEC, "Lift ",
butr->xmin, butr->ymin+20, dx, 20,
&c->fsize, 0.0f, 1.0f, 100, 0, "Alpha Lift");
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Gain ",
+ uiDefButF(block, NUMSLI, B_NODE_EXEC, "Gain ",
butr->xmin+dx, butr->ymin+20, dx, 20,
&c->fstrength, 0.0f, 1.0f, 100, 0, "Alpha Gain");
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Shadow Adjust ",
+ uiDefButF(block, NUMSLI, B_NODE_EXEC, "Shadow Adjust ",
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
&c->t3, 0.0f, 1.0f, 100, 0, "Adjusts the brightness of any shadows captured");
@@ -1785,13 +1761,13 @@ static int node_composit_buts_channel_matte(uiBlock *block, bNodeTree *ntree, bN
/*color space selectors*/
uiBlockBeginAlign(block);
- uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"RGB",
+ uiDefButS(block, ROW,B_NODE_EXEC,"RGB",
butr->xmin,butr->ymin+60,sx,20,&node->custom1,1,1, 0, 0, "RGB Color Space");
- uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"HSV",
+ uiDefButS(block, ROW,B_NODE_EXEC,"HSV",
butr->xmin+sx,butr->ymin+60,sx,20,&node->custom1,1,2, 0, 0, "HSV Color Space");
- uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YUV",
+ uiDefButS(block, ROW,B_NODE_EXEC,"YUV",
butr->xmin+2*sx,butr->ymin+60,sx,20,&node->custom1,1,3, 0, 0, "YUV Color Space");
- uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YCC",
+ uiDefButS(block, ROW,B_NODE_EXEC,"YCC",
butr->xmin+3*sx,butr->ymin+60,sx,20,&node->custom1,1,4, 0, 0, "YCbCr Color Space");
if (node->custom1==1) {
@@ -1808,18 +1784,18 @@ static int node_composit_buts_channel_matte(uiBlock *block, bNodeTree *ntree, bN
}
/*channel selector */
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, c1,
+ uiDefButS(block, ROW, B_NODE_EXEC, c1,
butr->xmin,butr->ymin+40,cx,20,&node->custom2,1, 1, 0, 0, "Channel 1");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, c2,
+ uiDefButS(block, ROW, B_NODE_EXEC, c2,
butr->xmin+cx,butr->ymin+40,cx,20,&node->custom2,1, 2, 0, 0, "Channel 2");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, c3,
+ uiDefButS(block, ROW, B_NODE_EXEC, c3,
butr->xmin+cx+cx,butr->ymin+40,cx,20,&node->custom2, 1, 3, 0, 0, "Channel 3");
/*tolerance sliders */
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "High ",
+ uiDefButF(block, NUMSLI, B_NODE_EXEC, "High ",
butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20,
&c->t1, 0.0f, 1.0f, 100, 0, "Values higher than this setting are 100% opaque");
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Low ",
+ uiDefButF(block, NUMSLI, B_NODE_EXEC, "Low ",
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
&c->t2, 0.0f, 1.0f, 100, 0, "Values lower than this setting are 100% keyed");
uiBlockEndAlign(block);
@@ -1838,10 +1814,10 @@ static int node_composit_buts_luma_matte(uiBlock *block, bNodeTree *ntree, bNode
NodeChroma *c=node->storage;
/*tolerance sliders */
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "High ",
+ uiDefButF(block, NUMSLI, B_NODE_EXEC, "High ",
butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20,
&c->t1, 0.0f, 1.0f, 100, 0, "Values higher than this setting are 100% opaque");
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Low ",
+ uiDefButF(block, NUMSLI, B_NODE_EXEC, "Low ",
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
&c->t2, 0.0f, 1.0f, 100, 0, "Values lower than this setting are 100% keyed");
uiBlockEndAlign(block);
@@ -1857,7 +1833,7 @@ static int node_composit_buts_luma_matte(uiBlock *block, bNodeTree *ntree, bNode
static int node_composit_buts_map_uv(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
{
if(block) {
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Alpha:",
+ uiDefButS(block, NUM, B_NODE_EXEC, "Alpha:",
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
&node->custom1, 0, 100, 0, 0, "Conversion percentage of UV differences to Alpha");
}
@@ -1867,7 +1843,7 @@ static int node_composit_buts_map_uv(uiBlock *block, bNodeTree *ntree, bNode *no
static int node_composit_buts_id_mask(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
{
if(block) {
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "ID:",
+ uiDefButS(block, NUM, B_NODE_EXEC, "ID:",
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
&node->custom1, 0, 10000, 0, 0, "Pass Index number to convert to Alpha");
}
@@ -1941,10 +1917,10 @@ static int node_composit_buts_file_output(uiBlock *block, bNodeTree *ntree, bNod
}
/* start frame, end frame */
- uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "SFra: ",
+ uiDefButI(block, NUM, B_NODE_EXEC, "SFra: ",
x, y, w/2, 20,
&nif->sfra, 1, MAXFRAMEF, 10, 0, "");
- uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "EFra: ",
+ uiDefButI(block, NUM, B_NODE_EXEC, "EFra: ",
x+w/2, y, w/2, 20,
&nif->efra, 1, MAXFRAMEF, 10, 0, "");
@@ -1973,7 +1949,7 @@ static void node_scale_cb(bContext *C, void *node_v, void *unused_v)
static int node_composit_buts_scale(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
{
if(block) {
- uiBut *bt= uiDefButS(block, MENU, B_NODE_EXEC+node->nr, "Relative %x0|Absolute %x1|Scene Size % %x2|",
+ uiBut *bt= uiDefButS(block, MENU, B_NODE_EXEC, "Relative %x0|Absolute %x1|Scene Size % %x2|",
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
&node->custom1, 0, 0, 0, 0, "Scale new image to absolute pixel size, size relative to the incoming image, or using the 'percent' size of the scene");
uiButSetFunc(bt, node_scale_cb, node, NULL);
@@ -1985,10 +1961,10 @@ static int node_composit_buts_invert(uiBlock *block, bNodeTree *ntree, bNode *no
{
if(block) {
uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, CMP_CHAN_RGB, B_NODE_EXEC+node->nr, "RGB",
+ uiDefButBitS(block, TOG, CMP_CHAN_RGB, B_NODE_EXEC, "RGB",
butr->xmin, butr->ymin, (butr->xmax-butr->xmin)/2, 20,
&node->custom1, 0, 0, 0, 0, "");
- uiDefButBitS(block, TOG, CMP_CHAN_A, B_NODE_EXEC+node->nr, "A",
+ uiDefButBitS(block, TOG, CMP_CHAN_A, B_NODE_EXEC, "A",
butr->xmin+(butr->xmax-butr->xmin)/2, butr->ymin, (butr->xmax-butr->xmin)/2, 20,
&node->custom1, 0, 0, 0, 0, "");
uiBlockEndAlign(block);
@@ -2002,7 +1978,7 @@ static int node_composit_buts_premulkey(uiBlock *block, bNodeTree *ntree, bNode
uiBut *bt;
/* blend type */
- bt=uiDefButS(block, MENU, B_NODE_EXEC+node->nr, "Key to Premul %x0|Premul to Key %x1",
+ bt=uiDefButS(block, MENU, B_NODE_EXEC, "Key to Premul %x0|Premul to Key %x1",
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
&node->custom1, 0, 0, 0, 0, "Conversion between premultiplied alpha and key alpha");
}
@@ -2154,13 +2130,13 @@ static int node_texture_buts_bricks(uiBlock *block, bNodeTree *ntree, bNode *nod
/* Offset */
uiDefButF(
- block, NUM, B_NODE_EXEC+node->nr, "Offset",
+ block, NUM, B_NODE_EXEC, "Offset",
butr->xmin, butr->ymin+20, w-ofw, 20,
&node->custom3,
0, 1, 0.25, 2,
"Offset amount" );
uiDefButS(
- block, NUM, B_NODE_EXEC+node->nr, "",
+ block, NUM, B_NODE_EXEC, "",
butr->xmin+w-ofw, butr->ymin+20, ofw, 20,
&node->custom1,
2, 99, 0, 0,
@@ -2168,13 +2144,13 @@ static int node_texture_buts_bricks(uiBlock *block, bNodeTree *ntree, bNode *nod
/* Squash */
uiDefButF(
- block, NUM, B_NODE_EXEC+node->nr, "Squash",
+ block, NUM, B_NODE_EXEC, "Squash",
butr->xmin, butr->ymin+0, w-ofw, 20,
&node->custom4,
0, 99, 0.25, 2,
"Stretch amount" );
uiDefButS(
- block, NUM, B_NODE_EXEC+node->nr, "",
+ block, NUM, B_NODE_EXEC, "",
butr->xmin+w-ofw, butr->ymin+0, ofw, 20,
&node->custom2,
2, 99, 0, 0,
@@ -2211,10 +2187,10 @@ static int node_texture_buts_proc(uiBlock *block, bNodeTree *ntree, bNode *node,
case TEX_BLEND:
if( block ) {
uiBlockBeginAlign( block );
- uiDefButS( block, MENU, B_NODE_EXEC+node->nr,
+ uiDefButS( block, MENU, B_NODE_EXEC,
"Linear %x0|Quad %x1|Ease %x2|Diag %x3|Sphere %x4|Halo %x5|Radial %x6",
x, y+20, w, 20, &tex->stype, 0, 1, 0, 0, "Blend Type" );
- uiDefButBitS(block, TOG, TEX_FLIPBLEND, B_NODE_EXEC+node->nr, "Flip XY", x, y, w, 20,
+ uiDefButBitS(block, TOG, TEX_FLIPBLEND, B_NODE_EXEC, "Flip XY", x, y, w, 20,
&tex->flag, 0, 0, 0, 0, "Flips the direction of the progression 90 degrees");
uiBlockEndAlign( block );
}
@@ -2225,16 +2201,16 @@ static int node_texture_buts_proc(uiBlock *block, bNodeTree *ntree, bNode *node,
if( block ) {
uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Soft", 0*w/3+x, 40+y, w/3, 18, &tex->stype, 2.0, (float)TEX_SOFT, 0, 0, "Uses soft marble");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Sharp", 1*w/3+x, 40+y, w/3, 18, &tex->stype, 2.0, (float)TEX_SHARP, 0, 0, "Uses more clearly defined marble");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Sharper", 2*w/3+x, 40+y, w/3, 18, &tex->stype, 2.0, (float)TEX_SHARPER, 0, 0, "Uses very clearly defined marble");
+ uiDefButS(block, ROW, B_NODE_EXEC, "Soft", 0*w/3+x, 40+y, w/3, 18, &tex->stype, 2.0, (float)TEX_SOFT, 0, 0, "Uses soft marble");
+ uiDefButS(block, ROW, B_NODE_EXEC, "Sharp", 1*w/3+x, 40+y, w/3, 18, &tex->stype, 2.0, (float)TEX_SHARP, 0, 0, "Uses more clearly defined marble");
+ uiDefButS(block, ROW, B_NODE_EXEC, "Sharper", 2*w/3+x, 40+y, w/3, 18, &tex->stype, 2.0, (float)TEX_SHARPER, 0, 0, "Uses very clearly defined marble");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Soft noise", 0*w/2+x, 20+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISESOFT, 0, 0, "Generates soft noise");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Hard noise", 1*w/2+x, 20+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISEPERL, 0, 0, "Generates hard noise");
+ uiDefButS(block, ROW, B_NODE_EXEC, "Soft noise", 0*w/2+x, 20+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISESOFT, 0, 0, "Generates soft noise");
+ uiDefButS(block, ROW, B_NODE_EXEC, "Hard noise", 1*w/2+x, 20+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISEPERL, 0, 0, "Generates hard noise");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Sin", 0*w/3+x, 0+y, w/3, 18, &tex->noisebasis2, 8.0, 0.0, 0, 0, "Uses a sine wave to produce bands.");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Saw", 1*w/3+x, 0+y, w/3, 18, &tex->noisebasis2, 8.0, 1.0, 0, 0, "Uses a saw wave to produce bands");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Tri", 2*w/3+x, 0+y, w/3, 18, &tex->noisebasis2, 8.0, 2.0, 0, 0, "Uses a triangle wave to produce bands");
+ uiDefButS(block, ROW, B_NODE_EXEC, "Sin", 0*w/3+x, 0+y, w/3, 18, &tex->noisebasis2, 8.0, 0.0, 0, 0, "Uses a sine wave to produce bands.");
+ uiDefButS(block, ROW, B_NODE_EXEC, "Saw", 1*w/3+x, 0+y, w/3, 18, &tex->noisebasis2, 8.0, 1.0, 0, 0, "Uses a saw wave to produce bands");
+ uiDefButS(block, ROW, B_NODE_EXEC, "Tri", 2*w/3+x, 0+y, w/3, 18, &tex->noisebasis2, 8.0, 2.0, 0, 0, "Uses a triangle wave to produce bands");
uiBlockEndAlign(block);
}
@@ -2248,12 +2224,12 @@ static int node_texture_buts_proc(uiBlock *block, bNodeTree *ntree, bNode *node,
uiDefButS(block, ROW, B_TEXPRV, "Bands", x, 40+y, w/2, 18, &tex->stype, 2.0, (float)TEX_BANDNOISE, 0, 0, "Uses standard noise");
uiDefButS(block, ROW, B_TEXPRV, "Rings", w/2+x, 40+y, w/2, 18, &tex->stype, 2.0, (float)TEX_RINGNOISE, 0, 0, "Lets Noise return RGB value");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Sin", 0*w/3+x, 20+y, w/3, 18, &tex->noisebasis2, 8.0, (float)TEX_SIN, 0, 0, "Uses a sine wave to produce bands.");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Saw", 1*w/3+x, 20+y, w/3, 18, &tex->noisebasis2, 8.0, (float)TEX_SAW, 0, 0, "Uses a saw wave to produce bands");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Tri", 2*w/3+x, 20+y, w/3, 18, &tex->noisebasis2, 8.0, (float)TEX_TRI, 0, 0, "Uses a triangle wave to produce bands");
+ uiDefButS(block, ROW, B_NODE_EXEC, "Sin", 0*w/3+x, 20+y, w/3, 18, &tex->noisebasis2, 8.0, (float)TEX_SIN, 0, 0, "Uses a sine wave to produce bands.");
+ uiDefButS(block, ROW, B_NODE_EXEC, "Saw", 1*w/3+x, 20+y, w/3, 18, &tex->noisebasis2, 8.0, (float)TEX_SAW, 0, 0, "Uses a saw wave to produce bands");
+ uiDefButS(block, ROW, B_NODE_EXEC, "Tri", 2*w/3+x, 20+y, w/3, 18, &tex->noisebasis2, 8.0, (float)TEX_TRI, 0, 0, "Uses a triangle wave to produce bands");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Soft noise", 0*w/2+x, 0+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISESOFT, 0, 0, "Generates soft noise");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Hard noise", 1*w/2+x, 0+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISEPERL, 0, 0, "Generates hard noise");
+ uiDefButS(block, ROW, B_NODE_EXEC, "Soft noise", 0*w/2+x, 0+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISESOFT, 0, 0, "Generates soft noise");
+ uiDefButS(block, ROW, B_NODE_EXEC, "Hard noise", 1*w/2+x, 0+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISEPERL, 0, 0, "Generates hard noise");
uiBlockEndAlign(block);
}
return 80;
@@ -2402,7 +2378,7 @@ static void node_texture_set_butfunc(bNodeType *ntype)
/* ******* init draw callbacks for all tree types, only called in usiblender.c, once ************* */
-void init_node_butfuncs(void)
+void ED_init_node_butfuncs(void)
{
bNodeType *ntype;
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 11f760bb882..06c4b6bacd1 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -503,7 +503,7 @@ static void socket_vector_menu_cb(bContext *C, void *node_v, void *ntree_v)
}
/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
-static uiBlock *socket_vector_menu(bContext *C, uiMenuBlockHandle *handle, void *socket_v)
+static uiBlock *socket_vector_menu(bContext *C, ARegion *ar, void *socket_v)
{
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
ScrArea *sa= CTX_wm_area(C);
@@ -523,7 +523,7 @@ static uiBlock *socket_vector_menu(bContext *C, uiMenuBlockHandle *handle, void
break;
}
- block= uiBeginBlock(C, handle->region, "socket menu", UI_EMBOSS, UI_HELV);
+ block= uiBeginBlock(C, ar, "socket menu", UI_EMBOSS, UI_HELV);
/* use this for a fake extra empy space around the buttons */
uiDefBut(block, LABEL, 0, "", -4, -4, 188, 68, NULL, 0, 0, 0, 0, "");
@@ -612,11 +612,34 @@ static void do_node_internal_buttons(bContext *C, void *node_v, int event)
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
if(event==B_NODE_EXEC) {
- if(snode->treetype==NTREE_SHADER)
+ if(snode->treetype==NTREE_SHADER) {
WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, snode->id);
+ }
+ else if(snode->treetype==NTREE_COMPOSIT) {
+ bNode *node= node_v;
+
+ NodeTagChanged(snode->edittree, node);
+ /* don't use NodeTagIDChanged, it gives far too many recomposites for image, scene layers, ... */
+
+ /* not the best implementation of the world... but we need it to work now :) */
+ if(node->type==CMP_NODE_R_LAYERS && node->custom2) {
+ /* add event for this window (after render curarea can be changed) */
+ //addqueue(curarea->win, UI_BUT_EVENT, B_NODE_TREE_EXEC);
+
+ //composite_node_render(snode, node);
+ //snode_handle_recalc(snode);
+
+ /* add another event, a render can go fullscreen and open new window */
+ //addqueue(curarea->win, UI_BUT_EVENT, B_NODE_TREE_EXEC);
+ }
+ else {
+ node= snode_get_editgroup(snode);
+ if(node)
+ NodeTagIDChanged(snode->nodetree, node->id);
+ }
+ WM_event_add_notifier(C, NC_SCENE|ND_NODES, CTX_data_scene(C));
+ }
- // else if(snode->treetype==NTREE_COMPOSIT)
- // composit_node_event(snode, val);
// else if(snode->treetype==NTREE_TEXTURE)
// texture_node_event(snode, val);
}
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index aa4d139e32f..b4c0fcbd1a5 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -88,35 +88,113 @@
// XXX XXX XXX
static void BIF_undo_push(char *s) {}
+/* ***************** composite job manager ********************** */
+
+typedef struct CompoJob {
+ Scene *scene;
+ bNodeTree *ntree;
+ bNodeTree *localtree;
+ short *stop;
+ short *do_update;
+} CompoJob;
+
+/* called by compo, only to check job 'stop' value */
+static int compo_breakjob(void *cjv)
+{
+ CompoJob *cj= cjv;
+
+ return *(cj->stop);
+}
+
+/* called by compo, wmJob sends notifier */
+static void compo_redrawjob(void *cjv, char *str)
+{
+ CompoJob *cj= cjv;
+
+ *(cj->do_update)= 1;
+}
+
+static void compo_freejob(void *cjv)
+{
+ CompoJob *cj= cjv;
+
+ if(cj->localtree) {
+ ntreeLocalMerge(cj->localtree, cj->ntree);
+ }
+ MEM_freeN(cj);
+}
+
+/* only now we copy the nodetree, so adding many jobs while
+ sliding buttons doesn't frustrate */
+static void compo_initjob(void *cjv)
+{
+ CompoJob *cj= cjv;
+
+ cj->localtree= ntreeLocalize(cj->ntree);
+}
+
+/* called before redraw notifiers, it moves finished previews over */
+static void compo_updatejob(void *cjv)
+{
+ CompoJob *cj= cjv;
+
+ ntreeLocalSync(cj->localtree, cj->ntree);
+}
+
+
+/* only this runs inside thread */
+static void compo_startjob(void *cjv, short *stop, short *do_update)
+{
+ CompoJob *cj= cjv;
+ bNodeTree *ntree= cj->localtree;
+
+ if(cj->scene->use_nodes==0)
+ return;
+
+ cj->stop= stop;
+ cj->do_update= do_update;
+
+ ntree->test_break= compo_breakjob;
+ ntree->tbh= cj;
+ ntree->stats_draw= compo_redrawjob;
+ ntree->sdh= cj;
+
+ // XXX BIF_store_spare();
+
+ ntreeCompositExecTree(ntree, &cj->scene->r, 1); /* 1 is do_previews */
+
+ ntree->test_break= NULL;
+ ntree->stats_draw= NULL;
+
+}
+
+void snode_composite_job(const bContext *C, ScrArea *sa)
+{
+ SpaceNode *snode= sa->spacedata.first;
+ wmJob *steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa);
+ CompoJob *cj= MEM_callocN(sizeof(CompoJob), "compo job");
+
+ /* customdata for preview thread */
+ cj->scene= CTX_data_scene(C);
+ cj->ntree= snode->nodetree;
+
+ /* setup job */
+ WM_jobs_customdata(steve, cj, compo_freejob);
+ WM_jobs_timer(steve, 0.1, NC_SCENE, NC_SCENE|ND_COMPO_RESULT);
+ WM_jobs_callbacks(steve, compo_startjob, compo_initjob, compo_updatejob);
+
+ WM_jobs_start(steve);
+
+}
+
+/* ***************************************** */
+
#if 0
// XXX snode_handle_recalc will go away */
static void snode_handle_recalc(SpaceNode *snode)
{
- if(snode->treetype==NTREE_COMPOSIT) {
- if(G.scene->use_nodes) {
- snode->nodetree->timecursor= set_timecursor;
- G.afbreek= 0;
- snode->nodetree->test_break= blender_test_break;
-
- // XXX BIF_store_spare();
-
- ntreeCompositExecTree(snode->nodetree, &G.scene->r, 1); /* 1 is do_previews */
-
- snode->nodetree->timecursor= NULL;
- snode->nodetree->test_break= NULL;
- // XXX waitcursor(0);
-
- // allqueue(REDRAWIMAGE, 1);
- if(G.scene->r.scemode & R_DOCOMP) {
- // XXX BIF_redraw_render_rect(); /* seems to screwup display? */
- // mywinset(curarea->win);
- }
- }
-
- // allqueue(REDRAWNODE, 1);
- }
- else if(snode->treetype==NTREE_TEXTURE) {
+ if(snode->treetype==NTREE_TEXTURE) {
ntreeTexUpdatePreviews(snode->nodetree);
// XXX BIF_preview_changed(ID_TE);
}
@@ -233,7 +311,7 @@ static void set_node_imagepath(char *str) /* called from fileselect */
#endif /* 0 */
-static bNode *snode_get_editgroup(SpaceNode *snode)
+bNode *snode_get_editgroup(SpaceNode *snode)
{
bNode *gnode;
diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c
index d239ebea472..451e9631f87 100644
--- a/source/blender/editors/space_node/node_header.c
+++ b/source/blender/editors/space_node/node_header.c
@@ -91,13 +91,13 @@ static void do_node_selectmenu(bContext *C, void *arg, int event)
ED_area_tag_redraw(curarea);
}
-static uiBlock *node_selectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_selectmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "node_selectmenu",
+ block= uiBeginBlock(C, ar, "node_selectmenu",
UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_selectmenu, NULL);
@@ -218,11 +218,11 @@ static void node_make_addmenu(bContext *C, int nodeclass, uiBlock *block)
}
}
-static uiBlock *node_add_inputmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_inputmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_inputmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_inputmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_INPUT, block);
@@ -233,11 +233,11 @@ static uiBlock *node_add_inputmenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_outputmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_outputmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_outputmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_outputmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_OUTPUT, block);
@@ -248,11 +248,11 @@ static uiBlock *node_add_outputmenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_colormenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_colormenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_colormenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_colormenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_OP_COLOR, block);
@@ -263,11 +263,11 @@ static uiBlock *node_add_colormenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_vectormenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_vectormenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_vectormenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_vectormenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_OP_VECTOR, block);
@@ -278,11 +278,11 @@ static uiBlock *node_add_vectormenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_filtermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_filtermenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_filtermenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_filtermenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_OP_FILTER, block);
@@ -293,11 +293,11 @@ static uiBlock *node_add_filtermenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_convertermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_convertermenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_convertermenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_convertermenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_CONVERTOR, block);
@@ -308,11 +308,11 @@ static uiBlock *node_add_convertermenu(bContext *C, uiMenuBlockHandle *handle, v
return block;
}
-static uiBlock *node_add_mattemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_mattemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_mattemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_mattemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_MATTE, block);
@@ -323,11 +323,11 @@ static uiBlock *node_add_mattemenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_distortmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_distortmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_distortmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_distortmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_DISTORT, block);
@@ -338,11 +338,11 @@ static uiBlock *node_add_distortmenu(bContext *C, uiMenuBlockHandle *handle, voi
return block;
}
-static uiBlock *node_add_patternmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_patternmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_patternmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_patternmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_PATTERN, block);
@@ -353,11 +353,11 @@ static uiBlock *node_add_patternmenu(bContext *C, uiMenuBlockHandle *handle, vo
return block;
}
-static uiBlock *node_add_texturemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_texturemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_texturemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_texturemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_TEXTURE, block);
@@ -368,11 +368,11 @@ static uiBlock *node_add_texturemenu(bContext *C, uiMenuBlockHandle *handle, voi
return block;
}
-static uiBlock *node_add_groupmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_groupmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_groupmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_groupmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_GROUP, block);
@@ -384,11 +384,11 @@ static uiBlock *node_add_groupmenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_dynamicmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_dynamicmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_dynamicmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_dynamicmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_OP_DYNAMIC, block);
@@ -400,14 +400,14 @@ static uiBlock *node_add_dynamicmenu(bContext *C, uiMenuBlockHandle *handle, voi
return block;
}
-static uiBlock *node_addmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_addmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "node_addmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_addmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
if(snode->treetype==NTREE_SHADER) {
@@ -521,14 +521,14 @@ static void do_node_nodemenu(bContext *C, void *arg, int event)
ED_area_tag_redraw(curarea);
}
-static uiBlock *node_nodemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_nodemenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "node_nodemenu",
+ block= uiBeginBlock(C, ar, "node_nodemenu",
UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_nodemenu, NULL);
@@ -606,14 +606,14 @@ static void do_node_viewmenu(bContext *C, void *arg, int event)
ED_area_tag_redraw(sa);
}
-static uiBlock *node_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "node_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_viewmenu, NULL);
if (snode->nodetree) {
@@ -773,8 +773,11 @@ void node_header_buttons(const bContext *C, ARegion *ar)
}
}
else if(snode->treetype==NTREE_COMPOSIT) {
- uiDefButS(block, TOG, B_NODE_USESCENE, "Use Nodes", xco+5,yco,90,19, &scene->use_nodes, 0.0f, 0.0f, 0, 0, "Indicate this Scene will use Nodes and execute them while editing");
- xco+= 90;
+ int icon;
+
+ if(WM_jobs_test(CTX_wm_manager(C), sa)) icon= ICON_REC; else icon= ICON_BLANK1;
+ uiDefIconTextButS(block, TOG, B_NODE_USESCENE, icon, "Use Nodes", xco+5,yco,100,19, &scene->use_nodes, 0.0f, 0.0f, 0, 0, "Indicate this Scene will use Nodes and execute them while editing");
+ xco+= 100;
uiDefButBitI(block, TOG, R_COMP_FREE, B_NOP, "Free Unused", xco+5,yco,100,19, &scene->r.scemode, 0.0f, 0.0f, 0, 0, "Free Nodes that are not used while composite");
xco+= 100;
uiDefButBitS(block, TOG, SNODE_BACKDRAW, REDRAWNODE, "Backdrop", xco+5,yco,90,19, &snode->flag, 0.0f, 0.0f, 0, 0, "Use active Viewer Node output as backdrop");
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 0259016b605..fb48e4012ad 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -78,6 +78,8 @@ void node_deselectall(SpaceNode *snode, int swap);
void node_shader_default(Material *ma);
void node_composit_default(Scene *sce);
void node_texture_default(Tex *tx);
+void snode_composite_job(const struct bContext *C, ScrArea *sa);
+bNode *snode_get_editgroup(SpaceNode *snode);
// XXXXXX
diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c
index 851c546507d..55aa53e9821 100644
--- a/source/blender/editors/space_node/node_ops.c
+++ b/source/blender/editors/space_node/node_ops.c
@@ -62,12 +62,20 @@ void node_keymap(struct wmWindowManager *wm)
{
ListBase *keymap= WM_keymap_listbase(wm, "Node", SPACE_NODE, 0);
+ /* mouse select in nodes used to be both keys, it's UI elements... */
+ RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_select", ACTIONMOUSE, KM_PRESS, 0, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_select", SELECTMOUSE, KM_PRESS, 0, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
+ RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_extend_select", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_extend_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
+
WM_keymap_add_item(keymap, "NODE_OT_visibility_toggle", ACTIONMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NODE_OT_fit_all", HOMEKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NODE_OT_border_select", BKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NODE_OT_delete_selection", XKEY, KM_PRESS, 0, 0);
+ /* generates event, needs to be after select to work */
+ WM_keymap_add_item(keymap, "WM_OT_tweak_gesture", ACTIONMOUSE, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "WM_OT_tweak_gesture", SELECTMOUSE, KM_PRESS, 0, 0);
+
transform_keymap_for_space(wm, keymap, SPACE_NODE);
}
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index dad10d34eac..35391dfcda0 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -125,10 +125,9 @@ static int node_select_exec(bContext *C, wmOperator *op)
}
WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL); /* Do we need to pass the scene? */
-
- //WM_event_add_modal_handler(C, &window->handlers, op);
- return /*OPERATOR_RUNNING_MODAL;*/ OPERATOR_FINISHED;
+ /* allow tweak event to work too */
+ return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
}
static int node_select_modal(bContext *C, wmOperator *op, wmEvent *event)
diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c
index 0fe1acd8a1a..908e990fadb 100644
--- a/source/blender/editors/space_node/node_state.c
+++ b/source/blender/editors/space_node/node_state.c
@@ -126,7 +126,7 @@ static int do_header_hidden_node(SpaceNode *snode, bNode *node, float mx, float
return 0;
}
-static void node_toggle_visibility(SpaceNode *snode, ARegion *ar, short *mval)
+static int node_toggle_visibility(SpaceNode *snode, ARegion *ar, short *mval)
{
bNode *node;
float mx, my;
@@ -140,16 +140,17 @@ static void node_toggle_visibility(SpaceNode *snode, ARegion *ar, short *mval)
if(node->flag & NODE_HIDDEN) {
if(do_header_hidden_node(snode, node, mx, my)) {
ED_region_tag_redraw(ar);
- break;
+ return 1;
}
}
else {
if(do_header_node(snode, node, mx, my)) {
ED_region_tag_redraw(ar);
- break;
+ return 1;
}
}
}
+ return 0;
}
static int node_toggle_visibility_exec(bContext *C, wmOperator *op)
@@ -160,9 +161,10 @@ static int node_toggle_visibility_exec(bContext *C, wmOperator *op)
mval[0] = RNA_int_get(op->ptr, "mouse_x");
mval[1] = RNA_int_get(op->ptr, "mouse_y");
- node_toggle_visibility(snode, ar, mval);
-
- return OPERATOR_FINISHED;
+ if(node_toggle_visibility(snode, ar, mval))
+ return OPERATOR_FINISHED;
+ else
+ return OPERATOR_PASS_THROUGH;
}
static int node_toggle_visibility_invoke(bContext *C, wmOperator *op, wmEvent *event)
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index f50a3640385..659069e321d 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -141,7 +141,14 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
/* preview renders */
switch(wmn->category) {
case NC_SCENE:
+ if(wmn->data==ND_NODES)
+ ED_area_tag_refresh(sa);
+ break;
+ case NC_WM:
+ if(wmn->data==ND_FILEREAD)
+ ED_area_tag_refresh(sa);
break;
+
case NC_MATERIAL:
/* future: add ID check? */
if(wmn->data==ND_SHADING)
@@ -155,11 +162,13 @@ static void node_area_refresh(const struct bContext *C, struct ScrArea *sa)
/* default now: refresh node is starting preview */
SpaceNode *snode= sa->spacedata.first;
- if(snode->treetype==NTREE_SHADER) {
- if(snode->nodetree) {
-
+ if(snode->nodetree) {
+ if(snode->treetype==NTREE_SHADER) {
ED_preview_shader_job(C, sa, snode->id, 100, 100);
}
+ else if(snode->treetype==NTREE_COMPOSIT) {
+ snode_composite_job(C, sa);
+ }
}
}
@@ -250,7 +259,8 @@ static void node_header_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_restore(C);
}
-static void node_main_area_listener(ARegion *ar, wmNotifier *wmn)
+/* used for header + main area */
+static void node_region_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
switch(wmn->category) {
@@ -304,7 +314,7 @@ void ED_spacetype_node(void)
art->regionid = RGN_TYPE_WINDOW;
art->init= node_main_area_init;
art->draw= node_main_area_draw;
- art->listener= node_main_area_listener;
+ art->listener= node_region_listener;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
BLI_addhead(&st->regiontypes, art);
@@ -314,7 +324,7 @@ void ED_spacetype_node(void)
art->regionid = RGN_TYPE_HEADER;
art->minsizey= HEADERY;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
-
+ art->listener= node_region_listener;
art->init= node_header_area_init;
art->draw= node_header_area_draw;
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index f4a3a9770cd..f61ea3d2746 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -33,6 +33,7 @@
#include "MEM_guardedalloc.h"
+#include "DNA_anim_types.h"
#include "DNA_action_types.h"
#include "DNA_armature_types.h"
#include "DNA_constraint_types.h"
@@ -590,6 +591,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
te->index= index; // for data arays
if(ELEM3(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP));
else if(ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM));
+ else if(type==TSE_ANIM_DATA);
else {
te->name= id->name+2; // default, can be overridden by Library or non-ID data
te->idcode= GS(id->name);
@@ -612,6 +614,8 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
{
Object *ob= (Object *)id;
+ outliner_add_element(soops, &te->subtree, ob->adt, te, TSE_ANIM_DATA, 0);
+
if(ob->proxy && ob->id.lib==NULL)
outliner_add_element(soops, &te->subtree, ob->proxy, te, TSE_PROXY, 0);
@@ -696,9 +700,6 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
}
}
- outliner_add_element(soops, &te->subtree, ob->ipo, te, 0, 0);
- outliner_add_element(soops, &te->subtree, ob->action, te, 0, 0);
-
for(a=0; a<ob->totcol; a++)
outliner_add_element(soops, &te->subtree, ob->mat[a], te, 0, a);
@@ -778,27 +779,16 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
}
if(ob->dup_group)
- outliner_add_element(soops, &te->subtree, ob->dup_group, te, 0, 0);
-
- if(ob->nlastrips.first) {
- bActionStrip *strip;
- TreeElement *ten;
- TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_NLA, 0);
- int a= 0;
-
- tenla->name= "NLA strips";
- for (strip=ob->nlastrips.first; strip; strip=strip->next, a++) {
- ten= outliner_add_element(soops, &tenla->subtree, strip->act, tenla, TSE_NLA_ACTION, a);
- if(ten) ten->directdata= strip;
- }
- }
+ outliner_add_element(soops, &te->subtree, ob->dup_group, te, 0, 0);
}
break;
case ID_ME:
{
Mesh *me= (Mesh *)id;
- outliner_add_element(soops, &te->subtree, me->ipo, te, 0, 0);
+
+ //outliner_add_element(soops, &te->subtree, me->adt, te, TSE_ANIM_DATA, 0);
+
outliner_add_element(soops, &te->subtree, me->key, te, 0, 0);
for(a=0; a<me->totcol; a++)
outliner_add_element(soops, &te->subtree, me->mat[a], te, 0, a);
@@ -809,6 +799,9 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
case ID_CU:
{
Curve *cu= (Curve *)id;
+
+ outliner_add_element(soops, &te->subtree, cu->adt, te, TSE_ANIM_DATA, 0);
+
for(a=0; a<cu->totcol; a++)
outliner_add_element(soops, &te->subtree, cu->mat[a], te, 0, a);
}
@@ -824,7 +817,8 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
{
Material *ma= (Material *)id;
- outliner_add_element(soops, &te->subtree, ma->ipo, te, 0, 0);
+ outliner_add_element(soops, &te->subtree, ma->adt, te, TSE_ANIM_DATA, 0);
+
for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a]) outliner_add_element(soops, &te->subtree, ma->mtex[a]->tex, te, 0, a);
}
@@ -834,20 +828,22 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
{
Tex *tex= (Tex *)id;
- outliner_add_element(soops, &te->subtree, tex->ipo, te, 0, 0);
+ outliner_add_element(soops, &te->subtree, tex->adt, te, TSE_ANIM_DATA, 0);
outliner_add_element(soops, &te->subtree, tex->ima, te, 0, 0);
}
break;
case ID_CA:
{
Camera *ca= (Camera *)id;
- outliner_add_element(soops, &te->subtree, ca->ipo, te, 0, 0);
+ outliner_add_element(soops, &te->subtree, ca->adt, te, TSE_ANIM_DATA, 0);
}
break;
case ID_LA:
{
Lamp *la= (Lamp *)id;
- outliner_add_element(soops, &te->subtree, la->ipo, te, 0, 0);
+
+ outliner_add_element(soops, &te->subtree, la->adt, te, TSE_ANIM_DATA, 0);
+
for(a=0; a<MAX_MTEX; a++) {
if(la->mtex[a]) outliner_add_element(soops, &te->subtree, la->mtex[a]->tex, te, 0, a);
}
@@ -856,7 +852,9 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
case ID_WO:
{
World *wrld= (World *)id;
- outliner_add_element(soops, &te->subtree, wrld->ipo, te, 0, 0);
+
+ outliner_add_element(soops, &te->subtree, wrld->adt, te, TSE_ANIM_DATA, 0);
+
for(a=0; a<MAX_MTEX; a++) {
if(wrld->mtex[a]) outliner_add_element(soops, &te->subtree, wrld->mtex[a]->tex, te, 0, a);
}
@@ -865,35 +863,14 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
case ID_KE:
{
Key *key= (Key *)id;
- outliner_add_element(soops, &te->subtree, key->ipo, te, 0, 0);
- }
- break;
- case ID_IP:
- {
- Ipo *ipo= (Ipo *)id;
- IpoCurve *icu;
- Object *lastadded= NULL;
- for (icu= ipo->curve.first; icu; icu= icu->next) {
- if (icu->driver && icu->driver->ob) {
- if (lastadded != icu->driver->ob) {
- outliner_add_element(soops, &te->subtree, icu->driver->ob, te, TSE_LINKED_OB, 0);
- lastadded= icu->driver->ob;
- }
- }
- }
+ outliner_add_element(soops, &te->subtree, key->adt, te, TSE_ANIM_DATA, 0);
}
break;
case ID_AC:
{
- bAction *act= (bAction *)id;
- bActionChannel *chan;
- int a= 0;
-
- tselem= TREESTORE(parent);
- for (chan=act->chanbase.first; chan; chan=chan->next, a++) {
- outliner_add_element(soops, &te->subtree, chan->ipo, te, 0, a);
- }
+ // XXX do we want to be exposing the F-Curves here?
+ //bAction *act= (bAction *)id;
}
break;
case ID_AR:
@@ -940,6 +917,56 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
break;
}
}
+ else if(type==TSE_ANIM_DATA) {
+ AnimData *adt= (AnimData *)idv;
+
+ /* this element's info */
+ te->name= "Animation";
+
+ /* Action */
+ outliner_add_element(soops, &te->subtree, adt->action, te, 0, 0);
+
+ /* Drivers */
+ if (adt->drivers.first) {
+ TreeElement *ted= outliner_add_element(soops, &te->subtree, adt, te, TSE_DRIVER_BASE, 0);
+ ID *lastadded= NULL;
+ FCurve *fcu;
+
+ ted->name= "Drivers";
+
+ for (fcu= adt->drivers.first; fcu; fcu= fcu->next) {
+ if (fcu->driver && fcu->driver->id) {
+ if (lastadded != fcu->driver->id) {
+ outliner_add_element(soops, &ted->subtree, fcu->driver->id, ted, TSE_LINKED_OB, 0);
+ lastadded= fcu->driver->id;
+ }
+ }
+ }
+ }
+
+ /* NLA Data */
+ if (adt->nla_tracks.first) {
+#if 0
+ TreeElement *tenla= outliner_add_element(soops, &te->subtree, adt, te, TSE_NLA, 0);
+ NlaTrack *nlt;
+ int a= 0;
+
+ tenla->name= "NLA Tracks";
+
+ for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
+ TreeElement *tenlt= outliner_add_element(soops, &te->subtree, nlt, te, TSE_NLA_TRACK, a);
+ bActionStrip *strip;
+ TreeElement *ten;
+ int b= 0;
+
+ for (strip=nlt->strips.first; strip; strip=strip->next, a++) {
+ ten= outliner_add_element(soops, &tenla->subtree, strip->act, tenla, TSE_NLA_ACTION, a);
+ if(ten) ten->directdata= strip;
+ }
+ }
+#endif
+ }
+ }
else if(type==TSE_SEQUENCE) {
Sequence *seq= (Sequence*) idv;
Sequence *p;
@@ -1320,11 +1347,10 @@ static void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
}
else if(soops->outlinevis==SO_SEQUENCE) {
Sequence *seq;
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
int op;
- ed= scene->ed;
- if(!ed)
+ if(ed==NULL)
return;
seq= ed->seqbasep->first;
@@ -1834,75 +1860,6 @@ static int tree_element_active_world(Scene *scene, SpaceOops *soops, TreeElement
return 0;
}
-static int tree_element_active_ipo(Scene *scene, SpaceOops *soops, TreeElement *te, int set)
-{
- TreeElement *tes;
- TreeStoreElem *tselems=NULL;
- Object *ob;
-
- /* we search for the object parent */
- ob= (Object *)outliner_search_back(soops, te, ID_OB);
- if(ob==NULL || ob!=OBACT) return 0; // just paranoia
-
- /* the parent of ipo */
- tes= te->parent;
- tselems= TREESTORE(tes);
-
- if(set) {
- if(tes->idcode==ID_AC) {
- if(ob->ipoflag & OB_ACTION_OB)
- ob->ipowin= ID_OB;
- else if(ob->ipoflag & OB_ACTION_KEY)
- ob->ipowin= ID_KE;
- else
- ob->ipowin= ID_PO;
- }
- else ob->ipowin= tes->idcode;
-
- if(ob->ipowin==ID_MA) tree_element_active_material(scene, soops, tes, 1);
- else if(ob->ipowin==ID_AC) {
- bActionChannel *chan;
- short a=0;
- for(chan=ob->action->chanbase.first; chan; chan= chan->next) {
- if(a==te->index) break;
- if(chan->ipo) a++;
- }
-// XXX deselect_actionchannels(ob->action, 0);
-// if (chan)
-// select_channel(ob->action, chan, SELECT_ADD);
- allqueue(REDRAWACTION, ob->ipowin);
- allqueue(REDRAWVIEW3D, ob->ipowin);
- }
-
- allqueue(REDRAWIPO, ob->ipowin);
- }
- else {
- if(tes->idcode==ID_AC) {
- if(ob->ipoflag & OB_ACTION_OB)
- return ob->ipowin==ID_OB;
- else if(ob->ipoflag & OB_ACTION_KEY)
- return ob->ipowin==ID_KE;
- else if(ob->ipowin==ID_AC) {
- bActionChannel *chan;
- short a=0;
- for(chan=ob->action->chanbase.first; chan; chan= chan->next) {
- if(a==te->index) break;
- if(chan->ipo) a++;
- }
-// XXX if(chan==get_hilighted_action_channel(ob->action)) return 1;
- }
- }
- else if(ob->ipowin==tes->idcode) {
- if(ob->ipowin==ID_MA) {
- Material *ma= give_current_material(ob, ob->actcol);
- if(ma==(Material *)tselems->id) return 1;
- }
- else return 1;
- }
- }
- return 0;
-}
-
static int tree_element_active_defgroup(Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
{
Object *ob;
@@ -1921,26 +1878,6 @@ static int tree_element_active_defgroup(Scene *scene, TreeElement *te, TreeStore
return 0;
}
-static int tree_element_active_nla_action(TreeElement *te, TreeStoreElem *tselem, int set)
-{
- if(set) {
- bActionStrip *strip= te->directdata;
- if(strip) {
-// XXX deselect_nlachannel_keys(0);
- strip->flag |= ACTSTRIP_SELECT;
- allqueue(REDRAWNLA, 0);
- }
- }
- else {
- /* id in tselem is action */
- bActionStrip *strip= te->directdata;
- if(strip) {
- if(strip->flag & ACTSTRIP_SELECT) return 1;
- }
- }
- return 0;
-}
-
static int tree_element_active_posegroup(Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
{
Object *ob= (Object *)tselem->id;
@@ -2086,8 +2023,6 @@ static int tree_element_active(Scene *scene, SpaceOops *soops, TreeElement *te,
return tree_element_active_world(scene, soops, te, set);
case ID_LA:
return tree_element_active_lamp(scene, soops, te, set);
- case ID_IP:
- return tree_element_active_ipo(scene, soops, te, set);
case ID_TE:
return tree_element_active_texture(scene, soops, te, set);
case ID_TXT:
@@ -2129,7 +2064,7 @@ static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *tselem,
static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
{
Sequence *seq, *p;
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
seq= (Sequence*)te->directdata;
if(set==0) {
@@ -2139,7 +2074,6 @@ static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeS
}
// XXX select_single_seq(seq, 1);
- ed= scene->ed;
p= ed->seqbasep->first;
while(p) {
if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
@@ -2161,8 +2095,6 @@ static int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops,
{
switch(tselem->type) {
- case TSE_NLA_ACTION:
- return tree_element_active_nla_action(te, tselem, set);
case TSE_DEFGROUP:
return tree_element_active_defgroup(scene, te, tselem, set);
case TSE_BONE:
@@ -2235,7 +2167,7 @@ static int do_outliner_mouse_event(bContext *C, Scene *scene, ARegion *ar, Space
if(event==LEFTMOUSE) {
if (ctrl) {
- if(ELEM9(tselem->type, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
+ if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
error("Cannot edit builtin name");
else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP))
error("Cannot edit sequence name");
@@ -3243,10 +3175,10 @@ static int tselem_rna_icon(PointerRNA *ptr)
return ICON_TPAINT_HLT;
else if(rnatype == &RNA_Library)
return ICON_LIBRARY_DEHLT;
- /*else if(rnatype == &RNA_Action)
- return ICON_ACTION;*/
- else if(rnatype == &RNA_Ipo)
- return ICON_IPO_DEHLT;
+ else if(rnatype == &RNA_Action)
+ return ICON_ACTION;
+ //else if(rnatype == &RNA_Ipo)
+ // return ICON_IPO_DEHLT;
else if(rnatype == &RNA_Key)
return ICON_SHAPEKEY;
else if(rnatype == &RNA_Main)
@@ -3320,6 +3252,8 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen
{
if(tselem->type) {
switch( tselem->type) {
+ case TSE_ANIM_DATA:
+ UI_icon_draw(x, y, ICON_IPO_DEHLT); break; // xxx
case TSE_NLA:
UI_icon_draw(x, y, ICON_NLA); break;
case TSE_NLA_ACTION:
@@ -3466,8 +3400,6 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen
UI_icon_draw(x, y, ICON_MATERIAL_DEHLT); break;
case ID_TE:
UI_icon_draw(x, y, ICON_TEXTURE_DEHLT); break;
- case ID_IP:
- UI_icon_draw(x, y, ICON_IPO_DEHLT); break;
case ID_IM:
UI_icon_draw(x, y, ICON_IMAGE_DEHLT); break;
case ID_SO:
diff --git a/source/blender/editors/space_outliner/outliner_header.c b/source/blender/editors/space_outliner/outliner_header.c
index f0cf5480e71..1f3bf71f814 100644
--- a/source/blender/editors/space_outliner/outliner_header.c
+++ b/source/blender/editors/space_outliner/outliner_header.c
@@ -111,14 +111,14 @@ static void do_viewmenu(bContext *C, void *arg, int event)
ED_area_tag_redraw(curarea);
}
-static uiBlock *outliner_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *outliner_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceOops *soops= curarea->spacedata.first;
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "outliner_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "outliner_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
if(soops->type==SO_OUTLINER) {
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 84b6babb269..4f621098105 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -60,7 +60,7 @@ typedef struct TreeElement {
#define TE_FREE_NAME 8
/* TreeStoreElem types */
-#define TSE_NLA 1
+#define TSE_NLA 1
#define TSE_NLA_ACTION 2
#define TSE_DEFGROUP_BASE 3
#define TSE_DEFGROUP 4
@@ -74,6 +74,9 @@ typedef struct TreeElement {
#define TSE_SCRIPT_BASE 12
#define TSE_POSE_BASE 13
#define TSE_POSE_CHANNEL 14
+#define TSE_ANIM_DATA 15
+#define TSE_DRIVER_BASE 16
+#define TSE_DRIVER 17
#define TSE_PROXY 18
#define TSE_R_LAYER_BASE 19
diff --git a/source/blender/editors/space_script/script_header.c b/source/blender/editors/space_script/script_header.c
index 37e77e1497a..2a7006348b3 100644
--- a/source/blender/editors/space_script/script_header.c
+++ b/source/blender/editors/space_script/script_header.c
@@ -65,13 +65,13 @@ static void do_viewmenu(bContext *C, void *arg, int event)
}
-static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index cff145c5046..60a7aaebd91 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -143,7 +143,7 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, w
static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, TRUE);
Scene *sce_seq;
char sce_name[MAX_ID_NAME-2];
@@ -230,7 +230,7 @@ void SEQUENCER_OT_add_scene_strip(struct wmOperatorType *ot)
static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, TRUE);
struct anim *an;
char filename[FILE_MAX];
@@ -317,7 +317,7 @@ void SEQUENCER_OT_add_movie_strip(struct wmOperatorType *ot)
static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, TRUE);
bSound *sound;
@@ -415,7 +415,7 @@ void SEQUENCER_OT_add_sound_strip(struct wmOperatorType *ot)
static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, TRUE);
int tot_images= 1; //XXX FIXME, we need string arrays!
@@ -506,7 +506,7 @@ void SEQUENCER_OT_add_image_strip(struct wmOperatorType *ot)
static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, TRUE);
Sequence *seq; /* generic strip vars */
Strip *strip;
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index ee03aee3fab..0068c03f6f9 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -988,12 +988,12 @@ void drawseqspace(const bContext *C, ARegion *ar)
Scene *scene= CTX_data_scene(C);
View2D *v2d= &ar->v2d;
View2DScrollers *scrollers;
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
float col[3];
int i;
- ed= scene->ed;
+
if(sseq->mainb != SEQ_DRAW_SEQUENCE) {
draw_image_seq(scene, ar, sseq);
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index fde72f64efb..6d45195cc02 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -142,27 +142,25 @@ typedef struct TransSeq {
Sequence *get_last_seq(Scene *scene)
{
- Editing *ed;
- ed= scene->ed;
- if(!ed) return NULL;
+ Editing *ed= seq_give_editing(scene, FALSE);
+ if(ed==NULL) return NULL;
return ed->act_seq;
}
void set_last_seq(Scene *scene, Sequence *seq)
{
- Editing *ed;
- ed= scene->ed;
- if(!ed) return;
+ Editing *ed= seq_give_editing(scene, FALSE);
+ if(ed==NULL) return;
ed->act_seq= seq;
}
Sequence *get_forground_frame_seq(Scene *scene, int frame)
{
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq, *best_seq=NULL;
int best_machine = -1;
- ed= scene->ed;
+
if(!ed) return NULL;
for (seq=ed->seqbasep->first; seq; seq= seq->next) {
@@ -191,7 +189,7 @@ void seq_rectf(Sequence *seq, rctf *rectf)
static void change_plugin_seq(Scene *scene, char *str) /* called from fileselect */
{
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
struct SeqEffectHandle sh;
Sequence *last_seq= get_last_seq(scene);
@@ -214,10 +212,10 @@ static void change_plugin_seq(Scene *scene, char *str) /* called from fileselect
void boundbox_seq(Scene *scene, rctf *rect)
{
Sequence *seq;
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
float min[2], max[2];
- ed= scene->ed;
+
if(ed==NULL) return;
min[0]= 0.0;
@@ -262,10 +260,10 @@ Sequence *find_neighboring_sequence(Scene *scene, Sequence *test, int lr, int se
/* looks to the left on lr==1, to the right on lr==2
sel - 0==unselected, 1==selected, -1==done care*/
Sequence *seq;
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
- ed= scene->ed;
- if(ed==NULL) return 0;
+
+ if(ed==NULL) return NULL;
if (sel>0) sel = SELECT;
@@ -299,13 +297,13 @@ Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, int sel)
/* looks to the left on lr==1, to the right on lr==2
sel - 0==unselected, 1==selected, -1==done care*/
Sequence *seq,*best_seq = NULL;
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
int dist, best_dist;
best_dist = MAXFRAME*2;
- ed= scene->ed;
- if(ed==NULL) return 0;
+
+ if(ed==NULL) return NULL;
if (sel) sel = SELECT;
@@ -348,15 +346,15 @@ Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, int sel)
Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, short mval[2])
{
Sequence *seq;
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
float x, y;
float pixelx;
float handsize;
float displen;
*hand= 0;
- ed= scene->ed;
- if(ed==NULL) return 0;
+
+ if(ed==NULL) return NULL;
pixelx = (v2d->cur.xmax - v2d->cur.xmin)/(v2d->mask.xmax - v2d->mask.xmin);
@@ -471,9 +469,9 @@ static int seq_is_predecessor(Sequence *pred, Sequence *seq)
void deselect_all_seq(Scene *scene)
{
Sequence *seq;
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
- ed= scene->ed;
+
if(ed==NULL) return;
SEQP_BEGIN(ed, seq) {
@@ -588,12 +586,12 @@ static void reload_sound_strip(Scene *scene, char *name)
static void reload_image_strip(Scene *scene, char *name)
{
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq, *seqact;
SpaceFile *sfile;
Sequence *last_seq= get_last_seq(scene);
- ed= scene->ed;
+
if(last_seq==0 || last_seq->type!=SEQ_IMAGE) return;
seqact= last_seq; /* last_seq changes in alloc_sequence */
@@ -626,7 +624,7 @@ static void reload_image_strip(Scene *scene, char *name)
void change_sequence(Scene *scene)
{
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *last_seq= get_last_seq(scene);
Scene *sce;
short event;
@@ -724,7 +722,7 @@ void change_sequence(Scene *scene)
int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequence **selseq1, Sequence **selseq2, Sequence **selseq3, char **error_str)
{
- Editing *ed = scene->ed;
+ Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq1= 0, *seq2= 0, *seq3= 0, *seq;
*error_str= NULL;
@@ -792,7 +790,7 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen
void reassign_inputs_seq_effect(Scene *scene)
{
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq1, *seq2, *seq3, *last_seq = get_last_seq(scene);
char *error_msg;
@@ -861,6 +859,7 @@ static Sequence *del_seq_find_replace_recurs(Scene *scene, Sequence *seq)
static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short deleteall)
{
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq, *seqn;
Sequence *last_seq = get_last_seq(scene);
@@ -875,7 +874,7 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de
if(seq==last_seq) set_last_seq(scene, NULL);
if(seq->type==SEQ_META) recurs_del_seq_flag(scene, &seq->seqbase, flag, 1);
if(seq->ipo) seq->ipo->id.us--;
- seq_free_sequence((Editing *)scene->ed, seq);
+ seq_free_sequence(ed, seq);
}
seq= seqn;
}
@@ -1218,11 +1217,11 @@ static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe
int insert_gap(Scene *scene, int gap, int cfra)
{
Sequence *seq;
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
int done=0;
/* all strips >= cfra are shifted */
- ed= scene->ed;
+
if(ed==NULL) return 0;
SEQP_BEGIN(ed, seq) {
@@ -1240,11 +1239,11 @@ int insert_gap(Scene *scene, int gap, int cfra)
void touch_seq_files(Scene *scene)
{
Sequence *seq;
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
char str[256];
/* touch all strips with movies */
- ed= scene->ed;
+
if(ed==NULL) return;
if(okee("Touch and print selected movies")==0) return;
@@ -1270,9 +1269,9 @@ void touch_seq_files(Scene *scene)
void set_filter_seq(Scene *scene)
{
Sequence *seq;
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
- ed= scene->ed;
+
if(ed==NULL) return;
if(okee("Set Deinterlace")==0) return;
@@ -1293,11 +1292,11 @@ void set_filter_seq(Scene *scene)
void seq_remap_paths(Scene *scene)
{
Sequence *seq, *last_seq = get_last_seq(scene);
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
char from[FILE_MAX], to[FILE_MAX], stripped[FILE_MAX];
- ed= scene->ed;
- if(ed==NULL || last_seq==NULL)
+
+ if(last_seq==NULL)
return;
BLI_strncpy(from, last_seq->strip->dir, FILE_MAX);
@@ -1335,10 +1334,10 @@ void seq_remap_paths(Scene *scene)
void no_gaps(Scene *scene)
{
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
int cfra, first= 0, done;
- ed= scene->ed;
+
if(ed==NULL) return;
for(cfra= CFRA; cfra<=EFRA; cfra++) {
@@ -1376,10 +1375,10 @@ static int seq_get_snaplimit(View2D *v2d)
void seq_snap(Scene *scene, short event)
{
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
- ed= scene->ed;
+
if(ed==NULL) return;
/* problem: contents of meta's are all shifted to the same position... */
@@ -1443,10 +1442,13 @@ void seq_snap_menu(Scene *scene)
static int sequencer_mute_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
int selected;
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
+
selected= RNA_enum_is_equal(op->ptr, "type", "SELECTED");
@@ -1492,10 +1494,13 @@ void SEQUENCER_OT_mute(struct wmOperatorType *ot)
static int sequencer_unmute_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
int selected;
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
+
selected= RNA_enum_is_equal(op->ptr, "type", "SELECTED");
@@ -1541,9 +1546,12 @@ void SEQUENCER_OT_unmute(struct wmOperatorType *ot)
static int sequencer_lock_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
+
for(seq= ed->seqbasep->first; seq; seq= seq->next) {
if (seq->flag & SELECT) {
seq->flag |= SEQ_LOCK;
@@ -1574,9 +1582,12 @@ void SEQUENCER_OT_lock(struct wmOperatorType *ot)
static int sequencer_unlock_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
+
for(seq= ed->seqbasep->first; seq; seq= seq->next) {
if (seq->flag & SELECT) {
seq->flag &= ~SEQ_LOCK;
@@ -1606,9 +1617,12 @@ void SEQUENCER_OT_unlock(struct wmOperatorType *ot)
static int sequencer_reload_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
+
for(seq= ed->seqbasep->first; seq; seq= seq->next) {
if(seq->flag & SELECT) {
update_changed_seq_and_deps(scene, seq, 0, 1);
@@ -1639,8 +1653,10 @@ void SEQUENCER_OT_reload(struct wmOperatorType *ot)
static int sequencer_refresh_all_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
free_imbuf_seq(&ed->seqbase);
@@ -1680,12 +1696,15 @@ static EnumPropertyItem prop_cut_types[] = {
static int sequencer_cut_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
int cut_side, cut_hard, cut_frame;
ListBase newlist;
int changed;
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
+
cut_frame= RNA_int_get(op->ptr, "frame");
cut_hard= RNA_enum_get(op->ptr, "type");
cut_side= RNA_enum_get(op->ptr, "side");
@@ -1771,11 +1790,12 @@ void SEQUENCER_OT_cut(struct wmOperatorType *ot)
static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
- ListBase new;
+ ListBase new= {NULL, NULL};
- new.first= new.last= 0;
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
recurs_dupli_seq(scene, ed->seqbasep, &new);
addlisttolist(ed->seqbasep, &new);
@@ -1817,11 +1837,13 @@ void SEQUENCER_OT_add_duplicate(wmOperatorType *ot)
static int sequencer_delete_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
MetaStack *ms;
int nothingSelected = TRUE;
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
seq=get_last_seq(scene);
if (seq && seq->flag & SELECT) { /* avoid a loop since this is likely to be selected */
@@ -1893,7 +1915,7 @@ void SEQUENCER_OT_delete(wmOperatorType *ot)
static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq, *seq_new, *seq_next;
Strip *strip_new;
@@ -1905,6 +1927,9 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
// if (!do_clever_numbuts("Separate Images", 1, REDRAW))
// return;
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
+
seq= ed->seqbasep->first;
while (seq) {
@@ -1983,11 +2008,12 @@ void SEQUENCER_OT_separate_images(wmOperatorType *ot)
static int sequencer_meta_toggle_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *last_seq= get_last_seq(scene);
MetaStack *ms;
-
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
if(last_seq && last_seq->type==SEQ_META && last_seq->flag & SELECT) {
/* Enter Metastrip */
@@ -2050,12 +2076,15 @@ void SEQUENCER_OT_meta_toggle(wmOperatorType *ot)
static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq, *seqm, *next;
int tot;
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
+
/* is there more than 1 select */
tot= 0;
seq= ed->seqbasep->first;
@@ -2104,7 +2133,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
/* remove all selected from main list, and put in meta */
- seqm= alloc_sequence(((Editing *)scene->ed)->seqbasep, 1, 1);
+ seqm= alloc_sequence(ed->seqbasep, 1, 1);
seqm->type= SEQ_META;
seqm->flag= SELECT;
@@ -2160,11 +2189,11 @@ static int seq_depends_on_meta(Sequence *seq, Sequence *seqm)
static int sequencer_meta_separate_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
- Sequence *seq, *last_seq = get_last_seq(scene);
+ Sequence *seq, *last_seq = get_last_seq(scene); /* last_seq checks ed==NULL */
- if(last_seq==0 || last_seq->type!=SEQ_META)
+ if(last_seq==NULL || last_seq->type!=SEQ_META)
return OPERATOR_CANCELLED;
addlisttolist(ed->seqbasep, &last_seq->seqbase);
@@ -2284,7 +2313,7 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *op)
View2D *v2d= UI_view2d_fromcontext(C);
ScrArea *area= CTX_wm_area(C);
bScreen *sc= CTX_wm_screen(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
int xmin= MAXFRAME*2;
@@ -2296,7 +2325,9 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *op)
int ymargin= 1;
int xmargin= FPS;
-
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
+
for(seq=ed->seqbasep->first; seq; seq=seq->next) {
if(seq->flag & SELECT) {
xmin= MIN2(xmin, seq->startdisp);
diff --git a/source/blender/editors/space_sequencer/sequencer_header.c b/source/blender/editors/space_sequencer/sequencer_header.c
index 88dec2287e6..8ae10bfb0bf 100644
--- a/source/blender/editors/space_sequencer/sequencer_header.c
+++ b/source/blender/editors/space_sequencer/sequencer_header.c
@@ -39,6 +39,7 @@
#include "BLI_blenlib.h"
+#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
#include "BKE_sequence.h"
@@ -71,13 +72,13 @@
#define B_IPOBORDER 4
#define B_SEQCLEAR 5
-static uiBlock *seq_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *seq_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *sa= CTX_wm_area(C);
SpaceSeq *sseq= sa->spacedata.first;
View2D *v2d= UI_view2d_fromcontext(C);
- uiBlock *block= uiBeginBlock(C, handle->region, "seq_viewmenu", UI_EMBOSSP, UI_HELV);
+ uiBlock *block= uiBeginBlock(C, ar, "seq_viewmenu", UI_EMBOSSP, UI_HELV);
short yco= 0, menuwidth=120;
if (sseq->mainb == SEQ_DRAW_SEQUENCE) {
@@ -145,11 +146,11 @@ static uiBlock *seq_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_u
return block;
}
-static uiBlock *seq_selectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *seq_selectmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *sa= CTX_wm_area(C);
- uiBlock *block= uiBeginBlock(C, handle->region, "seq_selectmenu", UI_EMBOSSP, UI_HELV);
+ uiBlock *block= uiBeginBlock(C, ar, "seq_selectmenu", UI_EMBOSSP, UI_HELV);
uiBut *but;
but= uiDefMenuButO(block, "SEQUENCER_OT_select_active_side", "Strips to the Left");
@@ -187,13 +188,13 @@ static uiBlock *seq_selectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg
return block;
}
-static uiBlock *seq_markermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *seq_markermenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *sa= CTX_wm_area(C);
SpaceSeq *sseq= sa->spacedata.first;
- uiBlock *block= uiBeginBlock(C, handle->region, "seq_markermenu", UI_EMBOSSP, UI_HELV);
+ uiBlock *block= uiBeginBlock(C, ar, "seq_markermenu", UI_EMBOSSP, UI_HELV);
short yco= 0, menuwidth=120;
@@ -234,9 +235,9 @@ static uiBlock *seq_markermenu(bContext *C, uiMenuBlockHandle *handle, void *arg
return block;
}
-static uiBlock *seq_addmenu_effectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *seq_addmenu_effectmenu(bContext *C, ARegion *ar, void *arg_unused)
{
- uiBlock *block= uiBeginBlock(C, handle->region, "seq_addmenu_effectmenu", UI_EMBOSSP, UI_HELV);
+ uiBlock *block= uiBeginBlock(C, ar, "seq_addmenu_effectmenu", UI_EMBOSSP, UI_HELV);
RNA_enum_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Add")), "type", SEQ_ADD);
@@ -265,10 +266,10 @@ static uiBlock *seq_addmenu_effectmenu(bContext *C, uiMenuBlockHandle *handle, v
}
-static uiBlock *seq_addmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *seq_addmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *sa= CTX_wm_area(C);
- uiBlock *block= uiBeginBlock(C, handle->region, "seq_addmenu", UI_EMBOSSP, UI_HELV);
+ uiBlock *block= uiBeginBlock(C, ar, "seq_addmenu", UI_EMBOSSP, UI_HELV);
uiBut *but;
uiDefMenuSub(block, seq_addmenu_effectmenu, "Effect");
@@ -282,14 +283,14 @@ static uiBlock *seq_addmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_un
#else
uiDefMenuButO(block, "SEQUENCER_OT_add_sound_strip", NULL);
#endif
- but= uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Color");
+ but= uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Add Color Strip");
RNA_enum_set(uiButGetOperatorPtrRNA(but), "type", SEQ_COLOR);
uiDefMenuButO(block, "SEQUENCER_OT_add_image_strip", NULL);
uiDefMenuButO(block, "SEQUENCER_OT_add_movie_strip", NULL);
uiDefMenuButO(block, "SEQUENCER_OT_add_scene_strip", NULL);
#ifdef WITH_FFMPEG
- but= uiDefMenuButO(block, "SEQUENCER_OT_add_movie_strip");
+ but= uiDefMenuButO(block, "SEQUENCER_OT_add_movie_strip", NULL);
RNA_boolean_set(uiButGetOperatorPtrRNA(but), "sound", TRUE);
#endif
@@ -307,13 +308,13 @@ static uiBlock *seq_addmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_un
return block;
}
-static uiBlock *seq_editmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *seq_editmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *sa= CTX_wm_area(C);
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
- uiBlock *block= uiBeginBlock(C, handle->region, "seq_editmenu", UI_EMBOSSP, UI_HELV);
+ uiBlock *block= uiBeginBlock(C, ar, "seq_editmenu", UI_EMBOSSP, UI_HELV);
uiBut *but;
@@ -331,7 +332,7 @@ static uiBlock *seq_editmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_u
uiDefMenuButO(block, "SEQUENCER_OT_add_duplicate", NULL);
uiDefMenuButO(block, "SEQUENCER_OT_delete", NULL);
- if (ed->act_seq) {
+ if (ed && ed->act_seq) {
switch(ed->act_seq->type) {
case SEQ_EFFECT:
uiDefMenuSep(block);
@@ -358,7 +359,7 @@ static uiBlock *seq_editmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_u
uiDefMenuButO(block, "SEQUENCER_OT_meta_make", NULL);
uiDefMenuButO(block, "SEQUENCER_OT_meta_separate", NULL);
- if ((ed && ed->metastack.first) || (ed->act_seq && ed->act_seq->type == SEQ_META)) {
+ if (ed && (ed->metastack.first || (ed->act_seq && ed->act_seq->type == SEQ_META))) {
uiDefMenuSep(block);
uiDefMenuButO(block, "SEQUENCER_OT_meta_toggle", NULL);
}
@@ -392,7 +393,7 @@ void sequencer_header_buttons(const bContext *C, ARegion *ar)
ScrArea *sa= CTX_wm_area(C);
SpaceSeq *sseq= sa->spacedata.first;
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
uiBlock *block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
int xco=3, yco= 3;
@@ -406,23 +407,23 @@ void sequencer_header_buttons(const bContext *C, ARegion *ar)
uiBlockSetEmboss(block, UI_EMBOSSP);
xmax= GetButStringLength("View");
- uiDefPulldownBut(block, seq_viewmenu, sa, "View", xco, yco, xmax-3, 24, "");
+ uiDefPulldownBut(block, seq_viewmenu, sa, "View", xco, 0, xmax-3, 24, "");
xco+=xmax;
xmax= GetButStringLength("Select");
- uiDefPulldownBut(block, seq_selectmenu, sa, "Select", xco, yco, xmax-3, 24, "");
+ uiDefPulldownBut(block, seq_selectmenu, sa, "Select", xco, 0, xmax-3, 24, "");
xco+=xmax;
xmax= GetButStringLength("Marker");
- uiDefPulldownBut(block, seq_markermenu, sa, "Marker", xco, yco, xmax-3, 24, "");
+ uiDefPulldownBut(block, seq_markermenu, sa, "Marker", xco, 0, xmax-3, 24, "");
xco+=xmax;
xmax= GetButStringLength("Add");
- uiDefPulldownBut(block, seq_addmenu, sa, "Add", xco, yco, xmax-3, 24, "");
+ uiDefPulldownBut(block, seq_addmenu, sa, "Add", xco, 0, xmax-3, 24, "");
xco+=xmax;
xmax= GetButStringLength("Strip");
- uiDefPulldownBut(block, seq_editmenu, sa, "Strip", xco, yco, xmax-3, 24, "");
+ uiDefPulldownBut(block, seq_editmenu, sa, "Strip", xco, 0, xmax-3, 24, "");
xco+=xmax;
}
diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c
index 19497ab5fe7..b97bfeb5ca8 100644
--- a/source/blender/editors/space_sequencer/sequencer_ops.c
+++ b/source/blender/editors/space_sequencer/sequencer_ops.c
@@ -150,7 +150,9 @@ void sequencer_keymap(wmWindowManager *wm)
WM_keymap_add_item(keymap, "SEQUENCER_OT_borderselect", BKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "ANIM_OT_change_frame", LEFTMOUSE, KM_PRESS, 0, 0);
-
+
+ WM_keymap_add_item(keymap, "WM_OT_tweak_gesture", SELECTMOUSE, KM_PRESS, 0, 0);
+
transform_keymap_for_space(wm, keymap, SPACE_SEQ);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index acabe762b3c..40535eb0f74 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -79,10 +79,8 @@
/* own include */
#include "sequencer_intern.h"
static void BIF_undo_push() {}
-static void std_rmouse_transform() {}
static void *find_nearest_marker() {return NULL;}
static void deselect_markers() {}
-static void transform_seq_nomarker() {}
@@ -90,9 +88,8 @@ static void transform_seq_nomarker() {}
void select_channel_direction(Scene *scene, Sequence *test,int lr) {
/* selects all strips in a channel to one direction of the passed strip */
Sequence *seq;
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
- ed= scene->ed;
if(ed==NULL) return;
seq= ed->seqbasep->first;
@@ -159,7 +156,7 @@ void select_surround_from_last(Scene *scene)
void select_single_seq(Scene *scene, Sequence *seq, int deselect_all) /* BRING BACK */
{
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
if(deselect_all)
deselect_all_seq(scene);
@@ -214,21 +211,17 @@ void select_neighbor_from_last(Scene *scene, int lr)
}
-
-
-
-
-
-
-
/* (de)select operator */
static int sequencer_deselect_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
int desel = 0;
-
+
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
+
for(seq= ed->seqbasep->first; seq; seq=seq->next) {
if(seq->flag & SEQ_ALLSEL) {
desel= 1;
@@ -269,9 +262,11 @@ void SEQUENCER_OT_deselect_all(struct wmOperatorType *ot)
static int sequencer_select_invert_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
-
+
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
for(seq= ed->seqbasep->first; seq; seq=seq->next) {
if (seq->flag & SELECT) {
@@ -314,14 +309,17 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
ARegion *ar= CTX_wm_region(C);
View2D *v2d= UI_view2d_fromcontext(C);
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
short extend= RNA_enum_is_equal(op->ptr, "type", "EXTEND");
short mval[2];
Sequence *seq,*neighbor;
int hand,seldir, shift= 0; // XXX
TimeMarker *marker;
-
+
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
+
marker=find_nearest_marker(SCE_MARKERS, 1); //XXX - dummy function for now
mval[0]= event->x - ar->winrct.xmin;
@@ -432,10 +430,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
recurs_sel_seq(seq);
}
-
ED_undo_push(C,"Select Strips, Sequencer");
-
- std_rmouse_transform(transform_seq_nomarker);
}
/* marker transform */
@@ -458,7 +453,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
ED_area_tag_redraw(CTX_wm_area(C));
/* allowing tweaks */
- return OPERATOR_PASS_THROUGH;
+ return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
}
void SEQUENCER_OT_select(wmOperatorType *ot)
@@ -480,12 +475,11 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
/* run recursivly to select linked */
static int select_more_less_seq__internal(Scene *scene, int sel, int linked) {
- Editing *ed;
+ Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq, *neighbor;
int change=0;
int isel;
- ed= scene->ed;
if(ed==NULL) return 0;
if (sel) {
@@ -673,15 +667,18 @@ void SEQUENCER_OT_select_linked(wmOperatorType *ot)
static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
+ Editing *ed= seq_give_editing(scene, FALSE);
View2D *v2d= UI_view2d_fromcontext(C);
Sequence *seq;
- Editing *ed=scene->ed;
rcti rect;
rctf rectf, rq;
int val;
short mval[2];
-
+
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
+
val= RNA_int_get(op->ptr, "event_type");
rect.xmin= RNA_int_get(op->ptr, "xmin");
rect.ymin= RNA_int_get(op->ptr, "ymin");
@@ -733,10 +730,3 @@ void SEQUENCER_OT_borderselect(wmOperatorType *ot)
RNA_def_enum(ot->srna, "type", prop_select_types, 0, "Type", "");
}
-
-
-
-
-
-
-
diff --git a/source/blender/editors/space_sound/sound_header.c b/source/blender/editors/space_sound/sound_header.c
index 7e47cb832a2..3eed96d14d7 100644
--- a/source/blender/editors/space_sound/sound_header.c
+++ b/source/blender/editors/space_sound/sound_header.c
@@ -65,13 +65,13 @@ static void do_viewmenu(bContext *C, void *arg, int event)
}
-static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index 84182f70cdb..b8898e40f01 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -65,13 +65,13 @@ static void do_viewmenu(bContext *C, void *arg, int event)
}
-static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
diff --git a/source/blender/editors/space_time/time_header.c b/source/blender/editors/space_time/time_header.c
index d12775eba9a..7672325c114 100644
--- a/source/blender/editors/space_time/time_header.c
+++ b/source/blender/editors/space_time/time_header.c
@@ -84,7 +84,7 @@ static void do_time_redrawmenu(bContext *C, void *arg, int event)
}
-static uiBlock *time_redrawmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *time_redrawmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C);
@@ -93,7 +93,7 @@ static uiBlock *time_redrawmenu(bContext *C, uiMenuBlockHandle *handle, void *ar
short yco= 0, menuwidth=120, icon;
char str[32];
- block= uiBeginBlock(C, handle->region, "header time_redrawmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "header time_redrawmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_time_redrawmenu, NULL);
if(stime->redraws & TIME_LEFTMOST_3D_WIN) icon= ICON_CHECKBOX_HLT;
@@ -205,7 +205,7 @@ static void do_time_viewmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *time_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *time_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C);
@@ -213,7 +213,7 @@ static uiBlock *time_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "time_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "time_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_time_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation", 0, yco-=20,
@@ -293,13 +293,13 @@ static void do_time_framemenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *time_framemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *time_framemenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "time_framemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "time_framemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_time_framemenu, NULL);
uiDefIconTextButO(block, BUTM, "MARKER_OT_add", WM_OP_EXEC_REGION_WIN, ICON_BLANK1, "Add Marker",
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 9ce9f8a244d..beaeb68e69a 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -250,6 +250,12 @@ static void view3d_modal_keymaps(wmWindowManager *wm, ARegion *ar, int stype)
else
WM_event_remove_keymap_handler(&ar->handlers, keymap);
+ keymap= WM_keymap_listbase(wm, "Curve", 0, 0);
+ if(stype==NS_EDITMODE_CURVE)
+ WM_event_add_keymap_handler(&ar->handlers, keymap);
+ else
+ WM_event_remove_keymap_handler(&ar->handlers, keymap);
+
/* editfont keymap swallows all... */
keymap= WM_keymap_listbase(wm, "Font", 0, 0);
if(stype==NS_EDITMODE_TEXT)
@@ -284,6 +290,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_GEOM_SELECT:
case ND_DRAW:
case ND_MODIFIER:
+ case ND_KEYS:
ED_region_tag_redraw(ar);
break;
}
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index be831c27d3c..15b2c453b9d 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -278,7 +278,7 @@ static void do_view3d_view_camerasmenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 0);
}
-static uiBlock *view3d_view_camerasmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_view_camerasmenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
Base *base;
@@ -287,7 +287,7 @@ static uiBlock *view3d_view_camerasmenu(bContext *C, uiMenuBlockHandle *handle,
int i=1;
char camname[48];
- block= uiBeginBlock(C, handle->region, "view3d_view_camerasmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_view_camerasmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_view_camerasmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Active Object as Active Camera|Ctrl NumPad 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
@@ -365,13 +365,13 @@ static void do_view3d_view_cameracontrolsmenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 0);
}
-static uiBlock *view3d_view_cameracontrolsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_view_cameracontrolsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
/* static short tog=0; */
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_view_cameracontrolsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_view_cameracontrolsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_view_cameracontrolsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Camera Fly Mode|Shift F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, "");
@@ -456,14 +456,14 @@ static void do_view3d_view_alignviewmenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 0);
}
-static uiBlock *view3d_view_alignviewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_view_alignviewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
/* static short tog=0; */
uiBlock *block;
Object *obedit = CTX_data_edit_object(C);
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_view_alignviewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_view_alignviewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_view_alignviewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center View to Cursor|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
@@ -488,7 +488,7 @@ static uiBlock *view3d_view_alignviewmenu(bContext *C, uiMenuBlockHandle *handle
//{
//}
-static uiBlock *view3d_view_spacehandlers(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_view_spacehandlers(bContext *C, ARegion *ar, void *arg_unused)
{
/* XXX */
return NULL;
@@ -553,7 +553,7 @@ static void do_view3d_viewmenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 1);
}
-static uiBlock *view3d_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *sa= CTX_wm_area(C);
View3D *v3d= sa->spacedata.first;
@@ -561,7 +561,7 @@ static uiBlock *view3d_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *ar
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Orientations...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 20, "");
@@ -630,7 +630,7 @@ static uiBlock *view3d_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *ar
uiDefIconTextBlockBut(block, view3d_view_spacehandlers, NULL, ICON_RIGHTARROW_THIN, "Space Handler Scripts", 0, yco-=20, 120, 19, "");
#endif
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -687,12 +687,12 @@ void do_view3d_select_object_typemenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 0);
}
-static uiBlock *view3d_select_object_typemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_object_typemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_select_object_typemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_object_typemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_object_typemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mesh", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -750,12 +750,12 @@ void do_view3d_select_object_layermenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 0);
}
-static uiBlock *view3d_select_object_layermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_object_layermenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short xco= 0, yco = 20, menuwidth = 22;
- block= uiBeginBlock(C, handle->region, "view3d_select_object_layermenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_object_layermenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_object_layermenu, NULL);
uiDefBut(block, BUTM, 1, "1", xco, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -801,12 +801,12 @@ void do_view3d_select_object_linkedmenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 0);
}
-static uiBlock *view3d_select_object_linkedmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_object_linkedmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_select_object_linkedmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_object_linkedmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_object_linkedmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Ipo|Shift L, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -841,12 +841,12 @@ void do_view3d_select_object_groupedmenu(bContext *C, void *arg, int event)
}
-static uiBlock *view3d_select_object_groupedmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_object_groupedmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_select_object_groupedmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_object_groupedmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_object_groupedmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Children|Shift G, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -868,12 +868,12 @@ static uiBlock *view3d_select_object_groupedmenu(bContext *C, uiMenuBlockHandle
#endif
-static uiBlock *view3d_select_objectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_objectmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
// short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_select_objectmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_objectmenu", UI_EMBOSSP, UI_HELV);
#if 0
uiBlockSetButmFunc(block, do_view3d_select_objectmenu, NULL);
@@ -905,7 +905,7 @@ static uiBlock *view3d_select_objectmenu(bContext *C, uiMenuBlockHandle *handle,
uiDefMenuButO(block, "OBJECT_OT_select_by_type", "Select All by Type");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -989,12 +989,12 @@ void do_view3d_select_meshmenu(bContext *C, void *arg, int event)
}
-static uiBlock *view3d_select_meshmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_meshmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_select_meshmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_meshmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_meshmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1056,7 +1056,7 @@ static uiBlock *view3d_select_meshmenu(bContext *C, uiMenuBlockHandle *handle, v
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Loop to Region|Ctrl E 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Region to Loop|Ctrl E 9", 0, yco-=20, menuwidth, 20, NULL, 0.0, 0.0, 1, 20, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -1122,13 +1122,13 @@ void do_view3d_select_curvemenu(bContext *C, void *arg, int event)
}
-static uiBlock *view3d_select_curvemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_curvemenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_select_curvemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_curvemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_curvemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1161,7 +1161,7 @@ static uiBlock *view3d_select_curvemenu(bContext *C, uiMenuBlockHandle *handle,
/* commented out because it seems to only like the LKEY method - based on mouse pointer position :( */
/*uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Connected Control Points|Ctrl L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");*/
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -1196,12 +1196,12 @@ void do_view3d_select_metaballmenu(bContext *C, void *arg, int event)
}
-static uiBlock *view3d_select_metaballmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_metaballmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_select_metaballmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_metaballmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_metaballmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1216,7 +1216,7 @@ static uiBlock *view3d_select_metaballmenu(bContext *C, uiMenuBlockHandle *handl
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Random...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -1245,12 +1245,12 @@ static void do_view3d_select_latticemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_select_latticemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_latticemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_select_latticemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_latticemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_latticemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1259,7 +1259,7 @@ static uiBlock *view3d_select_latticemenu(bContext *C, uiMenuBlockHandle *handle
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -1303,12 +1303,12 @@ static void do_view3d_select_armaturemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_select_armaturemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_armaturemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_select_armaturemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_armaturemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_armaturemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1328,7 +1328,7 @@ static uiBlock *view3d_select_armaturemenu(bContext *C, uiMenuBlockHandle *handl
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Parent|Shift [", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Child|Shift ]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -1375,12 +1375,12 @@ static void do_view3d_select_pose_armaturemenu(bContext *C, void *arg, int event
#endif
}
-static uiBlock *view3d_select_pose_armaturemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_pose_armaturemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_select_pose_armaturemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_pose_armaturemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_pose_armaturemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1401,7 +1401,7 @@ static uiBlock *view3d_select_pose_armaturemenu(bContext *C, uiMenuBlockHandle *
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Parent|Shift [", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Child|Shift ]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -1439,7 +1439,7 @@ void do_view3d_select_faceselmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_select_faceselmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_faceselmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
@@ -1448,7 +1448,7 @@ static uiBlock *view3d_select_faceselmenu(bContext *C, uiMenuBlockHandle *handle
// int i = 0;
#endif
- block= uiBeginBlock(C, handle->region, "view3d_select_faceselmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_faceselmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_faceselmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1472,7 +1472,7 @@ static uiBlock *view3d_select_faceselmenu(bContext *C, uiMenuBlockHandle *handle
// }
#endif
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -1515,12 +1515,12 @@ void do_view3d_edit_snapmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_snapmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_snapmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_snapmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_snapmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_snapmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Selection -> Grid|Shift S, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -1582,12 +1582,12 @@ void do_view3d_transform_moveaxismenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_transform_moveaxismenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_transform_moveaxismenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_transform_moveaxismenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_transform_moveaxismenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_transform_moveaxismenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Global|G, X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1650,12 +1650,12 @@ void do_view3d_transform_rotateaxismenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_transform_rotateaxismenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_transform_rotateaxismenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_transform_rotateaxismenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_transform_rotateaxismenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_transform_rotateaxismenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Global|R, X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1718,12 +1718,12 @@ void do_view3d_transform_scaleaxismenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_transform_scaleaxismenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_transform_scaleaxismenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_transform_scaleaxismenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_transform_scaleaxismenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_transform_scaleaxismenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Global|S, X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1829,14 +1829,14 @@ static void do_view3d_transformmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_transformmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_transformmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_transformmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_transformmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move|G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -1958,12 +1958,12 @@ void do_view3d_object_mirrormenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_object_mirrormenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_object_mirrormenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_object_mirrormenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_object_mirrormenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_object_mirrormenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Interactive Mirror|Ctrl M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -2010,12 +2010,12 @@ static void do_view3d_edit_object_transformmenu(bContext *C, void *arg, int even
#endif
}
-static uiBlock *view3d_edit_object_transformmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_transformmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_transformmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_transformmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Apply Scale/Rotation to ObData|Ctrl A, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
@@ -2048,12 +2048,12 @@ static void do_view3d_edit_object_makelocalmenu(bContext *C, void *arg, int even
#endif
}
-static uiBlock *view3d_edit_object_makelocalmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_makelocalmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_makelocalmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_makelocalmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_makelocalmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Selected Objects|L, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -2080,7 +2080,7 @@ static void do_view3d_edit_object_makelinksmenu(bContext *C, void *arg, int even
#endif
}
-static uiBlock *view3d_edit_object_makelinksmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_makelinksmenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
Object *ob=NULL;
@@ -2088,7 +2088,7 @@ static uiBlock *view3d_edit_object_makelinksmenu(bContext *C, uiMenuBlockHandle
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_makelinksmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_makelinksmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_makelinksmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "To Scene...|Ctrl L, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -2160,13 +2160,13 @@ static void do_view3d_edit_object_singleusermenu(bContext *C, void *arg, int eve
#endif
}
-static uiBlock *view3d_edit_object_singleusermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_singleusermenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_singleusermenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_singleusermenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_singleusermenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object|U, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -2212,7 +2212,7 @@ static void do_view3d_edit_object_copyattrmenu(bContext *C, void *arg, int event
allqueue(REDRAWVIEW3D, 0);
}
-static uiBlock *view3d_edit_object_copyattrmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_copyattrmenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
Object *ob=NULL;
@@ -2220,7 +2220,7 @@ static uiBlock *view3d_edit_object_copyattrmenu(bContext *C, uiMenuBlockHandle *
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_copyattrmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_copyattrmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_copyattrmenu, NULL);
ob= OBACT;
@@ -2291,12 +2291,12 @@ static void do_view3d_edit_object_parentmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_object_parentmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_parentmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_parentmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_parentmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_parentmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Parent...|Ctrl P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -2321,12 +2321,12 @@ static void do_view3d_edit_object_groupmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_object_groupmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_groupmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_groupmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_groupmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_groupmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add to Existing Group|Ctrl G, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
@@ -2353,12 +2353,12 @@ static void do_view3d_edit_object_trackmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_object_trackmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_trackmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_trackmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_trackmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_trackmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Track...|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -2384,12 +2384,12 @@ static void do_view3d_edit_object_constraintsmenu(bContext *C, void *arg, int ev
#endif
}
-static uiBlock *view3d_edit_object_constraintsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_constraintsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_constraintsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_constraintsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_constraintsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Constraint...|Ctrl Alt C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -2420,12 +2420,12 @@ static void do_view3d_edit_object_showhidemenu(bContext *C, void *arg, int event
#endif
}
-static uiBlock *view3d_edit_object_showhidemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_showhidemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_showhidemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_showhidemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_showhidemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -2447,14 +2447,14 @@ static void do_view3d_edit_object_scriptsmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_object_scriptsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_scriptsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
// short yco = 20, menuwidth = 120;
// XXX BPyMenu *pym;
// int i = 0;
- block= uiBeginBlock(C, handle->region, "v3d_eobject_pymenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "v3d_eobject_pymenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_scriptsmenu, NULL);
// for (pym = BPyMenuTable[PYMENU_OBJECT]; pym; pym = pym->next, i++) {
@@ -2522,13 +2522,13 @@ static void do_view3d_edit_objectmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_objectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_objectmenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_objectmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_objectmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_objectmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 15, "");
@@ -2582,7 +2582,7 @@ static uiBlock *view3d_edit_objectmenu(bContext *C, uiMenuBlockHandle *handle, v
uiDefIconTextBlockBut(block, view3d_edit_object_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, "");
#endif
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -2604,13 +2604,13 @@ static void do_view3d_edit_propfalloffmenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 1);
}
-static uiBlock *view3d_edit_propfalloffmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_propfalloffmenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_propfalloffmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_propfalloffmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_propfalloffmenu, NULL);
if (scene->prop_mode==PROP_SMOOTH) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, "");
@@ -2677,12 +2677,12 @@ void do_view3d_edit_mesh_verticesmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_mesh_verticesmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_mesh_verticesmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_mesh_verticesmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_mesh_verticesmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_mesh_verticesmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Merge...|Alt M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
@@ -2796,12 +2796,12 @@ void do_view3d_edit_mesh_edgesmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_mesh_edgesmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_mesh_edgesmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_mesh_edgesmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_mesh_edgesmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_mesh_edgesmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Edge/Face|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
@@ -2886,12 +2886,12 @@ void do_view3d_edit_mesh_facesmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_mesh_facesmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_mesh_facesmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_mesh_facesmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_mesh_facesmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_mesh_facesmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Edge/Face|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
@@ -2933,12 +2933,12 @@ void do_view3d_edit_mesh_normalsmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_mesh_normalsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_mesh_normalsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_mesh_normalsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_mesh_normalsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_mesh_normalsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Recalculate Outside|Ctrl N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
@@ -3000,12 +3000,12 @@ void do_view3d_edit_mirrormenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_mirrormenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_mirrormenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_mirrormenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_mirrormenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_mirrormenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Interactive Mirror|Ctrl M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -3047,12 +3047,12 @@ static void do_view3d_edit_mesh_showhidemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_mesh_showhidemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_mesh_showhidemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_mesh_showhidemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_mesh_showhidemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_mesh_showhidemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -3074,14 +3074,14 @@ static void do_view3d_edit_mesh_scriptsmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_mesh_scriptsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_mesh_scriptsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
// short yco = 20, menuwidth = 120;
// XXX BPyMenu *pym;
// int i = 0;
- block= uiBeginBlock(C, handle->region, "v3d_emesh_pymenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "v3d_emesh_pymenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_mesh_scriptsmenu, NULL);
// for (pym = BPyMenuTable[PYMENU_MESH]; pym; pym = pym->next, i++) {
@@ -3159,14 +3159,14 @@ static void do_view3d_edit_meshmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_meshmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_meshmenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_meshmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_meshmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_meshmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|Ctrl Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -3231,7 +3231,7 @@ static uiBlock *view3d_edit_meshmenu(bContext *C, uiMenuBlockHandle *handle, voi
uiDefIconTextBlockBut(block, view3d_edit_mesh_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, "");
#endif
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -3282,13 +3282,13 @@ static void do_view3d_edit_curve_controlpointsmenu(bContext *C, void *arg, int e
#endif
}
-static uiBlock *view3d_edit_curve_controlpointsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_curve_controlpointsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_curve_controlpointsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_curve_controlpointsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_curve_controlpointsmenu, NULL);
if (OBACT->type == OB_CURVE) {
@@ -3327,12 +3327,12 @@ void do_view3d_edit_curve_segmentsmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_curve_segmentsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_curve_segmentsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_curve_segmentsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_curve_segmentsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_curve_segmentsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subdivide", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -3361,13 +3361,13 @@ void do_view3d_edit_curve_showhidemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_curve_showhidemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_curve_showhidemenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_curve_showhidemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_curve_showhidemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_curve_showhidemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
@@ -3436,13 +3436,13 @@ static void do_view3d_edit_curvemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_curvemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_curvemenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_curvemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_curvemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_curvemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reload Original|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -3489,7 +3489,7 @@ static uiBlock *view3d_edit_curvemenu(bContext *C, uiMenuBlockHandle *handle, vo
uiDefIconTextBlockBut(block, view3d_edit_curve_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Control Points", 0, yco-=20, menuwidth, 19, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -3519,12 +3519,12 @@ static void do_view3d_edit_mball_showhidemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_mball_showhidemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_mball_showhidemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_mball_showhidemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_mball_showhidemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_mball_showhidemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
@@ -3574,12 +3574,12 @@ static void do_view3d_edit_metaballmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_metaballmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_metaballmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_metaballmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_metaballmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_metaballmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|Ctrl Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -3606,7 +3606,7 @@ static uiBlock *view3d_edit_metaballmenu(bContext *C, uiMenuBlockHandle *handle,
uiDefIconTextBlockBut(block, view3d_edit_mball_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Hide MetaElems", 0, yco-=20, 120, 19, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -3678,12 +3678,12 @@ static void do_view3d_edit_text_charsmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_text_charsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_text_charsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_text_charsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_text_charsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_text_charsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Copyright|Alt C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -3735,12 +3735,12 @@ static void do_view3d_edit_textmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_textmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_textmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_textmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_textmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_textmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -3753,7 +3753,7 @@ static uiBlock *view3d_edit_textmenu(bContext *C, uiMenuBlockHandle *handle, voi
uiDefIconTextBlockBut(block, view3d_edit_text_charsmenu, NULL, ICON_RIGHTARROW_THIN, "Special Characters", 0, yco-=20, 120, 19, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -3801,13 +3801,13 @@ static void do_view3d_edit_latticemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_latticemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_latticemenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_latticemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_latticemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_latticemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -3836,7 +3836,7 @@ static uiBlock *view3d_edit_latticemenu(bContext *C, uiMenuBlockHandle *handle,
}
uiDefIconTextBlockBut(block, view3d_edit_propfalloffmenu, NULL, ICON_RIGHTARROW_THIN, "Proportional Falloff", 0, yco-=20, 120, 19, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -3863,12 +3863,12 @@ void do_view3d_edit_armature_parentmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_armature_parentmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_armature_parentmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_armature_parentmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_armature_parentmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_armature_parentmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Parent...|Ctrl P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -3894,12 +3894,12 @@ void do_view3d_edit_armature_rollmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_armature_rollmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_armature_rollmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_armature_rollmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_armature_rollmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_armature_rollmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Roll (Z-Axis Up)|Ctrl N, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -3991,14 +3991,14 @@ static void do_view3d_scripts_armaturemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_scripts_armaturemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_scripts_armaturemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
// XXX BPyMenu *pym;
// int i= 0;
// short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_scripts_armaturemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_scripts_armaturemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_scripts_armaturemenu, NULL);
/* note that we acount for the N previous entries with i+20: */
@@ -4021,12 +4021,12 @@ static void do_view3d_armature_settingsmenu(bContext *C, void *arg, int event)
// XXX setflag_armature(event);
}
-static uiBlock *view3d_armature_settingsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_armature_settingsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_armature_settingsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_armature_settingsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_armature_settingsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Toggle a Setting|Shift W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
@@ -4039,14 +4039,14 @@ static uiBlock *view3d_armature_settingsmenu(bContext *C, uiMenuBlockHandle *han
return block;
}
-static uiBlock *view3d_edit_armaturemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_armaturemenu(bContext *C, ARegion *ar, void *arg_unused)
{
Object *obedit = CTX_data_edit_object(C);
bArmature *arm= obedit->data;
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_armaturemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_armaturemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_armaturemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -4101,7 +4101,7 @@ static uiBlock *view3d_edit_armaturemenu(bContext *C, uiMenuBlockHandle *handle,
uiDefIconTextBlockBut(block, view3d_scripts_armaturemenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, "");
#endif
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -4143,12 +4143,12 @@ static void do_view3d_pose_armature_transformmenu(bContext *C, void *arg, int ev
#endif
}
-static uiBlock *view3d_pose_armature_transformmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_pose_armature_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_pose_armature_transformmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_pose_armature_transformmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_pose_armature_transformmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear User Transform|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
@@ -4183,12 +4183,12 @@ static void do_view3d_pose_armature_showhidemenu(bContext *C, void *arg, int eve
#endif
}
-static uiBlock *view3d_pose_armature_showhidemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_pose_armature_showhidemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_pose_armature_showhidemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_pose_armature_showhidemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_pose_armature_showhidemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -4217,12 +4217,12 @@ static void do_view3d_pose_armature_ikmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_pose_armature_ikmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_pose_armature_ikmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_pose_armature_ikmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_pose_armature_ikmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_pose_armature_ikmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add IK to Bone...|Shift I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -4250,12 +4250,12 @@ static void do_view3d_pose_armature_constraintsmenu(bContext *C, void *arg, int
#endif
}
-static uiBlock *view3d_pose_armature_constraintsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_pose_armature_constraintsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_pose_armature_constraintsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_pose_armature_constraintsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_pose_armature_constraintsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Constraint to Bone...|Ctrl Alt C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -4289,12 +4289,12 @@ static void do_view3d_pose_armature_groupmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_pose_armature_groupmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_pose_armature_groupmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_pose_armature_groupmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_pose_armature_groupmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_pose_armature_groupmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Selected to Active Group|Ctrl G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -4325,12 +4325,12 @@ static void do_view3d_pose_armature_motionpathsmenu(bContext *C, void *arg, int
#endif
}
-static uiBlock *view3d_pose_armature_motionpathsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_pose_armature_motionpathsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_pose_armature_motionpathsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_pose_armature_motionpathsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_pose_armature_motionpathsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Calculate Paths|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -4365,12 +4365,12 @@ static void do_view3d_pose_armature_poselibmenu(bContext *C, void *arg, int even
#endif
}
-static uiBlock *view3d_pose_armature_poselibmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_pose_armature_poselibmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_pose_armature_poselibmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_pose_armature_poselibmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_pose_armature_poselibmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Browse Poses|Ctrl L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -4447,12 +4447,12 @@ static void do_view3d_pose_armaturemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_pose_armaturemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_pose_armaturemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_pose_armaturemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_pose_armaturemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_pose_armaturemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -4506,7 +4506,7 @@ static uiBlock *view3d_pose_armaturemenu(bContext *C, uiMenuBlockHandle *handle,
uiDefIconTextBlockBut(block, view3d_armature_settingsmenu,
NULL, ICON_RIGHTARROW_THIN, "Bone Settings", 0, yco-=20, 120, 19, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -4545,7 +4545,7 @@ static void do_view3d_vpaintmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_vpaintmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_vpaintmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
@@ -4554,7 +4554,7 @@ static uiBlock *view3d_vpaintmenu(bContext *C, uiMenuBlockHandle *handle, void *
// int i=0;
#endif
- block= uiBeginBlock(C, handle->region, "view3d_paintmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_paintmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_vpaintmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Vertex Painting|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -4571,7 +4571,7 @@ static uiBlock *view3d_vpaintmenu(bContext *C, uiMenuBlockHandle *handle, void *
// }
#endif
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -4598,18 +4598,18 @@ static void do_view3d_tpaintmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_tpaintmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_tpaintmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_paintmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_paintmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_tpaintmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Texture Painting|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -4649,7 +4649,7 @@ static void do_view3d_wpaintmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_wpaintmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_wpaintmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120, menunr=1;
@@ -4658,7 +4658,7 @@ static uiBlock *view3d_wpaintmenu(bContext *C, uiMenuBlockHandle *handle, void *
// int i=0;
#endif
- block= uiBeginBlock(C, handle->region, "view3d_paintmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_paintmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_wpaintmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Weight Painting|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -4686,7 +4686,7 @@ static uiBlock *view3d_wpaintmenu(bContext *C, uiMenuBlockHandle *handle, void *
// }
#endif
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -4800,13 +4800,13 @@ void do_view3d_sculptmenu(bContext *C, void *arg, int event)
#endif
}
-uiBlock *view3d_sculpt_inputmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+uiBlock *view3d_sculpt_inputmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth= 120;
Sculpt *sd= CTX_data_tool_settings(C)->sculpt;
- block= uiBeginBlock(C, handle->region, "view3d_sculpt_inputmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_sculpt_inputmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_sculpt_inputmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ((sd->flags & SCULPT_INPUT_SMOOTH) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Smooth Stroke|Shift S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -4818,7 +4818,7 @@ uiBlock *view3d_sculpt_inputmenu(bContext *C, uiMenuBlockHandle *handle, void *a
return block;
}
-uiBlock *view3d_sculptmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+uiBlock *view3d_sculptmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *sa= CTX_wm_area(C);
View3D *v3d= sa->spacedata.first;
@@ -4827,7 +4827,7 @@ uiBlock *view3d_sculptmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unu
// XXX const BrushData *br= sculptmode_brush();
short yco= 0, menuwidth= 120;
- block= uiBeginBlock(C, handle->region, "view3d_sculptmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_sculptmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_sculptmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Sculpt Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 14, "");
@@ -4868,7 +4868,7 @@ uiBlock *view3d_sculptmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unu
uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==DRAW_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Draw|D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");*/
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -4901,12 +4901,12 @@ static void do_view3d_facesel_showhidemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_facesel_showhidemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_facesel_showhidemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_facesel_showhidemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_facesel_showhidemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_facesel_showhidemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden Faces|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
@@ -4937,12 +4937,12 @@ static void do_view3d_faceselmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_faceselmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_faceselmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_faceselmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_faceselmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_faceselmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Vertex Colors|Shift K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -4956,7 +4956,7 @@ static uiBlock *view3d_faceselmenu(bContext *C, uiMenuBlockHandle *handle, void
uiDefIconTextBlockBut(block, view3d_facesel_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Faces", 0, yco-=20, 120, 19, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -5000,12 +5000,12 @@ void do_view3d_select_particlemenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *view3d_select_particlemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_particlemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_select_particlemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_particlemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_particlemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B",
@@ -5032,7 +5032,7 @@ static uiBlock *view3d_select_particlemenu(bContext *C, uiMenuBlockHandle *handl
0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -5060,12 +5060,12 @@ void do_view3d_particle_showhidemenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *view3d_particle_showhidemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_particle_showhidemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_particle_showhidemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_particle_showhidemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_particle_showhidemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H",
@@ -5117,14 +5117,14 @@ void do_view3d_particlemenu(bContext *C, void *arg, int event)
#endif
}
-uiBlock *view3d_particlemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+uiBlock *view3d_particlemenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
uiBlock *block;
ParticleEditSettings *pset= PE_settings(scene);
short yco= 0, menuwidth= 120;
-
- block= uiBeginBlock(C, handle->region, "view3d_particlemenu", UI_EMBOSSP, UI_HELV);
+
+ block= uiBeginBlock(C, ar, "view3d_particlemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_particlemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Particle Edit Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
@@ -5144,7 +5144,7 @@ uiBlock *view3d_particlemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_u
uiDefIconTextBlockBut(block, view3d_particle_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Particles", 0, yco-=20, menuwidth, 19, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index ef767a04728..39fa4ed815b 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -76,7 +76,6 @@
//#include "BIF_editmesh.h"
//#include "BIF_editsima.h"
//#include "BIF_editparticle.h"
-//#include "BIF_drawimage.h" /* uvco_to_areaco_noclip */
//#include "BIF_editaction.h"
#include "BKE_action.h" /* get_action_frame */
@@ -96,10 +95,11 @@
//#include "BSE_time.h"
//#include "BSE_view.h"
-#include "ED_view3d.h"
+#include "ED_image.h"
#include "ED_screen.h"
-#include "ED_util.h"
#include "ED_space_api.h"
+#include "ED_util.h"
+#include "ED_view3d.h"
#include "UI_view2d.h"
#include "WM_types.h"
@@ -192,9 +192,7 @@ void convertViewVec(TransInfo *t, float *vec, short dx, short dy)
View2D *v2d = t->view;
float divx, divy, aspx, aspy;
- // TRANSFORM_FIX_ME
- //transform_aspect_ratio_tface_uv(&aspx, &aspy);
- aspx= aspy= 1.0f;
+ ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
divx= v2d->mask.xmax-v2d->mask.xmin;
divy= v2d->mask.ymax-v2d->mask.ymin;
@@ -246,13 +244,11 @@ void projectIntView(TransInfo *t, float *vec, int *adr)
else if(t->spacetype==SPACE_IMAGE) {
float aspx, aspy, v[2];
- // TRANSFORM_FIX_ME
- //transform_aspect_ratio_tface_uv(&aspx, &aspy);
+ ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
v[0]= vec[0]/aspx;
v[1]= vec[1]/aspy;
- // TRANSFORM_FIX_ME
- //uvco_to_areaco_noclip(v, adr);
+ UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr+1);
}
else if(t->spacetype==SPACE_IPO) {
int out[2] = {0, 0};
@@ -293,46 +289,44 @@ void projectFloatView(TransInfo *t, float *vec, float *adr)
void applyAspectRatio(TransInfo *t, float *vec)
{
-#if 0 // TRANSFORM_FIX_ME
- TransInfo *t = BIF_GetTransInfo();
+ SpaceImage *sima= t->sa->spacedata.first;
if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
float aspx, aspy;
- if((G.sima->flag & SI_COORDFLOATS)==0) {
+ if((sima->flag & SI_COORDFLOATS)==0) {
int width, height;
- transform_width_height_tface_uv(&width, &height);
+ ED_space_image_size(sima, &width, &height);
vec[0] *= width;
vec[1] *= height;
}
- transform_aspect_ratio_tface_uv(&aspx, &aspy);
+ ED_space_image_uv_aspect(sima, &aspx, &aspy);
vec[0] /= aspx;
vec[1] /= aspy;
}
-#endif
}
void removeAspectRatio(TransInfo *t, float *vec)
{
-#if 0 // TRANSFORM_FIX_ME
+ SpaceImage *sima= t->sa->spacedata.first;
+
if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
float aspx, aspy;
- if((G.sima->flag & SI_COORDFLOATS)==0) {
+ if((sima->flag & SI_COORDFLOATS)==0) {
int width, height;
- transform_width_height_tface_uv(&width, &height);
+ ED_space_image_size(sima, &width, &height);
vec[0] /= width;
vec[1] /= height;
}
- transform_aspect_ratio_tface_uv(&aspx, &aspy);
+ ED_space_image_uv_aspect(sima, &aspx, &aspy);
vec[0] *= aspx;
vec[1] *= aspy;
}
-#endif
}
static void viewRedrawForce(bContext *C, TransInfo *t)
@@ -352,6 +346,16 @@ static void viewRedrawForce(bContext *C, TransInfo *t)
else
ED_area_tag_redraw(t->sa);
}
+ else if (t->spacetype == SPACE_IPO) {
+ SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first;
+
+ // TRANSFORM_FIX_ME
+ if (sipo->lock) {
+ // whole window...
+ }
+ else
+ ED_area_tag_redraw(t->sa);
+ }
else if(t->spacetype == SPACE_NODE)
{
//ED_area_tag_redraw(t->sa);
@@ -361,58 +365,16 @@ static void viewRedrawForce(bContext *C, TransInfo *t)
{
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, NULL);
}
-#if 0 // TRANSFORM_FIX_ME
else if (t->spacetype==SPACE_IMAGE) {
- if (G.sima->lock) force_draw_plus(SPACE_VIEW3D, 0);
+#if 0
+ SpaceImage *sima= (SpaceImage*)t->sa->spacedata.first;
+ if(sima->lock) force_draw_plus(SPACE_VIEW3D, 0);
else force_draw(0);
+#endif
+
+ // XXX better notifier, and how to deal with lock?
+ WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, t->obedit);
}
- else if (t->spacetype == SPACE_ACTION) {
- if (G.saction->lock) {
- short context;
-
- /* we ignore the pointer this function returns (not needed) */
- get_action_context(&context);
-
- if (context == ACTCONT_ACTION)
- force_draw_plus(SPACE_VIEW3D, 0);
- else if (context == ACTCONT_SHAPEKEY)
- force_draw_all(0);
- else
- force_draw(0);
- }
- else {
- force_draw(0);
- }
- }
- else if (t->spacetype == SPACE_NLA) {
- if (G.snla->lock)
- force_draw_all(0);
- else
- force_draw(0);
- }
- else if (t->spacetype == SPACE_IPO) {
- /* update realtime */
- if (G.sipo->lock) {
- if (G.sipo->blocktype==ID_MA || G.sipo->blocktype==ID_TE)
- force_draw_plus(SPACE_BUTS, 0);
- else if (G.sipo->blocktype==ID_CA)
- force_draw_plus(SPACE_VIEW3D, 0);
- else if (G.sipo->blocktype==ID_KE)
- force_draw_plus(SPACE_VIEW3D, 0);
- else if (G.sipo->blocktype==ID_PO)
- force_draw_plus(SPACE_VIEW3D, 0);
- else if (G.sipo->blocktype==ID_OB)
- force_draw_plus(SPACE_VIEW3D, 0);
- else if (G.sipo->blocktype==ID_SEQ)
- force_draw_plus(SPACE_SEQ, 0);
- else
- force_draw(0);
- }
- else {
- force_draw(0);
- }
- }
-#endif
}
static void viewRedrawPost(TransInfo *t)
@@ -918,7 +880,8 @@ void transformEvent(TransInfo *t, wmEvent *event)
break;
case LEFTMOUSE:
case RIGHTMOUSE:
- if (t->options & CTX_TWEAK)
+ if(WM_modal_tweak_exit(event, t->event_type))
+// if (t->options & CTX_TWEAK)
t->state = TRANS_CONFIRM;
break;
}
@@ -1101,8 +1064,15 @@ void initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
initTimeScale(t);
break;
case TFM_TIME_EXTEND:
- /* now that transdata has been made, do like for TFM_TIME_TRANSLATE */
- initTimeTranslate(t);
+ /* now that transdata has been made, do like for TFM_TIME_TRANSLATE (for most Animation
+ * Editors because they have only 1D transforms for time values) or TFM_TRANSLATION
+ * (for Graph Editor only since it uses 'standard' transforms to get 2D movement)
+ * depending on which editor this was called from
+ */
+ if (t->spacetype == SPACE_IPO)
+ initTranslation(t);
+ else
+ initTimeTranslate(t);
break;
case TFM_BAKE_TIME:
initBakeTime(t);
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index a7017df5439..89f31c18338 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -218,6 +218,7 @@ typedef struct TransInfo {
float center[3]; /* center of transformation */
int center2d[2]; /* center in screen coordinates */
short imval[2]; /* initial mouse position */
+ short event_type; /* event->type used to invoke transform */
short idx_max; /* maximum index on the input vector */
float snap[3]; /* Snapping Gears */
char frame_side; /* Mouse side of the cfra, 'L', 'R' or 'B' */
@@ -331,6 +332,7 @@ typedef struct TransInfo {
#define TD_SKIP (1 << 11) /* don't transform this data */
#define TD_BEZTRIPLE (1 << 12) /* if this is a bez triple, we need to restore the handles, if this is set transdata->misc.hdata needs freeing */
#define TD_NO_LOC (1 << 13) /* when this is set, don't apply translation changes to this element */
+#define TD_NOTIMESNAP (1 << 14) /* for Graph Editor autosnap, indicates that point should not undergo autosnapping */
/* transsnap->status */
#define SNAP_ON 1
@@ -441,8 +443,10 @@ void drawPropCircle(TransInfo *t);
/*********************** transform_conversions.c ********** */
struct ListBase;
+
void flushTransGPactionData(TransInfo *t);
-void flushTransIpoData(TransInfo *t);
+void flushTransGraphData(TransInfo *t);
+void remake_graph_transdata(TransInfo *t, struct ListBase *anim_data);
void flushTransUVs(TransInfo *t);
void flushTransParticles(TransInfo *t);
int clipUVTransform(TransInfo *t, float *vec, int resize);
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 4fc711babae..d59961465e7 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -122,10 +122,12 @@
#include "ED_anim_api.h"
#include "ED_armature.h"
#include "ED_editparticle.h"
+#include "ED_image.h"
#include "ED_keyframing.h"
#include "ED_keyframes_edit.h"
#include "ED_mesh.h"
#include "ED_types.h"
+#include "ED_uvedit.h"
#include "ED_view3d.h"
#include "UI_view2d.h"
@@ -139,7 +141,6 @@
//#include "BDR_drawaction.h" // list of keyframes in action
//#include "BDR_editobject.h" // reset_slowparents()
//#include "BDR_gpencil.h"
-//#include "BDR_unwrapper.h"
#include "BLI_arithb.h"
#include "BLI_blenlib.h"
@@ -157,11 +158,6 @@ extern ListBase editelems;
#include "BLO_sys_types.h" // for intptr_t support
-/************ STUBS TO GET COMPILE ************/
-void transform_aspect_ratio_tface_uv(float *a1, float *a2) {}
-
-
-
/* local function prototype - for Object/Bone Constraints */
static short constraints_list_needinv(TransInfo *t, ListBase *list);
@@ -2303,7 +2299,7 @@ void flushTransNodes(TransInfo *t)
/* *** SEQUENCE EDITOR *** */
void flushTransSeq(TransInfo *t)
{
- ListBase *seqbasep= ((Editing *)t->scene->ed)->seqbasep;
+ ListBase *seqbasep= seq_give_editing(t->scene, FALSE)->seqbasep; /* Editing null check alredy done */
int a, new_frame;
TransData *td= t->data;
TransData2D *td2d= t->data2d;
@@ -2380,11 +2376,11 @@ void flushTransSeq(TransInfo *t)
/* ********************* UV ****************** */
-static void UVsToTransData(TransData *td, TransData2D *td2d, float *uv, int selected)
+static void UVsToTransData(SpaceImage *sima, TransData *td, TransData2D *td2d, float *uv, int selected)
{
float aspx, aspy;
- transform_aspect_ratio_tface_uv(&aspx, &aspy);
+ ED_space_image_uv_aspect(sima, &aspx, &aspy);
/* uv coords are scaled by aspects. this is needed for rotations and
proportional editing to be consistent with the stretchted uv coords
@@ -2418,61 +2414,35 @@ static void UVsToTransData(TransData *td, TransData2D *td2d, float *uv, int sele
static void createTransUVs(bContext *C, TransInfo *t)
{
-#if 0 // TRANSFORM_FIX_ME
SpaceImage *sima = (SpaceImage*)CTX_wm_space_data(C);
+ Image *ima = CTX_data_edit_image(C);
+ Scene *scene = CTX_data_scene(C);
TransData *td = NULL;
TransData2D *td2d = NULL;
MTFace *tf;
int count=0, countsel=0;
int propmode = t->flag & T_PROP_EDIT;
- int efa_s1,efa_s2,efa_s3,efa_s4;
EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh;
EditFace *efa;
- if(is_uv_tface_editing_allowed()==0) return;
+ if(!ED_uvedit_test(t->obedit)) return;
/* count */
- if (sima->flag & SI_BE_SQUARE && !propmode) {
- for (efa= em->faces.first; efa; efa= efa->next) {
- /* store face pointer for second loop, prevent second lookup */
- tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tf)) {
- efa->tmp.p = tf;
-
- efa_s1 = simaUVSel_Check(efa, tf, 0);
- efa_s2 = simaUVSel_Check(efa, tf, 1);
- efa_s3 = simaUVSel_Check(efa, tf, 2);
- if (efa->v4) {
- efa_s4 = simaUVSel_Check(efa, tf, 3);
- if ( efa_s1 || efa_s2 || efa_s3 || efa_s4 ) {
- countsel += 4; /* all corners of this quad need their edges moved. so we must store TD for each */
- }
- } else {
- /* tri's are delt with normally when SI_BE_SQUARE's enabled */
- if (efa_s1) countsel++;
- if (efa_s2) countsel++;
- if (efa_s3) countsel++;
- }
- } else {
- efa->tmp.p = NULL;
- }
- }
- } else {
- for (efa= em->faces.first; efa; efa= efa->next) {
- tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tf)) {
- efa->tmp.p = tf;
-
- if (simaUVSel_Check(efa, tf, 0)) countsel++;
- if (simaUVSel_Check(efa, tf, 1)) countsel++;
- if (simaUVSel_Check(efa, tf, 2)) countsel++;
- if (efa->v4 && simaUVSel_Check(efa, tf, 3)) countsel++;
- if(propmode)
- count += (efa->v4)? 4: 3;
- } else {
- efa->tmp.p = NULL;
- }
+ for (efa= em->faces.first; efa; efa= efa->next) {
+ tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+
+ if(uvedit_face_visible(scene, ima, efa, tf)) {
+ efa->tmp.p = tf;
+
+ if (uvedit_uv_selected(scene, efa, tf, 0)) countsel++;
+ if (uvedit_uv_selected(scene, efa, tf, 1)) countsel++;
+ if (uvedit_uv_selected(scene, efa, tf, 2)) countsel++;
+ if (efa->v4 && uvedit_uv_selected(scene, efa, tf, 3)) countsel++;
+ if(propmode)
+ count += (efa->v4)? 4: 3;
+ } else {
+ efa->tmp.p = NULL;
}
}
@@ -2491,81 +2461,36 @@ static void createTransUVs(bContext *C, TransInfo *t)
td= t->data;
td2d= t->data2d;
- if (sima->flag & SI_BE_SQUARE && !propmode) {
- for (efa= em->faces.first; efa; efa= efa->next) {
- tf=(MTFace *)efa->tmp.p;
- if (tf) {
- efa_s1 = simaUVSel_Check(efa, tf, 0);
- efa_s2 = simaUVSel_Check(efa, tf, 1);
- efa_s3 = simaUVSel_Check(efa, tf, 2);
-
- if (efa->v4) {
- efa_s4 = simaUVSel_Check(efa, tf, 3);
-
- if ( efa_s1 || efa_s2 || efa_s3 || efa_s4 ) {
- /* all corners of this quad need their edges moved. so we must store TD for each */
-
- UVsToTransData(td, td2d, tf->uv[0], efa_s1);
- if (!efa_s1) td->flag |= TD_SKIP;
- td++; td2d++;
-
- UVsToTransData(td, td2d, tf->uv[1], efa_s2);
- if (!efa_s2) td->flag |= TD_SKIP;
- td++; td2d++;
-
- UVsToTransData(td, td2d, tf->uv[2], efa_s3);
- if (!efa_s3) td->flag |= TD_SKIP;
- td++; td2d++;
-
- UVsToTransData(td, td2d, tf->uv[3], efa_s4);
- if (!efa_s4) td->flag |= TD_SKIP;
- td++; td2d++;
- }
- } else {
- /* tri's are delt with normally when SI_BE_SQUARE's enabled */
- if (efa_s1) UVsToTransData(td++, td2d++, tf->uv[0], 1);
- if (efa_s2) UVsToTransData(td++, td2d++, tf->uv[1], 1);
- if (efa_s3) UVsToTransData(td++, td2d++, tf->uv[2], 1);
- }
- }
- }
- } else {
- for (efa= em->faces.first; efa; efa= efa->next) {
- /*tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tf)) {*/
- if ((tf=(MTFace *)efa->tmp.p)) {
- if (propmode) {
- UVsToTransData(td++, td2d++, tf->uv[0], simaUVSel_Check(efa, tf, 0));
- UVsToTransData(td++, td2d++, tf->uv[1], simaUVSel_Check(efa, tf, 1));
- UVsToTransData(td++, td2d++, tf->uv[2], simaUVSel_Check(efa, tf, 2));
- if(efa->v4)
- UVsToTransData(td++, td2d++, tf->uv[3], simaUVSel_Check(efa, tf, 3));
- } else {
- if(simaUVSel_Check(efa, tf, 0)) UVsToTransData(td++, td2d++, tf->uv[0], 1);
- if(simaUVSel_Check(efa, tf, 1)) UVsToTransData(td++, td2d++, tf->uv[1], 1);
- if(simaUVSel_Check(efa, tf, 2)) UVsToTransData(td++, td2d++, tf->uv[2], 1);
- if(efa->v4 && simaUVSel_Check(efa, tf, 3)) UVsToTransData(td++, td2d++, tf->uv[3], 1);
- }
+ for (efa= em->faces.first; efa; efa= efa->next) {
+ if ((tf=(MTFace *)efa->tmp.p)) {
+ if (propmode) {
+ UVsToTransData(sima, td++, td2d++, tf->uv[0], uvedit_uv_selected(scene, efa, tf, 0));
+ UVsToTransData(sima, td++, td2d++, tf->uv[1], uvedit_uv_selected(scene, efa, tf, 1));
+ UVsToTransData(sima, td++, td2d++, tf->uv[2], uvedit_uv_selected(scene, efa, tf, 2));
+ if(efa->v4)
+ UVsToTransData(sima, td++, td2d++, tf->uv[3], uvedit_uv_selected(scene, efa, tf, 3));
+ } else {
+ if(uvedit_uv_selected(scene, efa, tf, 0)) UVsToTransData(sima, td++, td2d++, tf->uv[0], 1);
+ if(uvedit_uv_selected(scene, efa, tf, 1)) UVsToTransData(sima, td++, td2d++, tf->uv[1], 1);
+ if(uvedit_uv_selected(scene, efa, tf, 2)) UVsToTransData(sima, td++, td2d++, tf->uv[2], 1);
+ if(efa->v4 && uvedit_uv_selected(scene, efa, tf, 3)) UVsToTransData(sima, td++, td2d++, tf->uv[3], 1);
}
}
}
if (sima->flag & SI_LIVE_UNWRAP)
- unwrap_lscm_live_begin();
-#endif
+ ED_uvedit_live_unwrap_begin(t->scene, t->obedit);
}
void flushTransUVs(TransInfo *t)
{
-#if 0 // TRANSFORM_FIX_ME
+ SpaceImage *sima = t->sa->spacedata.first;
TransData2D *td;
int a, width, height;
- Object *ob= OBACT;
- EditMesh *em = ((Mesh *)ob->data)->edit_mesh;
float aspx, aspy, invx, invy;
- transform_aspect_ratio_tface_uv(&aspx, &aspy);
- transform_width_height_tface_uv(&width, &height);
+ ED_space_image_uv_aspect(sima, &aspx, &aspy);
+ ED_space_image_size(sima, &width, &height);
invx= 1.0f/aspx;
invy= 1.0f/aspy;
@@ -2574,28 +2499,20 @@ void flushTransUVs(TransInfo *t)
td->loc2d[0]= td->loc[0]*invx;
td->loc2d[1]= td->loc[1]*invy;
- if((G.sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL)) {
+ if((sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL)) {
td->loc2d[0]= (float)floor(width*td->loc2d[0] + 0.5f)/width;
td->loc2d[1]= (float)floor(height*td->loc2d[1] + 0.5f)/height;
}
}
-
- if((G.sima->flag & SI_BE_SQUARE) && (t->flag & T_PROP_EDIT)==0 && (t->state != TRANS_CANCEL))
- be_square_tface_uv(em);
-
- /* this is overkill if G.sima->lock is not set, but still needed */
- object_uvs_changed(ob);
-#endif
}
int clipUVTransform(TransInfo *t, float *vec, int resize)
{
-#if 0 // TRANSFORM_FIX_ME
TransData *td;
int a, clipx=1, clipy=1;
float aspx, aspy, min[2], max[2];
- transform_aspect_ratio_tface_uv(&aspx, &aspy);
+ ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
min[0]= min[1]= 0.0f;
max[0]= aspx; max[1]= aspy;
@@ -2635,48 +2552,6 @@ int clipUVTransform(TransInfo *t, float *vec, int resize)
}
return (clipx || clipy);
-#endif
-return 0;
-}
-
-/* ********************* IPO EDITOR ************************* */
-
-/* for IPO Editor transform - but actual creation of transform structures is not performed here
- * due to bad globals that would need to be imported specially for this
- */
-static void createTransIpoData(bContext *C, TransInfo *t)
-{
- // TRANSFORM_FIX_ME
-#if 0
- /* in editipo.c due to some globals that are defined in that file... */
- make_ipo_transdata(t);
-#endif
-}
-
-/* this function is called on recalcData to apply the transforms applied
- * to the transdata on to the actual keyframe data
- */
-void flushTransIpoData(TransInfo *t)
-{
-#if 0 // TRANSFORM_FIX_ME
- TransData2D *td;
- int a;
-
- /* flush to 2d vector from internally used 3d vector */
- for (a=0, td= t->data2d; a<t->total; a++, td++) {
- // FIXME: autosnap needs to be here...
-
- /* we need to unapply the nla-scaling from the time in some situations */
- if (NLA_IPO_SCALED)
- td->loc2d[0]= get_action_frame(OBACT, td->loc[0]);
- else
- td->loc2d[0]= td->loc[0];
-
- /* when the icu that point comes from is a bitflag holder, don't allow adjusting values */
- if ((t->data[a].flag & TD_TIMEONLY)==0)
- td->loc2d[1]= td->loc[1];
- }
-#endif
}
/* ********************* ACTION/NLA EDITOR ****************** */
@@ -3162,6 +3037,459 @@ static void createTransActionData(bContext *C, TransInfo *t)
BLI_freelistN(&anim_data);
}
+/* ********************* GRAPH EDITOR ************************* */
+
+
+
+/* Helper function for createTransGraphEditData, which is reponsible for associating
+ * source data with transform data
+ */
+static void bezt_to_transdata (TransData *td, TransData2D *td2d, Object *nob, float *loc, float *cent, short selected, short ishandle)
+{
+ /* New location from td gets dumped onto the old-location of td2d, which then
+ * gets copied to the actual data at td2d->loc2d (bezt->vec[n])
+ *
+ * Due to NLA scaling, we apply NLA scaling to some of the verts here,
+ * and then that scaling will be undone after transform is done.
+ */
+
+ if (nob) {
+ td2d->loc[0] = get_action_frame_inv(nob, loc[0]);
+ td2d->loc[1] = loc[1];
+ td2d->loc[2] = 0.0f;
+ td2d->loc2d = loc;
+
+ td->loc = td2d->loc;
+ td->center[0] = get_action_frame_inv(nob, cent[0]);
+ td->center[1] = cent[1];
+ td->center[2] = 0.0f;
+
+ VECCOPY(td->iloc, td->loc);
+ }
+ else {
+ td2d->loc[0] = loc[0];
+ td2d->loc[1] = loc[1];
+ td2d->loc[2] = 0.0f;
+ td2d->loc2d = loc;
+
+ td->loc = td2d->loc;
+ VECCOPY(td->center, cent);
+ VECCOPY(td->iloc, td->loc);
+ }
+
+ memset(td->axismtx, 0, sizeof(td->axismtx));
+ td->axismtx[2][2] = 1.0f;
+
+ td->ext= NULL; td->tdi= NULL; td->val= NULL;
+
+ if (selected) {
+ td->flag |= TD_SELECTED;
+ td->dist= 0.0f;
+ }
+ else
+ td->dist= MAXFLOAT;
+
+ if (ishandle)
+ td->flag |= TD_NOTIMESNAP;
+
+ Mat3One(td->mtx);
+ Mat3One(td->smtx);
+}
+
+static void createTransGraphEditData(bContext *C, TransInfo *t)
+{
+ Scene *scene= CTX_data_scene(C);
+ ARegion *ar= CTX_wm_region(C);
+ View2D *v2d= &ar->v2d;
+
+ TransData *td = NULL;
+ TransData2D *td2d = NULL;
+
+ bAnimContext ac;
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ BezTriple *bezt, *prevbezt;
+ int count=0, i;
+ float cfra;
+ char side;
+
+ /* determine what type of data we are operating on */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return;
+
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE);
+ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+
+ /* which side of the current frame should be allowed */
+ // XXX we still want this mode, but how to get this using standard transform too?
+ if (t->mode == TFM_TIME_EXTEND) {
+ /* only side on which mouse is gets transformed */
+ float xmouse, ymouse;
+
+ UI_view2d_region_to_view(&ac.ar->v2d, t->imval[0], t->imval[1], &xmouse, &ymouse);
+ side = (xmouse > CFRA) ? 'R' : 'L'; // XXX use t->frame_side
+ }
+ else {
+ /* normal transform - both sides of current frame are considered */
+ side = 'B';
+ }
+
+ /* loop 1: count how many BezTriples (specifically their verts) are selected (or should be edited) */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ Object *nob= NULL; //ANIM_nla_mapping_get(&ac, ale); // XXX we don't handle NLA mapping for now here...
+ FCurve *fcu= (FCurve *)ale->key_data;
+
+ /* convert current-frame to action-time (slightly less accurate, espcially under
+ * higher scaling ratios, but is faster than converting all points)
+ */
+ if (nob)
+ cfra = get_action_frame(nob, (float)CFRA);
+ else
+ cfra = (float)CFRA;
+
+ /* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse */
+ if (fcu->bezt) {
+ for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
+ if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) {
+ if (v2d->around == V3D_LOCAL) {
+ /* for local-pivot we only need to count the number of selected handles only, so that centerpoitns don't
+ * don't get moved wrong
+ */
+ if (bezt->ipo == BEZT_IPO_BEZ) {
+ if (bezt->f1 & SELECT) count++;
+ if (bezt->f3 & SELECT) count++;
+ }
+ else if (bezt->f2 & SELECT) count++;
+ }
+ else {
+ /* for 'normal' pivots */
+ if (bezt->ipo == BEZT_IPO_BEZ) {
+ if (bezt->f1 & SELECT) count++;
+ if (bezt->f2 & SELECT) count++;
+ if (bezt->f3 & SELECT) count++;
+ }
+ else if (bezt->f2 & SELECT) count++;
+ }
+ }
+ }
+ }
+ }
+
+ /* stop if trying to build list if nothing selected */
+ if (count == 0) {
+ /* cleanup temp list */
+ BLI_freelistN(&anim_data);
+ return;
+ }
+
+ /* allocate memory for data */
+ t->total= count;
+
+ t->data= MEM_callocN(t->total*sizeof(TransData), "TransData (Graph Editor)");
+ /* for each 2d vert a 3d vector is allocated, so that they can be treated just as if they were 3d verts */
+ t->data2d= MEM_callocN(t->total*sizeof(TransData2D), "TransData2D (Graph Editor)");
+
+ td= t->data;
+ td2d= t->data2d;
+
+ /* loop 2: build transdata arrays */
+ cfra = (float)CFRA;
+
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ Object *nob= NULL; //ANIM_nla_mapping_get(&ac, ale); // XXX we don't handle NLA mapping here yet
+ FCurve *fcu= (FCurve *)ale->key_data;
+
+ /* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse (if applicable) */
+ bezt= fcu->bezt;
+ prevbezt= NULL;
+
+ for (i=0; i < fcu->totvert; i++, prevbezt=bezt, bezt++) {
+ if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) {
+ TransDataCurveHandleFlags *hdata = NULL;
+ short h1=1, h2=1;
+
+ /* only include handles if selected, and interpolaton mode uses beztriples */
+ if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) {
+ if (bezt->f1 & SELECT) {
+ hdata = initTransDataCurveHandes(td, bezt);
+ bezt_to_transdata(td++, td2d++, nob, bezt->vec[0], bezt->vec[1], 1, 1);
+ }
+ else
+ h1= 0;
+ }
+ if (bezt->ipo == BEZT_IPO_BEZ) {
+ if (bezt->f3 & SELECT) {
+ if (hdata==NULL)
+ hdata = initTransDataCurveHandes(td, bezt);
+ bezt_to_transdata(td++, td2d++, nob, bezt->vec[2], bezt->vec[1], 1, 1);
+ }
+ else
+ h2= 0;
+ }
+
+ /* only include main vert if selected */
+ if (bezt->f2 & SELECT) {
+ /* if scaling around individuals centers, do no include keyframes */
+ if (v2d->around != V3D_LOCAL) {
+ /* if handles were not selected, store their selection status */
+ if (!(bezt->f1 & SELECT) && !(bezt->f3 & SELECT)) {
+ if (hdata == NULL)
+ hdata = initTransDataCurveHandes(td, bezt);
+ }
+
+ bezt_to_transdata(td++, td2d++, nob, bezt->vec[1], bezt->vec[1], 1, 0);
+ }
+
+ /* special hack (must be done after initTransDataCurveHandes(), as that stores handle settings to restore...):
+ * - Check if we've got entire BezTriple selected and we're scaling/rotating that point,
+ * then check if we're using auto-handles.
+ * - If so, change them auto-handles to aligned handles so that handles get affected too
+ */
+ if ((bezt->h1 == HD_AUTO) && (bezt->h2 == HD_AUTO) && ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) {
+ if (h1 && h2) {
+ bezt->h1= HD_ALIGN;
+ bezt->h2= HD_ALIGN;
+ }
+ }
+ }
+ }
+ }
+
+ /* Sets handles based on the selection */
+ testhandles_fcurve(fcu);
+ }
+
+ /* cleanup temp list */
+ BLI_freelistN(&anim_data);
+}
+
+
+/* ------------------------ */
+
+/* struct for use in re-sorting BezTriples during IPO transform */
+typedef struct BeztMap {
+ BezTriple *bezt;
+ int oldIndex; /* index of bezt in icu->bezt array before sorting */
+ int newIndex; /* index of bezt in icu->bezt array after sorting */
+ short swapHs; /* swap order of handles (-1=clear; 0=not checked, 1=swap) */
+ char pipo, cipo; /* interpolation of current and next segments */
+} BeztMap;
+
+
+/* This function converts an FCurve's BezTriple array to a BeztMap array
+ * NOTE: this allocates memory that will need to get freed later
+ */
+static BeztMap *bezt_to_beztmaps (BezTriple *bezts, int totvert)
+{
+ BezTriple *bezt= bezts;
+ BezTriple *prevbezt= NULL;
+ BeztMap *bezm, *bezms;
+ int i;
+
+ /* allocate memory for this array */
+ if (totvert==0 || bezts==NULL)
+ return NULL;
+ bezm= bezms= MEM_callocN(sizeof(BeztMap)*totvert, "BeztMaps");
+
+ /* assign beztriples to beztmaps */
+ for (i=0; i < totvert; i++, bezm++, prevbezt=bezt, bezt++) {
+ bezm->bezt= bezt;
+
+ bezm->oldIndex= i;
+ bezm->newIndex= i;
+
+ bezm->pipo= (prevbezt) ? prevbezt->ipo : bezt->ipo;
+ bezm->cipo= bezt->ipo;
+ }
+
+ return bezms;
+}
+
+/* This function copies the code of sort_time_ipocurve, but acts on BeztMap structs instead */
+static void sort_time_beztmaps (BeztMap *bezms, int totvert)
+{
+ BeztMap *bezm;
+ int i, ok= 1;
+
+ /* keep repeating the process until nothing is out of place anymore */
+ while (ok) {
+ ok= 0;
+
+ bezm= bezms;
+ i= totvert;
+ while (i--) {
+ /* is current bezm out of order (i.e. occurs later than next)? */
+ if (i > 0) {
+ if (bezm->bezt->vec[1][0] > (bezm+1)->bezt->vec[1][0]) {
+ bezm->newIndex++;
+ (bezm+1)->newIndex--;
+
+ SWAP(BeztMap, *bezm, *(bezm+1));
+
+ ok= 1;
+ }
+ }
+
+ /* do we need to check if the handles need to be swapped?
+ * optimisation: this only needs to be performed in the first loop
+ */
+ if (bezm->swapHs == 0) {
+ if ( (bezm->bezt->vec[0][0] > bezm->bezt->vec[1][0]) &&
+ (bezm->bezt->vec[2][0] < bezm->bezt->vec[1][0]) )
+ {
+ /* handles need to be swapped */
+ bezm->swapHs = 1;
+ }
+ else {
+ /* handles need to be cleared */
+ bezm->swapHs = -1;
+ }
+ }
+
+ bezm++;
+ }
+ }
+}
+
+/* This function firstly adjusts the pointers that the transdata has to each BezTriple */
+static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totvert)
+{
+ BezTriple *bezts = fcu->bezt;
+ BeztMap *bezm;
+ TransData2D *td;
+ int i, j;
+ char *adjusted;
+
+ /* dynamically allocate an array of chars to mark whether an TransData's
+ * pointers have been fixed already, so that we don't override ones that are
+ * already done
+ */
+ adjusted= MEM_callocN(t->total, "beztmap_adjusted_map");
+
+ /* for each beztmap item, find if it is used anywhere */
+ bezm= bezms;
+ for (i= 0; i < totvert; i++, bezm++) {
+ /* loop through transdata, testing if we have a hit
+ * for the handles (vec[0]/vec[2]), we must also check if they need to be swapped...
+ */
+ td= t->data2d;
+ for (j= 0; j < t->total; j++, td++) {
+ /* skip item if already marked */
+ if (adjusted[j] != 0) continue;
+
+ /* only selected verts */
+ if (bezm->pipo == BEZT_IPO_BEZ) {
+ if (bezm->bezt->f1 & SELECT) {
+ if (td->loc2d == bezm->bezt->vec[0]) {
+ if (bezm->swapHs == 1)
+ td->loc2d= (bezts + bezm->newIndex)->vec[2];
+ else
+ td->loc2d= (bezts + bezm->newIndex)->vec[0];
+ adjusted[j] = 1;
+ }
+ }
+ }
+ if (bezm->cipo == BEZT_IPO_BEZ) {
+ if (bezm->bezt->f3 & SELECT) {
+ if (td->loc2d == bezm->bezt->vec[2]) {
+ if (bezm->swapHs == 1)
+ td->loc2d= (bezts + bezm->newIndex)->vec[0];
+ else
+ td->loc2d= (bezts + bezm->newIndex)->vec[2];
+ adjusted[j] = 1;
+ }
+ }
+ }
+ if (bezm->bezt->f2 & SELECT) {
+ if (td->loc2d == bezm->bezt->vec[1]) {
+ td->loc2d= (bezts + bezm->newIndex)->vec[1];
+ adjusted[j] = 1;
+ }
+ }
+ }
+
+ }
+
+ /* free temp memory used for 'adjusted' array */
+ MEM_freeN(adjusted);
+}
+
+/* This function is called by recalcData during the Transform loop to recalculate
+ * the handles of curves and sort the keyframes so that the curves draw correctly.
+ * It is only called if some keyframes have moved out of order.
+ *
+ * anim_data is the list of channels (F-Curves) retrieved already containing the
+ * channels to work on. It should not be freed here as it may still need to be used.
+ */
+void remake_graph_transdata (TransInfo *t, ListBase *anim_data)
+{
+ bAnimListElem *ale;
+
+ /* sort and reassign verts */
+ for (ale= anim_data->first; ale; ale= ale->next) {
+ FCurve *fcu= (FCurve *)ale->key_data;
+
+ if (fcu->bezt) {
+ BeztMap *bezm;
+
+ /* adjust transform-data pointers */
+ bezm= bezt_to_beztmaps(fcu->bezt, fcu->totvert);
+ sort_time_beztmaps(bezm, fcu->totvert);
+ beztmap_to_data(t, fcu, bezm, fcu->totvert);
+
+ /* re-sort actual beztriples (perhaps this could be done using the beztmaps to save time?) */
+ sort_time_fcurve(fcu);
+
+ /* free mapping stuff */
+ MEM_freeN(bezm);
+
+ /* make sure handles are all set correctly */
+ testhandles_fcurve(fcu);
+ }
+ }
+}
+
+/* this function is called on recalcData to apply the transforms applied
+ * to the transdata on to the actual keyframe data
+ */
+void flushTransGraphData(TransInfo *t)
+{
+ SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
+ TransData *td;
+ TransData2D *td2d;
+ int a;
+
+ /* flush to 2d vector from internally used 3d vector */
+ for (a=0, td= t->data, td2d=t->data2d; a<t->total; a++, td++, td2d++) {
+ /* handle snapping for time values
+ * - we should still be in NLA-mapping timespace
+ * - only apply to keyframes (but never to handles)
+ */
+ if ((td->flag & TD_NOTIMESNAP)==0) {
+ switch (sipo->autosnap) {
+ case SACTSNAP_FRAME: /* snap to nearest frame */
+ td2d->loc[0]= (float)( floor(td2d->loc[0]+0.5f) );
+ break;
+
+ case SACTSNAP_MARKER: /* snap to nearest marker */
+ //td2d->loc[0]= (float)find_nearest_marker_time(td2d->loc[0]);
+ break;
+ }
+ }
+
+ /* we need to unapply the nla-scaling from the time in some situations */
+ //if (NLA_IPO_SCALED)
+ // td2d->loc2d[0]= get_action_frame(OBACT, td2d->loc[0]);
+ //else
+ td2d->loc2d[0]= td2d->loc[0];
+
+ td2d->loc2d[1]= td2d->loc[1];
+ }
+}
+
/* **************** IpoKey stuff, for Object TransData ********** */
@@ -3536,17 +3864,17 @@ static void createTransSeqData(bContext *C, TransInfo *t)
View2D *v2d= UI_view2d_fromcontext(C);
Scene *scene= CTX_data_scene(C);
- Editing *ed= scene->ed;
+ Editing *ed= seq_give_editing(t->scene, FALSE);
TransData *td = NULL;
TransData2D *td2d= NULL;
TransDataSeq *tdsq= NULL;
-
-
int count=0;
-
-
+ if (ed==NULL) {
+ t->total= 0;
+ return;
+ }
/* which side of the current frame should be allowed */
if (t->mode == TFM_TIME_EXTEND) {
@@ -4072,9 +4400,9 @@ void special_aftertrans_update(TransInfo *t)
}
if (t->spacetype == SPACE_SEQ) {
-
- if (!cancelled) {
- ListBase *seqbasep= ((Editing *)t->scene->ed)->seqbasep;
+ Editing *ed= seq_give_editing(t->scene, FALSE);
+ if (ed && !cancelled) {
+ ListBase *seqbasep= ed->seqbasep;
int a;
TransData *td= t->data;
TransData2D *td2d= t->data2d;
@@ -4226,12 +4554,65 @@ void special_aftertrans_update(TransInfo *t)
}
#endif // XXX future of this is still not clear
- /* make sure all IPO-curves are set correctly */
+ /* make sure all F-Curves are set correctly */
ANIM_editkeyframes_refresh(&ac);
/* clear flag that was set for time-slide drawing */
saction->flag &= ~SACTION_MOVING;
}
+ else if (t->spacetype == SPACE_IPO) {
+ SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first;
+ Scene *scene;
+ bAnimContext ac;
+
+ /* initialise relevant anim-context 'context' data from TransInfo data */
+ /* NOTE: sync this with the code in ANIM_animdata_get_context() */
+ memset(&ac, 0, sizeof(bAnimContext));
+
+ scene= ac.scene= t->scene;
+ ob= ac.obact= OBACT;
+ ac.sa= t->sa;
+ ac.ar= t->ar;
+ ac.spacetype= (t->sa)? t->sa->spacetype : 0;
+ ac.regiontype= (t->ar)? t->ar->regiontype : 0;
+
+ if (ANIM_animdata_context_getdata(&ac) == 0)
+ return;
+
+ if (ac.datatype)
+ {
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ short filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE);
+
+ /* get channels to work on */
+ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+
+ /* these should all be ipo-blocks */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ Object *nob= ANIM_nla_mapping_get(&ac, ale);
+ FCurve *fcu= (FCurve *)ale->key_data;
+
+ if ( (sipo->flag & SIPO_NOTRANSKEYCULL)==0 &&
+ ((cancelled == 0) || (duplicate)) )
+ {
+ if (nob) {
+ ANIM_nla_mapping_apply_fcurve(nob, fcu, 0, 1);
+ posttrans_fcurve_clean(fcu);
+ ANIM_nla_mapping_apply_fcurve(nob, fcu, 1, 1);
+ }
+ else
+ posttrans_fcurve_clean(fcu);
+ }
+ }
+
+ /* free temp memory */
+ BLI_freelistN(&anim_data);
+ }
+
+ /* make sure all F-Curves are set correctly */
+ ANIM_editkeyframes_refresh(&ac);
+ }
else if (t->obedit) {
// TRANSFORM_FIX_ME
// if (t->mode==TFM_BONESIZE || t->mode==TFM_BONE_ENVELOPE)
@@ -4260,26 +4641,6 @@ void special_aftertrans_update(TransInfo *t)
posttrans_nla_clean(t);
}
}
- else if (t->spacetype == SPACE_IPO) {
- // FIXME! is there any code from the old transform_ipo that needs to be added back?
-
- /* after transform, remove duplicate keyframes on a frame that resulted from transform */
- if (G.sipo->ipo)
- {
- if ( (G.sipo->flag & SIPO_NOTRANSKEYCULL)==0 &&
- (cancelled == 0) )
- {
- /* NOTE: no need to do NLA scaling stuff here, as when there is NLA scaling,
- * the transformed handles will get moved wrong (seem to match wrong repeat cycle)
- */
- posttrans_ipo_clean(G.sipo->ipo);
- }
- }
-
- /* resetting slow-parents isn't really necessary when editing sequence ipo's */
- if (G.sipo->blocktype==ID_SEQ)
- resetslowpar= 0;
- }
else if ((t->flag & T_POSE) && (t->poseobj)) {
bArmature *arm;
bPose *pose;
@@ -4593,7 +4954,7 @@ void createTransData(bContext *C, TransInfo *t)
}
else if (t->spacetype == SPACE_IPO) {
t->flag |= T_POINTS|T_2D_EDIT;
- createTransIpoData(C, t);
+ createTransGraphEditData(C, t);
#if 0
if (t->data && (t->flag & T_PROP_EDIT)) {
sort_trans_data(t); // makes selected become first in array
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index a2a8d318546..0a0b6e6f07a 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -34,6 +34,7 @@
#include "BLO_sys_types.h" // for intptr_t support
+#include "DNA_anim_types.h"
#include "DNA_action_types.h"
#include "DNA_armature_types.h"
#include "DNA_constraint_types.h"
@@ -71,6 +72,7 @@
#include "BKE_depsgraph.h"
#include "BKE_displist.h"
#include "BKE_depsgraph.h"
+#include "BKE_fcurve.h"
#include "BKE_global.h"
#include "BKE_group.h"
#include "BKE_lattice.h"
@@ -81,12 +83,14 @@
#include "BKE_utildefines.h"
#include "BKE_context.h"
+#include "ED_anim_api.h"
#include "ED_armature.h"
-#include "ED_view3d.h"
+#include "ED_image.h"
#include "ED_mesh.h"
#include "ED_space_api.h"
+#include "ED_uvedit.h"
+#include "ED_view3d.h"
-//#include "BSE_editaction_types.h"
//#include "BDR_unwrapper.h"
#include "BLI_arithb.h"
@@ -347,76 +351,6 @@ void recalcData(TransInfo *t)
}
}
}
- else if (t->spacetype == SPACE_IPO) {
- EditIpo *ei;
- int dosort = 0;
- int a;
-
- /* do the flush first */
- flushTransIpoData(t);
-
- /* now test if there is a need to re-sort */
- ei= G.sipo->editipo;
- for (a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN(ei, flag & IPO_VISIBLE, icu)) {
-
- /* watch it: if the time is wrong: do not correct handles */
- if (test_time_ipocurve(ei->icu)) {
- dosort++;
- } else {
- calchandles_ipocurve(ei->icu);
- }
- }
- }
-
- /* do resort and other updates? */
- if (dosort) remake_ipo_transdata(t);
- if (G.sipo->showkey) update_ipokey_val();
-
- calc_ipo(G.sipo->ipo, (float)CFRA);
-
- /* update realtime - not working? */
- if (G.sipo->lock) {
- if (G.sipo->blocktype==ID_MA || G.sipo->blocktype==ID_TE) {
- do_ipo(G.sipo->ipo);
- }
- else if(G.sipo->blocktype==ID_CA) {
- do_ipo(G.sipo->ipo);
- }
- else if(G.sipo->blocktype==ID_KE) {
- Object *ob= OBACT;
- if(ob) {
- ob->shapeflag &= ~OB_SHAPE_TEMPLOCK;
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- }
- else if(G.sipo->blocktype==ID_PO) {
- Object *ob= OBACT;
- if(ob && ob->pose) {
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- }
- else if(G.sipo->blocktype==ID_OB) {
- Object *ob= OBACT;
- Base *base= FIRSTBASE;
-
- /* only if this if active object has this ipo in an action (assumes that current ipo is in action) */
- if ((ob) && (ob->ipoflag & OB_ACTION_OB) && (G.sipo->pin==0)) {
- ob->ctime= -1234567.0f;
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
- }
-
- while(base) {
- if(base->object->ipo==G.sipo->ipo) {
- do_ob_ipo(base->object);
- base->object->recalc |= OB_RECALC_OB;
- }
- base= base->next;
- }
- DAG_scene_flush_update(G.scene, screen_view3d_layers(), 0);
- }
- }
- }
else if (t->obedit) {
if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
Curve *cu= t->obedit->data;
@@ -458,13 +392,69 @@ void recalcData(TransInfo *t)
else if (t->spacetype==SPACE_SEQ) {
flushTransSeq(t);
}
+ else if (t->spacetype == SPACE_IPO) {
+ SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first;
+ Scene *scene;
+
+ ListBase anim_data = {NULL, NULL};
+ bAnimContext ac;
+ int filter;
+
+ bAnimListElem *ale;
+ int dosort = 0;
+
+
+ /* initialise relevant anim-context 'context' data from TransInfo data */
+ /* NOTE: sync this with the code in ANIM_animdata_get_context() */
+ memset(&ac, 0, sizeof(bAnimContext));
+
+ scene= ac.scene= t->scene;
+ ac.obact= OBACT;
+ ac.sa= t->sa;
+ ac.ar= t->ar;
+ ac.spacetype= (t->sa)? t->sa->spacetype : 0;
+ ac.regiontype= (t->ar)? t->ar->regiontype : 0;
+
+ /* do the flush first */
+ flushTransGraphData(t);
+
+ /* get curves to check if a re-sort is needed */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE);
+ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+
+ /* now test if there is a need to re-sort */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ FCurve *fcu= (FCurve *)ale->key_data;
+
+ /* watch it: if the time is wrong: do not correct handles yet */
+ if (test_time_fcurve(fcu))
+ dosort++;
+ else
+ calchandles_fcurve(fcu);
+ }
+
+ /* do resort and other updates? */
+ if (dosort) remake_graph_transdata(t, &anim_data);
+ //if (sipo->showkey) update_ipokey_val();
+
+ /* now free temp channels */
+ BLI_freelistN(&anim_data);
+
+ /* update realtime - not working? */
+ if (sipo->lock) {
+
+ }
+ }
else if (t->obedit) {
if (t->obedit->type == OB_MESH) {
if(t->spacetype==SPACE_IMAGE) {
+ SpaceImage *sima= t->sa->spacedata.first;
+
flushTransUVs(t);
- /* TRANSFORM_FIX_ME */
-// if (G.sima->flag & SI_LIVE_UNWRAP)
-// unwrap_lscm_live_re_solve();
+ if(sima->flag & SI_LIVE_UNWRAP)
+ ED_uvedit_live_unwrap_re_solve();
+
+ DAG_object_flush_update(t->scene, t->obedit, OB_RECALC_DATA);
} else {
EditMesh *em = ((Mesh*)t->obedit->data)->edit_mesh;
/* mirror modifier clipping? */
@@ -699,6 +689,8 @@ void initTransInfo (bContext *C, TransInfo *t, wmEvent *event)
{
t->imval[0] = event->x - t->ar->winrct.xmin;
t->imval[1] = event->y - t->ar->winrct.ymin;
+
+ t->event_type = event->type;
}
else
{
@@ -741,11 +733,9 @@ void initTransInfo (bContext *C, TransInfo *t, wmEvent *event)
}
else if(t->spacetype==SPACE_IMAGE || t->spacetype==SPACE_NODE)
{
- View2D *v2d = sa->spacedata.first; // XXX no!
-
- t->view = v2d;
-
- t->around = v2d->around;
+ // XXX for now, get View2D from the active region
+ t->view = &ar->v2d;
+ t->around = ar->v2d.around;
}
else
{
@@ -789,10 +779,9 @@ void postTrans (TransInfo *t)
}
if(t->spacetype==SPACE_IMAGE) {
-#if 0 // TRANSFORM_FIX_ME
- if (G.sima->flag & SI_LIVE_UNWRAP)
- unwrap_lscm_live_end(t->state == TRANS_CANCEL);
-#endif
+ SpaceImage *sima= t->sa->spacedata.first;
+ if(sima->flag & SI_LIVE_UNWRAP)
+ ED_uvedit_live_unwrap_end(t->state == TRANS_CANCEL);
}
else if(t->spacetype==SPACE_ACTION) {
if (t->customData)
@@ -921,16 +910,17 @@ void calculateCenterCursor(TransInfo *t)
void calculateCenterCursor2D(TransInfo *t)
{
-#if 0 // TRANSFORM_FIX_ME
+ View2D *v2d= t->view;
float aspx=1.0, aspy=1.0;
if(t->spacetype==SPACE_IMAGE) /* only space supported right now but may change */
- transform_aspect_ratio_tface_uv(&aspx, &aspy);
- if (G.v2d) {
- t->center[0] = G.v2d->cursor[0] * aspx;
- t->center[1] = G.v2d->cursor[1] * aspy;
+ ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
+
+ if (v2d) {
+ t->center[0] = v2d->cursor[0] * aspx;
+ t->center[1] = v2d->cursor[1] * aspy;
}
-#endif
+
calculateCenter2D(t);
}
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 487bd4c08bf..3bad5379484 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -66,7 +66,7 @@ static int select_orientation_invoke(bContext *C, wmOperator *op, wmEvent *event
op->customdata = string;
- uiPupmenuOperator(C, 0, op, "orientation", string);
+ uiPupMenuOperator(C, 0, op, "orientation", string);
return OPERATOR_RUNNING_MODAL;
}
@@ -242,7 +242,10 @@ void transform_keymap_for_space(struct wmWindowManager *wm, struct ListBase *key
case SPACE_VIEW3D:
km = WM_keymap_add_item(keymap, "TFM_OT_transform", GKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
-
+
+ km= WM_keymap_add_item(keymap, "TFM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
+ RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
+
km = WM_keymap_add_item(keymap, "TFM_OT_transform", RKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_ROTATION);
@@ -265,6 +268,9 @@ void transform_keymap_for_space(struct wmWindowManager *wm, struct ListBase *key
km= WM_keymap_add_item(keymap, "TFM_OT_transform", GKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_TRANSLATE);
+ km= WM_keymap_add_item(keymap, "TFM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
+ RNA_int_set(km->ptr, "mode", TFM_TIME_TRANSLATE);
+
km= WM_keymap_add_item(keymap, "TFM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND);
@@ -274,10 +280,32 @@ void transform_keymap_for_space(struct wmWindowManager *wm, struct ListBase *key
km= WM_keymap_add_item(keymap, "TFM_OT_transform", TKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_SLIDE);
break;
+ case SPACE_IPO:
+ km= WM_keymap_add_item(keymap, "TFM_OT_transform", GKEY, KM_PRESS, 0, 0);
+ RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
+
+ km= WM_keymap_add_item(keymap, "TFM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
+ RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
+
+ // XXX the 'mode' identifier here is not quite right
+ km= WM_keymap_add_item(keymap, "TFM_OT_transform", EKEY, KM_PRESS, 0, 0);
+ RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND);
+
+ km = WM_keymap_add_item(keymap, "TFM_OT_transform", RKEY, KM_PRESS, 0, 0);
+ RNA_int_set(km->ptr, "mode", TFM_ROTATION);
+
+ km = WM_keymap_add_item(keymap, "TFM_OT_transform", SKEY, KM_PRESS, 0, 0);
+ RNA_int_set(km->ptr, "mode", TFM_RESIZE);
+ break;
case SPACE_NODE:
km= WM_keymap_add_item(keymap, "TFM_OT_transform", GKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
+ km= WM_keymap_add_item(keymap, "TFM_OT_transform", EVT_TWEAK_A, KM_ANY, 0, 0);
+ RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
+ km= WM_keymap_add_item(keymap, "TFM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
+ RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
+
km = WM_keymap_add_item(keymap, "TFM_OT_transform", RKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_ROTATION);
@@ -287,10 +315,29 @@ void transform_keymap_for_space(struct wmWindowManager *wm, struct ListBase *key
case SPACE_SEQ:
km= WM_keymap_add_item(keymap, "TFM_OT_transform", GKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
-
+
+ km= WM_keymap_add_item(keymap, "TFM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
+ RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
+
km= WM_keymap_add_item(keymap, "TFM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND);
break;
+ case SPACE_IMAGE:
+ km = WM_keymap_add_item(keymap, "TFM_OT_transform", GKEY, KM_PRESS, 0, 0);
+ RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
+
+ km= WM_keymap_add_item(keymap, "TFM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
+ RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
+
+ km = WM_keymap_add_item(keymap, "TFM_OT_transform", RKEY, KM_PRESS, 0, 0);
+ RNA_int_set(km->ptr, "mode", TFM_ROTATION);
+
+ km = WM_keymap_add_item(keymap, "TFM_OT_transform", SKEY, KM_PRESS, 0, 0);
+ RNA_int_set(km->ptr, "mode", TFM_RESIZE);
+
+ km = WM_keymap_add_item(keymap, "TFM_OT_transform", SKEY, KM_PRESS, KM_ALT|KM_CTRL|KM_SHIFT, 0);
+ RNA_int_set(km->ptr, "mode", TFM_SHEAR);
+ break;
default:
break;
}
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 7663f3418fb..447c4b810ab 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -64,12 +64,15 @@
#include "BKE_anim.h" /* for duplis */
#include "BKE_context.h"
-#include "ED_view3d.h"
+#include "ED_image.h"
#include "ED_mesh.h"
+#include "ED_uvedit.h"
+#include "ED_view3d.h"
#include "WM_types.h"
#include "UI_resources.h"
+#include "UI_view2d.h"
#include "MEM_guardedalloc.h"
@@ -172,9 +175,8 @@ void drawSnapping(TransInfo *t)
myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
glLoadIdentity();
- aspect_sima(G.sima, &xuser_asp, &yuser_asp);
-
- transform_width_height_tface_uv(&wi, &hi);
+ ED_space_image_aspect(t->sa->spacedata.first, &xuser_aspx, &yuser_asp);
+ ED_space_image_width(t->sa->spacedata.first, &wi, &hi);
w = (((float)wi)/256.0f)*G.sima->zoom * xuser_asp;
h = (((float)hi)/256.0f)*G.sima->zoom * yuser_asp;
@@ -559,20 +561,16 @@ void CalcSnapGeometry(TransInfo *t, float *vec)
}
}
else if (t->spacetype == SPACE_IMAGE)
- { /* same as above but for UV's */
- MTFace *nearesttf=NULL;
- float aspx, aspy;
- int face_corner;
+ {
+ /* same as above but for UV's */
+ Image *ima= ED_space_image(t->sa->spacedata.first);
+ float aspx, aspy, co[2];
- // TRANSFORM_FIX_ME
- //find_nearest_uv(&nearesttf, NULL, NULL, &face_corner);
+ UI_view2d_region_to_view(&t->ar->v2d, t->mval[0], t->mval[1], co, co+1);
- if (nearesttf != NULL)
+ if(ED_uvedit_nearest_uv(t->scene, t->obedit, ima, co, t->tsnap.snapPoint))
{
- VECCOPY2D(t->tsnap.snapPoint, nearesttf->uv[face_corner]);
-
- // TRANSFORM_FIX_ME
- //transform_aspect_ratio_tface_uv(&aspx, &aspy);
+ ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
t->tsnap.snapPoint[0] *= aspx;
t->tsnap.snapPoint[1] *= aspy;
@@ -1311,8 +1309,7 @@ static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], Gea
/* evil hack - snapping needs to be adapted for image aspect ratio */
if((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
- // TRANSFORM_FIX_ME
- //transform_aspect_ratio_tface_uv(asp, asp+1);
+ ED_space_image_uv_aspect(t->sa->spacedata.first, asp, asp+1);
}
for (i=0; i<=max_index; i++) {
diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c
index 84ecf8e2d38..b593c99e5f4 100644
--- a/source/blender/editors/util/editmode_undo.c
+++ b/source/blender/editors/util/editmode_undo.c
@@ -334,7 +334,7 @@ static void do_editmode_undohistorymenu(bContext *C, void *arg, int event)
}
-uiBlock *editmode_undohistorymenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+uiBlock *editmode_undohistorymenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
UndoElem *uel;
@@ -343,7 +343,7 @@ uiBlock *editmode_undohistorymenu(bContext *C, uiMenuBlockHandle *handle, void *
undo_clean_stack(C); // removes other objects from it
- block= uiBeginBlock(C, handle->region, "view3d_edit_mesh_undohistorymenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_mesh_undohistorymenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_editmode_undohistorymenu, NULL);
for(uel= undobase.first; uel; uel= uel->next, item++) {
diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h
index ea188848e1e..eb58562239e 100644
--- a/source/blender/editors/uvedit/uvedit_intern.h
+++ b/source/blender/editors/uvedit/uvedit_intern.h
@@ -44,10 +44,6 @@ struct wmOperatorType;
#define TF_PIN_MASK(id) (TF_PIN1 << id)
#define TF_SEL_MASK(id) (TF_SEL1 << id)
-/* state testing */
-int uvedit_test(struct Object *obedit);
-int uvedit_test_silent(struct Object *obedit);
-
/* visibility and selection */
int uvedit_face_visible_nolocal(struct Scene *scene, struct EditFace *efa);
int uvedit_face_visible(struct Scene *scene, struct Image *ima, struct EditFace *efa, struct MTFace *tf);
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 38e959aeff7..24b664daa13 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -56,6 +56,8 @@
#include "IMB_imbuf_types.h" // XXX remove?
+#include "BIF_transform.h"
+
#include "ED_mesh.h"
#include "ED_screen.h"
@@ -77,7 +79,7 @@ void uvface_setsel__internal(bContext *C, SpaceImage *sima, Scene *scene, Object
/************************* state testing ************************/
-int uvedit_test_silent(Object *obedit)
+int ED_uvedit_test_silent(Object *obedit)
{
if(obedit->type != OB_MESH)
return 0;
@@ -85,12 +87,12 @@ int uvedit_test_silent(Object *obedit)
return EM_texFaceCheck(((Mesh*)obedit->data)->edit_mesh);
}
-int uvedit_test(Object *obedit)
+int ED_uvedit_test(Object *obedit)
{
// XXX if(!obedit)
// XXX error("Enter Edit Mode to perform this action");
- return uvedit_test_silent(obedit);
+ return ED_uvedit_test_silent(obedit);
}
/************************* assign image ************************/
@@ -160,7 +162,7 @@ void ED_uvedit_set_tile(Scene *scene, Object *obedit, Image *ima, int curtile, i
MTFace *tf;
/* verify if we have something to do */
- if(!ima || !uvedit_test_silent(obedit))
+ if(!ima || !ED_uvedit_test_silent(obedit))
return;
/* skip assigning these procedural images... */
@@ -436,69 +438,6 @@ int uvedit_center(Scene *scene, Image *ima, Object *obedit, float *cent, int mod
return 0;
}
-/************************** constraints ****************************/
-
-void uvedit_constrain_square(Scene *scene, Image *ima, EditMesh *em)
-{
- EditFace *efa;
- MTFace *tf;
-
- /* if 1 vertex selected: doit (with the selected vertex) */
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->v4) {
- tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
- if(uvedit_face_visible(scene, ima, efa, tf)) {
- if(uvedit_uv_selected(scene, efa, tf, 0)) {
- if(tf->uv[1][0] == tf->uv[2][0] ) {
- tf->uv[1][1]= tf->uv[0][1];
- tf->uv[3][0]= tf->uv[0][0];
- }
- else {
- tf->uv[1][0]= tf->uv[0][0];
- tf->uv[3][1]= tf->uv[0][1];
- }
-
- }
-
- if(uvedit_uv_selected(scene, efa, tf, 1)) {
- if(tf->uv[2][1] == tf->uv[3][1] ) {
- tf->uv[2][0]= tf->uv[1][0];
- tf->uv[0][1]= tf->uv[1][1];
- }
- else {
- tf->uv[2][1]= tf->uv[1][1];
- tf->uv[0][0]= tf->uv[1][0];
- }
-
- }
-
- if(uvedit_uv_selected(scene, efa, tf, 2)) {
- if(tf->uv[3][0] == tf->uv[0][0] ) {
- tf->uv[3][1]= tf->uv[2][1];
- tf->uv[1][0]= tf->uv[2][0];
- }
- else {
- tf->uv[3][0]= tf->uv[2][0];
- tf->uv[1][1]= tf->uv[2][1];
- }
- }
-
- if(uvedit_uv_selected(scene, efa, tf, 3)) {
- if(tf->uv[0][1] == tf->uv[1][1] ) {
- tf->uv[0][0]= tf->uv[3][0];
- tf->uv[2][1]= tf->uv[3][1];
- }
- else {
- tf->uv[0][1]= tf->uv[3][1];
- tf->uv[2][0]= tf->uv[3][0];
- }
- }
- }
- }
- }
-}
-
/************************** find nearest ****************************/
typedef struct NearestHit {
@@ -652,6 +591,41 @@ static void find_nearest_uv_vert(Scene *scene, Image *ima, EditMesh *em, float c
}
}
+int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, float co[2], float uv[2])
+{
+ EditMesh *em= ((Mesh*)obedit->data)->edit_mesh;
+ EditFace *efa;
+ MTFace *tf;
+ float mindist, dist;
+ int i, nverts, found= 0;
+
+ mindist= 1e10f;
+ uv[0]= co[0];
+ uv[1]= co[1];
+
+ for(efa= em->faces.first; efa; efa= efa->next) {
+ tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+
+ if(uvedit_face_visible(scene, ima, efa, tf)) {
+ nverts= efa->v4? 4: 3;
+
+ for(i=0; i<nverts; i++) {
+ dist= fabs(co[0]-tf->uv[i][0]) + fabs(co[1]-tf->uv[i][1]);
+
+ if(dist<=mindist) {
+ mindist= dist;
+
+ uv[0]= tf->uv[i][0];
+ uv[1]= tf->uv[i][1];
+ found= 1;
+ }
+ }
+ }
+ }
+
+ return found;
+}
+
/*********************** loop select ***********************/
static void uv_vertex_loop_flag(UvMapVert *first)
@@ -1323,9 +1297,6 @@ static int stitch_exec(bContext *C, wmOperator *op)
MEM_freeN(uv_average);
}
- // XXX if(sima->flag & SI_BE_SQUARE)
- // XXX uvedit_constrain_square(scene, sima->image, em);
-
DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); // XXX
@@ -1747,7 +1718,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
- return OPERATOR_FINISHED;
+ return OPERATOR_PASS_THROUGH|OPERATOR_FINISHED;
}
static int select_exec(bContext *C, wmOperator *op)
@@ -1947,7 +1918,7 @@ void borderselect_sima(bContext *C, SpaceImage *sima, Scene *scene, Image *ima,
int val, ok = 1;
short mval[2], select;
- if(!uvedit_test(obedit)) return;
+ if(!ED_uvedit_test(obedit)) return;
val= 0; // XXX get_border(&rect, 3);
select = 0; // XXX (val==LEFTMOUSE) ? 1 : 0;
@@ -2236,7 +2207,7 @@ void snap_uv_curs_to_pixels(SpaceImage *sima, View2D *v2d)
int snap_uv_curs_to_sel(Scene *scene, Image *ima, Object *obedit, View2D *v2d)
{
- if(!uvedit_test(obedit)) return 0;
+ if(!ED_uvedit_test(obedit)) return 0;
return uvedit_center(scene, ima, obedit, v2d->cursor, 0);
}
@@ -2244,7 +2215,7 @@ void snap_menu_sima(SpaceImage *sima, Scene *scene, Object *obedit, View2D *v2d)
{
short event;
- if(!uvedit_test(obedit) || !v2d) return; /* !G.v2d should never happen */
+ if(!ED_uvedit_test(obedit) || !v2d) return; /* !G.v2d should never happen */
event = 0; // XXX pupmenu("Snap %t|Selection -> Pixels%x1|Selection -> Cursor%x2|Selection -> Adjacent Unselected%x3|Cursor -> Selection%x4|Cursor -> Pixel%x5");
switch (event) {
@@ -2515,7 +2486,7 @@ void pin_tface_uv(Scene *scene, Image *ima, Object *obedit, int mode)
EditFace *efa;
MTFace *tface;
- if(!uvedit_test(obedit)) return;
+ if(!ED_uvedit_test(obedit)) return;
for(efa= em->faces.first; efa; efa= efa->next) {
tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
@@ -2547,7 +2518,7 @@ void select_pinned_tface_uv(Scene *scene, Image *ima, Object *obedit)
EditFace *efa;
MTFace *tface;
- if(!uvedit_test(obedit)) return;
+ if(!ED_uvedit_test(obedit)) return;
for(efa= em->faces.first; efa; efa= efa->next) {
tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
@@ -2597,11 +2568,16 @@ void ED_keymap_uvedit(wmWindowManager *wm)
// XXX not working?
RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, KM_ALT)->ptr, "extend", 1);
+ /* generates event, needs to be after select to work */
+ WM_keymap_add_item(keymap, "WM_OT_tweak_gesture", SELECTMOUSE, KM_PRESS, 0, 0);
+
WM_keymap_add_item(keymap, "UV_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "UV_OT_unlink_selection", LKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "UV_OT_de_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "UV_OT_select_invert", IKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "UV_OT_stitch", VKEY, KM_PRESS, 0, 0);
+
+ transform_keymap_for_space(wm, keymap, SPACE_IMAGE);
}
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 0fe907677f3..de5838823d1 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -53,6 +53,7 @@
#include "PIL_time.h"
#include "ED_mesh.h"
+#include "ED_uvedit.h"
#include "uvedit_intern.h"
#include "uvedit_parametrizer.h"
@@ -166,12 +167,12 @@ void unwrap_lscm(Scene *scene, Object *obedit, short seamcut)
short fillholes = scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES;
/* add uvs if there not here */
- if (!uvedit_test(obedit)) {
+ if (!ED_uvedit_test(obedit)) {
#if 0
if (em && em->faces.first)
EM_add_data_layer(&em->fdata, CD_MTFACE);
- if (!uvedit_test(obedit))
+ if (!ED_uvedit_test(obedit))
return;
if (G.sima && G.sima->image) /* this is a bit of a kludge, but assume they want the image on their mesh when UVs are added */
@@ -219,7 +220,7 @@ void minimize_stretch_tface_uv(Scene *scene, Object *obedit)
unsigned short event = 0;
short fillholes = scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES;
- if(!uvedit_test(obedit)) return;
+ if(!ED_uvedit_test(obedit)) return;
handle = construct_param_handle(scene, em, 1, fillholes, 1);
@@ -309,7 +310,7 @@ void pack_charts_tface_uv(Scene *scene, Object *obedit)
EditMesh *em= ((Mesh*)obedit->data)->edit_mesh;
ParamHandle *handle;
- if(!uvedit_test(obedit)) return;
+ if(!ED_uvedit_test(obedit)) return;
handle = construct_param_handle(scene, em, 1, 0, 1);
param_pack(handle);
@@ -330,7 +331,7 @@ void average_charts_tface_uv(Scene *scene, Object *obedit)
EditMesh *em= ((Mesh*)obedit->data)->edit_mesh;
ParamHandle *handle;
- if(!uvedit_test(obedit)) return;
+ if(!ED_uvedit_test(obedit)) return;
handle = construct_param_handle(scene, em, 1, 0, 1);
param_average(handle);
@@ -349,20 +350,20 @@ void average_charts_tface_uv(Scene *scene, Object *obedit)
static ParamHandle *liveHandle = NULL;
-void unwrap_lscm_live_begin(Scene *scene, Object *obedit)
+void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit)
{
EditMesh *em= ((Mesh*)obedit->data)->edit_mesh;
short abf = scene->toolsettings->unwrapper == 1;
short fillholes = scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES;
- if(!uvedit_test(obedit)) return;
+ if(!ED_uvedit_test(obedit)) return;
liveHandle = construct_param_handle(scene, em, 0, fillholes, 1);
param_lscm_begin(liveHandle, PARAM_TRUE, abf);
}
-void unwrap_lscm_live_re_solve(void)
+void ED_uvedit_live_unwrap_re_solve(void)
{
if (liveHandle) {
param_lscm_solve(liveHandle);
@@ -370,7 +371,7 @@ void unwrap_lscm_live_re_solve(void)
}
}
-void unwrap_lscm_live_end(short cancel)
+void ED_uvedit_live_unwrap_end(short cancel)
{
if (liveHandle) {
param_lscm_end(liveHandle);
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index b7788a1b92a..ef00935c212 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -261,7 +261,7 @@ typedef struct bAction {
/* Flags for the action */
typedef enum eAction_Flags {
/* flags for displaying in UI */
- ACT_EXPANDED = (1<<0),
+ ACT_COLLAPSED = (1<<0),
ACT_SELECTED = (1<<1),
/* flags for evaluation/editing */
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index e89e91c90eb..a6e3e5f4afb 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -496,6 +496,9 @@ enum {
ADT_NLA_EVAL_OFF = (1<<1),
/* don't execute drivers */
ADT_DRIVERS_DISABLED = (1<<2),
+
+ /* drivers expanded in UI */
+ ADT_DRIVERS_COLLAPSED = (1<<10),
} eAnimData_Flag;
/* Animation Data recalculation settings (to be set by depsgraph) */
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index 992b8907ba7..6a88e76deca 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -237,8 +237,26 @@ typedef struct Curve {
#define CU_BSPLINE 2
#define CU_CARDINAL 3
#define CU_NURBS 4
+#define CU_TYPE 7
+
#define CU_2D 8
+ /* only for adding */
+#define CU_PRIMITIVE 0xF00
+
+ /* 2 or 4 points */
+#define CU_PRIM_CURVE 0x100
+ /* 8 points circle */
+#define CU_PRIM_CIRCLE 0x200
+ /* 4x4 patch Nurb */
+#define CU_PRIM_PATCH 0x300
+#define CU_PRIM_TUBE 0x400
+#define CU_PRIM_SPHERE 0x500
+#define CU_PRIM_DONUT 0x600
+ /* 5 points, 5th order straight line (for anim path) */
+#define CU_PRIM_PATH 0x700
+
+
/* flagu flagv (nurb) */
#define CU_CYCLIC 1
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 852842465c2..b10de02dbb4 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -125,6 +125,7 @@ typedef struct bNode {
float custom3, custom4;
short need_exec, exec; /* need_exec is set as UI execution event, exec is flag during exec */
+ void *threaddata; /* optional extra storage for use in thread (read only then!) */
rctf totr; /* entire boundbox */
rctf butr; /* optional buttons area */
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index dffea96ce41..e45be7972ef 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -357,7 +357,6 @@ typedef struct SpaceNode {
} SpaceNode;
/* snode->flag */
-#define SNODE_DO_PREVIEW 1
#define SNODE_BACKDRAW 2
#define SNODE_DISPGP 4
diff --git a/source/blender/makesdna/DNA_view2d_types.h b/source/blender/makesdna/DNA_view2d_types.h
index c4148e80a95..ac628ca2266 100644
--- a/source/blender/makesdna/DNA_view2d_types.h
+++ b/source/blender/makesdna/DNA_view2d_types.h
@@ -114,6 +114,9 @@ typedef struct View2D {
#define V2D_SCROLL_SCALE_VERTICAL (1<<5)
/* scale markings - horizontal */
#define V2D_SCROLL_SCALE_HORIZONTAL (1<<6)
+ /* disable draw temporary */
+#define V2D_SCROLL_VERTICAL_HIDE (1<<7)
+#define V2D_SCROLL_HORIZONTAL_HIDE (1<<8)
/* alignment flags for totrect, flags use 'shading-out' convention (v2d->align) */
/* all quadrants free */
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index b4bf6db542f..5aeaf5d2743 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -94,6 +94,9 @@ typedef struct wmWindow {
short monitor; /* multiscreen... no idea how to store yet */
short active; /* set to 1 if an active window, for quick rejects */
short cursor; /* current mouse cursor type */
+ short lastcursor; /* for temp waitcursor */
+ short pad2;
+ int pad3;
struct wmEvent *eventstate; /* storage for event system */
diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript
index 661f9b91a34..330153f0a7f 100644
--- a/source/blender/makesrna/intern/SConscript
+++ b/source/blender/makesrna/intern/SConscript
@@ -32,9 +32,15 @@ makesrna_tool.Append (CPPPATH = ['#/intern/guardedalloc',
'../../windowmanager'])
if env['OURPLATFORM'] == 'linuxcross':
- makesrna_tool.Replace(CC='gcc')
- makesrna_tool.Replace(AR='ar')
- makesrna_tool.Replace(LINK='gcc')
+ USE_WINE = True # when cross compiling on linux 64bit this is useful
+else:
+ USE_WINE = False
+
+if not USE_WINE:
+ if env['OURPLATFORM'] == 'linuxcross':
+ makesdna_tool.Replace(CC='gcc')
+ makesdna_tool.Replace(AR='ar')
+ makesdna_tool.Replace(LINK='gcc')
if sys.platform != 'cygwin':
makesrna_tool.Append (CCFLAGS = cflags)
@@ -74,6 +80,12 @@ if env['OURPLATFORM'] != 'linuxcross':
rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna " + build_dir)
else:
rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe " + build_dir)
+
+ if USE_WINE:
+ rna.Command (generated_files, '', 'wine ' + root_build_dir+os.sep+"makesrna.exe " + build_dir)
+ else:
+ rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe " + build_dir)
+
obj = ['intern/rna_access.c', 'intern/rna_dependency.c']
for generated_file in generated_files:
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 5e1f80d0a3c..7cb57053272 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -1209,18 +1209,17 @@ void RNA_def_constraint(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ACTIVE);
RNA_def_property_ui_text(prop, "Active", "Constraint is the one being edited ");
- prop= RNA_def_property(srna, "own_ipo", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_OWN_IPO);
- RNA_def_property_ui_text(prop, "Local IPO", "Constraint has its own IPO data.");
-
prop= RNA_def_property(srna, "proxy_local", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_PROXY_LOCAL);
RNA_def_property_ui_text(prop, "Proxy Local", "Constraint was added in this proxy instance (i.e. did not belong to source Armature).");
+ /* values */
+ prop= RNA_def_property(srna, "influence", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "enforce");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Influence", "Amount of influence constraint will have on the final solution.");
+
/* pointers */
- prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "IPO", "Local IPO data.");
-
rna_def_constrainttarget(brna);
rna_def_constraint_childof(brna);
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 2c366093e15..25542fd6d65 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -210,10 +210,6 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_PIXELSNAP);
RNA_def_property_ui_text(prop, "Snap to Pixels", "Snap UVs to pixel locations while editing.");
- prop= RNA_def_property(srna, "constrain_quads_rectangular", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_BE_SQUARE);
- RNA_def_property_ui_text(prop, "Constrain Quads Rectangular", "Constrain quads to be rectangular while editing.");
-
prop= RNA_def_property(srna, "constrain_to_image_bounds", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_CLIP_UV);
RNA_def_property_ui_text(prop, "Constrain to Image Bounds", "Constraint to stay within the image bounds while editing.");
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index 532b599f786..e2b4506f377 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -244,6 +244,7 @@ void RNA_def_texture(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem prop_type_items[] = {
+ {0, "NONE", "None", ""},
{TEX_CLOUDS, "CLOUDS", "Clouds", ""},
{TEX_WOOD, "WOOD", "Wood", ""},
{TEX_MARBLE, "MARBLE", "Marble", ""},
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index e1fee06d6f4..de78be51290 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -86,6 +86,12 @@ static void rna_userdef_autokeymode_set(struct PointerRNA *ptr,int value)
}
}
+static void *rna_UserDef_self_get(PointerRNA *ptr)
+{
+ return ptr->data;
+}
+
+
#else
static void rna_def_userdef_theme_ui(BlenderRNA *brna)
@@ -1029,9 +1035,10 @@ static void rna_def_userdef_solidlight(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Specular Color", "The color of the lights specular highlight.");
}
-static void rna_def_userdef_view(StructRNA *srna)
+static void rna_def_userdef_view(BlenderRNA *brna)
{
PropertyRNA *prop;
+ StructRNA *srna;
static EnumPropertyItem view_zoom_styles[] = {
{USER_ZOOM_CONT, "CONTINUE", "Continue", "Old style zoom, continues while moving mouse up or down."},
@@ -1045,6 +1052,11 @@ static void rna_def_userdef_view(StructRNA *srna)
{0, NULL, NULL, NULL}};
+ srna= RNA_def_struct(brna, "UserPreferencesView", NULL);
+ RNA_def_struct_sdna(srna, "UserDef");
+ RNA_def_struct_nested(brna, srna, "UserPreferences");
+ RNA_def_struct_ui_text(srna, "View & Controls", "Preferences related to viewing data");
+
/* View and Controls */
/* display */
@@ -1062,7 +1074,7 @@ static void rna_def_userdef_view(StructRNA *srna)
prop= RNA_def_property(srna, "use_large_cursors", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "curssize", 0);
- RNA_def_property_ui_text(prop, "Use Large Cursors", "Use large mouse cursors when available.");
+ RNA_def_property_ui_text(prop, "Large Cursors", "Use large mouse cursors when available.");
prop= RNA_def_property(srna, "show_view_name", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_VIEWPORTNAME);
@@ -1104,7 +1116,7 @@ static void rna_def_userdef_view(StructRNA *srna)
prop= RNA_def_property(srna, "use_column_layout", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_PLAINMENUS);
- RNA_def_property_ui_text(prop, "Use Column Layout", "Use a column layout for toolbox and do not flip the contents of any menu.");
+ RNA_def_property_ui_text(prop, "Toolbox Column Layout", "Use a column layout for toolbox and do not flip the contents of any menu.");
/* snap to grid */
prop= RNA_def_property(srna, "snap_translate", PROP_BOOLEAN, PROP_NONE);
@@ -1121,11 +1133,11 @@ static void rna_def_userdef_view(StructRNA *srna)
prop= RNA_def_property(srna, "auto_depth", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ORBIT_ZBUF);
- RNA_def_property_ui_text(prop, "Use Auto Depth", "Use the depth under the mouse to improve view pan/rotate/zoom functionality.");
+ RNA_def_property_ui_text(prop, "Auto Depth", "Use the depth under the mouse to improve view pan/rotate/zoom functionality.");
prop= RNA_def_property(srna, "global_pivot", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_LOCKAROUND);
- RNA_def_property_ui_text(prop, "Use Global Pivot", "Lock the same rotation/scaling pivot in all 3D Views.");
+ RNA_def_property_ui_text(prop, "Global Pivot", "Lock the same rotation/scaling pivot in all 3D Views.");
/* view zoom */
prop= RNA_def_property(srna, "viewport_zoom_style", PROP_ENUM, PROP_NONE);
@@ -1169,7 +1181,7 @@ static void rna_def_userdef_view(StructRNA *srna)
prop= RNA_def_property(srna, "use_middle_mouse_paste", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_MMB_PASTE);
- RNA_def_property_ui_text(prop, "Use Middle Mouse Paste", "In text window, paste with middle mouse button instead of panning.");
+ RNA_def_property_ui_text(prop, "Middle Mouse Paste", "In text window, paste with middle mouse button instead of panning.");
prop= RNA_def_property(srna, "show_mini_axis", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_ROTVIEWICON);
@@ -1188,11 +1200,11 @@ static void rna_def_userdef_view(StructRNA *srna)
/* middle mouse button */
prop= RNA_def_property(srna, "middle_mouse_rotate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_VIEWMOVE);
- RNA_def_property_ui_text(prop, "Use Middle Mouse Rotate", "Use the middle mouse button for rotation the viewport.");
+ RNA_def_property_ui_text(prop, "Middle Mouse Rotate", "Use the middle mouse button for rotation the viewport.");
prop= RNA_def_property(srna, "middle_mouse_pan", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_VIEWMOVE);
- RNA_def_property_ui_text(prop, "Use Middle Mouse Pan", "Use the middle mouse button for panning the viewport.");
+ RNA_def_property_ui_text(prop, "Middle Mouse Pan", "Use the middle mouse button for panning the viewport.");
prop= RNA_def_property(srna, "wheel_invert_zoom", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_WHEELZOOMDIR);
@@ -1214,24 +1226,24 @@ static void rna_def_userdef_view(StructRNA *srna)
RNA_def_property_ui_text(prop, "Rotation Angle", "The rotation step for numerical pad keys (2 4 6 8).");
/* 3D transform widget */
- prop= RNA_def_property(srna, "use_transform_widget", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_manipulator", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tw_flag", 1);
- RNA_def_property_ui_text(prop, "Use Transform Widget", "Use 3d transform manipulator.");
+ RNA_def_property_ui_text(prop, "Manipulator", "Use 3d transform manipulator.");
- prop= RNA_def_property(srna, "transform_widget_size", PROP_INT, PROP_NONE);
+ prop= RNA_def_property(srna, "manipulator_size", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "tw_size");
RNA_def_property_range(prop, 2, 40);
- RNA_def_property_ui_text(prop, "Transform Widget Size", "Diameter of widget, in 10 pixel units.");
+ RNA_def_property_ui_text(prop, "Manipulator Size", "Diameter of widget, in 10 pixel units.");
- prop= RNA_def_property(srna, "transform_widget_handle_size", PROP_INT, PROP_NONE);
+ prop= RNA_def_property(srna, "manipulator_handle_size", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "tw_handlesize");
RNA_def_property_range(prop, 2, 40);
- RNA_def_property_ui_text(prop, "Transform Widget Handle Size", "Size of widget handles as percentage of widget radius.");
+ RNA_def_property_ui_text(prop, "Manipulator Handle Size", "Size of widget handles as percentage of widget radius.");
- prop= RNA_def_property(srna, "transform_widget_hotspot", PROP_INT, PROP_NONE);
+ prop= RNA_def_property(srna, "manipulator_hotspot", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "tw_hotspot");
RNA_def_property_range(prop, 4, 40);
- RNA_def_property_ui_text(prop, "Transform Widget Hotspot", "Hotspot in pixels for clicking widget handles.");
+ RNA_def_property_ui_text(prop, "Manipulator Hotspot", "Hotspot in pixels for clicking widget handles.");
prop= RNA_def_property(srna, "object_center_size", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "obcenter_dia");
@@ -1249,9 +1261,10 @@ static void rna_def_userdef_view(StructRNA *srna)
RNA_def_property_ui_text(prop, "NDof Rotation Speed", "The overall rotation speed of an NDOF device, as percent of standard.");
}
-static void rna_def_userdef_edit(StructRNA *srna)
+static void rna_def_userdef_edit(BlenderRNA *brna)
{
PropertyRNA *prop;
+ StructRNA *srna;
static EnumPropertyItem auto_key_modes[] = {
{AUTOKEY_MODE_NORMAL, "ADD_REPLACE_KEYS", "Add/Replace Keys", ""},
@@ -1264,6 +1277,11 @@ static void rna_def_userdef_edit(StructRNA *srna)
{IPO_BEZ, "BEZIER", "Bezier", ""},
{0, NULL, NULL, NULL}};
+ srna= RNA_def_struct(brna, "UserPreferencesEdit", NULL);
+ RNA_def_struct_sdna(srna, "UserDef");
+ RNA_def_struct_nested(brna, srna, "UserPreferences");
+ RNA_def_struct_ui_text(srna, "Edit Methods", "Settings for interacting with Blender data.");
+
/* Edit Methods */
prop= RNA_def_property(srna, "material_linked_object", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_MAT_ON_OB);
@@ -1318,7 +1336,7 @@ static void rna_def_userdef_edit(StructRNA *srna)
prop= RNA_def_property(srna, "use_visual_keying", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_AUTOMATKEY);
- RNA_def_property_ui_text(prop, "Use Visual Keying", "Use Visual keying automatically for constrained objects.");
+ RNA_def_property_ui_text(prop, "Visual Keying", "Use Visual keying automatically for constrained objects.");
prop= RNA_def_property(srna, "new_interpolation_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, new_ipo_curve_types);
@@ -1395,10 +1413,11 @@ static void rna_def_userdef_edit(StructRNA *srna)
RNA_def_property_ui_text(prop, "Duplicate Action", "Causes actions to be duplicated with Shift+D.");
}
-static void rna_def_userdef_language(StructRNA *srna)
+static void rna_def_userdef_language(BlenderRNA *brna)
{
PropertyRNA *prop;
-
+ StructRNA *srna;
+
/* hardcoded here, could become dynamic somehow */
static EnumPropertyItem language_items[] = {
{0, "ENGLISH", "English", ""},
@@ -1425,7 +1444,12 @@ static void rna_def_userdef_language(StructRNA *srna)
{21, "GREEK", "Greek", ""},
{22, "KOREAN", "Korean", ""},
{0, NULL, NULL, NULL}};
-
+
+ srna= RNA_def_struct(brna, "UserPreferencesLanguage", NULL);
+ RNA_def_struct_sdna(srna, "UserDef");
+ RNA_def_struct_nested(brna, srna, "UserPreferences");
+ RNA_def_struct_ui_text(srna, "Language & Font", "User interface translation settings.");
+
prop= RNA_def_property(srna, "international_fonts", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_DOTRANSLATE);
RNA_def_property_ui_text(prop, "International Fonts", "Use international fonts.");
@@ -1459,15 +1483,21 @@ static void rna_def_userdef_language(StructRNA *srna)
prop= RNA_def_property(srna, "use_textured_fonts", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_USETEXTUREFONT);
- RNA_def_property_ui_text(prop, "Use Textured Fonts", "Use textures for drawing international fonts.");
+ RNA_def_property_ui_text(prop, "Textured Fonts", "Use textures for drawing international fonts.");
}
-static void rna_def_userdef_autosave(StructRNA *srna)
+static void rna_def_userdef_autosave(BlenderRNA *brna)
{
PropertyRNA *prop;
+ StructRNA *srna;
/* Autosave */
+ srna= RNA_def_struct(brna, "UserPreferencesAutosave", NULL);
+ RNA_def_struct_sdna(srna, "UserDef");
+ RNA_def_struct_nested(brna, srna, "UserPreferences");
+ RNA_def_struct_ui_text(srna, "Auto Save", "Automatic backup file settings.");
+
prop= RNA_def_property(srna, "save_version", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "versions");
RNA_def_property_range(prop, 0, 32);
@@ -1491,9 +1521,10 @@ static void rna_def_userdef_autosave(StructRNA *srna)
RNA_def_property_ui_text(prop, "Save Preview Images", "Enables automatic saving of preview images in the .blend file.");
}
-static void rna_def_userdef_system(StructRNA *srna)
+static void rna_def_userdef_system(BlenderRNA *brna)
{
PropertyRNA *prop;
+ StructRNA *srna;
static EnumPropertyItem gl_texture_clamp_items[] = {
{0, "GL_CLAMP_OFF", "GL Texture Clamp Off", ""},
@@ -1519,6 +1550,11 @@ static void rna_def_userdef_system(StructRNA *srna)
{USER_DRAW_FULL, "FULL", "Full", "Do a full redraw each time, slow, only use for reference or when all else fails."},
{0, NULL, NULL, NULL}};
+ srna= RNA_def_struct(brna, "UserPreferencesSystem", NULL);
+ RNA_def_struct_sdna(srna, "UserDef");
+ RNA_def_struct_nested(brna, srna, "UserPreferences");
+ RNA_def_struct_ui_text(srna, "System & OpenGL", "Graphics driver and operating system settings.");
+
/* System & OpenGL */
prop= RNA_def_property(srna, "solid_lights", PROP_COLLECTION, PROP_NONE);
@@ -1581,7 +1617,7 @@ static void rna_def_userdef_system(StructRNA *srna)
prop= RNA_def_property(srna, "use_mipmaps", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_MIPMAP);
- RNA_def_property_ui_text(prop, "Use Mipmaps", "Scale textures for the 3d View (looks nicer but uses more memory and slows image reloading.)");
+ RNA_def_property_ui_text(prop, "Mipmaps", "Scale textures for the 3d View (looks nicer but uses more memory and slows image reloading.)");
prop= RNA_def_property(srna, "gl_texture_limit", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "glreslimit");
@@ -1619,13 +1655,19 @@ static void rna_def_userdef_system(StructRNA *srna)
#endif
}
-static void rna_def_userdef_filepaths(StructRNA *srna)
+static void rna_def_userdef_filepaths(BlenderRNA *brna)
{
PropertyRNA *prop;
+ StructRNA *srna;
+
+ srna= RNA_def_struct(brna, "UserPreferencesFilePaths", NULL);
+ RNA_def_struct_sdna(srna, "UserDef");
+ RNA_def_struct_nested(brna, srna, "UserPreferences");
+ RNA_def_struct_ui_text(srna, "File Paths", "Default paths for external files.");
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, "Use Relative Paths", "Default relative path option for the file selector.");
+ RNA_def_property_ui_text(prop, "Relative Paths", "Default relative path option for the file selector.");
prop= RNA_def_property(srna, "compress_file", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_FILECOMPRESS);
@@ -1700,12 +1742,49 @@ void RNA_def_userdef(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "Theme");
RNA_def_property_ui_text(prop, "Themes", "");
- rna_def_userdef_view(srna);
- rna_def_userdef_edit(srna);
- rna_def_userdef_language(srna);
- rna_def_userdef_autosave(srna);
- rna_def_userdef_system(srna);
- rna_def_userdef_filepaths(srna);
+ /* nested structs */
+ prop= RNA_def_property(srna, "userpreferences_view", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "UserPreferencesView");
+ RNA_def_property_pointer_funcs(prop, "rna_UserDef_self_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "View & Controls", "Preferences related to viewing data.");
+
+ prop= RNA_def_property(srna, "userpreferences_edit", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "UserPreferencesEdit");
+ RNA_def_property_pointer_funcs(prop, "rna_UserDef_self_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Edit Methods", "Settings for interacting with Blender data.");
+
+ prop= RNA_def_property(srna, "userpreferences_autosave", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "UserPreferencesAutosave");
+ RNA_def_property_pointer_funcs(prop, "rna_UserDef_self_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Auto Save", "Automatic backup file settings.");
+
+ prop= RNA_def_property(srna, "userpreferences_language", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "UserPreferencesLanguage");
+ RNA_def_property_pointer_funcs(prop, "rna_UserDef_self_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Language & Font", "User interface translation settings.");
+
+ prop= RNA_def_property(srna, "userpreferences_filepaths", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "UserPreferencesFilePaths");
+ RNA_def_property_pointer_funcs(prop, "rna_UserDef_self_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "File Paths", "Default paths for external files.");
+
+ prop= RNA_def_property(srna, "userpreferences_system", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "UserPreferencesSystem");
+ RNA_def_property_pointer_funcs(prop, "rna_UserDef_self_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "System & OpenGL", "Graphics driver and operating system settings.");
+
+ rna_def_userdef_view(brna);
+ rna_def_userdef_edit(brna);
+ rna_def_userdef_autosave(brna);
+ rna_def_userdef_language(brna);
+ rna_def_userdef_filepaths(brna);
+ rna_def_userdef_system(brna);
+
+
+
+
+
+
}
#endif
diff --git a/source/blender/python/intern/bpy_compat.h b/source/blender/python/intern/bpy_compat.h
index bc201a3e802..ef363e397fa 100644
--- a/source/blender/python/intern/bpy_compat.h
+++ b/source/blender/python/intern/bpy_compat.h
@@ -74,4 +74,11 @@
#endif
#endif
+
+/* defined in bpy_util.c */
+#if PY_VERSION_HEX < 0x03000000
+PyObject *Py_CmpToRich(int op, int cmp);
+#endif
+
+
#endif /* BPY_COMPAT_H__ */
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index fb1040fac18..72f4d7fb11e 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -278,7 +278,7 @@ PyObject *pyop_base_dir(PyObject *self)
/*-----------------------BPy_OperatorBase method def------------------------------*/
PyTypeObject pyop_base_Type = {
#if (PY_VERSION_HEX >= 0x02060000)
- PyVarObject_HEAD_INIT(&PyType_Type, 0)
+ PyVarObject_HEAD_INIT(NULL, 0)
#else
/* python 2.5 and below */
PyObject_HEAD_INIT( NULL ) /* required py macro */
@@ -364,7 +364,7 @@ PyTypeObject pyop_base_Type = {
/*-----------------------BPy_OperatorBase method def------------------------------*/
PyTypeObject pyop_func_Type = {
#if (PY_VERSION_HEX >= 0x02060000)
- PyVarObject_HEAD_INIT(&PyType_Type, 0)
+ PyVarObject_HEAD_INIT(NULL, 0)
#else
/* python 2.5 and below */
PyObject_HEAD_INIT( NULL ) /* required py macro */
diff --git a/source/blender/python/intern/bpy_operator.h b/source/blender/python/intern/bpy_operator.h
index 19c503c1e8c..5cc3ba64e0e 100644
--- a/source/blender/python/intern/bpy_operator.h
+++ b/source/blender/python/intern/bpy_operator.h
@@ -36,12 +36,12 @@ extern PyTypeObject pyop_base_Type;
extern PyTypeObject pyop_func_Type;
typedef struct {
- PyObject_VAR_HEAD /* required python macro */
+ PyObject_HEAD /* required python macro */
bContext *C;
} BPy_OperatorBase;
typedef struct {
- PyObject_VAR_HEAD /* required python macro */
+ PyObject_HEAD /* required python macro */
char name[OP_MAX_TYPENAME];
bContext *C;
} BPy_OperatorFunc;
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 5ecab0ddbb5..4156db21507 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -34,7 +34,7 @@
#define MAXFLOAT_DOC 10000000
static int pyrna_struct_compare( BPy_StructRNA * a, BPy_StructRNA * b )
-{
+{
return (a->ptr.data==b->ptr.data) ? 0 : -1;
}
@@ -43,6 +43,28 @@ static int pyrna_prop_compare( BPy_PropertyRNA * a, BPy_PropertyRNA * b )
return (a->prop==b->prop && a->ptr.data==b->ptr.data ) ? 0 : -1;
}
+
+/* For some reason python3 needs these :/ */
+static PyObject *pyrna_struct_richcmp(BPy_StructRNA * a, BPy_StructRNA * b, int op)
+{
+ int cmp_result= -1; /* assume false */
+ if (BPy_StructRNA_Check(a) && BPy_StructRNA_Check(b)) {
+ cmp_result= pyrna_struct_compare(a, b);
+ }
+
+ return Py_CmpToRich(op, cmp_result);
+}
+
+static PyObject *pyrna_prop_richcmp(BPy_PropertyRNA * a, BPy_PropertyRNA * b, int op)
+{
+ int cmp_result= -1; /* assume false */
+ if (BPy_PropertyRNA_Check(a) && BPy_PropertyRNA_Check(b)) {
+ cmp_result= pyrna_prop_compare(a, b);
+ }
+
+ return Py_CmpToRich(op, cmp_result);
+}
+
/*----------------------repr--------------------------------------------*/
static PyObject *pyrna_struct_repr( BPy_StructRNA * self )
{
@@ -954,7 +976,7 @@ static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *k
/*-----------------------BPy_StructRNA method def------------------------------*/
PyTypeObject pyrna_struct_Type = {
#if (PY_VERSION_HEX >= 0x02060000)
- PyVarObject_HEAD_INIT(&PyType_Type, 0)
+ PyVarObject_HEAD_INIT(NULL, 0)
#else
/* python 2.5 and below */
PyObject_HEAD_INIT( NULL ) /* required py macro */
@@ -1001,7 +1023,7 @@ PyTypeObject pyrna_struct_Type = {
/*** Assigned meaning in release 2.1 ***/
/*** rich comparisons ***/
- NULL, /* richcmpfunc tp_richcompare; */
+ (richcmpfunc)pyrna_struct_richcmp, /* richcmpfunc tp_richcompare; */
/*** weak reference enabler ***/
0, /* long tp_weaklistoffset; */
@@ -1039,7 +1061,7 @@ PyTypeObject pyrna_struct_Type = {
/*-----------------------BPy_PropertyRNA method def------------------------------*/
PyTypeObject pyrna_prop_Type = {
#if (PY_VERSION_HEX >= 0x02060000)
- PyVarObject_HEAD_INIT(&PyType_Type, 0)
+ PyVarObject_HEAD_INIT(NULL, 0)
#else
/* python 2.5 and below */
PyObject_HEAD_INIT( NULL ) /* required py macro */
@@ -1087,7 +1109,7 @@ PyTypeObject pyrna_prop_Type = {
/*** Assigned meaning in release 2.1 ***/
/*** rich comparisons ***/
- NULL, /* richcmpfunc tp_richcompare; */
+ (richcmpfunc)pyrna_prop_richcmp, /* richcmpfunc tp_richcompare; */
/*** weak reference enabler ***/
0, /* long tp_weaklistoffset; */
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h
index 73272eac6e8..fc16ad6ea9a 100644
--- a/source/blender/python/intern/bpy_rna.h
+++ b/source/blender/python/intern/bpy_rna.h
@@ -33,14 +33,17 @@
extern PyTypeObject pyrna_struct_Type;
extern PyTypeObject pyrna_prop_Type;
+#define BPy_StructRNA_Check(v) (PyObject_TypeCheck(v, &pyrna_struct_Type))
+#define BPy_PropertyRNA_Check(v) (PyObject_TypeCheck(v, &pyrna_prop_Type))
+
typedef struct {
- PyObject_VAR_HEAD /* required python macro */
+ PyObject_HEAD /* required python macro */
PointerRNA ptr;
int freeptr; /* needed in some cases if ptr.data is created on the fly, free when deallocing */
} BPy_StructRNA;
typedef struct {
- PyObject_VAR_HEAD /* required python macro */
+ PyObject_HEAD /* required python macro */
PointerRNA ptr;
PropertyRNA *prop;
} BPy_PropertyRNA;
diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c
index 28d97f9bdf5..bbf766c23eb 100644
--- a/source/blender/python/intern/bpy_util.c
+++ b/source/blender/python/intern/bpy_util.c
@@ -110,6 +110,46 @@ int BPY_flag_from_seq(BPY_flag_def *flagdef, PyObject *seq, int *flag)
return 0; /* ok */
}
+
+/* Copied from pythons 3's Object.c */
+#if PY_VERSION_HEX < 0x03000000
+PyObject *
+Py_CmpToRich(int op, int cmp)
+{
+ PyObject *res;
+ int ok;
+
+ if (PyErr_Occurred())
+ return NULL;
+ switch (op) {
+ case Py_LT:
+ ok = cmp < 0;
+ break;
+ case Py_LE:
+ ok = cmp <= 0;
+ break;
+ case Py_EQ:
+ ok = cmp == 0;
+ break;
+ case Py_NE:
+ ok = cmp != 0;
+ break;
+ case Py_GT:
+ ok = cmp > 0;
+ break;
+ case Py_GE:
+ ok = cmp >= 0;
+ break;
+ default:
+ PyErr_BadArgument();
+ return NULL;
+ }
+ res = ok ? Py_True : Py_False;
+ Py_INCREF(res);
+ return res;
+}
+#endif
+
/* for debugging */
void PyObSpit(char *name, PyObject *var) {
fprintf(stderr, "<%s> : ", name);
diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c
index 174a9db4398..c75de189b10 100644
--- a/source/blender/render/intern/source/occlusion.c
+++ b/source/blender/render/intern/source/occlusion.c
@@ -514,10 +514,6 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
OccFace *face;
int a, b, totthread=0, offset[TOTCHILD], count[TOTCHILD];
- /* keep track of maximum depth for stack */
- if(depth > tree->maxdepth)
- tree->maxdepth= depth;
-
/* add a new node */
node->occlusion= 1.0f;
@@ -552,6 +548,10 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
child= BLI_memarena_alloc(tree->arena, sizeof(OccNode));
node->child[b].node= child;
+ /* keep track of maximum depth for stack */
+ if(depth+1 > tree->maxdepth)
+ tree->maxdepth= depth+1;
+
if(tree->dothreadedbuild)
BLI_unlock_thread(LOCK_CUSTOM1);
@@ -679,6 +679,7 @@ static OcclusionTree *occ_tree_build(Render *re)
/* recurse */
tree->root= BLI_memarena_alloc(tree->arena, sizeof(OccNode));
+ tree->maxdepth= 1;
occ_build_recursive(tree, tree->root, 0, totface, 1);
#if 0
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index b381206cb8b..f9dd6a19fb7 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -38,6 +38,7 @@ SET(INC .
../../../intern/ghost ../../../intern/opennl/extern ../../../extern/glew/include
../nodes
../gpu
+ ../blenfont
${SDL_INC}
)
diff --git a/source/blender/windowmanager/SConscript b/source/blender/windowmanager/SConscript
index a160d13a64f..862235d7b4b 100644
--- a/source/blender/windowmanager/SConscript
+++ b/source/blender/windowmanager/SConscript
@@ -9,7 +9,7 @@ sources = env.Glob('intern/*.c')
incs = '. ../editors/include ../python ../makesdna ../blenlib ../blenkernel'
incs += ' ../nodes ../imbuf ../blenloader ../render/extern/include'
incs += ' ../ftfont ../radiosity/extern/include ../../kernel/gen_system'
-incs += ' ../makesrna ../gpu'
+incs += ' ../makesrna ../gpu ../blenfont'
incs += ' #/intern/guardedalloc #/intern/memutil #/intern/ghost #/intern/bmfont'
incs += ' #/intern/elbeem #/extern/glew/include'
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index c46263183a9..940fd762f10 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -64,7 +64,7 @@ void WM_write_autosave (struct bContext *C);
void WM_cursor_set (struct wmWindow *win, int curs);
void WM_cursor_modal (struct wmWindow *win, int curs);
void WM_cursor_restore (struct wmWindow *win);
-void WM_cursor_wait (struct wmWindow *win, int val);
+void WM_cursor_wait (int val);
void WM_timecursor (struct wmWindow *win, int nr);
void *WM_paint_cursor_activate(struct wmWindowManager *wm, int (*poll)(struct bContext *C), void (*draw)(struct bContext *C, int, int, void *customdata), void *customdata);
@@ -81,7 +81,7 @@ ListBase *WM_keymap_listbase (struct wmWindowManager *wm, const char *nameid,
int spaceid, int regionid);
char *WM_key_event_string(short type);
-char *WM_key_event_operator_string(const struct bContext *C, const char *opname, int opcontext, char *str, int len);
+char *WM_key_event_operator_string(const struct bContext *C, const char *opname, int opcontext, struct IDProperty *properties, char *str, int len);
/* handlers */
@@ -187,13 +187,17 @@ int WM_framebuffer_to_index(unsigned int col);
struct wmJob *WM_jobs_get(struct wmWindowManager *wm, struct wmWindow *win, void *owner);
+int WM_jobs_test(struct wmWindowManager *wm, void *owner);
+
void WM_jobs_customdata(struct wmJob *, void *customdata, void (*free)(void *));
-void WM_jobs_timer(struct wmJob *, double timestep, unsigned int note);
+void WM_jobs_timer(struct wmJob *, double timestep, unsigned int note, unsigned int endnote);
void WM_jobs_callbacks(struct wmJob *,
void (*startjob)(void *, short *, short *),
+ void (*initjob)(void *),
void (*update)(void *));
void WM_jobs_start(struct wmJob *);
+void WM_jobs_stop_all(struct wmWindowManager *wm);
#endif /* WM_API_H */
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index f0747e6dad0..a9c31261aca 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -140,18 +140,22 @@ typedef struct wmNotifier {
/* category */
#define NOTE_CATEGORY 0xFF000000
-#define NC_WINDOW (1<<24)
-#define NC_SCREEN (2<<24)
-#define NC_SCENE (3<<24)
-#define NC_OBJECT (4<<24)
-#define NC_MATERIAL (5<<24)
-#define NC_TEXTURE (6<<24)
-#define NC_LAMP (7<<24)
-#define NC_GROUP (8<<24)
+#define NC_WM (1<<24)
+#define NC_WINDOW (2<<24)
+#define NC_SCREEN (3<<24)
+#define NC_SCENE (4<<24)
+#define NC_OBJECT (5<<24)
+#define NC_MATERIAL (6<<24)
+#define NC_TEXTURE (7<<24)
+#define NC_LAMP (8<<24)
+#define NC_GROUP (9<<24)
/* data type, 256 entries is enough, it can overlap */
#define NOTE_DATA 0x00FF0000
+ /* windowmanager */
+#define ND_FILEREAD (1<<16)
+
/* Scene */
#define ND_MARKERS (2<<16)
#define ND_FRAME (3<<16)
@@ -161,6 +165,8 @@ typedef struct wmNotifier {
#define ND_OB_ACTIVE (7<<16)
#define ND_OB_SELECT (8<<16)
#define ND_MODE (9<<16)
+#define ND_RENDER_RESULT (10<<16)
+#define ND_COMPO_RESULT (11<<16)
/* Object */
#define ND_TRANSFORM (16<<16)
@@ -171,6 +177,7 @@ typedef struct wmNotifier {
#define ND_GEOM_SELECT (21<<16)
#define ND_DRAW (22<<16)
#define ND_MODIFIER (23<<16)
+#define ND_KEYS (24<<16)
/* Material */
#define ND_SHADING (30<<16)
diff --git a/source/blender/windowmanager/intern/Makefile b/source/blender/windowmanager/intern/Makefile
index b5b04b11be7..0bf161e3250 100644
--- a/source/blender/windowmanager/intern/Makefile
+++ b/source/blender/windowmanager/intern/Makefile
@@ -62,6 +62,7 @@ CPPFLAGS += -I../../render/extern/include
CPPFLAGS += -I../../ftfont
CPPFLAGS += -I../../radiosity/extern/include
CPPFLAGS += -I../../../kernel/gen_system
+CPPFLAGS += -I../../blenfont
# path to the guarded memory allocator
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index d264b096012..3aa177b1018 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -128,11 +128,13 @@ void wm_add_default(bContext *C)
{
wmWindowManager *wm= alloc_libblock(&CTX_data_main(C)->wm, ID_WM, "WinMan");
wmWindow *win;
+ bScreen *screen= CTX_wm_screen(C); /* XXX from file read hrmf */
CTX_wm_manager_set(C, wm);
-
win= wm_window_new(C);
- win->screen= CTX_wm_screen(C); /* XXX from window? */
+ win->screen= screen;
+ if(screen)
+ BLI_strncpy(win->screenname, screen->id.name+2, 21);
wm->winactive= win;
wm_window_make_drawable(C, win);
}
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index 3afc9cc884b..d1c268a1189 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -36,6 +36,8 @@
#include "DNA_userdef_types.h"
#include "BKE_context.h"
+#include "BKE_global.h"
+#include "BKE_main.h"
#include "WM_api.h"
#include "wm_cursors.h"
@@ -120,29 +122,32 @@ void WM_cursor_set(wmWindow *win, int curs)
}
}
-static int LastCursor=-1; /* global, assumed we only have one */
-
void WM_cursor_modal(wmWindow *win, int val)
{
- if(LastCursor == -1)
- LastCursor = win->cursor;
+ if(win->lastcursor == 0)
+ win->lastcursor = win->cursor;
WM_cursor_set(win, val);
}
void WM_cursor_restore(wmWindow *win)
{
- if(LastCursor != -1)
- WM_cursor_set(win, LastCursor);
- LastCursor = -1;
+ if(win->lastcursor)
+ WM_cursor_set(win, win->lastcursor);
+ win->lastcursor = 0;
}
-
-void WM_cursor_wait(wmWindow *win, int val)
+/* to allow usage all over, we do entire WM */
+void WM_cursor_wait(int val)
{
- if(val) {
- WM_cursor_modal(win, CURSOR_WAIT);
- } else {
- WM_cursor_restore(win);
+ wmWindowManager *wm= G.main->wm.first;
+ wmWindow *win= wm->windows.first;
+
+ for(; win; win= win->next) {
+ if(val) {
+ WM_cursor_modal(win, CURSOR_WAIT);
+ } else {
+ WM_cursor_restore(win);
+ }
}
}
@@ -166,8 +171,8 @@ void WM_timecursor(wmWindow *win, int nr)
unsigned char bitmap[16][2];
int i, idx;
- if(LastCursor != -1)
- LastCursor= win->cursor;
+ if(win->lastcursor != 0)
+ win->lastcursor= win->cursor;
memset(&bitmap, 0x00, sizeof(bitmap));
memset(&mask, 0xFF, sizeof(mask));
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index af14bc95207..34ab1c8d48f 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -365,7 +365,7 @@ static void wm_draw_triple_fail(bContext *C, wmWindow *win)
static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
{
- GLint format;
+ GLint width;
int x, y;
/* compute texture sizes */
@@ -402,13 +402,14 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
for(y=0; y<triple->ny; y++) {
for(x=0; x<triple->nx; x++) {
+ /* disabled, does not seems to work well everywhere */
/* proxy texture is only guaranteed to test for the cases that
* there is only one texture in use, which may not be the case */
glBindTexture(triple->target, triple->bind[x + y*triple->nx]);
glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGB8, triple->x[x], triple->y[y], 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
- glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &format);
+ glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width);
- if(format == 0) {
+ if(width == 0) {
glBindTexture(triple->target, 0);
printf("WM: failed to allocate texture for triple buffer drawing (GL_PROXY_TEXTURE_2D).\n");
return 0;
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 344cd73b727..81efe5f8860 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -220,7 +220,7 @@ int WM_operator_call(bContext *C, wmOperator *op)
if(!(retval & OPERATOR_RUNNING_MODAL))
if(op->reports->list.first)
- uiPupmenuReports(C, op->reports);
+ uiPupMenuReports(C, op->reports);
if((retval & OPERATOR_FINISHED) && (op->type->flag & OPTYPE_REGISTER)) {
wm_operator_register(CTX_wm_manager(C), op);
@@ -283,7 +283,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
if(!(retval & OPERATOR_RUNNING_MODAL)) {
if(op->reports->list.first) /* only show the report if the report list was not given in the function */
- uiPupmenuReports(C, op->reports);
+ uiPupMenuReports(C, op->reports);
if (retval & OPERATOR_FINISHED) /* todo - this may conflict with the other WM_operator_print, if theres ever 2 prints for 1 action will may need to add modal check here */
if(G.f & G_DEBUG)
@@ -558,7 +558,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
if(!(retval & OPERATOR_RUNNING_MODAL))
if(op->reports->list.first)
- uiPupmenuReports(C, op->reports);
+ uiPupMenuReports(C, op->reports);
if (retval & OPERATOR_FINISHED) {
if(G.f & G_DEBUG)
@@ -790,6 +790,7 @@ void wm_event_do_handlers(bContext *C)
int action;
CTX_wm_window_set(C, win);
+
/* we let modal handlers get active area/region, also wm_paintcursor_test needs it */
CTX_wm_area_set(C, area_event_inside(C, event->x, event->y));
CTX_wm_region_set(C, region_event_inside(C, event->x, event->y));
@@ -802,7 +803,7 @@ void wm_event_do_handlers(bContext *C)
/* fileread case */
if(CTX_wm_window(C)==NULL) {
wm_event_free(event);
- break;
+ return;
}
if(wm_event_always_pass(event) || action==WM_HANDLER_CONTINUE) {
@@ -850,14 +851,8 @@ void wm_event_do_handlers(bContext *C)
}
wm_event_free(event);
- CTX_wm_window_set(C, NULL);
- CTX_wm_area_set(C, NULL);
- CTX_wm_region_set(C, NULL);
}
-
- /* fileread case */
- if(CTX_wm_window(C)==NULL)
- break;
+ CTX_wm_window_set(C, NULL);
}
}
@@ -975,8 +970,8 @@ void WM_event_add_mousemove(bContext *C)
/* for modal callbacks, check configuration for how to interpret exit with tweaks */
int WM_modal_tweak_exit(wmEvent *evt, int tweak_event)
{
- /* user preset?? dunno... */
- int tweak_modal= 1;
+ /* user preset or keymap? dunno... */
+ int tweak_modal= (U.flag & USER_DRAGIMMEDIATE)==0;
switch(tweak_event) {
case EVT_TWEAK_L:
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 4bd3cf3f39f..86e0bc6474c 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -81,6 +81,7 @@
#include "GHOST_C-api.h"
#include "UI_interface.h"
+#include "BLF_api.h"
// XXX #include "BPY_extern.h"
@@ -394,6 +395,9 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
/* first wrap up running stuff */
/* code copied from wm_init_exit.c */
for(wm= wmlist->first; wm; wm= wm->id.next) {
+
+ WM_jobs_stop_all(wm);
+
for(win= wm->windows.first; win; win= win->next) {
CTX_wm_window_set(C, win); /* needed by operator close callbacks */
@@ -443,12 +447,14 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
/* match oldwm to new dbase, only old files */
for(wm= oldwmlist->first; wm; wm= wm->id.next) {
+ /* ensure making new keymaps and set space types */
+ wm->initialized= 0;
+
for(win= wm->windows.first; win; win= win->next) {
- win->screen= (bScreen *)find_id("SR", win->screenname);
-
- if(win->screen==NULL)
- win->screen= ED_screen_duplicate(win, CTX_wm_screen(C)); /* active screen */
-
+ /* all windows get active screen from file */
+ win->screen= CTX_wm_screen(C);
+ BLI_strncpy(win->screenname, win->screen->id.name+2, 21);
+
if(win->screen->winid==0)
win->screen->winid= win->winid;
}
@@ -462,6 +468,10 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
/* this code could move to setup_appdata */
oldwm= oldwmlist->first;
wm= G.main->wm.first;
+
+ /* ensure making new keymaps and set space types */
+ wm->initialized= 0;
+
/* only first wm in list has ghostwins */
for(win= wm->windows.first; win; win= win->next) {
for(oldwin= oldwm->windows.first; oldwin; oldwin= oldwin->next) {
@@ -518,7 +528,10 @@ void WM_read_file(bContext *C, char *name, ReportList *reports)
BKE_reset_undo();
BKE_write_undo(C, "original"); /* save current state */
+ WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL);
// refresh_interface_font();
+
+ CTX_wm_window_set(C, NULL); /* exits queues */
}
// else if(retval==1)
// XXX BIF_undo_push("Import file");
@@ -571,9 +584,7 @@ int WM_read_homefile(bContext *C, int from_memory)
G.fileflags &= ~G_FILE_AUTOPLAY; /* disable autoplay in .B.blend... */
// mainwindow_set_filename_to_title(""); // empty string re-initializes title to "Blender"
-#ifdef INTERNATIONAL
-// XXX read_languagefile();
-#endif
+ BLF_lang_init();
// refresh_interface_font();
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 01e4cd10b3d..654555f65e9 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -82,12 +82,14 @@
#include "wm_files.h"
#include "wm_window.h"
+#include "ED_node.h"
#include "ED_previewrender.h"
#include "ED_space_api.h"
#include "ED_screen.h"
#include "ED_util.h"
#include "UI_interface.h"
+#include "BLF_api.h"
#include "GPU_extensions.h"
#include "GPU_draw.h"
@@ -114,10 +116,11 @@ void WM_init(bContext *C)
set_free_windowmanager_cb(wm_close_and_free); /* library.c */
set_blender_test_break_cb(wm_window_testbreak); /* blender.c */
- ED_spacetypes_init(); /* editors/area/spacetype.c */
+ ED_spacetypes_init(); /* editors/space_api/spacetype.c */
+
+ ED_file_init(); /* for fsmenu */
+ ED_init_node_butfuncs();
- ED_file_init(); /* for fsmenu */
-
/* get the default database, plus a wm */
WM_read_homefile(C, 0);
@@ -175,6 +178,9 @@ void WM_exit(bContext *C)
/* modal handlers are on window level freed, others too? */
/* note; same code copied in wm_files.c */
if(C && CTX_wm_manager(C)) {
+
+ WM_jobs_stop_all(CTX_wm_manager(C));
+
for(win= CTX_wm_manager(C)->windows.first; win; win= win->next) {
CTX_wm_window_set(C, win); /* needed by operator close callbacks */
@@ -218,10 +224,7 @@ void WM_exit(bContext *C)
// fsmenu_free();
-#ifdef INTERNATIONAL
-// free_languagemenu();
-#endif
-
+ BLF_lang_exit();
RE_FreeAllRender();
// free_txt_data();
@@ -243,6 +246,8 @@ void WM_exit(bContext *C)
#ifdef INTERNATIONAL
FTF_End();
#endif
+
+ GPU_extensions_exit();
// if (copybuf) MEM_freeN(copybuf);
// if (copybufinfo) MEM_freeN(copybufinfo);
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index 422cc42e10b..40a72034d26 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -36,6 +36,7 @@
#include "BKE_blender.h"
#include "BKE_context.h"
#include "BKE_idprop.h"
+#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_report.h"
@@ -87,18 +88,22 @@ struct wmJob {
/* should store entire own context, for start, update, free */
void *customdata;
+ /* to prevent cpu overhead, use this one which only gets called when job really starts, not in thread */
+ void (*initjob)(void *);
+ /* this runs inside thread, and does full job */
void (*startjob)(void *, short *stop, short *do_update);
+ /* update gets called if thread defines so, and max once per timerstep */
+ /* it runs outside thread, blocking blender, no drawing! */
+ void (*update)(void *);
+ /* free entire customdata, doesn't run in thread */
void (*free)(void *);
/* running jobs each have own timer */
double timestep;
wmTimer *wt;
/* the notifier event timers should send */
- unsigned int note;
+ unsigned int note, endnote;
- /* update gets called if thread defines so, and max once per timerstep */
- /* no drawing, send notifiers! */
- void (*update)(void *);
/* internal */
void *owner;
@@ -135,6 +140,18 @@ wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner)
return steve;
}
+/* returns true if job runs, for UI (progress) indicators */
+int WM_jobs_test(wmWindowManager *wm, void *owner)
+{
+ wmJob *steve;
+
+ for(steve= wm->jobs.first; steve; steve= steve->next)
+ if(steve->owner==owner)
+ if(steve->running)
+ return 1;
+ return 0;
+}
+
void WM_jobs_customdata(wmJob *steve, void *customdata, void (*free)(void *))
{
/* pending job? just free */
@@ -150,17 +167,20 @@ void WM_jobs_customdata(wmJob *steve, void *customdata, void (*free)(void *))
}
}
-void WM_jobs_timer(wmJob *steve, double timestep, unsigned int note)
+void WM_jobs_timer(wmJob *steve, double timestep, unsigned int note, unsigned int endnote)
{
steve->timestep = timestep;
steve->note = note;
+ steve->endnote = endnote;
}
void WM_jobs_callbacks(wmJob *steve,
void (*startjob)(void *, short *, short *),
+ void (*initjob)(void *),
void (*update)(void *))
{
steve->startjob= startjob;
+ steve->initjob= initjob;
steve->update= update;
}
@@ -191,9 +211,14 @@ void WM_jobs_start(wmJob *steve)
steve->customdata= NULL;
steve->running= 1;
- BLI_init_threads(&steve->threads, do_job_thread, 1);
+ if(steve->initjob)
+ steve->initjob(steve->run_customdata);
+
+ BLI_init_threads(&steve->threads, do_job_thread, 1);
BLI_insert_thread(&steve->threads, steve);
+ // printf("job started\n");
+
/* restarted job has timer already */
if(steve->wt==NULL)
steve->wt= WM_event_add_window_timer(steve->win, TIMERJOBS, steve->timestep);
@@ -202,6 +227,28 @@ void WM_jobs_start(wmJob *steve)
}
}
+void WM_jobs_stop_all(wmWindowManager *wm)
+{
+ wmJob *steve= wm->jobs.first;
+
+ for(; steve; steve= steve->next) {
+ if(steve->running) {
+ /* signal job to end */
+ steve->stop= 1;
+ BLI_end_threads(&steve->threads);
+ }
+
+ if(steve->wt)
+ WM_event_remove_window_timer(steve->win, steve->wt);
+ if(steve->customdata)
+ steve->free(steve->customdata);
+ if(steve->run_customdata)
+ steve->run_free(steve->run_customdata);
+ }
+
+ BLI_freelistN(&wm->jobs);
+}
+
/* hardcoded to event TIMERJOBS */
static int wm_jobs_timer(bContext *C, wmOperator *op, wmEvent *evt)
{
@@ -214,9 +261,10 @@ static int wm_jobs_timer(bContext *C, wmOperator *op, wmEvent *evt)
/* running threads */
if(steve->threads.first) {
- if(steve->do_update) {
+ /* always call note and update when ready */
+ if(steve->do_update || steve->ready) {
if(steve->update)
- steve->update(steve->customdata);
+ steve->update(steve->run_customdata);
if(steve->note)
WM_event_add_notifier(C, steve->note, NULL);
steve->do_update= 0;
@@ -228,9 +276,15 @@ static int wm_jobs_timer(bContext *C, wmOperator *op, wmEvent *evt)
steve->run_customdata= NULL;
steve->run_free= NULL;
+ // if(steve->stop) printf("job stopped\n");
+ // else printf("job finished\n");
+
steve->running= 0;
BLI_end_threads(&steve->threads);
+ if(steve->endnote)
+ WM_event_add_notifier(C, steve->endnote, NULL);
+
/* new job added for steve? */
if(steve->customdata) {
WM_jobs_start(steve);
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 864146a8576..46a5c45a30d 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -37,6 +37,7 @@
#include "BKE_blender.h"
#include "BKE_context.h"
+#include "BKE_idprop.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_utildefines.h"
@@ -507,13 +508,35 @@ static char *wm_keymap_item_to_string(wmKeymapItem *kmi, char *str, int len)
return str;
}
-char *WM_key_event_operator_string(const bContext *C, const char *opname, int opcontext, char *str, int len)
+static char *wm_keymap_item_find(ListBase *handlers, const char *opname, int opcontext, IDProperty *properties, char *str, int len)
{
wmEventHandler *handler;
wmKeymapItem *kmi;
- ListBase *handlers= NULL;
- /* find right handler list based on specified context */
+ /* find keymap item in handlers */
+ for(handler=handlers->first; handler; handler=handler->next)
+ if(handler->keymap)
+ for(kmi=handler->keymap->first; kmi; kmi=kmi->next)
+ if(strcmp(kmi->idname, opname) == 0 && WM_key_event_string(kmi->type)[0])
+ if(kmi->ptr && IDP_EqualsProperties(properties, kmi->ptr->data))
+ return wm_keymap_item_to_string(kmi, str, len);
+
+ return NULL;
+}
+
+char *WM_key_event_operator_string(const bContext *C, const char *opname, int opcontext, IDProperty *properties, char *str, int len)
+{
+ char *found= NULL;
+
+ /* look into multiple handler lists to find the item */
+ if(CTX_wm_window(C))
+ if((found= wm_keymap_item_find(&CTX_wm_window(C)->handlers, opname, opcontext, properties, str, len)))
+ return found;
+
+ if(CTX_wm_area(C))
+ if((found= wm_keymap_item_find(&CTX_wm_area(C)->handlers, opname, opcontext, properties, str, len)))
+ return found;
+
if(ELEM(opcontext, WM_OP_EXEC_REGION_WIN, WM_OP_INVOKE_REGION_WIN)) {
if(CTX_wm_area(C)) {
ARegion *ar= CTX_wm_area(C)->regionbase.first;
@@ -522,32 +545,16 @@ char *WM_key_event_operator_string(const bContext *C, const char *opname, int op
break;
if(ar)
- handlers= &ar->handlers;
+ if((found= wm_keymap_item_find(&ar->handlers, opname, opcontext, properties, str, len)))
+ return found;
}
}
- else if(ELEM(opcontext, WM_OP_EXEC_AREA, WM_OP_INVOKE_AREA)) {
- if(CTX_wm_area(C))
- handlers= &CTX_wm_area(C)->handlers;
- }
- else if(ELEM(opcontext, WM_OP_EXEC_SCREEN, WM_OP_INVOKE_SCREEN)) {
- if(CTX_wm_window(C))
- handlers= &CTX_wm_window(C)->handlers;
- }
else {
if(CTX_wm_region(C))
- handlers= &CTX_wm_region(C)->handlers;
+ if((found= wm_keymap_item_find(&CTX_wm_region(C)->handlers, opname, opcontext, properties, str, len)))
+ return found;
}
- if(!handlers)
- return NULL;
-
- /* find keymap item in handlers */
- for(handler=handlers->first; handler; handler=handler->next)
- if(handler->keymap)
- for(kmi=handler->keymap->first; kmi; kmi=kmi->next)
- if(strcmp(kmi->idname, opname) == 0 && WM_key_event_string(kmi->type)[0])
- return wm_keymap_item_to_string(kmi, str, len);
-
return NULL;
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index fe9fe2e29a4..827c7572788 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -217,7 +217,7 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
for (i=0; i<totitem; i++)
p+= sprintf(p, "|%s %%x%d", item[i].name, item[i].value);
- uiPupmenuOperator(C, totitem/30, op, "type", menu);
+ uiPupMenuOperator(C, totitem/30, op, "type", menu);
MEM_freeN(menu);
return OPERATOR_RUNNING_MODAL;
@@ -231,7 +231,7 @@ int WM_operator_confirm(bContext *C, wmOperator *op, wmEvent *event)
char buf[512];
sprintf(buf, "OK? %%i%d%%t|%s", ICON_HELP, op->type->name);
- uiPupmenuOperator(C, 0, op, NULL, buf);
+ uiPupMenuOperator(C, 0, op, NULL, buf);
return OPERATOR_RUNNING_MODAL;
}
@@ -337,7 +337,7 @@ static int wm_recentfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
char pup[2048];
recent_filelist(pup);
- uiPupmenuOperator(C, 0, op, "nr", pup);
+ uiPupMenuOperator(C, 0, op, "nr", pup);
return OPERATOR_RUNNING_MODAL;
}
@@ -368,7 +368,8 @@ static int wm_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* settings for filebrowser */
sfile= (SpaceFile*)CTX_wm_space_data(C);
sfile->op = op;
- ED_fileselect_set_params(sfile, FILE_BLENDER, "Load", "C:\\", 0, 0, 0);
+ // XXX replace G.sce
+ ED_fileselect_set_params(sfile, FILE_BLENDER, "Load As", G.sce, 0, 0, 0);
/* screen and area have been reset already in ED_screen_full_newspace */
@@ -1170,5 +1171,6 @@ void wm_window_keymap(wmWindowManager *wm)
WM_keymap_verify_item(keymap, "WM_OT_save_as_mainfile", F2KEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "WM_OT_window_fullscreen_toggle", F11KEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "WM_OT_exit_blender", QKEY, KM_PRESS, KM_CTRL, 0);
+
}
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 06ec8f6819a..eebf89982c1 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -153,6 +153,7 @@ wmWindow *wm_window_copy(bContext *C, wmWindow *winorig)
win->sizey= winorig->sizey;
win->screen= ED_screen_duplicate(win, winorig->screen);
+ BLI_strncpy(win->screenname, win->screen->id.name+2, 21);
win->screen->do_refresh= 1;
win->screen->do_draw= 1;
@@ -279,7 +280,6 @@ void wm_window_add_ghostwindows(wmWindowManager *wm)
/* area-rip calls this */
wmWindow *WM_window_open(bContext *C, rcti *rect)
{
- wmWindowManager *wm= CTX_wm_manager(C);
wmWindow *win= wm_window_new(C);
win->posx= rect->xmin;
@@ -290,7 +290,7 @@ wmWindow *WM_window_open(bContext *C, rcti *rect)
win->drawmethod= -1;
win->drawdata= NULL;
- wm_window_add_ghostwindow(wm, "Blender", win);
+ wm_check(C);
return win;
}
diff --git a/source/blender/windowmanager/wm_cursors.h b/source/blender/windowmanager/wm_cursors.h
index e3f0e846b7a..096e1916fa9 100644
--- a/source/blender/windowmanager/wm_cursors.h
+++ b/source/blender/windowmanager/wm_cursors.h
@@ -74,9 +74,9 @@ typedef struct BCursor {
} BCursor;
-#define SYSCURSOR -1
+#define SYSCURSOR 1
enum {
- BC_NW_ARROWCURSOR=0,
+ BC_NW_ARROWCURSOR=2,
BC_NS_ARROWCURSOR,
BC_EW_ARROWCURSOR,
BC_WAITCURSOR,
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index ddd9b636660..55e04783ab7 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -274,6 +274,7 @@ IF(UNIX)
bf_videotex
bf_rna
bf_dna
+ bf_blenfont
)
FOREACH(SORTLIB ${BLENDER_SORTED_LIBS})