merge with 2.5 at 19207, plus some half-finished walker stuff
authorJoseph Eagar <joeedh@gmail.com>
Sun, 8 Mar 2009 07:15:41 +0000 (07:15 +0000)
committerJoseph Eagar <joeedh@gmail.com>
Sun, 8 Mar 2009 07:15:41 +0000 (07:15 +0000)
161 files changed:
CMakeLists.txt
config/win64-vc-config.py [new file with mode: 0644]
intern/ghost/GHOST_C-api.h
intern/ghost/GHOST_ISystem.h
intern/ghost/intern/GHOST_C-api.cpp
intern/ghost/intern/GHOST_System.h
intern/ghost/intern/GHOST_SystemCarbon.cpp
intern/ghost/intern/GHOST_SystemCarbon.h
intern/ghost/intern/GHOST_SystemWin32.cpp
intern/ghost/intern/GHOST_SystemWin32.h
intern/ghost/intern/GHOST_SystemX11.cpp
intern/ghost/intern/GHOST_SystemX11.h
projectfiles_vc9/blender/BPY_python/BPY_python.vcproj
projectfiles_vc9/blender/blenfont/BLF_blenfont.vcproj
projectfiles_vc9/blender/editors/ED_editors.vcproj
projectfiles_vc9/blender/makesrna/RNA_makesrna.vcproj
projectfiles_vc9/blender/makesrna/RNA_rna.vcproj
projectfiles_vc9/gameengine/converter/KX_converter.vcproj
release/datafiles/bmonofont.ttf [new file with mode: 0644]
source/blender/blenfont/BLF_api.h
source/blender/blenfont/SConscript
source/blender/blenfont/intern/blf.c
source/blender/blenfont/intern/blf_font.c
source/blender/blenfont/intern/blf_glyph.c
source/blender/blenfont/intern/blf_internal.h
source/blender/blenfont/intern/blf_internal_types.h
source/blender/blenkernel/BKE_brush.h
source/blender/blenkernel/BKE_context.h
source/blender/blenkernel/BKE_fcurve.h
source/blender/blenkernel/BKE_particle.h
source/blender/blenkernel/BKE_text.h
source/blender/blenkernel/intern/brush.c
source/blender/blenkernel/intern/context.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/fcurve.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/ipo.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/text.c
source/blender/blenlib/intern/arithb.c
source/blender/blenloader/intern/readfile.c
source/blender/bmesh/bmesh_operators.h
source/blender/bmesh/bmesh_walkers.h
source/blender/bmesh/intern/bmesh_walkers.c
source/blender/editors/animation/anim_channels.c
source/blender/editors/animation/anim_filter.c
source/blender/editors/animation/keyframes_draw.c
source/blender/editors/animation/keyframes_edit.c
source/blender/editors/animation/keyframes_general.c
source/blender/editors/animation/keyframing.c
source/blender/editors/armature/armature_intern.h
source/blender/editors/armature/armature_ops.c
source/blender/editors/armature/editarmature.c
source/blender/editors/curve/curve_intern.h
source/blender/editors/curve/curve_ops.c
source/blender/editors/curve/editfont.c
source/blender/editors/datafiles/bmonofont.ttf.c [new file with mode: 0644]
source/blender/editors/include/ED_anim_api.h
source/blender/editors/include/ED_armature.h
source/blender/editors/include/ED_curve.h
source/blender/editors/include/ED_datafiles.h
source/blender/editors/include/ED_fileselect.h
source/blender/editors/include/ED_image.h
source/blender/editors/include/ED_keyframes_edit.h
source/blender/editors/include/ED_mesh.h
source/blender/editors/include/ED_particle.h
source/blender/editors/include/ED_text.h [new file with mode: 0644]
source/blender/editors/include/ED_view3d.h
source/blender/editors/include/UI_interface.h
source/blender/editors/include/UI_resources.h
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_panel.c
source/blender/editors/interface/interface_utils.c
source/blender/editors/interface/view2d.c
source/blender/editors/interface/view2d_ops.c
source/blender/editors/mesh/editmesh_add.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/object/object_edit.c
source/blender/editors/physics/editparticle.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_intern.h
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_action/action_draw.c
source/blender/editors/space_action/action_edit.c
source/blender/editors/space_action/action_header.c
source/blender/editors/space_action/action_select.c
source/blender/editors/space_file/file_draw.c
source/blender/editors/space_file/file_header.c
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/space_file.c
source/blender/editors/space_graph/graph_buttons.c
source/blender/editors/space_graph/graph_draw.c
source/blender/editors/space_graph/graph_edit.c
source/blender/editors/space_graph/graph_header.c
source/blender/editors/space_graph/graph_intern.h
source/blender/editors/space_graph/graph_ops.c
source/blender/editors/space_graph/graph_select.c
source/blender/editors/space_graph/space_graph.c
source/blender/editors/space_image/image_header.c
source/blender/editors/space_image/image_intern.h
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_image/image_panels.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_info/info_header.c
source/blender/editors/space_info/space_info.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_outliner/outliner.c
source/blender/editors/space_outliner/outliner_ops.c
source/blender/editors/space_script/script_edit.c
source/blender/editors/space_script/space_script.c
source/blender/editors/space_text/Makefile
source/blender/editors/space_text/SConscript
source/blender/editors/space_text/space_text.c
source/blender/editors/space_text/text_draw.c [new file with mode: 0644]
source/blender/editors/space_text/text_header.c
source/blender/editors/space_text/text_intern.h
source/blender/editors/space_text/text_ops.c [new file with mode: 0644]
source/blender/editors/space_text/text_python.c [new file with mode: 0644]
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_ops.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_manipulator.c
source/blender/editors/util/undo.c
source/blender/imbuf/IMB_thumbs.h
source/blender/imbuf/intern/thumbs.c
source/blender/makesdna/DNA_particle_types.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_space_types.h
source/blender/makesdna/DNA_text_types.h
source/blender/makesdna/intern/SConscript
source/blender/makesrna/RNA_access.h
source/blender/makesrna/RNA_define.h
source/blender/makesrna/intern/CMakeLists.txt
source/blender/makesrna/intern/SConscript
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_action.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_material.c
source/blender/makesrna/intern/rna_particle.c
source/blender/makesrna/intern/rna_pose.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_timeline.c [new file with mode: 0755]
source/blender/render/intern/source/shadeoutput.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/WM_types.h
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_init_exit.c
source/blender/windowmanager/intern/wm_window.c
source/blender/windowmanager/wm_event_types.h
source/creator/creator.c

index be2c9b6b950c73894f2f5c17afbb409a38df5b56..2d70716a4680ae2609c089ec20fbaa04deafca70 100644 (file)
@@ -348,22 +348,28 @@ IF(APPLE)
     SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-6.1-powerpc)
   ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
 
-  INCLUDE(${CMAKE_ROOT}/Modules/FindOpenAL.cmake)
-  IF(OPENAL_FOUND)
-    SET(WITH_OPENAL ON)
-    SET(OPENAL_LIB ${OPENAL_LIBRARY})
-    SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
-  ELSE(OPENAL_FOUND)
-    SET(WITH_OPENAL OFF)
-  ENDIF(OPENAL_FOUND)
+  IF(WITH_OPENAL)
+    INCLUDE(${CMAKE_ROOT}/Modules/FindOpenAL.cmake)
+    IF(OPENAL_FOUND)
+      SET(WITH_OPENAL ON)
+      SET(OPENAL_LIB ${OPENAL_LIBRARY})
+      SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
+    ELSE(OPENAL_FOUND)
+      SET(WITH_OPENAL OFF)
+    ENDIF(OPENAL_FOUND)
+  ENDIF(WITH_OPENAL)
 
   SET(PYTHON /System/Library/Frameworks/Python.framework/Versions/)
-  SET(PYTHON_VERSION 2.3)
+  SET(PYTHON_VERSION 2.5)
   SET(PYTHON_INC "${PYTHON}${PYTHON_VERSION}/include/python${PYTHON_VERSION}" CACHE STRING "")
   SET(PYTHON_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION} CACHE STRING "")
   SET(PYTHON_LIB "")
   SET(PYTHON_LIBPATH ${PYTHON}${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config CACHE STRING "")
-  SET(PYTHON_LINKFLAGS "-u __dummy -u _PyMac_Error -framework System -framework Python")
+  IF(CMAKE_SYSTEM_VERSION GREATER 10.4)
+       SET(PYTHON_LINKFLAGS "-u _PyMac_Error -framework System -framework Python")
+  ELSE(CMAKE_SYSTEM_VERSION GREATER 10.4)
+    SET(PYTHON_LINKFLAGS "-u _PyMac_Error -framework System -framework Python")
+  ENDIF(CMAKE_SYSTEM_VERSION GREATER 10.4)
 
   SET(GETTEXT ${LIBDIR}/gettext)
   SET(GETTEXT_INC "${GETTEXT}/include")
diff --git a/config/win64-vc-config.py b/config/win64-vc-config.py
new file mode 100644 (file)
index 0000000..222c6c5
--- /dev/null
@@ -0,0 +1,212 @@
+LCGDIR = '#../lib/win64'
+LIBDIR = '${LCGDIR}'
+
+# enable ffmpeg  support
+WITH_BF_FFMPEG = False # -DWITH_FFMPEG
+BF_FFMPEG = LIBDIR +'/ffmpeg'
+BF_FFMPEG_INC = '${BF_FFMPEG}/include'
+BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
+BF_FFMPEG_LIB = 'avformat-52.lib avcodec-51.lib avdevice-52.lib avutil-49.lib swscale-0.lib'
+
+BF_PYTHON = LIBDIR + '/python'
+BF_PYTHON_VERSION = '2.5'
+BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
+BF_PYTHON_BINARY = 'python'
+BF_PYTHON_LIB = 'python25'
+BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
+
+WITH_BF_OPENAL = False 
+WITH_BF_STATICOPENAL = False
+BF_OPENAL = LIBDIR + '/openal'
+BF_OPENAL_INC = '${BF_OPENAL}/include ${BF_OPENAL}/include/AL '
+BF_OPENAL_LIB = 'dxguid openal_static'
+BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
+# Warning, this static lib configuration is untested! users of this OS please confirm.
+BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
+
+# TODO - are these useful on win32?
+# BF_CXX = '/usr'
+# WITH_BF_STATICCXX = False
+# BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
+
+WITH_BF_ICONV = True
+BF_ICONV = LIBDIR + '/iconv'
+BF_ICONV_INC = '${BF_ICONV}/include'
+BF_ICONV_LIB = 'iconv'
+BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
+
+WITH_BF_SDL = True
+BF_SDL = LIBDIR + '/sdl'
+BF_SDL_INC = '${BF_SDL}/include'
+BF_SDL_LIB = 'SDL.lib'
+BF_SDL_LIBPATH = '${BF_SDL}/lib'
+
+BF_PTHREADS = LIBDIR + '/pthreads'
+BF_PTHREADS_INC = '${BF_PTHREADS}/include'
+BF_PTHREADS_LIB = 'pthreadVC2'
+BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
+
+WITH_BF_FMOD = False
+BF_FMOD = LIBDIR + '/fmod'
+
+WITH_BF_OPENEXR = True
+WITH_BF_STATICOPENEXR = False
+BF_OPENEXR = LIBDIR + '/openexr'
+BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/IlmImf ${BF_OPENEXR}/include/Iex ${BF_OPENEXR}/include/Imath '
+BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread '
+BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib_vs2008'
+# Warning, this static lib configuration is untested! users of this OS please confirm.
+BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
+
+WITH_BF_DDS = True
+
+WITH_BF_JPEG = True
+BF_JPEG = LIBDIR + '/jpeg'
+BF_JPEG_INC = '${BF_JPEG}/include'
+BF_JPEG_LIB = 'libjpeg'
+BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
+
+WITH_BF_PNG = True
+BF_PNG = LIBDIR + '/png'
+BF_PNG_INC = '${BF_PNG}/include'
+BF_PNG_LIB = 'libpng'
+BF_PNG_LIBPATH = '${BF_PNG}/lib'
+
+BF_TIFF = LIBDIR + '/tiff'
+BF_TIFF_INC = '${BF_TIFF}/include'
+BF_TIFF_LIB = 'libtiff'
+BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
+
+WITH_BF_ZLIB = True
+BF_ZLIB = LIBDIR + '/zlib'
+BF_ZLIB_INC = '${BF_ZLIB}/include'
+BF_ZLIB_LIB = 'libz'
+BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
+
+WITH_BF_INTERNATIONAL = False
+
+BF_GETTEXT = LIBDIR + '/gettext'
+BF_GETTEXT_INC = '${BF_GETTEXT}/include'
+BF_GETTEXT_LIB = 'gnu_gettext'
+BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
+
+WITH_BF_FTGL = False
+BF_FTGL = LIBDIR + '/ftgl'
+BF_FTGL_INC = '${BF_FTGL}/include'
+BF_FTGL_LIB = 'extern_ftgl'
+
+WITH_BF_GAMEENGINE = True
+WITH_BF_PLAYER = False
+
+WITH_BF_ODE = True
+BF_ODE = LIBDIR + '/ode'
+BF_ODE_INC = BF_ODE + '/include'
+BF_ODE_LIB = BF_ODE + '/lib/libode.a'
+
+WITH_BF_BULLET = True
+BF_BULLET = '#extern/bullet2/src'
+BF_BULLET_INC = '${BF_BULLET}'
+BF_BULLET_LIB = 'extern_bullet'
+
+BF_SOLID = '#extern/solid'
+BF_SOLID_INC = '${BF_SOLID}'
+BF_SOLID_LIB = 'extern_solid'
+
+BF_WINTAB = LIBDIR + '/wintab'
+BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
+
+WITH_BF_YAFRAY = True
+
+WITH_BF_BINRELOC = False
+
+#WITH_BF_NSPR = True
+#BF_NSPR = $(LIBDIR)/nspr
+#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
+#BF_NSPR_LIB = 
+
+# Uncomment the following line to use Mozilla inplace of netscape
+#CPPFLAGS += -DMOZ_NOT_NET
+# Location of MOZILLA/Netscape header files...
+#BF_MOZILLA = $(LIBDIR)/mozilla
+#BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl
+#BF_MOZILLA_LIB =
+# Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
+# if this is not set.
+#
+# Be paranoid regarding library creation (do not update archives)
+#BF_PARANOID = True
+
+# enable freetype2 support for text objects
+BF_WITH_FREETYPE = True
+BF_FREETYPE = LIBDIR + '/freetype'
+BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
+BF_FREETYPE_LIB = 'freetype2ST'
+BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
+
+WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
+BF_QUICKTIME = LIBDIR + '/QTDevWin'
+BF_QUICKTIME_INC = '${BF_QUICKTIME}/CIncludes'
+BF_QUICKTIME_LIB = 'qtmlClient'
+BF_QUICKTIME_LIBPATH = '${BF_QUICKTIME}/Libraries'
+
+WITH_BF_OPENJPEG = False
+BF_OPENJPEG = '#extern/libopenjpeg'
+BF_OPENJPEG_LIB = ''
+BF_OPENJPEG_INC = '${BF_OPENJPEG}'
+BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
+
+WITH_BF_REDCODE = False  
+BF_REDCODE_INC = '#extern'
+
+WITH_BF_STATICOPENGL = False
+BF_OPENGL_INC = '${BF_OPENGL}/include'
+BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
+BF_OPENGL_LIB = 'opengl32 glu32'
+BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a',
+                         '${BF_OPENGL}/lib/libXmu.a', '${BF_OPENGL}/lib/libXext.a',
+                         '${BF_OPENGL}/lib/libX11.a', '${BF_OPENGL}/lib/libXi.a' ]
+CC = 'cl.exe'
+CXX = 'cl.exe'
+
+CCFLAGS = ['/nologo', '/Ob1', '/J', '/W3', '/Gd', '/MT']
+CXXFLAGS = ['/EHsc']
+
+BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr']
+
+CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-DFTGL_LIBRARY_STATIC', '-D_CRT_SECURE_NO_DEPRECATE']
+REL_CFLAGS = ['-O2', '-DNDEBUG']
+REL_CCFLAGS = ['-O2', '-DNDEBUG']
+REL_CXXFLAGS = ['-O2', '-DNDEBUG']
+
+C_WARN = []
+CC_WARN = []
+CXX_WARN = []
+
+LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid']
+
+WITH_BF_DOCS=False
+
+BF_DEBUG=False
+BF_BSC=False
+CFLAGS = []
+CCFLAGS = ['/nologo', '/Ob1', '/J', '/W3', '/Gd', '/MT', '/openmp']
+CXXFLAGS = ['/EHsc']
+
+if BF_DEBUG:
+       BF_NUMJOBS=1
+else:
+       BF_NUMJOBS=6
+
+PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/ENTRY:mainCRTStartup','/INCREMENTAL:NO','/NODEFAULTLIB:"msvcprt.lib"','/NODEFAULTLIB:"glut32.lib"','/NODEFAULTLIB:"libc.lib"','/NODEFAULTLIB:"libcd.lib"','/NODEFAULTLIB:"libcpd.lib"','/NODEFAULTLIB:"libcp.lib"','/LARGEADDRESSAWARE']
+
+BF_BUILDDIR = '..\\build\\blender25-win64-vc'
+BF_INSTALLDIR='..\\install\\blender25-win64-vc'
+BF_DOCDIR='..\\install\\blender25-win64-vc\\doc'
+
+
+
+######################### MERGE WITH ABOVE ################################
+
+
+
+
index cb1eac7a9a6516bffa55fa55984b13ad7dd3f966..c3158214830833e574e0101770aa41d73409a20c 100644 (file)
@@ -771,14 +771,16 @@ extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
 
 /**
  * Return the data from the clipboad
- * @return clipboard data
+ * @param      return the selection instead, X11 only feature
+ * @return     clipboard data
  */
-extern GHOST_TUns8* GHOST_getClipboard(int flag);
+extern GHOST_TUns8* GHOST_getClipboard(int selection);
 
 /**
  * Put data to the Clipboard
+ * @param      set the selection instead, X11 only feature
  */
-extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int flag);
+extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
 
 #ifdef __cplusplus
 }
index baf0cb813f84af7a40273a9b206d8be8f834d5b7..08794dfd085366299b6d83901f49d14c43a108c2 100644 (file)
@@ -356,12 +356,12 @@ public:
         * @return Returns "unsinged char" from X11 XA_CUT_BUFFER0 buffer
         *
         */
-        virtual GHOST_TUns8* getClipboard(int flag) const = 0;
+        virtual GHOST_TUns8* getClipboard(bool selection) const = 0;
 
        /**
         * Put data to the Clipboard
         */
-       virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const = 0;
+       virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
 
 protected:
        /**
index ad5189af0e922f29216456f6ce9f349f3b7fccae..401dba8d240799aa465ee9a61e39101296d6a7eb 100644 (file)
@@ -810,15 +810,15 @@ GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
        return result;
 }
 
-GHOST_TUns8* GHOST_getClipboard(int flag)
+GHOST_TUns8* GHOST_getClipboard(int selection)
 {
        GHOST_ISystem* system = GHOST_ISystem::getSystem();
-       return system->getClipboard(flag);
+       return system->getClipboard(selection);
 }
 
-void GHOST_putClipboard(GHOST_TInt8 *buffer, int flag)
+void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection)
 {
        GHOST_ISystem* system = GHOST_ISystem::getSystem();
-       system->putClipboard(buffer, flag);
+       system->putClipboard(buffer, selection);
 }
 
index efce931860a2890e7bf7feed3bfb58472440fd87..9310e9b259149e05a7727329c14fc916b2e01ed4 100644 (file)
@@ -284,18 +284,18 @@ public:
 
        /**
         * Returns the selection buffer
-        * @param flag          Only used on X11
-        * @return              Returns the clipboard data
+        * @param selection             Only used on X11
+        * @return                              Returns the clipboard data
         *
         */
-        virtual GHOST_TUns8* getClipboard(int flag) const = 0;
+        virtual GHOST_TUns8* getClipboard(bool selection) const = 0;
          
          /**
           * Put data to the Clipboard
-          * @param buffer      The buffer to copy to the clipboard
-          * @param flag        The clipboard to copy too only used on X11
+          * @param buffer              The buffer to copy to the clipboard
+          * @param selection   The clipboard to copy too only used on X11
           */
-         virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const = 0;
+         virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
 
 protected:
        /**
index 203b38470194ba81c96a454f2f69b1bcf8e5da9e..1043d0938b45b483c4fcdf44bc1440b5146df060 100644 (file)
@@ -1119,7 +1119,7 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even
     return err;
 }
 
-GHOST_TUns8* GHOST_SystemCarbon::getClipboard(int flag) const
+GHOST_TUns8* GHOST_SystemCarbon::getClipboard(bool selection) const
 {
        PasteboardRef inPasteboard;
        PasteboardItemID itemID;
@@ -1158,9 +1158,9 @@ GHOST_TUns8* GHOST_SystemCarbon::getClipboard(int flag) const
        }
 }
 
-void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, int flag) const
+void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, bool selection) const
 {
-       if(flag == 1) {return;} //If Flag is 1 means the selection and is used on X11
+       if(selection) {return;} // for copying the selection, used on X11
 
        PasteboardRef inPasteboard;
        CFDataRef textData = NULL;
index 2a1d63257843ba49d6135f2269faa35a58f13923..62d45ee769d2462d0e8bffacbc2295dfd0260afb 100644 (file)
@@ -169,17 +169,17 @@ public:
 
        /**
         * Returns Clipboard data
-        * @param flag          Indicate which buffer to return
-        * @return              Returns the selected buffer
+        * @param selection             Indicate which buffer to return
+        * @return                              Returns the selected buffer
         */
-       virtual GHOST_TUns8* getClipboard(int flag) const;
+       virtual GHOST_TUns8* getClipboard(bool selection) const;
        
        /**
         * Puts buffer to system clipboard
         * @param buffer        The buffer to be copied
-        * @param flag          Indicates which buffer to copy too Only used on X11
+        * @param selection     Indicates which buffer to copy too, only used on X11
         */
-       virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const;
+       virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
 
 protected:
        /**
index 6b5fcfe7705277882261c2d8eb87e9b46935e528..e79a075ff2c9b8880c6bc08d03963c4ed57fea26 100644 (file)
@@ -913,7 +913,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
        return lResult;
 }
 
-GHOST_TUns8* GHOST_SystemWin32::getClipboard(int flag) const 
+GHOST_TUns8* GHOST_SystemWin32::getClipboard(bool selection) const 
 {
        char *buffer;
        char *temp_buff;
@@ -943,9 +943,10 @@ GHOST_TUns8* GHOST_SystemWin32::getClipboard(int flag) const
        }
 }
 
-void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, int flag) const
+void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
 {
-       if(flag == 1) {return;} //If Flag is 1 means the selection and is used on X11
+       if(selection) {return;} // for copying the selection, used on X11
+
        if (OpenClipboard(NULL)) {
                HLOCAL clipbuffer;
                char *data;
index 00f7af0016258c8c4086e7f85ddc945bb2f72cdc..9387b6cad50db6c596ada44849cf209a34629e36 100644 (file)
@@ -170,17 +170,17 @@ public:
 
        /**
         * Returns unsinged char from CUT_BUFFER0
-        * @param flag          Flag is not used on win32 on used on X11
-        * @return              Returns the Clipboard
+        * @param selection             Used by X11 only
+        * @return                              Returns the Clipboard
         */
-       virtual GHOST_TUns8* getClipboard(int flag) const;
+       virtual GHOST_TUns8* getClipboard(bool selection) const;
        
        /**
         * Puts buffer to system clipboard
-        * @param flag          Flag is not used on win32 on used on X11
-        * @return              No return
+        * @param selection             Used by X11 only
+        * @return                              No return
         */
-       virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const;
+       virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
         
 protected:
        /**
index 0d19c3b230df5a26206bf65edc4e8813e56526e3..2e76b50fe7a82acee5a2162112bbe7b1a8841176 100644 (file)
@@ -1006,7 +1006,7 @@ convertXKey(
 
        GHOST_TUns8*
 GHOST_SystemX11::
-getClipboard(int flag
+getClipboard(bool selection
 ) const {
        //Flag 
        //0 = Regular clipboard 1 = selection
@@ -1027,7 +1027,7 @@ getClipboard(int flag
        compound_text = XInternAtom(m_display, "COMPOUND_TEXT", False);
 
        //lets check the owner and if it is us then return the static buffer
-       if(flag == 0) {
+       if(!selection) {
                Primary_atom = XInternAtom(m_display, "CLIPBOARD", False);
                owner = XGetSelectionOwner(m_display, Primary_atom);
                if (owner == m_window) {
@@ -1077,14 +1077,14 @@ getClipboard(int flag
        void
 GHOST_SystemX11::
 putClipboard(
-GHOST_TInt8 *buffer, int flag) const
+GHOST_TInt8 *buffer, bool selection) const
 {
        static Atom Primary_atom;
        Window m_window, owner;
        
        if(!buffer) {return;}
        
-       if(flag == 0) {
+       if(!selection) {
                Primary_atom = XInternAtom(m_display, "CLIPBOARD", False);
                if(txt_cut_buffer) { free((void*)txt_cut_buffer); }
                
index 4b0ddd7a4f96e5b072fac5ff4daeb8b49be1e236..6eacd88b8c202a26f5691580ab9e8b00d1f4b4c7 100644 (file)
@@ -202,18 +202,17 @@ public:
                
        /**
         * Returns unsinged char from CUT_BUFFER0
-        * @param flag          Flag indicates which buffer to return 0 for clipboard 1 for selection
-        * @return              Returns the Clipboard indicated by Flag
+        * @param selection             Get selection, X11 only feature
+        * @return                              Returns the Clipboard indicated by Flag
         */
