Merged changes in the trunk up to revision 31284.
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Thu, 12 Aug 2010 13:41:59 +0000 (13:41 +0000)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Thu, 12 Aug 2010 13:41:59 +0000 (13:41 +0000)
248 files changed:
CMakeLists.txt
build_files/cmake/macros.cmake
build_files/make/nan_compile.mk
release/Makefile
release/plugins/Makefile
release/plugins/bmake
release/plugins/sequence/Makefile
release/plugins/texture/Makefile
release/scripts/io/export_fbx.py
release/scripts/io/export_obj.py
release/scripts/io/export_x3d.py
release/scripts/io/import_anim_bvh.py
release/scripts/io/import_scene_3ds.py
release/scripts/io/import_scene_obj.py
release/scripts/io/import_shape_mdd.py
release/scripts/io/netrender/ui.py
release/scripts/modules/add_object_utils.py
release/scripts/modules/bpy/utils.py
release/scripts/modules/bpy_types.py
release/scripts/modules/bpy_xml_ui.py [deleted file]
release/scripts/modules/bpyml.py [new file with mode: 0644]
release/scripts/modules/bpyml_ui.py [new file with mode: 0644]
release/scripts/modules/rigify/spine_pivot_flex.py
release/scripts/modules/rigify/tail_control.py
release/scripts/modules/rna_info.py
release/scripts/op/console_python.py
release/scripts/op/console_shell.py
release/scripts/op/uvcalc_smart_project.py
release/scripts/templates/gamelogic.py
release/scripts/ui/properties_data_armature_rigify.py
release/scripts/ui/properties_material.py
release/scripts/ui/properties_object.py
release/scripts/ui/properties_render.py
release/scripts/ui/properties_render_test.xml [deleted file]
release/scripts/ui/space_info.py
release/scripts/ui/space_text.py
release/scripts/ui/space_view3d_toolbar.py
source/Makefile
source/blender/Makefile
source/blender/avi/Makefile
source/blender/avi/intern/Makefile
source/blender/blenfont/Makefile
source/blender/blenfont/intern/Makefile
source/blender/blenkernel/BKE_cloth.h
source/blender/blenkernel/BKE_collision.h
source/blender/blenkernel/BKE_effect.h
source/blender/blenkernel/BKE_idcode.h [new file with mode: 0644]
source/blender/blenkernel/BKE_sca.h
source/blender/blenkernel/Makefile
source/blender/blenkernel/intern/Makefile
source/blender/blenkernel/intern/cloth.c
source/blender/blenkernel/intern/collision.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/idcode.c [new file with mode: 0644]
source/blender/blenkernel/intern/implicit.c
source/blender/blenkernel/intern/key.c
source/blender/blenkernel/intern/lattice.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/nla.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/softbody.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenlib/Makefile
source/blender/blenlib/intern/Makefile
source/blender/blenlib/intern/math_geom_inline.c
source/blender/blenlib/intern/path_util.c
source/blender/blenlib/intern/storage.c
source/blender/blenloader/BLO_readfile.h
source/blender/blenloader/Makefile
source/blender/blenloader/intern/Makefile
source/blender/blenloader/intern/readblenentry.c
source/blender/blenloader/intern/readfile.c
source/blender/blenpluginapi/Makefile
source/blender/blenpluginapi/intern/Makefile
source/blender/collada/DocumentExporter.cpp
source/blender/collada/Makefile
source/blender/collada/SConscript
source/blender/editors/Makefile
source/blender/editors/animation/Makefile
source/blender/editors/armature/Makefile
source/blender/editors/curve/Makefile
source/blender/editors/curve/editcurve.c
source/blender/editors/datafiles/Makefile
source/blender/editors/gpencil/Makefile
source/blender/editors/include/ED_lattice.h [new file with mode: 0644]
source/blender/editors/include/ED_view3d.h
source/blender/editors/interface/Makefile
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/mesh/Makefile
source/blender/editors/mesh/editmesh.c
source/blender/editors/metaball/Makefile
source/blender/editors/object/Makefile
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_hook.c
source/blender/editors/object/object_intern.h
source/blender/editors/object/object_lattice.c
source/blender/editors/object/object_relations.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/physics/Makefile
source/blender/editors/render/Makefile
source/blender/editors/screen/Makefile
source/blender/editors/sculpt_paint/Makefile
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sound/Makefile
source/blender/editors/space_action/Makefile
source/blender/editors/space_api/Makefile
source/blender/editors/space_buttons/Makefile
source/blender/editors/space_console/Makefile
source/blender/editors/space_console/space_console.c
source/blender/editors/space_file/Makefile
source/blender/editors/space_file/file_draw.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_file/space_file.c
source/blender/editors/space_graph/Makefile
source/blender/editors/space_image/Makefile
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_info/Makefile
source/blender/editors/space_info/info_stats.c
source/blender/editors/space_logic/Makefile
source/blender/editors/space_logic/logic_window.c
source/blender/editors/space_nla/Makefile
source/blender/editors/space_node/Makefile
source/blender/editors/space_outliner/Makefile
source/blender/editors/space_script/Makefile
source/blender/editors/space_sequencer/Makefile
source/blender/editors/space_sound/Makefile
source/blender/editors/space_text/Makefile
source/blender/editors/space_text/text_draw.c
source/blender/editors/space_time/Makefile
source/blender/editors/space_userpref/Makefile
source/blender/editors/space_view3d/Makefile
source/blender/editors/space_view3d/drawmesh.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/space_view3d/view3d_intern.h
source/blender/editors/space_view3d/view3d_snap.c
source/blender/editors/transform/Makefile
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_manipulator.c
source/blender/editors/util/Makefile
source/blender/editors/uvedit/Makefile
source/blender/gpu/Makefile
source/blender/gpu/intern/Makefile
source/blender/ikplugin/Makefile
source/blender/ikplugin/intern/Makefile
source/blender/imbuf/Makefile
source/blender/imbuf/intern/Makefile
source/blender/imbuf/intern/cineon/Makefile
source/blender/imbuf/intern/dds/Makefile
source/blender/imbuf/intern/openexr/Makefile
source/blender/imbuf/intern/thumbs.c
source/blender/makesdna/DNA_curve_types.h
source/blender/makesdna/DNA_lattice_types.h
source/blender/makesdna/DNA_space_types.h
source/blender/makesdna/DNA_texture_types.h
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesdna/Makefile
source/blender/makesdna/intern/Makefile
source/blender/makesrna/Makefile
source/blender/makesrna/intern/Makefile
source/blender/makesrna/intern/rna_color.c
source/blender/makesrna/intern/rna_curve.c
source/blender/makesrna/intern/rna_fluidsim.c
source/blender/makesrna/intern/rna_lattice.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_particle.c
source/blender/makesrna/intern/rna_scene_api.c
source/blender/makesrna/intern/rna_smoke.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_text.c
source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py [changed mode: 0644->0755]
source/blender/makesrna/rna_cleanup/rna_properties.txt
source/blender/modifiers/MOD_modifiertypes.h
source/blender/modifiers/Makefile
source/blender/modifiers/intern/MOD_cloth.c
source/blender/modifiers/intern/MOD_collision.c
source/blender/modifiers/intern/MOD_none.c
source/blender/modifiers/intern/MOD_util.c
source/blender/modifiers/intern/MOD_util.h
source/blender/modifiers/intern/Makefile
source/blender/nodes/Makefile
source/blender/nodes/intern/CMP_nodes/Makefile
source/blender/nodes/intern/Makefile
source/blender/nodes/intern/SHD_nodes/Makefile
source/blender/nodes/intern/TEX_nodes/Makefile
source/blender/python/Makefile
source/blender/python/doc/sphinx_doc_gen.py
source/blender/python/generic/Makefile
source/blender/python/generic/mathutils.c
source/blender/python/generic/mathutils_matrix.c
source/blender/python/generic/noise.c
source/blender/python/intern/Makefile
source/blender/python/intern/bpy_rna.c
source/blender/quicktime/Makefile
source/blender/quicktime/apple/Makefile
source/blender/readblenfile/Makefile
source/blender/readblenfile/intern/Makefile
source/blender/readblenfile/stub/Makefile
source/blender/readblenfile/test/Makefile
source/blender/render/Makefile
source/blender/render/intern/Makefile
source/blender/verify/Makefile
source/blender/verify/intern/Makefile
source/blender/windowmanager/Makefile
source/blender/windowmanager/intern/Makefile
source/blender/windowmanager/intern/wm_operators.c
source/blenderplayer/bad_level_call_stubs/Makefile
source/blenderplayer/bad_level_call_stubs/stubs.c
source/creator/Makefile
source/darwin/Makefile
source/gameengine/BlenderRoutines/Makefile
source/gameengine/Converter/KX_BlenderSceneConverter.cpp
source/gameengine/Converter/Makefile
source/gameengine/Expressions/Makefile
source/gameengine/GameLogic/Joystick/Makefile
source/gameengine/GameLogic/Makefile
source/gameengine/GamePlayer/Makefile
source/gameengine/GamePlayer/common/Makefile
source/gameengine/GamePlayer/common/unix/Makefile
source/gameengine/GamePlayer/common/windows/Makefile
source/gameengine/GamePlayer/ghost/Makefile
source/gameengine/Ketsji/KXNetwork/Makefile
source/gameengine/Ketsji/KX_PythonInit.cpp
source/gameengine/Ketsji/Makefile
source/gameengine/Makefile
source/gameengine/Network/LoopBackNetwork/Makefile
source/gameengine/Network/Makefile
source/gameengine/Network/TerraplayNetwork/Makefile
source/gameengine/Physics/Bullet/Makefile
source/gameengine/Physics/Dummy/Makefile
source/gameengine/Physics/Makefile
source/gameengine/Physics/common/Makefile
source/gameengine/Rasterizer/Makefile
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile
source/gameengine/SceneGraph/Makefile
source/gameengine/VideoTexture/Makefile
source/icons/Makefile
source/kernel/Makefile
source/kernel/gen_messaging/Makefile
source/kernel/gen_messaging/intern/Makefile
source/kernel/gen_system/Makefile

index 87265e959e53e73c7b6400e85f976b556ab48b85..cb131c6e5e1cff978a523d48b5ff280be315f9f7 100644 (file)
@@ -316,12 +316,6 @@ IF(UNIX AND NOT APPLE)
 
        SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -Wno-char-subscripts")
 