-               GHOST_TUns8*
-       getClipboard(int flag) const;
+       GHOST_TUns8* getClipboard(bool selection) const;
        
        /**
         * Puts buffer to system clipboard
         * @param buffer        The buffer to copy to the clipboard     
-        * @param flag          Flag indicates which buffer to set ownership of 0 for clipboard 1 for selection
+        * @param selection     Set the selection into the clipboard, X11 only feature
         */
-       virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const;
+       virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
 
        /**
         * Atom used for ICCCM, WM-spec and Motif.
index efe2e09305b26db218cda707a0c0ab343d983040..96218215184d40a48f2ca6bd75b3febe02008499 100644 (file)
                                        RelativePath="..\..\..\source\blender\python\intern\bpy_scriptlink.c"\r
                                        >\r
                                </File>\r
+                               <File\r
+                                       RelativePath="..\..\..\source\blender\python\intern\bpy_ui.c"\r
+                                       >\r
+                               </File>\r
                                <File\r
                                        RelativePath="..\..\..\source\blender\python\intern\bpy_util.c"\r
                                        >\r
                                        RelativePath="..\..\..\source\blender\python\intern\bpy_rna.h"\r
                                        >\r
                                </File>\r
+                               <File\r
+                                       RelativePath="..\..\..\source\blender\python\intern\bpy_ui.h"\r
+                                       >\r
+                               </File>\r
                                <File\r
                                        RelativePath="..\..\..\source\blender\python\intern\bpy_util.h"\r
                                        >\r
index 6332c1609d2b42ac734eb3f2b9477c6470c35393..0aa9c1a3185f5718eaba219cda10c58497fbe7ba 100644 (file)
@@ -43,7 +43,7 @@
                        <Tool\r
                                Name="VCCLCompilerTool"\r
                                InlineFunctionExpansion="1"\r
-                               AdditionalIncludeDirectories="..\..\..\intern\guardedalloc;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenlib;..\..\..\source\blender\blenkernel;..\..\..\source\blender\ftfont"\r
+                               AdditionalIncludeDirectories="..\..\..\intern\guardedalloc;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenlib;..\..\..\source\blender\blenkernel;..\..\..\source\blender\blenfont;..\..\..\source\blender\ftfont;..\..\..\..\lib\windows\freetype\include;..\..\..\source\blender\editors\include;..\..\..\..\build\msvc_9\extern\glew\include"\r
                                PreprocessorDefinitions="WIN32;NDEBUG;_LIB;WITH_BF_INTERNATIONAL;WITH_FREETYPE2"\r
                                StringPooling="true"\r
                                RuntimeLibrary="0"\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
                                Optimization="0"\r
-                               AdditionalIncludeDirectories="..\..\..\intern\guardedalloc;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenlib;..\..\..\source\blender\blenkernel;..\..\..\source\blender\ftfont"\r
+                               AdditionalIncludeDirectories="..\..\..\intern\guardedalloc;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenlib;..\..\..\source\blender\blenkernel;..\..\..\source\blender\blenfont;..\..\..\source\blender\ftfont;..\..\..\..\lib\windows\freetype\include;..\..\..\source\blender\editors\include;..\..\..\..\build\msvc_9\extern\glew\include"\r
                                PreprocessorDefinitions="WIN32,_DEBUG,_LIB,WITH_BF_INTERNATIONAL,WITH_FREETYPE2"\r
                                BasicRuntimeChecks="3"\r
                                RuntimeLibrary="1"\r
                        Name="Source Files"\r
                        Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
                        >\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\blenfont\intern\blf.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\blenfont\intern\blf_dir.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\blenfont\intern\blf_font.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\blenfont\intern\blf_glyph.c"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\source\blender\blenfont\intern\blf_lang.c"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\blenfont\intern\blf_util.c"\r
+                               >\r
+                       </File>\r
                </Filter>\r
                <Filter\r
                        Name="extern"\r
                <Filter\r
                        Name="intern"\r
                        >\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\blenfont\intern\blf_internal.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\source\blender\blenfont\intern\blf_internal_types.h"\r
                                >\r
index 2f7009432203c6120550ccdcb43f57e68c8191bd..da6f8276230383a706af7a2df1624abb64d12e34 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="Windows-1252"?>\r
 <VisualStudioProject\r
        ProjectType="Visual C++"\r
-       Version="9,00"\r
+       Version="9.00"\r
        Name="ED_editors"\r
        ProjectGUID="{FB88301F-F725-401B-ACD7-D2ABBF333B71}"\r
        RootNamespace="BL_editors"\r
                                RelativePath="..\..\..\source\blender\editors\include\ED_object.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\editors\include\ED_particle.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\source\blender\editors\include\ED_previewrender.h"\r
                                >\r
                                RelativePath="..\..\..\source\blender\editors\datafiles\blenderbuttons.c"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\editors\datafiles\bmonofont.ttf.c"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\source\blender\editors\datafiles\preview.blend.c"\r
                                >\r
                                RelativePath="..\..\..\source\blender\editors\space_view3d\space_view3d.c"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\editors\space_view3d\view3d_buttons.c"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\source\blender\editors\space_view3d\view3d_draw.c"\r
                                >\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\..\..\source\blender\editors\space_view3d\view3d_view.c"\r
+                               RelativePath="..\..\..\source\blender\editors\space_view3d\view3d_snap.c"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\..\..\source\blender\editors\space_view3d\vpaint.c"\r
+                               RelativePath="..\..\..\source\blender\editors\space_view3d\view3d_view.c"\r
                                >\r
                        </File>\r
                </Filter>\r
                <Filter\r
                        Name="space_graph"\r
                        >\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\editors\space_graph\graph_buttons.c"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\source\blender\editors\space_graph\graph_draw.c"\r
                                >\r
                                RelativePath="..\..\..\source\blender\editors\space_text\space_text.c"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\editors\space_text\text_draw.c"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\source\blender\editors\space_text\text_header.c"\r
                                >\r
                                RelativePath="..\..\..\source\blender\editors\space_text\text_intern.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\editors\space_text\text_ops.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\editors\space_text\text_python.c"\r
+                               >\r
+                       </File>\r
                </Filter>\r
                <Filter\r
                        Name="space_sound"\r
                <Filter\r
                        Name="mesh"\r
                        >\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\editors\mesh\bmeshutils.c"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\source\blender\editors\mesh\editdeform.c"\r
                                >\r
                        </File>\r
                </Filter>\r
                <Filter\r
-                       Name="sculpt"\r
+                       Name="sculpt_paint"\r
                        >\r
                        <File\r
-                               RelativePath="..\..\..\source\blender\editors\sculpt\sculpt.c"\r
+                               RelativePath="..\..\..\source\blender\editors\sculpt_paint\paint_image.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\editors\sculpt_paint\paint_intern.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\editors\sculpt_paint\paint_ops.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\editors\sculpt_paint\paint_utils.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\editors\sculpt_paint\paint_vertex.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\editors\sculpt_paint\sculpt.c"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\..\..\source\blender\editors\sculpt\sculpt_intern.h"\r
+                               RelativePath="..\..\..\source\blender\editors\sculpt_paint\sculpt_intern.h"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\..\..\source\blender\editors\sculpt\stroke.c"\r
+                               RelativePath="..\..\..\source\blender\editors\sculpt_paint\sculpt_stroke.c"\r
                                >\r
                        </File>\r
                </Filter>\r
index 1257207f7d446435a436c6bdc3481240e6e20285..e215bf2eabab835fa2be2021a1cd8a5e61627288 100644 (file)
                                RelativePath="..\..\..\source\blender\makesrna\intern\rna_actuator.c"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\makesrna\intern\rna_animation.c"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\source\blender\makesrna\intern\rna_armature.c"\r
                                >\r
                                RelativePath="..\..\..\source\blender\makesrna\intern\rna_texture.c"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\makesrna\intern\rna_timeline.c"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\source\blender\makesrna\intern\rna_userdef.c"\r
                                >\r
index 5c3da3cead9e01c71352b0164513423cd12c1070..a0e4a87c630b8469bd0f314d8ccf6114a333c900 100644 (file)
                                RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_actuator_gen.c"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_animation_gen.c"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_armature_gen.c"\r
                                >\r
                                RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_texture_gen.c"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_timeline_gen.c"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\source\blender\makesrna\intern\rna.crna_userdef_gen.c"\r
                                >\r
index 53a628ed5ee7372f56c3e10a9c7f02111c6973c3..b759aae1c9ef011046c347f615388c58570835e8 100644 (file)
@@ -42,7 +42,7 @@
                        <Tool\r
                                Name="VCCLCompilerTool"\r
                                Optimization="0"\r
-                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\build\msvc_9\extern\solid\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Ketsji;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\ode;..\..\..\source\gameengine\SceneGraph;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\BlenderRoutines;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\source\gameengine\rasterizer\ras_openglrasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\gameengine\soundsystem\snd_blenderwavecache;..\..\..\source\sumo\include;..\..\..\source\sumo\Fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\gpu"\r
+                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\build\msvc_9\extern\solid\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Ketsji;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\ode;..\..\..\source\gameengine\SceneGraph;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\BlenderRoutines;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\source\gameengine\rasterizer\ras_openglrasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\gameengine\soundsystem\snd_blenderwavecache;..\..\..\source\sumo\include;..\..\..\source\sumo\Fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\gpu"\r
                                PreprocessorDefinitions="WIN32,_LIB,_DEBUG"\r
                                BasicRuntimeChecks="3"\r
                                RuntimeLibrary="3"\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
                                InlineFunctionExpansion="1"\r
-                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\build\msvc_9\extern\solid\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Ketsji;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\ode;..\..\..\source\gameengine\SceneGraph;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\BlenderRoutines;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\source\gameengine\rasterizer\ras_openglrasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\gameengine\soundsystem\snd_blenderwavecache;..\..\..\source\sumo\include;..\..\..\source\sumo\Fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\gpu"\r
+                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\build\msvc_9\extern\solid\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Ketsji;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\ode;..\..\..\source\gameengine\SceneGraph;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\BlenderRoutines;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\source\gameengine\rasterizer\ras_openglrasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\gameengine\soundsystem\snd_blenderwavecache;..\..\..\source\sumo\include;..\..\..\source\sumo\Fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\gpu"\r
                                PreprocessorDefinitions="NDEBUG,WIN32,_LIB,USE_SUMO_SOLID"\r
                                StringPooling="true"\r
                                RuntimeLibrary="0"\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
                                Optimization="0"\r
-                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\build\msvc_9\extern\solid\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Ketsji;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\ode;..\..\..\source\gameengine\SceneGraph;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\BlenderRoutines;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\source\gameengine\rasterizer\ras_openglrasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\gameengine\soundsystem\snd_blenderwavecache;..\..\..\source\sumo\include;..\..\..\source\sumo\Fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\gpu"\r
+                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\build\msvc_9\extern\solid\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Ketsji;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\ode;..\..\..\source\gameengine\SceneGraph;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\BlenderRoutines;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\source\gameengine\rasterizer\ras_openglrasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\gameengine\soundsystem\snd_blenderwavecache;..\..\..\source\sumo\include;..\..\..\source\sumo\Fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\gpu"\r
                                PreprocessorDefinitions="WIN32,_LIB,_DEBUG"\r
                                BasicRuntimeChecks="3"\r
                                RuntimeLibrary="1"\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
                                InlineFunctionExpansion="1"\r
-                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\build\msvc_9\extern\solid\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Ketsji;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\ode;..\..\..\source\gameengine\SceneGraph;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\BlenderRoutines;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\source\gameengine\rasterizer\ras_openglrasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\gameengine\soundsystem\snd_blenderwavecache;..\..\..\source\sumo\include;..\..\..\source\sumo\Fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\gpu"\r
+                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\build\msvc_9\extern\solid\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Ketsji;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\ode;..\..\..\source\gameengine\SceneGraph;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\BlenderRoutines;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\source\gameengine\rasterizer\ras_openglrasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\gameengine\soundsystem\snd_blenderwavecache;..\..\..\source\sumo\include;..\..\..\source\sumo\Fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\gpu"\r
                                PreprocessorDefinitions="NDEBUG,WIN32,_LIB,USE_SUMO_SOLID"\r
                                StringPooling="true"\r
                                RuntimeLibrary="2"\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
                                Optimization="0"\r
-                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\build\msvc_9\extern\solid\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Ketsji;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\ode;..\..\..\source\gameengine\SceneGraph;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\BlenderRoutines;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\source\gameengine\rasterizer\ras_openglrasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\gameengine\soundsystem\snd_blenderwavecache;..\..\..\source\sumo\include;..\..\..\source\sumo\Fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\gpu"\r
+                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\build\msvc_9\extern\solid\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Ketsji;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\ode;..\..\..\source\gameengine\SceneGraph;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\BlenderRoutines;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\source\gameengine\rasterizer\ras_openglrasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\gameengine\soundsystem\snd_blenderwavecache;..\..\..\source\sumo\include;..\..\..\source\sumo\Fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\gpu"\r
                                PreprocessorDefinitions="WIN32,_LIB,_DEBUG"\r
                                BasicRuntimeChecks="3"\r
                                RuntimeLibrary="1"\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
                                InlineFunctionExpansion="1"\r
-                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\build\msvc_9\extern\solid\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Ketsji;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\ode;..\..\..\source\gameengine\SceneGraph;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\BlenderRoutines;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\source\gameengine\rasterizer\ras_openglrasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\gameengine\soundsystem\snd_blenderwavecache;..\..\..\source\sumo\include;..\..\..\source\sumo\Fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\gpu"\r
+                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\build\msvc_9\extern\solid\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Ketsji;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\ode;..\..\..\source\gameengine\SceneGraph;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\BlenderRoutines;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\source\gameengine\rasterizer\ras_openglrasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\gameengine\soundsystem\snd_blenderwavecache;..\..\..\source\sumo\include;..\..\..\source\sumo\Fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\gpu"\r
                                PreprocessorDefinitions="NDEBUG,WIN32,_LIB,USE_SUMO_SOLID"\r
                                StringPooling="true"\r
                                RuntimeLibrary="0"\r
diff --git a/release/datafiles/bmonofont.ttf b/release/datafiles/bmonofont.ttf
new file mode 100644 (file)
index 0000000..e95786a
Binary files /dev/null and b/release/datafiles/bmonofont.ttf differ
index 1485f0881b2dceadb89f7e3cfbd6e21f156ca731..0e96bf8ceb135c6db6e62e33d48e98a6dd0a8b6b 100644 (file)
@@ -29,6 +29,8 @@
 #ifndef BLF_API_H
 #define BLF_API_H
 
+struct rctf;
+
 int BLF_init(void);
 void BLF_exit(void);
 
@@ -41,7 +43,7 @@ void BLF_position(float x, float y, float z);
 void BLF_size(int size, int dpi);
 void BLF_draw(char *str);
 
-void BLF_boundbox(char *str, rctf *box);
+void BLF_boundbox(char *str, struct rctf *box);
 float BLF_width(char *str);
 float BLF_height(char *str);
 void BLF_rotation(float angle);
@@ -83,8 +85,7 @@ char **BLF_dir_get(int *ndir);
 void BLF_dir_free(char **dirs, int count);
 
 /* font->flags. */
-#define BLF_ASPECT (1<<0)
-#define BLF_ROTATION (1<<1)
-#define BLF_CLIPPING (1<<2)
+#define BLF_ROTATION (1<<0)
+#define BLF_CLIPPING (1<<1)
 
 #endif /* BLF_API_H */
index 42ccfc8e2edeed37e8eeca1b2a3ba45a0dc6dc12..85797c3c23b8a058fdf5f7295e4db8b5026b3642 100644 (file)
@@ -12,11 +12,11 @@ incs += ' ' + env['BF_GETTEXT_INC']
 
 defs = ''
 
-if env['WITH_BF_INTERNATIONAL']:
-       defs += ' WITH_FREETYPE2'
-
-defs = 'FTGL_STATIC_LIBRARY'
+defs += 'FTGL_STATIC_LIBRARY'
 if sys.platform == 'win32':
        defs += ' _WIN32 USE_GETTEXT_DLL'
 
+if env['WITH_BF_INTERNATIONAL']:
+       defs += ' WITH_FREETYPE2'
+
 env.BlenderLib ( 'bf_blenfont', sources, Split(incs), Split(defs), libtype=['core'], priority=[210] )
index 5b39c2c8ae52bf00558eed9532bc60f66f8c7d45..43c85b78977094bf678a27a094880b3b02abd048 100644 (file)
@@ -58,7 +58,6 @@
 #include "blf_internal_types.h"
 #include "blf_internal.h"
 
-#ifdef WITH_FREETYPE2
 
 /* Max number of font in memory.
  * Take care that now every font have a glyph cache per size/dpi,
@@ -76,41 +75,33 @@ int global_font_num= 0;
 /* Current font. */
 int global_font_cur= 0;
 
-#endif /* WITH_FREETYPE2 */
 
 int BLF_init(void)
 {
-#ifdef WITH_FREETYPE2
        int i;
 
        for (i= 0; i < BLF_MAX_FONT; i++)
                global_font[i]= NULL;
 
        return(blf_font_init());
-#else
-       return(0);
-#endif
 }
 
 void BLF_exit(void)
 {
-#ifdef WITH_FREETYPE2
        FontBLF *font;
        int i;
 
        for (i= 0; i < global_font_num; i++) {
                font= global_font[i];
-               if(font)
-                       blf_font_free(font);
+               if(font && font->free)
+                       (*font->free)(font);
        }
 
        blf_font_exit();
-#endif
 }
 
 int blf_search(char *name)
 {
-#ifdef WITH_FREETYPE2
        FontBLF *font;
        int i;
 
@@ -119,13 +110,11 @@ int blf_search(char *name)
                if (font && (!strcmp(font->name, name)))
                        return(i);
        }
-#endif
        return(-1);
 }
 
 int BLF_load(char *name)
 {
-#ifdef WITH_FREETYPE2
        FontBLF *font;
        char *filename;
        int i;
@@ -153,6 +142,7 @@ int BLF_load(char *name)
                return(-1);
        }
 
+#ifdef WITH_FREETYPE2
        font= blf_font_new(name, filename);
        MEM_freeN(filename);
 
@@ -165,14 +155,13 @@ int BLF_load(char *name)
        i= global_font_num;
        global_font_num++;
        return(i);
-#else
-       return(-1);
 #endif /* WITH_FREETYPE2 */
+
+       return(-1);
 }
 
 int BLF_load_mem(char *name, unsigned char *mem, int mem_size)
 {
-#ifdef WITH_FREETYPE2
        FontBLF *font;
        int i;
 
@@ -192,6 +181,7 @@ int BLF_load_mem(char *name, unsigned char *mem, int mem_size)
                return(-1);
        }
 
+#ifdef WITH_FREETYPE2
        font= blf_font_new_from_mem(name, mem, mem_size);
        if (!font) {
                printf("Can't load font, %s from memory!!\n", name);
@@ -202,177 +192,146 @@ int BLF_load_mem(char *name, unsigned char *mem, int mem_size)
        i= global_font_num;
        global_font_num++;
        return(i);
-#else
-       return(-1);
 #endif /* WITH_FREETYPE2 */
+       return(-1);
 }
 
 void BLF_set(int fontid)
 {
-#ifdef WITH_FREETYPE2
        if (fontid >= 0 && fontid < BLF_MAX_FONT)
                global_font_cur= fontid;
-#endif
 }
 
 void BLF_enable(int option)
 {
-#ifdef WITH_FREETYPE2
        FontBLF *font;
 
        font= global_font[global_font_cur];
        if (font)
                font->flags |= option;
-#endif
 }
 
 void BLF_disable(int option)
 {
-#ifdef WITH_FREETYPE2
        FontBLF *font;
 
        font= global_font[global_font_cur];
        if (font)
                font->flags &= ~option;
-#endif
 }
 
 void BLF_aspect(float aspect)
 {
-#ifdef WITH_FREETYPE2
        FontBLF *font;
 
        font= global_font[global_font_cur];
        if (font)
                font->aspect= aspect;
-#endif
 }
 
 void BLF_position(float x, float y, float z)
 {
-#ifdef WITH_FREETYPE2
        FontBLF *font;
-       float remainder, aspect;
+       float remainder;
 
        font= global_font[global_font_cur];
        if (font) {
-               if (font->flags & BLF_ASPECT)
-                       aspect= font->aspect;
-               else
-                       aspect= 1.0f;
-
                remainder= x - floor(x);
                if (remainder > 0.4 && remainder < 0.6) {
                        if (remainder < 0.5)
-                               x -= 0.1 * aspect;
+                               x -= 0.1 * font->aspect;
                        else
-                               x += 0.1 * aspect;
+                               x += 0.1 * font->aspect;
                }
 
                remainder= y - floor(y);
                if (remainder > 0.4 && remainder < 0.6) {
                        if (remainder < 0.5)
-                               y -= 0.1 * aspect;
+                               y -= 0.1 * font->aspect;
                        else
-                               y += 0.1 * aspect;
+                               y += 0.1 * font->aspect;
                }
 
                font->pos[0]= x;
                font->pos[1]= y;
                font->pos[2]= z;
        }
-#endif
 }
 
 void BLF_size(int size, int dpi)
 {
-#ifdef WITH_FREETYPE2
        FontBLF *font;
 
        font= global_font[global_font_cur];
-       if (font)
-               blf_font_size(font, size, dpi);
-#endif
+       if (font && font->size_set)
+               (*font->size_set)(font, size, dpi);
 }
 
 void BLF_draw(char *str)
 {
-#ifdef WITH_FREETYPE2
        FontBLF *font;
 
        font= global_font[global_font_cur];
-       if (font && font->glyph_cache) {
+       if (font && font->draw && font->glyph_cache) {
                glEnable(GL_BLEND);
                glEnable(GL_TEXTURE_2D);
                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
                glPushMatrix();
                glTranslatef(font->pos[0], font->pos[1], font->pos[2]);
-
-               if (font->flags & BLF_ASPECT)
-                       glScalef(font->aspect, font->aspect, 1.0);
+               glScalef(font->aspect, font->aspect, 1.0);
 
                if (font->flags & BLF_ROTATION)
                        glRotatef(font->angle, 0.0f, 0.0f, 1.0f);
 
-               blf_font_draw(font, str);
+               (*font->draw)(font, str);
 
                glPopMatrix();
                glDisable(GL_BLEND);
                glDisable(GL_TEXTURE_2D);
        }
-#endif /* WITH_FREETYPE2 */
 }
 
 void BLF_boundbox(char *str, rctf *box)
 {
-#ifdef WITH_FREETYPE2
        FontBLF *font;
 
        font= global_font[global_font_cur];
-       if (font && font->glyph_cache)
-               blf_font_boundbox(font, str, box);
-#endif
+       if (font && font->boundbox_get && font->glyph_cache)
+               (*font->boundbox_get)(font, str, box);
 }
 
 float BLF_width(char *str)
 {
-#ifdef WITH_FREETYPE2
        FontBLF *font;
 
        font= global_font[global_font_cur];
-       if (font && font->glyph_cache)
-               return(blf_font_width(font, str));
-#endif
+       if (font && font->width_get && font->glyph_cache)
+               return((*font->width_get)(font, str));
        return(0.0f);
 }
 
 float BLF_height(char *str)
 {
-#ifdef WITH_FREETYPE2
        FontBLF *font;
 
        font= global_font[global_font_cur];
-       if (font && font->glyph_cache)
-               return(blf_font_height(font, str));
-#endif
+       if (font && font->height_get && font->glyph_cache)
+               return((*font->height_get)(font, str));
        return(0.0f);
 }
 
 void BLF_rotation(float angle)
 {
-#ifdef WITH_FREETYPE2
        FontBLF *font;
 
        font= global_font[global_font_cur];
        if (font)
                font->angle= angle;
-#endif
 }
 
 void BLF_clipping(float xmin, float ymin, float xmax, float ymax)
 {
-#ifdef WITH_FREETYPE2
        FontBLF *font;
 
        font= global_font[global_font_cur];
@@ -382,5 +341,4 @@ void BLF_clipping(float xmin, float ymin, float xmax, float ymax)
                font->clip_rec.xmax= xmax;
                font->clip_rec.ymax= ymax;
        }
-#endif
 }
index 44847e727278bea5bf9cb81acc7bcc8b4c5ac2d8..a80e97327f3d6cdb20a99f4e8fb359353db419f4 100644 (file)
@@ -73,85 +73,12 @@ void blf_font_exit(void)
        FT_Done_FreeType(global_ft_lib);
 }
 
-void blf_font_fill(FontBLF *font)
-{
-       font->ref= 1;
-       font->aspect= 1.0f;
-       font->pos[0]= 0.0f;
-       font->pos[1]= 0.0f;
-       font->angle= 0.0f;
-       Mat4One(font->mat);
-       font->clip_rec.xmin= 0.0f;
-       font->clip_rec.xmax= 0.0f;
-       font->clip_rec.ymin= 0.0f;
-       font->clip_rec.ymax= 0.0f;
-       font->flags= 0;
-       font->dpi= 0;
-       font->size= 0;
-       font->cache.first= NULL;
-       font->cache.last= NULL;
-       font->glyph_cache= NULL;
-       glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&font->max_tex_size);
-}
-
-FontBLF *blf_font_new(char *name, char *filename)
-{
-       FontBLF *font;
-       FT_Error err;
-
-       font= (FontBLF *)MEM_mallocN(sizeof(FontBLF), "blf_font_new");
-       err= FT_New_Face(global_ft_lib, filename, 0, &font->face);
-       if (err) {
-               MEM_freeN(font);
-               return(NULL);
-       }
-
-       err= FT_Select_Charmap(font->face, ft_encoding_unicode);
-       if (err) {
-               printf("Can't set the unicode character map!\n");
-               FT_Done_Face(font->face);
-               MEM_freeN(font);
-               return(NULL);
-       }
-
-       font->name= BLI_strdup(name);
-       font->filename= BLI_strdup(filename);
-       blf_font_fill(font);
-       return(font);
-}
-
-FontBLF *blf_font_new_from_mem(char *name, unsigned char *mem, int mem_size)
-{
-       FontBLF *font;
-       FT_Error err;
-
-       font= (FontBLF *)MEM_mallocN(sizeof(FontBLF), "blf_font_new_from_mem");
-       err= FT_New_Memory_Face(global_ft_lib, mem, mem_size, 0, &font->face);
-       if (err) {
-               MEM_freeN(font);
-               return(NULL);
-       }
-
-       err= FT_Select_Charmap(font->face, ft_encoding_unicode);
-       if (err) {
-               printf("Can't set the unicode character map!\n");
-               FT_Done_Face(font->face);
-               MEM_freeN(font);
-               return(NULL);
-       }
-
-       font->name= BLI_strdup(name);
-       font->filename= NULL;
-       blf_font_fill(font);
-       return(font);
-}
-
 void blf_font_size(FontBLF *font, int size, int dpi)
 {
        GlyphCacheBLF *gc;
        FT_Error err;
-       
-       err= FT_Set_Char_Size(font->face, 0, (size * 64), dpi, dpi);
+
+       err= FT_Set_Char_Size((FT_Face)font->engine, 0, (size * 64), dpi, dpi);
        if (err) {
                /* FIXME: here we can go through the fixed size and choice a close one */
                printf("The current font don't support the size, %d and dpi, %d\n", size, dpi);
@@ -178,23 +105,26 @@ void blf_font_draw(FontBLF *font, char *str)
        unsigned int c;
        GlyphBLF *g, *g_prev;
        FT_Vector delta;
-       FT_UInt glyph_index;
+       FT_Face face;
+       FT_UInt glyph_index, g_prev_index;
        int pen_x, pen_y;
        int i, has_kerning;
 
+       face= (FT_Face)font->engine;
        i= 0;
        pen_x= 0;
        pen_y= 0;
-       has_kerning= FT_HAS_KERNING(font->face);
+       has_kerning= FT_HAS_KERNING(face);
        g_prev= NULL;
+       g_prev_index= 0;
 
        while (str[i]) {
                c= blf_utf8_next((unsigned char *)str, &i);
                if (c == 0)
                        break;
 
-               glyph_index= FT_Get_Char_Index(font->face, c);
-               g= blf_glyph_search(font->glyph_cache, glyph_index);
+               glyph_index= FT_Get_Char_Index(face, c);
+               g= blf_glyph_search(font->glyph_cache, c);
                if (!g)
                        g= blf_glyph_add(font, glyph_index, c);
 
@@ -206,7 +136,7 @@ void blf_font_draw(FontBLF *font, char *str)
                        delta.x= 0;
                        delta.y= 0;
 
-                       FT_Get_Kerning(font->face, g_prev->index, glyph_index, FT_KERNING_UNFITTED, &delta);
+                       FT_Get_Kerning(face, g_prev_index, glyph_index, FT_KERNING_UNFITTED, &delta);
                        pen_x += delta.x >> 6;
                }
 
@@ -216,6 +146,7 @@ void blf_font_draw(FontBLF *font, char *str)
 
                pen_x += g->advance;
                g_prev= g;
+               g_prev_index= glyph_index;
        }
 }
 
@@ -224,11 +155,13 @@ void blf_font_boundbox(FontBLF *font, char *str, rctf *box)
        unsigned int c;
        GlyphBLF *g, *g_prev;
        FT_Vector delta;
-       FT_UInt glyph_index;
+       FT_UInt glyph_index, g_prev_index;
+       FT_Face face;
        rctf gbox;
        int pen_x, pen_y;
        int i, has_kerning;
 
+       face= (FT_Face)font->engine;
        box->xmin= 32000.0f;
        box->xmax= -32000.0f;
        box->ymin= 32000.0f;
@@ -237,16 +170,17 @@ void blf_font_boundbox(FontBLF *font, char *str, rctf *box)
        i= 0;
        pen_x= 0;
        pen_y= 0;
-       has_kerning= FT_HAS_KERNING(font->face);
+       has_kerning= FT_HAS_KERNING(face);
        g_prev= NULL;
+       g_prev_index= 0;
 
        while (str[i]) {
                c= blf_utf8_next((unsigned char *)str, &i);
                if (c == 0)
                        break;
 
-               glyph_index= FT_Get_Char_Index(font->face, c);
-               g= blf_glyph_search(font->glyph_cache, glyph_index);
+               glyph_index= FT_Get_Char_Index(face, c);
+               g= blf_glyph_search(font->glyph_cache, c);
                if (!g)
                        g= blf_glyph_add(font, glyph_index, c);
 
@@ -258,7 +192,7 @@ void blf_font_boundbox(FontBLF *font, char *str, rctf *box)
                        delta.x= 0;
                        delta.y= 0;
 
-                       FT_Get_Kerning(font->face, g_prev->index, glyph_index, FT_KERNING_UNFITTED, &delta);
+                       FT_Get_Kerning(face, g_prev_index, glyph_index, FT_KERNING_UNFITTED, &delta);
                        pen_x += delta.x >> 6;
                }
 
@@ -279,6 +213,7 @@ void blf_font_boundbox(FontBLF *font, char *str, rctf *box)
 
                pen_x += g->advance;
                g_prev= g;
+               g_prev_index= glyph_index;
        }
 
        if (box->xmin > box->xmax) {
@@ -291,30 +226,18 @@ void blf_font_boundbox(FontBLF *font, char *str, rctf *box)
 
 float blf_font_width(FontBLF *font, char *str)
 {
-       float aspect;
        rctf box;
 
-       if (font->flags & BLF_ASPECT)
-               aspect= font->aspect;
-       else
-               aspect= 1.0f;
-
        blf_font_boundbox(font, str, &box);
-       return((box.xmax - box.xmin) * aspect);
+       return((box.xmax - box.xmin) * font->aspect);
 }
 
 float blf_font_height(FontBLF *font, char *str)
 {
-       float aspect;
        rctf box;
 
-       if (font->flags & BLF_ASPECT)
-               aspect= font->aspect;
-       else
-               aspect= 1.0f;
-
        blf_font_boundbox(font, str, &box);
-       return((box.ymax - box.ymin) * aspect);
+       return((box.ymax - box.ymin) * font->aspect);
 }
 
 void blf_font_free(FontBLF *font)
@@ -328,7 +251,7 @@ void blf_font_free(FontBLF *font)
                blf_glyph_cache_free(gc);
        }
 
-       FT_Done_Face(font->face);
+       FT_Done_Face((FT_Face)font->engine);
        if (font->filename)
                MEM_freeN(font->filename);
        if (font->name)
@@ -336,4 +259,94 @@ void blf_font_free(FontBLF *font)
        MEM_freeN(font);
 }
 
+void blf_font_fill(FontBLF *font)
+{
+       font->type= BLF_FONT_FREETYPE2;
+       font->ref= 1;
+       font->aspect= 1.0f;
+       font->pos[0]= 0.0f;
+       font->pos[1]= 0.0f;
+       font->angle= 0.0f;
+       Mat4One(font->mat);
+       font->clip_rec.xmin= 0.0f;
+       font->clip_rec.xmax= 0.0f;
+       font->clip_rec.ymin= 0.0f;
+       font->clip_rec.ymax= 0.0f;
+       font->flags= 0;
+       font->dpi= 0;
+       font->size= 0;
+       font->cache.first= NULL;
+       font->cache.last= NULL;
+       font->glyph_cache= NULL;
+       glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&font->max_tex_size);
+
+       font->size_set= blf_font_size;
+       font->draw= blf_font_draw;
+       font->boundbox_get= blf_font_boundbox;
+       font->width_get= blf_font_width;
+       font->height_get= blf_font_height;
+       font->free= blf_font_free;
+}
+
+FontBLF *blf_font_new(char *name, char *filename)
+{
+       FontBLF *font;
+       FT_Error err;
+       FT_Face face;
+
+       err= FT_New_Face(global_ft_lib, filename, 0, &face);
+       if (err)
+               return(NULL);
+
+       err= FT_Select_Charmap(face, ft_encoding_unicode);
+       if (err) {
+               printf("Can't set the unicode character map!\n");
+               FT_Done_Face(face);
+               return(NULL);
+       }
+
+       font= (FontBLF *)MEM_mallocN(sizeof(FontBLF), "blf_font_new");
+       font->name= BLI_strdup(name);
+       font->filename= BLI_strdup(filename);
+       font->engine= (void *)face;
+       blf_font_fill(font);
+       return(font);
+}
+
+FontBLF *blf_font_new_from_mem(char *name, unsigned char *mem, int mem_size)
+{
+       FontBLF *font;
+       FT_Error err;
+       FT_Face face;
+
+       err= FT_New_Memory_Face(global_ft_lib, mem, mem_size, 0, &face);
+       if (err)
+               return(NULL);
+
+       err= FT_Select_Charmap(face, ft_encoding_unicode);
+       if (err) {
+               printf("Can't set the unicode character map!\n");
+               FT_Done_Face(face);
+               return(NULL);
+       }
+
+       font= (FontBLF *)MEM_mallocN(sizeof(FontBLF), "blf_font_new_from_mem");
+       font->name= BLI_strdup(name);
+       font->filename= NULL;
+       font->engine= (void *)face;
+       blf_font_fill(font);
+       return(font);
+}
+
+#else /* !WITH_FREETYPE2 */
+
+int blf_font_init(void)
+{
+       return(0);
+}
+
+void blf_font_exit(void)
+{
+}
+
 #endif /* WITH_FREETYPE2 */
index 2bbdeb9ad328e19c51d2abc98722c6ad834bdfdd..7212deff8c8783c7630290e471cde88691549db1 100644 (file)
@@ -78,8 +78,10 @@ GlyphCacheBLF *blf_glyph_cache_find(FontBLF *font, int size, int dpi)
 GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font)
 {
        GlyphCacheBLF *gc;
+       FT_Face face;
        int i;
 
+       face= (FT_Face)font->engine;
        gc= (GlyphCacheBLF *)MEM_mallocN(sizeof(GlyphCacheBLF), "blf_glyph_cache_new");
        gc->next= NULL;
        gc->prev= NULL;
@@ -98,23 +100,23 @@ GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font)
        gc->y_offs= 0;
        gc->pad= 3;
 
-       gc->num_glyphs= font->face->num_glyphs;
-       gc->rem_glyphs= font->face->num_glyphs;
-       gc->ascender= ((float)font->face->size->metrics.ascender) / 64.0f;
-       gc->descender= ((float)font->face->size->metrics.descender) / 64.0f;
+       gc->num_glyphs= face->num_glyphs;
+       gc->rem_glyphs= face->num_glyphs;
+       gc->ascender= ((float)face->size->metrics.ascender) / 64.0f;
+       gc->descender= ((float)face->size->metrics.descender) / 64.0f;
 
-       if (FT_IS_SCALABLE(font->face)) {
-               gc->max_glyph_width= (float)((font->face->bbox.xMax - font->face->bbox.xMin) *
-                                       (((float)font->face->size->metrics.x_ppem) /
-                                        ((float)font->face->units_per_EM)));
+       if (FT_IS_SCALABLE(face)) {
+               gc->max_glyph_width= (float)((face->bbox.xMax - face->bbox.xMin) *
+                                       (((float)face->size->metrics.x_ppem) /
+                                        ((float)face->units_per_EM)));
 
-               gc->max_glyph_height= (float)((font->face->bbox.yMax - font->face->bbox.yMin) *
-                                       (((float)font->face->size->metrics.y_ppem) /
-                                        ((float)font->face->units_per_EM)));
+               gc->max_glyph_height= (float)((face->bbox.yMax - face->bbox.yMin) *
+                                       (((float)face->size->metrics.y_ppem) /
+                                        ((float)face->units_per_EM)));
        }
        else {
-               gc->max_glyph_width= ((float)font->face->size->metrics.max_advance) / 64.0f;
-               gc->max_glyph_height= ((float)font->face->size->metrics.height) / 64.0f;
+               gc->max_glyph_width= ((float)face->size->metrics.max_advance) / 64.0f;
+               gc->max_glyph_height= ((float)face->size->metrics.height) / 64.0f;
        }
 
        gc->p2_width= 0;
@@ -180,15 +182,15 @@ void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc)
        free((void *)buf);
 }
 
-GlyphBLF *blf_glyph_search(GlyphCacheBLF *gc, FT_UInt idx)
+GlyphBLF *blf_glyph_search(GlyphCacheBLF *gc, unsigned int c)
 {
        GlyphBLF *p;
        unsigned int key;
 
-       key= blf_hash(idx);
+       key= blf_hash(c);
        p= gc->bucket[key].first;
        while (p) {
-               if (p->index == idx)
+               if (p->c == c)
                        return(p);
                p= p->next;
        }
@@ -200,21 +202,23 @@ GlyphBLF *blf_glyph_add(FontBLF *font, FT_UInt index, unsigned int c)
        FT_GlyphSlot slot;
        GlyphCacheBLF *gc;
        GlyphBLF *g;
+       FT_Face face;
        FT_Error err;
        FT_Bitmap bitmap;
        FT_BBox bbox;
        unsigned int key;
 
-       g= blf_glyph_search(font->glyph_cache, index);
+       g= blf_glyph_search(font->glyph_cache, c);
        if (g)
                return(g);
 
-       err= FT_Load_Glyph(font->face, index, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP);
+       face= (FT_Face)font->engine;
+       err= FT_Load_Glyph(face, index, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP);
        if (err)
                return(NULL);
 
        /* get the glyph. */
-       slot= font->face->glyph;
+       slot= face->glyph;
 
        err= FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL);
        if (err || slot->format != FT_GLYPH_FORMAT_BITMAP)
@@ -224,7 +228,6 @@ GlyphBLF *blf_glyph_add(FontBLF *font, FT_UInt index, unsigned int c)
        g->next= NULL;
        g->prev= NULL;
        g->c= c;
-       g->index= index;
 
        gc= font->glyph_cache;
        if (gc->cur_tex == -1) {
@@ -280,7 +283,7 @@ GlyphBLF *blf_glyph_add(FontBLF *font, FT_UInt index, unsigned int c)
        /* update the x offset for the next glyph. */
        gc->x_offs += (int)(g->box.xmax - g->box.xmin + gc->pad);
 
-       key= blf_hash(g->index);
+       key= blf_hash(g->c);
        BLI_addhead(&(gc->bucket[key]), g);
        gc->rem_glyphs--;
        return(g);
index 25df7e0e95ffb9e79f48a585b2cb434b7811c43c..d160df67f18b582f4d02d4bb9ccd07c8cceb4610 100644 (file)
@@ -35,26 +35,19 @@ int blf_utf8_next(unsigned char *buf, int *iindex);
 char *blf_dir_search(const char *file);
 int blf_dir_split(const char *str, char *file, int *size);
 
-#ifdef WITH_FREETYPE2
-
 int blf_font_init(void);
 void blf_font_exit(void);
 
+#ifdef WITH_FREETYPE2
+
 FontBLF *blf_font_new(char *name, char *filename);
 FontBLF *blf_font_new_from_mem(char *name, unsigned char *mem, int mem_size);
 
-void blf_font_free(FontBLF *font);
-void blf_font_size(FontBLF *font, int size, int dpi);
-void blf_font_draw(FontBLF *font, char *str);
-void blf_font_boundbox(FontBLF *font, char *str, rctf *box);
-float blf_font_width(FontBLF *font, char *str);
-float blf_font_height(FontBLF *font, char *str);
-
 GlyphCacheBLF *blf_glyph_cache_find(FontBLF *font, int size, int dpi);
 GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font);
 void blf_glyph_cache_free(GlyphCacheBLF *gc);
 
-GlyphBLF *blf_glyph_search(GlyphCacheBLF *gc, FT_UInt idx);
+GlyphBLF *blf_glyph_search(GlyphCacheBLF *gc, unsigned int c);
 GlyphBLF *blf_glyph_add(FontBLF *font, FT_UInt index, unsigned int c);
 
 void blf_glyph_free(GlyphBLF *g);
index ccfd5c64200f5874274415823b569201d385f151..7313eb97426ef3a04f7ba0b50cd06e8f4fc4ed85 100644 (file)
 #ifndef BLF_INTERNAL_TYPES_H
 #define BLF_INTERNAL_TYPES_H
 