-       IF(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
-               SET(PLATFORM_CFLAGS " -msse -msse2 ${PLATFORM_CFLAGS}")
-               ADD_DEFINITIONS(-D__SSE__)
-               ADD_DEFINITIONS(-D__MMX__)
-       ENDIF(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
-
        SET(PLATFORM_LINKFLAGS "-pthread")
 
        # Better warnings
@@ -633,12 +627,6 @@ IF(WIN32)
                        SET(WITH_JACK OFF)
                ENDIF(WITH_JACK)
 
-               IF(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
-                       SET(PLATFORM_CFLAGS " -msse -msse2 ${PLATFORM_CFLAGS}")
-                       ADD_DEFINITIONS(-D__SSE__)
-                       ADD_DEFINITIONS(-D__MMX__)
-               ENDIF(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
-
        ENDIF(MSVC)
 
 ENDIF(WIN32)
@@ -819,12 +807,6 @@ IF(APPLE)
                SET(TIFF_LIBPATH ${TIFF}/lib)
        ENDIF(WITH_IMAGE_TIFF)
 
-       IF(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
-               SET(PLATFORM_CFLAGS " -msse -msse2 ${PLATFORM_CFLAGS}")
-               ADD_DEFINITIONS(-D__SSE__)
-               ADD_DEFINITIONS(-D__MMX__)
-       ENDIF(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
-
        SET(EXETYPE MACOSX_BUNDLE)
 
        SET(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
@@ -868,9 +850,26 @@ IF(WITH_BUILDINFO)
                ENDIF(BUILD_REV_RETURN)
        ENDIF(WIN32)
 ENDIF(WITH_BUILDINFO)
-       
 #-----------------------------------------------------------------------------
 # Common.
+
+IF(WITH_RAYOPTIMIZATION)
+       IF(CMAKE_COMPILER_IS_GNUCC)
+               IF(SUPPORT_SSE_BUILD)
+                       SET(PLATFORM_CFLAGS " -msse ${PLATFORM_CFLAGS}")
+                       ADD_DEFINITIONS(-D__SSE__)
+                       ADD_DEFINITIONS(-D__MMX__)
+               ENDIF(SUPPORT_SSE_BUILD)
+               IF(SUPPORT_SSE2_BUILD)
+                       SET(PLATFORM_CFLAGS " -msse2 ${PLATFORM_CFLAGS}")
+                       ADD_DEFINITIONS(-D__SSE2__)
+                       IF(NOT SUPPORT_SSE_BUILD) # dont double up
+                               ADD_DEFINITIONS(-D__MMX__)
+                       ENDIF(NOT SUPPORT_SSE_BUILD)
+               ENDIF(SUPPORT_SSE2_BUILD)
+       ENDIF(CMAKE_COMPILER_IS_GNUCC)
+ENDIF(WITH_RAYOPTIMIZATION)
+
 IF(WITH_IMAGE_OPENJPEG)
        set(OPENJPEG ${CMAKE_SOURCE_DIR}/extern/libopenjpeg)
        set(OPENJPEG_INC ${OPENJPEG})
index 22c090342ef7b4b8a8d74025ddc1500697c48668..0957ace301c14007a9d5963a91b8972a14c8e5f5 100644 (file)
@@ -183,19 +183,38 @@ MACRO(SETUP_LIBLINKS
 ENDMACRO(SETUP_LIBLINKS)
 
 MACRO(TEST_SSE_SUPPORT)
-       INCLUDE(CheckCXXSourceCompiles)
+       INCLUDE(CheckCSourceRuns)
 
        MESSAGE(STATUS "Detecting SSE support")
        IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
                SET(CMAKE_REQUIRED_FLAGS "-msse -msse2")
        ELSEIF(MSVC)
-               SET(CMAKE_REQUIRED_FLAGS "/arch:SSE2")
+               SET(CMAKE_REQUIRED_FLAGS "/arch:SSE2") # TODO, SSE 1 ?
        ENDIF()
 
-       CHECK_CXX_SOURCE_COMPILES("
+       CHECK_C_SOURCE_RUNS("
                #include <xmmintrin.h>
                int main() { __m128 v = _mm_setzero_ps(); return 0; }"
        SUPPORT_SSE_BUILD)
+
+       CHECK_C_SOURCE_RUNS("
+               #include <emmintrin.h>
+               int main() { __m128d v = _mm_setzero_pd(); return 0; }"
+       SUPPORT_SSE2_BUILD)
+       MESSAGE(STATUS "Detecting SSE support")
+
+       IF(SUPPORT_SSE_BUILD)
+               MESSAGE(STATUS "   ...SSE support found.")
+       ELSE(SUPPORT_SSE_BUILD)
+               MESSAGE(STATUS "   ...SSE support missing.")
+       ENDIF(SUPPORT_SSE_BUILD)
+
+       IF(SUPPORT_SSE2_BUILD)
+               MESSAGE(STATUS "   ...SSE2 support found.")
+       ELSE(SUPPORT_SSE2_BUILD)
+               MESSAGE(STATUS "   ...SSE2 support missing.")
+       ENDIF(SUPPORT_SSE2_BUILD)
+
 ENDMACRO(TEST_SSE_SUPPORT)
 
 
index be38eac4f92a50696b61c1e8c06aea30b01e7de8..4107bb1820ddd10c0f80c2e8351d0844e29b9df3 100644 (file)
@@ -176,6 +176,9 @@ ifeq ($(OS),linux)
     REL_CFLAGS  += -O2
     REL_CCFLAGS += -O2
     NAN_DEPEND = true
+  ifeq ($(WITH_BF_RAYOPTIMIZATION), true) 
+    CCFLAGS += -msse
+  endif
   ifeq ($(CPU),alpha)
     CFLAGS += -mieee
   endif
index e6d904ea13cb625394e90a8be03b7b1b913a27fe..bef76b349b273d2f2f91e1e9e6619a7a154a2d15 100644 (file)
@@ -16,7 +16,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 # All rights reserved.
index 3ed2ee2161e2bba24ae1be8fb65430f67ee45e28..ee7086b331de1955bb874718a47d975eb7d4a5aa 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 # All rights reserved.
index f03e9270011e895ef5e23d374f63338525d81e22..9740bfa716aea7dc28791eb242830dace4b6bb77 100644 (file)
@@ -16,7 +16,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 # All rights reserved.
index 0e1463fae7f7cba340c205e9cce304963dae58f7..ab847adf5feffbdc4cc499a187d84d625d10ab98 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 # All rights reserved.
index 0e1463fae7f7cba340c205e9cce304963dae58f7..ab847adf5feffbdc4cc499a187d84d625d10ab98 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 # All rights reserved.
index 5c2e0cb5f95f4ccfcf9fd8fa80b0aac6e2280497..c040861941a7e7d9b29af4bffa76fe23e2da980a 100644 (file)
@@ -55,7 +55,7 @@ import math # math.pi
 import shutil # for file copying
 
 import bpy
-from mathutils import Vector, Euler, Matrix, RotationMatrix
+from mathutils import Vector, Euler, Matrix
 
 def copy_file(source, dest):
     # XXX - remove, can use shutil
@@ -107,19 +107,19 @@ def eulerRadToDeg(eul):
 mtx4_identity = Matrix()
 
 # testing
-mtx_x90                = RotationMatrix( math.pi/2, 3, 'X') # used
-#mtx_x90n      = RotationMatrix(-90, 3, 'x')
-#mtx_y90       = RotationMatrix( 90, 3, 'y')
-#mtx_y90n      = RotationMatrix(-90, 3, 'y')
-#mtx_z90       = RotationMatrix( 90, 3, 'z')
-#mtx_z90n      = RotationMatrix(-90, 3, 'z')
-
-#mtx4_x90      = RotationMatrix( 90, 4, 'x')
-mtx4_x90n      = RotationMatrix(-math.pi/2, 4, 'X') # used
-#mtx4_y90      = RotationMatrix( 90, 4, 'y')
-mtx4_y90n      = RotationMatrix(-math.pi/2, 4, 'Y') # used
-mtx4_z90       = RotationMatrix( math.pi/2, 4, 'Z') # used
-mtx4_z90n      = RotationMatrix(-math.pi/2, 4, 'Z') # used
+mtx_x90                = Matrix.Rotation( math.pi/2, 3, 'X') # used
+#mtx_x90n      = Matrix.Rotation(-90, 3, 'x')
+#mtx_y90       = Matrix.Rotation( 90, 3, 'y')
+#mtx_y90n      = Matrix.Rotation(-90, 3, 'y')
+#mtx_z90       = Matrix.Rotation( 90, 3, 'z')
+#mtx_z90n      = Matrix.Rotation(-90, 3, 'z')
+
+#mtx4_x90      = Matrix.Rotation( 90, 4, 'x')
+mtx4_x90n      = Matrix.Rotation(-math.pi/2, 4, 'X') # used
+#mtx4_y90      = Matrix.Rotation( 90, 4, 'y')
+mtx4_y90n      = Matrix.Rotation(-math.pi/2, 4, 'Y') # used
+mtx4_z90       = Matrix.Rotation( math.pi/2, 4, 'Z') # used
+mtx4_z90n      = Matrix.Rotation(-math.pi/2, 4, 'Z') # used
 
 # def strip_path(p):
 #      return p.split('\\')[-1].split('/')[-1]
@@ -562,7 +562,7 @@ def write(filename, batch_objects = None, \
             elif type =='CAMERA':
 #                      elif ob and type =='Camera':
                 y = matrix_rot * Vector((0.0, 1.0, 0.0))
-                matrix_rot = RotationMatrix(math.pi/2, 3, y) * matrix_rot
+                matrix_rot = Matrix.Rotation(math.pi/2, 3, y) * matrix_rot
 
             return matrix_rot
 
@@ -664,7 +664,7 @@ def write(filename, batch_objects = None, \
                     rot = tuple(matrix_rot.to_euler())
                 elif ob and ob.type =='Camera':
                     y = matrix_rot * Vector((0.0, 1.0, 0.0))
-                    matrix_rot = RotationMatrix(math.pi/2, 3, y) * matrix_rot
+                    matrix_rot = Matrix.Rotation(math.pi/2, 3, y) * matrix_rot
                     rot = tuple(matrix_rot.to_euler())
                 else:
                     rot = tuple(matrix_rot.to_euler())
index fa378d26878e3c0d88f68bd4c97901bae203cce8..5e951f064065c4a9cf91c74a7d7fab34d4ae47f1 100644 (file)
@@ -44,7 +44,7 @@ import mathutils
 
 
 # Returns a tuple - path,extension.
-# 'hello.obj' >         ('hello', '.obj')
+# 'hello.obj' >  ('hello', '.obj')
 def splitExt(path):
     dotidx = path.rfind('.')
     if dotidx == -1:
@@ -81,7 +81,7 @@ def write_mtl(scene, filepath, copy_images, mtl_dict):
 
     file = open(filepath, "w")
     # XXX
-#      file.write('# Blender MTL File: %s\n' % Blender.Get('filepath').split('\\')[-1].split('/')[-1])
+#   file.write('# Blender MTL File: %s\n' % Blender.Get('filepath').split('\\')[-1].split('/')[-1])
     file.write('# Material Count: %i\n' % len(mtl_dict))
     # Write material/image combinations we have used.
     for key, (mtl_mat_name, mat, img) in mtl_dict.items():
@@ -93,7 +93,7 @@ def write_mtl(scene, filepath, copy_images, mtl_dict):
 
         if mat:
             file.write('Ns %.6f\n' % ((mat.specular_hardness-1) * 1.9607843137254901) ) # Hardness, convert blenders 1-511 to MTL's
-            file.write('Ka %.6f %.6f %.6f\n' % tuple([c*mat.ambient for c in worldAmb])  ) # Ambient, uses mirror colour,
+            file.write('Ka %.6f %.6f %.6f\n' %  tuple([c*mat.ambient for c in worldAmb])  ) # Ambient, uses mirror colour,
             file.write('Kd %.6f %.6f %.6f\n' % tuple([c*mat.diffuse_intensity for c in mat.diffuse_color]) ) # Diffuse
             file.write('Ks %.6f %.6f %.6f\n' % tuple([c*mat.specular_intensity for c in mat.specular_color]) ) # Specular
             if hasattr(mat, "ior"):
@@ -113,25 +113,25 @@ def write_mtl(scene, filepath, copy_images, mtl_dict):
         else:
             #write a dummy material here?
             file.write('Ns 0\n')
-            file.write('Ka %.6f %.6f %.6f\n' % tuple([c for c in worldAmb])  ) # Ambient, uses mirror colour,
+            file.write('Ka %.6f %.6f %.6f\n' %  tuple([c for c in worldAmb])  ) # Ambient, uses mirror colour,
             file.write('Kd 0.8 0.8 0.8\n')
             file.write('Ks 0.8 0.8 0.8\n')
             file.write('d 1\n') # No alpha
             file.write('illum 2\n') # light normaly
 
         # Write images!
-        if img:         # We have an image on the face!
+        if img:  # We have an image on the face!
             # write relative image path
             rel = copy_image(img)
             file.write('map_Kd %s\n' % rel) # Diffuse mapping image
-#                      file.write('map_Kd %s\n' % img.filepath.split('\\')[-1].split('/')[-1]) # Diffuse mapping image
+#           file.write('map_Kd %s\n' % img.filepath.split('\\')[-1].split('/')[-1]) # Diffuse mapping image
 
         elif mat: # No face image. if we havea material search for MTex image.
             for mtex in mat.texture_slots:
                 if mtex and mtex.texture.type == 'IMAGE':
                     try:
                         filepath = copy_image(mtex.texture.image)
-#                                              filepath = mtex.texture.image.filepath.split('\\')[-1].split('/')[-1]
+#                       filepath = mtex.texture.image.filepath.split('\\')[-1].split('/')[-1]
                         file.write('map_Kd %s\n' % filepath) # Diffuse mapping image
                         break
                     except:
@@ -157,8 +157,8 @@ def copy_file(source, dest):
 def copy_images(dest_dir):
     if dest_dir[-1] != os.sep:
         dest_dir += os.sep
-#      if dest_dir[-1] != sys.sep:
-#              dest_dir += sys.sep
+#   if dest_dir[-1] != sys.sep:
+#       dest_dir += sys.sep
 
     # Get unique image names
     uniqueImages = {}
@@ -181,20 +181,20 @@ def copy_images(dest_dir):
     # Now copy images
     copyCount = 0
 
-#      for bImage in uniqueImages.values():
-#              image_path = bpy.path.abspath(bImage.filepath)
-#              if bpy.sys.exists(image_path):
-#                      # Make a name for the target path.
-#                      dest_image_path = dest_dir + image_path.split('\\')[-1].split('/')[-1]
-#                      if not bpy.utils.exists(dest_image_path): # Image isnt already there
-#                              print('\tCopying "%s" > "%s"' % (image_path, dest_image_path))
-#                              copy_file(image_path, dest_image_path)
-#                              copyCount+=1
+#   for bImage in uniqueImages.values():
+#       image_path = bpy.path.abspath(bImage.filepath)
+#       if bpy.sys.exists(image_path):
+#           # Make a name for the target path.
+#           dest_image_path = dest_dir + image_path.split('\\')[-1].split('/')[-1]
+#           if not bpy.utils.exists(dest_image_path): # Image isnt already there
+#               print('\tCopying "%s" > "%s"' % (image_path, dest_image_path))
+#               copy_file(image_path, dest_image_path)
+#               copyCount+=1
 
-#      paths= bpy.util.copy_images(uniqueImages.values(), dest_dir)
+#   paths= bpy.util.copy_images(uniqueImages.values(), dest_dir)
 
     print('\tCopied %d images' % copyCount)
-#      print('\tCopied %d images' % copyCount)
+#   print('\tCopied %d images' % copyCount)
 
 # XXX not converted
 def test_nurbs_compat(ob):
@@ -217,8 +217,8 @@ def write_nurb(file, ob, ob_mat):
     Vector = Blender.mathutils.Vector
     for nu in cu:
 
-        if nu.type==0:         DEG_ORDER_U = 1
-        else:                          DEG_ORDER_U = nu.orderU-1  # Tested to be correct
+        if nu.type==0:      DEG_ORDER_U = 1
+        else:               DEG_ORDER_U = nu.orderU-1  # Tested to be correct
 
         if nu.type==1:
             print("\tWarning, bezier curve:", ob.name, "only poly and nurbs curves supported")
@@ -275,7 +275,7 @@ def write_nurb(file, ob, ob_mat):
 
     return tot_verts
 
-def write(filepath, objects, scene,
+def write_file(filepath, objects, scene,
           EXPORT_TRI=False,
           EXPORT_EDGES=False,
           EXPORT_NORMALS=False,
@@ -319,9 +319,9 @@ def write(filepath, objects, scene,
         """
         weightDict = {}
         for vert_index in face.verts:
-#              for vert in face:
+#       for vert in face:
             vWeights = vWeightMap[vert_index]
-#                      vWeights = vWeightMap[vert]
+#           vWeights = vWeightMap[vert]
             for vGroupName, weight in vWeights:
                 weightDict[vGroupName] = weightDict.get(vGroupName, 0) + weight
 
@@ -348,8 +348,8 @@ def write(filepath, objects, scene,
     temp_mesh_name = '~tmp-mesh'
 
     time1 = time.clock()
-#      time1 = sys.time()
-#      scn = Scene.GetCurrent()
+#   time1 = sys.time()
+#   scn = Scene.GetCurrent()
 
     file = open(filepath, "w")
 
@@ -363,7 +363,7 @@ def write(filepath, objects, scene,
         file.write('mtllib %s\n' % ( mtlfilepath.split('\\')[-1].split('/')[-1] ))
 
     if EXPORT_ROTX90:
-        mat_xrot90= mathutils.RotationMatrix(-math.pi/2, 4, 'X')
+        mat_xrot90= mathutils.Matrix.Rotation(-math.pi/2, 4, 'X')
 
     # Initialize totals, these are updated each object
     totverts = totuvco = totno = 1
@@ -401,15 +401,15 @@ def write(filepath, objects, scene,
         for ob, ob_mat in obs:
 
             # XXX postponed
-#                      # Nurbs curve support
-#                      if EXPORT_CURVE_AS_NURBS and test_nurbs_compat(ob):
-#                              if EXPORT_ROTX90:
-#                                      ob_mat = ob_mat * mat_xrot90
+#           # Nurbs curve support
+#           if EXPORT_CURVE_AS_NURBS and test_nurbs_compat(ob):
+#               if EXPORT_ROTX90:
+#                   ob_mat = ob_mat * mat_xrot90
 
-#                              totverts += write_nurb(file, ob, ob_mat)
+#               totverts += write_nurb(file, ob, ob_mat)
 
-#                              continue
-#                      end nurbs
+#               continue
+#           end nurbs
 
             if ob.type != 'MESH':
                 continue
@@ -421,10 +421,10 @@ def write(filepath, objects, scene,
             else:
                 me.transform(ob_mat)
 
-#                      # Will work for non meshes now! :)
-#                      me= BPyMesh.getMeshFromObject(ob, containerMesh, EXPORT_APPLY_MODIFIERS, EXPORT_POLYGROUPS, scn)
-#                      if not me:
-#                              continue
+#           # Will work for non meshes now! :)
+#           me= BPyMesh.getMeshFromObject(ob, containerMesh, EXPORT_APPLY_MODIFIERS, EXPORT_POLYGROUPS, scn)
+#           if not me:
+#               continue
 
             if EXPORT_UV:
                 faceuv = len(me.uv_textures) > 0
@@ -472,13 +472,13 @@ def write(filepath, objects, scene,
             # High Quality Normals
             if EXPORT_NORMALS and face_index_pairs:
                 me.calc_normals()
-#                              if EXPORT_NORMALS_HQ:
-#                                      BPyMesh.meshCalcNormals(me)
-#                              else:
-#                                      # transforming normals is incorrect
-#                                      # when the matrix is scaled,
-#                                      # better to recalculate them
-#                                      me.calcNormals()
+#               if EXPORT_NORMALS_HQ:
+#                   BPyMesh.meshCalcNormals(me)
+#               else:
+#                   # transforming normals is incorrect
+#                   # when the matrix is scaled,
+#                   # better to recalculate them
+#                   me.calcNormals()
 
             materials = me.materials
 
@@ -512,18 +512,18 @@ def write(filepath, objects, scene,
             else:
                 # no materials
                 face_index_pairs.sort(key = lambda a: a[0].smooth)
-#                      if EXPORT_KEEP_VERT_ORDER:
-#                              pass
-#                      elif faceuv:
-#                              try:    faces.sort(key = lambda a: (a.mat, a.image, a.smooth))
-#                              except: faces.sort(lambda a,b: cmp((a.mat, a.image, a.smooth), (b.mat, b.image, b.smooth)))
-#                      elif len(materials) > 1:
-#                              try:    faces.sort(key = lambda a: (a.mat, a.smooth))
-#                              except: faces.sort(lambda a,b: cmp((a.mat, a.smooth), (b.mat, b.smooth)))
-#                      else:
-#                              # no materials
-#                              try:    faces.sort(key = lambda a: a.smooth)
-#                              except: faces.sort(lambda a,b: cmp(a.smooth, b.smooth))
+#           if EXPORT_KEEP_VERT_ORDER:
+#               pass
+#           elif faceuv:
+#               try:    faces.sort(key = lambda a: (a.mat, a.image, a.smooth))
+#               except: faces.sort(lambda a,b: cmp((a.mat, a.image, a.smooth), (b.mat, b.image, b.smooth)))
+#           elif len(materials) > 1:
+#               try:    faces.sort(key = lambda a: (a.mat, a.smooth))
+#               except: faces.sort(lambda a,b: cmp((a.mat, a.smooth), (b.mat, b.smooth)))
+#           else:
+#               # no materials
+#               try:    faces.sort(key = lambda a: a.smooth)
+#               except: faces.sort(lambda a,b: cmp(a.smooth, b.smooth))
 
             faces = [pair[0] for pair in face_index_pairs]
 
@@ -565,7 +565,7 @@ def write(filepath, objects, scene,
 
                     # # add another UV if it's a quad
                     # if len(f.verts) == 4:
-                    #  uvs.append(tface.uv4)
+                    #   uvs.append(tface.uv4)
 
                     for uv_index, uv in enumerate(uvs):
                         uvkey = veckey2d(uv)
@@ -575,19 +575,19 @@ def write(filepath, objects, scene,
                             uv_face_mapping[f_index][uv_index] = uv_dict[uvkey] = len(uv_dict)
                             file.write('vt %.6f %.6f\n' % tuple(uv))
 
-#                              uv_dict = {} # could use a set() here
-#                              for f_index, f in enumerate(faces):
+#               uv_dict = {} # could use a set() here
+#               for f_index, f in enumerate(faces):
 
-#                                      for uv_index, uv in enumerate(f.uv):
-#                                              uvkey = veckey2d(uv)
-#                                              try:
-#                                                      uv_face_mapping[f_index][uv_index] = uv_dict[uvkey]
-#                                              except:
-#                                                      uv_face_mapping[f_index][uv_index] = uv_dict[uvkey] = len(uv_dict)
-#                                                      file.write('vt %.6f %.6f\n' % tuple(uv))
+#                   for uv_index, uv in enumerate(f.uv):
+#                       uvkey = veckey2d(uv)
+#                       try:
+#                           uv_face_mapping[f_index][uv_index] = uv_dict[uvkey]
+#                       except:
+#                           uv_face_mapping[f_index][uv_index] = uv_dict[uvkey] = len(uv_dict)
+#                           file.write('vt %.6f %.6f\n' % tuple(uv))
 
                 uv_unique_count = len(uv_dict)
-#                              del uv, uvkey, uv_dict, f_index, uv_index
+#               del uv, uvkey, uv_dict, f_index, uv_index
                 # Only need uv_unique_count and uv_face_mapping
 
             # NORMAL, Smooth/Non smoothed.
@@ -615,28 +615,28 @@ def write(filepath, objects, scene,
             # XXX
             if EXPORT_POLYGROUPS:
                 # Retrieve the list of vertex groups
-#                              vertGroupNames = me.getVertGroupNames()
+#               vertGroupNames = me.getVertGroupNames()
 
                 currentVGroup = ''
                 # Create a dictionary keyed by face id and listing, for each vertex, the vertex groups it belongs to
                 vgroupsMap = [[] for _i in range(len(me.verts))]
-#                              vgroupsMap = [[] for _i in xrange(len(me.verts))]
+#               vgroupsMap = [[] for _i in xrange(len(me.verts))]
                 for g in ob.vertex_groups:
-#                              for vertexGroupName in vertGroupNames:
+#               for vertexGroupName in vertGroupNames:
                     for vIdx, vWeight in getVertsFromGroup(me, g.index):
-#                                      for vIdx, vWeight in me.getVertsFromGroup(vertexGroupName, 1):
+#                   for vIdx, vWeight in me.getVertsFromGroup(vertexGroupName, 1):
                         vgroupsMap[vIdx].append((g.name, vWeight))
 
             for f, f_index in face_index_pairs:
                 f_v = [{"index": index, "vertex": me.verts[index]} for index in f.verts]
 
                 # if f.verts[3] == 0:
-                #      f_v.pop()
+                #   f_v.pop()
 
-#                              f_v= f.v
+#               f_v= f.v
                 f_smooth= f.smooth
                 f_mat = min(f.material_index, len(materialNames)-1)
-#                              f_mat = min(f.mat, len(materialNames)-1)
+#               f_mat = min(f.mat, len(materialNames)-1)
                 if faceuv:
 
                     tface = me.active_uv_texture.data[f_index]
@@ -645,32 +645,32 @@ def write(filepath, objects, scene,
                     f_uv = tface.uv
                     # f_uv= [tface.uv1, tface.uv2, tface.uv3]
                     # if len(f.verts) == 4:
-                    #  f_uv.append(tface.uv4)
-#                                      f_image = f.image
-#                                      f_uv= f.uv
+                    #   f_uv.append(tface.uv4)
+#                   f_image = f.image
+#                   f_uv= f.uv
 
                 # MAKE KEY
                 if faceuv and f_image: # Object is always true.
-                    key = materialNames[f_mat],         f_image.name
+                    key = materialNames[f_mat],  f_image.name
                 else:
-                    key = materialNames[f_mat],         None # No image, use None instead.
+                    key = materialNames[f_mat],  None # No image, use None instead.
 
                 # Write the vertex group
                 if EXPORT_POLYGROUPS:
                     if len(ob.vertex_groups):
                         # find what vertext group the face belongs to
                         theVGroup = findVertexGroupName(f,vgroupsMap)
-                        if     theVGroup != currentVGroup:
+                        if  theVGroup != currentVGroup:
                             currentVGroup = theVGroup
                             file.write('g %s\n' % theVGroup)
-#                              # Write the vertex group
-#                              if EXPORT_POLYGROUPS:
-#                                      if vertGroupNames:
-#                                              # find what vertext group the face belongs to
-#                                              theVGroup = findVertexGroupName(f,vgroupsMap)
-#                                              if      theVGroup != currentVGroup:
-#                                                      currentVGroup = theVGroup
-#                                                      file.write('g %s\n' % theVGroup)
+#               # Write the vertex group
+#               if EXPORT_POLYGROUPS:
+#                   if vertGroupNames:
+#                       # find what vertext group the face belongs to
+#                       theVGroup = findVertexGroupName(f,vgroupsMap)
+#                       if  theVGroup != currentVGroup:
+#                           currentVGroup = theVGroup
+#                           file.write('g %s\n' % theVGroup)
 
                 # CHECK FOR CONTEXT SWITCH
                 if key == contextMat:
@@ -776,39 +776,38 @@ def write(filepath, objects, scene,
     # Now we have all our materials, save them
     if EXPORT_MTL:
         write_mtl(scene, mtlfilepath, EXPORT_COPY_IMAGES, mtl_dict)
-#      if EXPORT_COPY_IMAGES:
-#              dest_dir = os.path.basename(filepath)
-# #            dest_dir = filepath
-# #            # Remove chars until we are just the path.
-# #            while dest_dir and dest_dir[-1] not in '\\/':
-# #                    dest_dir = dest_dir[:-1]
-#              if dest_dir:
-#                      copy_images(dest_dir, mtl_dict)
-#              else:
-#                      print('\tError: "%s" could not be used as a base for an image path.' % filepath)
+#   if EXPORT_COPY_IMAGES:
+#       dest_dir = os.path.basename(filepath)
+# #         dest_dir = filepath
+# #         # Remove chars until we are just the path.
+# #         while dest_dir and dest_dir[-1] not in '\\/':
+# #             dest_dir = dest_dir[:-1]
+#       if dest_dir:
+#           copy_images(dest_dir, mtl_dict)
+#       else:
+#           print('\tError: "%s" could not be used as a base for an image path.' % filepath)
 
     print("OBJ Export time: %.2f" % (time.clock() - time1))
-#      print "OBJ Export time: %.2f" % (sys.time() - time1)
 
 def write(filepath, context,
-              EXPORT_APPLY_MODIFIERS = True, # not used
-              EXPORT_ROTX90 = True, # wrong
-              EXPORT_TRI = False, # ok
-              EXPORT_EDGES = False,
-              EXPORT_NORMALS = False, # not yet
-              EXPORT_NORMALS_HQ = False, # not yet
-              EXPORT_UV = True, # ok
-              EXPORT_MTL = True,
-              EXPORT_SEL_ONLY = True, # ok
-              EXPORT_ALL_SCENES = False, # XXX not working atm
-              EXPORT_ANIMATION = False,
-              EXPORT_COPY_IMAGES = False,
-              EXPORT_BLEN_OBS = True,
-              EXPORT_GROUP_BY_OB = False,
-              EXPORT_GROUP_BY_MAT = False,
-              EXPORT_KEEP_VERT_ORDER = False,
-              EXPORT_POLYGROUPS = False,
-              EXPORT_CURVE_AS_NURBS = True):
+              EXPORT_TRI, # ok
+              EXPORT_EDGES,
+              EXPORT_NORMALS, # not yet
+              EXPORT_NORMALS_HQ, # not yet
+              EXPORT_UV, # ok
+              EXPORT_MTL,
+              EXPORT_COPY_IMAGES,
+              EXPORT_APPLY_MODIFIERS, # ok
+              EXPORT_ROTX90, # wrong
+              EXPORT_BLEN_OBS,
+              EXPORT_GROUP_BY_OB,
+              EXPORT_GROUP_BY_MAT,
+              EXPORT_KEEP_VERT_ORDER,
+              EXPORT_POLYGROUPS,
+              EXPORT_CURVE_AS_NURBS,
+              EXPORT_SEL_ONLY, # ok
+              EXPORT_ALL_SCENES, # XXX not working atm
+              EXPORT_ANIMATION): # Not used
     
     base_name, ext = splitExt(filepath)
     context_name = [base_name, '', '', ext] # Base name, scene name, frame number, extension
@@ -819,10 +818,10 @@ def write(filepath, context,
     if context.object:
         bpy.ops.object.mode_set(mode='OBJECT')
 
-#      if EXPORT_ALL_SCENES:
-#              export_scenes = bpy.data.scenes
-#      else:
-#              export_scenes = [orig_scene]
+#   if EXPORT_ALL_SCENES:
+#       export_scenes = bpy.data.scenes
+#   else:
+#       export_scenes = [orig_scene]
 
     # XXX only exporting one scene atm since changing
     # current scene is not possible.
@@ -831,17 +830,17 @@ def write(filepath, context,
     export_scenes = [orig_scene]
 
     # Export all scenes.
-    for scn in export_scenes:
-        #              scn.makeCurrent() # If already current, this is not slow.
-        #              context = scn.getRenderingContext()
-        orig_frame = scn.frame_current
+    for scene in export_scenes:
+        #       scene.makeCurrent() # If already current, this is not slow.
+        #       context = scene.getRenderingContext()
+        orig_frame = scene.frame_current
 
         if EXPORT_ALL_SCENES: # Add scene name into the context_name
-            context_name[1] = '_%s' % bpy.path.clean_name(scn.name) # WARNING, its possible that this could cause a collision. we could fix if were feeling parranoied.
+            context_name[1] = '_%s' % bpy.path.clean_name(scene.name) # WARNING, its possible that this could cause a collision. we could fix if were feeling parranoied.
 
         # Export an animation?
         if EXPORT_ANIMATION:
-            scene_frames = range(scn.frame_start, context.frame_end + 1) # Up to and including the end frame.
+            scene_frames = range(scene.frame_start, context.frame_end + 1) # Up to and including the end frame.
         else:
             scene_frames = [orig_frame] # Dont export an animation.
 
@@ -850,30 +849,39 @@ def write(filepath, context,
             if EXPORT_ANIMATION: # Add frame to the filepath.
                 context_name[2] = '_%.6d' % frame
 
-            scn.frame_current = frame
+            scene.frame_current = frame
             if EXPORT_SEL_ONLY:
-                export_objects = context.selected_objects
+                objects = context.selected_objects
             else:
-                export_objects = scn.objects
+                objects = scene.objects
 
             full_path= ''.join(context_name)
 
             # erm... bit of a problem here, this can overwrite files when exporting frames. not too bad.
             # EXPORT THE FILE.
-            write(full_path, export_objects, scn,
-                  EXPORT_TRI, EXPORT_EDGES, EXPORT_NORMALS,
-                  EXPORT_NORMALS_HQ, EXPORT_UV, EXPORT_MTL,
-                  EXPORT_COPY_IMAGES, EXPORT_APPLY_MODIFIERS,
-                  EXPORT_ROTX90, EXPORT_BLEN_OBS,
-                  EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_KEEP_VERT_ORDER,
-                  EXPORT_POLYGROUPS, EXPORT_CURVE_AS_NURBS)
-
-
-        scn.frame_current = orig_frame
+            write_file(full_path, objects, scene,
+                  EXPORT_TRI,
+                  EXPORT_EDGES,
+                  EXPORT_NORMALS,
+                  EXPORT_NORMALS_HQ,
+                  EXPORT_UV,
+                  EXPORT_MTL,
+                  EXPORT_COPY_IMAGES,
+                  EXPORT_APPLY_MODIFIERS,
+                  EXPORT_ROTX90,
+                  EXPORT_BLEN_OBS,
+                  EXPORT_GROUP_BY_OB,
+                  EXPORT_GROUP_BY_MAT,
+                  EXPORT_KEEP_VERT_ORDER,
+                  EXPORT_POLYGROUPS,
+                  EXPORT_CURVE_AS_NURBS)
+
+
+        scene.frame_current = orig_frame
 
     # Restore old active scene.
-#      orig_scene.makeCurrent()
-#      Window.WaitCursor(0)
+#   orig_scene.makeCurrent()
+#   Window.WaitCursor(0)
 
 
 '''
@@ -898,12 +906,12 @@ class ExportOBJ(bpy.types.Operator):
     check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
 
     # context group
-    use_selection = BoolProperty(name="Selection Only", description="", default= False)
+    use_selection = BoolProperty(name="Selection Only", description="Export selected objects only", default= False)
     use_all_scenes = BoolProperty(name="All Scenes", description="", default= False)
-    use_animation = BoolProperty(name="All Animation", description="", default= False)
+    use_animation = BoolProperty(name="Animation", description="", default= False)
 
     # object group
-    use_modifiers = BoolProperty(name="Apply Modifiers", description="", default= True)
+    use_modifiers = BoolProperty(name="Apply Modifiers", description="Apply modifiers (preview resolution)", default= True)
     use_rotate90 = BoolProperty(name="Rotate X90", description="", default= True)
 
     # extra data group
@@ -947,7 +955,7 @@ class ExportOBJ(bpy.types.Operator):
               EXPORT_CURVE_AS_NURBS=self.properties.use_nurbs,
               EXPORT_SEL_ONLY=self.properties.use_selection,
               EXPORT_ALL_SCENES=self.properties.use_all_scenes,
-              )
+              EXPORT_ANIMATION=self.properties.use_animation)
 
         return {'FINISHED'}
 
@@ -978,4 +986,3 @@ def unregister():
 
 if __name__ == "__main__":
     register()
-
index 5fe48a2550a45373ddadeb8908cefc43d3f5677b..607f38be6f7db97ca84277fe8298c8bd41429c18 100644 (file)
@@ -81,7 +81,7 @@ from export_3ds import create_derived_objects, free_derived_objects
 
 #
 DEG2RAD=0.017453292519943295
-MATWORLD= mathutils.RotationMatrix(-90, 4, 'X')
+MATWORLD= mathutils.Matrix.Rotation(-90, 4, 'X')
 
 ####################################
 # Global Variables
index ba9b8a1f91d79b159bff2c4d7471158ad47afc19..3a80768070016652e961122e40004b84e31f0106 100644 (file)
@@ -23,7 +23,7 @@ from math import radians
 
 import bpy
 import mathutils
-from mathutils import Vector, Euler, Matrix, RotationMatrix, TranslationMatrix
+from mathutils import Vector, Euler, Matrix
 
 
 class bvh_node_class(object):
@@ -78,7 +78,7 @@ MATRIX_IDENTITY_4x4 = Matrix([1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0,
 
 def eulerRotate(x, y, z, rot_order):
     # Clamp all values between 0 and 360, values outside this raise an error.
-    mats = [RotationMatrix(x, 3, 'X'), RotationMatrix(y, 3, 'Y'), RotationMatrix(z, 3, 'Z')]
+    mats = [Matrix.Rotation(x, 3, 'X'), Matrix.Rotation(y, 3, 'Y'), Matrix.Rotation(z, 3, 'Z')]
     return (MATRIX_IDENTITY_3x3 * mats[rot_order[0]] * (mats[rot_order[1]] * (mats[rot_order[2]]))).to_euler()
 
     # Should work but doesnt!
@@ -529,7 +529,7 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
                     prev_euler[i] = euler
 
             if bvh_node.has_loc:
-                pose_bone.location = (bone_rest_matrix_inv * TranslationMatrix(Vector((lx, ly, lz)) - bvh_node.rest_head_local)).translation_part()
+                pose_bone.location = (bone_rest_matrix_inv * Matrix.Translation(Vector((lx, ly, lz)) - bvh_node.rest_head_local)).translation_part()
 
             if bvh_node.has_loc:
                 pose_bone.keyframe_insert("location")
index fe242ca1f292a9c4583f0c0e5b56e3ecbe76219e..0c30a8bd127825bbb1f658c3fc97027f8eaef0b9 100644 (file)
@@ -141,7 +141,7 @@ import os
 import time
 import struct
 
-from import_scene_obj import unpack_face_list, load_image
+from import_scene_obj import load_image
 
 import bpy
 import mathutils
@@ -312,10 +312,10 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
     contextMaterial = None
     contextMatrix_rot = None # Blender.mathutils.Matrix(); contextMatrix.identity()
     #contextMatrix_tx = None # Blender.mathutils.Matrix(); contextMatrix.identity()
-    contextMesh_vertls = None
+    contextMesh_vertls = None # flat array: (verts * 3)
     contextMesh_facels = None
     contextMeshMaterials = {} # matname:[face_idxs]
-    contextMeshUV = None
+    contextMeshUV = None # flat array (verts * 2)
 
     TEXTURE_DICT = {}
     MATDICT = {}
@@ -333,113 +333,69 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
     # print STRUCT_SIZE_4x3MAT, ' STRUCT_SIZE_4x3MAT'
 
     def putContextMesh(myContextMesh_vertls, myContextMesh_facels, myContextMeshMaterials):
-
-        materialFaces = set() # faces that have a material. Can optimize?
-
-        # Now make copies with assigned materils.
-
-        def makeMeshMaterialCopy(matName, faces):
-            '''
-            Make a new mesh with only face the faces that use this material.
-            faces can be any iterable object - containing ints.
-            '''
-
-            faceVertUsers = [False] * len(myContextMesh_vertls)
-            ok = 0
-            for fIdx in faces:
-                for vindex in myContextMesh_facels[fIdx]:
-                    faceVertUsers[vindex] = True
-                    if matName != None: # if matName is none then this is a set(), meaning we are using the untextured faces and do not need to store textured faces.
-                        materialFaces.add(fIdx)
-                    ok = 1
-
-            if not ok:
-                return
-
-            myVertMapping = {}
-            vertMappingIndex = 0
-
-            vertsToUse = [i for i in range(len(myContextMesh_vertls)) if faceVertUsers[i]]
-            myVertMapping = {ii: i for i, ii in enumerate(vertsToUse)}
-
-            tempName= '%s_%s' % (contextObName, matName) # matName may be None.
-            bmesh = bpy.data.meshes.new(tempName)
-
-            if matName == None:
-                img = None
+        
+        bmesh = bpy.data.meshes.new(contextObName)
+        if myContextMesh_vertls:
+
+            bmesh.add_geometry(len(myContextMesh_vertls)//3, 0, len(myContextMesh_facels))
+            bmesh.verts.foreach_set("co", myContextMesh_vertls)
+            
+            eekadoodle_faces = []
+            for v1, v2, v3 in myContextMesh_facels:
+                eekadoodle_faces.extend([v3, v1, v2, 0] if v3 == 0 else [v1, v2, v3, 0])
+            bmesh.faces.foreach_set("verts_raw", eekadoodle_faces)
+            
+            if bmesh.faces and contextMeshUV:
+                bmesh.add_uv_texture()
+                uv_faces = bmesh.active_uv_texture.data[:]
             else:
-                bmat = MATDICT[matName][1]
-                bmesh.add_material(bmat)
-#                              bmesh.materials = [bmat]
-                try:   img = TEXTURE_DICT[bmat.name]
-                except:        img = None
-
-#                      bmesh_verts = bmesh.verts
-            if len(vertsToUse):
-                bmesh.add_geometry(len(vertsToUse), 0, len(faces))
-
-                # XXX why add extra vertex?
-#                              bmesh_verts.extend( [Vector()] )
-                bmesh.verts.foreach_set("co", [x for tup in [myContextMesh_vertls[i] for i in vertsToUse] for x in tup])
-#                              bmesh_verts.extend( [myContextMesh_vertls[i] for i in vertsToUse] )
-
-                # +1 because of DUMMYVERT
-                bmesh.faces.foreach_set("verts_raw", unpack_face_list([[myVertMapping[vindex] for vindex in myContextMesh_facels[fIdx]] for fIdx in faces]))
-#                              face_mapping = bmesh.faces.extend( [ [ bmesh_verts[ myVertMapping[vindex]+1] for vindex in myContextMesh_facels[fIdx]] for fIdx in faces ], indexList=True )
-
-                if bmesh.faces and (contextMeshUV or img):
-                    bmesh.add_uv_texture()
-                    for ii, i in enumerate(faces):
-
-                        # Mapped index- faces may have not been added- if so, then map to the correct index
-                        # BUGGY API - face_mapping is not always the right length
-#                                              map_index = face_mapping[ii]
-
-                        if 1:
-#                                              if map_index != None:
-                            targetFace = bmesh.faces[ii]
-#                                                      targetFace = bmesh.faces[map_index]
-
-                            uf = bmesh.active_uv_texture.data[ii]
-
-                            if contextMeshUV:
-                                # v.index-1 because of the DUMMYVERT
-                                uvs = [contextMeshUV[vindex] for vindex in myContextMesh_facels[i]]
-
-                                if len(myContextMesh_facels[i]) == 3:
-                                    uf.uv1, uf.uv2, uf.uv3, uf.uv4 = uvs + [(0.0, 0.0)]
-                                else:
-                                    uf.uv1, uf.uv2, uf.uv3, uf.uv4 = uvs
-#                                                              targetFace.uv = [contextMeshUV[vindex] for vindex in myContextMesh_facels[i]]
-                            if img:
-                                uf.image = img
-
-                                # to get this image to show up in 'Textured' shading mode
-                                uf.tex = True
-
-            # bmesh.transform(contextMatrix)
-            ob = bpy.data.objects.new(tempName, bmesh)
-            SCN.objects.link(ob)
-#                      ob = SCN_OBJECTS.new(bmesh, tempName)
-            '''
-            if contextMatrix_tx:
-                ob.setMatrix(contextMatrix_tx)
-            '''
-
-            if contextMatrix_rot:
-                ob.matrix_world = contextMatrix_rot
-
-            importedObjects.append(ob)
-            bmesh.update()
-#                      bmesh.calcNormals()
-
-        for matName, faces in myContextMeshMaterials.items():
-            makeMeshMaterialCopy(matName, faces)
-
-        if len(materialFaces) != len(myContextMesh_facels):
-            # Invert material faces.
-            makeMeshMaterialCopy(None, set(range(len( myContextMesh_facels ))) - materialFaces)
-            #raise 'Some UnMaterialed faces', len(contextMesh.faces)
+                uv_faces = None
+
+            for mat_idx, (matName, faces) in enumerate(myContextMeshMaterials.items()):
+                if matName is None:
+                    bmesh.add_material(None)
+                else:
+                    bmat = MATDICT[matName][1]
+                    bmesh.add_material(bmat) # can be None
+                    img = TEXTURE_DICT.get(bmat.name)
+                
+                if uv_faces  and img:
+                    for fidx in faces:
+                        bmesh.faces[fidx].material_index = mat_idx
+                        uf = uv_faces[fidx]
+                        uf.image = img
+                        uf.tex = True
+                else:
+                    for fidx in faces:
+                        bmesh.faces[fidx].material_index = mat_idx
+                
+            if uv_faces:
+                for fidx, uf in enumerate(uv_faces):
+                    face = myContextMesh_facels[fidx]
+                    v1, v2, v3 = face
+                    
+                    # eekadoodle
+                    if v3 == 0:
+                        v1, v2, v3 = v3, v1, v2
+                    
+                    uf.uv1 = contextMeshUV[v1 * 2:(v1 * 2) + 2]
+                    uf.uv2 = contextMeshUV[v2 * 2:(v2 * 2) + 2]
+                    uf.uv3 = contextMeshUV[v3 * 2:(v3 * 2) + 2]
+                    # always a tri
+
+        ob = bpy.data.objects.new(tempName, bmesh)
+        SCN.objects.link(ob)
+        
+        '''
+        if contextMatrix_tx:
+            ob.setMatrix(contextMatrix_tx)
+        '''
+        
+        if contextMatrix_rot:
+            ob.matrix_world = contextMatrix_rot
+
+        importedObjects.append(ob)
+        bmesh.update()
 
     #a spare chunk
     new_chunk = chunk()
@@ -667,14 +623,10 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
             new_chunk.bytes_read += 2
 
             # print 'number of verts: ', num_verts
-            def getvert():
-                temp_data = struct.unpack('<3f', file.read(STRUCT_SIZE_3FLOAT))
-                new_chunk.bytes_read += STRUCT_SIZE_3FLOAT #12: 3 floats x 4 bytes each
-                return temp_data
-
-            #contextMesh.verts.extend( [Vector(),] ) # DUMMYVERT! - remove when blenders internals are fixed.
-            contextMesh_vertls = [getvert() for i in range(num_verts)]
-
+            contextMesh_vertls = struct.unpack('<%df' % (num_verts * 3), file.read(STRUCT_SIZE_3FLOAT * num_verts))
+            new_chunk.bytes_read += STRUCT_SIZE_3FLOAT * num_verts
+            # dummyvert is not used atm!
+            
             #print 'object verts: bytes read: ', new_chunk.bytes_read
 
         elif (new_chunk.ID == OBJECT_FACES):
@@ -684,15 +636,11 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
             new_chunk.bytes_read += 2
             #print 'number of faces: ', num_faces
 
-            def getface():
-                # print '\ngetting a face'
-                temp_data = file.read(STRUCT_SIZE_4UNSIGNED_SHORT)
-                new_chunk.bytes_read += STRUCT_SIZE_4UNSIGNED_SHORT #4 short ints x 2 bytes each
-                v1,v2,v3,dummy = struct.unpack('<4H', temp_data)
-                return v1, v2, v3
-
-            contextMesh_facels = [ getface() for i in range(num_faces) ]
-
+            # print '\ngetting a face'
+            temp_data = file.read(STRUCT_SIZE_4UNSIGNED_SHORT * num_faces)
+            new_chunk.bytes_read += STRUCT_SIZE_4UNSIGNED_SHORT * num_faces #4 short ints x 2 bytes each
+            contextMesh_facels = struct.unpack('<%dH' % (num_faces * 4), temp_data)
+            contextMesh_facels = [contextMesh_facels[i - 3:i] for i in range(3, (num_faces * 4) + 3, 4)]
 
         elif (new_chunk.ID == OBJECT_MATERIAL):
             # print 'elif (new_chunk.ID == OBJECT_MATERIAL):'
@@ -703,12 +651,11 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
             num_faces_using_mat = struct.unpack('<H', temp_data)[0]
             new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT
 
-            def getmat():
-                temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT)
-                new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT
-                return struct.unpack('<H', temp_data)[0]
+            
+            temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT * num_faces_using_mat)
+            new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT * num_faces_using_mat
 
-            contextMeshMaterials[material_name]= [ getmat() for i in range(num_faces_using_mat) ]
+            contextMeshMaterials[material_name]= struct.unpack("<%dH" % (num_faces_using_mat), temp_data)
 
             #look up the material in all the materials
 
@@ -717,12 +664,9 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
             num_uv = struct.unpack('<H', temp_data)[0]
             new_chunk.bytes_read += 2
 
-            def getuv():
-                temp_data = file.read(STRUCT_SIZE_2FLOAT)
-                new_chunk.bytes_read += STRUCT_SIZE_2FLOAT #2 float x 4 bytes each
-                return mathutils.Vector( struct.unpack('<2f', temp_data) )
-
-            contextMeshUV = [ getuv() for i in range(num_uv) ]
+            temp_data = file.read(STRUCT_SIZE_2FLOAT * num_uv)
+            new_chunk.bytes_read += STRUCT_SIZE_2FLOAT * num_uv
+            contextMeshUV = struct.unpack('<%df' % (num_uv * 2), temp_data)
 
         elif (new_chunk.ID == OBJECT_TRANS_MATRIX):
             # How do we know the matrix size? 54 == 4x4 48 == 4x3
@@ -771,7 +715,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
             #print contextMatrix_rot
             contextMatrix_rot.invert()
             #print contextMatrix_rot
-            #contextMatrix_tx = Blender.mathutils.TranslationMatrix(0.5 * Blender.mathutils.Vector(data[9:]))
+            #contextMatrix_tx = mathutils.Matrix.Translation(0.5 * Blender.mathutils.Vector(data[9:]))
             #contextMatrix_tx.invert()
 
             #tx.invert()
@@ -806,7 +750,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
 
     # FINISHED LOOP
     # There will be a number of objects still not added
-    if contextMesh_facels != None:
+    if CreateBlenderObject:
         putContextMesh(contextMesh_vertls, contextMesh_facels, contextMeshMaterials)
 
 def load_3ds(filename, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True, APPLY_MATRIX=False):
index e832489a56020f238bbedcc0f496691d893a553d..c129ad7bde6aaa34d6386ca336b516839659f4d1 100644 (file)
@@ -82,23 +82,21 @@ def unpack_list(list_of_tuples):
 
 # same as above except that it adds 0 for triangle faces
 def unpack_face_list(list_of_tuples):
-    l = []
-    for t in list_of_tuples:
-        face = [i for i in t]
-
-        if len(face) != 3 and len(face) != 4:
-            raise RuntimeError("{0} vertices in face.".format(len(face)))
-
-        # rotate indices if the 4th is 0
-        if len(face) == 4 and face[3] == 0:
-            face = [face[3], face[0], face[1], face[2]]
-
-        if len(face) == 3:
-            face.append(0)
+    # allocate the entire list
+    flat_ls = [0] * (len(list_of_tuples) * 4)
+    i = 0
 
-        l.extend(face)
+    for t in list_of_tuples:
+        if len(t) == 3:
+            if t[2] == 0:
+                t = t[1], t[2], t[0]
+        else: # assuem quad
+            if t[3] == 0 or t[2] == 0:
+                t = t[2], t[3], t[0], t[1]
 
-    return l
+        flat_ls[i:i + len(t)] = t
+        i += 4
+    return flat_ls
 
 def BPyMesh_ngon(from_data, indices, PREF_FIX_LOOPS= True):
     '''
@@ -305,13 +303,14 @@ def load_image(imagepath, dirname):
     if os.path.exists(imagepath):
         return bpy.data.images.load(imagepath)
 
-    variants = [os.path.join(dirname, imagepath), os.path.join(dirname, os.path.basename(imagepath))]
+    variants = [imagepath, os.path.join(dirname, imagepath), os.path.join(dirname, os.path.basename(imagepath))]
 
-    for path in variants:
-        if os.path.exists(path):
-            return bpy.data.images.load(path)
-        else:
-            print(path, "doesn't exist")
+    for filepath in variants:
+        for nfilepath in (filepath, bpy.path.resolve_ncase(filepath)):
+            if os.path.exists(nfilepath):
+                return bpy.data.images.load(nfilepath)
+
+    print(filepath, "doesn't exist")
 
     # TODO comprehensiveImageLoad also searched in bpy.config.textureDir
     return None
index d74726dce2e9998dacc5a9e60a8e9321874297eb..522f860684f1846d322b3b1f2513b42052cbc7dc 100644 (file)
@@ -12,7 +12,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # ***** END GPL LICENCE BLOCK *****
 
index 1dcee85820bb1dc19fd98644c46aad1f31edda80..cacc35ad48dc1cf25b046e9446981420863b399f 100644 (file)
@@ -86,7 +86,11 @@ class RenderButtonsPanel():
     bl_region_type = "WINDOW"
     bl_context = "render"
     # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
-
+    
+    @classmethod
+    def poll(cls, context):
+        rd = context.scene.render
+        return (rd.use_game_engine==False) and (rd.engine in cls.COMPAT_ENGINES)
 
 # Setting panel, use in the scene for now.
 class RENDER_PT_network_settings(bpy.types.Panel, RenderButtonsPanel):
@@ -95,7 +99,7 @@ class RENDER_PT_network_settings(bpy.types.Panel, RenderButtonsPanel):
 
     @classmethod
     def poll(cls, context):
-        return base_poll(cls, context)
+        return super(RENDER_PT_network_settings, cls).poll(context)
 
     def draw(self, context):
         layout = self.layout
@@ -134,7 +138,7 @@ class RENDER_PT_network_slave_settings(bpy.types.Panel, RenderButtonsPanel):
     @classmethod
     def poll(cls, context):
         scene = context.scene
-        return base_poll(cls, context) and scene.network_render.mode == "RENDER_SLAVE"
+        return super(RENDER_PT_network_slave_settings, cls).poll(context) and scene.network_render.mode == "RENDER_SLAVE"
 
     def draw(self, context):
         layout = self.layout
@@ -159,7 +163,7 @@ class RENDER_PT_network_master_settings(bpy.types.Panel, RenderButtonsPanel):
     @classmethod
     def poll(cls, context):
         scene = context.scene
-        return base_poll(cls, context) and scene.network_render.mode == "RENDER_MASTER"
+        return super(RENDER_PT_network_master_settings, cls).poll(context) and scene.network_render.mode == "RENDER_MASTER"
 
     def draw(self, context):
         layout = self.layout
@@ -177,7 +181,7 @@ class RENDER_PT_network_job(bpy.types.Panel, RenderButtonsPanel):
     @classmethod
     def poll(cls, context):
         scene = context.scene
-        return base_poll(cls, context) and scene.network_render.mode == "RENDER_CLIENT"
+        return super(RENDER_PT_network_job, cls).poll(context) and scene.network_render.mode == "RENDER_CLIENT"
 
     def draw(self, context):
         layout = self.layout
@@ -221,7 +225,7 @@ class RENDER_PT_network_slaves(bpy.types.Panel, RenderButtonsPanel):
         if netsettings.mode != "RENDER_CLIENT":
             return False
         verify_address(netsettings)
-        return base_poll(cls, context) and netsettings.server_address != "[default]"
+        return super(RENDER_PT_network_slaves, cls).poll(context) and netsettings.server_address != "[default]"
 
     def draw(self, context):
         layout = self.layout
@@ -259,7 +263,7 @@ class RENDER_PT_network_slaves_blacklist(bpy.types.Panel, RenderButtonsPanel):
         if netsettings.mode != "RENDER_CLIENT":
             return False
         verify_address(netsettings)
-        return base_poll(cls, context) and netsettings.server_address != "[default]"
+        return super(RENDER_PT_network_slaves_blacklist, cls).poll(context) and netsettings.server_address != "[default]"
 
     def draw(self, context):
         layout = self.layout
@@ -296,7 +300,7 @@ class RENDER_PT_network_jobs(bpy.types.Panel, RenderButtonsPanel):
         if netsettings.mode != "RENDER_CLIENT":
             return False
         verify_address(netsettings)
-        return base_poll(cls, context) and netsettings.server_address != "[default]"
+        return super(RENDER_PT_network_jobs, cls).poll(context) and netsettings.server_address != "[default]"
 
     def draw(self, context):
         layout = self.layout
index 9031121060ac76a6ca6960f32d493c78c3cb20ad..41c05ce9d8a503912c421f45e87b6c9cd3615ba5 100644 (file)
@@ -25,11 +25,11 @@ import mathutils
 def add_object_align_init(context, operator):
 
     if operator and operator.properties.is_property_set("location") and operator.properties.is_property_set("rotation"):
-        location = mathutils.TranslationMatrix(mathutils.Vector(operator.properties.location))
+        location = mathutils.Matrix.Translation(mathutils.Vector(operator.properties.location))
         rotation = mathutils.Euler(operator.properties.rotation).to_matrix().resize4x4()
     else:
         # TODO, local view cursor!
-        location = mathutils.TranslationMatrix(context.scene.cursor_location)
+        location = mathutils.Matrix.Translation(context.scene.cursor_location)
 
         if context.user_preferences.edit.object_align == 'VIEW' and context.space_data.type == 'VIEW_3D':
             rotation = context.space_data.region_3d.view_matrix.rotation_part().invert().resize4x4()
index c7ee23264e8c42e83257cdbb61d2731137963d61..6c1c669d1f2d845fb30496d18bcbd427c0754230 100644 (file)
@@ -30,8 +30,6 @@ import sys as _sys
 from _bpy import blend_paths
 from _bpy import script_paths as _bpy_script_paths
 
-_TEST_XML = _bpy.app.debug
-
 def _test_import(module_name, loaded_modules):
     import traceback
     import time
@@ -54,35 +52,6 @@ def _test_import(module_name, loaded_modules):
     loaded_modules.add(mod.__name__) # should match mod.__name__ too
     return mod
 
-if _TEST_XML:
-    # TEST CODE
-    def _test_import_xml(path, f, loaded_modules):
-        import bpy_xml_ui
-        import traceback
-
-        f_full = _os.path.join(path, f)
-        _bpy_types._register_immediate = True
-        try:
-            classes = bpy_xml_ui.load_xml(f_full)
-        except:
-            traceback.print_exc()
-            classes = []
-        _bpy_types._register_immediate = False
-
-        if classes:
-            mod_name = f.split(".")[0]
-
-            # fake module
-            mod = type(traceback)(mod_name)
-            mod.__file__ = f_full
-            for cls in classes:
-                setattr(mod, cls.__name__, cls)
-            
-            loaded_modules.add(mod_name)
-            _sys.modules[mod_name] = mod
-            mod.register = lambda: None # quiet errors
-            return mod
-
 
 def modules_from_path(path, loaded_modules):
     """
@@ -110,10 +79,6 @@ def modules_from_path(path, loaded_modules):
         else:
             mod = None
 
-        if _TEST_XML:
-            if mod is None and f.endswith(".xml"):
-                mod = _test_import_xml(path, f, loaded_modules)
-
         if mod:
             modules.append(mod)
 
index 0cd0aaaa3f049c43ffdaa1dd787c2c8456fc85f0..0a796793d01088f5b93ad64b9e6925cae49d2495 100644 (file)
@@ -525,7 +525,7 @@ class Text(bpy_types.ID):
 
     def as_string(self):
         """Return the text as a string."""
-        return "\n".join(line.line for line in self.lines)
+        return "\n".join(line.body for line in self.lines)
 
     def from_string(self, string):
         """Replace text with this string."""
diff --git a/release/scripts/modules/bpy_xml_ui.py b/release/scripts/modules/bpy_xml_ui.py
deleted file mode 100644 (file)
index 18eec9c..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-#  This program is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU General Public License
-#  as published by the Free Software Foundation; either version 2
-#  of the License, or (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program; if not, write to the Free Software Foundation,
-#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# <pep8 compliant>
-
-"""
-This module translates XML into blender/ui function calls.
-"""
-
-import xml.dom.minidom
-import bpy as _bpy
-
-def parse_rna(prop, value):
-    if prop.type == 'FLOAT':
-        value = float(value)
-    elif prop.type == 'INT':
-        value = int(value)
-    elif prop.type == 'BOOLEAN':
-        if value not in ("true", "false"):
-            raise Exception("invalid bool value: %s", value)
-        value = bool(value == "true")
-    elif prop.type in ('STRING', 'ENUM'):
-        pass
-    elif prop.type == 'POINTER':
-        value = eval("_bpy." + value)
-    else:
-        raise Exception("type not supported %s.%s" % (prop.identifier, prop.type))
-    return value
-    
-def parse_args(base, xml_node):
-    args = {}
-    rna_params = base.bl_rna.functions[xml_node.tagName].parameters
-    for key, value in xml_node.attributes.items():
-        args[key] = parse_rna(rna_params[key], value)
-    return args
-
-def ui_xml(base, xml_node):
-    name = xml_node.tagName
-    prop = base.bl_rna.properties.get(name)
-    if name in base.bl_rna.properties:
-        attr = xml_node.attributes.get("expr")
-        if attr:
-            value = attr.value
-            value = eval(value, {"context": _bpy.context})
-            setattr(base, name, value)
-        else:
-            attr = xml_node.attributes['value']
-            value = attr.value
-            value = parse_rna(prop, value)
-            setattr(base, name, value)
-    else:
-        func_new = getattr(base, name)
-        kw_args = parse_args(base, xml_node)
-        base_new = func_new(**kw_args) # call blender func
-        if xml_node.hasChildNodes():
-            ui_xml_list(base_new, xml_node.childNodes)
-
-def ui_xml_list(base, xml_nodes):
-    import bpy
-    for node in xml_nodes:
-        if node.nodeType not in (node.TEXT_NODE, node.COMMENT_NODE):
-            ui_xml(base, node)
-            bpy.N = node
-
-def test(layout):
-    uixml = xml.dom.minidom.parseString(open("/mnt/test/blender-svn/blender/release/scripts/ui/test.xml", 'r').read())
-    panel = uixml.getElementsByTagName('panel')[0]
-    ui_xml_list(layout, panel.childNodes)
-
-def load_xml(filepath):
-    classes = []
-    fn = open(filepath, 'r')
-    data = fn.read()
-    uixml = xml.dom.minidom.parseString(data).getElementsByTagName("ui")[0]
-    fn.close()
-    
-    def draw_xml(self, context):
-        node = self._xml_node.getElementsByTagName("draw")[0]
-        ui_xml_list(self.layout, node.childNodes)
-        
-    def draw_header_xml(self, context):
-        node = self._xml_node.getElementsByTagName("draw_header")[0]
-        ui_xml_list(self.layout, node.childNodes)
-    
-    for node in uixml.childNodes:
-        if node.nodeType not in (node.TEXT_NODE, node.COMMENT_NODE):
-            name = node.tagName
-            class_name = node.attributes["identifier"].value
-
-            if name == "panel":
-                class_dict = {
-                    "bl_label": node.attributes["label"].value,
-                    "bl_region_type": node.attributes["region_type"].value,
-                    "bl_space_type": node.attributes["space_type"].value,
-                    "bl_context": node.attributes["context"].value,
-                    "bl_default_closed": ((node.attributes["default_closed"].value == "true") if "default_closed" in node.attributes else False),
-
-                    "draw": draw_xml,
-                    "_xml_node": node
-                }
-                
-                if node.getElementsByTagName("draw_header"):
-                    class_dict["draw_header"] = draw_header_xml
-
-                # will register instantly
-                class_new = type(class_name, (_bpy.types.Panel,), class_dict)
-
-            elif name == "menu":
-                class_dict = {
-                    "bl_label": node.attributes["label"].value,
-
-                    "draw": draw_xml,
-                    "_xml_node": node
-                }
-
-                # will register instantly
-                class_new = type(class_name, (_bpy.types.Menu,), class_dict)
-
-            elif name == "header":
-                class_dict = {
-                    "bl_label": node.attributes["label"].value,
-                    "bl_space_type": node.attributes["space_type"].value,
-
-                    "draw": draw_xml,
-                    "_xml_node": node
-                }
-
-                # will register instantly
-                class_new = type(class_name, (_bpy.types.Header,), class_dict)
-            else:
-                raise Exception("invalid id found '%s': expected a value in ('header', 'panel', 'menu)'" % name)
-
-            classes.append(class_new)
-            
-
-    return classes
diff --git a/release/scripts/modules/bpyml.py b/release/scripts/modules/bpyml.py
new file mode 100644 (file)
index 0000000..f30a4b8
--- /dev/null
@@ -0,0 +1,204 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+"""
+This module translates a python like XML representation into XML
+or simple python blender/ui function calls.
+
+    sometag(arg=10) [
+        another()
+        another(key="value")
+    ]
+
+# converts into ...
+
+    <sometag arg="10">
+        <another/>
+        <another key="value" />
+    </sometag>
+
+"""
+
+TAG, ARGS, CHILDREN = range(3)
+class ReturnStore(tuple):
+    def __getitem__(self, key):
+
+        # single item get's
+        if type(key) is ReturnStore:
+            key = (key, )
+
+        if type(key) is tuple:
+            children = self[CHILDREN]
+            if children:
+                raise Exception("Only a single __getitem__ is allowed on the ReturnStore")
+            else:
+                children[:] = key
+            return self
+        else:
+            return tuple.__getitem__(self, key)
+
+
+class FunctionStore(object):
+    def __call__(self, **kwargs):
+        return ReturnStore((self.__class__.__name__, kwargs, []))
+
+
+def tag_vars(tags, module=__name__):
+    return {tag: type(tag, (FunctionStore, ), {"__module__": module})() for tag in tags}
+
+
+def tag_module(mod_name, tags):
+    import sys
+    from types import ModuleType
+    mod = ModuleType(mod_name)
+    sys.modules[mod_name] = mod
+    dict_values = tag_vars(tags, mod_name)
+    mod.__dict__.update(dict_values)
+    return mod
+
+
+def toxml(py_data, indent="    "):
+
+    if len(py_data) != 1 or type(py_data) != list:
+        raise Exception("Expected a list with one member")
+
+    def _to_xml(py_item, xml_node=None):
+        if xml_node is None:
+            xml_node = newdoc.createElement(py_item[TAG])
+
+        for key, value in py_item[ARGS].items():
+            xml_node.setAttribute(key, str(value))
+
+        for py_item_child in py_item[CHILDREN]:
+            xml_node.appendChild(_to_xml(py_item_child))
+
+        return xml_node
+
+    def _to_xml_iter(xml_parent, data_ls):
+        for py_item in data_ls:
+            xml_node = newdoc.createElement(py_item[TAG])
+            
+
+            # ok if its empty
+            _to_xml_iter(xml_node, py_item[CHILDREN])
+
+    import xml.dom.minidom
+    impl = xml.dom.minidom.getDOMImplementation()
+    newdoc = impl.createDocument(None, py_data[0][TAG], None)
+
+    _to_xml(py_data[0], newdoc.documentElement)
+
+    return newdoc.documentElement.toprettyxml(indent="  ")
+
+
+def fromxml(data):
+    def _fromxml_kwargs(xml_node):
+        kwargs = {}
+        for key, value in xml_node.attributes.items():
+            kwargs[key] = value
+        return kwargs
+    
+    
+    def _fromxml(xml_node):
+        py_item = (xml_node.tagName, _fromxml_kwargs(xml_node), [])
+        #_fromxml_iter(py_item, xml_node.childNodes)
+        for xml_node_child in xml_node.childNodes:
+            if xml_node_child.nodeType not in (xml_node_child.TEXT_NODE, xml_node_child.COMMENT_NODE):
+                py_item[CHILDREN].append(_fromxml(xml_node_child))
+        return py_item
+
+    import xml.dom.minidom
+    xml_doc = xml.dom.minidom.parseString(data)
+    return [_fromxml(xml_doc.documentElement)]
+
+
+def topretty_py(py_data, indent="    "):
+    
+    if len(py_data) != 1:
+        raise Exception("Expected a list with one member")
+
+    lines = []
+    
+    def _to_kwargs(kwargs):
+        return ", ".join([("%s=%s" % (key, repr(value))) for key, value in sorted(kwargs.items())])
+    
+    def _topretty(py_item, indent_ctx, last):
+        if py_item[CHILDREN]:
+            lines.append("%s%s(%s) [" % (indent_ctx, py_item[TAG], _to_kwargs(py_item[ARGS])))
+            py_item_last = py_item[CHILDREN][-1]
+            for py_item_child in py_item[CHILDREN]:
+                _topretty(py_item_child, indent_ctx + indent, (py_item_child is py_item_last))
+            lines.append("%s]%s" % (indent_ctx, ("" if last else ",")))
+        else:
+            lines.append("%s%s(%s)%s" % (indent_ctx, py_item[TAG], _to_kwargs(py_item[ARGS]), ("" if last else ",")))
+    
+    _topretty(py_data[0], "", True)
+
+    return "\n".join(lines)
+
+if __name__ == "__main__":
+    # testing code.
+    
+    tag_module("bpyml_test", ("ui", "prop", "row", "column", "active", "separator", "split"))
+    from bpyml_test import *
+
+    draw = [
+         ui() [
+            split() [
+                column() [
+                    prop(data='context.scene.render', property='stamp_time', text='Time'),
+                    prop(data='context.scene.render', property='stamp_date', text='Date'),
+                    prop(data='context.scene.render', property='stamp_render_time', text='RenderTime'),
+                    prop(data='context.scene.render', property='stamp_frame', text='Frame'),
+                    prop(data='context.scene.render', property='stamp_scene', text='Scene'),
+                    prop(data='context.scene.render', property='stamp_camera', text='Camera'),
+                    prop(data='context.scene.render', property='stamp_filename', text='Filename'),
+                    prop(data='context.scene.render', property='stamp_marker', text='Marker'),
+                    prop(data='context.scene.render', property='stamp_sequencer_strip', text='Seq. Strip')
+                ],
+                column() [
+                    active(expr='context.scene.render.render_stamp'),
+                    prop(data='context.scene.render', property='stamp_foreground', slider=True),
+                    prop(data='context.scene.render', property='stamp_background', slider=True),
+                    separator(),
+                    prop(data='context.scene.render', property='stamp_font_size', text='Font Size')
+                ]
+            ],
+            split(percentage=0.2) [
+                prop(data='context.scene.render', property='stamp_note', text='Note'),
+                row() [
+                    active(expr='context.scene.render.stamp_note'),
+                    prop(data='context.scene.render', property='stamp_note_text', text='')
+                ]
+            ]
+        ]
+    ]
+
+    xml_data = toxml(draw)
+    print(xml_data) # xml version
+
+    py_data = fromxml(xml_data)
+    print(py_data) # converted back to py
+
+    xml_data = toxml(py_data)
+    print(xml_data) # again back to xml
+
+    py_data = fromxml(xml_data) # pretty python version
+    print(topretty_py(py_data))
diff --git a/release/scripts/modules/bpyml_ui.py b/release/scripts/modules/bpyml_ui.py
new file mode 100644 (file)
index 0000000..ad68d1b
--- /dev/null
@@ -0,0 +1,100 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+
+import bpy as _bpy
+import bpyml
+from bpyml import TAG, ARGS, CHILDREN
+from types import ModuleType
+
+_uilayout_rna = _bpy.types.UILayout.bl_rna
+
+_uilayout_tags = ["ui"] + \
+    _uilayout_rna.properties.keys() + \
+    _uilayout_rna.functions.keys()
+
+# these need to be imported directly
+# >>> from bpyml_ui.locals import *
+locals = bpyml.tag_module("%s.locals" % __name__ , _uilayout_tags)
+
+
+def _parse_rna(prop, value):
+    if prop.type == 'FLOAT':
+        value = float(value)
+    elif prop.type == 'INT':
+        value = int(value)
+    elif prop.type == 'BOOLEAN':
+        if value in (True, False):
+            pass
+        else:
+            if value not in ("True", "False"):
+                raise Exception("invalid bool value: %s" % value)
+            value = bool(value == "True")
+    elif prop.type in ('STRING', 'ENUM'):
+        pass
+    elif prop.type == 'POINTER':
+        value = eval("_bpy." + value)
+    else:
+        raise Exception("type not supported %s.%s" % (prop.identifier, prop.type))
+    return value
+
+
+def _parse_rna_args(base, py_node):
+    rna_params = base.bl_rna.functions[py_node[TAG]].parameters
+    args = {}
+    for key, value in py_node[ARGS].items():
+        args[key] = _parse_rna(rna_params[key], value)
+    return args
+
+
+def _call_recursive(context, base, py_node):
+    prop = base.bl_rna.properties.get(py_node[TAG])
+    if py_node[TAG] in base.bl_rna.properties:
+        value = py_node[ARGS].get("expr")
+        if value:
+            value = eval(value, {"context": _bpy.context})
+            setattr(base, py_node[TAG], value)
+        else:
+            value = py_node[ARGS]['value'] # have to have this
+            setattr(base, name, value)
+    else:
+        args = _parse_rna_args(base, py_node)
+        func_new = getattr(base, py_node[TAG])
+        base_new = func_new(**args) # call blender func
+        if base_new is not None:
+            for py_node_child in py_node[CHILDREN]:
+                _call_recursive(context, base_new, py_node_child)
+
+
+class BPyML_BaseUI():
+    '''
+    This is a mix-in class that defines a draw function
+    which checks for draw_data
+    '''
+
+    def draw(self, context):
+        layout = self.layout
+        for py_node in self.draw_data[CHILDREN]:
+            _call_recursive(context, layout, py_node)
+
+    def draw_header(self, context):
+        layout = self.layout
+        for py_node in self.draw_header_data[CHILDREN]:
+            _call_recursive(context, layout, py_node)
index 86f2399f7ff1600fdda99ef3aa95745fc6b90a33..c4c9886e2e2e8488f4a83d6869d4b0acc99ce5f4 100644 (file)
@@ -147,7 +147,7 @@ def deform(obj, definitions, base_names, options):
 
 
 def main(obj, bone_definition, base_names, options):
-    from mathutils import Vector, RotationMatrix
+    from mathutils import Vector, Matrix
     from math import radians, pi
 
     arm = obj.data
@@ -264,7 +264,7 @@ def main(obj, bone_definition, base_names, options):
 
     # Rotate the rev chain 180 about the by the first bones center point
     pivot = (rv_chain.spine_01_e.head + rv_chain.spine_01_e.tail) * 0.5
-    matrix = RotationMatrix(radians(180), 3, 'X')
+    matrix = Matrix.Rotation(radians(180), 3, 'X')
     for i, attr in enumerate(rv_chain.attr_names): # similar to neck
         spine_e = getattr(rv_chain, attr + "_e")
         # use the first bone as the pivot
index 47da977891392e53733d55f80a0c03a5a2da265b..a629487c0c83c86a3ec5141cdcd616390c8e0acc 100644 (file)
@@ -12,7 +12,7 @@
 #
 #  You should have received a copy of the GNU General Public License
 #  along with this program; if not, write to the Free Software Foundation,
-#  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # ##### END GPL LICENSE BLOCK #####
 
@@ -22,7 +22,7 @@ import bpy
 from rigify import RigifyError
 from rigify_utils import bone_class_instance, copy_bone_simple
 from rna_prop_ui import rna_idprop_ui_prop_get
-from mathutils import Vector, RotationMatrix
+from mathutils import Vector, Matrix
 from math import radians, pi
 
 # not used, defined for completeness
index 71895a25446b8c8d95619193b48f85a1c18a1a83..5d769d016413f0cfb95eac6bed9a917770be25fc 100644 (file)
@@ -625,18 +625,23 @@ def BuildRNAInfo():
 if __name__ == "__main__":
     import rna_info
     struct = rna_info.BuildRNAInfo()[0]
-    data = ""
+    data = []
     for struct_id, v in sorted(struct.items()):
-        struct_id_str = "".join(sid for sid in struct_id if struct_id)
-        props = [(prop.identifier, prop) for prop in v.properties]
+        struct_id_str = v.identifier # "".join(sid for sid in struct_id if struct_id)
+
+        for base in v.get_bases():
+            struct_id_str = base.identifier + "|" + struct_id_str
         
+        props = [(prop.identifier, prop) for prop in v.properties]
         for prop_id, prop in sorted(props):
             # if prop.type == 'boolean':
             #     continue
-            data += "%s.%s -> %s:    %s%s    %s\n" % (struct_id_str, prop.identifier, prop.identifier, prop.type, ", (read-only)" if prop.is_readonly else "", prop.description)
+            data.append("%s.%s -> %s:    %s%s    %s" % (struct_id_str, prop.identifier, prop.identifier, prop.type, ", (read-only)" if prop.is_readonly else "", prop.description))
+        data.sort()
 
     if bpy.app.background:
-        print(data)
+        import sys
+        sys.stderr.write("\n".join(data))
     else:
         text = bpy.data.texts.new(name="api.py")
         text.from_string(data)
index cc0f3673e5c6fa14546d93493bf893c7db2ed560..918c31cff0464c018140ced58b51270b6b7bdf81 100644 (file)
@@ -131,7 +131,7 @@ def execute(context):
     is_multiline = False
 
     try:
-        line = line_object.line
+        line = line_object.body
 
         # run the console, "\n" executes a multiline statement
         line_exec = line if line.strip() else "\n"
@@ -212,13 +212,13 @@ def autocomplete(context):
 
     try:
         current_line = sc.history[-1]
-        line = current_line.line
+        line = current_line.body
 
         # This function isnt aware of the text editor or being an operator
         # just does the autocomp then copy its results back
-        current_line.line, current_line.current_character, scrollback = \
+        current_line.body, current_line.current_character, scrollback = \
             intellisense.expand(
-                line=current_line.line,
+                line=current_line.body,
                 cursor=current_line.current_character,
                 namespace=console.locals,
                 private=bpy.app.debug)
@@ -233,7 +233,7 @@ def autocomplete(context):
 
     # Separate automplete output by command prompts
     if scrollback != '':
-        bpy.ops.console.scrollback_append(text=sc.prompt + current_line.line, type='INPUT')
+        bpy.ops.console.scrollback_append(text=sc.prompt + current_line.body, type='INPUT')
 
     # Now we need to copy back the line from blender back into the
     # text editor. This will change when we dont use the text editor
index e269cc0bb2ffd179bcb048a1ede9128744aa3cf2..2c5b48acd34b2ff4a7fc8d6a97833c1318b5b50b 100644 (file)
@@ -47,7 +47,7 @@ def execute(context):
     sc = context.space_data
 
     try:
-        line = sc.history[-1].line
+        line = sc.history[-1].body
     except:
         return {'CANCELLED'}
 
index fbda1955013f89350a9eccc0ff400a46f009e310..bbd0102fc6108faf2e1eab3854b55f4c50646821 100644 (file)
@@ -22,7 +22,7 @@
 
 # <pep8 compliant>
 
-from mathutils import Matrix, Vector, RotationMatrix
+from mathutils import Matrix, Vector
 import time
 import geometry
 import bpy
@@ -275,15 +275,15 @@ def testNewVecLs2DRotIsBetter(vecs, mat=-1, bestAreaSoFar = -1):
 
 # Takes a list of faces that make up a UV island and rotate
 # until they optimally fit inside a square.
-ROTMAT_2D_POS_90D = RotationMatrix( radians(90.0), 2)
-ROTMAT_2D_POS_45D = RotationMatrix( radians(45.0), 2)
+ROTMAT_2D_POS_90D = Matrix.Rotation( radians(90.0), 2)
+ROTMAT_2D_POS_45D = Matrix.Rotation( radians(45.0), 2)
 
 RotMatStepRotation = []
 rot_angle = 22.5 #45.0/2
 while rot_angle > 0.1:
     RotMatStepRotation.append([\
-     RotationMatrix( radians(rot_angle), 2),\
-     RotationMatrix( radians(-rot_angle), 2)])
+     Matrix.Rotation( radians(rot_angle), 2),\
+     Matrix.Rotation( radians(-rot_angle), 2)])
 
     rot_angle = rot_angle/2.0
 
index b31d5d95987f2996b73fc3d63d507c0ceb72a4ac..21a901c091b7018ff45cf302135deeec5408f26a 100644 (file)
@@ -6,7 +6,7 @@
 # for keyboard event comparison
 # import GameKeys
 
-# support for Vector(), Matrix() types and advanced functions like ScaleMatrix(...) and RotationMatrix(...)
+# support for Vector(), Matrix() types and advanced functions like Matrix.Scale(...) and Matrix.Rotation(...)
 # import mathutils
 
 # for functions like getWindowWidth(), getWindowHeight()
index 070f1fb76787cc7b26aae3e09c0b78cc13526681..0dbd964acb596c08c2bf27a6e338b0ea11ae5288 100644 (file)
@@ -95,12 +95,13 @@ class DATA_PT_template(bpy.types.Panel):
         subsubrow.operator("pose.metarig_assign", text="Assign")
         subsubrow.operator("pose.metarig_clear", text="Clear")
 
-        subsubrow = subrow.split(percentage=0.8)
-        subsubrow.operator("pose.metarig_sample_add", text="Sample").metarig_type = self.templates[pose_templates.active_template_index]
-        subsubrow.operator("pose.metarig_sample_add", text="All").metarig_type = "" # self.templates[pose_templates.active_template_index]
+        if self.templates:
+            subsubrow = subrow.split(percentage=0.8)
+            subsubrow.operator("pose.metarig_sample_add", text="Sample").metarig_type = self.templates[pose_templates.active_template_index]
+            subsubrow.operator("pose.metarig_sample_add", text="All").metarig_type = "" # self.templates[pose_templates.active_template_index]
 
-        sub = row.column(align=True)
-        sub.operator("pose.metarig_reload", icon="FILE_REFRESH", text="")
+            sub = row.column(align=True)
+            sub.operator("pose.metarig_reload", icon="FILE_REFRESH", text="")
 
 
 # operators
index d14c8c05c637663f420b7f31bfa5f868757dbe91..5034f4f40ae3abb1692e0463f8763bceca3d0d34 100644 (file)
@@ -24,7 +24,7 @@ from rna_prop_ui import PropertyPanel
 def active_node_mat(mat):
     # TODO, 2.4x has a pipeline section, for 2.5 we need to communicate
     # which settings from node-materials are used
-    if mat:
+    if mat is not None:
         mat_node = mat.active_node_material
         if mat_node:
             return mat_node
index 6923e60a3df9d280cbd8a33f61b359523a980bf0..3af0cdef1e464aa3afd4fad8aa2f0c312b141b93 100644 (file)
@@ -252,7 +252,7 @@ class OBJECT_PT_animation(ObjectButtonsPanel, bpy.types.Panel):
         col.prop(ob, "time_offset_edit", text="Edit")
         row = col.row()
         row.prop(ob, "time_offset_particle", text="Particle")
-        row.active = len(ob.particle_systems) != 0
+        row.active = bool(ob.particle_systems)
         row = col.row()
         row.prop(ob, "time_offset_parent", text="Parent")
         row.active = (ob.parent is not None)
index 6856e73dc2f59286623de93d043164dadc2b4ff3..7568af9ce433f983e4804f0218d4ae8d9b6c25db 100644 (file)
@@ -695,7 +695,7 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
         # Audio:
         sub = layout.column()
 
-        if rd.ffmpeg_format not in ('MP3'):
+        if rd.ffmpeg_format not in ('MP3'):
             sub.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
 
         sub.separator()
diff --git a/release/scripts/ui/properties_render_test.xml b/release/scripts/ui/properties_render_test.xml
deleted file mode 100644 (file)
index f8a77e3..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-<ui>
-       <panel identifier="RENDER_PT_stamp_test" label="Stamp (XML)" space_type="PROPERTIES" region_type="WINDOW" context="render" default_closed="true">
-               <draw_header>
-                       <prop data="context.scene.render" property="render_stamp" text=""/>
-               </draw_header>
-
-               <draw>
-                       <split>
-                               <column>
-                                       <prop data="context.scene.render" property="stamp_time" text="Time"/>
-                                       <prop data="context.scene.render" property="stamp_date" text="Date"/>
-                                       <prop data="context.scene.render" property="stamp_render_time" text="RenderTime"/>
-                                       <prop data="context.scene.render" property="stamp_frame" text="Frame"/>
-                                       <prop data="context.scene.render" property="stamp_scene" text="Scene"/>
-                                       <prop data="context.scene.render" property="stamp_camera" text="Camera"/>
-                                       <prop data="context.scene.render" property="stamp_filename" text="Filename"/>
-                                       <prop data="context.scene.render" property="stamp_marker" text="Marker"/>
-                                       <prop data="context.scene.render" property="stamp_sequencer_strip" text="Seq. Strip"/>
-                               </column>
-                               <column>
-                                       <active expr="context.scene.render.render_stamp"/>
-                                       <prop data="context.scene.render" property="stamp_foreground" slider="true"/>
-                                       <prop data="context.scene.render" property="stamp_background" slider="true"/>
-                                       <separator/>
-                                       <prop data="context.scene.render" property="stamp_font_size" text="Font Size"/>
-                               </column>
-                       </split>
-                       <split percentage="0.2">
-                               <prop data="context.scene.render" property="stamp_note" text="Note"/>
-                               <row>
-                                       <active expr="context.scene.render.stamp_note"/>
-                                       <prop data="context.scene.render" property="stamp_note_text" text=""/>
-                               </row>
-                       </split>
-               </draw>
-       </panel>
-
-       <panel identifier="RENDER_PT_dimensions_test" label="Dimensions (XML)" space_type="PROPERTIES" region_type="WINDOW" context="render">
-               <draw>
-                       <row align="true">
-                               <menu menu="RENDER_MT_presets"/>
-                               <operator operator="render.preset_add" text="" icon="ZOOMIN"/>
-                       </row>
-                       <split>
-                               <column>
-                                       <column align="true">
-                                               <label text="Resolution:"/>
-                                               <prop data="context.scene.render" property="resolution_x" text="X"/>
-                                               <prop data="context.scene.render" property="resolution_y" text="Y"/>
-                                               <prop data="context.scene.render" property="resolution_percentage" text=""/>
-
-                                               <label text="Aspect Ratio:"/>
-                                               <prop data="context.scene.render" property="pixel_aspect_x" text="X"/>
-                                               <prop data="context.scene.render" property="pixel_aspect_y" text="Y"/>
-                                       </column>
-                                       <row>
-                                               <prop data="context.scene.render" property="use_border" text="Border"/>
-                                               <row>
-                                                       <active expr="context.scene.render.use_border"/>
-                                                       <prop data="context.scene.render" property="crop_to_border" text="Crop"/>
-                                               </row>
-                                       </row>
-                               </column>
-                               <column>
-                                       <column align="true">
-                                               <label text="Frame Range:"/>
-                                               <prop data="context.scene" property="frame_start" text="Start"/>
-                                               <prop data="context.scene" property="frame_end" text="End"/>
-                                               <prop data="context.scene" property="frame_step" text="Step"/>
-
-                                               <label text="Frame Rate:"/>
-                                               <prop data="context.scene.render" property="fps"/>
-                                               <prop data="context.scene.render" property="fps_base" text="/"/>
-                                       </column>
-                               </column>
-                       </split>
-               </draw>
-       </panel>
-</ui>
index 618cd3c51c9294a83690c81a48320eafcd83a0ea..db9e4df89673824e676ceec79a2328019534bade 100644 (file)
@@ -27,7 +27,7 @@ class INFO_HT_header(bpy.types.Header):
         layout = self.layout
 
         wm = context.manager
-        if wm and len(wm.operators):
+        if wm and wm.operators:
             last_op = wm.operators[-1]
         else:
             last_op = None
@@ -131,7 +131,7 @@ class INFO_MT_file_import(bpy.types.Menu):
     bl_label = "Import"
 
     def draw(self, context):
-        if "collada_import" in dir(bpy.ops.wm):
+        if hasattr(bpy.types, "WM_OT_collada_import"):
             self.layout.operator("wm.collada_import", text="COLLADA (.dae)")
 
 
@@ -140,7 +140,7 @@ class INFO_MT_file_export(bpy.types.Menu):
     bl_label = "Export"
 
     def draw(self, context):
-        if "collada_export" in dir(bpy.ops.wm):
+        if hasattr(bpy.types, "WM_OT_collada_export"):
             self.layout.operator("wm.collada_export", text="COLLADA (.dae)")
 
 
index 71ab6540132117566ec8f71862b0a4d5058f9a72..d9fce39fee88a034e76a82ec8e58b4c34afab390 100644 (file)
@@ -48,9 +48,9 @@ class TEXT_HT_header(bpy.types.Header):
         layout.template_ID(st, "text", new="text.new", unlink="text.unlink")
 
         row = layout.row(align=True)
-        row.prop(st, "line_numbers", text="")
-        row.prop(st, "word_wrap", text="")
-        row.prop(st, "syntax_highlight", text="")
+        row.prop(st, "show_line_numbers", text="")
+        row.prop(st, "show_word_wrap", text="")
+        row.prop(st, "show_syntax_highlight", text="")
 
         if text:
             row = layout.row()
@@ -81,9 +81,10 @@ class TEXT_PT_properties(bpy.types.Panel):
         st = context.space_data
 
         flow = layout.column_flow()
-        flow.prop(st, "line_numbers")
-        flow.prop(st, "word_wrap")
-        flow.prop(st, "syntax_highlight")
+        flow.prop(st, "show_line_numbers")
+        flow.prop(st, "show_word_wrap")
+        flow.prop(st, "show_syntax_highlight")
+        flow.prop(st, "show_line_highlight")
         flow.prop(st, "live_edit")
 
         flow = layout.column_flow()
index 56abbb3cb1406b3ebe22d3b385c5b13743599bab..8981369f3b0901abfe926d9a3d24ce7f7dd3ffe5 100644 (file)
@@ -487,7 +487,7 @@ class PaintPanel():
         elif context.particle_edit_object:
             return ts.particle_edit
 
-        return False
+        return None
 
 
 class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
@@ -753,7 +753,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
             col.separator()
 
             col = layout.column()
-            col.active = tex_slot.map_mode in ('FIXED')
+            col.active = tex_slot.map_mode in ('FIXED')
             col.label(text="Angle:")
             
             col = layout.column()
@@ -963,6 +963,7 @@ class VIEW3D_PT_tools_brush_curve(PaintPanel, bpy.types.Panel):
         layout = self.layout
 
         settings = self.paint_settings(context)
+
         brush = settings.brush
 
         layout.template_curve_mapping(brush, "curve", brush=True)
index 00ff981362cf554dc304d02b8513c8a514e1849a..ece5b6d8bbaa960879b964f09debe30064910aad 100644 (file)
@@ -17,7 +17,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 # All rights reserved.
index 1149e1c4be254239c976ca1e06f1ac8a9d7c965f..8052c175f8e97641b1563609cf47983a57240b84 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 # All rights reserved.
index c8ab5fe0aca9ffa4027f2fff9a30e5f28cd629f0..96a6573cc67014276f9211fb6f78f97510cc9c01 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 # All rights reserved.
index 30f225c80315a31d93650506f62ffbdda5723d66..8d1af9adb287ef925def073add2b88eda229ab36 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 # All rights reserved.
index 9f34d458126ae2de91ef3bf9285b5b87f8d45e49..df1bbb72110053446d01ab57b77283af11c7f427 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2009 Blender Foundation
 # All rights reserved.
index 77e87c27a02a94d3f6fceca52303d05b827151d1..d3a6e656028fa8755b2704e0ce17aa21aacb2317 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2008 Blender Foundation.
 # All rights reserved.
index d8b3fcfd0bb0e0b8d91287e0fb44a9dbe1e5d50f..034bedbb07d3d5bfea4327b020f01eb5b81eba4d 100644 (file)
 
 #include <float.h>
 
-#include "BLI_linklist.h"
-#include "BKE_customdata.h"
-#include "BKE_DerivedMesh.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-#include "BLI_edgehash.h"
-
-#include "DNA_cloth_types.h"
-#include "DNA_customdata_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-
-#include "BKE_collision.h"
-
 struct Object;
+struct ListBase;
 struct Scene;
 struct MFace;
 struct DerivedMesh;
@@ -210,7 +194,7 @@ typedef enum
 ////////////////////////////////////////////////
 
 // needed for implicit.c
-int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, float dt );
+int cloth_bvh_objcollision (struct Object *ob, struct ClothModifierData * clmd, float step, float dt );
 
 ////////////////////////////////////////////////
 
@@ -220,10 +204,10 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
 ////////////////////////////////////////////////
 
 // needed for cloth.c
-int implicit_init ( Object *ob, ClothModifierData *clmd );
-int implicit_free ( ClothModifierData *clmd );
-int implicit_solver ( Object *ob, float frame, ClothModifierData *clmd, ListBase *effectors );
-void implicit_set_positions ( ClothModifierData *clmd );
+int implicit_init ( struct Object *ob, struct ClothModifierData *clmd );
+int implicit_free ( struct ClothModifierData *clmd );
+int implicit_solver ( struct Object *ob, float frame, struct ClothModifierData *clmd, struct ListBase *effectors );
+void implicit_set_positions ( struct ClothModifierData *clmd );
 
 // globally needed
 void clmdSetInterruptCallBack ( int ( *f ) ( void ) );
@@ -235,23 +219,23 @@ void clmdSetInterruptCallBack ( int ( *f ) ( void ) );
 ////////////////////////////////////////////////
 
 // needed for modifier.c
-void cloth_free_modifier_extern ( ClothModifierData *clmd );
-void cloth_free_modifier ( Object *ob, ClothModifierData *clmd );
-void cloth_init ( ClothModifierData *clmd );
-DerivedMesh *clothModifier_do ( ClothModifierData *clmd, struct Scene *scene, Object *ob, DerivedMesh *dm, int useRenderParams, int isFinalCalc );
+void cloth_free_modifier_extern ( struct ClothModifierData *clmd );
+void cloth_free_modifier ( struct Object *ob, struct ClothModifierData *clmd );
+void cloth_init ( struct ClothModifierData *clmd );
+struct DerivedMesh *clothModifier_do ( struct ClothModifierData *clmd, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm, int useRenderParams, int isFinalCalc );
 
-void cloth_update_normals ( ClothVertex *verts, int nVerts, MFace *face, int totface );
-int cloth_uses_vgroup(ClothModifierData *clmd);
+void cloth_update_normals ( ClothVertex *verts, int nVerts, struct MFace *face, int totface );
+int cloth_uses_vgroup(struct ClothModifierData *clmd);
 
 // needed for collision.c
-void bvhtree_update_from_cloth ( ClothModifierData *clmd, int moving );
-void bvhselftree_update_from_cloth ( ClothModifierData *clmd, int moving );
+void bvhtree_update_from_cloth ( struct ClothModifierData *clmd, int moving );
+void bvhselftree_update_from_cloth ( struct ClothModifierData *clmd, int moving );
 
 // needed for button_object.c
-void cloth_clear_cache ( Object *ob, ClothModifierData *clmd, float framenr );
+void cloth_clear_cache ( struct Object *ob, struct ClothModifierData *clmd, float framenr );
 
 // needed for cloth.c
-int cloth_add_spring ( ClothModifierData *clmd, unsigned int indexA, unsigned int indexB, float restlength, int spring_type);
+int cloth_add_spring ( struct ClothModifierData *clmd, unsigned int indexA, unsigned int indexB, float restlength, int spring_type);
 
 ////////////////////////////////////////////////
 
@@ -270,9 +254,9 @@ typedef struct
 {
        char            *name;
        CM_SOLVER_ID    id;
-       int     ( *init ) ( Object *ob, ClothModifierData *clmd );
-       int     ( *solver ) ( Object *ob, float framenr, ClothModifierData *clmd, ListBase *effectors );
-       int     ( *free ) ( ClothModifierData *clmd );
+       int     ( *init ) ( struct Object *ob, struct ClothModifierData *clmd );
+       int     ( *solver ) ( struct Object *ob, float framenr, struct ClothModifierData *clmd, struct ListBase *effectors );
+       int     ( *free ) ( struct ClothModifierData *clmd );
 }
 CM_SOLVER_DEF;
 
index 91c5eb4afee7ea2d64399c89bf7cdef522167111..d7ae7df93429d85f6578425a813fe6b32d894a44 100644 (file)
 #include <string.h>
 
 /* types */
-#include "BLI_linklist.h"
 #include "BKE_collision.h"
-#include "BKE_customdata.h"
-#include "BKE_DerivedMesh.h"
 #include "DNA_cloth_types.h"
-#include "DNA_customdata_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
 
 #include "BLI_kdopbvh.h"
 
 struct Cloth;
 struct ClothModifierData;
+struct CollisionModifierData;
 struct DerivedMesh;
 struct Group;
 struct MFace;
+struct MVert;
 struct Object;
 struct Scene;
+struct LinkNode;
 
 ////////////////////////////////////////
 // used for collisions in collision.c
@@ -122,16 +118,16 @@ FaceCollPair;
 // used in modifier.c from collision.c
 /////////////////////////////////////////////////
 
-BVHTree *bvhtree_build_from_mvert ( MFace *mfaces, unsigned int numfaces, MVert *x, unsigned int numverts, float epsilon );
-void bvhtree_update_from_mvert ( BVHTree * bvhtree, MFace *faces, int numfaces, MVert *x, MVert *xnew, int numverts, int moving );
+BVHTree *bvhtree_build_from_mvert ( struct MFace *mfaces, unsigned int numfaces, struct MVert *x, unsigned int numverts, float epsilon );
+void bvhtree_update_from_mvert ( BVHTree * bvhtree, struct MFace *faces, int numfaces, struct MVert *x, struct MVert *xnew, int numverts, int moving );
 
 /////////////////////////////////////////////////
 
-LinkNode *BLI_linklist_append_fast ( LinkNode **listp, void *ptr );
+struct LinkNode *BLI_linklist_append_fast ( struct LinkNode **listp, void *ptr );
 
 // move Collision modifier object inter-frame with step = [0,1]
 // defined in collisions.c
-void collision_move_object ( CollisionModifierData *collmd, float step, float prevstep );
+void collision_move_object ( struct CollisionModifierData *collmd, float step, float prevstep );
 
 // interface for collision functions
 void collisions_compute_barycentric ( float pv[3], float p1[3], float p2[3], float p3[3], float *w1, float *w2, float *w3 );
index 837fede3c8ac896679cc6fc7d0272fd2d70c5e42..99f55200eac4fa54912b8fd3a5d5f5f66cf5c03b 100644 (file)
@@ -31,7 +31,6 @@
 #ifndef BKE_EFFECT_H
 #define BKE_EFFECT_H
 
-#include "DNA_object_types.h"
 #include "DNA_modifier_types.h"
 
 struct Object;
diff --git a/source/blender/blenkernel/BKE_idcode.h b/source/blender/blenkernel/BKE_idcode.h
new file mode 100644 (file)
index 0000000..b624e34
--- /dev/null
@@ -0,0 +1,75 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef BKE_ID_INFO_H
+#define BKE_ID_INFO_H
+
+/**
+ * Convert an idcode into a name.
+ * 
+ * @param code The code to convert.
+ * @return A static string representing the name of
+ * the code.
+ */
+const char *BKE_idcode_to_name(int code);
+
+/**
+ * Convert an idcode into a name (plural).
+ * 
+ * @param code The code to convert.
+ * @return A static string representing the name of
+ * the code.
+ */
+const char *BKE_idcode_to_name_plural(int code);
+
+/**
+ * Convert a name into an idcode (ie. ID_SCE)
+ * 
+ * @param name The name to convert.
+ * @return The code for the name, or 0 if invalid.
+ */
+int BKE_idcode_from_name(const char *name);
+
+/**
+ * Return non-zero when an ID type is linkable.
+ * 
+ * @param code The code to check.
+ * @return Boolean, 0 when non linkable.
+ */
+int BKE_idcode_is_linkable(int code);
+
+/**
+ * Return if the ID code is a valid ID code.
+ * 
+ * @param code The code to check.
+ * @return Boolean, 0 when invalid.
+ */
+int BKE_idcode_is_valid(int code);
+
+#endif
index 7adbfd9b48d928d6831215da8988b32df1f50459..6cafb7ef1046f7f28017657521350dd2a56a66ca 100644 (file)
@@ -70,9 +70,9 @@ void set_sca_new_poins_ob(struct Object *ob);
 void set_sca_new_poins(void);
 void sca_remove_ob_poin(struct Object *obt, struct Object *ob);                    
 
-void sca_move_sensor(struct bSensor *sens_to_move, Object *ob, int move_up);
-void sca_move_controller(struct bController *cont_to_move, Object *ob, int move_up);
-void sca_move_actuator(struct bActuator *act_to_move, Object *ob, int move_up);
+void sca_move_sensor(struct bSensor *sens_to_move, struct Object *ob, int move_up);
+void sca_move_controller(struct bController *cont_to_move, struct Object *ob, int move_up);
+void sca_move_actuator(struct bActuator *act_to_move, struct Object *ob, int move_up);
 
 #endif
 
index f0476bbf0268a11b0ae0ee892fad8c4bf80446ed..dc5f0a91da631a3f9ed26e4fdbbc6b7b75fb4669 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 # All rights reserved.
index eb14914c7bad032a113d03d2bf038b066ef33ced..53a9999758c6391409699d073142934531f418ef 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 # All rights reserved.
index b9b1c16c0c4b2e94836e1a25ce950af492e43fb3..bebfa4af88e5f99858936f6652d91c2693bc60e6 100644 (file)
 
 #include "MEM_guardedalloc.h"
 
+#include "DNA_cloth_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
+#include "DNA_meshdata_types.h"
+
+#include "BLI_math.h"
+#include "BLI_edgehash.h"
+
 #include "BKE_cdderivedmesh.h"
 #include "BKE_cloth.h"
 #include "BKE_effect.h"
index 54adc648539230e522d92f56124a591234f79be4..3a9c15f654c41596c7600b3fe9c25c7b1a6ebd84 100644 (file)
 #include "DNA_object_types.h"
 #include "DNA_object_force.h"
 #include "DNA_scene_types.h"
+#include "DNA_meshdata_types.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_math.h"
+#include "BLI_edgehash.h"
 
 #include "BKE_DerivedMesh.h"
 #include "BKE_global.h"
index 841bd635acf8b73858c56603e5b6477c746fc876..358dd1914e75080270fb6ff0dfdc27010d8d473a 100644 (file)
@@ -1573,7 +1573,7 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
        
        for(a=0; a<resolu; a++, fac+= dfac) {
                if (tilt_array) {
-                       if (nu->tilt_interp==3) { /* May as well support for tilt also 2.47 ease interp */
+                       if (nu->tilt_interp==KEY_CU_EASE) { /* May as well support for tilt also 2.47 ease interp */
                                *tilt_array = prevbezt->alfa + (bezt->alfa - prevbezt->alfa)*(3.0f*fac*fac - 2.0f*fac*fac*fac);
                        } else {
                                key_curve_position_weights(fac, t, nu->tilt_interp);
@@ -1584,7 +1584,7 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
                }
                
                if (radius_array) {
-                       if (nu->radius_interp==3) {
+                       if (nu->radius_interp==KEY_CU_EASE) {
                                /* Support 2.47 ease interp
                                 * Note! - this only takes the 2 points into account,
                                 * giving much more localized results to changes in radius, sometimes you want that */
diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c
new file mode 100644 (file)
index 0000000..bc5740b
--- /dev/null
@@ -0,0 +1,129 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ * return info about ID types
+ */
+#include <stdlib.h>
+#include <string.h>
+
+#include "DNA_ID.h"
+
+typedef struct {
+       unsigned short code;
+       char *name, *plural;
+       
+       int flags;
+#define IDTYPE_FLAGS_ISLINKABLE        (1<<0)
+} IDType;
+
+/* plural need to match rna_main.c's MainCollectionDef */
+static IDType idtypes[]= {
+       { ID_AC,                "Action",       "actions",              IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_AR,                "Armature", "armatures",        IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_BR,                "Brush",        "brushes",              IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_CA,                "Camera",       "cameras",              IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_CU,                "Curve",        "curves",               IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_GD,                "GPencil",      "gpencil",              IDTYPE_FLAGS_ISLINKABLE},  /* rename gpencil */
+       { ID_GR,                "Group",        "groups",               IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_ID,                "ID",           "ids",                  0}, /* plural is fake */
+       { ID_IM,                "Image",        "images",               IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_IP,                "Ipo",          "ipos",                 IDTYPE_FLAGS_ISLINKABLE},  /* deprecated */
+       { ID_KE,                "Key",          "keys",                 0}, 
+       { ID_LA,                "Lamp",         "lamps",                IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_LI,                "Library",      "libraries",    0}, 
+       { ID_LS,                "FreestyleLineStyle", "linestyles", 0}, 
+       { ID_LT,                "Lattice",      "lattices",             IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_MA,                "Material", "materials",        IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_MB,                "Metaball", "metaballs",        IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_ME,                "Mesh",         "meshes",               IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_NT,                "NodeTree",     "node_groups",  IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_OB,                "Object",       "objects",              IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_PA,                "ParticleSettings",     "particles", 0},
+       { ID_SCE,               "Scene",        "scenes",               IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_SCR,               "Screen",       "screens",              0}, 
+       { ID_SEQ,               "Sequence",     "sequences",    0}, /* not actually ID data */
+       { ID_SO,                "Sound",        "sounds",               IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_TE,                "Texture",      "textures",             IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_TXT,               "Text",         "texts",                IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_VF,                "VFont",        "fonts",                IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_WO,                "World",        "worlds",               IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_WM,                "WindowManager", "window_managers",     0}, 
+};
+static int nidtypes= sizeof(idtypes)/sizeof(idtypes[0]);
+
+static IDType *idtype_from_name(const char *str) 
+{
+       int i= nidtypes;
+       
+       while (i--)
+               if (strcmp(str, idtypes[i].name)==0)
+                       return &idtypes[i];
+
+       return NULL;
+}
+static IDType *idtype_from_code(int code) 
+{
+       int i= nidtypes;
+       
+       while (i--)
+               if (code==idtypes[i].code)
+                       return &idtypes[i];
+       
+       return NULL;
+}
+
+int BKE_idcode_is_valid(int code) 
+{
+       return idtype_from_code(code)?1:0;
+}
+
+int BKE_idcode_is_linkable(int code) {
+       IDType *idt= idtype_from_code(code);
+       return idt?(idt->flags&IDTYPE_FLAGS_ISLINKABLE):0;
+}
+
+const char *BKE_idcode_to_name(int code) 
+{
+       IDType *idt= idtype_from_code(code);
+       
+       return idt?idt->name:NULL;
+}
+
+int BKE_idcode_from_name(const char *name) 
+{
+       IDType *idt= idtype_from_name(name);
+       
+       return idt?idt->code:0;
+}
+
+const char *BKE_idcode_to_name_plural(int code) 
+{
+       IDType *idt= idtype_from_code(code);
+       
+       return idt?idt->plural:NULL;
+}
index 902965bd2f6bcb1ba6f66edcfca2d6c6fd61908d..d544174b0d453dfd6d08e04870ab855fca8d281b 100644 (file)
 
 #include "MEM_guardedalloc.h"
 
-#include "BKE_cloth.h"
-
+#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
 #include "DNA_object_force.h"
+#include "DNA_meshdata_types.h"
+
+#include "BLI_threads.h"
+#include "BLI_math.h"
+#include "BLI_linklist.h"
 
+#include "BKE_cloth.h"
+#include "BKE_collision.h"
 #include "BKE_effect.h"
 #include "BKE_global.h"
 #include "BKE_utildefines.h"
 
-#include "BLI_threads.h"
-
 #define CLOTH_OPENMP_LIMIT 25
 
 #ifdef _WIN32
index 354b3b0e7d80d30611572ae4d94048b55c6265d9..f4b931ec52b17a50a881c4ca12857c9cd828ffef 100644 (file)
@@ -1850,9 +1850,12 @@ void vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
                tot= count_curveverts(&cu->nurb);
        }
 
-       fp= kb->data= MEM_callocN(tot*elemsize, "key_to_vertcos vertCos");
+       if (tot == 0) {
+               kb->data= NULL;
+               return;
+       }
 
-       if (tot == 0) return;
+       fp= kb->data= MEM_callocN(tot*elemsize, "key_to_vertcos vertCos");
 
        /* Copy coords to keyblock */
 
index 1eb7b5d20215d427b3b7be795784316272130aa4..1390f0dbd56fa70505ea57305b22d6caced7e690 100644 (file)
@@ -225,8 +225,12 @@ void free_lattice(Lattice *lt)
        if(lt->def) MEM_freeN(lt->def);
        if(lt->dvert) free_dverts(lt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
        if(lt->editlatt) {
-               if(lt->editlatt->def) MEM_freeN(lt->editlatt->def);
-               if(lt->editlatt->dvert) free_dverts(lt->editlatt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
+               Lattice *editlt= lt->editlatt->latt;
+
+               if(editlt->def) MEM_freeN(editlt->def);
+               if(editlt->dvert) free_dverts(editlt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
+
+               MEM_freeN(editlt);
                MEM_freeN(lt->editlatt);
        }
 }
@@ -295,7 +299,7 @@ void init_latt_deform(Object *oblatt, Object *ob)
        float fu, fv, fw;
        int u, v, w;
 
-       if(lt->editlatt) lt= lt->editlatt;
+       if(lt->editlatt) lt= lt->editlatt->latt;
        bp = lt->def;
        
        fp= lt->latticedata= MEM_mallocN(sizeof(float)*3*lt->pntsu*lt->pntsv*lt->pntsw, "latticedata");
@@ -350,7 +354,7 @@ void calc_latt_deform(Object *ob, float *co, float weight)
        MDeformVert *dvert= lattice_get_deform_verts(ob);
 
 
-       if(lt->editlatt) lt= lt->editlatt;
+       if(lt->editlatt) lt= lt->editlatt->latt;
        if(lt->latticedata==NULL) return;
 
        if(lt->vgroup[0] && dvert) {
@@ -446,7 +450,7 @@ void end_latt_deform(Object *ob)
 {
        Lattice *lt= ob->data;
        
-       if(lt->editlatt) lt= lt->editlatt;
+       if(lt->editlatt) lt= lt->editlatt->latt;
        
        if(lt->latticedata)
                MEM_freeN(lt->latticedata);
@@ -1002,7 +1006,7 @@ float (*lattice_getVertexCos(struct Object *ob, int *numVerts_r))[3]
        int i, numVerts;
        float (*vertexCos)[3];
 
-       if(lt->editlatt) lt= lt->editlatt;
+       if(lt->editlatt) lt= lt->editlatt->latt;
        numVerts = *numVerts_r = lt->pntsu*lt->pntsv*lt->pntsw;
        
        vertexCos = MEM_mallocN(sizeof(*vertexCos)*numVerts,"lt_vcos");
@@ -1066,7 +1070,7 @@ struct MDeformVert* lattice_get_deform_verts(struct Object *oblatt)
        if(oblatt->type == OB_LATTICE)
        {
                Lattice *lt = (Lattice*)oblatt->data;
-               if(lt->editlatt) lt= lt->editlatt;
+               if(lt->editlatt) lt= lt->editlatt->latt;
                return lt->dvert;
        }
 
index 858e9d6c6d9c272645e47666ff77d0f8b654d187..ea118e4a53c1f2cc48640af84f4bf1c7bdefa617 100644 (file)
@@ -41,6 +41,8 @@
 #include "float.h"
 
 #include "DNA_armature_types.h"
+#include "DNA_object_types.h"
+#include "DNA_meshdata_types.h"
 
 #include "BKE_bmesh.h"
 #include "BKE_cloth.h"
@@ -193,7 +195,7 @@ void modifier_copyData(ModifierData *md, ModifierData *target)
                mti->copyData(md, target);
 }
 
-int modifier_couldBeCage(Scene *scene, ModifierData *md)
+int modifier_couldBeCage(struct Scene *scene, ModifierData *md)
 {
        ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 
@@ -233,7 +235,7 @@ void modifier_setError(ModifierData *md, char *format, ...)
  * also used in transform_conversion.c, to detect CrazySpace [tm] (2nd arg
  * then is NULL)
  */
-int modifiers_getCageIndex(Scene *scene, Object *ob, int *lastPossibleCageIndex_r, int virtual_)
+int modifiers_getCageIndex(struct Scene *scene, Object *ob, int *lastPossibleCageIndex_r, int virtual_)
 {
        ModifierData *md = (virtual_)? modifiers_getVirtualModifierList(ob): ob->modifiers.first;
        int i, cageIndex = -1;
@@ -283,7 +285,7 @@ int modifiers_isParticleEnabled(Object *ob)
        return (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render));
 }
 
-int modifier_isEnabled(Scene *scene, ModifierData *md, int required_mode)
+int modifier_isEnabled(struct Scene *scene, ModifierData *md, int required_mode)
 {
        ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 
@@ -298,7 +300,7 @@ int modifier_isEnabled(Scene *scene, ModifierData *md, int required_mode)
        return 1;
 }
 
-LinkNode *modifiers_calcDataMasks(Scene *scene, Object *ob, ModifierData *md, CustomDataMask dataMask, int required_mode)
+LinkNode *modifiers_calcDataMasks(struct Scene *scene, Object *ob, ModifierData *md, CustomDataMask dataMask, int required_mode)
 {
        LinkNode *dataMasks = NULL;
        LinkNode *curr, *prev;
@@ -487,7 +489,7 @@ int modifier_isCorrectableDeformed(ModifierData *md)
        return 0;
 }
 
-int modifiers_isCorrectableDeformed(Scene *scene, Object *ob)
+int modifiers_isCorrectableDeformed(struct Scene *scene, Object *ob)
 {
        ModifierData *md = modifiers_getVirtualModifierList(ob);
        
index 8d2ad49e7bfa41fadfe49001b8c3060d6d7fc9d5..b053d615756f3094cb0f5efafe3aafa00d1ba421 100644 (file)
@@ -1265,13 +1265,13 @@ void BKE_nlastrip_validate_name (AnimData *adt, NlaStrip *strip)
                char *dot;
                
                /* Strip off the suffix */
-               dot = strchr(strip->name, '.');
+               dot = strrchr(strip->name, '.');
                if (dot) *dot=0;
                
                /* Try different possibilities */
                for (number = 1; number <= 999; number++) {
                        /* assemble alternative name */
-                       BLI_snprintf(tempname, 128, "%s%c%03d", strip->name, ".", number);
+                       BLI_snprintf(tempname, 128, "%s.%03d", strip->name, number);
                        
                        /* if hash doesn't have this, set it */
                        if (BLI_ghash_haskey(gh, tempname) == 0) {
index c08a3408505f57b3d06e105aa04805f0573b97d5..115cfac762718e01c0e507ddabb69622ddcf8a25 100644 (file)
@@ -1917,7 +1917,7 @@ static void give_parvert(Object *par, int nr, float *vec)
                DispList *dl = find_displist(&par->disp, DL_VERTS);
                float *co = dl?dl->verts:NULL;
                
-               if(latt->editlatt) latt= latt->editlatt;
+               if(latt->editlatt) latt= latt->editlatt->latt;
                
                a= latt->pntsu*latt->pntsv*latt->pntsw;
                count= 0;
@@ -2501,7 +2501,7 @@ void object_handle_update(Scene *scene, Object *ob)
                        
                        /* includes all keys and modifiers */
                        if(ob->type==OB_MESH) {
-                               EditMesh *em = BKE_mesh_get_editmesh(ob->data);
+                               EditMesh *em = (ob == scene->obedit)? BKE_mesh_get_editmesh(ob->data): NULL;
                                
                                /* evaluate drivers */
                                // XXX: should we push this to derivedmesh instead?
index 52ee0180f43d9b82263b140e49404cbbf1ed4f14..7b3638f0e337282feb7ab1dbf1dd2c644b85f702 100644 (file)
 #include "DNA_key_types.h"
 #include "DNA_material_types.h"
 #include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
 #include "DNA_particle_types.h"
 #include "DNA_smoke_types.h"
+#include "DNA_scene_types.h"
 
+#include "BLI_blenlib.h"
 #include "BLI_kdtree.h"
 #include "BLI_rand.h"
 #include "BLI_threads.h"
+#include "BLI_math.h"
 
 #include "BKE_anim.h"
 #include "BKE_animsys.h"
index d44221d2cd39f464dd6d7888850a3163ec76b621..6cf49808ec71a15d6a4b2fb3812bcb462e1e6dbe 100644 (file)
@@ -43,6 +43,7 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_threads.h"
+#include "BLI_math.h"
 
 #include "PIL_time.h"
 
index 4d1994e760b7b1a1ed7a4a2f002a2beea35d5aec..b8e824ce3d5dd6c20facb272faf1824429dc1f8a 100644 (file)
@@ -55,11 +55,12 @@ variables on the UI for now
 #include "MEM_guardedalloc.h"
 
 /* types */
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_lattice_types.h"
 #include "DNA_curve_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_scene_types.h"
 
 #include "BLI_math.h"
 #include "BLI_ghash.h"
index 0d7738353df55a31fd17a10c3faa968b7cc9854a..4c85656dd914d4187b9ef4ac2c920ab30a1c94ca 100644 (file)
@@ -69,6 +69,8 @@ static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v);
 static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e);
 static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f);
 
+static int ccgDM_use_grid_pbvh(CCGDerivedMesh *ccgdm);
+
 ///
 
 static void *arena_alloc(CCGAllocatorHDL a, int numBytes) {
@@ -1249,7 +1251,7 @@ static void ccgDM_glNormalFast(float *a, float *b, float *c, float *d)
 
 static void ccgdm_pbvh_update(CCGDerivedMesh *ccgdm)
 {
-       if(ccgdm->pbvh && ccgdm->multires.mmd) {
+       if(ccgdm->pbvh && ccgDM_use_grid_pbvh(ccgdm)) {
                CCGFace **faces;
                int totface;
 
index ae8a5afd0ba66de77eef890391e934ef5c216bdd..d4dcfaeeabf88d42e108a5df1c4e5c55a4e17270 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 # All rights reserved.
index 7ef44aff881d5a4aeccf8496ced10a59708f27db..018fd3477df12bb54bd6c27d3a97cc315031ec38 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 # All rights reserved.
index 697ac8dc782655d4ebc48c0ee6e5ffbc13a21024..f2d8e27cbd5a425a5d4d4ce5ac5f4374ed860795 100644 (file)
@@ -15,7 +15,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
index 9a56722b5d91764fa551e439b9e6768442ae95a1..cf773d575e52f231ede21d938e6ddee43f972a92 100644 (file)
@@ -586,7 +586,7 @@ int BLI_path_abs(char *path, const char *basepath)
                BLI_strncpy(tmp, path, FILE_MAX);
        }
 #else
-       BLI_strncpy(tmp, path, FILE_MAX);
+       BLI_strncpy(tmp, path, sizeof(tmp));
        
        /* Check for loading a windows path on a posix system
         * in this case, there is no use in trying C:/ since it 
@@ -603,7 +603,7 @@ int BLI_path_abs(char *path, const char *basepath)
        
 #endif
 
-       BLI_strncpy(base, basepath, FILE_MAX);
+       BLI_strncpy(base, basepath, sizeof(base));
        
        BLI_cleanup_file(NULL, base);
        
@@ -626,17 +626,19 @@ int BLI_path_abs(char *path, const char *basepath)
                        BLI_strncpy(path, tmp+2, FILE_MAX);
                        
                        memcpy(tmp, base, baselen);
-                       strcpy(tmp+baselen, path);
-                       strcpy(path, tmp);
+                       BLI_strncpy(tmp+baselen, path, sizeof(tmp)-baselen);
+                       BLI_strncpy(path, tmp, FILE_MAX);
                } else {
-                       strcpy(path, tmp+2);
+                       BLI_strncpy(path, tmp+2, FILE_MAX);
                }
        } else {
-               strcpy(path, tmp);
+               BLI_strncpy(path, tmp, FILE_MAX);
        }
        
        if (path[0]!='\0') {
                if ( path[strlen(path)-1]=='/') {
+                       /* remove the '/' so we avoid BLI_cleanup_dir adding an extra \ in WIN32 */
+                       path[strlen(path)-1] = '\0';
                        BLI_cleanup_dir(NULL, path);
                } else {
                        BLI_cleanup_file(NULL, path);
@@ -1160,7 +1162,7 @@ void BLI_make_existing_file(char *name)
 {
        char di[FILE_MAXDIR+FILE_MAXFILE], fi[FILE_MAXFILE];
 
-       strcpy(di, name);
+       BLI_strncpy(di, name, sizeof(di));
        BLI_splitdirstring(di, fi);
        
        /* test exist */
index edb6aecabb14a0c5bffcabc14da8872a5e59ff21..80310b1ef8a9ae1cbfe5975b0d231a912a4b894a 100644 (file)
@@ -237,8 +237,19 @@ void BLI_builddir(char *dirname, char *relname)
                
                if (newnum){
 
-                       if (files) files=(struct direntry *)realloc(files,(totnum+newnum) * sizeof(struct direntry));
-                       else files=(struct direntry *)malloc(newnum * sizeof(struct direntry));
+                       if(files) {
+                               void *tmp= realloc(files, (totnum+newnum) * sizeof(struct direntry));
+                               if(tmp) {
+                                       files= (struct direntry *)tmp;
+                               }
+                               else { /* realloc fail */
+                                       free(files);
+                                       files= NULL;
+                               }
+                       }
+                       
+                       if(files==NULL)
+                               files=(struct direntry *)malloc(newnum * sizeof(struct direntry));
 
                        if (files){
                                dlink = (struct dirlink *) dirbase->first;
index d6418f426c87ab0774bda51065d1f35fc033760d..eeced13b57b28e1c3a60df3c8a53c7ddee1e1f04 100644 (file)
@@ -111,38 +111,6 @@ BlendFileData *BLO_read_from_memfile(struct Main *oldmain, const char *filename,
        void
 BLO_blendfiledata_free(
        BlendFileData *bfd);
-
-/**
- * Convert an idcode into a name.
- * 
- * @param code The code to convert.
- * @return A static string representing the name of
- * the code.
- */
-       char*
-BLO_idcode_to_name(
-       int code);
-       
-/**
- * Convert an idcode into a name (plural).
- * 
- * @param code The code to convert.
- * @return A static string representing the name of
- * the code.
- */
-       char*
-BLO_idcode_to_name_plural(
-       int code);
-
-/**
- * Convert a name into an idcode (ie. ID_SCE)
- * 
- * @param name The name to convert.
- * @return The code for the name, or 0 if invalid.
- */
-       int
-BLO_idcode_from_name(
-       char *name);
        
 /**
  * Open a blendhandle from a file path.
index 4ffc558f8891d9cf00c268380dfa30f9df20231c..069bad4d37194b57d6dd74bc9969e5d9854cfb08 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 # All rights reserved.
index f4690fcc066c224cba7f805750ba53268f6c5d68..fe178ea26103ec9ec51971cba856597465ccb50e 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 # All rights reserved.
index 3e32d98079ef443dc533cb3ad9cc5d7288c37842..d66d802c8eef650a6b5d809287602a0bf0ac0d4c 100644 (file)
@@ -46,6 +46,7 @@
 
 #include "BKE_main.h"
 #include "BKE_library.h" // for free_main
+#include "BKE_idcode.h"
 #include "BKE_report.h"
 
 #include "BLO_readfile.h"
 #include "BLI_winstuff.h"
 #endif
 
-       /**
-        * IDType stuff, I plan to move this
-        * out into its own file + prefix, and
-        * make sure all IDType handling goes through
-        * these routines.
-        */
-
-typedef struct {
-       unsigned short code;
-       char *name, *plural;
-       
-       int flags;
-#define IDTYPE_FLAGS_ISLINKABLE        (1<<0)
-} IDType;
-
-/* plural need to match rna_main.c's MainCollectionDef */
-static IDType idtypes[]= {
-       { ID_AC,                "Action",       "actions",              IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_AR,                "Armature", "armatures",        IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_BR,                "Brush",        "brushes",              IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_CA,                "Camera",       "cameras",              IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_CU,                "Curve",        "curves",               IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_GD,                "GPencil",      "gpencil",              IDTYPE_FLAGS_ISLINKABLE},  /* rename gpencil */
-       { ID_GR,                "Group",        "groups",               IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_ID,                "ID",           "ids",                  0}, /* plural is fake */
-       { ID_IM,                "Image",        "images",               IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_IP,                "Ipo",          "ipos",                 IDTYPE_FLAGS_ISLINKABLE},  /* deprecated */
-       { ID_KE,                "Key",          "keys",                 0}, 
-       { ID_LA,                "Lamp",         "lamps",                IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_LI,                "Library",      "libraries",    0}, 
-       { ID_LS,                "FreestyleLineStyle", "linestyles", 0}, 
-       { ID_LT,                "Lattice",      "lattices",             IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_MA,                "Material", "materials",        IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_MB,                "Metaball", "metaballs",        IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_ME,                "Mesh",         "meshes",               IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_NT,                "NodeTree",     "node_groups",  IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_OB,                "Object",       "objects",              IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_PA,                "ParticleSettings",     "particles", 0},
-       { ID_SCE,               "Scene",        "scenes",               IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_SCR,               "Screen",       "screens",              0}, 
-       { ID_SEQ,               "Sequence",     "sequences",    0}, /* not actually ID data */
-       { ID_SO,                "Sound",        "sounds",               IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_TE,                "Texture",      "textures",             IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_TXT,               "Text",         "texts",                IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_VF,                "VFont",        "fonts",                IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_WO,                "World",        "worlds",               IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_WM,                "WindowManager", "window_managers",     0}, 
-};
-static int nidtypes= sizeof(idtypes)/sizeof(idtypes[0]);
-
 /* local prototypes --------------------- */
 void BLO_blendhandle_print_sizes(BlendHandle *, void *); 
 
-
-static IDType *idtype_from_name(char *str) 
-{
-       int i= nidtypes;
-       
-       while (i--)
-               if (BLI_streq(str, idtypes[i].name))
-                       return &idtypes[i];
-       
-       return NULL;
-}
-static IDType *idtype_from_code(int code) 
-{
-       int i= nidtypes;
-       
-       while (i--)
-               if (code==idtypes[i].code)
-                       return &idtypes[i];
-       
-       return NULL;
-}
-
-static int bheadcode_is_idcode(int code) 
-{
-       return idtype_from_code(code)?1:0;
-}
-
-static int idcode_is_linkable(int code) {
-       IDType *idt= idtype_from_code(code);
-       return idt?(idt->flags&IDTYPE_FLAGS_ISLINKABLE):0;
-}
-
-char *BLO_idcode_to_name(int code) 
-{
-       IDType *idt= idtype_from_code(code);
-       
-       return idt?idt->name:NULL;
-}
-
-int BLO_idcode_from_name(char *name) 
-{
-       IDType *idt= idtype_from_name(name);
-       
-       return idt?idt->code:0;
-}
-
-char *BLO_idcode_to_name_plural(int code) 
-{
-       IDType *idt= idtype_from_code(code);
-       
-       return idt?idt->plural:NULL;
-}
-
        /* Access routines used by filesel. */
         
 BlendHandle *BLO_blendhandle_from_file(char *file) 
@@ -309,13 +207,13 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
        for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
                if (bhead->code==ENDB) {
                        break;
-               } else if (bheadcode_is_idcode(bhead->code)) {
-                       if (idcode_is_linkable(bhead->code)) {
-                               char *str= BLO_idcode_to_name(bhead->code);
+               } else if (BKE_idcode_is_valid(bhead->code)) {
+                       if (BKE_idcode_is_linkable(bhead->code)) {
+                               const char *str= BKE_idcode_to_name(bhead->code);
                                
-                               if (!BLI_ghash_haskey(gathered, str)) {
+                               if (!BLI_ghash_haskey(gathered, (void *)str)) {
                                        BLI_linklist_prepend(&names, strdup(str));
-                                       BLI_ghash_insert(gathered, str, NULL);
+                                       BLI_ghash_insert(gathered, (void *)str, NULL);
                                }
                        }
                }
index b48f9dea70d4e7f84ac6f6d276734c5b44422438..3367eb17a2891d70f8c5f48f4b4c222691e24a00 100644 (file)
 #include "BKE_image.h"
 #include "BKE_lattice.h"
 #include "BKE_library.h" // for which_libbase
+#include "BKE_idcode.h"
 #include "BKE_main.h" // for Main
 #include "BKE_mesh.h" // for ME_ defines (patching)
 #include "BKE_modifier.h"
@@ -4107,8 +4108,9 @@ static void composite_patch(bNodeTree *ntree, Scene *scene)
 
 static void link_paint(FileData *fd, Scene *sce, Paint *p)
 {
-       if(p && p->brush) {
+       if(p) {
                p->brush= newlibadr_us(fd, sce->id.lib, p->brush);
+               p->paint_cursor= NULL;
        }
 }
 
@@ -12755,8 +12757,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
 
                                                                append_id_part(fd, mainptr, id, &realid);
                                                                if (!realid) {
-                                                                       BKE_reportf(fd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
-                                                                       if(!G.background && basefd->reports) printf("LIB ERROR: %s:'%s' missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
+                                                                       BKE_reportf(fd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
+                                                                       if(!G.background && basefd->reports) printf("LIB ERROR: %s:'%s' missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
                                                                }
                                                                
                                                                change_idid_adr(mainlist, basefd, id, realid);
@@ -12791,8 +12793,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
                                ID *idn= id->next;
                                if(id->flag & LIB_READ) {
                                        BLI_remlink(lbarray[a], id);
-                                       BKE_reportf(basefd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
-                                       if(!G.background && basefd->reports)printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
+                                       BKE_reportf(basefd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
+                                       if(!G.background && basefd->reports)printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
                                        change_idid_adr(mainlist, basefd, id, NULL);
 
                                        MEM_freeN(id);
index 83678309b452216b5a4f93992d81a97986a21dcc..c91161d8cfd727794b6bbbbd404ca70f64f64bbd 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 # All rights reserved.
index 20a61e9a25cdbf3849f5cb59387a57a3d3175880..696462f3f4685401a7bc27767a2b2458365da25c 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 # All rights reserved.
index 7a994d6b41870e295536a8d4698a1c9d7a333858..d77cd02f9e1665f4b0371257916110cc49ce783d 100644 (file)
@@ -1774,6 +1774,7 @@ public:
 
                for (int a = 0; a < MAX_MTEX; a++) {
                        if (ma->mtex[a] &&
+                               ma->mtex[a]->tex &&
                                ma->mtex[a]->tex->type == TEX_IMAGE &&
                                ma->mtex[a]->texco == TEXCO_UV){
                                indices.push_back(a);
index 3b5f09594dec9fbe777b57116ac4f938e23ed14e..d4cc18d22b62f2dcc679f46262629bba961ab46c 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2008 Blender Foundation.
 # All rights reserved.
index b86e731269872b964beb30ee32a736230c6b0211..91c3a381272ebc99a61dcb723c2846c0a3cefae0 100644 (file)
@@ -14,7 +14,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2006, Blender Foundation
 # All rights reserved.
index e259168a4ef6cb01d10b6560b3a09c70614c1be9..168d919e6defd3a3496efcf918b7bf8b1444db6f 100644 (file)
@@ -17,7 +17,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) Blender Foundation.
 # All rights reserved.
index a7f36aa58ac99a8166b01ffa7becaa3a8ed449ec..f120091e917c1d632b7c3ee0b63e25d925b2b876 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 4838282de92018b0a562fc31cb2d3e3039cf41b9..707ceb5524640c1f6cfea5842a45f22aedd4faf5 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 6449700e50ba7a0cc8437804b4d892d302fb4e75..d9c51c7420e1a4d16eba721d8b4e30a031f08ec2 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 7150070dd6554f9ad10adc41978fc5e58fbd4375..b85429e36a9731069b99db41dfba0a70f763a30b 100644 (file)
@@ -724,7 +724,7 @@ static void calc_shapeKeys(Object *obedit)
                int a, i, j;
                EditNurb *editnurb= cu->editnurb;
                KeyBlock *currkey;
-               KeyBlock *actkey= ob_get_keyblock(obedit);
+               KeyBlock *actkey= BLI_findlink(&cu->key->block, editnurb->shapenr-1);
                BezTriple *bezt, *oldbezt;
                BPoint *bp, *oldbp;
                Nurb *nu;
@@ -738,7 +738,7 @@ static void calc_shapeKeys(Object *obedit)
                        int act_is_basis = 0;
                        /* find if this key is a basis for any others */
                        for(currkey = cu->key->block.first; currkey; currkey= currkey->next) {
-                               if(obedit->shapenr-1 == currkey->relative) {
+                               if(editnurb->shapenr-1 == currkey->relative) {
                                        act_is_basis = 1;
                                        break;
                                }
@@ -806,7 +806,7 @@ static void calc_shapeKeys(Object *obedit)
 
                currkey = cu->key->block.first;
                while(currkey) {
-                       int apply_offset = (ofs && (currkey != actkey) && (obedit->shapenr-1 == currkey->relative));
+                       int apply_offset = (ofs && (currkey != actkey) && (editnurb->shapenr-1 == currkey->relative));
 
                        fp= newkey= MEM_callocN(cu->key->elemsize * totvert,  "currkey->data");
                        ofp= oldkey = currkey->data;
@@ -1035,6 +1035,7 @@ void make_editNurb(Object *obedit)
                }
 
                if(actkey) {
+                       editnurb->shapenr= obedit->shapenr;
                        init_editNurb_keyIndex(editnurb, &cu->nurb);
                }
        }
index d7bb4e7222feb6ac1416085218f9a23bda98a6bb..c76014df60e0cb8961382ac1763887b6966ce29a 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 9bc5f491a83f962eb83337780facdc621d3448ad..f3e781a0369ea76acff674153affc4bbc606d050 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
diff --git a/source/blender/editors/include/ED_lattice.h b/source/blender/editors/include/ED_lattice.h
new file mode 100644 (file)
index 0000000..bebd6c5
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ * 
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+struct Object;
+
+void free_editLatt(struct Object *ob);
+void make_editLatt(struct Object *obedit);
+void load_editLatt(struct Object *obedit);
index 1da51af5e2875770c130ae91950ebb52af5528c0..ced2536b411085a6b6e04863a426e051b32cbd11 100644 (file)
@@ -51,7 +51,7 @@ struct ViewContext;
 
 /* for derivedmesh drawing callbacks, for view3d_select, .... */
 typedef struct ViewContext {
-       Scene *scene;
+       struct Scene *scene;
        struct Object *obact;
        struct Object *obedit;
        struct ARegion *ar;
index 115740a8403caa4b923645ba9e3c46fd05757c33..7b5d4e60fbd2b346b4bc3ec9344785aa1b117117 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 7179ef96dc0ef4cf3f1af21af3a0688a70141747..2a9a1335b1f7fc375f94a9334735ca1368a2376e 100644 (file)
@@ -1146,7 +1146,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *wcol, rcti *rect)
        glColor4fv( &cbd->r );
        glVertex2fv(v1); glVertex2fv(v2);
        
-       for( a = 1; a < sizex; a++ ) {
+       for( a = 1; a <= sizex; a++ ) {
                pos = ((float)a) / (sizex-1);
                do_colorband( coba, pos, colf );
                if (but->block->color_profile != BLI_PR_NONE)
@@ -1163,19 +1163,8 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *wcol, rcti *rect)
        glDisable(GL_BLEND);
        
        /* outline */
-       v1[0]= x1; v1[1]= y1;
-       
-       cpack(0x0);
-       glBegin(GL_LINE_LOOP);
-       glVertex2fv(v1);
-       v1[0]+= sizex;
-       glVertex2fv(v1);
-       v1[1]+= sizey;
-       glVertex2fv(v1);
-       v1[0]-= sizex;
-       glVertex2fv(v1);
-       glEnd();
-       
+       glColor4f(0.0, 0.0, 0.0, 1.0);
+       fdrawbox(x1, y1, x1+sizex, y1+sizey);
        
        /* help lines */
        v1[0]= v2[0]=v3[0]= x1;
@@ -1231,6 +1220,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *wcol, rcti *rect)
                }       
        }
        glEnd();
+
 }
 
 void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
index e1a760628b05b090605ef7dc62f28f23a049c3d2..8dcc204f06f66b5d8943be3e2df85b05073e23f7 100644 (file)
@@ -4262,7 +4262,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
                        return WM_UI_HANDLER_BREAK;
                }
                /* reset to default */
-               else if(event->type == ZEROKEY && event->val == KM_PRESS) {
+               else if(ELEM(event->type, ZEROKEY,PAD0) && event->val == KM_PRESS) {
                        if (!(ELEM3(but->type, HSVCIRCLE, HSVCUBE, HISTOGRAM)))
                                ui_set_but_default(C, but);
                }
index 169ef4e76751dabf7168707944c6d13cd3fe7acd..6e235130a5ccf74d5447b08b1137f90d43f6575f 100644 (file)
@@ -2099,12 +2099,6 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
        /* list item behind label & other buttons */
        sub= uiLayoutRow(overlap, 0);
 
-       if(itemptr->type == &RNA_ShapeKey) {
-               ob= (Object*)activeptr->data;
-               if(ob->mode == OB_MODE_EDIT && !(ob->type == OB_MESH))
-                       uiLayoutSetEnabled(sub, 0);
-       }
-
        but= uiDefButR(block, LISTROW, 0, "", 0,0, UI_UNIT_X*10,UI_UNIT_Y, activeptr, activepropname, 0, 0, i, 0, 0, "");
        uiButSetFlag(but, UI_BUT_NO_TOOLTIP);
 
index 8ae40e1b957a2129ac99d9aae43331911b04896d..be57f72329a6c32dcd4bba0b2b92146409d87099 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 2ba6800b62e7ba5bb4159dffef70f11dd402a724..e6ba228c260a35af696dd6419a7922584577445e 100644 (file)
 
 #include "MEM_guardedalloc.h"
 
-
+#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
 #include "DNA_key_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_modifier_types.h"
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
@@ -41,7 +44,7 @@
 #include "BLI_dynstr.h"
 #include "BLI_rand.h"
 
-#include "BKE_cloth.h"
+#include "BKE_DerivedMesh.h"
 #include "BKE_context.h"
 #include "BKE_depsgraph.h"
 #include "BKE_global.h"
index d971ec9b412e850f6a3bdb4d051cceacd228be5f..c28ef59e9dbc2d3f88af87870c201c474ccbbe23 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 7c081355ed52fac364f024efa3bac66f715cd592..4694653b115eef1808732f2595c2270b96ee1b37 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 8bbe5a1b0ab530a505154020dab49b5482789a9e..36879e43fe2ee0df579630dc1a734699e8816104 100644 (file)
@@ -43,6 +43,9 @@
 #include "DNA_material_types.h"
 #include "DNA_meta_types.h"
 #include "DNA_property_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
+#include "DNA_meshdata_types.h"
 #include "DNA_vfont_types.h"
 
 #include "BLI_blenlib.h"
@@ -54,7 +57,6 @@
 #include "BKE_anim.h"
 #include "BKE_constraint.h"
 #include "BKE_context.h"
-#include "BKE_cloth.h"
 #include "BKE_curve.h"
 #include "BKE_depsgraph.h"
 #include "BKE_font.h"
@@ -76,6 +78,7 @@
 #include "ED_curve.h"
 #include "ED_mesh.h"
 #include "ED_mball.h"
+#include "ED_lattice.h"
 #include "ED_object.h"
 #include "ED_screen.h"
 #include "ED_util.h"
@@ -936,14 +939,15 @@ void special_editmenu(Scene *scene, View3D *v3d)
                static float weight= 1.0f;
                { // XXX
 // XXX         if(fbutton(&weight, 0.0f, 1.0f, 10, 10, "Set Weight")) {
-                       int a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
-                       BPoint *bp= lt->editlatt->def;
+                       Lattice *editlt= lt->editlatt->latt;
+                       int a= editlt->pntsu*editlt->pntsv*editlt->pntsw;
+                       BPoint *bp= editlt->def;
                        
                        while(a--) {
                                if(bp->f1 & SELECT)
                                        bp->weight= weight;
                                bp++;
-                       }       
+                       }
                }
        }
 
index 2ee82a194cc24fc07bd23326a486bbcda62b30ad..75e22d5356fa2f5c412d74e6e30e7daca9b6ccbe 100644 (file)
@@ -191,13 +191,14 @@ static int return_editlattice_indexar(Lattice *editlatt, int *tot, int **indexar
 
 static void select_editlattice_hook(Object *obedit, HookModifierData *hmd)
 {
-       Lattice *lt= obedit->data;
+       Lattice *lt= obedit->data, *editlt;
        BPoint *bp;
        int index=0, nr=0, a;
-       
+
+       editlt= lt->editlatt->latt;
        /* count */
-       a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
-       bp= lt->editlatt->def;
+       a= editlt->pntsu*editlt->pntsv*editlt->pntsw;
+       bp= editlt->def;
        while(a--) {
                if(hmd->indexar[index]==nr) {
                        bp->f1 |= SELECT;
@@ -313,7 +314,7 @@ static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char
                case OB_LATTICE:
                {
                        Lattice *lt= obedit->data;
-                       return return_editlattice_indexar(lt->editlatt, tot, indexar, cent_r);
+                       return return_editlattice_indexar(lt->editlatt->latt, tot, indexar, cent_r);
                }
                default:
                        return 0;
index bd48db2f78080abbc8103e26ff55500bbc00ccaa..ed75c4060a20342e52fdbb6fdb062e5389b35625 100644 (file)
@@ -131,11 +131,6 @@ void OBJECT_OT_hook_reset(struct wmOperatorType *ot);
 void OBJECT_OT_hook_recenter(struct wmOperatorType *ot);
 
 /* object_lattice.c */
-void free_editLatt(struct Object *ob);
-void make_editLatt(struct Object *obedit);
-void load_editLatt(struct Object *obedit);
-void remake_editLatt(struct Object *obedit);
-
 void LATTICE_OT_select_all(struct wmOperatorType *ot);
 void LATTICE_OT_make_regular(struct wmOperatorType *ot);
 
index a1fb10e350eb718556216d13b80f5aa09d25d369..9f82a1209cf9814901ff05f92ce9deab73975fd9 100644 (file)
@@ -46,6 +46,8 @@
 #include "BKE_lattice.h"
 #include "BKE_mesh.h"
 
+#include "BLI_listbase.h"
+
 #include "ED_screen.h"
 #include "ED_view3d.h"
 #include "ED_util.h"
@@ -62,12 +64,16 @@ void free_editLatt(Object *ob)
        Lattice *lt= ob->data;
        
        if(lt->editlatt) {
-               if(lt->editlatt->def)
-                       MEM_freeN(lt->editlatt->def);
-               if(lt->editlatt->dvert) 
-                       free_dverts(lt->editlatt->dvert, lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw);
-               
+               Lattice *editlt= lt->editlatt->latt;
+
+               if(editlt->def)
+                       MEM_freeN(editlt->def);
+               if(editlt->dvert)
+                       free_dverts(editlt->dvert, editlt->pntsu*editlt->pntsv*editlt->pntsw);
+
+               MEM_freeN(editlt);
                MEM_freeN(lt->editlatt);
+
                lt->editlatt= NULL;
        }
 }
@@ -76,47 +82,51 @@ void make_editLatt(Object *obedit)
 {
        Lattice *lt= obedit->data;
        KeyBlock *actkey;
-       
+
        free_editLatt(obedit);
-       
+
        lt= obedit->data;
 
        actkey= ob_get_keyblock(obedit);
        if(actkey)
                key_to_latt(actkey, lt);
 
-       lt->editlatt= MEM_dupallocN(lt);
-       lt->editlatt->def= MEM_dupallocN(lt->def);
-       
+       lt->editlatt= MEM_callocN(sizeof(EditLatt), "editlatt");
+       lt->editlatt->latt= MEM_dupallocN(lt);
+       lt->editlatt->latt->def= MEM_dupallocN(lt->def);
+
        if(lt->dvert) {
                int tot= lt->pntsu*lt->pntsv*lt->pntsw;
-               lt->editlatt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
-               copy_dverts(lt->editlatt->dvert, lt->dvert, tot);
+               lt->editlatt->latt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
+               copy_dverts(lt->editlatt->latt->dvert, lt->dvert, tot);
        }
+
+       if(lt->key) lt->editlatt->shapenr= obedit->shapenr;
 }
 
 void load_editLatt(Object *obedit)
 {
-       Lattice *lt;
+       Lattice *lt, *editlt;
        KeyBlock *actkey;
        BPoint *bp;
        float *fp;
        int tot;
-       
+
        lt= obedit->data;
-       
-       actkey= ob_get_keyblock(obedit);
+       editlt= lt->editlatt->latt;
+
+       if(lt->editlatt->shapenr) {
+               actkey= BLI_findlink(&lt->key->block, lt->editlatt->shapenr-1);
 
-       if(actkey) {
                /* active key: vertices */
-               tot= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
+               tot= editlt->pntsu*editlt->pntsv*editlt->pntsw;
                
                if(actkey->data) MEM_freeN(actkey->data);
                
                fp=actkey->data= MEM_callocN(lt->key->elemsize*tot, "actkey->data");
                actkey->totelem= tot;
-       
-               bp= lt->editlatt->def;
+
+               bp= editlt->def;
                while(tot--) {
                        VECCOPY(fp, bp->vec);
                        fp+= 3;
@@ -125,30 +135,30 @@ void load_editLatt(Object *obedit)
        }
        else {
                MEM_freeN(lt->def);
-       
-               lt->def= MEM_dupallocN(lt->editlatt->def);
 
-               lt->flag= lt->editlatt->flag;
+               lt->def= MEM_dupallocN(editlt->def);
 
-               lt->pntsu= lt->editlatt->pntsu;
-               lt->pntsv= lt->editlatt->pntsv;
-               lt->pntsw= lt->editlatt->pntsw;
+               lt->flag= editlt->flag;
+
+               lt->pntsu= editlt->pntsu;
+               lt->pntsv= editlt->pntsv;
+               lt->pntsw= editlt->pntsw;
                
-               lt->typeu= lt->editlatt->typeu;
-               lt->typev= lt->editlatt->typev;
-               lt->typew= lt->editlatt->typew;
+               lt->typeu= editlt->typeu;
+               lt->typev= editlt->typev;
+               lt->typew= editlt->typew;
        }
-       
+
        if(lt->dvert) {
                free_dverts(lt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
                lt->dvert= NULL;
        }
-       
-       if(lt->editlatt->dvert) {
+
+       if(editlt->dvert) {
                int tot= lt->pntsu*lt->pntsv*lt->pntsw;
-               
+
                lt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
-               copy_dverts(lt->dvert, lt->editlatt->dvert, tot);
+               copy_dverts(lt->dvert, editlt->dvert, tot);
        }
 }
 
@@ -160,9 +170,9 @@ void ED_setflagsLatt(Object *obedit, int flag)
        BPoint *bp;
        int a;
        
-       bp= lt->editlatt->def;
+       bp= lt->editlatt->latt->def;
        
-       a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
+       a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
        
        while(a--) {
                if(bp->hide==0) {
@@ -183,8 +193,8 @@ int select_all_exec(bContext *C, wmOperator *op)
        if (action == SEL_TOGGLE) {
                action = SEL_SELECT;
 
-               bp= lt->editlatt->def;
-               a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
+               bp= lt->editlatt->latt->def;
+               a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
 
                while(a--) {
                        if(bp->hide==0) {
@@ -205,8 +215,8 @@ int select_all_exec(bContext *C, wmOperator *op)
                ED_setflagsLatt(obedit, 0);
                break;
        case SEL_INVERT:
-               bp= lt->editlatt->def;
-               a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
+               bp= lt->editlatt->latt->def;
+               a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
 
                while(a--) {
                        if(bp->hide==0) {
@@ -256,7 +266,7 @@ int make_regular_exec(bContext *C, wmOperator *op)
        
        if(ob) {
                lt= ob->data;
-               resizelattice(lt->editlatt, lt->pntsu, lt->pntsv, lt->pntsw, NULL);
+               resizelattice(lt->editlatt->latt, lt->pntsu, lt->pntsv, lt->pntsw, NULL);
        }
        else {
                ob= CTX_data_active_object(C);
@@ -354,21 +364,21 @@ typedef struct UndoLattice {
 static void undoLatt_to_editLatt(void *data, void *edata)
 {
        UndoLattice *ult= (UndoLattice*)data;
-       Lattice *editlatt= (Lattice *)edata;
-       int a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw;
+       EditLatt *editlatt= (EditLatt *)edata;
+       int a= editlatt->latt->pntsu*editlatt->latt->pntsv*editlatt->latt->pntsw;
 
-       memcpy(editlatt->def, ult->def, a*sizeof(BPoint));
+       memcpy(editlatt->latt->def, ult->def, a*sizeof(BPoint));
 }
 
 static void *editLatt_to_undoLatt(void *edata)
 {
        UndoLattice *ult= MEM_callocN(sizeof(UndoLattice), "UndoLattice");
-       Lattice *editlatt= (Lattice *)edata;
+       EditLatt *editlatt= (EditLatt *)edata;
        
-       ult->def= MEM_dupallocN(editlatt->def);
-       ult->pntsu= editlatt->pntsu;
-       ult->pntsv= editlatt->pntsv;
-       ult->pntsw= editlatt->pntsw;
+       ult->def= MEM_dupallocN(editlatt->latt->def);
+       ult->pntsu= editlatt->latt->pntsu;
+       ult->pntsv= editlatt->latt->pntsv;
+       ult->pntsw= editlatt->latt->pntsw;
        
        return ult;
 }
@@ -384,11 +394,11 @@ static void free_undoLatt(void *data)
 static int validate_undoLatt(void *data, void *edata)
 {
        UndoLattice *ult= (UndoLattice*)data;
-       Lattice *editlatt= (Lattice *)edata;
+       EditLatt *editlatt= (EditLatt *)edata;
 
-       return (ult->pntsu == editlatt->pntsu &&
-                       ult->pntsv == editlatt->pntsv &&
-                       ult->pntsw == editlatt->pntsw);
+       return (ult->pntsu == editlatt->latt->pntsu &&
+                       ult->pntsv == editlatt->latt->pntsv &&
+                       ult->pntsw == editlatt->latt->pntsw);
 }
 
 static void *get_editlatt(bContext *C)
index 23bcf5309c5489f9d3faa92a23f5120d2243e14b..6e9244e39cab69f652e9a5056c5a7e59e4899dde 100644 (file)
@@ -172,8 +172,8 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
        else if(obedit->type==OB_LATTICE) {
                Lattice *lt= obedit->data;
                
-               a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
-               bp= lt->editlatt->def;
+               a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
+               bp= lt->editlatt->latt->def;
                while(a--) {
                        if(bp->f1 & SELECT) {
                                if(v1==0) v1= nr;
index 86f0c5fa874915cdebf97fb8c96ca36a027e3d65..5cdabcab41ab4dd338450645ee37bf2af367d2eb 100644 (file)
@@ -73,7 +73,7 @@ static Lattice *vgroup_edit_lattice(Object *ob)
 {
        if(ob->type==OB_LATTICE) {
                Lattice *lt= ob->data;
-               return (lt->editlatt)? lt->editlatt: lt;
+               return (lt->editlatt)? lt->editlatt->latt: lt;
        }
 
        return NULL;
@@ -169,7 +169,7 @@ int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_tot)
                                int i=0;
 
                                Lattice *lt= (Lattice *)id;
-                               lt= (lt->editlatt)? lt->editlatt: lt;
+                               lt= (lt->editlatt)? lt->editlatt->latt: lt;
 
                                *dvert_tot= lt->pntsu*lt->pntsv*lt->pntsw;
                                *dvert_arr= MEM_mallocN(sizeof(void*)*(*dvert_tot), "vgroup parray from me");
@@ -203,7 +203,7 @@ int ED_vgroup_give_array(ID *id, MDeformVert **dvert_arr, int *dvert_tot)
                        case ID_LT:
                        {
                                Lattice *lt= (Lattice *)id;
-                               lt= (lt->editlatt)? lt->editlatt: lt;
+                               lt= (lt->editlatt)? lt->editlatt->latt: lt;
                                *dvert_arr= lt->dvert;
                                *dvert_tot= lt->pntsu*lt->pntsv*lt->pntsw;
                                return TRUE;
index e9260b66087737eb3a1df1b589c6293141109b45..9ffc3a5b37271924e40460924880388b64ac8a04 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 85b70172e0a0062db56e39fd603ed3eb0d8b170b..510e5372e22ae3de1ac5e9fc46ee64465c618e93 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 23c9d130eec1f6655b80c883f4badaa6506e5edd..2ab35a328888860bd978a37731e1aecf831e0780 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 012a39b8d253614c594502c0bb9d5306eacaf73c..f9f39fea7ebab389b34129289eadb01fe29f02d4 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index b7ebee91e76588f21ccd534c349f0e8d6079f8eb..198ec4fee3bfe80caf0bcd28d5cd81e2ce14b7bb 100644 (file)
 #include "DNA_armature_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_particle_types.h"
+#include "DNA_scene_types.h"
 #include "DNA_brush_types.h"
+#include "DNA_object_types.h"
+#include "DNA_meshdata_types.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
 
+#include "BKE_DerivedMesh.h"
 #include "BKE_action.h"
 #include "BKE_brush.h"
-#include "BKE_cloth.h"
 #include "BKE_context.h"
 #include "BKE_depsgraph.h"
 #include "BKE_deform.h"
index 10145035eb4b674461e180a752adc21d7a88e922..211fcfb9a4c4540d66c2362ec0260af976d38410 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index e856587accad4f97afeea2d5bdbf8ae46c7215ae..19aeb54cc2f23f86e9dcdec5e57298e3655df29a 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 474fbe890537e2d1eda929dcb8e7ddf1cbe60b47..deaa46a95823c8729105a222cb8a053066c391be 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index a4894ede06b69458387476de8120da4ab2dd8116..28758fb168b046685655b15297815647a997ad76 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 3f760b1ad676ece9ecf35bb01ab68f5aedbdfd9d..4ae157507e0d32624b337f18d839a99df59d2349 100644 (file)
@@ -17,7 +17,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2009 Blender Foundation
 # All rights reserved.
index f5d913e9f3255ff2a80283f21db0fd75d7ed1376..4ee69bbd809cc08b51b660723a9b835934622906 100644 (file)
 
 #include "MEM_guardedalloc.h"
 
-#include "BLO_readfile.h" /* get the ID name for dnd*/
-
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
 
 #include "BKE_context.h"
 #include "BKE_screen.h"
+#include "BKE_idcode.h"
 
 #include "ED_screen.h"
 
@@ -177,7 +176,7 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop)
        char text[64];
        ID *id= drag->poin;
 
-       snprintf(text, sizeof(text), "bpy.data.%s['%s']", BLO_idcode_to_name_plural(GS(id->name)), id->name+2); 
+       snprintf(text, sizeof(text), "bpy.data.%s['%s']", BKE_idcode_to_name_plural(GS(id->name)), id->name+2); 
 
        /* copy drag path to properties */
        RNA_string_set(drop->ptr, "text", text);
index 48f6879b02934c1799ebc27a072fcae8e2915f51..1fc27795f081787ed7d58626b6ad3dfff8428437 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 22c5270ae6ddec35accc4dd4abfbc9a066cf32b8..f25fab45c7cc828b28484e1e311fd6dd8a19903d 100644 (file)
@@ -426,21 +426,25 @@ static void renamebutton_cb(bContext *C, void *arg1, char *oldname)
        SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
        ARegion* ar = CTX_wm_region(C);
 
+#if 0
        struct direntry *file = (struct direntry *)arg1;
+#endif
 
        BLI_make_file_string(G.sce, orgname, sfile->params->dir, oldname);
-       BLI_strncpy(filename, file->relname, sizeof(filename));
+       BLI_strncpy(filename, sfile->params->renameedit, sizeof(filename));
        BLI_make_file_string(G.sce, newname, sfile->params->dir, filename);
 
        if( strcmp(orgname, newname) != 0 ) {
                if (!BLI_exists(newname)) {
                        BLI_rename(orgname, newname);
                        /* to make sure we show what is on disk */
+#if 0          /* this is cleared anyway, no need */
+                       MEM_freeN(file->relname);
+                       file->relname= BLI_strdup(sfile->params->renameedit);
+#endif
                        ED_fileselect_clear(C, sfile);
-               } else {
-                       BLI_strncpy(file->relname, oldname, strlen(oldname)+1);
                }
-               
+
                ED_region_tag_redraw(ar);
        }
 }
@@ -535,7 +539,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
                        int but_width = (FILE_IMGDISPLAY == params->display) ? layout->tile_w : layout->column_widths[COLUMN_NAME];
 
                        uiBut *but = uiDefBut(block, TEX, 1, "", spos, sy-layout->tile_h-3, 
-                               but_width, layout->textheight*2, file->relname, 1.0f, (float)FILE_MAX,0,0,"");
+                               but_width, layout->textheight*2, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit),0,0,"");
                        uiButSetRenameFunc(but, renamebutton_cb, file);
                        if ( 0 == uiButActiveOnly(C, block, but)) {
                                file->flags &= ~EDITING;
index 2664082b20b1de450eb943cd99c2e7e22fb1585e..c3bea2a5bea4f1c59a031365d799cb0cb122b7a3 100644 (file)
@@ -57,6 +57,7 @@
 #include "BKE_main.h"
 #include "BKE_report.h"
 #include "BLO_readfile.h"
+#include "BKE_idcode.h"
 
 #include "DNA_space_types.h"
 
@@ -881,7 +882,7 @@ static int groupname_to_code(char *group)
        if (lslash)
                lslash[0]= '\0';
 
-       return BLO_idcode_from_name(buf);
+       return BKE_idcode_from_name(buf);
 }
 
 void filelist_from_library(struct FileList* filelist)
index 659763921c72354f6cff7d5c01c2ae7f5103a68d..0dbd10483487acb9873f188f9bfa52ac25c6c6dd 100644 (file)
@@ -62,8 +62,6 @@
 #include "BLI_storage_types.h"
 #include "BLI_dynstr.h"
 
-#include "BLO_readfile.h"
-
 #include "BKE_context.h"
 #include "BKE_global.h"
 
@@ -206,6 +204,13 @@ short ED_fileselect_set_params(SpaceFile *sfile)
                params->filter = 0;
                params->sort = FILE_SORT_ALPHA;
        }
+
+
+       /* initialize the list with previous folders */
+       if (!sfile->folders_prev)
+               sfile->folders_prev = folderlist_new();
+       folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
+
        return 1;
 }
 
index 2f023aeebc1a5e9b83a1b223bd010a35c6eaabfc..7b9423332f2ececfe44daef54cd0e6e3d68c8c4d 100644 (file)
@@ -232,6 +232,7 @@ static void file_refresh(const bContext *C, ScrArea *sa)
                                file->flags |= EDITING;
                        }
                }
+               BLI_strncpy(sfile->params->renameedit, sfile->params->renamefile, sizeof(sfile->params->renameedit));
                params->renamefile[0] = '\0';
        }
        if (sfile->layout) sfile->layout->dirty= 1;
index 65cdf1a3ffb99cf4b70adb9d6321af4ce0085dbf..633242355f052280b67a13a3fd142679708b2297 100644 (file)
@@ -17,7 +17,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 1838b9ce73da2228b9ee8e1bff23f81d11848155..773a69209611973786c34f6586e0b49b98caa06a 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index be2782ab25c171e85fd84088d5b2ff4dc9c3f001..314d5dd904361e6c0329d508ffe7bc4c7d36138c 100644 (file)
@@ -739,7 +739,22 @@ static int open_exec(bContext *C, wmOperator *op)
 static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
        SpaceImage *sima= CTX_wm_space_image(C);
-       char *path= (sima && sima->image)? sima->image->name: U.textudir;
+       char *path=U.textudir;
+       Image *ima= NULL;
+
+       if(sima) {
+                ima= sima->image;
+       }
+
+       if (ima==NULL) {
+                Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+                if(tex && tex->type==TEX_IMAGE)
+                        ima= tex->ima;
+       }
+
+       if(ima)
+               path= ima->name;
+       
 
        if(!RNA_property_is_set(op->ptr, "relative_path"))
                RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
index 931c2f2097c9213b3f1ef55b0ecdf82c5a029608..46feeec86136bc8389d85bce2dca83cfa690fac3 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 693cac01f07dfcb674c3db2987156d3868489e75..0789114c054023e0774f5e74344a663cf96551e6 100644 (file)
@@ -225,7 +225,7 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
        else if(obedit->type==OB_LATTICE) {
                /* Lattice Edit */
                Lattice *lt= obedit->data;
-               Lattice *editlatt= lt->editlatt;
+               Lattice *editlatt= lt->editlatt->latt;
                BPoint *bp;
                int a;
 
index 90cd73bd62a4530be9ed8c905a79aefedb22308e..9b72e132be8f08023dfaae895d9f65f310915aa6 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 723227a36e481aab4b86eb6233c4890886d46455..798c7639d7e7bc4de0c61758bf8a2be567734efe 100644 (file)
@@ -3929,7 +3929,7 @@ static void draw_actuator_filter_2d(uiLayout *layout, PointerRNA *ptr)
                        split=uiLayoutSplit(layout, 0.75, 1);
                        row= uiLayoutRow(split, 0);
                        uiLayoutSetActive(row, RNA_boolean_get(ptr, "enable_motion_blur")==1);
-                       uiItemR(row, ptr, "motion_blur_value", 0, NULL, 0);
+                       uiItemR(row, ptr, "motion_blur_factor", 0, NULL, 0);
                        uiItemR(split, ptr, "enable_motion_blur", UI_ITEM_R_TOGGLE, NULL, 0);
                        break;
                default: // all other 2D Filters
index d7c9477dc83574feeca4ddb9d239a2235a4c7606..fd940081c16977c96ed5aa263975bf1649ae2e08 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 5bd6e95e28c14bc8870a902bad3f727efc9e1838..6c12149a43f4e69f2ba6cbe0d218959d6b9415eb 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 8d7cd017e0bec1148923f5455d06f0dac67df6c9..bd6725c5b710d98565991ad2a8eed569fbfc6f12 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 3322cb61a7f821b6cd4833e8f6868ee15f707f59..35462b8c25517d2df32f196ccf6bdf5cb8b9fbac 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 2fb3de516b476b24666e5001877fa7977b44257e..bb1cbdf1cd3b9dc45bbaf979e75f1d99509ea8a2 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index a072684d543cfc0ec35f94e3f0bec25ca58068c4..03764c97a96aea64af8489405c7ac7c524afb6f6 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 50871017085be58a89b6a45da8ac544f047dd965..8bc12852e182585fc0d0ca805695a5396cd3fa06 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 926ccc1914ab79dbf5a43f0ec3942cceb4053acd..6fbfc463c451a55cd1ee1daf396b51abc3a67180 100644 (file)
@@ -1101,6 +1101,20 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
                }
        }
 
+       if(st->line_hlight) {
+               /* TODO, dont draw if hidden */
+               int x1= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
+               int x2= x1 + ar->winx;
+               y= ar->winy-2 - vsell*st->lheight;
+
+               glColor4ub(255, 255, 255, 32);
+               
+               glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+               glEnable(GL_BLEND);
+               glRecti(x1, y, x2, y-st->lheight+1);
+               glDisable(GL_BLEND);
+       }
+       
        if(!hidden) {
                /* Draw the cursor itself (we draw the sel. cursor as this is the leading edge) */
                x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
@@ -1288,7 +1302,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
        }
        y= ar->winy-st->lheight;
        winx= ar->winx - TXT_SCROLL_WIDTH;
-
+       
        /* draw cursor */
        draw_cursor(st, ar);
 
index e0bf3943dd89215f54f2c2d6ee4ba5410160eb7a..958c3018f82271906dcb203182b700e60e93e71a 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index be7206f51cef4f7d7b055b5051e7064e12f0686b..8510c355ab49f68e0acbfa9221900af0e352ed1e 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index 9204f2482c6542df309297418f4814ccb1958e30..58d88194c2288fc334a9001a601f7298fb6ba40c 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2007 Blender Foundation
 # All rights reserved.
index fe055f194f6630ee0c346b53733c2455bd301da9..372ac97634205ba145ff10818fd6086c5085ad94 100644 (file)
@@ -42,6 +42,7 @@
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_view3d_types.h"
+#include "DNA_object_types.h"
 
 #include "BKE_DerivedMesh.h"
 #include "BKE_effect.h"
index d8c4a38e2aae50100e7c42a9801cb8426e3f4c3a..e23276cecad80a18d941d36163b799fc0c7768bc 100644 (file)
@@ -1357,10 +1357,10 @@ void lattice_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, BPo
 {
        Object *obedit= vc->obedit;
        Lattice *lt= obedit->data;
-       BPoint *bp = lt->editlatt->def;
+       BPoint *bp = lt->editlatt->latt->def;
        DispList *dl = find_displist(&obedit->disp, DL_VERTS);
        float *co = dl?dl->verts:NULL;
-       int i, N = lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
+       int i, N = lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
        short s[2] = {IS_CLIPPED, 0};
 
        ED_view3d_local_clipping(vc->rv3d, obedit->obmat); /* for local clipping lookups */
@@ -1408,7 +1408,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
        dl= find_displist(&ob->disp, DL_VERTS);
        
        if(is_edit) {
-               lt= lt->editlatt;
+               lt= lt->editlatt->latt;
 
                cpack(0x004000);
                
index 5f3565c10885274a6367bc7285185be0805d4c13..e6c8ff2c2687f9bcfeb2ef32e2f9d493a4a479c8 100644 (file)
@@ -255,8 +255,8 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d
                BPoint *bp;
                int a;
                
-               a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
-               bp= lt->editlatt->def;
+               a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
+               bp= lt->editlatt->latt->def;
                while(a--) {
                        if(bp->f1 & SELECT) {
                                add_v3_v3(median, bp->vec);
@@ -457,8 +457,8 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d
                        BPoint *bp;
                        int a;
                        
-                       a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
-                       bp= lt->editlatt->def;
+                       a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
+                       bp= lt->editlatt->latt->def;
                        while(a--) {
                                if(bp->f1 & SELECT) {
                                        add_v3_v3(bp->vec, median);
index 5f61fac07275ae5237c916f2a305e681de9a1054..aa7e0e51caefcfd1acd167e2c806a04a8e22d6ca 100644 (file)
@@ -31,6 +31,7 @@
 #include <stdlib.h>
 
 #include "DNA_scene_types.h"
+#include "DNA_object_types.h"
 
 #include "RNA_access.h"
 
index fd78c8298e9ff7308f50d849680d519df170ca66..173d825626903db5984bba371e2e7d8488146dba 100644 (file)
@@ -102,9 +102,9 @@ void draw_motion_paths_cleanup(Scene *scene, View3D *v3d, struct ARegion *ar);
 
 /* drawobject.c */
 void draw_object(Scene *scene, struct ARegion *ar, View3D *v3d, Base *base, int flag);
-int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt);
-void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, int dt, int outline);
-void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob);
+int draw_glsl_material(Scene *scene, struct Object *ob, View3D *v3d, int dt);
+void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, int dt, int outline);
+void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob);
 void drawaxes(float size, int flag, char drawtype);
 
 void view3d_cached_text_draw_begin(void);
@@ -117,7 +117,7 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
 int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, int flag);
 
 /* drawmesh.c */
-void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, struct DerivedMesh *dm, int faceselect);
+void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, struct DerivedMesh *dm, int faceselect);
 
 /* view3d_draw.c */
 void view3d_main_area_draw(const struct bContext *C, struct ARegion *ar);
@@ -154,7 +154,7 @@ int boundbox_clip(RegionView3D *rv3d, float obmat[][4], struct BoundBox *bb);
 
 void centerview(struct ARegion *ar, View3D *v3d);
 
-void smooth_view(struct bContext *C, Object *, Object *, float *ofs, float *quat, float *dist, float *lens);
+void smooth_view(struct bContext *C, struct Object *, struct Object *, float *ofs, float *quat, float *dist, float *lens);
 
 void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect); /* rect: for picking */
 void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d);
@@ -174,7 +174,7 @@ void view3d_toolshelf_register(struct ARegionType *art);
 void view3d_tool_props_register(struct ARegionType *art);
 
 /* view3d_snap.c */
-int minmax_verts(Object *obedit, float *min, float *max);
+int minmax_verts(struct Object *obedit, float *min, float *max);
 
 void VIEW3D_OT_snap_selected_to_grid(struct wmOperatorType *ot);
 void VIEW3D_OT_snap_selected_to_cursor(struct wmOperatorType *ot);
index 35c4d10cb94c5f68a88ade65f6e7f709596819a5..a4e893a61813e056fafdd5d69d7c834caed29338 100644 (file)
@@ -145,8 +145,8 @@ static void special_transvert_update(Scene *scene, Object *obedit)
                else if(obedit->type==OB_LATTICE) {
                        Lattice *lt= obedit->data;
                        
-                       if(lt->editlatt->flag & LT_OUTSIDE) 
-                               outside_lattice(lt->editlatt);
+                       if(lt->editlatt->latt->flag & LT_OUTSIDE)
+                               outside_lattice(lt->editlatt->latt);
                }
        }
 }
@@ -372,9 +372,9 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
        else if(obedit->type==OB_LATTICE) {
                Lattice *lt= obedit->data;
                
-               bp= lt->e