-typedef struct DirBLF {
-       struct DirBLF *next;
-       struct DirBLF *prev;
-
-       /* full path where search fonts. */
-       char *path;
-} DirBLF;
-
-#ifdef WITH_FREETYPE2
-
 typedef struct GlyphCacheBLF {
        struct GlyphCacheBLF *next;
        struct GlyphCacheBLF *prev;
@@ -95,9 +85,6 @@ typedef struct GlyphBLF {
        /* and the character, as UTF8 */
        unsigned int c;
 
-       /* Freetype2 index. */
-       FT_UInt index;
-
        /* texture id where this glyph is store. */
        GLuint tex;
 
@@ -133,6 +120,9 @@ typedef struct FontBLF {
        /* filename or NULL. */
        char *filename;
 
+       /* font type, can be freetype2 or internal. */
+       int type;
+
        /* reference count. */
        int ref;
 
@@ -163,17 +153,31 @@ typedef struct FontBLF {
        /* font options. */
        int flags;
 
-       /* freetype2 face. */
-       FT_Face face;
-
        /* list of glyph cache for this font. */
        ListBase cache;
 
        /* current glyph cache, size and dpi. */
        GlyphCacheBLF *glyph_cache;
+
+       /* engine data. */
+       void *engine;
+
+       /* engine functions. */
+       void (*size_set)(struct FontBLF *, int, int);
+       void (*draw)(struct FontBLF *, char *);
+       void (*boundbox_get)(struct FontBLF *, char *, rctf *);
+       float (*width_get)(struct FontBLF *, char *);
+       float (*height_get)(struct FontBLF *, char *);
+       void (*free)(struct FontBLF *);
 } FontBLF;
 
-#endif /* WITH_FREETYPE2 */
+typedef struct DirBLF {
+       struct DirBLF *next;
+       struct DirBLF *prev;
+
+       /* full path where search fonts. */
+       char *path;
+} DirBLF;
 
 typedef struct LangBLF {
        struct LangBLF *next;
@@ -193,4 +197,8 @@ typedef struct LangBLF {
 #define BLF_CLIP_DISABLE 0
 #define BLF_CLIP_OUT 1
 
+/* font->type */
+#define BLF_FONT_FREETYPE2 0
+#define BLF_FONT_INTERNAL 1
+
 #endif /* BLF_INTERNAL_TYPES_H */
index eba7558d4920dfdf491afc5e2e83c61dfcc44771..4146d313d415ea117be49cdd05e210618e503811 100644 (file)
@@ -85,8 +85,8 @@ void brush_painter_free(BrushPainter *painter);
 unsigned int *brush_gen_texture_cache(struct Brush *br, int half_side);
 
 /* radial control */
-void brush_radial_control_invoke(struct wmOperator *op, struct Brush *br);
-int brush_radial_control_exec(struct wmOperator *op, struct Brush *br);
+void brush_radial_control_invoke(struct wmOperator *op, struct Brush *br, float size_weight);
+int brush_radial_control_exec(struct wmOperator *op, struct Brush *br, float size_weight);
 
 #endif
 
index a95b436d016c7bfa3359a2e6d02b3388c16507f4..e384900e0cb77a3d9b6ca93a96a871ad7c21e9a3 100644 (file)
@@ -50,11 +50,14 @@ struct RegionView3D;
 struct StructRNA;
 struct ToolSettings;
 struct Image;
+struct Text;
 struct ImBuf;
 struct EditBone;
 struct bPoseChannel;
 struct wmWindow;
 struct wmWindowManager;
+struct SpaceText;
+struct SpaceImage;
 
 /* Structs */
 
@@ -83,6 +86,8 @@ enum {
        CTX_DATA_EDIT_IMAGE,
        CTX_DATA_EDIT_IMAGE_BUFFER,
 
+       CTX_DATA_EDIT_TEXT,
+
        CTX_DATA_SELECTED_NODES,
        
        CTX_DATA_SELECTED_BONES,
@@ -132,12 +137,15 @@ struct wmWindow *CTX_wm_window(const bContext *C);
 struct bScreen *CTX_wm_screen(const bContext *C);
 struct ScrArea *CTX_wm_area(const bContext *C);
 struct SpaceLink *CTX_wm_space_data(const bContext *C);
-struct View3D *CTX_wm_view3d(const bContext *C);
-struct RegionView3D *CTX_wm_region_view3d(const bContext *C);
 struct ARegion *CTX_wm_region(const bContext *C);
 void *CTX_wm_region_data(const bContext *C);
 struct uiBlock *CTX_wm_ui_block(const bContext *C);
 
+struct View3D *CTX_wm_view3d(const bContext *C);
+struct RegionView3D *CTX_wm_region_view3d(const bContext *C);
+struct SpaceText *CTX_wm_space_text(const bContext *C);
+struct SpaceImage *CTX_wm_space_image(const bContext *C);
+
 void CTX_wm_manager_set(bContext *C, struct wmWindowManager *wm);
 void CTX_wm_window_set(bContext *C, struct wmWindow *win);
 void CTX_wm_screen_set(bContext *C, struct bScreen *screen); /* to be removed */
@@ -196,6 +204,8 @@ struct Object *CTX_data_edit_object(const bContext *C);
 struct Image *CTX_data_edit_image(const bContext *C);
 struct ImBuf *CTX_data_edit_image_buffer(const bContext *C);
 
+struct Text *CTX_data_edit_text(const bContext *C);
+
 int CTX_data_selected_nodes(const bContext *C, ListBase *list);
 
 struct EditBone *CTX_data_active_bone(const bContext *C);
index dd5e0dd6e21c63936695d429fbff6c17071c813e..a8b1ad49648e3472d68c84df73ebb44e6730b4cf 100644 (file)
@@ -108,5 +108,26 @@ float evaluate_fcurve(struct FCurve *fcu, float evaltime);
 /* evaluate fcurve and store value */
 void calculate_fcurve(struct FCurve *fcu, float ctime);
 
+/* ************* F-Curve Samples API ******************** */
+
+/* -------- Defines --------  */
+
+/* Basic signature for F-Curve sample-creation function 
+ *     - fcu: the F-Curve being operated on
+ *     - data: pointer to some specific data that may be used by one of the callbacks
+ */
+typedef float (*FcuSampleFunc)(struct FCurve *fcu, void *data, float evaltime);
+
+/* ----- Sampling Callbacks ------  */
+
+/* Basic sampling callback which acts as a wrapper for evaluate_fcurve() */
+float fcurve_samplingcb_evalcurve(struct FCurve *fcu, void *data, float evaltime);
+
+/* -------- Main Methods --------  */
+
+/* Main API function for creating a set of sampled curve data, given some callback function 
+ * used to retrieve the values to store.
+ */
+void fcurve_store_samples(struct FCurve *fcu, void *data, int start, int end, FcuSampleFunc sample_cb);
 
 #endif /* BKE_FCURVE_H*/
index 616bf737889f77b4cd128bd80e151c96ae58b385..8bf6d91e325bf8e46196da507cceb696f418e270 100644 (file)
@@ -139,15 +139,20 @@ typedef struct ParticleUndo {
        char name[64];
 } ParticleUndo;
 
-typedef struct ParticleEdit{
+typedef struct ParticleEdit {
        ListBase undo;
        struct ParticleUndo *curundo;
-       struct KDTree *emitter_field;
+
        ParticleEditKey **keys;
+       int totkeys;
+
        int *mirror_cache;
+
+       struct KDTree *emitter_field;
        float *emitter_cosnos;
 
-       int totkeys;
+       char sel_col[3];
+       char nosel_col[3];
 } ParticleEdit;
 
 typedef struct ParticleThreadContext {
@@ -244,6 +249,7 @@ void psys_find_parents(struct Object *ob, struct ParticleSystemModifierData *psm
 
 void psys_cache_paths(struct Scene *scene, struct Object *ob, struct ParticleSystem *psys, float cfra, int editupdate);
 void psys_cache_child_paths(struct Scene *scene, struct Object *ob, struct ParticleSystem *psys, float cfra, int editupdate);
+void psys_update_world_cos(struct Object *ob, struct ParticleSystem *psys);
 int do_guide(struct Scene *scene, struct ParticleKey *state, int pa_num, float time, struct ListBase *lb);
 float psys_get_size(struct Object *ob, struct Material *ma, struct ParticleSystemModifierData *psmd, struct IpoCurve *icu_size, struct ParticleSystem *psys, struct ParticleSettings *part, struct ParticleData *pa, float *vg_size);
 float psys_get_timestep(struct ParticleSettings *part);
index 856abf74011d48f6232b92ad574db6e37299acf0..d288c0b651675c2f244ab19c3f0bc28d9102dd28 100644 (file)
@@ -47,8 +47,6 @@ int               reopen_text         (struct Text *text);
 struct Text*   add_text                (char *file, const char *relpath); 
 struct Text*   copy_text               (struct Text *ta);
 
-void   txt_free_cut_buffer     (void);
-
 char*  txt_to_buf                      (struct Text *text);
 void   txt_clean_text          (struct Text *text);
 void   txt_order_cursors       (struct Text *text);
@@ -70,14 +68,11 @@ void        txt_move_to                     (struct Text *text, unsigned int line, unsigned int ch, short
 void   txt_pop_sel                     (struct Text *text);
 void   txt_delete_char         (struct Text *text);
 void   txt_delete_word         (struct Text *text);
-void   txt_copy_sel            (struct Text *text);
+void   txt_delete_selected     (struct Text *text);
 void   txt_sel_all                     (struct Text *text);
 void   txt_sel_line            (struct Text *text);
-void   txt_print_cutbuffer     (void);
-void   txt_cut_sel                     (struct Text *text);
 char*  txt_sel_to_buf          (struct Text *text);
 void   txt_insert_buf          (struct Text *text, char *in_buffer);
-void   txt_paste                       (struct Text *text);
 void   txt_print_undo          (struct Text *text);
 void   txt_undo_add_toop       (struct Text *text, int op, unsigned int froml, unsigned short fromc, unsigned int tol, unsigned short toc);
 void   txt_do_undo                     (struct Text *text);
@@ -87,9 +82,6 @@ void  txt_backspace_char      (struct Text *text);
 void   txt_backspace_word      (struct Text *text);
 int            txt_add_char            (struct Text *text, char add);
 int            txt_replace_char        (struct Text *text, char add);
-void   find_and_replace        (struct SpaceText *st, short mode);
-void   run_python_script       (struct SpaceText *st);
-int    jumptoline_interactive  (struct SpaceText *st);
 void   txt_export_to_object    (struct Text *text);
 void   txt_export_to_objects(struct Text *text);
 void   unindent                (struct Text *text);
@@ -97,9 +89,6 @@ void  comment                 (struct Text *text);
 void   indent                  (struct Text *text);
 void   uncomment               (struct Text *text);
 int    setcurr_tab             (struct Text *text);
-void   convert_tabs            (struct SpaceText *st, int tab);
-void   txt_copy_clipboard      (struct Text *text);
-void   txt_paste_clipboard     (struct Text *text);
 
 void   txt_add_marker                                          (struct Text *text, struct TextLine *line, int start, int end, char color[4], int group, int flags);
 short  txt_clear_marker_region                         (struct Text *text, struct TextLine *line, int start, int end, int group, int flags);
@@ -152,10 +141,6 @@ struct TextMarker  *txt_next_marker_color  (struct Text *text, struct TextMarker *
 #define UNDO_COMMENT           034
 #define UNDO_UNCOMMENT         035
 
-/* Find and replace flags */
-#define TXT_FIND_WRAP          0x01
-#define TXT_FIND_ALLTEXTS      0x02
-
 /* Marker flags */
 #define TMARK_TEMP             0x01    /* Remove on non-editing events, don't save */
 #define TMARK_EDITALL  0x02    /* Edit all markers of the same group as one */
index ab453fb6f44eeb9eb454f446e23c2cd36ff375f9..e5dd9c2188dca9e1455840999c490315334b6ce0 100644 (file)
@@ -1053,13 +1053,13 @@ static struct ImBuf *brush_gen_radial_control_imbuf(Brush *br)
        return im;
 }
 
-void brush_radial_control_invoke(wmOperator *op, Brush *br)
+void brush_radial_control_invoke(wmOperator *op, Brush *br, float size_weight)
 {
        int mode = RNA_int_get(op->ptr, "mode");
        float original_value= 0;
 
        if(mode == WM_RADIALCONTROL_SIZE)
-               original_value = br->size;
+               original_value = br->size * size_weight;
        else if(mode == WM_RADIALCONTROL_STRENGTH)
                original_value = br->alpha;
        else if(mode == WM_RADIALCONTROL_ANGLE)
@@ -1069,14 +1069,14 @@ void brush_radial_control_invoke(wmOperator *op, Brush *br)
        op->customdata = brush_gen_radial_control_imbuf(br);
 }
 
-int brush_radial_control_exec(wmOperator *op, Brush *br)
+int brush_radial_control_exec(wmOperator *op, Brush *br, float size_weight)
 {
        int mode = RNA_int_get(op->ptr, "mode");
        float new_value = RNA_float_get(op->ptr, "new_value");
        const float conv = 0.017453293;
 
        if(mode == WM_RADIALCONTROL_SIZE)
-               br->size = new_value;
+               br->size = new_value * size_weight;
        else if(mode == WM_RADIALCONTROL_STRENGTH)
                br->alpha = new_value;
        else if(mode == WM_RADIALCONTROL_ANGLE)
index 07937d0a9011058233552f2c7cfa9b8eb1e24267..fc338e1bc954b6072801cc4a4b0010f670aab369 100644 (file)
@@ -164,6 +164,21 @@ SpaceLink *CTX_wm_space_data(const bContext *C)
        return (C->wm.area)? C->wm.area->spacedata.first: NULL;
 }
 
+ARegion *CTX_wm_region(const bContext *C)
+{
+       return C->wm.region;
+}
+
+void *CTX_wm_region_data(const bContext *C)
+{
+       return (C->wm.region)? C->wm.region->regiondata: NULL;
+}
+
+struct uiBlock *CTX_wm_ui_block(const bContext *C)
+{
+       return C->wm.block;
+}
+
 View3D *CTX_wm_view3d(const bContext *C)
 {
        if(C->wm.area && C->wm.area->spacetype==SPACE_VIEW3D)
@@ -179,19 +194,18 @@ RegionView3D *CTX_wm_region_view3d(const bContext *C)
        return NULL;
 }
 
-ARegion *CTX_wm_region(const bContext *C)
+struct SpaceText *CTX_wm_space_text(const bContext *C)
 {
-       return C->wm.region;
+       if(C->wm.area && C->wm.area->spacetype==SPACE_TEXT)
+               return C->wm.area->spacedata.first;
+       return NULL;
 }
 
-void *CTX_wm_region_data(const bContext *C)
+struct SpaceImage *CTX_wm_space_image(const bContext *C)
 {
-       return (C->wm.region)? C->wm.region->regiondata: NULL;
-}
-
-struct uiBlock *CTX_wm_ui_block(const bContext *C)
-{
-       return C->wm.block;
+       if(C->wm.area && C->wm.area->spacetype==SPACE_IMAGE)
+               return C->wm.area->spacedata.first;
+       return NULL;
 }
 
 void CTX_wm_manager_set(bContext *C, wmWindowManager *wm)
@@ -444,6 +458,11 @@ struct ImBuf *CTX_data_edit_image_buffer(const bContext *C)
        return ctx_data_pointer_get(C, CTX_DATA_EDIT_IMAGE_BUFFER);
 }
 
+struct Text *CTX_data_edit_text(const bContext *C)
+{
+       return ctx_data_pointer_get(C, CTX_DATA_EDIT_TEXT);
+}
+
 struct EditBone *CTX_data_active_bone(const bContext *C)
 {
        return ctx_data_pointer_get(C, CTX_DATA_ACTIVE_BONE);
index 7d7d98095c6977fc982cfdb35ad454a5128a7838..30cb40160612d017f56bd2be6d56d1dbe60f5f80 100644 (file)
@@ -108,7 +108,6 @@ void BKE_free_editfont(Curve *cu)
 /* don't free curve itself */
 void free_curve(Curve *cu)
 {
-
        freeNurblist(&cu->nurb);
        BLI_freelistN(&cu->bev);
        freedisplist(&cu->disp);
index 49d1b06d9a2bba4b4e373ebbe893d888db7c83f2..6f3cad7995cfffea1da8d1908c627f7d00170c07 100644 (file)
@@ -294,6 +294,61 @@ void bezt_add_to_cfra_elem (ListBase *lb, BezTriple *bezt)
        cen->sel= bezt->f2;
 }
 
+/* ***************************** Samples Utilities ******************************* */
+/* Some utilities for working with FPoints (i.e. 'sampled' animation curve data, such as
+ * data imported from BVH/Mocap files), which are specialised for use with high density datasets,
+ * which BezTriples/Keyframe data are ill equipped to do.
+ */
+/* Basic sampling callback which acts as a wrapper for evaluate_fcurve() 
+ *     'data' arg here is unneeded here...
+ */
+float fcurve_samplingcb_evalcurve (FCurve *fcu, void *data, float evaltime)
+{
+       /* assume any interference from drivers on the curve is intended... */
+       return evaluate_fcurve(fcu, evaltime);
+} 
+
+/* Main API function for creating a set of sampled curve data, given some callback function 
+ * used to retrieve the values to store.
+ */
+void fcurve_store_samples (FCurve *fcu, void *data, int start, int end, FcuSampleFunc sample_cb)
+{
+       FPoint *fpt, *new_fpt;
+       int cfra;
+       
+       /* sanity checks */
+       // TODO: make these tests report errors using reports not printf's
+       if ELEM(NULL, fcu, sample_cb) {
+               printf("Error: No F-Curve with F-Curve Modifiers to Bake\n");
+               return;
+       }
+       if (start >= end) {
+               printf("Error: Frame range for Sampled F-Curve creation is inappropriate \n");
+               return;
+       }
+       
+       /* set up sample data */
+       fpt= new_fpt= MEM_callocN(sizeof(FPoint)*(end-start+1), "FPoint Samples");
+       
+       /* use the sampling callback at 1-frame intervals from start to end frames */
+       for (cfra= start; cfra <= end; cfra++, fpt++) {
+               fpt->vec[0]= (float)cfra;
+               fpt->vec[1]= sample_cb(fcu, data, (float)cfra);
+       }
+       
+       /* free any existing sample/keyframe data on curve  */
+       if (fcu->bezt) MEM_freeN(fcu->bezt);
+       if (fcu->fpt) MEM_freeN(fcu->fpt);
+       
+       /* store the samples */
+       fcu->bezt= NULL;
+       fcu->fpt= new_fpt;
+       fcu->totvert= end - start + 1;
+}
+
 /* ***************************** F-Curve Sanity ********************************* */
 /* The functions here are used in various parts of Blender, usually after some editing
  * of keyframe data has occurred. They ensure that keyframe data is properly ordered and
@@ -1596,8 +1651,7 @@ void fcurve_free_modifiers (FCurve *fcu)
  */
 void fcurve_bake_modifiers (FCurve *fcu, int start, int end)
 {
-       FPoint *fpt, *new_fpt;
-       int cfra;
+       ChannelDriver *driver;
        
        /* sanity checks */
        // TODO: make these tests report errors using reports not printf's
@@ -1605,30 +1659,19 @@ void fcurve_bake_modifiers (FCurve *fcu, int start, int end)
                printf("Error: No F-Curve with F-Curve Modifiers to Bake\n");
                return;
        }
-       if (start >= end) {
-               printf("Error: Frame range for F-Curve Modifier Baking inappropriate \n");
-               return;
-       }
        
-       /* set up sample data */
-       fpt= new_fpt= MEM_callocN(sizeof(FPoint)*(end-start+1), "FPoint FModifier Samples");
+       /* temporarily, disable driver while we sample, so that they don't influence the outcome */
+       driver= fcu->driver;
+       fcu->driver= NULL;
        
-       /* sample the curve at 1-frame intervals from start to end frames 
-        *      - assume that any ChannelDriver possibly present did not interfere in any way
-        */
-       for (cfra= start; cfra <= end; cfra++, fpt++) {
-               fpt->vec[0]= (float)cfra;
-               fpt->vec[1]= evaluate_fcurve(fcu, (float)cfra);
-       }
+       /* bake the modifiers, by sampling the curve at each frame */
+       fcurve_store_samples(fcu, NULL, start, end, fcurve_samplingcb_evalcurve);
        
-       /* free any existing sample/keyframe data on curve, and all modifiers */
-       if (fcu->bezt) MEM_freeN(fcu->bezt);
-       if (fcu->fpt) MEM_freeN(fcu->fpt);
+       /* free the modifiers now */
        fcurve_free_modifiers(fcu);
        
-       /* store the samples */
-       fcu->fpt= new_fpt;
-       fcu->totvert= end - start + 1;
+       /* restore driver */
+       fcu->driver= driver;
 }
 
 /* ***************************** F-Curve - Evaluation ********************************* */
index 360e1905ce81e30d237cba25a7b9a85df464da32..53b805f5f4c7eb027ab5b0952f3ae7162ba2310a 100644 (file)
@@ -351,12 +351,16 @@ 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));
-       }
+       /* sanity check */
+       if(dest && source && dest!=source) {
        
-       free_libblock(&G.main->image, source);
+               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);
+       }
 }
 
 
index 440f83e6a4f8ac82c8da149f67b9f860ac81f503..dbb720fb0bc24903d289aa113e3d2f83dd9dde47 100644 (file)
@@ -39,6 +39,7 @@
 #include <math.h>
 #include <stdio.h>
 #include <string.h>
+#include <stddef.h>
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -743,6 +744,72 @@ static char *world_adrcodes_to_paths (int adrcode, int *array_index)
        return NULL;    
 }
 
+/* Particle Types */
+static char *particle_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 PART_CLUMP:
+                       return "settings.clump_factor";
+               case PART_AVE:
+                       return "settings.angular_velocity_factor";
+               case PART_SIZE:
+                       return "settings.particle_size";
+               case PART_DRAG:
+                       return "settings.drag_factor";
+               case PART_BROWN:
+                       return "settings.brownian_factor";
+               case PART_DAMP:
+                       return "settings.damp_factor";
+               case PART_LENGTH:
+                       return "settings.length";
+               case PART_GRAV_X:
+                       *array_index= 0; return "settings.acceleration";
+               case PART_GRAV_Y:
+                       *array_index= 1; return "settings.acceleration";
+               case PART_GRAV_Z:
+                       *array_index= 2; return "settings.acceleration";
+               case PART_KINK_AMP:
+                       return "settings.kink_amplitude";
+               case PART_KINK_FREQ:
+                       return "settings.kink_frequency";
+               case PART_KINK_SHAPE:
+                       return "settings.kink_shape";
+               case PART_BB_TILT:
+                       return "settings.billboard_tilt";
+               
+               /* PartDeflect needs to be sorted out properly in rna_object_force;
+                  If anyone else works on this, but is unfamiliar, these particular
+                       settings reference the particles of the system themselves
+                       being used as forces -- it will use the same rna structure
+                       as the similar object forces                            */
+               /*case PART_PD_FSTR:
+                       if (part->pd) poin= &(part->pd->f_strength);
+                       break;
+               case PART_PD_FFALL:
+                       if (part->pd) poin= &(part->pd->f_power);
+                       break;
+               case PART_PD_FMAXD:
+                       if (part->pd) poin= &(part->pd->maxdist);
+                       break;
+               case PART_PD2_FSTR:
+                       if (part->pd2) poin= &(part->pd2->f_strength);
+                       break;
+               case PART_PD2_FFALL:
+                       if (part->pd2) poin= &(part->pd2->f_power);
+                       break;
+               case PART_PD2_FMAXD:
+                       if (part->pd2) poin= &(part->pd2->maxdist);
+                       break;*/
+
+               }
+               
+       return NULL;    
+}
+
 /* ------- */
 
 /* Allocate memory for RNA-path for some property given a blocktype, adrcode, and 'root' parts of path
@@ -799,6 +866,9 @@ char *get_rna_access (int blocktype, int adrcode, char actname[], char constname
                
                case ID_WO: /* world */
                        propname= world_adrcodes_to_paths(adrcode, &dummy_index);
+
+               case ID_PA: /* particle */
+                       propname= particle_adrcodes_to_paths(adrcode, &dummy_index);
                        
                /* XXX problematic blocktypes */
                case ID_CU: /* curve */
@@ -970,12 +1040,65 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
        return cdriver;
 }
 
+/* Add F-Curve to the correct list 
+ *     - grpname is needed to be used as group name where relevant, and is usually derived from actname
+ */
+static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, char *grpname)
+{
+       /* If we're adding to an action, we will have groups to write to... */
+       if (groups && grpname) {
+               /* wrap the pointers given into a dummy action that we pass to the API func
+                * and extract the resultant lists...
+                */
+               bAction tmp_act;
+               bActionGroup *agrp= NULL;
+               
+               /* init the temp action */
+               //memset(&tmp_act, 0, sizeof(bAction)); // XXX only enable this line if we get errors
+               tmp_act.groups.first= groups->first;
+               tmp_act.groups.last= groups->last;
+               tmp_act.curves.first= list->first;
+               tmp_act.curves.last= list->last;
+               /* ... xxx, the other vars don't need to be filled in */
+               
+               /* get the group to use */
+               agrp= action_groups_find_named(&tmp_act, grpname);
+               if (agrp == NULL) {
+                       /* no matching group, so add one */
+                       if (agrp == NULL) {
+                               /* Add a new group, and make it active */
+                               agrp= MEM_callocN(sizeof(bActionGroup), "bActionGroup");
+                               
+                               agrp->flag = AGRP_SELECTED;
+                               BLI_snprintf(agrp->name, 64, grpname);
+                               
+                               BLI_addtail(&tmp_act.groups, agrp);
+                               BLI_uniquename(&tmp_act.groups, agrp, "Group", offsetof(bActionGroup, name), 64);
+                       }
+               }
+               
+               /* add F-Curve to group */
+               /* WARNING: this func should only need to look at the stuff we initialised, if not, things may crash */
+               action_groups_add_channel(&tmp_act, agrp, fcu);
+               
+               /* set the output lists based on the ones in the temp action */
+               groups->first= tmp_act.groups.first;
+               groups->last= tmp_act.groups.last;
+               list->first= tmp_act.curves.first;
+               list->last= tmp_act.curves.last;
+       }
+       else {
+               /* simply add the F-Curve to the end of the given list */
+               BLI_addtail(list, fcu);
+       }
+}
+
 /* Convert IPO-Curve to F-Curve (including Driver data), and free any of the old data that 
  * is not relevant, BUT do not free the IPO-Curve itself...
  *     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 void icu_to_fcurves (ListBase *list, IpoCurve *icu, char *actname, char *constname)
+static void icu_to_fcurves (ListBase *groups, ListBase *list, IpoCurve *icu, char *actname, char *constname)
 {
        AdrBit2Path *abp;
        FCurve *fcu;
@@ -1090,7 +1213,7 @@ static void icu_to_fcurves (ListBase *list, IpoCurve *icu, char *actname, char *
                        }
                        
                        /* add new F-Curve to list */
-                       BLI_addtail(list, fcurve);
+                       fcurve_add_to_list(groups, list, fcurve, actname);
                }
                
                /* free old data of curve now that it's no longer needed for converting any more curves */
@@ -1149,7 +1272,7 @@ static void icu_to_fcurves (ListBase *list, IpoCurve *icu, char *actname, char *
                }
                
                /* add new F-Curve to list */
-               BLI_addtail(list, fcu);
+               fcurve_add_to_list(groups, list, fcu, actname);
        }
 }
 
@@ -1159,7 +1282,7 @@ static void icu_to_fcurves (ListBase *list, IpoCurve *icu, char *actname, char *
  * 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_animato (Ipo *ipo, char actname[], char constname[], ListBase *anim, ListBase *drivers)
+static void ipo_to_animato (Ipo *ipo, char actname[], char constname[], ListBase *animgroups, ListBase *anim, ListBase *drivers)
 {
        IpoCurve *icu, *icn;
        
@@ -1191,14 +1314,14 @@ static void ipo_to_animato (Ipo *ipo, char actname[], char constname[], ListBase
                 * we figure out the best place to put the channel, then tell the curve-converter to just dump there
                 */
                if (icu->driver) {
-                       /* Blender 2.4x allowed empty drivers */
-                       if(icu->driver->ob || icu->driver->type == IPO_DRIVER_TYPE_PYTHON)
-                               icu_to_fcurves(drivers, icu, actname, constname);
+                       /* Blender 2.4x allowed empty drivers, but we don't now, since they cause more trouble than they're worth */
+                       if ((icu->driver->ob) || (icu->driver->type == IPO_DRIVER_TYPE_PYTHON))
+                               icu_to_fcurves(NULL, drivers, icu, actname, constname);
                        else
                                MEM_freeN(icu->driver);
                }
                else
-                       icu_to_fcurves(anim, icu, actname, constname);
+                       icu_to_fcurves(animgroups, anim, icu, actname, constname);
                
                /* free this IpoCurve now that it's been converted */
                BLI_freelinkN(&ipo->curve, icu);
@@ -1210,7 +1333,7 @@ static void ipo_to_animato (Ipo *ipo, char actname[], char constname[], ListBase
  * 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_animato (bAction *act, ListBase *curves, ListBase *drivers)
+static void action_to_animato (bAction *act, ListBase *groups, ListBase *curves, ListBase *drivers)
 {
        bActionChannel *achan, *achann;
        bConstraintChannel *conchan, *conchann;
@@ -1231,7 +1354,7 @@ static void action_to_animato (bAction *act, ListBase *curves, ListBase *drivers
                
                /* convert Action Channel's IPO data */
                if (achan->ipo) {
-                       ipo_to_animato(achan->ipo, achan->name, NULL, curves, drivers);
+                       ipo_to_animato(achan->ipo, achan->name, NULL, groups, curves, drivers);
                        achan->ipo->id.us--;
                        achan->ipo= NULL;
                }
@@ -1243,7 +1366,7 @@ static void action_to_animato (bAction *act, ListBase *curves, ListBase *drivers
                        
                        /* convert Constraint Channel's IPO data */
                        if (conchan->ipo) {
-                               ipo_to_animato(conchan->ipo, achan->name, conchan->name, curves, drivers);
+                               ipo_to_animato(conchan->ipo, achan->name, conchan->name, groups, curves, drivers);
                                conchan->ipo->id.us--;
                                conchan->ipo= NULL;
                        }
@@ -1287,7 +1410,8 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[])
        /* 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);
+       // XXX there shouldn't be any need for the groups, so don't supply pointer for that now... 
+       ipo_to_animato(ipo, actname, constname, NULL, &anim, &drivers);
        
        /* deal with animation first */
        if (anim.first) {
@@ -1329,7 +1453,7 @@ static void action_to_animdata (ID *id, bAction *act)
        }
        
        /* convert Action data */
-       action_to_animato(act, &adt->action->curves, &adt->drivers);
+       action_to_animato(act, &adt->action->groups, &adt->action->curves, &adt->drivers);
 }
 
 /* *************************************************** */
@@ -1406,10 +1530,9 @@ void do_versions_ipos_to_animato(Main *main)
                
                /* check PoseChannels for constraints with local data */
                if (ob->pose) {
-                       
                        /* Verify if there's AnimData block */
                        BKE_id_add_animdata(id);
-
+                       
                        for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
                                for (con= pchan->constraints.first; con; con= con->next) {
                                        /* if constraint has own IPO, convert add these to Object 
@@ -1433,6 +1556,9 @@ void do_versions_ipos_to_animato(Main *main)
                         * (NOTE: they're most likely to be drivers too) 
                         */
                        if (con->ipo) {
+                               /* Verify if there's AnimData block, just in case */
+                               BKE_id_add_animdata(id);
+                               
                                /* although this was the constraint's local IPO, we still need to provide con 
                                 * so that drivers can be added properly...
                                 */
@@ -1446,19 +1572,24 @@ void do_versions_ipos_to_animato(Main *main)
                }
                
                /* check constraint channels - we need to remove them anyway... */
-               for (conchan= ob->constraintChannels.first; conchan; conchan= conchann) {
-                       /* get pointer to next Constraint Channel */
-                       conchann= conchan->next;
+               if (ob->constraintChannels.first) {
+                       /* Verify if there's AnimData block */
+                       BKE_id_add_animdata(id);
                        
-                       /* convert Constraint Channel's IPO data */
-                       if (conchan->ipo) {
-                               ipo_to_animdata(id, conchan->ipo, NULL, conchan->name);
-                               conchan->ipo->id.us--;
-                               conchan->ipo= NULL;
+                       for (conchan= ob->constraintChannels.first; conchan; conchan= conchann) {
+                               /* get pointer to next Constraint Channel */
+                               conchann= conchan->next;
+                               
+                               /* convert Constraint Channel's IPO data */
+                               if (conchan->ipo) {
+                                       ipo_to_animdata(id, conchan->ipo, NULL, conchan->name);
+                                       conchan->ipo->id.us--;
+                                       conchan->ipo= NULL;
+                               }
+                               
+                               /* free Constraint Channel */
+                               BLI_freelinkN(&ob->constraintChannels, conchan);
                        }
-                       
-                       /* free Constraint Channel */
-                       BLI_freelinkN(&ob->constraintChannels, conchan);
                }
        }
        
@@ -1573,7 +1704,7 @@ void do_versions_ipos_to_animato(Main *main)
                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);
+               action_to_animato(act, &act->groups, &act->curves, &drivers);
        }
        
        /* ipo's */
@@ -1588,7 +1719,7 @@ void do_versions_ipos_to_animato(Main *main)
                        
                        /* 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);
+                       ipo_to_animato(ipo, NULL, NULL, NULL, &new_act->curves, &drivers);
                }
                
                /* clear fake-users, and set user-count to zero to make sure it is cleared on file-save */
@@ -1641,71 +1772,7 @@ void *get_ipo_poin (ID *id, IpoCurve *icu, int *type)
        *type= IPO_FLOAT;
 
        /* data is divided into 'blocktypes' based on ID-codes */
-       switch (GS(id->name)) {
-               case ID_PA: /* particle channels -----------------------------  */
-               {
-                       ParticleSettings *part= (ParticleSettings *)id;
-                       
-                       switch (icu->adrcode) {
-                       case PART_EMIT_FREQ:
-                       case PART_EMIT_LIFE:
-                       case PART_EMIT_VEL:
-                       case PART_EMIT_AVE:
-                       case PART_EMIT_SIZE:
-                               poin= NULL; 
-                               break;
-                       
-                       case PART_CLUMP:
-                               poin= &(part->clumpfac); break;
-                       case PART_AVE:
-                               poin= &(part->avefac); break;
-                       case PART_SIZE:
-                               poin= &(part->size); break;
-                       case PART_DRAG:
-                               poin= &(part->dragfac); break;
-                       case PART_BROWN:
-                               poin= &(part->brownfac); break;
-                       case PART_DAMP:
-                               poin= &(part->dampfac); break;
-                       case PART_LENGTH:
-                               poin= &(part->length); break;
-                       case PART_GRAV_X:
-                               poin= &(part->acc[0]); break;
-                       case PART_GRAV_Y:
-                               poin= &(part->acc[1]); break;
-                       case PART_GRAV_Z:
-                               poin= &(part->acc[2]); break;
-                       case PART_KINK_AMP:
-                               poin= &(part->kink_amp); break;
-                       case PART_KINK_FREQ:
-                               poin= &(part->kink_freq); break;
-                       case PART_KINK_SHAPE:
-                               poin= &(part->kink_shape); break;
-                       case PART_BB_TILT:
-                               poin= &(part->bb_tilt); break;
-                               
-                       case PART_PD_FSTR:
-                               if (part->pd) poin= &(part->pd->f_strength);
-                               break;
-                       case PART_PD_FFALL:
-                               if (part->pd) poin= &(part->pd->f_power);
-                               break;
-                       case PART_PD_FMAXD:
-                               if (part->pd) poin= &(part->pd->maxdist);
-                               break;
-                       case PART_PD2_FSTR:
-                               if (part->pd2) poin= &(part->pd2->f_strength);
-                               break;
-                       case PART_PD2_FFALL:
-                               if (part->pd2) poin= &(part->pd2->f_power);
-                               break;
-                       case PART_PD2_FMAXD:
-                               if (part->pd2) poin= &(part->pd2->maxdist);
-                               break;
-                       }
-               }
-                       break;
-       }
+       // all adr codes put into converters!
 
        /* return pointer */
        return poin;
index 89d00cc8f062efdd2d98aadac06d7608b188910e..1e0abac915b06edbcf36cf5570c494ecc3f8da7e 100644 (file)
@@ -2490,8 +2490,11 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
                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);
+                       if(node->id) {
+                               if(node->flag & NODE_DO_OUTPUT)
+                                       node->new_node->id= (ID *)BKE_image_copy((Image *)node->id);
+                               else
+                                       node->new_node->id= NULL;
                        }
                }
                
@@ -2565,6 +2568,7 @@ void ntreeLocalMerge(bNodeTree *localtree, bNodeTree *ntree)
                        
                        if(ELEM(lnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
                                if(lnode->id && (lnode->flag & NODE_DO_OUTPUT)) {
+                                       /* image_merge does sanity check for pointers */
                                        BKE_image_merge((Image *)lnode->new_node->id, (Image *)lnode->id);
                                }
                        }
index cac95a85d54865f9048bf98dc7c7f132514bcb95..2b1dcc782c63e27f1e74a85f066de9e512fc3e8e 100644 (file)
@@ -391,7 +391,8 @@ void psys_free(Object *ob, ParticleSystem * psys)
 
                free_keyed_keys(psys);
 
-               //XXX PE_free_particle_edit(psys);
+               if(psys->edit && psys->free_edit)
+                       psys->free_edit(psys);
 
                if(psys->particles){
                        MEM_freeN(psys->particles);
@@ -2338,7 +2339,6 @@ void psys_cache_paths(Scene *scene, Object *ob, ParticleSystem *psys, float cfra
        int k,i;
        int steps = (int)pow(2.0, (double)psys->part->draw_step);
        int totpart = psys->totpart;
-       char nosel[4], sel[4];
        float sel_col[3];
        float nosel_col[3];
        float length, vec[3];
@@ -2350,25 +2350,25 @@ void psys_cache_paths(Scene *scene, Object *ob, ParticleSystem *psys, float cfra
        if((psys->flag & PSYS_HAIR_DONE)==0 && (psys->flag & PSYS_KEYED)==0)
                return;
 
-       if(psys->renderdata)
+       if(psys->renderdata) {
                steps = (int)pow(2.0, (double)psys->part->ren_step);
-       else if(psys_in_edit_mode(scene, psys)){
+       }
+       else if(psys_in_edit_mode(scene, psys)) {
                edit=psys->edit;
                
                //timed = edit->draw_timed;
 
-               //XXX PE_get_colors(sel,nosel);
-               if(pset->brushtype == PE_BRUSH_WEIGHT){
+               if(pset->brushtype == PE_BRUSH_WEIGHT) {
                        sel_col[0] = sel_col[1] = sel_col[2] = 1.0f;
                        nosel_col[0] = nosel_col[1] = nosel_col[2] = 0.0f;
                }
                else{
-                       sel_col[0] = (float)sel[0] / 255.0f;
-                       sel_col[1] = (float)sel[1] / 255.0f;
-                       sel_col[2] = (float)sel[2] / 255.0f;
-                       nosel_col[0] = (float)nosel[0] / 255.0f;
-                       nosel_col[1] = (float)nosel[1] / 255.0f;
-                       nosel_col[2] = (float)nosel[2] / 255.0f;
+                       sel_col[0] = (float)edit->sel_col[0] / 255.0f;
+                       sel_col[1] = (float)edit->sel_col[1] / 255.0f;
+                       sel_col[2] = (float)edit->sel_col[2] / 255.0f;
+                       nosel_col[0] = (float)edit->nosel_col[0] / 255.0f;
+                       nosel_col[1] = (float)edit->nosel_col[1] / 255.0f;
+                       nosel_col[2] = (float)edit->nosel_col[2] / 255.0f;
                }
        }
 
index 516cdc7612532c9e671688685ad9a5a54db5d3be..afb4fb68c8c158e08d712c270e13022a14b49e50 100644 (file)
@@ -4174,6 +4174,30 @@ static void psys_update_path_cache(Scene *scene, Object *ob, ParticleSystemModif
                psys_free_path_cache(psys);
 }
 
+/* calculate and store key locations in world coordinates */
+void psys_update_world_cos(Object *ob, ParticleSystem *psys)
+{
+       ParticleSystemModifierData *psmd= psys_get_modifier(ob, psys);
+       ParticleData *pa;
+       ParticleEditKey *key;
+       int i, k, totpart;
+       float hairmat[4][4];
+
+       if(psys==0 || psys->edit==0)
+               return;
+
+       totpart= psys->totpart;
+
+       for(i=0, pa=psys->particles; i<totpart; i++, pa++) {
+               psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
+
+               for(k=0, key=psys->edit->keys[i]; k<pa->totkey; k++, key++) {
+                       VECCOPY(key->world_co,key->co);
+                       Mat4MulVecfl(hairmat, key->world_co);
+               }
+       }
+}
+
 static void hair_step(Scene *scene, Object *ob, ParticleSystemModifierData *psmd, ParticleSystem *psys, float cfra)
 {
        ParticleSettings *part = psys->part;
@@ -4200,7 +4224,7 @@ static void hair_step(Scene *scene, Object *ob, ParticleSystemModifierData *psmd
                precalc_effectors(scene, ob,psys,psmd,cfra);
                
        if(psys_in_edit_mode(scene, psys))
-               ; //XXX PE_recalc_world_cos(ob, psys);
+               psys_update_world_cos(ob, psys);
 
        psys_update_path_cache(scene, ob,psmd,psys,cfra);
 }
index 999e1744ae63cff95e983506defdffae14a88268..47a33bdee66bcce47ef92b2803bf4f4576197dcd 100644 (file)
@@ -65,9 +65,6 @@ A text should relate to a file as follows -
 (Text *)->flags has the following bits
        TXT_ISDIRTY - should always be set if the file in mem. differs from
                                        the file on disk, or if there is no file on disk.
-       TXT_ISTMP - should always be set if the (Text *)->name file has not
-                                       been written before, and attempts to save should result
-                                       in "Save over?"
        TXT_ISMEM - should always be set if the Text has not been mapped to
                                        a file, in which case (Text *)->name may be NULL or garbage.                    
        TXT_ISEXT - should always be set if the Text is not to be written into
@@ -130,7 +127,6 @@ static void txt_delete_line(Text *text, TextLine *line);
 
 /***/
 
-static char *txt_cut_buffer= NULL;
 static unsigned char undoing;
 
 /* allow to switch off undoing externally */
@@ -179,7 +175,7 @@ Text *add_empty_text(char *name)
        ta->undo_buf= MEM_mallocN(ta->undo_len, "undo buf");
                
        ta->nlines=1;
-       ta->flags= TXT_ISDIRTY | TXT_ISTMP | TXT_ISMEM;
+       ta->flags= TXT_ISDIRTY | TXT_ISMEM;
 
        ta->lines.first= ta->lines.last= NULL;
        ta->markers.first= ta->markers.last= NULL;
@@ -257,8 +253,6 @@ int reopen_text(Text *text)
        text->undo_len= TXT_INIT_UNDO;
        text->undo_buf= MEM_mallocN(text->undo_len, "undo buf");
        
-       text->flags= TXT_ISTMP; 
-       
        fseek(fp, 0L, SEEK_END);
        len= ftell(fp);
        fseek(fp, 0L, SEEK_SET);        
@@ -347,9 +341,6 @@ Text *add_text(char *file, const char *relpath)
        ta->lines.first= ta->lines.last= NULL;
        ta->markers.first= ta->markers.last= NULL;
        ta->curl= ta->sell= NULL;
-
-/*     ta->flags= TXT_ISTMP | TXT_ISEXT; */
-       ta->flags= TXT_ISTMP;
        
        fseek(fp, 0L, SEEK_END);
        len= ftell(fp);
@@ -430,7 +421,7 @@ Text *copy_text(Text *ta)
        tan->name= MEM_mallocN(strlen(ta->name)+1, "text_name");
        strcpy(tan->name, ta->name);
        
-       tan->flags = ta->flags | TXT_ISDIRTY | TXT_ISTMP;
+       tan->flags = ta->flags | TXT_ISDIRTY;
        
        tan->lines.first= tan->lines.last= NULL;
        tan->markers.first= tan->markers.last= NULL;
@@ -1056,11 +1047,6 @@ void txt_sel_line (Text *text)
 /* Cut and paste functions */
 /***************************/
 
-void txt_print_cutbuffer (void) 
-{
-       printf ("Cut buffer\n--\n%s\n--\n", txt_cut_buffer);    
-}
-
 char *txt_to_buf (Text *text)
 {
        int length;
@@ -1165,15 +1151,6 @@ int txt_find_string(Text *text, char *findstr, int wrap)
                return 0;
 }
 
-void txt_cut_sel (Text *text)
-{
-       if (!G.background) /* Python uses txt_cut_sel, which it should not, working around for now  */
-               ; //XXX txt_copy_clipboard(text);
-       
-       txt_delete_sel(text);
-       txt_make_dirty(text);
-}
-
 char *txt_sel_to_buf (Text *text)
 {
        char *buf;
@@ -1251,85 +1228,6 @@ char *txt_sel_to_buf (Text *text)
        return buf;
 }
 
-void txt_copy_sel (Text *text)
-{
-       int length=0;
-       TextLine *tmp, *linef, *linel;
-       int charf, charl;
-       
-       if (!text) return;
-       if (!text->curl) return;
-       if (!text->sell) return;
-
-       if (!txt_has_sel(text)) return;
-       
-       if (txt_cut_buffer) MEM_freeN(txt_cut_buffer);
-       txt_cut_buffer= NULL;
-       
-       if (text->curl==text->sell) {
-               linef= linel= text->curl;
-               
-               if (text->curc < text->selc) {
-                       charf= text->curc;
-                       charl= text->selc;
-               } else{
-                       charf= text->selc;
-                       charl= text->curc;
-               }
-       } else if (txt_get_span(text->curl, text->sell)<0) {
-               linef= text->sell;
-               linel= text->curl;
-
-               charf= text->selc;              
-               charl= text->curc;
-       } else {
-               linef= text->curl;
-               linel= text->sell;
-               
-               charf= text->curc;
-               charl= text->selc;
-       }
-
-       if (linef == linel) {
-               length= charl-charf;
-
-               txt_cut_buffer= MEM_mallocN(length+1, "cut buffera");
-               
-               BLI_strncpy(txt_cut_buffer, linef->line + charf, length+1);
-       } else {
-               length+= linef->len - charf;
-               length+= charl;
-               length++; /* For the '\n' */
-               
-               tmp= linef->next;
-               while (tmp && tmp!= linel) {
-                       length+= tmp->len+1;
-                       tmp= tmp->next;
-               }
-               
-               txt_cut_buffer= MEM_mallocN(length+1, "cut bufferb");
-               
-               strncpy(txt_cut_buffer, linef->line+ charf, linef->len-charf);
-               length= linef->len-charf;
-               
-               txt_cut_buffer[length++]='\n';
-               
-               tmp= linef->next;
-               while (tmp && tmp!=linel) {
-                       strncpy(txt_cut_buffer+length, tmp->line, tmp->len);
-                       length+= tmp->len;
-                       
-                       txt_cut_buffer[length++]='\n';                  
-                       
-                       tmp= tmp->next;
-               }
-               strncpy(txt_cut_buffer+length, linel->line, charl);
-               length+= charl;
-               
-               txt_cut_buffer[length]=0;
-       }
-}
-
 void txt_insert_buf(Text *text, char *in_buffer)
 {
        int i=0, l=0, j, u, len;
@@ -1380,16 +1278,6 @@ void txt_insert_buf(Text *text, char *in_buffer)
        undoing= u;
 }
 
-void txt_free_cut_buffer(void) 
-{
-       if (txt_cut_buffer) MEM_freeN(txt_cut_buffer);
-}
-
-void txt_paste(Text *text)
-{
-       txt_insert_buf(text, txt_cut_buffer);
-}
-
 /******************/
 /* Undo functions */
 /******************/
@@ -2394,6 +2282,12 @@ int txt_add_char (Text *text, char add)
        return 1;
 }
 
+void txt_delete_selected(Text *text)
+{
+       txt_delete_sel(text);
+       txt_make_dirty(text);
+}
+
 int txt_replace_char (Text *text, char add)
 {
        char del;
index ebefd94da9ced801ab105c7d42d3988ae4c6f8b8..a633b5811ff59cf349873dc1999230dd3faac7ac 100644 (file)
@@ -111,14 +111,14 @@ float Normalize(float *n)
        return d;
 }
 
-
+/*original function from shadeoutput.c*/
 double Normalize_d(double *n)
 {
        double d;
        
        d= n[0]*n[0]+n[1]*n[1]+n[2]*n[2];
-       /* A larger value causes normalize errors in a scaled down models with camera xtreme close */
-       if(d>1.0e-35F) {
+
+       if(d>0.00000000000000001) {
                d= sqrt(d);
 
                n[0]/=d; 
index 023d7c091719f49f4b0ce1191f2a4071f70a3da3..338dc810641dd9989bee23850561bc8284178382 100644 (file)
 #include "BKE_animsys.h"
 #include "BKE_action.h"
 #include "BKE_armature.h"
+#include "BKE_brush.h"
 #include "BKE_cdderivedmesh.h"
 #include "BKE_cloth.h"
 #include "BKE_colortools.h"
@@ -1511,6 +1512,8 @@ static void direct_link_brush(FileData *fd, Brush *brush)
        brush->curve= newdataadr(fd, brush->curve);
        if(brush->curve)
                direct_link_curvemapping(fd, brush->curve);
+       else
+               brush_curve_preset(brush, BRUSH_PRESET_SHARP);
 }
 
 static void direct_link_script(FileData *fd, Script *script)
@@ -2548,7 +2551,7 @@ static void direct_link_text(FileData *fd, Text *text)
                ln= ln->next;
        }
 
-       text->flags = (text->flags|TXT_ISTMP) & ~TXT_ISEXT;
+       text->flags = (text->flags) & ~TXT_ISEXT;
 
        text->id.us= 1;
 }
@@ -2938,6 +2941,7 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
                }
 
                psys->edit = 0;
+               psys->free_edit = NULL;
                psys->pathcache = 0;
                psys->childcache = 0;
                psys->pathcachebufs.first = psys->pathcachebufs.last = 0;
@@ -3849,6 +3853,9 @@ static void direct_link_scene(FileData *fd, Scene *sce)
                sce->toolsettings->vpaint= newdataadr(fd, sce->toolsettings->vpaint);
                sce->toolsettings->wpaint= newdataadr(fd, sce->toolsettings->wpaint);
                sce->toolsettings->sculpt= newdataadr(fd, sce->toolsettings->sculpt);
+               sce->toolsettings->imapaint.paintcursor= NULL;
+               sce->toolsettings->particle.paintcursor= NULL;
+
                if(sce->toolsettings->sculpt)
                        sce->toolsettings->sculpt->session= MEM_callocN(sizeof(SculptSession), "reload sculpt session");
        }
@@ -5636,6 +5643,11 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
                                ar->v2d.align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
                                ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPZOOM|V2D_KEEPASPECT);
                                break;
+                       }
+                       case SPACE_TEXT:
+                       {
+                               SpaceText *st= (SpaceText *)sl;
+                               st->flags |= ST_FIND_WRAP;
                        }
                                //case SPACE_XXX: // FIXME... add other ones
                                //      memcpy(&ar->v2d, &((SpaceXxx *)sl)->v2d, sizeof(View2D));
index 30e7e4c9317a9a20e798c250f9559bb962c92a81..a1f0a82257bba0cbc80a84de28a3c708414a2a1b 100644 (file)
@@ -167,12 +167,14 @@ int BMO_CatchOpError(BMesh *bm, BMOperator *catchop, int errorcode, char **msg);
 #define BMERR_SELF_INTERSECTING                        1
 #define BMERR_DISSOLVEDISK_FAILED              2
 #define BMERR_CONNECTVERT_FAILED               3
+#define BMERR_WALKER_FAILED                    4
 
 static char *bmop_error_messages[] = {
        0,
        "Self intersection error",
        "Could not dissolve vert",
        "Could not connect verts",
+       "Could not traverse mesh",
 };
 
 /*------------begin operator defines (see bmesh_opdefines.c too)------------*/
index 5f0b1e2f25683dab74f0e474cdbfba1a189bc6b3..22e92e9b6596d8fd9e9ea7896775799e402bb00c 100644 (file)
@@ -1,6 +1,12 @@
 #ifndef BM_WALKERS_H
 #define BM_WALKERS_H
 
+#include "BLI_ghash.h"
+
+/*
+  NOTE: do NOT modify topology while walking a mesh!
+*/
+
 /*Walkers*/
 typedef struct BMWalker{
        BLI_mempool *stack;
@@ -8,19 +14,20 @@ typedef struct BMWalker{
        void *currentstate;
        void *(*begin) (struct BMWalker *walker, void *start);
        void *(*yield)(struct BMWalker *walker);
-       void   (*step) (struct BMWalker *walker);
-       int visitedmask;
+       void *(*step) (struct BMWalker *walker);
        int restrictflag;
+       GHash *visithash;
 }BMWalker;
 
-void BMWalker_Init(struct BMWalker *walker, BMesh *bm, int type, int searchmask);
+void BMWalker_Init(struct BMWalker *walker,BMesh *bm,int type, int searchmask);
 void *BMWalker_Step(struct BMWalker *walker);
 void BMWalker_End(struct BMWalker *walker);
 
-#define BM_SHELLWALKER 0
-#define BM_LOOPWALKER  1
-#define BM_RINGWALKER  2
-#define BM_UVISLANDS           3
-#define BM_MAXWALKERS  4
+#define BMW_SHELL      0
+/*#define BMW_LOOP     1
+#define BMW_RING       2
+#define BMW_UVISLANDS  3*/
+#define BMW_ISLANDBOUND        1
+#define BMW_MAXWALKERS 2
 
 #endif
\ No newline at end of file
index 6e0717ce7e8194dcf3d18debdaf98405aa5d3171..23efdd0b022578ba2c74004f4fb12334d13c4618 100644 (file)
@@ -7,6 +7,19 @@
 
 #include "bmesh.h"
 
+/*
+ - joeedh -
+ design notes:
+
+ * walkers should use tool flags, not header flags
+ * walkers now use ghash rather then stealing flags.
+   ghash can be rewritten to be faster if necassary.
+ * walkers should always raise BMERR_WALKER_FAILED,
+   with a custom error message.
+ * tools should ALWAYS have necassary error handling
+   for if walkers fail.
+*/
+
 /*
 NOTE: This code needs to be read through a couple of times!!
 */
@@ -17,7 +30,14 @@ typedef struct shellWalker{
        BMEdge *curedge, *current;
 } shellWalker;
 
-/*
+typedef struct islandboundWalker {
+       struct islandboundWalker *prev;
+       BMEdge *base;
+       BMVert *lastv;
+       BMEdge *curedge;
+} islandboundWalker;
+
+/*  NOTE: this comment is out of date, update it - joeedh
  *     BMWalker - change this to use the filters functions.
  *     
  *     A generic structure for maintaing the state and callbacks nessecary for walking over
@@ -41,13 +61,18 @@ typedef struct shellWalker{
 */
 
 /*Forward declerations*/
-static int request_walkerMask(struct BMesh *bm);
 static void *BMWalker_walk(struct BMWalker *walker);
-static void BMWalker_popState(struct BMWalker *walker);
-static void BMWalker_pushState(struct BMWalker *walker);
-static void *shellWalker_begin(struct BMWalker *walker, void *data);
-static void *shellWalker_yield(struct BMWalker *walker);
-static void shellWalker_step(struct BMWalker *walker);
+static void BMWalker_popstate(struct BMWalker *walker);
+static void BMWalker_pushstate(struct BMWalker *walker);
+
+static void *shellWalker_Begin(struct BMWalker *walker, void *data);
+static void *shellWalker_Yield(struct BMWalker *walker);
+static void *shellWalker_Step(struct BMWalker *walker);
+
+static void *islandboundWalker_Begin(BMWalker *walker, void *data);
+static void *islandboundWalker_Yield(BMWalker *walker);
+static void *islandboundWalker_Step(BMWalker *walker);
+
 struct shellWalker;
 
 /* Pointer hiding*/
@@ -56,34 +81,6 @@ typedef struct bmesh_walkerGeneric{
 } bmesh_walkerGeneric;
 
 
-/*
- *     REQUEST_WALKERMASK
- *
- *  Each active walker for a bmesh has its own bitmask
- *     to use for flagging elements as visited. request_walkerMask
- *     queries the bmesh passed in and returns the first free
- *  bitmask. If none are free, it returns 0. The maximum number
- *  of walkers that can be used for a single bmesh between calls to
- *  bmesh_edit_begin() and bmesh_edit_end() is defined by the constant
- *  BM_MAXWALKERS.
- *
-*/
-
-static int request_walkerMask(BMesh *bm)
-{
-       int i;
-       for(i=0; i < BM_MAXWALKERS; i++){
-               if(!(bm->walkers & (1 << i))){
-                       bm->walkers |= (1 << i);
-                       return (1 << i);
-               }
-       }
-       return 0;
-}
-
-
-
-
 /*
  * BMWalker_CREATE
  * 
@@ -93,71 +90,72 @@ static int request_walkerMask(BMesh *bm)
  *
 */
 
-void BMWalker_init(BMWalker *walker, BMesh *bm, int type, int searchmask)
+void BMWalker_Init(BMWalker *walker, BMesh *bm, int type, int searchmask)
 {
-       int visitedmask = request_walkerMask(bm);
        int size = 0;
        
-       if(visitedmask){
-               memset(walker, 0, sizeof(BMWalker));
-               walker->bm = bm;
-               walker->visitedmask = visitedmask;
-               walker->restrictflag = searchmask;
-               switch(type){
-                       case BM_SHELLWALKER:
-                               walker->begin = shellWalker_begin;
-                               walker->step = shellWalker_step;
-                               walker->yield = shellWalker_yield;
-                               size = sizeof(shellWalker);             
-                               break;
-                       //case BM_LOOPWALKER:
-                       //      walker->begin = loopwalker_begin;
-                       //      walker->step = loopwalker_step;
-                       //      walker->yield = loopwalker_yield;
-                       //      size = sizeof(loopWalker);
-                       //      break;
-                       //case BM_RINGWALKER:
-                       //      walker->begin = ringwalker_begin;
-                       //      walker->step = ringwalker_step;
-                       //      walker->yield = ringwalker_yield;
-                       //      size = sizeof(ringWalker);
-                       //      break;
-                       default:
-                               break;
-               }
-               walker->stack = BLI_mempool_create(size, 100, 100);
-               walker->currentstate = NULL;
+       memset(walker, 0, sizeof(BMWalker));
+       walker->bm = bm;
+       walker->restrictflag = searchmask;
+       walker->visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp);
+
+       switch(type){
+               case BMW_SHELL:
+                       walker->begin = shellWalker_Begin;
+                       walker->step = shellWalker_Step;
+                       walker->yield = shellWalker_Yield;
+                       size = sizeof(shellWalker);             
+                       break;
+               case BMW_ISLANDBOUND:
+                       walker->begin = islandboundWalker_Begin;
+                       walker->step = islandboundWalker_Step;
+                       walker->yield = islandboundWalker_Yield;
+                       size = sizeof(islandboundWalker);               
+                       break;
+               //case BMW_LOOP:
+               //      walker->begin = loopwalker_Begin;
+               //      walker->step = loopwalker_Step;
+               //      walker->yield = loopwalker_Yield;
+               //      size = sizeof(loopWalker);
+               //      break;
+               //case BMW_RING:
+               //      walker->begin = ringwalker_Begin;
+               //      walker->step = ringwalker_Step;
+               //      walker->yield = ringwalker_Yield;
+               //      size = sizeof(ringWalker);
+               //      break;
+               default:
+                       break;
        }
+       walker->stack = BLI_mempool_create(size, 100, 100);
+       walker->currentstate = NULL;
 }
 
 /*
- * BMWalker_END
+ * BMWalker_End
  *
  * Frees a walker's stack.
  *
 */
 
-void BMWalker_end(BMWalker *walker)
+void BMWalker_End(BMWalker *walker)
 {
        BLI_mempool_destroy(walker->stack);
 }
 
 
 /*
- * BMWalker_STEP
+ * BMWalker_Step
  *
 */
 
-void *BMWalker_step(BMWalker *walker)
+void *BMWalker_Step(BMWalker *walker)
 {
        BMHeader *head;
 
-       while(head = BMWalker_walk(walker)){
-               //NOTE: figure this out 
-               //if(bmesh_test_flag(head, walker->restrictflag)) return head;
-               return head;
-       }
-       return NULL;
+       head = BMWalker_walk(walker);
+
+       return head;
 }
 
 /*
@@ -178,21 +176,21 @@ static void *BMWalker_walk(BMWalker *walker)
                walker->step(walker);
                current = walker->yield(walker);
                if(current) return current;
-               else BMWalker_popState(walker);
+               else BMWalker_popstate(walker);
 
        }
        return NULL;
 }
 
 /*
- * BMWalker_POPSTATE
+ * BMWalker_popstate
  *
  * Pops the current walker state off the stack
  * and makes the previous state current
  *
 */
 
-static void BMWalker_popState(BMWalker *walker)
+static void BMWalker_popstate(BMWalker *walker)
 {
        void *oldstate;
        oldstate = walker->currentstate;
@@ -202,14 +200,14 @@ static void BMWalker_popState(BMWalker *walker)
 }
 
 /*
- * BMWalker_PUSHSTATE
+ * BMWalker_pushstate
  *
  * Pushes the current state down the stack and allocates
  * a new one.
  *
 */
 
-static void BMWalker_pushState(BMWalker *walker)
+static void BMWalker_pushstate(BMWalker *walker)
 {
        bmesh_walkerGeneric *newstate;
        newstate = BLI_mempool_alloc(walker->stack);
@@ -228,46 +226,49 @@ static void BMWalker_pushState(BMWalker *walker)
  * 
 */
 
-static void *shellWalker_begin(BMWalker *walker, void *data){
+static void *shellWalker_Begin(BMWalker *walker, void *data){
        BMVert *v = data;
        shellWalker *shellWalk = NULL;
-       BMWalker_pushState(walker);
+       BMWalker_pushstate(walker);
        shellWalk = walker->currentstate;
-       shellWalk->base = shellWalk->curedge = NULL;
+       shellWalk->base = NULL;
+       shellWalk->curedge = NULL;
        if(v->edge){
                shellWalk->base = v;
                shellWalk->curedge = v->edge;
        }
+
+       return v->edge;
 }
-static void *shellWalker_yield(BMWalker *walker)
+static void *shellWalker_Yield(BMWalker *walker)
 {
        shellWalker *shellWalk = walker->currentstate;
        return shellWalk->curedge;
 }
 
-static void shellWalker_step(BMWalker *walker)
+static void *shellWalker_Step(BMWalker *walker)
 {
        BMEdge *curedge, *next = NULL;
        BMVert *ov = NULL;
        int restrictpass = 1;
        shellWalker *shellWalk = walker->currentstate;
-
-       if(!(shellWalk->base->head.flag & walker->visitedmask))
-               shellWalk->base->head.flag |= walker->visitedmask;
        
+       if (!BLI_ghash_lookup(walker->visithash, shellWalk->base))
+               BLI_ghash_insert(walker->visithash, shellWalk->base, NULL);
+
        /*find the next edge whose other vertex has not been visited*/
        curedge = shellWalk->curedge;
        do{
-               if(!(curedge->head.flag & walker->visitedmask))
-                       curedge->head.flag |= walker->visitedmask;
-                       if(walker->restrictflag && (!(curedge->head.flag & walker->restrictflag))) restrictpass = 0;
-                       if(restrictpass){
+               if (!BLI_ghash_lookup(walker->visithash, curedge)) 
+                       BLI_ghash_insert(walker->visithash, curedge, NULL);
+                       if(walker->restrictflag && (!BMO_TestFlag(walker->bm, curedge, walker->restrictflag))) restrictpass = 0;
+                       if(restrictpass) {
                                ov = BM_OtherEdgeVert(curedge, shellWalk->base);
                                
                                /*save current state*/
                                shellWalk->curedge = curedge;
                                /*push a new state onto the stack*/
-                               BMWalker_pushState(walker);
+                               BMWalker_pushstate(walker);
                                
                                /*populate the new state*/
                                ((shellWalker*)walker->currentstate)->base = ov;
@@ -283,4 +284,68 @@ static void shellWalker_step(BMWalker *walker)
        
        shellWalk->current = next;
        return shellWalk->current;
-}
\ No newline at end of file
+}
+
+/*     Island Boundary Walker:
+ *
+ *     Starts at a edge on the mesh and walks over the boundary of an
+ *      island it belongs to.
+ *
+ *     TODO:
+ *
+ *  Add restriction flag/callback for wire edges.
+ * 
+*/
+
+static void *islandboundWalker_Begin(BMWalker *walker, void *data){
+       BMEdge *e = data;
+       islandboundWalker *iwalk = NULL;
+
+       BMWalker_pushstate(walker);
+
+       iwalk = walker->currentstate;
+       iwalk->base = iwalk->curedge = e;
+
+       return e;
+}
+
+static void *islandboundWalker_Yield(BMWalker *walker)
+{
+       islandboundWalker *iwalk = walker->currentstate;
+
+       return iwalk->curedge;
+}
+
+static void *islandboundWalker_Step(BMWalker *walker)
+{
+       islandboundWalker *iwalk = walker->currentstate, *owalk;
+       BMIter iter;
+       BMVert *v;
+       BMEdge *e = iwalk->curedge;
+       int found;
+
+       owalk = iwalk;
+
+       if (iwalk->lastv == e->v1) v = e->v2;
+       else v = e->v1;
+       
+       BMWalker_popstate(walker);
+
+       e=BMIter_New(&iter, walker->bm, BM_EDGES_OF_VERT, v);
+       for (; e; e=BMIter_Step(&iter)) {
+               if (!BMO_TestFlag(walker->bm, e, walker->restrictflag))
+                       continue;
+               if (BLI_ghash_haskey(walker->visithash, e)) continue;
+
+               BLI_ghash_insert(walker->visithash, e, NULL);
+               BMWalker_pushstate(walker);
+               
+               iwalk = walker->currentstate;
+               iwalk->base = iwalk->base;
+               iwalk->curedge = e;
+               iwalk->lastv = v;               
+               
+       }
+
+       return iwalk->curedge;
+}
index ca385333d7a05e3dbdee227d2f326d9cf0933b7d..8dfb1c20bbe06e87bcc3a833530bf2cb7d4e8488 100644 (file)
                else                                                                    (channel)->flag &= ~(sflag); \
        }
 
-/* -------------------------- Internal Tools -------------------------------- */
+/* -------------------------- Exposed API ----------------------------------- */
 
-/* set the given Action Group to be the 'active' one in its Action */
-static void action_set_active_agrp (bAction *act, bActionGroup *agrp)
+/* Set the given animation-channel as the active one for the active context */
+void ANIM_set_active_channel (void *data, short datatype, int filter, void *channel_data, short channel_type)
 {
-       bActionGroup *grp;
+       ListBase anim_data = {NULL, NULL};
+       bAnimListElem *ale;
+       short smode;
        
-       /* sanity check */
-       if (act == NULL)
+       /* try to build list of filtered items */
+       // XXX we don't need/supply animcontext for now, since in this case, there's nothing really essential there that isn't already covered
+       ANIM_animdata_filter(NULL, &anim_data, filter, data, datatype);
+       if (anim_data.first == NULL)
                return;
                
-       /* clear active flag on all others */
-       for (grp= act->groups.first; grp; grp= grp->next)
-               grp->flag &= ~AGRP_ACTIVE;
+       /* only clear the 'active' flag for the channels of the same type */
+       for (ale= anim_data.first; ale; ale= ale->next) {
+               /* skip if types don't match */
+               if (channel_type != ale->type)
+                       continue;       
                
-       /* set the given group to be the active one */
-       if (agrp)
-               agrp->flag |= AGRP_ACTIVE;
-}
-
-/* -------------------------- Exposed API ----------------------------------- */
-
-/* Set the given ActionChannel or ActionGroup as the active one in the given action
- *     - data: should be bAction...
- *     - datatype: should be ANIMCONT_ACTION 
- *     - channel_data: bActionChannel or bActionGroup
- *     - channel_type: eAnim_ChannelType
- */
-void ANIM_action_set_active_channel (void *data, short datatype, void *channel_data, short channel_type)
-{
-       /* sanity checks */
-       if ((data == NULL) || (datatype != ANIMCONT_ACTION))
-               return;
+               /* flag setting mode 
+                *      - depends on whether the provided channel is encountered
+                */
+               if (ale->data == channel_data)
+                       smode= ACHANNEL_SETFLAG_ADD;
+               else
+                       smode= ACHANNEL_SETFLAG_CLEAR;
                
-       switch (channel_type) {
-               case ANIMTYPE_GROUP:
-                       action_set_active_agrp((bAction *)data, (bActionGroup *)channel_data);
-                       break;
+               /* flag to set depends on type */
+               switch (ale->type) {
+                       case ANIMTYPE_GROUP:
+                       {
+                               bActionGroup *agrp= (bActionGroup *)ale->data;
+                               
+                               ACHANNEL_SET_FLAG(agrp, smode, AGRP_ACTIVE);
+                       }
+                               break;
+                       case ANIMTYPE_FCURVE:
+                       {
+                               FCurve *fcu= (FCurve *)ale->data;
+                               
+                               ACHANNEL_SET_FLAG(fcu, smode, FCURVE_ACTIVE);
+                       }
+                               break;
+               }
        }
+       
+       /* clean up */
+       BLI_freelistN(&anim_data);
 }
 
 /* Deselect all animation channels 
@@ -856,6 +867,27 @@ void ANIM_OT_channels_toggle_setting (wmOperatorType *ot)
        RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
 }
 
+// XXX currently, this is a separate operator, but perhaps we could in future specify in keymaps whether to call invoke or exec?
+void ANIM_OT_channels_toggle_editable (wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Toggle Channel Editability";
+       ot->idname= "ANIM_OT_channels_toggle_editable";
+       
+       /* api callbacks */
+       ot->exec= animchannels_setflag_exec;
+       ot->poll= ED_operator_areaactive;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       
+       /* props */
+               /* flag-setting mode */
+       RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_TOGGLE, "Mode", "");
+               /* setting to set */
+       RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, ACHANNEL_SETTING_PROTECT, "Type", "");
+}
+
 /* ********************** Select All Operator *********************** */
 
 static int animchannels_deselectall_exec(bContext *C, wmOperator *op)
@@ -1192,14 +1224,14 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s
                                }
                                else if (selectmode == -1) {
                                        /* select all in group (and deselect everthing else) */ 
-                                       bActionChannel *achan;
+                                       FCurve *fcu;
                                        
                                        /* deselect all other channels */
                                        ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
                                        
                                        /* only select channels in group and group itself */
-                                       for (achan= agrp->channels.first; achan && achan->grp==agrp; achan= achan->next)
-                                               achan->flag |= ACHAN_SELECTED;
+                                       for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcu->next)
+                                               fcu->flag |= FCURVE_SELECTED;
                                        agrp->flag |= AGRP_SELECTED;                                    
                                }
                                else {
@@ -1208,19 +1240,26 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s
                                        agrp->flag |= AGRP_SELECTED;
                                }
                                
-                               /* if group is selected now, and we're in Action Editor mode (so that we have pointer to active action),
-                                * we can make this group the 'active' one in that action
-                                */
-                               // TODO: we should be able to do this through dopesheet + f-curves editor too...
-                               if ((agrp->flag & AGRP_SELECTED) && (ac->datatype == ANIMCONT_ACTION))
-                                       action_set_active_agrp((bAction *)ac->data, agrp);
+                               /* if group is selected now, make group the 'active' one in the visible list */
+                               if (agrp->flag & AGRP_SELECTED)
+                                       ANIM_set_active_channel(ac->data, ac->datatype, filter, agrp, ANIMTYPE_GROUP);
                        }
                }
                        break;
                case ANIMTYPE_FCURVE: 
                {
                        FCurve *fcu= (FCurve *)ale->data;
-                       short offset= (ac->datatype != ANIMCONT_ACTION)? 18 : 0;
+                       short offset;
+                       
+                       if (ac->datatype != ANIMCONT_ACTION) {
+                               /* for now, special case for materials */
+                               if (ale->ownertype == ANIMTYPE_DSMAT)
+                                       offset= 21;
+                               else
+                                       offset= 18;
+                       }
+                       else
+                               offset = 0;
                        
                        if (x >= (ACHANNEL_NAMEWIDTH-ACHANNEL_BUTTON_WIDTH)) {
                                /* toggle protection */
@@ -1232,17 +1271,23 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s
                        }
                        else if ((x < (offset+17)) && (ac->spacetype==SPACE_IPO)) {
                                /* toggle visibility */
-                               // XXX this is supposed to be button before name, though this sometimes fails
                                fcu->flag ^= FCURVE_VISIBLE;
                        }
                        else {
                                /* select/deselect */
-                               fcu->flag ^= FCURVE_SELECTED;
+                               if (selectmode == SELECT_INVERT) {
+                                       /* inverse selection status of this F-Curve only */
+                                       fcu->flag ^= FCURVE_SELECTED;
+                               }
+                               else {
+                                       /* select F-Curve by itself */
+                                       ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
+                                       fcu->flag |= FCURVE_SELECTED;
+                               }
                                
+                               /* if F-Curve is selected now, make F-Curve the 'active' one in the visible list */
                                if (fcu->flag & FCURVE_SELECTED)
-                                       fcu->flag |= FCURVE_ACTIVE;
-                               else
-                                       fcu->flag &= ~FCURVE_ACTIVE;
+                                       ANIM_set_active_channel(ac->data, ac->datatype, filter, fcu, ANIMTYPE_FCURVE);
                        }
                }
                        break;
@@ -1375,6 +1420,9 @@ void ED_operatortypes_animchannels(void)
        WM_operatortype_append(ANIM_OT_channels_disable_setting);
        WM_operatortype_append(ANIM_OT_channels_toggle_setting);
        
+               // XXX does this need to be a separate operator?
+       WM_operatortype_append(ANIM_OT_channels_toggle_editable);
+       
                // XXX these need to be updated for new system... todo...
        //WM_operatortype_append(ANIM_OT_channels_move_up);
        //WM_operatortype_append(ANIM_OT_channels_move_down);
@@ -1407,6 +1455,9 @@ void ED_keymap_animchannels(wmWindowManager *wm)
        WM_keymap_add_item(keymap, "ANIM_OT_channels_enable_setting", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
        WM_keymap_add_item(keymap, "ANIM_OT_channels_disable_setting", WKEY, KM_PRESS, KM_ALT, 0);
        
+       /* settings - specialised hotkeys */
+       WM_keymap_add_item(keymap, "ANIM_OT_channels_toggle_editable", TABKEY, KM_PRESS, 0, 0);
+       
        /* rearranging - actions only */
        //WM_keymap_add_item(keymap, "ANIM_OT_channels_move_up", PAGEUPKEY, KM_PRESS, KM_SHIFT, 0);
        //WM_keymap_add_item(keymap, "ANIM_OT_channels_move_down", PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0);
index 05fa1f3bc977dec8bc74bd994e4c0e97596697ed..689520eb0fa55214dacf66f5b75298174b60bbe8 100644 (file)
@@ -1191,7 +1191,7 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
                if (base->object) {
                        Object *ob= base->object;
                        Key *key= ob_get_key(ob);
-                       short actOk, keyOk, dataOk;
+                       short actOk, keyOk, dataOk, matOk;
                        
                        /* firstly, check if object can be included, by the following fanimors:
                         *      - if only visible, must check for layer and also viewport visibility
@@ -1225,6 +1225,34 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
                                        keyOk= ((key) && ANIMDATA_HAS_KEYS(key) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS));
                                }
                                
+                               /* materials - only for geometric types */
+                               matOk= 0; /* by default, not ok... */
+                               if ( !(ads->filterflag & ADS_FILTER_NOMAT) && (ob->totcol) && 
+                                        ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL) ) 
+                               {
+                                       int a;
+                                       
+                                       /* firstly check that we actuallly have some materials */
+                                       for (a=0; a < ob->totcol; a++) {
+                                               Material *ma= give_current_material(ob, a);
+                                               
+                                               /* if material has relevant animation data, break */
+                                               if (ads->filterflag & ADS_FILTER_ONLYDRIVERS) {
+                                                       if (ANIMDATA_HAS_DRIVERS(ma)) {
+                                                               matOk= 1;
+                                                               break;
+                                                       }
+                                               }
+                                               else {
+                                                       if (ANIMDATA_HAS_KEYS(ma)) {
+                                                               matOk= 1;
+                                                               break;
+                                                       }
+                                               }
+                                       }
+                               }
+                               
+                               /* data */
                                switch (ob->type) {
                                        case OB_CAMERA: /* ------- Camera ------------ */
                                        {
@@ -1244,22 +1272,13 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
                                                        dataOk= (ANIMDATA_HAS_KEYS(la) && !(ads->filterflag & ADS_FILTER_NOLAM));       
                                        }
                                                break;
-                                       case OB_CURVE: /* -------- Curve ---------- */
-                                       {
-                                               Curve *cu= (Curve *)ob->data;
-                                               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 --- */
                                                dataOk= 0;
                                                break;
                                }
                                
                                /* check if all bad (i.e. nothing to show) */
-                               if (!actOk && !keyOk && !dataOk)
+                               if (!actOk && !keyOk && !dataOk && !matOk)
                                        continue;
                        }
                        else {
@@ -1267,6 +1286,24 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
                                actOk= ANIMDATA_HAS_KEYS(ob);
                                keyOk= (key != NULL);
                                
+                               /* materials - only for geometric types */
+                               matOk= 0; /* by default, not ok... */
+                               if (ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL) && (ob->totcol)) 
+                               {
+                                       int a;
+                                       
+                                       /* firstly check that we actuallly have some materials */
+                                       for (a=0; a < ob->totcol; a++) {
+                                               Material *ma= give_current_material(ob, a);
+                                               
+                                               if ((ma) && ANIMDATA_HAS_KEYS(ma)) {
+                                                       matOk= 1;
+                                                       break;
+                                               }
+                                       }
+                               }
+                               
+                               /* data */
                                switch (ob->type) {
                                        case OB_CAMERA: /* ------- Camera ------------ */
                                        {
@@ -1292,7 +1329,7 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
                                }
                                
                                /* check if all bad (i.e. nothing to show) */
-                               if (!actOk && !keyOk && !dataOk)
+                               if (!actOk && !keyOk && !dataOk && !matOk)
                                        continue;
                        }
                        
index 1727ec1718265906faf11965c4378a648b3491ae..4b5ab6296b43520a5a332c131f551cab2ade816d 100644 (file)
@@ -535,7 +535,7 @@ void fcurve_to_keylist(FCurve *fcu, ListBase *keys, ListBase *blocks, ActKeysInc
        ActKeyBlock *ab, *ab2;
        int v;
        
-       if (fcu && fcu->totvert) {
+       if (fcu && fcu->totvert && fcu->bezt) {
                /* loop through beztriples, making ActKeys and ActKeyBlocks */
                bezt= fcu->bezt;
                
index c3a393994d71d559e70501f35a0031d1f2ed3629..44814812c7694f3d6e0337c3d72d7159c39b2019 100644 (file)
@@ -84,7 +84,7 @@ short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, FCurve *fcu, BeztEditFunc
        int b;
        
        /* sanity check */
-       if (fcu == NULL)
+       if (ELEM(NULL, fcu, fcu->bezt))
                return 0;
        
        /* if function to apply to bezier curves is set, then loop through executing it on beztriples */
index cf7d56da5d9485f68e47b51fac1e667e18e57399..fc6ed9b00bb91c7a3b4cef7a25d172057181561f 100644 (file)
@@ -38,7 +38,6 @@
 #include "DNA_anim_types.h"
 #include "DNA_action_types.h"
 #include "DNA_curve_types.h"
-#include "DNA_ipo_types.h" // XXX to be removed
 #include "DNA_key_types.h"
 #include "DNA_object_types.h"
 #include "DNA_space_types.h"
@@ -357,3 +356,187 @@ void smooth_fcurve (FCurve *fcu)
 }
 
 /* **************************************************** */
+/* Copy/Paste Tools */
+/* - The copy/paste buffer currently stores a set of temporary F-Curves containing only the keyframes 
+ *   that were selected in each of the original F-Curves
+ * - 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.
+ */
+
+/* globals for copy/paste data (like for other copy/paste buffers) */
+ListBase animcopybuf = {NULL, NULL};
+static float animcopy_firstframe= 999999999.0f;
+
+/* datatype for use in copy/paste buffer */
+// XXX F-Curve editor should use this too
+typedef struct tAnimCopybufItem {
+       struct tAnimCopybufItem *next, *prev;
+       
+       ID *id;                         /* ID which owns the curve */
+       bActionGroup *grp;      /* Action Group */
+       char *rna_path;         /* RNA-Path */
+       int array_index;        /* array index */
+       
+       int totvert;            /* number of keyframes stored for this channel */
+       BezTriple *bezt;        /* keyframes in buffer */
+} tAnimCopybufItem;
+
+
+/* This function frees any MEM_calloc'ed copy/paste buffer data */
+// XXX find some header to put this in!
+void free_anim_copybuf (void)
+{
+       tAnimCopybufItem *aci, *acn;
+       
+       /* free each buffer element */
+       for (aci= animcopybuf.first; aci; aci= acn) {
+               acn= aci->next;
+               
+               /* free keyframes */
+               if (aci->bezt) 
+                       MEM_freeN(aci->bezt);
+                       
+               /* free RNA-path */
+               if (aci->rna_path)
+                       MEM_freeN(aci->rna_path);
+                       
+               /* free ourself */
+               BLI_freelinkN(&animcopybuf, aci);
+       }
+       
+       /* restore initial state */
+       animcopybuf.first= animcopybuf.last= NULL;
+       animcopy_firstframe= 999999999.0f;
+}
+
+/* ------------------- */
+
+/* This function adds data to the keyframes copy/paste buffer, freeing existing data first */
+short copy_animedit_keys (bAnimContext *ac, ListBase *anim_data)
+{      
+       bAnimListElem *ale;
+       
+       /* clear buffer first */
+       free_anim_copybuf();
+       
+       /* assume that each of these is an ipo-block */
+       for (ale= anim_data->first; ale; ale= ale->next) {
+               FCurve *fcu= (FCurve *)ale->key_data;
+               tAnimCopybufItem *aci;
+               BezTriple *bezt, *newbuf;
+               int i;
+               
+               /* init copybuf item info */
+               aci= MEM_callocN(sizeof(tAnimCopybufItem), "AnimCopybufItem");
+               aci->id= ale->id;
+               aci->grp= fcu->grp;
+               aci->rna_path= MEM_dupallocN(fcu->rna_path);
+               aci->array_index= fcu->array_index;
+               BLI_addtail(&animcopybuf, aci);
+               
+               /* add selected keyframes to buffer */
+               // XXX we don't cope with sample-data yet
+               // TODO: currently, we resize array everytime we add a new vert - this works ok as long as it is assumed only a few keys are copied
+               for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
+                       if (BEZSELECTED(bezt)) {
+                               /* add to buffer */
+                               newbuf= MEM_callocN(sizeof(BezTriple)*(aci->totvert+1), "copybuf beztriple");
+                               
+                               /* assume that since we are just resizing the array, just copy all existing data across */
+                               if (aci->bezt)
+                                       memcpy(newbuf, aci->bezt, sizeof(BezTriple)*(aci->totvert));
+                               
+                               /* copy current beztriple across too */
+                               *(newbuf + aci->totvert)= *bezt; 
+                               
+                               /* free old array and set the new */
+                               if (aci->bezt) MEM_freeN(aci->bezt);
+                               aci->bezt= newbuf;
+                               aci->totvert++;
+                               
+                               /* check if this is the earliest frame encountered so far */
+                               if (bezt->vec[1][0] < animcopy_firstframe)
+                                       animcopy_firstframe= bezt->vec[1][0];
+                       }
+               }
+               
+       }
+       
+       /* check if anything ended up in the buffer */
+       if (ELEM(NULL, animcopybuf.first, animcopybuf.last))
+               return -1;
+       
+       /* everything went fine */
+       return 0;
+}
+
+/* This function pastes data from the keyframes copy/paste buffer */
+short paste_animedit_keys (bAnimContext *ac, ListBase *anim_data)
+{
+       bAnimListElem *ale;
+       const Scene *scene= (ac->scene);
+       const float offset = (float)(CFRA - animcopy_firstframe);
+       short no_name= 0;
+       
+       /* check if buffer is empty */
+       if (ELEM(NULL, animcopybuf.first, animcopybuf.last)) {
+               //error("No data in buffer to paste");
+               return -1;
+       }
+       /* check if single channel in buffer (disregard names if so)  */
+       if (animcopybuf.first == animcopybuf.last)
+               no_name= 1;
+       
+       /* from selected channels */
+       for (ale= anim_data->first; ale; ale= ale->next) {
+               FCurve *fcu = (FCurve *)ale->data;              /* destination F-Curve */
+               tAnimCopybufItem *aci= NULL;
+               BezTriple *bezt;
+               int i;
+               
+               /* find buffer item to paste from 
+                *      - if names don't matter (i.e. only 1 channel in buffer), don't check id/group
+                *      - if names do matter, only check if id-type is ok for now (group check is not that important)
+                *      - most importantly, rna-paths should match (array indices are unimportant for now)
+                */
+               // TODO: the matching algorithm here is pathetic!
+               for (aci= animcopybuf.first; aci; aci= aci->next) {
+                       /* check that paths exist */
+                       if (aci->rna_path && fcu->rna_path) {
+                               if (strcmp(aci->rna_path, fcu->rna_path) == 0) {
+                                       /* should be a match unless there's more than one of these */
+                                       if ((no_name) || (aci->array_index == fcu->array_index)) 
+                                               break;
+                               }
+                       }
+               }
+               
+               
+               /* copy the relevant data from the matching buffer curve */
+               if (aci) {
+                       /* just start pasting, with the the first keyframe on the current frame, and so on */
+                       for (i=0, bezt=aci->bezt; i < aci->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_fcurve(fcu, bezt);
+                               
+                               /* un-apply offset from src beztriple after copying */
+                               bezt->vec[0][0] -= offset;
+                               bezt->vec[1][0] -= offset;
+                               bezt->vec[2][0] -= offset;
+                       }
+                       
+                       /* recalculate F-Curve's handles? */
+                       calchandles_fcurve(fcu);
+               }
+       }
+       
+       return 0;
+}
+
+/* **************************************************** */
index 9529eb840116183d75507662d669ae0e9b31ee64..f490fb774389c9dd6fa83cdf05c7cae7c7bddd4b 100644 (file)
@@ -130,13 +130,11 @@ FCurve *verify_fcurve (ID *id, const char group[], const char rna_path[], const
                                /* Add a new group, and make it active */
                                grp= MEM_callocN(sizeof(bActionGroup), "bActionGroup");
                                
-                               grp->flag |= (AGRP_ACTIVE|AGRP_SELECTED|AGRP_EXPANDED);
+                               grp->flag = AGRP_SELECTED;
                                BLI_snprintf(grp->name, 64, group);
                                
                                BLI_addtail(&act->groups, grp);
                                BLI_uniquename(&act->groups, grp, "Group", offsetof(bActionGroup, name), 64);
-                               
-                               set_active_action_group(act, grp, 1);
                        }
                        
                        /* add F-Curve to group */
@@ -656,7 +654,7 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_
                                float eul[3];
                                
                                Mat4ToEul(ob->obmat, eul);
-                               return eul[array_index]*(5.72958f);
+                               return eul[array_index];
                        }
                }
        }
@@ -854,7 +852,6 @@ short deletekey (ID *id, const char group[], const char rna_path[], int array_in
                        delete_fcurve_key(fcu, i, 1);
                        
                        /* Only delete curve too if there are no points (we don't need to check for drivers, as they're kept separate) */
-                       // XXX how do we handle drivers then?
                        if (fcu->totvert == 0) {
                                BLI_remlink(&act->curves, fcu);
                                free_fcurve(fcu);
@@ -1800,342 +1797,6 @@ static void commonkey_context_getsbuts (const bContext *C, ListBase *sources, bK
        *ksc= NULL;
 }
 
-
-/* get keyingsets for appropriate context */
-static void commonkey_context_get (const bContext *C, ScrArea *sa, short mode, ListBase *sources, bKeyingContext **ksc)
-{
-       /* get current view if no view is defined */
-       if (sa == NULL)
-               sa= CTX_wm_area(C);
-       
-       /* check view type */
-       switch (sa->spacetype) {
-               /* 3d view - first one tested as most often used */
-               case SPACE_VIEW3D:
-               {
-                       commonkey_context_getv3d(C, sources, ksc);
-               }
-                       break;
-                       
-               /* buttons view */
-               case SPACE_BUTS:
-               {
-                       commonkey_context_getsbuts(C, sources, ksc);
-               }
-                       break;
-                       
-               /* spaces with their own methods */
-               case SPACE_IPO:
-                       //if (mode == COMMONKEY_MODE_INSERT)
-                       //      insertkey_editipo(); // XXX old calls...
-                       return;
-               case SPACE_ACTION:
-                       //if (mode == COMMONKEY_MODE_INSERT)
-                       //      insertkey_action(); // XXX old calls...
-                       return;
-                       
-               /* timeline view - keyframe buttons */
-               case SPACE_TIME:
-               {
-                       bScreen *sc= CTX_wm_screen(C);
-                       ScrArea *sab;
-                       int bigarea= 0;
-                       
-                       /* try to find largest 3d-view available 
-                        * (mostly of the time, this is what when user will want this,
-                        *  as it's a standard feature in all other apps) 
-                        */
-                       //sab= find_biggest_area_of_type(SPACE_VIEW3D);
-                       sab= NULL; // XXX for now...
-                       if (sab) {
-                               commonkey_context_getv3d(C, sources, ksc);
-                               return;
-                       }
-                       
-                       /* if not found, sab is now NULL, so perform own biggest area test */
-                       for (sa= sc->areabase.first; sa; sa= sa->next) { // XXX this has changed!
-                               int area= sa->winx * sa->winy;
-                               
-                               if (sa->spacetype != SPACE_TIME) {
-                                       if ( (!sab) || (area > bigarea) ) {
-                                               sab= sa;
-                                               bigarea= area;
-                                       }
-                               }
-                       }
-                       
-                       /* use whichever largest area was found (it shouldn't be a time window) */
-                       if (sab)
-                               commonkey_context_get(C, sab, mode, sources, ksc);
-               }
-                       break;
-       }
-}
-
-/* flush updates after all operations */
-static void commonkey_context_finish (const bContext *C, ListBase *sources)
-{
-       ScrArea *curarea= CTX_wm_area(C);
-       Scene *scene= CTX_data_scene(C);
-       
-       /* check view type */
-       switch (curarea->spacetype) {
-               /* 3d view - first one tested as most often used */
-               case SPACE_VIEW3D:
-               {
-                       /* either pose or object level */
-                       if (OBACT && (OBACT->pose)) {   
-                               //Object *ob= OBACT;
-                               
-                               /* recalculate ipo handles, etc. */
-                               // XXX this method has been removed!
-                               //if (ob->action)
-                               //      remake_action_ipos(ob->action);
-                               
-                               /* recalculate bone-paths on adding new keyframe? */
-                               // XXX missing function
-                               // TODO: currently, there is no setting to turn this on/off globally
-                               //if (ob->pose->flag & POSE_RECALCPATHS)
-                               //      pose_recalculate_paths(ob);
-                       }
-                       else {
-                               bCommonKeySrc *cks;
-                               
-                               /* loop over bases (as seen in sources) */
-                               for (cks= sources->first; cks; cks= cks->next) {
-                                       Object *ob= (Object *)cks->id;
-                                       
-                                       /* simply set recalc flag */
-                                       ob->recalc |= OB_RECALC_OB;
-                               }
-                       }
-               }
-                       break;
-       }
-}
-
-/* flush refreshes after undo */
-static void commonkey_context_refresh (bContext *C)
-{
-       ScrArea *curarea= CTX_wm_area(C);
-       
-       /* check view type */
-       switch (curarea->spacetype) {
-               /* 3d view - first one tested as most often used */
-               case SPACE_VIEW3D:
-               {
-                       /* do refreshes */
-                       ED_anim_dag_flush_update(C);
-               }
-                       break;
-                       
-               /* buttons window */
-               case SPACE_BUTS:
-               {
-                       //allspace(REMAKEIPO, 0);
-                       //allqueue(REDRAWVIEW3D, 0);
-                       //allqueue(REDRAWMARKER, 0);
-               }
-                       break;
-       }
-}
-
-/* --- */
-
-/* Get the keying set that was chosen by the user from the menu */
-static bKeyingSet *get_keyingset_fromcontext (bKeyingContext *ksc, short index)
-{
-       /* check if index is valid */
-       if (ELEM(NULL, ksc, ksc->keyingsets))
-               return NULL;
-       if ((index < 1) || (index > ksc->tot))
-               return NULL;
-               
-       /* index starts from 1, and should directly correspond to keyingset in array */
-       return (bKeyingSet *)(ksc->keyingsets + (index - 1));
-}
-
-/* ---------------- Keyframe Management API -------------------- */
-
-/* Display a menu for handling the insertion of keyframes based on the active view */
-void common_modifykey (bContext *C, short mode)
-{
-       ListBase dsources = {NULL, NULL};
-       bKeyingContext *ksc= NULL;
-       bCommonKeySrc *cks;
-       bKeyingSet *ks = NULL;
-       char *menustr, buf[64];
-       short menu_nr;
-       
-       /* check if mode is valid */
-       if (ELEM(mode, COMMONKEY_MODE_INSERT, COMMONKEY_MODE_DELETE)==0)
-               return;
-       
-       /* delegate to other functions or get keyingsets to use 
-        *      - if the current area doesn't have its own handling, there will be data returned...
-        */
-       commonkey_context_get(C, NULL, mode, &dsources, &ksc);
-       
-       /* check that there is data to operate on */
-       if (ELEM(NULL, dsources.first, ksc)) {
-               BLI_freelistN(&dsources);
-               return;
-       }
-       
-       /* get menu and process it */
-       if (mode == COMMONKEY_MODE_DELETE)
-               menustr= build_keyingsets_menu(ksc, "Delete");
-       else
-               menustr= build_keyingsets_menu(ksc, "Insert");
-       // XXX: this goes to the invoke!
-       //menu_nr= pupmenu(menustr);
-       //if (menustr) MEM_freeN(menustr);
-       menu_nr = -1; // XXX for now
-       
-       /* no item selected or shapekey entry? */
-       if (menu_nr < 1) {
-               /* free temp sources */
-               BLI_freelistN(&dsources);
-               
-               /* check if insert new shapekey */
-               // XXX missing function!
-               //if ((menu_nr == 0) && (mode == COMMONKEY_MODE_INSERT))
-               //      insert_shapekey(OBACT);
-               //else 
-                       ksc->lastused= NULL;
-                       
-               return;
-       }
-       else {
-               /* try to get keyingset */
-               ks= get_keyingset_fromcontext(ksc, menu_nr);
-               
-               if (ks == NULL) {
-                       BLI_freelistN(&dsources);
-                       return;
-               }
-       }
-       
-       /* loop over each destination, applying the keying set */
-       for (cks= dsources.first; cks; cks= cks->next) {
-               short success= 0;
-               
-               /* special hacks for 'available' option */
-               if (ks->flag == -2) {
-                       IpoCurve *icu= NULL, *icn= NULL;
-                       
-                       /* get first IPO-curve */
-                       if (cks->act && cks->actname) {
-                               bActionChannel *achan= get_action_channel(cks->act, cks->actname);
-                               
-                               // FIXME: what about constraint channels?
-                               if (achan && achan->ipo)
-                                       icu= achan->ipo->curve.first; 
-                       }
-                       else if(cks->ipo)
-                               icu= cks->ipo->curve.first;
-                               
-                       /* we get adrcodes directly from IPO curves (see method below...) */
-                       for (; icu; icu= icn) {
-                               short flag;
-                               
-                               /* get next ipo-curve in case current is deleted */
-                               icn= icu->next;
-                               
-                               /* insert mode or delete mode */
-                               if (mode == COMMONKEY_MODE_DELETE) {
-                                       /* local flags only add on to global flags */
-                                       flag = 0;
-                                       
-                                       /* delete keyframe */
-                                       success += deletekey(cks->id, ks->blocktype, cks->actname, cks->constname, icu->adrcode, flag);
-                               }
-                               else {
-                                       /* local flags only add on to global flags */
-                                       flag = ks->flag;
-                                       if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX;
-                                       if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED;
-                                       // if (IS_AUTOKEY_MODE(EDITKEYS)) flag |= INSERTKEY_REPLACE;
-                                       
-                                       /* insert keyframe */
-                                       success += insertkey(cks->id, ks->blocktype, cks->actname, cks->constname, icu->adrcode, flag);
-                               }
-                       }
-               }
-               else {
-                       bKS_AdrcodeGetter kag;
-                       short (*get_next_adrcode)(bKS_AdrcodeGetter *);
-                       int adrcode;
-                       
-                       /* initialise keyingset channel iterator */
-                       ks_adrcodegetter_init(&kag, ks, cks);
-                       
-                       /* get iterator - only one can be in use at a time... the flags should be mutually exclusive in this regard */
-                       if (ks->flag & COMMONKEY_PCHANROT)
-                               get_next_adrcode= ks_getnextadrcode_pchanrot;
-                       else if (ks->flag & COMMONKEY_ADDMAP)
-                               get_next_adrcode= ks_getnextadrcode_addmap;
-                       else
-                               get_next_adrcode= ks_getnextadrcode_default;
-                       
-                       /* loop over channels available in keyingset */
-                       for (adrcode= get_next_adrcode(&kag); adrcode > 0; adrcode= get_next_adrcode(&kag)) {
-                               short flag;
-                               
-                               /* insert mode or delete mode */
-                               if (mode == COMMONKEY_MODE_DELETE) {
-                                       /* local flags only add on to global flags */
-                                       flag = 0;
-                                       //flag &= ~COMMONKEY_MODES;
-                                       
-                                       /* delete keyframe */
-                                       success += deletekey(cks->id, ks->blocktype, cks->actname, cks->constname, adrcode, flag);
-                               }
-                               else {
-                                       /* local flags only add on to global flags */
-                                       flag = ks->flag;
-                                       if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX;
-                                       if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED;
-                                       // if (IS_AUTOKEY_MODE(EDITKEYS)) flag |= INSERTKEY_REPLACE;
-                                       flag &= ~COMMONKEY_MODES;
-                                       
-                                       /* insert keyframe */
-                                       success += insertkey(cks->id, ks->blocktype, cks->actname, cks->constname, adrcode, flag);
-                               }
-                       }
-               }
-               
-               /* special handling for some key-sources */
-               if (success) {
-                       /* set pose recalc-paths flag */
-                       if (cks->pchan) {
-                               Object *ob= (Object *)cks->id;
-                               bPoseChannel *pchan= cks->pchan;
-                               
-                               /* set flag to trigger path recalc */
-                               if (pchan->path) 
-                                       ob->pose->flag |= POSE_RECALCPATHS;
-                                       
-                               /* clear unkeyed flag (it doesn't matter if it's set or not) */
-                                       // XXX old animation system
-                               //if (pchan->bone)
-                               //      pchan->bone->flag &= ~BONE_UNKEYED;
-                       }
-                       
-                       // XXX for new system, need to remove overrides
-               }
-       }
-       
-       /* apply post-keying flushes for this data sources */
-       commonkey_context_finish(C, &dsources);
-       
-       /* free temp data */
-       BLI_freelistN(&dsources);
-       
-       /* queue updates for contexts */
-       commonkey_context_refresh(C);
-}
-
 #endif // XXX old keyingsets code based on adrcodes... to be restored in due course
 
 /* Given a KeyingSet and context info (if required), modify keyframes for the channels specified
@@ -2224,6 +1885,34 @@ static int commonkey_modifykey (ListBase *dsources, KeyingSet *ks, short mode, f
        return success;
 }
 
+
+/* Polling callback for use with ANIM_*_keyframe() operators
+ * This is based on the standard ED_operator_areaactive callback,
+ * except that it does special checks for a few spacetypes too...
+ */
+static int modify_key_op_poll(bContext *C)
+{
+       ScrArea *sa= CTX_wm_area(C);
+       Scene *scene= CTX_data_scene(C);
+       
+       /* if no area or active scene */
+       if (ELEM(NULL, sa, scene)) 
+               return 0;
+       
+       /* if Outliner, only allow in DataBlocks view */
+       if (sa->spacetype == SPACE_OOPS) {
+               SpaceOops *so= (SpaceOops *)CTX_wm_space_data(C);
+               
+               if ((so->type != SO_OUTLINER) || (so->outlinevis != SO_DATABLOCKS))
+                       return 0;
+       }
+       
+       /* TODO: checks for other space types can be added here */
+       
+       /* should be fine */
+       return 1;
+}
+
 /* Insert Key Operator ------------------------ */
 
 /* NOTE:
@@ -2232,7 +1921,7 @@ static int commonkey_modifykey (ListBase *dsources, KeyingSet *ks, short mode, f
  *
  *     -- Joshua Leung, Feb 2009
  */
-
 static int insert_key_exec (bContext *C, wmOperator *op)
 {
        ListBase dsources = {NULL, NULL};
@@ -2275,7 +1964,7 @@ void ANIM_OT_insert_keyframe (wmOperatorType *ot)
        
        /* callbacks */
        ot->exec= insert_key_exec; 
-       ot->poll= ED_operator_areaactive;
+       ot->poll= modify_key_op_poll;
        
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2332,8 +2021,7 @@ void ANIM_OT_delete_keyframe (wmOperatorType *ot)
        
        /* callbacks */
        ot->exec= delete_key_exec; 
-       
-       ot->poll= ED_operator_areaactive;
+       ot->poll= modify_key_op_poll;
        
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2454,7 +2142,7 @@ static int insert_key_old_exec (bContext *C, wmOperator *op)
                                        success+= insertkey(id, "Object Transforms", "rotation", 1, cfra, 0);
                                        success+= insertkey(id, "Object Transforms", "rotation", 2, cfra, 0);
                                        break;
-                               case 1: /* object location */
+                               default: /* object location */
                                        success+= insertkey(id, "Object Transforms", "location", 0, cfra, 0);
                                        success+= insertkey(id, "Object Transforms", "location", 1, cfra, 0);
                                        success+= insertkey(id, "Object Transforms", "location", 2, cfra, 0);
@@ -2473,13 +2161,13 @@ static int insert_key_old_exec (bContext *C, wmOperator *op)
                                                char buf[512];
                                                
                                                switch (mode) {
-                                               case 6: /* pchan scale */
+                                               case 7: /* pchan scale */
                                                        sprintf(buf, "pose.pose_channels[\"%s\"].scale", pchan->name);
                                                        success+= insertkey(id, pchan->name, buf, 0, cfra, 0);
                                                        success+= insertkey(id, pchan->name, buf, 1, cfra, 0);
                                                        success+= insertkey(id, pchan->name, buf, 2, cfra, 0);
                                                        break;
-                                               case 5: /* pchan rotation */
+                                               case 6: /* pchan rotation */
                                                        if (pchan->rotmode == PCHAN_ROT_QUAT) {
                                                                sprintf(buf, "pose.pose_channels[\"%s\"].rotation", pchan->name);
                                                                success+= insertkey(id, pchan->name, buf, 0, cfra, 0);
index 6ca92f356446940d9a9350de4cd30eae53683b4d..9f50bb3f044479f37c69115468c3716046bb5a33 100644 (file)
@@ -45,6 +45,10 @@ void ARMATURE_OT_de_select_all(struct wmOperatorType *ot);
 void ARMATURE_OT_selection_invert(struct wmOperatorType *ot);
 void ARMATURE_OT_select_hierarchy(struct wmOperatorType *ot);
 void ARMATURE_OT_select_connected(struct wmOperatorType *ot);
+void ARMATURE_OT_delete_selected(struct wmOperatorType *ot);
+void ARMATURE_OT_duplicate_selected(struct wmOperatorType *ot);
+void ARMATURE_OT_extrude(struct wmOperatorType *ot);
+void ARMATURE_OT_click_extrude(struct wmOperatorType *ot);
 
 void POSE_OT_hide(struct wmOperatorType *ot);
 void POSE_OT_reveal(struct wmOperatorType *ot);
index 12554c8492fba98ffc563dc8acee494433ac1844..e80d4d017d9c3c0d58c4f874c6673e0f9cebf743 100644 (file)
@@ -124,6 +124,11 @@ void ED_operatortypes_armature(void)
        WM_operatortype_append(ARMATURE_OT_selection_invert);
        WM_operatortype_append(ARMATURE_OT_select_hierarchy);
        WM_operatortype_append(ARMATURE_OT_select_connected);
+
+       WM_operatortype_append(ARMATURE_OT_delete_selected);
+       WM_operatortype_append(ARMATURE_OT_duplicate_selected);
+       WM_operatortype_append(ARMATURE_OT_extrude);
+       WM_operatortype_append(ARMATURE_OT_click_extrude);
        
        /* POSE */
        WM_operatortype_append(POSE_OT_hide);
@@ -185,6 +190,12 @@ void ED_keymap_armature(wmWindowManager *wm)
        RNA_boolean_set(kmi->ptr, "add_to_sel", 1);
 
        WM_keymap_add_item(keymap, "ARMATURE_OT_select_connected", LKEY, KM_PRESS, 0, 0);
+       WM_keymap_add_item(keymap, "ARMATURE_OT_delete_selected", XKEY, KM_PRESS, 0, 0);
+       WM_keymap_add_item(keymap, "ARMATURE_OT_duplicate_selected", DKEY, KM_PRESS, KM_SHIFT, 0);
+       WM_keymap_add_item(keymap, "ARMATURE_OT_extrude", EKEY, KM_PRESS, 0, 0);
+       kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_extrude", EKEY, KM_PRESS, KM_SHIFT, 0);
+       RNA_boolean_set(kmi->ptr, "forked", 1);
+       WM_keymap_add_item(keymap, "ARMATURE_OT_click_extrude", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
        
        /* Pose ------------------------ */
        /* only set in posemode, by space_view3d listener */
index 3d8753d3ade2f6cdc3f7a14159e18ff20683e091..021f87ea663ac2422da5fb83920b7ce1a0eb905b 100644 (file)
@@ -74,6 +74,7 @@
 #include "PIL_time.h"
 
 #include "BIF_gl.h"
+#include "BIF_transform.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
@@ -678,7 +679,7 @@ int join_armature(Scene *scene, View3D *v3d)
        
        /*      Ensure we're not in editmode and that the active object is an armature*/
        if (ob->type!=OB_ARMATURE) return 0;
-       if(arm->edbo) return 0;
+       if (arm->edbo) return 0;
        
        if (object_data_is_libdata(ob)) {
                error_libdata();
@@ -1172,7 +1173,6 @@ static void bone_setflag (int *bone, int flag, short mode)
                                *bone &= ~flag;
                        else
                                *bone ^= flag;
-
                }
                else {
                        if (mode == 2)
@@ -1585,15 +1585,22 @@ EditBone *ED_armature_bone_get_mirrored(ListBase *edbo, EditBone *ebo)
        return eboflip;
 }
 
+
+/* previously delete_armature */
 /* only editmode! */
-void delete_armature(Scene *scene)
+static int armature_delete_selected_exec(bContext *C, wmOperator *op)
 {
-       Object *obedit= scene->obedit; // XXX get from context
-       bArmature *arm= obedit->data;
+       bArmature *arm;
        EditBone        *curBone, *next;
        bConstraint *con;
-       
-       if (okee("Erase selected bone(s)")==0) return;
+       Object *obedit= CTX_data_edit_object(C); // XXX get from context
+       arm = obedit->data;
+
+       /* cancel if nothing selected */
+       if (CTX_DATA_COUNT(C, selected_bones) == 0)
+         return OPERATOR_CANCELLED;
+
+       /* if (okee("Erase selected bone(s)")==0) return; */
 
        /* Select mirrored bones */
        if (arm->flag & ARM_MIRROR_EDIT) {
@@ -1659,8 +1666,25 @@ void delete_armature(Scene *scene)
        
        
        armature_sync_selection(arm->edbo);
+
+       WM_event_add_notifier(C, NC_OBJECT, obedit);
+
+       return OPERATOR_FINISHED;
+}
+
+void ARMATURE_OT_delete_selected(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Delete Selected Bone(s)";
+       ot->idname= "ARMATURE_OT_delete_selected";
+       
+       /* api callbacks */
+       ot->invoke = WM_operator_confirm;
+       ot->exec = armature_delete_selected_exec;
+       ot->poll = ED_operator_editarmature;
        
-       BIF_undo_push("Delete bone(s)");
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* toggle==0: deselect
@@ -2087,7 +2111,8 @@ static EditBone *add_editbone(Object *obedit, char *name)
        return bone;
 }
 
-static void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d, short newob)
+/* v3d and rv3d are allowed to be NULL */
+void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d)
 {
        Object *obedit= scene->obedit; // XXX get from context
        float           obmat[3][3], curs[3], viewmat[3][3], totmat[3][3], imat[3][3];
@@ -2099,7 +2124,7 @@ static void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d, sh
        Mat4Invert(obedit->imat, obedit->obmat);
        Mat4MulVecfl(obedit->imat, curs);
 
-       if ( !(newob) || (U.flag & USER_ADD_VIEWALIGNED) ) 
+       if (rv3d && (U.flag & USER_ADD_VIEWALIGNED))
                Mat3CpyMat4(obmat, rv3d->viewmat);
        else Mat3One(obmat);
        
@@ -2114,60 +2139,30 @@ static void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d, sh
 
        VECCOPY(bone->head, curs);
        
-       if ( !(newob) || (U.flag & USER_ADD_VIEWALIGNED) )
+       if ( (U.flag & USER_ADD_VIEWALIGNED) )
                VecAddf(bone->tail, bone->head, imat[1]);       // bone with unit length 1
        else
                VecAddf(bone->tail, bone->head, imat[2]);       // bone with unit length 1, pointing up Z
        
 }
 
-void add_primitiveArmature(Scene *scene, View3D *v3d, int type)
-{
-       RegionView3D *rv3d= NULL; // XXX get from context
-       Object *obedit= scene->obedit; // XXX get from context
-       short newob=0;
-       
-       if(scene->id.lib) return;
-       
-       G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT+G_SCULPTMODE);
-//     setcursor_space(SPACE_VIEW3D, CURSOR_STD);
-
-// XXX check_editmode(OB_ARMATURE);
-       
-       /* If we're not the "obedit", make a new object and enter editmode */
-       if (obedit==NULL) {
-               add_object(scene, OB_ARMATURE);
-               ED_object_base_init_from_view(NULL, BASACT);    // XXX NULL is C
-               obedit= BASACT->object;
-               
-               where_is_object(scene, obedit);
-               
-               ED_armature_to_edit(obedit);
-//             setcursor_space(SPACE_VIEW3D, CURSOR_EDIT);
-               newob=1;
-       }
-       
-       /* no primitive support yet */
-       add_primitive_bone(scene, v3d, rv3d, newob);
-       
-       //armature_sync_selection(arm->edbo); // XXX which armature?
-
-       if ((newob) && !(U.flag & USER_ADD_EDITMODE)) {
-               ED_armature_from_edit(scene, obedit);
-               ED_armature_edit_free(obedit);
-       }
-       
-       BIF_undo_push("Add primitive");
-}
 
+/* previously addvert_armature */
 /* the ctrl-click method */
-void addvert_armature(Scene *scene, View3D *v3d)
+static int armature_click_extrude_exec(bContext *C, wmOperator *op)
 {
-       Object *obedit= scene->obedit; // XXX get from context
-       bArmature *arm= obedit->data;
+       View3D *v3d;
+       bArmature *arm;
        EditBone *ebone, *newbone, *flipbone;
        float *curs, mat[3][3],imat[3][3];
        int a, to_root= 0;
+       Object *obedit;
+       Scene *scene;
+
+       scene = CTX_data_scene(C);
+       v3d= CTX_wm_view3d(C);
+       obedit= CTX_data_edit_object(C);
+       arm= obedit->data;
        
        /* find the active or selected bone */
        for (ebone = arm->edbo->first; ebone; ebone=ebone->next) {
@@ -2185,7 +2180,7 @@ void addvert_armature(Scene *scene, View3D *v3d)
                        }
                }
                if (ebone == NULL) 
-                       return;
+                       return OPERATOR_CANCELLED;
                
                to_root= 1;
        }
@@ -2239,8 +2234,83 @@ void addvert_armature(Scene *scene, View3D *v3d)
        }
        
        armature_sync_selection(arm->edbo);
+
+       WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, obedit);
+       
+       return OPERATOR_FINISHED;
+}
+
+static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+       /* TODO most of this code is copied from set3dcursor_invoke,
+          it would be better to reuse code in set3dcursor_invoke */
+
+       /* temporarily change 3d cursor position */
+       Scene *scene;
+       ARegion *ar;
+       View3D *v3d;
+       RegionView3D *rv3d;
+       float dx, dy, fz, *fp = NULL, dvec[3], oldcurs[3];
+       short mx, my, mval[2];
+       int retv;
+
+       scene= CTX_data_scene(C);
+       ar= CTX_wm_region(C);
+       v3d = CTX_wm_view3d(C);
+       rv3d= CTX_wm_region_view3d(C);
+       
+       fp= give_cursor(scene, v3d);
+       
+       VECCOPY(oldcurs, fp);
+       
+       mx= event->x - ar->winrct.xmin;
+       my= event->y - ar->winrct.ymin;
+       project_short_noclip(ar, fp, mval);
+       
+       initgrabz(rv3d, fp[0], fp[1], fp[2]);
+       
+       if(mval[0]!=IS_CLIPPED) {
+               
+               window_to_3d_delta(ar, dvec, mval[0]-mx, mval[1]-my);
+               VecSubf(fp, fp, dvec);
+       }
+       else {
+               
+               dx= ((float)(mx-(ar->winx/2)))*rv3d->zfac/(ar->winx/2);
+               dy= ((float)(my-(ar->winy/2)))*rv3d->zfac/(ar->winy/2);
+               
+               fz= rv3d->persmat[0][3]*fp[0]+ rv3d->persmat[1][3]*fp[1]+ rv3d->persmat[2][3]*fp[2]+ rv3d->persmat[3][3];
+               fz= fz/rv3d->zfac;
+               
+               fp[0]= (rv3d->persinv[0][0]*dx + rv3d->persinv[1][0]*dy+ rv3d->persinv[2][0]*fz)-rv3d->ofs[0];
+               fp[1]= (rv3d->persinv[0][1]*dx + rv3d->persinv[1][1]*dy+ rv3d->persinv[2][1]*fz)-rv3d->ofs[1];
+               fp[2]= (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy+ rv3d->persinv[2][2]*fz)-rv3d->ofs[2];
+       }
+
+       /* extrude to the where new cursor is and store the operation result */
+       retv= armature_click_extrude_exec(C, op);
+
+       /* restore previous 3d cursor position */
+       VECCOPY(fp, oldcurs);
+
+       return retv;
+}
+
+void ARMATURE_OT_click_extrude(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Click-Extrude";
+       ot->idname= "ARMATURE_OT_click_extrude";
        
-       BIF_undo_push("Add Bone");
+       /* api callbacks */
+       ot->invoke = armature_click_extrude_invoke;
+       ot->exec = armature_click_extrude_exec;
+       ot->poll = ED_operator_editarmature;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+       /* props */
 }
 
 /* adds an EditBone between the nominated locations (should be in the right space) */
@@ -2320,14 +2390,20 @@ static void update_dup_subtarget(Object *obedit, EditBone *dupBone)
        }
 }
 
-
-void adduplicate_armature(Scene *scene)
+/* previously adduplicate_armature */
+static int armature_duplicate_selected_exec(bContext *C, wmOperator *op)
 {
-       Object *obedit= scene->obedit; // XXX get from context
-       bArmature *arm= obedit->data;
+       bArmature *arm;
        EditBone        *eBone = NULL;
        EditBone        *curBone;
        EditBone        *firstDup=NULL; /*      The beginning of the duplicated bones in the edbo list */
+
+       Object *obedit= CTX_data_edit_object(C);
+       arm= obedit->data;
+
+       /* cancel if nothing selected */
+       if (CTX_DATA_COUNT(C, selected_bones) == 0)
+         return OPERATOR_CANCELLED;
        
        armature_sync_selection(arm->edbo); // XXX why is this needed?
 
@@ -2351,7 +2427,7 @@ void adduplicate_armature(Scene *scene)
                                eBone=MEM_callocN(sizeof(EditBone), "addup_editbone");
                                eBone->flag |= BONE_SELECTED;
                                
-                               /*      Copy data from old bone to new bone */
+                               /* Copy data from old bone to new bone */
                                memcpy(eBone, curBone, sizeof(EditBone));
                                
                                curBone->temp = eBone;
@@ -2369,7 +2445,7 @@ void adduplicate_armature(Scene *scene)
                                        bPoseChannel *chanold, *channew;
                                        ListBase     *listold, *listnew;
                                        
-                                       chanold = verify_pose_channel(OBACT->pose, curBone->name);
+                                       chanold = verify_pose_channel(obedit->pose, curBone->name);
                                        if (chanold) {
                                                listold = &chanold->constraints;
                                                if (listold) {
@@ -2377,7 +2453,7 @@ void adduplicate_armature(Scene *scene)
                                                         *              yet as the new bones created here are still 'EditBones' not 'Bones'. 
                                                         */
                                                        channew = 
-                                                               verify_pose_channel(OBACT->pose, eBone->name);
+                                                               verify_pose_channel(obedit->pose, eBone->name);
                                                        if (channew) {
                                                                /* copy transform locks */
                                                                channew->protectflag = chanold->protectflag;
@@ -2412,43 +2488,74 @@ void adduplicate_armature(Scene *scene)
                        if (curBone->flag & BONE_SELECTED) {
                                eBone=(EditBone*) curBone->temp;
                                
-                               /*      If this bone has no parent,
-                               Set the duplicate->parent to NULL
-                               */
-                               if (!curBone->parent)
+                               if (!curBone->parent) {
+                                       /* If this bone has no parent,
+                                        * Set the duplicate->parent to NULL
+                                        */
                                        eBone->parent = NULL;
-                               /*      If this bone has a parent that IS selected,
-                                       Set the duplicate->parent to the curBone->parent->duplicate
-                                       */
-                               else if (curBone->parent->flag & BONE_SELECTED)
+                               }
+                               else if (curBone->parent->flag & BONE_SELECTED) {
+                                       /* If this bone has a parent that IS selected,
+                                        * Set the duplicate->parent to the curBone->parent->duplicate
+                                        */
                                        eBone->parent= (EditBone *)curBone->parent->temp;
-                               /*      If this bone has a parent that IS not selected,
-                                       Set the duplicate->parent to the curBone->parent
-                                       */
+                               }
                                else {
+                                       /* If this bone has a parent that IS not selected,
+                                        * Set the duplicate->parent to the curBone->parent
+                                        */
                                        eBone->parent=(EditBone*) curBone->parent; 
                                        eBone->flag &= ~BONE_CONNECTED;
                                }
                                
                                /* Lets try to fix any constraint subtargets that might
-                                       have been duplicated */
+                                * have been duplicated 
+                                */
                                update_dup_subtarget(obedit, eBone);
                        }
                }
        } 
        
        /*      Deselect the old bones and select the new ones */
-       
        for (curBone=arm->edbo->first; curBone && curBone!=firstDup; curBone=curBone->next) {
                if (EBONE_VISIBLE(arm, curBone))
                        curBone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL | BONE_ACTIVE);
        }
+
+       WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, obedit);
        
-// XXX BIF_TransformSetUndo("Add Duplicate");
-//     initTransform(TFM_TRANSLATION, CTX_NO_PET);
-//     Transform();
+       return OPERATOR_FINISHED;
 }
 
+static int armature_duplicate_selected_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+       int retv= armature_duplicate_selected_exec(C, op);
+
+       if (retv == OPERATOR_FINISHED) {
+               RNA_int_set(op->ptr, "mode", TFM_TRANSLATION);
+               WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
+       }
+
+       return retv;
+}
+
+void ARMATURE_OT_duplicate_selected(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Duplicate Selected Bone(s)";
+       ot->idname= "ARMATURE_OT_duplicate_selected";
+       
+       /* api callbacks */
+       ot->invoke = armature_duplicate_selected_invoke;
+       ot->exec = armature_duplicate_selected_exec;
+       ot->poll = ED_operator_editarmature;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+       /* to give to transform */
+       RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX);
+}
 
 
 /* *************** END Adding stuff in editmode *************** */
@@ -2909,15 +3016,20 @@ void show_all_armature_bones(Scene *scene)
        BIF_undo_push("Reveal Bones");
 }
 
+/* previously extrude_armature */
 /* context; editmode armature */
 /* if forked && mirror-edit: makes two bones with flipped names */
-void extrude_armature(Scene *scene, int forked)
+static int armature_extrude_exec(bContext *C, wmOperator *op)
 {
-       Object *obedit= scene->obedit; // XXX get from context
-       bArmature *arm= obedit->data;
+       Object *obedit;
+       bArmature *arm;
        EditBone *newbone, *ebone, *flipbone, *first=NULL;
        int a, totbone= 0, do_extrude;
-       
+       int forked = RNA_boolean_get(op->ptr, "forked");
+
+       obedit= CTX_data_edit_object(C);
+       arm= obedit->data;
+
        /* since we allow root extrude too, we have to make sure selection is OK */
        for (ebone = arm->edbo->first; ebone; ebone=ebone->next) {
                if (EBONE_VISIBLE(arm, ebone)) {
@@ -3029,13 +3141,44 @@ void extrude_armature(Scene *scene, int forked)
        }
        /* if only one bone, make this one active */
        if (totbone==1 && first) first->flag |= BONE_ACTIVE;
+
+       if (totbone==0) return OPERATOR_CANCELLED;
        
        /* Transform the endpoints */
        armature_sync_selection(arm->edbo);
-// XXX BIF_TransformSetUndo("Extrude");
-//     initTransform(TFM_TRANSLATION, CTX_NO_PET);
-//     Transform();
+
+       return OPERATOR_FINISHED;
+}
+
+static int armature_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+       if (OPERATOR_CANCELLED == armature_extrude_exec(C, op))
+               return OPERATOR_CANCELLED;
+
+       RNA_int_set(op->ptr, "mode", TFM_TRANSLATION);
+       WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
+
+       return OPERATOR_FINISHED;
+}
+
+void ARMATURE_OT_extrude(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Extrude";
+       ot->idname= "ARMATURE_OT_extrude";
+       
+       /* api callbacks */
+       ot->invoke= armature_extrude_invoke;
+       ot->exec= armature_extrude_exec;
+       ot->poll= ED_operator_editarmature;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
+       /* props */
+       RNA_def_boolean(ot->srna, "forked", 0, "Forked", "");
+       /* to give to transform */
+       RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX);
 }
 /* ********************** Bone Add ********************/
 
@@ -3356,6 +3499,8 @@ void ARMATURE_OT_switch_direction(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 /* ***************** Parenting *********************** */
+
+/* armature parenting options */
 #define ARM_PAR_CONNECT 1
 #define ARM_PAR_OFFSET 2
 
@@ -3465,14 +3610,19 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op)
                /* Parent 'selected' bones to the active one
                 * - the context iterator contains both selected bones and their mirrored copies,
                 *   so we assume that unselected bones are mirrored copies of some selected bone
+                * - since the active one (and/or its mirror) will also be selected, we also need 
+                *      to check that we are not trying to opearate on them, since such an operation 
+                *      would cause errors
                 */
                
-               /* align selected bones to the active one */
+               /* parent selected bones to the active one */
                CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) {
-                       if (ebone->flag & BONE_SELECTED) 
-                               bone_connect_to_new_parent(arm->edbo, ebone, actbone, val);
-                       else
-                               bone_connect_to_new_parent(arm->edbo, ebone, actmirb, val);
+                       if (ELEM(ebone, actbone, actmirb) == 0) {
+                               if (ebone->flag & BONE_SELECTED) 
+                                       bone_connect_to_new_parent(arm->edbo, ebone, actbone, val);
+                               else
+                                       bone_connect_to_new_parent(arm->edbo, ebone, actmirb, val);
+                       }
                }
                CTX_DATA_END;
        }
@@ -3831,14 +3981,19 @@ static int armature_align_bones_exec(bContext *C, wmOperator *op)
                /* Align 'selected' bones to the active one
                 * - the context iterator contains both selected bones and their mirrored copies,
                 *   so we assume that unselected bones are mirrored copies of some selected bone
+                * - since the active one (and/or its mirror) will also be selected, we also need 
+                *      to check that we are not trying to opearate on them, since such an operation 
+                *      would cause errors
                 */
                
                /* align selected bones to the active one */
                CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) {
-                       if (ebone->flag & BONE_SELECTED)
-                               bone_align_to_bone(arm->edbo, ebone, actbone);
-                       else
-                               bone_align_to_bone(arm->edbo, ebone, actmirb);
+                       if (ELEM(ebone, actbone, actmirb) == 0) {
+                               if (ebone->flag & BONE_SELECTED)
+                                       bone_align_to_bone(arm->edbo, ebone, actbone);
+                               else
+                                       bone_align_to_bone(arm->edbo, ebone, actmirb);
+                       }
                }
                CTX_DATA_END;
        }
index 68223633011418ee706cb8b729ca406e32864a19..bb7a5b500a786b5e3d8778b7396a6afd1f6537a3 100644 (file)
@@ -44,7 +44,6 @@ enum { LINE_BEGIN, LINE_END, PREV_CHAR, NEXT_CHAR, PREV_WORD, NEXT_WORD,
 void FONT_OT_insert_text(struct wmOperatorType *ot);
 void FONT_OT_line_break(struct wmOperatorType *ot);
 void FONT_OT_insert_lorem(struct wmOperatorType *ot);
-void FONT_OT_text_to_object(struct wmOperatorType *ot);
 
 void FONT_OT_toggle_case(struct wmOperatorType *ot);
 void FONT_OT_set_case(struct wmOperatorType *ot);
index 8989d8720eb27fc9af5a4a2e93ec1f127cf6059e..a53acb2e9b72d1a1bf87995892de924e2d45a436 100644 (file)
@@ -99,7 +99,6 @@ void ED_operatortypes_curve(void)
        WM_operatortype_append(FONT_OT_insert_text);
        WM_operatortype_append(FONT_OT_line_break);
        WM_operatortype_append(FONT_OT_insert_lorem);
-       WM_operatortype_append(FONT_OT_text_to_object);
 
        WM_operatortype_append(FONT_OT_toggle_case);
        WM_operatortype_append(FONT_OT_set_case);
index edc1f8aecaebe6ce832be22b156b64a30fe95e73..722dfcdbd1d4d51e9455d96528e411e1d3214b74 100644 (file)
@@ -463,182 +463,96 @@ void FONT_OT_paste_buffer(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
-/******************* XXX text to object operator ********************/
+/******************* text to object operator ********************/
 
-static void txt_export_to_object(Scene *scene, Object *obedit, Text *text)
+static void txt_add_object(bContext *C, TextLine *firstline, int totline, float offset[3])
 {
-       ID *id;
+       Scene *scene= CTX_data_scene(C);
        Curve *cu;
+       Object *obedit;
+       Base *base;
        struct TextLine *tmp;
-       int nchars = 0;
-//     char sdir[FILE_MAXDIR];
-//     char sfile[FILE_MAXFILE];
-
-       if(!text || !text->lines.first) return;
+       int nchars = 0, a;
 
-       id = (ID *)text;
+       obedit= add_object(scene, OB_FONT);
+       base= scene->basact;
 
-       if(obedit && obedit->type==OB_FONT) return;
-// XXX check_editmode(OB_FONT);
-       
-       add_object(scene, OB_FONT);
-
-       ED_object_base_init_from_view(NULL, BASACT); // XXX
-       obedit= BASACT->object;
+       ED_object_base_init_from_view(C, base);
        where_is_object(scene, obedit);
 
-       cu= obedit->data;
-
-/*     
-//             renames object, careful with long filenames.
+       obedit->loc[0] += offset[0];
+       obedit->loc[1] += offset[1];
+       obedit->loc[2] += offset[2];
 
-       if(text->name) {
-       //ID *find_id(char *type, char *name)   
-               BLI_split_dirfile(text->name, sdir, sfile);
-//             rename_id((ID *)obedit, sfile);
-               rename_id((ID *)cu, sfile);
-               id->us++;
-       }
-*/     
+       cu= obedit->data;
        cu->vfont= get_builtin_font();
        cu->vfont->id.us++;
 
-       tmp= text->lines.first;
-       while(cu->len<MAXTEXT && tmp) {
+       for(tmp=firstline, a=0; cu->len<MAXTEXT && a<totline; tmp=tmp->next, a++)
                nchars += strlen(tmp->line) + 1;
-               tmp = tmp->next;
-       }
 
        if(cu->str) MEM_freeN(cu->str);
        if(cu->strinfo) MEM_freeN(cu->strinfo); 
 
-       cu->str= MEM_mallocN(nchars+4, "str");
+       cu->str= MEM_callocN(nchars+4, "str");
        cu->strinfo= MEM_callocN((nchars+4)*sizeof(CharInfo), "strinfo");
-       cu->totbox= cu->actbox= 1;
-       cu->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "textbox");
-       cu->tb[0].w = cu->tb[0].h = 0.0;
+
+       cu->str[0]= '\0';
+       cu->len= 0;
+       cu->pos= 0;
        
-       tmp= text->lines.first;
-       strcpy(cu->str, tmp->line);
-       cu->len= strlen(tmp->line);
-       cu->pos= cu->len;
+       for(tmp=firstline, a=0; cu->len<MAXTEXT && a<totline; tmp=tmp->next, a++) {
+               strcat(cu->str, tmp->line);
+               cu->len+= strlen(tmp->line);
 
-       tmp= tmp->next;
+               if(tmp->next) {
+                       strcat(cu->str, "\n");
+                       cu->len++;
+               }
 
-       while(cu->len<MAXTEXT && tmp) {
-               strcat(cu->str, "\n");
-               strcat(cu->str, tmp->line);
-               cu->len+= strlen(tmp->line) + 1;
                cu->pos= cu->len;
-               tmp= tmp->next;
        }
 
-       make_editText(obedit);
-       ED_object_exit_editmode(NULL, EM_FREEDATA|EM_WAITCURSOR); // XXX
+       WM_event_add_notifier(C, NC_OBJECT|NA_ADDED, obedit);
 }
 
-static void txt_export_to_objects(Scene *scene, Object *obedit, Text *text)
+void ED_text_to_object(bContext *C, Text *text, int split_lines)
 {
-       RegionView3D *rv3d= NULL; // XXX
-       ID *id;
-       Curve *cu;
-       struct TextLine *curline;
-       int nchars;
-       int linenum = 0;
-       float offset[3] = {0.0,0.0,0.0};
+       RegionView3D *rv3d= CTX_wm_region_view3d(C);
+       TextLine *line;
+       float offset[3];
+       int linenum= 0;
 
        if(!text || !text->lines.first) return;
 
-       id = (ID *)text;
-
-       if(obedit && obedit->type==OB_FONT) return;
-// XXX check_editmode(OB_FONT);
-
-       curline = text->lines.first;
-       while(curline){ 
-               /*skip lines with no text, but still make space for them*/
-               if(curline->line[0] == '\0'){
-                       linenum++;
-                       curline = curline->next;
-                       continue;
-               }
-                       
-               nchars = 0;     
-               add_object(scene, OB_FONT);
-       
-               ED_object_base_init_from_view(NULL, BASACT); // XXX
-               obedit= BASACT->object;
-               where_is_object(scene, obedit); 
-               
-               /* Do the translation */
-               offset[0] = 0;
-               offset[1] = -linenum;
-               offset[2] = 0;
-       
-               Mat4Mul3Vecfl(rv3d->viewinv, offset);
-               
-               obedit->loc[0] += offset[0];
-               obedit->loc[1] += offset[1];
-               obedit->loc[2] += offset[2];
-               /* End Translation */
-                                       
-               cu= obedit->data;
-               
-               cu->vfont= get_builtin_font();
-               cu->vfont->id.us++;
-       
-               nchars = strlen(curline->line) + 1;
+       if(split_lines) {
+               for(line=text->lines.first; line; line=line->next) {
+                       /* skip lines with no text, but still make space for them */
+                       if(line->line[0] == '\0') {
+                               linenum++;
+                               continue;
+                       }
        
-               if(cu->str) MEM_freeN(cu->str);
-               if(cu->strinfo) MEM_freeN(cu->strinfo);         
+                       /* do the translation */
+                       offset[0] = 0;
+                       offset[1] = -linenum;
+                       offset[2] = 0;
        
-               cu->str= MEM_mallocN(nchars+4, "str");
-               cu->strinfo= MEM_callocN((nchars+4)*sizeof(CharInfo), "strinfo");
-               cu->totbox= cu->actbox= 1;
-               cu->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "textbox");
-               cu->tb[0].w = cu->tb[0].h = 0.0;
-               
-               strcpy(cu->str, curline->line);
-               cu->len= strlen(curline->line);
-               cu->pos= cu->len;
+                       if(rv3d)
+                               Mat4Mul3Vecfl(rv3d->viewinv, offset);
 
-               make_editText(obedit);
-               ED_object_exit_editmode(NULL, EM_FREEDATA|EM_WAITCURSOR); // XXX
+                       txt_add_object(C, line, 1, offset);
 
-               linenum++;
-               curline = curline->next;
+                       linenum++;
+               }
        }
-}
-
-static int text_to_object_exec(bContext *C, wmOperator *op)
-{
-       Scene *scene= CTX_data_scene(C);
-       Object *obedit= CTX_data_edit_object(C);
-       Text *text= NULL; /// XXX retrieve this ..
-
-       if(RNA_boolean_get(op->ptr, "split_lines"))
-               txt_export_to_objects(scene, obedit, text);
-       else
-               txt_export_to_object(scene, obedit, text);
-
-       return OPERATOR_FINISHED;
-}
-
-void FONT_OT_text_to_object(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Text to Object";
-       ot->idname= "FONT_OT_text_to_object";
-       
-       /* api callbacks */
-       ot->exec= text_to_object_exec;
-       ot->poll= ED_operator_editfont; // XXX not correct
-       
-       /* flags */
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       else {
+               offset[0]= 0.0f;
+               offset[1]= 0.0f;
+               offset[2]= 0.0f;
 
-       /* properties */
-       RNA_def_boolean(ot->srna, "split_lines", 0, "Split Lines", "Create one object per line in the text.");
+               txt_add_object(C, text->lines.first, BLI_countlist(&text->lines), offset);
+       }
 }
 
 /********************** utilities ***************************/
diff --git a/source/blender/editors/datafiles/bmonofont.ttf.c b/source/blender/editors/datafiles/bmonofont.ttf.c
new file mode 100644 (file)
index 0000000..029ee60
--- /dev/null
@@ -0,0 +1,9681 @@
+/* DataToC output of file <bmonofont_ttf> */
+
+int datatoc_bmonofont_ttf_size= 309588;
+char datatoc_bmonofont_ttf[]= {
+  0,  1,  0,  0,  0, 18,  1,  0,  0,  4,  0, 32, 70, 70, 84, 77, 76,195, 13,197,
+  0,  0,  1, 44,  0,  0,  0, 28, 71, 68, 69, 70,107,171,118, 72,  0,  0,  1, 72,  0,  0,  0,174, 71, 80, 79, 83, 85,176, 56, 58,
+  0,  0,  1,248,  0,  0, 53,184, 71, 83, 85, 66, 11, 72,224,153,  0,  0, 55,176,  0,  0,  4,240, 79, 83, 47, 50,135,252,137,178,
+  0,  0, 60,160,  0,  0,  0, 86, 99,109, 97,112,173,161, 29,196,  0,  0, 60,248,  0,  0, 20,198, 99,118,116, 32,233,151,  7, 12,
+  0,  0, 81,192,  0,  0,  2, 48,102,112,103,109, 91,  2,107,223,  0,  0, 83,240,  0,  0,  0,172,103, 97,115,112,  0,  7,  0,  7,
+  0,  0, 84,156,  0,  0,  0, 12,103,108,121,102, 94, 39,215, 74,  0,  0, 84,168,  0,  3,133, 48,104,101, 97,100,233, 47, 44,226,
+  0,  3,217,216,  0,  0,  0, 54,104,104,101, 97,  8,183,  2,  7,  0,  3,218, 16,  0,  0,  0, 36,104,109,116,120,224, 90,223,  8,
+  0,  3,218, 52,  0,  0, 23,172,108,111, 99, 97, 19,189,108,128,  0,  3,241,224,  0,  0, 47, 76,109, 97,120,112, 17,120,  9,216,
+  0,  4, 33, 44,  0,  0,  0, 32,110, 97,109,101, 96,229,233,137,  0,  4, 33, 76,  0,  0, 33, 21,112,111,115,116,106, 10,163,233,
+  0,  4, 66,100,  0,  0,111,212,112,114,101,112, 58,199,192,  7,  0,  4,178, 56,  0,  0,  7, 27,  0,  0,  0,  1,  0,  0,  0,  0,
+196, 21,105,  4,  0,  0,  0,  0,196, 86,210, 96,  0,  0,  0,  0,196, 86,210, 96,  0,  1,  0,  0,